@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
|
@@ -1,56 +1,71 @@
|
|
|
1
|
+
import { LocalAppSourceHashSchema } from "../../../../packages/gateway-contract/src/local-apps.js";
|
|
2
|
+
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
1
3
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
2
4
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
5
|
+
import { parseLocalAppFixGuidanceInput } from "../../../local-apps/fix-guidance.js";
|
|
3
6
|
import { readLocalAppAcceptanceConfig } from "../../../local-apps/acceptance.js";
|
|
4
7
|
import { createProductDispatcher } from "../../../capabilities/runtime/product.js";
|
|
5
8
|
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
6
9
|
import { capabilityHttpContext, capabilityHttpError } from "../../../capabilities/adapters/http.js";
|
|
7
10
|
import { LOCAL_APP_RUNTIME_BRIDGE_HASH, injectLocalAppRuntimeBridge } from "../../../local-apps/preview-runtime-bridge.js";
|
|
8
11
|
import { relative, resolve } from "node:path";
|
|
9
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
12
|
+
import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
10
13
|
import { randomUUID } from "node:crypto";
|
|
11
14
|
//#region src/gateway/hono/routes/local-apps.ts
|
|
15
|
+
init_src();
|
|
12
16
|
const LOCAL_APP_PREVIEW_CSP = `default-src 'self'; script-src 'self' 'sha256-${LOCAL_APP_RUNTIME_BRIDGE_HASH}'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'none'; frame-ancestors 'self'; frame-src 'none'; base-uri 'none'; object-src 'none'; form-action 'none'`;
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
function servePreviewAsset(c, preview, prefix, cacheControl) {
|
|
18
|
+
const origin = c.req.header("origin");
|
|
19
|
+
const cors = { "Access-Control-Allow-Origin": origin === "null" ? "null" : origin || "*" };
|
|
20
|
+
let assetPath = c.req.path.startsWith(prefix) ? c.req.path.slice(prefix.length) : "";
|
|
21
|
+
try {
|
|
22
|
+
assetPath = decodeURIComponent(assetPath);
|
|
23
|
+
} catch {
|
|
24
|
+
return c.json({ error: "Invalid asset path" }, 400, cors);
|
|
25
|
+
}
|
|
26
|
+
if (!assetPath || assetPath.includes("..")) return c.json({ error: "Invalid asset path" }, 400, cors);
|
|
27
|
+
if (!existsSync(preview.uiRoot)) return c.json({ error: "Not found" }, 404, cors);
|
|
28
|
+
const root = realpathSync(resolve(preview.uiRoot));
|
|
29
|
+
const unresolvedPath = resolve(root, assetPath);
|
|
30
|
+
const fullPath = existsSync(unresolvedPath) ? realpathSync(unresolvedPath) : unresolvedPath;
|
|
31
|
+
const rel = relative(root, fullPath);
|
|
32
|
+
if (rel.startsWith("..") || rel === "") return c.json({ error: "Path traversal denied" }, 403, cors);
|
|
33
|
+
if (!existsSync(fullPath) || !statSync(fullPath).isFile()) return c.json({ error: "Not found" }, 404, cors);
|
|
34
|
+
const mimeType = extensionAssetMimeType(assetPath);
|
|
35
|
+
const content = readFileSync(fullPath);
|
|
36
|
+
let textContent = null;
|
|
37
|
+
if (mimeType.startsWith("text/html")) {
|
|
38
|
+
let acceptance;
|
|
21
39
|
try {
|
|
22
|
-
|
|
40
|
+
acceptance = readLocalAppAcceptanceConfig(preview.uiRoot);
|
|
23
41
|
} catch {
|
|
24
|
-
|
|
42
|
+
acceptance = {
|
|
43
|
+
schemaVersion: 1,
|
|
44
|
+
scenarios: []
|
|
45
|
+
};
|
|
25
46
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return
|
|
48
|
-
"Content-Type": mimeType,
|
|
49
|
-
"Content-Security-Policy": LOCAL_APP_PREVIEW_CSP,
|
|
50
|
-
"Cache-Control": "no-store",
|
|
51
|
-
"X-Content-Type-Options": "nosniff",
|
|
52
|
-
...cors
|
|
53
|
-
} });
|
|
47
|
+
textContent = injectLocalAppRuntimeBridge(content.toString("utf8"), acceptance);
|
|
48
|
+
} else if (mimeType.startsWith("text/")) textContent = content.toString("utf8");
|
|
49
|
+
return new Response(textContent ?? new Uint8Array(content), { headers: {
|
|
50
|
+
"Content-Type": mimeType,
|
|
51
|
+
"Content-Security-Policy": LOCAL_APP_PREVIEW_CSP,
|
|
52
|
+
"Cache-Control": cacheControl,
|
|
53
|
+
"X-Content-Type-Options": "nosniff",
|
|
54
|
+
...cors
|
|
55
|
+
} });
|
|
56
|
+
}
|
|
57
|
+
function registerPublicLocalAppPreviewRoutes(app, service) {
|
|
58
|
+
app.get("/api/local-apps/preview/:token/draft/*", (c) => {
|
|
59
|
+
const preview = service.localApps.resolveDraftPreview(c.req.param("token"));
|
|
60
|
+
if (!preview) return c.json({ error: "Preview not found" }, 404);
|
|
61
|
+
return servePreviewAsset(c, preview, `/api/local-apps/preview/${preview.previewToken}/draft/`, "no-store");
|
|
62
|
+
});
|
|
63
|
+
app.get("/api/local-apps/preview/:token/snapshots/:sourceHash/*", (c) => {
|
|
64
|
+
const sourceHash = LocalAppSourceHashSchema.safeParse(c.req.param("sourceHash"));
|
|
65
|
+
if (!sourceHash.success) return c.json({ error: "Invalid snapshot hash" }, 400);
|
|
66
|
+
const preview = service.localApps.resolveSnapshotPreview(c.req.param("token"), sourceHash.data);
|
|
67
|
+
if (!preview) return c.json({ error: "Preview not found" }, 404);
|
|
68
|
+
return servePreviewAsset(c, preview, `/api/local-apps/preview/${preview.previewToken}/snapshots/${sourceHash.data}/`, "private, max-age=31536000, immutable");
|
|
54
69
|
});
|
|
55
70
|
}
|
|
56
71
|
function registerLocalAppsRoutes(app, deps) {
|
|
@@ -79,6 +94,12 @@ function registerLocalAppsRoutes(app, deps) {
|
|
|
79
94
|
return capabilityHttpError(c, error);
|
|
80
95
|
}
|
|
81
96
|
});
|
|
97
|
+
app.get("/api/local-apps/:id/snapshots/:sourceHash", (c) => {
|
|
98
|
+
const sourceHash = LocalAppSourceHashSchema.safeParse(c.req.param("sourceHash"));
|
|
99
|
+
if (!sourceHash.success) return c.json({ error: "Invalid snapshot hash" }, 400);
|
|
100
|
+
const snapshot = deps.service.localApps.getSnapshot(c.req.param("id"), sourceHash.data);
|
|
101
|
+
return snapshot ? c.json({ snapshot }) : c.json({ error: "Snapshot not found" }, 404);
|
|
102
|
+
});
|
|
82
103
|
app.post("/api/local-apps/:id/validate", async (c) => {
|
|
83
104
|
try {
|
|
84
105
|
return c.json(await capabilities.call("xopc.local_apps.validate", { id: c.req.param("id") }, capabilityHttpContext(c)));
|
|
@@ -86,6 +107,17 @@ function registerLocalAppsRoutes(app, deps) {
|
|
|
86
107
|
return capabilityHttpError(c, error);
|
|
87
108
|
}
|
|
88
109
|
});
|
|
110
|
+
app.post("/api/local-apps/:id/fix-guidance", async (c) => {
|
|
111
|
+
try {
|
|
112
|
+
const body = await c.req.json().catch(() => {
|
|
113
|
+
throw new CapabilityError("INVALID_INPUT", "Invalid JSON body");
|
|
114
|
+
});
|
|
115
|
+
const guidance = deps.service.localApps.getFixGuidance(c.req.param("id"), parseLocalAppFixGuidanceInput(body));
|
|
116
|
+
return c.json({ guidance });
|
|
117
|
+
} catch (error) {
|
|
118
|
+
return capabilityHttpError(c, error);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
89
121
|
app.post("/api/local-apps/:id/acceptance-runs", async (c) => {
|
|
90
122
|
try {
|
|
91
123
|
const body = await c.req.json().catch(() => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { isManagedConnectorServer } from "../../../connectors/materialize.js";
|
|
2
|
+
import { AgentPluginStore } from "../../../extensions/agent-plugins/store.js";
|
|
2
3
|
import { canonicalizeConfiguredMcpServer, normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
4
|
+
import { savePluginAuthBinding } from "../../../extensions/agent-plugins/auth.js";
|
|
3
5
|
import { loadMergedBundleMcpConfig } from "../../../agent/mcp/bundle-mcp-config.js";
|
|
4
6
|
import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
|
|
5
7
|
import { getMcpOAuthManager } from "../../../agent/mcp/oauth/mcp-oauth-manager.js";
|
|
@@ -20,12 +22,12 @@ function registerMcpRoutes(authenticated, deps) {
|
|
|
20
22
|
cfg
|
|
21
23
|
});
|
|
22
24
|
const configured = normalizeConfiguredMcpServers(cfg.mcp?.servers);
|
|
23
|
-
const
|
|
24
|
-
const servers = await Promise.all(Object.entries(configured).map(async ([id, server]) => ({
|
|
25
|
+
const servers = await Promise.all(Object.entries(merged.config.mcpServers).map(async ([id, server]) => ({
|
|
25
26
|
id,
|
|
27
|
+
plugin: server.xopcPlugin,
|
|
26
28
|
managed: isManagedConnectorServer(server),
|
|
27
29
|
connectorId: isManagedConnectorServer(server) ? server.xopcConnector.connectorId : void 0,
|
|
28
|
-
oauth: await
|
|
30
|
+
oauth: await getMcpOAuthManager(server).status(id, server)
|
|
29
31
|
})));
|
|
30
32
|
return c.json({
|
|
31
33
|
ok: true,
|
|
@@ -76,9 +78,30 @@ function registerMcpRoutes(authenticated, deps) {
|
|
|
76
78
|
}, 404);
|
|
77
79
|
return c.json({
|
|
78
80
|
ok: true,
|
|
79
|
-
payload: await getMcpOAuthManager().status(id, server)
|
|
81
|
+
payload: await getMcpOAuthManager(server).status(id, server)
|
|
80
82
|
});
|
|
81
83
|
});
|
|
84
|
+
authenticated.post("/api/mcp/servers/:id/oauth/callback", deps.strictRateLimitMiddleware, async (c) => {
|
|
85
|
+
const id = c.req.param("id");
|
|
86
|
+
const server = resolveServer(id);
|
|
87
|
+
if (!server) return c.json({
|
|
88
|
+
ok: false,
|
|
89
|
+
error: "Unknown MCP server"
|
|
90
|
+
}, 404);
|
|
91
|
+
try {
|
|
92
|
+
const body = await c.req.json();
|
|
93
|
+
if (typeof body.callbackUrl !== "string" || body.callbackUrl.length > 16384) throw new Error("Expected callbackUrl");
|
|
94
|
+
return c.json({
|
|
95
|
+
ok: true,
|
|
96
|
+
payload: await getMcpOAuthManager(server).submitCallback(id, server, body.callbackUrl)
|
|
97
|
+
});
|
|
98
|
+
} catch {
|
|
99
|
+
return c.json({
|
|
100
|
+
ok: false,
|
|
101
|
+
error: "OAuth callback rejected; verify the URL and active authorization session"
|
|
102
|
+
}, 400);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
82
105
|
authenticated.post("/api/mcp/servers/:id/oauth/start", deps.strictRateLimitMiddleware, async (c) => {
|
|
83
106
|
const id = c.req.param("id");
|
|
84
107
|
const server = resolveServer(id);
|
|
@@ -87,9 +110,12 @@ function registerMcpRoutes(authenticated, deps) {
|
|
|
87
110
|
error: `Unknown MCP server: ${id}`
|
|
88
111
|
}, 404);
|
|
89
112
|
try {
|
|
90
|
-
const
|
|
113
|
+
const origin = server.xopcPlugin;
|
|
114
|
+
if (origin) await savePluginAuthBinding(new AgentPluginStore(), origin.id, origin.serverName, { mode: "oauth" });
|
|
115
|
+
const oauthServer = origin ? resolveServer(id) : server;
|
|
116
|
+
const payload = await getMcpOAuthManager(oauthServer).start({
|
|
91
117
|
serverId: id,
|
|
92
|
-
rawServer:
|
|
118
|
+
rawServer: oauthServer,
|
|
93
119
|
cfg: deps.service.currentConfig
|
|
94
120
|
});
|
|
95
121
|
return c.json({
|
|
@@ -111,7 +137,7 @@ function registerMcpRoutes(authenticated, deps) {
|
|
|
111
137
|
error: `Unknown MCP server: ${id}`
|
|
112
138
|
}, 404);
|
|
113
139
|
try {
|
|
114
|
-
const payload = await getMcpOAuthManager().disconnect(id, server);
|
|
140
|
+
const payload = await getMcpOAuthManager(server).disconnect(id, server);
|
|
115
141
|
return c.json({
|
|
116
142
|
ok: true,
|
|
117
143
|
payload
|
|
@@ -171,20 +197,25 @@ function registerMcpRoutes(authenticated, deps) {
|
|
|
171
197
|
const workspaceDir = getWorkspacePath(cfg) || "./workspace";
|
|
172
198
|
const body = await c.req.json().catch(() => ({}));
|
|
173
199
|
const inlineServer = body && typeof body === "object" && !Array.isArray(body) && body.server && typeof body.server === "object" ? body.server : void 0;
|
|
174
|
-
|
|
200
|
+
if (inlineServer && id.startsWith("plugin/")) return c.json({
|
|
201
|
+
ok: false,
|
|
202
|
+
error: "Plugin servers must use their installed configuration"
|
|
203
|
+
}, 400);
|
|
175
204
|
const mergedServers = loadMergedBundleMcpConfig({
|
|
176
205
|
workspaceDir,
|
|
177
206
|
cfg
|
|
178
207
|
}).config.mcpServers;
|
|
179
|
-
const knownServer = inlineServer ??
|
|
208
|
+
const knownServer = inlineServer ?? mergedServers[id];
|
|
180
209
|
if (!knownServer) return c.json({
|
|
181
210
|
ok: false,
|
|
182
211
|
error: `Unknown MCP server: ${id}`
|
|
183
212
|
}, 404);
|
|
184
213
|
try {
|
|
185
|
-
const oauth = await getMcpOAuthManager().status(id, knownServer);
|
|
186
|
-
if (oauth.configured && oauth.status !== "connected") return c.json({
|
|
214
|
+
const oauth = await getMcpOAuthManager(knownServer).status(id, knownServer);
|
|
215
|
+
if (oauth.configured && knownServer.xopcAutoAuth !== true && oauth.status !== "connected") return c.json({
|
|
187
216
|
ok: false,
|
|
217
|
+
code: "MCP_AUTHORIZATION_REQUIRED",
|
|
218
|
+
serverId: id,
|
|
188
219
|
error: oauth.session?.error ?? "MCP server authorization is required"
|
|
189
220
|
}, 409);
|
|
190
221
|
const capabilities = await listBundleMcpServerCapabilitiesForGateway({
|
|
@@ -198,6 +229,12 @@ function registerMcpRoutes(authenticated, deps) {
|
|
|
198
229
|
} : cfg,
|
|
199
230
|
serverId: id
|
|
200
231
|
});
|
|
232
|
+
if (capabilities.error) return c.json({
|
|
233
|
+
ok: false,
|
|
234
|
+
code: capabilities.error.code,
|
|
235
|
+
serverId: id,
|
|
236
|
+
error: capabilities.error.message
|
|
237
|
+
}, capabilities.error.code === "MCP_AUTHORIZATION_REQUIRED" ? 409 : 502);
|
|
201
238
|
return c.json({
|
|
202
239
|
ok: true,
|
|
203
240
|
payload: {
|
|
@@ -212,16 +249,6 @@ function registerMcpRoutes(authenticated, deps) {
|
|
|
212
249
|
}, 500);
|
|
213
250
|
}
|
|
214
251
|
});
|
|
215
|
-
authenticated.post("/api/mcp/approvals/respond", async (c) => {
|
|
216
|
-
const body = await c.req.json().catch(() => ({}));
|
|
217
|
-
return c.json({
|
|
218
|
-
ok: true,
|
|
219
|
-
payload: {
|
|
220
|
-
acknowledged: true,
|
|
221
|
-
body
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
252
|
}
|
|
226
253
|
//#endregion
|
|
227
254
|
export { registerMcpRoutes };
|
|
@@ -53,6 +53,7 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
|
|
|
53
53
|
};
|
|
54
54
|
attachments?: import("hono/dist/types/utils/types.js").JSONValue[];
|
|
55
55
|
contextRefs?: {
|
|
56
|
+
refId?: string;
|
|
56
57
|
kind: import("../../../agent/source-context/types.js").AgentSourceContext["kind"];
|
|
57
58
|
sourceId: string;
|
|
58
59
|
version: string;
|
|
@@ -65,6 +66,7 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
|
|
|
65
66
|
fileKind?: "file" | "directory";
|
|
66
67
|
}[];
|
|
67
68
|
contextSnapshots?: {
|
|
69
|
+
refId?: string;
|
|
68
70
|
kind: import("../../../agent/source-context/types.js").SessionSourceBinding["kind"] | "task" | "file" | "session" | "mcp_resource" | "browser_tab" | "browser_page" | "app_context";
|
|
69
71
|
sourceId: string;
|
|
70
72
|
version: string;
|
|
@@ -189,6 +191,7 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
|
|
|
189
191
|
};
|
|
190
192
|
attachments?: import("hono/dist/types/utils/types.js").JSONValue[];
|
|
191
193
|
contextRefs?: {
|
|
194
|
+
refId?: string;
|
|
192
195
|
kind: import("../../../agent/source-context/types.js").AgentSourceContext["kind"];
|
|
193
196
|
sourceId: string;
|
|
194
197
|
version: string;
|
|
@@ -201,6 +204,7 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
|
|
|
201
204
|
fileKind?: "file" | "directory";
|
|
202
205
|
}[];
|
|
203
206
|
contextSnapshots?: {
|
|
207
|
+
refId?: string;
|
|
204
208
|
kind: import("../../../agent/source-context/types.js").SessionSourceBinding["kind"] | "task" | "file" | "session" | "mcp_resource" | "browser_tab" | "browser_page" | "app_context";
|
|
205
209
|
sourceId: string;
|
|
206
210
|
version: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
+
import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packages/gateway-contract/src/user-turn-document.js";
|
|
3
4
|
import { browserPageContextsInputSchema } from "../../../../packages/gateway-contract/src/browser-page-context.js";
|
|
4
5
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
5
6
|
import { endpointTurnClaimSchema, init_src as init_src$1 } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
@@ -24,6 +25,13 @@ init_providers();
|
|
|
24
25
|
init_logger();
|
|
25
26
|
const MAX_TURN_CONTEXTS = 5;
|
|
26
27
|
const log = createLogger("Gateway:SessionInput");
|
|
28
|
+
function contextDocumentIsValid(content, refs) {
|
|
29
|
+
if (!refs) return false;
|
|
30
|
+
const document = parseUserTurnDocument(content);
|
|
31
|
+
if (!document) return true;
|
|
32
|
+
const available = new Set(refs.flatMap((ref) => ref.refId ? [ref.refId] : []));
|
|
33
|
+
return userTurnDocumentRefIds(document).every((refId) => available.has(refId));
|
|
34
|
+
}
|
|
27
35
|
async function submitSessionInput(c, deps, conversationId, options) {
|
|
28
36
|
const body = await c.req.json().catch(() => null);
|
|
29
37
|
if (!body || !conversationId) return c.json({
|
|
@@ -51,6 +59,13 @@ async function submitSessionInput(c, deps, conversationId, options) {
|
|
|
51
59
|
}
|
|
52
60
|
}, 400);
|
|
53
61
|
const content = typeof body.content === "string" ? body.content : "";
|
|
62
|
+
if (!contextDocumentIsValid(content, contextRefs)) return c.json({
|
|
63
|
+
ok: false,
|
|
64
|
+
error: {
|
|
65
|
+
code: "BAD_REQUEST",
|
|
66
|
+
message: "Input contains an unknown context reference"
|
|
67
|
+
}
|
|
68
|
+
}, 400);
|
|
54
69
|
if (options?.taskConversation && isTaskDestructiveCommand(content)) return c.json({
|
|
55
70
|
ok: false,
|
|
56
71
|
error: {
|
|
@@ -239,6 +254,13 @@ async function replaceLatestSessionTurn(c, deps, conversationId, targetTurnId) {
|
|
|
239
254
|
}
|
|
240
255
|
}, 400);
|
|
241
256
|
const content = typeof body.content === "string" ? body.content : "";
|
|
257
|
+
if (!contextDocumentIsValid(content, contextRefs)) return c.json({
|
|
258
|
+
ok: false,
|
|
259
|
+
error: {
|
|
260
|
+
code: "BAD_REQUEST",
|
|
261
|
+
message: "Input contains an unknown context reference"
|
|
262
|
+
}
|
|
263
|
+
}, 400);
|
|
242
264
|
const contentError = validateWebchatContent(content);
|
|
243
265
|
if (contentError) return c.json({
|
|
244
266
|
ok: false,
|
|
@@ -157,6 +157,17 @@ function registerSideChatRoutes(authenticated, deps) {
|
|
|
157
157
|
return respondSideChatError(c, error);
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
|
+
authenticated.post("/api/side-chats/:sideChatId/promote", deps.chatRateLimitMiddleware, async (c) => {
|
|
161
|
+
try {
|
|
162
|
+
const result = await service.sideChatPromotions.promote(c.req.param("sideChatId"), readClientInstanceId(c));
|
|
163
|
+
return c.json({
|
|
164
|
+
ok: true,
|
|
165
|
+
...result
|
|
166
|
+
}, result.created ? 201 : 200);
|
|
167
|
+
} catch (error) {
|
|
168
|
+
return respondSideChatError(c, error);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
160
171
|
authenticated.delete("/api/side-chats/:sideChatId", async (c) => {
|
|
161
172
|
try {
|
|
162
173
|
return await service.sideChatRuns.dispose(c.req.param("sideChatId"), readClientInstanceId(c)) ? c.json({ ok: true }) : c.json({
|
|
@@ -87,7 +87,13 @@ var GatewayAgentRunner = class {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
if (unique.size > MAX_TURN_CONTEXTS) throw new Error(`A message can reference at most ${MAX_TURN_CONTEXTS} sources`);
|
|
90
|
-
const contexts = await Promise.all([...unique.values()].map((ref) =>
|
|
90
|
+
const contexts = await Promise.all([...unique.values()].map(async (ref) => {
|
|
91
|
+
const context = await opts.resolveTurnContext(ref, conversationId);
|
|
92
|
+
return context && ref.refId ? {
|
|
93
|
+
...context,
|
|
94
|
+
refId: ref.refId
|
|
95
|
+
} : context;
|
|
96
|
+
}));
|
|
91
97
|
if (contexts.some((context) => context === null)) throw new Error("A referenced source is unavailable or has changed; select it again");
|
|
92
98
|
return fitSourceContextsToBudget(contexts.filter((context) => context !== null));
|
|
93
99
|
},
|
|
@@ -52,6 +52,7 @@ export interface SkillSourceInstallResultPayload extends SkillInstallResultPaylo
|
|
|
52
52
|
contentHash: string;
|
|
53
53
|
}
|
|
54
54
|
export interface ExtensionMarketplacePackageDetailPayload extends MarketplacePackageDetail {
|
|
55
|
+
format?: 'native-extension' | 'agent-plugin';
|
|
55
56
|
installability: {
|
|
56
57
|
available: boolean;
|
|
57
58
|
reason?: string;
|
|
@@ -2,12 +2,14 @@ import { resolveStateDir } from "../../config/paths-state.js";
|
|
|
2
2
|
import { createLogger } from "../../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../../utils/logger.js";
|
|
4
4
|
import { init_paths, resolveExtensionsDir } from "../../config/paths.js";
|
|
5
|
+
import { getExtensionLockfileManager } from "../../extensions/lockfile.js";
|
|
6
|
+
import { AgentPluginStore } from "../../extensions/agent-plugins/store.js";
|
|
5
7
|
import { createSkillConfigManager } from "../../agent/skills/config.js";
|
|
6
8
|
import { resolveWorkspaceSkillsDir, resolveWorkspaceSkillsLockPath } from "../../agent/skills/workspace-skills-dir.js";
|
|
7
9
|
import { removeSkillsLockEntry } from "../../agent/skills/hub-lock.js";
|
|
8
10
|
import { deleteManagedSkill, installSkillFromZip, listManagedSkillDirs } from "../../agent/skills/managed-store.js";
|
|
9
11
|
import { normalizeSkillInstallTarget } from "../../agent/skills/install-target.js";
|
|
10
|
-
import {
|
|
12
|
+
import { isAgentPluginArchive, withAgentPluginArchive } from "../../extensions/agent-plugins/sources.js";
|
|
11
13
|
import { existsSync, rmSync } from "node:fs";
|
|
12
14
|
//#region src/gateway/service/marketplace-service.ts
|
|
13
15
|
/**
|
|
@@ -206,6 +208,18 @@ var GatewayMarketplaceService = class {
|
|
|
206
208
|
const resolved = await resolveExtensionZipDownloadUrl(base, packageName.trim());
|
|
207
209
|
const buffer = await downloadExtensionStoreZipBuffer(base, resolved.downloadUrl);
|
|
208
210
|
verifyStoreArtifactSha256(buffer, resolved.sha256);
|
|
211
|
+
if (isAgentPluginArchive(buffer)) {
|
|
212
|
+
const plan = withAgentPluginArchive(buffer, (path) => new AgentPluginStore().inspect(path));
|
|
213
|
+
return {
|
|
214
|
+
...detail,
|
|
215
|
+
format: "agent-plugin",
|
|
216
|
+
manifest: plan.manifest,
|
|
217
|
+
installability: {
|
|
218
|
+
available: true,
|
|
219
|
+
sha256: resolved.sha256
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
209
223
|
const { peekExtensionManifestFromStoreZip, peekExtensionPackageJsonFromStoreZip } = await import("../../extensions/install.js");
|
|
210
224
|
const manifest = peekExtensionManifestFromStoreZip(buffer);
|
|
211
225
|
const packageJson = peekExtensionPackageJsonFromStoreZip(buffer);
|
|
@@ -24,11 +24,11 @@ function sameAppContext(input, existing) {
|
|
|
24
24
|
return isDeepStrictEqual(identity(input.sourceContexts), identity(existing.contextSnapshots));
|
|
25
25
|
}
|
|
26
26
|
function contextRefsMatchFrozenSnapshot(requested, frozen) {
|
|
27
|
-
const editable = frozen?.filter((ref) => ref.kind === "note" || ref.kind === "task") ?? [];
|
|
27
|
+
const editable = frozen?.filter((ref) => ref.kind === "note" || ref.kind === "task" || ref.kind === "file" || ref.kind === "session" || ref.kind === "browser_tab" || ref.kind === "mcp_resource") ?? [];
|
|
28
28
|
if (requested.length !== editable.length) return false;
|
|
29
29
|
return requested.every((ref, index) => {
|
|
30
30
|
const snapshot = editable[index];
|
|
31
|
-
return snapshot?.kind === ref.kind && snapshot.sourceId === ref.sourceId && ref.expectedVersion === snapshot.version;
|
|
31
|
+
return snapshot?.kind === ref.kind && snapshot.sourceId === ref.sourceId && snapshot.refId === ref.refId && ref.expectedVersion === snapshot.version;
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
var SessionInputCoordinator = class {
|
|
@@ -311,7 +311,7 @@ var SessionInputCoordinator = class {
|
|
|
311
311
|
const existing = getSessionInputById(conversationId, id);
|
|
312
312
|
if (!contextRefsMatchFrozenSnapshot(body.contextRefs, existing?.contextRefs)) try {
|
|
313
313
|
const resolved = await this.deps.prepareContexts(conversationId, body.contextRefs) ?? [];
|
|
314
|
-
sourceContexts = fitSourceContextsToBudget([...existing?.contextSnapshots?.filter((source) => source.kind
|
|
314
|
+
sourceContexts = fitSourceContextsToBudget([...existing?.contextSnapshots?.filter((source) => source.kind === "app_context" || source.kind === "browser_page") ?? [], ...resolved]);
|
|
315
315
|
} catch (err) {
|
|
316
316
|
log.warn({
|
|
317
317
|
err,
|
|
@@ -8,12 +8,13 @@ import { NotesService } from '../notes/index.js';
|
|
|
8
8
|
import { WorkflowRunService } from '../workflows/service/workflow-run-service.js';
|
|
9
9
|
import { ExtensionLoader } from '../extensions/index.js';
|
|
10
10
|
import { SessionIndex } from '../session/index.js';
|
|
11
|
-
import { EphemeralSideChatManager, SideChatRunService } from './side-chat/index.js';
|
|
11
|
+
import { EphemeralSideChatManager, SideChatPromotionService, SideChatRunService } from './side-chat/index.js';
|
|
12
12
|
import type { Config } from '../config/schema.js';
|
|
13
13
|
import { type ResolvedGatewayAuth } from './auth.js';
|
|
14
14
|
import { ModelCatalogSyncService } from '../providers/model-catalog-sync-service.js';
|
|
15
15
|
import { ProjectService } from '../projects/index.js';
|
|
16
16
|
import { LocalAppService } from '../local-apps/index.js';
|
|
17
|
+
import { ChatPreviewService } from '../chat-previews/index.js';
|
|
17
18
|
import { TaskConversationRepository } from '../tasks/task-conversation-repository.js';
|
|
18
19
|
import { type BrowserAutomationService } from '../browser/automations/index.js';
|
|
19
20
|
import { GatewaySessionsApi } from './service/sessions-api.js';
|
|
@@ -86,6 +87,7 @@ export declare class GatewayService {
|
|
|
86
87
|
/** Process-local, non-persistent side conversations forked from durable sessions. */
|
|
87
88
|
readonly sideChats: EphemeralSideChatManager;
|
|
88
89
|
readonly sideChatRuns: SideChatRunService;
|
|
90
|
+
readonly sideChatPromotions: SideChatPromotionService;
|
|
89
91
|
/**
|
|
90
92
|
* Session CRUD / search / compaction / tag-archive-pin / stats — the gateway
|
|
91
93
|
* REST surface for sessions. Routes should depend on this narrow service
|
|
@@ -107,6 +109,8 @@ export declare class GatewayService {
|
|
|
107
109
|
readonly discussionSealer: DiscussionSealer;
|
|
108
110
|
/** Local user-created apps, their coder projects, previews, and installs. */
|
|
109
111
|
readonly localApps: LocalAppService;
|
|
112
|
+
/** Immutable, conversation-scoped UI previews that do not create projects. */
|
|
113
|
+
readonly chatPreviews: ChatPreviewService;
|
|
110
114
|
get sceneAccess(): SceneAccess | undefined;
|
|
111
115
|
constructor(serviceConfig?: GatewayServiceConfig);
|
|
112
116
|
/** Lazy AgentService — constructed on first use or during `start()`. */
|
|
@@ -64,6 +64,8 @@ import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
|
64
64
|
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
65
65
|
import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
|
|
66
66
|
import { ChannelManager } from "../channels/manager.js";
|
|
67
|
+
import { ChatPreviewService } from "../chat-previews/service.js";
|
|
68
|
+
import "../chat-previews/index.js";
|
|
67
69
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
68
70
|
import "../config/index.js";
|
|
69
71
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
@@ -100,6 +102,7 @@ import { WorkflowRunService } from "../workflows/service/workflow-run-service.js
|
|
|
100
102
|
import { WorkflowSessionBridge } from "../workflows/service/workflow-session-bridge.js";
|
|
101
103
|
import { EphemeralSideChatManager } from "./side-chat/manager.js";
|
|
102
104
|
import { SideChatRunService } from "./side-chat/run-service.js";
|
|
105
|
+
import { SideChatPromotionService } from "./side-chat/promotion-service.js";
|
|
103
106
|
import "./side-chat/index.js";
|
|
104
107
|
import { wireTunnelEventsToGateway } from "../tunnel/gateway-lifecycle.js";
|
|
105
108
|
import { getExposureManager } from "../remote-access/exposure-manager.js";
|
|
@@ -301,6 +304,7 @@ var GatewayService = class {
|
|
|
301
304
|
/** Process-local, non-persistent side conversations forked from durable sessions. */
|
|
302
305
|
sideChats;
|
|
303
306
|
sideChatRuns;
|
|
307
|
+
sideChatPromotions;
|
|
304
308
|
/**
|
|
305
309
|
* Session CRUD / search / compaction / tag-archive-pin / stats — the gateway
|
|
306
310
|
* REST surface for sessions. Routes should depend on this narrow service
|
|
@@ -329,6 +333,8 @@ var GatewayService = class {
|
|
|
329
333
|
discussionSealer;
|
|
330
334
|
/** Local user-created apps, their coder projects, previews, and installs. */
|
|
331
335
|
localApps;
|
|
336
|
+
/** Immutable, conversation-scoped UI previews that do not create projects. */
|
|
337
|
+
chatPreviews;
|
|
332
338
|
get sceneAccess() {
|
|
333
339
|
return this.sceneHost ? {
|
|
334
340
|
services: this.sceneHost.http,
|
|
@@ -467,6 +473,7 @@ var GatewayService = class {
|
|
|
467
473
|
getExtensionLoader: () => this.extensionLoader,
|
|
468
474
|
emit: (type, payload) => this.emit(type, payload)
|
|
469
475
|
});
|
|
476
|
+
this.chatPreviews = new ChatPreviewService({ localApps: this.localApps });
|
|
470
477
|
this.agentRunner = new GatewayAgentRunner({
|
|
471
478
|
validateConnectionResume: async (input) => {
|
|
472
479
|
for (const source of input.contextSnapshots ?? []) if (source.kind === "app_context") await checkAppContextAccess(source, this.appContextDispatcher(), this.auth);
|
|
@@ -529,6 +536,7 @@ var GatewayService = class {
|
|
|
529
536
|
let sideChatRuns;
|
|
530
537
|
this.sideChats = new EphemeralSideChatManager({
|
|
531
538
|
getParentMetadata: (conversationId) => this.sessionIndex.getSessionMetadata(conversationId),
|
|
539
|
+
getParentConfig: async (conversationId) => getSessionConfig(conversationId),
|
|
532
540
|
loadParentMessages: (conversationId) => this.sessionIndex.getStore().load(conversationId),
|
|
533
541
|
getDefaultModelRef: (conversationId) => this.ensureAgentService().getModelForSession(conversationId),
|
|
534
542
|
getDefaultThinkingLevel: (conversationId) => this.ensureAgentService().getThinkingLevelForSession(conversationId),
|
|
@@ -550,6 +558,11 @@ var GatewayService = class {
|
|
|
550
558
|
publishRealtime: (topic, event, data) => this.realtime.broker.publish(topic, event, data),
|
|
551
559
|
completeRealtimeTopic: (topic) => this.realtime.completeTopic(topic)
|
|
552
560
|
});
|
|
561
|
+
this.sideChatPromotions = new SideChatPromotionService({
|
|
562
|
+
manager: this.sideChats,
|
|
563
|
+
sessionIndex: this.sessionIndex,
|
|
564
|
+
getAgentService: () => this.ensureAgentService()
|
|
565
|
+
});
|
|
553
566
|
this.sessions = new GatewaySessionsApi({
|
|
554
567
|
sessionIndex: this.sessionIndex,
|
|
555
568
|
getAgentService: () => this.ensureAgentService(),
|
|
@@ -627,6 +640,7 @@ var GatewayService = class {
|
|
|
627
640
|
getProjectService: () => this.projects,
|
|
628
641
|
getWorkDiscovery: () => this._workDiscovery ?? void 0,
|
|
629
642
|
getLocalAppService: () => this.localApps,
|
|
643
|
+
getChatPreviewService: () => this.chatPreviews,
|
|
630
644
|
dispatchTaskEvents: () => this.dispatchTaskEvents(),
|
|
631
645
|
dispatchTaskRuns: () => this.dispatchTaskRuns(),
|
|
632
646
|
getWorkflowRunService: () => this.createWorkflowRunService(),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { EphemeralSideChatManager, SideChatError, parseThinkingLevel } from './manager.js';
|
|
2
|
-
export type { EphemeralSideChatManagerOptions } from './manager.js';
|
|
2
|
+
export type { EphemeralSideChatManagerOptions, SideChatPromotionSnapshot } from './manager.js';
|
|
3
3
|
export { validateSideChatSelections } from './context-snapshot.js';
|
|
4
4
|
export { SideChatRunService } from './run-service.js';
|
|
5
|
+
export { SideChatPromotionService } from './promotion-service.js';
|
|
6
|
+
export type { SideChatPromotionResult, SideChatPromotionServiceOptions } from './promotion-service.js';
|
|
5
7
|
export type { CreateSideChatInput, SideChatConfig, SideChatContextSnapshot, SideChatSelection, SideChatStatus, SideChatView, } from './types.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { validateSideChatSelections } from "./context-snapshot.js";
|
|
2
2
|
import { EphemeralSideChatManager, SideChatError, parseThinkingLevel } from "./manager.js";
|
|
3
3
|
import { SideChatRunService } from "./run-service.js";
|
|
4
|
-
|
|
4
|
+
import { SideChatPromotionService } from "./promotion-service.js";
|
|
5
|
+
export { EphemeralSideChatManager, SideChatError, SideChatPromotionService, SideChatRunService, parseThinkingLevel, validateSideChatSelections };
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import type { AgentMessage, ThinkingLevel } from '@earendil-works/pi-agent-core';
|
|
2
2
|
import { InMemoryTranscriptRuntime } from '../../agent/embedded/transcript-runtime.js';
|
|
3
|
+
import type { SessionAgentConfig } from '../../session/config-types.js';
|
|
4
|
+
import type { TranscriptStoredRow } from '../../session/session-context-for-llm.js';
|
|
3
5
|
import type { SessionMetadata } from '../../session/types.js';
|
|
4
6
|
import type { CreateSideChatInput, SideChatConfig, SideChatStatus, SideChatView } from './types.js';
|
|
7
|
+
export interface SideChatPromotionSnapshot {
|
|
8
|
+
id: string;
|
|
9
|
+
parentMetadata: SessionMetadata;
|
|
10
|
+
parentConfig: SessionAgentConfig | null;
|
|
11
|
+
context: SideChatView['context'];
|
|
12
|
+
config: SideChatConfig;
|
|
13
|
+
contextMessages: AgentMessage[];
|
|
14
|
+
conversationRows: TranscriptStoredRow[];
|
|
15
|
+
}
|
|
5
16
|
export declare class SideChatError extends Error {
|
|
6
17
|
readonly code: 'INVALID_REQUEST' | 'NOT_FOUND' | 'PARENT_NOT_FOUND' | 'LIMIT_REACHED' | 'CAPACITY_REACHED' | 'CONFLICT' | 'EXPIRED';
|
|
7
18
|
readonly reason?: 'idle' | 'waiting';
|
|
@@ -9,6 +20,7 @@ export declare class SideChatError extends Error {
|
|
|
9
20
|
}
|
|
10
21
|
export interface EphemeralSideChatManagerOptions {
|
|
11
22
|
getParentMetadata: (conversationId: string) => Promise<SessionMetadata | null>;
|
|
23
|
+
getParentConfig?: (conversationId: string) => Promise<SessionAgentConfig | null>;
|
|
12
24
|
loadParentMessages: (conversationId: string) => Promise<AgentMessage[]>;
|
|
13
25
|
getDefaultModelRef: (conversationId: string) => string;
|
|
14
26
|
getDefaultThinkingLevel?: (conversationId: string) => ThinkingLevel;
|
|
@@ -39,12 +51,16 @@ export declare class EphemeralSideChatManager {
|
|
|
39
51
|
get(id: string, clientInstanceId: string): SideChatView;
|
|
40
52
|
getRuntime(id: string, clientInstanceId: string): InMemoryTranscriptRuntime;
|
|
41
53
|
getMessages(id: string, clientInstanceId: string): AgentMessage[];
|
|
54
|
+
beginPromotion(id: string, clientInstanceId: string): SideChatPromotionSnapshot;
|
|
55
|
+
cancelPromotion(id: string, clientInstanceId: string): void;
|
|
42
56
|
updateConfig(id: string, clientInstanceId: string, patch: Partial<SideChatConfig>): SideChatView;
|
|
43
57
|
heartbeat(id: string, clientInstanceId: string): SideChatView;
|
|
44
58
|
extend(id: string, clientInstanceId: string): SideChatView;
|
|
45
59
|
setStatus(id: string, clientInstanceId: string, status: SideChatStatus, runId?: string): SideChatView;
|
|
46
60
|
waitForInput(id: string, clientInstanceId: string, clarification: NonNullable<SideChatView['clarification']>, status?: 'waiting-input' | 'waiting-approval'): void;
|
|
47
61
|
dispose(id: string, clientInstanceId: string): Promise<boolean>;
|
|
62
|
+
disposePromoted(id: string, clientInstanceId: string): Promise<boolean>;
|
|
63
|
+
private disposeEntry;
|
|
48
64
|
disposeClient(clientInstanceId: string): Promise<number>;
|
|
49
65
|
sweepExpired(at?: number): Promise<number>;
|
|
50
66
|
disposeAll(): Promise<void>;
|