@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
@@ -1,10 +1,10 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { createLogger } from "../utils/logger/index.js";
3
3
  import { init_logger } from "../utils/logger.js";
4
- import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
5
4
  import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
6
- import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
5
+ import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
7
6
  import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
7
+ import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
8
8
  import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
9
9
  import { dirname, join } from "path";
10
10
  import { mkdir, readFile, readdir, rm } from "fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
- import { generatePKCE, init_pkce } from "./pkce.js";
3
2
  import { init_resolution, resolveConnectedPlatformEndpoint } from "../../platform/resolution.js";
3
+ import { generatePKCE, init_pkce } from "./pkce.js";
4
4
  import { hostname } from "node:os";
5
5
  import { randomBytes } from "node:crypto";
6
6
  import http from "node:http";
@@ -1,5 +1,5 @@
1
- import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
2
1
  import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
2
+ import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
3
3
  import path from "node:path";
4
4
  import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
5
5
  //#region src/auth/profiles/store.ts
@@ -1,8 +1,8 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
+ import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
2
3
  import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
3
- import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
4
4
  import { init_loader, loadConfig } from "../config/loader.js";
5
- import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
5
+ import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
6
6
  import { existsSync, readFileSync } from "node:fs";
7
7
  //#region src/auth/sync-provider-auth.ts
8
8
  /**
@@ -2,8 +2,8 @@ import { PACKAGE_VERSION, init_package_version } from "../../package-version.js"
2
2
  import { resolveStateDir } from "../../config/paths-state.js";
3
3
  import { createLogger } from "../../utils/logger/index.js";
4
4
  import { init_logger } from "../../utils/logger.js";
5
- import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
6
5
  import { init_paths, resolveBinDir, resolveConfigPath } from "../../config/paths.js";
6
+ import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
7
7
  import { assertCacheDir } from "../cache-dir-policy.js";
8
8
  import { BROWSER_EXTENSION_ID, BROWSER_NATIVE_HOST_NAME } from "../extension-identity.js";
9
9
  import "../native-messaging-host.js";
@@ -1,6 +1,6 @@
1
1
  import { init_agent_scope, normalizeAgentId, resolveAgentProfileDir } from "../agent/agent-scope.js";
2
- import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
3
2
  import { init_agent_session_key, resolveAgentIdFromConversationId } from "../routing/agent-session-key.js";
3
+ import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
4
4
  import { commandRegistry } from "./registry.js";
5
5
  import { join } from "node:path";
6
6
  import { readFile } from "node:fs/promises";
@@ -0,0 +1,2 @@
1
+ export * from './service.js';
2
+ export * from './store.js';
@@ -0,0 +1,3 @@
1
+ import { ChatPreviewStore } from "./store.js";
2
+ import { ChatPreviewNotFoundError, ChatPreviewRevisionConflictError, ChatPreviewService } from "./service.js";
3
+ export { ChatPreviewNotFoundError, ChatPreviewRevisionConflictError, ChatPreviewService, ChatPreviewStore };
@@ -0,0 +1,27 @@
1
+ import { type ChatPreviewCreateInput, type ChatPreviewRecord, type ChatPreviewRevision, type ChatPreviewReviseInput, type ChatPreviewDiagnostic, type ChatPreviewFixGuidance, type LocalAppDetail } from '@xopcai/gateway-contract';
2
+ import type { LocalAppService } from '../local-apps/index.js';
3
+ import { ChatPreviewStore } from './store.js';
4
+ export declare class ChatPreviewNotFoundError extends Error {
5
+ }
6
+ export declare class ChatPreviewRevisionConflictError extends Error {
7
+ }
8
+ export declare class ChatPreviewService {
9
+ private readonly store;
10
+ private readonly localApps?;
11
+ constructor(options?: {
12
+ store?: ChatPreviewStore;
13
+ localApps?: LocalAppService;
14
+ });
15
+ create(conversationId: string, rawInput: ChatPreviewCreateInput): {
16
+ preview: ChatPreviewRecord;
17
+ revision: ChatPreviewRevision;
18
+ };
19
+ get(id: string): ChatPreviewRecord;
20
+ getRevision(id: string, revision: string): ChatPreviewRevision;
21
+ revise(id: string, rawInput: ChatPreviewReviseInput): {
22
+ preview: ChatPreviewRecord;
23
+ revision: ChatPreviewRevision;
24
+ };
25
+ getFixGuidance(id: string, sourceHashValue: string, diagnostics: ChatPreviewDiagnostic[], locale: 'en' | 'zh'): ChatPreviewFixGuidance;
26
+ promote(id: string, sourceHashValue: string): LocalAppDetail;
27
+ }
@@ -0,0 +1,106 @@
1
+ import { ChatPreviewCreateInputSchema, ChatPreviewReviseInputSchema } from "../../packages/gateway-contract/src/chat-previews.js";
2
+ import { init_src } from "../../packages/gateway-contract/src/index.js";
3
+ import { ChatPreviewStore } from "./store.js";
4
+ import { createHash } from "node:crypto";
5
+ //#region src/chat-previews/service.ts
6
+ init_src();
7
+ var ChatPreviewNotFoundError = class extends Error {};
8
+ var ChatPreviewRevisionConflictError = class extends Error {};
9
+ function sourceHash(source) {
10
+ const hash = createHash("sha256");
11
+ for (const value of [
12
+ source.markup,
13
+ source.styles,
14
+ source.script
15
+ ]) {
16
+ hash.update(String(Buffer.byteLength(value)));
17
+ hash.update(":");
18
+ hash.update(value);
19
+ }
20
+ return hash.digest("hex");
21
+ }
22
+ var ChatPreviewService = class {
23
+ store;
24
+ localApps;
25
+ constructor(options = {}) {
26
+ this.store = options.store ?? new ChatPreviewStore();
27
+ this.localApps = options.localApps;
28
+ }
29
+ create(conversationId, rawInput) {
30
+ const input = ChatPreviewCreateInputSchema.parse(rawInput);
31
+ const source = {
32
+ markup: input.markup,
33
+ styles: input.styles,
34
+ script: input.script
35
+ };
36
+ return this.store.create({
37
+ conversationId,
38
+ title: input.title,
39
+ preferredHeight: input.preferredHeight,
40
+ sourceHash: sourceHash(source),
41
+ source
42
+ });
43
+ }
44
+ get(id) {
45
+ const preview = this.store.get(id);
46
+ if (!preview) throw new ChatPreviewNotFoundError("Chat preview not found");
47
+ return preview;
48
+ }
49
+ getRevision(id, revision) {
50
+ const result = this.store.getRevision(id, revision);
51
+ if (!result) throw new ChatPreviewNotFoundError("Chat preview revision not found");
52
+ return result;
53
+ }
54
+ revise(id, rawInput) {
55
+ this.get(id);
56
+ const input = ChatPreviewReviseInputSchema.parse(rawInput);
57
+ const source = {
58
+ markup: input.markup,
59
+ styles: input.styles,
60
+ script: input.script
61
+ };
62
+ const result = this.store.revise({
63
+ id,
64
+ expectedRevision: input.baseRevision,
65
+ sourceHash: sourceHash(source),
66
+ source,
67
+ title: input.title,
68
+ preferredHeight: input.preferredHeight
69
+ });
70
+ if (!result) throw new ChatPreviewRevisionConflictError("Chat preview changed; revise the latest revision");
71
+ return result;
72
+ }
73
+ getFixGuidance(id, sourceHashValue, diagnostics, locale) {
74
+ const preview = this.get(id);
75
+ this.getRevision(id, sourceHashValue);
76
+ const issues = JSON.stringify(diagnostics, null, 2);
77
+ return {
78
+ previewId: id,
79
+ sourceHash: sourceHashValue,
80
+ prompt: locale === "zh" ? `请修复对话预览“${preview.title}”的运行错误。先读取 previewId=${id}、sourceHash=${sourceHashValue} 的不可变版本,分析以下诊断,然后用 xopc_use 的 chat_preview/revise 提交完整 markup、styles、script,并将 baseRevision 设为 ${sourceHashValue}。不要创建 Local App。\n\n诊断:\n${issues}` : `Fix the runtime errors in chat preview "${preview.title}". Read immutable previewId=${id}, sourceHash=${sourceHashValue}, analyze the diagnostics below, then use xopc_use chat_preview/revise with complete markup, styles, and script and baseRevision=${sourceHashValue}. Do not create a Local App.\n\nDiagnostics:\n${issues}`
81
+ };
82
+ }
83
+ promote(id, sourceHashValue) {
84
+ if (!this.localApps) throw new Error("Local app service is unavailable");
85
+ const preview = this.get(id);
86
+ const revision = this.getRevision(id, sourceHashValue);
87
+ const promotedAppId = this.store.getPromotedAppId(id, sourceHashValue);
88
+ if (promotedAppId) {
89
+ const existing = this.localApps.get(promotedAppId);
90
+ if (!existing) throw new Error("Promoted Local App is unavailable");
91
+ return existing;
92
+ }
93
+ const app = this.localApps.createFromPreview({
94
+ name: preview.title,
95
+ idea: `Promoted from chat preview ${preview.id} at revision ${revision.sourceHash}`,
96
+ description: "Created from an immutable chat preview.",
97
+ markup: revision.markup,
98
+ styles: revision.styles,
99
+ script: revision.script
100
+ });
101
+ this.store.setPromotedAppId(id, sourceHashValue, app.id);
102
+ return app;
103
+ }
104
+ };
105
+ //#endregion
106
+ export { ChatPreviewNotFoundError, ChatPreviewRevisionConflictError, ChatPreviewService };
@@ -0,0 +1,28 @@
1
+ import type { ChatPreviewRecord, ChatPreviewRevision, ChatPreviewSource } from '@xopcai/gateway-contract';
2
+ export declare class ChatPreviewStore {
3
+ create(input: {
4
+ conversationId: string;
5
+ title: string;
6
+ preferredHeight: number;
7
+ sourceHash: string;
8
+ source: ChatPreviewSource;
9
+ }): {
10
+ preview: ChatPreviewRecord;
11
+ revision: ChatPreviewRevision;
12
+ };
13
+ get(id: string): ChatPreviewRecord | null;
14
+ getRevision(id: string, sourceHash: string): ChatPreviewRevision | null;
15
+ getPromotedAppId(id: string, sourceHash: string): string | null;
16
+ setPromotedAppId(id: string, sourceHash: string, appId: string): void;
17
+ revise(input: {
18
+ id: string;
19
+ expectedRevision: string;
20
+ sourceHash: string;
21
+ source: ChatPreviewSource;
22
+ title?: string;
23
+ preferredHeight?: number;
24
+ }): {
25
+ preview: ChatPreviewRecord;
26
+ revision: ChatPreviewRevision;
27
+ } | null;
28
+ }
@@ -0,0 +1,77 @@
1
+ import { getSqliteDatabase, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
2
+ import "../storage/sqlite/index.js";
3
+ import { randomUUID } from "node:crypto";
4
+ //#region src/chat-previews/store.ts
5
+ function previewFromRow(row) {
6
+ return {
7
+ id: row.preview_id,
8
+ conversationId: row.conversation_id,
9
+ title: row.title,
10
+ preferredHeight: row.preferred_height,
11
+ latestRevision: row.latest_revision,
12
+ createdAt: row.created_at,
13
+ updatedAt: row.updated_at
14
+ };
15
+ }
16
+ function revisionFromRow(row) {
17
+ return {
18
+ previewId: row.preview_id,
19
+ sourceHash: row.source_hash,
20
+ markup: row.markup,
21
+ styles: row.styles,
22
+ script: row.script,
23
+ createdAt: row.created_at
24
+ };
25
+ }
26
+ var ChatPreviewStore = class {
27
+ create(input) {
28
+ const id = randomUUID();
29
+ const now = Date.now();
30
+ runSqliteWriteTransaction((db) => {
31
+ db.prepare(`INSERT INTO chat_previews (
32
+ preview_id, conversation_id, title, preferred_height, latest_revision, created_at, updated_at
33
+ ) VALUES (?, ?, ?, ?, ?, ?, ?)`).run(id, input.conversationId, input.title, input.preferredHeight, input.sourceHash, now, now);
34
+ db.prepare(`INSERT INTO chat_preview_revisions (
35
+ preview_id, source_hash, markup, styles, script, created_at
36
+ ) VALUES (?, ?, ?, ?, ?, ?)`).run(id, input.sourceHash, input.source.markup, input.source.styles, input.source.script, now);
37
+ });
38
+ return {
39
+ preview: this.get(id),
40
+ revision: this.getRevision(id, input.sourceHash)
41
+ };
42
+ }
43
+ get(id) {
44
+ const row = getSqliteDatabase().prepare("SELECT * FROM chat_previews WHERE preview_id = ?").get(id);
45
+ return row ? previewFromRow(row) : null;
46
+ }
47
+ getRevision(id, sourceHash) {
48
+ const row = getSqliteDatabase().prepare("SELECT * FROM chat_preview_revisions WHERE preview_id = ? AND source_hash = ?").get(id, sourceHash);
49
+ return row ? revisionFromRow(row) : null;
50
+ }
51
+ getPromotedAppId(id, sourceHash) {
52
+ return getSqliteDatabase().prepare("SELECT promoted_app_id FROM chat_preview_revisions WHERE preview_id = ? AND source_hash = ?").get(id, sourceHash)?.promoted_app_id ?? null;
53
+ }
54
+ setPromotedAppId(id, sourceHash, appId) {
55
+ if (getSqliteDatabase().prepare(`UPDATE chat_preview_revisions SET promoted_app_id = ?
56
+ WHERE preview_id = ? AND source_hash = ? AND promoted_app_id IS NULL`).run(appId, id, sourceHash).changes !== 1) throw new Error("Chat preview revision was already promoted or no longer exists");
57
+ }
58
+ revise(input) {
59
+ const now = Date.now();
60
+ return runSqliteWriteTransaction((db) => {
61
+ const current = db.prepare("SELECT * FROM chat_previews WHERE preview_id = ?").get(input.id);
62
+ if (!current || current.latest_revision !== input.expectedRevision) return null;
63
+ db.prepare(`INSERT OR IGNORE INTO chat_preview_revisions (
64
+ preview_id, source_hash, markup, styles, script, created_at
65
+ ) VALUES (?, ?, ?, ?, ?, ?)`).run(input.id, input.sourceHash, input.source.markup, input.source.styles, input.source.script, now);
66
+ db.prepare(`UPDATE chat_previews SET
67
+ title = ?, preferred_height = ?, latest_revision = ?, updated_at = ?
68
+ WHERE preview_id = ?`).run(input.title ?? current.title, input.preferredHeight ?? current.preferred_height, input.sourceHash, now, input.id);
69
+ return {
70
+ preview: this.get(input.id),
71
+ revision: this.getRevision(input.id, input.sourceHash)
72
+ };
73
+ });
74
+ }
75
+ };
76
+ //#endregion
77
+ export { ChatPreviewStore };
@@ -2,8 +2,8 @@ import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
4
4
  import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
5
- import { loadConfig } from "../../config/loader.js";
6
5
  import { init_agent_session_key, resolveAgentMainConversationId } from "../../routing/agent-session-key.js";
6
+ import { loadConfig } from "../../config/loader.js";
7
7
  import { ExtensionLoader } from "../../extensions/loader.js";
8
8
  import "../../extensions/index.js";
9
9
  import { MessageBus, MessageBusShutdownError } from "../../infra/bus/queue.js";
@@ -53,7 +53,7 @@ async function checkDatabaseSchema(ctx) {
53
53
  id: "database-schema",
54
54
  label: "Database schema",
55
55
  status: "pass",
56
- message: `SQLite schema v${status.dbVersion} (current release v201).`,
56
+ message: `SQLite schema v${status.dbVersion} (current release v202).`,
57
57
  hints: []
58
58
  };
59
59
  }
@@ -1,9 +1,9 @@
1
1
  import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
2
- import { PROVIDER_ENV_MAP, init_env_keys } from "../../../../providers/env-keys.js";
2
+ import { getDefaultAgentId, init_resolve_route } from "../../../../routing/resolve-route.js";
3
+ import { init_loader, loadConfig } from "../../../../config/loader.js";
3
4
  import { getModelOAuthProviderIds, init_registry } from "../../../../auth/oauth/registry.js";
5
+ import { PROVIDER_ENV_MAP, init_env_keys } from "../../../../providers/env-keys.js";
4
6
  import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
5
- import { init_loader, loadConfig } from "../../../../config/loader.js";
6
- import { getDefaultAgentId, init_resolve_route } from "../../../../routing/resolve-route.js";
7
7
  import { existsSync } from "node:fs";
8
8
  //#region src/cli/commands/doctor/checks/provider-auth.ts
9
9
  init_credentials();
@@ -0,0 +1,8 @@
1
+ import { Command } from 'commander';
2
+ export declare function isAgentPluginSource(source: string): boolean;
3
+ export declare function installAgentPluginFromCli(source: string, options: {
4
+ yes?: boolean;
5
+ force?: boolean;
6
+ expectedId?: string;
7
+ }): Promise<import("../../extensions/agent-plugins/store.js").InstalledAgentPlugin>;
8
+ export declare function addAgentPluginLifecycleCommands(command: Command): void;
@@ -0,0 +1,82 @@
1
+ import { init_loader, loadConfig } from "../../config/loader.js";
2
+ import { pluginServerId } from "../../extensions/agent-plugins/validation.js";
3
+ import { AgentPluginStore } from "../../extensions/agent-plugins/store.js";
4
+ import { removePluginCredentials, savePluginAuthBinding } from "../../extensions/agent-plugins/auth.js";
5
+ import { materializePluginServers } from "../../extensions/agent-plugins/mcp-adapter.js";
6
+ import { getContextWithOpts } from "../context.js";
7
+ import { getMcpOAuthManager } from "../../agent/mcp/oauth/mcp-oauth-manager.js";
8
+ import { isAgentPluginArchive, withAgentPluginSource } from "../../extensions/agent-plugins/sources.js";
9
+ import { join, resolve } from "node:path";
10
+ import { existsSync, readFileSync, statSync } from "node:fs";
11
+ import { confirm } from "@inquirer/prompts";
12
+ //#region src/cli/commands/extension-agent-plugin.ts
13
+ init_loader();
14
+ function isAgentPluginSource(source) {
15
+ if (source.startsWith("https://")) return true;
16
+ const path = resolve(source);
17
+ if (existsSync(join(path, "package.json"))) {
18
+ if (JSON.parse(readFileSync(join(path, "package.json"), "utf8"))?.xopc?.extension) return false;
19
+ }
20
+ return existsSync(path) && (statSync(path).isFile() && /\.zip$/i.test(path) && statSync(path).size <= 50 * 1024 * 1024 && isAgentPluginArchive(readFileSync(path)) || existsSync(join(path, "plugin.json")) && !existsSync(join(path, "xopc.extension.json")));
21
+ }
22
+ async function installAgentPluginFromCli(source, options) {
23
+ const store = new AgentPluginStore();
24
+ const cfg = loadConfig(getContextWithOpts().configPath);
25
+ const plan = await withAgentPluginSource(source, cfg, (local) => store.inspect(local));
26
+ console.log(JSON.stringify({
27
+ format: "agent-plugin",
28
+ name: plan.manifest.name,
29
+ version: plan.manifest.version,
30
+ capabilities: plan.capabilities,
31
+ addedCapabilities: plan.addedCapabilities,
32
+ diagnostics: plan.diagnostics
33
+ }, null, 2));
34
+ if (!options.yes && (!plan.installed || plan.addedCapabilities.length)) {
35
+ if (!process.stdin.isTTY) throw new Error("Capability review requires --yes in non-interactive mode");
36
+ if (!await confirm({
37
+ message: "Install this Agent Plugin with these capabilities?",
38
+ default: false
39
+ })) return;
40
+ }
41
+ const plugin = await withAgentPluginSource(source, cfg, (local) => store.install(local, {
42
+ reviewHash: plan.reviewHash,
43
+ replace: options.force,
44
+ expectedId: options.expectedId,
45
+ sourceLabel: source.startsWith("https://") || source.startsWith("store:") ? source : resolve(source)
46
+ }));
47
+ console.log(`Installed plugin:${plugin.id} (${plugin.receipt.enabled ? "enabled" : "disabled"}).`);
48
+ return plugin;
49
+ }
50
+ function addAgentPluginLifecycleCommands(command) {
51
+ command.command("rollback").argument("<id>", "plugin:<name>").action((raw) => {
52
+ console.log(JSON.stringify(new AgentPluginStore().rollback(raw.replace(/^plugin:/, "")), null, 2));
53
+ });
54
+ for (const action of ["enable", "disable"]) command.command(action).argument("<id>", "plugin:<name>").action((raw) => {
55
+ const plugin = new AgentPluginStore().setEnabled(raw.replace(/^plugin:/, ""), action === "enable");
56
+ console.log(`${plugin.id}: ${action}d`);
57
+ });
58
+ command.command("remove").argument("<id>", "plugin:<name>").option("--remove-data", "Also remove persistent plugin data").option("--remove-credentials", "Also delete local credentials").action(async (raw, options) => {
59
+ const store = new AgentPluginStore();
60
+ const id = raw.replace(/^plugin:/, "");
61
+ if (options.removeCredentials) await removePluginCredentials(store, id);
62
+ store.remove(id, options.removeData);
63
+ console.log(`Removed ${raw}; credentials ${options.removeCredentials ? "deleted" : "retained"}${options.removeData ? ", plugin data deleted" : ", plugin data retained"}.`);
64
+ });
65
+ command.command("connect").argument("<id>", "plugin:<name>").requiredOption("--mcp <server>", "MCP server name").action(async (raw, options) => {
66
+ const store = new AgentPluginStore();
67
+ const id = raw.replace(/^plugin:/, "");
68
+ const plugin = store.get(id);
69
+ if (!plugin || plugin.readiness === "blocked") throw new Error("Plugin is unavailable");
70
+ await savePluginAuthBinding(store, id, options.mcp, { mode: "oauth" });
71
+ const serverId = pluginServerId(id, options.mcp);
72
+ const server = materializePluginServers(plugin, store)[serverId];
73
+ if (!server) throw new Error("MCP server not found");
74
+ const status = await getMcpOAuthManager(server).start({
75
+ serverId,
76
+ rawServer: server
77
+ });
78
+ console.log(JSON.stringify(status, null, 2));
79
+ });
80
+ }
81
+ //#endregion
82
+ export { addAgentPluginLifecycleCommands, installAgentPluginFromCli, isAgentPluginSource };
@@ -1,12 +1,15 @@
1
1
  import { init_paths, resolveExtensionsDir } from "../../config/paths.js";
2
2
  import { init_loader, loadConfig } from "../../config/loader.js";
3
+ import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "../../extensions/lockfile.js";
4
+ import { AgentPluginStore } from "../../extensions/agent-plugins/store.js";
3
5
  import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../../agent/skills/marketplace/adapters/store/store-api-client.js";
4
6
  import { getContextWithOpts } from "../context.js";
5
- import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "../../extensions/lockfile.js";
6
7
  import { peekExtensionManifestFromStoreZip } from "../../extensions/install.js";
7
8
  import { commitStagedExtensionInstall, finalizeStagedExtensionInstall, rollbackStagedExtensionInstall, stageExtensionLocal, stageExtensionNpm, stageExtensionStoreZip } from "../../extensions/install-transaction.js";
8
9
  import { fetchRegistry, findExtension, getExtensionMarketplaceStoreBaseUrl, listExtensions, searchExtensions } from "../../extensions/marketplace.js";
10
+ import { isAgentPluginArchive } from "../../extensions/agent-plugins/sources.js";
9
11
  import { colors } from "../utils/colors.js";
12
+ import { installAgentPluginFromCli, isAgentPluginSource } from "./extension-agent-plugin.js";
10
13
  import { validateExtensionPackageDirectory } from "./extension-pack.js";
11
14
  import { join, resolve } from "node:path";
12
15
  import { existsSync, readFileSync, statSync } from "node:fs";
@@ -135,6 +138,22 @@ async function installExtensionFromStoreWithLock(params) {
135
138
  console.log(colors.cyan("📦"), `Downloading ${params.packageName}@${version} from xopc-store (${params.storeBase})…`);
136
139
  const buf = await downloadExtensionStoreZipBuffer(params.storeBase, downloadUrl);
137
140
  verifyStoreArtifactSha256(buf, sha256);
141
+ if (isAgentPluginArchive(buf)) {
142
+ const installed = await installAgentPluginFromCli(`store:${params.packageName}${params.version ? `@${params.version}` : ""}`, {
143
+ yes: params.yes,
144
+ force: params.force,
145
+ expectedId: params.expectedExtensionId
146
+ });
147
+ if (!installed) return {
148
+ ok: false,
149
+ error: "Install cancelled"
150
+ };
151
+ return {
152
+ ok: true,
153
+ extensionId: `plugin:${installed.id}`,
154
+ version: installed.manifest.version ?? version
155
+ };
156
+ }
138
157
  const actualIntegrity = sha256Integrity(buf);
139
158
  const manifest = peekExtensionManifestFromStoreZip(buf);
140
159
  if (!await confirmInstall({
@@ -206,7 +225,11 @@ async function installExtensionFromStoreWithLock(params) {
206
225
  }
207
226
  }
208
227
  function createExtensionInstallCommand() {
209
- return new Command("install").description("Install extension from xopc-store (store.xopc.ai), npm, or a local directory into ~/.xopc/extensions").argument("<target>", "Explicit source spec: store:<id>, npm:<package>, or a local extension directory").option("-f, --force", "Replace an existing store or local extension with the same manifest id", false).option("-y, --yes", "Skip interactive install confirmation", false).action(async (target, opts) => {
228
+ return new Command("install").description("Install a native extension or portable Agent Plugin from an explicit source").argument("<target>", "store:<id>, npm:<package>, local directory, or Agent Plugin ZIP / HTTPS ZIP URL").option("-f, --force", "Replace an existing store or local extension with the same manifest id", false).option("-y, --yes", "Skip interactive install confirmation", false).action(async (target, opts) => {
229
+ if (isAgentPluginSource(target)) {
230
+ await installAgentPluginFromCli(target, opts);
231
+ return;
232
+ }
210
233
  const cfg = loadConfig(getContextWithOpts().configPath);
211
234
  const targetDir = resolveExtensionsDir();
212
235
  const lock = getExtensionLockfileManager();
@@ -354,14 +377,31 @@ function createExtensionPublishCommand() {
354
377
  });
355
378
  }
356
379
  function createExtensionUpdateCommand() {
357
- return new Command("update").description("Re-install extension(s) from the lockfile (npm or xopc-store) under ~/.xopc/extensions").argument("[extensionId]", "Specific extension id (default: all in lockfile)").action(async (extensionId) => {
380
+ return new Command("update").description("Update installed extensions and Agent Plugins from their recorded sources").argument("[extensionId]", "Specific extension or plugin:<name> (default: all installed)").option("-y, --yes", "Accept changed plugin capabilities").action(async (extensionId, options) => {
381
+ if (extensionId?.startsWith("plugin:")) {
382
+ const id = extensionId.slice(7);
383
+ const receipt = new AgentPluginStore().receipt(id);
384
+ if (!receipt) throw new Error("Plugin not installed");
385
+ await installAgentPluginFromCli(receipt.source, {
386
+ yes: options.yes,
387
+ force: true,
388
+ expectedId: id
389
+ });
390
+ return;
391
+ }
358
392
  const cfg = loadConfig(getContextWithOpts().configPath);
359
393
  const targetDir = resolveExtensionsDir();
360
394
  const storeBase = resolveExtensionsStoreBaseUrl(cfg);
361
395
  const lock = getExtensionLockfileManager();
362
396
  const data = await lock.load();
363
397
  const ids = extensionId?.trim() ? [extensionId.trim()] : Object.keys(data.extensions);
364
- if (ids.length === 0) {
398
+ const plugins = extensionId ? [] : new AgentPluginStore().list();
399
+ for (const plugin of plugins) await installAgentPluginFromCli(plugin.receipt.source, {
400
+ yes: options.yes,
401
+ force: true,
402
+ expectedId: plugin.id
403
+ });
404
+ if (ids.length === 0 && plugins.length === 0) {
365
405
  console.log("No extensions in lockfile.");
366
406
  return;
367
407
  }
@@ -3,13 +3,16 @@ 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
5
  import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
6
+ import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "../../extensions/lockfile.js";
7
+ import { AgentPluginStore } from "../../extensions/agent-plugins/store.js";
6
8
  import { checkEngineCompatibility } from "../../extensions/engine-check.js";
7
9
  import { ExtensionLoader } from "../../extensions/loader.js";
8
10
  import { getContextWithOpts } from "../context.js";
9
- import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "../../extensions/lockfile.js";
10
11
  import { checkAllExtensionsHealth, getExtensionHealthChecker } from "../../extensions/health.js";
11
12
  import { collectExtensionPackageDependencyIssues } from "../../extensions/package-contract.js";
13
+ import { withAgentPluginSource } from "../../extensions/agent-plugins/sources.js";
12
14
  import { colors } from "../utils/colors.js";
15
+ import { addAgentPluginLifecycleCommands, isAgentPluginSource } from "./extension-agent-plugin.js";
13
16
  import { createExtensionCreateCommand } from "./extension-create.js";
14
17
  import { createExtensionDevCommand } from "./extension-dev.js";
15
18
  import { createExtensionPackCommand } from "./extension-pack.js";
@@ -26,7 +29,19 @@ const log = createLogger("ExtensionCommands");
26
29
  function createExtensionListCommand() {
27
30
  return new Command("list").description("List installed extensions").option("--json", "Output as JSON").action(async (options) => {
28
31
  try {
29
- const extensions = await getExtensionLockfileManager().list();
32
+ const extensions = [...(await getExtensionLockfileManager().list()).map((ext) => ({
33
+ ...ext,
34
+ format: "native-extension"
35
+ })), ...new AgentPluginStore().list().map((p) => ({
36
+ name: `plugin:${p.id}`,
37
+ version: p.manifest.version ?? "",
38
+ format: p.format,
39
+ source: "local",
40
+ resolved: p.receipt.source,
41
+ installedAt: p.receipt.installedAt,
42
+ readiness: p.readiness,
43
+ enabled: p.receipt.enabled
44
+ }))];
30
45
  if (options.json) {
31
46
  console.log(JSON.stringify(extensions, null, 2));
32
47
  return;
@@ -62,6 +77,13 @@ function readJson(path) {
62
77
  function createExtensionInspectCommand() {
63
78
  return new Command("inspect").description("Inspect an installed extension manifest and package contract").argument("<extension>", "Extension id").option("--json", "Output as JSON").option("--runtime", "Load the extension and include runtime registrations").action(async (extensionId, options) => {
64
79
  try {
80
+ if (extensionId.startsWith("plugin:") || extensionId.startsWith("store:") || isAgentPluginSource(extensionId)) {
81
+ const store = new AgentPluginStore();
82
+ const result = extensionId.startsWith("plugin:") ? store.get(extensionId.slice(7)) : await withAgentPluginSource(extensionId, loadConfig(getContextWithOpts().configPath), (source) => store.inspect(source));
83
+ if (!result) throw new Error("Plugin not installed");
84
+ console.log(JSON.stringify(result, null, 2));
85
+ return;
86
+ }
65
87
  const lockEntry = await getExtensionLockfileManager().get(extensionId);
66
88
  const extensionDir = join(resolveExtensionsDir(), extensionId);
67
89
  const manifest = readJson(join(extensionDir, "xopc.extension.json")) ?? lockEntry?.manifest;
@@ -188,7 +210,11 @@ function createExtensionVerifyCommand() {
188
210
  return new Command("verify").description("Verify extension integrity").argument("[extension]", "Specific extension to verify (default: all)").action(async (extensionId) => {
189
211
  try {
190
212
  const lockfileManager = getExtensionLockfileManager();
191
- if (extensionId) {
213
+ if (extensionId?.startsWith("plugin:")) {
214
+ const plugin = new AgentPluginStore().get(extensionId.slice(7));
215
+ if (!plugin || plugin.readiness === "blocked") throw new Error("Plugin integrity verification failed");
216
+ console.log(`Verified ${extensionId}`);
217
+ } else if (extensionId) {
192
218
  const result = await lockfileManager.verify(extensionId);
193
219
  if (result.valid) console.log(colors.green("✓"), `Extension "${extensionId}" is valid`);
194
220
  else {
@@ -198,6 +224,11 @@ function createExtensionVerifyCommand() {
198
224
  } else {
199
225
  const results = await lockfileManager.verifyAll();
200
226
  let hasErrors = false;
227
+ for (const plugin of new AgentPluginStore().list()) {
228
+ const valid = plugin.readiness !== "blocked";
229
+ console.log(valid ? colors.green("✓") : colors.red("✗"), `plugin:${plugin.id}`);
230
+ if (!valid) hasErrors = true;
231
+ }
201
232
  for (const result of results) if (result.valid) console.log(colors.green("✓"), result.extensionId);
202
233
  else {
203
234
  console.log(colors.red("✗"), `${result.extensionId}: ${result.reason}`);
@@ -474,6 +505,7 @@ function createExtensionAuditCommand() {
474
505
  function registerExtensionCommands(program) {
475
506
  const extensions = new Command("extensions").description("Manage extensions").addCommand(createExtensionListCommand()).addCommand(createExtensionInspectCommand()).addCommand(createExtensionFreezeCommand()).addCommand(createExtensionHealthCommand()).addCommand(createExtensionVerifyCommand()).addCommand(createExtensionDoctorCommand()).addCommand(createExtensionAuditCommand()).addCommand(createExtensionPackCommand()).addCommand(createExtensionCreateCommand()).addCommand(createExtensionDevCommand()).addCommand(createExtensionInstallCommand()).addCommand(createExtensionSearchCommand()).addCommand(createExtensionPublishCommand()).addCommand(createExtensionUpdateCommand());
476
507
  program.addCommand(extensions);
508
+ addAgentPluginLifecycleCommands(extensions);
477
509
  }
478
510
  //#endregion
479
511
  export { createExtensionAuditCommand, createExtensionDoctorCommand, createExtensionFreezeCommand, createExtensionHealthCommand, createExtensionInspectCommand, createExtensionListCommand, createExtensionVerifyCommand, registerExtensionCommands };
@@ -1,6 +1,6 @@
1
1
  import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
2
- import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
3
2
  import { loadConfig, saveConfig } from "../../config/loader.js";
3
+ import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
4
4
  import { getAllModels, getAvailableModels, getConfiguredProviders, getProviderAuthState, getProviderDisplayName, init_providers, isProviderConfigured, providerSupportsApiKey, providerSupportsOAuth, resolveModel } from "../../providers/index.js";
5
5
  import { formatExamples, register } from "../registry.js";
6
6
  import { getContextWithOpts } from "../context.js";
@@ -1,9 +1,9 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
+ import { resolveEffectiveAgentConfigForSession } from "../config/agent-profile.js";
3
4
  import { COMPUTER_CONTROL_TOOL, ComputerAppSchema, ComputerObservationSchema, ComputerWindowSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
4
5
  import { ComputerServiceLimitsSchema, computerModelProfile, init_model_policy } from "./model-policy.js";
5
6
  import { getApiKey, init_providers, resolveModel } from "../providers/index.js";
6
- import { resolveEffectiveAgentConfigForSession } from "../config/agent-profile.js";
7
7
  import { enterComputerControl, leaveComputerControl } from "./control-guard.js";
8
8
  import { ComputerDiagnosticSchema, ComputerOperationError, computerDiagnostic, computerRecovery } from "./errors.js";
9
9
  import { createComputerModelAdapter, predictComputerStep, readComputerJson } from "./model-adapter.js";