@xopcai/xopc 0.0.320 → 0.0.323

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/dist/browser-ext/dist/assets/{auth-DKo-NMUY.js → auth-DocRzRlS.js} +95 -21
  2. package/dist/browser-ext/dist/background.js +1 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +18 -2
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BXLU0HJa.js → agent-avatar-dicebear-DFzmThVi.js} +1 -1
  8. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CAFHadiy.js +1 -0
  9. package/dist/gateway/static/root/assets/agent-plugin-dialog-DYFYiuig.js +1 -0
  10. package/dist/gateway/static/root/assets/{agents-hrbGiOHn.js → agents-BqIlB5Co.js} +1 -1
  11. package/dist/gateway/static/root/assets/{app-link-nL8iPwEr.js → app-link-C6gA5Nck.js} +1 -1
  12. package/dist/gateway/static/root/assets/{app-management-settings-panel-C0jEvonH.js → app-management-settings-panel-BgvMRGWe.js} +1 -1
  13. package/dist/gateway/static/root/assets/{appearance-settings-ByVRv2Oe.js → appearance-settings-CliHU03A.js} +1 -1
  14. package/dist/gateway/static/root/assets/apps-page-Drt3Foi9.js +1 -0
  15. package/dist/gateway/static/root/assets/{archive-plugin-CMITc1PQ.js → archive-plugin-DnuPpm0u.js} +1 -1
  16. package/dist/gateway/static/root/assets/{attachment-load-B5Z1PKHm.js → attachment-load-BiwaK0ie.js} +1 -1
  17. package/dist/gateway/static/root/assets/{automations-page-BOcXqVar.js → automations-page-CJSISGQH.js} +1 -1
  18. package/dist/gateway/static/root/assets/automations-workspace-B-Eduqwz.js +7 -0
  19. package/dist/gateway/static/root/assets/{binary-plugins-BkRb9adx.js → binary-plugins-KDjduQZO.js} +1 -1
  20. package/dist/gateway/static/root/assets/{block-editor-DsmDlkC2.js → block-editor-bclvgove.js} +3 -3
  21. package/dist/gateway/static/root/assets/{browser-automation-inputs-BgBH3eFk.js → browser-automation-inputs-CfQ2T9t6.js} +1 -1
  22. package/dist/gateway/static/root/assets/{browser-automations-page-e3KpurLo.js → browser-automations-page-Cxq38Nnp.js} +2 -2
  23. package/dist/gateway/static/root/assets/browser-settings-page-Dwgir6mu.js +3 -0
  24. package/dist/gateway/static/root/assets/capabilities-settings-panel-H5L5vynP.js +8 -0
  25. package/dist/gateway/static/root/assets/capabilities-uFKh3Hd0.js +1 -0
  26. package/dist/gateway/static/root/assets/channels-settings-RFBRYe5S.js +1 -0
  27. package/dist/gateway/static/root/assets/{chat-terminal-dock-DUdkU1C5.js → chat-terminal-dock-DKQC62nQ.js} +2 -2
  28. package/dist/gateway/static/root/assets/{computer-settings-page-C6WR9Syy.js → computer-settings-page-D1whpIqL.js} +1 -1
  29. package/dist/gateway/static/root/assets/{connector-service-page-SVKcySx0.js → connector-service-page-BAuYTgf5.js} +1 -1
  30. package/dist/gateway/static/root/assets/connectors-page-Px-v3Q6Q.js +2 -0
  31. package/dist/gateway/static/root/assets/{date-picker-DBD5yedi.js → date-picker-CfCo3lqh.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dependency-picker-HE41Co5W.js → dependency-picker-DOuVO2M1.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-DH9EU9O3.js → desktop-pet-D9tu6Bhu.js} +1 -1
  34. package/dist/gateway/static/root/assets/{desktop-pet-settings-Br6Z1Vau.js → desktop-pet-settings-CQPXub2f.js} +1 -1
  35. package/dist/gateway/static/root/assets/device-pairing-wizard-DxkOYSut.js +1 -0
  36. package/dist/gateway/static/root/assets/{extension-debug-page-CFjVNb1m.js → extension-debug-page-CtWClPz-.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-page-BQ3ldBhh.js → extension-page-BHh9HLCz.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-settings-page-CaXnWbRI.js → extension-settings-page-BdT3v5Uh.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-config-swr-DgFmBSH9.js → gateway-config-swr-1eqyz9vZ.js} +1 -1
  40. package/dist/gateway/static/root/assets/gateway-settings-CZas_Ekx.js +1 -0
  41. package/dist/gateway/static/root/assets/{gateway-startup-retry-C7h3xef0.js → gateway-startup-retry-C4rsW6vJ.js} +1 -1
  42. package/dist/gateway/static/root/assets/home-page-w3_aWeNt.js +1 -0
  43. package/dist/gateway/static/root/assets/{image-generation-api-DJ1xaz2p.js → image-generation-api-B5DXMylk.js} +1 -1
  44. package/dist/gateway/static/root/assets/{imports-page-CaB54QIp.js → imports-page-B1JH0G5j.js} +1 -1
  45. package/dist/gateway/static/root/assets/index--3c0awkr.js +121 -0
  46. package/dist/gateway/static/root/assets/index-CNc4N4TX.css +1 -0
  47. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DnvHvKQJ.js → keyboard-shortcuts-settings-DGrLJ8Yh.js} +1 -1
  48. package/dist/gateway/static/root/assets/local-app-workbench-page-BYKrJpFF.js +1 -0
  49. package/dist/gateway/static/root/assets/local-apps-Bpja8nC6.js +1 -0
  50. package/dist/gateway/static/root/assets/local-apps-page-DqjStqbL.js +1 -0
  51. package/dist/gateway/static/root/assets/{locale-store-C4RjTd0C.js → locale-store-BIkcRr3t.js} +1 -1
  52. package/dist/gateway/static/root/assets/{logs-page-N0q5DxnI.js → logs-page-Dl4kM4Na.js} +2 -2
  53. package/dist/gateway/static/root/assets/management-settings-gCfH4cwH.js +1 -0
  54. package/dist/gateway/static/root/assets/{markdown-view-DkPzc50Z.js → markdown-view-Ck_5MADq.js} +1 -1
  55. package/dist/gateway/static/root/assets/{media-plugins-BzLYE9lj.js → media-plugins-DTsZqgo6.js} +1 -1
  56. package/dist/gateway/static/root/assets/messages-7VAhscYe.js +3 -0
  57. package/dist/gateway/static/root/assets/note-detail-panel-j6sioeL1.js +5 -0
  58. package/dist/gateway/static/root/assets/notes-page-CMvvHv0f.js +8 -0
  59. package/dist/gateway/static/root/assets/{page-context-capture-button-DVnGa7Lu.js → page-context-capture-button-DTI_g4tz.js} +1 -1
  60. package/dist/gateway/static/root/assets/{page-tabs-q6lpN9OD.js → page-tabs-CfW_Q-K5.js} +1 -1
  61. package/dist/gateway/static/root/assets/{preview-open-alternatives-Ck63fJaQ.js → preview-open-alternatives-CuPN-vAn.js} +1 -1
  62. package/dist/gateway/static/root/assets/product-delivery-bv3z8Xkh.js +1 -0
  63. package/dist/gateway/static/root/assets/product-open-page-BHjxRz1E.js +1 -0
  64. package/dist/gateway/static/root/assets/project-detail-page-C9K_e-EV.js +1 -0
  65. package/dist/gateway/static/root/assets/projects-page-Bk-es4i9.js +1 -0
  66. package/dist/gateway/static/root/assets/{registry-api-CRnytFLF.js → registry-api-BAAZUGnU.js} +1 -1
  67. package/dist/gateway/static/root/assets/remote-access-hub-CLGJNA42.js +1 -0
  68. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bu3XyrDI.js → runtime-tools-settings-panel-CHJBJKL1.js} +2 -2
  69. package/dist/gateway/static/root/assets/{scenes-page-B_5HOUzl.js → scenes-page-ClLAD1pz.js} +2 -2
  70. package/dist/gateway/static/root/assets/{schema-form-CbOOKW1B.js → schema-form-FQAit5HL.js} +1 -1
  71. package/dist/gateway/static/root/assets/sessions-page-Xj8MkXN1.js +1 -0
  72. package/dist/gateway/static/root/assets/settings-advanced-gate-DwALV8mi.js +1 -0
  73. package/dist/gateway/static/root/assets/{settings-form-section-D3UN4rb4.js → settings-form-section-BDc6bw1q.js} +1 -1
  74. package/dist/gateway/static/root/assets/{settings-page-BHztZayW.js → settings-page-DnhxBJjV.js} +1 -1
  75. package/dist/gateway/static/root/assets/{settings-page-layout-nskqtzZs.js → settings-page-layout-D3KNSQ5g.js} +1 -1
  76. package/dist/gateway/static/root/assets/{setup-status-panel-BtukdJ-z.js → setup-status-panel-F0rCQ-2a.js} +1 -1
  77. package/dist/gateway/static/root/assets/{share-preview-page-DbYXEqur.js → share-preview-page-DVQCRxwK.js} +1 -1
  78. package/dist/gateway/static/root/assets/shares-settings-C7hf6Cov.js +1 -0
  79. package/dist/gateway/static/root/assets/skill-reload-api-xPrFejRE.js +1 -0
  80. package/dist/gateway/static/root/assets/{skills-page-CK9Jeaur.js → skills-page-RdDYu7Yj.js} +1 -1
  81. package/dist/gateway/static/root/assets/{skills-page.utils-B44aWbyL.js → skills-page.utils-mDwC9UJ-.js} +1 -1
  82. package/dist/gateway/static/root/assets/{system-settings-panel-BwqpUGv_.js → system-settings-panel-Bk7GrMij.js} +1 -1
  83. package/dist/gateway/static/root/assets/task-detail-page-2A966jFY.js +1 -0
  84. package/dist/gateway/static/root/assets/{tunnel-api-BKTZzQIT.js → tunnel-api-D3Aquraj.js} +1 -1
  85. package/dist/gateway/static/root/assets/{use-autosave-BB1JBOCz.js → use-autosave-C1xQ-sHn.js} +1 -1
  86. package/dist/gateway/static/root/assets/user-model-page-CnBxPBVe.js +2 -0
  87. package/dist/gateway/static/root/assets/{voice-api-key-field-C-HsgED9.js → voice-api-key-field-DCNECvcp.js} +1 -1
  88. package/dist/gateway/static/root/assets/{voice-config-api-DvJKYYA0.js → voice-config-api-B-_niUTU.js} +1 -1
  89. package/dist/gateway/static/root/assets/{work-discovery-overlay-K3e5ONUo.js → work-discovery-overlay-BrGx_JS_.js} +1 -1
  90. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-dXRTHBoE.js → workflow-run-setup-panel-CmmC2Pdr.js} +2 -2
  91. package/dist/gateway/static/root/assets/workflows-page-BZVpqw4T.js +6 -0
  92. package/dist/gateway/static/root/index.html +12 -11
  93. package/dist/package.js +1 -1
  94. package/dist/packages/gateway-contract/src/capabilities.js +4 -110
  95. package/dist/packages/gateway-contract/src/chat-previews.js +73 -0
  96. package/dist/packages/gateway-contract/src/index.js +6 -0
  97. package/dist/packages/gateway-contract/src/local-apps.js +215 -0
  98. package/dist/packages/gateway-contract/src/product-delivery.js +62 -17
  99. package/dist/packages/gateway-contract/src/user-turn-document.js +60 -0
  100. package/dist/src/agent/agent-manager.d.ts +1 -0
  101. package/dist/src/agent/agent-manager.js +5 -4
  102. package/dist/src/agent/background-review/run-background-review.js +1 -1
  103. package/dist/src/agent/embedded/model-runtime.js +1 -1
  104. package/dist/src/agent/embedded/run-for-session.js +1 -1
  105. package/dist/src/agent/embedded/transcript-runtime.d.ts +3 -0
  106. package/dist/src/agent/embedded/transcript-runtime.js +6 -0
  107. package/dist/src/agent/external-tools/cliProvider.js +4 -1
  108. package/dist/src/agent/external-tools/composio-provider.js +9 -3
  109. package/dist/src/agent/external-tools/gateway-tools.js +17 -10
  110. package/dist/src/agent/external-tools/mcp-provider.d.ts +3 -1
  111. package/dist/src/agent/external-tools/mcp-provider.js +91 -6
  112. package/dist/src/agent/external-tools/service.d.ts +2 -1
  113. package/dist/src/agent/external-tools/service.js +8 -3
  114. package/dist/src/agent/external-tools/types.d.ts +9 -0
  115. package/dist/src/agent/image/tool-model-config.js +1 -1
  116. package/dist/src/agent/mcp/bundle-mcp-config.js +37 -5
  117. package/dist/src/agent/mcp/bundle-mcp-gateway.d.ts +1 -0
  118. package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -0
  119. package/dist/src/agent/mcp/bundle-mcp-names.js +2 -1
  120. package/dist/src/agent/mcp/bundle-mcp-runtime.js +33 -1
  121. package/dist/src/agent/mcp/bundle-mcp-types.d.ts +4 -0
  122. package/dist/src/agent/mcp/index.js +1 -1
  123. package/dist/src/agent/mcp/mcp-stdio-transport.d.ts +1 -0
  124. package/dist/src/agent/mcp/mcp-stdio-transport.js +10 -0
  125. package/dist/src/agent/mcp/mcp-transport.js +12 -8
  126. package/dist/src/agent/mcp/oauth/index.js +1 -1
  127. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.d.ts +6 -1
  128. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +70 -14
  129. package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +1 -1
  130. package/dist/src/agent/mcp/oauth/mcp-oauth-session.d.ts +2 -0
  131. package/dist/src/agent/mcp/oauth/mcp-oauth-session.js +12 -0
  132. package/dist/src/agent/mcp/oauth/mcp-oauth-store.d.ts +3 -0
  133. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +14 -2
  134. package/dist/src/agent/mcp/plugin-http-fetch.d.ts +2 -0
  135. package/dist/src/agent/mcp/plugin-http-fetch.js +56 -0
  136. package/dist/src/agent/service/process-direct-streaming.js +27 -12
  137. package/dist/src/agent/service.js +3 -2
  138. package/dist/src/agent/service.types.d.ts +2 -0
  139. package/dist/src/agent/session/session-inspector.js +1 -1
  140. package/dist/src/agent/skills/hub-lock.js +1 -1
  141. package/dist/src/agent/skills/hub-pull.js +1 -1
  142. package/dist/src/agent/skills/index.js +8 -1
  143. package/dist/src/agent/skills/skill-manager.d.ts +2 -0
  144. package/dist/src/agent/skills/skill-manager.js +8 -0
  145. package/dist/src/agent/skills/skill-sources.js +17 -0
  146. package/dist/src/agent/skills/types.d.ts +3 -1
  147. package/dist/src/agent/source-context/injector.js +10 -5
  148. package/dist/src/agent/source-context/types.d.ts +3 -0
  149. package/dist/src/agent/source-context/types.js +8 -2
  150. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  151. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  152. package/dist/src/agent/tool-manuals/xopc-use.js +12 -2
  153. package/dist/src/agent/tools/automation-tool.js +1 -1
  154. package/dist/src/agent/tools/factory.d.ts +1 -0
  155. package/dist/src/agent/tools/factory.js +2 -1
  156. package/dist/src/agent/tools/search/registry.js +4 -1
  157. package/dist/src/agent/tools/workflow-tool.js +1 -1
  158. package/dist/src/agent/tools/write.js +1 -1
  159. package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
  160. package/dist/src/agent/tools/xopc-use-tool.js +120 -12
  161. package/dist/src/ai-assist/text-assist.js +1 -1
  162. package/dist/src/auth/credentials.js +2 -2
  163. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  164. package/dist/src/auth/profiles/store.js +1 -1
  165. package/dist/src/auth/sync-provider-auth.js +2 -2
  166. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  167. package/dist/src/chat-commands/agent-edit.js +1 -1
  168. package/dist/src/chat-previews/index.d.ts +2 -0
  169. package/dist/src/chat-previews/index.js +3 -0
  170. package/dist/src/chat-previews/service.d.ts +27 -0
  171. package/dist/src/chat-previews/service.js +106 -0
  172. package/dist/src/chat-previews/store.d.ts +28 -0
  173. package/dist/src/chat-previews/store.js +77 -0
  174. package/dist/src/cli/commands/agent.js +1 -1
  175. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  176. package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
  177. package/dist/src/cli/commands/extension-agent-plugin.d.ts +8 -0
  178. package/dist/src/cli/commands/extension-agent-plugin.js +82 -0
  179. package/dist/src/cli/commands/extension-marketplace.js +44 -4
  180. package/dist/src/cli/commands/extension.js +35 -3
  181. package/dist/src/cli/commands/models.js +1 -1
  182. package/dist/src/computer/runtime.js +1 -1
  183. package/dist/src/config/index.js +4 -4
  184. package/dist/src/config/loader.js +2 -2
  185. package/dist/src/config/models-json.js +2 -2
  186. package/dist/src/config/schema.js +2 -2
  187. package/dist/src/connectors/account-selection.js +1 -1
  188. package/dist/src/connectors/connection-candidates.d.ts +4 -1
  189. package/dist/src/connectors/connection-candidates.js +8 -2
  190. package/dist/src/connectors/connection-capabilities.d.ts +2 -2
  191. package/dist/src/connectors/connection-capabilities.js +3 -1
  192. package/dist/src/connectors/connection-recovery-service.d.ts +6 -1
  193. package/dist/src/connectors/connection-recovery-service.js +138 -26
  194. package/dist/src/connectors/plugin-mcp-recovery.d.ts +28 -0
  195. package/dist/src/connectors/plugin-mcp-recovery.js +90 -0
  196. package/dist/src/extensions/agent-plugins/auth.d.ts +39 -0
  197. package/dist/src/extensions/agent-plugins/auth.js +156 -0
  198. package/dist/src/extensions/agent-plugins/connection.d.ts +8 -0
  199. package/dist/src/extensions/agent-plugins/connection.js +41 -0
  200. package/dist/src/extensions/agent-plugins/health.d.ts +4 -0
  201. package/dist/src/extensions/agent-plugins/health.js +48 -0
  202. package/dist/src/extensions/agent-plugins/inventory.d.ts +53 -0
  203. package/dist/src/extensions/agent-plugins/inventory.js +34 -0
  204. package/dist/src/extensions/agent-plugins/mcp-adapter.d.ts +3 -0
  205. package/dist/src/extensions/agent-plugins/mcp-adapter.js +47 -0
  206. package/dist/src/extensions/agent-plugins/sources.d.ts +5 -0
  207. package/dist/src/extensions/agent-plugins/sources.js +72 -0
  208. package/dist/src/extensions/agent-plugins/store.d.ts +61 -0
  209. package/dist/src/extensions/agent-plugins/store.js +305 -0
  210. package/dist/src/extensions/agent-plugins/validation.d.ts +59 -0
  211. package/dist/src/extensions/agent-plugins/validation.js +211 -0
  212. package/dist/src/extensions/lockfile.js +1 -1
  213. package/dist/src/extensions/update.js +1 -1
  214. package/dist/src/gateway/agents-admin.js +1 -1
  215. package/dist/src/gateway/chat-stream/mapper.js +10 -3
  216. package/dist/src/gateway/file-path-classifier.js +1 -1
  217. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  218. package/dist/src/gateway/hono/routes/agent-plugins.d.ts +3 -0
  219. package/dist/src/gateway/hono/routes/agent-plugins.js +166 -0
  220. package/dist/src/gateway/hono/routes/agent-stream.js +14 -0
  221. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +4 -2
  222. package/dist/src/gateway/hono/routes/chat-previews.d.ts +3 -0
  223. package/dist/src/gateway/hono/routes/chat-previews.js +41 -0
  224. package/dist/src/gateway/hono/routes/connection-waits.js +4 -2
  225. package/dist/src/gateway/hono/routes/index.js +2 -0
  226. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  227. package/dist/src/gateway/hono/routes/local-apps.js +71 -39
  228. package/dist/src/gateway/hono/routes/mcp.js +48 -21
  229. package/dist/src/gateway/hono/routes/models.js +1 -1
  230. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +4 -0
  231. package/dist/src/gateway/hono/routes/session-input-handler.js +22 -0
  232. package/dist/src/gateway/hono/routes/side-chats.js +11 -0
  233. package/dist/src/gateway/service/agent-runner.js +7 -1
  234. package/dist/src/gateway/service/config-coordinator.js +1 -1
  235. package/dist/src/gateway/service/marketplace-service.d.ts +1 -0
  236. package/dist/src/gateway/service/marketplace-service.js +15 -1
  237. package/dist/src/gateway/service/session-input-coordinator.js +3 -3
  238. package/dist/src/gateway/service.d.ts +5 -1
  239. package/dist/src/gateway/service.js +19 -5
  240. package/dist/src/gateway/side-chat/index.d.ts +3 -1
  241. package/dist/src/gateway/side-chat/index.js +2 -1
  242. package/dist/src/gateway/side-chat/manager.d.ts +16 -0
  243. package/dist/src/gateway/side-chat/manager.js +40 -6
  244. package/dist/src/gateway/side-chat/promotion-service.d.ts +19 -0
  245. package/dist/src/gateway/side-chat/promotion-service.js +111 -0
  246. package/dist/src/gateway/side-chat/run-service.js +1 -0
  247. package/dist/src/gateway/side-chat/types.d.ts +1 -1
  248. package/dist/src/local-apps/artifact-files.d.ts +3 -0
  249. package/dist/src/local-apps/artifact-files.js +45 -0
  250. package/dist/src/local-apps/capabilities/write.js +1 -1
  251. package/dist/src/local-apps/fix-guidance.d.ts +3 -0
  252. package/dist/src/local-apps/fix-guidance.js +75 -0
  253. package/dist/src/local-apps/index.d.ts +2 -1
  254. package/dist/src/local-apps/scaffold.d.ts +5 -0
  255. package/dist/src/local-apps/scaffold.js +18 -5
  256. package/dist/src/local-apps/service.d.ts +18 -3
  257. package/dist/src/local-apps/service.js +106 -64
  258. package/dist/src/local-apps/snapshot-store.d.ts +8 -0
  259. package/dist/src/local-apps/snapshot-store.js +68 -0
  260. package/dist/src/local-apps/types.d.ts +4 -87
  261. package/dist/src/notes/service.js +1 -1
  262. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  263. package/dist/src/providers/index.js +2 -2
  264. package/dist/src/providers/model-catalog-persistence.js +1 -1
  265. package/dist/src/providers/model-registry.js +1 -1
  266. package/dist/src/providers/register-runtime-providers.js +1 -1
  267. package/dist/src/session/client-history.d.ts +3 -1
  268. package/dist/src/session/client-history.js +10 -3
  269. package/dist/src/session/index.d.ts +1 -1
  270. package/dist/src/session/manager.d.ts +4 -0
  271. package/dist/src/session/manager.js +6 -0
  272. package/dist/src/session/session-context-for-llm.d.ts +12 -1
  273. package/dist/src/session/session-context-for-llm.js +16 -2
  274. package/dist/src/session/store.d.ts +14 -0
  275. package/dist/src/session/store.js +17 -0
  276. package/dist/src/session/stored-rows-to-file-entries.js +10 -1
  277. package/dist/src/session/transcript-outline.js +10 -3
  278. package/dist/src/storage/sqlite/connection-wait-repository.js +9 -3
  279. package/dist/src/storage/sqlite/migrations/202_chat_previews.sql +26 -0
  280. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  281. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  282. package/dist/src/storage/sqlite/row-mappers.js +6 -1
  283. package/dist/src/storage/sqlite/schema.js +1 -1
  284. package/dist/src/tui/backends/embedded-backend.js +1 -1
  285. package/dist/src/tui/tui-commands.js +1 -1
  286. package/dist/src/tui/tui-startup-resources.js +1 -1
  287. package/dist/src/tui/tui.js +2 -2
  288. package/dist/src/voice/tts/audio.js +1 -1
  289. package/dist/src/work-discovery/service.js +2 -2
  290. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  291. package/package.json +4 -4
  292. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BGCqlTcR.js +0 -1
  293. package/dist/gateway/static/root/assets/api-DEneywgz.js +0 -1
  294. package/dist/gateway/static/root/assets/apps-page-vC87gAyb.js +0 -1
  295. package/dist/gateway/static/root/assets/automations-workspace-CzYmREol.js +0 -7
  296. package/dist/gateway/static/root/assets/browser-settings-page-BxaSzUIU.js +0 -3
  297. package/dist/gateway/static/root/assets/capabilities-D0S3DuAD.js +0 -1
  298. package/dist/gateway/static/root/assets/capabilities-settings-panel-CFCu-8da.js +0 -8
  299. package/dist/gateway/static/root/assets/channels-settings-CENp82yt.js +0 -1
  300. package/dist/gateway/static/root/assets/connectors-page-g_KTZWCb.js +0 -2
  301. package/dist/gateway/static/root/assets/device-pairing-wizard-DO7jp0ep.js +0 -1
  302. package/dist/gateway/static/root/assets/gateway-settings-BkeSEBxk.js +0 -1
  303. package/dist/gateway/static/root/assets/home-page-KoQXV4hp.js +0 -1
  304. package/dist/gateway/static/root/assets/index-ZxnWUdPv.css +0 -1
  305. package/dist/gateway/static/root/assets/index-u4709aCa.js +0 -89
  306. package/dist/gateway/static/root/assets/local-app-workbench-page-7QX0YFa7.js +0 -2
  307. package/dist/gateway/static/root/assets/local-apps-page-RSAl-NhO.js +0 -1
  308. package/dist/gateway/static/root/assets/management-settings-C_cb0Kue.js +0 -1
  309. package/dist/gateway/static/root/assets/messages-M5xl1fHE.js +0 -3
  310. package/dist/gateway/static/root/assets/note-detail-panel-CVWst-Er.js +0 -5
  311. package/dist/gateway/static/root/assets/notes-page-BFwCgIls.js +0 -8
  312. package/dist/gateway/static/root/assets/product-delivery-chCjIpvu.js +0 -1
  313. package/dist/gateway/static/root/assets/product-open-page-BIGvTs9n.js +0 -1
  314. package/dist/gateway/static/root/assets/project-detail-page-BFEtpkcf.js +0 -1
  315. package/dist/gateway/static/root/assets/projects-page-CHr-P2z4.js +0 -1
  316. package/dist/gateway/static/root/assets/remote-access-hub-PhEyHSOb.js +0 -1
  317. package/dist/gateway/static/root/assets/sessions-page-CmIhlHPS.js +0 -1
  318. package/dist/gateway/static/root/assets/settings-advanced-gate-CCOTu1jb.js +0 -1
  319. package/dist/gateway/static/root/assets/shares-settings-CG1sll8V.js +0 -1
  320. package/dist/gateway/static/root/assets/skill-reload-api-Byq23h9c.js +0 -1
  321. package/dist/gateway/static/root/assets/task-detail-page-D5q-wk_d.js +0 -1
  322. package/dist/gateway/static/root/assets/user-model-page-DE3ZeJL3.js +0 -2
  323. package/dist/gateway/static/root/assets/workflows-page-DGZaETmN.js +0 -6
@@ -0,0 +1,305 @@
1
+ import { init_paths_state, resolveStateDir } from "../../config/paths-state.js";
2
+ import { createLogger } from "../../utils/logger/index.js";
3
+ import { init_logger } from "../../utils/logger.js";
4
+ import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
5
+ import { computeExtensionDirectoryIntegrity } from "../lockfile.js";
6
+ import { containedPath, inspectAgentPlugin, pluginName } from "./validation.js";
7
+ import { readPluginMcpHealth } from "./health.js";
8
+ import { tmpdir } from "node:os";
9
+ import { dirname, join, resolve } from "node:path";
10
+ import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
11
+ import { createHash, randomUUID } from "node:crypto";
12
+ import { z } from "zod";
13
+ import AdmZip from "adm-zip";
14
+ import lockfile from "proper-lockfile";
15
+ //#region src/extensions/agent-plugins/store.ts
16
+ init_paths_state();
17
+ init_write_file_atomic();
18
+ init_logger();
19
+ const receiptFields = z.object({
20
+ id: pluginName,
21
+ revision: z.string().uuid(),
22
+ source: z.string(),
23
+ installedAt: z.string(),
24
+ enabled: z.boolean(),
25
+ integrity: z.string(),
26
+ capabilities: z.array(z.string())
27
+ });
28
+ const receiptSchema = receiptFields.extend({ previous: receiptFields.optional() });
29
+ const log = createLogger("AgentPlugins");
30
+ var AgentPluginStore = class {
31
+ constructor(stateDir = resolveStateDir()) {
32
+ this.stateDir = stateDir;
33
+ }
34
+ receiptsDir() {
35
+ return join(this.stateDir, "plugin-receipts");
36
+ }
37
+ revisionKey() {
38
+ if (!existsSync(this.receiptsDir())) return "";
39
+ return readdirSync(this.receiptsDir()).filter((name) => name.endsWith(".json")).sort().map((name) => {
40
+ try {
41
+ return `${name}:${statSync(join(this.receiptsDir(), name)).mtimeMs}`;
42
+ } catch {
43
+ return "";
44
+ }
45
+ }).join("|");
46
+ }
47
+ dataDir(id) {
48
+ return containedPath(this.stateDir, join(this.stateDir, "plugin-data", pluginName.parse(id)));
49
+ }
50
+ revisionDir(id, revision) {
51
+ return join(this.stateDir, "plugins", pluginName.parse(id), z.string().uuid().parse(revision));
52
+ }
53
+ receiptPath(id) {
54
+ return join(this.receiptsDir(), `${pluginName.parse(id)}.json`);
55
+ }
56
+ receipt(id) {
57
+ const path = this.receiptPath(id);
58
+ if (!existsSync(path)) return void 0;
59
+ const receipt = receiptSchema.parse(JSON.parse(readFileSync(path, "utf8")));
60
+ if (receipt.id !== id) throw new Error("Plugin receipt identity mismatch");
61
+ return receipt;
62
+ }
63
+ write(receipt) {
64
+ writeTextAtomicSync(this.receiptPath(receipt.id), JSON.stringify(receipt));
65
+ }
66
+ mutate(fn) {
67
+ mkdirSync(this.receiptsDir(), {
68
+ recursive: true,
69
+ mode: 448
70
+ });
71
+ const release = lockfile.lockSync(this.receiptsDir());
72
+ try {
73
+ return fn();
74
+ } finally {
75
+ release();
76
+ }
77
+ }
78
+ get(id) {
79
+ const receipt = this.receipt(id);
80
+ if (!receipt) return void 0;
81
+ const rootDir = this.revisionDir(id, receipt.revision);
82
+ try {
83
+ validatePackageTree(rootDir);
84
+ const inspection = inspectAgentPlugin(rootDir, this.dataDir(id));
85
+ const valid = computeExtensionDirectoryIntegrity(rootDir) === receipt.integrity;
86
+ if (!valid) inspection.diagnostics.push({
87
+ component: "package",
88
+ message: "Installed files differ from the reviewed package"
89
+ });
90
+ const health = Object.keys(inspection.servers).map((name) => readPluginMcpHealth(id, name, receipt.revision, this.stateDir));
91
+ const readiness = !valid ? "blocked" : inspection.diagnostics.length || health.includes("error") ? "degraded" : health.some((status) => status !== "ready") ? "setup_required" : "ready";
92
+ return {
93
+ ...inspection,
94
+ id,
95
+ receipt,
96
+ format: "agent-plugin",
97
+ readiness
98
+ };
99
+ } catch (error) {
100
+ return {
101
+ id,
102
+ receipt,
103
+ format: "agent-plugin",
104
+ readiness: "blocked",
105
+ rootDir,
106
+ manifest: {
107
+ $schema: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
108
+ name: id
109
+ },
110
+ skills: [],
111
+ servers: {},
112
+ capabilities: [],
113
+ diagnostics: [{
114
+ component: "package",
115
+ message: error instanceof Error ? error.message : String(error)
116
+ }]
117
+ };
118
+ }
119
+ }
120
+ list() {
121
+ if (!existsSync(this.receiptsDir())) return [];
122
+ return readdirSync(this.receiptsDir()).filter((name) => name.endsWith(".json")).sort().flatMap((name) => {
123
+ const id = name.slice(0, -5);
124
+ if (!pluginName.safeParse(id).success) return [];
125
+ try {
126
+ const plugin = this.get(id);
127
+ return plugin ? [plugin] : [];
128
+ } catch (error) {
129
+ log.warn({
130
+ err: error,
131
+ pluginId: id
132
+ }, "Invalid Agent Plugin receipt; package disabled");
133
+ return [];
134
+ }
135
+ });
136
+ }
137
+ active() {
138
+ if (["1", "true"].includes(process.env.XOPC_SKIP_EXTENSIONS ?? "")) return [];
139
+ return this.list().filter((p) => p.receipt.enabled && p.readiness !== "blocked");
140
+ }
141
+ inspect(source) {
142
+ return this.withSource(source, (root) => this.plan(root));
143
+ }
144
+ plan(root) {
145
+ validatePackageTree(root);
146
+ const initial = inspectAgentPlugin(root);
147
+ const inspection = inspectAgentPlugin(root, this.dataDir(initial.manifest.name));
148
+ const integrity = computeExtensionDirectoryIntegrity(root);
149
+ const current = this.receipt(inspection.manifest.name);
150
+ const addedCapabilities = inspection.capabilities.filter((c) => !current?.capabilities.includes(c));
151
+ const reviewHash = createHash("sha256").update(JSON.stringify([integrity, inspection.capabilities])).digest("hex");
152
+ return {
153
+ ...inspection,
154
+ integrity,
155
+ reviewHash,
156
+ addedCapabilities,
157
+ installed: !!current
158
+ };
159
+ }
160
+ install(source, options = {}) {
161
+ return this.mutate(() => this.withSource(source, (root) => {
162
+ const plan = this.plan(root);
163
+ const id = plan.manifest.name;
164
+ if (options.expectedId && options.expectedId !== id) throw new Error("Update package identity does not match installed plugin");
165
+ const current = this.receipt(id);
166
+ if (current && !options.replace) throw new Error("Plugin already installed; use update");
167
+ if ((!current || plan.addedCapabilities.length > 0) && options.reviewHash !== plan.reviewHash) throw new Error("Package capability review is required");
168
+ if (options.reviewHash && options.reviewHash !== plan.reviewHash) throw new Error("Package changed after review; inspect again");
169
+ validatePackageTree(root);
170
+ const revision = randomUUID();
171
+ const target = this.revisionDir(id, revision);
172
+ mkdirSync(dirname(target), { recursive: true });
173
+ try {
174
+ cpSync(root, target, {
175
+ recursive: true,
176
+ dereference: false,
177
+ verbatimSymlinks: true
178
+ });
179
+ validatePackageTree(target);
180
+ const installed = inspectAgentPlugin(target, this.dataDir(id));
181
+ const integrity = computeExtensionDirectoryIntegrity(target);
182
+ if (integrity !== plan.integrity) throw new Error("Package changed during installation");
183
+ const label = options.sourceLabel ?? source;
184
+ this.write({
185
+ id,
186
+ revision,
187
+ source: /^(https:\/\/|store:)/.test(label) ? label : resolve(label),
188
+ installedAt: (/* @__PURE__ */ new Date()).toISOString(),
189
+ enabled: current?.enabled ?? false,
190
+ integrity,
191
+ capabilities: installed.capabilities,
192
+ previous: current ? receiptFields.parse(current) : void 0
193
+ });
194
+ } catch (error) {
195
+ rmSync(target, {
196
+ recursive: true,
197
+ force: true
198
+ });
199
+ throw error;
200
+ }
201
+ return this.get(id);
202
+ }));
203
+ }
204
+ setEnabled(id, enabled) {
205
+ return this.mutate(() => {
206
+ const plugin = this.get(id);
207
+ if (!plugin) throw new Error("Plugin not installed");
208
+ if (enabled && plugin.readiness === "blocked") throw new Error("Repair the plugin before enabling it");
209
+ this.write({
210
+ ...plugin.receipt,
211
+ enabled
212
+ });
213
+ return this.get(id);
214
+ });
215
+ }
216
+ rollback(id) {
217
+ return this.mutate(() => {
218
+ const receipt = this.receipt(id);
219
+ const previous = receipt?.previous;
220
+ if (!receipt || !previous || previous.id !== id) throw new Error("No rollback revision available");
221
+ if (computeExtensionDirectoryIntegrity(this.revisionDir(id, previous.revision)) !== previous.integrity) throw new Error("Rollback revision integrity failed");
222
+ this.write({
223
+ ...previous,
224
+ enabled: receipt.enabled,
225
+ previous: receiptFields.parse(receipt)
226
+ });
227
+ return this.get(id);
228
+ });
229
+ }
230
+ remove(id, removeData = false) {
231
+ this.mutate(() => {
232
+ if (!this.receipt(id)) throw new Error("Plugin not installed");
233
+ rmSync(this.receiptPath(id));
234
+ rmSync(join(this.stateDir, "plugins", pluginName.parse(id)), {
235
+ recursive: true,
236
+ force: true
237
+ });
238
+ rmSync(join(this.stateDir, "plugin-health", id), {
239
+ recursive: true,
240
+ force: true
241
+ });
242
+ if (removeData) rmSync(this.dataDir(id), {
243
+ recursive: true,
244
+ force: true
245
+ });
246
+ });
247
+ }
248
+ withSource(source, fn) {
249
+ const path = resolve(source);
250
+ if (statSync(path).isDirectory()) return fn(path);
251
+ if (statSync(path).size > 50 * 1024 * 1024) throw new Error("Plugin archive exceeds 50 MiB");
252
+ const temp = mkdtempSync(join(tmpdir(), "xopc-agent-plugin-"));
253
+ try {
254
+ const entries = new AdmZip(path).getEntries();
255
+ if (entries.length > 1e4) throw new Error("Too many archive entries");
256
+ let bytes = 0;
257
+ const paths = /* @__PURE__ */ new Set();
258
+ for (const entry of entries) {
259
+ if (entry.entryName.includes("\\") || entry.entryName.startsWith("/") || /^[a-z]:/i.test(entry.entryName)) throw new Error("Unsafe archive path");
260
+ const target = containedPath(temp, join(temp, entry.entryName));
261
+ if (paths.has(target)) throw new Error("Duplicate archive path");
262
+ paths.add(target);
263
+ const mode = entry.attr >>> 16 & 65535;
264
+ if ((mode & 61440) === 40960) throw new Error("Archive symlinks are not supported");
265
+ bytes += entry.header.size;
266
+ if (bytes > 100 * 1024 * 1024) throw new Error("Expanded archive exceeds 100 MiB");
267
+ if (entry.isDirectory) mkdirSync(target, { recursive: true });
268
+ else {
269
+ mkdirSync(dirname(target), { recursive: true });
270
+ const data = entry.getData();
271
+ if (data.length !== entry.header.size) throw new Error("Archive size mismatch");
272
+ writeFileSync(target, data, {
273
+ mode: mode & 73 ? 493 : 420,
274
+ flag: "wx"
275
+ });
276
+ }
277
+ }
278
+ const children = readdirSync(temp);
279
+ return fn(existsSync(join(temp, "plugin.json")) ? temp : children.length === 1 ? join(temp, children[0]) : temp);
280
+ } finally {
281
+ rmSync(temp, {
282
+ recursive: true,
283
+ force: true
284
+ });
285
+ }
286
+ }
287
+ };
288
+ function validatePackageTree(root) {
289
+ let files = 0;
290
+ let bytes = 0;
291
+ const visit = (path, ancestors) => {
292
+ const safe = containedPath(root, path);
293
+ if (ancestors.has(safe)) throw new Error("Cyclic package symlink");
294
+ const stat = statSync(safe);
295
+ if (++files > 1e4 || (bytes += stat.isFile() ? stat.size : 0) > 100 * 1024 * 1024) throw new Error("Package exceeds limits");
296
+ if (stat.isDirectory()) {
297
+ const next = new Set([...ancestors, safe]);
298
+ for (const name of readdirSync(safe)) visit(join(path, name), next);
299
+ } else if (!stat.isFile()) throw new Error("Unsupported package file type");
300
+ if (lstatSync(path).isFile() && stat.nlink > 1) throw new Error("Package hardlinks are not supported");
301
+ };
302
+ visit(root, /* @__PURE__ */ new Set());
303
+ }
304
+ //#endregion
305
+ export { AgentPluginStore };
@@ -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 };
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
- import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
4
3
  import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
4
+ import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
5
5
  import { dirname, join } from "path";
6
6
  import { existsSync, lstatSync, readFileSync, readdirSync, readlinkSync } from "fs";
7
7
  import { mkdir, readFile } from "fs/promises";
@@ -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,6 +1,6 @@
1
1
  import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
2
- import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
3
2
  import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
3
+ import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
4
4
  import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
5
5
  import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
6
6
  import { seedAgentProfileMarkdownFiles } from "../agent/context/workspace-seed.js";
@@ -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 rows = asRecord(value)?.sourceContexts;
450
- if (!Array.isArray(rows)) return void 0;
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 ? { sourceContexts } : void 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);
@@ -1,7 +1,7 @@
1
1
  import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
2
2
  import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
3
- import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
4
3
  import { extractProfileAgentId } from "../config/agent-profile.js";
4
+ import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
5
5
  import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
6
6
  import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
7
7
  import { basename, isAbsolute, resolve } from "node:path";
@@ -1,9 +1,9 @@
1
1
  import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
2
2
  import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
3
3
  import { resolveModelsJsonPath } from "../../../config/paths.js";
4
+ import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
4
5
  import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
5
6
  import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
6
- import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
7
7
  import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
8
8
  import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
9
9
  import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
@@ -0,0 +1,3 @@
1
+ import type { Hono } from 'hono';
2
+ import type { AuthenticatedRouteDeps } from './deps.js';
3
+ export declare function registerAgentPluginRoutes(app: Hono, deps: AuthenticatedRouteDeps): void;