@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,3 +1,4 @@
1
+ import { t } from "../../core/i18n/index.js";
1
2
  import { comparePluginVersionsV1 } from "./catalog.js";
2
3
  /**
3
4
  * Minimal npm registry (packument) source for plugin package acquisition
@@ -28,20 +29,20 @@ export class NodeNpmRegistrySourceErrorV1 extends Error {
28
29
  export function sriToIntegrityV1(sri) {
29
30
  const match = /^(sha512|sha256)-([A-Za-z0-9+/]+={0,2})$/u.exec(sri.trim());
30
31
  if (match === null)
31
- throw new NodeNpmRegistrySourceErrorV1("integrity_unsupported", "npm integrity algorithm is unsupported");
32
+ throw new NodeNpmRegistrySourceErrorV1("integrity_unsupported", t("npm integrity algorithm is unsupported"));
32
33
  const algorithm = match[1];
33
34
  let raw;
34
35
  try {
35
36
  raw = Buffer.from(match[2], "base64");
36
37
  }
37
38
  catch {
38
- throw new NodeNpmRegistrySourceErrorV1("integrity_unsupported", "npm integrity encoding is invalid");
39
+ throw new NodeNpmRegistrySourceErrorV1("integrity_unsupported", t("npm integrity encoding is invalid"));
39
40
  }
40
41
  if ((algorithm === "sha256" && raw.byteLength !== 32) || (algorithm === "sha512" && raw.byteLength !== 64))
41
- throw new NodeNpmRegistrySourceErrorV1("integrity_unsupported", "npm integrity length is invalid");
42
+ throw new NodeNpmRegistrySourceErrorV1("integrity_unsupported", t("npm integrity length is invalid"));
42
43
  const hex = raw.toString("hex").toLowerCase();
43
44
  if (hex.length === 0)
44
- throw new NodeNpmRegistrySourceErrorV1("integrity_unsupported", "npm integrity is invalid");
45
+ throw new NodeNpmRegistrySourceErrorV1("integrity_unsupported", t("npm integrity is invalid"));
45
46
  return { algorithm, hex };
46
47
  }
47
48
  function parseVersionTriple(value) {
@@ -91,7 +92,7 @@ export function selectNpmPackageVersionV1(versions, range) {
91
92
  function boundedPositive(value, fallback, maximum, label) {
92
93
  const result = value ?? fallback;
93
94
  if (!Number.isSafeInteger(result) || result <= 0 || result > maximum)
94
- throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", `${label} must be a positive integer at most ${maximum}`);
95
+ throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", t("{label} must be a positive integer at most {maximum}", { label, maximum }));
95
96
  return result;
96
97
  }
97
98
  function registryOrigin(value) {
@@ -100,14 +101,14 @@ function registryOrigin(value) {
100
101
  parsed = new URL(value);
101
102
  }
102
103
  catch {
103
- throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", "npm registry origin is invalid");
104
+ throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", t("npm registry origin is invalid"));
104
105
  }
105
106
  if ((parsed.protocol !== "http:" && parsed.protocol !== "https:") ||
106
107
  parsed.username !== "" ||
107
108
  parsed.password !== "")
108
- throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", "npm registry origin must be http(s) without credentials");
109
+ throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", t("npm registry origin must be http(s) without credentials"));
109
110
  if (parsed.pathname !== "/" || parsed.search !== "" || parsed.hash !== "")
110
- throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", "npm registry origin must not include a path, query, or fragment");
111
+ throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", t("npm registry origin must not include a path, query, or fragment"));
111
112
  return parsed.origin;
112
113
  }
113
114
  function packumentUrl(registryOriginValue, name) {
@@ -120,7 +121,7 @@ function packumentUrl(registryOriginValue, name) {
120
121
  return new URL(`${registryOriginValue}/${scope}%2F${encodeURIComponent(packageName)}`);
121
122
  }
122
123
  if (scopeAt >= 0)
123
- throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", "npm package name is invalid");
124
+ throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", t("npm package name is invalid"));
124
125
  return new URL(`${registryOriginValue}/${encodeURIComponent(name)}`);
125
126
  }
126
127
  function tarballUrl(value) {
@@ -129,14 +130,14 @@ function tarballUrl(value) {
129
130
  parsed = new URL(value);
130
131
  }
131
132
  catch {
132
- throw new NodeNpmRegistrySourceErrorV1("invalid_response", "npm tarball URL is invalid");
133
+ throw new NodeNpmRegistrySourceErrorV1("invalid_response", t("npm tarball URL is invalid"));
133
134
  }
134
135
  if ((parsed.protocol !== "http:" && parsed.protocol !== "https:") ||
135
136
  parsed.username !== "" ||
136
137
  parsed.password !== "")
137
- throw new NodeNpmRegistrySourceErrorV1("invalid_response", "npm tarball URL must use http(s) without credentials");
138
+ throw new NodeNpmRegistrySourceErrorV1("invalid_response", t("npm tarball URL must use http(s) without credentials"));
138
139
  if (parsed.hash !== "")
139
- throw new NodeNpmRegistrySourceErrorV1("invalid_response", "npm tarball URL must not include a fragment");
140
+ throw new NodeNpmRegistrySourceErrorV1("invalid_response", t("npm tarball URL must not include a fragment"));
140
141
  return parsed;
141
142
  }
142
143
  function isAbortLike(error) {
@@ -172,20 +173,20 @@ function isJsonResponse(response) {
172
173
  }
173
174
  async function readBody(response, maxBytes, signal) {
174
175
  if (response.body === null)
175
- throw new NodeNpmRegistrySourceErrorV1("invalid_response", "npm registry response has no body");
176
+ throw new NodeNpmRegistrySourceErrorV1("invalid_response", t("npm registry response has no body"));
176
177
  const reader = response.body.getReader();
177
178
  const chunks = [];
178
179
  let total = 0;
179
180
  try {
180
181
  for (;;) {
181
182
  if (signal.aborted)
182
- throw new DOMException("aborted", "AbortError");
183
+ throw new DOMException(t("aborted"), "AbortError");
183
184
  const item = await reader.read();
184
185
  if (item.done)
185
186
  break;
186
187
  total += item.value.byteLength;
187
188
  if (total > maxBytes)
188
- throw new NodeNpmRegistrySourceErrorV1("response_too_large", "npm registry response exceeds the configured size limit");
189
+ throw new NodeNpmRegistrySourceErrorV1("response_too_large", t("npm registry response exceeds the configured size limit"));
189
190
  chunks.push(item.value);
190
191
  }
191
192
  }
@@ -206,34 +207,34 @@ function parsePackument(bytes) {
206
207
  value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
207
208
  }
208
209
  catch {
209
- throw new NodeNpmRegistrySourceErrorV1("invalid_response", "npm registry response is not valid JSON");
210
+ throw new NodeNpmRegistrySourceErrorV1("invalid_response", t("npm registry response is not valid JSON"));
210
211
  }
211
212
  if (typeof value !== "object" || value === null || Array.isArray(value))
212
- throw new NodeNpmRegistrySourceErrorV1("invalid_response", "npm packument is invalid");
213
+ throw new NodeNpmRegistrySourceErrorV1("invalid_response", t("npm packument is invalid"));
213
214
  const packument = value;
214
215
  if (typeof packument.versions !== "object" || packument.versions === null || Array.isArray(packument.versions))
215
- throw new NodeNpmRegistrySourceErrorV1("invalid_response", "npm packument has no version table");
216
+ throw new NodeNpmRegistrySourceErrorV1("invalid_response", t("npm packument has no version table"));
216
217
  return packument.versions;
217
218
  }
218
219
  /** Create a bounded npm registry reader. Version selection uses the ecosystem comparator. */
219
220
  export function createNodeNpmRegistrySourceV1(options = {}) {
220
221
  const transport = options.fetch ?? globalThis.fetch;
221
222
  if (typeof transport !== "function")
222
- throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", "Node fetch is unavailable");
223
+ throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", t("Node fetch is unavailable"));
223
224
  const registry = registryOrigin(options.registry ?? DEFAULT_NPM_REGISTRY_V1);
224
225
  if (options.token !== undefined &&
225
226
  (options.token.length === 0 || options.token.length > 4096 || /[\r\n\s]/u.test(options.token)))
226
- throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", "npm registry token is invalid");
227
+ throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", t("npm registry token is invalid"));
227
228
  const token = options.token;
228
229
  const timeoutMs = boundedPositive(options.requestTimeoutMs, DEFAULT_TIMEOUT_MS_V1, MAX_TIMEOUT_MS_V1, "requestTimeoutMs");
229
230
  const maxResponseBytes = boundedPositive(options.maxResponseBytes, DEFAULT_MAX_RESPONSE_BYTES_V1, MAX_RESPONSE_BYTES_V1, "maxResponseBytes");
230
231
  const maxTarballBytes = boundedPositive(options.maxTarballBytes, DEFAULT_MAX_TARBALL_BYTES_V1, MAX_TARBALL_BYTES_V1, "maxTarballBytes");
231
232
  const maxRedirects = options.maxRedirects ?? DEFAULT_REDIRECTS_V1;
232
233
  if (!Number.isSafeInteger(maxRedirects) || maxRedirects < 0 || maxRedirects > MAX_REDIRECTS_V1)
233
- throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", `maxRedirects must be an integer between 0 and ${MAX_REDIRECTS_V1}`);
234
+ throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", t("maxRedirects must be an integer between 0 and {max}", { max: MAX_REDIRECTS_V1 }));
234
235
  const userAgent = options.userAgent ?? "agent-forge-plugin-npm/1";
235
236
  if (userAgent.length === 0 || userAgent.length > 256 || /[\r\n]/u.test(userAgent))
236
- throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", "userAgent is invalid");
237
+ throw new NodeNpmRegistrySourceErrorV1("invalid_configuration", t("userAgent is invalid"));
237
238
  const fetchFollowingRedirects = async (url, headers, parentSignal) => {
238
239
  let current = url;
239
240
  for (let redirect = 0;; redirect += 1) {
@@ -250,10 +251,10 @@ export function createNodeNpmRegistrySourceV1(options = {}) {
250
251
  catch (error) {
251
252
  request.cleanup();
252
253
  if (request.timedOut())
253
- throw new NodeNpmRegistrySourceErrorV1("request_timed_out", "npm registry request timed out");
254
+ throw new NodeNpmRegistrySourceErrorV1("request_timed_out", t("npm registry request timed out"));
254
255
  if (isAbortLike(error))
255
- throw new NodeNpmRegistrySourceErrorV1("cancelled", "npm registry request was cancelled");
256
- throw new NodeNpmRegistrySourceErrorV1("request_failed", "npm registry request failed");
256
+ throw new NodeNpmRegistrySourceErrorV1("cancelled", t("npm registry request was cancelled"));
257
+ throw new NodeNpmRegistrySourceErrorV1("request_failed", t("npm registry request failed"));
257
258
  }
258
259
  if (!REDIRECT_STATUS.has(response.status))
259
260
  return { response, request };
@@ -261,23 +262,23 @@ export function createNodeNpmRegistrySourceV1(options = {}) {
261
262
  await response.body?.cancel().catch(() => undefined);
262
263
  request.cleanup();
263
264
  if (location === null || redirect >= maxRedirects)
264
- throw new NodeNpmRegistrySourceErrorV1("request_failed", "npm registry redirect limit exceeded");
265
+ throw new NodeNpmRegistrySourceErrorV1("request_failed", t("npm registry redirect limit exceeded"));
265
266
  current = tarballUrl(new URL(location, current).toString());
266
267
  }
267
268
  };
268
269
  const resolveNpmPackage = async (input) => {
269
270
  if (input.signal?.aborted === true)
270
- throw new NodeNpmRegistrySourceErrorV1("cancelled", "npm registry request was cancelled");
271
+ throw new NodeNpmRegistrySourceErrorV1("cancelled", t("npm registry request was cancelled"));
271
272
  const endpoint = packumentUrl(registry, input.name);
272
273
  const authorization = token === undefined ? {} : { authorization: `Bearer ${token}` };
273
274
  const { response, request } = await fetchFollowingRedirects(endpoint, authorization, input.signal);
274
275
  try {
275
276
  if (response.status === 404 || response.status === 403)
276
- throw new NodeNpmRegistrySourceErrorV1("package_not_found", "npm package was not found on the registry");
277
+ throw new NodeNpmRegistrySourceErrorV1("package_not_found", t("npm package was not found on the registry"));
277
278
  if (response.status < 200 || response.status >= 300)
278
- throw new NodeNpmRegistrySourceErrorV1("request_failed", "npm registry request did not succeed");
279
+ throw new NodeNpmRegistrySourceErrorV1("request_failed", t("npm registry request did not succeed"));
279
280
  if (!isJsonResponse(response))
280
- throw new NodeNpmRegistrySourceErrorV1("invalid_response", "npm registry response must be JSON");
281
+ throw new NodeNpmRegistrySourceErrorV1("invalid_response", t("npm registry response must be JSON"));
281
282
  const versions = parsePackument(await readBody(response, maxResponseBytes, request.signal));
282
283
  const version = selectNpmPackageVersionV1(Object.keys(versions), input.range);
283
284
  const dist = version === undefined ? undefined : versions[version]?.dist;
@@ -285,14 +286,14 @@ export function createNodeNpmRegistrySourceV1(options = {}) {
285
286
  dist === undefined ||
286
287
  typeof dist.tarball !== "string" ||
287
288
  dist.tarball.length === 0) {
288
- throw new NodeNpmRegistrySourceErrorV1("version_not_found", "No npm package version matches the requested range");
289
+ throw new NodeNpmRegistrySourceErrorV1("version_not_found", t("No npm package version matches the requested range"));
289
290
  }
290
291
  const integrityValue = dist.integrity;
291
292
  const integrity = typeof integrityValue === "string" && integrityValue.length > 0
292
293
  ? sriToIntegrityV1(integrityValue)
293
294
  : undefined;
294
295
  if (integrity === undefined)
295
- throw new NodeNpmRegistrySourceErrorV1("invalid_response", "npm package version has no integrity field");
296
+ throw new NodeNpmRegistrySourceErrorV1("invalid_response", t("npm package version has no integrity field"));
296
297
  return {
297
298
  version,
298
299
  tarballUrl: tarballUrl(dist.tarball).toString(),
@@ -307,13 +308,13 @@ export function createNodeNpmRegistrySourceV1(options = {}) {
307
308
  };
308
309
  const fetchTarball = async (input) => {
309
310
  if (input.signal?.aborted === true)
310
- throw new NodeNpmRegistrySourceErrorV1("cancelled", "npm tarball download was cancelled");
311
+ throw new NodeNpmRegistrySourceErrorV1("cancelled", t("npm tarball download was cancelled"));
311
312
  const endpoint = tarballUrl(input.url);
312
313
  const authorization = token === undefined ? {} : { authorization: `Bearer ${token}` };
313
314
  const { response, request } = await fetchFollowingRedirects(endpoint, authorization, input.signal);
314
315
  try {
315
316
  if (response.status < 200 || response.status >= 300)
316
- throw new NodeNpmRegistrySourceErrorV1("request_failed", "npm tarball download did not succeed");
317
+ throw new NodeNpmRegistrySourceErrorV1("request_failed", t("npm tarball download did not succeed"));
317
318
  return await readBody(response, maxTarballBytes, request.signal);
318
319
  }
319
320
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"node-npm-registry-source.js","sourceRoot":"","sources":["../../../src/plugins/ecosystem/node-npm-registry-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD;;;;;;GAMG;AAEH,MAAM,uBAAuB,GAAG,4BAA4B,CAAC;AAC7D,MAAM,qBAAqB,GAAG,MAAM,CAAC;AACrC,MAAM,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,CAAC,CAAC;YAClG,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAClE,CAAC;gBAAS,CAAC;YACV,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACrD,OAAO,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;IAAA,CACD,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC;AAAA,CACjE","sourcesContent":["import { comparePluginVersionsV1 } from \"./catalog.ts\";\n\n/**\n * Minimal npm registry (packument) source for plugin package acquisition\n * (design `插件独立分发与启动装配设计.md` §4.2). It is a two-step protocol:\n * resolve the packument to pick one version, then fetch the tarball. It does\n * not implement `PluginRegistrySourceV1.list()`; the signed registry sources\n * keep serving private deployments unchanged.\n */\n\nconst DEFAULT_NPM_REGISTRY_V1 = \"https://registry.npmjs.org\";\nconst DEFAULT_TIMEOUT_MS_V1 = 15_000;\nconst MAX_TIMEOUT_MS_V1 = 120_000;\nconst DEFAULT_MAX_RESPONSE_BYTES_V1 = 8 * 1024 * 1024;\nconst MAX_RESPONSE_BYTES_V1 = 16 * 1024 * 1024;\nconst DEFAULT_MAX_TARBALL_BYTES_V1 = 128 * 1024 * 1024;\nconst MAX_TARBALL_BYTES_V1 = 512 * 1024 * 1024;\nconst DEFAULT_REDIRECTS_V1 = 3;\nconst MAX_REDIRECTS_V1 = 5;\nconst REDIRECT_STATUS = new Set([301, 302, 303, 307, 308]);\n\nexport type NodeNpmRegistrySourceErrorCodeV1 =\n\t| \"cancelled\"\n\t| \"invalid_configuration\"\n\t| \"request_failed\"\n\t| \"request_timed_out\"\n\t| \"invalid_response\"\n\t| \"response_too_large\"\n\t| \"package_not_found\"\n\t| \"version_not_found\"\n\t| \"integrity_unsupported\";\n\nexport class NodeNpmRegistrySourceErrorV1 extends Error {\n\treadonly code: NodeNpmRegistrySourceErrorCodeV1;\n\n\tconstructor(code: NodeNpmRegistrySourceErrorCodeV1, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"NodeNpmRegistrySourceErrorV1\";\n\t\tthis.code = code;\n\t}\n}\n\n/** SRI integrity as hex plus its algorithm, aligned with the install host digest format. */\nexport interface NodeNpmIntegrityV1 {\n\treadonly algorithm: \"sha256\" | \"sha512\";\n\treadonly hex: string;\n}\n\nexport interface NodeNpmPackageResolutionV1 {\n\treadonly version: string;\n\treadonly tarballUrl: string;\n\treadonly integrity: NodeNpmIntegrityV1;\n\t/** Raw `dist` fields of the selected version. */\n\treadonly distInfo: Readonly<Record<string, unknown>>;\n}\n\nexport interface NodeNpmRegistrySourceOptionsV1 {\n\t/** Bare http(s) registry origin; defaults to the npm public registry. */\n\treadonly registry?: string;\n\t/** Bearer token for private registries. */\n\treadonly token?: string;\n\t/** Real fetch or a deterministic test replacement. */\n\treadonly fetch?: typeof globalThis.fetch;\n\treadonly requestTimeoutMs?: number;\n\treadonly maxResponseBytes?: number;\n\treadonly maxTarballBytes?: number;\n\treadonly maxRedirects?: number;\n\treadonly userAgent?: string;\n}\n\nexport interface NodeNpmRegistrySourceV1 {\n\treadonly version: 1;\n\t/** Sanitized bare registry origin (no credentials, path, query, or fragment). */\n\treadonly registry: string;\n\treadonly resolveNpmPackage: (input: {\n\t\treadonly name: string;\n\t\treadonly range?: string;\n\t\treadonly signal?: AbortSignal;\n\t}) => Promise<NodeNpmPackageResolutionV1>;\n\treadonly fetchTarball: (input: { readonly url: string; readonly signal?: AbortSignal }) => Promise<Uint8Array>;\n}\n\n/** Convert an npm SRI string (`sha512-<base64>`, `sha256-<base64>`) to hex form. */\nexport function sriToIntegrityV1(sri: string): NodeNpmIntegrityV1 {\n\tconst match = /^(sha512|sha256)-([A-Za-z0-9+/]+={0,2})$/u.exec(sri.trim());\n\tif (match === null)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"integrity_unsupported\", \"npm integrity algorithm is unsupported\");\n\tconst algorithm = match[1] as \"sha512\" | \"sha256\";\n\tlet raw: Buffer;\n\ttry {\n\t\traw = Buffer.from(match[2]!, \"base64\");\n\t} catch {\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"integrity_unsupported\", \"npm integrity encoding is invalid\");\n\t}\n\tif ((algorithm === \"sha256\" && raw.byteLength !== 32) || (algorithm === \"sha512\" && raw.byteLength !== 64))\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"integrity_unsupported\", \"npm integrity length is invalid\");\n\tconst hex = raw.toString(\"hex\").toLowerCase();\n\tif (hex.length === 0) throw new NodeNpmRegistrySourceErrorV1(\"integrity_unsupported\", \"npm integrity is invalid\");\n\treturn { algorithm, hex };\n}\n\nfunction parseVersionTriple(value: string): readonly [number, number, number] | undefined {\n\tconst match = /^(\\d+)\\.(\\d+)\\.(\\d+)/u.exec(value.replace(/^[vV]/u, \"\"));\n\tif (match === null) return undefined;\n\tconst major = Number.parseInt(match[1]!, 10);\n\tconst minor = Number.parseInt(match[2]!, 10);\n\tconst patch = Number.parseInt(match[3]!, 10);\n\tif (!Number.isSafeInteger(major) || !Number.isSafeInteger(minor) || !Number.isSafeInteger(patch)) return undefined;\n\treturn [major, minor, patch] as const;\n}\n\nfunction plainVersion(value: string): string {\n\treturn value.replace(/^[vV]/u, \"\");\n}\n\n/**\n * Select the highest version satisfying a minimal range subset using the\n * ecosystem comparator (`comparePluginVersionsV1`): `undefined`/`latest` →\n * highest; `x.y.z` → exact full match (prerelease suffix included);\n * `^x.y.z` → >= x.y.z and < (x+1).0.0; `~x.y.z` → >= x.y.z and\n * < x.(y+1).0. Bounds use the comparator ordering (e.g. `1.0.0-alpha`\n * sorts below `1.0.0`).\n */\nexport function selectNpmPackageVersionV1(versions: readonly string[], range?: string): string | undefined {\n\tif (!Array.isArray(versions)) return undefined;\n\tlet candidates = versions.filter((value) => typeof value === \"string\" && parseVersionTriple(value) !== undefined);\n\tif (candidates.length === 0) return undefined;\n\tif (range === undefined || range === \"latest\") {\n\t\treturn candidates.reduce((left, right) => (comparePluginVersionsV1(right, left) > 0 ? right : left));\n\t}\n\tconst exact = plainVersion(range.replace(/^[=~^]/u, \"\"));\n\tif (!range.startsWith(\"^\") && !range.startsWith(\"~\"))\n\t\treturn candidates.find((value) => plainVersion(value) === exact);\n\tconst bound = parseVersionTriple(exact);\n\tif (bound === undefined) return undefined;\n\tconst [major, minor] = bound;\n\tconst upper = range.startsWith(\"^\") ? `${major + 1}.0.0` : `${major}.${minor + 1}.0`;\n\tcandidates = candidates.filter(\n\t\t(value) => comparePluginVersionsV1(value, exact) >= 0 && comparePluginVersionsV1(value, upper) < 0,\n\t);\n\tif (candidates.length === 0) return undefined;\n\treturn candidates.reduce((left, right) => (comparePluginVersionsV1(right, left) > 0 ? right : left));\n}\n\nfunction boundedPositive(value: number | undefined, fallback: number, maximum: number, label: string): number {\n\tconst result = value ?? fallback;\n\tif (!Number.isSafeInteger(result) || result <= 0 || result > maximum)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_configuration\",\n\t\t\t`${label} must be a positive integer at most ${maximum}`,\n\t\t);\n\treturn result;\n}\n\nfunction registryOrigin(value: string): string {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(value);\n\t} catch {\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", \"npm registry origin is invalid\");\n\t}\n\tif (\n\t\t(parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") ||\n\t\tparsed.username !== \"\" ||\n\t\tparsed.password !== \"\"\n\t)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_configuration\",\n\t\t\t\"npm registry origin must be http(s) without credentials\",\n\t\t);\n\tif (parsed.pathname !== \"/\" || parsed.search !== \"\" || parsed.hash !== \"\")\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_configuration\",\n\t\t\t\"npm registry origin must not include a path, query, or fragment\",\n\t\t);\n\treturn parsed.origin;\n}\n\nfunction packumentUrl(registryOriginValue: string, name: string): URL {\n\tconst scopeAt = name.indexOf(\"/\");\n\tif (name.startsWith(\"@\") && scopeAt > 0) {\n\t\t// npm registry convention keeps the leading scope literal and percent\n\t\t// encodes the rest of the name, including the separating slash.\n\t\tconst scope = name.slice(0, scopeAt);\n\t\tconst packageName = name.slice(scopeAt + 1);\n\t\treturn new URL(`${registryOriginValue}/${scope}%2F${encodeURIComponent(packageName)}`);\n\t}\n\tif (scopeAt >= 0) throw new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", \"npm package name is invalid\");\n\treturn new URL(`${registryOriginValue}/${encodeURIComponent(name)}`);\n}\n\nfunction tarballUrl(value: string): URL {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(value);\n\t} catch {\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", \"npm tarball URL is invalid\");\n\t}\n\tif (\n\t\t(parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") ||\n\t\tparsed.username !== \"\" ||\n\t\tparsed.password !== \"\"\n\t)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_response\",\n\t\t\t\"npm tarball URL must use http(s) without credentials\",\n\t\t);\n\tif (parsed.hash !== \"\")\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", \"npm tarball URL must not include a fragment\");\n\treturn parsed;\n}\n\nfunction isAbortLike(error: unknown): boolean {\n\treturn error instanceof Error && (error.name === \"AbortError\" || error.name === \"AbortSignalError\");\n}\n\ninterface RequestSignal {\n\treadonly signal: AbortSignal;\n\treadonly timedOut: () => boolean;\n\treadonly cleanup: () => void;\n}\n\nfunction requestSignal(parent: AbortSignal | undefined, timeoutMs: number): RequestSignal {\n\tconst controller = new AbortController();\n\tlet timedOut = false;\n\tconst abort = () => controller.abort(parent?.reason);\n\tif (parent?.aborted === true) abort();\n\telse parent?.addEventListener(\"abort\", abort, { once: true });\n\tconst timeout = setTimeout(() => {\n\t\ttimedOut = true;\n\t\tcontroller.abort();\n\t}, timeoutMs);\n\treturn {\n\t\tsignal: controller.signal,\n\t\ttimedOut: () => timedOut,\n\t\tcleanup: () => {\n\t\t\tclearTimeout(timeout);\n\t\t\tparent?.removeEventListener(\"abort\", abort);\n\t\t},\n\t};\n}\n\nfunction isJsonResponse(response: Response): boolean {\n\tconst contentType = response.headers.get(\"content-type\");\n\tif (contentType === null) return false;\n\tconst mediaType = contentType.split(\";\", 1)[0]?.trim().toLowerCase();\n\treturn mediaType === \"application/json\" || mediaType === \"application/vnd.npm.install-v1+json\";\n}\n\nasync function readBody(response: Response, maxBytes: number, signal: AbortSignal): Promise<Uint8Array> {\n\tif (response.body === null)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", \"npm registry response has no body\");\n\tconst reader = response.body.getReader();\n\tconst chunks: Uint8Array[] = [];\n\tlet total = 0;\n\ttry {\n\t\tfor (;;) {\n\t\t\tif (signal.aborted) throw new DOMException(\"aborted\", \"AbortError\");\n\t\t\tconst item = await reader.read();\n\t\t\tif (item.done) break;\n\t\t\ttotal += item.value.byteLength;\n\t\t\tif (total > maxBytes)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\t\t\"response_too_large\",\n\t\t\t\t\t\"npm registry response exceeds the configured size limit\",\n\t\t\t\t);\n\t\t\tchunks.push(item.value);\n\t\t}\n\t} finally {\n\t\treader.releaseLock();\n\t}\n\tconst bytes = new Uint8Array(total);\n\tlet offset = 0;\n\tfor (const chunk of chunks) {\n\t\tbytes.set(chunk, offset);\n\t\toffset += chunk.byteLength;\n\t}\n\treturn bytes;\n}\n\ninterface PackumentVersionDistV1 {\n\treadonly tarball?: unknown;\n\treadonly integrity?: unknown;\n}\n\ninterface PackumentVersionV1 {\n\treadonly dist?: PackumentVersionDistV1;\n}\n\ninterface PackumentV1 {\n\treadonly versions?: Readonly<Record<string, PackumentVersionV1>>;\n}\n\nfunction parsePackument(bytes: Uint8Array): Readonly<Record<string, PackumentVersionV1>> {\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes));\n\t} catch {\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", \"npm registry response is not valid JSON\");\n\t}\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value))\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", \"npm packument is invalid\");\n\tconst packument = value as PackumentV1;\n\tif (typeof packument.versions !== \"object\" || packument.versions === null || Array.isArray(packument.versions))\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", \"npm packument has no version table\");\n\treturn packument.versions;\n}\n\n/** Create a bounded npm registry reader. Version selection uses the ecosystem comparator. */\nexport function createNodeNpmRegistrySourceV1(options: NodeNpmRegistrySourceOptionsV1 = {}): NodeNpmRegistrySourceV1 {\n\tconst transport = options.fetch ?? globalThis.fetch;\n\tif (typeof transport !== \"function\")\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", \"Node fetch is unavailable\");\n\tconst registry = registryOrigin(options.registry ?? DEFAULT_NPM_REGISTRY_V1);\n\tif (\n\t\toptions.token !== undefined &&\n\t\t(options.token.length === 0 || options.token.length > 4096 || /[\\r\\n\\s]/u.test(options.token))\n\t)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", \"npm registry token is invalid\");\n\tconst token = options.token;\n\tconst timeoutMs = boundedPositive(\n\t\toptions.requestTimeoutMs,\n\t\tDEFAULT_TIMEOUT_MS_V1,\n\t\tMAX_TIMEOUT_MS_V1,\n\t\t\"requestTimeoutMs\",\n\t);\n\tconst maxResponseBytes = boundedPositive(\n\t\toptions.maxResponseBytes,\n\t\tDEFAULT_MAX_RESPONSE_BYTES_V1,\n\t\tMAX_RESPONSE_BYTES_V1,\n\t\t\"maxResponseBytes\",\n\t);\n\tconst maxTarballBytes = boundedPositive(\n\t\toptions.maxTarballBytes,\n\t\tDEFAULT_MAX_TARBALL_BYTES_V1,\n\t\tMAX_TARBALL_BYTES_V1,\n\t\t\"maxTarballBytes\",\n\t);\n\tconst maxRedirects = options.maxRedirects ?? DEFAULT_REDIRECTS_V1;\n\tif (!Number.isSafeInteger(maxRedirects) || maxRedirects < 0 || maxRedirects > MAX_REDIRECTS_V1)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_configuration\",\n\t\t\t`maxRedirects must be an integer between 0 and ${MAX_REDIRECTS_V1}`,\n\t\t);\n\tconst userAgent = options.userAgent ?? \"agent-forge-plugin-npm/1\";\n\tif (userAgent.length === 0 || userAgent.length > 256 || /[\\r\\n]/u.test(userAgent))\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", \"userAgent is invalid\");\n\n\tconst fetchFollowingRedirects = async (\n\t\turl: URL,\n\t\theaders: Readonly<Record<string, string>>,\n\t\tparentSignal: AbortSignal | undefined,\n\t): Promise<{ readonly response: Response; readonly request: RequestSignal }> => {\n\t\tlet current = url;\n\t\tfor (let redirect = 0; ; redirect += 1) {\n\t\t\tconst request = requestSignal(parentSignal, timeoutMs);\n\t\t\tlet response: Response;\n\t\t\ttry {\n\t\t\t\tresponse = await transport(current.toString(), {\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\theaders: { accept: \"*/*\", \"user-agent\": userAgent, ...headers },\n\t\t\t\t\tredirect: \"manual\",\n\t\t\t\t\tsignal: request.signal,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\trequest.cleanup();\n\t\t\t\tif (request.timedOut())\n\t\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_timed_out\", \"npm registry request timed out\");\n\t\t\t\tif (isAbortLike(error))\n\t\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"cancelled\", \"npm registry request was cancelled\");\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_failed\", \"npm registry request failed\");\n\t\t\t}\n\t\t\tif (!REDIRECT_STATUS.has(response.status)) return { response, request };\n\t\t\tconst location = response.headers.get(\"location\");\n\t\t\tawait response.body?.cancel().catch(() => undefined);\n\t\t\trequest.cleanup();\n\t\t\tif (location === null || redirect >= maxRedirects)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_failed\", \"npm registry redirect limit exceeded\");\n\t\t\tcurrent = tarballUrl(new URL(location, current).toString());\n\t\t}\n\t};\n\n\tconst resolveNpmPackage = async (input: {\n\t\treadonly name: string;\n\t\treadonly range?: string;\n\t\treadonly signal?: AbortSignal;\n\t}): Promise<NodeNpmPackageResolutionV1> => {\n\t\tif (input.signal?.aborted === true)\n\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"cancelled\", \"npm registry request was cancelled\");\n\t\tconst endpoint = packumentUrl(registry, input.name);\n\t\tconst authorization: Readonly<Record<string, string>> =\n\t\t\ttoken === undefined ? {} : { authorization: `Bearer ${token}` };\n\t\tconst { response, request } = await fetchFollowingRedirects(endpoint, authorization, input.signal);\n\t\ttry {\n\t\t\tif (response.status === 404 || response.status === 403)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"package_not_found\", \"npm package was not found on the registry\");\n\t\t\tif (response.status < 200 || response.status >= 300)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_failed\", \"npm registry request did not succeed\");\n\t\t\tif (!isJsonResponse(response))\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", \"npm registry response must be JSON\");\n\t\t\tconst versions = parsePackument(await readBody(response, maxResponseBytes, request.signal));\n\t\t\tconst version = selectNpmPackageVersionV1(Object.keys(versions), input.range);\n\t\t\tconst dist = version === undefined ? undefined : versions[version]?.dist;\n\t\t\tif (\n\t\t\t\tversion === undefined ||\n\t\t\t\tdist === undefined ||\n\t\t\t\ttypeof dist.tarball !== \"string\" ||\n\t\t\t\tdist.tarball.length === 0\n\t\t\t) {\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\t\t\"version_not_found\",\n\t\t\t\t\t\"No npm package version matches the requested range\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst integrityValue = dist.integrity;\n\t\t\tconst integrity =\n\t\t\t\ttypeof integrityValue === \"string\" && integrityValue.length > 0\n\t\t\t\t\t? sriToIntegrityV1(integrityValue)\n\t\t\t\t\t: undefined;\n\t\t\tif (integrity === undefined)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", \"npm package version has no integrity field\");\n\t\t\treturn {\n\t\t\t\tversion,\n\t\t\t\ttarballUrl: tarballUrl(dist.tarball).toString(),\n\t\t\t\tintegrity,\n\t\t\t\tdistInfo: dist as Readonly<Record<string, unknown>>,\n\t\t\t};\n\t\t} finally {\n\t\t\tawait response.body?.cancel().catch(() => undefined);\n\t\t\trequest.cleanup();\n\t\t}\n\t};\n\n\tconst fetchTarball = async (input: { readonly url: string; readonly signal?: AbortSignal }): Promise<Uint8Array> => {\n\t\tif (input.signal?.aborted === true)\n\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"cancelled\", \"npm tarball download was cancelled\");\n\t\tconst endpoint = tarballUrl(input.url);\n\t\tconst authorization: Readonly<Record<string, string>> =\n\t\t\ttoken === undefined ? {} : { authorization: `Bearer ${token}` };\n\t\tconst { response, request } = await fetchFollowingRedirects(endpoint, authorization, input.signal);\n\t\ttry {\n\t\t\tif (response.status < 200 || response.status >= 300)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_failed\", \"npm tarball download did not succeed\");\n\t\t\treturn await readBody(response, maxTarballBytes, request.signal);\n\t\t} finally {\n\t\t\tawait response.body?.cancel().catch(() => undefined);\n\t\t\trequest.cleanup();\n\t\t}\n\t};\n\n\treturn { version: 1, registry, resolveNpmPackage, fetchTarball };\n}\n"]}
1
+ {"version":3,"file":"node-npm-registry-source.js","sourceRoot":"","sources":["../../../src/plugins/ecosystem/node-npm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Q,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC;AAAA,CACjE","sourcesContent":["import { t } from \"../../core/i18n/index.ts\";\nimport { comparePluginVersionsV1 } from \"./catalog.ts\";\n\n/**\n * Minimal npm registry (packument) source for plugin package acquisition\n * (design `插件独立分发与启动装配设计.md` §4.2). It is a two-step protocol:\n * resolve the packument to pick one version, then fetch the tarball. It does\n * not implement `PluginRegistrySourceV1.list()`; the signed registry sources\n * keep serving private deployments unchanged.\n */\n\nconst DEFAULT_NPM_REGISTRY_V1 = \"https://registry.npmjs.org\";\nconst DEFAULT_TIMEOUT_MS_V1 = 15_000;\nconst MAX_TIMEOUT_MS_V1 = 120_000;\nconst DEFAULT_MAX_RESPONSE_BYTES_V1 = 8 * 1024 * 1024;\nconst MAX_RESPONSE_BYTES_V1 = 16 * 1024 * 1024;\nconst DEFAULT_MAX_TARBALL_BYTES_V1 = 128 * 1024 * 1024;\nconst MAX_TARBALL_BYTES_V1 = 512 * 1024 * 1024;\nconst DEFAULT_REDIRECTS_V1 = 3;\nconst MAX_REDIRECTS_V1 = 5;\nconst REDIRECT_STATUS = new Set([301, 302, 303, 307, 308]);\n\nexport type NodeNpmRegistrySourceErrorCodeV1 =\n\t| \"cancelled\"\n\t| \"invalid_configuration\"\n\t| \"request_failed\"\n\t| \"request_timed_out\"\n\t| \"invalid_response\"\n\t| \"response_too_large\"\n\t| \"package_not_found\"\n\t| \"version_not_found\"\n\t| \"integrity_unsupported\";\n\nexport class NodeNpmRegistrySourceErrorV1 extends Error {\n\treadonly code: NodeNpmRegistrySourceErrorCodeV1;\n\n\tconstructor(code: NodeNpmRegistrySourceErrorCodeV1, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"NodeNpmRegistrySourceErrorV1\";\n\t\tthis.code = code;\n\t}\n}\n\n/** SRI integrity as hex plus its algorithm, aligned with the install host digest format. */\nexport interface NodeNpmIntegrityV1 {\n\treadonly algorithm: \"sha256\" | \"sha512\";\n\treadonly hex: string;\n}\n\nexport interface NodeNpmPackageResolutionV1 {\n\treadonly version: string;\n\treadonly tarballUrl: string;\n\treadonly integrity: NodeNpmIntegrityV1;\n\t/** Raw `dist` fields of the selected version. */\n\treadonly distInfo: Readonly<Record<string, unknown>>;\n}\n\nexport interface NodeNpmRegistrySourceOptionsV1 {\n\t/** Bare http(s) registry origin; defaults to the npm public registry. */\n\treadonly registry?: string;\n\t/** Bearer token for private registries. */\n\treadonly token?: string;\n\t/** Real fetch or a deterministic test replacement. */\n\treadonly fetch?: typeof globalThis.fetch;\n\treadonly requestTimeoutMs?: number;\n\treadonly maxResponseBytes?: number;\n\treadonly maxTarballBytes?: number;\n\treadonly maxRedirects?: number;\n\treadonly userAgent?: string;\n}\n\nexport interface NodeNpmRegistrySourceV1 {\n\treadonly version: 1;\n\t/** Sanitized bare registry origin (no credentials, path, query, or fragment). */\n\treadonly registry: string;\n\treadonly resolveNpmPackage: (input: {\n\t\treadonly name: string;\n\t\treadonly range?: string;\n\t\treadonly signal?: AbortSignal;\n\t}) => Promise<NodeNpmPackageResolutionV1>;\n\treadonly fetchTarball: (input: { readonly url: string; readonly signal?: AbortSignal }) => Promise<Uint8Array>;\n}\n\n/** Convert an npm SRI string (`sha512-<base64>`, `sha256-<base64>`) to hex form. */\nexport function sriToIntegrityV1(sri: string): NodeNpmIntegrityV1 {\n\tconst match = /^(sha512|sha256)-([A-Za-z0-9+/]+={0,2})$/u.exec(sri.trim());\n\tif (match === null)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"integrity_unsupported\", t(\"npm integrity algorithm is unsupported\"));\n\tconst algorithm = match[1] as \"sha512\" | \"sha256\";\n\tlet raw: Buffer;\n\ttry {\n\t\traw = Buffer.from(match[2]!, \"base64\");\n\t} catch {\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"integrity_unsupported\", t(\"npm integrity encoding is invalid\"));\n\t}\n\tif ((algorithm === \"sha256\" && raw.byteLength !== 32) || (algorithm === \"sha512\" && raw.byteLength !== 64))\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"integrity_unsupported\", t(\"npm integrity length is invalid\"));\n\tconst hex = raw.toString(\"hex\").toLowerCase();\n\tif (hex.length === 0) throw new NodeNpmRegistrySourceErrorV1(\"integrity_unsupported\", t(\"npm integrity is invalid\"));\n\treturn { algorithm, hex };\n}\n\nfunction parseVersionTriple(value: string): readonly [number, number, number] | undefined {\n\tconst match = /^(\\d+)\\.(\\d+)\\.(\\d+)/u.exec(value.replace(/^[vV]/u, \"\"));\n\tif (match === null) return undefined;\n\tconst major = Number.parseInt(match[1]!, 10);\n\tconst minor = Number.parseInt(match[2]!, 10);\n\tconst patch = Number.parseInt(match[3]!, 10);\n\tif (!Number.isSafeInteger(major) || !Number.isSafeInteger(minor) || !Number.isSafeInteger(patch)) return undefined;\n\treturn [major, minor, patch] as const;\n}\n\nfunction plainVersion(value: string): string {\n\treturn value.replace(/^[vV]/u, \"\");\n}\n\n/**\n * Select the highest version satisfying a minimal range subset using the\n * ecosystem comparator (`comparePluginVersionsV1`): `undefined`/`latest` →\n * highest; `x.y.z` → exact full match (prerelease suffix included);\n * `^x.y.z` → >= x.y.z and < (x+1).0.0; `~x.y.z` → >= x.y.z and\n * < x.(y+1).0. Bounds use the comparator ordering (e.g. `1.0.0-alpha`\n * sorts below `1.0.0`).\n */\nexport function selectNpmPackageVersionV1(versions: readonly string[], range?: string): string | undefined {\n\tif (!Array.isArray(versions)) return undefined;\n\tlet candidates = versions.filter((value) => typeof value === \"string\" && parseVersionTriple(value) !== undefined);\n\tif (candidates.length === 0) return undefined;\n\tif (range === undefined || range === \"latest\") {\n\t\treturn candidates.reduce((left, right) => (comparePluginVersionsV1(right, left) > 0 ? right : left));\n\t}\n\tconst exact = plainVersion(range.replace(/^[=~^]/u, \"\"));\n\tif (!range.startsWith(\"^\") && !range.startsWith(\"~\"))\n\t\treturn candidates.find((value) => plainVersion(value) === exact);\n\tconst bound = parseVersionTriple(exact);\n\tif (bound === undefined) return undefined;\n\tconst [major, minor] = bound;\n\tconst upper = range.startsWith(\"^\") ? `${major + 1}.0.0` : `${major}.${minor + 1}.0`;\n\tcandidates = candidates.filter(\n\t\t(value) => comparePluginVersionsV1(value, exact) >= 0 && comparePluginVersionsV1(value, upper) < 0,\n\t);\n\tif (candidates.length === 0) return undefined;\n\treturn candidates.reduce((left, right) => (comparePluginVersionsV1(right, left) > 0 ? right : left));\n}\n\nfunction boundedPositive(value: number | undefined, fallback: number, maximum: number, label: string): number {\n\tconst result = value ?? fallback;\n\tif (!Number.isSafeInteger(result) || result <= 0 || result > maximum)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_configuration\",\n\t\t\tt(\"{label} must be a positive integer at most {maximum}\", { label, maximum }),\n\t\t);\n\treturn result;\n}\n\nfunction registryOrigin(value: string): string {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(value);\n\t} catch {\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", t(\"npm registry origin is invalid\"));\n\t}\n\tif (\n\t\t(parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") ||\n\t\tparsed.username !== \"\" ||\n\t\tparsed.password !== \"\"\n\t)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_configuration\",\n\t\t\tt(\"npm registry origin must be http(s) without credentials\"),\n\t\t);\n\tif (parsed.pathname !== \"/\" || parsed.search !== \"\" || parsed.hash !== \"\")\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_configuration\",\n\t\t\tt(\"npm registry origin must not include a path, query, or fragment\"),\n\t\t);\n\treturn parsed.origin;\n}\n\nfunction packumentUrl(registryOriginValue: string, name: string): URL {\n\tconst scopeAt = name.indexOf(\"/\");\n\tif (name.startsWith(\"@\") && scopeAt > 0) {\n\t\t// npm registry convention keeps the leading scope literal and percent\n\t\t// encodes the rest of the name, including the separating slash.\n\t\tconst scope = name.slice(0, scopeAt);\n\t\tconst packageName = name.slice(scopeAt + 1);\n\t\treturn new URL(`${registryOriginValue}/${scope}%2F${encodeURIComponent(packageName)}`);\n\t}\n\tif (scopeAt >= 0) throw new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", t(\"npm package name is invalid\"));\n\treturn new URL(`${registryOriginValue}/${encodeURIComponent(name)}`);\n}\n\nfunction tarballUrl(value: string): URL {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(value);\n\t} catch {\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", t(\"npm tarball URL is invalid\"));\n\t}\n\tif (\n\t\t(parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") ||\n\t\tparsed.username !== \"\" ||\n\t\tparsed.password !== \"\"\n\t)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_response\",\n\t\t\tt(\"npm tarball URL must use http(s) without credentials\"),\n\t\t);\n\tif (parsed.hash !== \"\")\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", t(\"npm tarball URL must not include a fragment\"));\n\treturn parsed;\n}\n\nfunction isAbortLike(error: unknown): boolean {\n\treturn error instanceof Error && (error.name === \"AbortError\" || error.name === \"AbortSignalError\");\n}\n\ninterface RequestSignal {\n\treadonly signal: AbortSignal;\n\treadonly timedOut: () => boolean;\n\treadonly cleanup: () => void;\n}\n\nfunction requestSignal(parent: AbortSignal | undefined, timeoutMs: number): RequestSignal {\n\tconst controller = new AbortController();\n\tlet timedOut = false;\n\tconst abort = () => controller.abort(parent?.reason);\n\tif (parent?.aborted === true) abort();\n\telse parent?.addEventListener(\"abort\", abort, { once: true });\n\tconst timeout = setTimeout(() => {\n\t\ttimedOut = true;\n\t\tcontroller.abort();\n\t}, timeoutMs);\n\treturn {\n\t\tsignal: controller.signal,\n\t\ttimedOut: () => timedOut,\n\t\tcleanup: () => {\n\t\t\tclearTimeout(timeout);\n\t\t\tparent?.removeEventListener(\"abort\", abort);\n\t\t},\n\t};\n}\n\nfunction isJsonResponse(response: Response): boolean {\n\tconst contentType = response.headers.get(\"content-type\");\n\tif (contentType === null) return false;\n\tconst mediaType = contentType.split(\";\", 1)[0]?.trim().toLowerCase();\n\treturn mediaType === \"application/json\" || mediaType === \"application/vnd.npm.install-v1+json\";\n}\n\nasync function readBody(response: Response, maxBytes: number, signal: AbortSignal): Promise<Uint8Array> {\n\tif (response.body === null)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", t(\"npm registry response has no body\"));\n\tconst reader = response.body.getReader();\n\tconst chunks: Uint8Array[] = [];\n\tlet total = 0;\n\ttry {\n\t\tfor (;;) {\n\t\t\tif (signal.aborted) throw new DOMException(t(\"aborted\"), \"AbortError\");\n\t\t\tconst item = await reader.read();\n\t\t\tif (item.done) break;\n\t\t\ttotal += item.value.byteLength;\n\t\t\tif (total > maxBytes)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\t\t\"response_too_large\",\n\t\t\t\t\tt(\"npm registry response exceeds the configured size limit\"),\n\t\t\t\t);\n\t\t\tchunks.push(item.value);\n\t\t}\n\t} finally {\n\t\treader.releaseLock();\n\t}\n\tconst bytes = new Uint8Array(total);\n\tlet offset = 0;\n\tfor (const chunk of chunks) {\n\t\tbytes.set(chunk, offset);\n\t\toffset += chunk.byteLength;\n\t}\n\treturn bytes;\n}\n\ninterface PackumentVersionDistV1 {\n\treadonly tarball?: unknown;\n\treadonly integrity?: unknown;\n}\n\ninterface PackumentVersionV1 {\n\treadonly dist?: PackumentVersionDistV1;\n}\n\ninterface PackumentV1 {\n\treadonly versions?: Readonly<Record<string, PackumentVersionV1>>;\n}\n\nfunction parsePackument(bytes: Uint8Array): Readonly<Record<string, PackumentVersionV1>> {\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes));\n\t} catch {\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", t(\"npm registry response is not valid JSON\"));\n\t}\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value))\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", t(\"npm packument is invalid\"));\n\tconst packument = value as PackumentV1;\n\tif (typeof packument.versions !== \"object\" || packument.versions === null || Array.isArray(packument.versions))\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", t(\"npm packument has no version table\"));\n\treturn packument.versions;\n}\n\n/** Create a bounded npm registry reader. Version selection uses the ecosystem comparator. */\nexport function createNodeNpmRegistrySourceV1(options: NodeNpmRegistrySourceOptionsV1 = {}): NodeNpmRegistrySourceV1 {\n\tconst transport = options.fetch ?? globalThis.fetch;\n\tif (typeof transport !== \"function\")\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", t(\"Node fetch is unavailable\"));\n\tconst registry = registryOrigin(options.registry ?? DEFAULT_NPM_REGISTRY_V1);\n\tif (\n\t\toptions.token !== undefined &&\n\t\t(options.token.length === 0 || options.token.length > 4096 || /[\\r\\n\\s]/u.test(options.token))\n\t)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", t(\"npm registry token is invalid\"));\n\tconst token = options.token;\n\tconst timeoutMs = boundedPositive(\n\t\toptions.requestTimeoutMs,\n\t\tDEFAULT_TIMEOUT_MS_V1,\n\t\tMAX_TIMEOUT_MS_V1,\n\t\t\"requestTimeoutMs\",\n\t);\n\tconst maxResponseBytes = boundedPositive(\n\t\toptions.maxResponseBytes,\n\t\tDEFAULT_MAX_RESPONSE_BYTES_V1,\n\t\tMAX_RESPONSE_BYTES_V1,\n\t\t\"maxResponseBytes\",\n\t);\n\tconst maxTarballBytes = boundedPositive(\n\t\toptions.maxTarballBytes,\n\t\tDEFAULT_MAX_TARBALL_BYTES_V1,\n\t\tMAX_TARBALL_BYTES_V1,\n\t\t\"maxTarballBytes\",\n\t);\n\tconst maxRedirects = options.maxRedirects ?? DEFAULT_REDIRECTS_V1;\n\tif (!Number.isSafeInteger(maxRedirects) || maxRedirects < 0 || maxRedirects > MAX_REDIRECTS_V1)\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\"invalid_configuration\",\n\t\t\tt(\"maxRedirects must be an integer between 0 and {max}\", { max: MAX_REDIRECTS_V1 }),\n\t\t);\n\tconst userAgent = options.userAgent ?? \"agent-forge-plugin-npm/1\";\n\tif (userAgent.length === 0 || userAgent.length > 256 || /[\\r\\n]/u.test(userAgent))\n\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_configuration\", t(\"userAgent is invalid\"));\n\n\tconst fetchFollowingRedirects = async (\n\t\turl: URL,\n\t\theaders: Readonly<Record<string, string>>,\n\t\tparentSignal: AbortSignal | undefined,\n\t): Promise<{ readonly response: Response; readonly request: RequestSignal }> => {\n\t\tlet current = url;\n\t\tfor (let redirect = 0; ; redirect += 1) {\n\t\t\tconst request = requestSignal(parentSignal, timeoutMs);\n\t\t\tlet response: Response;\n\t\t\ttry {\n\t\t\t\tresponse = await transport(current.toString(), {\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\theaders: { accept: \"*/*\", \"user-agent\": userAgent, ...headers },\n\t\t\t\t\tredirect: \"manual\",\n\t\t\t\t\tsignal: request.signal,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\trequest.cleanup();\n\t\t\t\tif (request.timedOut())\n\t\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_timed_out\", t(\"npm registry request timed out\"));\n\t\t\t\tif (isAbortLike(error))\n\t\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"cancelled\", t(\"npm registry request was cancelled\"));\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_failed\", t(\"npm registry request failed\"));\n\t\t\t}\n\t\t\tif (!REDIRECT_STATUS.has(response.status)) return { response, request };\n\t\t\tconst location = response.headers.get(\"location\");\n\t\t\tawait response.body?.cancel().catch(() => undefined);\n\t\t\trequest.cleanup();\n\t\t\tif (location === null || redirect >= maxRedirects)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_failed\", t(\"npm registry redirect limit exceeded\"));\n\t\t\tcurrent = tarballUrl(new URL(location, current).toString());\n\t\t}\n\t};\n\n\tconst resolveNpmPackage = async (input: {\n\t\treadonly name: string;\n\t\treadonly range?: string;\n\t\treadonly signal?: AbortSignal;\n\t}): Promise<NodeNpmPackageResolutionV1> => {\n\t\tif (input.signal?.aborted === true)\n\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"cancelled\", t(\"npm registry request was cancelled\"));\n\t\tconst endpoint = packumentUrl(registry, input.name);\n\t\tconst authorization: Readonly<Record<string, string>> =\n\t\t\ttoken === undefined ? {} : { authorization: `Bearer ${token}` };\n\t\tconst { response, request } = await fetchFollowingRedirects(endpoint, authorization, input.signal);\n\t\ttry {\n\t\t\tif (response.status === 404 || response.status === 403)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"package_not_found\", t(\"npm package was not found on the registry\"));\n\t\t\tif (response.status < 200 || response.status >= 300)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_failed\", t(\"npm registry request did not succeed\"));\n\t\t\tif (!isJsonResponse(response))\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", t(\"npm registry response must be JSON\"));\n\t\t\tconst versions = parsePackument(await readBody(response, maxResponseBytes, request.signal));\n\t\t\tconst version = selectNpmPackageVersionV1(Object.keys(versions), input.range);\n\t\t\tconst dist = version === undefined ? undefined : versions[version]?.dist;\n\t\t\tif (\n\t\t\t\tversion === undefined ||\n\t\t\t\tdist === undefined ||\n\t\t\t\ttypeof dist.tarball !== \"string\" ||\n\t\t\t\tdist.tarball.length === 0\n\t\t\t) {\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\n\t\t\t\t\t\"version_not_found\",\n\t\t\t\t\tt(\"No npm package version matches the requested range\"),\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst integrityValue = dist.integrity;\n\t\t\tconst integrity =\n\t\t\t\ttypeof integrityValue === \"string\" && integrityValue.length > 0\n\t\t\t\t\t? sriToIntegrityV1(integrityValue)\n\t\t\t\t\t: undefined;\n\t\t\tif (integrity === undefined)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"invalid_response\", t(\"npm package version has no integrity field\"));\n\t\t\treturn {\n\t\t\t\tversion,\n\t\t\t\ttarballUrl: tarballUrl(dist.tarball).toString(),\n\t\t\t\tintegrity,\n\t\t\t\tdistInfo: dist as Readonly<Record<string, unknown>>,\n\t\t\t};\n\t\t} finally {\n\t\t\tawait response.body?.cancel().catch(() => undefined);\n\t\t\trequest.cleanup();\n\t\t}\n\t};\n\n\tconst fetchTarball = async (input: { readonly url: string; readonly signal?: AbortSignal }): Promise<Uint8Array> => {\n\t\tif (input.signal?.aborted === true)\n\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"cancelled\", t(\"npm tarball download was cancelled\"));\n\t\tconst endpoint = tarballUrl(input.url);\n\t\tconst authorization: Readonly<Record<string, string>> =\n\t\t\ttoken === undefined ? {} : { authorization: `Bearer ${token}` };\n\t\tconst { response, request } = await fetchFollowingRedirects(endpoint, authorization, input.signal);\n\t\ttry {\n\t\t\tif (response.status < 200 || response.status >= 300)\n\t\t\t\tthrow new NodeNpmRegistrySourceErrorV1(\"request_failed\", t(\"npm tarball download did not succeed\"));\n\t\t\treturn await readBody(response, maxTarballBytes, request.signal);\n\t\t} finally {\n\t\t\tawait response.body?.cancel().catch(() => undefined);\n\t\t\trequest.cleanup();\n\t\t}\n\t};\n\n\treturn { version: 1, registry, resolveNpmPackage, fetchTarball };\n}\n"]}