@xopcai/xopc 0.0.396 → 0.0.398

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 (276) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DwTaeL1e.js → agent-avatar-dicebear-Q-lKLSrc.js} +1 -1
  4. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CobxTBV_.js +1 -0
  5. package/dist/gateway/static/root/assets/agents-Bgmmue5K.js +77 -0
  6. package/dist/gateway/static/root/assets/{agents-admin-api-BjGOUrAf.js → agents-admin-api-DvSe10zu.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-B1ApwlFh.js → app-management-settings-panel-CB_W2ano.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-Avd_jVji.js → appearance-settings-B-ppSGBm.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-3qUgsGui.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-C26WGbj9.js → archive-plugin-CeQrQ693.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-T3FSuURJ.js → automations-page-Cc9vZanv.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-workspace-Bc4c_AEq.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-CLaLkM3M.js → binary-plugins-BqaVBv1R.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-CB4oRyM5.js → block-editor-B4ij8nZi.js} +40 -40
  15. package/dist/gateway/static/root/assets/{browser-automation-inputs-0nkk3bLA.js → browser-automation-inputs-DngvcZH9.js} +1 -1
  16. package/dist/gateway/static/root/assets/browser-automations-page-CdqwXyYq.js +3 -0
  17. package/dist/gateway/static/root/assets/browser-settings-page-CJT0rB-I.js +3 -0
  18. package/dist/gateway/static/root/assets/{capabilities-CTfLd_UE.js → capabilities-glv1DeRI.js} +1 -1
  19. package/dist/gateway/static/root/assets/capabilities-page-C56VsP0Y.js +2 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-DZiA8JIq.js +8 -0
  21. package/dist/gateway/static/root/assets/{capability-header-actions-Br5PchG2.js → capability-header-actions-Cu-ATcJq.js} +1 -1
  22. package/dist/gateway/static/root/assets/capability-links--dcwUjgv.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-gIjZtYnV.js +1 -0
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-Cl0hAav9.js → chat-terminal-dock-COdvmTgN.js} +2 -2
  25. package/dist/gateway/static/root/assets/computer-settings-page-C1XHsuI8.js +1 -0
  26. package/dist/gateway/static/root/assets/{connector-service-page-AqsoqTnF.js → connector-service-page-Cv2bhnQ5.js} +1 -1
  27. package/dist/gateway/static/root/assets/connectors-page-SmKItq0N.js +1 -0
  28. package/dist/gateway/static/root/assets/{date-picker-CyFehuto.js → date-picker-CCnqYwy0.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-Vu_5QGGJ.js → dependency-picker-nt5ruIio.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-Dw9k0Z2p.js → desktop-pet-Bn8xj1v3.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-DKqkhvxu.js → desktop-pet-settings-Cbl1J_VE.js} +1 -1
  32. package/dist/gateway/static/root/assets/{device-pairing-wizard-4l4ESMon.js → device-pairing-wizard-Tadg9co1.js} +1 -1
  33. package/dist/gateway/static/root/assets/{directory-picker-path-field-7svbL2tR.js → directory-picker-path-field-DuE5ez1E.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-CFa6PCBV.js → extension-debug-page-jsNxwqNi.js} +1 -1
  35. package/dist/gateway/static/root/assets/extension-page-N_rBjYX8.js +1 -0
  36. package/dist/gateway/static/root/assets/extension-settings-page-7qAdvlRB.js +1 -0
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-Di9g6pE8.js → gateway-config-swr-DAir1JsW.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-realtime-2-o7qk92.js → gateway-realtime-dE0XrVAT.js} +1 -1
  39. package/dist/gateway/static/root/assets/gateway-realtime-store-CPlVuu0d.js +1 -0
  40. package/dist/gateway/static/root/assets/gateway-settings-ViqOhx_m.js +1 -0
  41. package/dist/gateway/static/root/assets/{gateway-startup-retry-BCUswcVy.js → gateway-startup-retry-CqyGHM2M.js} +1 -1
  42. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DzEeyJpH.js → highlighted-body-KQOG7T2V-XrkWdmrk.js} +1 -1
  43. package/dist/gateway/static/root/assets/home-page-C_Xn_Kkz.js +2 -0
  44. package/dist/gateway/static/root/assets/{image-generation-api-Zo56ZmKs.js → image-generation-api-CmHdM2uL.js} +1 -1
  45. package/dist/gateway/static/root/assets/{imports-page-C_PPaOFv.js → imports-page-B-dnvHP_.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-DWzv8ZoO.css +1 -0
  47. package/dist/gateway/static/root/assets/{index-XRbEWVyZ.js → index-DvKDT-RQ.js} +116 -116
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BGtrzFT6.js → keyboard-shortcuts-settings-mCs9cDgv.js} +1 -1
  49. package/dist/gateway/static/root/assets/{local-app-workbench-page-Cu80fCA0.js → local-app-workbench-page-B7AtlfWQ.js} +1 -1
  50. package/dist/gateway/static/root/assets/{local-apps-page-Zsu8FnwP.js → local-apps-page-CIJE7jME.js} +1 -1
  51. package/dist/gateway/static/root/assets/{local-session-drafts-BjwlkAKA.js → local-session-drafts-fhip41-L.js} +1 -1
  52. package/dist/gateway/static/root/assets/{locale-store-Djl2FW6_.js → locale-store-Jnhw2WMv.js} +1 -1
  53. package/dist/gateway/static/root/assets/{logs-page-DlIhfEW_.js → logs-page-HawXUKF2.js} +2 -2
  54. package/dist/gateway/static/root/assets/management-settings-DByEh6rq.js +1 -0
  55. package/dist/gateway/static/root/assets/{markdown-view-DyO7Q0Ms.js → markdown-view-B58RypQ4.js} +1 -1
  56. package/dist/gateway/static/root/assets/{media-plugins-Ba1_QMmZ.js → media-plugins-B8BLxQgj.js} +1 -1
  57. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CZjPT7xE.js +1 -0
  58. package/dist/gateway/static/root/assets/messages-DBvKzlCl.js +3 -0
  59. package/dist/gateway/static/root/assets/note-detail-panel-hQHB5fCs.js +5 -0
  60. package/dist/gateway/static/root/assets/notes-page-BEusEk31.js +8 -0
  61. package/dist/gateway/static/root/assets/{page-context-capture-button-BqNWtf_f.js → page-context-capture-button-42bq8N6-.js} +1 -1
  62. package/dist/gateway/static/root/assets/personal-page-DPR5gzhf.js +1 -0
  63. package/dist/gateway/static/root/assets/plugin-details-dialog-D8dKKIY9.js +1 -0
  64. package/dist/gateway/static/root/assets/plugin-presentation-BrQpVvjC.js +1 -0
  65. package/dist/gateway/static/root/assets/{preview-open-alternatives-kkbrbiVd.js → preview-open-alternatives-DKyLVLpX.js} +1 -1
  66. package/dist/gateway/static/root/assets/{product-open-page-Dheqo_4J.js → product-open-page-DcGH0AXN.js} +1 -1
  67. package/dist/gateway/static/root/assets/{product-preview-content-B9Y6dIuh.js → product-preview-content-Ck6OzP09.js} +1 -1
  68. package/dist/gateway/static/root/assets/project-detail-page-BHoQ10Eo.js +1 -0
  69. package/dist/gateway/static/root/assets/projects-page-DYsq_OLJ.js +1 -0
  70. package/dist/gateway/static/root/assets/{registry-api-BwR2CiR5.js → registry-api-BbUEMGcj.js} +1 -1
  71. package/dist/gateway/static/root/assets/remote-access-hub-CU3EChY0.js +1 -0
  72. package/dist/gateway/static/root/assets/{runtime-tools-api-C_VOMhLI.js → runtime-tools-api-D0xtCTXr.js} +1 -1
  73. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BjyZGNP3.js → runtime-tools-settings-panel-Bfs5zKDg.js} +1 -1
  74. package/dist/gateway/static/root/assets/{schema-form-DelMOLjg.js → schema-form-BbI2BuSU.js} +1 -1
  75. package/dist/gateway/static/root/assets/{session-api-DbNNQps9.js → session-api-CAKgrbgz.js} +1 -1
  76. package/dist/gateway/static/root/assets/{session-manager-DfVviLTK.js → session-manager-D_N7qha7.js} +1 -1
  77. package/dist/gateway/static/root/assets/sessions-page-CjB2GOTs.js +1 -0
  78. package/dist/gateway/static/root/assets/settings-advanced-gate-jbVx8gcF.js +1 -0
  79. package/dist/gateway/static/root/assets/{settings-form-section-DNWEDA71.js → settings-form-section-BfBBJlr-.js} +1 -1
  80. package/dist/gateway/static/root/assets/{settings-page-DJ27gC7J.js → settings-page-9yu4SN1j.js} +1 -1
  81. package/dist/gateway/static/root/assets/setup-status-panel-DhWB3feW.js +1 -0
  82. package/dist/gateway/static/root/assets/{share-preview-page-Du4mumVM.js → share-preview-page-B6lQl5xb.js} +1 -1
  83. package/dist/gateway/static/root/assets/shares-settings-UJGjdz3F.js +1 -0
  84. package/dist/gateway/static/root/assets/{skill-api-zOxHjU7m.js → skill-api-y2m3k_R4.js} +1 -1
  85. package/dist/gateway/static/root/assets/skill-reload-api-Bk9FqsVa.js +1 -0
  86. package/dist/gateway/static/root/assets/skills-page-DLd4O-Fo.js +2 -0
  87. package/dist/gateway/static/root/assets/{style-DsnKw5jo.js → style-C2ptQg95.js} +1 -1
  88. package/dist/gateway/static/root/assets/{system-settings-panel-mz9hWo_H.js → system-settings-panel-DYzcLnVk.js} +1 -1
  89. package/dist/gateway/static/root/assets/task-detail-page-DLGtmHAH.js +2 -0
  90. package/dist/gateway/static/root/assets/{task-expandable-content-D3i_51Oc.js → task-expandable-content-HdEeV_0-.js} +1 -1
  91. package/dist/gateway/static/root/assets/{tracing-settings-page-aC-ziRbY.js → tracing-settings-page-DKQYmzFn.js} +1 -1
  92. package/dist/gateway/static/root/assets/{tunnel-api-Ch2Veztk.js → tunnel-api-C2VY_HTy.js} +1 -1
  93. package/dist/gateway/static/root/assets/usage-page-CjzunQtj.js +1 -0
  94. package/dist/gateway/static/root/assets/{use-autosave-BLW3t_OK.js → use-autosave-BElgnGMt.js} +1 -1
  95. package/dist/gateway/static/root/assets/user-model-page-DsOGCDTR.js +2 -0
  96. package/dist/gateway/static/root/assets/{voice-api-key-field-DulF6Cm4.js → voice-api-key-field-FVjX0qhn.js} +1 -1
  97. package/dist/gateway/static/root/assets/{voice-config-api-Ceo_hqZC.js → voice-config-api-T3nM4buh.js} +1 -1
  98. package/dist/gateway/static/root/assets/{work-discovery-overlay-bBMZM8tN.js → work-discovery-overlay-B2S2NZuK.js} +1 -1
  99. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CsxXS1WI.js → workflow-run-setup-panel-2Gq34KQk.js} +2 -2
  100. package/dist/gateway/static/root/assets/workflows-page-CjeFD3mk.js +6 -0
  101. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-wwIRBFCs.js → xopc-cloud-account-card-BZMIZxWg.js} +1 -1
  102. package/dist/gateway/static/root/index.html +15 -15
  103. package/dist/package.js +1 -1
  104. package/dist/src/agent/agent-manager.d.ts +8 -0
  105. package/dist/src/agent/agent-manager.js +3 -3
  106. package/dist/src/agent/background-review/run-background-review.js +1 -1
  107. package/dist/src/agent/embedded/codemode-extension.d.ts +1 -0
  108. package/dist/src/agent/embedded/codemode-extension.js +6 -1
  109. package/dist/src/agent/embedded/run-for-session.js +1 -1
  110. package/dist/src/agent/embedded/run-turn.js +34 -2
  111. package/dist/src/agent/embedded/session-runner.js +1 -1
  112. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  113. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  114. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  115. package/dist/src/agent/mcp/config.d.ts +2 -0
  116. package/dist/src/agent/mcp/config.js +2 -2
  117. package/dist/src/agent/mcp/connection-setup.js +13 -1
  118. package/dist/src/agent/mcp/effective-server.d.ts +3 -0
  119. package/dist/src/agent/mcp/effective-server.js +27 -0
  120. package/dist/src/agent/mcp/native-mcp.d.ts +1 -1
  121. package/dist/src/agent/mcp/native-mcp.js +13 -4
  122. package/dist/src/agent/mcp/tool-catalog.js +2 -1
  123. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  124. package/dist/src/agent/service.js +2 -2
  125. package/dist/src/agent/skills/index.d.ts +1 -0
  126. package/dist/src/agent/skills/index.js +7 -3
  127. package/dist/src/agent/skills/managed-store.js +1 -1
  128. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  129. package/dist/src/agent/skills/skill-manager.d.ts +1 -0
  130. package/dist/src/agent/skills/skill-manager.js +6 -1
  131. package/dist/src/agent/skills/skill-sources.d.ts +1 -0
  132. package/dist/src/agent/skills/skill-sources.js +4 -3
  133. package/dist/src/agent/skills/types.d.ts +1 -0
  134. package/dist/src/agent/tools/factory.js +1 -1
  135. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  136. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  137. package/dist/src/agent/workspace-runtime/registry.js +7 -3
  138. package/dist/src/agent-catalog/capabilities.js +2 -2
  139. package/dist/src/automations/capabilities/drafts.js +1 -1
  140. package/dist/src/automations/service/action-executor.js +2 -2
  141. package/dist/src/bootstrap/application-state.js +1 -1
  142. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  143. package/dist/src/capabilities/runtime/product.js +1 -1
  144. package/dist/src/chat-commands/agent-edit.js +1 -1
  145. package/dist/src/cli/commands/agent.js +1 -1
  146. package/dist/src/cli/commands/agents.js +1 -1
  147. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  148. package/dist/src/cli/commands/extension-agent-plugin.js +92 -7
  149. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  150. package/dist/src/cli/commands/extension.js +1 -1
  151. package/dist/src/cli/commands/mcp.js +6 -4
  152. package/dist/src/cli/commands/models.js +1 -1
  153. package/dist/src/cli/commands/onboard/model.js +1 -1
  154. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  155. package/dist/src/config/agent-model-intents.js +1 -1
  156. package/dist/src/config/agent-profile.js +2 -2
  157. package/dist/src/config/loader.js +1 -1
  158. package/dist/src/config/models-json.js +1 -1
  159. package/dist/src/config/schema.js +2 -2
  160. package/dist/src/extensions/agent-plugins/auth.d.ts +7 -1
  161. package/dist/src/extensions/agent-plugins/auth.js +53 -12
  162. package/dist/src/extensions/agent-plugins/branding.d.ts +12 -0
  163. package/dist/src/extensions/agent-plugins/branding.js +54 -0
  164. package/dist/src/extensions/agent-plugins/cli-authorization.d.ts +33 -0
  165. package/dist/src/extensions/agent-plugins/cli-authorization.js +203 -0
  166. package/dist/src/extensions/agent-plugins/connection-reuse.d.ts +10 -0
  167. package/dist/src/extensions/agent-plugins/connection-reuse.js +23 -0
  168. package/dist/src/extensions/agent-plugins/credentials.js +24 -1
  169. package/dist/src/extensions/agent-plugins/formats.d.ts +27 -0
  170. package/dist/src/extensions/agent-plugins/formats.js +208 -0
  171. package/dist/src/extensions/agent-plugins/inventory.d.ts +154 -2
  172. package/dist/src/extensions/agent-plugins/inventory.js +40 -5
  173. package/dist/src/extensions/agent-plugins/mcp-adapter.d.ts +2 -1
  174. package/dist/src/extensions/agent-plugins/mcp-adapter.js +42 -8
  175. package/dist/src/extensions/agent-plugins/mcp-format.d.ts +2 -0
  176. package/dist/src/extensions/agent-plugins/mcp-format.js +82 -0
  177. package/dist/src/extensions/agent-plugins/resources.d.ts +14 -0
  178. package/dist/src/extensions/agent-plugins/resources.js +112 -0
  179. package/dist/src/extensions/agent-plugins/setup-contract.d.ts +74 -0
  180. package/dist/src/extensions/agent-plugins/setup-contract.js +77 -0
  181. package/dist/src/extensions/agent-plugins/setup.d.ts +127 -0
  182. package/dist/src/extensions/agent-plugins/setup.js +496 -0
  183. package/dist/src/extensions/agent-plugins/skill-catalog.d.ts +14 -0
  184. package/dist/src/extensions/agent-plugins/skill-catalog.js +95 -0
  185. package/dist/src/extensions/agent-plugins/source-catalog.d.ts +21 -0
  186. package/dist/src/extensions/agent-plugins/source-catalog.js +175 -0
  187. package/dist/src/extensions/agent-plugins/sources.d.ts +1 -1
  188. package/dist/src/extensions/agent-plugins/sources.js +12 -3
  189. package/dist/src/extensions/agent-plugins/store.d.ts +33 -2
  190. package/dist/src/extensions/agent-plugins/store.js +175 -25
  191. package/dist/src/extensions/agent-plugins/user-config.d.ts +5 -0
  192. package/dist/src/extensions/agent-plugins/user-config.js +49 -0
  193. package/dist/src/extensions/agent-plugins/validation.d.ts +26 -1
  194. package/dist/src/extensions/agent-plugins/validation.js +143 -28
  195. package/dist/src/gateway/agents-admin.js +2 -2
  196. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  197. package/dist/src/gateway/hono/routes/agent-plugins.js +121 -10
  198. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  199. package/dist/src/gateway/hono/routes/composer-history.js +22 -4
  200. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  201. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  202. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  203. package/dist/src/gateway/hono/routes/mcp.js +6 -4
  204. package/dist/src/gateway/hono/routes/notes.js +2 -2
  205. package/dist/src/gateway/hono/routes/projects.js +2 -2
  206. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  207. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  208. package/dist/src/gateway/image-generation-setup.js +1 -1
  209. package/dist/src/gateway/lock.js +1 -1
  210. package/dist/src/gateway/service/marketplace-service.js +4 -2
  211. package/dist/src/gateway/service.js +8 -6
  212. package/dist/src/gateway/session-context-summary.js +1 -1
  213. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  214. package/dist/src/home-intelligence/host.js +2 -2
  215. package/dist/src/local-apps/service.js +1 -1
  216. package/dist/src/personal-agent/proactivity/service.js +1 -1
  217. package/dist/src/personal-agent/service.js +2 -2
  218. package/dist/src/providers/model-catalog-persistence.js +1 -1
  219. package/dist/src/routing/resolve-route.js +1 -1
  220. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  221. package/dist/src/storage/sqlite/composer-input-history-repository.d.ts +4 -3
  222. package/dist/src/storage/sqlite/composer-input-history-repository.js +10 -8
  223. package/dist/src/storage/sqlite/migrations/257_session_composer_history.sql +11 -0
  224. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  225. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  226. package/dist/src/storage/sqlite/schema.js +1 -1
  227. package/dist/src/tasks/capabilities/read.js +2 -2
  228. package/dist/src/tasks/capabilities/write.js +1 -1
  229. package/dist/src/tasks/task-handoff-service.js +1 -1
  230. package/dist/src/tui/backends/embedded-backend.d.ts +2 -2
  231. package/dist/src/tui/backends/embedded-backend.js +6 -6
  232. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +2 -2
  233. package/dist/src/tui/backends/gateway-realtime-backend.js +7 -4
  234. package/dist/src/tui/composer-history.d.ts +14 -0
  235. package/dist/src/tui/composer-history.js +85 -0
  236. package/dist/src/tui/tui-backend.d.ts +4 -3
  237. package/dist/src/tui/tui.js +19 -46
  238. package/dist/src/voice/realtime/persona-context.js +1 -1
  239. package/package.json +12 -4
  240. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D8Q9Cpge.js +0 -1
  241. package/dist/gateway/static/root/assets/agent-plugin-dialog-C-UKhDkS.js +0 -1
  242. package/dist/gateway/static/root/assets/agents-DOv68iBN.js +0 -77
  243. package/dist/gateway/static/root/assets/apps-page-Da6Ar2U3.js +0 -1
  244. package/dist/gateway/static/root/assets/automations-workspace-B9r27rPk.js +0 -6
  245. package/dist/gateway/static/root/assets/browser-automations-page-KLG8IXvl.js +0 -3
  246. package/dist/gateway/static/root/assets/browser-settings-page-Tcejw5fF.js +0 -3
  247. package/dist/gateway/static/root/assets/capabilities-page-BJlw9rhA.js +0 -2
  248. package/dist/gateway/static/root/assets/capabilities-settings-panel-kEvUR6Yu.js +0 -8
  249. package/dist/gateway/static/root/assets/channels-DRaE6_ub.js +0 -1
  250. package/dist/gateway/static/root/assets/computer-settings-page-B6JI2S1b.js +0 -1
  251. package/dist/gateway/static/root/assets/connectors-page-cDRZ8bqm.js +0 -1
  252. package/dist/gateway/static/root/assets/extension-page-BD4nZ9sf.js +0 -1
  253. package/dist/gateway/static/root/assets/extension-settings-page-CxPIMrmn.js +0 -1
  254. package/dist/gateway/static/root/assets/gateway-realtime-store-DQ6-whg-.js +0 -1
  255. package/dist/gateway/static/root/assets/gateway-settings-Da2CtQ7c.js +0 -1
  256. package/dist/gateway/static/root/assets/home-page-Cp4-sTfX.js +0 -2
  257. package/dist/gateway/static/root/assets/index-zIgp-ZTu.css +0 -1
  258. package/dist/gateway/static/root/assets/management-settings-CDV-xItG.js +0 -1
  259. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CpK57Kgp.js +0 -1
  260. package/dist/gateway/static/root/assets/messages-DPxcWxfD.js +0 -3
  261. package/dist/gateway/static/root/assets/note-detail-panel-BXi6BrXd.js +0 -5
  262. package/dist/gateway/static/root/assets/notes-page-ClR9R90o.js +0 -8
  263. package/dist/gateway/static/root/assets/personal-page-CSF-sn8w.js +0 -1
  264. package/dist/gateway/static/root/assets/project-detail-page-l5dXxnSq.js +0 -1
  265. package/dist/gateway/static/root/assets/projects-page-95Od8gLy.js +0 -1
  266. package/dist/gateway/static/root/assets/remote-access-hub-DPEpPFax.js +0 -1
  267. package/dist/gateway/static/root/assets/sessions-page-BN0nMm0w.js +0 -1
  268. package/dist/gateway/static/root/assets/settings-advanced-gate-BvfEKyfy.js +0 -1
  269. package/dist/gateway/static/root/assets/setup-status-panel-BWA_puDN.js +0 -1
  270. package/dist/gateway/static/root/assets/shares-settings-C0ixka9_.js +0 -1
  271. package/dist/gateway/static/root/assets/skill-reload-api-743oJIiS.js +0 -1
  272. package/dist/gateway/static/root/assets/skills-page-DBYhEjP9.js +0 -2
  273. package/dist/gateway/static/root/assets/task-detail-page-Brp2wrEc.js +0 -2
  274. package/dist/gateway/static/root/assets/usage-page-KfKZ2a3t.js +0 -1
  275. package/dist/gateway/static/root/assets/user-model-page-BSsT8WjA.js +0 -2
  276. package/dist/gateway/static/root/assets/workflows-page-a-mfjQ2h.js +0 -6
@@ -1,15 +1,79 @@
1
- import { type InstalledAgentPlugin } from './store.js';
2
- export declare function agentPluginInventoryRow(plugin: InstalledAgentPlugin): {
1
+ import { AgentPluginStore, type InstalledAgentPlugin } from './store.js';
2
+ export declare function agentPluginInventoryRow(plugin: InstalledAgentPlugin, store?: AgentPluginStore): {
3
3
  components: {
4
4
  skills: {
5
5
  name: string;
6
6
  }[];
7
7
  mcp: {
8
+ connectionAuth?: {
9
+ mode: "none" | "oauth" | "api-key";
10
+ headerName?: string;
11
+ prefix?: string;
12
+ };
8
13
  name: string;
9
14
  id: string;
10
15
  type: "stdio" | "streamable-http";
11
16
  }[];
12
17
  };
18
+ installationSource: string;
19
+ resolvedCommit: string;
20
+ dialect: import("./formats.js").PluginDialect;
21
+ verification: string;
22
+ compatibility: import("./formats.js").CompatibilityItem[];
23
+ workspacePaths: string[];
24
+ setup: {
25
+ authorizations: {
26
+ id: string;
27
+ title: string;
28
+ servers: string[];
29
+ methods: ({
30
+ type: "oauth";
31
+ server: string;
32
+ id: string;
33
+ title: string;
34
+ instructions: string[];
35
+ helpUrl?: string;
36
+ } | {
37
+ type: "form";
38
+ fields: string[];
39
+ id: string;
40
+ title: string;
41
+ instructions: string[];
42
+ helpUrl?: string;
43
+ } | {
44
+ type: "cli";
45
+ fields: string[];
46
+ login: {
47
+ command: string;
48
+ args: string[];
49
+ env: Record<string, string>;
50
+ cwd?: string;
51
+ };
52
+ check: {
53
+ command: string;
54
+ args: string[];
55
+ env: Record<string, string>;
56
+ cwd?: string;
57
+ };
58
+ timeoutSeconds: number;
59
+ id: string;
60
+ title: string;
61
+ instructions: string[];
62
+ helpUrl?: string;
63
+ })[];
64
+ description?: string;
65
+ }[];
66
+ userConfig: {
67
+ [k: string]: {
68
+ default: string | number | boolean;
69
+ type: "string" | "number" | "boolean";
70
+ title: string;
71
+ required: boolean;
72
+ sensitive: boolean;
73
+ };
74
+ };
75
+ tasks: string[];
76
+ };
13
77
  diagnostics: import("./validation.js").PluginDiagnostic[];
14
78
  provenance?: {
15
79
  kind: "store";
@@ -30,8 +94,20 @@ export declare function agentPluginInventoryRow(plugin: InstalledAgentPlugin): {
30
94
  version: string;
31
95
  description: string;
32
96
  source: string;
97
+ localizations: {
98
+ [k: string]: {
99
+ description?: string;
100
+ displayName: string;
101
+ };
102
+ };
103
+ branding: {
104
+ iconUrl: string;
105
+ iconSha256: string;
106
+ };
33
107
  active: boolean;
34
108
  activationEligible: boolean;
109
+ installationState: string;
110
+ authorizationStatus: string;
35
111
  readiness: "ready" | "blocked" | "degraded" | "setup_required";
36
112
  hasUi: boolean;
37
113
  hasConfigSchema: boolean;
@@ -43,11 +119,75 @@ export declare function listAgentPluginInventory(): {
43
119
  name: string;
44
120
  }[];
45
121
  mcp: {
122
+ connectionAuth?: {
123
+ mode: "none" | "oauth" | "api-key";
124
+ headerName?: string;
125
+ prefix?: string;
126
+ };
46
127
  name: string;
47
128
  id: string;
48
129
  type: "stdio" | "streamable-http";
49
130
  }[];
50
131
  };
132
+ installationSource: string;
133
+ resolvedCommit: string;
134
+ dialect: import("./formats.js").PluginDialect;
135
+ verification: string;
136
+ compatibility: import("./formats.js").CompatibilityItem[];
137
+ workspacePaths: string[];
138
+ setup: {
139
+ authorizations: {
140
+ id: string;
141
+ title: string;
142
+ servers: string[];
143
+ methods: ({
144
+ type: "oauth";
145
+ server: string;
146
+ id: string;
147
+ title: string;
148
+ instructions: string[];
149
+ helpUrl?: string;
150
+ } | {
151
+ type: "form";
152
+ fields: string[];
153
+ id: string;
154
+ title: string;
155
+ instructions: string[];
156
+ helpUrl?: string;
157
+ } | {
158
+ type: "cli";
159
+ fields: string[];
160
+ login: {
161
+ command: string;
162
+ args: string[];
163
+ env: Record<string, string>;
164
+ cwd?: string;
165
+ };
166
+ check: {
167
+ command: string;
168
+ args: string[];
169
+ env: Record<string, string>;
170
+ cwd?: string;
171
+ };
172
+ timeoutSeconds: number;
173
+ id: string;
174
+ title: string;
175
+ instructions: string[];
176
+ helpUrl?: string;
177
+ })[];
178
+ description?: string;
179
+ }[];
180
+ userConfig: {
181
+ [k: string]: {
182
+ default: string | number | boolean;
183
+ type: "string" | "number" | "boolean";
184
+ title: string;
185
+ required: boolean;
186
+ sensitive: boolean;
187
+ };
188
+ };
189
+ tasks: string[];
190
+ };
51
191
  diagnostics: import("./validation.js").PluginDiagnostic[];
52
192
  provenance?: {
53
193
  kind: "store";
@@ -68,8 +208,20 @@ export declare function listAgentPluginInventory(): {
68
208
  version: string;
69
209
  description: string;
70
210
  source: string;
211
+ localizations: {
212
+ [k: string]: {
213
+ description?: string;
214
+ displayName: string;
215
+ };
216
+ };
217
+ branding: {
218
+ iconUrl: string;
219
+ iconSha256: string;
220
+ };
71
221
  active: boolean;
72
222
  activationEligible: boolean;
223
+ installationState: string;
224
+ authorizationStatus: string;
73
225
  readiness: "ready" | "blocked" | "degraded" | "setup_required";
74
226
  hasUi: boolean;
75
227
  hasConfigSchema: boolean;
@@ -1,17 +1,36 @@
1
+ import { pluginAuthorizations } from "./setup-contract.js";
1
2
  import { pluginServerId } from "./validation.js";
2
3
  import { AgentPluginStore } from "./store.js";
4
+ import { pluginBranding, pluginLocalizations } from "./branding.js";
5
+ import { join } from "node:path";
6
+ import { existsSync, readFileSync } from "node:fs";
3
7
  //#region src/extensions/agent-plugins/inventory.ts
4
- function agentPluginInventoryRow(plugin) {
8
+ function agentPluginInventoryRow(plugin, store = new AgentPluginStore()) {
9
+ const setupPath = join(store.stateDir, "plugin-setup", `${plugin.id}.json`);
10
+ let saved;
11
+ try {
12
+ saved = existsSync(setupPath) ? JSON.parse(readFileSync(setupPath, "utf8")) : void 0;
13
+ } catch {}
14
+ const job = saved?.packageRevision === plugin.receipt.revision ? saved : void 0;
15
+ let authorizations = [];
16
+ try {
17
+ authorizations = pluginAuthorizations(plugin.manifest);
18
+ } catch {}
19
+ const needsAuthorization = !!job && ((job.missingConfig?.length ?? 0) > 0 || job.connections?.some((value) => value.state !== "connected") || job.authorizations?.some((value) => value.state !== "connected" || !!value.issues?.length));
5
20
  return {
6
21
  id: `plugin:${plugin.id}`,
7
22
  pluginId: plugin.id,
8
23
  format: plugin.format,
9
24
  name: plugin.manifest.name,
10
- version: plugin.manifest.version,
25
+ version: plugin.manifest.version ?? plugin.receipt.provenance?.version,
11
26
  description: plugin.manifest.description,
12
27
  source: "agent-plugin",
13
- active: plugin.receipt.enabled && plugin.readiness !== "blocked",
28
+ localizations: pluginLocalizations(plugin.manifest),
29
+ branding: pluginBranding(plugin.rootDir, plugin.manifest),
30
+ active: plugin.receipt.enabled && plugin.readiness !== "blocked" && plugin.readiness !== "setup_required",
14
31
  activationEligible: plugin.receipt.enabled,
32
+ installationState: job?.installed || job?.state === "completed" ? "installed" : job ? "preparing" : "installed",
33
+ authorizationStatus: needsAuthorization ? "required" : job?.connections?.length || authorizations.length ? "connected" : "not_required",
15
34
  readiness: plugin.readiness,
16
35
  hasUi: false,
17
36
  hasConfigSchema: false,
@@ -22,14 +41,30 @@ function agentPluginInventoryRow(plugin) {
22
41
  mcp: Object.entries(plugin.servers).map(([name, server]) => ({
23
42
  name,
24
43
  id: pluginServerId(plugin.id, name),
25
- type: server.type
44
+ type: server.type,
45
+ ...server.type !== "stdio" ? { connectionAuth: server.connectionAuth } : {}
26
46
  }))
27
47
  },
48
+ installationSource: plugin.receipt.source,
49
+ resolvedCommit: plugin.receipt.resolvedCommit,
50
+ dialect: plugin.layout?.dialect ?? "portable",
51
+ verification: "unverified",
52
+ compatibility: plugin.layout?.compatibility ?? [],
53
+ workspacePaths: plugin.receipt.workspacePaths ?? null,
54
+ setup: {
55
+ authorizations,
56
+ userConfig: Object.fromEntries(Object.entries(plugin.layout?.userConfig ?? {}).map(([key, field]) => [key, {
57
+ ...field,
58
+ default: field.sensitive ? void 0 : field.default
59
+ }])),
60
+ tasks: plugin.layout?.tasks ?? []
61
+ },
28
62
  diagnostics: plugin.diagnostics
29
63
  };
30
64
  }
31
65
  function listAgentPluginInventory() {
32
- return new AgentPluginStore().list().map(agentPluginInventoryRow);
66
+ const store = new AgentPluginStore();
67
+ return store.list().map((plugin) => agentPluginInventoryRow(plugin, store));
33
68
  }
34
69
  //#endregion
35
70
  export { agentPluginInventoryRow, listAgentPluginInventory };
@@ -1,3 +1,4 @@
1
1
  import { AgentPluginStore, type InstalledAgentPlugin } from './store.js';
2
2
  import { type PluginDiagnostic } from './validation.js';
3
- export declare function materializePluginServers(plugin: InstalledAgentPlugin, store?: AgentPluginStore, diagnostics?: PluginDiagnostic[]): Record<string, Record<string, unknown>>;
3
+ export declare function pluginOAuthCredentialId(pluginId: string, revision: string, serverName: string): string;
4
+ export declare function materializePluginServers(plugin: InstalledAgentPlugin, store?: AgentPluginStore, diagnostics?: PluginDiagnostic[], setup?: boolean): Record<string, Record<string, unknown>>;
@@ -1,13 +1,37 @@
1
1
  import { containedPath, expandPluginVariables, pluginServerId, resolvePluginCwd } from "./validation.js";
2
2
  import { AgentPluginStore } from "./store.js";
3
3
  import { applyPluginAuthBinding, readPluginAuthBinding } from "./auth.js";
4
- import { resolve } from "node:path";
4
+ import { expandUserConfig, readPluginUserConfig } from "./user-config.js";
5
+ import { homedir } from "node:os";
6
+ import { join, resolve } from "node:path";
7
+ import { existsSync, mkdirSync, readFileSync } from "node:fs";
8
+ import { createHash } from "node:crypto";
5
9
  //#region src/extensions/agent-plugins/mcp-adapter.ts
6
- function materializePluginServers(plugin, store = new AgentPluginStore(), diagnostics = []) {
10
+ function pluginOAuthCredentialId(pluginId, revision, serverName) {
11
+ return `mcp_draft_${createHash("sha256").update(JSON.stringify([
12
+ "plugin",
13
+ pluginId,
14
+ revision,
15
+ serverName
16
+ ])).digest("hex").slice(0, 32)}`;
17
+ }
18
+ function materializePluginServers(plugin, store = new AgentPluginStore(), diagnostics = [], setup = false) {
7
19
  const root = plugin.rootDir;
8
20
  const data = store.dataDir(plugin.id);
21
+ mkdirSync(data, {
22
+ recursive: true,
23
+ mode: 448
24
+ });
25
+ const values = {
26
+ ...Object.fromEntries(Object.entries(plugin.layout?.userConfig ?? {}).filter(([, field]) => field.default !== void 0).map(([key, field]) => [key, field.default])),
27
+ ...readPluginUserConfig(store, plugin.id, plugin.receipt.revision)
28
+ };
29
+ const expand = (value) => expandUserConfig(expandPluginVariables(value.replace(/\$\{PLUGIN_ACCOUNTS\}/g, join(data, "accounts", plugin.receipt.revision)).replace(/\$\{PLUGIN_RESOURCES\}/g, join(data, "resources", plugin.receipt.revision)), root, data), values);
9
30
  const servers = Object.create(null);
31
+ const setupPath = join(store.stateDir, "plugin-setup", `${plugin.id}.json`);
32
+ const job = !setup && existsSync(setupPath) ? JSON.parse(readFileSync(setupPath, "utf8")) : void 0;
10
33
  for (const [name, server] of Object.entries(plugin.servers)) try {
34
+ if (job?.packageRevision === plugin.receipt.revision && (job.state !== "completed" && !job.installed || job.connections.find((c) => c.name === name)?.state !== "connected")) continue;
11
35
  const origin = {
12
36
  id: plugin.id,
13
37
  serverName: name,
@@ -17,20 +41,30 @@ function materializePluginServers(plugin, store = new AgentPluginStore(), diagno
17
41
  };
18
42
  const raw = server.type !== "stdio" ? {
19
43
  ...server,
44
+ ...plugin.receipt.credentialScope === "revision" ? { xopcOAuthCredentialId: pluginOAuthCredentialId(plugin.id, plugin.receipt.revision, name) } : {},
45
+ ...server.headers ? { headers: Object.fromEntries(Object.entries(server.headers).map(([key, value]) => [key, expand(value)])) } : {},
20
46
  xopcPlugin: origin
21
47
  } : {
22
48
  type: "stdio",
23
49
  xopcPlugin: origin,
24
- command: server.command.startsWith("./") ? containedPath(root, resolve(root, server.command)) : server.command,
25
- args: server.args?.map((value) => expandPluginVariables(value, root, data)),
50
+ command: server.command.startsWith("./") ? containedPath(root, resolve(root, server.command)) : server.command.startsWith("${PLUGIN_RESOURCES}/") ? containedPath(data, join(data, "resources", plugin.receipt.revision, server.command.slice(20))) : server.command,
51
+ args: server.args?.map((value) => {
52
+ const expanded = expand(value);
53
+ if (typeof expanded !== "string") throw new Error("Sensitive arguments are not supported; use environment variables");
54
+ return expanded;
55
+ }),
26
56
  env: {
27
- ...Object.fromEntries(Object.entries(server.env ?? {}).map(([key, value]) => [key, expandPluginVariables(value, root, data)])),
57
+ ...Object.fromEntries(Object.entries(server.env ?? {}).map(([key, value]) => [key, expand(value)])),
58
+ PLUGIN_HOST_HOME: homedir(),
28
59
  PLUGIN_ROOT: root,
29
- PLUGIN_DATA: data
60
+ PLUGIN_DATA: data,
61
+ PLUGIN_RESOURCES: join(data, "resources", plugin.receipt.revision),
62
+ CLAUDE_PLUGIN_ROOT: root,
63
+ CLAUDE_PLUGIN_DATA: data
30
64
  },
31
65
  cwd: resolvePluginCwd(server.cwd, root, data)
32
66
  };
33
- servers[pluginServerId(plugin.id, name)] = applyPluginAuthBinding(raw, readPluginAuthBinding(store, plugin.id, name, server));
67
+ servers[pluginServerId(plugin.id, name)] = applyPluginAuthBinding(raw, readPluginAuthBinding(store, plugin.id, name, server, plugin.receipt.revision));
34
68
  } catch (error) {
35
69
  diagnostics.push({
36
70
  component: `mcp:${name}`,
@@ -40,4 +74,4 @@ function materializePluginServers(plugin, store = new AgentPluginStore(), diagno
40
74
  return servers;
41
75
  }
42
76
  //#endregion
43
- export { materializePluginServers };
77
+ export { materializePluginServers, pluginOAuthCredentialId };
@@ -0,0 +1,2 @@
1
+ /** Only map authentication settings that native pi can represent without semantic loss. */
2
+ export declare function normalizePluginMcpServer(input: unknown, legacy: boolean, warn: (message: string) => void): unknown;
@@ -0,0 +1,82 @@
1
+ import { z } from "zod";
2
+ //#region src/extensions/agent-plugins/mcp-format.ts
3
+ const oauthClient = z.discriminatedUnion("mode", [z.strictObject({
4
+ mode: z.literal("provided"),
5
+ clientId: z.string().min(1),
6
+ tokenEndpointAuthMethod: z.literal("none").optional()
7
+ }), z.strictObject({ mode: z.enum(["dcr", "cimd"]) })]);
8
+ const scope = z.string().trim().min(1);
9
+ const authSchema = z.discriminatedUnion("type", [
10
+ z.strictObject({
11
+ type: z.enum(["oauth", "mixed"]),
12
+ client: oauthClient.optional(),
13
+ baseScopes: z.array(scope).optional(),
14
+ defaultScopes: z.array(scope).optional()
15
+ }),
16
+ z.strictObject({ type: z.literal("none") }),
17
+ z.strictObject({
18
+ type: z.literal("api_key"),
19
+ headerScheme: z.enum([
20
+ "bearer",
21
+ "basic",
22
+ "custom_header"
23
+ ]),
24
+ headerName: z.string().optional()
25
+ })
26
+ ]);
27
+ /** Only map authentication settings that native pi can represent without semantic loss. */
28
+ function normalizePluginMcpServer(input, legacy, warn) {
29
+ const value = { ...z.record(z.string(), z.unknown()).parse(input) };
30
+ const extensions = value.extensions;
31
+ if (extensions !== void 0) {
32
+ const ext = z.record(z.string(), z.unknown()).parse(extensions);
33
+ for (const key of Object.keys(ext)) if (key !== "com.openai") warn(`Unrecognized MCP extension: ${key}`);
34
+ const openai = ext["com.openai"] === void 0 ? {} : z.record(z.string(), z.unknown()).parse(ext["com.openai"]);
35
+ for (const key of Object.keys(openai)) if (key !== "auth") warn(`Unrecognized OpenAI MCP declaration: ${key}`);
36
+ if (openai.auth !== void 0) {
37
+ const auth = authSchema.parse(openai.auth);
38
+ if (auth.type === "oauth" || auth.type === "mixed") {
39
+ if (auth.baseScopes?.length && auth.defaultScopes === void 0) throw new Error("OAuth base scopes with discovered defaults require an adapter");
40
+ value.oauth = {
41
+ ...auth.client?.mode === "provided" ? { clientId: auth.client.clientId } : auth.client ? { clientRegistration: auth.client.mode } : {},
42
+ ...auth.defaultScopes !== void 0 ? { scope: [...new Set([...auth.baseScopes ?? [], ...auth.defaultScopes])].join(" ") } : {}
43
+ };
44
+ value.connectionAuth = { mode: "oauth" };
45
+ } else if (auth.type === "api_key") {
46
+ if (auth.headerScheme === "custom_header" && !auth.headerName || auth.headerScheme !== "custom_header" && auth.headerName) throw new Error("Invalid API key header declaration");
47
+ value.connectionAuth = {
48
+ mode: "api-key",
49
+ headerName: auth.headerName ?? "Authorization",
50
+ prefix: auth.headerScheme === "bearer" ? "Bearer " : auth.headerScheme === "basic" ? "Basic " : ""
51
+ };
52
+ } else value.connectionAuth = { mode: "none" };
53
+ }
54
+ delete value.extensions;
55
+ }
56
+ if (legacy) {
57
+ const allowed = new Set([
58
+ "type",
59
+ "command",
60
+ "args",
61
+ "env",
62
+ "cwd",
63
+ "url",
64
+ "headers",
65
+ "oauth_resource",
66
+ "oauth",
67
+ "connectionAuth"
68
+ ]);
69
+ for (const key of Object.keys(value)) if (!allowed.has(key)) {
70
+ warn(`Unsupported MCP field: ${key}`);
71
+ delete value[key];
72
+ }
73
+ if (value.oauth_resource !== void 0 && value.oauth_resource !== value.url) throw new Error("A distinct OAuth resource requires an adapter");
74
+ delete value.oauth_resource;
75
+ value.type = value.type === "http" ? "streamable-http" : value.type ?? (value.command ? "stdio" : "streamable-http");
76
+ if (typeof value.command === "string") value.command = value.command.replace(/^\$\{(?:CLAUDE_)?PLUGIN_ROOT\}\//, "./");
77
+ if (typeof value.cwd === "string") value.cwd = value.cwd.replace(/^\$\{CLAUDE_PLUGIN_(ROOT|DATA)\}/, "${PLUGIN_$1}");
78
+ }
79
+ return value;
80
+ }
81
+ //#endregion
82
+ export { normalizePluginMcpServer };
@@ -0,0 +1,14 @@
1
+ import type { AgentPluginStore, InstalledAgentPlugin } from './store.js';
2
+ export declare function pluginResources(plugin: Pick<InstalledAgentPlugin, 'manifest'>): {
3
+ url: string;
4
+ sha256: string;
5
+ maxBytes: number;
6
+ executable: boolean;
7
+ id: string;
8
+ platform?: "darwin" | "linux" | "win32";
9
+ arch?: "arm64" | "x64";
10
+ }[];
11
+ /** Download pinned files; execute them only later through an explicitly reviewed MCP process. */
12
+ export declare function preparePluginResources(store: AgentPluginStore, plugin: InstalledAgentPlugin, signal: AbortSignal): Promise<void>;
13
+ /** Derive ownership from retained revisions, including rollback and staged packages. */
14
+ export declare function prunePluginResourceCache(store: AgentPluginStore): void;
@@ -0,0 +1,112 @@
1
+ import { createPluginSourceFetch } from "./source-http-fetch.js";
2
+ import { containedPath } from "./validation.js";
3
+ import { dirname, join } from "node:path";
4
+ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
5
+ import { createHash, randomUUID } from "node:crypto";
6
+ import { z } from "zod";
7
+ //#region src/extensions/agent-plugins/resources.ts
8
+ const resourceVariant = z.strictObject({
9
+ url: z.string().url(),
10
+ sha256: z.string().regex(/^[a-f0-9]{64}$/),
11
+ maxBytes: z.number().int().positive().max(50 * 1024 * 1024).default(50 * 1024 * 1024),
12
+ executable: z.boolean().default(false),
13
+ platform: z.enum([
14
+ "darwin",
15
+ "linux",
16
+ "win32"
17
+ ]).optional(),
18
+ arch: z.enum(["arm64", "x64"]).optional()
19
+ });
20
+ const resourceId = z.string().min(1).max(64).regex(/^[a-z][a-z0-9]*(?:[-.][a-z0-9]+)*$/);
21
+ const resourcesSchema = z.array(z.union([resourceVariant.extend({ id: resourceId }).strict(), z.strictObject({
22
+ id: resourceId,
23
+ variants: z.array(resourceVariant).min(1).max(6)
24
+ })])).max(20);
25
+ function pluginResources(plugin) {
26
+ const extension = plugin.manifest.extensions?.["ai.xopc"];
27
+ if (extension?.setup?.version !== void 0 && extension.setup.version !== 1) throw new Error("Unsupported plugin setup protocol version");
28
+ const ids = /* @__PURE__ */ new Set();
29
+ return resourcesSchema.parse(extension?.setup?.resources ?? []).map((resource) => {
30
+ if (ids.has(resource.id)) throw new Error("Duplicate plugin resource");
31
+ ids.add(resource.id);
32
+ if (!("variants" in resource)) return resource;
33
+ const matches = resource.variants.filter((value) => (!value.platform || value.platform === process.platform) && (!value.arch || value.arch === process.arch));
34
+ if (matches.length !== 1) throw new Error(`Expected one resource variant for this platform: ${resource.id}`);
35
+ return {
36
+ ...matches[0],
37
+ id: resource.id
38
+ };
39
+ });
40
+ }
41
+ function verified(path, sha256, maxBytes) {
42
+ if (!existsSync(path)) return;
43
+ const stat = statSync(path);
44
+ if (!stat.isFile() || stat.size > maxBytes) return;
45
+ const data = readFileSync(path);
46
+ return createHash("sha256").update(data).digest("hex") === sha256 ? data : void 0;
47
+ }
48
+ function atomicFile(path, data, mode) {
49
+ mkdirSync(dirname(path), {
50
+ recursive: true,
51
+ mode: 448
52
+ });
53
+ const pending = `${path}.${randomUUID()}.tmp`;
54
+ try {
55
+ writeFileSync(pending, data, {
56
+ mode,
57
+ flag: "wx"
58
+ });
59
+ renameSync(pending, path);
60
+ } finally {
61
+ rmSync(pending, { force: true });
62
+ }
63
+ }
64
+ /** Download pinned files; execute them only later through an explicitly reviewed MCP process. */
65
+ async function preparePluginResources(store, plugin, signal) {
66
+ const dataRoot = store.dataDir(plugin.id), cacheRoot = join(store.stateDir, "plugin-resource-cache");
67
+ for (const resource of pluginResources(plugin)) {
68
+ signal.throwIfAborted();
69
+ if (resource.platform && resource.platform !== process.platform || resource.arch && resource.arch !== process.arch) throw new Error(`Resource is unavailable for this platform: ${resource.id}`);
70
+ const target = containedPath(dataRoot, join(dataRoot, "resources", plugin.receipt.revision, resource.id));
71
+ if (verified(target, resource.sha256, resource.maxBytes) && (!resource.executable || (statSync(target).mode & 73) !== 0)) continue;
72
+ const cached = containedPath(cacheRoot, join(cacheRoot, resource.sha256));
73
+ let data = verified(cached, resource.sha256, resource.maxBytes);
74
+ if (!data) {
75
+ const url = new URL(resource.url);
76
+ const response = await createPluginSourceFetch(url, {})(url, { signal: AbortSignal.any([signal, AbortSignal.timeout(6e4)]) });
77
+ if (!response.ok || !response.body) throw new Error(`Resource download failed: ${resource.id}`);
78
+ const chunks = [];
79
+ let bytes = 0;
80
+ const reader = response.body.getReader();
81
+ try {
82
+ for (;;) {
83
+ const part = await reader.read();
84
+ if (part.done) break;
85
+ bytes += part.value.length;
86
+ if (bytes > resource.maxBytes) throw new Error("Resource exceeds size limit");
87
+ chunks.push(part.value);
88
+ }
89
+ } finally {
90
+ await reader.cancel();
91
+ }
92
+ data = Buffer.concat(chunks);
93
+ if (createHash("sha256").update(data).digest("hex") !== resource.sha256) throw new Error(`Resource integrity failed: ${resource.id}`);
94
+ }
95
+ signal.throwIfAborted();
96
+ const content = data;
97
+ store.withRevision(plugin.id, plugin.receipt.revision, () => {
98
+ atomicFile(cached, content, 384);
99
+ atomicFile(containedPath(dataRoot, target), content, resource.executable ? 448 : 384);
100
+ });
101
+ }
102
+ }
103
+ /** Derive ownership from retained revisions, including rollback and staged packages. */
104
+ function prunePluginResourceCache(store) {
105
+ const cacheRoot = join(store.stateDir, "plugin-resource-cache");
106
+ if (!existsSync(cacheRoot)) return;
107
+ const referenced = /* @__PURE__ */ new Set();
108
+ for (const plugin of store.list()) for (const revision of store.history(plugin.id)) if (existsSync(revision.rootDir)) for (const hash of revision.receipt.resourceHashes ?? []) referenced.add(hash);
109
+ for (const name of readdirSync(cacheRoot)) if (/^[a-f0-9]{64}$/.test(name) && !referenced.has(name)) rmSync(join(cacheRoot, name), { force: true });
110
+ }
111
+ //#endregion
112
+ export { pluginResources, preparePluginResources, prunePluginResourceCache };
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ export declare const setupCommandSchema: z.ZodObject<{
3
+ command: z.ZodString;
4
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
5
+ env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
6
+ cwd: z.ZodOptional<z.ZodString>;
7
+ }, z.core.$strict>;
8
+ export declare const pluginAuthorizationSchema: z.ZodArray<z.ZodObject<{
9
+ id: z.ZodString;
10
+ title: z.ZodString;
11
+ description: z.ZodOptional<z.ZodString>;
12
+ servers: z.ZodArray<z.ZodString>;
13
+ methods: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
14
+ type: z.ZodLiteral<"oauth">;
15
+ server: z.ZodString;
16
+ id: z.ZodString;
17
+ title: z.ZodString;
18
+ instructions: z.ZodDefault<z.ZodArray<z.ZodString>>;
19
+ helpUrl: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strict>, z.ZodObject<{
21
+ type: z.ZodLiteral<"form">;
22
+ fields: z.ZodArray<z.ZodString>;
23
+ id: z.ZodString;
24
+ title: z.ZodString;
25
+ instructions: z.ZodDefault<z.ZodArray<z.ZodString>>;
26
+ helpUrl: z.ZodOptional<z.ZodString>;
27
+ }, z.core.$strict>, z.ZodObject<{
28
+ type: z.ZodLiteral<"cli">;
29
+ fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
30
+ login: z.ZodObject<{
31
+ command: z.ZodString;
32
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
33
+ env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
34
+ cwd: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strict>;
36
+ check: z.ZodObject<{
37
+ command: z.ZodString;
38
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
39
+ env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
40
+ cwd: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strict>;
42
+ timeoutSeconds: z.ZodDefault<z.ZodNumber>;
43
+ id: z.ZodString;
44
+ title: z.ZodString;
45
+ instructions: z.ZodDefault<z.ZodArray<z.ZodString>>;
46
+ helpUrl: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strict>], "type">>;
48
+ }, z.core.$strict>>;
49
+ export type PluginAuthorization = z.infer<typeof pluginAuthorizationSchema>[number];
50
+ export type SetupCommand = z.infer<typeof setupCommandSchema>;
51
+ export declare function pluginAuthorizations(manifest: {
52
+ extensions?: Record<string, unknown>;
53
+ }): PluginAuthorization[];
54
+ export declare function safeAuthorizationUrl(value: string): string;
55
+ export declare const pluginPermissionIssueSchema: z.ZodObject<{
56
+ id: z.ZodString;
57
+ title: z.ZodString;
58
+ scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
59
+ instructions: z.ZodDefault<z.ZodArray<z.ZodString>>;
60
+ method: z.ZodOptional<z.ZodString>;
61
+ helpUrl: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strict>;
63
+ export type PluginPermissionIssue = z.infer<typeof pluginPermissionIssueSchema>;
64
+ export declare function parsePluginAuthorizationCheck(output: string, methodIds: string[]): {
65
+ authenticated: boolean;
66
+ issues: {
67
+ id: string;
68
+ title: string;
69
+ scopes: string[];
70
+ instructions: string[];
71
+ method?: string;
72
+ helpUrl?: string;
73
+ }[];
74
+ };