@xopcai/xopc 0.0.369 → 0.0.370
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 +59 -174
- package/README.zh-CN.md +59 -174
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js +131 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/_u64.js +30 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js +252 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js +16 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js +66 -0
- package/dist/browser-ext/dist/sidepanel.js +21 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Stj17S9u.js → agent-avatar-dicebear-C61i1QbX.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-0fCR1DHx.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-Di99mUTT.js +1 -0
- package/dist/gateway/static/root/assets/agents-BRZZmYH_.js +66 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-pJFe6M6c.js → app-management-settings-panel-noqqxkds.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BrxSpBWa.js → appearance-settings-DG8QN0gR.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DegSl5Lh.js → apps-page-CgiyzFYo.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BZQ_VHjp.js → automations-page-CgAcRFDS.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BIkxIpab.js +6 -0
- package/dist/gateway/static/root/assets/{block-editor-3XjFv3kK.js → block-editor-B1VE-jAe.js} +3 -3
- package/dist/gateway/static/root/assets/browser-automations-page-CIjyMS6f.js +3 -0
- package/dist/gateway/static/root/assets/{browser-settings-page-ch2_bQF0.js → browser-settings-page-BMAivBfp.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-DO-vfNKI.js → capabilities-CY4SiHcP.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-B48r0DDa.js → capabilities-gjQtMhKu.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-DRdcfo68.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-NckMsJ5N.js → capabilities-settings-panel-ZuL6pWjM.js} +4 -4
- package/dist/gateway/static/root/assets/{capability-header-actions-CY8KCO9j.js → capability-header-actions-D0GC1FEv.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-CHOS2CGa.js → channels-CgE22Pzd.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bwknnb4c.js → chat-terminal-dock-CEjh1utz.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-B2xeFCSt.js → computer-settings-page-vFHJAmQr.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-C83DnAqK.js → connector-service-page-DTrwZ4kV.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DRcMiTWu.js +1 -0
- package/dist/gateway/static/root/assets/copy-text-row-C1gaJwlZ.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-Bq9GR-DU.js → date-picker-NfGIPSYY.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-CqguveUi.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-BwsbQw8V.js → desktop-pet-CTx1zkJm.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-sL9i44pP.js → desktop-pet-settings-BRDS3EGc.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-Du4Ciuyw.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BFlDmsS5.js → directory-picker-path-field-CjstlxFl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-7Z1Tp7-w.js → extension-debug-page-BfAtjhoK.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-uGqvb8QX.js → extension-page-BJmudejr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-xlSyz4Z6.js → extension-provider-Br6LXyIj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CKHgrjOs.js → extension-settings-page-UvmHniyz.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-BwQg0G1D.js → fallback-models-euw9MGdt.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-F6D4A7N5.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-BAQnSEMJ.js → gateway-settings-C7roPHh1.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BGNCTtM3.js +2 -0
- package/dist/gateway/static/root/assets/{imports-page-re1_Nh64.js → imports-page-DxCoT0VV.js} +1 -1
- package/dist/gateway/static/root/assets/index-BGBkIIzM.css +1 -0
- package/dist/gateway/static/root/assets/index-FCEE325-.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B_xja9LN.js → keyboard-shortcuts-settings-CnLln9Ds.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CErdCrPX.js → local-app-workbench-page-yXRkSrEj.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BPL2RXdK.js → local-apps-page-D46buzTk.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-pox8evDV.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DmcCHnH0.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-khN1ThNL.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-C_t58yha.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BJ0QS6xx.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-tf77xIz3.js → page-context-capture-button-DfRODHv1.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CiiXwwQE.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-Dc3Y-Y7J.js → product-open-page-_Bp6HRmm.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-MG_hmVA3.js → product-preview-content-BUdiO0Ct.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Clb-fXYk.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-MllfNLGA.js → projects-page-D9JEEqhh.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Bs-C70el.js → remote-access-hub-CmyTq3_l.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DpJ5jNzR.js → runtime-tools-settings-panel-B1_inj8L.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-Dpxamkw6.js → scenes-page-CUNAZN2_.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DUeyQ1zh.js → schema-form-CfT-9UVw.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-Dgn4BRk_.js → send-session-input-BW40VHiL.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BqlvrjPE.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-CXZKScvu.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-B2vKXmzg.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DouHuBXt.js → settings-page-1h3vyueg.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cqc7UlZy.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-DJTabLAM.js → share-link-dialog-HCHM8qnf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-jw7h4t_B.js → share-preview-page-Ce6FNWt1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dh5jisCK.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CfyX_0zN.js → skill-api-deDZeQS8.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-DZozl9U_.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DWf256TE.js → system-settings-panel-CtzyMxqq.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DE6N1ZQe.js → task-detail-page-5f_V0h-p.js} +2 -2
- package/dist/gateway/static/root/assets/{tunnel-api-BBm9esrY.js → tunnel-api-vMtlbJ-m.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-C93x89uW.js → usage-page-B1-BCW8U.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-C7Gaaai1.js → use-composer-attachments-DJya1hIL.js} +1 -1
- package/dist/gateway/static/root/assets/use-file-preview-expanded-C5ONO7sF.js +2 -0
- package/dist/gateway/static/root/assets/user-model-page-D4BSq9HJ.js +2 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Bs2MKiTv.js → work-discovery-overlay-CjiNYJV5.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BR_U_snV.js → workflow-run-setup-panel-DJOetXvm.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CcAPFh2R.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-Si2o3inw.js → workspace-api-WhbMvdBE.js} +2 -2
- package/dist/gateway/static/root/index.html +18 -20
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-client/src/index.js +189 -0
- package/dist/packages/endpoint-tools-protocol/src/bridge.js +105 -0
- package/dist/packages/endpoint-tools-protocol/src/index.js +93 -2
- package/dist/packages/endpoint-tools-protocol/src/location.js +109 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +30 -5
- package/dist/src/agent/agent-manager.js +22 -26
- package/dist/src/agent/embedded/codemode-extension.d.ts +7 -0
- package/dist/src/agent/embedded/codemode-extension.js +232 -0
- package/dist/src/agent/embedded/codemode-output.d.ts +2 -0
- package/dist/src/agent/embedded/codemode-output.js +34 -0
- package/dist/src/agent/embedded/external-tool-discovery.d.ts +6 -0
- package/dist/src/agent/embedded/external-tool-discovery.js +60 -0
- package/dist/src/agent/embedded/model-runtime.js +5 -2
- package/dist/src/agent/embedded/run-for-session.js +10 -1
- package/dist/src/agent/embedded/run-turn.js +10 -3
- package/dist/src/agent/embedded/session-runner.d.ts +9 -1
- package/dist/src/agent/embedded/session-runner.js +111 -23
- package/dist/src/agent/embedded/session-tool-result-guard.d.ts +2 -0
- package/dist/src/agent/embedded/session-tool-result-guard.js +17 -0
- package/dist/src/agent/embedded/subscribe-session.js +14 -4
- package/dist/src/agent/embedded/tool-metadata.d.ts +15 -0
- package/dist/src/agent/embedded/tool-metadata.js +38 -0
- package/dist/src/agent/embedded/tool-search-extension.d.ts +5 -0
- package/dist/src/agent/embedded/tool-search-extension.js +31 -0
- package/dist/src/agent/embedded/types.d.ts +7 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +6 -0
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +148 -56
- package/dist/src/agent/external-tools/extension-provider.js +8 -1
- package/dist/src/agent/external-tools/gateway-tools.d.ts +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +45 -22
- package/dist/src/agent/external-tools/index.js +46 -14
- package/dist/src/agent/external-tools/memory-provider.js +8 -1
- package/dist/src/agent/external-tools/read-policy.js +2 -1
- package/dist/src/agent/external-tools/service.d.ts +2 -0
- package/dist/src/agent/external-tools/service.js +25 -3
- package/dist/src/agent/external-tools/tool-registry.d.ts +14 -0
- package/dist/src/agent/external-tools/tool-registry.js +14 -0
- package/dist/src/agent/external-tools/types.d.ts +8 -1
- package/dist/src/agent/external-tools/types.js +0 -1
- package/dist/src/agent/mcp/config.d.ts +18 -0
- package/dist/src/agent/mcp/{bundle-mcp-config.js → config.js} +8 -25
- package/dist/src/agent/mcp/native-mcp.d.ts +6 -0
- package/dist/src/agent/mcp/native-mcp.js +73 -0
- package/dist/src/agent/service.js +2 -5
- package/dist/src/agent/skills/installer.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/skills/skill-sources.js +1 -1
- package/dist/src/agent/source-context/index.d.ts +0 -1
- package/dist/src/agent/source-context/index.js +1 -2
- package/dist/src/agent/source-context/injector.js +1 -0
- package/dist/src/agent/source-context/types.d.ts +2 -2
- package/dist/src/agent/source-context/types.js +1 -1
- package/dist/src/agent/tools/cli-clarify.js +1 -1
- package/dist/src/agent/tools/codemode-permissions.d.ts +4 -0
- package/dist/src/agent/tools/codemode-permissions.js +23 -0
- package/dist/src/agent/tools/dataBatch.js +3 -1
- package/dist/src/agent/tools/delegation-parent-policy.js +1 -4
- package/dist/src/agent/tools/factory.js +4 -3
- package/dist/src/agent/transcript/provider-capabilities.js +0 -1
- package/dist/src/agent/transcript/transcript-policy.js +1 -2
- package/dist/src/agent-config/schema.d.ts +28 -0
- package/dist/src/agent-config/schema.js +7 -0
- package/dist/src/auth/credentials.js +7 -20
- package/dist/src/auth/model-credential-store.js +11 -4
- package/dist/src/auth/oauth/index.d.ts +1 -1
- package/dist/src/auth/oauth/index.js +3 -3
- package/dist/src/auth/oauth/openai.d.ts +2 -0
- package/dist/src/auth/oauth/openai.js +90 -0
- package/dist/src/auth/oauth/registry.js +3 -3
- package/dist/src/auth/oauth/types.d.ts +1 -0
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +5 -0
- package/dist/src/chat-commands/builtins/model.js +2 -2
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +0 -19
- package/dist/src/cli/commands/mcp.js +36 -2
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/utils/oauth-login.js +2 -2
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/mcp-config-normalize.d.ts +0 -3
- package/dist/src/config/mcp-config-normalize.js +2 -22
- package/dist/src/config/models-json.d.ts +0 -5
- package/dist/src/config/models-json.js +13 -4
- package/dist/src/config/paths.d.ts +0 -1
- package/dist/src/config/paths.js +1 -4
- package/dist/src/config/schema.d.ts +130 -36
- package/dist/src/config/schema.js +52 -35
- package/dist/src/connectors/auth-provider-registry.d.ts +1 -1
- package/dist/src/connectors/auth-provider-registry.js +1 -21
- package/dist/src/connectors/china-catalog.js +5 -5
- package/dist/src/connectors/connection-recovery-service.d.ts +1 -6
- package/dist/src/connectors/connection-recovery-service.js +3 -105
- package/dist/src/connectors/health.d.ts +1 -2
- package/dist/src/connectors/health.js +2 -101
- package/dist/src/connectors/types.d.ts +1 -1
- package/dist/src/endpoint-tools/binding-service.d.ts +2 -0
- package/dist/src/endpoint-tools/binding-service.js +14 -2
- package/dist/src/endpoint-tools/bridge-host.d.ts +15 -0
- package/dist/src/endpoint-tools/bridge-host.js +166 -0
- package/dist/src/endpoint-tools/bridge.d.ts +27 -0
- package/dist/src/endpoint-tools/bridge.js +88 -0
- package/dist/src/endpoint-tools/capability-catalog.d.ts +2 -0
- package/dist/src/endpoint-tools/capability-catalog.js +8 -0
- package/dist/src/endpoint-tools/grant-service.d.ts +69 -0
- package/dist/src/endpoint-tools/grant-service.js +113 -0
- package/dist/src/endpoint-tools/index.js +1 -1
- package/dist/src/endpoint-tools/invocation-service.js +6 -2
- package/dist/src/endpoint-tools/location-task.d.ts +22 -0
- package/dist/src/endpoint-tools/location-task.js +114 -0
- package/dist/src/endpoint-tools/policy.js +16 -1
- package/dist/src/endpoint-tools/registry.d.ts +2 -0
- package/dist/src/endpoint-tools/registry.js +9 -0
- package/dist/src/endpoint-tools/result-projector.d.ts +15 -0
- package/dist/src/endpoint-tools/result-projector.js +31 -0
- package/dist/src/endpoint-tools/runtime.d.ts +2 -0
- package/dist/src/endpoint-tools/runtime.js +15 -2
- package/dist/src/endpoint-tools/target-resolver.d.ts +12 -0
- package/dist/src/endpoint-tools/target-resolver.js +27 -0
- package/dist/src/endpoint-tools/turn-context.d.ts +6 -0
- package/dist/src/endpoint-tools/turn-context.js +29 -0
- package/dist/src/extensions/agent-plugins/auth.d.ts +0 -2
- package/dist/src/extensions/agent-plugins/auth.js +2 -19
- package/dist/src/extensions/agent-plugins/credentials.js +3 -19
- package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/mcp-adapter.js +1 -5
- package/dist/src/extensions/agent-plugins/source-http-fetch.d.ts +2 -0
- package/dist/src/{agent/mcp/plugin-http-fetch.js → extensions/agent-plugins/source-http-fetch.js} +7 -7
- package/dist/src/extensions/agent-plugins/sources.js +2 -2
- package/dist/src/extensions/agent-plugins/store.js +1 -3
- package/dist/src/extensions/agent-plugins/validation.d.ts +0 -4
- package/dist/src/extensions/agent-plugins/validation.js +13 -20
- package/dist/src/gateway/agents-admin.d.ts +5 -0
- package/dist/src/gateway/agents-admin.js +56 -1
- package/dist/src/gateway/chat-stream/mapper.js +9 -0
- package/dist/src/gateway/chat-stream/protocol.d.ts +4 -4
- package/dist/src/gateway/hono/lib/config-payload.d.ts +9 -4
- package/dist/src/gateway/hono/lib/config-payload.js +2 -5
- package/dist/src/gateway/hono/oauth-async.js +9 -2
- package/dist/src/gateway/hono/routes/agent-plugins.js +4 -9
- package/dist/src/gateway/hono/routes/agents.js +4 -3
- package/dist/src/gateway/hono/routes/connection-waits.js +2 -5
- package/dist/src/gateway/hono/routes/connectors.js +5 -60
- package/dist/src/gateway/hono/routes/device-authorizations.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-authorizations.js +74 -0
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +7 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +1 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +53 -3
- package/dist/src/gateway/hono/routes/lazy-bundles.js +17 -1
- package/dist/src/gateway/hono/routes/mcp.d.ts +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +11 -237
- package/dist/src/gateway/hono/routes/session-command-handler.js +11 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +8 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +25 -1
- package/dist/src/gateway/service/config-coordinator.js +2 -5
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +13 -5
- package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/session-input-coordinator.js +29 -9
- package/dist/src/gateway/service/sessions-api.js +0 -6
- package/dist/src/gateway/service.js +3 -12
- package/dist/src/gateway/session-reset-service.js +0 -6
- package/dist/src/imports/compatibility.js +12 -10
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/providers/env-keys.js +1 -1
- package/dist/src/providers/index.js +26 -24
- package/dist/src/providers/model-call.d.ts +0 -2
- package/dist/src/providers/model-call.js +2 -6
- package/dist/src/providers/model-registry.js +4 -2
- package/dist/src/providers/model-supplements.d.ts +3 -3
- package/dist/src/providers/model-supplements.js +6 -27
- package/dist/src/providers/presentation.js +3 -8
- package/dist/src/providers/prompt-cache-plan.js +1 -1
- package/dist/src/providers/provider-auth-service.d.ts +1 -1
- package/dist/src/providers/provider-auth-service.js +7 -2
- package/dist/src/providers/provider-policy.d.ts +3 -0
- package/dist/src/providers/provider-policy.js +14 -0
- package/dist/src/providers/register-runtime-providers.js +6 -1
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/session/store.js +7 -1
- package/dist/src/session/transcript-events.d.ts +5 -0
- package/dist/src/session/transcript-events.js +1 -0
- package/dist/src/session/types.d.ts +2 -0
- package/dist/src/storage/sqlite/device-grant-audit-repository.d.ts +11 -0
- package/dist/src/storage/sqlite/device-grant-audit-repository.js +10 -0
- package/dist/src/storage/sqlite/endpoint-device-settings-repository.d.ts +7 -0
- package/dist/src/storage/sqlite/endpoint-device-settings-repository.js +17 -0
- package/dist/src/storage/sqlite/migrations/240_device_settings.sql +5 -0
- package/dist/src/storage/sqlite/migrations/241_device_grant_audit.sql +13 -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/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/xopc-tui-keybindings.d.ts +4 -4
- package/package.json +19 -8
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CCRfvuov.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CRlzd8El.js +0 -1
- package/dist/gateway/static/root/assets/agents-_ug2LCQb.js +0 -66
- package/dist/gateway/static/root/assets/automations-workspace-BQywN6nG.js +0 -6
- package/dist/gateway/static/root/assets/browser-automations-page-yiEuG1v7.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-BEnFt_dj.js +0 -2
- package/dist/gateway/static/root/assets/connectors-page-D6wTmWA6.js +0 -2
- package/dist/gateway/static/root/assets/copy-text-row-BHDs3cBa.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-BTERkA9X.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DI2bqaKO.js +0 -1
- package/dist/gateway/static/root/assets/dist-Che_jiQF.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-DDWymi-o.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BZDjvwet.js +0 -2
- package/dist/gateway/static/root/assets/index-BB1z8QxA.js +0 -106
- package/dist/gateway/static/root/assets/index-D9R6tU7r.css +0 -1
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
- package/dist/gateway/static/root/assets/local-session-drafts-DRPsDCj1.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DL-BM0xq.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BOVRHhXk.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DJJK2yL4.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-oCxO7ZTv.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-DOk9gUK5.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-3uAzbW4T.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-LInoZ_Yi.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-BCVlNHtq.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Bz-ue9fZ.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-B5BoZ-1y.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BlnlzGjH.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DjdTeYzm.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-Db2VYg1b.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-B74LkVbp.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Crk4SxtC.js +0 -6
- package/dist/src/agent/embedded/system-prompt-override.d.ts +0 -2
- package/dist/src/agent/embedded/system-prompt-override.js +0 -21
- package/dist/src/agent/external-tools/mcp-provider.d.ts +0 -32
- package/dist/src/agent/external-tools/mcp-provider.js +0 -208
- package/dist/src/agent/mcp/bundle-mcp-config.d.ts +0 -20
- package/dist/src/agent/mcp/bundle-mcp-gateway.d.ts +0 -79
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +0 -93
- package/dist/src/agent/mcp/bundle-mcp-names.d.ts +0 -1
- package/dist/src/agent/mcp/bundle-mcp-names.js +0 -25
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -1
- package/dist/src/agent/mcp/bundle-mcp-policy.js +0 -6
- package/dist/src/agent/mcp/bundle-mcp-runtime.d.ts +0 -46
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +0 -571
- package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +0 -2
- package/dist/src/agent/mcp/bundle-mcp-tools.js +0 -2
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +0 -76
- package/dist/src/agent/mcp/bundle-mcp-types.js +0 -1
- package/dist/src/agent/mcp/embedded-mcp.d.ts +0 -10
- package/dist/src/agent/mcp/embedded-mcp.js +0 -14
- package/dist/src/agent/mcp/index.d.ts +0 -5
- package/dist/src/agent/mcp/index.js +0 -12
- package/dist/src/agent/mcp/mcp-config-shared.d.ts +0 -8
- package/dist/src/agent/mcp/mcp-config-shared.js +0 -39
- package/dist/src/agent/mcp/mcp-http.d.ts +0 -23
- package/dist/src/agent/mcp/mcp-http.js +0 -67
- package/dist/src/agent/mcp/mcp-resource-id.d.ts +0 -6
- package/dist/src/agent/mcp/mcp-resource-id.js +0 -19
- package/dist/src/agent/mcp/mcp-stdio-transport.d.ts +0 -26
- package/dist/src/agent/mcp/mcp-stdio-transport.js +0 -120
- package/dist/src/agent/mcp/mcp-stdio.d.ts +0 -18
- package/dist/src/agent/mcp/mcp-stdio.js +0 -35
- package/dist/src/agent/mcp/mcp-transport-config.d.ts +0 -28
- package/dist/src/agent/mcp/mcp-transport-config.js +0 -91
- package/dist/src/agent/mcp/mcp-transport.d.ts +0 -17
- package/dist/src/agent/mcp/mcp-transport.js +0 -141
- package/dist/src/agent/mcp/oauth/index.d.ts +0 -6
- package/dist/src/agent/mcp/oauth/index.js +0 -6
- package/dist/src/agent/mcp/oauth/mcp-oauth-errors.d.ts +0 -5
- package/dist/src/agent/mcp/oauth/mcp-oauth-errors.js +0 -14
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.d.ts +0 -30
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +0 -276
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.d.ts +0 -33
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +0 -103
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.d.ts +0 -31
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.js +0 -181
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.d.ts +0 -12
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +0 -91
- package/dist/src/agent/mcp/oauth/mcp-oauth-types.d.ts +0 -22
- package/dist/src/agent/mcp/oauth/mcp-oauth-types.js +0 -1
- package/dist/src/agent/mcp/plugin-http-fetch.d.ts +0 -2
- package/dist/src/agent/source-context/mcp-resource-context.d.ts +0 -8
- package/dist/src/agent/source-context/mcp-resource-context.js +0 -30
- package/dist/src/auth/oauth/openai-codex.d.ts +0 -9
- package/dist/src/auth/oauth/openai-codex.js +0 -414
- package/dist/src/connectors/plugin-mcp-recovery.d.ts +0 -28
- package/dist/src/connectors/plugin-mcp-recovery.js +0 -90
- package/dist/src/extensions/agent-plugins/connection.d.ts +0 -8
- package/dist/src/extensions/agent-plugins/connection.js +0 -41
- package/dist/src/extensions/agent-plugins/health.d.ts +0 -4
- package/dist/src/extensions/agent-plugins/health.js +0 -48
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.d.ts +0 -1
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.js +0 -8
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../../config/paths-state.js";
|
|
2
2
|
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
3
3
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
4
|
-
import { pluginName } from "./validation.js";
|
|
5
|
-
import { clearPluginMcpHealth } from "./health.js";
|
|
6
4
|
import { isDangerousHostEnvVarName } from "../../infra/host-env-security.js";
|
|
5
|
+
import { pluginName } from "./validation.js";
|
|
7
6
|
import { join } from "node:path";
|
|
8
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
8
|
import { createHash } from "node:crypto";
|
|
@@ -15,12 +14,7 @@ init_write_file_atomic();
|
|
|
15
14
|
init_paths_state();
|
|
16
15
|
const bindingSchema = z.strictObject({
|
|
17
16
|
serverName: z.string(),
|
|
18
|
-
mode: z.enum([
|
|
19
|
-
"auto",
|
|
20
|
-
"oauth",
|
|
21
|
-
"api-key",
|
|
22
|
-
"none"
|
|
23
|
-
]),
|
|
17
|
+
mode: z.enum(["auto", "api-key"]),
|
|
24
18
|
identityScope: z.literal("owner"),
|
|
25
19
|
endpointFingerprint: z.string(),
|
|
26
20
|
fields: z.array(z.strictObject({
|
|
@@ -49,7 +43,6 @@ async function savePluginAuthBinding(store, id, name, input) {
|
|
|
49
43
|
const plugin = store.get(id);
|
|
50
44
|
const server = plugin?.servers[name];
|
|
51
45
|
if (!server || plugin?.readiness === "blocked") throw new Error("Plugin MCP server unavailable");
|
|
52
|
-
if (input.mode === "oauth" && server.type !== "streamable-http") throw new Error("OAuth requires streamable HTTP");
|
|
53
46
|
const endpointFingerprint = pluginEndpointFingerprint(server);
|
|
54
47
|
const fields = [];
|
|
55
48
|
const resolver = new CredentialResolver(store.stateDir === resolveStateDir() ? {} : { stateDir: store.stateDir });
|
|
@@ -95,20 +88,10 @@ async function savePluginAuthBinding(store, id, name, input) {
|
|
|
95
88
|
fields
|
|
96
89
|
});
|
|
97
90
|
await writeTextAtomic(bindingPath(store, id, name), JSON.stringify(binding));
|
|
98
|
-
clearPluginMcpHealth(id, name, store.stateDir);
|
|
99
91
|
}
|
|
100
92
|
function applyPluginAuthBinding(raw, binding) {
|
|
101
93
|
if (!binding) return raw;
|
|
102
94
|
const result = { ...raw };
|
|
103
|
-
if (binding.mode === "none" || binding.mode === "api-key") {
|
|
104
|
-
delete result.auth;
|
|
105
|
-
delete result.xopcAutoAuth;
|
|
106
|
-
}
|
|
107
|
-
if (binding.mode === "oauth") {
|
|
108
|
-
result.auth = { type: "oauth" };
|
|
109
|
-
delete result.xopcAutoAuth;
|
|
110
|
-
result.headers = Object.fromEntries(Object.entries(result.headers ?? {}).filter(([key]) => key.toLowerCase() !== "authorization"));
|
|
111
|
-
}
|
|
112
95
|
for (const field of binding.fields) {
|
|
113
96
|
const values = { ...result[field.target] };
|
|
114
97
|
const insensitive = field.target === "headers" || process.platform === "win32";
|
|
@@ -1,31 +1,15 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../../config/paths-state.js";
|
|
2
2
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
3
|
-
import { pluginName
|
|
4
|
-
import {
|
|
5
|
-
import { McpOAuthStore } from "../../agent/mcp/oauth/mcp-oauth-store.js";
|
|
6
|
-
import { getMcpOAuthManager } from "../../agent/mcp/oauth/mcp-oauth-manager.js";
|
|
3
|
+
import { pluginName } from "./validation.js";
|
|
4
|
+
import { pluginCredentialProviderPrefix } from "./auth.js";
|
|
7
5
|
import { join } from "node:path";
|
|
8
|
-
import { existsSync,
|
|
6
|
+
import { existsSync, rmSync } from "node:fs";
|
|
9
7
|
//#region src/extensions/agent-plugins/credentials.ts
|
|
10
8
|
init_credentials();
|
|
11
9
|
init_paths_state();
|
|
12
10
|
async function removePluginCredentials(store, id) {
|
|
13
11
|
pluginName.parse(id);
|
|
14
|
-
const plugin = store.get(id);
|
|
15
|
-
const serverNames = new Set(Object.keys(plugin?.servers ?? {}));
|
|
16
12
|
const dir = join(store.stateDir, "plugin-auth", id);
|
|
17
|
-
if (existsSync(dir)) for (const file of readdirSync(dir)) {
|
|
18
|
-
if (!/^[a-f0-9]{64}\.json$/.test(file)) throw new Error("Unexpected plugin auth store entry");
|
|
19
|
-
const binding = parsePluginAuthBinding(JSON.parse(readFileSync(join(dir, file), "utf8")));
|
|
20
|
-
serverNames.add(binding.serverName);
|
|
21
|
-
}
|
|
22
|
-
for (const name of serverNames) {
|
|
23
|
-
await getMcpOAuthManager({ xopcPlugin: {
|
|
24
|
-
id,
|
|
25
|
-
serverName: name
|
|
26
|
-
} }).cancelPending();
|
|
27
|
-
await new McpOAuthStore(`owner:${pluginServerId(id, name)}`).deleteScope();
|
|
28
|
-
}
|
|
29
13
|
const resolver = new CredentialResolver(store.stateDir === resolveStateDir() ? {} : { stateDir: store.stateDir });
|
|
30
14
|
for (const profile of await resolver.listProfiles()) if (profile.provider.startsWith(pluginCredentialProviderPrefix(id))) await resolver.deleteProviderCredential(profile.provider);
|
|
31
15
|
if (existsSync(dir)) rmSync(dir, {
|
|
@@ -7,7 +7,7 @@ export declare function agentPluginInventoryRow(plugin: InstalledAgentPlugin): {
|
|
|
7
7
|
mcp: {
|
|
8
8
|
name: string;
|
|
9
9
|
id: string;
|
|
10
|
-
type: "
|
|
10
|
+
type: "stdio" | "streamable-http";
|
|
11
11
|
}[];
|
|
12
12
|
};
|
|
13
13
|
diagnostics: import("./validation.js").PluginDiagnostic[];
|
|
@@ -45,7 +45,7 @@ export declare function listAgentPluginInventory(): {
|
|
|
45
45
|
mcp: {
|
|
46
46
|
name: string;
|
|
47
47
|
id: string;
|
|
48
|
-
type: "
|
|
48
|
+
type: "stdio" | "streamable-http";
|
|
49
49
|
}[];
|
|
50
50
|
};
|
|
51
51
|
diagnostics: import("./validation.js").PluginDiagnostic[];
|
|
@@ -17,11 +17,7 @@ function materializePluginServers(plugin, store = new AgentPluginStore(), diagno
|
|
|
17
17
|
};
|
|
18
18
|
const raw = server.type !== "stdio" ? {
|
|
19
19
|
...server,
|
|
20
|
-
xopcPlugin: origin
|
|
21
|
-
...server.type === "streamable-http" && !Object.keys(server.headers ?? {}).some((key) => key.toLowerCase() === "authorization") ? {
|
|
22
|
-
auth: { type: "oauth" },
|
|
23
|
-
xopcAutoAuth: true
|
|
24
|
-
} : {}
|
|
20
|
+
xopcPlugin: origin
|
|
25
21
|
} : {
|
|
26
22
|
type: "stdio",
|
|
27
23
|
xopcPlugin: origin,
|
package/dist/src/{agent/mcp/plugin-http-fetch.js → extensions/agent-plugins/source-http-fetch.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BlockList, isIP } from "node:net";
|
|
2
2
|
import { Agent, fetch } from "undici";
|
|
3
3
|
import { lookup } from "node:dns";
|
|
4
|
-
//#region src/agent/
|
|
4
|
+
//#region src/extensions/agent-plugins/source-http-fetch.ts
|
|
5
5
|
const blocked = new BlockList();
|
|
6
6
|
for (const [network, prefix] of [
|
|
7
7
|
["0.0.0.0", 8],
|
|
@@ -29,19 +29,19 @@ const publicDispatcher = new Agent({ connect: { lookup(host, options, callback)
|
|
|
29
29
|
all: true
|
|
30
30
|
}, (error, addresses) => {
|
|
31
31
|
if (error) return callback(error, []);
|
|
32
|
-
if (!addresses.length || addresses.some((entry) => isBlocked(entry.address))) return callback(/* @__PURE__ */ new Error("Plugin
|
|
32
|
+
if (!addresses.length || addresses.some((entry) => isBlocked(entry.address))) return callback(/* @__PURE__ */ new Error("Plugin download cannot access private network addresses"), []);
|
|
33
33
|
if (options.all) callback(null, addresses);
|
|
34
34
|
else callback(null, addresses[0].address, addresses[0].family);
|
|
35
35
|
});
|
|
36
36
|
} } });
|
|
37
|
-
function
|
|
37
|
+
function createPluginSourceFetch(endpoint, configuredHeaders) {
|
|
38
38
|
return async (input, init) => {
|
|
39
39
|
const url = new URL(input);
|
|
40
|
-
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password || url.hash) throw new Error("Invalid plugin
|
|
40
|
+
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password || url.hash) throw new Error("Invalid plugin download request URL");
|
|
41
41
|
const local = loopback(endpoint.hostname) && url.origin === endpoint.origin;
|
|
42
|
-
if (!local && url.protocol !== "https:") throw new Error("Plugin
|
|
42
|
+
if (!local && url.protocol !== "https:") throw new Error("Plugin download requires HTTPS");
|
|
43
43
|
const address = url.hostname.replace(/^\[|\]$/g, "");
|
|
44
|
-
if (!local && isIP(address) && isBlocked(address)) throw new Error("Plugin
|
|
44
|
+
if (!local && isIP(address) && isBlocked(address)) throw new Error("Plugin download cannot access private network addresses");
|
|
45
45
|
const headers = new Headers(url.origin === endpoint.origin ? configuredHeaders : void 0);
|
|
46
46
|
new Headers(init?.headers).forEach((value, key) => headers.set(key, value));
|
|
47
47
|
return await fetch(url, {
|
|
@@ -53,4 +53,4 @@ function createPluginHttpFetch(endpoint, configuredHeaders) {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
//#endregion
|
|
56
|
-
export {
|
|
56
|
+
export { createPluginSourceFetch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createPluginSourceFetch } from "./source-http-fetch.js";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -63,7 +63,7 @@ async function withAgentPluginSource(source, config, fn) {
|
|
|
63
63
|
};
|
|
64
64
|
} else {
|
|
65
65
|
const url = new URL(source);
|
|
66
|
-
const response = await
|
|
66
|
+
const response = await createPluginSourceFetch(url, {})(url, { signal: AbortSignal.timeout(3e4) });
|
|
67
67
|
if (!response.ok || !response.body) throw new Error(`Plugin download failed (${response.status})`);
|
|
68
68
|
const reader = response.body.getReader();
|
|
69
69
|
const chunks = [];
|
|
@@ -4,7 +4,6 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
4
4
|
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
5
5
|
import { computeExtensionDirectoryIntegrity } from "../lockfile.js";
|
|
6
6
|
import { containedPath, inspectAgentPlugin, pluginName } from "./validation.js";
|
|
7
|
-
import { readPluginMcpHealth } from "./health.js";
|
|
8
7
|
import { tmpdir } from "node:os";
|
|
9
8
|
import { dirname, join, resolve } from "node:path";
|
|
10
9
|
import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -104,8 +103,7 @@ var AgentPluginStore = class {
|
|
|
104
103
|
component: "package",
|
|
105
104
|
message: "Installed files differ from the reviewed package"
|
|
106
105
|
});
|
|
107
|
-
const
|
|
108
|
-
const readiness = !valid ? "blocked" : inspection.diagnostics.length || health.includes("error") ? "degraded" : health.some((status) => status !== "ready") ? "setup_required" : "ready";
|
|
106
|
+
const readiness = !valid ? "blocked" : inspection.diagnostics.length ? "degraded" : "ready";
|
|
109
107
|
return {
|
|
110
108
|
...inspection,
|
|
111
109
|
id,
|
|
@@ -28,10 +28,6 @@ declare const serverSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
28
28
|
type: z.ZodLiteral<"streamable-http">;
|
|
29
29
|
url: z.ZodString;
|
|
30
30
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
31
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
32
|
-
type: z.ZodLiteral<"sse">;
|
|
33
|
-
url: z.ZodString;
|
|
34
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
35
31
|
}, z.core.$strict>], "type">;
|
|
36
32
|
export type PluginManifest = z.infer<typeof manifestSchema>;
|
|
37
33
|
export type PluginServer = z.infer<typeof serverSchema>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
2
2
|
import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
import { validateHeaderName, validateHeaderValue } from "node:http";
|
|
5
6
|
import yaml from "js-yaml";
|
|
@@ -24,25 +25,17 @@ const manifestSchema = z.object({
|
|
|
24
25
|
extensions: z.record(z.string(), z.unknown()).optional()
|
|
25
26
|
});
|
|
26
27
|
const strings = z.record(z.string(), z.string());
|
|
27
|
-
const serverSchema = z.discriminatedUnion("type", [
|
|
28
|
-
z.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
z.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
headers: strings.optional()
|
|
39
|
-
}),
|
|
40
|
-
z.strictObject({
|
|
41
|
-
type: z.literal("sse"),
|
|
42
|
-
url: z.string().min(1),
|
|
43
|
-
headers: strings.optional()
|
|
44
|
-
})
|
|
45
|
-
]);
|
|
28
|
+
const serverSchema = z.discriminatedUnion("type", [z.strictObject({
|
|
29
|
+
type: z.literal("stdio"),
|
|
30
|
+
command: z.string().min(1),
|
|
31
|
+
args: z.array(z.string()).optional(),
|
|
32
|
+
env: strings.optional(),
|
|
33
|
+
cwd: z.string().optional()
|
|
34
|
+
}), z.strictObject({
|
|
35
|
+
type: z.literal("streamable-http"),
|
|
36
|
+
url: z.string().min(1),
|
|
37
|
+
headers: strings.optional()
|
|
38
|
+
})]);
|
|
46
39
|
function containedPath(root, path) {
|
|
47
40
|
const base = resolve(root);
|
|
48
41
|
const target = resolve(path);
|
|
@@ -205,7 +198,7 @@ function inspectAgentPlugin(rootDir, dataDir = join(rootDir, ".inspection-data")
|
|
|
205
198
|
return result;
|
|
206
199
|
}
|
|
207
200
|
function pluginServerId(pluginId, serverName) {
|
|
208
|
-
return `
|
|
201
|
+
return `plugin_${pluginId.replace(/[^a-zA-Z0-9_]/g, "_")}_${createHash("sha256").update(JSON.stringify([pluginId, serverName])).digest("hex").slice(0, 16)}`;
|
|
209
202
|
}
|
|
210
203
|
//#endregion
|
|
211
204
|
export { MCP_SCHEMA, PLUGIN_SCHEMA, containedPath, expandPluginVariables, inspectAgentPlugin, pluginName, pluginServerId, resolvePluginCwd, validatePluginServer };
|
|
@@ -101,3 +101,8 @@ export declare function writeAgentAvatarFromBase64(agentId: string, base64: stri
|
|
|
101
101
|
export declare function deleteAgentAvatarFile(agentId: string): Promise<AgentAdminResult<{
|
|
102
102
|
agentId: string;
|
|
103
103
|
}>>;
|
|
104
|
+
/** Rasterize configured generated avatars locally for native mobile clients. */
|
|
105
|
+
export declare function resolveAgentAvatarImage(agentId: string): Promise<AgentAdminResult<{
|
|
106
|
+
buffer: Buffer;
|
|
107
|
+
contentType: string;
|
|
108
|
+
}>>;
|
|
@@ -434,5 +434,60 @@ async function deleteAgentAvatarFile(agentId) {
|
|
|
434
434
|
data: { agentId: id }
|
|
435
435
|
};
|
|
436
436
|
}
|
|
437
|
+
const renderedAvatarCache = /* @__PURE__ */ new Map();
|
|
438
|
+
/** Rasterize configured generated avatars locally for native mobile clients. */
|
|
439
|
+
async function resolveAgentAvatarImage(agentId) {
|
|
440
|
+
const missing = assertAgentExistsForAvatar(agentId);
|
|
441
|
+
if (missing) return missing;
|
|
442
|
+
const id = normalizeAgentId(agentId);
|
|
443
|
+
const reference = listAgentEntries().find((entry) => normalizeAgentId(entry.id) === id)?.profile?.avatar?.trim() ?? "";
|
|
444
|
+
if (reference === "xopc:custom") return readAgentAvatarFile(id);
|
|
445
|
+
if (reference.startsWith("xopc:loopi:") || /^https?:\/\//i.test(reference)) return {
|
|
446
|
+
ok: false,
|
|
447
|
+
status: 404,
|
|
448
|
+
error: "Avatar is rendered by the client"
|
|
449
|
+
};
|
|
450
|
+
const match = /^xopc:dicebear:(adventurer|bottts|lorelei|thumbs|fun-emoji|pixel-art):(.+)$/.exec(reference);
|
|
451
|
+
const style = match?.[1] ?? "adventurer";
|
|
452
|
+
const seed = match?.[2] ?? id;
|
|
453
|
+
const key = JSON.stringify([style, seed]);
|
|
454
|
+
const cached = renderedAvatarCache.get(key);
|
|
455
|
+
if (cached) return {
|
|
456
|
+
ok: true,
|
|
457
|
+
data: {
|
|
458
|
+
buffer: cached,
|
|
459
|
+
contentType: "image/png"
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
const [{ createAvatar }, collection, { default: sharp }] = await Promise.all([
|
|
463
|
+
import("@dicebear/core"),
|
|
464
|
+
import("@dicebear/collection"),
|
|
465
|
+
import("sharp")
|
|
466
|
+
]);
|
|
467
|
+
const options = {
|
|
468
|
+
seed,
|
|
469
|
+
size: 128
|
|
470
|
+
};
|
|
471
|
+
const svg = (() => {
|
|
472
|
+
switch (style) {
|
|
473
|
+
case "bottts": return createAvatar(collection.bottts, options).toString();
|
|
474
|
+
case "lorelei": return createAvatar(collection.lorelei, options).toString();
|
|
475
|
+
case "thumbs": return createAvatar(collection.thumbs, options).toString();
|
|
476
|
+
case "fun-emoji": return createAvatar(collection.funEmoji, options).toString();
|
|
477
|
+
case "pixel-art": return createAvatar(collection.pixelArt, options).toString();
|
|
478
|
+
default: return createAvatar(collection.adventurer, options).toString();
|
|
479
|
+
}
|
|
480
|
+
})();
|
|
481
|
+
const buffer = await sharp(Buffer.from(svg)).png().toBuffer();
|
|
482
|
+
if (renderedAvatarCache.size >= 64) renderedAvatarCache.delete(renderedAvatarCache.keys().next().value);
|
|
483
|
+
renderedAvatarCache.set(key, buffer);
|
|
484
|
+
return {
|
|
485
|
+
ok: true,
|
|
486
|
+
data: {
|
|
487
|
+
buffer,
|
|
488
|
+
contentType: "image/png"
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
}
|
|
437
492
|
//#endregion
|
|
438
|
-
export { createGatewayAgent, deleteAgentAvatarFile, deleteGatewayAgent, getGatewayAgentEffectiveConfig, listAgentProfileFiles, listGatewayAgents, readAgentAvatarFile, readAgentProfileFile, updateGatewayAgent, writeAgentAvatarFromBase64, writeAgentProfileFile };
|
|
493
|
+
export { createGatewayAgent, deleteAgentAvatarFile, deleteGatewayAgent, getGatewayAgentEffectiveConfig, listAgentProfileFiles, listGatewayAgents, readAgentAvatarFile, readAgentProfileFile, resolveAgentAvatarImage, updateGatewayAgent, writeAgentAvatarFromBase64, writeAgentProfileFile };
|
|
@@ -274,6 +274,7 @@ var ChatStreamMapper = class {
|
|
|
274
274
|
const toolName = String(event.toolName ?? "unknown");
|
|
275
275
|
this.toolCallToMessageId.set(toolCallId, messageId);
|
|
276
276
|
const events = [this.make("tool_start", {
|
|
277
|
+
...toolExecutionMetadata(event),
|
|
277
278
|
messageId,
|
|
278
279
|
toolCallId,
|
|
279
280
|
toolName,
|
|
@@ -300,6 +301,7 @@ var ChatStreamMapper = class {
|
|
|
300
301
|
const textDelta = extractText(partial);
|
|
301
302
|
const toolName = String(event.toolName ?? "unknown");
|
|
302
303
|
const events = [this.make("tool_update", {
|
|
304
|
+
...toolExecutionMetadata(event),
|
|
303
305
|
messageId,
|
|
304
306
|
toolCallId,
|
|
305
307
|
toolName,
|
|
@@ -329,6 +331,7 @@ var ChatStreamMapper = class {
|
|
|
329
331
|
const result = boundRealtimeToolResult(fullResult);
|
|
330
332
|
const toolName = String(event.toolName ?? "unknown");
|
|
331
333
|
const events = [this.make("tool_end", {
|
|
334
|
+
...toolExecutionMetadata(event),
|
|
332
335
|
messageId,
|
|
333
336
|
toolCallId,
|
|
334
337
|
toolName,
|
|
@@ -541,6 +544,12 @@ function extractDetails(value) {
|
|
|
541
544
|
function asRecord(value) {
|
|
542
545
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
543
546
|
}
|
|
547
|
+
function toolExecutionMetadata(event) {
|
|
548
|
+
return {
|
|
549
|
+
...typeof event.parentToolCallId === "string" ? { parentToolCallId: event.parentToolCallId } : {},
|
|
550
|
+
...typeof event.durationMs === "number" ? { durationMs: event.durationMs } : {}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
544
553
|
function normalizeToolResult(value) {
|
|
545
554
|
if (value == null) return void 0;
|
|
546
555
|
if (typeof value === "string") return { text: value };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolActivity, TurnOutcome } from '@xopcai/gateway-contract';
|
|
1
|
+
import type { AgentStreamToolExecutionMetadata, ToolActivity, TurnOutcome } from '@xopcai/gateway-contract';
|
|
2
2
|
import type { TaskUpdateTrigger } from '../../storage/sqlite/session-input-repository.js';
|
|
3
3
|
export type ChatStreamStatus = 'success' | 'error' | 'cancelled' | 'suspended';
|
|
4
4
|
export type PetFeedbackTaskState = 'working' | 'waiting' | 'success' | 'error';
|
|
@@ -63,14 +63,14 @@ export type ToolStartEvent = ChatStreamEnvelope<'tool_start', {
|
|
|
63
63
|
toolName: string;
|
|
64
64
|
args?: unknown;
|
|
65
65
|
activity: ToolActivity;
|
|
66
|
-
}>;
|
|
66
|
+
} & AgentStreamToolExecutionMetadata>;
|
|
67
67
|
export type ToolUpdateEvent = ChatStreamEnvelope<'tool_update', {
|
|
68
68
|
messageId: string;
|
|
69
69
|
toolCallId: string;
|
|
70
70
|
toolName: string;
|
|
71
71
|
details?: unknown;
|
|
72
72
|
textDelta?: string;
|
|
73
|
-
}>;
|
|
73
|
+
} & AgentStreamToolExecutionMetadata>;
|
|
74
74
|
export type ToolEndEvent = ChatStreamEnvelope<'tool_end', {
|
|
75
75
|
messageId: string;
|
|
76
76
|
toolCallId: string;
|
|
@@ -84,7 +84,7 @@ export type ToolEndEvent = ChatStreamEnvelope<'tool_end', {
|
|
|
84
84
|
};
|
|
85
85
|
deliveries?: import('@xopcai/gateway-contract').ProductDeliveryEnvelope[];
|
|
86
86
|
errorMessage?: string;
|
|
87
|
-
}>;
|
|
87
|
+
} & AgentStreamToolExecutionMetadata>;
|
|
88
88
|
export type CommandStartedEvent = ChatStreamEnvelope<'command_started', {
|
|
89
89
|
messageId: string;
|
|
90
90
|
toolCallId: string;
|
|
@@ -2,8 +2,7 @@ import type { Config } from '../../../config/schema.js';
|
|
|
2
2
|
import type { GatewayService } from '../../service.js';
|
|
3
3
|
/** MCP block for GET/PATCH `/api/config` (authenticated console editing). */
|
|
4
4
|
export declare function buildSafeMcpConfigForWeb(config: Config): {
|
|
5
|
-
servers:
|
|
6
|
-
sessionIdleTtlMs?: number;
|
|
5
|
+
servers: Record<string, Record<string, unknown>>;
|
|
7
6
|
};
|
|
8
7
|
export declare function buildSafeBrowserConfigForWeb(browser: unknown): {
|
|
9
8
|
security?: unknown;
|
|
@@ -109,6 +108,13 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
109
108
|
allowed?: string[];
|
|
110
109
|
};
|
|
111
110
|
runtime: {
|
|
111
|
+
codemode?: {
|
|
112
|
+
enabled: boolean;
|
|
113
|
+
timeoutMs: number;
|
|
114
|
+
maxConcurrentCalls: number;
|
|
115
|
+
maxCalls: number;
|
|
116
|
+
maxOutputTokens: number;
|
|
117
|
+
};
|
|
112
118
|
thinkingLevel?: "low" | "high" | "off" | "medium" | "minimal" | "xhigh" | "max";
|
|
113
119
|
commandIsolation?: {
|
|
114
120
|
mode: "host";
|
|
@@ -345,7 +351,6 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
345
351
|
id?: string;
|
|
346
352
|
}[];
|
|
347
353
|
mcp: {
|
|
348
|
-
servers:
|
|
349
|
-
sessionIdleTtlMs?: number;
|
|
354
|
+
servers: Record<string, Record<string, unknown>>;
|
|
350
355
|
};
|
|
351
356
|
}>;
|
|
@@ -7,9 +7,9 @@ import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConf
|
|
|
7
7
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
8
8
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
9
9
|
import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
10
|
-
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
11
10
|
import { resolveShareConfig } from "../../../share/share-config.js";
|
|
12
11
|
import { maskTunnelSecretForWeb } from "../../../tunnel/env.js";
|
|
12
|
+
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
13
13
|
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus } from "../../../channels/catalog/channel-catalog-service.js";
|
|
14
14
|
import { resolveSessionConfigForWeb, resolveUpdateConfigForWeb } from "../../../config/web-patch.js";
|
|
15
15
|
import { GENERIC_MASKED_SECRET, maskSecretLength } from "./mask-secret-length.js";
|
|
@@ -43,10 +43,7 @@ async function maskLlmProviderApiKeyForWeb(provider) {
|
|
|
43
43
|
function buildSafeMcpConfigForWeb(config) {
|
|
44
44
|
const mcp = config.mcp;
|
|
45
45
|
if (!mcp) return { servers: {} };
|
|
46
|
-
return {
|
|
47
|
-
...mcp.sessionIdleTtlMs !== void 0 ? { sessionIdleTtlMs: mcp.sessionIdleTtlMs } : {},
|
|
48
|
-
servers: normalizeConfiguredMcpServers(mcp.servers)
|
|
49
|
-
};
|
|
46
|
+
return { servers: normalizeConfiguredMcpServers(mcp.servers) };
|
|
50
47
|
}
|
|
51
48
|
function buildSafeBrowserConfigForWeb(browser) {
|
|
52
49
|
if (!browser || typeof browser !== "object") return { enabled: false };
|
|
@@ -295,13 +295,20 @@ async function runOAuthFlow(session, oauthProvider, service) {
|
|
|
295
295
|
session.deviceCode = prompt.deviceCode;
|
|
296
296
|
session.verificationUri = prompt.verificationUri;
|
|
297
297
|
session.message = prompt.message;
|
|
298
|
-
manualCodePromise
|
|
298
|
+
manualCodePromise ??= new Promise((resolve, reject) => {
|
|
299
299
|
manualCodeResolve = resolve;
|
|
300
300
|
manualCodeReject = reject;
|
|
301
301
|
});
|
|
302
302
|
session.manualCodeResolve = manualCodeResolve;
|
|
303
303
|
session.manualCodeReject = manualCodeReject;
|
|
304
|
-
|
|
304
|
+
const cancel = () => manualCodeReject?.(/* @__PURE__ */ new Error("OAuth prompt cancelled"));
|
|
305
|
+
prompt.signal?.addEventListener("abort", cancel, { once: true });
|
|
306
|
+
try {
|
|
307
|
+
if (prompt.signal?.aborted) cancel();
|
|
308
|
+
return await manualCodePromise;
|
|
309
|
+
} finally {
|
|
310
|
+
prompt.signal?.removeEventListener("abort", cancel);
|
|
311
|
+
}
|
|
305
312
|
},
|
|
306
313
|
onProgress: (message) => {
|
|
307
314
|
log.debug({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentPluginStore } from "../../../extensions/agent-plugins/store.js";
|
|
2
2
|
import { savePluginAuthBinding } from "../../../extensions/agent-plugins/auth.js";
|
|
3
|
-
import {
|
|
3
|
+
import { evictAllEmbeddedSessionRunners } from "../../../agent/embedded/session-runner.js";
|
|
4
4
|
import { withAgentPluginSource } from "../../../extensions/agent-plugins/sources.js";
|
|
5
5
|
import { agentPluginInventoryRow } from "../../../extensions/agent-plugins/inventory.js";
|
|
6
6
|
import { removePluginCredentials } from "../../../extensions/agent-plugins/credentials.js";
|
|
@@ -13,7 +13,7 @@ const sourceBody = z.strictObject({
|
|
|
13
13
|
function registerAgentPluginRoutes(app, deps) {
|
|
14
14
|
const store = new AgentPluginStore();
|
|
15
15
|
const refresh = async () => {
|
|
16
|
-
|
|
16
|
+
evictAllEmbeddedSessionRunners();
|
|
17
17
|
deps.service.marketplace.reloadSkills();
|
|
18
18
|
};
|
|
19
19
|
app.post("/api/extensions/inspect", deps.strictRateLimitMiddleware, async (c) => {
|
|
@@ -123,12 +123,7 @@ function registerAgentPluginRoutes(app, deps) {
|
|
|
123
123
|
app.put("/api/extensions/agent-plugins/:id/mcp/:server/auth", deps.strictRateLimitMiddleware, async (c) => {
|
|
124
124
|
try {
|
|
125
125
|
const body = z.strictObject({
|
|
126
|
-
mode: z.enum([
|
|
127
|
-
"auto",
|
|
128
|
-
"oauth",
|
|
129
|
-
"api-key",
|
|
130
|
-
"none"
|
|
131
|
-
]),
|
|
126
|
+
mode: z.enum(["auto", "api-key"]),
|
|
132
127
|
secrets: z.array(z.strictObject({
|
|
133
128
|
target: z.enum(["headers", "env"]),
|
|
134
129
|
key: z.string(),
|
|
@@ -152,7 +147,7 @@ function registerAgentPluginRoutes(app, deps) {
|
|
|
152
147
|
removeData: z.boolean().optional(),
|
|
153
148
|
removeCredentials: z.boolean().optional()
|
|
154
149
|
}).parse(await c.req.json());
|
|
155
|
-
|
|
150
|
+
evictAllEmbeddedSessionRunners();
|
|
156
151
|
if (body.removeCredentials) await removePluginCredentials(store, c.req.param("id"));
|
|
157
152
|
store.remove(c.req.param("id"), body.removeData);
|
|
158
153
|
deps.service.marketplace.reloadSkills();
|
|
@@ -2,7 +2,7 @@ import { normalizeAgentId } from "../../../agent-catalog/id.js";
|
|
|
2
2
|
import { AgentEntrySchema, AgentModelsOverrideSchema, AgentProfileSchema, RuntimePolicySchema, SkillOverrideSchema, ToolPoliciesSchema, WorkflowPolicySchema } from "../../../agent-config/schema.js";
|
|
3
3
|
import { init_agent_config } from "../../../agent-config/index.js";
|
|
4
4
|
import { init_agent_scope } from "../../../agent/agent-scope.js";
|
|
5
|
-
import { createGatewayAgent, deleteAgentAvatarFile, deleteGatewayAgent, getGatewayAgentEffectiveConfig, listAgentProfileFiles, listGatewayAgents, readAgentAvatarFile, readAgentProfileFile, updateGatewayAgent, writeAgentAvatarFromBase64, writeAgentProfileFile } from "../../agents-admin.js";
|
|
5
|
+
import { createGatewayAgent, deleteAgentAvatarFile, deleteGatewayAgent, getGatewayAgentEffectiveConfig, listAgentProfileFiles, listGatewayAgents, readAgentAvatarFile, readAgentProfileFile, resolveAgentAvatarImage, updateGatewayAgent, writeAgentAvatarFromBase64, writeAgentProfileFile } from "../../agents-admin.js";
|
|
6
6
|
import { getVoiceModelsConfig } from "../../../config/voice.js";
|
|
7
7
|
//#region src/gateway/hono/routes/agents.ts
|
|
8
8
|
init_agent_config();
|
|
@@ -208,7 +208,8 @@ function registerAgentsRoutes(authenticated, deps) {
|
|
|
208
208
|
});
|
|
209
209
|
});
|
|
210
210
|
authenticated.get("/api/agents/:id/avatar", async (c) => {
|
|
211
|
-
const
|
|
211
|
+
const id = normalizeAgentId(c.req.param("id") ?? "");
|
|
212
|
+
const res = c.req.query("resolve") === "1" ? await resolveAgentAvatarImage(id) : await readAgentAvatarFile(id);
|
|
212
213
|
if (res.ok === false) return c.json({
|
|
213
214
|
ok: false,
|
|
214
215
|
error: { message: res.error }
|
|
@@ -217,7 +218,7 @@ function registerAgentsRoutes(authenticated, deps) {
|
|
|
217
218
|
status: 200,
|
|
218
219
|
headers: {
|
|
219
220
|
"Content-Type": res.data.contentType,
|
|
220
|
-
"Cache-Control": "private, max-age=3600"
|
|
221
|
+
"Cache-Control": c.req.query("resolve") === "1" ? "private, no-store" : "private, max-age=3600"
|
|
221
222
|
}
|
|
222
223
|
});
|
|
223
224
|
});
|
|
@@ -13,14 +13,11 @@ const actionSchema = z.object({
|
|
|
13
13
|
"cancel",
|
|
14
14
|
"select_account",
|
|
15
15
|
"confirm_scope",
|
|
16
|
-
"replace_source"
|
|
17
|
-
"submit_callback"
|
|
16
|
+
"replace_source"
|
|
18
17
|
]),
|
|
19
18
|
candidateRef: z.string().optional(),
|
|
20
19
|
needKey: z.string().optional(),
|
|
21
|
-
accountId: z.string().optional()
|
|
22
|
-
callbackUrl: z.string().max(16384).optional(),
|
|
23
|
-
instanceId: z.string().optional()
|
|
20
|
+
accountId: z.string().optional()
|
|
24
21
|
}).strict();
|
|
25
22
|
function registerConnectionWaitRoutes(app, { service, strictRateLimitMiddleware }) {
|
|
26
23
|
app.get("/api/sessions/:conversationId/connection-wait", (c) => {
|