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

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 (445) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/bundled-plugins/agent-loop-policy/agent-forge.json +19 -0
  3. package/bundled-plugins/agent-loop-policy/dist/entry.d.ts +28 -0
  4. package/bundled-plugins/agent-loop-policy/dist/entry.d.ts.map +1 -0
  5. package/bundled-plugins/agent-loop-policy/dist/entry.js +69 -0
  6. package/bundled-plugins/agent-loop-policy/dist/entry.js.map +1 -0
  7. package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts +199 -0
  8. package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts.map +1 -0
  9. package/bundled-plugins/agent-loop-policy/dist/loop-guard.js +208 -0
  10. package/bundled-plugins/agent-loop-policy/dist/loop-guard.js.map +1 -0
  11. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts +17 -0
  12. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts.map +1 -0
  13. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js +18 -0
  14. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js.map +1 -0
  15. package/bundled-plugins/agent-loop-policy/plugin.json +7 -0
  16. package/bundled-plugins/coding-tools/agent-forge.json +19 -0
  17. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.d.ts +5 -44
  18. package/bundled-plugins/coding-tools/dist/bash.d.ts.map +1 -0
  19. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.js +15 -119
  20. package/bundled-plugins/coding-tools/dist/bash.js.map +1 -0
  21. package/bundled-plugins/coding-tools/dist/capability.d.ts +25 -0
  22. package/bundled-plugins/coding-tools/dist/capability.d.ts.map +1 -0
  23. package/bundled-plugins/coding-tools/dist/capability.js +98 -0
  24. package/bundled-plugins/coding-tools/dist/capability.js.map +1 -0
  25. package/bundled-plugins/coding-tools/dist/config.d.ts +8 -0
  26. package/bundled-plugins/coding-tools/dist/config.d.ts.map +1 -0
  27. package/bundled-plugins/coding-tools/dist/config.js +8 -0
  28. package/bundled-plugins/coding-tools/dist/config.js.map +1 -0
  29. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.d.ts +3 -3
  30. package/bundled-plugins/coding-tools/dist/edit.d.ts.map +1 -0
  31. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.js +12 -10
  32. package/bundled-plugins/coding-tools/dist/edit.js.map +1 -0
  33. package/bundled-plugins/coding-tools/dist/entry.d.ts +14 -0
  34. package/bundled-plugins/coding-tools/dist/entry.d.ts.map +1 -0
  35. package/bundled-plugins/coding-tools/dist/entry.js +23 -0
  36. package/bundled-plugins/coding-tools/dist/entry.js.map +1 -0
  37. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.d.ts +4 -4
  38. package/bundled-plugins/coding-tools/dist/find.d.ts.map +1 -0
  39. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.js +10 -8
  40. package/bundled-plugins/coding-tools/dist/find.js.map +1 -0
  41. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.d.ts +3 -3
  42. package/bundled-plugins/coding-tools/dist/grep.d.ts.map +1 -0
  43. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.js +10 -8
  44. package/bundled-plugins/coding-tools/dist/grep.js.map +1 -0
  45. package/bundled-plugins/coding-tools/dist/index.d.ts +17 -0
  46. package/bundled-plugins/coding-tools/dist/index.d.ts.map +1 -0
  47. package/bundled-plugins/coding-tools/dist/index.js +17 -0
  48. package/bundled-plugins/coding-tools/dist/index.js.map +1 -0
  49. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.d.ts +3 -3
  50. package/bundled-plugins/coding-tools/dist/ls.d.ts.map +1 -0
  51. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js +8 -6
  52. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js.map +1 -1
  53. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.d.ts +2 -1
  54. package/bundled-plugins/coding-tools/dist/powershell.d.ts.map +1 -0
  55. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.js +6 -3
  56. package/bundled-plugins/coding-tools/dist/powershell.js.map +1 -0
  57. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.d.ts +3 -3
  58. package/bundled-plugins/coding-tools/dist/read.d.ts.map +1 -0
  59. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.js +15 -13
  60. package/bundled-plugins/coding-tools/dist/read.js.map +1 -0
  61. package/bundled-plugins/coding-tools/dist/types.d.ts +74 -0
  62. package/bundled-plugins/coding-tools/dist/types.d.ts.map +1 -0
  63. package/bundled-plugins/coding-tools/dist/types.js +28 -0
  64. package/bundled-plugins/coding-tools/dist/types.js.map +1 -0
  65. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.d.ts +2 -2
  66. package/bundled-plugins/coding-tools/dist/write.d.ts.map +1 -0
  67. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.js +11 -9
  68. package/bundled-plugins/coding-tools/dist/write.js.map +1 -0
  69. package/bundled-plugins/coding-tools/plugin.json +10 -0
  70. package/bundled-plugins/compaction-policy/agent-forge.json +19 -0
  71. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts +6 -0
  72. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts.map +1 -0
  73. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js +19 -0
  74. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js.map +1 -0
  75. package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts +6 -0
  76. package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts.map +1 -0
  77. package/bundled-plugins/compaction-policy/dist/compaction-policy.js +38 -0
  78. package/bundled-plugins/compaction-policy/dist/compaction-policy.js.map +1 -0
  79. package/bundled-plugins/compaction-policy/dist/entry.d.ts +13 -0
  80. package/bundled-plugins/compaction-policy/dist/entry.d.ts.map +1 -0
  81. package/bundled-plugins/compaction-policy/dist/entry.js +23 -0
  82. package/bundled-plugins/compaction-policy/dist/entry.js.map +1 -0
  83. package/bundled-plugins/compaction-policy/plugin.json +10 -0
  84. package/bundled-plugins/mcp-http/dist/index.d.ts +8 -0
  85. package/bundled-plugins/mcp-http/dist/index.d.ts.map +1 -0
  86. package/bundled-plugins/mcp-http/dist/index.js +8 -0
  87. package/bundled-plugins/mcp-http/dist/index.js.map +1 -0
  88. package/bundled-plugins/mcp-http/dist/mcp-http.d.ts.map +1 -0
  89. package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.js +1 -1
  90. package/bundled-plugins/mcp-http/dist/mcp-http.js.map +1 -0
  91. package/bundled-plugins/overflow-policy/agent-forge.json +19 -0
  92. package/bundled-plugins/overflow-policy/dist/entry.d.ts +16 -0
  93. package/bundled-plugins/overflow-policy/dist/entry.d.ts.map +1 -0
  94. package/bundled-plugins/overflow-policy/dist/entry.js +35 -0
  95. package/bundled-plugins/overflow-policy/dist/entry.js.map +1 -0
  96. package/bundled-plugins/overflow-policy/plugin.json +10 -0
  97. package/bundled-plugins/provider-failover/agent-forge.json +19 -0
  98. package/bundled-plugins/provider-failover/dist/entry.d.ts +8 -0
  99. package/bundled-plugins/provider-failover/dist/entry.d.ts.map +1 -0
  100. package/bundled-plugins/provider-failover/dist/entry.js +8 -0
  101. package/bundled-plugins/provider-failover/dist/entry.js.map +1 -0
  102. package/bundled-plugins/provider-failover/dist/provider-failover.d.ts +122 -0
  103. package/bundled-plugins/provider-failover/dist/provider-failover.d.ts.map +1 -0
  104. package/{dist/core/extensions → bundled-plugins/provider-failover/dist}/provider-failover.js +143 -56
  105. package/bundled-plugins/provider-failover/dist/provider-failover.js.map +1 -0
  106. package/bundled-plugins/provider-failover/plugin.json +7 -0
  107. package/bundled-plugins/retry-policy/agent-forge.json +19 -0
  108. package/bundled-plugins/retry-policy/dist/entry.d.ts +16 -0
  109. package/bundled-plugins/retry-policy/dist/entry.d.ts.map +1 -0
  110. package/bundled-plugins/retry-policy/dist/entry.js +34 -0
  111. package/bundled-plugins/retry-policy/dist/entry.js.map +1 -0
  112. package/bundled-plugins/retry-policy/plugin.json +10 -0
  113. package/dist/bundle/.build-manifest.json +109 -155
  114. package/dist/bundle/chunks/{anthropic-messages-ALDZBUKI.js → anthropic-messages-PLAKXR73.js} +1 -1
  115. package/dist/bundle/chunks/{azure-openai-responses-A2WJWZFB.js → azure-openai-responses-OUWQ2AZD.js} +1 -1
  116. package/dist/bundle/chunks/chunk-44I47ACN.js +13 -0
  117. package/dist/bundle/chunks/chunk-6F5JWGKE.js +4 -0
  118. package/dist/bundle/chunks/{chunk-CIX3FSBK.js → chunk-A3JYRWB6.js} +1 -1
  119. package/dist/bundle/chunks/{chunk-SQFG22WN.js → chunk-AC2FIS4G.js} +1 -1
  120. package/dist/bundle/chunks/chunk-HTC5K5SM.js +866 -0
  121. package/dist/bundle/chunks/{chunk-YJCQVXW5.js → chunk-HTEVUY7F.js} +1 -1
  122. package/dist/bundle/chunks/{chunk-Y7HXTASS.js → chunk-HV64ASMT.js} +1 -1
  123. package/dist/bundle/chunks/chunk-LSP24WNH.js +665 -0
  124. package/dist/bundle/chunks/{chunk-7ZY7IXZD.js → chunk-TRDNDS6A.js} +1 -1
  125. package/dist/bundle/chunks/{google-generative-ai-NIB4WONV.js → google-generative-ai-DLII6DAT.js} +1 -1
  126. package/dist/bundle/chunks/{google-vertex-DCPYUEUO.js → google-vertex-G7BZL7GM.js} +1 -1
  127. package/dist/bundle/chunks/image-resize-worker.js +4 -4
  128. package/dist/bundle/chunks/{mistral-conversations-OC6LA5XL.js → mistral-conversations-JXUK24ID.js} +1 -1
  129. package/dist/bundle/chunks/{openai-codex-responses-IO2X4Y7L.js → openai-codex-responses-5GSGFIPG.js} +1 -1
  130. package/dist/bundle/chunks/{openai-completions-XYQQHETU.js → openai-completions-EI2I6DTG.js} +1 -1
  131. package/dist/bundle/chunks/{openai-responses-DLIRN3CI.js → openai-responses-AUJQ3NWT.js} +1 -1
  132. package/dist/bundle/chunks/{pi-messages-E6RRYBO7.js → pi-messages-PWU2VJMR.js} +1 -1
  133. package/dist/bundle/chunks/virtual-modules-MRXD3RWG.js +5 -0
  134. package/dist/bundle/cli.js +1 -1
  135. package/dist/bundle/client.js +1 -1
  136. package/dist/bundle/index.js +3 -3
  137. package/dist/bundle/rpc-entry.js +1 -1
  138. package/dist/capabilities/builtin.d.ts +1 -1
  139. package/dist/capabilities/builtin.d.ts.map +1 -1
  140. package/dist/capabilities/builtin.js +5 -0
  141. package/dist/capabilities/builtin.js.map +1 -1
  142. package/dist/cli/plugin-command.d.ts.map +1 -1
  143. package/dist/cli/plugin-command.js +25 -3
  144. package/dist/cli/plugin-command.js.map +1 -1
  145. package/dist/config.d.ts +2 -3
  146. package/dist/config.d.ts.map +1 -1
  147. package/dist/config.js +2 -4
  148. package/dist/config.js.map +1 -1
  149. package/dist/core/agent-session-bash.d.ts +1 -1
  150. package/dist/core/agent-session-bash.d.ts.map +1 -1
  151. package/dist/core/agent-session-bash.js +1 -1
  152. package/dist/core/agent-session-bash.js.map +1 -1
  153. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  154. package/dist/core/agent-session-compaction.js +14 -1
  155. package/dist/core/agent-session-compaction.js.map +1 -1
  156. package/dist/core/agent-session-internal.d.ts +3 -1
  157. package/dist/core/agent-session-internal.d.ts.map +1 -1
  158. package/dist/core/agent-session-internal.js.map +1 -1
  159. package/dist/core/agent-session-loop.d.ts +4 -3
  160. package/dist/core/agent-session-loop.d.ts.map +1 -1
  161. package/dist/core/agent-session-loop.js +9 -6
  162. package/dist/core/agent-session-loop.js.map +1 -1
  163. package/dist/core/agent-session-retry.d.ts +1 -1
  164. package/dist/core/agent-session-retry.d.ts.map +1 -1
  165. package/dist/core/agent-session-retry.js +32 -3
  166. package/dist/core/agent-session-retry.js.map +1 -1
  167. package/dist/core/agent-session-services.d.ts +2 -0
  168. package/dist/core/agent-session-services.d.ts.map +1 -1
  169. package/dist/core/agent-session-services.js +31 -9
  170. package/dist/core/agent-session-services.js.map +1 -1
  171. package/dist/core/agent-session-store.d.ts.map +1 -1
  172. package/dist/core/agent-session-store.js +6 -1
  173. package/dist/core/agent-session-store.js.map +1 -1
  174. package/dist/core/agent-session-tools.d.ts.map +1 -1
  175. package/dist/core/agent-session-tools.js +18 -1
  176. package/dist/core/agent-session-tools.js.map +1 -1
  177. package/dist/core/agent-session.d.ts +34 -11
  178. package/dist/core/agent-session.d.ts.map +1 -1
  179. package/dist/core/agent-session.js +114 -38
  180. package/dist/core/agent-session.js.map +1 -1
  181. package/dist/core/bash-executor.d.ts +1 -1
  182. package/dist/core/bash-executor.d.ts.map +1 -1
  183. package/dist/core/bash-executor.js.map +1 -1
  184. package/dist/core/extensions/bootstrap-agent-loop.d.ts +23 -151
  185. package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
  186. package/dist/core/extensions/bootstrap-agent-loop.js +28 -290
  187. package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
  188. package/dist/core/extensions/capability-runtime-types.d.ts +5 -3
  189. package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
  190. package/dist/core/extensions/capability-runtime-types.js.map +1 -1
  191. package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
  192. package/dist/core/extensions/capability-runtime.js +42 -6
  193. package/dist/core/extensions/capability-runtime.js.map +1 -1
  194. package/dist/core/extensions/index.d.ts +12 -5
  195. package/dist/core/extensions/index.d.ts.map +1 -1
  196. package/dist/core/extensions/index.js +12 -5
  197. package/dist/core/extensions/index.js.map +1 -1
  198. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  199. package/dist/core/extensions/virtual-modules.js +65 -0
  200. package/dist/core/extensions/virtual-modules.js.map +1 -1
  201. package/dist/core/facade/coding-agent-facade.d.ts +1 -1
  202. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  203. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  204. package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -1
  205. package/dist/core/i18n/locales/zh-cn/cli.js +2 -0
  206. package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -1
  207. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +1 -1
  208. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -1
  209. package/dist/core/i18n/locales/zh-cn/core-contract-core.js +1 -1
  210. package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -1
  211. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -1
  212. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +2 -4
  213. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -1
  214. package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
  215. package/dist/core/i18n/locales/zh-cn/core-errors.js +3 -1
  216. package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
  217. package/dist/core/i18n/locales/zh-cn/index.d.ts.map +1 -1
  218. package/dist/core/i18n/locales/zh-cn/index.js +2 -0
  219. package/dist/core/i18n/locales/zh-cn/index.js.map +1 -1
  220. package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -1
  221. package/dist/core/i18n/locales/zh-cn/interactive-mode.js +5 -0
  222. package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -1
  223. package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts +7 -0
  224. package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts.map +1 -0
  225. package/dist/core/i18n/locales/zh-cn/session-cleanup.js +15 -0
  226. package/dist/core/i18n/locales/zh-cn/session-cleanup.js.map +1 -0
  227. package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts.map +1 -1
  228. package/dist/core/i18n/locales/zh-cn/slash-commands.js +1 -0
  229. package/dist/core/i18n/locales/zh-cn/slash-commands.js.map +1 -1
  230. package/dist/core/sdk.d.ts +10 -3
  231. package/dist/core/sdk.d.ts.map +1 -1
  232. package/dist/core/sdk.js +287 -78
  233. package/dist/core/sdk.js.map +1 -1
  234. package/dist/core/session-cleanup.d.ts +49 -0
  235. package/dist/core/session-cleanup.d.ts.map +1 -0
  236. package/dist/core/session-cleanup.js +159 -0
  237. package/dist/core/session-cleanup.js.map +1 -0
  238. package/dist/core/session-index.d.ts +75 -0
  239. package/dist/core/session-index.d.ts.map +1 -0
  240. package/dist/core/session-index.js +455 -0
  241. package/dist/core/session-index.js.map +1 -0
  242. package/dist/core/session-manager.d.ts +9 -0
  243. package/dist/core/session-manager.d.ts.map +1 -1
  244. package/dist/core/session-manager.js +202 -47
  245. package/dist/core/session-manager.js.map +1 -1
  246. package/dist/core/slash-commands.d.ts.map +1 -1
  247. package/dist/core/slash-commands.js +5 -0
  248. package/dist/core/slash-commands.js.map +1 -1
  249. package/dist/core/system-prompt.d.ts.map +1 -1
  250. package/dist/core/system-prompt.js +12 -1
  251. package/dist/core/system-prompt.js.map +1 -1
  252. package/dist/core/tools/bash-operations.d.ts +41 -0
  253. package/dist/core/tools/bash-operations.d.ts.map +1 -0
  254. package/dist/core/tools/bash-operations.js +113 -0
  255. package/dist/core/tools/bash-operations.js.map +1 -0
  256. package/dist/core/tools/capability-mount.d.ts +40 -0
  257. package/dist/core/tools/capability-mount.d.ts.map +1 -0
  258. package/dist/core/tools/capability-mount.js +112 -0
  259. package/dist/core/tools/capability-mount.js.map +1 -0
  260. package/dist/core/tools/index.d.ts +12 -36
  261. package/dist/core/tools/index.d.ts.map +1 -1
  262. package/dist/core/tools/index.js +1 -117
  263. package/dist/core/tools/index.js.map +1 -1
  264. package/dist/core/tools/readme-path.d.ts +3 -0
  265. package/dist/core/tools/readme-path.d.ts.map +1 -0
  266. package/dist/core/tools/readme-path.js +15 -0
  267. package/dist/core/tools/readme-path.js.map +1 -0
  268. package/dist/index.d.ts +3 -19
  269. package/dist/index.d.ts.map +1 -1
  270. package/dist/index.js +6 -39
  271. package/dist/index.js.map +1 -1
  272. package/dist/main.d.ts.map +1 -1
  273. package/dist/main.js +1 -0
  274. package/dist/main.js.map +1 -1
  275. package/dist/modes/interactive/components/assistant-message.d.ts +3 -0
  276. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  277. package/dist/modes/interactive/components/assistant-message.js +27 -5
  278. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  279. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  280. package/dist/modes/interactive/components/session-selector-search.js +5 -1
  281. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  282. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  283. package/dist/modes/interactive/components/session-selector.js +9 -0
  284. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  285. package/dist/modes/interactive/components/tool-execution.d.ts +17 -1
  286. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  287. package/dist/modes/interactive/components/tool-execution.js +52 -25
  288. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  289. package/dist/modes/interactive/components/tool-run-group.d.ts +44 -0
  290. package/dist/modes/interactive/components/tool-run-group.d.ts.map +1 -0
  291. package/dist/modes/interactive/components/tool-run-group.js +121 -0
  292. package/dist/modes/interactive/components/tool-run-group.js.map +1 -0
  293. package/dist/modes/interactive/interactive-commands.d.ts +2 -0
  294. package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
  295. package/dist/modes/interactive/interactive-commands.js +7 -0
  296. package/dist/modes/interactive/interactive-commands.js.map +1 -1
  297. package/dist/modes/interactive/interactive-mode.d.ts +18 -0
  298. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  299. package/dist/modes/interactive/interactive-mode.js +85 -3
  300. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  301. package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
  302. package/dist/plugins/ecosystem/cli.js +20 -5
  303. package/dist/plugins/ecosystem/cli.js.map +1 -1
  304. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts +7 -2
  305. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
  306. package/dist/plugins/ecosystem/node-npm-registry-source.js +64 -9
  307. package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
  308. package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts.map +1 -1
  309. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js +6 -0
  310. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js.map +1 -1
  311. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +7 -1
  312. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
  313. package/dist/plugins/ecosystem/node-plugin-bootstrap.js +50 -3
  314. package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
  315. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +28 -16
  316. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
  317. package/dist/plugins/ecosystem/plugin-bootstrap.js +35 -33
  318. package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
  319. package/dist/profile/plugin-profiles.d.ts +1 -1
  320. package/dist/profile/plugin-profiles.d.ts.map +1 -1
  321. package/dist/profile/plugin-profiles.js +18 -0
  322. package/dist/profile/plugin-profiles.js.map +1 -1
  323. package/dist/profiles/builtin-suites.d.ts +19 -5
  324. package/dist/profiles/builtin-suites.d.ts.map +1 -1
  325. package/dist/profiles/builtin-suites.js +26 -6
  326. package/dist/profiles/builtin-suites.js.map +1 -1
  327. package/docs/settings.md +354 -354
  328. package/docs/usage.md +292 -292
  329. package/examples/extensions/bash-spawn-hook/index.ts +7 -2
  330. package/examples/extensions/built-in-tool-renderer/index.ts +4 -2
  331. package/examples/extensions/minimal-mode/index.ts +2 -2
  332. package/examples/extensions/truncated-tool/index.ts +1 -1
  333. package/examples/extensions/with-deps/package-lock.json +2 -2
  334. package/examples/extensions/with-deps/package.json +1 -1
  335. package/examples/extensions/with-deps/plugin.json +1 -1
  336. package/package.json +3 -2
  337. package/dist/bundle/chunks/chunk-6ZKDNZHA.js +0 -145
  338. package/dist/bundle/chunks/chunk-HLJEVRWP.js +0 -13
  339. package/dist/bundle/chunks/chunk-YGHQME4V.js +0 -1456
  340. package/dist/bundle/chunks/virtual-modules-KZ5DRH7Q.js +0 -2
  341. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts +0 -7
  342. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts.map +0 -1
  343. package/dist/core/extensions/bootstrap-branch-summary-policy.js +0 -28
  344. package/dist/core/extensions/bootstrap-branch-summary-policy.js.map +0 -1
  345. package/dist/core/extensions/bootstrap-compaction-policy.d.ts +0 -7
  346. package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +0 -1
  347. package/dist/core/extensions/bootstrap-compaction-policy.js +0 -48
  348. package/dist/core/extensions/bootstrap-compaction-policy.js.map +0 -1
  349. package/dist/core/extensions/bootstrap-overflow-policy.d.ts +0 -7
  350. package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +0 -1
  351. package/dist/core/extensions/bootstrap-overflow-policy.js +0 -30
  352. package/dist/core/extensions/bootstrap-overflow-policy.js.map +0 -1
  353. package/dist/core/extensions/bootstrap-retry-policy.d.ts +0 -7
  354. package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +0 -1
  355. package/dist/core/extensions/bootstrap-retry-policy.js +0 -29
  356. package/dist/core/extensions/bootstrap-retry-policy.js.map +0 -1
  357. package/dist/core/extensions/bootstrap-tools.d.ts +0 -20
  358. package/dist/core/extensions/bootstrap-tools.d.ts.map +0 -1
  359. package/dist/core/extensions/bootstrap-tools.js +0 -36
  360. package/dist/core/extensions/bootstrap-tools.js.map +0 -1
  361. package/dist/core/extensions/provider-failover.d.ts +0 -110
  362. package/dist/core/extensions/provider-failover.d.ts.map +0 -1
  363. package/dist/core/extensions/provider-failover.js.map +0 -1
  364. package/dist/core/tools/bash.d.ts.map +0 -1
  365. package/dist/core/tools/bash.js.map +0 -1
  366. package/dist/core/tools/edit.d.ts.map +0 -1
  367. package/dist/core/tools/edit.js.map +0 -1
  368. package/dist/core/tools/find.d.ts.map +0 -1
  369. package/dist/core/tools/find.js.map +0 -1
  370. package/dist/core/tools/grep.d.ts.map +0 -1
  371. package/dist/core/tools/grep.js.map +0 -1
  372. package/dist/core/tools/ls.d.ts.map +0 -1
  373. package/dist/core/tools/powershell.d.ts.map +0 -1
  374. package/dist/core/tools/powershell.js.map +0 -1
  375. package/dist/core/tools/read.d.ts.map +0 -1
  376. package/dist/core/tools/read.js.map +0 -1
  377. package/dist/core/tools/write.d.ts.map +0 -1
  378. package/dist/core/tools/write.js.map +0 -1
  379. package/dist/plugins/mcp-http.d.ts.map +0 -1
  380. package/dist/plugins/mcp-http.js.map +0 -1
  381. package/dist/profile/child-facade.d.ts +0 -44
  382. package/dist/profile/child-facade.d.ts.map +0 -1
  383. package/dist/profile/child-facade.js +0 -56
  384. package/dist/profile/child-facade.js.map +0 -1
  385. package/dist/profile/dependency-wiring.d.ts +0 -48
  386. package/dist/profile/dependency-wiring.d.ts.map +0 -1
  387. package/dist/profile/dependency-wiring.js +0 -56
  388. package/dist/profile/dependency-wiring.js.map +0 -1
  389. package/dist/profile/domain-recovery.d.ts +0 -60
  390. package/dist/profile/domain-recovery.d.ts.map +0 -1
  391. package/dist/profile/domain-recovery.js +0 -94
  392. package/dist/profile/domain-recovery.js.map +0 -1
  393. package/dist/profile/first-roles.d.ts +0 -30
  394. package/dist/profile/first-roles.d.ts.map +0 -1
  395. package/dist/profile/first-roles.js +0 -83
  396. package/dist/profile/first-roles.js.map +0 -1
  397. package/dist/profile/goal-plugin.d.ts +0 -38
  398. package/dist/profile/goal-plugin.d.ts.map +0 -1
  399. package/dist/profile/goal-plugin.js +0 -132
  400. package/dist/profile/goal-plugin.js.map +0 -1
  401. package/dist/profile/plan-plugin.d.ts +0 -44
  402. package/dist/profile/plan-plugin.d.ts.map +0 -1
  403. package/dist/profile/plan-plugin.js +0 -157
  404. package/dist/profile/plan-plugin.js.map +0 -1
  405. package/dist/profile/policy-manifest.d.ts +0 -53
  406. package/dist/profile/policy-manifest.d.ts.map +0 -1
  407. package/dist/profile/policy-manifest.js +0 -53
  408. package/dist/profile/policy-manifest.js.map +0 -1
  409. package/dist/profile/role-assembly.d.ts +0 -47
  410. package/dist/profile/role-assembly.d.ts.map +0 -1
  411. package/dist/profile/role-assembly.js +0 -31
  412. package/dist/profile/role-assembly.js.map +0 -1
  413. package/dist/profile/role-catalog.d.ts +0 -43
  414. package/dist/profile/role-catalog.d.ts.map +0 -1
  415. package/dist/profile/role-catalog.js +0 -132
  416. package/dist/profile/role-catalog.js.map +0 -1
  417. package/dist/profile/role-orchestrator.d.ts +0 -123
  418. package/dist/profile/role-orchestrator.d.ts.map +0 -1
  419. package/dist/profile/role-orchestrator.js +0 -195
  420. package/dist/profile/role-orchestrator.js.map +0 -1
  421. package/dist/profile/role-runner.d.ts +0 -99
  422. package/dist/profile/role-runner.d.ts.map +0 -1
  423. package/dist/profile/role-runner.js +0 -79
  424. package/dist/profile/role-runner.js.map +0 -1
  425. package/dist/profile/root-facade.d.ts +0 -36
  426. package/dist/profile/root-facade.d.ts.map +0 -1
  427. package/dist/profile/root-facade.js +0 -49
  428. package/dist/profile/root-facade.js.map +0 -1
  429. package/dist/profile/skill-discovery-wiring.d.ts +0 -58
  430. package/dist/profile/skill-discovery-wiring.d.ts.map +0 -1
  431. package/dist/profile/skill-discovery-wiring.js +0 -80
  432. package/dist/profile/skill-discovery-wiring.js.map +0 -1
  433. package/dist/profile/state-store.d.ts +0 -62
  434. package/dist/profile/state-store.d.ts.map +0 -1
  435. package/dist/profile/state-store.js +0 -144
  436. package/dist/profile/state-store.js.map +0 -1
  437. package/dist/profile/todo-plugin.d.ts +0 -37
  438. package/dist/profile/todo-plugin.d.ts.map +0 -1
  439. package/dist/profile/todo-plugin.js +0 -137
  440. package/dist/profile/todo-plugin.js.map +0 -1
  441. package/examples/extensions/mcp-stdio/index.d.ts +0 -64
  442. package/examples/extensions/mcp-stdio/index.d.ts.map +0 -1
  443. package/examples/extensions/mcp-stdio/index.js +0 -292
  444. package/examples/extensions/mcp-stdio/index.js.map +0 -1
  445. /package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-bootstrap.d.ts","sourceRoot":"","sources":["../../../src/plugins/ecosystem/plugin-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAIrF,eAAO,MAAM,2BAA2B,GAAa,CAAC;AAEtD,gFAAgF;AAChF,MAAM,MAAM,2BAA2B,GAAG,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B,KAAK,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE3C,qFAAqF;AACrF,MAAM,MAAM,+BAA+B,GAAG,CAAC,KAAK,EAAE;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B,KAAK,OAAO,CAAC;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3E,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;IACjD,QAAQ,CAAC,cAAc,EAAE,+BAA+B,CAAC;IACzD,2EAA2E;IAC3E,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CA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AAC,OAAO,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,SAAS,2BAA2B,EAAE,CAAC;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAWD,0EAA0E;AAC1E,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEpH;AAwBD;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,QAAQ,EAAE,SAAS,6BAA6B,EAAE,CAAC;IAC5D,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAgGnC","sourcesContent":["/**\n * Startup plugin bootstrap orchestrator (design\n * `插件独立分发与启动装配设计.md` §4.4, §0.7). Pure injectable decision loop\n * over the frozen factory manifest: every entry is compared against the\n * locally resolved active installations and only missing plugins are handed\n * to the npm install dependency — bootstrap never acquires through any other\n * source.\n *\n * Coverage rules (G5): an existing active installation is never replaced. A\n * satisfied range is skipped silently (zero acquisition calls, G3); an\n * unsatisfied one produces a diagnostic with a manual install command and no\n * automatic replacement. Failure semantics (G4): one plugin's install\n * failure is recorded and the loop continues; the run itself never throws.\n * All effects live behind the injected dependencies, so the loop is fully\n * deterministic under mocks.\n */\n\nimport type { PluginBootstrapFactoryEntryV1 } from \"./bootstrap-factory-manifest.ts\";\nimport { selectNpmPackageVersionV1 } from \"./node-npm-registry-source.ts\";\nimport { PluginAcquisitionErrorV1 } from \"./plugin-acquisition.ts\";\n\nexport const PLUGIN_BOOTSTRAP_VERSION_V1 = 1 as const;\n\n/** Read-only local lookup of active installation versions (never networked). */\nexport type PluginBootstrapListActiveV1 = (input: {\n\treadonly signal?: AbortSignal;\n}) => Promise<ReadonlyMap<string, string>>;\n\n/** npm-only install action; resolves with the installed version and source label. */\nexport type PluginBootstrapInstallFromNpmV1 = (input: {\n\treadonly npmName: string;\n\treadonly range?: string;\n\treadonly signal?: AbortSignal;\n}) => Promise<{ readonly pluginVersion: string; readonly source: string }>;\n\nexport interface PluginBootstrapDepsV1 {\n\treadonly listActive: PluginBootstrapListActiveV1;\n\treadonly installFromNpm: PluginBootstrapInstallFromNpmV1;\n\t/** Deterministic clock for the observed duration; defaults to Date.now. */\n\treadonly now?: () => number;\n\t/** Cooperative cancellation; checked before each manifest entry. */\n\treadonly signal?: AbortSignal;\n}\n\nexport type PluginBootstrapActionStatusV1 = \"skipped\" | \"diagnosed\" | \"installed\" | \"failed\";\n\nexport type PluginBootstrapActionReasonV1 = \"satisfies_range\" | \"range_not_satisfied\" | \"installed\" | \"install_failed\";\n\n/** One per-entry outcome; the version fields carry what each status observed. */\nexport interface PluginBootstrapActionV1 {\n\treadonly pluginId: string;\n\treadonly status: PluginBootstrapActionStatusV1;\n\treadonly reason: PluginBootstrapActionReasonV1;\n\treadonly npmName: string;\n\treadonly range?: string;\n\t/** Active version that decided a skipped/diagnosed outcome. */\n\treadonly activeVersion?: string;\n\t/** Version reported by the install action. */\n\treadonly installedVersion?: string;\n\t/** npm source label reported by the install action. */\n\treadonly source?: string;\n\t/** Acquisition or install failure code for failed actions. */\n\treadonly errorCode?: string;\n}\n\nexport type PluginBootstrapDiagnosticCodeV1 =\n\t| \"range_not_satisfied\"\n\t| \"install_failed\"\n\t| \"list_active_failed\"\n\t| \"cancelled\"\n\t| \"bootstrap_failed\"\n\t| \"bootstrap_skipped_offline\";\n\nexport interface PluginBootstrapDiagnosticV1 {\n\treadonly code: PluginBootstrapDiagnosticCodeV1;\n\treadonly message: string;\n\treadonly pluginId?: string;\n}\n\nexport type PluginBootstrapStatusV1 = \"succeeded\" | \"degraded\" | \"failed\";\n\nexport interface PluginBootstrapResultV1 {\n\treadonly version: typeof PLUGIN_BOOTSTRAP_VERSION_V1;\n\t/** Aggregated outcome: failed > degraded (diagnosed entries) > succeeded. */\n\treadonly status: PluginBootstrapStatusV1;\n\treadonly actions: readonly PluginBootstrapActionV1[];\n\treadonly diagnostics: readonly PluginBootstrapDiagnosticV1[];\n\treadonly durationMs: number;\n}\n\n/**\n * A version satisfies a factory range under the same selection semantics npm\n * resolution uses: it is the version that would be picked if it were the only\n * candidate. Keeps local comparison and registry resolution consistent.\n */\nfunction satisfiesRangeV1(version: string, range: string | undefined): boolean {\n\treturn selectNpmPackageVersionV1([version], range) === version;\n}\n\n/** Executable repair command for diagnostics (G4/G5 remediation hint). */\nexport function pluginBootstrapInstallCommandV1(entry: { readonly npmName: string; readonly range?: string }): string {\n\treturn `agent-forge plugin install ${entry.npmName}@${entry.range ?? \"latest\"}`;\n}\n\nfunction errorMessage(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n\nfunction acquireErrorCode(error: unknown): string {\n\treturn error instanceof PluginAcquisitionErrorV1 ? error.code : \"install_failed\";\n}\n\nfunction actionOf(\n\tentry: PluginBootstrapFactoryEntryV1,\n\tstatus: PluginBootstrapActionStatusV1,\n\treason: PluginBootstrapActionReasonV1,\n): PluginBootstrapActionV1 {\n\treturn Object.freeze({\n\t\tpluginId: entry.pluginId,\n\t\tstatus,\n\t\treason,\n\t\tnpmName: entry.npmName,\n\t\t...(entry.range === undefined ? {} : { range: entry.range }),\n\t});\n}\n\n/**\n * Run the bootstrap decision loop. An empty manifest short-circuits before\n * any dependency is touched, so the factory-empty S1-c2 state performs zero\n * reads on real startups.\n */\nexport async function runPluginBootstrapV1(input: {\n\treadonly manifest: readonly PluginBootstrapFactoryEntryV1[];\n\treadonly deps: PluginBootstrapDepsV1;\n\t/**\n\t * Fired once after the local active-state read when at least one factory\n\t * entry has no active installation — the host's first-run progress line\n\t * hook (设计 §4.4 首装进度行, 2026-10-03): a fresh install is otherwise\n\t * silent for the whole network install window. Injected effect, the loop\n\t * itself stays free of console I/O.\n\t */\n\treadonly onPendingInstalls?: (count: number) => void;\n}): Promise<PluginBootstrapResultV1> {\n\tconst now = input.deps.now ?? Date.now;\n\tconst startedAt = now();\n\tconst finish = (\n\t\tstatus: PluginBootstrapStatusV1,\n\t\tactions: readonly PluginBootstrapActionV1[],\n\t\tdiagnostics: readonly PluginBootstrapDiagnosticV1[],\n\t): PluginBootstrapResultV1 =>\n\t\tObject.freeze({\n\t\t\tversion: PLUGIN_BOOTSTRAP_VERSION_V1,\n\t\t\tstatus,\n\t\t\tactions: Object.freeze([...actions]),\n\t\t\tdiagnostics: Object.freeze([...diagnostics]),\n\t\t\tdurationMs: Math.max(0, now() - startedAt),\n\t\t});\n\tif (input.manifest.length === 0) return finish(\"succeeded\", [], []);\n\tconst signal = input.deps.signal;\n\tlet active: ReadonlyMap<string, string>;\n\ttry {\n\t\tactive = await input.deps.listActive({ ...(signal === undefined ? {} : { signal }) });\n\t} catch (error) {\n\t\treturn finish(\n\t\t\t\"failed\",\n\t\t\t[],\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tcode: \"list_active_failed\",\n\t\t\t\t\tmessage: `Active plugin state could not be read; bootstrap installed nothing: ${errorMessage(error)}`,\n\t\t\t\t},\n\t\t\t],\n\t\t);\n\t}\n\tconst actions: PluginBootstrapActionV1[] = [];\n\tconst diagnostics: PluginBootstrapDiagnosticV1[] = [];\n\tif (input.onPendingInstalls !== undefined) {\n\t\tconst pending = input.manifest.filter((entry) => !active.has(entry.pluginId)).length;\n\t\tif (pending > 0) input.onPendingInstalls(pending);\n\t}\n\tfor (const entry of input.manifest) {\n\t\tif (signal?.aborted === true) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"cancelled\",\n\t\t\t\tmessage: \"Plugin bootstrap was cancelled before all factory entries were processed\",\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tconst activeVersion = active.get(entry.pluginId);\n\t\tif (activeVersion !== undefined) {\n\t\t\tif (satisfiesRangeV1(activeVersion, entry.range)) {\n\t\t\t\tactions.push(Object.freeze({ ...actionOf(entry, \"skipped\", \"satisfies_range\"), activeVersion }));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tactions.push(Object.freeze({ ...actionOf(entry, \"diagnosed\", \"range_not_satisfied\"), activeVersion }));\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"range_not_satisfied\",\n\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\tmessage:\n\t\t\t\t\t`Active version ${activeVersion} of ${entry.pluginId} does not satisfy the factory range ` +\n\t\t\t\t\t`${entry.range ?? \"latest\"}; bootstrap never replaces active installations. ` +\n\t\t\t\t\t`Run \\`${pluginBootstrapInstallCommandV1(entry)}\\` to install a matching version, ` +\n\t\t\t\t\t`or \\`agent-forge plugin update --all\\` to upgrade every outdated plugin at once.`,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst installed = await input.deps.installFromNpm({\n\t\t\t\tnpmName: entry.npmName,\n\t\t\t\t...(entry.range === undefined ? {} : { range: entry.range }),\n\t\t\t\t...(signal === undefined ? {} : { signal }),\n\t\t\t});\n\t\t\tactions.push(\n\t\t\t\tObject.freeze({\n\t\t\t\t\t...actionOf(entry, \"installed\", \"installed\"),\n\t\t\t\t\tinstalledVersion: installed.pluginVersion,\n\t\t\t\t\tsource: installed.source,\n\t\t\t\t}),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconst errorCode = acquireErrorCode(error);\n\t\t\tactions.push(Object.freeze({ ...actionOf(entry, \"failed\", \"install_failed\"), errorCode }));\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"install_failed\",\n\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\tmessage:\n\t\t\t\t\t`Bootstrap could not install ${entry.pluginId} from npm (${errorCode}: ${errorMessage(error)}). ` +\n\t\t\t\t\t`Startup continues without it; its capabilities stay unavailable until installed. ` +\n\t\t\t\t\t`Run \\`${pluginBootstrapInstallCommandV1(entry)}\\` to install it manually.`,\n\t\t\t});\n\t\t}\n\t}\n\tconst status: PluginBootstrapStatusV1 = actions.some((action) => action.status === \"failed\")\n\t\t? \"failed\"\n\t\t: actions.some((action) => action.status === \"diagnosed\")\n\t\t\t? \"degraded\"\n\t\t\t: \"succeeded\";\n\treturn finish(status, actions, diagnostics);\n}\n"]}
1
+ {"version":3,"file":"plugin-bootstrap.d.ts","sourceRoot":"","sources":["../../../src/plugins/ecosystem/plugin-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAIrF,eAAO,MAAM,2BAA2B,GAAa,CAAC;AAEtD,gFAAgF;AAChF,MAAM,MAAM,2BAA2B,GAAG,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B,KAAK,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE3C,qFAAqF;AACrF,MAAM,MAAM,+BAA+B,GAAG,CAAC,KAAK,EAAE;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B,KAAK,OAAO,CAAC;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3E,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;IACjD,QAAQ,CAAC,cAAc,EAAE,+BAA+B,CAAC;IACzD,2EAA2E;IAC3E,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,oEAAoE;IACpE,Q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,QAAQ,CAAC,OAAO,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,SAAS,2BAA2B,EAAE,CAAC;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAWD,uEAAuE;AACvE,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEpH;AAwBD;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,QAAQ,EAAE,SAAS,6BAA6B,EAAE,CAAC;IAC5D,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,CAAC;CAC9D,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA6FnC","sourcesContent":["/**\n * Startup plugin bootstrap orchestrator (design\n * `插件独立分发与启动装配设计.md` §4.4, §0.7). Pure injectable decision loop\n * over the frozen factory manifest: every entry is compared against the\n * locally resolved active installations; missing plugins and factory entries\n * whose active version no longer satisfies the factory range are handed to\n * the npm install dependency — bootstrap never acquires through any other\n * source.\n *\n * Coverage rules (G5, with the 2026-10-04 install-and-use exception): a\n * satisfied range is skipped silently (zero acquisition calls, G3); a factory\n * entry whose range is unsatisfied is automatically realigned by installing\n * the factory range — factory plugins are version-locked to the running\n * framework, so an unsatisfied range is a broken compatibility state, not a\n * user preference to protect. User-installed third-party plugins are not in\n * the factory manifest and stay untouched. Failure semantics (G4): one\n * plugin's install failure is recorded and the loop continues; the run itself\n * never throws, and a failed entry self-heals on the next startup because it\n * stays unsatisfied. All effects live behind the injected dependencies, so\n * the loop is fully deterministic under mocks.\n */\n\nimport type { PluginBootstrapFactoryEntryV1 } from \"./bootstrap-factory-manifest.ts\";\nimport { selectNpmPackageVersionV1 } from \"./node-npm-registry-source.ts\";\nimport { PluginAcquisitionErrorV1 } from \"./plugin-acquisition.ts\";\n\nexport const PLUGIN_BOOTSTRAP_VERSION_V1 = 1 as const;\n\n/** Read-only local lookup of active installation versions (never networked). */\nexport type PluginBootstrapListActiveV1 = (input: {\n\treadonly signal?: AbortSignal;\n}) => Promise<ReadonlyMap<string, string>>;\n\n/** npm-only install action; resolves with the installed version and source label. */\nexport type PluginBootstrapInstallFromNpmV1 = (input: {\n\treadonly npmName: string;\n\treadonly range?: string;\n\treadonly signal?: AbortSignal;\n}) => Promise<{ readonly pluginVersion: string; readonly source: string }>;\n\nexport interface PluginBootstrapDepsV1 {\n\treadonly listActive: PluginBootstrapListActiveV1;\n\treadonly installFromNpm: PluginBootstrapInstallFromNpmV1;\n\t/** Deterministic clock for the observed duration; defaults to Date.now. */\n\treadonly now?: () => number;\n\t/** Cooperative cancellation; checked before each manifest entry. */\n\treadonly signal?: AbortSignal;\n}\n\nexport type PluginBootstrapActionStatusV1 = \"skipped\" | \"installed\" | \"failed\";\n\nexport type PluginBootstrapActionReasonV1 =\n\t| \"satisfies_range\"\n\t| \"installed\"\n\t| \"range_aligned\"\n\t| \"install_failed\"\n\t| \"align_failed\";\n\n/** One per-entry outcome; the version fields carry what each status observed. */\nexport interface PluginBootstrapActionV1 {\n\treadonly pluginId: string;\n\treadonly status: PluginBootstrapActionStatusV1;\n\treadonly reason: PluginBootstrapActionReasonV1;\n\treadonly npmName: string;\n\treadonly range?: string;\n\t/** Active version that decided a skipped outcome. */\n\treadonly activeVersion?: string;\n\t/** Version reported by the install action. */\n\treadonly installedVersion?: string;\n\t/** npm source label reported by the install action. */\n\treadonly source?: string;\n\t/** Acquisition or install failure code for failed actions. */\n\treadonly errorCode?: string;\n}\n\nexport type PluginBootstrapDiagnosticCodeV1 =\n\t| \"install_failed\"\n\t| \"list_active_failed\"\n\t| \"cancelled\"\n\t| \"bootstrap_failed\"\n\t| \"bootstrap_skipped_offline\";\n\nexport interface PluginBootstrapDiagnosticV1 {\n\treadonly code: PluginBootstrapDiagnosticCodeV1;\n\treadonly message: string;\n\treadonly pluginId?: string;\n}\n\nexport type PluginBootstrapStatusV1 = \"succeeded\" | \"failed\";\n\nexport interface PluginBootstrapResultV1 {\n\treadonly version: typeof PLUGIN_BOOTSTRAP_VERSION_V1;\n\t/** Aggregated outcome: failed (any failed entry) > succeeded. */\n\treadonly status: PluginBootstrapStatusV1;\n\treadonly actions: readonly PluginBootstrapActionV1[];\n\treadonly diagnostics: readonly PluginBootstrapDiagnosticV1[];\n\treadonly durationMs: number;\n}\n\n/**\n * A version satisfies a factory range under the same selection semantics npm\n * resolution uses: it is the version that would be picked if it were the only\n * candidate. Keeps local comparison and registry resolution consistent.\n */\nfunction satisfiesRangeV1(version: string, range: string | undefined): boolean {\n\treturn selectNpmPackageVersionV1([version], range) === version;\n}\n\n/** Executable repair command for diagnostics (G4 remediation hint). */\nexport function pluginBootstrapInstallCommandV1(entry: { readonly npmName: string; readonly range?: string }): string {\n\treturn `agent-forge plugin install ${entry.npmName}@${entry.range ?? \"latest\"}`;\n}\n\nfunction errorMessage(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n\nfunction acquireErrorCode(error: unknown): string {\n\treturn error instanceof PluginAcquisitionErrorV1 ? error.code : \"install_failed\";\n}\n\nfunction actionOf(\n\tentry: PluginBootstrapFactoryEntryV1,\n\tstatus: PluginBootstrapActionStatusV1,\n\treason: PluginBootstrapActionReasonV1,\n): PluginBootstrapActionV1 {\n\treturn Object.freeze({\n\t\tpluginId: entry.pluginId,\n\t\tstatus,\n\t\treason,\n\t\tnpmName: entry.npmName,\n\t\t...(entry.range === undefined ? {} : { range: entry.range }),\n\t});\n}\n\n/**\n * Run the bootstrap decision loop. An empty manifest short-circuits before\n * any dependency is touched, so the factory-empty S1-c2 state performs zero\n * reads on real startups.\n */\nexport async function runPluginBootstrapV1(input: {\n\treadonly manifest: readonly PluginBootstrapFactoryEntryV1[];\n\treadonly deps: PluginBootstrapDepsV1;\n\t/**\n\t * Fired once after the local active-state read when at least one factory\n\t * entry has no active installation — the host's first-run progress line\n\t * hook (设计 §4.4 首装进度行, 2026-10-03): a fresh install is otherwise\n\t * silent for the whole network install window. Injected effect, the loop\n\t * itself stays free of console I/O.\n\t */\n\treadonly onPendingInstalls?: (count: number) => void;\n\t/**\n\t * Fired after every per-entry action (设计 §4.4 逐插件进度, 2026-10-04):\n\t * the host renders one line per install/align/failure so the waiting user\n\t * sees live state; skipped entries stay silent at the host's discretion.\n\t * Injected effect, the loop itself stays free of console I/O.\n\t */\n\treadonly onAction?: (action: PluginBootstrapActionV1) => void;\n}): Promise<PluginBootstrapResultV1> {\n\tconst now = input.deps.now ?? Date.now;\n\tconst startedAt = now();\n\tconst finish = (\n\t\tstatus: PluginBootstrapStatusV1,\n\t\tactions: readonly PluginBootstrapActionV1[],\n\t\tdiagnostics: readonly PluginBootstrapDiagnosticV1[],\n\t): PluginBootstrapResultV1 =>\n\t\tObject.freeze({\n\t\t\tversion: PLUGIN_BOOTSTRAP_VERSION_V1,\n\t\t\tstatus,\n\t\t\tactions: Object.freeze([...actions]),\n\t\t\tdiagnostics: Object.freeze([...diagnostics]),\n\t\t\tdurationMs: Math.max(0, now() - startedAt),\n\t\t});\n\tif (input.manifest.length === 0) return finish(\"succeeded\", [], []);\n\tconst signal = input.deps.signal;\n\tlet active: ReadonlyMap<string, string>;\n\ttry {\n\t\tactive = await input.deps.listActive({ ...(signal === undefined ? {} : { signal }) });\n\t} catch (error) {\n\t\treturn finish(\n\t\t\t\"failed\",\n\t\t\t[],\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tcode: \"list_active_failed\",\n\t\t\t\t\tmessage: `Active plugin state could not be read; bootstrap installed nothing: ${errorMessage(error)}`,\n\t\t\t\t},\n\t\t\t],\n\t\t);\n\t}\n\tconst actions: PluginBootstrapActionV1[] = [];\n\tconst diagnostics: PluginBootstrapDiagnosticV1[] = [];\n\tconst record = (action: PluginBootstrapActionV1): void => {\n\t\tactions.push(action);\n\t\tinput.onAction?.(action);\n\t};\n\tif (input.onPendingInstalls !== undefined) {\n\t\tconst pending = input.manifest.filter((entry) => !active.has(entry.pluginId)).length;\n\t\tif (pending > 0) input.onPendingInstalls(pending);\n\t}\n\tfor (const entry of input.manifest) {\n\t\tif (signal?.aborted === true) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"cancelled\",\n\t\t\t\tmessage: \"Plugin bootstrap was cancelled before all factory entries were processed\",\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tconst activeVersion = active.get(entry.pluginId);\n\t\tif (activeVersion !== undefined && satisfiesRangeV1(activeVersion, entry.range)) {\n\t\t\trecord(Object.freeze({ ...actionOf(entry, \"skipped\", \"satisfies_range\"), activeVersion }));\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst installed = await input.deps.installFromNpm({\n\t\t\t\tnpmName: entry.npmName,\n\t\t\t\t...(entry.range === undefined ? {} : { range: entry.range }),\n\t\t\t\t...(signal === undefined ? {} : { signal }),\n\t\t\t});\n\t\t\trecord(\n\t\t\t\tObject.freeze({\n\t\t\t\t\t...actionOf(entry, \"installed\", activeVersion === undefined ? \"installed\" : \"range_aligned\"),\n\t\t\t\t\tinstalledVersion: installed.pluginVersion,\n\t\t\t\t\tsource: installed.source,\n\t\t\t\t}),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconst errorCode = acquireErrorCode(error);\n\t\t\tconst aligning = activeVersion !== undefined;\n\t\t\trecord(\n\t\t\t\tObject.freeze({ ...actionOf(entry, \"failed\", aligning ? \"align_failed\" : \"install_failed\"), errorCode }),\n\t\t\t);\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"install_failed\",\n\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\tmessage: aligning\n\t\t\t\t\t? `Bootstrap could not align ${entry.pluginId} (active ${activeVersion}) to the factory range ` +\n\t\t\t\t\t\t`${entry.range ?? \"latest\"} from npm (${errorCode}: ${errorMessage(error)}). ` +\n\t\t\t\t\t\t`Startup continues; the factory range stays unsatisfied, so the next startup retries automatically. ` +\n\t\t\t\t\t\t`Run \\`${pluginBootstrapInstallCommandV1(entry)}\\` to align it now.`\n\t\t\t\t\t: `Bootstrap could not install ${entry.pluginId} from npm (${errorCode}: ${errorMessage(error)}). ` +\n\t\t\t\t\t\t`Startup continues without it; its capabilities stay unavailable until installed, ` +\n\t\t\t\t\t\t`and the next startup retries automatically. ` +\n\t\t\t\t\t\t`Run \\`${pluginBootstrapInstallCommandV1(entry)}\\` to install it manually.`,\n\t\t\t});\n\t\t}\n\t}\n\tconst status: PluginBootstrapStatusV1 = actions.some((action) => action.status === \"failed\")\n\t\t? \"failed\"\n\t\t: \"succeeded\";\n\treturn finish(status, actions, diagnostics);\n}\n"]}
@@ -2,17 +2,22 @@
2
2
  * Startup plugin bootstrap orchestrator (design
3
3
  * `插件独立分发与启动装配设计.md` §4.4, §0.7). Pure injectable decision loop
4
4
  * over the frozen factory manifest: every entry is compared against the
5
- * locally resolved active installations and only missing plugins are handed
6
- * to the npm install dependency — bootstrap never acquires through any other
5
+ * locally resolved active installations; missing plugins and factory entries
6
+ * whose active version no longer satisfies the factory range are handed to
7
+ * the npm install dependency — bootstrap never acquires through any other
7
8
  * source.
8
9
  *
9
- * Coverage rules (G5): an existing active installation is never replaced. A
10
- * satisfied range is skipped silently (zero acquisition calls, G3); an
11
- * unsatisfied one produces a diagnostic with a manual install command and no
12
- * automatic replacement. Failure semantics (G4): one plugin's install
13
- * failure is recorded and the loop continues; the run itself never throws.
14
- * All effects live behind the injected dependencies, so the loop is fully
15
- * deterministic under mocks.
10
+ * Coverage rules (G5, with the 2026-10-04 install-and-use exception): a
11
+ * satisfied range is skipped silently (zero acquisition calls, G3); a factory
12
+ * entry whose range is unsatisfied is automatically realigned by installing
13
+ * the factory range — factory plugins are version-locked to the running
14
+ * framework, so an unsatisfied range is a broken compatibility state, not a
15
+ * user preference to protect. User-installed third-party plugins are not in
16
+ * the factory manifest and stay untouched. Failure semantics (G4): one
17
+ * plugin's install failure is recorded and the loop continues; the run itself
18
+ * never throws, and a failed entry self-heals on the next startup because it
19
+ * stays unsatisfied. All effects live behind the injected dependencies, so
20
+ * the loop is fully deterministic under mocks.
16
21
  */
17
22
  import { selectNpmPackageVersionV1 } from "./node-npm-registry-source.js";
18
23
  import { PluginAcquisitionErrorV1 } from "./plugin-acquisition.js";
@@ -25,7 +30,7 @@ export const PLUGIN_BOOTSTRAP_VERSION_V1 = 1;
25
30
  function satisfiesRangeV1(version, range) {
26
31
  return selectNpmPackageVersionV1([version], range) === version;
27
32
  }
28
- /** Executable repair command for diagnostics (G4/G5 remediation hint). */
33
+ /** Executable repair command for diagnostics (G4 remediation hint). */
29
34
  export function pluginBootstrapInstallCommandV1(entry) {
30
35
  return `agent-forge plugin install ${entry.npmName}@${entry.range ?? "latest"}`;
31
36
  }
@@ -76,6 +81,10 @@ export async function runPluginBootstrapV1(input) {
76
81
  }
77
82
  const actions = [];
78
83
  const diagnostics = [];
84
+ const record = (action) => {
85
+ actions.push(action);
86
+ input.onAction?.(action);
87
+ };
79
88
  if (input.onPendingInstalls !== undefined) {
80
89
  const pending = input.manifest.filter((entry) => !active.has(entry.pluginId)).length;
81
90
  if (pending > 0)
@@ -90,20 +99,8 @@ export async function runPluginBootstrapV1(input) {
90
99
  break;
91
100
  }
92
101
  const activeVersion = active.get(entry.pluginId);
93
- if (activeVersion !== undefined) {
94
- if (satisfiesRangeV1(activeVersion, entry.range)) {
95
- actions.push(Object.freeze({ ...actionOf(entry, "skipped", "satisfies_range"), activeVersion }));
96
- continue;
97
- }
98
- actions.push(Object.freeze({ ...actionOf(entry, "diagnosed", "range_not_satisfied"), activeVersion }));
99
- diagnostics.push({
100
- code: "range_not_satisfied",
101
- pluginId: entry.pluginId,
102
- message: `Active version ${activeVersion} of ${entry.pluginId} does not satisfy the factory range ` +
103
- `${entry.range ?? "latest"}; bootstrap never replaces active installations. ` +
104
- `Run \`${pluginBootstrapInstallCommandV1(entry)}\` to install a matching version, ` +
105
- `or \`agent-forge plugin update --all\` to upgrade every outdated plugin at once.`,
106
- });
102
+ if (activeVersion !== undefined && satisfiesRangeV1(activeVersion, entry.range)) {
103
+ record(Object.freeze({ ...actionOf(entry, "skipped", "satisfies_range"), activeVersion }));
107
104
  continue;
108
105
  }
109
106
  try {
@@ -112,29 +109,34 @@ export async function runPluginBootstrapV1(input) {
112
109
  ...(entry.range === undefined ? {} : { range: entry.range }),
113
110
  ...(signal === undefined ? {} : { signal }),
114
111
  });
115
- actions.push(Object.freeze({
116
- ...actionOf(entry, "installed", "installed"),
112
+ record(Object.freeze({
113
+ ...actionOf(entry, "installed", activeVersion === undefined ? "installed" : "range_aligned"),
117
114
  installedVersion: installed.pluginVersion,
118
115
  source: installed.source,
119
116
  }));
120
117
  }
121
118
  catch (error) {
122
119
  const errorCode = acquireErrorCode(error);
123
- actions.push(Object.freeze({ ...actionOf(entry, "failed", "install_failed"), errorCode }));
120
+ const aligning = activeVersion !== undefined;
121
+ record(Object.freeze({ ...actionOf(entry, "failed", aligning ? "align_failed" : "install_failed"), errorCode }));
124
122
  diagnostics.push({
125
123
  code: "install_failed",
126
124
  pluginId: entry.pluginId,
127
- message: `Bootstrap could not install ${entry.pluginId} from npm (${errorCode}: ${errorMessage(error)}). ` +
128
- `Startup continues without it; its capabilities stay unavailable until installed. ` +
129
- `Run \`${pluginBootstrapInstallCommandV1(entry)}\` to install it manually.`,
125
+ message: aligning
126
+ ? `Bootstrap could not align ${entry.pluginId} (active ${activeVersion}) to the factory range ` +
127
+ `${entry.range ?? "latest"} from npm (${errorCode}: ${errorMessage(error)}). ` +
128
+ `Startup continues; the factory range stays unsatisfied, so the next startup retries automatically. ` +
129
+ `Run \`${pluginBootstrapInstallCommandV1(entry)}\` to align it now.`
130
+ : `Bootstrap could not install ${entry.pluginId} from npm (${errorCode}: ${errorMessage(error)}). ` +
131
+ `Startup continues without it; its capabilities stay unavailable until installed, ` +
132
+ `and the next startup retries automatically. ` +
133
+ `Run \`${pluginBootstrapInstallCommandV1(entry)}\` to install it manually.`,
130
134
  });
131
135
  }
132
136
  }
133
137
  const status = actions.some((action) => action.status === "failed")
134
138
  ? "failed"
135
- : actions.some((action) => action.status === "diagnosed")
136
- ? "degraded"
137
- : "succeeded";
139
+ : "succeeded";
138
140
  return finish(status, actions, diagnostics);
139
141
  }
140
142
  //# sourceMappingURL=plugin-bootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-bootstrap.js","sourceRoot":"","sources":["../../../src/plugins/ecosystem/plugin-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAU,CAAC;AAqEtD;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,OAAe,EAAE,KAAyB,EAAW;IAC9E,OAAO,yBAAyB,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,KAAK,OAAO,CAAC;AAAA,CAC/D;AAED,0EAA0E;AAC1E,MAAM,UAAU,+BAA+B,CAAC,KAA4D,EAAU;IACrH,OAAO,8BAA8B,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,KAAK,IAAI,QAAQ,EAAE,CAAC;AAAA,CAChF;AAED,SAAS,YAAY,CAAC,KAAc,EAAU;IAC7C,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAAA,CAC9D;AAED,SAAS,gBAAgB,CAAC,KAAc,E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SAAS,CAAC,aAAa;gBACzC,MAAM,EAAE,SAAS,CAAC,MAAM;aACxB,CAAC,CACF,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAC1C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YAC3F,WAAW,CAAC,IAAI,CAAC;gBAChB,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,OAAO,EACN,+BAA+B,KAAK,CAAC,QAAQ,cAAc,SAAS,KAAK,YAAY,CAAC,KAAK,CAAC,KAAK;oBACjG,mFAAmF;oBACnF,SAAS,+BAA+B,CAAC,KAAK,CAAC,4BAA4B;aAC5E,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IACD,MAAM,MAAM,GAA4B,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC;QAC3F,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;YACxD,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,WAAW,CAAC;IAChB,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AAAA,CAC5C","sourcesContent":["/**\n * Startup plugin bootstrap orchestrator (design\n * `插件独立分发与启动装配设计.md` §4.4, §0.7). Pure injectable decision loop\n * over the frozen factory manifest: every entry is compared against the\n * locally resolved active installations and only missing plugins are handed\n * to the npm install dependency — bootstrap never acquires through any other\n * source.\n *\n * Coverage rules (G5): an existing active installation is never replaced. A\n * satisfied range is skipped silently (zero acquisition calls, G3); an\n * unsatisfied one produces a diagnostic with a manual install command and no\n * automatic replacement. Failure semantics (G4): one plugin's install\n * failure is recorded and the loop continues; the run itself never throws.\n * All effects live behind the injected dependencies, so the loop is fully\n * deterministic under mocks.\n */\n\nimport type { PluginBootstrapFactoryEntryV1 } from \"./bootstrap-factory-manifest.ts\";\nimport { selectNpmPackageVersionV1 } from \"./node-npm-registry-source.ts\";\nimport { PluginAcquisitionErrorV1 } from \"./plugin-acquisition.ts\";\n\nexport const PLUGIN_BOOTSTRAP_VERSION_V1 = 1 as const;\n\n/** Read-only local lookup of active installation versions (never networked). */\nexport type PluginBootstrapListActiveV1 = (input: {\n\treadonly signal?: AbortSignal;\n}) => Promise<ReadonlyMap<string, string>>;\n\n/** npm-only install action; resolves with the installed version and source label. */\nexport type PluginBootstrapInstallFromNpmV1 = (input: {\n\treadonly npmName: string;\n\treadonly range?: string;\n\treadonly signal?: AbortSignal;\n}) => Promise<{ readonly pluginVersion: string; readonly source: string }>;\n\nexport interface PluginBootstrapDepsV1 {\n\treadonly listActive: PluginBootstrapListActiveV1;\n\treadonly installFromNpm: PluginBootstrapInstallFromNpmV1;\n\t/** Deterministic clock for the observed duration; defaults to Date.now. */\n\treadonly now?: () => number;\n\t/** Cooperative cancellation; checked before each manifest entry. */\n\treadonly signal?: AbortSignal;\n}\n\nexport type PluginBootstrapActionStatusV1 = \"skipped\" | \"diagnosed\" | \"installed\" | \"failed\";\n\nexport type PluginBootstrapActionReasonV1 = \"satisfies_range\" | \"range_not_satisfied\" | \"installed\" | \"install_failed\";\n\n/** One per-entry outcome; the version fields carry what each status observed. */\nexport interface PluginBootstrapActionV1 {\n\treadonly pluginId: string;\n\treadonly status: PluginBootstrapActionStatusV1;\n\treadonly reason: PluginBootstrapActionReasonV1;\n\treadonly npmName: string;\n\treadonly range?: string;\n\t/** Active version that decided a skipped/diagnosed outcome. */\n\treadonly activeVersion?: string;\n\t/** Version reported by the install action. */\n\treadonly installedVersion?: string;\n\t/** npm source label reported by the install action. */\n\treadonly source?: string;\n\t/** Acquisition or install failure code for failed actions. */\n\treadonly errorCode?: string;\n}\n\nexport type PluginBootstrapDiagnosticCodeV1 =\n\t| \"range_not_satisfied\"\n\t| \"install_failed\"\n\t| \"list_active_failed\"\n\t| \"cancelled\"\n\t| \"bootstrap_failed\"\n\t| \"bootstrap_skipped_offline\";\n\nexport interface PluginBootstrapDiagnosticV1 {\n\treadonly code: PluginBootstrapDiagnosticCodeV1;\n\treadonly message: string;\n\treadonly pluginId?: string;\n}\n\nexport type PluginBootstrapStatusV1 = \"succeeded\" | \"degraded\" | \"failed\";\n\nexport interface PluginBootstrapResultV1 {\n\treadonly version: typeof PLUGIN_BOOTSTRAP_VERSION_V1;\n\t/** Aggregated outcome: failed > degraded (diagnosed entries) > succeeded. */\n\treadonly status: PluginBootstrapStatusV1;\n\treadonly actions: readonly PluginBootstrapActionV1[];\n\treadonly diagnostics: readonly PluginBootstrapDiagnosticV1[];\n\treadonly durationMs: number;\n}\n\n/**\n * A version satisfies a factory range under the same selection semantics npm\n * resolution uses: it is the version that would be picked if it were the only\n * candidate. Keeps local comparison and registry resolution consistent.\n */\nfunction satisfiesRangeV1(version: string, range: string | undefined): boolean {\n\treturn selectNpmPackageVersionV1([version], range) === version;\n}\n\n/** Executable repair command for diagnostics (G4/G5 remediation hint). */\nexport function pluginBootstrapInstallCommandV1(entry: { readonly npmName: string; readonly range?: string }): string {\n\treturn `agent-forge plugin install ${entry.npmName}@${entry.range ?? \"latest\"}`;\n}\n\nfunction errorMessage(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n\nfunction acquireErrorCode(error: unknown): string {\n\treturn error instanceof PluginAcquisitionErrorV1 ? error.code : \"install_failed\";\n}\n\nfunction actionOf(\n\tentry: PluginBootstrapFactoryEntryV1,\n\tstatus: PluginBootstrapActionStatusV1,\n\treason: PluginBootstrapActionReasonV1,\n): PluginBootstrapActionV1 {\n\treturn Object.freeze({\n\t\tpluginId: entry.pluginId,\n\t\tstatus,\n\t\treason,\n\t\tnpmName: entry.npmName,\n\t\t...(entry.range === undefined ? {} : { range: entry.range }),\n\t});\n}\n\n/**\n * Run the bootstrap decision loop. An empty manifest short-circuits before\n * any dependency is touched, so the factory-empty S1-c2 state performs zero\n * reads on real startups.\n */\nexport async function runPluginBootstrapV1(input: {\n\treadonly manifest: readonly PluginBootstrapFactoryEntryV1[];\n\treadonly deps: PluginBootstrapDepsV1;\n\t/**\n\t * Fired once after the local active-state read when at least one factory\n\t * entry has no active installation — the host's first-run progress line\n\t * hook (设计 §4.4 首装进度行, 2026-10-03): a fresh install is otherwise\n\t * silent for the whole network install window. Injected effect, the loop\n\t * itself stays free of console I/O.\n\t */\n\treadonly onPendingInstalls?: (count: number) => void;\n}): Promise<PluginBootstrapResultV1> {\n\tconst now = input.deps.now ?? Date.now;\n\tconst startedAt = now();\n\tconst finish = (\n\t\tstatus: PluginBootstrapStatusV1,\n\t\tactions: readonly PluginBootstrapActionV1[],\n\t\tdiagnostics: readonly PluginBootstrapDiagnosticV1[],\n\t): PluginBootstrapResultV1 =>\n\t\tObject.freeze({\n\t\t\tversion: PLUGIN_BOOTSTRAP_VERSION_V1,\n\t\t\tstatus,\n\t\t\tactions: Object.freeze([...actions]),\n\t\t\tdiagnostics: Object.freeze([...diagnostics]),\n\t\t\tdurationMs: Math.max(0, now() - startedAt),\n\t\t});\n\tif (input.manifest.length === 0) return finish(\"succeeded\", [], []);\n\tconst signal = input.deps.signal;\n\tlet active: ReadonlyMap<string, string>;\n\ttry {\n\t\tactive = await input.deps.listActive({ ...(signal === undefined ? {} : { signal }) });\n\t} catch (error) {\n\t\treturn finish(\n\t\t\t\"failed\",\n\t\t\t[],\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tcode: \"list_active_failed\",\n\t\t\t\t\tmessage: `Active plugin state could not be read; bootstrap installed nothing: ${errorMessage(error)}`,\n\t\t\t\t},\n\t\t\t],\n\t\t);\n\t}\n\tconst actions: PluginBootstrapActionV1[] = [];\n\tconst diagnostics: PluginBootstrapDiagnosticV1[] = [];\n\tif (input.onPendingInstalls !== undefined) {\n\t\tconst pending = input.manifest.filter((entry) => !active.has(entry.pluginId)).length;\n\t\tif (pending > 0) input.onPendingInstalls(pending);\n\t}\n\tfor (const entry of input.manifest) {\n\t\tif (signal?.aborted === true) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"cancelled\",\n\t\t\t\tmessage: \"Plugin bootstrap was cancelled before all factory entries were processed\",\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tconst activeVersion = active.get(entry.pluginId);\n\t\tif (activeVersion !== undefined) {\n\t\t\tif (satisfiesRangeV1(activeVersion, entry.range)) {\n\t\t\t\tactions.push(Object.freeze({ ...actionOf(entry, \"skipped\", \"satisfies_range\"), activeVersion }));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tactions.push(Object.freeze({ ...actionOf(entry, \"diagnosed\", \"range_not_satisfied\"), activeVersion }));\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"range_not_satisfied\",\n\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\tmessage:\n\t\t\t\t\t`Active version ${activeVersion} of ${entry.pluginId} does not satisfy the factory range ` +\n\t\t\t\t\t`${entry.range ?? \"latest\"}; bootstrap never replaces active installations. ` +\n\t\t\t\t\t`Run \\`${pluginBootstrapInstallCommandV1(entry)}\\` to install a matching version, ` +\n\t\t\t\t\t`or \\`agent-forge plugin update --all\\` to upgrade every outdated plugin at once.`,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst installed = await input.deps.installFromNpm({\n\t\t\t\tnpmName: entry.npmName,\n\t\t\t\t...(entry.range === undefined ? {} : { range: entry.range }),\n\t\t\t\t...(signal === undefined ? {} : { signal }),\n\t\t\t});\n\t\t\tactions.push(\n\t\t\t\tObject.freeze({\n\t\t\t\t\t...actionOf(entry, \"installed\", \"installed\"),\n\t\t\t\t\tinstalledVersion: installed.pluginVersion,\n\t\t\t\t\tsource: installed.source,\n\t\t\t\t}),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconst errorCode = acquireErrorCode(error);\n\t\t\tactions.push(Object.freeze({ ...actionOf(entry, \"failed\", \"install_failed\"), errorCode }));\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"install_failed\",\n\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\tmessage:\n\t\t\t\t\t`Bootstrap could not install ${entry.pluginId} from npm (${errorCode}: ${errorMessage(error)}). ` +\n\t\t\t\t\t`Startup continues without it; its capabilities stay unavailable until installed. ` +\n\t\t\t\t\t`Run \\`${pluginBootstrapInstallCommandV1(entry)}\\` to install it manually.`,\n\t\t\t});\n\t\t}\n\t}\n\tconst status: PluginBootstrapStatusV1 = actions.some((action) => action.status === \"failed\")\n\t\t? \"failed\"\n\t\t: actions.some((action) => action.status === \"diagnosed\")\n\t\t\t? \"degraded\"\n\t\t\t: \"succeeded\";\n\treturn finish(status, actions, diagnostics);\n}\n"]}
1
+ {"version":3,"file":"plugin-bootstrap.js","sourceRoot":"","sources":["../../../src/plugins/ecosystem/plugin-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAU,CAAC;AAyEtD;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,OAAe,EAAE,KAAyB,EAAW;IAC9E,OAAO,yBAAyB,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,KAAK,OAAO,CAAC;AAAA,CAC/D;AAED,uEAAuE;AACvE,MAAM,UAAU,+BAA+B,CAAC,KAA4D,EAAU;IACrH,OAAO,8BAA8B,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,KAAK,IAAI,QAAQ,EAAE,C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, §0.7). Pure injectable decision loop\n * over the frozen factory manifest: every entry is compared against the\n * locally resolved active installations; missing plugins and factory entries\n * whose active version no longer satisfies the factory range are handed to\n * the npm install dependency — bootstrap never acquires through any other\n * source.\n *\n * Coverage rules (G5, with the 2026-10-04 install-and-use exception): a\n * satisfied range is skipped silently (zero acquisition calls, G3); a factory\n * entry whose range is unsatisfied is automatically realigned by installing\n * the factory range — factory plugins are version-locked to the running\n * framework, so an unsatisfied range is a broken compatibility state, not a\n * user preference to protect. User-installed third-party plugins are not in\n * the factory manifest and stay untouched. Failure semantics (G4): one\n * plugin's install failure is recorded and the loop continues; the run itself\n * never throws, and a failed entry self-heals on the next startup because it\n * stays unsatisfied. All effects live behind the injected dependencies, so\n * the loop is fully deterministic under mocks.\n */\n\nimport type { PluginBootstrapFactoryEntryV1 } from \"./bootstrap-factory-manifest.ts\";\nimport { selectNpmPackageVersionV1 } from \"./node-npm-registry-source.ts\";\nimport { PluginAcquisitionErrorV1 } from \"./plugin-acquisition.ts\";\n\nexport const PLUGIN_BOOTSTRAP_VERSION_V1 = 1 as const;\n\n/** Read-only local lookup of active installation versions (never networked). */\nexport type PluginBootstrapListActiveV1 = (input: {\n\treadonly signal?: AbortSignal;\n}) => Promise<ReadonlyMap<string, string>>;\n\n/** npm-only install action; resolves with the installed version and source label. */\nexport type PluginBootstrapInstallFromNpmV1 = (input: {\n\treadonly npmName: string;\n\treadonly range?: string;\n\treadonly signal?: AbortSignal;\n}) => Promise<{ readonly pluginVersion: string; readonly source: string }>;\n\nexport interface PluginBootstrapDepsV1 {\n\treadonly listActive: PluginBootstrapListActiveV1;\n\treadonly installFromNpm: PluginBootstrapInstallFromNpmV1;\n\t/** Deterministic clock for the observed duration; defaults to Date.now. */\n\treadonly now?: () => number;\n\t/** Cooperative cancellation; checked before each manifest entry. */\n\treadonly signal?: AbortSignal;\n}\n\nexport type PluginBootstrapActionStatusV1 = \"skipped\" | \"installed\" | \"failed\";\n\nexport type PluginBootstrapActionReasonV1 =\n\t| \"satisfies_range\"\n\t| \"installed\"\n\t| \"range_aligned\"\n\t| \"install_failed\"\n\t| \"align_failed\";\n\n/** One per-entry outcome; the version fields carry what each status observed. */\nexport interface PluginBootstrapActionV1 {\n\treadonly pluginId: string;\n\treadonly status: PluginBootstrapActionStatusV1;\n\treadonly reason: PluginBootstrapActionReasonV1;\n\treadonly npmName: string;\n\treadonly range?: string;\n\t/** Active version that decided a skipped outcome. */\n\treadonly activeVersion?: string;\n\t/** Version reported by the install action. */\n\treadonly installedVersion?: string;\n\t/** npm source label reported by the install action. */\n\treadonly source?: string;\n\t/** Acquisition or install failure code for failed actions. */\n\treadonly errorCode?: string;\n}\n\nexport type PluginBootstrapDiagnosticCodeV1 =\n\t| \"install_failed\"\n\t| \"list_active_failed\"\n\t| \"cancelled\"\n\t| \"bootstrap_failed\"\n\t| \"bootstrap_skipped_offline\";\n\nexport interface PluginBootstrapDiagnosticV1 {\n\treadonly code: PluginBootstrapDiagnosticCodeV1;\n\treadonly message: string;\n\treadonly pluginId?: string;\n}\n\nexport type PluginBootstrapStatusV1 = \"succeeded\" | \"failed\";\n\nexport interface PluginBootstrapResultV1 {\n\treadonly version: typeof PLUGIN_BOOTSTRAP_VERSION_V1;\n\t/** Aggregated outcome: failed (any failed entry) > succeeded. */\n\treadonly status: PluginBootstrapStatusV1;\n\treadonly actions: readonly PluginBootstrapActionV1[];\n\treadonly diagnostics: readonly PluginBootstrapDiagnosticV1[];\n\treadonly durationMs: number;\n}\n\n/**\n * A version satisfies a factory range under the same selection semantics npm\n * resolution uses: it is the version that would be picked if it were the only\n * candidate. Keeps local comparison and registry resolution consistent.\n */\nfunction satisfiesRangeV1(version: string, range: string | undefined): boolean {\n\treturn selectNpmPackageVersionV1([version], range) === version;\n}\n\n/** Executable repair command for diagnostics (G4 remediation hint). */\nexport function pluginBootstrapInstallCommandV1(entry: { readonly npmName: string; readonly range?: string }): string {\n\treturn `agent-forge plugin install ${entry.npmName}@${entry.range ?? \"latest\"}`;\n}\n\nfunction errorMessage(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n\nfunction acquireErrorCode(error: unknown): string {\n\treturn error instanceof PluginAcquisitionErrorV1 ? error.code : \"install_failed\";\n}\n\nfunction actionOf(\n\tentry: PluginBootstrapFactoryEntryV1,\n\tstatus: PluginBootstrapActionStatusV1,\n\treason: PluginBootstrapActionReasonV1,\n): PluginBootstrapActionV1 {\n\treturn Object.freeze({\n\t\tpluginId: entry.pluginId,\n\t\tstatus,\n\t\treason,\n\t\tnpmName: entry.npmName,\n\t\t...(entry.range === undefined ? {} : { range: entry.range }),\n\t});\n}\n\n/**\n * Run the bootstrap decision loop. An empty manifest short-circuits before\n * any dependency is touched, so the factory-empty S1-c2 state performs zero\n * reads on real startups.\n */\nexport async function runPluginBootstrapV1(input: {\n\treadonly manifest: readonly PluginBootstrapFactoryEntryV1[];\n\treadonly deps: PluginBootstrapDepsV1;\n\t/**\n\t * Fired once after the local active-state read when at least one factory\n\t * entry has no active installation — the host's first-run progress line\n\t * hook (设计 §4.4 首装进度行, 2026-10-03): a fresh install is otherwise\n\t * silent for the whole network install window. Injected effect, the loop\n\t * itself stays free of console I/O.\n\t */\n\treadonly onPendingInstalls?: (count: number) => void;\n\t/**\n\t * Fired after every per-entry action (设计 §4.4 逐插件进度, 2026-10-04):\n\t * the host renders one line per install/align/failure so the waiting user\n\t * sees live state; skipped entries stay silent at the host's discretion.\n\t * Injected effect, the loop itself stays free of console I/O.\n\t */\n\treadonly onAction?: (action: PluginBootstrapActionV1) => void;\n}): Promise<PluginBootstrapResultV1> {\n\tconst now = input.deps.now ?? Date.now;\n\tconst startedAt = now();\n\tconst finish = (\n\t\tstatus: PluginBootstrapStatusV1,\n\t\tactions: readonly PluginBootstrapActionV1[],\n\t\tdiagnostics: readonly PluginBootstrapDiagnosticV1[],\n\t): PluginBootstrapResultV1 =>\n\t\tObject.freeze({\n\t\t\tversion: PLUGIN_BOOTSTRAP_VERSION_V1,\n\t\t\tstatus,\n\t\t\tactions: Object.freeze([...actions]),\n\t\t\tdiagnostics: Object.freeze([...diagnostics]),\n\t\t\tdurationMs: Math.max(0, now() - startedAt),\n\t\t});\n\tif (input.manifest.length === 0) return finish(\"succeeded\", [], []);\n\tconst signal = input.deps.signal;\n\tlet active: ReadonlyMap<string, string>;\n\ttry {\n\t\tactive = await input.deps.listActive({ ...(signal === undefined ? {} : { signal }) });\n\t} catch (error) {\n\t\treturn finish(\n\t\t\t\"failed\",\n\t\t\t[],\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tcode: \"list_active_failed\",\n\t\t\t\t\tmessage: `Active plugin state could not be read; bootstrap installed nothing: ${errorMessage(error)}`,\n\t\t\t\t},\n\t\t\t],\n\t\t);\n\t}\n\tconst actions: PluginBootstrapActionV1[] = [];\n\tconst diagnostics: PluginBootstrapDiagnosticV1[] = [];\n\tconst record = (action: PluginBootstrapActionV1): void => {\n\t\tactions.push(action);\n\t\tinput.onAction?.(action);\n\t};\n\tif (input.onPendingInstalls !== undefined) {\n\t\tconst pending = input.manifest.filter((entry) => !active.has(entry.pluginId)).length;\n\t\tif (pending > 0) input.onPendingInstalls(pending);\n\t}\n\tfor (const entry of input.manifest) {\n\t\tif (signal?.aborted === true) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"cancelled\",\n\t\t\t\tmessage: \"Plugin bootstrap was cancelled before all factory entries were processed\",\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tconst activeVersion = active.get(entry.pluginId);\n\t\tif (activeVersion !== undefined && satisfiesRangeV1(activeVersion, entry.range)) {\n\t\t\trecord(Object.freeze({ ...actionOf(entry, \"skipped\", \"satisfies_range\"), activeVersion }));\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst installed = await input.deps.installFromNpm({\n\t\t\t\tnpmName: entry.npmName,\n\t\t\t\t...(entry.range === undefined ? {} : { range: entry.range }),\n\t\t\t\t...(signal === undefined ? {} : { signal }),\n\t\t\t});\n\t\t\trecord(\n\t\t\t\tObject.freeze({\n\t\t\t\t\t...actionOf(entry, \"installed\", activeVersion === undefined ? \"installed\" : \"range_aligned\"),\n\t\t\t\t\tinstalledVersion: installed.pluginVersion,\n\t\t\t\t\tsource: installed.source,\n\t\t\t\t}),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconst errorCode = acquireErrorCode(error);\n\t\t\tconst aligning = activeVersion !== undefined;\n\t\t\trecord(\n\t\t\t\tObject.freeze({ ...actionOf(entry, \"failed\", aligning ? \"align_failed\" : \"install_failed\"), errorCode }),\n\t\t\t);\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"install_failed\",\n\t\t\t\tpluginId: entry.pluginId,\n\t\t\t\tmessage: aligning\n\t\t\t\t\t? `Bootstrap could not align ${entry.pluginId} (active ${activeVersion}) to the factory range ` +\n\t\t\t\t\t\t`${entry.range ?? \"latest\"} from npm (${errorCode}: ${errorMessage(error)}). ` +\n\t\t\t\t\t\t`Startup continues; the factory range stays unsatisfied, so the next startup retries automatically. ` +\n\t\t\t\t\t\t`Run \\`${pluginBootstrapInstallCommandV1(entry)}\\` to align it now.`\n\t\t\t\t\t: `Bootstrap could not install ${entry.pluginId} from npm (${errorCode}: ${errorMessage(error)}). ` +\n\t\t\t\t\t\t`Startup continues without it; its capabilities stay unavailable until installed, ` +\n\t\t\t\t\t\t`and the next startup retries automatically. ` +\n\t\t\t\t\t\t`Run \\`${pluginBootstrapInstallCommandV1(entry)}\\` to install it manually.`,\n\t\t\t});\n\t\t}\n\t}\n\tconst status: PluginBootstrapStatusV1 = actions.some((action) => action.status === \"failed\")\n\t\t? \"failed\"\n\t\t: \"succeeded\";\n\treturn finish(status, actions, diagnostics);\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { HostFactsV1, PluginManifestV1, ProfileResolutionV1 } from "../plugins/ecosystem/types.ts";
2
2
  import { type ProfileAssemblyResultV1, type VerifiedToolPluginV1 } from "./profile-assembly.ts";
3
- export type BuiltinPluginProfileIdV1 = "coding-core" | "desktop-qa" | "desktop-observe" | "desktop-control" | "lsp-diagnostics" | "image-generation" | "process-exec" | "test-runner" | "workspace-files" | "workspace-files-write" | "formatter-linter" | "git-repository";
3
+ export type BuiltinPluginProfileIdV1 = "coding-core" | "desktop-qa" | "desktop-observe" | "desktop-control" | "desktop-observe-macos" | "desktop-control-macos" | "desktop-qa-macos" | "lsp-diagnostics" | "image-generation" | "process-exec" | "test-runner" | "workspace-files" | "workspace-files-write" | "formatter-linter" | "git-repository";
4
4
  export interface BuiltinPluginProfileV1 {
5
5
  readonly id: BuiltinPluginProfileIdV1;
6
6
  readonly version: string;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-profiles.d.ts","sourceRoot":"","sources":["../../src/profile/plugin-profiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,WAAW,EACX,gBAAgB,EAEhB,mBAAmB,EACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAmB,KAAK,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAEjH,MAAM,MAAM,wBAAwB,GACjC,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,cAAc,GACd,aAAa,GACb,iBAAiB,GACjB,uBAAuB,GACvB,kBAAkB,GAClB,gBAAgB,CAAC;AAEpB,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,EAAE,EAAE,wBAAwB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,gCAAgC,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAE1F,MAAM,MAAM,gCAAgC,GACzC;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,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QAAQ,CAAC,iBAAiB,CAAC,EAAE,gCAAgC,CAAC;CAC9D,GAAG,gCAAgC,CA2FnC","sourcesContent":["import { VERSION } from \"../config.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { comparePluginVersionsV1 } from \"../plugins/ecosystem/catalog.ts\";\nimport { resolvePluginProfileV1 } from \"../plugins/ecosystem/resolver.ts\";\nimport type {\n\tHostFactsV1,\n\tPluginManifestV1,\n\tPluginResolutionV1,\n\tProfileResolutionV1,\n} from \"../plugins/ecosystem/types.ts\";\nimport { assembleProfile, type ProfileAssemblyResultV1, type VerifiedToolPluginV1 } from \"./profile-assembly.ts\";\n\nexport type BuiltinPluginProfileIdV1 =\n\t| \"coding-core\"\n\t| \"desktop-qa\"\n\t| \"desktop-observe\"\n\t| \"desktop-control\"\n\t| \"lsp-diagnostics\"\n\t| \"image-generation\"\n\t| \"process-exec\"\n\t| \"test-runner\"\n\t| \"workspace-files\"\n\t| \"workspace-files-write\"\n\t| \"formatter-linter\"\n\t| \"git-repository\";\n\nexport interface BuiltinPluginProfileV1 {\n\treadonly id: BuiltinPluginProfileIdV1;\n\treadonly version: string;\n\treadonly pluginIds: readonly string[];\n}\n\n/**\n * Host-owned manifest replacements for installed, verified package versions.\n *\n * Builtin manifests remain the default. A host may explicitly provide one\n * replacement per builtin plugin ID when a staged/verified/active install is\n * selected for a new Profile. The resolver never discovers files or chooses a\n * version implicitly; the replacement is part of the resulting Profile\n * identity and must still pass normal compatibility and verification checks.\n */\nexport type BuiltinPluginManifestOverridesV1 = Readonly<Record<string, PluginManifestV1>>;\n\nexport type BuiltinPluginProfileResolutionV1 =\n\t| { readonly status: \"not_found\"; readonly profileId: string }\n\t| { readonly status: \"host_facts_required\"; readonly profileId: string }\n\t| {\n\t\t\treadonly status: \"invalid_selection\";\n\t\t\treadonly profileId: string;\n\t\t\treadonly unknownPluginIds: readonly string[];\n\t\t\treadonly duplicatePluginIds: readonly string[];\n\t }\n\t| {\n\t\t\treadonly status: \"resolved\";\n\t\t\treadonly profile: BuiltinPluginProfileV1;\n\t\t\treadonly resolution: ProfileResolutionV1;\n\t\t\treadonly assembly?: ProfileAssemblyResultV1;\n\t };\n\n// D-075 S3: every first-party category-A plugin now ships as an independent\n// package under `plugins/` with the `agent-forge.plugin.<name>` id domain\n// (design §4.1). No embedded manifests remain; profiles resolve through the\n// install store (host-provided `manifestOverrides` from active bindings).\nconst manifests: Readonly<Record<string, PluginManifestV1>> = Object.freeze({});\n\nconst profiles: readonly BuiltinPluginProfileV1[] = Object.freeze([\n\t{ id: \"coding-core\", version: \"1\", pluginIds: [] },\n\t{\n\t\tid: \"desktop-qa\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-windows-observe\", \"agent-forge.plugin.desktop-windows-input\"],\n\t},\n\t{ id: \"desktop-observe\", version: \"1\", pluginIds: [\"agent-forge.plugin.desktop-windows-observe\"] },\n\t{\n\t\tid: \"desktop-control\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-windows-observe\", \"agent-forge.plugin.desktop-windows-input\"],\n\t},\n\t{ id: \"lsp-diagnostics\", version: \"1\", pluginIds: [\"agent-forge.plugin.lsp-diagnostics\"] },\n\t{ id: \"image-generation\", version: \"1\", pluginIds: [\"agent-forge.plugin.image-generation\"] },\n\t{ id: \"process-exec\", version: \"1\", pluginIds: [\"agent-forge.plugin.process-exec\"] },\n\t{ id: \"test-runner\", version: \"1\", pluginIds: [\"agent-forge.plugin.test-runner\"] },\n\t{ id: \"workspace-files\", version: \"1\", pluginIds: [\"agent-forge.plugin.workspace-files\"] },\n\t{ id: \"workspace-files-write\", version: \"1\", pluginIds: [\"agent-forge.plugin.workspace-files-write\"] },\n\t{\n\t\t// D-075 S2: the plugin code ships as the independent package\n\t\t// `agent-forge.plugin.formatter-linter` (design §4.1 id domain); this\n\t\t// Profile stays the stable user entry (`--plugin-profile formatter-linter`)\n\t\t// and resolves through the install store, not an embedded manifest.\n\t\tid: \"formatter-linter\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.formatter-linter\"],\n\t},\n\t{ id: \"git-repository\", version: \"1\", pluginIds: [\"agent-forge.plugin.git-repository\"] },\n]);\n\nexport function listBuiltinPluginProfilesV1(): readonly BuiltinPluginProfileV1[] {\n\treturn profiles;\n}\n\n/** True when the id names a builtin plugin profile (the CLI selection vocabulary). */\nexport function isBuiltinPluginProfileIdV1(value: string): value is BuiltinPluginProfileIdV1 {\n\treturn profiles.some((profile) => profile.id === value);\n}\n\n/** Return the first-party manifest projection for catalog and selection UIs. */\nexport function listBuiltinPluginManifestsV1(): readonly PluginManifestV1[] {\n\treturn Object.freeze(\n\t\tObject.values(manifests).sort((left, right) => {\n\t\t\tconst idOrder = `${left.id}@${left.pluginVersion}`.localeCompare(`${right.id}@${right.pluginVersion}`);\n\t\t\treturn idOrder === 0 ? comparePluginVersionsV1(left.pluginVersion, right.pluginVersion) : idOrder;\n\t\t}),\n\t);\n}\n\n/**\n * First-party plugins of an explicitly selected Profile are trusted by\n * default: builtins ship with the product and the user chose the Profile\n * explicitly. Installed third-party versions are still verified through the\n * active-binding resolver; host-injected verifiedPlugins always win.\n */\nexport function defaultBuiltinVerifiedPluginsV1(profileId: string): readonly VerifiedToolPluginV1[] {\n\tconst profile = profiles.find((candidate) => candidate.id === profileId);\n\tif (profile === undefined) return [];\n\treturn profile.pluginIds.flatMap((pluginId) => {\n\t\tconst manifest = manifests[pluginId];\n\t\treturn manifest === undefined ? [] : [{ pluginId: manifest.id, version: manifest.pluginVersion }];\n\t});\n}\n\nexport function resolveBuiltinPluginProfileV1(input: {\n\treadonly profileId: string;\n\treadonly host: HostFactsV1;\n\t/** Optional subset of the selected builtin Profile's plugins. */\n\treadonly selectedPluginIds?: readonly string[];\n\treadonly disabledPluginIds?: readonly string[];\n\treadonly verifiedPlugins?: readonly VerifiedToolPluginV1[];\n\t/** Explicit host-selected active manifests; never inferred from disk. */\n\treadonly manifestOverrides?: BuiltinPluginManifestOverridesV1;\n}): BuiltinPluginProfileResolutionV1 {\n\tconst profile = profiles.find((candidate) => candidate.id === input.profileId);\n\tif (profile === undefined) return { status: \"not_found\", profileId: input.profileId };\n\tconst requestedPluginIds = input.selectedPluginIds;\n\tconst requestedDisabledPluginIds = input.disabledPluginIds;\n\tif (requestedPluginIds !== undefined || requestedDisabledPluginIds !== undefined) {\n\t\tconst availablePluginIds = new Set(profile.pluginIds);\n\t\tconst duplicatePluginIds: string[] = [];\n\t\tconst unknownPluginIds: string[] = [];\n\t\tfor (const requestedIds of [requestedPluginIds ?? [], requestedDisabledPluginIds ?? []]) {\n\t\t\tconst seen = new Set<string>();\n\t\t\tfor (const pluginId of requestedIds) {\n\t\t\t\tif (!availablePluginIds.has(pluginId) && !unknownPluginIds.includes(pluginId))\n\t\t\t\t\tunknownPluginIds.push(pluginId);\n\t\t\t\tif (seen.has(pluginId) && !duplicatePluginIds.includes(pluginId)) duplicatePluginIds.push(pluginId);\n\t\t\t\tseen.add(pluginId);\n\t\t\t}\n\t\t}\n\t\tif (unknownPluginIds.length > 0 || duplicatePluginIds.length > 0) {\n\t\t\treturn {\n\t\t\t\tstatus: \"invalid_selection\",\n\t\t\t\tprofileId: input.profileId,\n\t\t\t\tunknownPluginIds: Object.freeze([...new Set(unknownPluginIds)]),\n\t\t\t\tduplicatePluginIds: Object.freeze(duplicatePluginIds),\n\t\t\t};\n\t\t}\n\t}\n\tconst selected =\n\t\trequestedPluginIds === undefined\n\t\t\t? profile.pluginIds\n\t\t\t: profile.pluginIds.filter((pluginId) => requestedPluginIds.includes(pluginId));\n\tconst selectedProfile =\n\t\trequestedPluginIds === undefined\n\t\t\t? profile\n\t\t\t: Object.freeze({ ...profile, pluginIds: Object.freeze([...selected]) });\n\tconst disabled = new Set(input.disabledPluginIds ?? []);\n\t// D-075 S2: a Profile plugin without a builtin manifest and without a\n\t// host-installed override is a structured miss, not a startup failure. The\n\t// plugin is omitted from the resolved manifest and runtime bindings; the\n\t// remaining Profile plugins resolve normally (soft degradation).\n\tconst manifestByPluginId = new Map(\n\t\tselectedProfile.pluginIds.map((pluginId) => [pluginId, manifestFor(pluginId, input.manifestOverrides)] as const),\n\t);\n\tconst missingPluginIds = selectedProfile.pluginIds.filter(\n\t\t(pluginId) => manifestByPluginId.get(pluginId) === undefined,\n\t);\n\tconst resolution = resolvePluginProfileV1({\n\t\tprofileId: selectedProfile.id,\n\t\tprofileVersion: selectedProfile.version,\n\t\tplugins: selectedProfile.pluginIds.flatMap((pluginId) => {\n\t\t\tconst manifest = manifestByPluginId.get(pluginId);\n\t\t\treturn manifest === undefined\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\t\t// A user-disabled plugin must not block the remaining profile. It is\n\t\t\t\t\t\t\t// still represented in the resolution diagnostics, but is omitted from\n\t\t\t\t\t\t\t// the active resolved manifest and runtime bindings.\n\t\t\t\t\t\t\trequired: !disabled.has(pluginId),\n\t\t\t\t\t\t\tdisabled: disabled.has(pluginId),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t}),\n\t\thost: input.host,\n\t\t// The host's own version enforces each manifest's minHostVersion floor\n\t\t// at the single builtin profile resolution funnel used by production\n\t\t// loading paths.\n\t\thostVersion: VERSION,\n\t});\n\tconst merged = mergeMissingPluginResolutionsV1(resolution, missingPluginIds, disabled);\n\tif (merged.status !== \"ready\") return { status: \"resolved\", profile: selectedProfile, resolution: merged };\n\tconst resolvedPlugins = merged.resolvedManifest.plugins.map((plugin) => ({\n\t\tpluginId: plugin.pluginId,\n\t\tpluginVersion: plugin.pluginVersion,\n\t\tcapabilityRefs: plugin.capabilityRefs,\n\t\t...(plugin.selectedAdapter === undefined ? {} : { selectedAdapter: plugin.selectedAdapter }),\n\t}));\n\tconst verifiedPlugins = input.verifiedPlugins ?? [];\n\tconst assembly = assembleProfile({\n\t\tprofileId: selectedProfile.id,\n\t\tprofileVersion: selectedProfile.version,\n\t\tresolvedPlugins,\n\t\tverifiedPlugins,\n\t});\n\treturn {\n\t\tstatus: \"resolved\",\n\t\tprofile: selectedProfile,\n\t\tresolution: merged,\n\t\tassembly,\n\t};\n}\n\nfunction manifestFor(\n\tpluginId: string,\n\toverrides: BuiltinPluginManifestOverridesV1 | undefined,\n): PluginManifestV1 | undefined {\n\tconst manifest = overrides?.[pluginId] ?? manifests[pluginId];\n\t// A mismatched override stays a hard host error: the host selected it\n\t// explicitly, so silence would hide an identity bug. A plain absent\n\t// manifest (no builtin, no installed override) is the structured miss.\n\tif (manifest !== undefined && manifest.id !== pluginId)\n\t\tthrow new Error(t(\"builtin manifest override does not match plugin {pluginId}\", { pluginId }));\n\treturn manifest;\n}\n\n/**\n * Merge structured `manifest_missing` resolutions for Profile plugins that\n * have no builtin manifest and no installed override into the resolver\n * result. Missing plugins never block the Profile (soft degradation): the\n * remaining diagnostics and the resolved manifest stay exactly what the\n * resolver produced, and the merged plugin list keeps the resolver's\n * deterministic id sort.\n */\nfunction mergeMissingPluginResolutionsV1(\n\tresolution: ProfileResolutionV1,\n\tmissingPluginIds: readonly string[],\n\tdisabled: ReadonlySet<string>,\n): ProfileResolutionV1 {\n\tif (missingPluginIds.length === 0) return resolution;\n\tconst missing: PluginResolutionV1[] = missingPluginIds.map((pluginId) => ({\n\t\tpluginId,\n\t\tpluginVersion: \"\",\n\t\trequired: !disabled.has(pluginId),\n\t\tstatus: \"manifest-missing\",\n\t\tdiagnostics: [\n\t\t\t{\n\t\t\t\tcode: \"manifest_missing\",\n\t\t\t\tmessage: `Plugin ${pluginId} has no builtin manifest and no installed active override; the plugin is omitted from this profile (install it with agent-forge plugin install)`,\n\t\t\t},\n\t\t],\n\t}));\n\tconst plugins = [...resolution.plugins, ...missing].sort((left, right) =>\n\t\tleft.pluginId.localeCompare(right.pluginId),\n\t);\n\treturn Object.freeze({\n\t\t...resolution,\n\t\tplugins: Object.freeze(plugins),\n\t\tdiagnostics: Object.freeze(plugins.flatMap((plug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S,MAAM,EAAE,CAAC;CAC9C,GACD;IACA,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAyDL,wBAAgB,2BAA2B,IAAI,SAAS,sBAAsB,EAAE,CAE/E;AAED,sFAAsF;AACtF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,wBAAwB,CAE3F;AAED,gFAAgF;AAChF,wBAAgB,4BAA4B,IAAI,SAAS,gBAAgB,EAAE,CAO1E;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,oBAAoB,EAAE,CAOlG;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC3D,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,gCAAgC,CAAC;CAC9D,GAAG,gCAAgC,CA2FnC","sourcesContent":["import { VERSION } from \"../config.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { comparePluginVersionsV1 } from \"../plugins/ecosystem/catalog.ts\";\nimport { resolvePluginProfileV1 } from \"../plugins/ecosystem/resolver.ts\";\nimport type {\n\tHostFactsV1,\n\tPluginManifestV1,\n\tPluginResolutionV1,\n\tProfileResolutionV1,\n} from \"../plugins/ecosystem/types.ts\";\nimport { assembleProfile, type ProfileAssemblyResultV1, type VerifiedToolPluginV1 } from \"./profile-assembly.ts\";\n\nexport type BuiltinPluginProfileIdV1 =\n\t| \"coding-core\"\n\t| \"desktop-qa\"\n\t| \"desktop-observe\"\n\t| \"desktop-control\"\n\t| \"desktop-observe-macos\"\n\t| \"desktop-control-macos\"\n\t| \"desktop-qa-macos\"\n\t| \"lsp-diagnostics\"\n\t| \"image-generation\"\n\t| \"process-exec\"\n\t| \"test-runner\"\n\t| \"workspace-files\"\n\t| \"workspace-files-write\"\n\t| \"formatter-linter\"\n\t| \"git-repository\";\n\nexport interface BuiltinPluginProfileV1 {\n\treadonly id: BuiltinPluginProfileIdV1;\n\treadonly version: string;\n\treadonly pluginIds: readonly string[];\n}\n\n/**\n * Host-owned manifest replacements for installed, verified package versions.\n *\n * Builtin manifests remain the default. A host may explicitly provide one\n * replacement per builtin plugin ID when a staged/verified/active install is\n * selected for a new Profile. The resolver never discovers files or chooses a\n * version implicitly; the replacement is part of the resulting Profile\n * identity and must still pass normal compatibility and verification checks.\n */\nexport type BuiltinPluginManifestOverridesV1 = Readonly<Record<string, PluginManifestV1>>;\n\nexport type BuiltinPluginProfileResolutionV1 =\n\t| { readonly status: \"not_found\"; readonly profileId: string }\n\t| { readonly status: \"host_facts_required\"; readonly profileId: string }\n\t| {\n\t\t\treadonly status: \"invalid_selection\";\n\t\t\treadonly profileId: string;\n\t\t\treadonly unknownPluginIds: readonly string[];\n\t\t\treadonly duplicatePluginIds: readonly string[];\n\t }\n\t| {\n\t\t\treadonly status: \"resolved\";\n\t\t\treadonly profile: BuiltinPluginProfileV1;\n\t\t\treadonly resolution: ProfileResolutionV1;\n\t\t\treadonly assembly?: ProfileAssemblyResultV1;\n\t };\n\n// D-075 S3: every first-party category-A plugin now ships as an independent\n// package under `plugins/` with the `agent-forge.plugin.<name>` id domain\n// (design §4.1). No embedded manifests remain; profiles resolve through the\n// install store (host-provided `manifestOverrides` from active bindings).\nconst manifests: Readonly<Record<string, PluginManifestV1>> = Object.freeze({});\n\nconst profiles: readonly BuiltinPluginProfileV1[] = Object.freeze([\n\t{ id: \"coding-core\", version: \"1\", pluginIds: [] },\n\t{\n\t\tid: \"desktop-qa\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-windows-observe\", \"agent-forge.plugin.desktop-windows-input\"],\n\t},\n\t{ id: \"desktop-observe\", version: \"1\", pluginIds: [\"agent-forge.plugin.desktop-windows-observe\"] },\n\t{\n\t\tid: \"desktop-control\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-windows-observe\", \"agent-forge.plugin.desktop-windows-input\"],\n\t},\n\t{ id: \"lsp-diagnostics\", version: \"1\", pluginIds: [\"agent-forge.plugin.lsp-diagnostics\"] },\n\t{ id: \"image-generation\", version: \"1\", pluginIds: [\"agent-forge.plugin.image-generation\"] },\n\t{ id: \"process-exec\", version: \"1\", pluginIds: [\"agent-forge.plugin.process-exec\"] },\n\t{ id: \"test-runner\", version: \"1\", pluginIds: [\"agent-forge.plugin.test-runner\"] },\n\t{ id: \"workspace-files\", version: \"1\", pluginIds: [\"agent-forge.plugin.workspace-files\"] },\n\t{ id: \"workspace-files-write\", version: \"1\", pluginIds: [\"agent-forge.plugin.workspace-files-write\"] },\n\t{\n\t\t// D-075 S2: the plugin code ships as the independent package\n\t\t// `agent-forge.plugin.formatter-linter` (design §4.1 id domain); this\n\t\t// Profile stays the stable user entry (`--plugin-profile formatter-linter`)\n\t\t// and resolves through the install store, not an embedded manifest.\n\t\tid: \"formatter-linter\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.formatter-linter\"],\n\t},\n\t{ id: \"git-repository\", version: \"1\", pluginIds: [\"agent-forge.plugin.git-repository\"] },\n\t// macOS desktop profiles resolve the mac plugin packages; they stay separate\n\t// from the Windows profiles because a profile with an installed-but-\n\t// platform-unavailable plugin is blocked wholesale by the resolver.\n\t{\n\t\tid: \"desktop-observe-macos\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-macos-observe\"],\n\t},\n\t{\n\t\tid: \"desktop-control-macos\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-macos-observe\", \"agent-forge.plugin.desktop-macos-input\"],\n\t},\n\t{\n\t\tid: \"desktop-qa-macos\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-macos-observe\", \"agent-forge.plugin.desktop-macos-input\"],\n\t},\n]);\n\nexport function listBuiltinPluginProfilesV1(): readonly BuiltinPluginProfileV1[] {\n\treturn profiles;\n}\n\n/** True when the id names a builtin plugin profile (the CLI selection vocabulary). */\nexport function isBuiltinPluginProfileIdV1(value: string): value is BuiltinPluginProfileIdV1 {\n\treturn profiles.some((profile) => profile.id === value);\n}\n\n/** Return the first-party manifest projection for catalog and selection UIs. */\nexport function listBuiltinPluginManifestsV1(): readonly PluginManifestV1[] {\n\treturn Object.freeze(\n\t\tObject.values(manifests).sort((left, right) => {\n\t\t\tconst idOrder = `${left.id}@${left.pluginVersion}`.localeCompare(`${right.id}@${right.pluginVersion}`);\n\t\t\treturn idOrder === 0 ? comparePluginVersionsV1(left.pluginVersion, right.pluginVersion) : idOrder;\n\t\t}),\n\t);\n}\n\n/**\n * First-party plugins of an explicitly selected Profile are trusted by\n * default: builtins ship with the product and the user chose the Profile\n * explicitly. Installed third-party versions are still verified through the\n * active-binding resolver; host-injected verifiedPlugins always win.\n */\nexport function defaultBuiltinVerifiedPluginsV1(profileId: string): readonly VerifiedToolPluginV1[] {\n\tconst profile = profiles.find((candidate) => candidate.id === profileId);\n\tif (profile === undefined) return [];\n\treturn profile.pluginIds.flatMap((pluginId) => {\n\t\tconst manifest = manifests[pluginId];\n\t\treturn manifest === undefined ? [] : [{ pluginId: manifest.id, version: manifest.pluginVersion }];\n\t});\n}\n\nexport function resolveBuiltinPluginProfileV1(input: {\n\treadonly profileId: string;\n\treadonly host: HostFactsV1;\n\t/** Optional subset of the selected builtin Profile's plugins. */\n\treadonly selectedPluginIds?: readonly string[];\n\treadonly disabledPluginIds?: readonly string[];\n\treadonly verifiedPlugins?: readonly VerifiedToolPluginV1[];\n\t/** Explicit host-selected active manifests; never inferred from disk. */\n\treadonly manifestOverrides?: BuiltinPluginManifestOverridesV1;\n}): BuiltinPluginProfileResolutionV1 {\n\tconst profile = profiles.find((candidate) => candidate.id === input.profileId);\n\tif (profile === undefined) return { status: \"not_found\", profileId: input.profileId };\n\tconst requestedPluginIds = input.selectedPluginIds;\n\tconst requestedDisabledPluginIds = input.disabledPluginIds;\n\tif (requestedPluginIds !== undefined || requestedDisabledPluginIds !== undefined) {\n\t\tconst availablePluginIds = new Set(profile.pluginIds);\n\t\tconst duplicatePluginIds: string[] = [];\n\t\tconst unknownPluginIds: string[] = [];\n\t\tfor (const requestedIds of [requestedPluginIds ?? [], requestedDisabledPluginIds ?? []]) {\n\t\t\tconst seen = new Set<string>();\n\t\t\tfor (const pluginId of requestedIds) {\n\t\t\t\tif (!availablePluginIds.has(pluginId) && !unknownPluginIds.includes(pluginId))\n\t\t\t\t\tunknownPluginIds.push(pluginId);\n\t\t\t\tif (seen.has(pluginId) && !duplicatePluginIds.includes(pluginId)) duplicatePluginIds.push(pluginId);\n\t\t\t\tseen.add(pluginId);\n\t\t\t}\n\t\t}\n\t\tif (unknownPluginIds.length > 0 || duplicatePluginIds.length > 0) {\n\t\t\treturn {\n\t\t\t\tstatus: \"invalid_selection\",\n\t\t\t\tprofileId: input.profileId,\n\t\t\t\tunknownPluginIds: Object.freeze([...new Set(unknownPluginIds)]),\n\t\t\t\tduplicatePluginIds: Object.freeze(duplicatePluginIds),\n\t\t\t};\n\t\t}\n\t}\n\tconst selected =\n\t\trequestedPluginIds === undefined\n\t\t\t? profile.pluginIds\n\t\t\t: profile.pluginIds.filter((pluginId) => requestedPluginIds.includes(pluginId));\n\tconst selectedProfile =\n\t\trequestedPluginIds === undefined\n\t\t\t? profile\n\t\t\t: Object.freeze({ ...profile, pluginIds: Object.freeze([...selected]) });\n\tconst disabled = new Set(input.disabledPluginIds ?? []);\n\t// D-075 S2: a Profile plugin without a builtin manifest and without a\n\t// host-installed override is a structured miss, not a startup failure. The\n\t// plugin is omitted from the resolved manifest and runtime bindings; the\n\t// remaining Profile plugins resolve normally (soft degradation).\n\tconst manifestByPluginId = new Map(\n\t\tselectedProfile.pluginIds.map((pluginId) => [pluginId, manifestFor(pluginId, input.manifestOverrides)] as const),\n\t);\n\tconst missingPluginIds = selectedProfile.pluginIds.filter(\n\t\t(pluginId) => manifestByPluginId.get(pluginId) === undefined,\n\t);\n\tconst resolution = resolvePluginProfileV1({\n\t\tprofileId: selectedProfile.id,\n\t\tprofileVersion: selectedProfile.version,\n\t\tplugins: selectedProfile.pluginIds.flatMap((pluginId) => {\n\t\t\tconst manifest = manifestByPluginId.get(pluginId);\n\t\t\treturn manifest === undefined\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\t\t// A user-disabled plugin must not block the remaining profile. It is\n\t\t\t\t\t\t\t// still represented in the resolution diagnostics, but is omitted from\n\t\t\t\t\t\t\t// the active resolved manifest and runtime bindings.\n\t\t\t\t\t\t\trequired: !disabled.has(pluginId),\n\t\t\t\t\t\t\tdisabled: disabled.has(pluginId),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t}),\n\t\thost: input.host,\n\t\t// The host's own version enforces each manifest's minHostVersion floor\n\t\t// at the single builtin profile resolution funnel used by production\n\t\t// loading paths.\n\t\thostVersion: VERSION,\n\t});\n\tconst merged = mergeMissingPluginResolutionsV1(resolution, missingPluginIds, disabled);\n\tif (merged.status !== \"ready\") return { status: \"resolved\", profile: selectedProfile, resolution: merged };\n\tconst resolvedPlugins = merged.resolvedManifest.plugins.map((plugin) => ({\n\t\tpluginId: plugin.pluginId,\n\t\tpluginVersion: plugin.pluginVersion,\n\t\tcapabilityRefs: plugin.capabilityRefs,\n\t\t...(plugin.selectedAdapter === undefined ? {} : { selectedAdapter: plugin.selectedAdapter }),\n\t}));\n\tconst verifiedPlugins = input.verifiedPlugins ?? [];\n\tconst assembly = assembleProfile({\n\t\tprofileId: selectedProfile.id,\n\t\tprofileVersion: selectedProfile.version,\n\t\tresolvedPlugins,\n\t\tverifiedPlugins,\n\t});\n\treturn {\n\t\tstatus: \"resolved\",\n\t\tprofile: selectedProfile,\n\t\tresolution: merged,\n\t\tassembly,\n\t};\n}\n\nfunction manifestFor(\n\tpluginId: string,\n\toverrides: BuiltinPluginManifestOverridesV1 | undefined,\n): PluginManifestV1 | undefined {\n\tconst manifest = overrides?.[pluginId] ?? manifests[pluginId];\n\t// A mismatched override stays a hard host error: the host selected it\n\t// explicitly, so silence would hide an identity bug. A plain absent\n\t// manifest (no builtin, no installed override) is the structured miss.\n\tif (manifest !== undefined && manifest.id !== pluginId)\n\t\tthrow new Error(t(\"builtin manifest override does not match plugin {pluginId}\", { pluginId }));\n\treturn manifest;\n}\n\n/**\n * Merge structured `manifest_missing` resolutions for Profile plugins that\n * have no builtin manifest and no installed override into the resolver\n * result. Missing plugins never block the Profile (soft degradation): the\n * remaining diagnostics and the resolved manifest stay exactly what the\n * resolver produced, and the merged plugin list keeps the resolver's\n * deterministic id sort.\n */\nfunction mergeMissingPluginResolutionsV1(\n\tresolution: ProfileResolutionV1,\n\tmissingPluginIds: readonly string[],\n\tdisabled: ReadonlySet<string>,\n): ProfileResolutionV1 {\n\tif (missingPluginIds.length === 0) return resolution;\n\tconst missing: PluginResolutionV1[] = missingPluginIds.map((pluginId) => ({\n\t\tpluginId,\n\t\tpluginVersion: \"\",\n\t\trequired: !disabled.has(pluginId),\n\t\tstatus: \"manifest-missing\",\n\t\tdiagnostics: [\n\t\t\t{\n\t\t\t\tcode: \"manifest_missing\",\n\t\t\t\tmessage: `Plugin ${pluginId} has no builtin manifest and no installed active override; the plugin is omitted from this profile (install it with agent-forge plugin install)`,\n\t\t\t},\n\t\t],\n\t}));\n\tconst plugins = [...resolution.plugins, ...missing].sort((left, right) =>\n\t\tleft.pluginId.localeCompare(right.pluginId),\n\t);\n\treturn Object.freeze({\n\t\t...resolution,\n\t\tplugins: Object.freeze(plugins),\n\t\tdiagnostics: Object.freeze(plugins.flatMap((plugin) => plugin.diagnostics)),\n\t});\n}\n"]}
@@ -37,6 +37,24 @@ const profiles = Object.freeze([
37
37
  pluginIds: ["agent-forge.plugin.formatter-linter"],
38
38
  },
39
39
  { id: "git-repository", version: "1", pluginIds: ["agent-forge.plugin.git-repository"] },
40
+ // macOS desktop profiles resolve the mac plugin packages; they stay separate
41
+ // from the Windows profiles because a profile with an installed-but-
42
+ // platform-unavailable plugin is blocked wholesale by the resolver.
43
+ {
44
+ id: "desktop-observe-macos",
45
+ version: "1",
46
+ pluginIds: ["agent-forge.plugin.desktop-macos-observe"],
47
+ },
48
+ {
49
+ id: "desktop-control-macos",
50
+ version: "1",
51
+ pluginIds: ["agent-forge.plugin.desktop-macos-observe", "agent-forge.plugin.desktop-macos-input"],
52
+ },
53
+ {
54
+ id: "desktop-qa-macos",
55
+ version: "1",
56
+ pluginIds: ["agent-forge.plugin.desktop-macos-observe", "agent-forge.plugin.desktop-macos-input"],
57
+ },
40
58
  ]);
41
59
  export function listBuiltinPluginProfilesV1() {
42
60
  return profiles;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-profiles.js","sourceRoot":"","sources":["../../src/profile/plugin-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAO1E,OAAO,EAAE,eAAe,EAA2D,MAAM,uBAAuB,CAAC;AAiDjH,4EAA4E;AAC5E,0EAA0E;AAC1E,6EAA4E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+B,EAC/B,gBAAmC,EACnC,QAA6B,EACP;IACtB,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,UAAU,CAAC;IACrD,MAAM,OAAO,GAAyB,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACzE,QAAQ;QACR,aAAa,EAAE,EAAE;QACjB,QAAQ,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QACjC,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE;YACZ;gBACC,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,UAAU,QAAQ,iJAAiJ;aAC5K;SACD;KACD,CAAC,CAAC,CAAC;IACJ,MAAM,OAAO,GAAG,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACxE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAC3C,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,GAAG,UAAU;QACb,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QAC/B,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;KAC3E,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { VERSION } from \"../config.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { comparePluginVersionsV1 } from \"../plugins/ecosystem/catalog.ts\";\nimport { resolvePluginProfileV1 } from \"../plugins/ecosystem/resolver.ts\";\nimport type {\n\tHostFactsV1,\n\tPluginManifestV1,\n\tPluginResolutionV1,\n\tProfileResolutionV1,\n} from \"../plugins/ecosystem/types.ts\";\nimport { assembleProfile, type ProfileAssemblyResultV1, type VerifiedToolPluginV1 } from \"./profile-assembly.ts\";\n\nexport type BuiltinPluginProfileIdV1 =\n\t| \"coding-core\"\n\t| \"desktop-qa\"\n\t| \"desktop-observe\"\n\t| \"desktop-control\"\n\t| \"lsp-diagnostics\"\n\t| \"image-generation\"\n\t| \"process-exec\"\n\t| \"test-runner\"\n\t| \"workspace-files\"\n\t| \"workspace-files-write\"\n\t| \"formatter-linter\"\n\t| \"git-repository\";\n\nexport interface BuiltinPluginProfileV1 {\n\treadonly id: BuiltinPluginProfileIdV1;\n\treadonly version: string;\n\treadonly pluginIds: readonly string[];\n}\n\n/**\n * Host-owned manifest replacements for installed, verified package versions.\n *\n * Builtin manifests remain the default. A host may explicitly provide one\n * replacement per builtin plugin ID when a staged/verified/active install is\n * selected for a new Profile. The resolver never discovers files or chooses a\n * version implicitly; the replacement is part of the resulting Profile\n * identity and must still pass normal compatibility and verification checks.\n */\nexport type BuiltinPluginManifestOverridesV1 = Readonly<Record<string, PluginManifestV1>>;\n\nexport type BuiltinPluginProfileResolutionV1 =\n\t| { readonly status: \"not_found\"; readonly profileId: string }\n\t| { readonly status: \"host_facts_required\"; readonly profileId: string }\n\t| {\n\t\t\treadonly status: \"invalid_selection\";\n\t\t\treadonly profileId: string;\n\t\t\treadonly unknownPluginIds: readonly string[];\n\t\t\treadonly duplicatePluginIds: readonly string[];\n\t }\n\t| {\n\t\t\treadonly status: \"resolved\";\n\t\t\treadonly profile: BuiltinPluginProfileV1;\n\t\t\treadonly resolution: ProfileResolutionV1;\n\t\t\treadonly assembly?: ProfileAssemblyResultV1;\n\t };\n\n// D-075 S3: every first-party category-A plugin now ships as an independent\n// package under `plugins/` with the `agent-forge.plugin.<name>` id domain\n// (design §4.1). No embedded manifests remain; profiles resolve through the\n// install store (host-provided `manifestOverrides` from active bindings).\nconst manifests: Readonly<Record<string, PluginManifestV1>> = Object.freeze({});\n\nconst profiles: readonly BuiltinPluginProfileV1[] = Object.freeze([\n\t{ id: \"coding-core\", version: \"1\", pluginIds: [] },\n\t{\n\t\tid: \"desktop-qa\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-windows-observe\", \"agent-forge.plugin.desktop-windows-input\"],\n\t},\n\t{ id: \"desktop-observe\", version: \"1\", pluginIds: [\"agent-forge.plugin.desktop-windows-observe\"] },\n\t{\n\t\tid: \"desktop-control\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-windows-observe\", \"agent-forge.plugin.desktop-windows-input\"],\n\t},\n\t{ id: \"lsp-diagnostics\", version: \"1\", pluginIds: [\"agent-forge.plugin.lsp-diagnostics\"] },\n\t{ id: \"image-generation\", version: \"1\", pluginIds: [\"agent-forge.plugin.image-generation\"] },\n\t{ id: \"process-exec\", version: \"1\", pluginIds: [\"agent-forge.plugin.process-exec\"] },\n\t{ id: \"test-runner\", version: \"1\", pluginIds: [\"agent-forge.plugin.test-runner\"] },\n\t{ id: \"workspace-files\", version: \"1\", pluginIds: [\"agent-forge.plugin.workspace-files\"] },\n\t{ id: \"workspace-files-write\", version: \"1\", pluginIds: [\"agent-forge.plugin.workspace-files-write\"] },\n\t{\n\t\t// D-075 S2: the plugin code ships as the independent package\n\t\t// `agent-forge.plugin.formatter-linter` (design §4.1 id domain); this\n\t\t// Profile stays the stable user entry (`--plugin-profile formatter-linter`)\n\t\t// and resolves through the install store, not an embedded manifest.\n\t\tid: \"formatter-linter\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.formatter-linter\"],\n\t},\n\t{ id: \"git-repository\", version: \"1\", pluginIds: [\"agent-forge.plugin.git-repository\"] },\n]);\n\nexport function listBuiltinPluginProfilesV1(): readonly BuiltinPluginProfileV1[] {\n\treturn profiles;\n}\n\n/** True when the id names a builtin plugin profile (the CLI selection vocabulary). */\nexport function isBuiltinPluginProfileIdV1(value: string): value is BuiltinPluginProfileIdV1 {\n\treturn profiles.some((profile) => profile.id === value);\n}\n\n/** Return the first-party manifest projection for catalog and selection UIs. */\nexport function listBuiltinPluginManifestsV1(): readonly PluginManifestV1[] {\n\treturn Object.freeze(\n\t\tObject.values(manifests).sort((left, right) => {\n\t\t\tconst idOrder = `${left.id}@${left.pluginVersion}`.localeCompare(`${right.id}@${right.pluginVersion}`);\n\t\t\treturn idOrder === 0 ? comparePluginVersionsV1(left.pluginVersion, right.pluginVersion) : idOrder;\n\t\t}),\n\t);\n}\n\n/**\n * First-party plugins of an explicitly selected Profile are trusted by\n * default: builtins ship with the product and the user chose the Profile\n * explicitly. Installed third-party versions are still verified through the\n * active-binding resolver; host-injected verifiedPlugins always win.\n */\nexport function defaultBuiltinVerifiedPluginsV1(profileId: string): readonly VerifiedToolPluginV1[] {\n\tconst profile = profiles.find((candidate) => candidate.id === profileId);\n\tif (profile === undefined) return [];\n\treturn profile.pluginIds.flatMap((pluginId) => {\n\t\tconst manifest = manifests[pluginId];\n\t\treturn manifest === undefined ? [] : [{ pluginId: manifest.id, version: manifest.pluginVersion }];\n\t});\n}\n\nexport function resolveBuiltinPluginProfileV1(input: {\n\treadonly profileId: string;\n\treadonly host: HostFactsV1;\n\t/** Optional subset of the selected builtin Profile's plugins. */\n\treadonly selectedPluginIds?: readonly string[];\n\treadonly disabledPluginIds?: readonly string[];\n\treadonly verifiedPlugins?: readonly VerifiedToolPluginV1[];\n\t/** Explicit host-selected active manifests; never inferred from disk. */\n\treadonly manifestOverrides?: BuiltinPluginManifestOverridesV1;\n}): BuiltinPluginProfileResolutionV1 {\n\tconst profile = profiles.find((candidate) => candidate.id === input.profileId);\n\tif (profile === undefined) return { status: \"not_found\", profileId: input.profileId };\n\tconst requestedPluginIds = input.selectedPluginIds;\n\tconst requestedDisabledPluginIds = input.disabledPluginIds;\n\tif (requestedPluginIds !== undefined || requestedDisabledPluginIds !== undefined) {\n\t\tconst availablePluginIds = new Set(profile.pluginIds);\n\t\tconst duplicatePluginIds: string[] = [];\n\t\tconst unknownPluginIds: string[] = [];\n\t\tfor (const requestedIds of [requestedPluginIds ?? [], requestedDisabledPluginIds ?? []]) {\n\t\t\tconst seen = new Set<string>();\n\t\t\tfor (const pluginId of requestedIds) {\n\t\t\t\tif (!availablePluginIds.has(pluginId) && !unknownPluginIds.includes(pluginId))\n\t\t\t\t\tunknownPluginIds.push(pluginId);\n\t\t\t\tif (seen.has(pluginId) && !duplicatePluginIds.includes(pluginId)) duplicatePluginIds.push(pluginId);\n\t\t\t\tseen.add(pluginId);\n\t\t\t}\n\t\t}\n\t\tif (unknownPluginIds.length > 0 || duplicatePluginIds.length > 0) {\n\t\t\treturn {\n\t\t\t\tstatus: \"invalid_selection\",\n\t\t\t\tprofileId: input.profileId,\n\t\t\t\tunknownPluginIds: Object.freeze([...new Set(unknownPluginIds)]),\n\t\t\t\tduplicatePluginIds: Object.freeze(duplicatePluginIds),\n\t\t\t};\n\t\t}\n\t}\n\tconst selected =\n\t\trequestedPluginIds === undefined\n\t\t\t? profile.pluginIds\n\t\t\t: profile.pluginIds.filter((pluginId) => requestedPluginIds.includes(pluginId));\n\tconst selectedProfile =\n\t\trequestedPluginIds === undefined\n\t\t\t? profile\n\t\t\t: Object.freeze({ ...profile, pluginIds: Object.freeze([...selected]) });\n\tconst disabled = new Set(input.disabledPluginIds ?? []);\n\t// D-075 S2: a Profile plugin without a builtin manifest and without a\n\t// host-installed override is a structured miss, not a startup failure. The\n\t// plugin is omitted from the resolved manifest and runtime bindings; the\n\t// remaining Profile plugins resolve normally (soft degradation).\n\tconst manifestByPluginId = new Map(\n\t\tselectedProfile.pluginIds.map((pluginId) => [pluginId, manifestFor(pluginId, input.manifestOverrides)] as const),\n\t);\n\tconst missingPluginIds = selectedProfile.pluginIds.filter(\n\t\t(pluginId) => manifestByPluginId.get(pluginId) === undefined,\n\t);\n\tconst resolution = resolvePluginProfileV1({\n\t\tprofileId: selectedProfile.id,\n\t\tprofileVersion: selectedProfile.version,\n\t\tplugins: selectedProfile.pluginIds.flatMap((pluginId) => {\n\t\t\tconst manifest = manifestByPluginId.get(pluginId);\n\t\t\treturn manifest === undefined\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\t\t// A user-disabled plugin must not block the remaining profile. It is\n\t\t\t\t\t\t\t// still represented in the resolution diagnostics, but is omitted from\n\t\t\t\t\t\t\t// the active resolved manifest and runtime bindings.\n\t\t\t\t\t\t\trequired: !disabled.has(pluginId),\n\t\t\t\t\t\t\tdisabled: disabled.has(pluginId),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t}),\n\t\thost: input.host,\n\t\t// The host's own version enforces each manifest's minHostVersion floor\n\t\t// at the single builtin profile resolution funnel used by production\n\t\t// loading paths.\n\t\thostVersion: VERSION,\n\t});\n\tconst merged = mergeMissingPluginResolutionsV1(resolution, missingPluginIds, disabled);\n\tif (merged.status !== \"ready\") return { status: \"resolved\", profile: selectedProfile, resolution: merged };\n\tconst resolvedPlugins = merged.resolvedManifest.plugins.map((plugin) => ({\n\t\tpluginId: plugin.pluginId,\n\t\tpluginVersion: plugin.pluginVersion,\n\t\tcapabilityRefs: plugin.capabilityRefs,\n\t\t...(plugin.selectedAdapter === undefined ? {} : { selectedAdapter: plugin.selectedAdapter }),\n\t}));\n\tconst verifiedPlugins = input.verifiedPlugins ?? [];\n\tconst assembly = assembleProfile({\n\t\tprofileId: selectedProfile.id,\n\t\tprofileVersion: selectedProfile.version,\n\t\tresolvedPlugins,\n\t\tverifiedPlugins,\n\t});\n\treturn {\n\t\tstatus: \"resolved\",\n\t\tprofile: selectedProfile,\n\t\tresolution: merged,\n\t\tassembly,\n\t};\n}\n\nfunction manifestFor(\n\tpluginId: string,\n\toverrides: BuiltinPluginManifestOverridesV1 | undefined,\n): PluginManifestV1 | undefined {\n\tconst manifest = overrides?.[pluginId] ?? manifests[pluginId];\n\t// A mismatched override stays a hard host error: the host selected it\n\t// explicitly, so silence would hide an identity bug. A plain absent\n\t// manifest (no builtin, no installed override) is the structured miss.\n\tif (manifest !== undefined && manifest.id !== pluginId)\n\t\tthrow new Error(t(\"builtin manifest override does not match plugin {pluginId}\", { pluginId }));\n\treturn manifest;\n}\n\n/**\n * Merge structured `manifest_missing` resolutions for Profile plugins that\n * have no builtin manifest and no installed override into the resolver\n * result. Missing plugins never block the Profile (soft degradation): the\n * remaining diagnostics and the resolved manifest stay exactly what the\n * resolver produced, and the merged plugin list keeps the resolver's\n * deterministic id sort.\n */\nfunction mergeMissingPluginResolutionsV1(\n\tresolution: ProfileResolutionV1,\n\tmissingPluginIds: readonly string[],\n\tdisabled: ReadonlySet<string>,\n): ProfileResolutionV1 {\n\tif (missingPluginIds.length === 0) return resolution;\n\tconst missing: PluginResolutionV1[] = missingPluginIds.map((pluginId) => ({\n\t\tpluginId,\n\t\tpluginVersion: \"\",\n\t\trequired: !disabled.has(pluginId),\n\t\tstatus: \"manifest-missing\",\n\t\tdiagnostics: [\n\t\t\t{\n\t\t\t\tcode: \"manifest_missing\",\n\t\t\t\tmessage: `Plugin ${pluginId} has no builtin manifest and no installed active override; the plugin is omitted from this profile (install it with agent-forge plugin install)`,\n\t\t\t},\n\t\t],\n\t}));\n\tconst plugins = [...resolution.plugins, ...missing].sort((left, right) =>\n\t\tleft.pluginId.localeCompare(right.pluginId),\n\t);\n\treturn Object.freeze({\n\t\t...resolution,\n\t\tplugins: Object.freeze(plugins),\n\t\tdiagnostics: Object.freeze(plugins.flatMap((plugin) => plugin.diagnostics)),\n\t});\n}\n"]}
1
+ {"version":3,"file":"plugin-profiles.js","sourceRoot":"","sources":["../../src/profile/plugin-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAO1E,OAAO,EAAE,eAAe,EAA2D,MAAM,uBAAuB,CAAC;AAoDjH,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AC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;KAC3E,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { VERSION } from \"../config.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { comparePluginVersionsV1 } from \"../plugins/ecosystem/catalog.ts\";\nimport { resolvePluginProfileV1 } from \"../plugins/ecosystem/resolver.ts\";\nimport type {\n\tHostFactsV1,\n\tPluginManifestV1,\n\tPluginResolutionV1,\n\tProfileResolutionV1,\n} from \"../plugins/ecosystem/types.ts\";\nimport { assembleProfile, type ProfileAssemblyResultV1, type VerifiedToolPluginV1 } from \"./profile-assembly.ts\";\n\nexport type BuiltinPluginProfileIdV1 =\n\t| \"coding-core\"\n\t| \"desktop-qa\"\n\t| \"desktop-observe\"\n\t| \"desktop-control\"\n\t| \"desktop-observe-macos\"\n\t| \"desktop-control-macos\"\n\t| \"desktop-qa-macos\"\n\t| \"lsp-diagnostics\"\n\t| \"image-generation\"\n\t| \"process-exec\"\n\t| \"test-runner\"\n\t| \"workspace-files\"\n\t| \"workspace-files-write\"\n\t| \"formatter-linter\"\n\t| \"git-repository\";\n\nexport interface BuiltinPluginProfileV1 {\n\treadonly id: BuiltinPluginProfileIdV1;\n\treadonly version: string;\n\treadonly pluginIds: readonly string[];\n}\n\n/**\n * Host-owned manifest replacements for installed, verified package versions.\n *\n * Builtin manifests remain the default. A host may explicitly provide one\n * replacement per builtin plugin ID when a staged/verified/active install is\n * selected for a new Profile. The resolver never discovers files or chooses a\n * version implicitly; the replacement is part of the resulting Profile\n * identity and must still pass normal compatibility and verification checks.\n */\nexport type BuiltinPluginManifestOverridesV1 = Readonly<Record<string, PluginManifestV1>>;\n\nexport type BuiltinPluginProfileResolutionV1 =\n\t| { readonly status: \"not_found\"; readonly profileId: string }\n\t| { readonly status: \"host_facts_required\"; readonly profileId: string }\n\t| {\n\t\t\treadonly status: \"invalid_selection\";\n\t\t\treadonly profileId: string;\n\t\t\treadonly unknownPluginIds: readonly string[];\n\t\t\treadonly duplicatePluginIds: readonly string[];\n\t }\n\t| {\n\t\t\treadonly status: \"resolved\";\n\t\t\treadonly profile: BuiltinPluginProfileV1;\n\t\t\treadonly resolution: ProfileResolutionV1;\n\t\t\treadonly assembly?: ProfileAssemblyResultV1;\n\t };\n\n// D-075 S3: every first-party category-A plugin now ships as an independent\n// package under `plugins/` with the `agent-forge.plugin.<name>` id domain\n// (design §4.1). No embedded manifests remain; profiles resolve through the\n// install store (host-provided `manifestOverrides` from active bindings).\nconst manifests: Readonly<Record<string, PluginManifestV1>> = Object.freeze({});\n\nconst profiles: readonly BuiltinPluginProfileV1[] = Object.freeze([\n\t{ id: \"coding-core\", version: \"1\", pluginIds: [] },\n\t{\n\t\tid: \"desktop-qa\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-windows-observe\", \"agent-forge.plugin.desktop-windows-input\"],\n\t},\n\t{ id: \"desktop-observe\", version: \"1\", pluginIds: [\"agent-forge.plugin.desktop-windows-observe\"] },\n\t{\n\t\tid: \"desktop-control\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-windows-observe\", \"agent-forge.plugin.desktop-windows-input\"],\n\t},\n\t{ id: \"lsp-diagnostics\", version: \"1\", pluginIds: [\"agent-forge.plugin.lsp-diagnostics\"] },\n\t{ id: \"image-generation\", version: \"1\", pluginIds: [\"agent-forge.plugin.image-generation\"] },\n\t{ id: \"process-exec\", version: \"1\", pluginIds: [\"agent-forge.plugin.process-exec\"] },\n\t{ id: \"test-runner\", version: \"1\", pluginIds: [\"agent-forge.plugin.test-runner\"] },\n\t{ id: \"workspace-files\", version: \"1\", pluginIds: [\"agent-forge.plugin.workspace-files\"] },\n\t{ id: \"workspace-files-write\", version: \"1\", pluginIds: [\"agent-forge.plugin.workspace-files-write\"] },\n\t{\n\t\t// D-075 S2: the plugin code ships as the independent package\n\t\t// `agent-forge.plugin.formatter-linter` (design §4.1 id domain); this\n\t\t// Profile stays the stable user entry (`--plugin-profile formatter-linter`)\n\t\t// and resolves through the install store, not an embedded manifest.\n\t\tid: \"formatter-linter\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.formatter-linter\"],\n\t},\n\t{ id: \"git-repository\", version: \"1\", pluginIds: [\"agent-forge.plugin.git-repository\"] },\n\t// macOS desktop profiles resolve the mac plugin packages; they stay separate\n\t// from the Windows profiles because a profile with an installed-but-\n\t// platform-unavailable plugin is blocked wholesale by the resolver.\n\t{\n\t\tid: \"desktop-observe-macos\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-macos-observe\"],\n\t},\n\t{\n\t\tid: \"desktop-control-macos\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-macos-observe\", \"agent-forge.plugin.desktop-macos-input\"],\n\t},\n\t{\n\t\tid: \"desktop-qa-macos\",\n\t\tversion: \"1\",\n\t\tpluginIds: [\"agent-forge.plugin.desktop-macos-observe\", \"agent-forge.plugin.desktop-macos-input\"],\n\t},\n]);\n\nexport function listBuiltinPluginProfilesV1(): readonly BuiltinPluginProfileV1[] {\n\treturn profiles;\n}\n\n/** True when the id names a builtin plugin profile (the CLI selection vocabulary). */\nexport function isBuiltinPluginProfileIdV1(value: string): value is BuiltinPluginProfileIdV1 {\n\treturn profiles.some((profile) => profile.id === value);\n}\n\n/** Return the first-party manifest projection for catalog and selection UIs. */\nexport function listBuiltinPluginManifestsV1(): readonly PluginManifestV1[] {\n\treturn Object.freeze(\n\t\tObject.values(manifests).sort((left, right) => {\n\t\t\tconst idOrder = `${left.id}@${left.pluginVersion}`.localeCompare(`${right.id}@${right.pluginVersion}`);\n\t\t\treturn idOrder === 0 ? comparePluginVersionsV1(left.pluginVersion, right.pluginVersion) : idOrder;\n\t\t}),\n\t);\n}\n\n/**\n * First-party plugins of an explicitly selected Profile are trusted by\n * default: builtins ship with the product and the user chose the Profile\n * explicitly. Installed third-party versions are still verified through the\n * active-binding resolver; host-injected verifiedPlugins always win.\n */\nexport function defaultBuiltinVerifiedPluginsV1(profileId: string): readonly VerifiedToolPluginV1[] {\n\tconst profile = profiles.find((candidate) => candidate.id === profileId);\n\tif (profile === undefined) return [];\n\treturn profile.pluginIds.flatMap((pluginId) => {\n\t\tconst manifest = manifests[pluginId];\n\t\treturn manifest === undefined ? [] : [{ pluginId: manifest.id, version: manifest.pluginVersion }];\n\t});\n}\n\nexport function resolveBuiltinPluginProfileV1(input: {\n\treadonly profileId: string;\n\treadonly host: HostFactsV1;\n\t/** Optional subset of the selected builtin Profile's plugins. */\n\treadonly selectedPluginIds?: readonly string[];\n\treadonly disabledPluginIds?: readonly string[];\n\treadonly verifiedPlugins?: readonly VerifiedToolPluginV1[];\n\t/** Explicit host-selected active manifests; never inferred from disk. */\n\treadonly manifestOverrides?: BuiltinPluginManifestOverridesV1;\n}): BuiltinPluginProfileResolutionV1 {\n\tconst profile = profiles.find((candidate) => candidate.id === input.profileId);\n\tif (profile === undefined) return { status: \"not_found\", profileId: input.profileId };\n\tconst requestedPluginIds = input.selectedPluginIds;\n\tconst requestedDisabledPluginIds = input.disabledPluginIds;\n\tif (requestedPluginIds !== undefined || requestedDisabledPluginIds !== undefined) {\n\t\tconst availablePluginIds = new Set(profile.pluginIds);\n\t\tconst duplicatePluginIds: string[] = [];\n\t\tconst unknownPluginIds: string[] = [];\n\t\tfor (const requestedIds of [requestedPluginIds ?? [], requestedDisabledPluginIds ?? []]) {\n\t\t\tconst seen = new Set<string>();\n\t\t\tfor (const pluginId of requestedIds) {\n\t\t\t\tif (!availablePluginIds.has(pluginId) && !unknownPluginIds.includes(pluginId))\n\t\t\t\t\tunknownPluginIds.push(pluginId);\n\t\t\t\tif (seen.has(pluginId) && !duplicatePluginIds.includes(pluginId)) duplicatePluginIds.push(pluginId);\n\t\t\t\tseen.add(pluginId);\n\t\t\t}\n\t\t}\n\t\tif (unknownPluginIds.length > 0 || duplicatePluginIds.length > 0) {\n\t\t\treturn {\n\t\t\t\tstatus: \"invalid_selection\",\n\t\t\t\tprofileId: input.profileId,\n\t\t\t\tunknownPluginIds: Object.freeze([...new Set(unknownPluginIds)]),\n\t\t\t\tduplicatePluginIds: Object.freeze(duplicatePluginIds),\n\t\t\t};\n\t\t}\n\t}\n\tconst selected =\n\t\trequestedPluginIds === undefined\n\t\t\t? profile.pluginIds\n\t\t\t: profile.pluginIds.filter((pluginId) => requestedPluginIds.includes(pluginId));\n\tconst selectedProfile =\n\t\trequestedPluginIds === undefined\n\t\t\t? profile\n\t\t\t: Object.freeze({ ...profile, pluginIds: Object.freeze([...selected]) });\n\tconst disabled = new Set(input.disabledPluginIds ?? []);\n\t// D-075 S2: a Profile plugin without a builtin manifest and without a\n\t// host-installed override is a structured miss, not a startup failure. The\n\t// plugin is omitted from the resolved manifest and runtime bindings; the\n\t// remaining Profile plugins resolve normally (soft degradation).\n\tconst manifestByPluginId = new Map(\n\t\tselectedProfile.pluginIds.map((pluginId) => [pluginId, manifestFor(pluginId, input.manifestOverrides)] as const),\n\t);\n\tconst missingPluginIds = selectedProfile.pluginIds.filter(\n\t\t(pluginId) => manifestByPluginId.get(pluginId) === undefined,\n\t);\n\tconst resolution = resolvePluginProfileV1({\n\t\tprofileId: selectedProfile.id,\n\t\tprofileVersion: selectedProfile.version,\n\t\tplugins: selectedProfile.pluginIds.flatMap((pluginId) => {\n\t\t\tconst manifest = manifestByPluginId.get(pluginId);\n\t\t\treturn manifest === undefined\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\t\t// A user-disabled plugin must not block the remaining profile. It is\n\t\t\t\t\t\t\t// still represented in the resolution diagnostics, but is omitted from\n\t\t\t\t\t\t\t// the active resolved manifest and runtime bindings.\n\t\t\t\t\t\t\trequired: !disabled.has(pluginId),\n\t\t\t\t\t\t\tdisabled: disabled.has(pluginId),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t}),\n\t\thost: input.host,\n\t\t// The host's own version enforces each manifest's minHostVersion floor\n\t\t// at the single builtin profile resolution funnel used by production\n\t\t// loading paths.\n\t\thostVersion: VERSION,\n\t});\n\tconst merged = mergeMissingPluginResolutionsV1(resolution, missingPluginIds, disabled);\n\tif (merged.status !== \"ready\") return { status: \"resolved\", profile: selectedProfile, resolution: merged };\n\tconst resolvedPlugins = merged.resolvedManifest.plugins.map((plugin) => ({\n\t\tpluginId: plugin.pluginId,\n\t\tpluginVersion: plugin.pluginVersion,\n\t\tcapabilityRefs: plugin.capabilityRefs,\n\t\t...(plugin.selectedAdapter === undefined ? {} : { selectedAdapter: plugin.selectedAdapter }),\n\t}));\n\tconst verifiedPlugins = input.verifiedPlugins ?? [];\n\tconst assembly = assembleProfile({\n\t\tprofileId: selectedProfile.id,\n\t\tprofileVersion: selectedProfile.version,\n\t\tresolvedPlugins,\n\t\tverifiedPlugins,\n\t});\n\treturn {\n\t\tstatus: \"resolved\",\n\t\tprofile: selectedProfile,\n\t\tresolution: merged,\n\t\tassembly,\n\t};\n}\n\nfunction manifestFor(\n\tpluginId: string,\n\toverrides: BuiltinPluginManifestOverridesV1 | undefined,\n): PluginManifestV1 | undefined {\n\tconst manifest = overrides?.[pluginId] ?? manifests[pluginId];\n\t// A mismatched override stays a hard host error: the host selected it\n\t// explicitly, so silence would hide an identity bug. A plain absent\n\t// manifest (no builtin, no installed override) is the structured miss.\n\tif (manifest !== undefined && manifest.id !== pluginId)\n\t\tthrow new Error(t(\"builtin manifest override does not match plugin {pluginId}\", { pluginId }));\n\treturn manifest;\n}\n\n/**\n * Merge structured `manifest_missing` resolutions for Profile plugins that\n * have no builtin manifest and no installed override into the resolver\n * result. Missing plugins never block the Profile (soft degradation): the\n * remaining diagnostics and the resolved manifest stay exactly what the\n * resolver produced, and the merged plugin list keeps the resolver's\n * deterministic id sort.\n */\nfunction mergeMissingPluginResolutionsV1(\n\tresolution: ProfileResolutionV1,\n\tmissingPluginIds: readonly string[],\n\tdisabled: ReadonlySet<string>,\n): ProfileResolutionV1 {\n\tif (missingPluginIds.length === 0) return resolution;\n\tconst missing: PluginResolutionV1[] = missingPluginIds.map((pluginId) => ({\n\t\tpluginId,\n\t\tpluginVersion: \"\",\n\t\trequired: !disabled.has(pluginId),\n\t\tstatus: \"manifest-missing\",\n\t\tdiagnostics: [\n\t\t\t{\n\t\t\t\tcode: \"manifest_missing\",\n\t\t\t\tmessage: `Plugin ${pluginId} has no builtin manifest and no installed active override; the plugin is omitted from this profile (install it with agent-forge plugin install)`,\n\t\t\t},\n\t\t],\n\t}));\n\tconst plugins = [...resolution.plugins, ...missing].sort((left, right) =>\n\t\tleft.pluginId.localeCompare(right.pluginId),\n\t);\n\treturn Object.freeze({\n\t\t...resolution,\n\t\tplugins: Object.freeze(plugins),\n\t\tdiagnostics: Object.freeze(plugins.flatMap((plugin) => plugin.diagnostics)),\n\t});\n}\n"]}
@@ -52,8 +52,16 @@ export declare const SUITE_SCHEMA_VERSION = 1;
52
52
  * (ninth package) and the suite capability declaration at goal/plan/todo-set
53
53
  * parity, keeping its plugin form. Existing workspaces provisioned at revision
54
54
  * 5 receive the upgrade-proposal diagnostic and adopt via `--suite-reset`.
55
+ *
56
+ * Revision 7 (视觉保底, 2026-10-04): the two visual baseline roles
57
+ * `design-proposer` / `visual-reviewer` join the factory seeds and the default
58
+ * `associations.roles` (user ruling "术有专攻、角色隔离"; role files are
59
+ * disk-only and the seeds never overwrite user edits — see
60
+ * `docs/plans/视觉保底角色设计注记.md`). Existing workspaces provisioned at
61
+ * revision 6 receive the upgrade-proposal diagnostic and adopt via
62
+ * `--suite-reset`.
55
63
  */
56
- export declare const FACTORY_CONTENTS_VERSION = 6;
64
+ export declare const FACTORY_CONTENTS_VERSION = 7;
57
65
  /**
58
66
  * Factory default suite used when no suite is configured anywhere (设计 §9).
59
67
  * 2026-10-02 user ruling: the product is a coding agent, so the factory
@@ -77,7 +85,11 @@ export declare const BUILTIN_SUITE_TOOLS: readonly string[];
77
85
  * unconfigured default answers `/share` with the explicit configuration
78
86
  * prompt — never an implicit Radius/Gist fallback. `builtin.workflow` joins
79
87
  * at goal/plan/todo-set parity (D-077, 2026-10-02: factory default install
80
- * plus this suite declaration, plugin form unchanged).
88
+ * plus this suite declaration, plugin form unchanged). `builtin.coding-tools`
89
+ * joins with the D-082 batch-1 tool split (2026-10-03): the default coding
90
+ * tools assemble from the `plugins/coding-tools` package through the bundled
91
+ * distribution channel (插件独立分发与启动装配设计 §4.9), not the install
92
+ * store.
81
93
  */
82
94
  export declare const BUILTIN_SUITE_CAPABILITIES: readonly string[];
83
95
  export type SuiteMemoryStrategy = "assistant" | "code";
@@ -132,9 +144,11 @@ export interface SuiteDefinition {
132
144
  readonly factoryRevision?: number;
133
145
  }
134
146
  /**
135
- * 默认方案关联的子代理角色(开箱即用):这两个 id 对应工厂种子落盘的两个普通角色文件
136
- * (`<agentDir>/roles/{explore,reviewer}.json`,用户可改可删)。工厂不在运行期回退到任何
137
- * 编译内的角色定义;删掉文件只会让该关联成为 dangling 诊断。
147
+ * 默认方案关联的子代理角色(开箱即用):这四个 id 对应工厂种子落盘的四个普通角色文件
148
+ * (`<agentDir>/roles/{explore,reviewer,design-proposer,visual-reviewer}.json`,用户可改可删)。
149
+ * design-proposer / visual-reviewer 是视觉保底角色(2026-10-04 用户裁决"术有专攻、角色隔离"),
150
+ * 档案 readonly + 只读工具收窄,与编码角色结构性隔离——见 docs/plans/视觉保底角色设计注记.md。
151
+ * 工厂不在运行期回退到任何编译内的角色定义;删掉文件只会让该关联成为 dangling 诊断。
138
152
  */
139
153
  export declare const DEFAULT_ROLE_ASSOCIATIONS: readonly string[];
140
154
  /** The factory builtin pair: coding (factory default 尖刀) and assistant (fallback). */