@ai-agent-forge/agent-forge 0.86.7 → 0.88.0

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 (717) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +10 -11
  3. package/dist/artifacts/artifact-store.d.ts.map +1 -1
  4. package/dist/artifacts/artifact-store.js +9 -5
  5. package/dist/artifacts/artifact-store.js.map +1 -1
  6. package/dist/bundle/.build-manifest.json +430 -413
  7. package/dist/bundle/chunks/{chunk-A7GUOX2H.js → chunk-6ZKDNZHA.js} +5 -1
  8. package/dist/bundle/chunks/chunk-HLJEVRWP.js +13 -0
  9. package/dist/bundle/chunks/chunk-YGHQME4V.js +1456 -0
  10. package/dist/bundle/chunks/image-resize-worker.js +12 -1
  11. package/dist/bundle/chunks/{virtual-modules-3IZ4MYSQ.js → virtual-modules-KZ5DRH7Q.js} +1 -1
  12. package/dist/bundle/cli.js +1 -1
  13. package/dist/bundle/client.js +1 -1
  14. package/dist/bundle/index.js +2 -2
  15. package/dist/bundle/rpc-entry.js +1 -1
  16. package/dist/cli/args.d.ts.map +1 -1
  17. package/dist/cli/args.js +231 -185
  18. package/dist/cli/args.js.map +1 -1
  19. package/dist/cli/auth-check.d.ts.map +1 -1
  20. package/dist/cli/auth-check.js +17 -4
  21. package/dist/cli/auth-check.js.map +1 -1
  22. package/dist/cli/auth-command.d.ts.map +1 -1
  23. package/dist/cli/auth-command.js +15 -9
  24. package/dist/cli/auth-command.js.map +1 -1
  25. package/dist/cli/credential-print.d.ts.map +1 -1
  26. package/dist/cli/credential-print.js +14 -7
  27. package/dist/cli/credential-print.js.map +1 -1
  28. package/dist/cli/experimental/command.d.ts.map +1 -1
  29. package/dist/cli/experimental/command.js +6 -5
  30. package/dist/cli/experimental/command.js.map +1 -1
  31. package/dist/cli/list-models.d.ts.map +1 -1
  32. package/dist/cli/list-models.js +9 -8
  33. package/dist/cli/list-models.js.map +1 -1
  34. package/dist/cli/plugin-manager-controller.d.ts.map +1 -1
  35. package/dist/cli/plugin-manager-controller.js +2 -1
  36. package/dist/cli/plugin-manager-controller.js.map +1 -1
  37. package/dist/cli/serve.d.ts.map +1 -1
  38. package/dist/cli/serve.js +8 -5
  39. package/dist/cli/serve.js.map +1 -1
  40. package/dist/client/remote-session.d.ts.map +1 -1
  41. package/dist/client/remote-session.js +16 -9
  42. package/dist/client/remote-session.js.map +1 -1
  43. package/dist/config.d.ts.map +1 -1
  44. package/dist/config.js +5 -3
  45. package/dist/config.js.map +1 -1
  46. package/dist/core/agent-capability-contract.d.ts +0 -7
  47. package/dist/core/agent-capability-contract.d.ts.map +1 -1
  48. package/dist/core/agent-capability-contract.js +72 -68
  49. package/dist/core/agent-capability-contract.js.map +1 -1
  50. package/dist/core/agent-session-bash.d.ts.map +1 -1
  51. package/dist/core/agent-session-bash.js +5 -4
  52. package/dist/core/agent-session-bash.js.map +1 -1
  53. package/dist/core/agent-session-compaction.d.ts +6 -10
  54. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  55. package/dist/core/agent-session-compaction.js +35 -133
  56. package/dist/core/agent-session-compaction.js.map +1 -1
  57. package/dist/core/agent-session-context.d.ts.map +1 -1
  58. package/dist/core/agent-session-context.js +18 -13
  59. package/dist/core/agent-session-context.js.map +1 -1
  60. package/dist/core/agent-session-internal.d.ts +0 -6
  61. package/dist/core/agent-session-internal.d.ts.map +1 -1
  62. package/dist/core/agent-session-internal.js.map +1 -1
  63. package/dist/core/agent-session-model.d.ts.map +1 -1
  64. package/dist/core/agent-session-model.js +2 -1
  65. package/dist/core/agent-session-model.js.map +1 -1
  66. package/dist/core/agent-session-retry.d.ts.map +1 -1
  67. package/dist/core/agent-session-retry.js +3 -3
  68. package/dist/core/agent-session-retry.js.map +1 -1
  69. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  70. package/dist/core/agent-session-runtime.js +7 -6
  71. package/dist/core/agent-session-runtime.js.map +1 -1
  72. package/dist/core/agent-session-services.d.ts +1 -1
  73. package/dist/core/agent-session-services.d.ts.map +1 -1
  74. package/dist/core/agent-session-services.js.map +1 -1
  75. package/dist/core/agent-session-tools.d.ts.map +1 -1
  76. package/dist/core/agent-session-tools.js +3 -2
  77. package/dist/core/agent-session-tools.js.map +1 -1
  78. package/dist/core/agent-session.d.ts +40 -22
  79. package/dist/core/agent-session.d.ts.map +1 -1
  80. package/dist/core/agent-session.js +147 -67
  81. package/dist/core/agent-session.js.map +1 -1
  82. package/dist/core/auth-guidance.d.ts.map +1 -1
  83. package/dist/core/auth-guidance.js +11 -5
  84. package/dist/core/auth-guidance.js.map +1 -1
  85. package/dist/core/auth-storage.d.ts.map +1 -1
  86. package/dist/core/auth-storage.js +9 -6
  87. package/dist/core/auth-storage.js.map +1 -1
  88. package/dist/core/compaction/compaction.d.ts.map +1 -1
  89. package/dist/core/compaction/compaction.js +2 -1
  90. package/dist/core/compaction/compaction.js.map +1 -1
  91. package/dist/core/embedded-sdk.d.ts.map +1 -1
  92. package/dist/core/embedded-sdk.js +10 -6
  93. package/dist/core/embedded-sdk.js.map +1 -1
  94. package/dist/core/export-html/index.d.ts.map +1 -1
  95. package/dist/core/export-html/index.js +9 -4
  96. package/dist/core/export-html/index.js.map +1 -1
  97. package/dist/core/extensions/agent-composition.d.ts.map +1 -1
  98. package/dist/core/extensions/agent-composition.js +26 -19
  99. package/dist/core/extensions/agent-composition.js.map +1 -1
  100. package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
  101. package/dist/core/extensions/bootstrap-agent-loop.js +3 -2
  102. package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
  103. package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +1 -1
  104. package/dist/core/extensions/bootstrap-compaction-policy.js +0 -34
  105. package/dist/core/extensions/bootstrap-compaction-policy.js.map +1 -1
  106. package/dist/core/extensions/bootstrap-lifecycle.d.ts.map +1 -1
  107. package/dist/core/extensions/bootstrap-lifecycle.js +20 -17
  108. package/dist/core/extensions/bootstrap-lifecycle.js.map +1 -1
  109. package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +1 -1
  110. package/dist/core/extensions/bootstrap-overflow-policy.js +2 -1
  111. package/dist/core/extensions/bootstrap-overflow-policy.js.map +1 -1
  112. package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +1 -1
  113. package/dist/core/extensions/bootstrap-retry-policy.js +4 -3
  114. package/dist/core/extensions/bootstrap-retry-policy.js.map +1 -1
  115. package/dist/core/extensions/bootstrap-skills.d.ts.map +1 -1
  116. package/dist/core/extensions/bootstrap-skills.js +7 -6
  117. package/dist/core/extensions/bootstrap-skills.js.map +1 -1
  118. package/dist/core/extensions/bootstrap-tools.d.ts.map +1 -1
  119. package/dist/core/extensions/bootstrap-tools.js +2 -1
  120. package/dist/core/extensions/bootstrap-tools.js.map +1 -1
  121. package/dist/core/extensions/capability-plugin.d.ts.map +1 -1
  122. package/dist/core/extensions/capability-plugin.js +37 -13
  123. package/dist/core/extensions/capability-plugin.js.map +1 -1
  124. package/dist/core/extensions/capability-runtime-events.d.ts.map +1 -1
  125. package/dist/core/extensions/capability-runtime-events.js +17 -13
  126. package/dist/core/extensions/capability-runtime-events.js.map +1 -1
  127. package/dist/core/extensions/capability-runtime-guards.d.ts.map +1 -1
  128. package/dist/core/extensions/capability-runtime-guards.js +16 -15
  129. package/dist/core/extensions/capability-runtime-guards.js.map +1 -1
  130. package/dist/core/extensions/capability-runtime-manifest.d.ts.map +1 -1
  131. package/dist/core/extensions/capability-runtime-manifest.js +52 -30
  132. package/dist/core/extensions/capability-runtime-manifest.js.map +1 -1
  133. package/dist/core/extensions/capability-runtime-validation.d.ts.map +1 -1
  134. package/dist/core/extensions/capability-runtime-validation.js +66 -65
  135. package/dist/core/extensions/capability-runtime-validation.js.map +1 -1
  136. package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
  137. package/dist/core/extensions/capability-runtime.js +147 -127
  138. package/dist/core/extensions/capability-runtime.js.map +1 -1
  139. package/dist/core/extensions/compaction-memory-failure-mode.d.ts.map +1 -1
  140. package/dist/core/extensions/compaction-memory-failure-mode.js +3 -2
  141. package/dist/core/extensions/compaction-memory-failure-mode.js.map +1 -1
  142. package/dist/core/extensions/context-strategy-binding.d.ts.map +1 -1
  143. package/dist/core/extensions/context-strategy-binding.js +7 -4
  144. package/dist/core/extensions/context-strategy-binding.js.map +1 -1
  145. package/dist/core/extensions/lifecycle-catalog.d.ts.map +1 -1
  146. package/dist/core/extensions/lifecycle-catalog.js +290 -279
  147. package/dist/core/extensions/lifecycle-catalog.js.map +1 -1
  148. package/dist/core/extensions/lifecycle-delivery-queue.d.ts.map +1 -1
  149. package/dist/core/extensions/lifecycle-delivery-queue.js +3 -2
  150. package/dist/core/extensions/lifecycle-delivery-queue.js.map +1 -1
  151. package/dist/core/extensions/provider-failover.d.ts +7 -3
  152. package/dist/core/extensions/provider-failover.d.ts.map +1 -1
  153. package/dist/core/extensions/provider-failover.js +9 -8
  154. package/dist/core/extensions/provider-failover.js.map +1 -1
  155. package/dist/core/facade/coding-agent-facade.d.ts +6 -6
  156. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  157. package/dist/core/facade/coding-agent-facade.js +2 -3
  158. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  159. package/dist/core/http-dispatcher.d.ts.map +1 -1
  160. package/dist/core/http-dispatcher.js +2 -1
  161. package/dist/core/http-dispatcher.js.map +1 -1
  162. package/dist/core/i18n/index.d.ts +14 -0
  163. package/dist/core/i18n/index.d.ts.map +1 -0
  164. package/dist/core/i18n/index.js +67 -0
  165. package/dist/core/i18n/index.js.map +1 -0
  166. package/dist/core/i18n/locales/en/example.d.ts +7 -0
  167. package/dist/core/i18n/locales/en/example.d.ts.map +1 -0
  168. package/dist/core/i18n/locales/en/example.js +7 -0
  169. package/dist/core/i18n/locales/en/example.js.map +1 -0
  170. package/dist/core/i18n/locales/zh-cn/cli.d.ts +8 -0
  171. package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -0
  172. package/dist/core/i18n/locales/zh-cn/cli.js +229 -0
  173. package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -0
  174. package/dist/core/i18n/locales/zh-cn/common.d.ts +6 -0
  175. package/dist/core/i18n/locales/zh-cn/common.d.ts.map +1 -0
  176. package/dist/core/i18n/locales/zh-cn/common.js +6 -0
  177. package/dist/core/i18n/locales/zh-cn/common.js.map +1 -0
  178. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +13 -0
  179. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -0
  180. package/dist/core/i18n/locales/zh-cn/core-contract-core.js +173 -0
  181. package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -0
  182. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts +12 -0
  183. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -0
  184. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +582 -0
  185. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -0
  186. package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts +9 -0
  187. package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts.map +1 -0
  188. package/dist/core/i18n/locales/zh-cn/core-contract-final.js +55 -0
  189. package/dist/core/i18n/locales/zh-cn/core-contract-final.js.map +1 -0
  190. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts +11 -0
  191. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts.map +1 -0
  192. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js +455 -0
  193. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js.map +1 -0
  194. package/dist/core/i18n/locales/zh-cn/core-errors.d.ts +9 -0
  195. package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -0
  196. package/dist/core/i18n/locales/zh-cn/core-errors.js +191 -0
  197. package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -0
  198. package/dist/core/i18n/locales/zh-cn/example.d.ts +7 -0
  199. package/dist/core/i18n/locales/zh-cn/example.d.ts.map +1 -0
  200. package/dist/core/i18n/locales/zh-cn/example.js +10 -0
  201. package/dist/core/i18n/locales/zh-cn/example.js.map +1 -0
  202. package/dist/core/i18n/locales/zh-cn/index.d.ts +2 -0
  203. package/dist/core/i18n/locales/zh-cn/index.d.ts.map +1 -0
  204. package/dist/core/i18n/locales/zh-cn/index.js +41 -0
  205. package/dist/core/i18n/locales/zh-cn/index.js.map +1 -0
  206. package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts +10 -0
  207. package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -0
  208. package/dist/core/i18n/locales/zh-cn/interactive-mode.js +267 -0
  209. package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -0
  210. package/dist/core/i18n/locales/zh-cn/keybindings.d.ts +11 -0
  211. package/dist/core/i18n/locales/zh-cn/keybindings.d.ts.map +1 -0
  212. package/dist/core/i18n/locales/zh-cn/keybindings.js +67 -0
  213. package/dist/core/i18n/locales/zh-cn/keybindings.js.map +1 -0
  214. package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts +7 -0
  215. package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts.map +1 -0
  216. package/dist/core/i18n/locales/zh-cn/slash-commands.js +39 -0
  217. package/dist/core/i18n/locales/zh-cn/slash-commands.js.map +1 -0
  218. package/dist/core/i18n/locales/zh-cn/tui-builtin.d.ts +10 -0
  219. package/dist/core/i18n/locales/zh-cn/tui-builtin.d.ts.map +1 -0
  220. package/dist/core/i18n/locales/zh-cn/tui-builtin.js +15 -0
  221. package/dist/core/i18n/locales/zh-cn/tui-builtin.js.map +1 -0
  222. package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts +13 -0
  223. package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts.map +1 -0
  224. package/dist/core/i18n/locales/zh-cn/tui-components-misc.js +102 -0
  225. package/dist/core/i18n/locales/zh-cn/tui-components-misc.js.map +1 -0
  226. package/dist/core/i18n/locales/zh-cn/tui-components-selectors.d.ts +12 -0
  227. package/dist/core/i18n/locales/zh-cn/tui-components-selectors.d.ts.map +1 -0
  228. package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js +286 -0
  229. package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js.map +1 -0
  230. package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.d.ts +9 -0
  231. package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.d.ts.map +1 -0
  232. package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.js +79 -0
  233. package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.js.map +1 -0
  234. package/dist/core/i18n/locales/zh-cn/tui-self-owned.d.ts +8 -0
  235. package/dist/core/i18n/locales/zh-cn/tui-self-owned.d.ts.map +1 -0
  236. package/dist/core/i18n/locales/zh-cn/tui-self-owned.js +72 -0
  237. package/dist/core/i18n/locales/zh-cn/tui-self-owned.js.map +1 -0
  238. package/dist/core/keybindings.d.ts +15 -0
  239. package/dist/core/keybindings.d.ts.map +1 -1
  240. package/dist/core/keybindings.js +18 -0
  241. package/dist/core/keybindings.js.map +1 -1
  242. package/dist/core/logger.d.ts.map +1 -1
  243. package/dist/core/logger.js +5 -1
  244. package/dist/core/logger.js.map +1 -1
  245. package/dist/core/model-config.d.ts +0 -1
  246. package/dist/core/model-config.d.ts.map +1 -1
  247. package/dist/core/model-config.js +9 -1
  248. package/dist/core/model-config.js.map +1 -1
  249. package/dist/core/model-registry.d.ts.map +1 -1
  250. package/dist/core/model-registry.js +2 -1
  251. package/dist/core/model-registry.js.map +1 -1
  252. package/dist/core/model-runtime.d.ts.map +1 -1
  253. package/dist/core/model-runtime.js +11 -7
  254. package/dist/core/model-runtime.js.map +1 -1
  255. package/dist/core/package-install-host.d.ts.map +1 -1
  256. package/dist/core/package-install-host.js +4 -3
  257. package/dist/core/package-install-host.js.map +1 -1
  258. package/dist/core/package-manager.d.ts.map +1 -1
  259. package/dist/core/package-manager.js +15 -10
  260. package/dist/core/package-manager.js.map +1 -1
  261. package/dist/core/package-resource-collection.d.ts.map +1 -1
  262. package/dist/core/package-resource-collection.js +2 -1
  263. package/dist/core/package-resource-collection.js.map +1 -1
  264. package/dist/core/package-source.d.ts.map +1 -1
  265. package/dist/core/package-source.js +3 -2
  266. package/dist/core/package-source.js.map +1 -1
  267. package/dist/core/provider-composer.d.ts +2 -2
  268. package/dist/core/provider-composer.d.ts.map +1 -1
  269. package/dist/core/provider-composer.js +29 -21
  270. package/dist/core/provider-composer.js.map +1 -1
  271. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  272. package/dist/core/remote-catalog-provider.js +6 -2
  273. package/dist/core/remote-catalog-provider.js.map +1 -1
  274. package/dist/core/resolve-config-value.d.ts.map +1 -1
  275. package/dist/core/resolve-config-value.js +15 -5
  276. package/dist/core/resolve-config-value.js.map +1 -1
  277. package/dist/core/sdk.d.ts +27 -5
  278. package/dist/core/sdk.d.ts.map +1 -1
  279. package/dist/core/sdk.js +80 -55
  280. package/dist/core/sdk.js.map +1 -1
  281. package/dist/core/session-cwd.d.ts.map +1 -1
  282. package/dist/core/session-cwd.js +5 -2
  283. package/dist/core/session-cwd.js.map +1 -1
  284. package/dist/core/session-export.d.ts.map +1 -1
  285. package/dist/core/session-export.js +2 -1
  286. package/dist/core/session-export.js.map +1 -1
  287. package/dist/core/session-manager.d.ts.map +1 -1
  288. package/dist/core/session-manager.js +39 -29
  289. package/dist/core/session-manager.js.map +1 -1
  290. package/dist/core/session-storage.d.ts.map +1 -1
  291. package/dist/core/session-storage.js +3 -3
  292. package/dist/core/session-storage.js.map +1 -1
  293. package/dist/core/settings-manager.d.ts +20 -20
  294. package/dist/core/settings-manager.d.ts.map +1 -1
  295. package/dist/core/settings-manager.js +47 -59
  296. package/dist/core/settings-manager.js.map +1 -1
  297. package/dist/core/slash-commands.d.ts.map +1 -1
  298. package/dist/core/slash-commands.js +53 -32
  299. package/dist/core/slash-commands.js.map +1 -1
  300. package/dist/core/system-prompt.d.ts.map +1 -1
  301. package/dist/core/system-prompt.js +25 -2
  302. package/dist/core/system-prompt.js.map +1 -1
  303. package/dist/core/tools/bash.d.ts.map +1 -1
  304. package/dist/core/tools/bash.js +11 -7
  305. package/dist/core/tools/bash.js.map +1 -1
  306. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  307. package/dist/core/tools/edit-diff.js +9 -4
  308. package/dist/core/tools/edit-diff.js.map +1 -1
  309. package/dist/core/tools/edit.d.ts.map +1 -1
  310. package/dist/core/tools/edit.js +4 -3
  311. package/dist/core/tools/edit.js.map +1 -1
  312. package/dist/core/tools/index.d.ts.map +1 -1
  313. package/dist/core/tools/index.js +3 -2
  314. package/dist/core/tools/index.js.map +1 -1
  315. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  316. package/dist/core/tools/output-accumulator.js +2 -1
  317. package/dist/core/tools/output-accumulator.js.map +1 -1
  318. package/dist/core/tools/read.d.ts.map +1 -1
  319. package/dist/core/tools/read.js +6 -2
  320. package/dist/core/tools/read.js.map +1 -1
  321. package/dist/core/tools/write.d.ts.map +1 -1
  322. package/dist/core/tools/write.js +2 -1
  323. package/dist/core/tools/write.js.map +1 -1
  324. package/dist/durable/durable-service.d.ts.map +1 -1
  325. package/dist/durable/durable-service.js +25 -18
  326. package/dist/durable/durable-service.js.map +1 -1
  327. package/dist/host/checkpoint-commit.d.ts.map +1 -1
  328. package/dist/host/checkpoint-commit.js +2 -1
  329. package/dist/host/checkpoint-commit.js.map +1 -1
  330. package/dist/host/manual-compaction.d.ts.map +1 -1
  331. package/dist/host/manual-compaction.js +2 -1
  332. package/dist/host/manual-compaction.js.map +1 -1
  333. package/dist/host/output-projection.d.ts +0 -13
  334. package/dist/host/output-projection.d.ts.map +1 -1
  335. package/dist/host/output-projection.js +16 -2
  336. package/dist/host/output-projection.js.map +1 -1
  337. package/dist/host/summary-retry.d.ts.map +1 -1
  338. package/dist/host/summary-retry.js +3 -2
  339. package/dist/host/summary-retry.js.map +1 -1
  340. package/dist/main.d.ts.map +1 -1
  341. package/dist/main.js +97 -60
  342. package/dist/main.js.map +1 -1
  343. package/dist/modes/interactive/components/agents-view.d.ts.map +1 -1
  344. package/dist/modes/interactive/components/agents-view.js +18 -15
  345. package/dist/modes/interactive/components/agents-view.js.map +1 -1
  346. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  347. package/dist/modes/interactive/components/assistant-message.js +6 -5
  348. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  349. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  350. package/dist/modes/interactive/components/bash-execution.js +12 -7
  351. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  352. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  353. package/dist/modes/interactive/components/bordered-loader.js +2 -1
  354. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  355. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  356. package/dist/modes/interactive/components/branch-summary-message.js +6 -5
  357. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  358. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  359. package/dist/modes/interactive/components/compaction-summary-message.js +9 -5
  360. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  361. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  362. package/dist/modes/interactive/components/config-selector.js +18 -15
  363. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  364. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  365. package/dist/modes/interactive/components/custom-entry.js +2 -1
  366. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  367. package/dist/modes/interactive/components/dialog-editor.d.ts.map +1 -1
  368. package/dist/modes/interactive/components/dialog-editor.js +5 -4
  369. package/dist/modes/interactive/components/dialog-editor.js.map +1 -1
  370. package/dist/modes/interactive/components/dialog-input.d.ts.map +1 -1
  371. package/dist/modes/interactive/components/dialog-input.js +2 -1
  372. package/dist/modes/interactive/components/dialog-input.js.map +1 -1
  373. package/dist/modes/interactive/components/dialog-selector.d.ts.map +1 -1
  374. package/dist/modes/interactive/components/dialog-selector.js +4 -3
  375. package/dist/modes/interactive/components/dialog-selector.js.map +1 -1
  376. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
  377. package/dist/modes/interactive/components/first-time-setup.js +11 -10
  378. package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
  379. package/dist/modes/interactive/components/footer.d.ts +0 -2
  380. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  381. package/dist/modes/interactive/components/footer.js +8 -10
  382. package/dist/modes/interactive/components/footer.js.map +1 -1
  383. package/dist/modes/interactive/components/index.d.ts +1 -0
  384. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  385. package/dist/modes/interactive/components/index.js +1 -0
  386. package/dist/modes/interactive/components/index.js.map +1 -1
  387. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  388. package/dist/modes/interactive/components/keybinding-hints.js +3 -2
  389. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  390. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  391. package/dist/modes/interactive/components/login-dialog.js +12 -11
  392. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  393. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  394. package/dist/modes/interactive/components/mermaid.js +6 -2
  395. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  396. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  397. package/dist/modes/interactive/components/model-selector.js +28 -16
  398. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  399. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  400. package/dist/modes/interactive/components/oauth-selector.js +10 -9
  401. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  402. package/dist/modes/interactive/components/plugin-manager-entry.d.ts.map +1 -1
  403. package/dist/modes/interactive/components/plugin-manager-entry.js +22 -13
  404. package/dist/modes/interactive/components/plugin-manager-entry.js.map +1 -1
  405. package/dist/modes/interactive/components/plugin-selection-entry.d.ts.map +1 -1
  406. package/dist/modes/interactive/components/plugin-selection-entry.js +27 -12
  407. package/dist/modes/interactive/components/plugin-selection-entry.js.map +1 -1
  408. package/dist/modes/interactive/components/queue-manager-selector.d.ts +60 -0
  409. package/dist/modes/interactive/components/queue-manager-selector.d.ts.map +1 -0
  410. package/dist/modes/interactive/components/queue-manager-selector.js +166 -0
  411. package/dist/modes/interactive/components/queue-manager-selector.js.map +1 -0
  412. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  413. package/dist/modes/interactive/components/scoped-models-selector.js +16 -14
  414. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  415. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  416. package/dist/modes/interactive/components/session-selector.js +43 -31
  417. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  418. package/dist/modes/interactive/components/settings-selector.d.ts +4 -6
  419. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  420. package/dist/modes/interactive/components/settings-selector.js +115 -120
  421. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  422. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
  423. package/dist/modes/interactive/components/settings-submenu.js +5 -4
  424. package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
  425. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  426. package/dist/modes/interactive/components/show-images-selector.js +3 -2
  427. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  428. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  429. package/dist/modes/interactive/components/skill-invocation-message.js +4 -3
  430. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  431. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  432. package/dist/modes/interactive/components/status-indicator.js +14 -5
  433. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  434. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  435. package/dist/modes/interactive/components/theme-selector.js +2 -1
  436. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  437. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  438. package/dist/modes/interactive/components/thinking-selector.js +11 -4
  439. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  440. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  441. package/dist/modes/interactive/components/tool-execution.js +8 -3
  442. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  443. package/dist/modes/interactive/components/tree-list.d.ts.map +1 -1
  444. package/dist/modes/interactive/components/tree-list.js +7 -6
  445. package/dist/modes/interactive/components/tree-list.js.map +1 -1
  446. package/dist/modes/interactive/components/tree-render.d.ts.map +1 -1
  447. package/dist/modes/interactive/components/tree-render.js +28 -23
  448. package/dist/modes/interactive/components/tree-render.js.map +1 -1
  449. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  450. package/dist/modes/interactive/components/tree-selector.js +9 -7
  451. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  452. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  453. package/dist/modes/interactive/components/user-message-selector.js +5 -4
  454. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  455. package/dist/modes/interactive/components/workflow-view.d.ts.map +1 -1
  456. package/dist/modes/interactive/components/workflow-view.js +36 -21
  457. package/dist/modes/interactive/components/workflow-view.js.map +1 -1
  458. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  459. package/dist/modes/interactive/external-editor.js +2 -1
  460. package/dist/modes/interactive/external-editor.js.map +1 -1
  461. package/dist/modes/interactive/interactive-auth.d.ts.map +1 -1
  462. package/dist/modes/interactive/interactive-auth.js +71 -40
  463. package/dist/modes/interactive/interactive-auth.js.map +1 -1
  464. package/dist/modes/interactive/interactive-commands.d.ts +1 -0
  465. package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
  466. package/dist/modes/interactive/interactive-commands.js +3 -0
  467. package/dist/modes/interactive/interactive-commands.js.map +1 -1
  468. package/dist/modes/interactive/interactive-dialog-ui.d.ts.map +1 -1
  469. package/dist/modes/interactive/interactive-dialog-ui.js +5 -5
  470. package/dist/modes/interactive/interactive-dialog-ui.js.map +1 -1
  471. package/dist/modes/interactive/interactive-format.d.ts.map +1 -1
  472. package/dist/modes/interactive/interactive-format.js +34 -18
  473. package/dist/modes/interactive/interactive-format.js.map +1 -1
  474. package/dist/modes/interactive/interactive-helpers.d.ts.map +1 -1
  475. package/dist/modes/interactive/interactive-helpers.js +7 -2
  476. package/dist/modes/interactive/interactive-helpers.js.map +1 -1
  477. package/dist/modes/interactive/interactive-mode.d.ts +4 -2
  478. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  479. package/dist/modes/interactive/interactive-mode.js +350 -279
  480. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  481. package/dist/modes/interactive/interactive-selectors.d.ts +9 -0
  482. package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
  483. package/dist/modes/interactive/interactive-selectors.js +79 -25
  484. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  485. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  486. package/dist/modes/interactive/theme/theme-controller.js +5 -1
  487. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  488. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  489. package/dist/modes/interactive/theme/theme.js +26 -23
  490. package/dist/modes/interactive/theme/theme.js.map +1 -1
  491. package/dist/modes/json-event.d.ts.map +1 -1
  492. package/dist/modes/json-event.js +3 -2
  493. package/dist/modes/json-event.js.map +1 -1
  494. package/dist/modes/print-mode.d.ts.map +1 -1
  495. package/dist/modes/print-mode.js +3 -2
  496. package/dist/modes/print-mode.js.map +1 -1
  497. package/dist/modes/rpc/rpc-client.d.ts +0 -8
  498. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  499. package/dist/modes/rpc/rpc-client.js +3 -14
  500. package/dist/modes/rpc/rpc-client.js.map +1 -1
  501. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  502. package/dist/modes/rpc/rpc-mode.js +0 -9
  503. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  504. package/dist/modes/rpc/rpc-types.d.ts +0 -19
  505. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  506. package/dist/modes/rpc/rpc-types.js.map +1 -1
  507. package/dist/package-manager-cli.d.ts.map +1 -1
  508. package/dist/package-manager-cli.js +28 -13
  509. package/dist/package-manager-cli.js.map +1 -1
  510. package/dist/plugins/ecosystem/catalog.d.ts.map +1 -1
  511. package/dist/plugins/ecosystem/catalog.js +3 -2
  512. package/dist/plugins/ecosystem/catalog.js.map +1 -1
  513. package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
  514. package/dist/plugins/ecosystem/cli.js +2 -1
  515. package/dist/plugins/ecosystem/cli.js.map +1 -1
  516. package/dist/plugins/ecosystem/default-plugin-market.d.ts.map +1 -1
  517. package/dist/plugins/ecosystem/default-plugin-market.js +3 -2
  518. package/dist/plugins/ecosystem/default-plugin-market.js.map +1 -1
  519. package/dist/plugins/ecosystem/distribution.d.ts.map +1 -1
  520. package/dist/plugins/ecosystem/distribution.js +2 -1
  521. package/dist/plugins/ecosystem/distribution.js.map +1 -1
  522. package/dist/plugins/ecosystem/installer.d.ts.map +1 -1
  523. package/dist/plugins/ecosystem/installer.js +3 -2
  524. package/dist/plugins/ecosystem/installer.js.map +1 -1
  525. package/dist/plugins/ecosystem/node-disk-registry-source.d.ts.map +1 -1
  526. package/dist/plugins/ecosystem/node-disk-registry-source.js +20 -17
  527. package/dist/plugins/ecosystem/node-disk-registry-source.js.map +1 -1
  528. package/dist/plugins/ecosystem/node-distribution-host.d.ts.map +1 -1
  529. package/dist/plugins/ecosystem/node-distribution-host.js +35 -34
  530. package/dist/plugins/ecosystem/node-distribution-host.js.map +1 -1
  531. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
  532. package/dist/plugins/ecosystem/node-npm-registry-source.js +35 -34
  533. package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
  534. package/dist/plugins/ecosystem/node-package-install-host.d.ts.map +1 -1
  535. package/dist/plugins/ecosystem/node-package-install-host.js +9 -8
  536. package/dist/plugins/ecosystem/node-package-install-host.js.map +1 -1
  537. package/dist/plugins/ecosystem/node-package-install-persistence.d.ts.map +1 -1
  538. package/dist/plugins/ecosystem/node-package-install-persistence.js +4 -3
  539. package/dist/plugins/ecosystem/node-package-install-persistence.js.map +1 -1
  540. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +9 -2
  541. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
  542. package/dist/plugins/ecosystem/node-plugin-bootstrap.js +44 -5
  543. package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
  544. package/dist/plugins/ecosystem/node-plugin-trust-root.d.ts.map +1 -1
  545. package/dist/plugins/ecosystem/node-plugin-trust-root.js +10 -9
  546. package/dist/plugins/ecosystem/node-plugin-trust-root.js.map +1 -1
  547. package/dist/plugins/ecosystem/node-registry-source.d.ts.map +1 -1
  548. package/dist/plugins/ecosystem/node-registry-source.js +31 -30
  549. package/dist/plugins/ecosystem/node-registry-source.js.map +1 -1
  550. package/dist/plugins/ecosystem/node-release-package-source.d.ts.map +1 -1
  551. package/dist/plugins/ecosystem/node-release-package-source.js +30 -29
  552. package/dist/plugins/ecosystem/node-release-package-source.js.map +1 -1
  553. package/dist/plugins/ecosystem/node-tar-writer.d.ts.map +1 -1
  554. package/dist/plugins/ecosystem/node-tar-writer.js +11 -10
  555. package/dist/plugins/ecosystem/node-tar-writer.js.map +1 -1
  556. package/dist/plugins/ecosystem/node-url-package-source.d.ts.map +1 -1
  557. package/dist/plugins/ecosystem/node-url-package-source.js +21 -20
  558. package/dist/plugins/ecosystem/node-url-package-source.js.map +1 -1
  559. package/dist/plugins/ecosystem/plugin-acquisition.d.ts.map +1 -1
  560. package/dist/plugins/ecosystem/plugin-acquisition.js +3 -2
  561. package/dist/plugins/ecosystem/plugin-acquisition.js.map +1 -1
  562. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +9 -1
  563. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
  564. package/dist/plugins/ecosystem/plugin-bootstrap.js +5 -0
  565. package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
  566. package/dist/plugins/ecosystem/registry-cli-adapter.d.ts.map +1 -1
  567. package/dist/plugins/ecosystem/registry-cli-adapter.js +2 -1
  568. package/dist/plugins/ecosystem/registry-cli-adapter.js.map +1 -1
  569. package/dist/plugins/ecosystem/registry.d.ts.map +1 -1
  570. package/dist/plugins/ecosystem/registry.js +35 -32
  571. package/dist/plugins/ecosystem/registry.js.map +1 -1
  572. package/dist/plugins/ecosystem/resolver.d.ts.map +1 -1
  573. package/dist/plugins/ecosystem/resolver.js +3 -2
  574. package/dist/plugins/ecosystem/resolver.js.map +1 -1
  575. package/dist/plugins/ecosystem/selection-store.d.ts.map +1 -1
  576. package/dist/plugins/ecosystem/selection-store.js +11 -10
  577. package/dist/plugins/ecosystem/selection-store.js.map +1 -1
  578. package/dist/plugins/ecosystem/selection.d.ts.map +1 -1
  579. package/dist/plugins/ecosystem/selection.js +8 -7
  580. package/dist/plugins/ecosystem/selection.js.map +1 -1
  581. package/dist/plugins/ecosystem/state.d.ts.map +1 -1
  582. package/dist/plugins/ecosystem/state.js +24 -23
  583. package/dist/plugins/ecosystem/state.js.map +1 -1
  584. package/dist/plugins/ecosystem/updates.d.ts.map +1 -1
  585. package/dist/plugins/ecosystem/updates.js +5 -4
  586. package/dist/plugins/ecosystem/updates.js.map +1 -1
  587. package/dist/plugins/mcp-http.d.ts +0 -17
  588. package/dist/plugins/mcp-http.d.ts.map +1 -1
  589. package/dist/plugins/mcp-http.js +30 -7
  590. package/dist/plugins/mcp-http.js.map +1 -1
  591. package/dist/plugins/plugin-supervisor.d.ts.map +1 -1
  592. package/dist/plugins/plugin-supervisor.js +19 -1
  593. package/dist/plugins/plugin-supervisor.js.map +1 -1
  594. package/dist/profile/first-roles.d.ts.map +1 -1
  595. package/dist/profile/first-roles.js +10 -1
  596. package/dist/profile/first-roles.js.map +1 -1
  597. package/dist/profile/goal-plugin.d.ts.map +1 -1
  598. package/dist/profile/goal-plugin.js +24 -5
  599. package/dist/profile/goal-plugin.js.map +1 -1
  600. package/dist/profile/identity.d.ts.map +1 -1
  601. package/dist/profile/identity.js +7 -6
  602. package/dist/profile/identity.js.map +1 -1
  603. package/dist/profile/lock.d.ts.map +1 -1
  604. package/dist/profile/lock.js +15 -1
  605. package/dist/profile/lock.js.map +1 -1
  606. package/dist/profile/plan-plugin.d.ts.map +1 -1
  607. package/dist/profile/plan-plugin.js +26 -13
  608. package/dist/profile/plan-plugin.js.map +1 -1
  609. package/dist/profile/plugin-profiles.d.ts.map +1 -1
  610. package/dist/profile/plugin-profiles.js +2 -1
  611. package/dist/profile/plugin-profiles.js.map +1 -1
  612. package/dist/profile/policy-manifest.d.ts.map +1 -1
  613. package/dist/profile/policy-manifest.js +5 -4
  614. package/dist/profile/policy-manifest.js.map +1 -1
  615. package/dist/profile/profile-registry.d.ts +0 -12
  616. package/dist/profile/profile-registry.d.ts.map +1 -1
  617. package/dist/profile/profile-registry.js +14 -1
  618. package/dist/profile/profile-registry.js.map +1 -1
  619. package/dist/profile/role-catalog.d.ts +0 -1
  620. package/dist/profile/role-catalog.d.ts.map +1 -1
  621. package/dist/profile/role-catalog.js +17 -15
  622. package/dist/profile/role-catalog.js.map +1 -1
  623. package/dist/profile/role-orchestrator.d.ts.map +1 -1
  624. package/dist/profile/role-orchestrator.js +8 -7
  625. package/dist/profile/role-orchestrator.js.map +1 -1
  626. package/dist/profile/role-runner.d.ts.map +1 -1
  627. package/dist/profile/role-runner.js +3 -2
  628. package/dist/profile/role-runner.js.map +1 -1
  629. package/dist/profile/root-facade.d.ts.map +1 -1
  630. package/dist/profile/root-facade.js +2 -1
  631. package/dist/profile/root-facade.js.map +1 -1
  632. package/dist/profile/skill-discovery-wiring.d.ts.map +1 -1
  633. package/dist/profile/skill-discovery-wiring.js +7 -2
  634. package/dist/profile/skill-discovery-wiring.js.map +1 -1
  635. package/dist/profile/state-store.d.ts.map +1 -1
  636. package/dist/profile/state-store.js +13 -9
  637. package/dist/profile/state-store.js.map +1 -1
  638. package/dist/profile/todo-plugin.d.ts.map +1 -1
  639. package/dist/profile/todo-plugin.js +9 -4
  640. package/dist/profile/todo-plugin.js.map +1 -1
  641. package/dist/profiles/builtin-suites.d.ts +13 -6
  642. package/dist/profiles/builtin-suites.d.ts.map +1 -1
  643. package/dist/profiles/builtin-suites.js +15 -6
  644. package/dist/profiles/builtin-suites.js.map +1 -1
  645. package/dist/profiles/suite-loader.d.ts +25 -1
  646. package/dist/profiles/suite-loader.d.ts.map +1 -1
  647. package/dist/profiles/suite-loader.js +34 -9
  648. package/dist/profiles/suite-loader.js.map +1 -1
  649. package/dist/remote/server-entry.d.ts.map +1 -1
  650. package/dist/remote/server-entry.js +3 -2
  651. package/dist/remote/server-entry.js.map +1 -1
  652. package/dist/remote/session-source.d.ts.map +1 -1
  653. package/dist/remote/session-source.js +8 -4
  654. package/dist/remote/session-source.js.map +1 -1
  655. package/dist/share/session-share.d.ts.map +1 -1
  656. package/dist/share/session-share.js +14 -2
  657. package/dist/share/session-share.js.map +1 -1
  658. package/dist/testing/plugin-testkit.d.ts.map +1 -1
  659. package/dist/testing/plugin-testkit.js +4 -3
  660. package/dist/testing/plugin-testkit.js.map +1 -1
  661. package/dist/testing/runtime-delivery-queue.d.ts.map +1 -1
  662. package/dist/testing/runtime-delivery-queue.js +2 -1
  663. package/dist/testing/runtime-delivery-queue.js.map +1 -1
  664. package/dist/testing/session-plugin-testkit.d.ts.map +1 -1
  665. package/dist/testing/session-plugin-testkit.js +10 -7
  666. package/dist/testing/session-plugin-testkit.js.map +1 -1
  667. package/dist/utils/ansi.d.ts.map +1 -1
  668. package/dist/utils/ansi.js +2 -1
  669. package/dist/utils/ansi.js.map +1 -1
  670. package/dist/utils/clipboard.d.ts.map +1 -1
  671. package/dist/utils/clipboard.js +7 -6
  672. package/dist/utils/clipboard.js.map +1 -1
  673. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  674. package/dist/utils/image-resize-worker.js +3 -2
  675. package/dist/utils/image-resize-worker.js.map +1 -1
  676. package/dist/utils/photon.d.ts +2 -2
  677. package/dist/utils/photon.d.ts.map +1 -1
  678. package/dist/utils/photon.js +2 -2
  679. package/dist/utils/photon.js.map +1 -1
  680. package/dist/utils/shell.d.ts.map +1 -1
  681. package/dist/utils/shell.js +9 -8
  682. package/dist/utils/shell.js.map +1 -1
  683. package/dist/utils/tools-manager.d.ts.map +1 -1
  684. package/dist/utils/tools-manager.js +23 -13
  685. package/dist/utils/tools-manager.js.map +1 -1
  686. package/dist/utils/version-check.d.ts.map +1 -1
  687. package/dist/utils/version-check.js +5 -1
  688. package/dist/utils/version-check.js.map +1 -1
  689. package/docs/compaction.md +1 -3
  690. package/docs/docs.json +4 -0
  691. package/docs/index.md +1 -0
  692. package/docs/keybindings.md +3 -0
  693. package/docs/mcp.md +103 -0
  694. package/docs/models.md +14 -22
  695. package/docs/providers.md +0 -1
  696. package/docs/quickstart.md +1 -1
  697. package/docs/rpc.md +1 -26
  698. package/docs/sdk.md +4 -6
  699. package/docs/settings.md +10 -12
  700. package/docs/skills.md +1 -9
  701. package/docs/terminal-setup.md +2 -3
  702. package/docs/usage.md +7 -6
  703. package/examples/extensions/with-deps/package-lock.json +2 -2
  704. package/examples/extensions/with-deps/package.json +1 -1
  705. package/examples/extensions/with-deps/plugin.json +1 -1
  706. package/examples/sdk/10-settings.ts +2 -4
  707. package/examples/sdk/12-full-control.ts +1 -2
  708. package/package.json +1 -3
  709. package/dist/bundle/chunks/chunk-EALJ5DDX.js +0 -1452
  710. package/dist/core/extensions/microcompact.d.ts +0 -80
  711. package/dist/core/extensions/microcompact.d.ts.map +0 -1
  712. package/dist/core/extensions/microcompact.js +0 -134
  713. package/dist/core/extensions/microcompact.js.map +0 -1
  714. package/dist/server/create-harness.d.ts +0 -26
  715. package/dist/server/create-harness.d.ts.map +0 -1
  716. package/dist/server/create-harness.js +0 -106
  717. package/dist/server/create-harness.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/plugins/ecosystem/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC3G,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGzG,qEAAqE;AACrE,eAAO,MAAM,qCAAqC,QAAY,CAAC;AAC/D,gEAAgE;AAChE,eAAO,MAAM,gCAAgC,MAAM,CAAC;AACpD,wEAAwE;AACxE,eAAO,MAAM,oCAAoC,QAAkB,CAAC;AACpE,+EAA+E;AAC/E,eAAO,MAAM,mCAAmC,OAAO,CAAC;AACxD,mEAAmE;AACnE,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,MAAM,WAAW,gCAAgC;IAChD,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,YAAY,CAAC,EAAE,8BAA8B,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACtC,gFAAgF;IAChF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,CAAC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qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACxD;AAED,6EAA6E;AAC7E,MAAM,WAAW,+BAA+B;IAC/C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,8BAA8B,CAAC;CACvD;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAChG,sFAAsF;IACtF,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;KAC9B,KAAK,OAAO,CAAC,+BAA+B,GAAG,SAAS,CAAC,CAAC;IAC3D,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CAAC;CAC7G;AA4LD,6DAA6D;AAC7D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CAsLzF","sourcesContent":["import { buildPluginCatalogV1, comparePluginVersionsV1, type PluginCatalogSnapshotV1 } from \"./catalog.ts\";\nimport type { PluginDistributionDescriptorV1 } from \"./distribution.ts\";\nimport { createPluginDistributionV1 } from \"./distribution.ts\";\nimport type { CapabilityRefV1, HostFactsV1, PluginManifestV1, PluginSourceVerifierV1 } from \"./types.ts\";\nimport { pluginManifestDigestV1 } from \"./updates.ts\";\n\n/** Maximum manifest JSON bytes accepted by the registry boundary. */\nexport const MAX_PLUGIN_REGISTRY_MANIFEST_BYTES_V1 = 64 * 1024;\n/** Maximum number of manifests returned by one source query. */\nexport const MAX_PLUGIN_REGISTRY_MANIFESTS_V1 = 256;\n/** Maximum aggregate manifest metadata returned by one source query. */\nexport const MAX_PLUGIN_REGISTRY_PAYLOAD_BYTES_V1 = 4 * 1024 * 1024;\n/** Maximum source URI length; sources are identifiers, never package paths. */\nexport const MAX_PLUGIN_REGISTRY_SOURCE_CHARS_V1 = 2048;\n/** Maximum digest/signature text length accepted from a source. */\nexport const MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1 = 512;\n\nexport interface PluginRegistryManifestEnvelopeV1 {\n\treadonly manifest: PluginManifestV1;\n\treadonly source: string;\n\treadonly manifestDigest: string;\n\t/** Optional host- or registry-supplied signature. The verifier owns semantics. */\n\treadonly signature?: string;\n\t/** Optional signed artifact descriptor bound to this exact manifest identity. */\n\treadonly distribution?: PluginDistributionDescriptorV1;\n}\n\n/**\n * A transport-neutral registry source. Hosts inject HTTP, filesystem, or\n * package-manager implementations. The registry never receives package bytes\n * and never exposes source response bodies to the model context.\n */\nexport interface PluginRegistrySourceV1 {\n\t/** Optional stable source identity shown in diagnostics; never a local path. */\n\treadonly source?: string;\n\treadonly list: (input: { readonly signal?: AbortSignal }) => Promise<readonly PluginRegistryManifestEnvelopeV1[]>;\n}\n\nexport interface PluginRegistryDigestVerifierV1 {\n\treadonly verify: (input: {\n\t\treadonly manifest: PluginManifestV1;\n\t\treadonly source: string;\n\t\treadonly manifestDigest: string;\n\t\treadonly expectedDigest?: string;\n\t\treadonly signature?: string;\n\t}) =>\n\t\t| { readonly status: \"accepted\" }\n\t\t| { readonly status: \"rejected\"; readonly reason?: string }\n\t\t| Promise<{ readonly status: \"accepted\" } | { readonly status: \"rejected\"; readonly reason?: string }>;\n}\n\nexport interface PluginRegistryOptionsV1 {\n\treadonly source: PluginRegistrySourceV1;\n\treadonly host: HostFactsV1;\n\t/** Required digest/signature verifier. No implicit trust fallback. */\n\treadonly verify: PluginRegistryDigestVerifierV1;\n\t/** Existing source verifier contract is mandatory at the registry boundary. */\n\treadonly sourceVerifier: PluginSourceVerifierV1;\n\treadonly availableCapabilities?: readonly CapabilityRefV1[];\n\treadonly maxManifests?: number;\n}\n\nexport type PluginRegistryErrorCodeV1 =\n\t| \"cancelled\"\n\t| \"invalid_limit\"\n\t| \"source_rejected\"\n\t| \"invalid_manifest\"\n\t| \"invalid_source\"\n\t| \"invalid_digest\"\n\t| \"payload_too_large\"\n\t| \"too_many_manifests\"\n\t| \"incompatible\";\n\nexport class PluginRegistryErrorV1 extends Error {\n\treadonly code: PluginRegistryErrorCodeV1;\n\treadonly cause?: unknown;\n\n\tconstructor(code: PluginRegistryErrorCodeV1, message: string, cause?: unknown) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"PluginRegistryErrorV1\";\n\t\tthis.code = code;\n\t\tthis.cause = cause;\n\t}\n}\n\nexport interface PluginRegistryEntryV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly source: string;\n\treadonly manifestDigest: string;\n\treadonly signed: boolean;\n}\n\nexport type PluginRegistryRejectionCodeV1 = \"source_rejected\" | \"digest_rejected\" | \"incompatible\";\n\nexport interface PluginRegistryRejectionV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly code: PluginRegistryRejectionCodeV1;\n\treadonly reason: string;\n}\n\nexport interface PluginRegistryVerifiedEntryV1 extends PluginRegistryEntryV1 {\n\treadonly resolutionStatus: \"installed-ready\";\n}\n\nexport interface PluginRegistrySnapshotV1 {\n\treadonly version: 1;\n\treadonly source: string;\n\treadonly entries: readonly PluginRegistryEntryV1[];\n\treadonly catalog: PluginCatalogSnapshotV1;\n\t/** Only entries that passed proof validation and host compatibility. */\n\treadonly verified: readonly PluginRegistryVerifiedEntryV1[];\n\t/** Platform/API/test-only entries remain visible in catalog but are not verified. */\n\treadonly rejected: readonly PluginRegistryRejectionV1[];\n}\n\n/** Host-side package projection; package bytes never cross this boundary. */\nexport interface PluginRegistryResolvedPackageV1 {\n\treadonly manifest: PluginManifestV1;\n\treadonly source: string;\n\treadonly expectedDigest: string;\n\treadonly distribution?: PluginDistributionDescriptorV1;\n}\n\nexport interface PluginRegistryV1 {\n\treadonly list: (input?: { readonly signal?: AbortSignal }) => Promise<PluginRegistrySnapshotV1>;\n\t/** Optional host-side resolver. Older custom registry implementations may omit it. */\n\treadonly resolve?: (input: {\n\t\treadonly pluginId: string;\n\t\treadonly pluginVersion?: string;\n\t\treadonly signal?: AbortSignal;\n\t}) => Promise<PluginRegistryResolvedPackageV1 | undefined>;\n\t/** Optional host-side manifest projection used by the CLI catalog command. */\n\treadonly listManifests?: (input?: { readonly signal?: AbortSignal }) => Promise<readonly PluginManifestV1[]>;\n}\n\nfunction isAbortLike(error: unknown, signal: AbortSignal | undefined): boolean {\n\treturn (\n\t\tsignal?.aborted === true ||\n\t\t(error instanceof Error && (error.name === \"AbortError\" || error.name === \"AbortSignalError\"))\n\t);\n}\n\nfunction boundedString(\n\tvalue: unknown,\n\tlabel: string,\n\tmax: number,\n\tcode: PluginRegistryErrorCodeV1 = \"invalid_source\",\n): string {\n\tif (typeof value !== \"string\" || value.trim() === \"\" || value.length > max || /[\\u0000-\\u001f]/u.test(value)) {\n\t\tthrow new PluginRegistryErrorV1(code, `${label} must be a non-empty bounded string`);\n\t}\n\treturn value;\n}\n\nfunction assertAllowedKeys(value: Record<string, unknown>, allowed: readonly string[], label: string): void {\n\tconst expected = new Set(allowed);\n\tif (Object.keys(value).some((key) => !expected.has(key)))\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", `${label} contains an unsupported field`);\n}\n\nfunction validateSource(source: unknown): string {\n\tconst value = boundedString(source, \"source\", MAX_PLUGIN_REGISTRY_SOURCE_CHARS_V1);\n\tif (/^(?:file:|[a-zA-Z]:[\\\\/]|[\\\\/]{1,2}|\\\\\\\\)/iu.test(value) || /\\s/u.test(value)) {\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_source\",\n\t\t\t\"Plugin registry source must be an opaque URI, not a local path\",\n\t\t);\n\t}\n\tif (/^https?:\\/\\//iu.test(value)) {\n\t\ttry {\n\t\t\tconst parsed = new URL(value);\n\t\t\tconst pathname = parsed.pathname.length > 512 ? `${parsed.pathname.slice(0, 511)}…` : parsed.pathname;\n\t\t\treturn `${parsed.origin}${pathname || \"/\"}`;\n\t\t} catch (error) {\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_source\", \"Plugin registry source URL is invalid\", error);\n\t\t}\n\t}\n\treturn value;\n}\n\nfunction validateManifest(manifest: unknown): PluginManifestV1 {\n\tif (typeof manifest !== \"object\" || manifest === null || Array.isArray(manifest)) {\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest must be an object\");\n\t}\n\tconst value = manifest as Record<string, unknown>;\n\tassertAllowedKeys(\n\t\tvalue,\n\t\t[\n\t\t\t\"id\",\n\t\t\t\"pluginVersion\",\n\t\t\t\"apiVersion\",\n\t\t\t\"minHostVersion\",\n\t\t\t\"maxHostVersion\",\n\t\t\t\"capabilityRefs\",\n\t\t\t\"requires\",\n\t\t\t\"platform\",\n\t\t\t\"testOnly\",\n\t\t],\n\t\t\"Registry manifest\",\n\t);\n\tif (typeof value.id !== \"string\" || value.id.trim() === \"\" || value.id.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest id is invalid\");\n\tif (typeof value.pluginVersion !== \"string\" || value.pluginVersion.trim() === \"\" || value.pluginVersion.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest pluginVersion is invalid\");\n\tif (typeof value.apiVersion !== \"string\" || value.apiVersion.trim() === \"\" || value.apiVersion.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest apiVersion is invalid\");\n\tif (value.minHostVersion === undefined && value.maxHostVersion === undefined)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_manifest\",\n\t\t\t\"Published plugins must declare host version compatibility range: set minHostVersion and/or maxHostVersion\",\n\t\t);\n\tlet bytes: number;\n\ttry {\n\t\tbytes = new TextEncoder().encode(JSON.stringify(manifest)).byteLength;\n\t} catch (error) {\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest cannot be serialized\", error);\n\t}\n\tif (bytes > MAX_PLUGIN_REGISTRY_MANIFEST_BYTES_V1)\n\t\tthrow new PluginRegistryErrorV1(\"payload_too_large\", \"Registry manifest exceeds the size limit\");\n\treturn Object.freeze({ ...value } as unknown as PluginManifestV1);\n}\n\nfunction validateEnvelope(value: unknown): PluginRegistryManifestEnvelopeV1 {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value))\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry response entry must be an object\");\n\tconst entry = value as Record<string, unknown>;\n\tassertAllowedKeys(\n\t\tentry,\n\t\t[\"manifest\", \"source\", \"manifestDigest\", \"signature\", \"distribution\"],\n\t\t\"Registry response entry\",\n\t);\n\tconst manifest = validateManifest(entry.manifest);\n\tconst source = validateSource(entry.source);\n\tconst manifestDigest = boundedString(entry.manifestDigest, \"manifestDigest\", MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1);\n\tif (entry.signature !== undefined) boundedString(entry.signature, \"signature\", MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1);\n\tlet distribution: PluginDistributionDescriptorV1 | undefined;\n\tif (entry.distribution !== undefined) {\n\t\ttry {\n\t\t\tdistribution = createPluginDistributionV1().validateDescriptor(entry.distribution);\n\t\t} catch (error) {\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry distribution descriptor is invalid\", error);\n\t\t}\n\t\tif (\n\t\t\tdistribution.pluginId !== manifest.id ||\n\t\t\tdistribution.pluginVersion !== manifest.pluginVersion ||\n\t\t\tdistribution.manifestDigest !== manifestDigest\n\t\t)\n\t\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\t\"invalid_manifest\",\n\t\t\t\t\"Registry distribution descriptor does not match the manifest identity\",\n\t\t\t);\n\t}\n\treturn Object.freeze({\n\t\tmanifest,\n\t\tsource,\n\t\tmanifestDigest,\n\t\t...(entry.signature === undefined ? {} : { signature: entry.signature as string }),\n\t\t...(distribution === undefined ? {} : { distribution }),\n\t});\n}\n\nfunction validateMax(value: number | undefined): number {\n\tconst max = value ?? MAX_PLUGIN_REGISTRY_MANIFESTS_V1;\n\tif (!Number.isSafeInteger(max) || max < 1 || max > MAX_PLUGIN_REGISTRY_MANIFESTS_V1)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_limit\",\n\t\t\t`maxManifests must be an integer between 1 and ${MAX_PLUGIN_REGISTRY_MANIFESTS_V1}`,\n\t\t);\n\treturn max;\n}\n\nasync function validateSourceProof(\n\tentry: PluginRegistryManifestEnvelopeV1,\n\tverifier: PluginRegistryDigestVerifierV1,\n\tsourceVerifier: PluginSourceVerifierV1,\n): Promise<void> {\n\tconst actualDigest = pluginManifestDigestV1(entry.manifest);\n\tif (entry.manifestDigest !== actualDigest)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_digest\",\n\t\t\t`Manifest digest mismatch for ${entry.manifest.id}@${entry.manifest.pluginVersion}`,\n\t\t);\n\ttry {\n\t\tconst result = await verifier.verify({\n\t\t\tmanifest: entry.manifest,\n\t\t\tsource: entry.source,\n\t\t\tmanifestDigest: actualDigest,\n\t\t\texpectedDigest: entry.manifestDigest,\n\t\t\tsignature: entry.signature,\n\t\t});\n\t\tif (result.status !== \"accepted\")\n\t\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", result.reason ?? \"Registry source proof was rejected\");\n\t} catch (error) {\n\t\tif (error instanceof PluginRegistryErrorV1) throw error;\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Registry source proof was rejected\", error);\n\t}\n\tlet result: ReturnType<PluginSourceVerifierV1>;\n\ttry {\n\t\tresult = sourceVerifier({\n\t\t\tpluginId: entry.manifest.id,\n\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\tsource: entry.source,\n\t\t\tmanifestDigest: actualDigest,\n\t\t});\n\t} catch (error) {\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Plugin source verifier failed\", error);\n\t}\n\tif (result.status !== \"accepted\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", result.reason ?? \"Plugin source was rejected\");\n}\n\nfunction sourceIdentity(entries: readonly PluginRegistryManifestEnvelopeV1[]): string {\n\tconst sources = [...new Set(entries.map((entry) => entry.source))].sort((left, right) => left.localeCompare(right));\n\treturn sources.join(\",\");\n}\n\ninterface RegistryLoadV1 {\n\treadonly accepted: readonly PluginRegistryManifestEnvelopeV1[];\n\treadonly snapshot: PluginRegistrySnapshotV1;\n}\n\n/** Create a deterministic, host-injected registry client. */\nexport function createPluginRegistryV1(options: PluginRegistryOptionsV1): PluginRegistryV1 {\n\tconst maxManifests = validateMax(options.maxManifests);\n\tif (options.source === undefined || typeof options.source.list !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"invalid_source\", \"Registry source must provide list()\");\n\tif (options.source.source !== undefined) validateSource(options.source.source);\n\tif (options.verify === undefined || typeof options.verify.verify !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Registry source/digest verifier is required\");\n\tif (options.sourceVerifier === undefined || typeof options.sourceVerifier !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Registry source verifier is required\");\n\n\tconst load = async (input: { readonly signal?: AbortSignal } = {}): Promise<RegistryLoadV1> => {\n\t\tif (input.signal?.aborted)\n\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", \"Plugin registry operation was cancelled\");\n\t\tlet raw: readonly PluginRegistryManifestEnvelopeV1[];\n\t\ttry {\n\t\t\traw = await options.source.list({ signal: input.signal });\n\t\t} catch (error) {\n\t\t\tif (isAbortLike(error, input.signal))\n\t\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", \"Plugin registry operation was cancelled\", error);\n\t\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Plugin registry source failed\", error);\n\t\t}\n\t\tif (input.signal?.aborted)\n\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", \"Plugin registry operation was cancelled\");\n\t\tif (!Array.isArray(raw))\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry source must return an array\");\n\t\tif (raw.length > maxManifests)\n\t\t\tthrow new PluginRegistryErrorV1(\"too_many_manifests\", \"Registry response contains too many manifests\");\n\t\tconst entries = raw.map(validateEnvelope);\n\t\tconst payloadBytes = entries.reduce((total, entry) => {\n\t\t\tconst manifestBytes = new TextEncoder().encode(JSON.stringify(entry.manifest)).byteLength;\n\t\t\tconst distributionBytes =\n\t\t\t\tentry.distribution === undefined\n\t\t\t\t\t? 0\n\t\t\t\t\t: new TextEncoder().encode(JSON.stringify(entry.distribution)).byteLength;\n\t\t\treturn (\n\t\t\t\ttotal +\n\t\t\t\tmanifestBytes +\n\t\t\t\tdistributionBytes +\n\t\t\t\tnew TextEncoder().encode(entry.source).byteLength +\n\t\t\t\tnew TextEncoder().encode(entry.manifestDigest).byteLength +\n\t\t\t\t(entry.signature === undefined ? 0 : new TextEncoder().encode(entry.signature).byteLength)\n\t\t\t);\n\t\t}, 0);\n\t\tif (payloadBytes > MAX_PLUGIN_REGISTRY_PAYLOAD_BYTES_V1)\n\t\t\tthrow new PluginRegistryErrorV1(\"payload_too_large\", \"Registry response exceeds the aggregate size limit\");\n\t\tconst seen = new Set<string>();\n\t\tconst accepted: PluginRegistryManifestEnvelopeV1[] = [];\n\t\tconst rejected: PluginRegistryRejectionV1[] = [];\n\t\tfor (const entry of entries) {\n\t\t\tconst identity = `${entry.manifest.id}@${entry.manifest.pluginVersion}`;\n\t\t\tif (seen.has(identity))\n\t\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", `Duplicate registry manifest: ${identity}`);\n\t\t\tseen.add(identity);\n\t\t\ttry {\n\t\t\t\tawait validateSourceProof(entry, options.verify, options.sourceVerifier);\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof PluginRegistryErrorV1)) throw error;\n\t\t\t\tif (error.cause !== undefined) throw error;\n\t\t\t\tif (error.code !== \"source_rejected\" && error.code !== \"invalid_digest\") throw error;\n\t\t\t\trejected.push({\n\t\t\t\t\tpluginId: entry.manifest.id,\n\t\t\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\t\t\tcode: error.code === \"invalid_digest\" ? \"digest_rejected\" : \"source_rejected\",\n\t\t\t\t\treason:\n\t\t\t\t\t\terror.code === \"invalid_digest\" ? \"Manifest digest mismatch\" : \"Registry source proof was rejected\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (input.signal?.aborted)\n\t\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", \"Plugin registry operation was cancelled\");\n\t\t\taccepted.push(entry);\n\t\t}\n\t\tconst manifests = accepted.map((entry) => entry.manifest);\n\t\tconst catalog = buildPluginCatalogV1({\n\t\t\tmanifests,\n\t\t\thost: options.host,\n\t\t\tavailableCapabilities: options.availableCapabilities,\n\t\t\tmaxEntries: maxManifests,\n\t\t});\n\t\tconst publicEntries = Object.freeze(\n\t\t\t[...accepted]\n\t\t\t\t.sort((left, right) => {\n\t\t\t\t\tconst idOrder = left.manifest.id.localeCompare(right.manifest.id);\n\t\t\t\t\treturn idOrder === 0\n\t\t\t\t\t\t? comparePluginVersionsV1(right.manifest.pluginVersion, left.manifest.pluginVersion)\n\t\t\t\t\t\t: idOrder;\n\t\t\t\t})\n\t\t\t\t.map((entry) =>\n\t\t\t\t\tObject.freeze({\n\t\t\t\t\t\tpluginId: entry.manifest.id,\n\t\t\t\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\t\t\t\tsource: entry.source,\n\t\t\t\t\t\tmanifestDigest: entry.manifestDigest,\n\t\t\t\t\t\tsigned: entry.signature !== undefined,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t);\n\t\tconst catalogByIdentity = new Map(\n\t\t\tcatalog.entries.map((entry) => [`${entry.pluginId}@${entry.pluginVersion}`, entry] as const),\n\t\t);\n\t\tconst verified = Object.freeze(\n\t\t\tpublicEntries.flatMap((entry) => {\n\t\t\t\tconst catalogEntry = catalogByIdentity.get(`${entry.pluginId}@${entry.pluginVersion}`);\n\t\t\t\tif (catalogEntry?.resolution.status === \"installed-ready\")\n\t\t\t\t\treturn [{ ...entry, resolutionStatus: \"installed-ready\" as const }];\n\t\t\t\tconst reason = catalogEntry?.resolution.diagnostics[0]?.message ?? \"Plugin is incompatible with this host\";\n\t\t\t\trejected.push({\n\t\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\t\tpluginVersion: entry.pluginVersion,\n\t\t\t\t\tcode: \"incompatible\",\n\t\t\t\t\treason,\n\t\t\t\t});\n\t\t\t\treturn [];\n\t\t\t}),\n\t\t);\n\t\treturn {\n\t\t\taccepted: Object.freeze(accepted),\n\t\t\tsnapshot: Object.freeze({\n\t\t\t\tversion: 1,\n\t\t\t\tsource:\n\t\t\t\t\toptions.source.source === undefined ? sourceIdentity(accepted) : validateSource(options.source.source),\n\t\t\t\tentries: publicEntries,\n\t\t\t\tcatalog,\n\t\t\t\tverified,\n\t\t\t\trejected: Object.freeze(rejected),\n\t\t\t}),\n\t\t};\n\t};\n\tconst listManifests = async (\n\t\tinput: { readonly signal?: AbortSignal } = {},\n\t): Promise<readonly PluginManifestV1[]> => {\n\t\tconst loaded = await load(input);\n\t\treturn Object.freeze(\n\t\t\tloaded.snapshot.catalog.entries.flatMap((catalogEntry) =>\n\t\t\t\tloaded.accepted\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.manifest.id === catalogEntry.pluginId &&\n\t\t\t\t\t\t\tentry.manifest.pluginVersion === catalogEntry.pluginVersion,\n\t\t\t\t\t)\n\t\t\t\t\t.map((entry) => entry.manifest),\n\t\t\t),\n\t\t);\n\t};\n\treturn {\n\t\tlist: async (input = {}) => (await load(input)).snapshot,\n\t\tlistManifests,\n\t\tresolve: async (input) => {\n\t\t\tconst loaded = await load({ signal: input.signal });\n\t\t\tconst verified = new Set(loaded.snapshot.verified.map((entry) => `${entry.pluginId}@${entry.pluginVersion}`));\n\t\t\tconst identity =\n\t\t\t\tinput.pluginVersion === undefined\n\t\t\t\t\t? loaded.snapshot.catalog.entries.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.pluginId === input.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.resolution.status === \"installed-ready\" &&\n\t\t\t\t\t\t\t\tverified.has(`${candidate.pluginId}@${candidate.pluginVersion}`),\n\t\t\t\t\t\t)\n\t\t\t\t\t: loaded.snapshot.catalog.entries.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.pluginId === input.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.pluginVersion === input.pluginVersion &&\n\t\t\t\t\t\t\t\tcandidate.resolution.status === \"installed-ready\" &&\n\t\t\t\t\t\t\t\tverified.has(`${candidate.pluginId}@${candidate.pluginVersion}`),\n\t\t\t\t\t\t);\n\t\t\tconst entry =\n\t\t\t\tidentity === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: loaded.accepted.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.manifest.id === identity.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.manifest.pluginVersion === identity.pluginVersion,\n\t\t\t\t\t\t);\n\t\t\tif (entry === undefined) return undefined;\n\t\t\treturn Object.freeze({\n\t\t\t\tmanifest: entry.manifest,\n\t\t\t\tsource: entry.source,\n\t\t\t\texpectedDigest: entry.manifestDigest,\n\t\t\t\t...(entry.distribution === undefined ? {} : { distribution: entry.distribution }),\n\t\t\t});\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/plugins/ecosystem/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAiD,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC3G,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGzG,qEAAqE;AACrE,eAAO,MAAM,qCAAqC,QAAY,CAAC;AAC/D,gEAAgE;AAChE,eAAO,MAAM,gCAAgC,MAAM,CAAC;AACpD,wEAAwE;AACxE,eAAO,MAAM,oCAAoC,QAAkB,CAAC;AACpE,+EAA+E;AAC/E,eAAO,MAAM,mCAAmC,OAAO,CAAC;AACxD,mEAAmE;AACnE,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,MAAM,WAAW,gCAAgC;IAChD,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,YAAY,CAAC,EAAE,8BAA8B,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACtC,gFAAgF;IAChF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,SAAS,gCAAgC,EAAE,CAAC,CAAC;CAClH;AAED,MAAM,WAA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,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,8BAA8B,CAAC;CACvD;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAChG,sFAAsF;IACtF,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;KAC9B,KAAK,OAAO,CAAC,+BAA+B,GAAG,SAAS,CAAC,CAAC;IAC3D,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CAAC;CAC7G;AA8LD,6DAA6D;AAC7D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CAyLzF","sourcesContent":["import { t } from \"../../core/i18n/index.ts\";\nimport { buildPluginCatalogV1, comparePluginVersionsV1, type PluginCatalogSnapshotV1 } from \"./catalog.ts\";\nimport type { PluginDistributionDescriptorV1 } from \"./distribution.ts\";\nimport { createPluginDistributionV1 } from \"./distribution.ts\";\nimport type { CapabilityRefV1, HostFactsV1, PluginManifestV1, PluginSourceVerifierV1 } from \"./types.ts\";\nimport { pluginManifestDigestV1 } from \"./updates.ts\";\n\n/** Maximum manifest JSON bytes accepted by the registry boundary. */\nexport const MAX_PLUGIN_REGISTRY_MANIFEST_BYTES_V1 = 64 * 1024;\n/** Maximum number of manifests returned by one source query. */\nexport const MAX_PLUGIN_REGISTRY_MANIFESTS_V1 = 256;\n/** Maximum aggregate manifest metadata returned by one source query. */\nexport const MAX_PLUGIN_REGISTRY_PAYLOAD_BYTES_V1 = 4 * 1024 * 1024;\n/** Maximum source URI length; sources are identifiers, never package paths. */\nexport const MAX_PLUGIN_REGISTRY_SOURCE_CHARS_V1 = 2048;\n/** Maximum digest/signature text length accepted from a source. */\nexport const MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1 = 512;\n\nexport interface PluginRegistryManifestEnvelopeV1 {\n\treadonly manifest: PluginManifestV1;\n\treadonly source: string;\n\treadonly manifestDigest: string;\n\t/** Optional host- or registry-supplied signature. The verifier owns semantics. */\n\treadonly signature?: string;\n\t/** Optional signed artifact descriptor bound to this exact manifest identity. */\n\treadonly distribution?: PluginDistributionDescriptorV1;\n}\n\n/**\n * A transport-neutral registry source. Hosts inject HTTP, filesystem, or\n * package-manager implementations. The registry never receives package bytes\n * and never exposes source response bodies to the model context.\n */\nexport interface PluginRegistrySourceV1 {\n\t/** Optional stable source identity shown in diagnostics; never a local path. */\n\treadonly source?: string;\n\treadonly list: (input: { readonly signal?: AbortSignal }) => Promise<readonly PluginRegistryManifestEnvelopeV1[]>;\n}\n\nexport interface PluginRegistryDigestVerifierV1 {\n\treadonly verify: (input: {\n\t\treadonly manifest: PluginManifestV1;\n\t\treadonly source: string;\n\t\treadonly manifestDigest: string;\n\t\treadonly expectedDigest?: string;\n\t\treadonly signature?: string;\n\t}) =>\n\t\t| { readonly status: \"accepted\" }\n\t\t| { readonly status: \"rejected\"; readonly reason?: string }\n\t\t| Promise<{ readonly status: \"accepted\" } | { readonly status: \"rejected\"; readonly reason?: string }>;\n}\n\nexport interface PluginRegistryOptionsV1 {\n\treadonly source: PluginRegistrySourceV1;\n\treadonly host: HostFactsV1;\n\t/** Required digest/signature verifier. No implicit trust fallback. */\n\treadonly verify: PluginRegistryDigestVerifierV1;\n\t/** Existing source verifier contract is mandatory at the registry boundary. */\n\treadonly sourceVerifier: PluginSourceVerifierV1;\n\treadonly availableCapabilities?: readonly CapabilityRefV1[];\n\treadonly maxManifests?: number;\n}\n\nexport type PluginRegistryErrorCodeV1 =\n\t| \"cancelled\"\n\t| \"invalid_limit\"\n\t| \"source_rejected\"\n\t| \"invalid_manifest\"\n\t| \"invalid_source\"\n\t| \"invalid_digest\"\n\t| \"payload_too_large\"\n\t| \"too_many_manifests\"\n\t| \"incompatible\";\n\nexport class PluginRegistryErrorV1 extends Error {\n\treadonly code: PluginRegistryErrorCodeV1;\n\treadonly cause?: unknown;\n\n\tconstructor(code: PluginRegistryErrorCodeV1, message: string, cause?: unknown) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"PluginRegistryErrorV1\";\n\t\tthis.code = code;\n\t\tthis.cause = cause;\n\t}\n}\n\nexport interface PluginRegistryEntryV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly source: string;\n\treadonly manifestDigest: string;\n\treadonly signed: boolean;\n}\n\nexport type PluginRegistryRejectionCodeV1 = \"source_rejected\" | \"digest_rejected\" | \"incompatible\";\n\nexport interface PluginRegistryRejectionV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly code: PluginRegistryRejectionCodeV1;\n\treadonly reason: string;\n}\n\nexport interface PluginRegistryVerifiedEntryV1 extends PluginRegistryEntryV1 {\n\treadonly resolutionStatus: \"installed-ready\";\n}\n\nexport interface PluginRegistrySnapshotV1 {\n\treadonly version: 1;\n\treadonly source: string;\n\treadonly entries: readonly PluginRegistryEntryV1[];\n\treadonly catalog: PluginCatalogSnapshotV1;\n\t/** Only entries that passed proof validation and host compatibility. */\n\treadonly verified: readonly PluginRegistryVerifiedEntryV1[];\n\t/** Platform/API/test-only entries remain visible in catalog but are not verified. */\n\treadonly rejected: readonly PluginRegistryRejectionV1[];\n}\n\n/** Host-side package projection; package bytes never cross this boundary. */\nexport interface PluginRegistryResolvedPackageV1 {\n\treadonly manifest: PluginManifestV1;\n\treadonly source: string;\n\treadonly expectedDigest: string;\n\treadonly distribution?: PluginDistributionDescriptorV1;\n}\n\nexport interface PluginRegistryV1 {\n\treadonly list: (input?: { readonly signal?: AbortSignal }) => Promise<PluginRegistrySnapshotV1>;\n\t/** Optional host-side resolver. Older custom registry implementations may omit it. */\n\treadonly resolve?: (input: {\n\t\treadonly pluginId: string;\n\t\treadonly pluginVersion?: string;\n\t\treadonly signal?: AbortSignal;\n\t}) => Promise<PluginRegistryResolvedPackageV1 | undefined>;\n\t/** Optional host-side manifest projection used by the CLI catalog command. */\n\treadonly listManifests?: (input?: { readonly signal?: AbortSignal }) => Promise<readonly PluginManifestV1[]>;\n}\n\nfunction isAbortLike(error: unknown, signal: AbortSignal | undefined): boolean {\n\treturn (\n\t\tsignal?.aborted === true ||\n\t\t(error instanceof Error && (error.name === \"AbortError\" || error.name === \"AbortSignalError\"))\n\t);\n}\n\nfunction boundedString(\n\tvalue: unknown,\n\tlabel: string,\n\tmax: number,\n\tcode: PluginRegistryErrorCodeV1 = \"invalid_source\",\n): string {\n\tif (typeof value !== \"string\" || value.trim() === \"\" || value.length > max || /[\\u0000-\\u001f]/u.test(value)) {\n\t\tthrow new PluginRegistryErrorV1(code, t(\"{label} must be a non-empty bounded string\", { label }));\n\t}\n\treturn value;\n}\n\nfunction assertAllowedKeys(value: Record<string, unknown>, allowed: readonly string[], label: string): void {\n\tconst expected = new Set(allowed);\n\tif (Object.keys(value).some((key) => !expected.has(key)))\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"{label} contains an unsupported field\", { label }));\n}\n\nfunction validateSource(source: unknown): string {\n\tconst value = boundedString(source, \"source\", MAX_PLUGIN_REGISTRY_SOURCE_CHARS_V1);\n\tif (/^(?:file:|[a-zA-Z]:[\\\\/]|[\\\\/]{1,2}|\\\\\\\\)/iu.test(value) || /\\s/u.test(value)) {\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_source\",\n\t\t\tt(\"Plugin registry source must be an opaque URI, not a local path\"),\n\t\t);\n\t}\n\tif (/^https?:\\/\\//iu.test(value)) {\n\t\ttry {\n\t\t\tconst parsed = new URL(value);\n\t\t\tconst pathname = parsed.pathname.length > 512 ? `${parsed.pathname.slice(0, 511)}…` : parsed.pathname;\n\t\t\treturn `${parsed.origin}${pathname || \"/\"}`;\n\t\t} catch (error) {\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_source\", t(\"Plugin registry source URL is invalid\"), error);\n\t\t}\n\t}\n\treturn value;\n}\n\nfunction validateManifest(manifest: unknown): PluginManifestV1 {\n\tif (typeof manifest !== \"object\" || manifest === null || Array.isArray(manifest)) {\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest must be an object\"));\n\t}\n\tconst value = manifest as Record<string, unknown>;\n\tassertAllowedKeys(\n\t\tvalue,\n\t\t[\n\t\t\t\"id\",\n\t\t\t\"pluginVersion\",\n\t\t\t\"apiVersion\",\n\t\t\t\"minHostVersion\",\n\t\t\t\"maxHostVersion\",\n\t\t\t\"capabilityRefs\",\n\t\t\t\"requires\",\n\t\t\t\"platform\",\n\t\t\t\"testOnly\",\n\t\t],\n\t\t\"Registry manifest\",\n\t);\n\tif (typeof value.id !== \"string\" || value.id.trim() === \"\" || value.id.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest id is invalid\"));\n\tif (typeof value.pluginVersion !== \"string\" || value.pluginVersion.trim() === \"\" || value.pluginVersion.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest pluginVersion is invalid\"));\n\tif (typeof value.apiVersion !== \"string\" || value.apiVersion.trim() === \"\" || value.apiVersion.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest apiVersion is invalid\"));\n\tif (value.minHostVersion === undefined && value.maxHostVersion === undefined)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_manifest\",\n\t\t\tt(\"Published plugins must declare host version compatibility range: set minHostVersion and/or maxHostVersion\"),\n\t\t);\n\tlet bytes: number;\n\ttry {\n\t\tbytes = new TextEncoder().encode(JSON.stringify(manifest)).byteLength;\n\t} catch (error) {\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest cannot be serialized\"), error);\n\t}\n\tif (bytes > MAX_PLUGIN_REGISTRY_MANIFEST_BYTES_V1)\n\t\tthrow new PluginRegistryErrorV1(\"payload_too_large\", t(\"Registry manifest exceeds the size limit\"));\n\treturn Object.freeze({ ...value } as unknown as PluginManifestV1);\n}\n\nfunction validateEnvelope(value: unknown): PluginRegistryManifestEnvelopeV1 {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value))\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry response entry must be an object\"));\n\tconst entry = value as Record<string, unknown>;\n\tassertAllowedKeys(\n\t\tentry,\n\t\t[\"manifest\", \"source\", \"manifestDigest\", \"signature\", \"distribution\"],\n\t\t\"Registry response entry\",\n\t);\n\tconst manifest = validateManifest(entry.manifest);\n\tconst source = validateSource(entry.source);\n\tconst manifestDigest = boundedString(entry.manifestDigest, \"manifestDigest\", MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1);\n\tif (entry.signature !== undefined) boundedString(entry.signature, \"signature\", MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1);\n\tlet distribution: PluginDistributionDescriptorV1 | undefined;\n\tif (entry.distribution !== undefined) {\n\t\ttry {\n\t\t\tdistribution = createPluginDistributionV1().validateDescriptor(entry.distribution);\n\t\t} catch (error) {\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry distribution descriptor is invalid\"), error);\n\t\t}\n\t\tif (\n\t\t\tdistribution.pluginId !== manifest.id ||\n\t\t\tdistribution.pluginVersion !== manifest.pluginVersion ||\n\t\t\tdistribution.manifestDigest !== manifestDigest\n\t\t)\n\t\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\t\"invalid_manifest\",\n\t\t\t\tt(\"Registry distribution descriptor does not match the manifest identity\"),\n\t\t\t);\n\t}\n\treturn Object.freeze({\n\t\tmanifest,\n\t\tsource,\n\t\tmanifestDigest,\n\t\t...(entry.signature === undefined ? {} : { signature: entry.signature as string }),\n\t\t...(distribution === undefined ? {} : { distribution }),\n\t});\n}\n\nfunction validateMax(value: number | undefined): number {\n\tconst max = value ?? MAX_PLUGIN_REGISTRY_MANIFESTS_V1;\n\tif (!Number.isSafeInteger(max) || max < 1 || max > MAX_PLUGIN_REGISTRY_MANIFESTS_V1)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_limit\",\n\t\t\tt(\"maxManifests must be an integer between 1 and {max}\", { max: MAX_PLUGIN_REGISTRY_MANIFESTS_V1 }),\n\t\t);\n\treturn max;\n}\n\nasync function validateSourceProof(\n\tentry: PluginRegistryManifestEnvelopeV1,\n\tverifier: PluginRegistryDigestVerifierV1,\n\tsourceVerifier: PluginSourceVerifierV1,\n): Promise<void> {\n\tconst actualDigest = pluginManifestDigestV1(entry.manifest);\n\tif (entry.manifestDigest !== actualDigest)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_digest\",\n\t\t\tt(\"Manifest digest mismatch for {identity}\", {\n\t\t\t\tidentity: `${entry.manifest.id}@${entry.manifest.pluginVersion}`,\n\t\t\t}),\n\t\t);\n\ttry {\n\t\tconst result = await verifier.verify({\n\t\t\tmanifest: entry.manifest,\n\t\t\tsource: entry.source,\n\t\t\tmanifestDigest: actualDigest,\n\t\t\texpectedDigest: entry.manifestDigest,\n\t\t\tsignature: entry.signature,\n\t\t});\n\t\tif (result.status !== \"accepted\")\n\t\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", result.reason ?? t(\"Registry source proof was rejected\"));\n\t} catch (error) {\n\t\tif (error instanceof PluginRegistryErrorV1) throw error;\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Registry source proof was rejected\"), error);\n\t}\n\tlet result: ReturnType<PluginSourceVerifierV1>;\n\ttry {\n\t\tresult = sourceVerifier({\n\t\t\tpluginId: entry.manifest.id,\n\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\tsource: entry.source,\n\t\t\tmanifestDigest: actualDigest,\n\t\t});\n\t} catch (error) {\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Plugin source verifier failed\"), error);\n\t}\n\tif (result.status !== \"accepted\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", result.reason ?? t(\"Plugin source was rejected\"));\n}\n\nfunction sourceIdentity(entries: readonly PluginRegistryManifestEnvelopeV1[]): string {\n\tconst sources = [...new Set(entries.map((entry) => entry.source))].sort((left, right) => left.localeCompare(right));\n\treturn sources.join(\",\");\n}\n\ninterface RegistryLoadV1 {\n\treadonly accepted: readonly PluginRegistryManifestEnvelopeV1[];\n\treadonly snapshot: PluginRegistrySnapshotV1;\n}\n\n/** Create a deterministic, host-injected registry client. */\nexport function createPluginRegistryV1(options: PluginRegistryOptionsV1): PluginRegistryV1 {\n\tconst maxManifests = validateMax(options.maxManifests);\n\tif (options.source === undefined || typeof options.source.list !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"invalid_source\", t(\"Registry source must provide list()\"));\n\tif (options.source.source !== undefined) validateSource(options.source.source);\n\tif (options.verify === undefined || typeof options.verify.verify !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Registry source/digest verifier is required\"));\n\tif (options.sourceVerifier === undefined || typeof options.sourceVerifier !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Registry source verifier is required\"));\n\n\tconst load = async (input: { readonly signal?: AbortSignal } = {}): Promise<RegistryLoadV1> => {\n\t\tif (input.signal?.aborted)\n\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", t(\"Plugin registry operation was cancelled\"));\n\t\tlet raw: readonly PluginRegistryManifestEnvelopeV1[];\n\t\ttry {\n\t\t\traw = await options.source.list({ signal: input.signal });\n\t\t} catch (error) {\n\t\t\tif (isAbortLike(error, input.signal))\n\t\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", t(\"Plugin registry operation was cancelled\"), error);\n\t\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Plugin registry source failed\"), error);\n\t\t}\n\t\tif (input.signal?.aborted)\n\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", t(\"Plugin registry operation was cancelled\"));\n\t\tif (!Array.isArray(raw))\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry source must return an array\"));\n\t\tif (raw.length > maxManifests)\n\t\t\tthrow new PluginRegistryErrorV1(\"too_many_manifests\", t(\"Registry response contains too many manifests\"));\n\t\tconst entries = raw.map(validateEnvelope);\n\t\tconst payloadBytes = entries.reduce((total, entry) => {\n\t\t\tconst manifestBytes = new TextEncoder().encode(JSON.stringify(entry.manifest)).byteLength;\n\t\t\tconst distributionBytes =\n\t\t\t\tentry.distribution === undefined\n\t\t\t\t\t? 0\n\t\t\t\t\t: new TextEncoder().encode(JSON.stringify(entry.distribution)).byteLength;\n\t\t\treturn (\n\t\t\t\ttotal +\n\t\t\t\tmanifestBytes +\n\t\t\t\tdistributionBytes +\n\t\t\t\tnew TextEncoder().encode(entry.source).byteLength +\n\t\t\t\tnew TextEncoder().encode(entry.manifestDigest).byteLength +\n\t\t\t\t(entry.signature === undefined ? 0 : new TextEncoder().encode(entry.signature).byteLength)\n\t\t\t);\n\t\t}, 0);\n\t\tif (payloadBytes > MAX_PLUGIN_REGISTRY_PAYLOAD_BYTES_V1)\n\t\t\tthrow new PluginRegistryErrorV1(\"payload_too_large\", t(\"Registry response exceeds the aggregate size limit\"));\n\t\tconst seen = new Set<string>();\n\t\tconst accepted: PluginRegistryManifestEnvelopeV1[] = [];\n\t\tconst rejected: PluginRegistryRejectionV1[] = [];\n\t\tfor (const entry of entries) {\n\t\t\tconst identity = `${entry.manifest.id}@${entry.manifest.pluginVersion}`;\n\t\t\tif (seen.has(identity))\n\t\t\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\t\t\"invalid_manifest\",\n\t\t\t\t\tt(\"Duplicate registry manifest: {identity}\", { identity }),\n\t\t\t\t);\n\t\t\tseen.add(identity);\n\t\t\ttry {\n\t\t\t\tawait validateSourceProof(entry, options.verify, options.sourceVerifier);\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof PluginRegistryErrorV1)) throw error;\n\t\t\t\tif (error.cause !== undefined) throw error;\n\t\t\t\tif (error.code !== \"source_rejected\" && error.code !== \"invalid_digest\") throw error;\n\t\t\t\trejected.push({\n\t\t\t\t\tpluginId: entry.manifest.id,\n\t\t\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\t\t\tcode: error.code === \"invalid_digest\" ? \"digest_rejected\" : \"source_rejected\",\n\t\t\t\t\treason:\n\t\t\t\t\t\terror.code === \"invalid_digest\" ? \"Manifest digest mismatch\" : \"Registry source proof was rejected\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (input.signal?.aborted)\n\t\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", t(\"Plugin registry operation was cancelled\"));\n\t\t\taccepted.push(entry);\n\t\t}\n\t\tconst manifests = accepted.map((entry) => entry.manifest);\n\t\tconst catalog = buildPluginCatalogV1({\n\t\t\tmanifests,\n\t\t\thost: options.host,\n\t\t\tavailableCapabilities: options.availableCapabilities,\n\t\t\tmaxEntries: maxManifests,\n\t\t});\n\t\tconst publicEntries = Object.freeze(\n\t\t\t[...accepted]\n\t\t\t\t.sort((left, right) => {\n\t\t\t\t\tconst idOrder = left.manifest.id.localeCompare(right.manifest.id);\n\t\t\t\t\treturn idOrder === 0\n\t\t\t\t\t\t? comparePluginVersionsV1(right.manifest.pluginVersion, left.manifest.pluginVersion)\n\t\t\t\t\t\t: idOrder;\n\t\t\t\t})\n\t\t\t\t.map((entry) =>\n\t\t\t\t\tObject.freeze({\n\t\t\t\t\t\tpluginId: entry.manifest.id,\n\t\t\t\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\t\t\t\tsource: entry.source,\n\t\t\t\t\t\tmanifestDigest: entry.manifestDigest,\n\t\t\t\t\t\tsigned: entry.signature !== undefined,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t);\n\t\tconst catalogByIdentity = new Map(\n\t\t\tcatalog.entries.map((entry) => [`${entry.pluginId}@${entry.pluginVersion}`, entry] as const),\n\t\t);\n\t\tconst verified = Object.freeze(\n\t\t\tpublicEntries.flatMap((entry) => {\n\t\t\t\tconst catalogEntry = catalogByIdentity.get(`${entry.pluginId}@${entry.pluginVersion}`);\n\t\t\t\tif (catalogEntry?.resolution.status === \"installed-ready\")\n\t\t\t\t\treturn [{ ...entry, resolutionStatus: \"installed-ready\" as const }];\n\t\t\t\tconst reason = catalogEntry?.resolution.diagnostics[0]?.message ?? \"Plugin is incompatible with this host\";\n\t\t\t\trejected.push({\n\t\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\t\tpluginVersion: entry.pluginVersion,\n\t\t\t\t\tcode: \"incompatible\",\n\t\t\t\t\treason,\n\t\t\t\t});\n\t\t\t\treturn [];\n\t\t\t}),\n\t\t);\n\t\treturn {\n\t\t\taccepted: Object.freeze(accepted),\n\t\t\tsnapshot: Object.freeze({\n\t\t\t\tversion: 1,\n\t\t\t\tsource:\n\t\t\t\t\toptions.source.source === undefined ? sourceIdentity(accepted) : validateSource(options.source.source),\n\t\t\t\tentries: publicEntries,\n\t\t\t\tcatalog,\n\t\t\t\tverified,\n\t\t\t\trejected: Object.freeze(rejected),\n\t\t\t}),\n\t\t};\n\t};\n\tconst listManifests = async (\n\t\tinput: { readonly signal?: AbortSignal } = {},\n\t): Promise<readonly PluginManifestV1[]> => {\n\t\tconst loaded = await load(input);\n\t\treturn Object.freeze(\n\t\t\tloaded.snapshot.catalog.entries.flatMap((catalogEntry) =>\n\t\t\t\tloaded.accepted\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.manifest.id === catalogEntry.pluginId &&\n\t\t\t\t\t\t\tentry.manifest.pluginVersion === catalogEntry.pluginVersion,\n\t\t\t\t\t)\n\t\t\t\t\t.map((entry) => entry.manifest),\n\t\t\t),\n\t\t);\n\t};\n\treturn {\n\t\tlist: async (input = {}) => (await load(input)).snapshot,\n\t\tlistManifests,\n\t\tresolve: async (input) => {\n\t\t\tconst loaded = await load({ signal: input.signal });\n\t\t\tconst verified = new Set(loaded.snapshot.verified.map((entry) => `${entry.pluginId}@${entry.pluginVersion}`));\n\t\t\tconst identity =\n\t\t\t\tinput.pluginVersion === undefined\n\t\t\t\t\t? loaded.snapshot.catalog.entries.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.pluginId === input.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.resolution.status === \"installed-ready\" &&\n\t\t\t\t\t\t\t\tverified.has(`${candidate.pluginId}@${candidate.pluginVersion}`),\n\t\t\t\t\t\t)\n\t\t\t\t\t: loaded.snapshot.catalog.entries.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.pluginId === input.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.pluginVersion === input.pluginVersion &&\n\t\t\t\t\t\t\t\tcandidate.resolution.status === \"installed-ready\" &&\n\t\t\t\t\t\t\t\tverified.has(`${candidate.pluginId}@${candidate.pluginVersion}`),\n\t\t\t\t\t\t);\n\t\t\tconst entry =\n\t\t\t\tidentity === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: loaded.accepted.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.manifest.id === identity.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.manifest.pluginVersion === identity.pluginVersion,\n\t\t\t\t\t\t);\n\t\t\tif (entry === undefined) return undefined;\n\t\t\treturn Object.freeze({\n\t\t\t\tmanifest: entry.manifest,\n\t\t\t\tsource: entry.source,\n\t\t\t\texpectedDigest: entry.manifestDigest,\n\t\t\t\t...(entry.distribution === undefined ? {} : { distribution: entry.distribution }),\n\t\t\t});\n\t\t},\n\t};\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { t } from "../../core/i18n/index.js";
1
2
  import { buildPluginCatalogV1, comparePluginVersionsV1 } from "./catalog.js";
2
3
  import { createPluginDistributionV1 } from "./distribution.js";
3
4
  import { pluginManifestDigestV1 } from "./updates.js";
@@ -27,19 +28,19 @@ function isAbortLike(error, signal) {
27
28
  }
28
29
  function boundedString(value, label, max, code = "invalid_source") {
29
30
  if (typeof value !== "string" || value.trim() === "" || value.length > max || /[\u0000-\u001f]/u.test(value)) {
30
- throw new PluginRegistryErrorV1(code, `${label} must be a non-empty bounded string`);
31
+ throw new PluginRegistryErrorV1(code, t("{label} must be a non-empty bounded string", { label }));
31
32
  }
32
33
  return value;
33
34
  }
34
35
  function assertAllowedKeys(value, allowed, label) {
35
36
  const expected = new Set(allowed);
36
37
  if (Object.keys(value).some((key) => !expected.has(key)))
37
- throw new PluginRegistryErrorV1("invalid_manifest", `${label} contains an unsupported field`);
38
+ throw new PluginRegistryErrorV1("invalid_manifest", t("{label} contains an unsupported field", { label }));
38
39
  }
39
40
  function validateSource(source) {
40
41
  const value = boundedString(source, "source", MAX_PLUGIN_REGISTRY_SOURCE_CHARS_V1);
41
42
  if (/^(?:file:|[a-zA-Z]:[\\/]|[\\/]{1,2}|\\\\)/iu.test(value) || /\s/u.test(value)) {
42
- throw new PluginRegistryErrorV1("invalid_source", "Plugin registry source must be an opaque URI, not a local path");
43
+ throw new PluginRegistryErrorV1("invalid_source", t("Plugin registry source must be an opaque URI, not a local path"));
43
44
  }
44
45
  if (/^https?:\/\//iu.test(value)) {
45
46
  try {
@@ -48,14 +49,14 @@ function validateSource(source) {
48
49
  return `${parsed.origin}${pathname || "/"}`;
49
50
  }
50
51
  catch (error) {
51
- throw new PluginRegistryErrorV1("invalid_source", "Plugin registry source URL is invalid", error);
52
+ throw new PluginRegistryErrorV1("invalid_source", t("Plugin registry source URL is invalid"), error);
52
53
  }
53
54
  }
54
55
  return value;
55
56
  }
56
57
  function validateManifest(manifest) {
57
58
  if (typeof manifest !== "object" || manifest === null || Array.isArray(manifest)) {
58
- throw new PluginRegistryErrorV1("invalid_manifest", "Registry manifest must be an object");
59
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Registry manifest must be an object"));
59
60
  }
60
61
  const value = manifest;
61
62
  assertAllowedKeys(value, [
@@ -70,27 +71,27 @@ function validateManifest(manifest) {
70
71
  "testOnly",
71
72
  ], "Registry manifest");
72
73
  if (typeof value.id !== "string" || value.id.trim() === "" || value.id.length > 256)
73
- throw new PluginRegistryErrorV1("invalid_manifest", "Registry manifest id is invalid");
74
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Registry manifest id is invalid"));
74
75
  if (typeof value.pluginVersion !== "string" || value.pluginVersion.trim() === "" || value.pluginVersion.length > 256)
75
- throw new PluginRegistryErrorV1("invalid_manifest", "Registry manifest pluginVersion is invalid");
76
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Registry manifest pluginVersion is invalid"));
76
77
  if (typeof value.apiVersion !== "string" || value.apiVersion.trim() === "" || value.apiVersion.length > 256)
77
- throw new PluginRegistryErrorV1("invalid_manifest", "Registry manifest apiVersion is invalid");
78
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Registry manifest apiVersion is invalid"));
78
79
  if (value.minHostVersion === undefined && value.maxHostVersion === undefined)
79
- throw new PluginRegistryErrorV1("invalid_manifest", "Published plugins must declare host version compatibility range: set minHostVersion and/or maxHostVersion");
80
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Published plugins must declare host version compatibility range: set minHostVersion and/or maxHostVersion"));
80
81
  let bytes;
81
82
  try {
82
83
  bytes = new TextEncoder().encode(JSON.stringify(manifest)).byteLength;
83
84
  }
84
85
  catch (error) {
85
- throw new PluginRegistryErrorV1("invalid_manifest", "Registry manifest cannot be serialized", error);
86
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Registry manifest cannot be serialized"), error);
86
87
  }
87
88
  if (bytes > MAX_PLUGIN_REGISTRY_MANIFEST_BYTES_V1)
88
- throw new PluginRegistryErrorV1("payload_too_large", "Registry manifest exceeds the size limit");
89
+ throw new PluginRegistryErrorV1("payload_too_large", t("Registry manifest exceeds the size limit"));
89
90
  return Object.freeze({ ...value });
90
91
  }
91
92
  function validateEnvelope(value) {
92
93
  if (typeof value !== "object" || value === null || Array.isArray(value))
93
- throw new PluginRegistryErrorV1("invalid_manifest", "Registry response entry must be an object");
94
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Registry response entry must be an object"));
94
95
  const entry = value;
95
96
  assertAllowedKeys(entry, ["manifest", "source", "manifestDigest", "signature", "distribution"], "Registry response entry");
96
97
  const manifest = validateManifest(entry.manifest);
@@ -104,12 +105,12 @@ function validateEnvelope(value) {
104
105
  distribution = createPluginDistributionV1().validateDescriptor(entry.distribution);
105
106
  }
106
107
  catch (error) {
107
- throw new PluginRegistryErrorV1("invalid_manifest", "Registry distribution descriptor is invalid", error);
108
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Registry distribution descriptor is invalid"), error);
108
109
  }
109
110
  if (distribution.pluginId !== manifest.id ||
110
111
  distribution.pluginVersion !== manifest.pluginVersion ||
111
112
  distribution.manifestDigest !== manifestDigest)
112
- throw new PluginRegistryErrorV1("invalid_manifest", "Registry distribution descriptor does not match the manifest identity");
113
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Registry distribution descriptor does not match the manifest identity"));
113
114
  }
114
115
  return Object.freeze({
115
116
  manifest,
@@ -122,13 +123,15 @@ function validateEnvelope(value) {
122
123
  function validateMax(value) {
123
124
  const max = value ?? MAX_PLUGIN_REGISTRY_MANIFESTS_V1;
124
125
  if (!Number.isSafeInteger(max) || max < 1 || max > MAX_PLUGIN_REGISTRY_MANIFESTS_V1)
125
- throw new PluginRegistryErrorV1("invalid_limit", `maxManifests must be an integer between 1 and ${MAX_PLUGIN_REGISTRY_MANIFESTS_V1}`);
126
+ throw new PluginRegistryErrorV1("invalid_limit", t("maxManifests must be an integer between 1 and {max}", { max: MAX_PLUGIN_REGISTRY_MANIFESTS_V1 }));
126
127
  return max;
127
128
  }
128
129
  async function validateSourceProof(entry, verifier, sourceVerifier) {
129
130
  const actualDigest = pluginManifestDigestV1(entry.manifest);
130
131
  if (entry.manifestDigest !== actualDigest)
131
- throw new PluginRegistryErrorV1("invalid_digest", `Manifest digest mismatch for ${entry.manifest.id}@${entry.manifest.pluginVersion}`);
132
+ throw new PluginRegistryErrorV1("invalid_digest", t("Manifest digest mismatch for {identity}", {
133
+ identity: `${entry.manifest.id}@${entry.manifest.pluginVersion}`,
134
+ }));
132
135
  try {
133
136
  const result = await verifier.verify({
134
137
  manifest: entry.manifest,
@@ -138,12 +141,12 @@ async function validateSourceProof(entry, verifier, sourceVerifier) {
138
141
  signature: entry.signature,
139
142
  });
140
143
  if (result.status !== "accepted")
141
- throw new PluginRegistryErrorV1("source_rejected", result.reason ?? "Registry source proof was rejected");
144
+ throw new PluginRegistryErrorV1("source_rejected", result.reason ?? t("Registry source proof was rejected"));
142
145
  }
143
146
  catch (error) {
144
147
  if (error instanceof PluginRegistryErrorV1)
145
148
  throw error;
146
- throw new PluginRegistryErrorV1("source_rejected", "Registry source proof was rejected", error);
149
+ throw new PluginRegistryErrorV1("source_rejected", t("Registry source proof was rejected"), error);
147
150
  }
148
151
  let result;
149
152
  try {
@@ -155,10 +158,10 @@ async function validateSourceProof(entry, verifier, sourceVerifier) {
155
158
  });
156
159
  }
157
160
  catch (error) {
158
- throw new PluginRegistryErrorV1("source_rejected", "Plugin source verifier failed", error);
161
+ throw new PluginRegistryErrorV1("source_rejected", t("Plugin source verifier failed"), error);
159
162
  }
160
163
  if (result.status !== "accepted")
161
- throw new PluginRegistryErrorV1("source_rejected", result.reason ?? "Plugin source was rejected");
164
+ throw new PluginRegistryErrorV1("source_rejected", result.reason ?? t("Plugin source was rejected"));
162
165
  }
163
166
  function sourceIdentity(entries) {
164
167
  const sources = [...new Set(entries.map((entry) => entry.source))].sort((left, right) => left.localeCompare(right));
@@ -168,31 +171,31 @@ function sourceIdentity(entries) {
168
171
  export function createPluginRegistryV1(options) {
169
172
  const maxManifests = validateMax(options.maxManifests);
170
173
  if (options.source === undefined || typeof options.source.list !== "function")
171
- throw new PluginRegistryErrorV1("invalid_source", "Registry source must provide list()");
174
+ throw new PluginRegistryErrorV1("invalid_source", t("Registry source must provide list()"));
172
175
  if (options.source.source !== undefined)
173
176
  validateSource(options.source.source);
174
177
  if (options.verify === undefined || typeof options.verify.verify !== "function")
175
- throw new PluginRegistryErrorV1("source_rejected", "Registry source/digest verifier is required");
178
+ throw new PluginRegistryErrorV1("source_rejected", t("Registry source/digest verifier is required"));
176
179
  if (options.sourceVerifier === undefined || typeof options.sourceVerifier !== "function")
177
- throw new PluginRegistryErrorV1("source_rejected", "Registry source verifier is required");
180
+ throw new PluginRegistryErrorV1("source_rejected", t("Registry source verifier is required"));
178
181
  const load = async (input = {}) => {
179
182
  if (input.signal?.aborted)
180
- throw new PluginRegistryErrorV1("cancelled", "Plugin registry operation was cancelled");
183
+ throw new PluginRegistryErrorV1("cancelled", t("Plugin registry operation was cancelled"));
181
184
  let raw;
182
185
  try {
183
186
  raw = await options.source.list({ signal: input.signal });
184
187
  }
185
188
  catch (error) {
186
189
  if (isAbortLike(error, input.signal))
187
- throw new PluginRegistryErrorV1("cancelled", "Plugin registry operation was cancelled", error);
188
- throw new PluginRegistryErrorV1("source_rejected", "Plugin registry source failed", error);
190
+ throw new PluginRegistryErrorV1("cancelled", t("Plugin registry operation was cancelled"), error);
191
+ throw new PluginRegistryErrorV1("source_rejected", t("Plugin registry source failed"), error);
189
192
  }
190
193
  if (input.signal?.aborted)
191
- throw new PluginRegistryErrorV1("cancelled", "Plugin registry operation was cancelled");
194
+ throw new PluginRegistryErrorV1("cancelled", t("Plugin registry operation was cancelled"));
192
195
  if (!Array.isArray(raw))
193
- throw new PluginRegistryErrorV1("invalid_manifest", "Registry source must return an array");
196
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Registry source must return an array"));
194
197
  if (raw.length > maxManifests)
195
- throw new PluginRegistryErrorV1("too_many_manifests", "Registry response contains too many manifests");
198
+ throw new PluginRegistryErrorV1("too_many_manifests", t("Registry response contains too many manifests"));
196
199
  const entries = raw.map(validateEnvelope);
197
200
  const payloadBytes = entries.reduce((total, entry) => {
198
201
  const manifestBytes = new TextEncoder().encode(JSON.stringify(entry.manifest)).byteLength;
@@ -207,14 +210,14 @@ export function createPluginRegistryV1(options) {
207
210
  (entry.signature === undefined ? 0 : new TextEncoder().encode(entry.signature).byteLength));
208
211
  }, 0);
209
212
  if (payloadBytes > MAX_PLUGIN_REGISTRY_PAYLOAD_BYTES_V1)
210
- throw new PluginRegistryErrorV1("payload_too_large", "Registry response exceeds the aggregate size limit");
213
+ throw new PluginRegistryErrorV1("payload_too_large", t("Registry response exceeds the aggregate size limit"));
211
214
  const seen = new Set();
212
215
  const accepted = [];
213
216
  const rejected = [];
214
217
  for (const entry of entries) {
215
218
  const identity = `${entry.manifest.id}@${entry.manifest.pluginVersion}`;
216
219
  if (seen.has(identity))
217
- throw new PluginRegistryErrorV1("invalid_manifest", `Duplicate registry manifest: ${identity}`);
220
+ throw new PluginRegistryErrorV1("invalid_manifest", t("Duplicate registry manifest: {identity}", { identity }));
218
221
  seen.add(identity);
219
222
  try {
220
223
  await validateSourceProof(entry, options.verify, options.sourceVerifier);
@@ -235,7 +238,7 @@ export function createPluginRegistryV1(options) {
235
238
  continue;
236
239
  }
237
240
  if (input.signal?.aborted)
238
- throw new PluginRegistryErrorV1("cancelled", "Plugin registry operation was cancelled");
241
+ throw new PluginRegistryErrorV1("cancelled", t("Plugin registry operation was cancelled"));
239
242
  accepted.push(entry);
240
243
  }
241
244
  const manifests = accepted.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AAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;aACjF,CAAC,CAAC;QAAA,CACH;KACD,CAAC;AAAA,CACF","sourcesContent":["import { buildPluginCatalogV1, comparePluginVersionsV1, type PluginCatalogSnapshotV1 } from \"./catalog.ts\";\nimport type { PluginDistributionDescriptorV1 } from \"./distribution.ts\";\nimport { createPluginDistributionV1 } from \"./distribution.ts\";\nimport type { CapabilityRefV1, HostFactsV1, PluginManifestV1, PluginSourceVerifierV1 } from \"./types.ts\";\nimport { pluginManifestDigestV1 } from \"./updates.ts\";\n\n/** Maximum manifest JSON bytes accepted by the registry boundary. */\nexport const MAX_PLUGIN_REGISTRY_MANIFEST_BYTES_V1 = 64 * 1024;\n/** Maximum number of manifests returned by one source query. */\nexport const MAX_PLUGIN_REGISTRY_MANIFESTS_V1 = 256;\n/** Maximum aggregate manifest metadata returned by one source query. */\nexport const MAX_PLUGIN_REGISTRY_PAYLOAD_BYTES_V1 = 4 * 1024 * 1024;\n/** Maximum source URI length; sources are identifiers, never package paths. */\nexport const MAX_PLUGIN_REGISTRY_SOURCE_CHARS_V1 = 2048;\n/** Maximum digest/signature text length accepted from a source. */\nexport const MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1 = 512;\n\nexport interface PluginRegistryManifestEnvelopeV1 {\n\treadonly manifest: PluginManifestV1;\n\treadonly source: string;\n\treadonly manifestDigest: string;\n\t/** Optional host- or registry-supplied signature. The verifier owns semantics. */\n\treadonly signature?: string;\n\t/** Optional signed artifact descriptor bound to this exact manifest identity. */\n\treadonly distribution?: PluginDistributionDescriptorV1;\n}\n\n/**\n * A transport-neutral registry source. Hosts inject HTTP, filesystem, or\n * package-manager implementations. The registry never receives package bytes\n * and never exposes source response bodies to the model context.\n */\nexport interface PluginRegistrySourceV1 {\n\t/** Optional stable source identity shown in diagnostics; never a local path. */\n\treadonly source?: string;\n\treadonly list: (input: { readonly signal?: AbortSignal }) => Promise<readonly PluginRegistryManifestEnvelopeV1[]>;\n}\n\nexport interface PluginRegistryDigestVerifierV1 {\n\treadonly verify: (input: {\n\t\treadonly manifest: PluginManifestV1;\n\t\treadonly source: string;\n\t\treadonly manifestDigest: string;\n\t\treadonly expectedDigest?: string;\n\t\treadonly signature?: string;\n\t}) =>\n\t\t| { readonly status: \"accepted\" }\n\t\t| { readonly status: \"rejected\"; readonly reason?: string }\n\t\t| Promise<{ readonly status: \"accepted\" } | { readonly status: \"rejected\"; readonly reason?: string }>;\n}\n\nexport interface PluginRegistryOptionsV1 {\n\treadonly source: PluginRegistrySourceV1;\n\treadonly host: HostFactsV1;\n\t/** Required digest/signature verifier. No implicit trust fallback. */\n\treadonly verify: PluginRegistryDigestVerifierV1;\n\t/** Existing source verifier contract is mandatory at the registry boundary. */\n\treadonly sourceVerifier: PluginSourceVerifierV1;\n\treadonly availableCapabilities?: readonly CapabilityRefV1[];\n\treadonly maxManifests?: number;\n}\n\nexport type PluginRegistryErrorCodeV1 =\n\t| \"cancelled\"\n\t| \"invalid_limit\"\n\t| \"source_rejected\"\n\t| \"invalid_manifest\"\n\t| \"invalid_source\"\n\t| \"invalid_digest\"\n\t| \"payload_too_large\"\n\t| \"too_many_manifests\"\n\t| \"incompatible\";\n\nexport class PluginRegistryErrorV1 extends Error {\n\treadonly code: PluginRegistryErrorCodeV1;\n\treadonly cause?: unknown;\n\n\tconstructor(code: PluginRegistryErrorCodeV1, message: string, cause?: unknown) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"PluginRegistryErrorV1\";\n\t\tthis.code = code;\n\t\tthis.cause = cause;\n\t}\n}\n\nexport interface PluginRegistryEntryV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly source: string;\n\treadonly manifestDigest: string;\n\treadonly signed: boolean;\n}\n\nexport type PluginRegistryRejectionCodeV1 = \"source_rejected\" | \"digest_rejected\" | \"incompatible\";\n\nexport interface PluginRegistryRejectionV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly code: PluginRegistryRejectionCodeV1;\n\treadonly reason: string;\n}\n\nexport interface PluginRegistryVerifiedEntryV1 extends PluginRegistryEntryV1 {\n\treadonly resolutionStatus: \"installed-ready\";\n}\n\nexport interface PluginRegistrySnapshotV1 {\n\treadonly version: 1;\n\treadonly source: string;\n\treadonly entries: readonly PluginRegistryEntryV1[];\n\treadonly catalog: PluginCatalogSnapshotV1;\n\t/** Only entries that passed proof validation and host compatibility. */\n\treadonly verified: readonly PluginRegistryVerifiedEntryV1[];\n\t/** Platform/API/test-only entries remain visible in catalog but are not verified. */\n\treadonly rejected: readonly PluginRegistryRejectionV1[];\n}\n\n/** Host-side package projection; package bytes never cross this boundary. */\nexport interface PluginRegistryResolvedPackageV1 {\n\treadonly manifest: PluginManifestV1;\n\treadonly source: string;\n\treadonly expectedDigest: string;\n\treadonly distribution?: PluginDistributionDescriptorV1;\n}\n\nexport interface PluginRegistryV1 {\n\treadonly list: (input?: { readonly signal?: AbortSignal }) => Promise<PluginRegistrySnapshotV1>;\n\t/** Optional host-side resolver. Older custom registry implementations may omit it. */\n\treadonly resolve?: (input: {\n\t\treadonly pluginId: string;\n\t\treadonly pluginVersion?: string;\n\t\treadonly signal?: AbortSignal;\n\t}) => Promise<PluginRegistryResolvedPackageV1 | undefined>;\n\t/** Optional host-side manifest projection used by the CLI catalog command. */\n\treadonly listManifests?: (input?: { readonly signal?: AbortSignal }) => Promise<readonly PluginManifestV1[]>;\n}\n\nfunction isAbortLike(error: unknown, signal: AbortSignal | undefined): boolean {\n\treturn (\n\t\tsignal?.aborted === true ||\n\t\t(error instanceof Error && (error.name === \"AbortError\" || error.name === \"AbortSignalError\"))\n\t);\n}\n\nfunction boundedString(\n\tvalue: unknown,\n\tlabel: string,\n\tmax: number,\n\tcode: PluginRegistryErrorCodeV1 = \"invalid_source\",\n): string {\n\tif (typeof value !== \"string\" || value.trim() === \"\" || value.length > max || /[\\u0000-\\u001f]/u.test(value)) {\n\t\tthrow new PluginRegistryErrorV1(code, `${label} must be a non-empty bounded string`);\n\t}\n\treturn value;\n}\n\nfunction assertAllowedKeys(value: Record<string, unknown>, allowed: readonly string[], label: string): void {\n\tconst expected = new Set(allowed);\n\tif (Object.keys(value).some((key) => !expected.has(key)))\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", `${label} contains an unsupported field`);\n}\n\nfunction validateSource(source: unknown): string {\n\tconst value = boundedString(source, \"source\", MAX_PLUGIN_REGISTRY_SOURCE_CHARS_V1);\n\tif (/^(?:file:|[a-zA-Z]:[\\\\/]|[\\\\/]{1,2}|\\\\\\\\)/iu.test(value) || /\\s/u.test(value)) {\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_source\",\n\t\t\t\"Plugin registry source must be an opaque URI, not a local path\",\n\t\t);\n\t}\n\tif (/^https?:\\/\\//iu.test(value)) {\n\t\ttry {\n\t\t\tconst parsed = new URL(value);\n\t\t\tconst pathname = parsed.pathname.length > 512 ? `${parsed.pathname.slice(0, 511)}…` : parsed.pathname;\n\t\t\treturn `${parsed.origin}${pathname || \"/\"}`;\n\t\t} catch (error) {\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_source\", \"Plugin registry source URL is invalid\", error);\n\t\t}\n\t}\n\treturn value;\n}\n\nfunction validateManifest(manifest: unknown): PluginManifestV1 {\n\tif (typeof manifest !== \"object\" || manifest === null || Array.isArray(manifest)) {\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest must be an object\");\n\t}\n\tconst value = manifest as Record<string, unknown>;\n\tassertAllowedKeys(\n\t\tvalue,\n\t\t[\n\t\t\t\"id\",\n\t\t\t\"pluginVersion\",\n\t\t\t\"apiVersion\",\n\t\t\t\"minHostVersion\",\n\t\t\t\"maxHostVersion\",\n\t\t\t\"capabilityRefs\",\n\t\t\t\"requires\",\n\t\t\t\"platform\",\n\t\t\t\"testOnly\",\n\t\t],\n\t\t\"Registry manifest\",\n\t);\n\tif (typeof value.id !== \"string\" || value.id.trim() === \"\" || value.id.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest id is invalid\");\n\tif (typeof value.pluginVersion !== \"string\" || value.pluginVersion.trim() === \"\" || value.pluginVersion.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest pluginVersion is invalid\");\n\tif (typeof value.apiVersion !== \"string\" || value.apiVersion.trim() === \"\" || value.apiVersion.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest apiVersion is invalid\");\n\tif (value.minHostVersion === undefined && value.maxHostVersion === undefined)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_manifest\",\n\t\t\t\"Published plugins must declare host version compatibility range: set minHostVersion and/or maxHostVersion\",\n\t\t);\n\tlet bytes: number;\n\ttry {\n\t\tbytes = new TextEncoder().encode(JSON.stringify(manifest)).byteLength;\n\t} catch (error) {\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry manifest cannot be serialized\", error);\n\t}\n\tif (bytes > MAX_PLUGIN_REGISTRY_MANIFEST_BYTES_V1)\n\t\tthrow new PluginRegistryErrorV1(\"payload_too_large\", \"Registry manifest exceeds the size limit\");\n\treturn Object.freeze({ ...value } as unknown as PluginManifestV1);\n}\n\nfunction validateEnvelope(value: unknown): PluginRegistryManifestEnvelopeV1 {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value))\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry response entry must be an object\");\n\tconst entry = value as Record<string, unknown>;\n\tassertAllowedKeys(\n\t\tentry,\n\t\t[\"manifest\", \"source\", \"manifestDigest\", \"signature\", \"distribution\"],\n\t\t\"Registry response entry\",\n\t);\n\tconst manifest = validateManifest(entry.manifest);\n\tconst source = validateSource(entry.source);\n\tconst manifestDigest = boundedString(entry.manifestDigest, \"manifestDigest\", MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1);\n\tif (entry.signature !== undefined) boundedString(entry.signature, \"signature\", MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1);\n\tlet distribution: PluginDistributionDescriptorV1 | undefined;\n\tif (entry.distribution !== undefined) {\n\t\ttry {\n\t\t\tdistribution = createPluginDistributionV1().validateDescriptor(entry.distribution);\n\t\t} catch (error) {\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry distribution descriptor is invalid\", error);\n\t\t}\n\t\tif (\n\t\t\tdistribution.pluginId !== manifest.id ||\n\t\t\tdistribution.pluginVersion !== manifest.pluginVersion ||\n\t\t\tdistribution.manifestDigest !== manifestDigest\n\t\t)\n\t\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\t\"invalid_manifest\",\n\t\t\t\t\"Registry distribution descriptor does not match the manifest identity\",\n\t\t\t);\n\t}\n\treturn Object.freeze({\n\t\tmanifest,\n\t\tsource,\n\t\tmanifestDigest,\n\t\t...(entry.signature === undefined ? {} : { signature: entry.signature as string }),\n\t\t...(distribution === undefined ? {} : { distribution }),\n\t});\n}\n\nfunction validateMax(value: number | undefined): number {\n\tconst max = value ?? MAX_PLUGIN_REGISTRY_MANIFESTS_V1;\n\tif (!Number.isSafeInteger(max) || max < 1 || max > MAX_PLUGIN_REGISTRY_MANIFESTS_V1)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_limit\",\n\t\t\t`maxManifests must be an integer between 1 and ${MAX_PLUGIN_REGISTRY_MANIFESTS_V1}`,\n\t\t);\n\treturn max;\n}\n\nasync function validateSourceProof(\n\tentry: PluginRegistryManifestEnvelopeV1,\n\tverifier: PluginRegistryDigestVerifierV1,\n\tsourceVerifier: PluginSourceVerifierV1,\n): Promise<void> {\n\tconst actualDigest = pluginManifestDigestV1(entry.manifest);\n\tif (entry.manifestDigest !== actualDigest)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_digest\",\n\t\t\t`Manifest digest mismatch for ${entry.manifest.id}@${entry.manifest.pluginVersion}`,\n\t\t);\n\ttry {\n\t\tconst result = await verifier.verify({\n\t\t\tmanifest: entry.manifest,\n\t\t\tsource: entry.source,\n\t\t\tmanifestDigest: actualDigest,\n\t\t\texpectedDigest: entry.manifestDigest,\n\t\t\tsignature: entry.signature,\n\t\t});\n\t\tif (result.status !== \"accepted\")\n\t\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", result.reason ?? \"Registry source proof was rejected\");\n\t} catch (error) {\n\t\tif (error instanceof PluginRegistryErrorV1) throw error;\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Registry source proof was rejected\", error);\n\t}\n\tlet result: ReturnType<PluginSourceVerifierV1>;\n\ttry {\n\t\tresult = sourceVerifier({\n\t\t\tpluginId: entry.manifest.id,\n\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\tsource: entry.source,\n\t\t\tmanifestDigest: actualDigest,\n\t\t});\n\t} catch (error) {\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Plugin source verifier failed\", error);\n\t}\n\tif (result.status !== \"accepted\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", result.reason ?? \"Plugin source was rejected\");\n}\n\nfunction sourceIdentity(entries: readonly PluginRegistryManifestEnvelopeV1[]): string {\n\tconst sources = [...new Set(entries.map((entry) => entry.source))].sort((left, right) => left.localeCompare(right));\n\treturn sources.join(\",\");\n}\n\ninterface RegistryLoadV1 {\n\treadonly accepted: readonly PluginRegistryManifestEnvelopeV1[];\n\treadonly snapshot: PluginRegistrySnapshotV1;\n}\n\n/** Create a deterministic, host-injected registry client. */\nexport function createPluginRegistryV1(options: PluginRegistryOptionsV1): PluginRegistryV1 {\n\tconst maxManifests = validateMax(options.maxManifests);\n\tif (options.source === undefined || typeof options.source.list !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"invalid_source\", \"Registry source must provide list()\");\n\tif (options.source.source !== undefined) validateSource(options.source.source);\n\tif (options.verify === undefined || typeof options.verify.verify !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Registry source/digest verifier is required\");\n\tif (options.sourceVerifier === undefined || typeof options.sourceVerifier !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Registry source verifier is required\");\n\n\tconst load = async (input: { readonly signal?: AbortSignal } = {}): Promise<RegistryLoadV1> => {\n\t\tif (input.signal?.aborted)\n\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", \"Plugin registry operation was cancelled\");\n\t\tlet raw: readonly PluginRegistryManifestEnvelopeV1[];\n\t\ttry {\n\t\t\traw = await options.source.list({ signal: input.signal });\n\t\t} catch (error) {\n\t\t\tif (isAbortLike(error, input.signal))\n\t\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", \"Plugin registry operation was cancelled\", error);\n\t\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", \"Plugin registry source failed\", error);\n\t\t}\n\t\tif (input.signal?.aborted)\n\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", \"Plugin registry operation was cancelled\");\n\t\tif (!Array.isArray(raw))\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", \"Registry source must return an array\");\n\t\tif (raw.length > maxManifests)\n\t\t\tthrow new PluginRegistryErrorV1(\"too_many_manifests\", \"Registry response contains too many manifests\");\n\t\tconst entries = raw.map(validateEnvelope);\n\t\tconst payloadBytes = entries.reduce((total, entry) => {\n\t\t\tconst manifestBytes = new TextEncoder().encode(JSON.stringify(entry.manifest)).byteLength;\n\t\t\tconst distributionBytes =\n\t\t\t\tentry.distribution === undefined\n\t\t\t\t\t? 0\n\t\t\t\t\t: new TextEncoder().encode(JSON.stringify(entry.distribution)).byteLength;\n\t\t\treturn (\n\t\t\t\ttotal +\n\t\t\t\tmanifestBytes +\n\t\t\t\tdistributionBytes +\n\t\t\t\tnew TextEncoder().encode(entry.source).byteLength +\n\t\t\t\tnew TextEncoder().encode(entry.manifestDigest).byteLength +\n\t\t\t\t(entry.signature === undefined ? 0 : new TextEncoder().encode(entry.signature).byteLength)\n\t\t\t);\n\t\t}, 0);\n\t\tif (payloadBytes > MAX_PLUGIN_REGISTRY_PAYLOAD_BYTES_V1)\n\t\t\tthrow new PluginRegistryErrorV1(\"payload_too_large\", \"Registry response exceeds the aggregate size limit\");\n\t\tconst seen = new Set<string>();\n\t\tconst accepted: PluginRegistryManifestEnvelopeV1[] = [];\n\t\tconst rejected: PluginRegistryRejectionV1[] = [];\n\t\tfor (const entry of entries) {\n\t\t\tconst identity = `${entry.manifest.id}@${entry.manifest.pluginVersion}`;\n\t\t\tif (seen.has(identity))\n\t\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", `Duplicate registry manifest: ${identity}`);\n\t\t\tseen.add(identity);\n\t\t\ttry {\n\t\t\t\tawait validateSourceProof(entry, options.verify, options.sourceVerifier);\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof PluginRegistryErrorV1)) throw error;\n\t\t\t\tif (error.cause !== undefined) throw error;\n\t\t\t\tif (error.code !== \"source_rejected\" && error.code !== \"invalid_digest\") throw error;\n\t\t\t\trejected.push({\n\t\t\t\t\tpluginId: entry.manifest.id,\n\t\t\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\t\t\tcode: error.code === \"invalid_digest\" ? \"digest_rejected\" : \"source_rejected\",\n\t\t\t\t\treason:\n\t\t\t\t\t\terror.code === \"invalid_digest\" ? \"Manifest digest mismatch\" : \"Registry source proof was rejected\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (input.signal?.aborted)\n\t\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", \"Plugin registry operation was cancelled\");\n\t\t\taccepted.push(entry);\n\t\t}\n\t\tconst manifests = accepted.map((entry) => entry.manifest);\n\t\tconst catalog = buildPluginCatalogV1({\n\t\t\tmanifests,\n\t\t\thost: options.host,\n\t\t\tavailableCapabilities: options.availableCapabilities,\n\t\t\tmaxEntries: maxManifests,\n\t\t});\n\t\tconst publicEntries = Object.freeze(\n\t\t\t[...accepted]\n\t\t\t\t.sort((left, right) => {\n\t\t\t\t\tconst idOrder = left.manifest.id.localeCompare(right.manifest.id);\n\t\t\t\t\treturn idOrder === 0\n\t\t\t\t\t\t? comparePluginVersionsV1(right.manifest.pluginVersion, left.manifest.pluginVersion)\n\t\t\t\t\t\t: idOrder;\n\t\t\t\t})\n\t\t\t\t.map((entry) =>\n\t\t\t\t\tObject.freeze({\n\t\t\t\t\t\tpluginId: entry.manifest.id,\n\t\t\t\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\t\t\t\tsource: entry.source,\n\t\t\t\t\t\tmanifestDigest: entry.manifestDigest,\n\t\t\t\t\t\tsigned: entry.signature !== undefined,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t);\n\t\tconst catalogByIdentity = new Map(\n\t\t\tcatalog.entries.map((entry) => [`${entry.pluginId}@${entry.pluginVersion}`, entry] as const),\n\t\t);\n\t\tconst verified = Object.freeze(\n\t\t\tpublicEntries.flatMap((entry) => {\n\t\t\t\tconst catalogEntry = catalogByIdentity.get(`${entry.pluginId}@${entry.pluginVersion}`);\n\t\t\t\tif (catalogEntry?.resolution.status === \"installed-ready\")\n\t\t\t\t\treturn [{ ...entry, resolutionStatus: \"installed-ready\" as const }];\n\t\t\t\tconst reason = catalogEntry?.resolution.diagnostics[0]?.message ?? \"Plugin is incompatible with this host\";\n\t\t\t\trejected.push({\n\t\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\t\tpluginVersion: entry.pluginVersion,\n\t\t\t\t\tcode: \"incompatible\",\n\t\t\t\t\treason,\n\t\t\t\t});\n\t\t\t\treturn [];\n\t\t\t}),\n\t\t);\n\t\treturn {\n\t\t\taccepted: Object.freeze(accepted),\n\t\t\tsnapshot: Object.freeze({\n\t\t\t\tversion: 1,\n\t\t\t\tsource:\n\t\t\t\t\toptions.source.source === undefined ? sourceIdentity(accepted) : validateSource(options.source.source),\n\t\t\t\tentries: publicEntries,\n\t\t\t\tcatalog,\n\t\t\t\tverified,\n\t\t\t\trejected: Object.freeze(rejected),\n\t\t\t}),\n\t\t};\n\t};\n\tconst listManifests = async (\n\t\tinput: { readonly signal?: AbortSignal } = {},\n\t): Promise<readonly PluginManifestV1[]> => {\n\t\tconst loaded = await load(input);\n\t\treturn Object.freeze(\n\t\t\tloaded.snapshot.catalog.entries.flatMap((catalogEntry) =>\n\t\t\t\tloaded.accepted\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.manifest.id === catalogEntry.pluginId &&\n\t\t\t\t\t\t\tentry.manifest.pluginVersion === catalogEntry.pluginVersion,\n\t\t\t\t\t)\n\t\t\t\t\t.map((entry) => entry.manifest),\n\t\t\t),\n\t\t);\n\t};\n\treturn {\n\t\tlist: async (input = {}) => (await load(input)).snapshot,\n\t\tlistManifests,\n\t\tresolve: async (input) => {\n\t\t\tconst loaded = await load({ signal: input.signal });\n\t\t\tconst verified = new Set(loaded.snapshot.verified.map((entry) => `${entry.pluginId}@${entry.pluginVersion}`));\n\t\t\tconst identity =\n\t\t\t\tinput.pluginVersion === undefined\n\t\t\t\t\t? loaded.snapshot.catalog.entries.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.pluginId === input.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.resolution.status === \"installed-ready\" &&\n\t\t\t\t\t\t\t\tverified.has(`${candidate.pluginId}@${candidate.pluginVersion}`),\n\t\t\t\t\t\t)\n\t\t\t\t\t: loaded.snapshot.catalog.entries.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.pluginId === input.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.pluginVersion === input.pluginVersion &&\n\t\t\t\t\t\t\t\tcandidate.resolution.status === \"installed-ready\" &&\n\t\t\t\t\t\t\t\tverified.has(`${candidate.pluginId}@${candidate.pluginVersion}`),\n\t\t\t\t\t\t);\n\t\t\tconst entry =\n\t\t\t\tidentity === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: loaded.accepted.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.manifest.id === identity.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.manifest.pluginVersion === identity.pluginVersion,\n\t\t\t\t\t\t);\n\t\t\tif (entry === undefined) return undefined;\n\t\t\treturn Object.freeze({\n\t\t\t\tmanifest: entry.manifest,\n\t\t\t\tsource: entry.source,\n\t\t\t\texpectedDigest: entry.manifestDigest,\n\t\t\t\t...(entry.distribution === undefined ? {} : { distribution: entry.distribution }),\n\t\t\t});\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/plugins/ecosystem/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,0BAA0B,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAgC,MAAM,cAAc,CAAC;AAE3G,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,qEAAqE;AACrE,MAAM,CAAC,MAAM,qCAAqC,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/D,gEAAgE;AAChE,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,CAAC;AACpD,wEAAwE;AACxE,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACpE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mCAAmC,GAAG,IAAI,CAAC;AACxD,mEAAmE;AACnE,MAAM,CAAC,MAAM,kCAAkC,GAAG,GAAG,CAAC;AA0DtD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACtC,IAAI,CAA4B;IAChC,KAAK,CAAW;IAEzB,YAAY,IAA+B,EAAE,OAAe,EAAE,KAAe,EAAE;QAC9E,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,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parePluginVersionsV1, type PluginCatalogSnapshotV1 } from \"./catalog.ts\";\nimport type { PluginDistributionDescriptorV1 } from \"./distribution.ts\";\nimport { createPluginDistributionV1 } from \"./distribution.ts\";\nimport type { CapabilityRefV1, HostFactsV1, PluginManifestV1, PluginSourceVerifierV1 } from \"./types.ts\";\nimport { pluginManifestDigestV1 } from \"./updates.ts\";\n\n/** Maximum manifest JSON bytes accepted by the registry boundary. */\nexport const MAX_PLUGIN_REGISTRY_MANIFEST_BYTES_V1 = 64 * 1024;\n/** Maximum number of manifests returned by one source query. */\nexport const MAX_PLUGIN_REGISTRY_MANIFESTS_V1 = 256;\n/** Maximum aggregate manifest metadata returned by one source query. */\nexport const MAX_PLUGIN_REGISTRY_PAYLOAD_BYTES_V1 = 4 * 1024 * 1024;\n/** Maximum source URI length; sources are identifiers, never package paths. */\nexport const MAX_PLUGIN_REGISTRY_SOURCE_CHARS_V1 = 2048;\n/** Maximum digest/signature text length accepted from a source. */\nexport const MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1 = 512;\n\nexport interface PluginRegistryManifestEnvelopeV1 {\n\treadonly manifest: PluginManifestV1;\n\treadonly source: string;\n\treadonly manifestDigest: string;\n\t/** Optional host- or registry-supplied signature. The verifier owns semantics. */\n\treadonly signature?: string;\n\t/** Optional signed artifact descriptor bound to this exact manifest identity. */\n\treadonly distribution?: PluginDistributionDescriptorV1;\n}\n\n/**\n * A transport-neutral registry source. Hosts inject HTTP, filesystem, or\n * package-manager implementations. The registry never receives package bytes\n * and never exposes source response bodies to the model context.\n */\nexport interface PluginRegistrySourceV1 {\n\t/** Optional stable source identity shown in diagnostics; never a local path. */\n\treadonly source?: string;\n\treadonly list: (input: { readonly signal?: AbortSignal }) => Promise<readonly PluginRegistryManifestEnvelopeV1[]>;\n}\n\nexport interface PluginRegistryDigestVerifierV1 {\n\treadonly verify: (input: {\n\t\treadonly manifest: PluginManifestV1;\n\t\treadonly source: string;\n\t\treadonly manifestDigest: string;\n\t\treadonly expectedDigest?: string;\n\t\treadonly signature?: string;\n\t}) =>\n\t\t| { readonly status: \"accepted\" }\n\t\t| { readonly status: \"rejected\"; readonly reason?: string }\n\t\t| Promise<{ readonly status: \"accepted\" } | { readonly status: \"rejected\"; readonly reason?: string }>;\n}\n\nexport interface PluginRegistryOptionsV1 {\n\treadonly source: PluginRegistrySourceV1;\n\treadonly host: HostFactsV1;\n\t/** Required digest/signature verifier. No implicit trust fallback. */\n\treadonly verify: PluginRegistryDigestVerifierV1;\n\t/** Existing source verifier contract is mandatory at the registry boundary. */\n\treadonly sourceVerifier: PluginSourceVerifierV1;\n\treadonly availableCapabilities?: readonly CapabilityRefV1[];\n\treadonly maxManifests?: number;\n}\n\nexport type PluginRegistryErrorCodeV1 =\n\t| \"cancelled\"\n\t| \"invalid_limit\"\n\t| \"source_rejected\"\n\t| \"invalid_manifest\"\n\t| \"invalid_source\"\n\t| \"invalid_digest\"\n\t| \"payload_too_large\"\n\t| \"too_many_manifests\"\n\t| \"incompatible\";\n\nexport class PluginRegistryErrorV1 extends Error {\n\treadonly code: PluginRegistryErrorCodeV1;\n\treadonly cause?: unknown;\n\n\tconstructor(code: PluginRegistryErrorCodeV1, message: string, cause?: unknown) {\n\t\tsuper(message, cause === undefined ? undefined : { cause });\n\t\tthis.name = \"PluginRegistryErrorV1\";\n\t\tthis.code = code;\n\t\tthis.cause = cause;\n\t}\n}\n\nexport interface PluginRegistryEntryV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly source: string;\n\treadonly manifestDigest: string;\n\treadonly signed: boolean;\n}\n\nexport type PluginRegistryRejectionCodeV1 = \"source_rejected\" | \"digest_rejected\" | \"incompatible\";\n\nexport interface PluginRegistryRejectionV1 {\n\treadonly pluginId: string;\n\treadonly pluginVersion: string;\n\treadonly code: PluginRegistryRejectionCodeV1;\n\treadonly reason: string;\n}\n\nexport interface PluginRegistryVerifiedEntryV1 extends PluginRegistryEntryV1 {\n\treadonly resolutionStatus: \"installed-ready\";\n}\n\nexport interface PluginRegistrySnapshotV1 {\n\treadonly version: 1;\n\treadonly source: string;\n\treadonly entries: readonly PluginRegistryEntryV1[];\n\treadonly catalog: PluginCatalogSnapshotV1;\n\t/** Only entries that passed proof validation and host compatibility. */\n\treadonly verified: readonly PluginRegistryVerifiedEntryV1[];\n\t/** Platform/API/test-only entries remain visible in catalog but are not verified. */\n\treadonly rejected: readonly PluginRegistryRejectionV1[];\n}\n\n/** Host-side package projection; package bytes never cross this boundary. */\nexport interface PluginRegistryResolvedPackageV1 {\n\treadonly manifest: PluginManifestV1;\n\treadonly source: string;\n\treadonly expectedDigest: string;\n\treadonly distribution?: PluginDistributionDescriptorV1;\n}\n\nexport interface PluginRegistryV1 {\n\treadonly list: (input?: { readonly signal?: AbortSignal }) => Promise<PluginRegistrySnapshotV1>;\n\t/** Optional host-side resolver. Older custom registry implementations may omit it. */\n\treadonly resolve?: (input: {\n\t\treadonly pluginId: string;\n\t\treadonly pluginVersion?: string;\n\t\treadonly signal?: AbortSignal;\n\t}) => Promise<PluginRegistryResolvedPackageV1 | undefined>;\n\t/** Optional host-side manifest projection used by the CLI catalog command. */\n\treadonly listManifests?: (input?: { readonly signal?: AbortSignal }) => Promise<readonly PluginManifestV1[]>;\n}\n\nfunction isAbortLike(error: unknown, signal: AbortSignal | undefined): boolean {\n\treturn (\n\t\tsignal?.aborted === true ||\n\t\t(error instanceof Error && (error.name === \"AbortError\" || error.name === \"AbortSignalError\"))\n\t);\n}\n\nfunction boundedString(\n\tvalue: unknown,\n\tlabel: string,\n\tmax: number,\n\tcode: PluginRegistryErrorCodeV1 = \"invalid_source\",\n): string {\n\tif (typeof value !== \"string\" || value.trim() === \"\" || value.length > max || /[\\u0000-\\u001f]/u.test(value)) {\n\t\tthrow new PluginRegistryErrorV1(code, t(\"{label} must be a non-empty bounded string\", { label }));\n\t}\n\treturn value;\n}\n\nfunction assertAllowedKeys(value: Record<string, unknown>, allowed: readonly string[], label: string): void {\n\tconst expected = new Set(allowed);\n\tif (Object.keys(value).some((key) => !expected.has(key)))\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"{label} contains an unsupported field\", { label }));\n}\n\nfunction validateSource(source: unknown): string {\n\tconst value = boundedString(source, \"source\", MAX_PLUGIN_REGISTRY_SOURCE_CHARS_V1);\n\tif (/^(?:file:|[a-zA-Z]:[\\\\/]|[\\\\/]{1,2}|\\\\\\\\)/iu.test(value) || /\\s/u.test(value)) {\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_source\",\n\t\t\tt(\"Plugin registry source must be an opaque URI, not a local path\"),\n\t\t);\n\t}\n\tif (/^https?:\\/\\//iu.test(value)) {\n\t\ttry {\n\t\t\tconst parsed = new URL(value);\n\t\t\tconst pathname = parsed.pathname.length > 512 ? `${parsed.pathname.slice(0, 511)}…` : parsed.pathname;\n\t\t\treturn `${parsed.origin}${pathname || \"/\"}`;\n\t\t} catch (error) {\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_source\", t(\"Plugin registry source URL is invalid\"), error);\n\t\t}\n\t}\n\treturn value;\n}\n\nfunction validateManifest(manifest: unknown): PluginManifestV1 {\n\tif (typeof manifest !== \"object\" || manifest === null || Array.isArray(manifest)) {\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest must be an object\"));\n\t}\n\tconst value = manifest as Record<string, unknown>;\n\tassertAllowedKeys(\n\t\tvalue,\n\t\t[\n\t\t\t\"id\",\n\t\t\t\"pluginVersion\",\n\t\t\t\"apiVersion\",\n\t\t\t\"minHostVersion\",\n\t\t\t\"maxHostVersion\",\n\t\t\t\"capabilityRefs\",\n\t\t\t\"requires\",\n\t\t\t\"platform\",\n\t\t\t\"testOnly\",\n\t\t],\n\t\t\"Registry manifest\",\n\t);\n\tif (typeof value.id !== \"string\" || value.id.trim() === \"\" || value.id.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest id is invalid\"));\n\tif (typeof value.pluginVersion !== \"string\" || value.pluginVersion.trim() === \"\" || value.pluginVersion.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest pluginVersion is invalid\"));\n\tif (typeof value.apiVersion !== \"string\" || value.apiVersion.trim() === \"\" || value.apiVersion.length > 256)\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest apiVersion is invalid\"));\n\tif (value.minHostVersion === undefined && value.maxHostVersion === undefined)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_manifest\",\n\t\t\tt(\"Published plugins must declare host version compatibility range: set minHostVersion and/or maxHostVersion\"),\n\t\t);\n\tlet bytes: number;\n\ttry {\n\t\tbytes = new TextEncoder().encode(JSON.stringify(manifest)).byteLength;\n\t} catch (error) {\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry manifest cannot be serialized\"), error);\n\t}\n\tif (bytes > MAX_PLUGIN_REGISTRY_MANIFEST_BYTES_V1)\n\t\tthrow new PluginRegistryErrorV1(\"payload_too_large\", t(\"Registry manifest exceeds the size limit\"));\n\treturn Object.freeze({ ...value } as unknown as PluginManifestV1);\n}\n\nfunction validateEnvelope(value: unknown): PluginRegistryManifestEnvelopeV1 {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value))\n\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry response entry must be an object\"));\n\tconst entry = value as Record<string, unknown>;\n\tassertAllowedKeys(\n\t\tentry,\n\t\t[\"manifest\", \"source\", \"manifestDigest\", \"signature\", \"distribution\"],\n\t\t\"Registry response entry\",\n\t);\n\tconst manifest = validateManifest(entry.manifest);\n\tconst source = validateSource(entry.source);\n\tconst manifestDigest = boundedString(entry.manifestDigest, \"manifestDigest\", MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1);\n\tif (entry.signature !== undefined) boundedString(entry.signature, \"signature\", MAX_PLUGIN_REGISTRY_PROOF_CHARS_V1);\n\tlet distribution: PluginDistributionDescriptorV1 | undefined;\n\tif (entry.distribution !== undefined) {\n\t\ttry {\n\t\t\tdistribution = createPluginDistributionV1().validateDescriptor(entry.distribution);\n\t\t} catch (error) {\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry distribution descriptor is invalid\"), error);\n\t\t}\n\t\tif (\n\t\t\tdistribution.pluginId !== manifest.id ||\n\t\t\tdistribution.pluginVersion !== manifest.pluginVersion ||\n\t\t\tdistribution.manifestDigest !== manifestDigest\n\t\t)\n\t\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\t\"invalid_manifest\",\n\t\t\t\tt(\"Registry distribution descriptor does not match the manifest identity\"),\n\t\t\t);\n\t}\n\treturn Object.freeze({\n\t\tmanifest,\n\t\tsource,\n\t\tmanifestDigest,\n\t\t...(entry.signature === undefined ? {} : { signature: entry.signature as string }),\n\t\t...(distribution === undefined ? {} : { distribution }),\n\t});\n}\n\nfunction validateMax(value: number | undefined): number {\n\tconst max = value ?? MAX_PLUGIN_REGISTRY_MANIFESTS_V1;\n\tif (!Number.isSafeInteger(max) || max < 1 || max > MAX_PLUGIN_REGISTRY_MANIFESTS_V1)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_limit\",\n\t\t\tt(\"maxManifests must be an integer between 1 and {max}\", { max: MAX_PLUGIN_REGISTRY_MANIFESTS_V1 }),\n\t\t);\n\treturn max;\n}\n\nasync function validateSourceProof(\n\tentry: PluginRegistryManifestEnvelopeV1,\n\tverifier: PluginRegistryDigestVerifierV1,\n\tsourceVerifier: PluginSourceVerifierV1,\n): Promise<void> {\n\tconst actualDigest = pluginManifestDigestV1(entry.manifest);\n\tif (entry.manifestDigest !== actualDigest)\n\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\"invalid_digest\",\n\t\t\tt(\"Manifest digest mismatch for {identity}\", {\n\t\t\t\tidentity: `${entry.manifest.id}@${entry.manifest.pluginVersion}`,\n\t\t\t}),\n\t\t);\n\ttry {\n\t\tconst result = await verifier.verify({\n\t\t\tmanifest: entry.manifest,\n\t\t\tsource: entry.source,\n\t\t\tmanifestDigest: actualDigest,\n\t\t\texpectedDigest: entry.manifestDigest,\n\t\t\tsignature: entry.signature,\n\t\t});\n\t\tif (result.status !== \"accepted\")\n\t\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", result.reason ?? t(\"Registry source proof was rejected\"));\n\t} catch (error) {\n\t\tif (error instanceof PluginRegistryErrorV1) throw error;\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Registry source proof was rejected\"), error);\n\t}\n\tlet result: ReturnType<PluginSourceVerifierV1>;\n\ttry {\n\t\tresult = sourceVerifier({\n\t\t\tpluginId: entry.manifest.id,\n\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\tsource: entry.source,\n\t\t\tmanifestDigest: actualDigest,\n\t\t});\n\t} catch (error) {\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Plugin source verifier failed\"), error);\n\t}\n\tif (result.status !== \"accepted\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", result.reason ?? t(\"Plugin source was rejected\"));\n}\n\nfunction sourceIdentity(entries: readonly PluginRegistryManifestEnvelopeV1[]): string {\n\tconst sources = [...new Set(entries.map((entry) => entry.source))].sort((left, right) => left.localeCompare(right));\n\treturn sources.join(\",\");\n}\n\ninterface RegistryLoadV1 {\n\treadonly accepted: readonly PluginRegistryManifestEnvelopeV1[];\n\treadonly snapshot: PluginRegistrySnapshotV1;\n}\n\n/** Create a deterministic, host-injected registry client. */\nexport function createPluginRegistryV1(options: PluginRegistryOptionsV1): PluginRegistryV1 {\n\tconst maxManifests = validateMax(options.maxManifests);\n\tif (options.source === undefined || typeof options.source.list !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"invalid_source\", t(\"Registry source must provide list()\"));\n\tif (options.source.source !== undefined) validateSource(options.source.source);\n\tif (options.verify === undefined || typeof options.verify.verify !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Registry source/digest verifier is required\"));\n\tif (options.sourceVerifier === undefined || typeof options.sourceVerifier !== \"function\")\n\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Registry source verifier is required\"));\n\n\tconst load = async (input: { readonly signal?: AbortSignal } = {}): Promise<RegistryLoadV1> => {\n\t\tif (input.signal?.aborted)\n\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", t(\"Plugin registry operation was cancelled\"));\n\t\tlet raw: readonly PluginRegistryManifestEnvelopeV1[];\n\t\ttry {\n\t\t\traw = await options.source.list({ signal: input.signal });\n\t\t} catch (error) {\n\t\t\tif (isAbortLike(error, input.signal))\n\t\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", t(\"Plugin registry operation was cancelled\"), error);\n\t\t\tthrow new PluginRegistryErrorV1(\"source_rejected\", t(\"Plugin registry source failed\"), error);\n\t\t}\n\t\tif (input.signal?.aborted)\n\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", t(\"Plugin registry operation was cancelled\"));\n\t\tif (!Array.isArray(raw))\n\t\t\tthrow new PluginRegistryErrorV1(\"invalid_manifest\", t(\"Registry source must return an array\"));\n\t\tif (raw.length > maxManifests)\n\t\t\tthrow new PluginRegistryErrorV1(\"too_many_manifests\", t(\"Registry response contains too many manifests\"));\n\t\tconst entries = raw.map(validateEnvelope);\n\t\tconst payloadBytes = entries.reduce((total, entry) => {\n\t\t\tconst manifestBytes = new TextEncoder().encode(JSON.stringify(entry.manifest)).byteLength;\n\t\t\tconst distributionBytes =\n\t\t\t\tentry.distribution === undefined\n\t\t\t\t\t? 0\n\t\t\t\t\t: new TextEncoder().encode(JSON.stringify(entry.distribution)).byteLength;\n\t\t\treturn (\n\t\t\t\ttotal +\n\t\t\t\tmanifestBytes +\n\t\t\t\tdistributionBytes +\n\t\t\t\tnew TextEncoder().encode(entry.source).byteLength +\n\t\t\t\tnew TextEncoder().encode(entry.manifestDigest).byteLength +\n\t\t\t\t(entry.signature === undefined ? 0 : new TextEncoder().encode(entry.signature).byteLength)\n\t\t\t);\n\t\t}, 0);\n\t\tif (payloadBytes > MAX_PLUGIN_REGISTRY_PAYLOAD_BYTES_V1)\n\t\t\tthrow new PluginRegistryErrorV1(\"payload_too_large\", t(\"Registry response exceeds the aggregate size limit\"));\n\t\tconst seen = new Set<string>();\n\t\tconst accepted: PluginRegistryManifestEnvelopeV1[] = [];\n\t\tconst rejected: PluginRegistryRejectionV1[] = [];\n\t\tfor (const entry of entries) {\n\t\t\tconst identity = `${entry.manifest.id}@${entry.manifest.pluginVersion}`;\n\t\t\tif (seen.has(identity))\n\t\t\t\tthrow new PluginRegistryErrorV1(\n\t\t\t\t\t\"invalid_manifest\",\n\t\t\t\t\tt(\"Duplicate registry manifest: {identity}\", { identity }),\n\t\t\t\t);\n\t\t\tseen.add(identity);\n\t\t\ttry {\n\t\t\t\tawait validateSourceProof(entry, options.verify, options.sourceVerifier);\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof PluginRegistryErrorV1)) throw error;\n\t\t\t\tif (error.cause !== undefined) throw error;\n\t\t\t\tif (error.code !== \"source_rejected\" && error.code !== \"invalid_digest\") throw error;\n\t\t\t\trejected.push({\n\t\t\t\t\tpluginId: entry.manifest.id,\n\t\t\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\t\t\tcode: error.code === \"invalid_digest\" ? \"digest_rejected\" : \"source_rejected\",\n\t\t\t\t\treason:\n\t\t\t\t\t\terror.code === \"invalid_digest\" ? \"Manifest digest mismatch\" : \"Registry source proof was rejected\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (input.signal?.aborted)\n\t\t\t\tthrow new PluginRegistryErrorV1(\"cancelled\", t(\"Plugin registry operation was cancelled\"));\n\t\t\taccepted.push(entry);\n\t\t}\n\t\tconst manifests = accepted.map((entry) => entry.manifest);\n\t\tconst catalog = buildPluginCatalogV1({\n\t\t\tmanifests,\n\t\t\thost: options.host,\n\t\t\tavailableCapabilities: options.availableCapabilities,\n\t\t\tmaxEntries: maxManifests,\n\t\t});\n\t\tconst publicEntries = Object.freeze(\n\t\t\t[...accepted]\n\t\t\t\t.sort((left, right) => {\n\t\t\t\t\tconst idOrder = left.manifest.id.localeCompare(right.manifest.id);\n\t\t\t\t\treturn idOrder === 0\n\t\t\t\t\t\t? comparePluginVersionsV1(right.manifest.pluginVersion, left.manifest.pluginVersion)\n\t\t\t\t\t\t: idOrder;\n\t\t\t\t})\n\t\t\t\t.map((entry) =>\n\t\t\t\t\tObject.freeze({\n\t\t\t\t\t\tpluginId: entry.manifest.id,\n\t\t\t\t\t\tpluginVersion: entry.manifest.pluginVersion,\n\t\t\t\t\t\tsource: entry.source,\n\t\t\t\t\t\tmanifestDigest: entry.manifestDigest,\n\t\t\t\t\t\tsigned: entry.signature !== undefined,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t);\n\t\tconst catalogByIdentity = new Map(\n\t\t\tcatalog.entries.map((entry) => [`${entry.pluginId}@${entry.pluginVersion}`, entry] as const),\n\t\t);\n\t\tconst verified = Object.freeze(\n\t\t\tpublicEntries.flatMap((entry) => {\n\t\t\t\tconst catalogEntry = catalogByIdentity.get(`${entry.pluginId}@${entry.pluginVersion}`);\n\t\t\t\tif (catalogEntry?.resolution.status === \"installed-ready\")\n\t\t\t\t\treturn [{ ...entry, resolutionStatus: \"installed-ready\" as const }];\n\t\t\t\tconst reason = catalogEntry?.resolution.diagnostics[0]?.message ?? \"Plugin is incompatible with this host\";\n\t\t\t\trejected.push({\n\t\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\t\tpluginVersion: entry.pluginVersion,\n\t\t\t\t\tcode: \"incompatible\",\n\t\t\t\t\treason,\n\t\t\t\t});\n\t\t\t\treturn [];\n\t\t\t}),\n\t\t);\n\t\treturn {\n\t\t\taccepted: Object.freeze(accepted),\n\t\t\tsnapshot: Object.freeze({\n\t\t\t\tversion: 1,\n\t\t\t\tsource:\n\t\t\t\t\toptions.source.source === undefined ? sourceIdentity(accepted) : validateSource(options.source.source),\n\t\t\t\tentries: publicEntries,\n\t\t\t\tcatalog,\n\t\t\t\tverified,\n\t\t\t\trejected: Object.freeze(rejected),\n\t\t\t}),\n\t\t};\n\t};\n\tconst listManifests = async (\n\t\tinput: { readonly signal?: AbortSignal } = {},\n\t): Promise<readonly PluginManifestV1[]> => {\n\t\tconst loaded = await load(input);\n\t\treturn Object.freeze(\n\t\t\tloaded.snapshot.catalog.entries.flatMap((catalogEntry) =>\n\t\t\t\tloaded.accepted\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.manifest.id === catalogEntry.pluginId &&\n\t\t\t\t\t\t\tentry.manifest.pluginVersion === catalogEntry.pluginVersion,\n\t\t\t\t\t)\n\t\t\t\t\t.map((entry) => entry.manifest),\n\t\t\t),\n\t\t);\n\t};\n\treturn {\n\t\tlist: async (input = {}) => (await load(input)).snapshot,\n\t\tlistManifests,\n\t\tresolve: async (input) => {\n\t\t\tconst loaded = await load({ signal: input.signal });\n\t\t\tconst verified = new Set(loaded.snapshot.verified.map((entry) => `${entry.pluginId}@${entry.pluginVersion}`));\n\t\t\tconst identity =\n\t\t\t\tinput.pluginVersion === undefined\n\t\t\t\t\t? loaded.snapshot.catalog.entries.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.pluginId === input.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.resolution.status === \"installed-ready\" &&\n\t\t\t\t\t\t\t\tverified.has(`${candidate.pluginId}@${candidate.pluginVersion}`),\n\t\t\t\t\t\t)\n\t\t\t\t\t: loaded.snapshot.catalog.entries.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.pluginId === input.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.pluginVersion === input.pluginVersion &&\n\t\t\t\t\t\t\t\tcandidate.resolution.status === \"installed-ready\" &&\n\t\t\t\t\t\t\t\tverified.has(`${candidate.pluginId}@${candidate.pluginVersion}`),\n\t\t\t\t\t\t);\n\t\t\tconst entry =\n\t\t\t\tidentity === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: loaded.accepted.find(\n\t\t\t\t\t\t\t(candidate) =>\n\t\t\t\t\t\t\t\tcandidate.manifest.id === identity.pluginId &&\n\t\t\t\t\t\t\t\tcandidate.manifest.pluginVersion === identity.pluginVersion,\n\t\t\t\t\t\t);\n\t\t\tif (entry === undefined) return undefined;\n\t\t\treturn Object.freeze({\n\t\t\t\tmanifest: entry.manifest,\n\t\t\t\tsource: entry.source,\n\t\t\t\texpectedDigest: entry.manifestDigest,\n\t\t\t\t...(entry.distribution === undefined ? {} : { distribution: entry.distribution }),\n\t\t\t});\n\t\t},\n\t};\n}\n"]}