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

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 (360) hide show
  1. package/CHANGELOG.md +29 -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 +61 -117
  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-CIX3FSBK.js → chunk-A3JYRWB6.js} +1 -1
  117. package/dist/bundle/chunks/{chunk-SQFG22WN.js → chunk-AC2FIS4G.js} +1 -1
  118. package/dist/bundle/chunks/chunk-AQLNTW2B.js +664 -0
  119. package/dist/bundle/chunks/chunk-D3ARGZFR.js +13 -0
  120. package/dist/bundle/chunks/{chunk-YJCQVXW5.js → chunk-HTEVUY7F.js} +1 -1
  121. package/dist/bundle/chunks/{chunk-Y7HXTASS.js → chunk-HV64ASMT.js} +1 -1
  122. package/dist/bundle/chunks/chunk-LZOEQITZ.js +855 -0
  123. package/dist/bundle/chunks/{chunk-7ZY7IXZD.js → chunk-TRDNDS6A.js} +1 -1
  124. package/dist/bundle/chunks/chunk-Z72JWUZ4.js +4 -0
  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 +2 -2
  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-WF6WRHP7.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 +17 -1
  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 +1 -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.map +1 -1
  168. package/dist/core/agent-session-services.js +30 -9
  169. package/dist/core/agent-session-services.js.map +1 -1
  170. package/dist/core/agent-session-tools.d.ts.map +1 -1
  171. package/dist/core/agent-session-tools.js +5 -1
  172. package/dist/core/agent-session-tools.js.map +1 -1
  173. package/dist/core/agent-session.d.ts +12 -13
  174. package/dist/core/agent-session.d.ts.map +1 -1
  175. package/dist/core/agent-session.js +56 -34
  176. package/dist/core/agent-session.js.map +1 -1
  177. package/dist/core/bash-executor.d.ts +1 -1
  178. package/dist/core/bash-executor.d.ts.map +1 -1
  179. package/dist/core/bash-executor.js.map +1 -1
  180. package/dist/core/extensions/bootstrap-agent-loop.d.ts +23 -151
  181. package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
  182. package/dist/core/extensions/bootstrap-agent-loop.js +28 -290
  183. package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
  184. package/dist/core/extensions/capability-runtime-types.d.ts +5 -3
  185. package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
  186. package/dist/core/extensions/capability-runtime-types.js.map +1 -1
  187. package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
  188. package/dist/core/extensions/capability-runtime.js +42 -6
  189. package/dist/core/extensions/capability-runtime.js.map +1 -1
  190. package/dist/core/extensions/index.d.ts +12 -5
  191. package/dist/core/extensions/index.d.ts.map +1 -1
  192. package/dist/core/extensions/index.js +12 -5
  193. package/dist/core/extensions/index.js.map +1 -1
  194. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  195. package/dist/core/extensions/virtual-modules.js +65 -0
  196. package/dist/core/extensions/virtual-modules.js.map +1 -1
  197. package/dist/core/facade/coding-agent-facade.d.ts +1 -1
  198. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  199. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  200. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +1 -1
  201. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -1
  202. package/dist/core/i18n/locales/zh-cn/core-contract-core.js +1 -1
  203. package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -1
  204. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -1
  205. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +2 -4
  206. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -1
  207. package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
  208. package/dist/core/i18n/locales/zh-cn/core-errors.js +3 -1
  209. package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
  210. package/dist/core/sdk.d.ts +10 -3
  211. package/dist/core/sdk.d.ts.map +1 -1
  212. package/dist/core/sdk.js +263 -77
  213. package/dist/core/sdk.js.map +1 -1
  214. package/dist/core/tools/bash-operations.d.ts +41 -0
  215. package/dist/core/tools/bash-operations.d.ts.map +1 -0
  216. package/dist/core/tools/bash-operations.js +113 -0
  217. package/dist/core/tools/bash-operations.js.map +1 -0
  218. package/dist/core/tools/index.d.ts +12 -36
  219. package/dist/core/tools/index.d.ts.map +1 -1
  220. package/dist/core/tools/index.js +1 -117
  221. package/dist/core/tools/index.js.map +1 -1
  222. package/dist/core/tools/readme-path.d.ts +3 -0
  223. package/dist/core/tools/readme-path.d.ts.map +1 -0
  224. package/dist/core/tools/readme-path.js +15 -0
  225. package/dist/core/tools/readme-path.js.map +1 -0
  226. package/dist/index.d.ts +3 -19
  227. package/dist/index.d.ts.map +1 -1
  228. package/dist/index.js +6 -39
  229. package/dist/index.js.map +1 -1
  230. package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
  231. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  232. package/dist/modes/interactive/components/tool-execution.js +9 -25
  233. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  234. package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
  235. package/dist/plugins/ecosystem/cli.js +14 -2
  236. package/dist/plugins/ecosystem/cli.js.map +1 -1
  237. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts +7 -2
  238. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
  239. package/dist/plugins/ecosystem/node-npm-registry-source.js +64 -9
  240. package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
  241. package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts.map +1 -1
  242. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js +6 -0
  243. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js.map +1 -1
  244. package/dist/profiles/builtin-suites.d.ts +5 -1
  245. package/dist/profiles/builtin-suites.d.ts.map +1 -1
  246. package/dist/profiles/builtin-suites.js +6 -1
  247. package/dist/profiles/builtin-suites.js.map +1 -1
  248. package/examples/extensions/bash-spawn-hook/index.ts +7 -2
  249. package/examples/extensions/built-in-tool-renderer/index.ts +4 -2
  250. package/examples/extensions/minimal-mode/index.ts +2 -2
  251. package/examples/extensions/truncated-tool/index.ts +1 -1
  252. package/examples/extensions/with-deps/package-lock.json +2 -2
  253. package/examples/extensions/with-deps/package.json +1 -1
  254. package/examples/extensions/with-deps/plugin.json +1 -1
  255. package/package.json +3 -2
  256. package/dist/bundle/chunks/chunk-6ZKDNZHA.js +0 -145
  257. package/dist/bundle/chunks/chunk-HLJEVRWP.js +0 -13
  258. package/dist/bundle/chunks/chunk-YGHQME4V.js +0 -1456
  259. package/dist/bundle/chunks/virtual-modules-KZ5DRH7Q.js +0 -2
  260. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts +0 -7
  261. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts.map +0 -1
  262. package/dist/core/extensions/bootstrap-branch-summary-policy.js +0 -28
  263. package/dist/core/extensions/bootstrap-branch-summary-policy.js.map +0 -1
  264. package/dist/core/extensions/bootstrap-compaction-policy.d.ts +0 -7
  265. package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +0 -1
  266. package/dist/core/extensions/bootstrap-compaction-policy.js +0 -48
  267. package/dist/core/extensions/bootstrap-compaction-policy.js.map +0 -1
  268. package/dist/core/extensions/bootstrap-overflow-policy.d.ts +0 -7
  269. package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +0 -1
  270. package/dist/core/extensions/bootstrap-overflow-policy.js +0 -30
  271. package/dist/core/extensions/bootstrap-overflow-policy.js.map +0 -1
  272. package/dist/core/extensions/bootstrap-retry-policy.d.ts +0 -7
  273. package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +0 -1
  274. package/dist/core/extensions/bootstrap-retry-policy.js +0 -29
  275. package/dist/core/extensions/bootstrap-retry-policy.js.map +0 -1
  276. package/dist/core/extensions/bootstrap-tools.d.ts +0 -20
  277. package/dist/core/extensions/bootstrap-tools.d.ts.map +0 -1
  278. package/dist/core/extensions/bootstrap-tools.js +0 -36
  279. package/dist/core/extensions/bootstrap-tools.js.map +0 -1
  280. package/dist/core/extensions/provider-failover.d.ts +0 -110
  281. package/dist/core/extensions/provider-failover.d.ts.map +0 -1
  282. package/dist/core/extensions/provider-failover.js.map +0 -1
  283. package/dist/core/tools/bash.d.ts.map +0 -1
  284. package/dist/core/tools/bash.js.map +0 -1
  285. package/dist/core/tools/edit.d.ts.map +0 -1
  286. package/dist/core/tools/edit.js.map +0 -1
  287. package/dist/core/tools/find.d.ts.map +0 -1
  288. package/dist/core/tools/find.js.map +0 -1
  289. package/dist/core/tools/grep.d.ts.map +0 -1
  290. package/dist/core/tools/grep.js.map +0 -1
  291. package/dist/core/tools/ls.d.ts.map +0 -1
  292. package/dist/core/tools/powershell.d.ts.map +0 -1
  293. package/dist/core/tools/powershell.js.map +0 -1
  294. package/dist/core/tools/read.d.ts.map +0 -1
  295. package/dist/core/tools/read.js.map +0 -1
  296. package/dist/core/tools/write.d.ts.map +0 -1
  297. package/dist/core/tools/write.js.map +0 -1
  298. package/dist/plugins/mcp-http.d.ts.map +0 -1
  299. package/dist/plugins/mcp-http.js.map +0 -1
  300. package/dist/profile/child-facade.d.ts +0 -44
  301. package/dist/profile/child-facade.d.ts.map +0 -1
  302. package/dist/profile/child-facade.js +0 -56
  303. package/dist/profile/child-facade.js.map +0 -1
  304. package/dist/profile/dependency-wiring.d.ts +0 -48
  305. package/dist/profile/dependency-wiring.d.ts.map +0 -1
  306. package/dist/profile/dependency-wiring.js +0 -56
  307. package/dist/profile/dependency-wiring.js.map +0 -1
  308. package/dist/profile/domain-recovery.d.ts +0 -60
  309. package/dist/profile/domain-recovery.d.ts.map +0 -1
  310. package/dist/profile/domain-recovery.js +0 -94
  311. package/dist/profile/domain-recovery.js.map +0 -1
  312. package/dist/profile/first-roles.d.ts +0 -30
  313. package/dist/profile/first-roles.d.ts.map +0 -1
  314. package/dist/profile/first-roles.js +0 -83
  315. package/dist/profile/first-roles.js.map +0 -1
  316. package/dist/profile/goal-plugin.d.ts +0 -38
  317. package/dist/profile/goal-plugin.d.ts.map +0 -1
  318. package/dist/profile/goal-plugin.js +0 -132
  319. package/dist/profile/goal-plugin.js.map +0 -1
  320. package/dist/profile/plan-plugin.d.ts +0 -44
  321. package/dist/profile/plan-plugin.d.ts.map +0 -1
  322. package/dist/profile/plan-plugin.js +0 -157
  323. package/dist/profile/plan-plugin.js.map +0 -1
  324. package/dist/profile/policy-manifest.d.ts +0 -53
  325. package/dist/profile/policy-manifest.d.ts.map +0 -1
  326. package/dist/profile/policy-manifest.js +0 -53
  327. package/dist/profile/policy-manifest.js.map +0 -1
  328. package/dist/profile/role-assembly.d.ts +0 -47
  329. package/dist/profile/role-assembly.d.ts.map +0 -1
  330. package/dist/profile/role-assembly.js +0 -31
  331. package/dist/profile/role-assembly.js.map +0 -1
  332. package/dist/profile/role-catalog.d.ts +0 -43
  333. package/dist/profile/role-catalog.d.ts.map +0 -1
  334. package/dist/profile/role-catalog.js +0 -132
  335. package/dist/profile/role-catalog.js.map +0 -1
  336. package/dist/profile/role-orchestrator.d.ts +0 -123
  337. package/dist/profile/role-orchestrator.d.ts.map +0 -1
  338. package/dist/profile/role-orchestrator.js +0 -195
  339. package/dist/profile/role-orchestrator.js.map +0 -1
  340. package/dist/profile/role-runner.d.ts +0 -99
  341. package/dist/profile/role-runner.d.ts.map +0 -1
  342. package/dist/profile/role-runner.js +0 -79
  343. package/dist/profile/role-runner.js.map +0 -1
  344. package/dist/profile/root-facade.d.ts +0 -36
  345. package/dist/profile/root-facade.d.ts.map +0 -1
  346. package/dist/profile/root-facade.js +0 -49
  347. package/dist/profile/root-facade.js.map +0 -1
  348. package/dist/profile/skill-discovery-wiring.d.ts +0 -58
  349. package/dist/profile/skill-discovery-wiring.d.ts.map +0 -1
  350. package/dist/profile/skill-discovery-wiring.js +0 -80
  351. package/dist/profile/skill-discovery-wiring.js.map +0 -1
  352. package/dist/profile/state-store.d.ts +0 -62
  353. package/dist/profile/state-store.d.ts.map +0 -1
  354. package/dist/profile/state-store.js +0 -144
  355. package/dist/profile/state-store.js.map +0 -1
  356. package/dist/profile/todo-plugin.d.ts +0 -37
  357. package/dist/profile/todo-plugin.d.ts.map +0 -1
  358. package/dist/profile/todo-plugin.js +0 -137
  359. package/dist/profile/todo-plugin.js.map +0 -1
  360. /package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.d.ts +0 -0
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
3
- import{APP_NAME,configureHttpDispatcher,main}from"./chunks/chunk-YGHQME4V.js";import"./chunks/chunk-JUUC5AZY.js";import"./chunks/chunk-6ZKDNZHA.js";import"./chunks/chunk-XDUWOHPL.js";import"./chunks/chunk-3QKHSPQL.js";import"./chunks/chunk-HLJEVRWP.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-7ZY7IXZD.js";import"./chunks/chunk-Y7HXTASS.js";import"./chunks/chunk-CIX3FSBK.js";import"./chunks/chunk-4L3WN2XY.js";process.title=`${APP_NAME}-rpc`;process.env.AGENT_FORGE="true";process.env.AI_AGENT="agent-forge";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
3
+ import{configureHttpDispatcher,main}from"./chunks/chunk-LZOEQITZ.js";import{APP_NAME}from"./chunks/chunk-AQLNTW2B.js";import"./chunks/chunk-JUUC5AZY.js";import"./chunks/chunk-XDUWOHPL.js";import"./chunks/chunk-3QKHSPQL.js";import"./chunks/chunk-D3ARGZFR.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-TRDNDS6A.js";import"./chunks/chunk-HV64ASMT.js";import"./chunks/chunk-A3JYRWB6.js";import"./chunks/chunk-4L3WN2XY.js";process.title=`${APP_NAME}-rpc`;process.env.AGENT_FORGE="true";process.env.AI_AGENT="agent-forge";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
@@ -26,7 +26,7 @@
26
26
  * mapping form (工作流编排插件设计 §12 M3, 2026-10-01): `plugins/workflow`
27
27
  * assembles through the install store like the rest of the family.
28
28
  */
29
- export declare const BUILTIN_CAPABILITY_PACKAGE_IDS: Readonly<Record<"builtin.goal" | "builtin.plan" | "builtin.todo-set" | "builtin.session-share" | "builtin.subagent-delegate" | "builtin.memory" | "builtin.workflow", string>>;
29
+ export declare const BUILTIN_CAPABILITY_PACKAGE_IDS: Readonly<Record<"builtin.goal" | "builtin.plan" | "builtin.todo-set" | "builtin.session-share" | "builtin.subagent-delegate" | "builtin.memory" | "builtin.workflow" | "builtin.coding-tools", string>>;
30
30
  /** Suite short ids (suite.json `capabilities`) of the builtin capability family. */
31
31
  export declare const BUILTIN_CAPABILITY_IDS: readonly string[];
32
32
  //# sourceMappingURL=builtin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/capabilities/builtin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CACpD,MAAM,CACH,cAAc,GACd,cAAc,GACd,kBAAkB,GAClB,uBAAuB,GACvB,2BAA2B,GAC3B,gBAAgB,GAChB,kBAAkB,EACpB,MAAM,CACN,CASA,CAAC;AAEH,oFAAoF;AACpF,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAQnD,CAAC","sourcesContent":["/**\n * Suite short-id mapping for the first-party capability family (方案系统 M3,\n * docs/plans/方案实施计划.md §8).\n *\n * D-075 S4 (all four batches): every first-party capability has been split\n * out of the host — `builtin.goal`/`builtin.plan`/`builtin.todo-set`/\n * `builtin.session-share`/`builtin.subagent-delegate` and, with the fourth\n * batch, `builtin.memory` assemble from the independent `plugins/<name>`\n * packages through the install store (see\n * {@link BUILTIN_CAPABILITY_PACKAGE_IDS}). The host carries NO embedded\n * capability registry anymore — the retired `resolveBuiltinCapabilities`\n * assembly entry was deleted with its last sdk consumer (S5 embedded-path\n * retirement): unknown suite short ids surface as dangling diagnostics in\n * the sdk assembly chain, never as errors. The agent-dir config channel\n * (`<agentDir>/capabilities/<short-id>.json`) moved into the packages' own\n * entries; host services ride the public HostCapabilities\n * (`api.host.agentDir`/`communication`/`turnContext`/`roleAssociations`/\n * `memoryStorage`).\n */\n\n/**\n * Suite short ids (suite.json `capabilities`) that map onto INDEPENDENT plugin\n * packages after the S4 split (D-075 §6 S4, all four batches): none of them\n * have embedded implementations — they assemble from the corresponding\n * `plugins/<name>` packages through the install store (bootstrap factory\n * manifest or explicit `plugin install`). `builtin.workflow` joins the same\n * mapping form (工作流编排插件设计 §12 M3, 2026-10-01): `plugins/workflow`\n * assembles through the install store like the rest of the family.\n */\nexport const BUILTIN_CAPABILITY_PACKAGE_IDS: Readonly<\n\tRecord<\n\t\t| \"builtin.goal\"\n\t\t| \"builtin.plan\"\n\t\t| \"builtin.todo-set\"\n\t\t| \"builtin.session-share\"\n\t\t| \"builtin.subagent-delegate\"\n\t\t| \"builtin.memory\"\n\t\t| \"builtin.workflow\",\n\t\tstring\n\t>\n> = Object.freeze({\n\t\"builtin.goal\": \"agent-forge.plugin.goal\",\n\t\"builtin.plan\": \"agent-forge.plugin.plan\",\n\t\"builtin.todo-set\": \"agent-forge.plugin.todo-set\",\n\t\"builtin.session-share\": \"agent-forge.plugin.session-share\",\n\t\"builtin.subagent-delegate\": \"agent-forge.plugin.subagent-delegate\",\n\t\"builtin.memory\": \"agent-forge.plugin.memory\",\n\t\"builtin.workflow\": \"agent-forge.plugin.workflow\",\n});\n\n/** Suite short ids (suite.json `capabilities`) of the builtin capability family. */\nexport const BUILTIN_CAPABILITY_IDS: readonly string[] = [\n\t\"builtin.goal\",\n\t\"builtin.plan\",\n\t\"builtin.todo-set\",\n\t\"builtin.memory\",\n\t\"builtin.session-share\",\n\t\"builtin.subagent-delegate\",\n\t\"builtin.workflow\",\n];\n"]}
1
+ {"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/capabilities/builtin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CACpD,MAAM,CACH,cAAc,GACd,cAAc,GACd,kBAAkB,GAClB,uBAAuB,GACvB,2BAA2B,GAC3B,gBAAgB,GAChB,kBAAkB,GAClB,sBAAsB,EACxB,MAAM,CACN,CAaA,CAAC;AAEH,oFAAoF;AACpF,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EASnD,CAAC","sourcesContent":["/**\n * Suite short-id mapping for the first-party capability family (方案系统 M3,\n * docs/plans/方案实施计划.md §8).\n *\n * D-075 S4 (all four batches): every first-party capability has been split\n * out of the host — `builtin.goal`/`builtin.plan`/`builtin.todo-set`/\n * `builtin.session-share`/`builtin.subagent-delegate` and, with the fourth\n * batch, `builtin.memory` assemble from the independent `plugins/<name>`\n * packages through the install store (see\n * {@link BUILTIN_CAPABILITY_PACKAGE_IDS}). The host carries NO embedded\n * capability registry anymore — the retired `resolveBuiltinCapabilities`\n * assembly entry was deleted with its last sdk consumer (S5 embedded-path\n * retirement): unknown suite short ids surface as dangling diagnostics in\n * the sdk assembly chain, never as errors. The agent-dir config channel\n * (`<agentDir>/capabilities/<short-id>.json`) moved into the packages' own\n * entries; host services ride the public HostCapabilities\n * (`api.host.agentDir`/`communication`/`turnContext`/`roleAssociations`/\n * `memoryStorage`).\n */\n\n/**\n * Suite short ids (suite.json `capabilities`) that map onto INDEPENDENT plugin\n * packages after the S4 split (D-075 §6 S4, all four batches): none of them\n * have embedded implementations — they assemble from the corresponding\n * `plugins/<name>` packages through the install store (bootstrap factory\n * manifest or explicit `plugin install`). `builtin.workflow` joins the same\n * mapping form (工作流编排插件设计 §12 M3, 2026-10-01): `plugins/workflow`\n * assembles through the install store like the rest of the family.\n */\nexport const BUILTIN_CAPABILITY_PACKAGE_IDS: Readonly<\n\tRecord<\n\t\t| \"builtin.goal\"\n\t\t| \"builtin.plan\"\n\t\t| \"builtin.todo-set\"\n\t\t| \"builtin.session-share\"\n\t\t| \"builtin.subagent-delegate\"\n\t\t| \"builtin.memory\"\n\t\t| \"builtin.workflow\"\n\t\t| \"builtin.coding-tools\",\n\t\tstring\n\t>\n> = Object.freeze({\n\t\"builtin.goal\": \"agent-forge.plugin.goal\",\n\t\"builtin.plan\": \"agent-forge.plugin.plan\",\n\t\"builtin.todo-set\": \"agent-forge.plugin.todo-set\",\n\t\"builtin.session-share\": \"agent-forge.plugin.session-share\",\n\t\"builtin.subagent-delegate\": \"agent-forge.plugin.subagent-delegate\",\n\t\"builtin.memory\": \"agent-forge.plugin.memory\",\n\t\"builtin.workflow\": \"agent-forge.plugin.workflow\",\n\t// D-082 批 1(S6 工具批):默认编码工具迁出为 plugins/coding-tools 独立包,\n\t// 经 bundled 分发通道(§4.9)装载;退役的内嵌 bootstrap-tools 插件 id\n\t// 不再进入映射。\n\t\"builtin.coding-tools\": \"agent-forge.plugin.coding-tools\",\n});\n\n/** Suite short ids (suite.json `capabilities`) of the builtin capability family. */\nexport const BUILTIN_CAPABILITY_IDS: readonly string[] = [\n\t\"builtin.goal\",\n\t\"builtin.plan\",\n\t\"builtin.todo-set\",\n\t\"builtin.memory\",\n\t\"builtin.session-share\",\n\t\"builtin.subagent-delegate\",\n\t\"builtin.workflow\",\n\t\"builtin.coding-tools\",\n];\n"]}
@@ -34,6 +34,10 @@ export const BUILTIN_CAPABILITY_PACKAGE_IDS = Object.freeze({
34
34
  "builtin.subagent-delegate": "agent-forge.plugin.subagent-delegate",
35
35
  "builtin.memory": "agent-forge.plugin.memory",
36
36
  "builtin.workflow": "agent-forge.plugin.workflow",
37
+ // D-082 批 1(S6 工具批):默认编码工具迁出为 plugins/coding-tools 独立包,
38
+ // 经 bundled 分发通道(§4.9)装载;退役的内嵌 bootstrap-tools 插件 id
39
+ // 不再进入映射。
40
+ "builtin.coding-tools": "agent-forge.plugin.coding-tools",
37
41
  });
38
42
  /** Suite short ids (suite.json `capabilities`) of the builtin capability family. */
39
43
  export const BUILTIN_CAPABILITY_IDS = [
@@ -44,5 +48,6 @@ export const BUILTIN_CAPABILITY_IDS = [
44
48
  "builtin.session-share",
45
49
  "builtin.subagent-delegate",
46
50
  "builtin.workflow",
51
+ "builtin.coding-tools",
47
52
  ];
48
53
  //# sourceMappingURL=builtin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"builtin.js","sourceRoot":"","sources":["../../src/capabilities/builtin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAWvC,MAAM,CAAC,MAAM,CAAC;IACjB,cAAc,EAAE,yBAAyB;IACzC,cAAc,EAAE,yBAAyB;IACzC,kBAAkB,EAAE,6BAA6B;IACjD,uBAAuB,EAAE,kCAAkC;IAC3D,2BAA2B,EAAE,sCAAsC;IACnE,gBAAgB,EAAE,2BAA2B;IAC7C,kBAAkB,EAAE,6BAA6B;CACjD,CAAC,CAAC;AAEH,oFAAoF;AACpF,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACxD,cAAc;IACd,cAAc;IACd,kBAAkB;IAClB,gBAAgB;IAChB,uBAAuB;IACvB,2BAA2B;IAC3B,kBAAkB;CAClB,CAAC","sourcesContent":["/**\n * Suite short-id mapping for the first-party capability family (方案系统 M3,\n * docs/plans/方案实施计划.md §8).\n *\n * D-075 S4 (all four batches): every first-party capability has been split\n * out of the host — `builtin.goal`/`builtin.plan`/`builtin.todo-set`/\n * `builtin.session-share`/`builtin.subagent-delegate` and, with the fourth\n * batch, `builtin.memory` assemble from the independent `plugins/<name>`\n * packages through the install store (see\n * {@link BUILTIN_CAPABILITY_PACKAGE_IDS}). The host carries NO embedded\n * capability registry anymore — the retired `resolveBuiltinCapabilities`\n * assembly entry was deleted with its last sdk consumer (S5 embedded-path\n * retirement): unknown suite short ids surface as dangling diagnostics in\n * the sdk assembly chain, never as errors. The agent-dir config channel\n * (`<agentDir>/capabilities/<short-id>.json`) moved into the packages' own\n * entries; host services ride the public HostCapabilities\n * (`api.host.agentDir`/`communication`/`turnContext`/`roleAssociations`/\n * `memoryStorage`).\n */\n\n/**\n * Suite short ids (suite.json `capabilities`) that map onto INDEPENDENT plugin\n * packages after the S4 split (D-075 §6 S4, all four batches): none of them\n * have embedded implementations — they assemble from the corresponding\n * `plugins/<name>` packages through the install store (bootstrap factory\n * manifest or explicit `plugin install`). `builtin.workflow` joins the same\n * mapping form (工作流编排插件设计 §12 M3, 2026-10-01): `plugins/workflow`\n * assembles through the install store like the rest of the family.\n */\nexport const BUILTIN_CAPABILITY_PACKAGE_IDS: Readonly<\n\tRecord<\n\t\t| \"builtin.goal\"\n\t\t| \"builtin.plan\"\n\t\t| \"builtin.todo-set\"\n\t\t| \"builtin.session-share\"\n\t\t| \"builtin.subagent-delegate\"\n\t\t| \"builtin.memory\"\n\t\t| \"builtin.workflow\",\n\t\tstring\n\t>\n> = Object.freeze({\n\t\"builtin.goal\": \"agent-forge.plugin.goal\",\n\t\"builtin.plan\": \"agent-forge.plugin.plan\",\n\t\"builtin.todo-set\": \"agent-forge.plugin.todo-set\",\n\t\"builtin.session-share\": \"agent-forge.plugin.session-share\",\n\t\"builtin.subagent-delegate\": \"agent-forge.plugin.subagent-delegate\",\n\t\"builtin.memory\": \"agent-forge.plugin.memory\",\n\t\"builtin.workflow\": \"agent-forge.plugin.workflow\",\n});\n\n/** Suite short ids (suite.json `capabilities`) of the builtin capability family. */\nexport const BUILTIN_CAPABILITY_IDS: readonly string[] = [\n\t\"builtin.goal\",\n\t\"builtin.plan\",\n\t\"builtin.todo-set\",\n\t\"builtin.memory\",\n\t\"builtin.session-share\",\n\t\"builtin.subagent-delegate\",\n\t\"builtin.workflow\",\n];\n"]}
1
+ {"version":3,"file":"builtin.js","sourceRoot":"","sources":["../../src/capabilities/builtin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAYvC,MAAM,CAAC,MAAM,CAAC;IACjB,cAAc,EAAE,yBAAyB;IACzC,cAAc,EAAE,yBAAyB;IACzC,kBAAkB,EAAE,6BAA6B;IACjD,uBAAuB,EAAE,kCAAkC;IAC3D,2BAA2B,EAAE,sCAAsC;IACnE,gBAAgB,EAAE,2BAA2B;IAC7C,kBAAkB,EAAE,6BAA6B;IACjD,gGAAwD;IACxD,wFAAqD;IACrD,wBAAU;IACV,sBAAsB,EAAE,iCAAiC;CACzD,CAAC,CAAC;AAEH,oFAAoF;AACpF,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACxD,cAAc;IACd,cAAc;IACd,kBAAkB;IAClB,gBAAgB;IAChB,uBAAuB;IACvB,2BAA2B;IAC3B,kBAAkB;IAClB,sBAAsB;CACtB,CAAC","sourcesContent":["/**\n * Suite short-id mapping for the first-party capability family (方案系统 M3,\n * docs/plans/方案实施计划.md §8).\n *\n * D-075 S4 (all four batches): every first-party capability has been split\n * out of the host — `builtin.goal`/`builtin.plan`/`builtin.todo-set`/\n * `builtin.session-share`/`builtin.subagent-delegate` and, with the fourth\n * batch, `builtin.memory` assemble from the independent `plugins/<name>`\n * packages through the install store (see\n * {@link BUILTIN_CAPABILITY_PACKAGE_IDS}). The host carries NO embedded\n * capability registry anymore — the retired `resolveBuiltinCapabilities`\n * assembly entry was deleted with its last sdk consumer (S5 embedded-path\n * retirement): unknown suite short ids surface as dangling diagnostics in\n * the sdk assembly chain, never as errors. The agent-dir config channel\n * (`<agentDir>/capabilities/<short-id>.json`) moved into the packages' own\n * entries; host services ride the public HostCapabilities\n * (`api.host.agentDir`/`communication`/`turnContext`/`roleAssociations`/\n * `memoryStorage`).\n */\n\n/**\n * Suite short ids (suite.json `capabilities`) that map onto INDEPENDENT plugin\n * packages after the S4 split (D-075 §6 S4, all four batches): none of them\n * have embedded implementations — they assemble from the corresponding\n * `plugins/<name>` packages through the install store (bootstrap factory\n * manifest or explicit `plugin install`). `builtin.workflow` joins the same\n * mapping form (工作流编排插件设计 §12 M3, 2026-10-01): `plugins/workflow`\n * assembles through the install store like the rest of the family.\n */\nexport const BUILTIN_CAPABILITY_PACKAGE_IDS: Readonly<\n\tRecord<\n\t\t| \"builtin.goal\"\n\t\t| \"builtin.plan\"\n\t\t| \"builtin.todo-set\"\n\t\t| \"builtin.session-share\"\n\t\t| \"builtin.subagent-delegate\"\n\t\t| \"builtin.memory\"\n\t\t| \"builtin.workflow\"\n\t\t| \"builtin.coding-tools\",\n\t\tstring\n\t>\n> = Object.freeze({\n\t\"builtin.goal\": \"agent-forge.plugin.goal\",\n\t\"builtin.plan\": \"agent-forge.plugin.plan\",\n\t\"builtin.todo-set\": \"agent-forge.plugin.todo-set\",\n\t\"builtin.session-share\": \"agent-forge.plugin.session-share\",\n\t\"builtin.subagent-delegate\": \"agent-forge.plugin.subagent-delegate\",\n\t\"builtin.memory\": \"agent-forge.plugin.memory\",\n\t\"builtin.workflow\": \"agent-forge.plugin.workflow\",\n\t// D-082 批 1(S6 工具批):默认编码工具迁出为 plugins/coding-tools 独立包,\n\t// 经 bundled 分发通道(§4.9)装载;退役的内嵌 bootstrap-tools 插件 id\n\t// 不再进入映射。\n\t\"builtin.coding-tools\": \"agent-forge.plugin.coding-tools\",\n});\n\n/** Suite short ids (suite.json `capabilities`) of the builtin capability family. */\nexport const BUILTIN_CAPABILITY_IDS: readonly string[] = [\n\t\"builtin.goal\",\n\t\"builtin.plan\",\n\t\"builtin.todo-set\",\n\t\"builtin.memory\",\n\t\"builtin.session-share\",\n\t\"builtin.subagent-delegate\",\n\t\"builtin.workflow\",\n\t\"builtin.coding-tools\",\n];\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-command.d.ts","sourceRoot":"","sources":["../../src/cli/plugin-command.ts"],"names":[],"mappings":"AAQA,OAAO,EAKN,KAAK,oBAAoB,EACzB,KAAK,+BAA+B,EAIpC,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EAEvB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAGhF,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE;QACf,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,EAAE,SAAS;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACjF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;KACzC,CAAC;IACF,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAC;IACvC,kFAAkF;IAClF,QAAQ,CAAC,WAAW,CAAC,EAAE,+BAA+B,CAAC;IACvD,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IAC7C,0FAA0F;IAC1F,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IACzC,qFAAqF;IACrF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;IAChD,QAAQ,CAAC,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACjD,QAAQ,CAAC,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAmED;;;;GAIG;AACH,wBAAsB,sCAAsC,CAAC,OAAO,EAAE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;CACrC,GAAG,OAAO,CAAC;IAAE,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAWnG;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CACjD,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,sBAA2B,GAClC,OAAO,CAAC,OAAO,CAAC,CAiElB","sourcesContent":["import { join } from \"node:path\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../config.ts\";\nimport { BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1 } from \"../plugins/ecosystem/bootstrap-factory-manifest.ts\";\nimport { defaultPluginHostFactsV1, projectPluginScopeRefV1 } from \"../plugins/ecosystem/default-active-bindings.ts\";\nimport {\n\tcreateDefaultPluginMarketWiringV1,\n\ttype DefaultPluginMarketWiringV1,\n} from \"../plugins/ecosystem/default-plugin-market.ts\";\nimport {\n\tcreatePluginEcosystemCliV1,\n\tcreatePluginSelectionStoreV1,\n\tcreatePluginStateStoreV1,\n\tPLUGIN_ECOSYSTEM_CLI_VERSION_V1,\n\ttype PluginDistributionV1,\n\ttype PluginEcosystemCliAcquisitionV1,\n\ttype PluginEcosystemCliParsedCommandV1,\n\ttype PluginEcosystemCliResponseV1,\n\ttype PluginEcosystemCliV1,\n\ttype PluginEcosystemRegistryV1,\n\ttype PluginInstallerV1,\n\ttype PluginSelectionStoreV1,\n\ttype PluginStateStoreV1,\n\tparsePluginEcosystemCliCommandV1,\n} from \"../plugins/ecosystem/index.ts\";\nimport {\n\tisBuiltinPluginProfileIdV1,\n\tlistBuiltinPluginManifestsV1,\n\tlistBuiltinPluginProfilesV1,\n} from \"../profile/plugin-profiles.ts\";\nimport type { PluginManagerControllerV1 } from \"./plugin-manager-controller.ts\";\nimport { createPluginManagerControllerV1 } from \"./plugin-manager-controller.ts\";\n\nexport interface PluginCommandOptionsV1 {\n\treadonly agentDir?: string;\n\t/** Working directory used for the project-local selection store. */\n\treadonly cwd?: string;\n\treadonly host?: {\n\t\treadonly os: string;\n\t\treadonly arch: string;\n\t\treadonly runtime: readonly { readonly name: string; readonly version: string }[];\n\t\treadonly apiVersion: string;\n\t\treadonly hostFeatures: readonly string[];\n\t};\n\t/** Optional host-owned boundaries used by install/update/remove commands. */\n\treadonly registry?: PluginEcosystemRegistryV1;\n\treadonly installer?: PluginInstallerV1;\n\t/** Optional host-owned multi-source package resolution used by install/update. */\n\treadonly acquisition?: PluginEcosystemCliAcquisitionV1;\n\t/** Optional host-owned package download boundary used by install/update. */\n\treadonly distribution?: PluginDistributionV1;\n\t/** Override persistence in tests or an embedding host; defaults remain agentDir files. */\n\treadonly stateStore?: PluginStateStoreV1;\n\t/** Override the project-local persistence boundary in tests or an embedding host. */\n\treadonly projectStateStore?: PluginStateStoreV1;\n\treadonly selectionStore?: PluginSelectionStoreV1;\n\treadonly projectSelectionStore?: PluginSelectionStoreV1;\n\treadonly write?: (line: string) => void;\n}\n\nfunction printResponse(response: PluginEcosystemCliResponseV1, write: (line: string) => void): void {\n\twrite(response.text);\n\tif (response.status !== \"succeeded\") process.exitCode = 1;\n}\n\n/**\n * The parsed `selection set` command, or undefined for every other command\n * and for argv the ecosystem parser rejects (the ecosystem CLI reports those\n * with its own invalid-command diagnostic). Parsing through the shared\n * grammar keeps option positions (`--scope`, `--json`) from displacing the\n * profile token this boundary validates.\n */\nfunction parseSelectionSetCommand(argv: readonly string[]): PluginEcosystemCliParsedCommandV1 | undefined {\n\ttry {\n\t\tconst parsed = parsePluginEcosystemCliCommandV1(argv);\n\t\treturn parsed.command === \"selection-set\" ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\ninterface MarketCliOptionsV1 {\n\treadonly agentDir: string;\n\treadonly cwd: string;\n\treadonly market?: DefaultPluginMarketWiringV1;\n\treadonly overrides?: PluginCommandOptionsV1;\n}\n\nfunction buildMarketCli(options: MarketCliOptionsV1): PluginEcosystemCliV1 {\n\tconst { market, overrides } = options;\n\treturn createPluginEcosystemCliV1({\n\t\thost: overrides?.host ?? defaultPluginHostFactsV1(),\n\t\tmanifests: listBuiltinPluginManifestsV1(),\n\t\tregistry: overrides?.registry ?? market?.cliRegistry,\n\t\t// Multi-source acquisition (`plugin install <ref>`) rides along with the\n\t\t// default market wiring; a fully host-injected stack replaces it wholesale.\n\t\t...(overrides?.acquisition === undefined && market?.acquisition === undefined\n\t\t\t? {}\n\t\t\t: { acquisition: overrides?.acquisition ?? market?.acquisition }),\n\t\tinstaller: overrides?.installer ?? market?.installer,\n\t\t...(overrides?.distribution !== undefined || market?.distribution !== undefined\n\t\t\t? { distribution: overrides?.distribution ?? market!.distribution }\n\t\t\t: {}),\n\t\tstateStore:\n\t\t\toverrides?.stateStore ??\n\t\t\tmarket?.stateStore ??\n\t\t\tcreatePluginStateStoreV1({\n\t\t\t\tfilePath: join(options.agentDir, \"plugin-state.json\"),\n\t\t\t}),\n\t\tprojectStateStore:\n\t\t\toverrides?.projectStateStore ??\n\t\t\tmarket?.projectStateStore ??\n\t\t\tcreatePluginStateStoreV1({\n\t\t\t\tfilePath: join(options.cwd, CONFIG_DIR_NAME, \"plugin-state.json\"),\n\t\t\t}),\n\t\tprojectScopeRef: projectPluginScopeRefV1(options.cwd),\n\t\tselectionStore:\n\t\t\toverrides?.selectionStore ??\n\t\t\tcreatePluginSelectionStoreV1({ filePath: join(options.agentDir, \".plugin-selection.json\") }),\n\t\tprojectSelectionStore:\n\t\t\toverrides?.projectSelectionStore ??\n\t\t\tcreatePluginSelectionStoreV1({ filePath: join(options.cwd, CONFIG_DIR_NAME, \".plugin-selection.json\") }),\n\t});\n}\n\n/**\n * Default TUI manager controller over the default marketplace wiring. The\n * controller reads the global or project state store per scope; callers must\n * invoke `close` after the config screen closes.\n */\nexport async function createDefaultPluginManagerControllerV1(options: {\n\treadonly agentDir?: string;\n\treadonly cwd?: string;\n\treadonly scope: \"global\" | \"project\";\n}): Promise<{ readonly controller: PluginManagerControllerV1; readonly close: () => Promise<void> }> {\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst market = await createDefaultPluginMarketWiringV1({ agentDir, cwd });\n\tconst cli = buildMarketCli({ agentDir, cwd, market });\n\tconst controller = createPluginManagerControllerV1({\n\t\tregistry: market.registry,\n\t\tstateStore: options.scope === \"project\" ? market.projectStateStore : market.stateStore,\n\t\tcli,\n\t});\n\treturn { controller, close: market.close };\n}\n\n/**\n * Handle the independent ecosystem command namespace before legacy package\n * commands. Install/update/remove default to the disk install store plus an\n * optional configured marketplace origin; host injection of registry and\n * installer still wins entirely.\n */\nexport async function handlePluginEcosystemCommand(\n\targs: readonly string[],\n\toptions: PluginCommandOptionsV1 = {},\n): Promise<boolean> {\n\tif (args[0] !== \"plugin\") return false;\n\tconst write = options.write ?? ((line: string) => console.log(line));\n\t// Batch update convenience (0.85.7 user seat finding: a factory range bump\n\t// left seven plugins outdated and the per-plugin hint meant seven manual\n\t// commands). The ecosystem CLI protocol is unchanged — this outer layer\n\t// composes `state list` + one `update` per active plugin.\n\tif (args[1] === \"update\" && args[2] === \"--all\") {\n\t\tawait runBatchUpdate(args.slice(3), options, write);\n\t\treturn true;\n\t}\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\t// 2026-10-01 dogfood finding: `selection set` accepted any profile id — a\n\t// suite id like \"assistant\" persisted fine while the ordinary run resolves\n\t// only builtin plugin profile ids, so the stored selection could never be\n\t// read back. Unknown ids are rejected here at the CLI command boundary;\n\t// the selection store itself stays host-agnostic.\n\tconst selectionSet = parseSelectionSetCommand(args.slice(1));\n\tif (selectionSet !== undefined && !isBuiltinPluginProfileIdV1(selectionSet.profileId as string)) {\n\t\tconst validProfileIds = listBuiltinPluginProfilesV1()\n\t\t\t.map((profile) => profile.id)\n\t\t\t.join(\", \");\n\t\tconst message = `unknown plugin profile \"${selectionSet.profileId}\"; selection set accepts builtin plugin profile ids only: ${validProfileIds}`;\n\t\tconst base = {\n\t\t\tversion: PLUGIN_ECOSYSTEM_CLI_VERSION_V1,\n\t\t\tcommand: \"selection-set\" as const,\n\t\t\tformat: selectionSet.format,\n\t\t\tstatus: \"failed\" as const,\n\t\t\terror: { code: \"invalid_command\" as const, message },\n\t\t};\n\t\tprintResponse(\n\t\t\t{\n\t\t\t\t...base,\n\t\t\t\ttext: selectionSet.format === \"json\" ? JSON.stringify(base) : `failed: ${message}`,\n\t\t\t},\n\t\t\twrite,\n\t\t);\n\t\treturn true;\n\t}\n\tconst market =\n\t\toptions.registry === undefined && options.installer === undefined\n\t\t\t? await createDefaultPluginMarketWiringV1({ agentDir, cwd })\n\t\t\t: undefined;\n\ttry {\n\t\tconst cli = buildMarketCli({ agentDir, cwd, market, overrides: options });\n\t\tconst response = await cli.execute({ argv: args.slice(1) });\n\t\tprintResponse(response, write);\n\t\t// CRM seat finding F3, corrected by the 2026-10-01 dogfood: installing\n\t\t// a plugin activates nothing, and the old hint pointed at `plugin\n\t\t// selection set` — a store no ordinary run reads, so suite users were\n\t\t// sent down a dead end. The real activation path is the suite's\n\t\t// capabilities list in suite.json.\n\t\tif (response.status === \"succeeded\" && response.command === \"install\") {\n\t\t\tconst pluginId = response.data?.pluginId;\n\t\t\tif (typeof pluginId === \"string\") {\n\t\t\t\twrite(\n\t\t\t\t\t`note: this plugin is installed but not yet active; to activate its tools add \"${pluginId}\" to the capabilities list in <agentDir>/suites/<suite>/suite.json and restart`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t} finally {\n\t\tawait market?.close();\n\t}\n}\n\ninterface BatchUpdateEntry {\n\treadonly pluginId: string;\n\treadonly scope: string;\n\treadonly lifecycle: string;\n}\n\nasync function runBatchUpdate(\n\trestArgs: readonly string[],\n\toptions: PluginCommandOptionsV1,\n\twrite: (line: string) => void,\n): Promise<void> {\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst scopeIndex = restArgs.indexOf(\"--scope\");\n\tconst scope = scopeIndex !== -1 && restArgs[scopeIndex + 1] === \"project\" ? \"project\" : \"global\";\n\tconst market =\n\t\toptions.registry === undefined && options.installer === undefined\n\t\t\t? await createDefaultPluginMarketWiringV1({ agentDir, cwd })\n\t\t\t: undefined;\n\ttry {\n\t\tconst cli = buildMarketCli({ agentDir, cwd, market, overrides: options });\n\t\tconst listResponse = await cli.execute({ argv: [\"state\", \"list\", \"--scope\", scope] });\n\t\tif (listResponse.status !== \"succeeded\") {\n\t\t\tprintResponse(listResponse, write);\n\t\t\treturn;\n\t\t}\n\t\tconst entries = ((listResponse.data?.entries ?? []) as readonly BatchUpdateEntry[]).filter(\n\t\t\t(entry) => entry.lifecycle === \"active\" && entry.scope === scope,\n\t\t);\n\t\tif (entries.length === 0) {\n\t\t\twrite(\"No active plugins to update.\");\n\t\t\treturn;\n\t\t}\n\t\tconst updated: string[] = [];\n\t\tconst current: string[] = [];\n\t\tconst failed: string[] = [];\n\t\tfor (const entry of entries) {\n\t\t\t// Factory-listed first-party plugins upgrade through the npm range the\n\t\t\t// bootstrap warnings name (`install <npmName>@^range`): the default disk\n\t\t\t// registry only resolves already-installed versions, so a bare `update`\n\t\t\t// there re-resolves the current version and reports nothing to do.\n\t\t\t// Non-factory plugins keep the bare `update` registry semantics.\n\t\t\tconst factoryEntry = BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1.find((item) => item.pluginId === entry.pluginId);\n\t\t\tconst argv = factoryEntry\n\t\t\t\t? [\"install\", `${factoryEntry.npmName}@${factoryEntry.range ?? \"latest\"}`, \"--scope\", scope]\n\t\t\t\t: [\"update\", entry.pluginId, \"--scope\", scope];\n\t\t\tconst response = await cli.execute({ argv });\n\t\t\tif (response.status === \"succeeded\") {\n\t\t\t\tupdated.push(entry.pluginId);\n\t\t\t\twrite(response.text);\n\t\t\t} else if (response.error?.code === \"already_installed\") {\n\t\t\t\tcurrent.push(entry.pluginId);\n\t\t\t} else {\n\t\t\t\tfailed.push(entry.pluginId);\n\t\t\t\twrite(response.text);\n\t\t\t}\n\t\t}\n\t\tconst summary = [\n\t\t\t`updated ${updated.length}${updated.length > 0 ? ` (${updated.join(\", \")})` : \"\"}`,\n\t\t\t`already up to date ${current.length}${current.length > 0 ? ` (${current.join(\", \")})` : \"\"}`,\n\t\t\t`failed ${failed.length}${failed.length > 0 ? ` (${failed.join(\", \")})` : \"\"}`,\n\t\t].join(\"; \");\n\t\twrite(`plugin update --all [${scope}]: ${summary}`);\n\t\tif (failed.length > 0) process.exitCode = 1;\n\t} finally {\n\t\tawait market?.close();\n\t}\n}\n"]}
1
+ {"version":3,"file":"plugin-command.d.ts","sourceRoot":"","sources":["../../src/cli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C,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAmED;;;;GAIG;AACH,wBAAsB,sCAAsC,CAAC,OAAO,EAAE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;CACrC,GAAG,OAAO,CAAC;IAAE,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAWnG;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CACjD,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,sBAA2B,GAClC,OAAO,CAAC,OAAO,CAAC,CAiElB","sourcesContent":["import { join } from \"node:path\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../config.ts\";\nimport { BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1 } from \"../plugins/ecosystem/bootstrap-factory-manifest.ts\";\nimport { defaultPluginHostFactsV1, projectPluginScopeRefV1 } from \"../plugins/ecosystem/default-active-bindings.ts\";\nimport {\n\tcreateDefaultPluginMarketWiringV1,\n\ttype DefaultPluginMarketWiringV1,\n} from \"../plugins/ecosystem/default-plugin-market.ts\";\nimport {\n\tcreatePluginEcosystemCliV1,\n\tcreatePluginSelectionStoreV1,\n\tcreatePluginStateStoreV1,\n\tPLUGIN_ECOSYSTEM_CLI_VERSION_V1,\n\ttype PluginDistributionV1,\n\ttype PluginEcosystemCliAcquisitionV1,\n\ttype PluginEcosystemCliParsedCommandV1,\n\ttype PluginEcosystemCliResponseV1,\n\ttype PluginEcosystemCliV1,\n\ttype PluginEcosystemRegistryV1,\n\ttype PluginInstallerV1,\n\ttype PluginSelectionStoreV1,\n\ttype PluginStateStoreV1,\n\tparsePluginEcosystemCliCommandV1,\n} from \"../plugins/ecosystem/index.ts\";\nimport { selectNpmPackageVersionV1 } from \"../plugins/ecosystem/node-npm-registry-source.ts\";\nimport {\n\tisBuiltinPluginProfileIdV1,\n\tlistBuiltinPluginManifestsV1,\n\tlistBuiltinPluginProfilesV1,\n} from \"../profile/plugin-profiles.ts\";\nimport type { PluginManagerControllerV1 } from \"./plugin-manager-controller.ts\";\nimport { createPluginManagerControllerV1 } from \"./plugin-manager-controller.ts\";\n\nexport interface PluginCommandOptionsV1 {\n\treadonly agentDir?: string;\n\t/** Working directory used for the project-local selection store. */\n\treadonly cwd?: string;\n\treadonly host?: {\n\t\treadonly os: string;\n\t\treadonly arch: string;\n\t\treadonly runtime: readonly { readonly name: string; readonly version: string }[];\n\t\treadonly apiVersion: string;\n\t\treadonly hostFeatures: readonly string[];\n\t};\n\t/** Optional host-owned boundaries used by install/update/remove commands. */\n\treadonly registry?: PluginEcosystemRegistryV1;\n\treadonly installer?: PluginInstallerV1;\n\t/** Optional host-owned multi-source package resolution used by install/update. */\n\treadonly acquisition?: PluginEcosystemCliAcquisitionV1;\n\t/** Optional host-owned package download boundary used by install/update. */\n\treadonly distribution?: PluginDistributionV1;\n\t/** Override persistence in tests or an embedding host; defaults remain agentDir files. */\n\treadonly stateStore?: PluginStateStoreV1;\n\t/** Override the project-local persistence boundary in tests or an embedding host. */\n\treadonly projectStateStore?: PluginStateStoreV1;\n\treadonly selectionStore?: PluginSelectionStoreV1;\n\treadonly projectSelectionStore?: PluginSelectionStoreV1;\n\treadonly write?: (line: string) => void;\n}\n\nfunction printResponse(response: PluginEcosystemCliResponseV1, write: (line: string) => void): void {\n\twrite(response.text);\n\tif (response.status !== \"succeeded\") process.exitCode = 1;\n}\n\n/**\n * The parsed `selection set` command, or undefined for every other command\n * and for argv the ecosystem parser rejects (the ecosystem CLI reports those\n * with its own invalid-command diagnostic). Parsing through the shared\n * grammar keeps option positions (`--scope`, `--json`) from displacing the\n * profile token this boundary validates.\n */\nfunction parseSelectionSetCommand(argv: readonly string[]): PluginEcosystemCliParsedCommandV1 | undefined {\n\ttry {\n\t\tconst parsed = parsePluginEcosystemCliCommandV1(argv);\n\t\treturn parsed.command === \"selection-set\" ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\ninterface MarketCliOptionsV1 {\n\treadonly agentDir: string;\n\treadonly cwd: string;\n\treadonly market?: DefaultPluginMarketWiringV1;\n\treadonly overrides?: PluginCommandOptionsV1;\n}\n\nfunction buildMarketCli(options: MarketCliOptionsV1): PluginEcosystemCliV1 {\n\tconst { market, overrides } = options;\n\treturn createPluginEcosystemCliV1({\n\t\thost: overrides?.host ?? defaultPluginHostFactsV1(),\n\t\tmanifests: listBuiltinPluginManifestsV1(),\n\t\tregistry: overrides?.registry ?? market?.cliRegistry,\n\t\t// Multi-source acquisition (`plugin install <ref>`) rides along with the\n\t\t// default market wiring; a fully host-injected stack replaces it wholesale.\n\t\t...(overrides?.acquisition === undefined && market?.acquisition === undefined\n\t\t\t? {}\n\t\t\t: { acquisition: overrides?.acquisition ?? market?.acquisition }),\n\t\tinstaller: overrides?.installer ?? market?.installer,\n\t\t...(overrides?.distribution !== undefined || market?.distribution !== undefined\n\t\t\t? { distribution: overrides?.distribution ?? market!.distribution }\n\t\t\t: {}),\n\t\tstateStore:\n\t\t\toverrides?.stateStore ??\n\t\t\tmarket?.stateStore ??\n\t\t\tcreatePluginStateStoreV1({\n\t\t\t\tfilePath: join(options.agentDir, \"plugin-state.json\"),\n\t\t\t}),\n\t\tprojectStateStore:\n\t\t\toverrides?.projectStateStore ??\n\t\t\tmarket?.projectStateStore ??\n\t\t\tcreatePluginStateStoreV1({\n\t\t\t\tfilePath: join(options.cwd, CONFIG_DIR_NAME, \"plugin-state.json\"),\n\t\t\t}),\n\t\tprojectScopeRef: projectPluginScopeRefV1(options.cwd),\n\t\tselectionStore:\n\t\t\toverrides?.selectionStore ??\n\t\t\tcreatePluginSelectionStoreV1({ filePath: join(options.agentDir, \".plugin-selection.json\") }),\n\t\tprojectSelectionStore:\n\t\t\toverrides?.projectSelectionStore ??\n\t\t\tcreatePluginSelectionStoreV1({ filePath: join(options.cwd, CONFIG_DIR_NAME, \".plugin-selection.json\") }),\n\t});\n}\n\n/**\n * Default TUI manager controller over the default marketplace wiring. The\n * controller reads the global or project state store per scope; callers must\n * invoke `close` after the config screen closes.\n */\nexport async function createDefaultPluginManagerControllerV1(options: {\n\treadonly agentDir?: string;\n\treadonly cwd?: string;\n\treadonly scope: \"global\" | \"project\";\n}): Promise<{ readonly controller: PluginManagerControllerV1; readonly close: () => Promise<void> }> {\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst market = await createDefaultPluginMarketWiringV1({ agentDir, cwd });\n\tconst cli = buildMarketCli({ agentDir, cwd, market });\n\tconst controller = createPluginManagerControllerV1({\n\t\tregistry: market.registry,\n\t\tstateStore: options.scope === \"project\" ? market.projectStateStore : market.stateStore,\n\t\tcli,\n\t});\n\treturn { controller, close: market.close };\n}\n\n/**\n * Handle the independent ecosystem command namespace before legacy package\n * commands. Install/update/remove default to the disk install store plus an\n * optional configured marketplace origin; host injection of registry and\n * installer still wins entirely.\n */\nexport async function handlePluginEcosystemCommand(\n\targs: readonly string[],\n\toptions: PluginCommandOptionsV1 = {},\n): Promise<boolean> {\n\tif (args[0] !== \"plugin\") return false;\n\tconst write = options.write ?? ((line: string) => console.log(line));\n\t// Batch update convenience (0.85.7 user seat finding: a factory range bump\n\t// left seven plugins outdated and the per-plugin hint meant seven manual\n\t// commands). The ecosystem CLI protocol is unchanged — this outer layer\n\t// composes `state list` + one `update` per active plugin.\n\tif (args[1] === \"update\" && args[2] === \"--all\") {\n\t\tawait runBatchUpdate(args.slice(3), options, write);\n\t\treturn true;\n\t}\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\t// 2026-10-01 dogfood finding: `selection set` accepted any profile id — a\n\t// suite id like \"assistant\" persisted fine while the ordinary run resolves\n\t// only builtin plugin profile ids, so the stored selection could never be\n\t// read back. Unknown ids are rejected here at the CLI command boundary;\n\t// the selection store itself stays host-agnostic.\n\tconst selectionSet = parseSelectionSetCommand(args.slice(1));\n\tif (selectionSet !== undefined && !isBuiltinPluginProfileIdV1(selectionSet.profileId as string)) {\n\t\tconst validProfileIds = listBuiltinPluginProfilesV1()\n\t\t\t.map((profile) => profile.id)\n\t\t\t.join(\", \");\n\t\tconst message = `unknown plugin profile \"${selectionSet.profileId}\"; selection set accepts builtin plugin profile ids only: ${validProfileIds}`;\n\t\tconst base = {\n\t\t\tversion: PLUGIN_ECOSYSTEM_CLI_VERSION_V1,\n\t\t\tcommand: \"selection-set\" as const,\n\t\t\tformat: selectionSet.format,\n\t\t\tstatus: \"failed\" as const,\n\t\t\terror: { code: \"invalid_command\" as const, message },\n\t\t};\n\t\tprintResponse(\n\t\t\t{\n\t\t\t\t...base,\n\t\t\t\ttext: selectionSet.format === \"json\" ? JSON.stringify(base) : `failed: ${message}`,\n\t\t\t},\n\t\t\twrite,\n\t\t);\n\t\treturn true;\n\t}\n\tconst market =\n\t\toptions.registry === undefined && options.installer === undefined\n\t\t\t? await createDefaultPluginMarketWiringV1({ agentDir, cwd })\n\t\t\t: undefined;\n\ttry {\n\t\tconst cli = buildMarketCli({ agentDir, cwd, market, overrides: options });\n\t\tconst response = await cli.execute({ argv: args.slice(1) });\n\t\tprintResponse(response, write);\n\t\t// CRM seat finding F3, corrected by the 2026-10-01 dogfood: installing\n\t\t// a plugin activates nothing, and the old hint pointed at `plugin\n\t\t// selection set` — a store no ordinary run reads, so suite users were\n\t\t// sent down a dead end. The real activation path is the suite's\n\t\t// capabilities list in suite.json.\n\t\tif (response.status === \"succeeded\" && response.command === \"install\") {\n\t\t\tconst pluginId = response.data?.pluginId;\n\t\t\tif (typeof pluginId === \"string\") {\n\t\t\t\twrite(\n\t\t\t\t\t`note: this plugin is installed but not yet active; to activate its tools add \"${pluginId}\" to the capabilities list in <agentDir>/suites/<suite>/suite.json and restart`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t} finally {\n\t\tawait market?.close();\n\t}\n}\n\ninterface BatchUpdateEntry {\n\treadonly pluginId: string;\n\treadonly pluginVersion?: string;\n\treadonly scope: string;\n\treadonly lifecycle: string;\n}\n\nasync function runBatchUpdate(\n\trestArgs: readonly string[],\n\toptions: PluginCommandOptionsV1,\n\twrite: (line: string) => void,\n): Promise<void> {\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst scopeIndex = restArgs.indexOf(\"--scope\");\n\tconst scope = scopeIndex !== -1 && restArgs[scopeIndex + 1] === \"project\" ? \"project\" : \"global\";\n\tconst market =\n\t\toptions.registry === undefined && options.installer === undefined\n\t\t\t? await createDefaultPluginMarketWiringV1({ agentDir, cwd })\n\t\t\t: undefined;\n\ttry {\n\t\tconst cli = buildMarketCli({ agentDir, cwd, market, overrides: options });\n\t\tconst listResponse = await cli.execute({ argv: [\"state\", \"list\", \"--scope\", scope] });\n\t\tif (listResponse.status !== \"succeeded\") {\n\t\t\tprintResponse(listResponse, write);\n\t\t\treturn;\n\t\t}\n\t\tconst entries = ((listResponse.data?.entries ?? []) as readonly BatchUpdateEntry[]).filter(\n\t\t\t(entry) => entry.lifecycle === \"active\" && entry.scope === scope,\n\t\t);\n\t\tif (entries.length === 0) {\n\t\t\twrite(\"No active plugins to update.\");\n\t\t\treturn;\n\t\t}\n\t\tconst updated: string[] = [];\n\t\tconst current: string[] = [];\n\t\tconst failed: string[] = [];\n\t\tfor (const entry of entries) {\n\t\t\t// Factory-listed first-party plugins upgrade through the npm range the\n\t\t\t// bootstrap warnings name (`install <npmName>@^range`): the default disk\n\t\t\t// registry only resolves already-installed versions, so a bare `update`\n\t\t\t// there re-resolves the current version and reports nothing to do.\n\t\t\t// Non-factory plugins keep the bare `update` registry semantics.\n\t\t\tconst factoryEntry = BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1.find((item) => item.pluginId === entry.pluginId);\n\t\t\t// Offline satisfiability pre-check: when the recorded version already\n\t\t\t// satisfies the factory range, classifying as current must not touch the\n\t\t\t// network — acquisition downloads before its already_installed check, so\n\t\t\t// satisfied entries re-downloaded every run and one network blip failed\n\t\t\t// them. `latest`/absent ranges stay online-only (satisfiability is not\n\t\t\t// decidable offline); the check reuses the npm range selector.\n\t\t\tconst range = factoryEntry?.range;\n\t\t\tif (\n\t\t\t\tfactoryEntry !== undefined &&\n\t\t\t\trange !== undefined &&\n\t\t\t\trange !== \"latest\" &&\n\t\t\t\tentry.pluginVersion !== undefined &&\n\t\t\t\tselectNpmPackageVersionV1([entry.pluginVersion], range) === entry.pluginVersion\n\t\t\t) {\n\t\t\t\tcurrent.push(entry.pluginId);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst argv = factoryEntry\n\t\t\t\t? [\"install\", `${factoryEntry.npmName}@${range ?? \"latest\"}`, \"--scope\", scope]\n\t\t\t\t: [\"update\", entry.pluginId, \"--scope\", scope];\n\t\t\tconst response = await cli.execute({ argv });\n\t\t\tif (response.status === \"succeeded\") {\n\t\t\t\tupdated.push(entry.pluginId);\n\t\t\t\twrite(response.text);\n\t\t\t} else if (response.error?.code === \"already_installed\") {\n\t\t\t\tcurrent.push(entry.pluginId);\n\t\t\t} else {\n\t\t\t\tfailed.push(entry.pluginId);\n\t\t\t\twrite(response.text);\n\t\t\t}\n\t\t}\n\t\tconst summary = [\n\t\t\t`updated ${updated.length}${updated.length > 0 ? ` (${updated.join(\", \")})` : \"\"}`,\n\t\t\t`already up to date ${current.length}${current.length > 0 ? ` (${current.join(\", \")})` : \"\"}`,\n\t\t\t`failed ${failed.length}${failed.length > 0 ? ` (${failed.join(\", \")})` : \"\"}`,\n\t\t].join(\"; \");\n\t\twrite(`plugin update --all [${scope}]: ${summary}`);\n\t\tif (failed.length > 0) process.exitCode = 1;\n\t} finally {\n\t\tawait market?.close();\n\t}\n}\n"]}
@@ -4,6 +4,7 @@ import { BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1 } from "../plugins/ecosystem/boots
4
4
  import { defaultPluginHostFactsV1, projectPluginScopeRefV1 } from "../plugins/ecosystem/default-active-bindings.js";
5
5
  import { createDefaultPluginMarketWiringV1, } from "../plugins/ecosystem/default-plugin-market.js";
6
6
  import { createPluginEcosystemCliV1, createPluginSelectionStoreV1, createPluginStateStoreV1, PLUGIN_ECOSYSTEM_CLI_VERSION_V1, parsePluginEcosystemCliCommandV1, } from "../plugins/ecosystem/index.js";
7
+ import { selectNpmPackageVersionV1 } from "../plugins/ecosystem/node-npm-registry-source.js";
7
8
  import { isBuiltinPluginProfileIdV1, listBuiltinPluginManifestsV1, listBuiltinPluginProfilesV1, } from "../profile/plugin-profiles.js";
8
9
  import { createPluginManagerControllerV1 } from "./plugin-manager-controller.js";
9
10
  function printResponse(response, write) {
@@ -174,8 +175,23 @@ async function runBatchUpdate(restArgs, options, write) {
174
175
  // there re-resolves the current version and reports nothing to do.
175
176
  // Non-factory plugins keep the bare `update` registry semantics.
176
177
  const factoryEntry = BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1.find((item) => item.pluginId === entry.pluginId);
178
+ // Offline satisfiability pre-check: when the recorded version already
179
+ // satisfies the factory range, classifying as current must not touch the
180
+ // network — acquisition downloads before its already_installed check, so
181
+ // satisfied entries re-downloaded every run and one network blip failed
182
+ // them. `latest`/absent ranges stay online-only (satisfiability is not
183
+ // decidable offline); the check reuses the npm range selector.
184
+ const range = factoryEntry?.range;
185
+ if (factoryEntry !== undefined &&
186
+ range !== undefined &&
187
+ range !== "latest" &&
188
+ entry.pluginVersion !== undefined &&
189
+ selectNpmPackageVersionV1([entry.pluginVersion], range) === entry.pluginVersion) {
190
+ current.push(entry.pluginId);
191
+ continue;
192
+ }
177
193
  const argv = factoryEntry
178
- ? ["install", `${factoryEntry.npmName}@${factoryEntry.range ?? "latest"}`, "--scope", scope]
194
+ ? ["install", `${factoryEntry.npmName}@${range ?? "latest"}`, "--scope", scope]
179
195
  : ["update", entry.pluginId, "--scope", scope];
180
196
  const response = await cli.execute({ argv });
181
197
  if (response.status === "succeeded") {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-command.js","sourceRoot":"","sources":["../../src/cli/plugin-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,oCAAoC,EAAE,MAAM,oDAAoD,CAAC;AAC1G,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AACpH,OAAO,EACN,iCAAiC,GAEjC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACN,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAU/B,gCAAgC,GAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,GAC3B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AA6BjF,SAAS,aAAa,CAAC,QAAsC,EAAE,KAA6B,EAAQ;IACnG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrB,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AAAA,CAC1D;AAED;;;;;;GAMG;AACH,SAAS,wBAAwB,CAAC,IAAuB,EAAiD;IACzG,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,gCAAgC,CAAC,IAAI,CAAC,CAAC;QACtD,OAAO,MAAM,CAAC,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS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K,CAAC,QAAQ,CAAC,CAAC;gBAC5B,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;QACF,CAAC;QACD,MAAM,OAAO,GAAG;YACf,WAAW,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAClF,sBAAsB,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAC7F,UAAU,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;SAC9E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,KAAK,CAAC,wBAAwB,KAAK,MAAM,OAAO,EAAE,CAAC,CAAC;QACpD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC7C,CAAC;YAAS,CAAC;QACV,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;AAAA,CACD","sourcesContent":["import { join } from \"node:path\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../config.ts\";\nimport { BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1 } from \"../plugins/ecosystem/bootstrap-factory-manifest.ts\";\nimport { defaultPluginHostFactsV1, projectPluginScopeRefV1 } from \"../plugins/ecosystem/default-active-bindings.ts\";\nimport {\n\tcreateDefaultPluginMarketWiringV1,\n\ttype DefaultPluginMarketWiringV1,\n} from \"../plugins/ecosystem/default-plugin-market.ts\";\nimport {\n\tcreatePluginEcosystemCliV1,\n\tcreatePluginSelectionStoreV1,\n\tcreatePluginStateStoreV1,\n\tPLUGIN_ECOSYSTEM_CLI_VERSION_V1,\n\ttype PluginDistributionV1,\n\ttype PluginEcosystemCliAcquisitionV1,\n\ttype PluginEcosystemCliParsedCommandV1,\n\ttype PluginEcosystemCliResponseV1,\n\ttype PluginEcosystemCliV1,\n\ttype PluginEcosystemRegistryV1,\n\ttype PluginInstallerV1,\n\ttype PluginSelectionStoreV1,\n\ttype PluginStateStoreV1,\n\tparsePluginEcosystemCliCommandV1,\n} from \"../plugins/ecosystem/index.ts\";\nimport {\n\tisBuiltinPluginProfileIdV1,\n\tlistBuiltinPluginManifestsV1,\n\tlistBuiltinPluginProfilesV1,\n} from \"../profile/plugin-profiles.ts\";\nimport type { PluginManagerControllerV1 } from \"./plugin-manager-controller.ts\";\nimport { createPluginManagerControllerV1 } from \"./plugin-manager-controller.ts\";\n\nexport interface PluginCommandOptionsV1 {\n\treadonly agentDir?: string;\n\t/** Working directory used for the project-local selection store. */\n\treadonly cwd?: string;\n\treadonly host?: {\n\t\treadonly os: string;\n\t\treadonly arch: string;\n\t\treadonly runtime: readonly { readonly name: string; readonly version: string }[];\n\t\treadonly apiVersion: string;\n\t\treadonly hostFeatures: readonly string[];\n\t};\n\t/** Optional host-owned boundaries used by install/update/remove commands. */\n\treadonly registry?: PluginEcosystemRegistryV1;\n\treadonly installer?: PluginInstallerV1;\n\t/** Optional host-owned multi-source package resolution used by install/update. */\n\treadonly acquisition?: PluginEcosystemCliAcquisitionV1;\n\t/** Optional host-owned package download boundary used by install/update. */\n\treadonly distribution?: PluginDistributionV1;\n\t/** Override persistence in tests or an embedding host; defaults remain agentDir files. */\n\treadonly stateStore?: PluginStateStoreV1;\n\t/** Override the project-local persistence boundary in tests or an embedding host. */\n\treadonly projectStateStore?: PluginStateStoreV1;\n\treadonly selectionStore?: PluginSelectionStoreV1;\n\treadonly projectSelectionStore?: PluginSelectionStoreV1;\n\treadonly write?: (line: string) => void;\n}\n\nfunction printResponse(response: PluginEcosystemCliResponseV1, write: (line: string) => void): void {\n\twrite(response.text);\n\tif (response.status !== \"succeeded\") process.exitCode = 1;\n}\n\n/**\n * The parsed `selection set` command, or undefined for every other command\n * and for argv the ecosystem parser rejects (the ecosystem CLI reports those\n * with its own invalid-command diagnostic). Parsing through the shared\n * grammar keeps option positions (`--scope`, `--json`) from displacing the\n * profile token this boundary validates.\n */\nfunction parseSelectionSetCommand(argv: readonly string[]): PluginEcosystemCliParsedCommandV1 | undefined {\n\ttry {\n\t\tconst parsed = parsePluginEcosystemCliCommandV1(argv);\n\t\treturn parsed.command === \"selection-set\" ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\ninterface MarketCliOptionsV1 {\n\treadonly agentDir: string;\n\treadonly cwd: string;\n\treadonly market?: DefaultPluginMarketWiringV1;\n\treadonly overrides?: PluginCommandOptionsV1;\n}\n\nfunction buildMarketCli(options: MarketCliOptionsV1): PluginEcosystemCliV1 {\n\tconst { market, overrides } = options;\n\treturn createPluginEcosystemCliV1({\n\t\thost: overrides?.host ?? defaultPluginHostFactsV1(),\n\t\tmanifests: listBuiltinPluginManifestsV1(),\n\t\tregistry: overrides?.registry ?? market?.cliRegistry,\n\t\t// Multi-source acquisition (`plugin install <ref>`) rides along with the\n\t\t// default market wiring; a fully host-injected stack replaces it wholesale.\n\t\t...(overrides?.acquisition === undefined && market?.acquisition === undefined\n\t\t\t? {}\n\t\t\t: { acquisition: overrides?.acquisition ?? market?.acquisition }),\n\t\tinstaller: overrides?.installer ?? market?.installer,\n\t\t...(overrides?.distribution !== undefined || market?.distribution !== undefined\n\t\t\t? { distribution: overrides?.distribution ?? market!.distribution }\n\t\t\t: {}),\n\t\tstateStore:\n\t\t\toverrides?.stateStore ??\n\t\t\tmarket?.stateStore ??\n\t\t\tcreatePluginStateStoreV1({\n\t\t\t\tfilePath: join(options.agentDir, \"plugin-state.json\"),\n\t\t\t}),\n\t\tprojectStateStore:\n\t\t\toverrides?.projectStateStore ??\n\t\t\tmarket?.projectStateStore ??\n\t\t\tcreatePluginStateStoreV1({\n\t\t\t\tfilePath: join(options.cwd, CONFIG_DIR_NAME, \"plugin-state.json\"),\n\t\t\t}),\n\t\tprojectScopeRef: projectPluginScopeRefV1(options.cwd),\n\t\tselectionStore:\n\t\t\toverrides?.selectionStore ??\n\t\t\tcreatePluginSelectionStoreV1({ filePath: join(options.agentDir, \".plugin-selection.json\") }),\n\t\tprojectSelectionStore:\n\t\t\toverrides?.projectSelectionStore ??\n\t\t\tcreatePluginSelectionStoreV1({ filePath: join(options.cwd, CONFIG_DIR_NAME, \".plugin-selection.json\") }),\n\t});\n}\n\n/**\n * Default TUI manager controller over the default marketplace wiring. The\n * controller reads the global or project state store per scope; callers must\n * invoke `close` after the config screen closes.\n */\nexport async function createDefaultPluginManagerControllerV1(options: {\n\treadonly agentDir?: string;\n\treadonly cwd?: string;\n\treadonly scope: \"global\" | \"project\";\n}): Promise<{ readonly controller: PluginManagerControllerV1; readonly close: () => Promise<void> }> {\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst market = await createDefaultPluginMarketWiringV1({ agentDir, cwd });\n\tconst cli = buildMarketCli({ agentDir, cwd, market });\n\tconst controller = createPluginManagerControllerV1({\n\t\tregistry: market.registry,\n\t\tstateStore: options.scope === \"project\" ? market.projectStateStore : market.stateStore,\n\t\tcli,\n\t});\n\treturn { controller, close: market.close };\n}\n\n/**\n * Handle the independent ecosystem command namespace before legacy package\n * commands. Install/update/remove default to the disk install store plus an\n * optional configured marketplace origin; host injection of registry and\n * installer still wins entirely.\n */\nexport async function handlePluginEcosystemCommand(\n\targs: readonly string[],\n\toptions: PluginCommandOptionsV1 = {},\n): Promise<boolean> {\n\tif (args[0] !== \"plugin\") return false;\n\tconst write = options.write ?? ((line: string) => console.log(line));\n\t// Batch update convenience (0.85.7 user seat finding: a factory range bump\n\t// left seven plugins outdated and the per-plugin hint meant seven manual\n\t// commands). The ecosystem CLI protocol is unchanged — this outer layer\n\t// composes `state list` + one `update` per active plugin.\n\tif (args[1] === \"update\" && args[2] === \"--all\") {\n\t\tawait runBatchUpdate(args.slice(3), options, write);\n\t\treturn true;\n\t}\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\t// 2026-10-01 dogfood finding: `selection set` accepted any profile id — a\n\t// suite id like \"assistant\" persisted fine while the ordinary run resolves\n\t// only builtin plugin profile ids, so the stored selection could never be\n\t// read back. Unknown ids are rejected here at the CLI command boundary;\n\t// the selection store itself stays host-agnostic.\n\tconst selectionSet = parseSelectionSetCommand(args.slice(1));\n\tif (selectionSet !== undefined && !isBuiltinPluginProfileIdV1(selectionSet.profileId as string)) {\n\t\tconst validProfileIds = listBuiltinPluginProfilesV1()\n\t\t\t.map((profile) => profile.id)\n\t\t\t.join(\", \");\n\t\tconst message = `unknown plugin profile \"${selectionSet.profileId}\"; selection set accepts builtin plugin profile ids only: ${validProfileIds}`;\n\t\tconst base = {\n\t\t\tversion: PLUGIN_ECOSYSTEM_CLI_VERSION_V1,\n\t\t\tcommand: \"selection-set\" as const,\n\t\t\tformat: selectionSet.format,\n\t\t\tstatus: \"failed\" as const,\n\t\t\terror: { code: \"invalid_command\" as const, message },\n\t\t};\n\t\tprintResponse(\n\t\t\t{\n\t\t\t\t...base,\n\t\t\t\ttext: selectionSet.format === \"json\" ? JSON.stringify(base) : `failed: ${message}`,\n\t\t\t},\n\t\t\twrite,\n\t\t);\n\t\treturn true;\n\t}\n\tconst market =\n\t\toptions.registry === undefined && options.installer === undefined\n\t\t\t? await createDefaultPluginMarketWiringV1({ agentDir, cwd })\n\t\t\t: undefined;\n\ttry {\n\t\tconst cli = buildMarketCli({ agentDir, cwd, market, overrides: options });\n\t\tconst response = await cli.execute({ argv: args.slice(1) });\n\t\tprintResponse(response, write);\n\t\t// CRM seat finding F3, corrected by the 2026-10-01 dogfood: installing\n\t\t// a plugin activates nothing, and the old hint pointed at `plugin\n\t\t// selection set` — a store no ordinary run reads, so suite users were\n\t\t// sent down a dead end. The real activation path is the suite's\n\t\t// capabilities list in suite.json.\n\t\tif (response.status === \"succeeded\" && response.command === \"install\") {\n\t\t\tconst pluginId = response.data?.pluginId;\n\t\t\tif (typeof pluginId === \"string\") {\n\t\t\t\twrite(\n\t\t\t\t\t`note: this plugin is installed but not yet active; to activate its tools add \"${pluginId}\" to the capabilities list in <agentDir>/suites/<suite>/suite.json and restart`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t} finally {\n\t\tawait market?.close();\n\t}\n}\n\ninterface BatchUpdateEntry {\n\treadonly pluginId: string;\n\treadonly scope: string;\n\treadonly lifecycle: string;\n}\n\nasync function runBatchUpdate(\n\trestArgs: readonly string[],\n\toptions: PluginCommandOptionsV1,\n\twrite: (line: string) => void,\n): Promise<void> {\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst scopeIndex = restArgs.indexOf(\"--scope\");\n\tconst scope = scopeIndex !== -1 && restArgs[scopeIndex + 1] === \"project\" ? \"project\" : \"global\";\n\tconst market =\n\t\toptions.registry === undefined && options.installer === undefined\n\t\t\t? await createDefaultPluginMarketWiringV1({ agentDir, cwd })\n\t\t\t: undefined;\n\ttry {\n\t\tconst cli = buildMarketCli({ agentDir, cwd, market, overrides: options });\n\t\tconst listResponse = await cli.execute({ argv: [\"state\", \"list\", \"--scope\", scope] });\n\t\tif (listResponse.status !== \"succeeded\") {\n\t\t\tprintResponse(listResponse, write);\n\t\t\treturn;\n\t\t}\n\t\tconst entries = ((listResponse.data?.entries ?? []) as readonly BatchUpdateEntry[]).filter(\n\t\t\t(entry) => entry.lifecycle === \"active\" && entry.scope === scope,\n\t\t);\n\t\tif (entries.length === 0) {\n\t\t\twrite(\"No active plugins to update.\");\n\t\t\treturn;\n\t\t}\n\t\tconst updated: string[] = [];\n\t\tconst current: string[] = [];\n\t\tconst failed: string[] = [];\n\t\tfor (const entry of entries) {\n\t\t\t// Factory-listed first-party plugins upgrade through the npm range the\n\t\t\t// bootstrap warnings name (`install <npmName>@^range`): the default disk\n\t\t\t// registry only resolves already-installed versions, so a bare `update`\n\t\t\t// there re-resolves the current version and reports nothing to do.\n\t\t\t// Non-factory plugins keep the bare `update` registry semantics.\n\t\t\tconst factoryEntry = BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1.find((item) => item.pluginId === entry.pluginId);\n\t\t\tconst argv = factoryEntry\n\t\t\t\t? [\"install\", `${factoryEntry.npmName}@${factoryEntry.range ?? \"latest\"}`, \"--scope\", scope]\n\t\t\t\t: [\"update\", entry.pluginId, \"--scope\", scope];\n\t\t\tconst response = await cli.execute({ argv });\n\t\t\tif (response.status === \"succeeded\") {\n\t\t\t\tupdated.push(entry.pluginId);\n\t\t\t\twrite(response.text);\n\t\t\t} else if (response.error?.code === \"already_installed\") {\n\t\t\t\tcurrent.push(entry.pluginId);\n\t\t\t} else {\n\t\t\t\tfailed.push(entry.pluginId);\n\t\t\t\twrite(response.text);\n\t\t\t}\n\t\t}\n\t\tconst summary = [\n\t\t\t`updated ${updated.length}${updated.length > 0 ? ` (${updated.join(\", \")})` : \"\"}`,\n\t\t\t`already up to date ${current.length}${current.length > 0 ? ` (${current.join(\", \")})` : \"\"}`,\n\t\t\t`failed ${failed.length}${failed.length > 0 ? ` (${failed.join(\", \")})` : \"\"}`,\n\t\t].join(\"; \");\n\t\twrite(`plugin update --all [${scope}]: ${summary}`);\n\t\tif (failed.length > 0) process.exitCode = 1;\n\t} finally {\n\t\tawait market?.close();\n\t}\n}\n"]}
1
+ {"version":3,"file":"plugin-command.js","sourceRoot":"","sources":["../../src/cli/plugin-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,oCAAoC,EAAE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,CAAC,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACP,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAC5B,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;QACF,CAAC;QACD,MAAM,OAAO,GAAG;YACf,WAAW,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAClF,sBAAsB,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAC7F,UAAU,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;SAC9E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,KAAK,CAAC,wBAAwB,KAAK,MAAM,OAAO,EAAE,CAAC,CAAC;QACpD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC7C,CAAC;YAAS,CAAC;QACV,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;AAAA,CACD","sourcesContent":["import { join } from \"node:path\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../config.ts\";\nimport { BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1 } from \"../plugins/ecosystem/bootstrap-factory-manifest.ts\";\nimport { defaultPluginHostFactsV1, projectPluginScopeRefV1 } from \"../plugins/ecosystem/default-active-bindings.ts\";\nimport {\n\tcreateDefaultPluginMarketWiringV1,\n\ttype DefaultPluginMarketWiringV1,\n} from \"../plugins/ecosystem/default-plugin-market.ts\";\nimport {\n\tcreatePluginEcosystemCliV1,\n\tcreatePluginSelectionStoreV1,\n\tcreatePluginStateStoreV1,\n\tPLUGIN_ECOSYSTEM_CLI_VERSION_V1,\n\ttype PluginDistributionV1,\n\ttype PluginEcosystemCliAcquisitionV1,\n\ttype PluginEcosystemCliParsedCommandV1,\n\ttype PluginEcosystemCliResponseV1,\n\ttype PluginEcosystemCliV1,\n\ttype PluginEcosystemRegistryV1,\n\ttype PluginInstallerV1,\n\ttype PluginSelectionStoreV1,\n\ttype PluginStateStoreV1,\n\tparsePluginEcosystemCliCommandV1,\n} from \"../plugins/ecosystem/index.ts\";\nimport { selectNpmPackageVersionV1 } from \"../plugins/ecosystem/node-npm-registry-source.ts\";\nimport {\n\tisBuiltinPluginProfileIdV1,\n\tlistBuiltinPluginManifestsV1,\n\tlistBuiltinPluginProfilesV1,\n} from \"../profile/plugin-profiles.ts\";\nimport type { PluginManagerControllerV1 } from \"./plugin-manager-controller.ts\";\nimport { createPluginManagerControllerV1 } from \"./plugin-manager-controller.ts\";\n\nexport interface PluginCommandOptionsV1 {\n\treadonly agentDir?: string;\n\t/** Working directory used for the project-local selection store. */\n\treadonly cwd?: string;\n\treadonly host?: {\n\t\treadonly os: string;\n\t\treadonly arch: string;\n\t\treadonly runtime: readonly { readonly name: string; readonly version: string }[];\n\t\treadonly apiVersion: string;\n\t\treadonly hostFeatures: readonly string[];\n\t};\n\t/** Optional host-owned boundaries used by install/update/remove commands. */\n\treadonly registry?: PluginEcosystemRegistryV1;\n\treadonly installer?: PluginInstallerV1;\n\t/** Optional host-owned multi-source package resolution used by install/update. */\n\treadonly acquisition?: PluginEcosystemCliAcquisitionV1;\n\t/** Optional host-owned package download boundary used by install/update. */\n\treadonly distribution?: PluginDistributionV1;\n\t/** Override persistence in tests or an embedding host; defaults remain agentDir files. */\n\treadonly stateStore?: PluginStateStoreV1;\n\t/** Override the project-local persistence boundary in tests or an embedding host. */\n\treadonly projectStateStore?: PluginStateStoreV1;\n\treadonly selectionStore?: PluginSelectionStoreV1;\n\treadonly projectSelectionStore?: PluginSelectionStoreV1;\n\treadonly write?: (line: string) => void;\n}\n\nfunction printResponse(response: PluginEcosystemCliResponseV1, write: (line: string) => void): void {\n\twrite(response.text);\n\tif (response.status !== \"succeeded\") process.exitCode = 1;\n}\n\n/**\n * The parsed `selection set` command, or undefined for every other command\n * and for argv the ecosystem parser rejects (the ecosystem CLI reports those\n * with its own invalid-command diagnostic). Parsing through the shared\n * grammar keeps option positions (`--scope`, `--json`) from displacing the\n * profile token this boundary validates.\n */\nfunction parseSelectionSetCommand(argv: readonly string[]): PluginEcosystemCliParsedCommandV1 | undefined {\n\ttry {\n\t\tconst parsed = parsePluginEcosystemCliCommandV1(argv);\n\t\treturn parsed.command === \"selection-set\" ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\ninterface MarketCliOptionsV1 {\n\treadonly agentDir: string;\n\treadonly cwd: string;\n\treadonly market?: DefaultPluginMarketWiringV1;\n\treadonly overrides?: PluginCommandOptionsV1;\n}\n\nfunction buildMarketCli(options: MarketCliOptionsV1): PluginEcosystemCliV1 {\n\tconst { market, overrides } = options;\n\treturn createPluginEcosystemCliV1({\n\t\thost: overrides?.host ?? defaultPluginHostFactsV1(),\n\t\tmanifests: listBuiltinPluginManifestsV1(),\n\t\tregistry: overrides?.registry ?? market?.cliRegistry,\n\t\t// Multi-source acquisition (`plugin install <ref>`) rides along with the\n\t\t// default market wiring; a fully host-injected stack replaces it wholesale.\n\t\t...(overrides?.acquisition === undefined && market?.acquisition === undefined\n\t\t\t? {}\n\t\t\t: { acquisition: overrides?.acquisition ?? market?.acquisition }),\n\t\tinstaller: overrides?.installer ?? market?.installer,\n\t\t...(overrides?.distribution !== undefined || market?.distribution !== undefined\n\t\t\t? { distribution: overrides?.distribution ?? market!.distribution }\n\t\t\t: {}),\n\t\tstateStore:\n\t\t\toverrides?.stateStore ??\n\t\t\tmarket?.stateStore ??\n\t\t\tcreatePluginStateStoreV1({\n\t\t\t\tfilePath: join(options.agentDir, \"plugin-state.json\"),\n\t\t\t}),\n\t\tprojectStateStore:\n\t\t\toverrides?.projectStateStore ??\n\t\t\tmarket?.projectStateStore ??\n\t\t\tcreatePluginStateStoreV1({\n\t\t\t\tfilePath: join(options.cwd, CONFIG_DIR_NAME, \"plugin-state.json\"),\n\t\t\t}),\n\t\tprojectScopeRef: projectPluginScopeRefV1(options.cwd),\n\t\tselectionStore:\n\t\t\toverrides?.selectionStore ??\n\t\t\tcreatePluginSelectionStoreV1({ filePath: join(options.agentDir, \".plugin-selection.json\") }),\n\t\tprojectSelectionStore:\n\t\t\toverrides?.projectSelectionStore ??\n\t\t\tcreatePluginSelectionStoreV1({ filePath: join(options.cwd, CONFIG_DIR_NAME, \".plugin-selection.json\") }),\n\t});\n}\n\n/**\n * Default TUI manager controller over the default marketplace wiring. The\n * controller reads the global or project state store per scope; callers must\n * invoke `close` after the config screen closes.\n */\nexport async function createDefaultPluginManagerControllerV1(options: {\n\treadonly agentDir?: string;\n\treadonly cwd?: string;\n\treadonly scope: \"global\" | \"project\";\n}): Promise<{ readonly controller: PluginManagerControllerV1; readonly close: () => Promise<void> }> {\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst market = await createDefaultPluginMarketWiringV1({ agentDir, cwd });\n\tconst cli = buildMarketCli({ agentDir, cwd, market });\n\tconst controller = createPluginManagerControllerV1({\n\t\tregistry: market.registry,\n\t\tstateStore: options.scope === \"project\" ? market.projectStateStore : market.stateStore,\n\t\tcli,\n\t});\n\treturn { controller, close: market.close };\n}\n\n/**\n * Handle the independent ecosystem command namespace before legacy package\n * commands. Install/update/remove default to the disk install store plus an\n * optional configured marketplace origin; host injection of registry and\n * installer still wins entirely.\n */\nexport async function handlePluginEcosystemCommand(\n\targs: readonly string[],\n\toptions: PluginCommandOptionsV1 = {},\n): Promise<boolean> {\n\tif (args[0] !== \"plugin\") return false;\n\tconst write = options.write ?? ((line: string) => console.log(line));\n\t// Batch update convenience (0.85.7 user seat finding: a factory range bump\n\t// left seven plugins outdated and the per-plugin hint meant seven manual\n\t// commands). The ecosystem CLI protocol is unchanged — this outer layer\n\t// composes `state list` + one `update` per active plugin.\n\tif (args[1] === \"update\" && args[2] === \"--all\") {\n\t\tawait runBatchUpdate(args.slice(3), options, write);\n\t\treturn true;\n\t}\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\t// 2026-10-01 dogfood finding: `selection set` accepted any profile id — a\n\t// suite id like \"assistant\" persisted fine while the ordinary run resolves\n\t// only builtin plugin profile ids, so the stored selection could never be\n\t// read back. Unknown ids are rejected here at the CLI command boundary;\n\t// the selection store itself stays host-agnostic.\n\tconst selectionSet = parseSelectionSetCommand(args.slice(1));\n\tif (selectionSet !== undefined && !isBuiltinPluginProfileIdV1(selectionSet.profileId as string)) {\n\t\tconst validProfileIds = listBuiltinPluginProfilesV1()\n\t\t\t.map((profile) => profile.id)\n\t\t\t.join(\", \");\n\t\tconst message = `unknown plugin profile \"${selectionSet.profileId}\"; selection set accepts builtin plugin profile ids only: ${validProfileIds}`;\n\t\tconst base = {\n\t\t\tversion: PLUGIN_ECOSYSTEM_CLI_VERSION_V1,\n\t\t\tcommand: \"selection-set\" as const,\n\t\t\tformat: selectionSet.format,\n\t\t\tstatus: \"failed\" as const,\n\t\t\terror: { code: \"invalid_command\" as const, message },\n\t\t};\n\t\tprintResponse(\n\t\t\t{\n\t\t\t\t...base,\n\t\t\t\ttext: selectionSet.format === \"json\" ? JSON.stringify(base) : `failed: ${message}`,\n\t\t\t},\n\t\t\twrite,\n\t\t);\n\t\treturn true;\n\t}\n\tconst market =\n\t\toptions.registry === undefined && options.installer === undefined\n\t\t\t? await createDefaultPluginMarketWiringV1({ agentDir, cwd })\n\t\t\t: undefined;\n\ttry {\n\t\tconst cli = buildMarketCli({ agentDir, cwd, market, overrides: options });\n\t\tconst response = await cli.execute({ argv: args.slice(1) });\n\t\tprintResponse(response, write);\n\t\t// CRM seat finding F3, corrected by the 2026-10-01 dogfood: installing\n\t\t// a plugin activates nothing, and the old hint pointed at `plugin\n\t\t// selection set` — a store no ordinary run reads, so suite users were\n\t\t// sent down a dead end. The real activation path is the suite's\n\t\t// capabilities list in suite.json.\n\t\tif (response.status === \"succeeded\" && response.command === \"install\") {\n\t\t\tconst pluginId = response.data?.pluginId;\n\t\t\tif (typeof pluginId === \"string\") {\n\t\t\t\twrite(\n\t\t\t\t\t`note: this plugin is installed but not yet active; to activate its tools add \"${pluginId}\" to the capabilities list in <agentDir>/suites/<suite>/suite.json and restart`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t} finally {\n\t\tawait market?.close();\n\t}\n}\n\ninterface BatchUpdateEntry {\n\treadonly pluginId: string;\n\treadonly pluginVersion?: string;\n\treadonly scope: string;\n\treadonly lifecycle: string;\n}\n\nasync function runBatchUpdate(\n\trestArgs: readonly string[],\n\toptions: PluginCommandOptionsV1,\n\twrite: (line: string) => void,\n): Promise<void> {\n\tconst agentDir = options.agentDir ?? getAgentDir();\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst scopeIndex = restArgs.indexOf(\"--scope\");\n\tconst scope = scopeIndex !== -1 && restArgs[scopeIndex + 1] === \"project\" ? \"project\" : \"global\";\n\tconst market =\n\t\toptions.registry === undefined && options.installer === undefined\n\t\t\t? await createDefaultPluginMarketWiringV1({ agentDir, cwd })\n\t\t\t: undefined;\n\ttry {\n\t\tconst cli = buildMarketCli({ agentDir, cwd, market, overrides: options });\n\t\tconst listResponse = await cli.execute({ argv: [\"state\", \"list\", \"--scope\", scope] });\n\t\tif (listResponse.status !== \"succeeded\") {\n\t\t\tprintResponse(listResponse, write);\n\t\t\treturn;\n\t\t}\n\t\tconst entries = ((listResponse.data?.entries ?? []) as readonly BatchUpdateEntry[]).filter(\n\t\t\t(entry) => entry.lifecycle === \"active\" && entry.scope === scope,\n\t\t);\n\t\tif (entries.length === 0) {\n\t\t\twrite(\"No active plugins to update.\");\n\t\t\treturn;\n\t\t}\n\t\tconst updated: string[] = [];\n\t\tconst current: string[] = [];\n\t\tconst failed: string[] = [];\n\t\tfor (const entry of entries) {\n\t\t\t// Factory-listed first-party plugins upgrade through the npm range the\n\t\t\t// bootstrap warnings name (`install <npmName>@^range`): the default disk\n\t\t\t// registry only resolves already-installed versions, so a bare `update`\n\t\t\t// there re-resolves the current version and reports nothing to do.\n\t\t\t// Non-factory plugins keep the bare `update` registry semantics.\n\t\t\tconst factoryEntry = BOOTSTRAP_FACTORY_PLUGIN_MANIFEST_V1.find((item) => item.pluginId === entry.pluginId);\n\t\t\t// Offline satisfiability pre-check: when the recorded version already\n\t\t\t// satisfies the factory range, classifying as current must not touch the\n\t\t\t// network — acquisition downloads before its already_installed check, so\n\t\t\t// satisfied entries re-downloaded every run and one network blip failed\n\t\t\t// them. `latest`/absent ranges stay online-only (satisfiability is not\n\t\t\t// decidable offline); the check reuses the npm range selector.\n\t\t\tconst range = factoryEntry?.range;\n\t\t\tif (\n\t\t\t\tfactoryEntry !== undefined &&\n\t\t\t\trange !== undefined &&\n\t\t\t\trange !== \"latest\" &&\n\t\t\t\tentry.pluginVersion !== undefined &&\n\t\t\t\tselectNpmPackageVersionV1([entry.pluginVersion], range) === entry.pluginVersion\n\t\t\t) {\n\t\t\t\tcurrent.push(entry.pluginId);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst argv = factoryEntry\n\t\t\t\t? [\"install\", `${factoryEntry.npmName}@${range ?? \"latest\"}`, \"--scope\", scope]\n\t\t\t\t: [\"update\", entry.pluginId, \"--scope\", scope];\n\t\t\tconst response = await cli.execute({ argv });\n\t\t\tif (response.status === \"succeeded\") {\n\t\t\t\tupdated.push(entry.pluginId);\n\t\t\t\twrite(response.text);\n\t\t\t} else if (response.error?.code === \"already_installed\") {\n\t\t\t\tcurrent.push(entry.pluginId);\n\t\t\t} else {\n\t\t\t\tfailed.push(entry.pluginId);\n\t\t\t\twrite(response.text);\n\t\t\t}\n\t\t}\n\t\tconst summary = [\n\t\t\t`updated ${updated.length}${updated.length > 0 ? ` (${updated.join(\", \")})` : \"\"}`,\n\t\t\t`already up to date ${current.length}${current.length > 0 ? ` (${current.join(\", \")})` : \"\"}`,\n\t\t\t`failed ${failed.length}${failed.length > 0 ? ` (${failed.join(\", \")})` : \"\"}`,\n\t\t].join(\"; \");\n\t\twrite(`plugin update --all [${scope}]: ${summary}`);\n\t\tif (failed.length > 0) process.exitCode = 1;\n\t} finally {\n\t\tawait market?.close();\n\t}\n}\n"]}
package/dist/config.d.ts CHANGED
@@ -46,8 +46,8 @@ export declare function getThemesDir(): string;
46
46
  export declare function getExportTemplateDir(): string;
47
47
  /** Get path to package.json */
48
48
  export declare function getPackageJsonPath(): string;
49
- /** Get path to README.md */
50
- export declare function getReadmePath(): string;
49
+ /** Get path to README.md — shared with the coding-tools plugin via the `@agent-forge/host/readme-path` supply key. */
50
+ export { getReadmePath } from "./core/tools/readme-path.ts";
51
51
  /** Get path to docs directory */
52
52
  export declare function getDocsPath(): string;
53
53
  /** Get path to examples directory */
@@ -91,5 +91,4 @@ export declare function getPromptsDir(): string;
91
91
  export declare function getSessionsDir(): string;
92
92
  /** Get path to debug log file */
93
93
  export declare function getDebugLogPath(): string;
94
- export {};
95
94
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,WAAW,SACqF,CAAC;AAE9G,gEAAgE;AAChE,eAAO,MAAM,YAAY,SAAyB,CAAC;AAMnD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;AAEvF,UAAU,qBAAqB;IAC9B,OAAO,EAAE,MAAM,CAAC;IACh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ED,8CAA8C;AAC9C,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnE;AAwBD,eAAO,MAAM,YAAY,EAAE,MAA+C,CAAC;AAC3E,eAAO,MAAM,QAAQ,EAAE,MAA8C,CAAC;AACtE,eAAO,MAAM,SAAS,EAAE,MAAwD,CAAC;AACjF,eAAO,MAAM,eAAe,EAAE,MAA0D,CAAC;AACzF,eAAO,MAAM,OAAO,EAAE,MAA+B,CAAC;AAKtD,eAAO,MAAM,aAAa,QAA0B,CAAC;AACrD,eAAO,MAAM,eAAe,QAAkC,CAAC;AAE/D,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAMD,mEAAmE;AACnE,wBAAgB,WAAW,IAAI,MAAM,CAMpC;AAED,iDAAiD;AACjD,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,8BAA8B;AAC9B,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,4BAA4B;AAC5B,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,gCAAgC;AAChC,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,kCAAkC;AAClC,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,sDAAsD;AACtD,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,6CAA6C;AAC7C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,qCAAqC;AACrC,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,iCAAiC;AACjC,wBAAgB,eAAe,IAAI,MAAM,CAExC","sourcesContent":["import { accessSync, constants, existsSync, readFileSync, realpathSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { basename, dirname, join, resolve, sep, win32 } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { t } from \"./core/i18n/index.ts\";\nimport { spawnProcessSync } from \"./utils/child-process.ts\";\nimport { normalizePath } from \"./utils/paths.ts\";\nimport { stripBom } from \"./utils/text.ts\";\n\n// =============================================================================\n// Package Detection\n// =============================================================================\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Detect if we're running as a Bun compiled binary.\n * Bun binaries have import.meta.url containing \"$bunfs\", \"~BUN\", or \"%7EBUN\" (Bun's virtual filesystem path)\n */\nexport const isBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\n/** Detect if Bun is the runtime (compiled binary or bun run) */\nexport const isBunRuntime = !!process.versions.bun;\n\n// =============================================================================\n// Install Method Detection\n// =============================================================================\n\nexport type InstallMethod = \"bun-binary\" | \"npm\" | \"pnpm\" | \"yarn\" | \"bun\" | \"unknown\";\n\ninterface SelfUpdateCommandStep {\n\tcommand: string;\n\targs: string[];\n\tdisplay: string;\n}\n\nexport interface SelfUpdateCommand extends SelfUpdateCommandStep {\n\tsteps?: SelfUpdateCommandStep[];\n}\n\nexport type SelfUpdatePackageTarget = string | { packageName: string; installSpec?: string };\n\nfunction normalizeSelfUpdatePackageTarget(target: SelfUpdatePackageTarget): {\n\tpackageName: string;\n\tinstallSpec: string;\n} {\n\tif (typeof target === \"string\") {\n\t\treturn { packageName: target, installSpec: target };\n\t}\n\treturn { packageName: target.packageName, installSpec: target.installSpec ?? target.packageName };\n}\n\nfunction makeSelfUpdateCommand(\n\tinstallStep: SelfUpdateCommandStep,\n\tuninstallStep?: SelfUpdateCommandStep,\n): SelfUpdateCommand {\n\tif (!uninstallStep) return installStep;\n\treturn {\n\t\t...installStep,\n\t\tdisplay: `${uninstallStep.display} && ${installStep.display}`,\n\t\tsteps: [uninstallStep, installStep],\n\t};\n}\n\nfunction makeSelfUpdateCommandStep(command: string, args: string[]): SelfUpdateCommandStep {\n\treturn {\n\t\tcommand,\n\t\targs,\n\t\tdisplay: [command, ...args].map((arg) => (/\\s/.test(arg) ? `\"${arg}\"` : arg)).join(\" \"),\n\t};\n}\n\nexport function detectInstallMethod(): InstallMethod {\n\tif (isBunBinary) {\n\t\treturn \"bun-binary\";\n\t}\n\n\tconst resolvedPath = `${__dirname}\\0${process.execPath || \"\"}`.toLowerCase().replace(/\\\\/g, \"/\");\n\n\tif (resolvedPath.includes(\"/pnpm/\") || resolvedPath.includes(\"/.pnpm/\")) {\n\t\treturn \"pnpm\";\n\t}\n\tif (resolvedPath.includes(\"/yarn/\") || resolvedPath.includes(\"/.yarn/\")) {\n\t\treturn \"yarn\";\n\t}\n\tif (isBunRuntime || resolvedPath.includes(\"/install/global/node_modules/\")) {\n\t\treturn \"bun\";\n\t}\n\tif (resolvedPath.includes(\"/npm/\") || resolvedPath.includes(\"/node_modules/\")) {\n\t\treturn \"npm\";\n\t}\n\n\treturn \"unknown\";\n}\n\nfunction getInferredNpmInstall(): { root: string; prefix: string } | undefined {\n\tconst packageDir = getPackageDir();\n\tconst path = process.platform === \"win32\" || packageDir.includes(\"\\\\\") ? win32 : { basename, dirname };\n\tconst parent = path.dirname(packageDir);\n\tlet root: string | undefined;\n\tif (path.basename(parent).startsWith(\"@\") && path.basename(path.dirname(parent)) === \"node_modules\") {\n\t\troot = path.dirname(parent);\n\t} else if (path.basename(parent) === \"node_modules\") {\n\t\troot = parent;\n\t}\n\tif (!root) return undefined;\n\tconst rootParent = path.dirname(root);\n\tif (path.basename(rootParent) === \"lib\") return { root, prefix: path.dirname(rootParent) };\n\t// Windows global npm prefixes use `<prefix>\\\\node_modules`, which is\n\t// indistinguishable from local project installs by path shape alone. Do not\n\t// infer unsupported Windows custom prefixes without `npm root -g` evidence.\n\treturn undefined;\n}\n\nfunction getSelfUpdateCommandForMethod(\n\tmethod: InstallMethod,\n\tinstalledPackageName: string,\n\tupdatePackageTarget: SelfUpdatePackageTarget = installedPackageName,\n\tnpmCommand?: string[],\n): SelfUpdateCommand | undefined {\n\tconst target = normalizeSelfUpdatePackageTarget(updatePackageTarget);\n\tswitch (method) {\n\t\tcase \"bun-binary\":\n\t\t\treturn undefined;\n\t\tcase \"pnpm\": {\n\t\t\tconst match = readCommandOutput(\"pnpm\", [\"root\", \"-g\"])\n\t\t\t\t? undefined\n\t\t\t\t: /^(.*[\\\\/]global[\\\\/][^\\\\/]+)[\\\\/]\\.pnpm[\\\\/]/.exec(getPackageDir());\n\t\t\tconst binDirArgs = match\n\t\t\t\t? [`--config.global-bin-dir=${process.env.PNPM_HOME || dirname(dirname(match[1]))}`]\n\t\t\t\t: [];\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"pnpm\", [\n\t\t\t\t\t\"install\",\n\t\t\t\t\t\"-g\",\n\t\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\t\"--config.minimumReleaseAge=0\",\n\t\t\t\t\t...binDirArgs,\n\t\t\t\t\ttarget.installSpec,\n\t\t\t\t]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"pnpm\", [\"remove\", \"-g\", ...binDirArgs, installedPackageName]),\n\t\t\t);\n\t\t}\n\t\tcase \"yarn\":\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"yarn\", [\"global\", \"add\", \"--ignore-scripts\", target.installSpec]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"yarn\", [\"global\", \"remove\", installedPackageName]),\n\t\t\t);\n\t\tcase \"bun\":\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"bun\", [\n\t\t\t\t\t\"install\",\n\t\t\t\t\t\"-g\",\n\t\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\t\"--minimum-release-age=0\",\n\t\t\t\t\ttarget.installSpec,\n\t\t\t\t]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"bun\", [\"uninstall\", \"-g\", installedPackageName]),\n\t\t\t);\n\t\tcase \"npm\": {\n\t\t\tconst [command = \"npm\", ...npmArgs] = npmCommand ?? [];\n\t\t\tconst inferred = npmCommand?.length ? undefined : getInferredNpmInstall();\n\t\t\tconst prefixArgs = [...npmArgs, ...(inferred ? [\"--prefix\", inferred.prefix] : [])];\n\t\t\tconst installStep = makeSelfUpdateCommandStep(command, [\n\t\t\t\t...prefixArgs,\n\t\t\t\t\"install\",\n\t\t\t\t\"-g\",\n\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\"--min-release-age=0\",\n\t\t\t\ttarget.installSpec,\n\t\t\t]);\n\t\t\tconst uninstallStep =\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(command, [...prefixArgs, \"uninstall\", \"-g\", installedPackageName]);\n\t\t\treturn makeSelfUpdateCommand(installStep, uninstallStep);\n\t\t}\n\t\tcase \"unknown\":\n\t\t\treturn undefined;\n\t}\n}\n\nfunction readCommandOutput(\n\tcommand: string,\n\targs: string[],\n\toptions: { requireSuccess?: boolean } = {},\n): string | undefined {\n\tconst result = spawnProcessSync(command, args, {\n\t\tencoding: \"utf-8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t});\n\tif (result.status === 0) return result.stdout.trim() || undefined;\n\tif (options.requireSuccess) {\n\t\tconst reason = result.error?.message || result.stderr.trim() || `exit code ${result.status ?? \"unknown\"}`;\n\t\tthrow new Error(t(\"Failed to run {command}: {reason}\", { command: [command, ...args].join(\" \"), reason }));\n\t}\n\treturn undefined;\n}\n\nfunction getGlobalPackageRoots(method: InstallMethod, _packageName: string, npmCommand?: string[]): string[] {\n\tswitch (method) {\n\t\tcase \"npm\": {\n\t\t\tconst configured = !!npmCommand?.length;\n\t\t\tconst [command = \"npm\", ...npmArgs] = npmCommand ?? [];\n\t\t\tif (configured && command === \"bun\") {\n\t\t\t\tconst bunBin = readCommandOutput(command, [...npmArgs, \"pm\", \"bin\", \"-g\"], {\n\t\t\t\t\trequireSuccess: true,\n\t\t\t\t});\n\t\t\t\tconst roots = [join(homedir(), \".bun\", \"install\", \"global\", \"node_modules\")];\n\t\t\t\tif (bunBin) {\n\t\t\t\t\troots.push(join(dirname(bunBin), \"install\", \"global\", \"node_modules\"));\n\t\t\t\t}\n\t\t\t\treturn roots;\n\t\t\t}\n\t\t\tconst root = readCommandOutput(command, [...npmArgs, \"root\", \"-g\"], {\n\t\t\t\trequireSuccess: configured,\n\t\t\t});\n\t\t\tconst inferred = configured ? undefined : getInferredNpmInstall();\n\t\t\treturn [root, inferred?.root].filter((x): x is string => !!x);\n\t\t}\n\t\tcase \"pnpm\": {\n\t\t\tconst root = readCommandOutput(\"pnpm\", [\"root\", \"-g\"]);\n\t\t\tif (root) return [root, dirname(root)];\n\t\t\tconst match = /^(.*[\\\\/]global[\\\\/][^\\\\/]+)[\\\\/]\\.pnpm[\\\\/]/.exec(getPackageDir());\n\t\t\treturn match ? [match[1]] : [];\n\t\t}\n\t\tcase \"yarn\": {\n\t\t\tconst dir = readCommandOutput(\"yarn\", [\"global\", \"dir\"]);\n\t\t\treturn dir ? [dir, join(dir, \"node_modules\")] : [];\n\t\t}\n\t\tcase \"bun\": {\n\t\t\tconst bunBin = readCommandOutput(\"bun\", [\"pm\", \"bin\", \"-g\"]);\n\t\t\tconst roots = [join(homedir(), \".bun\", \"install\", \"global\", \"node_modules\")];\n\t\t\tif (bunBin) {\n\t\t\t\troots.push(join(dirname(bunBin), \"install\", \"global\", \"node_modules\"));\n\t\t\t}\n\t\t\treturn roots;\n\t\t}\n\t\tcase \"bun-binary\":\n\t\tcase \"unknown\":\n\t\t\treturn [];\n\t}\n}\n\nfunction normalizeExistingPathForComparison(path: string, resolveSymlinks: boolean): string | undefined {\n\tconst resolvedPath = resolve(path);\n\tif (!existsSync(resolvedPath)) {\n\t\treturn undefined;\n\t}\n\tlet normalizedPath = resolvedPath;\n\tif (resolveSymlinks) {\n\t\ttry {\n\t\t\tnormalizedPath = realpathSync(resolvedPath);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\tif (process.platform === \"win32\") {\n\t\tnormalizedPath = normalizedPath.toLowerCase();\n\t}\n\treturn normalizedPath;\n}\n\nfunction getPathComparisonCandidates(path: string): string[] {\n\treturn Array.from(\n\t\tnew Set(\n\t\t\t[normalizeExistingPathForComparison(path, false), normalizeExistingPathForComparison(path, true)].filter(\n\t\t\t\t(candidate): candidate is string => !!candidate,\n\t\t\t),\n\t\t),\n\t);\n}\n\nfunction getEntrypointPackageDir(): string | undefined {\n\tconst entrypoint = process.argv[1];\n\tif (!entrypoint) return undefined;\n\tlet dir = dirname(entrypoint);\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\treturn undefined;\n}\n\nfunction isSelfUpdatePathWritable(): boolean {\n\tconst packageDir = getPackageDir();\n\ttry {\n\t\taccessSync(packageDir, constants.W_OK);\n\t\taccessSync(dirname(packageDir), constants.W_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction isManagedByGlobalPackageManager(method: InstallMethod, packageName: string, npmCommand?: string[]): boolean {\n\tconst packageDirs = [getPackageDir(), getEntrypointPackageDir()].filter((dir): dir is string => !!dir);\n\tconst packageDirCandidates = packageDirs.flatMap((dir) => getPathComparisonCandidates(dir));\n\treturn getGlobalPackageRoots(method, packageName, npmCommand).some((root) => {\n\t\treturn getPathComparisonCandidates(root).some((normalizedRoot) => {\n\t\t\tconst rootPrefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\t\treturn packageDirCandidates.some((packageDir) => packageDir.startsWith(rootPrefix));\n\t\t});\n\t});\n}\n\nexport function getSelfUpdateCommand(\n\tpackageName: string,\n\tnpmCommand?: string[],\n\tupdatePackageTarget: SelfUpdatePackageTarget = packageName,\n): SelfUpdateCommand | undefined {\n\tconst method = detectInstallMethod();\n\tconst command = getSelfUpdateCommandForMethod(method, packageName, updatePackageTarget, npmCommand);\n\tif (!command || !isManagedByGlobalPackageManager(method, packageName, npmCommand) || !isSelfUpdatePathWritable()) {\n\t\treturn undefined;\n\t}\n\treturn command;\n}\n\nexport function getSelfUpdateUnavailableInstruction(\n\tpackageName: string,\n\tnpmCommand?: string[],\n\tupdatePackageTarget: SelfUpdatePackageTarget = packageName,\n): string {\n\tconst method = detectInstallMethod();\n\tconst target = normalizeSelfUpdatePackageTarget(updatePackageTarget);\n\tif (method === \"bun-binary\") {\n\t\treturn \"This standalone binary has no configured update source. Update it using the release channel that installed it.\";\n\t}\n\tconst command = getSelfUpdateCommandForMethod(method, packageName, target, npmCommand);\n\tif (command) {\n\t\tif (isManagedByGlobalPackageManager(method, packageName, npmCommand) && !isSelfUpdatePathWritable()) {\n\t\t\treturn `This installation is managed by a global ${method} install, but the install path is not writable. Update it yourself with: ${command.display}`;\n\t\t}\n\t\treturn `This installation is not managed by a global ${method} install. Update it with the package manager, wrapper, or source checkout that provides it.`;\n\t}\n\treturn `Update ${target.installSpec} using the package manager, wrapper, or source checkout that provides this installation.`;\n}\n\nexport function getUpdateInstruction(packageName: string): string {\n\tconst method = detectInstallMethod();\n\tconst command = getSelfUpdateCommandForMethod(method, packageName);\n\tif (command) {\n\t\treturn `Run: ${command.display}`;\n\t}\n\treturn getSelfUpdateUnavailableInstruction(packageName);\n}\n\n// =============================================================================\n// Package Asset Paths (shipped with executable)\n// =============================================================================\n\n/**\n * Get the base directory for resolving package assets (themes, package.json, README.md, CHANGELOG.md).\n * - For Bun binary: returns the directory containing the executable\n * - For Node.js and tsx: returns the package root containing package.json\n * - Ignores Bun binary metadata copied into dist/ when the package root is available\n */\nexport function findNodePackageDir(startDir: string): string {\n\tlet dir = startDir;\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\tconst parent = dirname(dir);\n\t\t\t// Bun binary packaging (distribution line retired 2026-10-03) placed\n\t\t\t// Bun's metadata inside dist/. Node still needs the package root so\n\t\t\t// its dist-relative asset paths do not become dist/dist/.\n\t\t\tif (basename(dir) === \"dist\" && existsSync(join(parent, \"package.json\"))) {\n\t\t\t\treturn parent;\n\t\t\t}\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\treturn startDir;\n}\n\nexport function getPackageDir(): string {\n\t// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)\n\tconst envDir = process.env.AGENT_FORGE_PACKAGE_DIR;\n\tif (envDir) {\n\t\treturn normalizePath(envDir);\n\t}\n\n\tif (isBunBinary) {\n\t\t// Bun binary: process.execPath points to the compiled executable\n\t\treturn dirname(process.execPath);\n\t}\n\treturn findNodePackageDir(__dirname);\n}\n\n/**\n * Get path to built-in themes directory (shipped with package)\n * - For Bun binary: theme/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/theme/\n * - For tsx (src/): src/modes/interactive/theme/\n */\nexport function getThemesDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"theme\");\n\t}\n\t// Theme is in modes/interactive/theme/ relative to src/ or dist/\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"theme\");\n}\n\n/**\n * Get path to HTML export template directory (shipped with package)\n * - For Bun binary: export-html/ next to executable\n * - For Node.js (dist/): dist/core/export-html/\n * - For tsx (src/): src/core/export-html/\n */\nexport function getExportTemplateDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"export-html\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"core\", \"export-html\");\n}\n\n/** Get path to package.json */\nexport function getPackageJsonPath(): string {\n\treturn join(getPackageDir(), \"package.json\");\n}\n\n/** Get path to README.md */\nexport function getReadmePath(): string {\n\treturn resolve(join(getPackageDir(), \"README.md\"));\n}\n\n/** Get path to docs directory */\nexport function getDocsPath(): string {\n\treturn resolve(join(getPackageDir(), \"docs\"));\n}\n\n/** Get path to examples directory */\nexport function getExamplesPath(): string {\n\treturn resolve(join(getPackageDir(), \"examples\"));\n}\n\n/** Get path to CHANGELOG.md */\nexport function getChangelogPath(): string {\n\treturn resolve(join(getPackageDir(), \"CHANGELOG.md\"));\n}\n\n/**\n * Get path to built-in interactive assets directory.\n * - For Bun binary: assets/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/assets/\n * - For tsx (src/): src/modes/interactive/assets/\n */\nexport function getInteractiveAssetsDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"assets\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"assets\");\n}\n\n/** Get path to a bundled interactive asset */\nexport function getBundledInteractiveAssetPath(name: string): string {\n\treturn join(getInteractiveAssetsDir(), name);\n}\n\n// =============================================================================\n// App Config (from package.json agentForgeConfig)\n// =============================================================================\n\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\tagentForgeConfig?: {\n\t\tname?: string;\n\t\tconfigDir?: string;\n\t};\n}\n\nlet pkg: PackageJson = {};\ntry {\n\tpkg = JSON.parse(stripBom(readFileSync(getPackageJsonPath(), \"utf-8\"))) as PackageJson;\n} catch (e: unknown) {\n\tconst err = e as NodeJS.ErrnoException;\n\tif (err.code !== \"ENOENT\") throw e;\n}\n\nconst agentForgeConfigName: string | undefined = pkg.agentForgeConfig?.name;\nexport const PACKAGE_NAME: string = pkg.name || \"@agent-forge/agent-forge\";\nexport const APP_NAME: string = agentForgeConfigName || \"agent-forge\";\nexport const APP_TITLE: string = agentForgeConfigName ? APP_NAME : \"Agent Forge\";\nexport const CONFIG_DIR_NAME: string = pkg.agentForgeConfig?.configDir || \".agent-forge\";\nexport const VERSION: string = pkg.version || \"0.0.0\";\n\n// Environment names use an underscore-safe application prefix (for example,\n// AGENT_FORGE_DIR and AGENT_FORGE_SESSION_DIR).\nconst ENV_APP_PREFIX = APP_NAME.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\");\nexport const ENV_AGENT_DIR = `${ENV_APP_PREFIX}_DIR`;\nexport const ENV_SESSION_DIR = `${ENV_APP_PREFIX}_SESSION_DIR`;\n\nexport function expandTildePath(path: string): string {\n\treturn normalizePath(path);\n}\n\n// =============================================================================\n// User Config Paths (~/.agent-forge/agent/*)\n// =============================================================================\n\n/** Get the agent config directory (e.g., ~/.agent-forge/agent/) */\nexport function getAgentDir(): string {\n\tconst envDir = process.env[ENV_AGENT_DIR];\n\tif (envDir) {\n\t\treturn expandTildePath(envDir);\n\t}\n\treturn join(homedir(), CONFIG_DIR_NAME, \"agent\");\n}\n\n/** Get path to user's custom themes directory */\nexport function getCustomThemesDir(): string {\n\treturn join(getAgentDir(), \"themes\");\n}\n\n/** Get path to models.json */\nexport function getModelsPath(): string {\n\treturn join(getAgentDir(), \"models.json\");\n}\n\n/** Get path to auth.json */\nexport function getAuthPath(): string {\n\treturn join(getAgentDir(), \"auth.json\");\n}\n\n/** Get path to settings.json */\nexport function getSettingsPath(): string {\n\treturn join(getAgentDir(), \"settings.json\");\n}\n\n/** Get path to tools directory */\nexport function getToolsDir(): string {\n\treturn join(getAgentDir(), \"tools\");\n}\n\n/** Get path to managed binaries directory (fd, rg) */\nexport function getBinDir(): string {\n\treturn join(getAgentDir(), \"bin\");\n}\n\n/** Get path to prompt templates directory */\nexport function getPromptsDir(): string {\n\treturn join(getAgentDir(), \"prompts\");\n}\n\n/** Get path to sessions directory */\nexport function getSessionsDir(): string {\n\treturn join(getAgentDir(), \"sessions\");\n}\n\n/** Get path to debug log file */\nexport function getDebugLogPath(): string {\n\treturn join(getAgentDir(), `${APP_NAME}-debug.log`);\n}\n"]}
1
+ {"version":3,"file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,MAAM,CAEvC;AAED,iCAAiC;AACjC,wBAAgB,eAAe,IAAI,MAAM,CAExC","sourcesContent":["import { accessSync, constants, existsSync, readFileSync, realpathSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { basename, dirname, join, resolve, sep, win32 } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { t } from \"./core/i18n/index.ts\";\nimport { spawnProcessSync } from \"./utils/child-process.ts\";\nimport { normalizePath } from \"./utils/paths.ts\";\nimport { stripBom } from \"./utils/text.ts\";\n\n// =============================================================================\n// Package Detection\n// =============================================================================\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Detect if we're running as a Bun compiled binary.\n * Bun binaries have import.meta.url containing \"$bunfs\", \"~BUN\", or \"%7EBUN\" (Bun's virtual filesystem path)\n */\nexport const isBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\n/** Detect if Bun is the runtime (compiled binary or bun run) */\nexport const isBunRuntime = !!process.versions.bun;\n\n// =============================================================================\n// Install Method Detection\n// =============================================================================\n\nexport type InstallMethod = \"bun-binary\" | \"npm\" | \"pnpm\" | \"yarn\" | \"bun\" | \"unknown\";\n\ninterface SelfUpdateCommandStep {\n\tcommand: string;\n\targs: string[];\n\tdisplay: string;\n}\n\nexport interface SelfUpdateCommand extends SelfUpdateCommandStep {\n\tsteps?: SelfUpdateCommandStep[];\n}\n\nexport type SelfUpdatePackageTarget = string | { packageName: string; installSpec?: string };\n\nfunction normalizeSelfUpdatePackageTarget(target: SelfUpdatePackageTarget): {\n\tpackageName: string;\n\tinstallSpec: string;\n} {\n\tif (typeof target === \"string\") {\n\t\treturn { packageName: target, installSpec: target };\n\t}\n\treturn { packageName: target.packageName, installSpec: target.installSpec ?? target.packageName };\n}\n\nfunction makeSelfUpdateCommand(\n\tinstallStep: SelfUpdateCommandStep,\n\tuninstallStep?: SelfUpdateCommandStep,\n): SelfUpdateCommand {\n\tif (!uninstallStep) return installStep;\n\treturn {\n\t\t...installStep,\n\t\tdisplay: `${uninstallStep.display} && ${installStep.display}`,\n\t\tsteps: [uninstallStep, installStep],\n\t};\n}\n\nfunction makeSelfUpdateCommandStep(command: string, args: string[]): SelfUpdateCommandStep {\n\treturn {\n\t\tcommand,\n\t\targs,\n\t\tdisplay: [command, ...args].map((arg) => (/\\s/.test(arg) ? `\"${arg}\"` : arg)).join(\" \"),\n\t};\n}\n\nexport function detectInstallMethod(): InstallMethod {\n\tif (isBunBinary) {\n\t\treturn \"bun-binary\";\n\t}\n\n\tconst resolvedPath = `${__dirname}\\0${process.execPath || \"\"}`.toLowerCase().replace(/\\\\/g, \"/\");\n\n\tif (resolvedPath.includes(\"/pnpm/\") || resolvedPath.includes(\"/.pnpm/\")) {\n\t\treturn \"pnpm\";\n\t}\n\tif (resolvedPath.includes(\"/yarn/\") || resolvedPath.includes(\"/.yarn/\")) {\n\t\treturn \"yarn\";\n\t}\n\tif (isBunRuntime || resolvedPath.includes(\"/install/global/node_modules/\")) {\n\t\treturn \"bun\";\n\t}\n\tif (resolvedPath.includes(\"/npm/\") || resolvedPath.includes(\"/node_modules/\")) {\n\t\treturn \"npm\";\n\t}\n\n\treturn \"unknown\";\n}\n\nfunction getInferredNpmInstall(): { root: string; prefix: string } | undefined {\n\tconst packageDir = getPackageDir();\n\tconst path = process.platform === \"win32\" || packageDir.includes(\"\\\\\") ? win32 : { basename, dirname };\n\tconst parent = path.dirname(packageDir);\n\tlet root: string | undefined;\n\tif (path.basename(parent).startsWith(\"@\") && path.basename(path.dirname(parent)) === \"node_modules\") {\n\t\troot = path.dirname(parent);\n\t} else if (path.basename(parent) === \"node_modules\") {\n\t\troot = parent;\n\t}\n\tif (!root) return undefined;\n\tconst rootParent = path.dirname(root);\n\tif (path.basename(rootParent) === \"lib\") return { root, prefix: path.dirname(rootParent) };\n\t// Windows global npm prefixes use `<prefix>\\\\node_modules`, which is\n\t// indistinguishable from local project installs by path shape alone. Do not\n\t// infer unsupported Windows custom prefixes without `npm root -g` evidence.\n\treturn undefined;\n}\n\nfunction getSelfUpdateCommandForMethod(\n\tmethod: InstallMethod,\n\tinstalledPackageName: string,\n\tupdatePackageTarget: SelfUpdatePackageTarget = installedPackageName,\n\tnpmCommand?: string[],\n): SelfUpdateCommand | undefined {\n\tconst target = normalizeSelfUpdatePackageTarget(updatePackageTarget);\n\tswitch (method) {\n\t\tcase \"bun-binary\":\n\t\t\treturn undefined;\n\t\tcase \"pnpm\": {\n\t\t\tconst match = readCommandOutput(\"pnpm\", [\"root\", \"-g\"])\n\t\t\t\t? undefined\n\t\t\t\t: /^(.*[\\\\/]global[\\\\/][^\\\\/]+)[\\\\/]\\.pnpm[\\\\/]/.exec(getPackageDir());\n\t\t\tconst binDirArgs = match\n\t\t\t\t? [`--config.global-bin-dir=${process.env.PNPM_HOME || dirname(dirname(match[1]))}`]\n\t\t\t\t: [];\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"pnpm\", [\n\t\t\t\t\t\"install\",\n\t\t\t\t\t\"-g\",\n\t\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\t\"--config.minimumReleaseAge=0\",\n\t\t\t\t\t...binDirArgs,\n\t\t\t\t\ttarget.installSpec,\n\t\t\t\t]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"pnpm\", [\"remove\", \"-g\", ...binDirArgs, installedPackageName]),\n\t\t\t);\n\t\t}\n\t\tcase \"yarn\":\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"yarn\", [\"global\", \"add\", \"--ignore-scripts\", target.installSpec]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"yarn\", [\"global\", \"remove\", installedPackageName]),\n\t\t\t);\n\t\tcase \"bun\":\n\t\t\treturn makeSelfUpdateCommand(\n\t\t\t\tmakeSelfUpdateCommandStep(\"bun\", [\n\t\t\t\t\t\"install\",\n\t\t\t\t\t\"-g\",\n\t\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\t\"--minimum-release-age=0\",\n\t\t\t\t\ttarget.installSpec,\n\t\t\t\t]),\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(\"bun\", [\"uninstall\", \"-g\", installedPackageName]),\n\t\t\t);\n\t\tcase \"npm\": {\n\t\t\tconst [command = \"npm\", ...npmArgs] = npmCommand ?? [];\n\t\t\tconst inferred = npmCommand?.length ? undefined : getInferredNpmInstall();\n\t\t\tconst prefixArgs = [...npmArgs, ...(inferred ? [\"--prefix\", inferred.prefix] : [])];\n\t\t\tconst installStep = makeSelfUpdateCommandStep(command, [\n\t\t\t\t...prefixArgs,\n\t\t\t\t\"install\",\n\t\t\t\t\"-g\",\n\t\t\t\t\"--ignore-scripts\",\n\t\t\t\t\"--min-release-age=0\",\n\t\t\t\ttarget.installSpec,\n\t\t\t]);\n\t\t\tconst uninstallStep =\n\t\t\t\ttarget.packageName === installedPackageName\n\t\t\t\t\t? undefined\n\t\t\t\t\t: makeSelfUpdateCommandStep(command, [...prefixArgs, \"uninstall\", \"-g\", installedPackageName]);\n\t\t\treturn makeSelfUpdateCommand(installStep, uninstallStep);\n\t\t}\n\t\tcase \"unknown\":\n\t\t\treturn undefined;\n\t}\n}\n\nfunction readCommandOutput(\n\tcommand: string,\n\targs: string[],\n\toptions: { requireSuccess?: boolean } = {},\n): string | undefined {\n\tconst result = spawnProcessSync(command, args, {\n\t\tencoding: \"utf-8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t});\n\tif (result.status === 0) return result.stdout.trim() || undefined;\n\tif (options.requireSuccess) {\n\t\tconst reason = result.error?.message || result.stderr.trim() || `exit code ${result.status ?? \"unknown\"}`;\n\t\tthrow new Error(t(\"Failed to run {command}: {reason}\", { command: [command, ...args].join(\" \"), reason }));\n\t}\n\treturn undefined;\n}\n\nfunction getGlobalPackageRoots(method: InstallMethod, _packageName: string, npmCommand?: string[]): string[] {\n\tswitch (method) {\n\t\tcase \"npm\": {\n\t\t\tconst configured = !!npmCommand?.length;\n\t\t\tconst [command = \"npm\", ...npmArgs] = npmCommand ?? [];\n\t\t\tif (configured && command === \"bun\") {\n\t\t\t\tconst bunBin = readCommandOutput(command, [...npmArgs, \"pm\", \"bin\", \"-g\"], {\n\t\t\t\t\trequireSuccess: true,\n\t\t\t\t});\n\t\t\t\tconst roots = [join(homedir(), \".bun\", \"install\", \"global\", \"node_modules\")];\n\t\t\t\tif (bunBin) {\n\t\t\t\t\troots.push(join(dirname(bunBin), \"install\", \"global\", \"node_modules\"));\n\t\t\t\t}\n\t\t\t\treturn roots;\n\t\t\t}\n\t\t\tconst root = readCommandOutput(command, [...npmArgs, \"root\", \"-g\"], {\n\t\t\t\trequireSuccess: configured,\n\t\t\t});\n\t\t\tconst inferred = configured ? undefined : getInferredNpmInstall();\n\t\t\treturn [root, inferred?.root].filter((x): x is string => !!x);\n\t\t}\n\t\tcase \"pnpm\": {\n\t\t\tconst root = readCommandOutput(\"pnpm\", [\"root\", \"-g\"]);\n\t\t\tif (root) return [root, dirname(root)];\n\t\t\tconst match = /^(.*[\\\\/]global[\\\\/][^\\\\/]+)[\\\\/]\\.pnpm[\\\\/]/.exec(getPackageDir());\n\t\t\treturn match ? [match[1]] : [];\n\t\t}\n\t\tcase \"yarn\": {\n\t\t\tconst dir = readCommandOutput(\"yarn\", [\"global\", \"dir\"]);\n\t\t\treturn dir ? [dir, join(dir, \"node_modules\")] : [];\n\t\t}\n\t\tcase \"bun\": {\n\t\t\tconst bunBin = readCommandOutput(\"bun\", [\"pm\", \"bin\", \"-g\"]);\n\t\t\tconst roots = [join(homedir(), \".bun\", \"install\", \"global\", \"node_modules\")];\n\t\t\tif (bunBin) {\n\t\t\t\troots.push(join(dirname(bunBin), \"install\", \"global\", \"node_modules\"));\n\t\t\t}\n\t\t\treturn roots;\n\t\t}\n\t\tcase \"bun-binary\":\n\t\tcase \"unknown\":\n\t\t\treturn [];\n\t}\n}\n\nfunction normalizeExistingPathForComparison(path: string, resolveSymlinks: boolean): string | undefined {\n\tconst resolvedPath = resolve(path);\n\tif (!existsSync(resolvedPath)) {\n\t\treturn undefined;\n\t}\n\tlet normalizedPath = resolvedPath;\n\tif (resolveSymlinks) {\n\t\ttry {\n\t\t\tnormalizedPath = realpathSync(resolvedPath);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\tif (process.platform === \"win32\") {\n\t\tnormalizedPath = normalizedPath.toLowerCase();\n\t}\n\treturn normalizedPath;\n}\n\nfunction getPathComparisonCandidates(path: string): string[] {\n\treturn Array.from(\n\t\tnew Set(\n\t\t\t[normalizeExistingPathForComparison(path, false), normalizeExistingPathForComparison(path, true)].filter(\n\t\t\t\t(candidate): candidate is string => !!candidate,\n\t\t\t),\n\t\t),\n\t);\n}\n\nfunction getEntrypointPackageDir(): string | undefined {\n\tconst entrypoint = process.argv[1];\n\tif (!entrypoint) return undefined;\n\tlet dir = dirname(entrypoint);\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\treturn undefined;\n}\n\nfunction isSelfUpdatePathWritable(): boolean {\n\tconst packageDir = getPackageDir();\n\ttry {\n\t\taccessSync(packageDir, constants.W_OK);\n\t\taccessSync(dirname(packageDir), constants.W_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction isManagedByGlobalPackageManager(method: InstallMethod, packageName: string, npmCommand?: string[]): boolean {\n\tconst packageDirs = [getPackageDir(), getEntrypointPackageDir()].filter((dir): dir is string => !!dir);\n\tconst packageDirCandidates = packageDirs.flatMap((dir) => getPathComparisonCandidates(dir));\n\treturn getGlobalPackageRoots(method, packageName, npmCommand).some((root) => {\n\t\treturn getPathComparisonCandidates(root).some((normalizedRoot) => {\n\t\t\tconst rootPrefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\t\treturn packageDirCandidates.some((packageDir) => packageDir.startsWith(rootPrefix));\n\t\t});\n\t});\n}\n\nexport function getSelfUpdateCommand(\n\tpackageName: string,\n\tnpmCommand?: string[],\n\tupdatePackageTarget: SelfUpdatePackageTarget = packageName,\n): SelfUpdateCommand | undefined {\n\tconst method = detectInstallMethod();\n\tconst command = getSelfUpdateCommandForMethod(method, packageName, updatePackageTarget, npmCommand);\n\tif (!command || !isManagedByGlobalPackageManager(method, packageName, npmCommand) || !isSelfUpdatePathWritable()) {\n\t\treturn undefined;\n\t}\n\treturn command;\n}\n\nexport function getSelfUpdateUnavailableInstruction(\n\tpackageName: string,\n\tnpmCommand?: string[],\n\tupdatePackageTarget: SelfUpdatePackageTarget = packageName,\n): string {\n\tconst method = detectInstallMethod();\n\tconst target = normalizeSelfUpdatePackageTarget(updatePackageTarget);\n\tif (method === \"bun-binary\") {\n\t\treturn \"This standalone binary has no configured update source. Update it using the release channel that installed it.\";\n\t}\n\tconst command = getSelfUpdateCommandForMethod(method, packageName, target, npmCommand);\n\tif (command) {\n\t\tif (isManagedByGlobalPackageManager(method, packageName, npmCommand) && !isSelfUpdatePathWritable()) {\n\t\t\treturn `This installation is managed by a global ${method} install, but the install path is not writable. Update it yourself with: ${command.display}`;\n\t\t}\n\t\treturn `This installation is not managed by a global ${method} install. Update it with the package manager, wrapper, or source checkout that provides it.`;\n\t}\n\treturn `Update ${target.installSpec} using the package manager, wrapper, or source checkout that provides this installation.`;\n}\n\nexport function getUpdateInstruction(packageName: string): string {\n\tconst method = detectInstallMethod();\n\tconst command = getSelfUpdateCommandForMethod(method, packageName);\n\tif (command) {\n\t\treturn `Run: ${command.display}`;\n\t}\n\treturn getSelfUpdateUnavailableInstruction(packageName);\n}\n\n// =============================================================================\n// Package Asset Paths (shipped with executable)\n// =============================================================================\n\n/**\n * Get the base directory for resolving package assets (themes, package.json, README.md, CHANGELOG.md).\n * - For Bun binary: returns the directory containing the executable\n * - For Node.js and tsx: returns the package root containing package.json\n * - Ignores Bun binary metadata copied into dist/ when the package root is available\n */\nexport function findNodePackageDir(startDir: string): string {\n\tlet dir = startDir;\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\tconst parent = dirname(dir);\n\t\t\t// Bun binary packaging (distribution line retired 2026-10-03) placed\n\t\t\t// Bun's metadata inside dist/. Node still needs the package root so\n\t\t\t// its dist-relative asset paths do not become dist/dist/.\n\t\t\tif (basename(dir) === \"dist\" && existsSync(join(parent, \"package.json\"))) {\n\t\t\t\treturn parent;\n\t\t\t}\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\treturn startDir;\n}\n\nexport function getPackageDir(): string {\n\t// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)\n\tconst envDir = process.env.AGENT_FORGE_PACKAGE_DIR;\n\tif (envDir) {\n\t\treturn normalizePath(envDir);\n\t}\n\n\tif (isBunBinary) {\n\t\t// Bun binary: process.execPath points to the compiled executable\n\t\treturn dirname(process.execPath);\n\t}\n\treturn findNodePackageDir(__dirname);\n}\n\n/**\n * Get path to built-in themes directory (shipped with package)\n * - For Bun binary: theme/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/theme/\n * - For tsx (src/): src/modes/interactive/theme/\n */\nexport function getThemesDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"theme\");\n\t}\n\t// Theme is in modes/interactive/theme/ relative to src/ or dist/\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"theme\");\n}\n\n/**\n * Get path to HTML export template directory (shipped with package)\n * - For Bun binary: export-html/ next to executable\n * - For Node.js (dist/): dist/core/export-html/\n * - For tsx (src/): src/core/export-html/\n */\nexport function getExportTemplateDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"export-html\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"core\", \"export-html\");\n}\n\n/** Get path to package.json */\nexport function getPackageJsonPath(): string {\n\treturn join(getPackageDir(), \"package.json\");\n}\n\n/** Get path to README.md — shared with the coding-tools plugin via the `@agent-forge/host/readme-path` supply key. */\nexport { getReadmePath } from \"./core/tools/readme-path.ts\";\n\n/** Get path to docs directory */\nexport function getDocsPath(): string {\n\treturn resolve(join(getPackageDir(), \"docs\"));\n}\n\n/** Get path to examples directory */\nexport function getExamplesPath(): string {\n\treturn resolve(join(getPackageDir(), \"examples\"));\n}\n\n/** Get path to CHANGELOG.md */\nexport function getChangelogPath(): string {\n\treturn resolve(join(getPackageDir(), \"CHANGELOG.md\"));\n}\n\n/**\n * Get path to built-in interactive assets directory.\n * - For Bun binary: assets/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/assets/\n * - For tsx (src/): src/modes/interactive/assets/\n */\nexport function getInteractiveAssetsDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"assets\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"assets\");\n}\n\n/** Get path to a bundled interactive asset */\nexport function getBundledInteractiveAssetPath(name: string): string {\n\treturn join(getInteractiveAssetsDir(), name);\n}\n\n// =============================================================================\n// App Config (from package.json agentForgeConfig)\n// =============================================================================\n\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\tagentForgeConfig?: {\n\t\tname?: string;\n\t\tconfigDir?: string;\n\t};\n}\n\nlet pkg: PackageJson = {};\ntry {\n\tpkg = JSON.parse(stripBom(readFileSync(getPackageJsonPath(), \"utf-8\"))) as PackageJson;\n} catch (e: unknown) {\n\tconst err = e as NodeJS.ErrnoException;\n\tif (err.code !== \"ENOENT\") throw e;\n}\n\nconst agentForgeConfigName: string | undefined = pkg.agentForgeConfig?.name;\nexport const PACKAGE_NAME: string = pkg.name || \"@agent-forge/agent-forge\";\nexport const APP_NAME: string = agentForgeConfigName || \"agent-forge\";\nexport const APP_TITLE: string = agentForgeConfigName ? APP_NAME : \"Agent Forge\";\nexport const CONFIG_DIR_NAME: string = pkg.agentForgeConfig?.configDir || \".agent-forge\";\nexport const VERSION: string = pkg.version || \"0.0.0\";\n\n// Environment names use an underscore-safe application prefix (for example,\n// AGENT_FORGE_DIR and AGENT_FORGE_SESSION_DIR).\nconst ENV_APP_PREFIX = APP_NAME.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\");\nexport const ENV_AGENT_DIR = `${ENV_APP_PREFIX}_DIR`;\nexport const ENV_SESSION_DIR = `${ENV_APP_PREFIX}_SESSION_DIR`;\n\nexport function expandTildePath(path: string): string {\n\treturn normalizePath(path);\n}\n\n// =============================================================================\n// User Config Paths (~/.agent-forge/agent/*)\n// =============================================================================\n\n/** Get the agent config directory (e.g., ~/.agent-forge/agent/) */\nexport function getAgentDir(): string {\n\tconst envDir = process.env[ENV_AGENT_DIR];\n\tif (envDir) {\n\t\treturn expandTildePath(envDir);\n\t}\n\treturn join(homedir(), CONFIG_DIR_NAME, \"agent\");\n}\n\n/** Get path to user's custom themes directory */\nexport function getCustomThemesDir(): string {\n\treturn join(getAgentDir(), \"themes\");\n}\n\n/** Get path to models.json */\nexport function getModelsPath(): string {\n\treturn join(getAgentDir(), \"models.json\");\n}\n\n/** Get path to auth.json */\nexport function getAuthPath(): string {\n\treturn join(getAgentDir(), \"auth.json\");\n}\n\n/** Get path to settings.json */\nexport function getSettingsPath(): string {\n\treturn join(getAgentDir(), \"settings.json\");\n}\n\n/** Get path to tools directory */\nexport function getToolsDir(): string {\n\treturn join(getAgentDir(), \"tools\");\n}\n\n/** Get path to managed binaries directory (fd, rg) */\nexport function getBinDir(): string {\n\treturn join(getAgentDir(), \"bin\");\n}\n\n/** Get path to prompt templates directory */\nexport function getPromptsDir(): string {\n\treturn join(getAgentDir(), \"prompts\");\n}\n\n/** Get path to sessions directory */\nexport function getSessionsDir(): string {\n\treturn join(getAgentDir(), \"sessions\");\n}\n\n/** Get path to debug log file */\nexport function getDebugLogPath(): string {\n\treturn join(getAgentDir(), `${APP_NAME}-debug.log`);\n}\n"]}
package/dist/config.js CHANGED
@@ -354,10 +354,8 @@ export function getExportTemplateDir() {
354
354
  export function getPackageJsonPath() {
355
355
  return join(getPackageDir(), "package.json");
356
356
  }
357
- /** Get path to README.md */
358
- export function getReadmePath() {
359
- return resolve(join(getPackageDir(), "README.md"));
360
- }
357
+ /** Get path to README.md — shared with the coding-tools plugin via the `@agent-forge/host/readme-path` supply key. */
358
+ export { getReadmePath } from "./core/tools/readme-path.js";
361
359
  /** Get path to docs directory */
362
360
  export function getDocsPath() {
363
361
  return resolve(join(getPackageDir(), "docs"));