@xopcai/xopc 0.0.231 → 0.0.232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
- package/dist/extensions/telegram/src/config-schema.d.ts +4 -4
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/gateway/static/root/assets/{activity-store-M0nAY5XB.js → activity-store-VXCWz43N.js} +1 -1
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-BXRaZYW8.js +1 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-dR7HMaRX.js +1 -0
- package/dist/gateway/static/root/assets/agents-Bileycwe.js +1 -0
- package/dist/gateway/static/root/assets/api-wGPgL8xY.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DP7YVRPn.js → app-management-settings-panel-BJfClfPx.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CVQ5n7y6.js → appearance-settings-C_R0vUAu.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DSCia0DT.js → apps-page-CBow8pBI.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DnFHkSHE.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-mmr_mHRr.js → attachment-load-DZrEwytM.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DfY-T6Ga.js → automations-page-DpkKajui.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBntVWgv.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CO9QMEh2.js → binary-plugins-Ckc_Csue.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CE14CVOy.js → block-editor-DAC6w-iV.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DrsMd-Po.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-BGd7R8GO.js +1 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-1wgXyoSO.js → browser-workflows-page-DUfj7ntM.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-97gkGeSV.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CuBsz8UI.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-CfboECLt.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdRW6Euc.js → chat-terminal-dock-CA9fndbZ.js} +2 -2
- package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-SuL7td7Z.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CqPu7HYJ.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-C8dJsCgk.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Iz2wYimy.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CMO-J3cG.js → desktop-pet-C3h40FmG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-MmOR4A3u.js → desktop-pet-settings-YfeVVzLe.js} +1 -1
- package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DdH0dG2_.js → extension-debug-page-CChgztz_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Clg-KktN.js → extension-page-DF6ct6_y.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-jgBsjn0F.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DEHnF4Wm.js → gateway-config-api-CVajuIGL.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BGQn8duh.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-BbssNGid.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-D2Rnh9fX.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CJtXu8iD.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Be1o1AXQ.js +1 -0
- package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-YKP2me5Z.js → image-generation-api-D7W2p5_8.js} +1 -1
- package/dist/gateway/static/root/assets/index-B2OJSXX9.js +70 -0
- package/dist/gateway/static/root/assets/index-rHjAElxG.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BvpEeHnm.js → keyboard-shortcuts-settings-BvHYyNus.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-COfelgk7.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Bzvn99eH.js → local-apps-page-Cb8t2wWM.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-DLwVxS3V.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DA8oDjeB.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B8Jie4-J.js +1 -0
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
- package/dist/gateway/static/root/assets/markdown-split-BD1r4o2i.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-RxNHwlNo.js → markdown-view-B-BHEcNd.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D8I7OGnT.js → media-plugins-BCev8fkW.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Dp1OxSKt.js +3 -0
- package/dist/gateway/static/root/assets/mobile-device-api-DACoHhhk.js +1 -0
- package/dist/gateway/static/root/assets/{models-hub-cache-0RjEwafI.js → models-hub-cache-C8zjqmIv.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-api-EpgG-OQc.js → notes-api-DEdNKw0I.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CCvjGMhN.js → notes-page-BBTLjJwa.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DICgUGPv.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-BwNLwbI8.js → oauth-api-BNCO2YK5.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-MmMswmOU.js → product-open-page-fEBbRekH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CqdkznYJ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-dHDXpMCg.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-Cvr4Qm7N.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-2feZudJw.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Dx6o7sLu.js → runtime-tools-settings-panel-BT5B74IH.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-Cdd9c4vt.js → schema-form-C4tB34S5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CO2JCFdy.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DxMVaqdn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D0YxMnhm.js → settings-form-section-D1oXhkgI.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CldfX6FJ.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-c3LJnbvE.js +1 -0
- package/dist/gateway/static/root/assets/settings-shell-layer-context-DCp6ykjQ.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-DZNHb6A5.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DiqBn-oE.js → share-preview-page-DptCK_mk.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DakZ2AGN.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BOiNkWJC.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CZwhWiRl.js → skills-page-OHBeBtSg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-kBGr8opZ.js → skills-page.utils-B9WZbOLC.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CPBs6lWi.js → system-settings-panel-Dj_DpOGw.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D5Nbe3C8.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Qgvo0Ga7.js → theme-store-Cpd3Gd5R.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C4YcEiP9.js → use-autosave-DCl5Yq7N.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-CAPSUK8B.js +1 -0
- package/dist/gateway/static/root/assets/{vendor-codemirror-DRr7hFaD.js → vendor-codemirror--gTq3YAI.js} +16 -16
- package/dist/gateway/static/root/assets/voice-api-key-field-BB_ZQV8F.js +1 -0
- package/dist/gateway/static/root/assets/voice-config-api-BNiYmpl5.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CKIdPEen.js → work-discovery-overlay-BrIdtdum.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK44Vm5W.js → workflow-run-setup-panel-hKh-uCLo.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-ahDvypGO.js +5 -0
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -2
- package/dist/src/agent/agent-manager.js +29 -44
- package/dist/src/agent/background-review/run-background-review.js +10 -15
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/mcp-provider.js +3 -13
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +13 -14
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -9
- package/dist/src/agent/mcp/bundle-mcp-policy.js +1 -13
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +1 -1
- package/dist/src/{agent-runtime/memory-runtime.d.ts → agent/memory/runtime.d.ts} +1 -1
- package/dist/src/{agent-runtime/memory-runtime.js → agent/memory/runtime.js} +2 -3
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -3
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
- package/dist/src/agent/service.js +0 -1
- package/dist/src/agent/starter-agents.js +1 -8
- package/dist/src/agent/tools/executor.d.ts +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -5
- package/dist/src/agent-config/index.d.ts +2 -0
- package/dist/src/agent-config/index.js +11 -0
- package/dist/src/agent-config/resolver.d.ts +11 -0
- package/dist/src/agent-config/resolver.js +113 -0
- package/dist/src/agent-config/schema.d.ts +491 -0
- package/dist/src/agent-config/schema.js +172 -0
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/cli/commands/agents.js +2 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +12 -4
- package/dist/src/cli/commands/image.js +3 -4
- package/dist/src/cli/commands/models.js +9 -3
- package/dist/src/cli/commands/onboard/model.js +12 -11
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -18
- package/dist/src/cli/utils/init-workspace-core.d.ts +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/commands/agents.config.d.ts +1 -3
- package/dist/src/commands/agents.config.js +9 -26
- package/dist/src/config/agent-model-intents.d.ts +10 -0
- package/dist/src/config/agent-model-intents.js +39 -0
- package/dist/src/config/agent-profile.d.ts +7 -9
- package/dist/src/config/agent-profile.js +30 -28
- package/dist/src/config/default-model.d.ts +1 -11
- package/dist/src/config/default-model.js +3 -11
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/integration.d.ts +1 -1
- package/dist/src/config/reload.js +1 -1
- package/dist/src/config/rules.js +3 -3
- package/dist/src/config/schema.d.ts +187 -452
- package/dist/src/config/schema.js +53 -131
- package/dist/src/extensions/activation-context.js +7 -11
- package/dist/src/gateway/agent-builtin-tools.d.ts +250 -6
- package/dist/src/gateway/agent-builtin-tools.js +284 -46
- package/dist/src/gateway/agents-admin.d.ts +20 -62
- package/dist/src/gateway/agents-admin.js +36 -228
- package/dist/src/gateway/device-routes.d.ts +3 -0
- package/dist/src/gateway/device-routes.js +47 -0
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -20
- package/dist/src/gateway/global-defaults-admin.js +20 -120
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
- package/dist/src/gateway/hono/lib/config-payload.js +2 -4
- package/dist/src/gateway/hono/middleware/auth.js +33 -1
- package/dist/src/gateway/hono/middleware/scopes.d.ts +2 -12
- package/dist/src/gateway/hono/middleware/scopes.js +9 -18
- package/dist/src/gateway/hono/routes/agents.js +64 -100
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/device-push.d.ts +2 -0
- package/dist/src/gateway/hono/routes/{mobile.js → device-push.js} +40 -18
- package/dist/src/gateway/hono/routes/devices.d.ts +4 -0
- package/dist/src/gateway/hono/routes/devices.js +214 -0
- package/dist/src/gateway/hono/routes/files.js +5 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -20
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.js +8 -1
- package/dist/src/gateway/hono/routes/status.js +9 -16
- package/dist/src/gateway/hono/routes/tunnel.d.ts +0 -2
- package/dist/src/gateway/hono/routes/tunnel.js +10 -199
- package/dist/src/gateway/image-generation-setup.d.ts +2 -2
- package/dist/src/gateway/image-generation-setup.js +8 -7
- package/dist/src/gateway/public-url.d.ts +1 -1
- package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
- package/dist/src/gateway/security/gateway-principal.js +12 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
- package/dist/src/gateway/security/gateway-scopes.js +66 -0
- package/dist/src/gateway/security/index.d.ts +2 -1
- package/dist/src/gateway/security/index.js +3 -2
- package/dist/src/gateway/service.js +7 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
- package/dist/src/migrations/index.d.ts +0 -1
- package/dist/src/migrations/index.js +1 -2
- package/dist/src/migrations/runner.js +1 -2
- package/dist/src/notifications/device-store.d.ts +1 -1
- package/dist/src/notifications/device-store.js +11 -11
- package/dist/src/notifications/store.js +3 -3
- package/dist/src/providers/index.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +14 -9
- package/dist/src/realtime/runtime.d.ts +2 -0
- package/dist/src/realtime/runtime.js +27 -3
- package/dist/src/realtime/tickets.d.ts +6 -1
- package/dist/src/realtime/tickets.js +2 -1
- package/dist/src/remote-access/exposure-manager.js +3 -3
- package/dist/src/share/share-url.js +2 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
- package/dist/src/storage/sqlite/device-access-repository.js +194 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
- package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.d.ts +10 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.js +50 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tunnel/consent.d.ts +1 -1
- package/dist/src/tunnel/consent.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/tunnel/index.d.ts +1 -4
- package/dist/src/tunnel/index.js +3 -5
- package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
- package/dist/src/tunnel/tunnel-config.js +1 -1
- package/dist/src/tunnel/tunnel-service.d.ts +2 -3
- package/dist/src/tunnel/tunnel-service.js +1 -20
- package/dist/src/tunnel/tunnel-types.d.ts +0 -6
- package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +3 -3
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-CBqUnlvL.js +0 -1
- package/dist/gateway/static/root/assets/agents-7YO6znTT.js +0 -68
- package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +0 -8
- package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DYSMZsms.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-DGCfX4tK.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-DHDa4ht1.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-B9qoxDcn.js +0 -1
- package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-eP3fJ2M6.js +0 -1
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DKkEXXj9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DlBPNubY.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
- package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +0 -70
- package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BQaeyOYm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-D9tmIiEm.js +0 -1
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-y53gEKsF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BoE_tToG.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BQmyb5KC.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BML8zCwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +0 -5
- package/dist/src/agent-manifest/index.d.ts +0 -5
- package/dist/src/agent-manifest/index.js +0 -10
- package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
- package/dist/src/agent-manifest/preset-chain.js +0 -30
- package/dist/src/agent-manifest/prompt.d.ts +0 -2
- package/dist/src/agent-manifest/prompt.js +0 -49
- package/dist/src/agent-manifest/resolver.d.ts +0 -32
- package/dist/src/agent-manifest/resolver.js +0 -114
- package/dist/src/agent-manifest/schema.d.ts +0 -695
- package/dist/src/agent-manifest/schema.js +0 -226
- package/dist/src/agent-manifest/validator.d.ts +0 -25
- package/dist/src/agent-manifest/validator.js +0 -74
- package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
- package/dist/src/agent-runtime/boundary-guard.js +0 -21
- package/dist/src/agent-runtime/index.d.ts +0 -7
- package/dist/src/agent-runtime/index.js +0 -8
- package/dist/src/agent-runtime/model-router.d.ts +0 -11
- package/dist/src/agent-runtime/model-router.js +0 -14
- package/dist/src/agent-runtime/run-trace.d.ts +0 -27
- package/dist/src/agent-runtime/run-trace.js +0 -51
- package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
- package/dist/src/agent-runtime/runtime-profile.js +0 -42
- package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
- package/dist/src/agent-runtime/tool-registry.js +0 -50
- package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
- package/dist/src/agent-runtime/workflow-runtime.js +0 -32
- package/dist/src/config/agent-typed-models.d.ts +0 -13
- package/dist/src/config/agent-typed-models.js +0 -48
- package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
- package/dist/src/gateway/capability-presets-admin.js +0 -303
- package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
- package/dist/src/gateway/hono/lib/agent-model.js +0 -97
- package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
- package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
- package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
- package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
- package/dist/src/gateway/security/operator-scopes.js +0 -147
- package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
- package/dist/src/migrations/config/default-capability-preset.js +0 -133
- package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
- package/dist/src/tunnel/enable-lan-pairing.js +0 -41
- package/dist/src/tunnel/pair-context.d.ts +0 -36
- package/dist/src/tunnel/pair-context.js +0 -77
- package/dist/src/tunnel/pair-url.d.ts +0 -43
- package/dist/src/tunnel/pair-url.js +0 -117
- package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
- package/dist/src/tunnel/pairing-rate-limit.js +0 -28
- package/dist/src/tunnel/pairing.d.ts +0 -21
- package/dist/src/tunnel/pairing.js +0 -103
- package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
- package/dist/src/tunnel/tunnel-qr.js +0 -29
|
@@ -1,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;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { CapabilityPresetSchema, DEFAULT_CAPABILITY_PRESET_ID, init_schema } from "../../agent-manifest/schema.js";
|
|
2
|
-
import { ConfigSchema, init_schema as init_schema$1 } from "../../config/schema.js";
|
|
3
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
-
//#region src/migrations/config/default-capability-preset.ts
|
|
5
|
-
init_schema();
|
|
6
|
-
init_schema$1();
|
|
7
|
-
const DEFAULT_CAPABILITY_PRESET_MIGRATION_ID = "2026-07-ensure-default-capability-preset";
|
|
8
|
-
function createDefaultCapabilityPreset() {
|
|
9
|
-
return {
|
|
10
|
-
id: DEFAULT_CAPABILITY_PRESET_ID,
|
|
11
|
-
name: "Global defaults",
|
|
12
|
-
description: "Default capabilities inherited by every agent.",
|
|
13
|
-
version: 1,
|
|
14
|
-
models: {
|
|
15
|
-
defaultRole: "deep",
|
|
16
|
-
roles: {}
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function ensureDefaultCapabilityPresetInitialized(config) {
|
|
21
|
-
const agents = config.agents;
|
|
22
|
-
const capabilityPresets = { ...agents.capabilityPresets ?? {} };
|
|
23
|
-
let changed = false;
|
|
24
|
-
if (!capabilityPresets["default"]) {
|
|
25
|
-
capabilityPresets[DEFAULT_CAPABILITY_PRESET_ID] = createDefaultCapabilityPreset();
|
|
26
|
-
changed = true;
|
|
27
|
-
}
|
|
28
|
-
const defaultPreset = agents.defaultPreset?.trim() || "default";
|
|
29
|
-
if (defaultPreset !== agents.defaultPreset) changed = true;
|
|
30
|
-
if (!changed) return {
|
|
31
|
-
config,
|
|
32
|
-
changed: false
|
|
33
|
-
};
|
|
34
|
-
return {
|
|
35
|
-
config: ConfigSchema.parse({
|
|
36
|
-
...config,
|
|
37
|
-
agents: {
|
|
38
|
-
...agents,
|
|
39
|
-
defaultPreset,
|
|
40
|
-
capabilityPresets
|
|
41
|
-
}
|
|
42
|
-
}),
|
|
43
|
-
changed: true
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function planned(message, details) {
|
|
47
|
-
return {
|
|
48
|
-
id: DEFAULT_CAPABILITY_PRESET_MIGRATION_ID,
|
|
49
|
-
title: "Initialize global default capability preset",
|
|
50
|
-
kind: "config",
|
|
51
|
-
safety: "auto",
|
|
52
|
-
status: "planned",
|
|
53
|
-
message,
|
|
54
|
-
details
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function conflict(message, details) {
|
|
58
|
-
return {
|
|
59
|
-
id: DEFAULT_CAPABILITY_PRESET_MIGRATION_ID,
|
|
60
|
-
title: "Initialize global default capability preset",
|
|
61
|
-
kind: "config",
|
|
62
|
-
safety: "manual",
|
|
63
|
-
status: "conflict",
|
|
64
|
-
message,
|
|
65
|
-
details
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function readRawConfigObject(configPath) {
|
|
69
|
-
if (!existsSync(configPath)) return null;
|
|
70
|
-
const raw = readFileSync(configPath, "utf8");
|
|
71
|
-
const parsed = JSON.parse(raw);
|
|
72
|
-
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Config root must be an object");
|
|
73
|
-
return parsed;
|
|
74
|
-
}
|
|
75
|
-
const defaultCapabilityPresetMigration = {
|
|
76
|
-
id: DEFAULT_CAPABILITY_PRESET_MIGRATION_ID,
|
|
77
|
-
kind: "config",
|
|
78
|
-
safety: "auto",
|
|
79
|
-
detect(ctx) {
|
|
80
|
-
const raw = readRawConfigObject(ctx.configPath);
|
|
81
|
-
if (!raw) return null;
|
|
82
|
-
const rawAgents = raw.agents;
|
|
83
|
-
if (rawAgents !== void 0 && (rawAgents === null || typeof rawAgents !== "object" || Array.isArray(rawAgents))) return conflict("agents config is not an object; cannot initialize global defaults automatically.");
|
|
84
|
-
const agents = rawAgents ?? {};
|
|
85
|
-
const rawPresets = agents.capabilityPresets;
|
|
86
|
-
if (rawPresets !== void 0 && (rawPresets === null || typeof rawPresets !== "object" || Array.isArray(rawPresets))) return conflict("agents.capabilityPresets is not an object; cannot initialize global defaults automatically.");
|
|
87
|
-
const existingDefault = (rawPresets ?? {})[DEFAULT_CAPABILITY_PRESET_ID];
|
|
88
|
-
if (existingDefault !== void 0) {
|
|
89
|
-
const parsedPreset = CapabilityPresetSchema.safeParse(existingDefault);
|
|
90
|
-
if (!parsedPreset.success) return conflict("Existing default capability preset is invalid; please repair it manually.", { issues: parsedPreset.error.issues.slice(0, 5).map((issue) => ({
|
|
91
|
-
path: issue.path.join("."),
|
|
92
|
-
message: issue.message
|
|
93
|
-
})) });
|
|
94
|
-
}
|
|
95
|
-
const needsDefaultPresetPointer = typeof agents.defaultPreset !== "string" || agents.defaultPreset.trim().length === 0;
|
|
96
|
-
const needsDefaultPresetObject = existingDefault === void 0;
|
|
97
|
-
if (!needsDefaultPresetPointer && !needsDefaultPresetObject) return null;
|
|
98
|
-
return planned("Global default capability preset is missing and will be initialized.", {
|
|
99
|
-
addDefaultPresetPointer: needsDefaultPresetPointer,
|
|
100
|
-
addDefaultPresetObject: needsDefaultPresetObject
|
|
101
|
-
});
|
|
102
|
-
},
|
|
103
|
-
apply(ctx) {
|
|
104
|
-
const detected = this.detect(ctx);
|
|
105
|
-
if (!detected) return {
|
|
106
|
-
id: this.id,
|
|
107
|
-
title: "Initialize global default capability preset",
|
|
108
|
-
kind: "config",
|
|
109
|
-
safety: "auto",
|
|
110
|
-
status: "not_needed",
|
|
111
|
-
message: "Global default capability preset is already initialized."
|
|
112
|
-
};
|
|
113
|
-
if (detected.status === "conflict") return detected;
|
|
114
|
-
const raw = readRawConfigObject(ctx.configPath);
|
|
115
|
-
const ensured = ensureDefaultCapabilityPresetInitialized(ConfigSchema.parse(raw ?? void 0));
|
|
116
|
-
if (!ensured.changed) return {
|
|
117
|
-
...detected,
|
|
118
|
-
status: "not_needed",
|
|
119
|
-
message: "Global default capability preset is already initialized."
|
|
120
|
-
};
|
|
121
|
-
return {
|
|
122
|
-
...detected,
|
|
123
|
-
status: "applied",
|
|
124
|
-
message: "Initialized global default capability preset.",
|
|
125
|
-
details: {
|
|
126
|
-
...detected.details,
|
|
127
|
-
config: ensured.config
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
//#endregion
|
|
133
|
-
export { DEFAULT_CAPABILITY_PRESET_MIGRATION_ID, createDefaultCapabilityPreset, defaultCapabilityPresetMigration, ensureDefaultCapabilityPresetInitialized };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { assertGatewayAuthConfigured, resolveGatewayAuth } from "../gateway/auth.js";
|
|
2
|
-
import { assertGatewayRuntimeConfig } from "../gateway/runtime-config.js";
|
|
3
|
-
//#region src/tunnel/enable-lan-pairing.ts
|
|
4
|
-
function applyLanPairingGatewayPatch(config) {
|
|
5
|
-
if (!config.gateway) return {
|
|
6
|
-
ok: false,
|
|
7
|
-
message: "Gateway section missing from config"
|
|
8
|
-
};
|
|
9
|
-
const previousGateway = JSON.stringify(config.gateway);
|
|
10
|
-
const nextGateway = {
|
|
11
|
-
...config.gateway,
|
|
12
|
-
bind: "lan"
|
|
13
|
-
};
|
|
14
|
-
delete nextGateway.customBindHost;
|
|
15
|
-
const candidate = {
|
|
16
|
-
...config,
|
|
17
|
-
gateway: nextGateway
|
|
18
|
-
};
|
|
19
|
-
const port = nextGateway.port ?? 18790;
|
|
20
|
-
try {
|
|
21
|
-
const auth = resolveGatewayAuth({ authConfig: candidate.gateway.auth });
|
|
22
|
-
assertGatewayAuthConfigured(auth);
|
|
23
|
-
assertGatewayRuntimeConfig({
|
|
24
|
-
cfg: candidate,
|
|
25
|
-
auth,
|
|
26
|
-
port
|
|
27
|
-
});
|
|
28
|
-
} catch (err) {
|
|
29
|
-
return {
|
|
30
|
-
ok: false,
|
|
31
|
-
message: err instanceof Error ? err.message : String(err)
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
config.gateway = candidate.gateway;
|
|
35
|
-
return {
|
|
36
|
-
ok: true,
|
|
37
|
-
changed: previousGateway !== JSON.stringify(config.gateway)
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
export { applyLanPairingGatewayPatch };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../config/schema.js';
|
|
2
|
-
import type { GatewayBindMode } from '../config/schema.js';
|
|
3
|
-
export type MobilePairCandidateKind = 'lan' | 'tunnel' | 'reverse-proxy';
|
|
4
|
-
export type MobilePairBlockReason = 'GATEWAY_LOOPBACK_ONLY' | 'NO_REACHABLE_URL';
|
|
5
|
-
export type MobilePairCandidate = {
|
|
6
|
-
kind: MobilePairCandidateKind;
|
|
7
|
-
url: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
reachable: boolean;
|
|
10
|
-
note?: string;
|
|
11
|
-
};
|
|
12
|
-
export type MobilePairContext = {
|
|
13
|
-
port: number;
|
|
14
|
-
bindMode: GatewayBindMode;
|
|
15
|
-
listenHost: string;
|
|
16
|
-
pairingReady: boolean;
|
|
17
|
-
blockReason?: MobilePairBlockReason;
|
|
18
|
-
candidates: MobilePairCandidate[];
|
|
19
|
-
recommended: {
|
|
20
|
-
mode: MobilePairCandidateKind | null;
|
|
21
|
-
url: string | null;
|
|
22
|
-
};
|
|
23
|
-
/** Ordered URLs for mobile clients (LAN first when available, then tunnel). */
|
|
24
|
-
connectUrls: string[];
|
|
25
|
-
};
|
|
26
|
-
export declare function buildMobilePairContext(params: {
|
|
27
|
-
config: Config;
|
|
28
|
-
tunnelPublicUrl?: string | null;
|
|
29
|
-
tunnelConnected?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Optional override for `gateway.publicUrl`. Falls back to the configured
|
|
32
|
-
* value when omitted; useful for transient candidates (e.g. UI auto-detect
|
|
33
|
-
* from `window.location.origin` before the user persists the value).
|
|
34
|
-
*/
|
|
35
|
-
reverseProxyPublicUrl?: string | null;
|
|
36
|
-
}): MobilePairContext;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { init_public_url, normalizePublicUrlOrNull } from "../config/public-url.js";
|
|
2
|
-
import { enumerateLanGatewayCandidates } from "../gateway/host.js";
|
|
3
|
-
import { isNetworkAccessibleBindHost, resolveGatewayBindMode, resolveGatewayEffectiveHost } from "../config/gateway-bind.js";
|
|
4
|
-
import { buildMobileConnectUrlOrder } from "./pair-url.js";
|
|
5
|
-
//#region src/tunnel/pair-context.ts
|
|
6
|
-
init_public_url();
|
|
7
|
-
function buildMobilePairContext(params) {
|
|
8
|
-
const port = params.config.gateway?.port ?? 18790;
|
|
9
|
-
const bindMode = resolveGatewayBindMode(params.config);
|
|
10
|
-
const listenHost = resolveGatewayEffectiveHost(params.config);
|
|
11
|
-
const lanListenReady = isNetworkAccessibleBindHost(listenHost);
|
|
12
|
-
const lanEnumerated = enumerateLanGatewayCandidates(port);
|
|
13
|
-
const candidates = lanEnumerated.map((entry) => ({
|
|
14
|
-
kind: "lan",
|
|
15
|
-
url: entry.url,
|
|
16
|
-
label: entry.interfaceName,
|
|
17
|
-
reachable: lanListenReady,
|
|
18
|
-
...lanListenReady ? {} : { note: "requires_lan_bind" }
|
|
19
|
-
}));
|
|
20
|
-
const tunnelUrl = params.tunnelPublicUrl?.trim() || null;
|
|
21
|
-
const tunnelConnected = params.tunnelConnected === true && Boolean(tunnelUrl);
|
|
22
|
-
if (tunnelConnected && tunnelUrl) candidates.unshift({
|
|
23
|
-
kind: "tunnel",
|
|
24
|
-
url: tunnelUrl,
|
|
25
|
-
reachable: true
|
|
26
|
-
});
|
|
27
|
-
const configuredReverseProxy = normalizePublicUrlOrNull(params.config.gateway?.publicUrl);
|
|
28
|
-
const reverseProxyUrl = params.reverseProxyPublicUrl !== void 0 ? normalizePublicUrlOrNull(params.reverseProxyPublicUrl) : configuredReverseProxy;
|
|
29
|
-
if (reverseProxyUrl) candidates.unshift({
|
|
30
|
-
kind: "reverse-proxy",
|
|
31
|
-
url: reverseProxyUrl,
|
|
32
|
-
reachable: true
|
|
33
|
-
});
|
|
34
|
-
let recommended = {
|
|
35
|
-
mode: null,
|
|
36
|
-
url: null
|
|
37
|
-
};
|
|
38
|
-
if (reverseProxyUrl) recommended = {
|
|
39
|
-
mode: "reverse-proxy",
|
|
40
|
-
url: reverseProxyUrl
|
|
41
|
-
};
|
|
42
|
-
else if (tunnelConnected && tunnelUrl) recommended = {
|
|
43
|
-
mode: "tunnel",
|
|
44
|
-
url: tunnelUrl
|
|
45
|
-
};
|
|
46
|
-
else if (lanListenReady && lanEnumerated[0]) recommended = {
|
|
47
|
-
mode: "lan",
|
|
48
|
-
url: lanEnumerated[0].url
|
|
49
|
-
};
|
|
50
|
-
else if (lanEnumerated[0]) recommended = {
|
|
51
|
-
mode: "lan",
|
|
52
|
-
url: lanEnumerated[0].url
|
|
53
|
-
};
|
|
54
|
-
const pairingReady = Boolean(reverseProxyUrl || tunnelConnected || lanListenReady && lanEnumerated.length > 0);
|
|
55
|
-
let blockReason;
|
|
56
|
-
if (!pairingReady) blockReason = !lanListenReady && !tunnelConnected ? "GATEWAY_LOOPBACK_ONLY" : "NO_REACHABLE_URL";
|
|
57
|
-
const lanUrlForConnect = lanListenReady && lanEnumerated[0] ? lanEnumerated[0].url : null;
|
|
58
|
-
const hasUpstream = Boolean(reverseProxyUrl) || tunnelConnected;
|
|
59
|
-
const connectUrls = buildMobileConnectUrlOrder({
|
|
60
|
-
reverseProxyUrl,
|
|
61
|
-
baseUrl: reverseProxyUrl ? reverseProxyUrl : tunnelConnected && tunnelUrl ? tunnelUrl : lanListenReady && recommended.url ? recommended.url : null,
|
|
62
|
-
lanUrl: hasUpstream ? lanUrlForConnect : null,
|
|
63
|
-
tunnelUrl: tunnelConnected ? tunnelUrl : null
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
port,
|
|
67
|
-
bindMode,
|
|
68
|
-
listenHost,
|
|
69
|
-
pairingReady,
|
|
70
|
-
...blockReason ? { blockReason } : {},
|
|
71
|
-
candidates,
|
|
72
|
-
recommended,
|
|
73
|
-
connectUrls
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
export { buildMobilePairContext };
|