@xopcai/xopc 0.0.230 → 0.0.232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
- package/dist/extensions/telegram/src/config-schema.d.ts +4 -4
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/gateway/static/root/assets/{activity-store-M0nAY5XB.js → activity-store-VXCWz43N.js} +1 -1
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-BXRaZYW8.js +1 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-dR7HMaRX.js +1 -0
- package/dist/gateway/static/root/assets/agents-Bileycwe.js +1 -0
- package/dist/gateway/static/root/assets/api-wGPgL8xY.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CwAPK4Jm.js → app-management-settings-panel-BJfClfPx.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DsGLvqTb.js → appearance-settings-C_R0vUAu.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Ee9qOQEx.js → apps-page-CBow8pBI.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DnFHkSHE.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B4qqigAQ.js → attachment-load-DZrEwytM.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-B8ImehSW.js → automations-page-DpkKajui.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBntVWgv.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DaJbyYc2.js → binary-plugins-Ckc_Csue.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Kl25XWJc.js → block-editor-DAC6w-iV.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DrsMd-Po.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-BGd7R8GO.js +1 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-DjMxs33B.js → browser-workflows-page-DUfj7ntM.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-97gkGeSV.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CuBsz8UI.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-CfboECLt.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BiU_4Rq6.js → chat-terminal-dock-CA9fndbZ.js} +2 -2
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +1 -0
- package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-SuL7td7Z.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CqPu7HYJ.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-C8dJsCgk.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Iz2wYimy.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-ux9DxchT.js → desktop-pet-C3h40FmG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BVVCBgYK.js → desktop-pet-settings-YfeVVzLe.js} +1 -1
- package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Dh6DDuvQ.js → extension-debug-page-CChgztz_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-8OKQDEat.js → extension-page-DF6ct6_y.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-jgBsjn0F.js +1 -0
- package/dist/gateway/static/root/assets/files-Dp8_uGTO.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-Dlc6eaTG.js → gateway-config-api-CVajuIGL.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BGQn8duh.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-DqQgiAUv.js → gateway-settings-BbssNGid.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-D2Rnh9fX.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CJtXu8iD.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Be1o1AXQ.js +1 -0
- package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-YKP2me5Z.js → image-generation-api-D7W2p5_8.js} +1 -1
- package/dist/gateway/static/root/assets/index-B2OJSXX9.js +70 -0
- package/dist/gateway/static/root/assets/index-rHjAElxG.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BSFNqxzY.js → keyboard-shortcuts-settings-BvHYyNus.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-COfelgk7.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DzU6yZ9-.js → local-apps-page-Cb8t2wWM.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-DLwVxS3V.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DA8oDjeB.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B8Jie4-J.js +1 -0
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
- package/dist/gateway/static/root/assets/markdown-split-BD1r4o2i.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DvM5PWEH.js → markdown-view-B-BHEcNd.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-B1bGSQqt.css +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-B8vMe5VX.js → media-plugins-BCev8fkW.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Dp1OxSKt.js +3 -0
- package/dist/gateway/static/root/assets/mobile-device-api-DACoHhhk.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-C8zjqmIv.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-BFsOGYkd.js → notes-api-DEdNKw0I.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-B-YZ7iuK.js → notes-page-BBTLjJwa.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DICgUGPv.js +4 -0
- package/dist/gateway/static/root/assets/oauth-api-BNCO2YK5.js +1 -0
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DkWcyki5.js → product-open-page-fEBbRekH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CqdkznYJ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-dHDXpMCg.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-Cvr4Qm7N.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-2feZudJw.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bq_ETeal.js → runtime-tools-settings-panel-BT5B74IH.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BogTlrsP.js → schema-form-C4tB34S5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CO2JCFdy.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DxMVaqdn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Coy1Cbp6.js → settings-form-section-D1oXhkgI.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CldfX6FJ.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-c3LJnbvE.js +1 -0
- package/dist/gateway/static/root/assets/settings-shell-layer-context-DCp6ykjQ.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-DZNHb6A5.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-DptCK_mk.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-DakZ2AGN.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BOiNkWJC.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-Brxb6QnW.js → skills-page-OHBeBtSg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-FB5LtEGm.js → skills-page.utils-B9WZbOLC.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-ChosWt8n.js → system-settings-panel-Dj_DpOGw.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D5Nbe3C8.js +1 -0
- package/dist/gateway/static/root/assets/theme-store-Cpd3Gd5R.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-2SqnmSKD.js → use-autosave-DCl5Yq7N.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-CAPSUK8B.js +1 -0
- package/dist/gateway/static/root/assets/{vendor-codemirror-DRr7hFaD.js → vendor-codemirror--gTq3YAI.js} +16 -16
- package/dist/gateway/static/root/assets/voice-api-key-field-BB_ZQV8F.js +1 -0
- package/dist/gateway/static/root/assets/voice-config-api-BNiYmpl5.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CK3aZDdE.js → work-discovery-overlay-BrIdtdum.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BjOuddkX.js → workflow-run-setup-panel-hKh-uCLo.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-ahDvypGO.js +5 -0
- package/dist/gateway/static/root/index.html +19 -15
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -2
- package/dist/src/agent/agent-manager.js +29 -44
- package/dist/src/agent/background-review/run-background-review.js +10 -15
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/mcp-provider.js +3 -13
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +13 -14
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -9
- package/dist/src/agent/mcp/bundle-mcp-policy.js +1 -13
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +1 -1
- package/dist/src/{agent-runtime/memory-runtime.d.ts → agent/memory/runtime.d.ts} +1 -1
- package/dist/src/{agent-runtime/memory-runtime.js → agent/memory/runtime.js} +2 -3
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -3
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +5 -3
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/starter-agents.js +1 -8
- package/dist/src/agent/tools/executor.d.ts +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -5
- package/dist/src/agent/tools/write.js +9 -12
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-config/index.d.ts +2 -0
- package/dist/src/agent-config/index.js +11 -0
- package/dist/src/agent-config/resolver.d.ts +11 -0
- package/dist/src/agent-config/resolver.js +113 -0
- package/dist/src/agent-config/schema.d.ts +491 -0
- package/dist/src/agent-config/schema.js +172 -0
- package/dist/src/auth/oauth/index.js +2 -2
- package/dist/src/auth/oauth/registry.d.ts +1 -1
- package/dist/src/auth/oauth/registry.js +5 -1
- package/dist/src/auth/oauth/xopc-cloud.d.ts +1 -0
- package/dist/src/auth/oauth/xopc-cloud.js +8 -2
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/cli/commands/agents.js +2 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +12 -4
- package/dist/src/cli/commands/image.js +3 -4
- package/dist/src/cli/commands/models.js +9 -3
- package/dist/src/cli/commands/onboard/model.js +12 -11
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -18
- package/dist/src/cli/utils/init-workspace-core.d.ts +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/commands/agents.config.d.ts +1 -3
- package/dist/src/commands/agents.config.js +9 -26
- package/dist/src/config/agent-model-intents.d.ts +10 -0
- package/dist/src/config/agent-model-intents.js +39 -0
- package/dist/src/config/agent-profile.d.ts +7 -9
- package/dist/src/config/agent-profile.js +30 -28
- package/dist/src/config/default-model.d.ts +1 -11
- package/dist/src/config/default-model.js +3 -11
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/integration.d.ts +1 -1
- package/dist/src/config/reload.js +1 -1
- package/dist/src/config/rules.js +3 -3
- package/dist/src/config/schema.d.ts +187 -452
- package/dist/src/config/schema.js +53 -131
- package/dist/src/extensions/activation-context.js +7 -11
- package/dist/src/files/file-service.d.ts +36 -0
- package/dist/src/files/file-service.js +282 -0
- package/dist/src/gateway/agent-builtin-tools.d.ts +250 -6
- package/dist/src/gateway/agent-builtin-tools.js +284 -46
- package/dist/src/gateway/agents-admin.d.ts +20 -62
- package/dist/src/gateway/agents-admin.js +36 -228
- package/dist/src/gateway/device-routes.d.ts +3 -0
- package/dist/src/gateway/device-routes.js +47 -0
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -20
- package/dist/src/gateway/global-defaults-admin.js +20 -120
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +6 -4
- package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
- package/dist/src/gateway/hono/lib/config-payload.js +2 -4
- package/dist/src/gateway/hono/middleware/auth.js +33 -1
- package/dist/src/gateway/hono/middleware/scopes.d.ts +2 -12
- package/dist/src/gateway/hono/middleware/scopes.js +9 -18
- package/dist/src/gateway/hono/routes/agents.js +64 -100
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/device-push.d.ts +2 -0
- package/dist/src/gateway/hono/routes/{mobile.js → device-push.js} +40 -18
- package/dist/src/gateway/hono/routes/devices.d.ts +4 -0
- package/dist/src/gateway/hono/routes/devices.js +214 -0
- package/dist/src/gateway/hono/routes/files.d.ts +3 -0
- package/dist/src/gateway/hono/routes/files.js +176 -0
- package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +12 -20
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +0 -508
- package/dist/src/gateway/hono/routes/realtime.js +8 -1
- package/dist/src/gateway/hono/routes/shares.js +410 -21
- package/dist/src/gateway/hono/routes/status.js +9 -16
- package/dist/src/gateway/hono/routes/tunnel.d.ts +0 -2
- package/dist/src/gateway/hono/routes/tunnel.js +10 -199
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +15 -974
- package/dist/src/gateway/image-generation-setup.d.ts +2 -2
- package/dist/src/gateway/image-generation-setup.js +8 -7
- package/dist/src/gateway/public-url.d.ts +1 -1
- package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
- package/dist/src/gateway/security/gateway-principal.js +12 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
- package/dist/src/gateway/security/gateway-scopes.js +66 -0
- package/dist/src/gateway/security/index.d.ts +2 -1
- package/dist/src/gateway/security/index.js +3 -2
- package/dist/src/gateway/service.js +4 -4
- package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/migrations/index.d.ts +0 -1
- package/dist/src/migrations/index.js +1 -2
- package/dist/src/migrations/runner.js +1 -2
- package/dist/src/notifications/device-store.d.ts +1 -1
- package/dist/src/notifications/device-store.js +11 -11
- package/dist/src/notifications/store.js +3 -3
- package/dist/src/providers/index.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +14 -9
- package/dist/src/realtime/runtime.d.ts +2 -0
- package/dist/src/realtime/runtime.js +27 -3
- package/dist/src/realtime/tickets.d.ts +6 -1
- package/dist/src/realtime/tickets.js +2 -1
- package/dist/src/remote-access/exposure-manager.js +3 -3
- package/dist/src/share/hosted-session-share.d.ts +104 -0
- package/dist/src/share/hosted-session-share.js +276 -0
- package/dist/src/share/note-share-service.js +4 -24
- package/dist/src/share/session-share-projector.d.ts +31 -0
- package/dist/src/share/session-share-projector.js +79 -0
- package/dist/src/share/session-share-service.d.ts +89 -0
- package/dist/src/share/session-share-service.js +325 -0
- package/dist/src/share/share-asset-ticket.d.ts +7 -0
- package/dist/src/share/share-asset-ticket.js +30 -0
- package/dist/src/share/share-landing.d.ts +4 -3
- package/dist/src/share/share-landing.js +5 -5
- package/dist/src/share/share-store.d.ts +27 -2
- package/dist/src/share/share-store.js +71 -8
- package/dist/src/share/share-types.d.ts +17 -2
- package/dist/src/share/share-url.js +2 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
- package/dist/src/storage/sqlite/device-access-repository.js +194 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
- package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.d.ts +10 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.js +50 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +11 -3
- package/dist/src/tunnel/consent.d.ts +1 -1
- package/dist/src/tunnel/consent.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/tunnel/index.d.ts +1 -4
- package/dist/src/tunnel/index.js +3 -5
- package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
- package/dist/src/tunnel/tunnel-config.js +1 -1
- package/dist/src/tunnel/tunnel-service.d.ts +2 -3
- package/dist/src/tunnel/tunnel-service.js +1 -20
- package/dist/src/tunnel/tunnel-types.d.ts +0 -6
- package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +3 -3
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-Bp_wmuGW.js +0 -1
- package/dist/gateway/static/root/assets/agents-CKG93dlc.js +0 -68
- package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BNFAfNwC.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Cg6NgwE_.js +0 -8
- package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-NvJKgF1u.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-C2uBdALe.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-CIcYKMEs.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CEEcmUiP.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-Cs_5pUPT.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-y1kWrFVU.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-skc62zrn.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-V8vZP0Dy.js +0 -1
- package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BgSV0Nny.js +0 -1
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-Pxqk5GFH.js +0 -1
- package/dist/gateway/static/root/assets/home-page-1xjo6wE4.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
- package/dist/gateway/static/root/assets/index-Bbd_dXui.js +0 -70
- package/dist/gateway/static/root/assets/index-D_hrEKXM.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-heQ4-PJ7.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BblnS6Jy.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-B8hM56HS.js +0 -1
- package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-DRbZjxMK.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-CLzTdVLW.css +0 -1
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-CAM09C8b.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BIPIwgU2.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B_kzTn1K.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CtD8DsD-.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B8n9HI1y.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-xlhdRTME.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-B5GU7iCG.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-Dd-BRu12.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CwEFAVWx.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-DzXw9UQJ.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Bk6UQOwS.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DrmQZ3Au.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CW2sJbdc.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-DOdCjyuw.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Bq9KB-Oj.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DtTIF6M8.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CcbGEQol.js +0 -5
- package/dist/src/agent-manifest/index.d.ts +0 -5
- package/dist/src/agent-manifest/index.js +0 -10
- package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
- package/dist/src/agent-manifest/preset-chain.js +0 -30
- package/dist/src/agent-manifest/prompt.d.ts +0 -2
- package/dist/src/agent-manifest/prompt.js +0 -49
- package/dist/src/agent-manifest/resolver.d.ts +0 -32
- package/dist/src/agent-manifest/resolver.js +0 -114
- package/dist/src/agent-manifest/schema.d.ts +0 -695
- package/dist/src/agent-manifest/schema.js +0 -226
- package/dist/src/agent-manifest/validator.d.ts +0 -25
- package/dist/src/agent-manifest/validator.js +0 -74
- package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
- package/dist/src/agent-runtime/boundary-guard.js +0 -21
- package/dist/src/agent-runtime/index.d.ts +0 -7
- package/dist/src/agent-runtime/index.js +0 -8
- package/dist/src/agent-runtime/model-router.d.ts +0 -11
- package/dist/src/agent-runtime/model-router.js +0 -14
- package/dist/src/agent-runtime/run-trace.d.ts +0 -27
- package/dist/src/agent-runtime/run-trace.js +0 -51
- package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
- package/dist/src/agent-runtime/runtime-profile.js +0 -42
- package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
- package/dist/src/agent-runtime/tool-registry.js +0 -50
- package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
- package/dist/src/agent-runtime/workflow-runtime.js +0 -32
- package/dist/src/config/agent-typed-models.d.ts +0 -13
- package/dist/src/config/agent-typed-models.js +0 -48
- package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
- package/dist/src/gateway/capability-presets-admin.js +0 -303
- package/dist/src/gateway/file-path-classifier.d.ts +0 -30
- package/dist/src/gateway/file-path-classifier.js +0 -105
- package/dist/src/gateway/file-reference-errors.d.ts +0 -6
- package/dist/src/gateway/file-reference-errors.js +0 -21
- package/dist/src/gateway/file-reference-registry.d.ts +0 -34
- package/dist/src/gateway/file-reference-registry.js +0 -45
- package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
- package/dist/src/gateway/hono/lib/agent-model.js +0 -97
- package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
- package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
- package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
- package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
- package/dist/src/gateway/security/operator-scopes.js +0 -147
- package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
- package/dist/src/migrations/config/default-capability-preset.js +0 -133
- package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
- package/dist/src/tunnel/enable-lan-pairing.js +0 -41
- package/dist/src/tunnel/pair-context.d.ts +0 -36
- package/dist/src/tunnel/pair-context.js +0 -77
- package/dist/src/tunnel/pair-url.d.ts +0 -43
- package/dist/src/tunnel/pair-url.js +0 -117
- package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
- package/dist/src/tunnel/pairing-rate-limit.js +0 -28
- package/dist/src/tunnel/pairing.d.ts +0 -21
- package/dist/src/tunnel/pairing.js +0 -103
- package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
- package/dist/src/tunnel/tunnel-qr.js +0 -29
|
@@ -1,58 +1,30 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { AgentModelsOverrideSchema, AgentsConfigSchema as AgentsConfigSchema$1, DEFAULT_AGENT_MODEL_REF, ImageGenerationRouteSchema, ModelRouteSchema } from "../agent-config/schema.js";
|
|
3
|
+
import { init_agent_config } from "../agent-config/index.js";
|
|
4
4
|
import { checkCacheDir, init_cache_dir_policy } from "../browser/cache-dir-policy.js";
|
|
5
5
|
import { UserContextConfigSchema, init_config } from "../user-context/config.js";
|
|
6
|
-
import {
|
|
6
|
+
import { init_default_model } from "./default-model.js";
|
|
7
7
|
import { init_public_url, validatePublicUrl } from "./public-url.js";
|
|
8
8
|
import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, init_config_schema } from "../../extensions/telegram/src/config-schema.js";
|
|
9
9
|
import { WeixinAccountConfigSchema, WeixinConfigSchema, init_config_schema as init_config_schema$1 } from "../../extensions/weixin/src/config-schema.js";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
//#region src/config/schema.ts
|
|
12
12
|
function getAgentDefaultModelRef(config) {
|
|
13
|
-
|
|
14
|
-
const defaultId = config.agents?.default?.trim() || list.find((entry) => entry.default === true)?.id?.trim() || list[0]?.id;
|
|
15
|
-
const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];
|
|
16
|
-
if (!agent) return void 0;
|
|
17
|
-
let modelRef;
|
|
18
|
-
const applyModels = (models) => {
|
|
19
|
-
const roles = models?.roles ?? {};
|
|
20
|
-
const defaultRole = models?.defaultRole ?? Object.keys(roles)[0];
|
|
21
|
-
const next = (defaultRole ? roles[defaultRole] : void 0)?.model.trim();
|
|
22
|
-
if (next) modelRef = next;
|
|
23
|
-
};
|
|
24
|
-
const rootPresetIds = [...config.agents.capabilityPresets[config.agents.defaultPreset] ? [config.agents.defaultPreset] : [], ...(agent.extends ?? []).filter((id) => id !== config.agents.defaultPreset)];
|
|
25
|
-
for (const presetId of linearizePresetIds(rootPresetIds, config.agents.capabilityPresets)) applyModels(config.agents.capabilityPresets[presetId]?.models);
|
|
26
|
-
applyModels(agent.models);
|
|
27
|
-
return modelRef;
|
|
13
|
+
return config.agents.list.find((entry) => entry.enabled !== false && entry.id === config.agents.default)?.models?.chat?.primary ?? config.agents.defaults.models.chat.primary;
|
|
28
14
|
}
|
|
29
15
|
function getAgentDefaultModelsConfig(config, requestedAgentId) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];
|
|
33
|
-
if (!agent) return void 0;
|
|
34
|
-
let modelConfig;
|
|
35
|
-
const applyModels = (models) => {
|
|
36
|
-
if (!models) return;
|
|
37
|
-
modelConfig = {
|
|
38
|
-
...modelConfig,
|
|
39
|
-
...models,
|
|
40
|
-
roles: {
|
|
41
|
-
...modelConfig?.roles ?? {},
|
|
42
|
-
...models.roles ?? {}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
const rootPresetIds = [...config.agents.capabilityPresets[config.agents.defaultPreset] ? [config.agents.defaultPreset] : [], ...(agent.extends ?? []).filter((id) => id !== config.agents.defaultPreset)];
|
|
47
|
-
for (const presetId of linearizePresetIds(rootPresetIds, config.agents.capabilityPresets)) applyModels(config.agents.capabilityPresets[presetId]?.models);
|
|
48
|
-
applyModels(agent.models);
|
|
49
|
-
return modelConfig;
|
|
16
|
+
const id = requestedAgentId?.trim() || config.agents.default;
|
|
17
|
+
return config.agents.list.find((entry) => entry.enabled !== false && entry.id === id)?.models;
|
|
50
18
|
}
|
|
51
19
|
function getAgentDefaultImageModelConfig(config) {
|
|
52
|
-
|
|
20
|
+
const models = getAgentDefaultModelsConfig(config);
|
|
21
|
+
if (models && Object.hasOwn(models, "imageUnderstanding")) return models.imageUnderstanding ?? void 0;
|
|
22
|
+
return config.agents.defaults.models.imageUnderstanding;
|
|
53
23
|
}
|
|
54
24
|
function getAgentDefaultImageGenerationModelConfig(config, agentId) {
|
|
55
|
-
|
|
25
|
+
const models = getAgentDefaultModelsConfig(config, agentId);
|
|
26
|
+
if (models && Object.hasOwn(models, "imageGeneration")) return models.imageGeneration ?? void 0;
|
|
27
|
+
return config.agents.defaults.models.imageGeneration;
|
|
56
28
|
}
|
|
57
29
|
/** `provider/model` or null when invalid. */
|
|
58
30
|
function parseModelRef(ref) {
|
|
@@ -64,88 +36,39 @@ function parseModelRef(ref) {
|
|
|
64
36
|
model: trimmed.slice(idx + 1).trim()
|
|
65
37
|
};
|
|
66
38
|
}
|
|
67
|
-
var AgentModelRefSchema, AgentImageGenerationModelSchema,
|
|
39
|
+
var AgentModelRefSchema, AgentImageGenerationModelSchema, AgentModelsSchema, AgentsConfigSchema, BrowserCloudConfigSchema, BrowserExtensionConfigSchema, BrowserCloakConfigSchema, BrowserConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, SessionDmScopeSchema, SessionStorageConfigSchema, SessionResetModeSchema, SessionResetConfigSchema, SessionResetByTypeSchema, SessionScopeSchema, SessionConfigSchema, ChannelsConfigSchema, SearchProviderEntrySchema, WebSearchConfigSchema, WebsiteBlocklistSchema, WebToolsConfigSchema, ToolsConfigSchema, RuntimePreferenceSchema, RuntimeProvisionSchema, LanguageRuntimeSchema, DEFAULT_RUNTIME_TOOLS_CONFIG, RuntimeToolsConfigSchema, GatewayAuthRateLimitSchema, GatewaySecuritySchema, GatewayTrustedProxySchema, GatewayAuthSchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayRemoteSchema, GatewayTlsSchema, GatewayModeSchema, HeartbeatConfigSchema, GatewayChannelConnectDeferModeSchema, TunnelConsentSchema, TunnelConfigSchema, WorkspaceImportConfigSchema, WorkspaceConfigSchema, GatewayBindModeSchema, GatewayWebchatConfigSchema, GatewayConfigSchema, ModelsDevConfigSchema, ModelCatalogConfigSchema, SttProviderConfigCatchallSchema, STTProviderConfigSchema, STTFallbackConfigSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, STTConfigSchema, TtsProviderConfigCatchallSchema, TTSProviderConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSEdgeConfigSchema, TTSSummarizationConfigSchema, TTSConfigSchema, VoiceRefinementConfigSchema, VoiceConfigSchema, MessagesConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProviderAuthConfigSchema, ProvidersConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, UpdateAutoConfigSchema, UpdateConfigSchema, CommandsConfigSchema, TuiConfigSchema, McpHttpUrlSchema, ConnectorSecretReferenceSchema, McpConfigScalarSchema, McpOAuthConfigSchema, McpServerSchema, McpConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ConfigSchema;
|
|
68
40
|
var init_schema = __esmMin((() => {
|
|
69
|
-
|
|
70
|
-
init_preset_chain();
|
|
41
|
+
init_agent_config();
|
|
71
42
|
init_cache_dir_policy();
|
|
72
43
|
init_config();
|
|
73
44
|
init_default_model();
|
|
74
45
|
init_public_url();
|
|
75
46
|
init_config_schema();
|
|
76
47
|
init_config_schema$1();
|
|
77
|
-
AgentModelRefSchema =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
AgentImageGenerationModelSchema = z.object({
|
|
82
|
-
primary: z.string().min(1),
|
|
83
|
-
fallbacks: z.array(z.string()).optional(),
|
|
84
|
-
/** Hard cap for the whole generation attempt (ms). */
|
|
85
|
-
timeoutMs: z.number().int().positive().optional(),
|
|
86
|
-
/**
|
|
87
|
-
* When all `primary + fallbacks` candidates fail, sweep every other
|
|
88
|
-
* configured provider before giving up.
|
|
89
|
-
*/
|
|
90
|
-
autoProviderFallback: z.boolean().optional()
|
|
91
|
-
}).strict();
|
|
92
|
-
AgentTypedModelRoleSchema = z.object({
|
|
93
|
-
description: z.string().max(500).optional(),
|
|
94
|
-
model: z.string().min(1),
|
|
95
|
-
fallbacks: z.array(z.string().min(1)).optional()
|
|
96
|
-
}).strict().superRefine((entry, ctx) => {
|
|
97
|
-
const validateRef = (ref) => {
|
|
98
|
-
const trimmed = ref.trim();
|
|
99
|
-
const idx = trimmed.indexOf("/");
|
|
100
|
-
return idx > 0 && idx < trimmed.length - 1;
|
|
101
|
-
};
|
|
102
|
-
if (!validateRef(entry.model)) ctx.addIssue({
|
|
103
|
-
code: "custom",
|
|
104
|
-
message: `model must be provider/model format (got '${entry.model}')`,
|
|
105
|
-
path: ["model"]
|
|
106
|
-
});
|
|
107
|
-
for (const [index, fallback] of (entry.fallbacks ?? []).entries()) if (!validateRef(fallback)) ctx.addIssue({
|
|
108
|
-
code: "custom",
|
|
109
|
-
message: `fallback must be provider/model format (got '${fallback}')`,
|
|
110
|
-
path: ["fallbacks", index]
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
AgentTypedModelRolesSchema = z.record(z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/), AgentTypedModelRoleSchema).optional();
|
|
114
|
-
AgentModelsSchema = z.object({
|
|
115
|
-
defaultRole: z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/).optional(),
|
|
116
|
-
roles: AgentTypedModelRolesSchema,
|
|
117
|
-
imageModel: AgentModelRefSchema.optional(),
|
|
118
|
-
imageGenerationModel: AgentImageGenerationModelSchema.optional()
|
|
119
|
-
}).strict().optional();
|
|
120
|
-
AgentsConfigSchema = z.object({
|
|
121
|
-
/** Default agent id when not specified (routing / session creation). */
|
|
122
|
-
default: z.string().optional(),
|
|
123
|
-
/** Protected global defaults preset applied before each agent's own presets. */
|
|
124
|
-
defaultPreset: z.string().default(DEFAULT_CAPABILITY_PRESET_ID),
|
|
125
|
-
capabilityPresets: z.record(z.string(), CapabilityPresetSchema).default({}),
|
|
126
|
-
list: z.array(AgentConfigEntrySchema).default([])
|
|
127
|
-
}).strict().default({
|
|
48
|
+
AgentModelRefSchema = ModelRouteSchema;
|
|
49
|
+
AgentImageGenerationModelSchema = ImageGenerationRouteSchema;
|
|
50
|
+
AgentModelsSchema = AgentModelsOverrideSchema;
|
|
51
|
+
AgentsConfigSchema = AgentsConfigSchema$1.default({
|
|
128
52
|
default: "main",
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
53
|
+
defaults: {
|
|
54
|
+
models: {
|
|
55
|
+
chat: {
|
|
56
|
+
primary: DEFAULT_AGENT_MODEL_REF,
|
|
57
|
+
fallbacks: []
|
|
58
|
+
},
|
|
59
|
+
intents: {}
|
|
60
|
+
},
|
|
61
|
+
skills: {
|
|
62
|
+
mode: "all-enabled",
|
|
63
|
+
exclude: []
|
|
64
|
+
},
|
|
65
|
+
tools: {},
|
|
66
|
+
workflows: {},
|
|
67
|
+
runtime: {}
|
|
68
|
+
},
|
|
137
69
|
list: [{
|
|
138
70
|
id: "main",
|
|
139
|
-
enabled: true
|
|
140
|
-
identity: {
|
|
141
|
-
name: "Smart Assistant",
|
|
142
|
-
description: "General-purpose personal assistant.",
|
|
143
|
-
role: "General assistant",
|
|
144
|
-
language: "en",
|
|
145
|
-
tone: "direct"
|
|
146
|
-
},
|
|
147
|
-
responsibilities: { primary: ["Help the user complete tasks"] },
|
|
148
|
-
workspace: { root: "~/.xopc/workspace/main" }
|
|
71
|
+
enabled: true
|
|
149
72
|
}]
|
|
150
73
|
});
|
|
151
74
|
BrowserCloudConfigSchema = z.object({
|
|
@@ -1080,26 +1003,25 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
1080
1003
|
},
|
|
1081
1004
|
agents: {
|
|
1082
1005
|
default: "main",
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1006
|
+
defaults: {
|
|
1007
|
+
models: {
|
|
1008
|
+
chat: {
|
|
1009
|
+
primary: DEFAULT_AGENT_MODEL_REF,
|
|
1010
|
+
fallbacks: []
|
|
1011
|
+
},
|
|
1012
|
+
intents: {}
|
|
1013
|
+
},
|
|
1014
|
+
skills: {
|
|
1015
|
+
mode: "all-enabled",
|
|
1016
|
+
exclude: []
|
|
1017
|
+
},
|
|
1018
|
+
tools: {},
|
|
1019
|
+
workflows: {},
|
|
1020
|
+
runtime: {}
|
|
1021
|
+
},
|
|
1091
1022
|
list: [{
|
|
1092
1023
|
id: "main",
|
|
1093
|
-
enabled: true
|
|
1094
|
-
identity: {
|
|
1095
|
-
name: "Smart Assistant",
|
|
1096
|
-
description: "General-purpose personal assistant.",
|
|
1097
|
-
role: "General assistant",
|
|
1098
|
-
language: "en",
|
|
1099
|
-
tone: "direct"
|
|
1100
|
-
},
|
|
1101
|
-
responsibilities: { primary: ["Help the user complete tasks"] },
|
|
1102
|
-
workspace: { root: "~/.xopc/workspace/main" }
|
|
1024
|
+
enabled: true
|
|
1103
1025
|
}]
|
|
1104
1026
|
},
|
|
1105
1027
|
bindings: [],
|
|
@@ -1173,4 +1095,4 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
1173
1095
|
}));
|
|
1174
1096
|
//#endregion
|
|
1175
1097
|
init_schema();
|
|
1176
|
-
export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema,
|
|
1098
|
+
export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef };
|
|
@@ -96,17 +96,13 @@ function defaultModelId(config) {
|
|
|
96
96
|
if (!Array.isArray(list)) return void 0;
|
|
97
97
|
const defaultId = typeof agents.default === "string" ? agents.default : void 0;
|
|
98
98
|
const entry = list.find((candidate) => isRecord(candidate) && candidate.id === defaultId) ?? list.find((candidate) => isRecord(candidate) && candidate.enabled !== false);
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (isRecord(role)) {
|
|
107
|
-
const model = role.model;
|
|
108
|
-
if (typeof model === "string" && model.trim().length > 0) return model;
|
|
109
|
-
}
|
|
99
|
+
const overrideModels = isRecord(entry) && isRecord(entry.models) ? entry.models : void 0;
|
|
100
|
+
const overrideChat = overrideModels && isRecord(overrideModels.chat) ? overrideModels.chat : void 0;
|
|
101
|
+
if (typeof overrideChat?.primary === "string" && overrideChat.primary.trim()) return overrideChat.primary;
|
|
102
|
+
const defaults = isRecord(agents.defaults) ? agents.defaults : void 0;
|
|
103
|
+
const models = defaults && isRecord(defaults.models) ? defaults.models : void 0;
|
|
104
|
+
const chat = models && isRecord(models.chat) ? models.chat : void 0;
|
|
105
|
+
return typeof chat?.primary === "string" && chat.primary.trim() ? chat.primary : void 0;
|
|
110
106
|
}
|
|
111
107
|
/**
|
|
112
108
|
* Merge partial activation context over values inferred from loaded app config.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FileResource, FileSpace } from '@xopcai/gateway-contract';
|
|
2
|
+
import type { Config } from '../config/schema.js';
|
|
3
|
+
import { type ProjectService } from '../projects/index.js';
|
|
4
|
+
export type ResolvedFileSpace = FileSpace & {
|
|
5
|
+
root: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function fileSpaceId(root: string): string;
|
|
8
|
+
export declare function fileResourceId(spaceId: string, relativePath: string): string;
|
|
9
|
+
export declare function parseFileResourceId(id: string): {
|
|
10
|
+
spaceId: string;
|
|
11
|
+
relativePath: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function resolveFilePath(root: string, path: string, mustExist?: boolean): Promise<string>;
|
|
14
|
+
export declare class FileServiceError extends Error {
|
|
15
|
+
readonly status: 400 | 403 | 404 | 409;
|
|
16
|
+
constructor(status: 400 | 403 | 404 | 409, message: string);
|
|
17
|
+
}
|
|
18
|
+
export declare function fileResourceFromPath(space: ResolvedFileSpace, absolutePath: string): Promise<FileResource>;
|
|
19
|
+
export declare class FileSpaceService {
|
|
20
|
+
private readonly getConfig;
|
|
21
|
+
private readonly projects;
|
|
22
|
+
private readonly resolveSessionWorkspace;
|
|
23
|
+
private readonly dynamicSpaces;
|
|
24
|
+
private cache;
|
|
25
|
+
constructor(getConfig: () => Config, projects: ProjectService, resolveSessionWorkspace: (sessionKey: string) => string);
|
|
26
|
+
private createSpace;
|
|
27
|
+
list(): Promise<ResolvedFileSpace[]>;
|
|
28
|
+
forContext(kind: 'agent' | 'project' | 'session', id: string): Promise<ResolvedFileSpace>;
|
|
29
|
+
get(id: string): Promise<ResolvedFileSpace>;
|
|
30
|
+
resource(id: string): Promise<{
|
|
31
|
+
space: ResolvedFileSpace;
|
|
32
|
+
resource: FileResource;
|
|
33
|
+
absolutePath: string;
|
|
34
|
+
}>;
|
|
35
|
+
children(spaceId: string, path?: string): Promise<FileResource[]>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
2
|
+
import { resolveProjectAgentId } from "../projects/project-agent.js";
|
|
3
|
+
import "../projects/index.js";
|
|
4
|
+
import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
5
|
+
import { constants } from "node:fs";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { access, lstat, opendir, realpath, stat } from "node:fs/promises";
|
|
8
|
+
//#region src/files/file-service.ts
|
|
9
|
+
init_agent_scope();
|
|
10
|
+
const SKIPPED_NAMES = new Set([
|
|
11
|
+
".DS_Store",
|
|
12
|
+
".git",
|
|
13
|
+
"node_modules"
|
|
14
|
+
]);
|
|
15
|
+
const TEXT_EXTENSIONS = new Set([
|
|
16
|
+
"css",
|
|
17
|
+
"csv",
|
|
18
|
+
"html",
|
|
19
|
+
"htm",
|
|
20
|
+
"js",
|
|
21
|
+
"json",
|
|
22
|
+
"jsx",
|
|
23
|
+
"md",
|
|
24
|
+
"mjs",
|
|
25
|
+
"cjs",
|
|
26
|
+
"svg",
|
|
27
|
+
"ts",
|
|
28
|
+
"tsx",
|
|
29
|
+
"txt",
|
|
30
|
+
"xml",
|
|
31
|
+
"yaml",
|
|
32
|
+
"yml"
|
|
33
|
+
]);
|
|
34
|
+
const MIME_TYPES = {
|
|
35
|
+
png: "image/png",
|
|
36
|
+
jpg: "image/jpeg",
|
|
37
|
+
jpeg: "image/jpeg",
|
|
38
|
+
gif: "image/gif",
|
|
39
|
+
webp: "image/webp",
|
|
40
|
+
svg: "image/svg+xml",
|
|
41
|
+
md: "text/markdown",
|
|
42
|
+
txt: "text/plain",
|
|
43
|
+
json: "application/json",
|
|
44
|
+
html: "text/html",
|
|
45
|
+
htm: "text/html",
|
|
46
|
+
css: "text/css",
|
|
47
|
+
js: "text/javascript",
|
|
48
|
+
mjs: "text/javascript",
|
|
49
|
+
cjs: "text/javascript",
|
|
50
|
+
ts: "text/typescript",
|
|
51
|
+
tsx: "text/typescript",
|
|
52
|
+
csv: "text/csv",
|
|
53
|
+
xml: "application/xml",
|
|
54
|
+
yaml: "application/yaml",
|
|
55
|
+
yml: "application/yaml",
|
|
56
|
+
pdf: "application/pdf",
|
|
57
|
+
mp3: "audio/mpeg",
|
|
58
|
+
wav: "audio/wav",
|
|
59
|
+
ogg: "audio/ogg",
|
|
60
|
+
m4a: "audio/mp4",
|
|
61
|
+
mp4: "video/mp4",
|
|
62
|
+
mov: "video/quicktime",
|
|
63
|
+
webm: "video/webm"
|
|
64
|
+
};
|
|
65
|
+
function isWithin(root, target) {
|
|
66
|
+
const rel = relative(root, target);
|
|
67
|
+
return rel === "" || !rel.startsWith(`..${sep}`) && rel !== ".." && !isAbsolute(rel);
|
|
68
|
+
}
|
|
69
|
+
function normalizeRelativePath(input) {
|
|
70
|
+
const normalized = input.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
71
|
+
if (normalized.includes("\0") || normalized.split("/").some((part) => part === "..")) throw new FileServiceError(400, "Invalid file path");
|
|
72
|
+
return normalized.split("/").filter((part) => part && part !== ".").join("/");
|
|
73
|
+
}
|
|
74
|
+
function mimeType(name, directory) {
|
|
75
|
+
if (directory) return "inode/directory";
|
|
76
|
+
return MIME_TYPES[name.includes(".") ? name.split(".").pop().toLowerCase() : ""] ?? "application/octet-stream";
|
|
77
|
+
}
|
|
78
|
+
function capabilities(name, directory, writable) {
|
|
79
|
+
if (directory) return writable ? ["upload"] : [];
|
|
80
|
+
const extension = name.includes(".") ? name.split(".").pop().toLowerCase() : "";
|
|
81
|
+
const result = ["download", "share"];
|
|
82
|
+
if (MIME_TYPES[extension] || TEXT_EXTENSIONS.has(extension)) result.unshift("preview");
|
|
83
|
+
if (writable && TEXT_EXTENSIONS.has(extension)) result.push("edit");
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
function fileSpaceId(root) {
|
|
87
|
+
return createHash("sha256").update(root).digest("base64url").slice(0, 24);
|
|
88
|
+
}
|
|
89
|
+
function fileResourceId(spaceId, relativePath) {
|
|
90
|
+
return `${spaceId}.${Buffer.from(normalizeRelativePath(relativePath)).toString("base64url")}`;
|
|
91
|
+
}
|
|
92
|
+
function parseFileResourceId(id) {
|
|
93
|
+
const separator = id.indexOf(".");
|
|
94
|
+
if (separator <= 0) throw new FileServiceError(400, "Invalid file id");
|
|
95
|
+
try {
|
|
96
|
+
return {
|
|
97
|
+
spaceId: id.slice(0, separator),
|
|
98
|
+
relativePath: normalizeRelativePath(Buffer.from(id.slice(separator + 1), "base64url").toString("utf8"))
|
|
99
|
+
};
|
|
100
|
+
} catch (error) {
|
|
101
|
+
if (error instanceof FileServiceError) throw error;
|
|
102
|
+
throw new FileServiceError(400, "Invalid file id");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function resolveFilePath(root, path, mustExist = true) {
|
|
106
|
+
const canonicalRoot = await realpath(root).catch(() => {
|
|
107
|
+
throw new FileServiceError(404, "File space is unavailable");
|
|
108
|
+
});
|
|
109
|
+
const candidate = resolve(canonicalRoot, normalizeRelativePath(path));
|
|
110
|
+
if (!isWithin(canonicalRoot, candidate)) throw new FileServiceError(400, "Invalid file path");
|
|
111
|
+
if (!mustExist) {
|
|
112
|
+
if (!isWithin(canonicalRoot, await realpath(dirname(candidate)).catch(() => {
|
|
113
|
+
throw new FileServiceError(404, "Parent directory not found");
|
|
114
|
+
}))) throw new FileServiceError(400, "Invalid file path");
|
|
115
|
+
return candidate;
|
|
116
|
+
}
|
|
117
|
+
const canonicalTarget = await realpath(candidate).catch(() => {
|
|
118
|
+
throw new FileServiceError(404, "File not found");
|
|
119
|
+
});
|
|
120
|
+
if (!isWithin(canonicalRoot, canonicalTarget)) throw new FileServiceError(400, "File is outside its space");
|
|
121
|
+
return canonicalTarget;
|
|
122
|
+
}
|
|
123
|
+
var FileServiceError = class extends Error {
|
|
124
|
+
constructor(status, message) {
|
|
125
|
+
super(message);
|
|
126
|
+
this.status = status;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
async function fileResourceFromPath(space, absolutePath) {
|
|
130
|
+
const info = await stat(absolutePath);
|
|
131
|
+
const revisionInfo = await stat(absolutePath, { bigint: true });
|
|
132
|
+
const relativePath = relative(await realpath(space.root), absolutePath).split(sep).join("/");
|
|
133
|
+
const name = basename(absolutePath);
|
|
134
|
+
const directory = info.isDirectory();
|
|
135
|
+
return {
|
|
136
|
+
id: fileResourceId(space.id, relativePath),
|
|
137
|
+
spaceId: space.id,
|
|
138
|
+
name,
|
|
139
|
+
relativePath,
|
|
140
|
+
parentPath: dirname(relativePath).split(sep).join("/").replace(/^\.$/, ""),
|
|
141
|
+
kind: directory ? "directory" : "file",
|
|
142
|
+
mimeType: mimeType(name, directory),
|
|
143
|
+
size: info.size,
|
|
144
|
+
modifiedAt: Math.max(0, Math.round(info.mtimeMs)),
|
|
145
|
+
revision: `${revisionInfo.mtimeNs}:${revisionInfo.ctimeNs}:${revisionInfo.ino}:${revisionInfo.size}`,
|
|
146
|
+
capabilities: capabilities(name, directory, space.writable)
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
var FileSpaceService = class {
|
|
150
|
+
dynamicSpaces = /* @__PURE__ */ new Map();
|
|
151
|
+
cache = null;
|
|
152
|
+
constructor(getConfig, projects, resolveSessionWorkspace) {
|
|
153
|
+
this.getConfig = getConfig;
|
|
154
|
+
this.projects = projects;
|
|
155
|
+
this.resolveSessionWorkspace = resolveSessionWorkspace;
|
|
156
|
+
}
|
|
157
|
+
async createSpace(root, title, bindings) {
|
|
158
|
+
const canonicalRoot = await realpath(root).catch(() => null);
|
|
159
|
+
if (!canonicalRoot) return null;
|
|
160
|
+
const rootStat = await stat(canonicalRoot).catch(() => null);
|
|
161
|
+
if (!rootStat?.isDirectory()) return null;
|
|
162
|
+
const writable = await access(canonicalRoot, constants.W_OK).then(() => true).catch(() => false);
|
|
163
|
+
return {
|
|
164
|
+
id: fileSpaceId(canonicalRoot),
|
|
165
|
+
title,
|
|
166
|
+
kind: "workspace",
|
|
167
|
+
bindings,
|
|
168
|
+
writable,
|
|
169
|
+
root: canonicalRoot,
|
|
170
|
+
lastActivityAt: Math.max(0, Math.round(rootStat.mtimeMs))
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
async list() {
|
|
174
|
+
if (this.cache && Date.now() - this.cache.at < 5e3) return this.cache.spaces;
|
|
175
|
+
const config = this.getConfig();
|
|
176
|
+
const spaces = [];
|
|
177
|
+
for (const agent of listAgentEntries(config)) {
|
|
178
|
+
const space = await this.createSpace(resolveAgentWorkspaceDir(config, agent.id), agent.id, [{
|
|
179
|
+
kind: "agent",
|
|
180
|
+
id: agent.id
|
|
181
|
+
}]);
|
|
182
|
+
if (space) spaces.push(space);
|
|
183
|
+
}
|
|
184
|
+
let offset = 0;
|
|
185
|
+
while (true) {
|
|
186
|
+
const page = this.projects.list({
|
|
187
|
+
limit: 500,
|
|
188
|
+
offset
|
|
189
|
+
});
|
|
190
|
+
for (const project of page.items) {
|
|
191
|
+
const agentId = resolveProjectAgentId({
|
|
192
|
+
config,
|
|
193
|
+
projects: this.projects,
|
|
194
|
+
projectId: project.id
|
|
195
|
+
});
|
|
196
|
+
const root = project.workspaceRoot ?? resolveAgentWorkspaceDir(config, agentId);
|
|
197
|
+
const space = await this.createSpace(root, project.name, [{
|
|
198
|
+
kind: "project",
|
|
199
|
+
id: project.id
|
|
200
|
+
}]);
|
|
201
|
+
if (space) spaces.push(space);
|
|
202
|
+
}
|
|
203
|
+
if (!page.hasMore || page.items.length === 0) break;
|
|
204
|
+
offset += page.items.length;
|
|
205
|
+
}
|
|
206
|
+
const merged = /* @__PURE__ */ new Map();
|
|
207
|
+
for (const space of [...spaces, ...this.dynamicSpaces.values()]) {
|
|
208
|
+
const existing = merged.get(space.id);
|
|
209
|
+
if (existing) existing.bindings = [...existing.bindings, ...space.bindings.filter((binding) => !existing.bindings.some((item) => item.kind === binding.kind && item.id === binding.id))];
|
|
210
|
+
else merged.set(space.id, {
|
|
211
|
+
...space,
|
|
212
|
+
bindings: [...space.bindings]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
const result = [...merged.values()].sort((a, b) => (b.lastActivityAt ?? 0) - (a.lastActivityAt ?? 0));
|
|
216
|
+
this.cache = {
|
|
217
|
+
at: Date.now(),
|
|
218
|
+
spaces: result
|
|
219
|
+
};
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
async forContext(kind, id) {
|
|
223
|
+
let root;
|
|
224
|
+
let title = id;
|
|
225
|
+
if (kind === "agent") root = resolveAgentWorkspaceDir(this.getConfig(), id);
|
|
226
|
+
if (kind === "project") {
|
|
227
|
+
const project = this.projects.get(id);
|
|
228
|
+
if (project) {
|
|
229
|
+
const config = this.getConfig();
|
|
230
|
+
const agentId = resolveProjectAgentId({
|
|
231
|
+
config,
|
|
232
|
+
projects: this.projects,
|
|
233
|
+
projectId: id
|
|
234
|
+
});
|
|
235
|
+
root = project.workspaceRoot ?? resolveAgentWorkspaceDir(config, agentId);
|
|
236
|
+
}
|
|
237
|
+
title = project?.name ?? id;
|
|
238
|
+
}
|
|
239
|
+
if (kind === "session") root = this.resolveSessionWorkspace(id);
|
|
240
|
+
if (!root) throw new FileServiceError(404, "File space not found");
|
|
241
|
+
const space = await this.createSpace(root, title, [{
|
|
242
|
+
kind,
|
|
243
|
+
id
|
|
244
|
+
}]);
|
|
245
|
+
if (!space) throw new FileServiceError(404, "File space is unavailable");
|
|
246
|
+
this.dynamicSpaces.set(space.id, space);
|
|
247
|
+
this.cache = null;
|
|
248
|
+
return space;
|
|
249
|
+
}
|
|
250
|
+
async get(id) {
|
|
251
|
+
const space = (await this.list()).find((item) => item.id === id);
|
|
252
|
+
if (!space) throw new FileServiceError(404, "File space not found");
|
|
253
|
+
return space;
|
|
254
|
+
}
|
|
255
|
+
async resource(id) {
|
|
256
|
+
const locator = parseFileResourceId(id);
|
|
257
|
+
const space = await this.get(locator.spaceId);
|
|
258
|
+
const absolutePath = await resolveFilePath(space.root, locator.relativePath);
|
|
259
|
+
return {
|
|
260
|
+
space,
|
|
261
|
+
resource: await fileResourceFromPath(space, absolutePath),
|
|
262
|
+
absolutePath
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
async children(spaceId, path = "") {
|
|
266
|
+
const space = await this.get(spaceId);
|
|
267
|
+
const directory = await resolveFilePath(space.root, path);
|
|
268
|
+
if (!(await stat(directory)).isDirectory()) throw new FileServiceError(400, "Path is not a directory");
|
|
269
|
+
const entries = [];
|
|
270
|
+
const dir = await opendir(directory);
|
|
271
|
+
for await (const entry of dir) {
|
|
272
|
+
if (SKIPPED_NAMES.has(entry.name)) continue;
|
|
273
|
+
const target = resolve(directory, entry.name);
|
|
274
|
+
const linkInfo = await lstat(target).catch(() => null);
|
|
275
|
+
if (!linkInfo || linkInfo.isSymbolicLink()) continue;
|
|
276
|
+
entries.push(await fileResourceFromPath(space, target));
|
|
277
|
+
}
|
|
278
|
+
return entries.sort((a, b) => a.kind === b.kind ? a.name.localeCompare(b.name) : a.kind === "directory" ? -1 : 1);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
//#endregion
|
|
282
|
+
export { FileServiceError, FileSpaceService, fileResourceFromPath, fileResourceId, fileSpaceId, parseFileResourceId, resolveFilePath };
|