@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,45 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
//#region src/gateway/file-reference-registry.ts
|
|
3
|
-
const DEFAULT_TTL_MS = 1800 * 1e3;
|
|
4
|
-
var FileReferenceRegistry = class {
|
|
5
|
-
refs = /* @__PURE__ */ new Map();
|
|
6
|
-
register(input) {
|
|
7
|
-
this.expire();
|
|
8
|
-
const id = randomUUID();
|
|
9
|
-
const ref = {
|
|
10
|
-
id,
|
|
11
|
-
absolutePath: input.absolutePath,
|
|
12
|
-
sessionKey: input.sessionKey?.trim() || void 0,
|
|
13
|
-
scope: input.scope,
|
|
14
|
-
locationKind: input.locationKind,
|
|
15
|
-
capabilities: [...new Set(input.capabilities)],
|
|
16
|
-
expiresAt: Date.now() + (input.ttlMs ?? DEFAULT_TTL_MS)
|
|
17
|
-
};
|
|
18
|
-
this.refs.set(id, ref);
|
|
19
|
-
return ref;
|
|
20
|
-
}
|
|
21
|
-
resolve(id) {
|
|
22
|
-
this.expire();
|
|
23
|
-
const ref = this.refs.get(id);
|
|
24
|
-
if (!ref) return null;
|
|
25
|
-
if (ref.expiresAt <= Date.now()) {
|
|
26
|
-
this.refs.delete(id);
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return ref;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Remove a specific reference (used after a one-shot action like
|
|
33
|
-
* import-to-workspace completes so the source card can't be re-triggered).
|
|
34
|
-
* Returns true if the reference existed and was removed.
|
|
35
|
-
*/
|
|
36
|
-
expireById(id) {
|
|
37
|
-
return this.refs.delete(id);
|
|
38
|
-
}
|
|
39
|
-
expire(now = Date.now()) {
|
|
40
|
-
for (const [id, ref] of this.refs) if (ref.expiresAt <= now) this.refs.delete(id);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const fileReferenceRegistry = new FileReferenceRegistry();
|
|
44
|
-
//#endregion
|
|
45
|
-
export { FileReferenceRegistry, fileReferenceRegistry };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { AgentTypedModel } from '../../../config/schema.js';
|
|
2
|
-
/**
|
|
3
|
-
* Coerce PATCH body `{ roles: Record<id, role> }` into validated typed model roles.
|
|
4
|
-
* Returns `null` to clear, `undefined` when input should be skipped, or cleaned roles.
|
|
5
|
-
* Empty roles after filtering → `null` (same as clear).
|
|
6
|
-
*/
|
|
7
|
-
export declare function normalizePatchTypedModels(v: unknown): Record<string, Omit<AgentTypedModel, 'id'>> | null | undefined;
|
|
8
|
-
/** Read `primary` from an `AgentModelConfig` object. */
|
|
9
|
-
export declare function agentModelRefToString(ref: unknown): string | undefined;
|
|
10
|
-
export declare function agentModelFallbacksToArray(ref: unknown): string[];
|
|
11
|
-
/**
|
|
12
|
-
* Coerce a PATCH body `model` value into the canonical `{ primary, fallbacks? }`
|
|
13
|
-
* object form. Returns `undefined` when the input has no usable primary so the
|
|
14
|
-
* caller can skip the assignment.
|
|
15
|
-
*/
|
|
16
|
-
export declare function normalizePatchAgentModel(v: unknown): {
|
|
17
|
-
primary: string;
|
|
18
|
-
fallbacks?: string[];
|
|
19
|
-
} | undefined;
|
|
20
|
-
/** Read `timeoutMs` from an image-generation model ref (only set when ref is an object). */
|
|
21
|
-
export declare function agentImageGenerationModelTimeoutMs(ref: unknown): number | null;
|
|
22
|
-
/** Read `autoProviderFallback` from an image-generation model ref. Defaults to false. */
|
|
23
|
-
export declare function agentImageGenerationModelAutoProviderFallback(ref: unknown): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* PATCH body normalizer for image-generation model refs. Always
|
|
26
|
-
* emits `{ primary, fallbacks?, timeoutMs?, autoProviderFallback? }`. Returns
|
|
27
|
-
* `undefined` when the input has no usable primary so the caller can skip the
|
|
28
|
-
* assignment.
|
|
29
|
-
*/
|
|
30
|
-
export declare function normalizePatchAgentImageGenerationModel(v: unknown): {
|
|
31
|
-
primary: string;
|
|
32
|
-
fallbacks?: string[];
|
|
33
|
-
timeoutMs?: number;
|
|
34
|
-
autoProviderFallback?: true;
|
|
35
|
-
} | undefined;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
//#region src/gateway/hono/lib/agent-model.ts
|
|
2
|
-
const TYPED_MODEL_ID_RE = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
3
|
-
function isValidProviderModelRef(ref) {
|
|
4
|
-
const trimmed = ref.trim();
|
|
5
|
-
const idx = trimmed.indexOf("/");
|
|
6
|
-
return idx > 0 && idx < trimmed.length - 1;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Coerce PATCH body `{ roles: Record<id, role> }` into validated typed model roles.
|
|
10
|
-
* Returns `null` to clear, `undefined` when input should be skipped, or cleaned roles.
|
|
11
|
-
* Empty roles after filtering → `null` (same as clear).
|
|
12
|
-
*/
|
|
13
|
-
function normalizePatchTypedModels(v) {
|
|
14
|
-
if (v === void 0) return void 0;
|
|
15
|
-
if (v === null) return null;
|
|
16
|
-
if (!v || typeof v !== "object" || Array.isArray(v) || !("roles" in v)) return void 0;
|
|
17
|
-
const rawRoles = v.roles;
|
|
18
|
-
if (!rawRoles || typeof rawRoles !== "object" || Array.isArray(rawRoles)) return void 0;
|
|
19
|
-
const rows = Object.entries(rawRoles).map(([id, role]) => ({
|
|
20
|
-
id,
|
|
21
|
-
...role
|
|
22
|
-
}));
|
|
23
|
-
const byId = /* @__PURE__ */ new Map();
|
|
24
|
-
for (const raw of rows) {
|
|
25
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
26
|
-
const o = raw;
|
|
27
|
-
const id = typeof o.id === "string" ? o.id.trim() : "";
|
|
28
|
-
const model = typeof o.model === "string" ? o.model.trim() : "";
|
|
29
|
-
if (!id || !TYPED_MODEL_ID_RE.test(id) || !model || !isValidProviderModelRef(model)) continue;
|
|
30
|
-
const description = typeof o.description === "string" && o.description.trim() ? o.description.trim().slice(0, 500) : void 0;
|
|
31
|
-
byId.set(id, description ? {
|
|
32
|
-
description,
|
|
33
|
-
model
|
|
34
|
-
} : { model });
|
|
35
|
-
}
|
|
36
|
-
if (byId.size === 0) return null;
|
|
37
|
-
return Object.fromEntries(byId.entries());
|
|
38
|
-
}
|
|
39
|
-
/** Read `primary` from an `AgentModelConfig` object. */
|
|
40
|
-
function agentModelRefToString(ref) {
|
|
41
|
-
if (!ref || typeof ref !== "object" || Array.isArray(ref)) return void 0;
|
|
42
|
-
const p = ref.primary;
|
|
43
|
-
return typeof p === "string" && p.trim() ? p : void 0;
|
|
44
|
-
}
|
|
45
|
-
function agentModelFallbacksToArray(ref) {
|
|
46
|
-
if (!ref || typeof ref !== "object" || Array.isArray(ref)) return [];
|
|
47
|
-
const f = ref.fallbacks;
|
|
48
|
-
if (!Array.isArray(f)) return [];
|
|
49
|
-
return f.filter((x) => typeof x === "string" && x.trim().length > 0);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Coerce a PATCH body `model` value into the canonical `{ primary, fallbacks? }`
|
|
53
|
-
* object form. Returns `undefined` when the input has no usable primary so the
|
|
54
|
-
* caller can skip the assignment.
|
|
55
|
-
*/
|
|
56
|
-
function normalizePatchAgentModel(v) {
|
|
57
|
-
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
58
|
-
const o = v;
|
|
59
|
-
const primary = typeof o.primary === "string" ? o.primary.trim() : "";
|
|
60
|
-
if (!primary) return void 0;
|
|
61
|
-
const fallbacks = Array.isArray(o.fallbacks) ? o.fallbacks.filter((x) => typeof x === "string" && x.trim().length > 0) : [];
|
|
62
|
-
return fallbacks.length > 0 ? {
|
|
63
|
-
primary,
|
|
64
|
-
fallbacks
|
|
65
|
-
} : { primary };
|
|
66
|
-
}
|
|
67
|
-
/** Read `timeoutMs` from an image-generation model ref (only set when ref is an object). */
|
|
68
|
-
function agentImageGenerationModelTimeoutMs(ref) {
|
|
69
|
-
if (!ref || typeof ref !== "object" || Array.isArray(ref)) return null;
|
|
70
|
-
const v = ref.timeoutMs;
|
|
71
|
-
return typeof v === "number" && Number.isFinite(v) && v > 0 ? v : null;
|
|
72
|
-
}
|
|
73
|
-
/** Read `autoProviderFallback` from an image-generation model ref. Defaults to false. */
|
|
74
|
-
function agentImageGenerationModelAutoProviderFallback(ref) {
|
|
75
|
-
if (!ref || typeof ref !== "object" || Array.isArray(ref)) return false;
|
|
76
|
-
return ref.autoProviderFallback === true;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* PATCH body normalizer for image-generation model refs. Always
|
|
80
|
-
* emits `{ primary, fallbacks?, timeoutMs?, autoProviderFallback? }`. Returns
|
|
81
|
-
* `undefined` when the input has no usable primary so the caller can skip the
|
|
82
|
-
* assignment.
|
|
83
|
-
*/
|
|
84
|
-
function normalizePatchAgentImageGenerationModel(v) {
|
|
85
|
-
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
86
|
-
const o = v;
|
|
87
|
-
const primary = typeof o.primary === "string" ? o.primary.trim() : "";
|
|
88
|
-
if (!primary) return void 0;
|
|
89
|
-
const out = { primary };
|
|
90
|
-
const fallbacks = Array.isArray(o.fallbacks) ? o.fallbacks.filter((x) => typeof x === "string" && x.trim().length > 0).map((x) => x.trim()) : [];
|
|
91
|
-
if (fallbacks.length > 0) out.fallbacks = fallbacks;
|
|
92
|
-
if (typeof o.timeoutMs === "number" && Number.isFinite(o.timeoutMs) && o.timeoutMs > 0) out.timeoutMs = Math.floor(o.timeoutMs);
|
|
93
|
-
if (o.autoProviderFallback === true) out.autoProviderFallback = true;
|
|
94
|
-
return out;
|
|
95
|
-
}
|
|
96
|
-
//#endregion
|
|
97
|
-
export { agentImageGenerationModelAutoProviderFallback, agentImageGenerationModelTimeoutMs, agentModelFallbacksToArray, agentModelRefToString, normalizePatchAgentImageGenerationModel, normalizePatchAgentModel, normalizePatchTypedModels };
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { CapabilityPresetSchema, init_schema } from "../../../agent-manifest/schema.js";
|
|
2
|
-
import { init_agent_scope, normalizeAgentId } from "../../../agent/agent-scope.js";
|
|
3
|
-
import { listCapabilityPresets, prepareCreateCapabilityPreset, prepareDeleteCapabilityPreset, prepareUpdateCapabilityPreset, previewCapabilityPresetUpdate } from "../../capability-presets-admin.js";
|
|
4
|
-
//#region src/gateway/hono/routes/capability-presets.ts
|
|
5
|
-
init_schema();
|
|
6
|
-
init_agent_scope();
|
|
7
|
-
function parseJsonObject(raw) {
|
|
8
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return { error: "body must be an object" };
|
|
9
|
-
return raw;
|
|
10
|
-
}
|
|
11
|
-
function isParseError(value) {
|
|
12
|
-
return typeof value === "object" && value !== null && "error" in value && typeof value.error === "string";
|
|
13
|
-
}
|
|
14
|
-
function parseCreateBody(raw) {
|
|
15
|
-
const body = parseJsonObject(raw);
|
|
16
|
-
if (isParseError(body)) return body;
|
|
17
|
-
const out = {
|
|
18
|
-
id: typeof body.id === "string" ? body.id : void 0,
|
|
19
|
-
name: typeof body.name === "string" ? body.name : void 0,
|
|
20
|
-
description: typeof body.description === "string" ? body.description : void 0
|
|
21
|
-
};
|
|
22
|
-
if (Object.hasOwn(body, "version")) out.version = Number(body.version);
|
|
23
|
-
if (Object.hasOwn(body, "memory")) return { error: "memory is not a capability preset field" };
|
|
24
|
-
for (const key of [
|
|
25
|
-
"extends",
|
|
26
|
-
"models",
|
|
27
|
-
"tools",
|
|
28
|
-
"skills",
|
|
29
|
-
"workflows",
|
|
30
|
-
"boundaries",
|
|
31
|
-
"runtime",
|
|
32
|
-
"locks"
|
|
33
|
-
]) {
|
|
34
|
-
if (!Object.hasOwn(body, key)) continue;
|
|
35
|
-
const parsed = CapabilityPresetSchema.pick({ [key]: true }).safeParse({ [key]: body[key] });
|
|
36
|
-
if (!parsed.success) return { error: `${key} ${parsed.error.issues[0]?.message ?? "is invalid"}` };
|
|
37
|
-
out[key] = parsed.data[key];
|
|
38
|
-
}
|
|
39
|
-
return out;
|
|
40
|
-
}
|
|
41
|
-
function parseUpdateBody(raw) {
|
|
42
|
-
const body = parseJsonObject(raw);
|
|
43
|
-
if (isParseError(body)) return body;
|
|
44
|
-
const out = {};
|
|
45
|
-
if (Object.hasOwn(body, "name")) out.name = String(body.name ?? "");
|
|
46
|
-
if (Object.hasOwn(body, "description")) out.description = body.description === null ? null : String(body.description ?? "");
|
|
47
|
-
if (Object.hasOwn(body, "version")) out.version = Number(body.version);
|
|
48
|
-
if (Object.hasOwn(body, "memory")) return { error: "memory is not a capability preset field" };
|
|
49
|
-
for (const key of [
|
|
50
|
-
"extends",
|
|
51
|
-
"models",
|
|
52
|
-
"tools",
|
|
53
|
-
"skills",
|
|
54
|
-
"workflows",
|
|
55
|
-
"boundaries",
|
|
56
|
-
"runtime",
|
|
57
|
-
"locks"
|
|
58
|
-
]) {
|
|
59
|
-
if (!Object.hasOwn(body, key)) continue;
|
|
60
|
-
if (body[key] === null) {
|
|
61
|
-
out[key] = null;
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
const parsed = CapabilityPresetSchema.pick({ [key]: true }).safeParse({ [key]: body[key] });
|
|
65
|
-
if (!parsed.success) return { error: `${key} ${parsed.error.issues[0]?.message ?? "is invalid"}` };
|
|
66
|
-
out[key] = parsed.data[key];
|
|
67
|
-
}
|
|
68
|
-
return out;
|
|
69
|
-
}
|
|
70
|
-
function registerCapabilityPresetsRoutes(authenticated, deps) {
|
|
71
|
-
const { service, strictRateLimitMiddleware } = deps;
|
|
72
|
-
authenticated.get("/api/capability-presets", async (c) => {
|
|
73
|
-
return c.json({
|
|
74
|
-
ok: true,
|
|
75
|
-
payload: listCapabilityPresets(service.currentConfig)
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
authenticated.post("/api/capability-presets", strictRateLimitMiddleware, async (c) => {
|
|
79
|
-
let raw;
|
|
80
|
-
try {
|
|
81
|
-
raw = await c.req.json();
|
|
82
|
-
} catch {
|
|
83
|
-
return c.json({
|
|
84
|
-
ok: false,
|
|
85
|
-
error: { message: "Invalid JSON" }
|
|
86
|
-
}, 400);
|
|
87
|
-
}
|
|
88
|
-
const body = parseCreateBody(raw);
|
|
89
|
-
if (isParseError(body)) return c.json({
|
|
90
|
-
ok: false,
|
|
91
|
-
error: { message: body.error }
|
|
92
|
-
}, 400);
|
|
93
|
-
const prep = prepareCreateCapabilityPreset(service.currentConfig, body);
|
|
94
|
-
if (prep.ok === false) return c.json({
|
|
95
|
-
ok: false,
|
|
96
|
-
error: { message: prep.error }
|
|
97
|
-
}, prep.status ?? 400);
|
|
98
|
-
const save = await service.saveConfig(prep.data.nextConfig);
|
|
99
|
-
if (!save.saved) return c.json({
|
|
100
|
-
ok: false,
|
|
101
|
-
error: { message: save.error ?? "save failed" }
|
|
102
|
-
}, 500);
|
|
103
|
-
return c.json({
|
|
104
|
-
ok: true,
|
|
105
|
-
payload: {
|
|
106
|
-
presetId: prep.data.presetId,
|
|
107
|
-
presets: listCapabilityPresets(service.currentConfig)
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
authenticated.patch("/api/capability-presets/:id", strictRateLimitMiddleware, async (c) => {
|
|
112
|
-
const id = normalizeAgentId(c.req.param("id") ?? "");
|
|
113
|
-
let raw;
|
|
114
|
-
try {
|
|
115
|
-
raw = await c.req.json();
|
|
116
|
-
} catch {
|
|
117
|
-
return c.json({
|
|
118
|
-
ok: false,
|
|
119
|
-
error: { message: "Invalid JSON" }
|
|
120
|
-
}, 400);
|
|
121
|
-
}
|
|
122
|
-
const body = parseUpdateBody(raw);
|
|
123
|
-
if (isParseError(body)) return c.json({
|
|
124
|
-
ok: false,
|
|
125
|
-
error: { message: body.error }
|
|
126
|
-
}, 400);
|
|
127
|
-
const prep = prepareUpdateCapabilityPreset(service.currentConfig, id, body);
|
|
128
|
-
if (prep.ok === false) return c.json({
|
|
129
|
-
ok: false,
|
|
130
|
-
error: { message: prep.error }
|
|
131
|
-
}, prep.status ?? 400);
|
|
132
|
-
const save = await service.saveConfig(prep.data.nextConfig);
|
|
133
|
-
if (!save.saved) return c.json({
|
|
134
|
-
ok: false,
|
|
135
|
-
error: { message: save.error ?? "save failed" }
|
|
136
|
-
}, 500);
|
|
137
|
-
return c.json({
|
|
138
|
-
ok: true,
|
|
139
|
-
payload: listCapabilityPresets(service.currentConfig)
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
authenticated.post("/api/capability-presets/:id/preview", strictRateLimitMiddleware, async (c) => {
|
|
143
|
-
const id = normalizeAgentId(c.req.param("id") ?? "");
|
|
144
|
-
let raw;
|
|
145
|
-
try {
|
|
146
|
-
raw = await c.req.json();
|
|
147
|
-
} catch {
|
|
148
|
-
return c.json({
|
|
149
|
-
ok: false,
|
|
150
|
-
error: { message: "Invalid JSON" }
|
|
151
|
-
}, 400);
|
|
152
|
-
}
|
|
153
|
-
const body = parseUpdateBody(raw);
|
|
154
|
-
if (isParseError(body)) return c.json({
|
|
155
|
-
ok: false,
|
|
156
|
-
error: { message: body.error }
|
|
157
|
-
}, 400);
|
|
158
|
-
const preview = previewCapabilityPresetUpdate(service.currentConfig, id, body);
|
|
159
|
-
if (preview.ok === false) return c.json({
|
|
160
|
-
ok: false,
|
|
161
|
-
error: { message: preview.error }
|
|
162
|
-
}, preview.status ?? 400);
|
|
163
|
-
return c.json({
|
|
164
|
-
ok: true,
|
|
165
|
-
payload: preview.data
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
authenticated.delete("/api/capability-presets/:id", strictRateLimitMiddleware, async (c) => {
|
|
169
|
-
const id = normalizeAgentId(c.req.param("id") ?? "");
|
|
170
|
-
const prep = prepareDeleteCapabilityPreset(service.currentConfig, id);
|
|
171
|
-
if (prep.ok === false) return c.json({
|
|
172
|
-
ok: false,
|
|
173
|
-
error: { message: prep.error }
|
|
174
|
-
}, prep.status ?? 400);
|
|
175
|
-
const save = await service.saveConfig(prep.data.nextConfig);
|
|
176
|
-
if (!save.saved) return c.json({
|
|
177
|
-
ok: false,
|
|
178
|
-
error: { message: save.error ?? "save failed" }
|
|
179
|
-
}, 500);
|
|
180
|
-
return c.json({
|
|
181
|
-
ok: true,
|
|
182
|
-
payload: listCapabilityPresets(service.currentConfig)
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
//#endregion
|
|
187
|
-
export { registerCapabilityPresetsRoutes };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Operator scope system for fine-grained gateway API authorization.
|
|
3
|
-
*
|
|
4
|
-
* Each gateway API method maps to one or more required scopes.
|
|
5
|
-
* Clients declare their scopes at connection time; the gateway enforces
|
|
6
|
-
* that the declared scopes cover the method being invoked.
|
|
7
|
-
*/
|
|
8
|
-
export declare const ADMIN_SCOPE: "operator.admin";
|
|
9
|
-
export declare const READ_SCOPE: "operator.read";
|
|
10
|
-
export declare const WRITE_SCOPE: "operator.write";
|
|
11
|
-
export type OperatorScope = typeof ADMIN_SCOPE | typeof READ_SCOPE | typeof WRITE_SCOPE;
|
|
12
|
-
export declare const KNOWN_OPERATOR_SCOPES: ReadonlySet<OperatorScope>;
|
|
13
|
-
export declare function isOperatorScope(value: unknown): value is OperatorScope;
|
|
14
|
-
/** Default scopes granted to authenticated CLI / direct connections. */
|
|
15
|
-
export declare const DEFAULT_OPERATOR_SCOPES: OperatorScope[];
|
|
16
|
-
/**
|
|
17
|
-
* Check whether a set of granted scopes satisfies the required scope for a route.
|
|
18
|
-
*/
|
|
19
|
-
export declare function authorizeRouteScope(routePath: string, grantedScopes: readonly OperatorScope[]): {
|
|
20
|
-
allowed: true;
|
|
21
|
-
} | {
|
|
22
|
-
allowed: false;
|
|
23
|
-
requiredScope: OperatorScope;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Check whether any of the granted scopes satisfies the required scope.
|
|
27
|
-
*/
|
|
28
|
-
export declare function authorizeScope(requiredScope: OperatorScope, grantedScopes: readonly OperatorScope[]): {
|
|
29
|
-
allowed: true;
|
|
30
|
-
} | {
|
|
31
|
-
allowed: false;
|
|
32
|
-
requiredScope: OperatorScope;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Parse scopes from a comma-separated header value.
|
|
36
|
-
*/
|
|
37
|
-
export declare function parseScopesHeader(headerValue: string | undefined): OperatorScope[];
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
//#region src/gateway/security/operator-scopes.ts
|
|
2
|
-
/**
|
|
3
|
-
* Operator scope system for fine-grained gateway API authorization.
|
|
4
|
-
*
|
|
5
|
-
* Each gateway API method maps to one or more required scopes.
|
|
6
|
-
* Clients declare their scopes at connection time; the gateway enforces
|
|
7
|
-
* that the declared scopes cover the method being invoked.
|
|
8
|
-
*/
|
|
9
|
-
const ADMIN_SCOPE = "operator.admin";
|
|
10
|
-
const READ_SCOPE = "operator.read";
|
|
11
|
-
const WRITE_SCOPE = "operator.write";
|
|
12
|
-
const KNOWN_OPERATOR_SCOPES = new Set([
|
|
13
|
-
ADMIN_SCOPE,
|
|
14
|
-
READ_SCOPE,
|
|
15
|
-
WRITE_SCOPE
|
|
16
|
-
]);
|
|
17
|
-
function isOperatorScope(value) {
|
|
18
|
-
return typeof value === "string" && KNOWN_OPERATOR_SCOPES.has(value);
|
|
19
|
-
}
|
|
20
|
-
/** Default scopes granted to authenticated CLI / direct connections. */
|
|
21
|
-
const DEFAULT_OPERATOR_SCOPES = [
|
|
22
|
-
ADMIN_SCOPE,
|
|
23
|
-
READ_SCOPE,
|
|
24
|
-
WRITE_SCOPE
|
|
25
|
-
];
|
|
26
|
-
/**
|
|
27
|
-
* Route-level scope requirements.
|
|
28
|
-
* Maps HTTP route path prefixes to required minimum scope.
|
|
29
|
-
*/
|
|
30
|
-
const ROUTE_SCOPE_REQUIREMENTS = [
|
|
31
|
-
{
|
|
32
|
-
prefix: "/api/config",
|
|
33
|
-
scope: ADMIN_SCOPE
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
prefix: "/api/update",
|
|
37
|
-
scope: ADMIN_SCOPE
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
prefix: "/api/extensions/registry",
|
|
41
|
-
scope: ADMIN_SCOPE
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
prefix: "/api/agent",
|
|
45
|
-
scope: WRITE_SCOPE
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
prefix: "/api/sessions",
|
|
49
|
-
scope: WRITE_SCOPE
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
prefix: "/api/automations",
|
|
53
|
-
scope: WRITE_SCOPE
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
prefix: "/api/automation-runs",
|
|
57
|
-
scope: WRITE_SCOPE
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
prefix: "/api/channels",
|
|
61
|
-
scope: WRITE_SCOPE
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
prefix: "/api/agents",
|
|
65
|
-
scope: WRITE_SCOPE
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
prefix: "/api/workspace",
|
|
69
|
-
scope: WRITE_SCOPE
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
prefix: "/api/skills",
|
|
73
|
-
scope: WRITE_SCOPE
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
prefix: "/api/marketplace/install",
|
|
77
|
-
scope: ADMIN_SCOPE
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
prefix: "/api/marketplace/uninstall",
|
|
81
|
-
scope: ADMIN_SCOPE
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
prefix: "/api/commands",
|
|
85
|
-
scope: WRITE_SCOPE
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
prefix: "/api/host-fs",
|
|
89
|
-
scope: WRITE_SCOPE
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
prefix: "/api/status",
|
|
93
|
-
scope: READ_SCOPE
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
prefix: "/api/models",
|
|
97
|
-
scope: READ_SCOPE
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
prefix: "/api/logs",
|
|
101
|
-
scope: READ_SCOPE
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
prefix: "/api/doctor",
|
|
105
|
-
scope: READ_SCOPE
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
prefix: "/api/realtime",
|
|
109
|
-
scope: READ_SCOPE
|
|
110
|
-
}
|
|
111
|
-
];
|
|
112
|
-
/** Scope hierarchy: admin > write > read. */
|
|
113
|
-
const SCOPE_HIERARCHY = {
|
|
114
|
-
[ADMIN_SCOPE]: 3,
|
|
115
|
-
[WRITE_SCOPE]: 2,
|
|
116
|
-
[READ_SCOPE]: 1
|
|
117
|
-
};
|
|
118
|
-
function scopeSatisfies(granted, required) {
|
|
119
|
-
return SCOPE_HIERARCHY[granted] >= SCOPE_HIERARCHY[required];
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Check whether a set of granted scopes satisfies the required scope for a route.
|
|
123
|
-
*/
|
|
124
|
-
function authorizeRouteScope(routePath, grantedScopes) {
|
|
125
|
-
const routeRequirement = ROUTE_SCOPE_REQUIREMENTS.find((entry) => routePath.startsWith(entry.prefix));
|
|
126
|
-
if (!routeRequirement) return authorizeScope(READ_SCOPE, grantedScopes);
|
|
127
|
-
return authorizeScope(routeRequirement.scope, grantedScopes);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Check whether any of the granted scopes satisfies the required scope.
|
|
131
|
-
*/
|
|
132
|
-
function authorizeScope(requiredScope, grantedScopes) {
|
|
133
|
-
if (grantedScopes.some((granted) => scopeSatisfies(granted, requiredScope))) return { allowed: true };
|
|
134
|
-
return {
|
|
135
|
-
allowed: false,
|
|
136
|
-
requiredScope
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Parse scopes from a comma-separated header value.
|
|
141
|
-
*/
|
|
142
|
-
function parseScopesHeader(headerValue) {
|
|
143
|
-
if (!headerValue?.trim()) return [...DEFAULT_OPERATOR_SCOPES];
|
|
144
|
-
return headerValue.split(",").map((scope) => scope.trim()).filter(isOperatorScope);
|
|
145
|
-
}
|
|
146
|
-
//#endregion
|
|
147
|
-
export { ADMIN_SCOPE, DEFAULT_OPERATOR_SCOPES, KNOWN_OPERATOR_SCOPES, READ_SCOPE, WRITE_SCOPE, authorizeRouteScope, authorizeScope, isOperatorScope, parseScopesHeader };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type CapabilityPreset } from '../../agent-manifest/schema.js';
|
|
2
|
-
import { type Config } from '../../config/schema.js';
|
|
3
|
-
import type { Migration } from '../types.js';
|
|
4
|
-
export declare const DEFAULT_CAPABILITY_PRESET_MIGRATION_ID = "2026-07-ensure-default-capability-preset";
|
|
5
|
-
export declare function createDefaultCapabilityPreset(): CapabilityPreset;
|
|
6
|
-
export declare function ensureDefaultCapabilityPresetInitialized(config: Config): {
|
|
7
|
-
config: Config;
|
|
8
|
-
changed: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare const defaultCapabilityPresetMigration: Migration;
|