@xopcai/xopc 0.0.321 → 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-C69p1Gbr.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-CWR3p3t3.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-D98bt40S.js → app-management-settings-panel-BgvMRGWe.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-ChMUELAZ.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-BIIiu6uP.js → archive-plugin-DnuPpm0u.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CDJpcsCp.js → attachment-load-BiwaK0ie.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Cb5a_WOk.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-zp55zQPu.js → binary-plugins-KDjduQZO.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B0CTIZb-.js → block-editor-bclvgove.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-Bx3W4J4H.js → browser-automation-inputs-CfQ2T9t6.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D5Lr9b8a.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-1I1PdIq0.js → chat-terminal-dock-DKQC62nQ.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-BT-EfoI6.js → computer-settings-page-D1whpIqL.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-mhQ-19tj.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-BqcldZoN.js → date-picker-CfCo3lqh.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DLDLJx3D.js → dependency-picker-DOuVO2M1.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-kSFeHyrt.js → desktop-pet-D9tu6Bhu.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BjY7DqD7.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-DbWJDT4X.js → extension-debug-page-CtWClPz-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-lAC_2xWA.js → extension-page-BHh9HLCz.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-jFy1NJg9.js → extension-settings-page-BdT3v5Uh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B7WpH3VW.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-C8F_z865.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-Dc7d0_7q.js → image-generation-api-B5DXMylk.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-_fMvJvzM.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-CHnZYx1U.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-D9krC43K.js → locale-store-BIkcRr3t.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-COxOJsgX.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-CurpvCbB.js → markdown-view-Ck_5MADq.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CYldyH6K.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-DZOiI84c.js → page-context-capture-button-DTI_g4tz.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-C-XCf9cR.js → page-tabs-CfW_Q-K5.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CvgeoEU8.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-cK-g8BDq.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-DlUodTo-.js → runtime-tools-settings-panel-CHJBJKL1.js} +2 -2
- package/dist/gateway/static/root/assets/{scenes-page-DO8vGorm.js → scenes-page-ClLAD1pz.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BfboLCeN.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-BytEfCGo.js → settings-form-section-BDc6bw1q.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Da2ql9KX.js → settings-page-DnhxBJjV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CBfB_7yz.js → settings-page-layout-D3KNSQ5g.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DElF2sgq.js → setup-status-panel-F0rCQ-2a.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-B8J0Saj5.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-CNQHhsiv.js → skills-page-RdDYu7Yj.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-B53tyGx5.js → skills-page.utils-mDwC9UJ-.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-0HAvlVtR.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-DJsxU6q_.js → tunnel-api-D3Aquraj.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-eIELzAOD.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-BJ59ZCAn.js → voice-api-key-field-DCNECvcp.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DBXZJWLS.js → voice-config-api-B-_niUTU.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BpSxdIgB.js → work-discovery-overlay-BrGx_JS_.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Bhlv3VUX.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 +1 -0
- 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/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 +13 -1
- 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 +1 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- 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/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/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/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/doctor/checks/database-schema.js +1 -1
- 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/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/update.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +10 -3
- 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/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/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 +14 -0
- 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/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/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DWLXHWXg.js +0 -1
- package/dist/gateway/static/root/assets/api-Df2D6d3C.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BzytHIn1.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CtSV8tp-.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-DrvNA-G2.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-D0S3DuAD.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-c0k2virA.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-Bkl9fDHc.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Dw_h-5Qh.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-C5f4FRpE.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-D7XbH6Hk.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CFJypY6Y.js +0 -1
- package/dist/gateway/static/root/assets/index-B4Vwh0H-.css +0 -1
- package/dist/gateway/static/root/assets/index-BNubE2Zi.js +0 -89
- package/dist/gateway/static/root/assets/local-app-workbench-page-BLKCFXvr.js +0 -2
- package/dist/gateway/static/root/assets/local-apps-page-BNFmOkxs.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-BX5NtnQ2.js +0 -1
- package/dist/gateway/static/root/assets/messages-B1sTgIrE.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DZ0IWx1R.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-B9F1uue_.js +0 -8
- package/dist/gateway/static/root/assets/product-delivery-chCjIpvu.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-DEYWx__w.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-9qMDEKVd.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D4UTOpEm.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CPmOucUB.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-zu5P0dk5.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-ClEw-i1l.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-MLolJfoV.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DTPsW9TY.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Dc30oS9J.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Bq6ab5WJ.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Ci-4HAYm.js +0 -6
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PLUGIN_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
|
|
3
|
+
export declare const MCP_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
|
|
4
|
+
export declare const pluginName: z.ZodString;
|
|
5
|
+
declare const manifestSchema: z.ZodObject<{
|
|
6
|
+
$schema: z.ZodLiteral<"https://agent-plugins.org/schemas/1.0.0/plugin.schema.json">;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
version: z.ZodOptional<z.ZodString>;
|
|
9
|
+
description: z.ZodOptional<z.ZodString>;
|
|
10
|
+
author: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
name: z.ZodOptional<z.ZodString>;
|
|
12
|
+
email: z.ZodOptional<z.ZodString>;
|
|
13
|
+
url: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strict>>;
|
|
15
|
+
homepage: z.ZodOptional<z.ZodString>;
|
|
16
|
+
repository: z.ZodOptional<z.ZodString>;
|
|
17
|
+
license: z.ZodOptional<z.ZodString>;
|
|
18
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
|
+
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
declare const serverSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
22
|
+
type: z.ZodLiteral<"stdio">;
|
|
23
|
+
command: z.ZodString;
|
|
24
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
26
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
28
|
+
type: z.ZodLiteral<"streamable-http">;
|
|
29
|
+
url: z.ZodString;
|
|
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
|
+
}, z.core.$strict>], "type">;
|
|
36
|
+
export type PluginManifest = z.infer<typeof manifestSchema>;
|
|
37
|
+
export type PluginServer = z.infer<typeof serverSchema>;
|
|
38
|
+
export interface PluginDiagnostic {
|
|
39
|
+
component: string;
|
|
40
|
+
message: string;
|
|
41
|
+
}
|
|
42
|
+
export interface PluginInspection {
|
|
43
|
+
manifest: PluginManifest;
|
|
44
|
+
rootDir: string;
|
|
45
|
+
skills: Array<{
|
|
46
|
+
name: string;
|
|
47
|
+
filePath: string;
|
|
48
|
+
}>;
|
|
49
|
+
servers: Record<string, PluginServer>;
|
|
50
|
+
capabilities: string[];
|
|
51
|
+
diagnostics: PluginDiagnostic[];
|
|
52
|
+
}
|
|
53
|
+
export declare function containedPath(root: string, path: string): string;
|
|
54
|
+
export declare function expandPluginVariables(value: string, root: string, data: string): string;
|
|
55
|
+
export declare function resolvePluginCwd(cwd: string | undefined, root: string, data: string): string;
|
|
56
|
+
export declare function validatePluginServer(raw: unknown, root: string, data: string): PluginServer;
|
|
57
|
+
export declare function inspectAgentPlugin(rootDir: string, dataDir?: string): PluginInspection;
|
|
58
|
+
export declare function pluginServerId(pluginId: string, serverName: string): string;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
2
|
+
import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { validateHeaderName, validateHeaderValue } from "node:http";
|
|
5
|
+
import yaml from "js-yaml";
|
|
6
|
+
//#region src/extensions/agent-plugins/validation.ts
|
|
7
|
+
const PLUGIN_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
|
|
8
|
+
const MCP_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
|
|
9
|
+
const pluginName = z.string().min(1).max(64).regex(/^(?!.*(?:--|\.\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/);
|
|
10
|
+
const manifestSchema = z.object({
|
|
11
|
+
$schema: z.literal(PLUGIN_SCHEMA),
|
|
12
|
+
name: pluginName,
|
|
13
|
+
version: z.string().optional(),
|
|
14
|
+
description: z.string().optional(),
|
|
15
|
+
author: z.strictObject({
|
|
16
|
+
name: z.string().optional(),
|
|
17
|
+
email: z.string().optional(),
|
|
18
|
+
url: z.string().optional()
|
|
19
|
+
}).optional(),
|
|
20
|
+
homepage: z.string().optional(),
|
|
21
|
+
repository: z.string().optional(),
|
|
22
|
+
license: z.string().optional(),
|
|
23
|
+
keywords: z.array(z.string()).optional(),
|
|
24
|
+
extensions: z.record(z.string(), z.unknown()).optional()
|
|
25
|
+
});
|
|
26
|
+
const strings = z.record(z.string(), z.string());
|
|
27
|
+
const serverSchema = z.discriminatedUnion("type", [
|
|
28
|
+
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
|
+
}),
|
|
35
|
+
z.strictObject({
|
|
36
|
+
type: z.literal("streamable-http"),
|
|
37
|
+
url: z.string().min(1),
|
|
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
|
+
]);
|
|
46
|
+
function containedPath(root, path) {
|
|
47
|
+
const base = resolve(root);
|
|
48
|
+
const target = resolve(path);
|
|
49
|
+
const rel = relative(base, target);
|
|
50
|
+
if (rel === ".." || rel.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || isAbsolute(rel)) throw new Error("Path escapes package boundary");
|
|
51
|
+
let ancestor = target;
|
|
52
|
+
while (!existsSync(ancestor)) {
|
|
53
|
+
try {
|
|
54
|
+
lstatSync(ancestor);
|
|
55
|
+
throw new Error("Broken package symlink");
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (error.code !== "ENOENT") throw error;
|
|
58
|
+
}
|
|
59
|
+
if (dirname(ancestor) === ancestor) break;
|
|
60
|
+
ancestor = dirname(ancestor);
|
|
61
|
+
}
|
|
62
|
+
let baseAncestor = base;
|
|
63
|
+
while (!existsSync(baseAncestor)) baseAncestor = dirname(baseAncestor);
|
|
64
|
+
const canonicalBase = resolve(realpathSync(baseAncestor), relative(baseAncestor, base));
|
|
65
|
+
const canonicalTarget = resolve(realpathSync(ancestor), relative(ancestor, target));
|
|
66
|
+
const resolvedRelative = relative(canonicalBase, canonicalTarget);
|
|
67
|
+
if (resolvedRelative === ".." || resolvedRelative.startsWith("../") || resolvedRelative.startsWith("..\\") || isAbsolute(resolvedRelative)) throw new Error("Resolved path escapes package boundary");
|
|
68
|
+
return canonicalTarget;
|
|
69
|
+
}
|
|
70
|
+
function readPackageFile(root, path) {
|
|
71
|
+
const safe = containedPath(root, path);
|
|
72
|
+
const stat = statSync(safe);
|
|
73
|
+
if (!stat.isFile() || stat.size > 1024 * 1024) throw new Error("Expected a regular file of at most 1 MiB");
|
|
74
|
+
return readFileSync(safe, "utf8");
|
|
75
|
+
}
|
|
76
|
+
function expandPluginVariables(value, root, data) {
|
|
77
|
+
return value.replace(/\$\{PLUGIN_(ROOT|DATA)\}/g, (_, key) => key === "ROOT" ? root : data);
|
|
78
|
+
}
|
|
79
|
+
function resolvePluginCwd(cwd, root, data) {
|
|
80
|
+
if (cwd === void 0) return root;
|
|
81
|
+
const dataRooted = /^\$\{PLUGIN_DATA\}(?:\/|$)/.test(cwd);
|
|
82
|
+
if (!dataRooted && !/^(?:\.\/|\$\{PLUGIN_ROOT\}(?:\/|$))/.test(cwd)) throw new Error("Invalid MCP cwd");
|
|
83
|
+
return containedPath(dataRooted ? data : root, resolve(root, expandPluginVariables(cwd, root, data)));
|
|
84
|
+
}
|
|
85
|
+
function validatePluginServer(raw, root, data) {
|
|
86
|
+
const server = serverSchema.parse(raw);
|
|
87
|
+
if (server.type === "stdio") {
|
|
88
|
+
if (server.command.startsWith("./")) {
|
|
89
|
+
if (!statSync(containedPath(root, resolve(root, server.command))).isFile()) throw new Error("MCP command must be a file");
|
|
90
|
+
} else if (!/^[^\s/\\:;|&<>`$\x00-\x1f]+$/.test(server.command)) throw new Error("MCP command must be one bare executable or ./package-path");
|
|
91
|
+
for (const key of Object.keys(server.env ?? {})) {
|
|
92
|
+
if (["PLUGIN_ROOT", "PLUGIN_DATA"].includes(process.platform === "win32" ? key.toUpperCase() : key)) throw new Error("Reserved plugin environment variable");
|
|
93
|
+
if (!key || /[=\0]/.test(key)) throw new Error("Invalid environment name");
|
|
94
|
+
}
|
|
95
|
+
if ([
|
|
96
|
+
...server.args ?? [],
|
|
97
|
+
...Object.values(server.env ?? {}),
|
|
98
|
+
server.command,
|
|
99
|
+
server.cwd ?? ""
|
|
100
|
+
].some((value) => value.includes("\0"))) throw new Error("NUL in process configuration");
|
|
101
|
+
resolvePluginCwd(server.cwd, root, data);
|
|
102
|
+
} else {
|
|
103
|
+
const url = new URL(server.url);
|
|
104
|
+
const loopback = url.hostname === "localhost" || url.hostname === "[::1]" || /^127(?:\.\d{1,3}){3}$/.test(url.hostname);
|
|
105
|
+
if (!["https:", "http:"].includes(url.protocol) || url.protocol === "http:" && !loopback || url.username || url.password || server.url.includes("#")) throw new Error("Remote MCP requires HTTPS (HTTP is allowed on loopback), without user information or fragments");
|
|
106
|
+
const names = /* @__PURE__ */ new Set();
|
|
107
|
+
for (const [key, value] of Object.entries(server.headers ?? {})) {
|
|
108
|
+
validateHeaderName(key);
|
|
109
|
+
validateHeaderValue(key, value);
|
|
110
|
+
if (names.has(key.toLowerCase())) throw new Error("Duplicate case-insensitive header");
|
|
111
|
+
names.add(key.toLowerCase());
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return server;
|
|
115
|
+
}
|
|
116
|
+
function inspectAgentPlugin(rootDir, dataDir = join(rootDir, ".inspection-data")) {
|
|
117
|
+
const root = realpathSync(rootDir);
|
|
118
|
+
if (existsSync(join(root, "xopc.extension.json"))) throw new Error("This package is a native xopc extension");
|
|
119
|
+
if (existsSync(join(root, "package.json"))) {
|
|
120
|
+
if (JSON.parse(readPackageFile(root, join(root, "package.json")))?.xopc?.extension) throw new Error("This package is a native xopc extension");
|
|
121
|
+
}
|
|
122
|
+
const raw = JSON.parse(readPackageFile(root, join(root, "plugin.json")));
|
|
123
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new Error("Plugin manifest must be an object");
|
|
124
|
+
const diagnostics = [];
|
|
125
|
+
const cleaned = { ...raw };
|
|
126
|
+
for (const key of Object.keys(cleaned)) if (!Object.hasOwn(manifestSchema.shape, key)) {
|
|
127
|
+
diagnostics.push({
|
|
128
|
+
component: "manifest",
|
|
129
|
+
message: `Ignored unknown field: ${key}`
|
|
130
|
+
});
|
|
131
|
+
delete cleaned[key];
|
|
132
|
+
}
|
|
133
|
+
if ("extensions" in cleaned && (!cleaned.extensions || typeof cleaned.extensions !== "object" || Array.isArray(cleaned.extensions))) {
|
|
134
|
+
diagnostics.push({
|
|
135
|
+
component: "manifest",
|
|
136
|
+
message: "Ignored non-object extensions field"
|
|
137
|
+
});
|
|
138
|
+
delete cleaned.extensions;
|
|
139
|
+
}
|
|
140
|
+
const result = {
|
|
141
|
+
manifest: manifestSchema.parse(cleaned),
|
|
142
|
+
rootDir: root,
|
|
143
|
+
skills: [],
|
|
144
|
+
servers: Object.create(null),
|
|
145
|
+
capabilities: [],
|
|
146
|
+
diagnostics
|
|
147
|
+
};
|
|
148
|
+
const attempt = (component, fn) => {
|
|
149
|
+
try {
|
|
150
|
+
fn();
|
|
151
|
+
} catch (error) {
|
|
152
|
+
diagnostics.push({
|
|
153
|
+
component,
|
|
154
|
+
message: error instanceof Error ? error.message : String(error)
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const present = (path) => {
|
|
159
|
+
try {
|
|
160
|
+
lstatSync(path);
|
|
161
|
+
return true;
|
|
162
|
+
} catch (error) {
|
|
163
|
+
if (error.code === "ENOENT") return false;
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const skillsDir = join(root, "skills");
|
|
168
|
+
if (present(skillsDir)) attempt("skills", () => {
|
|
169
|
+
const safe = containedPath(root, skillsDir);
|
|
170
|
+
if (!statSync(safe).isDirectory()) throw new Error("skills must be a directory");
|
|
171
|
+
for (const name of readdirSync(safe).sort()) attempt(`skill:${name}`, () => {
|
|
172
|
+
const dir = containedPath(root, join(safe, name));
|
|
173
|
+
if (!statSync(dir).isDirectory() || !present(join(dir, "SKILL.md"))) return;
|
|
174
|
+
const filePath = containedPath(root, join(dir, "SKILL.md"));
|
|
175
|
+
const match = readPackageFile(root, filePath).match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
176
|
+
if (!match) throw new Error("Skill requires YAML frontmatter");
|
|
177
|
+
const metadata = z.object({
|
|
178
|
+
name: z.string().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
|
|
179
|
+
description: z.string().min(1).max(1024),
|
|
180
|
+
license: z.string().optional(),
|
|
181
|
+
compatibility: z.string().min(1).max(500).optional(),
|
|
182
|
+
metadata: strings.optional(),
|
|
183
|
+
"allowed-tools": z.string().optional()
|
|
184
|
+
}).parse(yaml.load(match[1], { schema: yaml.JSON_SCHEMA }));
|
|
185
|
+
if (metadata.name !== name || !metadata.description.trim()) throw new Error("Skill name must match its directory and description must not be blank");
|
|
186
|
+
result.skills.push({
|
|
187
|
+
name,
|
|
188
|
+
filePath
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
const mcpPath = join(root, "mcp.json");
|
|
193
|
+
if (present(mcpPath)) attempt("mcp", () => {
|
|
194
|
+
const mcp = z.strictObject({
|
|
195
|
+
$schema: z.literal(MCP_SCHEMA),
|
|
196
|
+
mcpServers: z.record(z.string(), z.unknown())
|
|
197
|
+
}).parse(JSON.parse(readPackageFile(root, mcpPath)));
|
|
198
|
+
for (const [name, rawServer] of Object.entries(mcp.mcpServers)) attempt(`mcp:${name}`, () => {
|
|
199
|
+
result.servers[name] = validatePluginServer(rawServer, root, dataDir);
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
for (const skill of result.skills) result.capabilities.push(`content.skills:${skill.name}`);
|
|
203
|
+
for (const [name, server] of Object.entries(result.servers)) result.capabilities.push(server.type === "stdio" ? `runtime.mcp.stdio:${name}:${JSON.stringify(server)}` : `network.mcp:${name}:${server.type}:${server.url}:${JSON.stringify(server.headers ?? {})}`);
|
|
204
|
+
result.capabilities.sort();
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
function pluginServerId(pluginId, serverName) {
|
|
208
|
+
return `plugin/${encodeURIComponent(pluginId)}/${encodeURIComponent(serverName)}`;
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
export { MCP_SCHEMA, PLUGIN_SCHEMA, containedPath, expandPluginVariables, inspectAgentPlugin, pluginName, pluginServerId, resolvePluginCwd, validatePluginServer };
|
|
@@ -2,8 +2,8 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_paths, resolveBundledExtensionsDir, resolveExtensionsDir } from "../config/paths.js";
|
|
4
4
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
|
-
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
6
5
|
import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "./lockfile.js";
|
|
6
|
+
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
7
7
|
import { commitStagedExtensionInstall, finalizeStagedExtensionInstall, rollbackStagedExtensionInstall, stageExtensionNpm, stageExtensionStoreZip } from "./install-transaction.js";
|
|
8
8
|
import { findExtension } from "./marketplace.js";
|
|
9
9
|
import { join } from "node:path";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parseTurnOutcome } from "../../../packages/gateway-contract/src/turn-outcome.js";
|
|
2
2
|
import { resolveToolActivity } from "../../../packages/gateway-contract/src/tool-activity.js";
|
|
3
|
+
import { isUserTurnDocument } from "../../../packages/gateway-contract/src/user-turn-document.js";
|
|
3
4
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
4
5
|
import { createPetFeedback } from "./pet-feedback.js";
|
|
5
6
|
//#region src/gateway/chat-stream/mapper.ts
|
|
@@ -446,12 +447,15 @@ function userMessageFromEvent(event, turnId) {
|
|
|
446
447
|
};
|
|
447
448
|
}
|
|
448
449
|
function userMessageDisplayMetadata(value) {
|
|
449
|
-
const
|
|
450
|
-
|
|
450
|
+
const metadata = asRecord(value);
|
|
451
|
+
const rows = metadata?.sourceContexts;
|
|
452
|
+
const userTurnDocument = isUserTurnDocument(metadata?.userTurnDocument) ? metadata.userTurnDocument : void 0;
|
|
453
|
+
if (!Array.isArray(rows)) return userTurnDocument ? { userTurnDocument } : void 0;
|
|
451
454
|
const sourceContexts = rows.flatMap((value) => {
|
|
452
455
|
const row = asRecord(value);
|
|
453
456
|
if (row?.kind !== "note" && row?.kind !== "task" && row?.kind !== "file" && row?.kind !== "session" && row?.kind !== "browser_tab" && row?.kind !== "mcp_resource" || typeof row.sourceId !== "string" || typeof row.version !== "string" || typeof row.title !== "string") return [];
|
|
454
457
|
return [{
|
|
458
|
+
...typeof row.refId === "string" ? { refId: row.refId } : {},
|
|
455
459
|
kind: row.kind,
|
|
456
460
|
sourceId: row.sourceId,
|
|
457
461
|
version: row.version,
|
|
@@ -461,7 +465,10 @@ function userMessageDisplayMetadata(value) {
|
|
|
461
465
|
...row.kind === "file" && (row.fileKind === "file" || row.fileKind === "directory") ? { fileKind: row.fileKind } : {}
|
|
462
466
|
}];
|
|
463
467
|
});
|
|
464
|
-
return sourceContexts.length > 0 ? {
|
|
468
|
+
return sourceContexts.length > 0 || userTurnDocument ? {
|
|
469
|
+
...sourceContexts.length > 0 ? { sourceContexts } : {},
|
|
470
|
+
...userTurnDocument ? { userTurnDocument } : {}
|
|
471
|
+
} : void 0;
|
|
465
472
|
}
|
|
466
473
|
function extractTextFromMessage(message) {
|
|
467
474
|
return extractText(message.content);
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { AgentPluginStore } from "../../../extensions/agent-plugins/store.js";
|
|
2
|
+
import { removePluginCredentials, savePluginAuthBinding } from "../../../extensions/agent-plugins/auth.js";
|
|
3
|
+
import { disposeAllSessionMcpRuntimes } from "../../../agent/mcp/bundle-mcp-runtime.js";
|
|
4
|
+
import { withAgentPluginSource } from "../../../extensions/agent-plugins/sources.js";
|
|
5
|
+
import { agentPluginInventoryRow } from "../../../extensions/agent-plugins/inventory.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
//#region src/gateway/hono/routes/agent-plugins.ts
|
|
8
|
+
const sourceBody = z.strictObject({
|
|
9
|
+
source: z.string().min(1),
|
|
10
|
+
reviewHash: z.string().optional()
|
|
11
|
+
});
|
|
12
|
+
function registerAgentPluginRoutes(app, deps) {
|
|
13
|
+
const store = new AgentPluginStore();
|
|
14
|
+
const refresh = async () => {
|
|
15
|
+
await disposeAllSessionMcpRuntimes();
|
|
16
|
+
deps.service.marketplace.reloadSkills();
|
|
17
|
+
};
|
|
18
|
+
app.post("/api/extensions/inspect", deps.strictRateLimitMiddleware, async (c) => {
|
|
19
|
+
try {
|
|
20
|
+
const body = sourceBody.parse(await c.req.json());
|
|
21
|
+
return c.json({
|
|
22
|
+
ok: true,
|
|
23
|
+
payload: await withAgentPluginSource(body.source, deps.service.currentConfig, (source) => store.inspect(source))
|
|
24
|
+
});
|
|
25
|
+
} catch (error) {
|
|
26
|
+
return c.json({
|
|
27
|
+
ok: false,
|
|
28
|
+
error: error instanceof Error ? error.message : String(error)
|
|
29
|
+
}, 400);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
app.post("/api/extensions/install", deps.strictRateLimitMiddleware, async (c) => {
|
|
33
|
+
try {
|
|
34
|
+
const body = sourceBody.parse(await c.req.json());
|
|
35
|
+
const plugin = await withAgentPluginSource(body.source, deps.service.currentConfig, (source) => store.install(source, {
|
|
36
|
+
reviewHash: body.reviewHash,
|
|
37
|
+
sourceLabel: body.source
|
|
38
|
+
}));
|
|
39
|
+
await refresh();
|
|
40
|
+
return c.json({
|
|
41
|
+
ok: true,
|
|
42
|
+
payload: agentPluginInventoryRow(plugin)
|
|
43
|
+
});
|
|
44
|
+
} catch (error) {
|
|
45
|
+
return c.json({
|
|
46
|
+
ok: false,
|
|
47
|
+
error: error instanceof Error ? error.message : String(error)
|
|
48
|
+
}, 400);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
app.get("/api/extensions/agent-plugins/:id", (c) => {
|
|
52
|
+
try {
|
|
53
|
+
const plugin = store.get(c.req.param("id"));
|
|
54
|
+
return plugin ? c.json({
|
|
55
|
+
ok: true,
|
|
56
|
+
payload: agentPluginInventoryRow(plugin)
|
|
57
|
+
}) : c.json({
|
|
58
|
+
ok: false,
|
|
59
|
+
error: "Plugin not found"
|
|
60
|
+
}, 404);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
return c.json({
|
|
63
|
+
ok: false,
|
|
64
|
+
error: error instanceof Error ? error.message : String(error)
|
|
65
|
+
}, 400);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
app.post("/api/extensions/agent-plugins/:id/activation", deps.strictRateLimitMiddleware, async (c) => {
|
|
69
|
+
try {
|
|
70
|
+
const body = z.strictObject({ enabled: z.boolean() }).parse(await c.req.json());
|
|
71
|
+
const plugin = store.setEnabled(c.req.param("id"), body.enabled);
|
|
72
|
+
await refresh();
|
|
73
|
+
return c.json({
|
|
74
|
+
ok: true,
|
|
75
|
+
payload: agentPluginInventoryRow(plugin)
|
|
76
|
+
});
|
|
77
|
+
} catch (error) {
|
|
78
|
+
return c.json({
|
|
79
|
+
ok: false,
|
|
80
|
+
error: error instanceof Error ? error.message : String(error)
|
|
81
|
+
}, 400);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
app.post("/api/extensions/agent-plugins/:id/update", deps.strictRateLimitMiddleware, async (c) => {
|
|
85
|
+
try {
|
|
86
|
+
const body = sourceBody.parse(await c.req.json());
|
|
87
|
+
const plugin = await withAgentPluginSource(body.source, deps.service.currentConfig, (source) => store.install(source, {
|
|
88
|
+
reviewHash: body.reviewHash,
|
|
89
|
+
replace: true,
|
|
90
|
+
expectedId: c.req.param("id"),
|
|
91
|
+
sourceLabel: body.source
|
|
92
|
+
}));
|
|
93
|
+
await refresh();
|
|
94
|
+
return c.json({
|
|
95
|
+
ok: true,
|
|
96
|
+
payload: agentPluginInventoryRow(plugin)
|
|
97
|
+
});
|
|
98
|
+
} catch (error) {
|
|
99
|
+
return c.json({
|
|
100
|
+
ok: false,
|
|
101
|
+
error: error instanceof Error ? error.message : String(error)
|
|
102
|
+
}, 400);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
app.post("/api/extensions/agent-plugins/:id/rollback", deps.strictRateLimitMiddleware, async (c) => {
|
|
106
|
+
try {
|
|
107
|
+
const plugin = store.rollback(c.req.param("id"));
|
|
108
|
+
await refresh();
|
|
109
|
+
return c.json({
|
|
110
|
+
ok: true,
|
|
111
|
+
payload: agentPluginInventoryRow(plugin)
|
|
112
|
+
});
|
|
113
|
+
} catch (error) {
|
|
114
|
+
return c.json({
|
|
115
|
+
ok: false,
|
|
116
|
+
error: error instanceof Error ? error.message : String(error)
|
|
117
|
+
}, 400);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
app.put("/api/extensions/agent-plugins/:id/mcp/:server/auth", deps.strictRateLimitMiddleware, async (c) => {
|
|
121
|
+
try {
|
|
122
|
+
const body = z.strictObject({
|
|
123
|
+
mode: z.enum([
|
|
124
|
+
"auto",
|
|
125
|
+
"oauth",
|
|
126
|
+
"api-key",
|
|
127
|
+
"none"
|
|
128
|
+
]),
|
|
129
|
+
secrets: z.array(z.strictObject({
|
|
130
|
+
target: z.enum(["headers", "env"]),
|
|
131
|
+
key: z.string(),
|
|
132
|
+
value: z.string(),
|
|
133
|
+
prefix: z.string().optional()
|
|
134
|
+
})).max(20).optional()
|
|
135
|
+
}).parse(await c.req.json());
|
|
136
|
+
await savePluginAuthBinding(store, c.req.param("id"), c.req.param("server"), body);
|
|
137
|
+
await refresh();
|
|
138
|
+
return c.json({ ok: true });
|
|
139
|
+
} catch (error) {
|
|
140
|
+
return c.json({
|
|
141
|
+
ok: false,
|
|
142
|
+
error: error instanceof Error ? error.message : String(error)
|
|
143
|
+
}, 400);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
app.delete("/api/extensions/agent-plugins/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
147
|
+
try {
|
|
148
|
+
const body = z.strictObject({
|
|
149
|
+
removeData: z.boolean().optional(),
|
|
150
|
+
removeCredentials: z.boolean().optional()
|
|
151
|
+
}).parse(await c.req.json());
|
|
152
|
+
await disposeAllSessionMcpRuntimes();
|
|
153
|
+
if (body.removeCredentials) await removePluginCredentials(store, c.req.param("id"));
|
|
154
|
+
store.remove(c.req.param("id"), body.removeData);
|
|
155
|
+
deps.service.marketplace.reloadSkills();
|
|
156
|
+
return c.json({ ok: true });
|
|
157
|
+
} catch (error) {
|
|
158
|
+
return c.json({
|
|
159
|
+
ok: false,
|
|
160
|
+
error: error instanceof Error ? error.message : String(error)
|
|
161
|
+
}, 400);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { registerAgentPluginRoutes };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packages/gateway-contract/src/user-turn-document.js";
|
|
2
|
+
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
1
3
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
2
4
|
import { parseTurnContextRefs } from "../../../agent/source-context/types.js";
|
|
3
5
|
import { replaceLatestSessionTurn, submitSessionInput } from "./session-input-handler.js";
|
|
4
6
|
//#region src/gateway/hono/routes/agent-stream.ts
|
|
7
|
+
init_src();
|
|
5
8
|
function registerAgentStreamRoutes(authenticated, deps) {
|
|
6
9
|
const { service, chatRateLimitMiddleware } = deps;
|
|
7
10
|
authenticated.post("/api/agent/abort", chatRateLimitMiddleware, async (c) => {
|
|
@@ -60,6 +63,17 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
60
63
|
message: "Invalid source context references"
|
|
61
64
|
}
|
|
62
65
|
}, 400);
|
|
66
|
+
if (typeof body.content === "string") {
|
|
67
|
+
const document = parseUserTurnDocument(body.content);
|
|
68
|
+
const refIds = new Set((contextRefs ?? []).flatMap((ref) => ref.refId ? [ref.refId] : []));
|
|
69
|
+
if (document && !userTurnDocumentRefIds(document).every((refId) => refIds.has(refId))) return c.json({
|
|
70
|
+
ok: false,
|
|
71
|
+
error: {
|
|
72
|
+
code: "BAD_REQUEST",
|
|
73
|
+
message: "Input contains an unknown context reference"
|
|
74
|
+
}
|
|
75
|
+
}, 400);
|
|
76
|
+
}
|
|
63
77
|
if (body.content !== void 0) {
|
|
64
78
|
const contentError = validateWebchatContent(body.content);
|
|
65
79
|
if (contentError) return c.json({
|
|
@@ -7,6 +7,7 @@ import { createOAuthAsyncHandler } from "../oauth-async.js";
|
|
|
7
7
|
import { createOAuthHandler } from "../oauth.js";
|
|
8
8
|
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
9
9
|
import { loadExtensionStore, saveExtensionStore } from "../lib/extension-store.js";
|
|
10
|
+
import { listAgentPluginInventory } from "../../../extensions/agent-plugins/inventory.js";
|
|
10
11
|
import { relative, resolve } from "node:path";
|
|
11
12
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
12
13
|
//#region src/gateway/hono/routes/auth-registry-extensions.ts
|
|
@@ -152,7 +153,7 @@ function registerAuthRegistryExtensionsRoutes(authenticated, deps) {
|
|
|
152
153
|
});
|
|
153
154
|
authenticated.get("/api/extensions", async (c) => {
|
|
154
155
|
const loader = service.getExtensionLoader();
|
|
155
|
-
if (!loader) return c.json({ extensions:
|
|
156
|
+
if (!loader) return c.json({ extensions: listAgentPluginInventory() });
|
|
156
157
|
const registry = loader.getRegistry();
|
|
157
158
|
const discovered = loader.discoverExtensions();
|
|
158
159
|
const activeIds = /* @__PURE__ */ new Set();
|
|
@@ -166,6 +167,7 @@ function registerAuthRegistryExtensionsRoutes(authenticated, deps) {
|
|
|
166
167
|
activationEligibleIds = /* @__PURE__ */ new Set();
|
|
167
168
|
}
|
|
168
169
|
const extensions = discovered.map((ext) => ({
|
|
170
|
+
format: "native-extension",
|
|
169
171
|
id: ext.manifest.id,
|
|
170
172
|
name: ext.manifest.name,
|
|
171
173
|
description: ext.manifest.description,
|
|
@@ -182,7 +184,7 @@ function registerAuthRegistryExtensionsRoutes(authenticated, deps) {
|
|
|
182
184
|
contributions: ext.manifest.ui.contributions
|
|
183
185
|
} : void 0
|
|
184
186
|
}));
|
|
185
|
-
return c.json({ extensions });
|
|
187
|
+
return c.json({ extensions: [...extensions, ...listAgentPluginInventory()] });
|
|
186
188
|
});
|
|
187
189
|
/**
|
|
188
190
|
* Built-in (bundled) extension enable/disable — persists `extensions.enabled` / `extensions.disabled`.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ChatPreviewFixGuidanceInputSchema, ChatPreviewSourceHashSchema } from "../../../../packages/gateway-contract/src/chat-previews.js";
|
|
2
|
+
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
|
+
import { ChatPreviewNotFoundError } from "../../../chat-previews/service.js";
|
|
4
|
+
import "../../../chat-previews/index.js";
|
|
5
|
+
//#region src/gateway/hono/routes/chat-previews.ts
|
|
6
|
+
init_src();
|
|
7
|
+
function registerChatPreviewRoutes(app, deps) {
|
|
8
|
+
app.get("/api/chat-previews/:id/revisions/:sourceHash", (c) => {
|
|
9
|
+
const sourceHash = ChatPreviewSourceHashSchema.safeParse(c.req.param("sourceHash"));
|
|
10
|
+
if (!sourceHash.success) return c.json({ error: "Invalid preview revision" }, 400);
|
|
11
|
+
try {
|
|
12
|
+
return c.json({ revision: deps.service.chatPreviews.getRevision(c.req.param("id"), sourceHash.data) }, 200, { "Cache-Control": "private, max-age=31536000, immutable" });
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (error instanceof ChatPreviewNotFoundError) return c.json({ error: error.message }, 404);
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
app.post("/api/chat-previews/:id/fix-guidance", async (c) => {
|
|
19
|
+
const parsed = ChatPreviewFixGuidanceInputSchema.safeParse(await c.req.json().catch(() => null));
|
|
20
|
+
if (!parsed.success) return c.json({ error: "Invalid fix guidance input" }, 400);
|
|
21
|
+
try {
|
|
22
|
+
return c.json({ guidance: deps.service.chatPreviews.getFixGuidance(c.req.param("id"), parsed.data.sourceHash, parsed.data.diagnostics, parsed.data.locale) });
|
|
23
|
+
} catch (error) {
|
|
24
|
+
if (error instanceof ChatPreviewNotFoundError) return c.json({ error: error.message }, 404);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
app.post("/api/chat-previews/:id/promote", async (c) => {
|
|
29
|
+
const body = await c.req.json().catch(() => null);
|
|
30
|
+
const sourceHash = ChatPreviewSourceHashSchema.safeParse(body?.sourceHash);
|
|
31
|
+
if (!sourceHash.success) return c.json({ error: "Invalid preview revision" }, 400);
|
|
32
|
+
try {
|
|
33
|
+
return c.json({ app: deps.service.chatPreviews.promote(c.req.param("id"), sourceHash.data) }, 201);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
if (error instanceof ChatPreviewNotFoundError) return c.json({ error: error.message }, 404);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { registerChatPreviewRoutes };
|
|
@@ -13,11 +13,13 @@ const actionSchema = z.object({
|
|
|
13
13
|
"cancel",
|
|
14
14
|
"select_account",
|
|
15
15
|
"confirm_scope",
|
|
16
|
-
"replace_source"
|
|
16
|
+
"replace_source",
|
|
17
|
+
"submit_callback"
|
|
17
18
|
]),
|
|
18
19
|
candidateRef: z.string().optional(),
|
|
19
20
|
needKey: z.string().optional(),
|
|
20
|
-
accountId: z.string().optional()
|
|
21
|
+
accountId: z.string().optional(),
|
|
22
|
+
callbackUrl: z.string().max(16384).optional()
|
|
21
23
|
}).strict();
|
|
22
24
|
function registerConnectionWaitRoutes(app, { service, strictRateLimitMiddleware }) {
|
|
23
25
|
app.get("/api/sessions/:conversationId/connection-wait", (c) => {
|
|
@@ -16,6 +16,7 @@ import { registerEndpointToolRoutes } from "./endpoint-tools.js";
|
|
|
16
16
|
import { registerRealtimeRoutes } from "./realtime.js";
|
|
17
17
|
import { registerDeviceRoutes } from "./devices.js";
|
|
18
18
|
import { registerLocalAppsRoutes } from "./local-apps.js";
|
|
19
|
+
import { registerChatPreviewRoutes } from "./chat-previews.js";
|
|
19
20
|
import { registerWorkDiscoveryRoutes } from "./work-discovery.js";
|
|
20
21
|
import { registerContextSourceRoutes } from "./context-sources.js";
|
|
21
22
|
import { registerTaskRoutes } from "./tasks.js";
|
|
@@ -34,6 +35,7 @@ function registerCoreAuthenticatedRoutes(authenticated, deps) {
|
|
|
34
35
|
registerProjectsRoutes(authenticated, deps);
|
|
35
36
|
registerProjectSkillRoutes(authenticated, deps);
|
|
36
37
|
registerLocalAppsRoutes(authenticated, deps);
|
|
38
|
+
registerChatPreviewRoutes(authenticated, deps);
|
|
37
39
|
registerWorkDiscoveryRoutes(authenticated, deps);
|
|
38
40
|
registerContextSourceRoutes(authenticated, deps);
|
|
39
41
|
registerTaskRoutes(authenticated, deps);
|
|
@@ -3,6 +3,14 @@ function startsWithAny(path, prefixes) {
|
|
|
3
3
|
return prefixes.some((prefix) => path === prefix || path.startsWith(`${prefix}/`));
|
|
4
4
|
}
|
|
5
5
|
const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
6
|
+
{
|
|
7
|
+
id: "agent-plugins",
|
|
8
|
+
match: (path) => path === "/api/extensions/inspect" || path === "/api/extensions/install" || startsWithAny(path, ["/api/extensions/agent-plugins"]),
|
|
9
|
+
load: async () => {
|
|
10
|
+
const { registerAgentPluginRoutes } = await import("./agent-plugins.js");
|
|
11
|
+
return { register: registerAgentPluginRoutes };
|
|
12
|
+
}
|
|
13
|
+
},
|
|
6
14
|
{
|
|
7
15
|
id: "local-app-capabilities",
|
|
8
16
|
match: (path) => /^\/api\/local-app-capabilities\/[^/]+(?:\/[^/]+\/invocations)?$/.test(path),
|