@xopcai/xopc 0.0.320 → 0.0.323
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/dist/browser-ext/dist/assets/{auth-DKo-NMUY.js → auth-DocRzRlS.js} +95 -21
- package/dist/browser-ext/dist/background.js +1 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +18 -2
- 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-BXLU0HJa.js → agent-avatar-dicebear-DFzmThVi.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CAFHadiy.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-DYFYiuig.js +1 -0
- package/dist/gateway/static/root/assets/{agents-hrbGiOHn.js → agents-BqIlB5Co.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-nL8iPwEr.js → app-link-C6gA5Nck.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C0jEvonH.js → app-management-settings-panel-BgvMRGWe.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-ByVRv2Oe.js → appearance-settings-CliHU03A.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Drt3Foi9.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CMITc1PQ.js → archive-plugin-DnuPpm0u.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B5Z1PKHm.js → attachment-load-BiwaK0ie.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BOcXqVar.js → automations-page-CJSISGQH.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B-Eduqwz.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BkRb9adx.js → binary-plugins-KDjduQZO.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DsmDlkC2.js → block-editor-bclvgove.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BgBH3eFk.js → browser-automation-inputs-CfQ2T9t6.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-e3KpurLo.js → browser-automations-page-Cxq38Nnp.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-Dwgir6mu.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-H5L5vynP.js +8 -0
- package/dist/gateway/static/root/assets/capabilities-uFKh3Hd0.js +1 -0
- package/dist/gateway/static/root/assets/channels-settings-RFBRYe5S.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DUdkU1C5.js → chat-terminal-dock-DKQC62nQ.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-C6WR9Syy.js → computer-settings-page-D1whpIqL.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-SVKcySx0.js → connector-service-page-BAuYTgf5.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Px-v3Q6Q.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-DBD5yedi.js → date-picker-CfCo3lqh.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-HE41Co5W.js → dependency-picker-DOuVO2M1.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DH9EU9O3.js → desktop-pet-D9tu6Bhu.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Br6Z1Vau.js → desktop-pet-settings-CQPXub2f.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DxkOYSut.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CFjVNb1m.js → extension-debug-page-CtWClPz-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BQ3ldBhh.js → extension-page-BHh9HLCz.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CaXnWbRI.js → extension-settings-page-BdT3v5Uh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DgFmBSH9.js → gateway-config-swr-1eqyz9vZ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CZas_Ekx.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C7h3xef0.js → gateway-startup-retry-C4rsW6vJ.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-w3_aWeNt.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DJ1xaz2p.js → image-generation-api-B5DXMylk.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-CaB54QIp.js → imports-page-B1JH0G5j.js} +1 -1
- package/dist/gateway/static/root/assets/index--3c0awkr.js +121 -0
- package/dist/gateway/static/root/assets/index-CNc4N4TX.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DnvHvKQJ.js → keyboard-shortcuts-settings-DGrLJ8Yh.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BYKrJpFF.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-Bpja8nC6.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-DqjStqbL.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-C4RjTd0C.js → locale-store-BIkcRr3t.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-N0q5DxnI.js → logs-page-Dl4kM4Na.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-gCfH4cwH.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DkPzc50Z.js → markdown-view-Ck_5MADq.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BzLYE9lj.js → media-plugins-DTsZqgo6.js} +1 -1
- package/dist/gateway/static/root/assets/messages-7VAhscYe.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-j6sioeL1.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-CMvvHv0f.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-DVnGa7Lu.js → page-context-capture-button-DTI_g4tz.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-q6lpN9OD.js → page-tabs-CfW_Q-K5.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Ck63fJaQ.js → preview-open-alternatives-CuPN-vAn.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-bv3z8Xkh.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-BHjxRz1E.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-C9K_e-EV.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Bk-es4i9.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CRnytFLF.js → registry-api-BAAZUGnU.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CLGJNA42.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bu3XyrDI.js → runtime-tools-settings-panel-CHJBJKL1.js} +2 -2
- package/dist/gateway/static/root/assets/{scenes-page-B_5HOUzl.js → scenes-page-ClLAD1pz.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-CbOOKW1B.js → schema-form-FQAit5HL.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-Xj8MkXN1.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DwALV8mi.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D3UN4rb4.js → settings-form-section-BDc6bw1q.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BHztZayW.js → settings-page-DnhxBJjV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-nskqtzZs.js → settings-page-layout-D3KNSQ5g.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BtukdJ-z.js → setup-status-panel-F0rCQ-2a.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DbYXEqur.js → share-preview-page-DVQCRxwK.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-C7hf6Cov.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-xPrFejRE.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CK9Jeaur.js → skills-page-RdDYu7Yj.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-B44aWbyL.js → skills-page.utils-mDwC9UJ-.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BwqpUGv_.js → system-settings-panel-Bk7GrMij.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-2A966jFY.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-BKTZzQIT.js → tunnel-api-D3Aquraj.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BB1JBOCz.js → use-autosave-C1xQ-sHn.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CnBxPBVe.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-C-HsgED9.js → voice-api-key-field-DCNECvcp.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DvJKYYA0.js → voice-config-api-B-_niUTU.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-K3e5ONUo.js → work-discovery-overlay-BrGx_JS_.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-dXRTHBoE.js → workflow-run-setup-panel-CmmC2Pdr.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BZVpqw4T.js +6 -0
- package/dist/gateway/static/root/index.html +12 -11
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/capabilities.js +4 -110
- package/dist/packages/gateway-contract/src/chat-previews.js +73 -0
- package/dist/packages/gateway-contract/src/index.js +6 -0
- package/dist/packages/gateway-contract/src/local-apps.js +215 -0
- package/dist/packages/gateway-contract/src/product-delivery.js +62 -17
- package/dist/packages/gateway-contract/src/user-turn-document.js +60 -0
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +5 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/transcript-runtime.d.ts +3 -0
- package/dist/src/agent/embedded/transcript-runtime.js +6 -0
- package/dist/src/agent/external-tools/cliProvider.js +4 -1
- package/dist/src/agent/external-tools/composio-provider.js +9 -3
- package/dist/src/agent/external-tools/gateway-tools.js +17 -10
- package/dist/src/agent/external-tools/mcp-provider.d.ts +3 -1
- package/dist/src/agent/external-tools/mcp-provider.js +91 -6
- package/dist/src/agent/external-tools/service.d.ts +2 -1
- package/dist/src/agent/external-tools/service.js +8 -3
- package/dist/src/agent/external-tools/types.d.ts +9 -0
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-config.js +37 -5
- package/dist/src/agent/mcp/bundle-mcp-gateway.d.ts +1 -0
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -0
- package/dist/src/agent/mcp/bundle-mcp-names.js +2 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +33 -1
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +4 -0
- package/dist/src/agent/mcp/index.js +1 -1
- package/dist/src/agent/mcp/mcp-stdio-transport.d.ts +1 -0
- package/dist/src/agent/mcp/mcp-stdio-transport.js +10 -0
- package/dist/src/agent/mcp/mcp-transport.js +12 -8
- package/dist/src/agent/mcp/oauth/index.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.d.ts +6 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +70 -14
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.d.ts +2 -0
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.js +12 -0
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.d.ts +3 -0
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +14 -2
- package/dist/src/agent/mcp/plugin-http-fetch.d.ts +2 -0
- package/dist/src/agent/mcp/plugin-http-fetch.js +56 -0
- package/dist/src/agent/service/process-direct-streaming.js +27 -12
- package/dist/src/agent/service.js +3 -2
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/skills/index.js +8 -1
- package/dist/src/agent/skills/skill-manager.d.ts +2 -0
- package/dist/src/agent/skills/skill-manager.js +8 -0
- package/dist/src/agent/skills/skill-sources.js +17 -0
- package/dist/src/agent/skills/types.d.ts +3 -1
- package/dist/src/agent/source-context/injector.js +10 -5
- package/dist/src/agent/source-context/types.d.ts +3 -0
- package/dist/src/agent/source-context/types.js +8 -2
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +12 -2
- package/dist/src/agent/tools/automation-tool.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent/tools/search/registry.js +4 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +120 -12
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-previews/index.d.ts +2 -0
- package/dist/src/chat-previews/index.js +3 -0
- package/dist/src/chat-previews/service.d.ts +27 -0
- package/dist/src/chat-previews/service.js +106 -0
- package/dist/src/chat-previews/store.d.ts +28 -0
- package/dist/src/chat-previews/store.js +77 -0
- package/dist/src/cli/commands/agent.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 +3 -3
- package/dist/src/cli/commands/extension-agent-plugin.d.ts +8 -0
- package/dist/src/cli/commands/extension-agent-plugin.js +82 -0
- package/dist/src/cli/commands/extension-marketplace.js +44 -4
- package/dist/src/cli/commands/extension.js +35 -3
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/schema.js +2 -2
- package/dist/src/connectors/account-selection.js +1 -1
- package/dist/src/connectors/connection-candidates.d.ts +4 -1
- package/dist/src/connectors/connection-candidates.js +8 -2
- package/dist/src/connectors/connection-capabilities.d.ts +2 -2
- package/dist/src/connectors/connection-capabilities.js +3 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +6 -1
- package/dist/src/connectors/connection-recovery-service.js +138 -26
- package/dist/src/connectors/plugin-mcp-recovery.d.ts +28 -0
- package/dist/src/connectors/plugin-mcp-recovery.js +90 -0
- package/dist/src/extensions/agent-plugins/auth.d.ts +39 -0
- package/dist/src/extensions/agent-plugins/auth.js +156 -0
- package/dist/src/extensions/agent-plugins/connection.d.ts +8 -0
- package/dist/src/extensions/agent-plugins/connection.js +41 -0
- package/dist/src/extensions/agent-plugins/health.d.ts +4 -0
- package/dist/src/extensions/agent-plugins/health.js +48 -0
- package/dist/src/extensions/agent-plugins/inventory.d.ts +53 -0
- package/dist/src/extensions/agent-plugins/inventory.js +34 -0
- package/dist/src/extensions/agent-plugins/mcp-adapter.d.ts +3 -0
- package/dist/src/extensions/agent-plugins/mcp-adapter.js +47 -0
- package/dist/src/extensions/agent-plugins/sources.d.ts +5 -0
- package/dist/src/extensions/agent-plugins/sources.js +72 -0
- package/dist/src/extensions/agent-plugins/store.d.ts +61 -0
- package/dist/src/extensions/agent-plugins/store.js +305 -0
- package/dist/src/extensions/agent-plugins/validation.d.ts +59 -0
- package/dist/src/extensions/agent-plugins/validation.js +211 -0
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +10 -3
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-plugins.d.ts +3 -0
- package/dist/src/gateway/hono/routes/agent-plugins.js +166 -0
- package/dist/src/gateway/hono/routes/agent-stream.js +14 -0
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +4 -2
- package/dist/src/gateway/hono/routes/chat-previews.d.ts +3 -0
- package/dist/src/gateway/hono/routes/chat-previews.js +41 -0
- package/dist/src/gateway/hono/routes/connection-waits.js +4 -2
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/local-apps.js +71 -39
- package/dist/src/gateway/hono/routes/mcp.js +48 -21
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +4 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +22 -0
- package/dist/src/gateway/hono/routes/side-chats.js +11 -0
- package/dist/src/gateway/service/agent-runner.js +7 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/marketplace-service.d.ts +1 -0
- package/dist/src/gateway/service/marketplace-service.js +15 -1
- package/dist/src/gateway/service/session-input-coordinator.js +3 -3
- package/dist/src/gateway/service.d.ts +5 -1
- package/dist/src/gateway/service.js +19 -5
- package/dist/src/gateway/side-chat/index.d.ts +3 -1
- package/dist/src/gateway/side-chat/index.js +2 -1
- package/dist/src/gateway/side-chat/manager.d.ts +16 -0
- package/dist/src/gateway/side-chat/manager.js +40 -6
- package/dist/src/gateway/side-chat/promotion-service.d.ts +19 -0
- package/dist/src/gateway/side-chat/promotion-service.js +111 -0
- package/dist/src/gateway/side-chat/run-service.js +1 -0
- package/dist/src/gateway/side-chat/types.d.ts +1 -1
- package/dist/src/local-apps/artifact-files.d.ts +3 -0
- package/dist/src/local-apps/artifact-files.js +45 -0
- package/dist/src/local-apps/capabilities/write.js +1 -1
- package/dist/src/local-apps/fix-guidance.d.ts +3 -0
- package/dist/src/local-apps/fix-guidance.js +75 -0
- package/dist/src/local-apps/index.d.ts +2 -1
- package/dist/src/local-apps/scaffold.d.ts +5 -0
- package/dist/src/local-apps/scaffold.js +18 -5
- package/dist/src/local-apps/service.d.ts +18 -3
- package/dist/src/local-apps/service.js +106 -64
- package/dist/src/local-apps/snapshot-store.d.ts +8 -0
- package/dist/src/local-apps/snapshot-store.js +68 -0
- package/dist/src/local-apps/types.d.ts +4 -87
- package/dist/src/notes/service.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/session/client-history.d.ts +3 -1
- package/dist/src/session/client-history.js +10 -3
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/manager.d.ts +4 -0
- package/dist/src/session/manager.js +6 -0
- package/dist/src/session/session-context-for-llm.d.ts +12 -1
- package/dist/src/session/session-context-for-llm.js +16 -2
- package/dist/src/session/store.d.ts +14 -0
- package/dist/src/session/store.js +17 -0
- package/dist/src/session/stored-rows-to-file-entries.js +10 -1
- package/dist/src/session/transcript-outline.js +10 -3
- package/dist/src/storage/sqlite/connection-wait-repository.js +9 -3
- package/dist/src/storage/sqlite/migrations/202_chat_previews.sql +26 -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/row-mappers.js +6 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BGCqlTcR.js +0 -1
- package/dist/gateway/static/root/assets/api-DEneywgz.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-vC87gAyb.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CzYmREol.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-BxaSzUIU.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-D0S3DuAD.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CFCu-8da.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-CENp82yt.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-g_KTZWCb.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-DO7jp0ep.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BkeSEBxk.js +0 -1
- package/dist/gateway/static/root/assets/home-page-KoQXV4hp.js +0 -1
- package/dist/gateway/static/root/assets/index-ZxnWUdPv.css +0 -1
- package/dist/gateway/static/root/assets/index-u4709aCa.js +0 -89
- package/dist/gateway/static/root/assets/local-app-workbench-page-7QX0YFa7.js +0 -2
- package/dist/gateway/static/root/assets/local-apps-page-RSAl-NhO.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-C_cb0Kue.js +0 -1
- package/dist/gateway/static/root/assets/messages-M5xl1fHE.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-CVWst-Er.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BFwCgIls.js +0 -8
- package/dist/gateway/static/root/assets/product-delivery-chCjIpvu.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-BIGvTs9n.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BFEtpkcf.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CHr-P2z4.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-PhEyHSOb.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CmIhlHPS.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CCOTu1jb.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CG1sll8V.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Byq23h9c.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-D5q-wk_d.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DE3ZeJL3.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DGZaETmN.js +0 -6
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { init_paths_state, resolveStateDir } from "../../config/paths-state.js";
|
|
2
|
+
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
3
|
+
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
4
|
+
import { pluginName, pluginServerId } from "./validation.js";
|
|
5
|
+
import { clearPluginMcpHealth } from "./health.js";
|
|
6
|
+
import { isDangerousHostEnvVarName } from "../../infra/host-env-security.js";
|
|
7
|
+
import { McpOAuthStore } from "../../agent/mcp/oauth/mcp-oauth-store.js";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { existsSync, readFileSync, readdirSync, rmSync } from "node:fs";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { validateHeaderName } from "node:http";
|
|
13
|
+
//#region src/extensions/agent-plugins/auth.ts
|
|
14
|
+
init_credentials();
|
|
15
|
+
init_write_file_atomic();
|
|
16
|
+
init_paths_state();
|
|
17
|
+
const bindingSchema = z.strictObject({
|
|
18
|
+
serverName: z.string(),
|
|
19
|
+
mode: z.enum([
|
|
20
|
+
"auto",
|
|
21
|
+
"oauth",
|
|
22
|
+
"api-key",
|
|
23
|
+
"none"
|
|
24
|
+
]),
|
|
25
|
+
identityScope: z.literal("owner"),
|
|
26
|
+
endpointFingerprint: z.string(),
|
|
27
|
+
fields: z.array(z.strictObject({
|
|
28
|
+
target: z.enum(["headers", "env"]),
|
|
29
|
+
key: z.string(),
|
|
30
|
+
provider: z.string(),
|
|
31
|
+
prefix: z.string()
|
|
32
|
+
}))
|
|
33
|
+
});
|
|
34
|
+
const hash = (value) => createHash("sha256").update(value).digest("hex");
|
|
35
|
+
const providerPrefix = (id) => `plugin-${hash(id).slice(0, 16)}-`;
|
|
36
|
+
function pluginEndpointFingerprint(server) {
|
|
37
|
+
return hash(server.type === "stdio" ? JSON.stringify(server) : new URL(server.url).toString());
|
|
38
|
+
}
|
|
39
|
+
function bindingPath(store, id, name) {
|
|
40
|
+
return join(store.stateDir, "plugin-auth", pluginName.parse(id), `${hash(name)}.json`);
|
|
41
|
+
}
|
|
42
|
+
function readPluginAuthBinding(store, id, name, server) {
|
|
43
|
+
const path = bindingPath(store, id, name);
|
|
44
|
+
if (!existsSync(path)) return void 0;
|
|
45
|
+
const binding = bindingSchema.parse(JSON.parse(readFileSync(path, "utf8")));
|
|
46
|
+
return binding.endpointFingerprint === pluginEndpointFingerprint(server) ? binding : void 0;
|
|
47
|
+
}
|
|
48
|
+
async function savePluginAuthBinding(store, id, name, input) {
|
|
49
|
+
const plugin = store.get(id);
|
|
50
|
+
const server = plugin?.servers[name];
|
|
51
|
+
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
|
+
const endpointFingerprint = pluginEndpointFingerprint(server);
|
|
54
|
+
const fields = [];
|
|
55
|
+
const resolver = new CredentialResolver(store.stateDir === resolveStateDir() ? {} : { stateDir: store.stateDir });
|
|
56
|
+
if (input.mode !== "api-key" && input.secrets?.length) throw new Error("Secrets require api-key mode");
|
|
57
|
+
const seen = /* @__PURE__ */ new Set();
|
|
58
|
+
for (const field of input.secrets ?? []) {
|
|
59
|
+
if (!field.value || field.value.length > 16384 || /[\r\n\0]/.test(field.value) || /[\r\n\0]/.test(field.prefix ?? "")) throw new Error("Invalid secret value");
|
|
60
|
+
if (field.target === "headers") {
|
|
61
|
+
validateHeaderName(field.key);
|
|
62
|
+
if (server.type === "stdio") throw new Error("stdio credentials must use env");
|
|
63
|
+
if ([
|
|
64
|
+
"host",
|
|
65
|
+
"content-length",
|
|
66
|
+
"connection",
|
|
67
|
+
"transfer-encoding",
|
|
68
|
+
"cookie"
|
|
69
|
+
].includes(field.key.toLowerCase())) throw new Error("Unsupported credential header");
|
|
70
|
+
} else if (server.type !== "stdio" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(field.key) || /^(PLUGIN_ROOT|PLUGIN_DATA|PATH)$/i.test(field.key) || isDangerousHostEnvVarName(field.key)) throw new Error("Unsupported credential environment variable");
|
|
71
|
+
const normalizedKey = field.target === "headers" || process.platform === "win32" ? field.key.toLowerCase() : field.key;
|
|
72
|
+
if (seen.has(normalizedKey)) throw new Error("Duplicate credential field");
|
|
73
|
+
seen.add(normalizedKey);
|
|
74
|
+
const provider = `${providerPrefix(id)}${hash(JSON.stringify([
|
|
75
|
+
"owner",
|
|
76
|
+
id,
|
|
77
|
+
name,
|
|
78
|
+
endpointFingerprint,
|
|
79
|
+
field.target,
|
|
80
|
+
normalizedKey
|
|
81
|
+
]))}`;
|
|
82
|
+
fields.push({
|
|
83
|
+
target: field.target,
|
|
84
|
+
key: field.key,
|
|
85
|
+
provider,
|
|
86
|
+
prefix: field.prefix ?? ""
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
for (let i = 0; i < fields.length; i++) await resolver.saveApiKey(fields[i].provider, input.secrets[i].value);
|
|
90
|
+
const binding = bindingSchema.parse({
|
|
91
|
+
serverName: name,
|
|
92
|
+
mode: input.mode,
|
|
93
|
+
identityScope: "owner",
|
|
94
|
+
endpointFingerprint,
|
|
95
|
+
fields
|
|
96
|
+
});
|
|
97
|
+
await writeTextAtomic(bindingPath(store, id, name), JSON.stringify(binding));
|
|
98
|
+
clearPluginMcpHealth(id, name, store.stateDir);
|
|
99
|
+
}
|
|
100
|
+
function applyPluginAuthBinding(raw, binding) {
|
|
101
|
+
if (!binding) return raw;
|
|
102
|
+
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
|
+
for (const field of binding.fields) {
|
|
113
|
+
const values = { ...result[field.target] };
|
|
114
|
+
const insensitive = field.target === "headers" || process.platform === "win32";
|
|
115
|
+
for (const key of Object.keys(values)) if (insensitive ? key.toLowerCase() === field.key.toLowerCase() : key === field.key) delete values[key];
|
|
116
|
+
values[field.key] = { xopcSecretRef: {
|
|
117
|
+
provider: field.provider,
|
|
118
|
+
fieldKey: field.key,
|
|
119
|
+
prefix: field.prefix
|
|
120
|
+
} };
|
|
121
|
+
result[field.target] = values;
|
|
122
|
+
}
|
|
123
|
+
result.xopcAuthRevision = hash(JSON.stringify(binding));
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
function pluginOAuthScope(raw) {
|
|
127
|
+
const plugin = raw?.xopcPlugin;
|
|
128
|
+
return plugin ? `owner:${pluginServerId(plugin.id, plugin.serverName)}` : void 0;
|
|
129
|
+
}
|
|
130
|
+
async function removePluginCredentials(store, id) {
|
|
131
|
+
pluginName.parse(id);
|
|
132
|
+
const plugin = store.get(id);
|
|
133
|
+
const serverNames = new Set(Object.keys(plugin?.servers ?? {}));
|
|
134
|
+
const dir = join(store.stateDir, "plugin-auth", id);
|
|
135
|
+
if (existsSync(dir)) for (const file of readdirSync(dir)) {
|
|
136
|
+
if (!/^[a-f0-9]{64}\.json$/.test(file)) throw new Error("Unexpected plugin auth store entry");
|
|
137
|
+
const binding = bindingSchema.parse(JSON.parse(readFileSync(join(dir, file), "utf8")));
|
|
138
|
+
serverNames.add(binding.serverName);
|
|
139
|
+
}
|
|
140
|
+
const { getMcpOAuthManager } = await import("../../agent/mcp/oauth/mcp-oauth-manager.js");
|
|
141
|
+
for (const name of serverNames) {
|
|
142
|
+
await getMcpOAuthManager({ xopcPlugin: {
|
|
143
|
+
id,
|
|
144
|
+
serverName: name
|
|
145
|
+
} }).cancelPending();
|
|
146
|
+
await new McpOAuthStore(`owner:${pluginServerId(id, name)}`).deleteScope();
|
|
147
|
+
}
|
|
148
|
+
const resolver = new CredentialResolver(store.stateDir === resolveStateDir() ? {} : { stateDir: store.stateDir });
|
|
149
|
+
for (const profile of await resolver.listProfiles()) if (profile.provider.startsWith(providerPrefix(id))) await resolver.deleteProviderCredential(profile.provider);
|
|
150
|
+
if (existsSync(dir)) rmSync(dir, {
|
|
151
|
+
recursive: true,
|
|
152
|
+
force: true
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { applyPluginAuthBinding, pluginEndpointFingerprint, pluginOAuthScope, readPluginAuthBinding, removePluginCredentials, savePluginAuthBinding };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ConnectionNeed } from '@xopcai/gateway-contract';
|
|
2
|
+
import { AgentPluginStore } from './store.js';
|
|
3
|
+
export declare function pluginMcpCandidateRef(pluginId: string, serverName: string): string;
|
|
4
|
+
export declare function parsePluginMcpCandidateRef(ref: string): {
|
|
5
|
+
pluginId: string;
|
|
6
|
+
serverName: string;
|
|
7
|
+
} | undefined;
|
|
8
|
+
export declare function resolvePluginMcpConnectionCandidate(ref: string, store?: AgentPluginStore): ConnectionNeed | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { pluginServerId } from "./validation.js";
|
|
2
|
+
import { AgentPluginStore } from "./store.js";
|
|
3
|
+
//#region src/extensions/agent-plugins/connection.ts
|
|
4
|
+
const PREFIX = "plugin-mcp:";
|
|
5
|
+
function pluginMcpCandidateRef(pluginId, serverName) {
|
|
6
|
+
return `${PREFIX}${encodeURIComponent(pluginId)}:${encodeURIComponent(serverName)}`;
|
|
7
|
+
}
|
|
8
|
+
function parsePluginMcpCandidateRef(ref) {
|
|
9
|
+
if (!ref.startsWith(PREFIX)) return void 0;
|
|
10
|
+
const parts = ref.slice(11).split(":");
|
|
11
|
+
if (parts.length !== 2) return void 0;
|
|
12
|
+
try {
|
|
13
|
+
return {
|
|
14
|
+
pluginId: decodeURIComponent(parts[0]),
|
|
15
|
+
serverName: decodeURIComponent(parts[1])
|
|
16
|
+
};
|
|
17
|
+
} catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function resolvePluginMcpConnectionCandidate(ref, store = new AgentPluginStore()) {
|
|
22
|
+
const parsed = parsePluginMcpCandidateRef(ref);
|
|
23
|
+
if (!parsed) return void 0;
|
|
24
|
+
const plugin = store.get(parsed.pluginId);
|
|
25
|
+
const server = plugin?.servers[parsed.serverName];
|
|
26
|
+
if (!plugin || !server || !plugin.receipt.enabled || plugin.readiness === "blocked" || server.type !== "streamable-http") return;
|
|
27
|
+
const serverId = pluginServerId(plugin.id, parsed.serverName);
|
|
28
|
+
return {
|
|
29
|
+
key: serverId,
|
|
30
|
+
target: {
|
|
31
|
+
type: "plugin-mcp",
|
|
32
|
+
pluginId: plugin.id,
|
|
33
|
+
serverId,
|
|
34
|
+
serverName: parsed.serverName
|
|
35
|
+
},
|
|
36
|
+
label: plugin.manifest.name,
|
|
37
|
+
capabilities: [`mcp.tools:${serverId}`]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { parsePluginMcpCandidateRef, pluginMcpCandidateRef, resolvePluginMcpConnectionCandidate };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type PluginMcpHealth = 'ready' | 'authorization_required' | 'error' | 'not_tested';
|
|
2
|
+
export declare function readPluginMcpHealth(id: string, name: string, revision: string, stateDir?: string): PluginMcpHealth;
|
|
3
|
+
export declare function clearPluginMcpHealth(id: string, name: string, stateDir?: string): void;
|
|
4
|
+
export declare function recordPluginMcpHealth(raw: unknown, status: Exclude<PluginMcpHealth, 'not_tested'>): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { init_paths_state, resolveStateDir } from "../../config/paths-state.js";
|
|
2
|
+
import { createLogger } from "../../utils/logger/index.js";
|
|
3
|
+
import { init_logger } from "../../utils/logger.js";
|
|
4
|
+
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
5
|
+
import { pluginName } from "./validation.js";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { readFileSync, rmSync } from "node:fs";
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
//#region src/extensions/agent-plugins/health.ts
|
|
10
|
+
init_paths_state();
|
|
11
|
+
init_write_file_atomic();
|
|
12
|
+
init_logger();
|
|
13
|
+
const log = createLogger("PluginMcpHealth");
|
|
14
|
+
function pathFor(id, name, stateDir) {
|
|
15
|
+
return join(stateDir, "plugin-health", pluginName.parse(id), `${createHash("sha256").update(name).digest("hex")}.json`);
|
|
16
|
+
}
|
|
17
|
+
function readPluginMcpHealth(id, name, revision, stateDir = resolveStateDir()) {
|
|
18
|
+
try {
|
|
19
|
+
const value = JSON.parse(readFileSync(pathFor(id, name, stateDir), "utf8"));
|
|
20
|
+
return value.revision === revision && [
|
|
21
|
+
"ready",
|
|
22
|
+
"authorization_required",
|
|
23
|
+
"error"
|
|
24
|
+
].includes(value.status) ? value.status : "not_tested";
|
|
25
|
+
} catch {
|
|
26
|
+
return "not_tested";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function clearPluginMcpHealth(id, name, stateDir = resolveStateDir()) {
|
|
30
|
+
rmSync(pathFor(id, name, stateDir), { force: true });
|
|
31
|
+
}
|
|
32
|
+
function recordPluginMcpHealth(raw, status) {
|
|
33
|
+
const plugin = raw?.xopcPlugin;
|
|
34
|
+
if (!plugin) return;
|
|
35
|
+
try {
|
|
36
|
+
writeTextAtomicSync(pathFor(plugin.id, plugin.serverName, resolveStateDir()), JSON.stringify({
|
|
37
|
+
revision: plugin.revision,
|
|
38
|
+
status
|
|
39
|
+
}));
|
|
40
|
+
} catch (error) {
|
|
41
|
+
log.warn({
|
|
42
|
+
err: error,
|
|
43
|
+
pluginId: plugin.id
|
|
44
|
+
}, "Could not persist MCP connection status");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { clearPluginMcpHealth, readPluginMcpHealth, recordPluginMcpHealth };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type InstalledAgentPlugin } from './store.js';
|
|
2
|
+
export declare function agentPluginInventoryRow(plugin: InstalledAgentPlugin): {
|
|
3
|
+
id: string;
|
|
4
|
+
pluginId: string;
|
|
5
|
+
format: "agent-plugin";
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
description: string;
|
|
9
|
+
source: string;
|
|
10
|
+
active: boolean;
|
|
11
|
+
activationEligible: boolean;
|
|
12
|
+
readiness: "ready" | "blocked" | "degraded" | "setup_required";
|
|
13
|
+
hasUi: boolean;
|
|
14
|
+
hasConfigSchema: boolean;
|
|
15
|
+
canRollback: boolean;
|
|
16
|
+
components: {
|
|
17
|
+
skills: {
|
|
18
|
+
name: string;
|
|
19
|
+
}[];
|
|
20
|
+
mcp: {
|
|
21
|
+
name: string;
|
|
22
|
+
id: string;
|
|
23
|
+
type: "sse" | "streamable-http" | "stdio";
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
diagnostics: import("./validation.js").PluginDiagnostic[];
|
|
27
|
+
};
|
|
28
|
+
export declare function listAgentPluginInventory(): {
|
|
29
|
+
id: string;
|
|
30
|
+
pluginId: string;
|
|
31
|
+
format: "agent-plugin";
|
|
32
|
+
name: string;
|
|
33
|
+
version: string;
|
|
34
|
+
description: string;
|
|
35
|
+
source: string;
|
|
36
|
+
active: boolean;
|
|
37
|
+
activationEligible: boolean;
|
|
38
|
+
readiness: "ready" | "blocked" | "degraded" | "setup_required";
|
|
39
|
+
hasUi: boolean;
|
|
40
|
+
hasConfigSchema: boolean;
|
|
41
|
+
canRollback: boolean;
|
|
42
|
+
components: {
|
|
43
|
+
skills: {
|
|
44
|
+
name: string;
|
|
45
|
+
}[];
|
|
46
|
+
mcp: {
|
|
47
|
+
name: string;
|
|
48
|
+
id: string;
|
|
49
|
+
type: "sse" | "streamable-http" | "stdio";
|
|
50
|
+
}[];
|
|
51
|
+
};
|
|
52
|
+
diagnostics: import("./validation.js").PluginDiagnostic[];
|
|
53
|
+
}[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { pluginServerId } from "./validation.js";
|
|
2
|
+
import { AgentPluginStore } from "./store.js";
|
|
3
|
+
//#region src/extensions/agent-plugins/inventory.ts
|
|
4
|
+
function agentPluginInventoryRow(plugin) {
|
|
5
|
+
return {
|
|
6
|
+
id: `plugin:${plugin.id}`,
|
|
7
|
+
pluginId: plugin.id,
|
|
8
|
+
format: plugin.format,
|
|
9
|
+
name: plugin.manifest.name,
|
|
10
|
+
version: plugin.manifest.version,
|
|
11
|
+
description: plugin.manifest.description,
|
|
12
|
+
source: "agent-plugin",
|
|
13
|
+
active: plugin.receipt.enabled && plugin.readiness !== "blocked",
|
|
14
|
+
activationEligible: plugin.receipt.enabled,
|
|
15
|
+
readiness: plugin.readiness,
|
|
16
|
+
hasUi: false,
|
|
17
|
+
hasConfigSchema: false,
|
|
18
|
+
canRollback: !!plugin.receipt.previous,
|
|
19
|
+
components: {
|
|
20
|
+
skills: plugin.skills.map((skill) => ({ name: skill.name })),
|
|
21
|
+
mcp: Object.entries(plugin.servers).map(([name, server]) => ({
|
|
22
|
+
name,
|
|
23
|
+
id: pluginServerId(plugin.id, name),
|
|
24
|
+
type: server.type
|
|
25
|
+
}))
|
|
26
|
+
},
|
|
27
|
+
diagnostics: plugin.diagnostics
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function listAgentPluginInventory() {
|
|
31
|
+
return new AgentPluginStore().list().map(agentPluginInventoryRow);
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { agentPluginInventoryRow, listAgentPluginInventory };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AgentPluginStore, type InstalledAgentPlugin } from './store.js';
|
|
2
|
+
import { type PluginDiagnostic } from './validation.js';
|
|
3
|
+
export declare function materializePluginServers(plugin: InstalledAgentPlugin, store?: AgentPluginStore, diagnostics?: PluginDiagnostic[]): Record<string, Record<string, unknown>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { containedPath, expandPluginVariables, pluginServerId, resolvePluginCwd } from "./validation.js";
|
|
2
|
+
import { AgentPluginStore } from "./store.js";
|
|
3
|
+
import { applyPluginAuthBinding, readPluginAuthBinding } from "./auth.js";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
//#region src/extensions/agent-plugins/mcp-adapter.ts
|
|
6
|
+
function materializePluginServers(plugin, store = new AgentPluginStore(), diagnostics = []) {
|
|
7
|
+
const root = plugin.rootDir;
|
|
8
|
+
const data = store.dataDir(plugin.id);
|
|
9
|
+
const servers = Object.create(null);
|
|
10
|
+
for (const [name, server] of Object.entries(plugin.servers)) try {
|
|
11
|
+
const origin = {
|
|
12
|
+
id: plugin.id,
|
|
13
|
+
serverName: name,
|
|
14
|
+
rootDir: root,
|
|
15
|
+
dataDir: data,
|
|
16
|
+
revision: plugin.receipt.revision
|
|
17
|
+
};
|
|
18
|
+
const raw = server.type !== "stdio" ? {
|
|
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
|
+
} : {}
|
|
25
|
+
} : {
|
|
26
|
+
type: "stdio",
|
|
27
|
+
xopcPlugin: origin,
|
|
28
|
+
command: server.command.startsWith("./") ? containedPath(root, resolve(root, server.command)) : server.command,
|
|
29
|
+
args: server.args?.map((value) => expandPluginVariables(value, root, data)),
|
|
30
|
+
env: {
|
|
31
|
+
...Object.fromEntries(Object.entries(server.env ?? {}).map(([key, value]) => [key, expandPluginVariables(value, root, data)])),
|
|
32
|
+
PLUGIN_ROOT: root,
|
|
33
|
+
PLUGIN_DATA: data
|
|
34
|
+
},
|
|
35
|
+
cwd: resolvePluginCwd(server.cwd, root, data)
|
|
36
|
+
};
|
|
37
|
+
servers[pluginServerId(plugin.id, name)] = applyPluginAuthBinding(raw, readPluginAuthBinding(store, plugin.id, name, server));
|
|
38
|
+
} catch (error) {
|
|
39
|
+
diagnostics.push({
|
|
40
|
+
component: `mcp:${name}`,
|
|
41
|
+
message: error instanceof Error ? error.message : String(error)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return servers;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { materializePluginServers };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Config } from '../../config/schema.js';
|
|
2
|
+
export declare function isAgentPluginArchive(buffer: Buffer): boolean;
|
|
3
|
+
export declare function withAgentPluginArchive<T>(buffer: Buffer, fn: (local: string) => T): T;
|
|
4
|
+
/** Resolve remote artifacts only for explicit inspect/install requests, never during discovery. */
|
|
5
|
+
export declare function withAgentPluginSource<T>(source: string, config: Config | undefined, fn: (local: string) => T): Promise<T>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createPluginHttpFetch } from "../../agent/mcp/plugin-http-fetch.js";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import AdmZip from "adm-zip";
|
|
6
|
+
//#region src/extensions/agent-plugins/sources.ts
|
|
7
|
+
function isAgentPluginArchive(buffer) {
|
|
8
|
+
const entries = new AdmZip(buffer).getEntries();
|
|
9
|
+
const paths = entries.map((entry) => entry.entryName.replace(/\/$/, ""));
|
|
10
|
+
const nativeMetadata = (path) => {
|
|
11
|
+
const entry = entries.find((item) => item.entryName === path);
|
|
12
|
+
if (!entry) return false;
|
|
13
|
+
if (entry.header.size > 1024 * 1024) throw new Error("Package metadata exceeds 1 MiB");
|
|
14
|
+
return Boolean(JSON.parse(entry.getData().toString("utf8"))?.xopc?.extension);
|
|
15
|
+
};
|
|
16
|
+
if (paths.includes("xopc.extension.json")) return false;
|
|
17
|
+
if (paths.includes("plugin.json")) return !nativeMetadata("package.json");
|
|
18
|
+
const first = new Set(paths.map((path) => path.split("/")[0]));
|
|
19
|
+
if (first.size !== 1) return false;
|
|
20
|
+
const root = [...first][0];
|
|
21
|
+
return paths.includes(`${root}/plugin.json`) && !paths.includes(`${root}/xopc.extension.json`) && !nativeMetadata(`${root}/package.json`);
|
|
22
|
+
}
|
|
23
|
+
function withAgentPluginArchive(buffer, fn) {
|
|
24
|
+
const dir = mkdtempSync(join(tmpdir(), "xopc-plugin-download-"));
|
|
25
|
+
try {
|
|
26
|
+
const file = join(dir, "plugin.zip");
|
|
27
|
+
writeFileSync(file, buffer);
|
|
28
|
+
return fn(file);
|
|
29
|
+
} finally {
|
|
30
|
+
rmSync(dir, {
|
|
31
|
+
recursive: true,
|
|
32
|
+
force: true
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** Resolve remote artifacts only for explicit inspect/install requests, never during discovery. */
|
|
37
|
+
async function withAgentPluginSource(source, config, fn) {
|
|
38
|
+
if (!source.startsWith("https://") && !source.startsWith("store:")) return fn(source);
|
|
39
|
+
let buffer;
|
|
40
|
+
if (source.startsWith("store:")) {
|
|
41
|
+
const { resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, downloadExtensionStoreZipBuffer, verifyStoreArtifactSha256 } = await import("../../agent/skills/marketplace/adapters/store/store-api-client.js");
|
|
42
|
+
const spec = source.slice(6);
|
|
43
|
+
const match = /^([a-z0-9.-]+)(?:@([^/]+))?$/.exec(spec);
|
|
44
|
+
if (!match) throw new Error("Expected store:<package>[@version]");
|
|
45
|
+
const base = resolveExtensionsStoreBaseUrl(config);
|
|
46
|
+
const artifact = await resolveExtensionZipDownloadUrl(base, match[1], match[2]);
|
|
47
|
+
buffer = await downloadExtensionStoreZipBuffer(base, artifact.downloadUrl);
|
|
48
|
+
verifyStoreArtifactSha256(buffer, artifact.sha256);
|
|
49
|
+
} else {
|
|
50
|
+
const url = new URL(source);
|
|
51
|
+
const response = await createPluginHttpFetch(url, {})(url, { signal: AbortSignal.timeout(3e4) });
|
|
52
|
+
if (!response.ok || !response.body) throw new Error(`Plugin download failed (${response.status})`);
|
|
53
|
+
const reader = response.body.getReader();
|
|
54
|
+
const chunks = [];
|
|
55
|
+
let size = 0;
|
|
56
|
+
try {
|
|
57
|
+
for (;;) {
|
|
58
|
+
const { done, value } = await reader.read();
|
|
59
|
+
if (done) break;
|
|
60
|
+
size += value.length;
|
|
61
|
+
if (size > 50 * 1024 * 1024) throw new Error("Plugin download exceeds 50 MiB");
|
|
62
|
+
chunks.push(Buffer.from(value));
|
|
63
|
+
}
|
|
64
|
+
} finally {
|
|
65
|
+
await reader.cancel();
|
|
66
|
+
}
|
|
67
|
+
buffer = Buffer.concat(chunks);
|
|
68
|
+
}
|
|
69
|
+
return withAgentPluginArchive(buffer, fn);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { isAgentPluginArchive, withAgentPluginArchive, withAgentPluginSource };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type PluginInspection } from './validation.js';
|
|
3
|
+
declare const receiptSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
revision: z.ZodString;
|
|
6
|
+
source: z.ZodString;
|
|
7
|
+
installedAt: z.ZodString;
|
|
8
|
+
enabled: z.ZodBoolean;
|
|
9
|
+
integrity: z.ZodString;
|
|
10
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
11
|
+
previous: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
revision: z.ZodString;
|
|
14
|
+
source: z.ZodString;
|
|
15
|
+
installedAt: z.ZodString;
|
|
16
|
+
enabled: z.ZodBoolean;
|
|
17
|
+
integrity: z.ZodString;
|
|
18
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type PluginReceipt = z.infer<typeof receiptSchema>;
|
|
22
|
+
export interface InstalledAgentPlugin extends PluginInspection {
|
|
23
|
+
id: string;
|
|
24
|
+
format: 'agent-plugin';
|
|
25
|
+
receipt: PluginReceipt;
|
|
26
|
+
readiness: 'ready' | 'setup_required' | 'degraded' | 'blocked';
|
|
27
|
+
}
|
|
28
|
+
export interface PluginInstallPlan extends PluginInspection {
|
|
29
|
+
integrity: string;
|
|
30
|
+
reviewHash: string;
|
|
31
|
+
addedCapabilities: string[];
|
|
32
|
+
installed: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare class AgentPluginStore {
|
|
35
|
+
readonly stateDir: string;
|
|
36
|
+
constructor(stateDir?: string);
|
|
37
|
+
private receiptsDir;
|
|
38
|
+
revisionKey(): string;
|
|
39
|
+
dataDir(id: string): string;
|
|
40
|
+
private revisionDir;
|
|
41
|
+
private receiptPath;
|
|
42
|
+
receipt(id: string): PluginReceipt | undefined;
|
|
43
|
+
private write;
|
|
44
|
+
private mutate;
|
|
45
|
+
get(id: string): InstalledAgentPlugin | undefined;
|
|
46
|
+
list(): InstalledAgentPlugin[];
|
|
47
|
+
active(): InstalledAgentPlugin[];
|
|
48
|
+
inspect(source: string): PluginInstallPlan;
|
|
49
|
+
private plan;
|
|
50
|
+
install(source: string, options?: {
|
|
51
|
+
reviewHash?: string;
|
|
52
|
+
replace?: boolean;
|
|
53
|
+
expectedId?: string;
|
|
54
|
+
sourceLabel?: string;
|
|
55
|
+
}): InstalledAgentPlugin;
|
|
56
|
+
setEnabled(id: string, enabled: boolean): InstalledAgentPlugin;
|
|
57
|
+
rollback(id: string): InstalledAgentPlugin;
|
|
58
|
+
remove(id: string, removeData?: boolean): void;
|
|
59
|
+
private withSource;
|
|
60
|
+
}
|
|
61
|
+
export {};
|