@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,32 +0,0 @@
|
|
|
1
|
-
//#region src/agent-runtime/workflow-runtime.ts
|
|
2
|
-
function resolveWorkflow(params) {
|
|
3
|
-
const catalog = new Map([...params.catalog].map((workflow) => [workflow.id, workflow]));
|
|
4
|
-
const intent = params.intent?.trim().toLowerCase();
|
|
5
|
-
const suggested = intent ? params.manifest.workflows.suggested?.find((entry) => entry.intent.toLowerCase() === intent) : void 0;
|
|
6
|
-
const id = suggested?.workflow ?? params.manifest.workflows.default;
|
|
7
|
-
if (!id) return { reason: "no workflow configured" };
|
|
8
|
-
if (params.manifest.workflows.allowed && !params.manifest.workflows.allowed.includes(id)) return { reason: `workflow "${id}" is not allowed by manifest` };
|
|
9
|
-
const workflow = catalog.get(id);
|
|
10
|
-
if (!workflow) return { reason: `workflow "${id}" is not in the workflow catalog` };
|
|
11
|
-
return {
|
|
12
|
-
workflow,
|
|
13
|
-
reason: suggested ? `matched intent "${suggested.intent}"` : "using default workflow"
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function validateWorkflowForRuntime(params) {
|
|
17
|
-
const issues = [];
|
|
18
|
-
const availableTools = new Set(params.tools.tools.map((entry) => entry.name));
|
|
19
|
-
for (const [phaseIndex, phase] of params.workflow.phases.entries()) {
|
|
20
|
-
if (phase.modelRole && !params.manifest.models.roles[phase.modelRole]) issues.push({
|
|
21
|
-
path: `phases.${phaseIndex}.modelRole`,
|
|
22
|
-
message: `model role "${phase.modelRole}" is not configured`
|
|
23
|
-
});
|
|
24
|
-
for (const toolName of phase.requiredTools ?? []) if (!availableTools.has(toolName)) issues.push({
|
|
25
|
-
path: `phases.${phaseIndex}.requiredTools`,
|
|
26
|
-
message: `required tool "${toolName}" is not available at runtime`
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return issues;
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
export { resolveWorkflow, validateWorkflowForRuntime };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Named model roles from the selected agent manifest.
|
|
3
|
-
*/
|
|
4
|
-
import type { AgentTypedModel, Config } from './schema.js';
|
|
5
|
-
export type { AgentTypedModel };
|
|
6
|
-
export declare function resolveEffectiveTypedModels(config: Config, agentId: string): Map<string, AgentTypedModel>;
|
|
7
|
-
/** Resolve a typed model id to `provider/model`, or undefined when not configured. */
|
|
8
|
-
export declare function resolveTypedModelRef(config: Config, agentId: string, typeId: string): string | undefined;
|
|
9
|
-
/**
|
|
10
|
-
* Resolve a model reference: `provider/model`, typed id (`small`), or `@small`.
|
|
11
|
-
* Throws when the ref is invalid or the typed id is unknown.
|
|
12
|
-
*/
|
|
13
|
-
export declare function resolveModelRef(config: Config, agentId: string, ref: string): string;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { init_schema, parseModelRef } from "./schema.js";
|
|
2
|
-
import { resolveEffectiveAgentManifestForAgent } from "./agent-profile.js";
|
|
3
|
-
//#region src/config/agent-typed-models.ts
|
|
4
|
-
init_schema();
|
|
5
|
-
function rolesToEntries(roles) {
|
|
6
|
-
return Object.entries(roles ?? {}).map(([id, role]) => ({
|
|
7
|
-
id,
|
|
8
|
-
...role
|
|
9
|
-
}));
|
|
10
|
-
}
|
|
11
|
-
function resolveEffectiveTypedModels(config, agentId) {
|
|
12
|
-
const out = /* @__PURE__ */ new Map();
|
|
13
|
-
const manifest = resolveEffectiveAgentManifestForAgent(config, agentId);
|
|
14
|
-
for (const modelRole of rolesToEntries(manifest.models.roles)) out.set(modelRole.id, modelRole);
|
|
15
|
-
return out;
|
|
16
|
-
}
|
|
17
|
-
/** Resolve a typed model id to `provider/model`, or undefined when not configured. */
|
|
18
|
-
function resolveTypedModelRef(config, agentId, typeId) {
|
|
19
|
-
return resolveEffectiveTypedModels(config, agentId).get(typeId)?.model?.trim() || void 0;
|
|
20
|
-
}
|
|
21
|
-
function parseModelRefInput(ref) {
|
|
22
|
-
const trimmed = ref.trim();
|
|
23
|
-
if (!trimmed) return {};
|
|
24
|
-
if (trimmed.includes("/")) return { directRef: trimmed };
|
|
25
|
-
const typeId = trimmed.startsWith("@") ? trimmed.slice(1).trim() : trimmed;
|
|
26
|
-
return typeId ? { typeId } : {};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Resolve a model reference: `provider/model`, typed id (`small`), or `@small`.
|
|
30
|
-
* Throws when the ref is invalid or the typed id is unknown.
|
|
31
|
-
*/
|
|
32
|
-
function resolveModelRef(config, agentId, ref) {
|
|
33
|
-
const { directRef, typeId } = parseModelRefInput(ref);
|
|
34
|
-
if (directRef) {
|
|
35
|
-
if (!parseModelRef(directRef)) throw new Error(`model ref must be provider/model format (got '${directRef}')`);
|
|
36
|
-
return directRef;
|
|
37
|
-
}
|
|
38
|
-
if (typeId) {
|
|
39
|
-
const resolved = resolveTypedModelRef(config, agentId, typeId);
|
|
40
|
-
if (resolved) return resolved;
|
|
41
|
-
const available = [...resolveEffectiveTypedModels(config, agentId).keys()];
|
|
42
|
-
const hint = available.length > 0 ? ` (available: ${available.join(", ")})` : " (none configured)";
|
|
43
|
-
throw new Error(`Unknown typed model id '${typeId}' for agent '${agentId}'${hint}`);
|
|
44
|
-
}
|
|
45
|
-
throw new Error("model ref must not be empty");
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
|
-
export { resolveEffectiveTypedModels, resolveModelRef, resolveTypedModelRef };
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { type CapabilityPreset } from '../agent-manifest/schema.js';
|
|
2
|
-
import { resolveCapabilityPresetLayer } from '../agent-manifest/resolver.js';
|
|
3
|
-
import type { Config } from '../config/schema.js';
|
|
4
|
-
export type CapabilityPresetAdminResult<T> = {
|
|
5
|
-
ok: true;
|
|
6
|
-
data: T;
|
|
7
|
-
} | {
|
|
8
|
-
ok: false;
|
|
9
|
-
error: string;
|
|
10
|
-
status?: 400 | 404 | 409 | 500;
|
|
11
|
-
};
|
|
12
|
-
export type CapabilityPresetAgentUsage = {
|
|
13
|
-
agentId: string;
|
|
14
|
-
agentName?: string;
|
|
15
|
-
direct: boolean;
|
|
16
|
-
};
|
|
17
|
-
export type CapabilityPresetRow = CapabilityPreset & {
|
|
18
|
-
usage: CapabilityPresetAgentUsage[];
|
|
19
|
-
inherited: ReturnType<typeof resolveCapabilityPresetLayer>['patch'];
|
|
20
|
-
inheritedSources: Record<string, string>;
|
|
21
|
-
};
|
|
22
|
-
export type CapabilityPresetsListResponse = {
|
|
23
|
-
defaultPresetId: string;
|
|
24
|
-
presets: CapabilityPresetRow[];
|
|
25
|
-
agents: Array<{
|
|
26
|
-
id: string;
|
|
27
|
-
name?: string;
|
|
28
|
-
extends: string[];
|
|
29
|
-
}>;
|
|
30
|
-
builtinToolIds: string[];
|
|
31
|
-
mcpServerIds: string[];
|
|
32
|
-
workflows: Array<{
|
|
33
|
-
id: string;
|
|
34
|
-
title: string;
|
|
35
|
-
description: string;
|
|
36
|
-
}>;
|
|
37
|
-
};
|
|
38
|
-
export type CapabilityPresetPreviewDiff = {
|
|
39
|
-
path: string;
|
|
40
|
-
before?: unknown;
|
|
41
|
-
after?: unknown;
|
|
42
|
-
};
|
|
43
|
-
export type CapabilityPresetPreviewAgent = {
|
|
44
|
-
agentId: string;
|
|
45
|
-
agentName?: string;
|
|
46
|
-
diffs: CapabilityPresetPreviewDiff[];
|
|
47
|
-
};
|
|
48
|
-
export type CreateCapabilityPresetBody = {
|
|
49
|
-
id?: string;
|
|
50
|
-
name?: string;
|
|
51
|
-
description?: string;
|
|
52
|
-
version?: number;
|
|
53
|
-
extends?: CapabilityPreset['extends'];
|
|
54
|
-
models?: CapabilityPreset['models'];
|
|
55
|
-
tools?: CapabilityPreset['tools'];
|
|
56
|
-
skills?: CapabilityPreset['skills'];
|
|
57
|
-
workflows?: CapabilityPreset['workflows'];
|
|
58
|
-
boundaries?: CapabilityPreset['boundaries'];
|
|
59
|
-
runtime?: CapabilityPreset['runtime'];
|
|
60
|
-
locks?: CapabilityPreset['locks'];
|
|
61
|
-
};
|
|
62
|
-
export type UpdateCapabilityPresetBody = {
|
|
63
|
-
name?: string;
|
|
64
|
-
description?: string | null;
|
|
65
|
-
version?: number;
|
|
66
|
-
extends?: string[] | null;
|
|
67
|
-
models?: CapabilityPreset['models'] | null;
|
|
68
|
-
tools?: CapabilityPreset['tools'] | null;
|
|
69
|
-
skills?: CapabilityPreset['skills'] | null;
|
|
70
|
-
workflows?: CapabilityPreset['workflows'] | null;
|
|
71
|
-
boundaries?: CapabilityPreset['boundaries'] | null;
|
|
72
|
-
runtime?: CapabilityPreset['runtime'] | null;
|
|
73
|
-
locks?: string[] | null;
|
|
74
|
-
};
|
|
75
|
-
export declare function listCapabilityPresets(cfg: Config): CapabilityPresetsListResponse;
|
|
76
|
-
export declare function prepareCreateCapabilityPreset(cfg: Config, body: CreateCapabilityPresetBody): CapabilityPresetAdminResult<{
|
|
77
|
-
nextConfig: Config;
|
|
78
|
-
presetId: string;
|
|
79
|
-
}>;
|
|
80
|
-
export declare function prepareUpdateCapabilityPreset(cfg: Config, presetIdRaw: string, body: UpdateCapabilityPresetBody): CapabilityPresetAdminResult<{
|
|
81
|
-
nextConfig: Config;
|
|
82
|
-
}>;
|
|
83
|
-
export declare function previewCapabilityPresetUpdate(cfg: Config, presetIdRaw: string, body: UpdateCapabilityPresetBody): CapabilityPresetAdminResult<{
|
|
84
|
-
agents: CapabilityPresetPreviewAgent[];
|
|
85
|
-
}>;
|
|
86
|
-
export declare function prepareDeleteCapabilityPreset(cfg: Config, presetIdRaw: string): CapabilityPresetAdminResult<{
|
|
87
|
-
nextConfig: Config;
|
|
88
|
-
}>;
|
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import { CapabilityPresetSchema, init_schema } from "../agent-manifest/schema.js";
|
|
2
|
-
import { init_preset_chain, linearizePresetIds } from "../agent-manifest/preset-chain.js";
|
|
3
|
-
import { resolveCapabilityPresetLayer, resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
4
|
-
import { normalizeConfiguredMcpServers } from "../config/mcp-config-normalize.js";
|
|
5
|
-
import { GATEWAY_BUILTIN_TOOL_IDS } from "./agent-builtin-tools.js";
|
|
6
|
-
import { createWorkflowCatalog } from "../agent/workflow/catalog.js";
|
|
7
|
-
//#region src/gateway/capability-presets-admin.ts
|
|
8
|
-
init_schema();
|
|
9
|
-
init_preset_chain();
|
|
10
|
-
function presetMap(cfg) {
|
|
11
|
-
return cfg.agents.capabilityPresets ?? {};
|
|
12
|
-
}
|
|
13
|
-
function normalizePresetId(id) {
|
|
14
|
-
return id.trim().toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
function flattenPolicy(value, path = "", out = /* @__PURE__ */ new Map()) {
|
|
17
|
-
if (Array.isArray(value) || value === null || typeof value !== "object") {
|
|
18
|
-
if (path) out.set(path, value);
|
|
19
|
-
return out;
|
|
20
|
-
}
|
|
21
|
-
for (const [key, child] of Object.entries(value)) flattenPolicy(child, path ? `${path}.${key}` : key, out);
|
|
22
|
-
return out;
|
|
23
|
-
}
|
|
24
|
-
function manifestDiff(before, after) {
|
|
25
|
-
const beforeFlat = flattenPolicy(before);
|
|
26
|
-
const afterFlat = flattenPolicy(after);
|
|
27
|
-
return [...new Set([...beforeFlat.keys(), ...afterFlat.keys()])].filter((path) => JSON.stringify(beforeFlat.get(path)) !== JSON.stringify(afterFlat.get(path))).sort((a, b) => a.localeCompare(b)).map((path) => ({
|
|
28
|
-
path,
|
|
29
|
-
...beforeFlat.has(path) ? { before: beforeFlat.get(path) } : {},
|
|
30
|
-
...afterFlat.has(path) ? { after: afterFlat.get(path) } : {}
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
function agentUsage(cfg, presetId) {
|
|
34
|
-
const defaultPresetId = cfg.agents.defaultPreset || "default";
|
|
35
|
-
return cfg.agents.list.filter((agent) => {
|
|
36
|
-
return linearizePresetIds([...cfg.agents.capabilityPresets[defaultPresetId] ? [defaultPresetId] : [], ...(agent.extends ?? []).filter((id) => id !== defaultPresetId)], cfg.agents.capabilityPresets).includes(presetId);
|
|
37
|
-
}).map((agent) => ({
|
|
38
|
-
agentId: agent.id,
|
|
39
|
-
...agent.identity.name ? { agentName: agent.identity.name } : {},
|
|
40
|
-
direct: presetId === defaultPresetId || (agent.extends ?? []).includes(presetId)
|
|
41
|
-
})).sort((a, b) => a.agentId.localeCompare(b.agentId));
|
|
42
|
-
}
|
|
43
|
-
function validatePresetReferences(presets) {
|
|
44
|
-
for (const [id, preset] of Object.entries(presets)) for (const parent of preset.extends ?? []) if (!presets[parent]) return {
|
|
45
|
-
ok: false,
|
|
46
|
-
error: `capability preset "${id}" extends missing preset "${parent}"`,
|
|
47
|
-
status: 400
|
|
48
|
-
};
|
|
49
|
-
const visiting = /* @__PURE__ */ new Set();
|
|
50
|
-
const visited = /* @__PURE__ */ new Set();
|
|
51
|
-
const visit = (id, stack) => {
|
|
52
|
-
if (visiting.has(id)) return {
|
|
53
|
-
ok: false,
|
|
54
|
-
error: `capability preset cycle detected: ${[...stack, id].join(" -> ")}`,
|
|
55
|
-
status: 400
|
|
56
|
-
};
|
|
57
|
-
if (visited.has(id)) return {
|
|
58
|
-
ok: true,
|
|
59
|
-
data: void 0
|
|
60
|
-
};
|
|
61
|
-
visiting.add(id);
|
|
62
|
-
for (const parent of presets[id]?.extends ?? []) {
|
|
63
|
-
const res = visit(parent, [...stack, id]);
|
|
64
|
-
if (!res.ok) return res;
|
|
65
|
-
}
|
|
66
|
-
visiting.delete(id);
|
|
67
|
-
visited.add(id);
|
|
68
|
-
return {
|
|
69
|
-
ok: true,
|
|
70
|
-
data: void 0
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
for (const id of Object.keys(presets)) {
|
|
74
|
-
const res = visit(id, []);
|
|
75
|
-
if (!res.ok) return res;
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
ok: true,
|
|
79
|
-
data: void 0
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function validateAgentPresetReferences(cfg) {
|
|
83
|
-
const presets = presetMap(cfg);
|
|
84
|
-
for (const agent of cfg.agents.list) for (const presetId of agent.extends ?? []) if (!presets[presetId]) return {
|
|
85
|
-
ok: false,
|
|
86
|
-
error: `agent "${agent.id}" extends missing preset "${presetId}"`,
|
|
87
|
-
status: 400
|
|
88
|
-
};
|
|
89
|
-
return {
|
|
90
|
-
ok: true,
|
|
91
|
-
data: void 0
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function nextConfigWithPresets(cfg, presets) {
|
|
95
|
-
const refs = validatePresetReferences(presets);
|
|
96
|
-
if (refs.ok === false) return {
|
|
97
|
-
ok: false,
|
|
98
|
-
error: refs.error,
|
|
99
|
-
status: refs.status
|
|
100
|
-
};
|
|
101
|
-
const nextConfig = {
|
|
102
|
-
...cfg,
|
|
103
|
-
agents: {
|
|
104
|
-
...cfg.agents,
|
|
105
|
-
capabilityPresets: presets
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const agentRefs = validateAgentPresetReferences(nextConfig);
|
|
109
|
-
if (agentRefs.ok === false) return {
|
|
110
|
-
ok: false,
|
|
111
|
-
error: agentRefs.error,
|
|
112
|
-
status: agentRefs.status
|
|
113
|
-
};
|
|
114
|
-
for (const agent of nextConfig.agents.list) try {
|
|
115
|
-
resolveEffectiveAgentManifest({
|
|
116
|
-
agent,
|
|
117
|
-
presets,
|
|
118
|
-
defaultPresetId: nextConfig.agents.defaultPreset
|
|
119
|
-
});
|
|
120
|
-
} catch (error) {
|
|
121
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
122
|
-
return {
|
|
123
|
-
ok: false,
|
|
124
|
-
error: `agent "${agent.id}" effective manifest is invalid: ${message}`,
|
|
125
|
-
status: 400
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
ok: true,
|
|
130
|
-
data: { nextConfig }
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function listCapabilityPresets(cfg) {
|
|
134
|
-
const presets = Object.values(presetMap(cfg)).map((preset) => {
|
|
135
|
-
const inherited = resolveCapabilityPresetLayer({
|
|
136
|
-
presetIds: preset.extends,
|
|
137
|
-
presets: cfg.agents.capabilityPresets,
|
|
138
|
-
defaultPresetId: preset.id === cfg.agents.defaultPreset ? "__none__" : cfg.agents.defaultPreset
|
|
139
|
-
});
|
|
140
|
-
return {
|
|
141
|
-
...preset,
|
|
142
|
-
usage: agentUsage(cfg, preset.id),
|
|
143
|
-
inherited: inherited.patch,
|
|
144
|
-
inheritedSources: inherited.sources
|
|
145
|
-
};
|
|
146
|
-
}).sort((a, b) => a.id.localeCompare(b.id));
|
|
147
|
-
const agents = cfg.agents.list.map((agent) => ({
|
|
148
|
-
id: agent.id,
|
|
149
|
-
...agent.identity.name ? { name: agent.identity.name } : {},
|
|
150
|
-
extends: [...agent.extends ?? []]
|
|
151
|
-
})).sort((a, b) => a.id.localeCompare(b.id));
|
|
152
|
-
const workflows = createWorkflowCatalog().list().map((entry) => ({
|
|
153
|
-
id: entry.name,
|
|
154
|
-
title: entry.title,
|
|
155
|
-
description: entry.description
|
|
156
|
-
}));
|
|
157
|
-
return {
|
|
158
|
-
defaultPresetId: cfg.agents.defaultPreset,
|
|
159
|
-
presets,
|
|
160
|
-
agents,
|
|
161
|
-
builtinToolIds: [...GATEWAY_BUILTIN_TOOL_IDS],
|
|
162
|
-
mcpServerIds: Object.keys(normalizeConfiguredMcpServers(cfg.mcp?.servers)).sort(),
|
|
163
|
-
workflows
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
function prepareCreateCapabilityPreset(cfg, body) {
|
|
167
|
-
const id = normalizePresetId(body.id ?? "");
|
|
168
|
-
const name = body.name?.trim() || id;
|
|
169
|
-
const description = body.description?.trim();
|
|
170
|
-
const { id: _id, name: _name, description: _description, ...policy } = body;
|
|
171
|
-
const parsed = CapabilityPresetSchema.safeParse({
|
|
172
|
-
...policy,
|
|
173
|
-
id,
|
|
174
|
-
name,
|
|
175
|
-
version: body.version ?? 1,
|
|
176
|
-
...description ? { description } : {}
|
|
177
|
-
});
|
|
178
|
-
if (!parsed.success) return {
|
|
179
|
-
ok: false,
|
|
180
|
-
error: parsed.error.issues[0]?.message ?? "capability preset is invalid",
|
|
181
|
-
status: 400
|
|
182
|
-
};
|
|
183
|
-
const presets = presetMap(cfg);
|
|
184
|
-
if (presets[id]) return {
|
|
185
|
-
ok: false,
|
|
186
|
-
error: `capability preset "${id}" already exists`,
|
|
187
|
-
status: 409
|
|
188
|
-
};
|
|
189
|
-
const next = nextConfigWithPresets(cfg, {
|
|
190
|
-
...presets,
|
|
191
|
-
[id]: parsed.data
|
|
192
|
-
});
|
|
193
|
-
if (next.ok === false) return {
|
|
194
|
-
ok: false,
|
|
195
|
-
error: next.error,
|
|
196
|
-
status: next.status
|
|
197
|
-
};
|
|
198
|
-
return {
|
|
199
|
-
ok: true,
|
|
200
|
-
data: {
|
|
201
|
-
...next.data,
|
|
202
|
-
presetId: id
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
function prepareUpdateCapabilityPreset(cfg, presetIdRaw, body) {
|
|
207
|
-
const presetId = normalizePresetId(presetIdRaw);
|
|
208
|
-
const presets = presetMap(cfg);
|
|
209
|
-
const current = presets[presetId];
|
|
210
|
-
if (!current) return {
|
|
211
|
-
ok: false,
|
|
212
|
-
error: `capability preset "${presetId}" not found`,
|
|
213
|
-
status: 404
|
|
214
|
-
};
|
|
215
|
-
const nextPreset = { ...current };
|
|
216
|
-
if (body.name !== void 0) {
|
|
217
|
-
const name = body.name.trim();
|
|
218
|
-
if (!name) return {
|
|
219
|
-
ok: false,
|
|
220
|
-
error: "name must be a non-empty string",
|
|
221
|
-
status: 400
|
|
222
|
-
};
|
|
223
|
-
nextPreset.name = name;
|
|
224
|
-
}
|
|
225
|
-
if (body.description !== void 0) if (body.description === null || !body.description.trim()) delete nextPreset.description;
|
|
226
|
-
else nextPreset.description = body.description.trim();
|
|
227
|
-
nextPreset.version = body.version ?? current.version + 1;
|
|
228
|
-
for (const key of [
|
|
229
|
-
"extends",
|
|
230
|
-
"models",
|
|
231
|
-
"tools",
|
|
232
|
-
"skills",
|
|
233
|
-
"workflows",
|
|
234
|
-
"boundaries",
|
|
235
|
-
"runtime",
|
|
236
|
-
"locks"
|
|
237
|
-
]) {
|
|
238
|
-
if (body[key] === void 0) continue;
|
|
239
|
-
if (body[key] === null) delete nextPreset[key];
|
|
240
|
-
else nextPreset[key] = body[key];
|
|
241
|
-
}
|
|
242
|
-
const parsed = CapabilityPresetSchema.safeParse(nextPreset);
|
|
243
|
-
if (!parsed.success) return {
|
|
244
|
-
ok: false,
|
|
245
|
-
error: parsed.error.issues[0]?.message ?? "capability preset is invalid",
|
|
246
|
-
status: 400
|
|
247
|
-
};
|
|
248
|
-
return nextConfigWithPresets(cfg, {
|
|
249
|
-
...presets,
|
|
250
|
-
[presetId]: parsed.data
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
function previewCapabilityPresetUpdate(cfg, presetIdRaw, body) {
|
|
254
|
-
const prepared = prepareUpdateCapabilityPreset(cfg, presetIdRaw, body);
|
|
255
|
-
if (prepared.ok === false) return prepared;
|
|
256
|
-
return {
|
|
257
|
-
ok: true,
|
|
258
|
-
data: { agents: cfg.agents.list.flatMap((agent) => {
|
|
259
|
-
const before = resolveEffectiveAgentManifest({
|
|
260
|
-
agent,
|
|
261
|
-
presets: cfg.agents.capabilityPresets,
|
|
262
|
-
defaultPresetId: cfg.agents.defaultPreset
|
|
263
|
-
}).manifest;
|
|
264
|
-
const after = resolveEffectiveAgentManifest({
|
|
265
|
-
agent,
|
|
266
|
-
presets: prepared.data.nextConfig.agents.capabilityPresets,
|
|
267
|
-
defaultPresetId: prepared.data.nextConfig.agents.defaultPreset
|
|
268
|
-
}).manifest;
|
|
269
|
-
const diffs = manifestDiff(before, after);
|
|
270
|
-
if (diffs.length === 0) return [];
|
|
271
|
-
return [{
|
|
272
|
-
agentId: agent.id,
|
|
273
|
-
...agent.identity.name ? { agentName: agent.identity.name } : {},
|
|
274
|
-
diffs
|
|
275
|
-
}];
|
|
276
|
-
}) }
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
function prepareDeleteCapabilityPreset(cfg, presetIdRaw) {
|
|
280
|
-
const presetId = normalizePresetId(presetIdRaw);
|
|
281
|
-
const presets = presetMap(cfg);
|
|
282
|
-
if (!presets[presetId]) return {
|
|
283
|
-
ok: false,
|
|
284
|
-
error: `capability preset "${presetId}" not found`,
|
|
285
|
-
status: 404
|
|
286
|
-
};
|
|
287
|
-
if (presetId === cfg.agents.defaultPreset) return {
|
|
288
|
-
ok: false,
|
|
289
|
-
error: `capability preset "${presetId}" is the global default and cannot be deleted`,
|
|
290
|
-
status: 409
|
|
291
|
-
};
|
|
292
|
-
const usage = agentUsage(cfg, presetId);
|
|
293
|
-
if (usage.length > 0) return {
|
|
294
|
-
ok: false,
|
|
295
|
-
error: `capability preset "${presetId}" is used by agents: ${usage.map((u) => u.agentId).join(", ")}`,
|
|
296
|
-
status: 409
|
|
297
|
-
};
|
|
298
|
-
const nextPresets = { ...presets };
|
|
299
|
-
delete nextPresets[presetId];
|
|
300
|
-
return nextConfigWithPresets(cfg, nextPresets);
|
|
301
|
-
}
|
|
302
|
-
//#endregion
|
|
303
|
-
export { listCapabilityPresets, prepareCreateCapabilityPreset, prepareDeleteCapabilityPreset, prepareUpdateCapabilityPreset, previewCapabilityPresetUpdate };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../config/schema.js';
|
|
2
|
-
import type { FileReferenceLocationKind, FileReferenceScope } from './file-reference-registry.js';
|
|
3
|
-
export type { FileReferenceLocationKind };
|
|
4
|
-
export interface FilePathClassifierContext {
|
|
5
|
-
workspaceRoot: string;
|
|
6
|
-
profileMarkdownRoot?: string;
|
|
7
|
-
stateDir: string;
|
|
8
|
-
skillsDir: string;
|
|
9
|
-
configFilePath: string;
|
|
10
|
-
agentsHomeDir: string;
|
|
11
|
-
agentId: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function buildFilePathClassifierContext(cfg: Config, sessionKeyRaw?: string): FilePathClassifierContext;
|
|
14
|
-
export declare function looksLikeHostAbsolutePath(pathRaw: string): boolean;
|
|
15
|
-
export declare function fileRefSessionKeysMatch(registered?: string, query?: string): boolean;
|
|
16
|
-
export interface ClassifiedFileLocation {
|
|
17
|
-
scope: FileReferenceScope;
|
|
18
|
-
locationKind?: FileReferenceLocationKind;
|
|
19
|
-
manageRoute?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare function classifyFileLocation(absPath: string, ctx: FilePathClassifierContext): ClassifiedFileLocation;
|
|
22
|
-
export interface ResolveFileReferenceCandidateResult {
|
|
23
|
-
candidate: string | null;
|
|
24
|
-
invalid: boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Resolve user path to an absolute candidate (workspace, absolute host, or profile fallback).
|
|
28
|
-
*/
|
|
29
|
-
export declare function resolveFileReferenceCandidate(rawPath: string, workspaceRoot: string, ctx: FilePathClassifierContext): Promise<ResolveFileReferenceCandidateResult>;
|
|
30
|
-
export declare function displayNameForPath(rawPath: string): string;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
2
|
-
import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
3
|
-
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
4
|
-
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
5
|
-
import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
|
|
6
|
-
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
|
-
import { basename, isAbsolute, resolve } from "node:path";
|
|
8
|
-
import { stat } from "node:fs/promises";
|
|
9
|
-
//#region src/gateway/file-path-classifier.ts
|
|
10
|
-
init_agent_scope();
|
|
11
|
-
init_paths();
|
|
12
|
-
init_paths_state();
|
|
13
|
-
function buildFilePathClassifierContext(cfg, sessionKeyRaw) {
|
|
14
|
-
const agentId = extractProfileAgentId(sessionKeyRaw, cfg);
|
|
15
|
-
const stateDir = resolveStateDir();
|
|
16
|
-
return {
|
|
17
|
-
workspaceRoot: "",
|
|
18
|
-
profileMarkdownRoot: resolveAgentProfileDir(cfg, agentId),
|
|
19
|
-
stateDir,
|
|
20
|
-
skillsDir: resolveSkillsDir(),
|
|
21
|
-
configFilePath: resolveConfigPath(),
|
|
22
|
-
agentsHomeDir: resolve(stateDir, "agents"),
|
|
23
|
-
agentId
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function looksLikeHostAbsolutePath(pathRaw) {
|
|
27
|
-
const p = pathRaw.trim();
|
|
28
|
-
if (!p) return false;
|
|
29
|
-
if (/^[a-z][a-z0-9+.-]*:/i.test(p) && !/^[A-Za-z]:[\\/]/.test(p)) return false;
|
|
30
|
-
return isAbsolute(p) || /^[A-Za-z]:[\\/]/.test(p) || p.startsWith("\\\\");
|
|
31
|
-
}
|
|
32
|
-
function fileRefSessionKeysMatch(registered, query) {
|
|
33
|
-
return (registered ?? "").trim() === (query ?? "").trim();
|
|
34
|
-
}
|
|
35
|
-
function classifyFileLocation(absPath, ctx) {
|
|
36
|
-
const p = resolve(absPath);
|
|
37
|
-
if (isPathUnderWorkspace(resolve(ctx.workspaceRoot), p)) return { scope: "workspace" };
|
|
38
|
-
if (ctx.profileMarkdownRoot) {
|
|
39
|
-
if (isPathUnderWorkspace(resolve(ctx.profileMarkdownRoot), p)) return {
|
|
40
|
-
scope: "agent-profile",
|
|
41
|
-
locationKind: "agent-profile",
|
|
42
|
-
manageRoute: "/settings/agents"
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (isPathUnderWorkspace(resolve(ctx.skillsDir), p)) return {
|
|
46
|
-
scope: "external",
|
|
47
|
-
locationKind: "xopc-skills",
|
|
48
|
-
manageRoute: "/settings/skills"
|
|
49
|
-
};
|
|
50
|
-
if (isPathUnderWorkspace(resolve(ctx.agentsHomeDir), p)) return {
|
|
51
|
-
scope: "external",
|
|
52
|
-
locationKind: "xopc-agents",
|
|
53
|
-
manageRoute: "/settings/agents"
|
|
54
|
-
};
|
|
55
|
-
const stateRoot = resolve(ctx.stateDir);
|
|
56
|
-
if (p === resolve(ctx.configFilePath) || isPathUnderWorkspace(stateRoot, p)) return {
|
|
57
|
-
scope: "external",
|
|
58
|
-
locationKind: "xopc-config",
|
|
59
|
-
manageRoute: "/settings/gateway"
|
|
60
|
-
};
|
|
61
|
-
return {
|
|
62
|
-
scope: "external",
|
|
63
|
-
locationKind: "host"
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Resolve user path to an absolute candidate (workspace, absolute host, or profile fallback).
|
|
68
|
-
*/
|
|
69
|
-
async function resolveFileReferenceCandidate(rawPath, workspaceRoot, ctx) {
|
|
70
|
-
const displayRoot = workspaceRoot;
|
|
71
|
-
ctx = {
|
|
72
|
-
...ctx,
|
|
73
|
-
workspaceRoot: displayRoot
|
|
74
|
-
};
|
|
75
|
-
if (looksLikeHostAbsolutePath(rawPath)) return {
|
|
76
|
-
candidate: resolve(rawPath),
|
|
77
|
-
invalid: false
|
|
78
|
-
};
|
|
79
|
-
const wsPath = resolveWorkspaceSafePath(workspaceRoot, rawPath);
|
|
80
|
-
if (!wsPath) return {
|
|
81
|
-
candidate: null,
|
|
82
|
-
invalid: true
|
|
83
|
-
};
|
|
84
|
-
try {
|
|
85
|
-
await stat(wsPath);
|
|
86
|
-
return {
|
|
87
|
-
candidate: wsPath,
|
|
88
|
-
invalid: false
|
|
89
|
-
};
|
|
90
|
-
} catch (e) {
|
|
91
|
-
if (e?.code === "ENOENT" && ctx.profileMarkdownRoot && isBareProfileMarkdownFileName(rawPath)) return {
|
|
92
|
-
candidate: resolveProfileMarkdownPathIfBareName(rawPath, ctx.profileMarkdownRoot),
|
|
93
|
-
invalid: false
|
|
94
|
-
};
|
|
95
|
-
return {
|
|
96
|
-
candidate: wsPath,
|
|
97
|
-
invalid: false
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function displayNameForPath(rawPath) {
|
|
102
|
-
return basename(rawPath.replace(/\\/g, "/")) || rawPath;
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
export { buildFilePathClassifierContext, classifyFileLocation, displayNameForPath, fileRefSessionKeysMatch, looksLikeHostAbsolutePath, resolveFileReferenceCandidate };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//#region src/gateway/file-reference-errors.ts
|
|
2
|
-
function classifyFileReferenceFsError(err) {
|
|
3
|
-
const code = err?.code;
|
|
4
|
-
if (code === "ENOENT" || code === "ENOTDIR") return {
|
|
5
|
-
code: "FILE_NOT_FOUND",
|
|
6
|
-
message: "File not found",
|
|
7
|
-
status: 404
|
|
8
|
-
};
|
|
9
|
-
if (code === "EACCES" || code === "EPERM") return {
|
|
10
|
-
code: "FILE_ACCESS_DENIED",
|
|
11
|
-
message: "Gateway does not have permission to access this file",
|
|
12
|
-
status: 403
|
|
13
|
-
};
|
|
14
|
-
return {
|
|
15
|
-
code: "FILE_ACCESS_FAILED",
|
|
16
|
-
message: "Gateway could not access this file",
|
|
17
|
-
status: 500
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { classifyFileReferenceFsError };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export type FileReferenceScope = 'workspace' | 'external' | 'agent-profile' | 'session-artifact' | 'missing' | 'invalid';
|
|
2
|
-
/** Where an off-workspace file lives (UI badge + manage deep link). */
|
|
3
|
-
export type FileReferenceLocationKind = 'agent-profile' | 'xopc-skills' | 'xopc-config' | 'xopc-agents' | 'xopc-sessions' | 'host';
|
|
4
|
-
export type FileReferenceCapability = 'preview' | 'edit' | 'openExternal' | 'revealInFolder' | 'copyPath' | 'importToWorkspace';
|
|
5
|
-
export interface RegisteredFileReference {
|
|
6
|
-
id: string;
|
|
7
|
-
absolutePath: string;
|
|
8
|
-
sessionKey?: string;
|
|
9
|
-
scope: FileReferenceScope;
|
|
10
|
-
locationKind?: FileReferenceLocationKind;
|
|
11
|
-
capabilities: FileReferenceCapability[];
|
|
12
|
-
expiresAt: number;
|
|
13
|
-
}
|
|
14
|
-
export interface RegisterFileReferenceInput {
|
|
15
|
-
absolutePath: string;
|
|
16
|
-
sessionKey?: string;
|
|
17
|
-
scope: FileReferenceScope;
|
|
18
|
-
locationKind?: FileReferenceLocationKind;
|
|
19
|
-
capabilities: FileReferenceCapability[];
|
|
20
|
-
ttlMs?: number;
|
|
21
|
-
}
|
|
22
|
-
export declare class FileReferenceRegistry {
|
|
23
|
-
private readonly refs;
|
|
24
|
-
register(input: RegisterFileReferenceInput): RegisteredFileReference;
|
|
25
|
-
resolve(id: string): RegisteredFileReference | null;
|
|
26
|
-
/**
|
|
27
|
-
* Remove a specific reference (used after a one-shot action like
|
|
28
|
-
* import-to-workspace completes so the source card can't be re-triggered).
|
|
29
|
-
* Returns true if the reference existed and was removed.
|
|
30
|
-
*/
|
|
31
|
-
expireById(id: string): boolean;
|
|
32
|
-
expire(now?: number): void;
|
|
33
|
-
}
|
|
34
|
-
export declare const fileReferenceRegistry: FileReferenceRegistry;
|