@ai-agent-forge/agent-forge 0.87.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 (451) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +2 -2
  3. package/bundled-plugins/agent-loop-policy/agent-forge.json +19 -0
  4. package/bundled-plugins/agent-loop-policy/dist/entry.d.ts +28 -0
  5. package/bundled-plugins/agent-loop-policy/dist/entry.d.ts.map +1 -0
  6. package/bundled-plugins/agent-loop-policy/dist/entry.js +69 -0
  7. package/bundled-plugins/agent-loop-policy/dist/entry.js.map +1 -0
  8. package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts +199 -0
  9. package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts.map +1 -0
  10. package/bundled-plugins/agent-loop-policy/dist/loop-guard.js +208 -0
  11. package/bundled-plugins/agent-loop-policy/dist/loop-guard.js.map +1 -0
  12. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts +17 -0
  13. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts.map +1 -0
  14. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js +18 -0
  15. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js.map +1 -0
  16. package/bundled-plugins/agent-loop-policy/plugin.json +7 -0
  17. package/bundled-plugins/coding-tools/agent-forge.json +19 -0
  18. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.d.ts +5 -44
  19. package/bundled-plugins/coding-tools/dist/bash.d.ts.map +1 -0
  20. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.js +15 -119
  21. package/bundled-plugins/coding-tools/dist/bash.js.map +1 -0
  22. package/bundled-plugins/coding-tools/dist/capability.d.ts +25 -0
  23. package/bundled-plugins/coding-tools/dist/capability.d.ts.map +1 -0
  24. package/bundled-plugins/coding-tools/dist/capability.js +98 -0
  25. package/bundled-plugins/coding-tools/dist/capability.js.map +1 -0
  26. package/bundled-plugins/coding-tools/dist/config.d.ts +8 -0
  27. package/bundled-plugins/coding-tools/dist/config.d.ts.map +1 -0
  28. package/bundled-plugins/coding-tools/dist/config.js +8 -0
  29. package/bundled-plugins/coding-tools/dist/config.js.map +1 -0
  30. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.d.ts +3 -3
  31. package/bundled-plugins/coding-tools/dist/edit.d.ts.map +1 -0
  32. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.js +12 -10
  33. package/bundled-plugins/coding-tools/dist/edit.js.map +1 -0
  34. package/bundled-plugins/coding-tools/dist/entry.d.ts +14 -0
  35. package/bundled-plugins/coding-tools/dist/entry.d.ts.map +1 -0
  36. package/bundled-plugins/coding-tools/dist/entry.js +23 -0
  37. package/bundled-plugins/coding-tools/dist/entry.js.map +1 -0
  38. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.d.ts +4 -4
  39. package/bundled-plugins/coding-tools/dist/find.d.ts.map +1 -0
  40. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.js +10 -8
  41. package/bundled-plugins/coding-tools/dist/find.js.map +1 -0
  42. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.d.ts +3 -3
  43. package/bundled-plugins/coding-tools/dist/grep.d.ts.map +1 -0
  44. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.js +10 -8
  45. package/bundled-plugins/coding-tools/dist/grep.js.map +1 -0
  46. package/bundled-plugins/coding-tools/dist/index.d.ts +17 -0
  47. package/bundled-plugins/coding-tools/dist/index.d.ts.map +1 -0
  48. package/bundled-plugins/coding-tools/dist/index.js +17 -0
  49. package/bundled-plugins/coding-tools/dist/index.js.map +1 -0
  50. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.d.ts +3 -3
  51. package/bundled-plugins/coding-tools/dist/ls.d.ts.map +1 -0
  52. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js +8 -6
  53. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js.map +1 -1
  54. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.d.ts +2 -1
  55. package/bundled-plugins/coding-tools/dist/powershell.d.ts.map +1 -0
  56. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.js +6 -3
  57. package/bundled-plugins/coding-tools/dist/powershell.js.map +1 -0
  58. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.d.ts +3 -3
  59. package/bundled-plugins/coding-tools/dist/read.d.ts.map +1 -0
  60. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.js +15 -13
  61. package/bundled-plugins/coding-tools/dist/read.js.map +1 -0
  62. package/bundled-plugins/coding-tools/dist/types.d.ts +74 -0
  63. package/bundled-plugins/coding-tools/dist/types.d.ts.map +1 -0
  64. package/bundled-plugins/coding-tools/dist/types.js +28 -0
  65. package/bundled-plugins/coding-tools/dist/types.js.map +1 -0
  66. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.d.ts +2 -2
  67. package/bundled-plugins/coding-tools/dist/write.d.ts.map +1 -0
  68. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.js +11 -9
  69. package/bundled-plugins/coding-tools/dist/write.js.map +1 -0
  70. package/bundled-plugins/coding-tools/plugin.json +10 -0
  71. package/bundled-plugins/compaction-policy/agent-forge.json +19 -0
  72. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts +6 -0
  73. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts.map +1 -0
  74. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js +19 -0
  75. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js.map +1 -0
  76. package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts +6 -0
  77. package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts.map +1 -0
  78. package/bundled-plugins/compaction-policy/dist/compaction-policy.js +38 -0
  79. package/bundled-plugins/compaction-policy/dist/compaction-policy.js.map +1 -0
  80. package/bundled-plugins/compaction-policy/dist/entry.d.ts +13 -0
  81. package/bundled-plugins/compaction-policy/dist/entry.d.ts.map +1 -0
  82. package/bundled-plugins/compaction-policy/dist/entry.js +23 -0
  83. package/bundled-plugins/compaction-policy/dist/entry.js.map +1 -0
  84. package/bundled-plugins/compaction-policy/plugin.json +10 -0
  85. package/bundled-plugins/mcp-http/dist/index.d.ts +8 -0
  86. package/bundled-plugins/mcp-http/dist/index.d.ts.map +1 -0
  87. package/bundled-plugins/mcp-http/dist/index.js +8 -0
  88. package/bundled-plugins/mcp-http/dist/index.js.map +1 -0
  89. package/bundled-plugins/mcp-http/dist/mcp-http.d.ts.map +1 -0
  90. package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.js +1 -1
  91. package/bundled-plugins/mcp-http/dist/mcp-http.js.map +1 -0
  92. package/bundled-plugins/overflow-policy/agent-forge.json +19 -0
  93. package/bundled-plugins/overflow-policy/dist/entry.d.ts +16 -0
  94. package/bundled-plugins/overflow-policy/dist/entry.d.ts.map +1 -0
  95. package/bundled-plugins/overflow-policy/dist/entry.js +35 -0
  96. package/bundled-plugins/overflow-policy/dist/entry.js.map +1 -0
  97. package/bundled-plugins/overflow-policy/plugin.json +10 -0
  98. package/bundled-plugins/provider-failover/agent-forge.json +19 -0
  99. package/bundled-plugins/provider-failover/dist/entry.d.ts +8 -0
  100. package/bundled-plugins/provider-failover/dist/entry.d.ts.map +1 -0
  101. package/bundled-plugins/provider-failover/dist/entry.js +8 -0
  102. package/bundled-plugins/provider-failover/dist/entry.js.map +1 -0
  103. package/bundled-plugins/provider-failover/dist/provider-failover.d.ts +122 -0
  104. package/bundled-plugins/provider-failover/dist/provider-failover.d.ts.map +1 -0
  105. package/{dist/core/extensions → bundled-plugins/provider-failover/dist}/provider-failover.js +149 -61
  106. package/bundled-plugins/provider-failover/dist/provider-failover.js.map +1 -0
  107. package/bundled-plugins/provider-failover/plugin.json +7 -0
  108. package/bundled-plugins/retry-policy/agent-forge.json +19 -0
  109. package/bundled-plugins/retry-policy/dist/entry.d.ts +16 -0
  110. package/bundled-plugins/retry-policy/dist/entry.d.ts.map +1 -0
  111. package/bundled-plugins/retry-policy/dist/entry.js +34 -0
  112. package/bundled-plugins/retry-policy/dist/entry.js.map +1 -0
  113. package/bundled-plugins/retry-policy/plugin.json +10 -0
  114. package/dist/bundle/.build-manifest.json +105 -183
  115. package/dist/bundle/chunks/{anthropic-messages-ALDZBUKI.js → anthropic-messages-PLAKXR73.js} +1 -1
  116. package/dist/bundle/chunks/{azure-openai-responses-A2WJWZFB.js → azure-openai-responses-OUWQ2AZD.js} +1 -1
  117. package/dist/bundle/chunks/{chunk-CIX3FSBK.js → chunk-A3JYRWB6.js} +1 -1
  118. package/dist/bundle/chunks/{chunk-SQFG22WN.js → chunk-AC2FIS4G.js} +1 -1
  119. package/dist/bundle/chunks/chunk-AQLNTW2B.js +664 -0
  120. package/dist/bundle/chunks/chunk-D3ARGZFR.js +13 -0
  121. package/dist/bundle/chunks/{chunk-YJCQVXW5.js → chunk-HTEVUY7F.js} +1 -1
  122. package/dist/bundle/chunks/{chunk-Y7HXTASS.js → chunk-HV64ASMT.js} +1 -1
  123. package/dist/bundle/chunks/chunk-LZOEQITZ.js +855 -0
  124. package/dist/bundle/chunks/{chunk-7ZY7IXZD.js → chunk-TRDNDS6A.js} +1 -1
  125. package/dist/bundle/chunks/chunk-Z72JWUZ4.js +4 -0
  126. package/dist/bundle/chunks/{google-generative-ai-NIB4WONV.js → google-generative-ai-DLII6DAT.js} +1 -1
  127. package/dist/bundle/chunks/{google-vertex-DCPYUEUO.js → google-vertex-G7BZL7GM.js} +1 -1
  128. package/dist/bundle/chunks/image-resize-worker.js +3 -3
  129. package/dist/bundle/chunks/{mistral-conversations-OC6LA5XL.js → mistral-conversations-JXUK24ID.js} +1 -1
  130. package/dist/bundle/chunks/{openai-codex-responses-IO2X4Y7L.js → openai-codex-responses-5GSGFIPG.js} +1 -1
  131. package/dist/bundle/chunks/{openai-completions-XYQQHETU.js → openai-completions-EI2I6DTG.js} +1 -1
  132. package/dist/bundle/chunks/{openai-responses-DLIRN3CI.js → openai-responses-AUJQ3NWT.js} +1 -1
  133. package/dist/bundle/chunks/{pi-messages-E6RRYBO7.js → pi-messages-PWU2VJMR.js} +1 -1
  134. package/dist/bundle/chunks/virtual-modules-WF6WRHP7.js +5 -0
  135. package/dist/bundle/cli.js +1 -1
  136. package/dist/bundle/client.js +1 -1
  137. package/dist/bundle/index.js +3 -3
  138. package/dist/bundle/rpc-entry.js +1 -1
  139. package/dist/capabilities/builtin.d.ts +1 -1
  140. package/dist/capabilities/builtin.d.ts.map +1 -1
  141. package/dist/capabilities/builtin.js +5 -0
  142. package/dist/capabilities/builtin.js.map +1 -1
  143. package/dist/cli/auth-check.d.ts.map +1 -1
  144. package/dist/cli/auth-check.js +14 -2
  145. package/dist/cli/auth-check.js.map +1 -1
  146. package/dist/cli/auth-command.d.ts.map +1 -1
  147. package/dist/cli/auth-command.js +1 -1
  148. package/dist/cli/auth-command.js.map +1 -1
  149. package/dist/cli/plugin-command.d.ts.map +1 -1
  150. package/dist/cli/plugin-command.js +17 -1
  151. package/dist/cli/plugin-command.js.map +1 -1
  152. package/dist/config.d.ts +2 -3
  153. package/dist/config.d.ts.map +1 -1
  154. package/dist/config.js +5 -6
  155. package/dist/config.js.map +1 -1
  156. package/dist/core/agent-session-bash.d.ts +1 -1
  157. package/dist/core/agent-session-bash.d.ts.map +1 -1
  158. package/dist/core/agent-session-bash.js +1 -1
  159. package/dist/core/agent-session-bash.js.map +1 -1
  160. package/dist/core/agent-session-compaction.d.ts +6 -10
  161. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  162. package/dist/core/agent-session-compaction.js +21 -112
  163. package/dist/core/agent-session-compaction.js.map +1 -1
  164. package/dist/core/agent-session-internal.d.ts +1 -7
  165. package/dist/core/agent-session-internal.d.ts.map +1 -1
  166. package/dist/core/agent-session-internal.js.map +1 -1
  167. package/dist/core/agent-session-loop.d.ts +4 -3
  168. package/dist/core/agent-session-loop.d.ts.map +1 -1
  169. package/dist/core/agent-session-loop.js +9 -6
  170. package/dist/core/agent-session-loop.js.map +1 -1
  171. package/dist/core/agent-session-retry.d.ts +1 -1
  172. package/dist/core/agent-session-retry.d.ts.map +1 -1
  173. package/dist/core/agent-session-retry.js +32 -4
  174. package/dist/core/agent-session-retry.js.map +1 -1
  175. package/dist/core/agent-session-services.d.ts.map +1 -1
  176. package/dist/core/agent-session-services.js +30 -9
  177. package/dist/core/agent-session-services.js.map +1 -1
  178. package/dist/core/agent-session-tools.d.ts.map +1 -1
  179. package/dist/core/agent-session-tools.js +5 -1
  180. package/dist/core/agent-session-tools.js.map +1 -1
  181. package/dist/core/agent-session.d.ts +12 -33
  182. package/dist/core/agent-session.d.ts.map +1 -1
  183. package/dist/core/agent-session.js +61 -67
  184. package/dist/core/agent-session.js.map +1 -1
  185. package/dist/core/bash-executor.d.ts +1 -1
  186. package/dist/core/bash-executor.d.ts.map +1 -1
  187. package/dist/core/bash-executor.js.map +1 -1
  188. package/dist/core/extensions/bootstrap-agent-loop.d.ts +23 -151
  189. package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
  190. package/dist/core/extensions/bootstrap-agent-loop.js +28 -290
  191. package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
  192. package/dist/core/extensions/capability-runtime-types.d.ts +5 -3
  193. package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
  194. package/dist/core/extensions/capability-runtime-types.js.map +1 -1
  195. package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
  196. package/dist/core/extensions/capability-runtime.js +42 -6
  197. package/dist/core/extensions/capability-runtime.js.map +1 -1
  198. package/dist/core/extensions/index.d.ts +12 -5
  199. package/dist/core/extensions/index.d.ts.map +1 -1
  200. package/dist/core/extensions/index.js +12 -5
  201. package/dist/core/extensions/index.js.map +1 -1
  202. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  203. package/dist/core/extensions/virtual-modules.js +65 -0
  204. package/dist/core/extensions/virtual-modules.js.map +1 -1
  205. package/dist/core/facade/coding-agent-facade.d.ts +1 -7
  206. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  207. package/dist/core/facade/coding-agent-facade.js +0 -3
  208. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  209. package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -1
  210. package/dist/core/i18n/locales/zh-cn/cli.js +3 -1
  211. package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -1
  212. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +1 -1
  213. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -1
  214. package/dist/core/i18n/locales/zh-cn/core-contract-core.js +1 -1
  215. package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -1
  216. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -1
  217. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +2 -4
  218. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -1
  219. package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
  220. package/dist/core/i18n/locales/zh-cn/core-errors.js +3 -1
  221. package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
  222. package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -1
  223. package/dist/core/i18n/locales/zh-cn/interactive-mode.js +2 -0
  224. package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -1
  225. package/dist/core/i18n/locales/zh-cn/tui-components-selectors.d.ts.map +1 -1
  226. package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js +0 -2
  227. package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js.map +1 -1
  228. package/dist/core/model-config.d.ts +0 -1
  229. package/dist/core/model-config.d.ts.map +1 -1
  230. package/dist/core/model-config.js +9 -1
  231. package/dist/core/model-config.js.map +1 -1
  232. package/dist/core/model-runtime.d.ts.map +1 -1
  233. package/dist/core/model-runtime.js +3 -3
  234. package/dist/core/model-runtime.js.map +1 -1
  235. package/dist/core/provider-composer.d.ts +2 -2
  236. package/dist/core/provider-composer.d.ts.map +1 -1
  237. package/dist/core/provider-composer.js +7 -8
  238. package/dist/core/provider-composer.js.map +1 -1
  239. package/dist/core/sdk.d.ts +18 -3
  240. package/dist/core/sdk.d.ts.map +1 -1
  241. package/dist/core/sdk.js +267 -76
  242. package/dist/core/sdk.js.map +1 -1
  243. package/dist/core/settings-manager.d.ts +9 -20
  244. package/dist/core/settings-manager.d.ts.map +1 -1
  245. package/dist/core/settings-manager.js +20 -54
  246. package/dist/core/settings-manager.js.map +1 -1
  247. package/dist/core/tools/bash-operations.d.ts +41 -0
  248. package/dist/core/tools/bash-operations.d.ts.map +1 -0
  249. package/dist/core/tools/bash-operations.js +113 -0
  250. package/dist/core/tools/bash-operations.js.map +1 -0
  251. package/dist/core/tools/index.d.ts +12 -36
  252. package/dist/core/tools/index.d.ts.map +1 -1
  253. package/dist/core/tools/index.js +1 -117
  254. package/dist/core/tools/index.js.map +1 -1
  255. package/dist/core/tools/readme-path.d.ts +3 -0
  256. package/dist/core/tools/readme-path.d.ts.map +1 -0
  257. package/dist/core/tools/readme-path.js +15 -0
  258. package/dist/core/tools/readme-path.js.map +1 -0
  259. package/dist/index.d.ts +3 -19
  260. package/dist/index.d.ts.map +1 -1
  261. package/dist/index.js +6 -39
  262. package/dist/index.js.map +1 -1
  263. package/dist/main.d.ts.map +1 -1
  264. package/dist/main.js +3 -2
  265. package/dist/main.js.map +1 -1
  266. package/dist/modes/interactive/components/footer.d.ts +0 -2
  267. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  268. package/dist/modes/interactive/components/footer.js +2 -7
  269. package/dist/modes/interactive/components/footer.js.map +1 -1
  270. package/dist/modes/interactive/components/settings-selector.d.ts +2 -6
  271. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  272. package/dist/modes/interactive/components/settings-selector.js +6 -28
  273. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  274. package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
  275. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  276. package/dist/modes/interactive/components/tool-execution.js +9 -25
  277. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  278. package/dist/modes/interactive/interactive-mode.d.ts +0 -1
  279. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  280. package/dist/modes/interactive/interactive-mode.js +23 -36
  281. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  282. package/dist/modes/rpc/rpc-client.d.ts +0 -8
  283. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  284. package/dist/modes/rpc/rpc-client.js +0 -12
  285. package/dist/modes/rpc/rpc-client.js.map +1 -1
  286. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  287. package/dist/modes/rpc/rpc-mode.js +0 -9
  288. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  289. package/dist/modes/rpc/rpc-types.d.ts +0 -19
  290. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  291. package/dist/modes/rpc/rpc-types.js.map +1 -1
  292. package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
  293. package/dist/plugins/ecosystem/cli.js +14 -2
  294. package/dist/plugins/ecosystem/cli.js.map +1 -1
  295. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts +7 -2
  296. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
  297. package/dist/plugins/ecosystem/node-npm-registry-source.js +64 -9
  298. package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
  299. package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts.map +1 -1
  300. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js +6 -0
  301. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js.map +1 -1
  302. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +9 -2
  303. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
  304. package/dist/plugins/ecosystem/node-plugin-bootstrap.js +23 -0
  305. package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
  306. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +9 -1
  307. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
  308. package/dist/plugins/ecosystem/plugin-bootstrap.js +5 -0
  309. package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
  310. package/dist/profiles/builtin-suites.d.ts +5 -1
  311. package/dist/profiles/builtin-suites.d.ts.map +1 -1
  312. package/dist/profiles/builtin-suites.js +6 -1
  313. package/dist/profiles/builtin-suites.js.map +1 -1
  314. package/dist/utils/photon.d.ts +2 -2
  315. package/dist/utils/photon.d.ts.map +1 -1
  316. package/dist/utils/photon.js +2 -2
  317. package/dist/utils/photon.js.map +1 -1
  318. package/docs/compaction.md +1 -3
  319. package/docs/docs.json +4 -0
  320. package/docs/index.md +1 -0
  321. package/docs/mcp.md +103 -0
  322. package/docs/models.md +14 -22
  323. package/docs/providers.md +0 -1
  324. package/docs/rpc.md +1 -26
  325. package/docs/sdk.md +4 -6
  326. package/docs/settings.md +9 -12
  327. package/docs/skills.md +1 -9
  328. package/docs/usage.md +1 -1
  329. package/examples/extensions/bash-spawn-hook/index.ts +7 -2
  330. package/examples/extensions/built-in-tool-renderer/index.ts +4 -2
  331. package/examples/extensions/minimal-mode/index.ts +2 -2
  332. package/examples/extensions/truncated-tool/index.ts +1 -1
  333. package/examples/extensions/with-deps/package-lock.json +2 -2
  334. package/examples/extensions/with-deps/package.json +1 -1
  335. package/examples/extensions/with-deps/plugin.json +1 -1
  336. package/examples/sdk/10-settings.ts +2 -4
  337. package/examples/sdk/12-full-control.ts +1 -2
  338. package/package.json +3 -4
  339. package/dist/bundle/chunks/chunk-6ZKDNZHA.js +0 -145
  340. package/dist/bundle/chunks/chunk-BFC2BDVJ.js +0 -13
  341. package/dist/bundle/chunks/chunk-MOHOLL3F.js +0 -1456
  342. package/dist/bundle/chunks/virtual-modules-KZ5DRH7Q.js +0 -2
  343. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts +0 -7
  344. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts.map +0 -1
  345. package/dist/core/extensions/bootstrap-branch-summary-policy.js +0 -28
  346. package/dist/core/extensions/bootstrap-branch-summary-policy.js.map +0 -1
  347. package/dist/core/extensions/bootstrap-compaction-policy.d.ts +0 -7
  348. package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +0 -1
  349. package/dist/core/extensions/bootstrap-compaction-policy.js +0 -82
  350. package/dist/core/extensions/bootstrap-compaction-policy.js.map +0 -1
  351. package/dist/core/extensions/bootstrap-overflow-policy.d.ts +0 -7
  352. package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +0 -1
  353. package/dist/core/extensions/bootstrap-overflow-policy.js +0 -30
  354. package/dist/core/extensions/bootstrap-overflow-policy.js.map +0 -1
  355. package/dist/core/extensions/bootstrap-retry-policy.d.ts +0 -7
  356. package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +0 -1
  357. package/dist/core/extensions/bootstrap-retry-policy.js +0 -29
  358. package/dist/core/extensions/bootstrap-retry-policy.js.map +0 -1
  359. package/dist/core/extensions/bootstrap-tools.d.ts +0 -20
  360. package/dist/core/extensions/bootstrap-tools.d.ts.map +0 -1
  361. package/dist/core/extensions/bootstrap-tools.js +0 -36
  362. package/dist/core/extensions/bootstrap-tools.js.map +0 -1
  363. package/dist/core/extensions/microcompact.d.ts +0 -80
  364. package/dist/core/extensions/microcompact.d.ts.map +0 -1
  365. package/dist/core/extensions/microcompact.js +0 -134
  366. package/dist/core/extensions/microcompact.js.map +0 -1
  367. package/dist/core/extensions/provider-failover.d.ts +0 -106
  368. package/dist/core/extensions/provider-failover.d.ts.map +0 -1
  369. package/dist/core/extensions/provider-failover.js.map +0 -1
  370. package/dist/core/tools/bash.d.ts.map +0 -1
  371. package/dist/core/tools/bash.js.map +0 -1
  372. package/dist/core/tools/edit.d.ts.map +0 -1
  373. package/dist/core/tools/edit.js.map +0 -1
  374. package/dist/core/tools/find.d.ts.map +0 -1
  375. package/dist/core/tools/find.js.map +0 -1
  376. package/dist/core/tools/grep.d.ts.map +0 -1
  377. package/dist/core/tools/grep.js.map +0 -1
  378. package/dist/core/tools/ls.d.ts.map +0 -1
  379. package/dist/core/tools/powershell.d.ts.map +0 -1
  380. package/dist/core/tools/powershell.js.map +0 -1
  381. package/dist/core/tools/read.d.ts.map +0 -1
  382. package/dist/core/tools/read.js.map +0 -1
  383. package/dist/core/tools/write.d.ts.map +0 -1
  384. package/dist/core/tools/write.js.map +0 -1
  385. package/dist/plugins/mcp-http.d.ts.map +0 -1
  386. package/dist/plugins/mcp-http.js.map +0 -1
  387. package/dist/profile/child-facade.d.ts +0 -44
  388. package/dist/profile/child-facade.d.ts.map +0 -1
  389. package/dist/profile/child-facade.js +0 -56
  390. package/dist/profile/child-facade.js.map +0 -1
  391. package/dist/profile/dependency-wiring.d.ts +0 -48
  392. package/dist/profile/dependency-wiring.d.ts.map +0 -1
  393. package/dist/profile/dependency-wiring.js +0 -56
  394. package/dist/profile/dependency-wiring.js.map +0 -1
  395. package/dist/profile/domain-recovery.d.ts +0 -60
  396. package/dist/profile/domain-recovery.d.ts.map +0 -1
  397. package/dist/profile/domain-recovery.js +0 -94
  398. package/dist/profile/domain-recovery.js.map +0 -1
  399. package/dist/profile/first-roles.d.ts +0 -30
  400. package/dist/profile/first-roles.d.ts.map +0 -1
  401. package/dist/profile/first-roles.js +0 -83
  402. package/dist/profile/first-roles.js.map +0 -1
  403. package/dist/profile/goal-plugin.d.ts +0 -38
  404. package/dist/profile/goal-plugin.d.ts.map +0 -1
  405. package/dist/profile/goal-plugin.js +0 -132
  406. package/dist/profile/goal-plugin.js.map +0 -1
  407. package/dist/profile/plan-plugin.d.ts +0 -44
  408. package/dist/profile/plan-plugin.d.ts.map +0 -1
  409. package/dist/profile/plan-plugin.js +0 -157
  410. package/dist/profile/plan-plugin.js.map +0 -1
  411. package/dist/profile/policy-manifest.d.ts +0 -53
  412. package/dist/profile/policy-manifest.d.ts.map +0 -1
  413. package/dist/profile/policy-manifest.js +0 -53
  414. package/dist/profile/policy-manifest.js.map +0 -1
  415. package/dist/profile/role-assembly.d.ts +0 -47
  416. package/dist/profile/role-assembly.d.ts.map +0 -1
  417. package/dist/profile/role-assembly.js +0 -31
  418. package/dist/profile/role-assembly.js.map +0 -1
  419. package/dist/profile/role-catalog.d.ts +0 -43
  420. package/dist/profile/role-catalog.d.ts.map +0 -1
  421. package/dist/profile/role-catalog.js +0 -132
  422. package/dist/profile/role-catalog.js.map +0 -1
  423. package/dist/profile/role-orchestrator.d.ts +0 -123
  424. package/dist/profile/role-orchestrator.d.ts.map +0 -1
  425. package/dist/profile/role-orchestrator.js +0 -195
  426. package/dist/profile/role-orchestrator.js.map +0 -1
  427. package/dist/profile/role-runner.d.ts +0 -99
  428. package/dist/profile/role-runner.d.ts.map +0 -1
  429. package/dist/profile/role-runner.js +0 -79
  430. package/dist/profile/role-runner.js.map +0 -1
  431. package/dist/profile/root-facade.d.ts +0 -36
  432. package/dist/profile/root-facade.d.ts.map +0 -1
  433. package/dist/profile/root-facade.js +0 -49
  434. package/dist/profile/root-facade.js.map +0 -1
  435. package/dist/profile/skill-discovery-wiring.d.ts +0 -58
  436. package/dist/profile/skill-discovery-wiring.d.ts.map +0 -1
  437. package/dist/profile/skill-discovery-wiring.js +0 -80
  438. package/dist/profile/skill-discovery-wiring.js.map +0 -1
  439. package/dist/profile/state-store.d.ts +0 -62
  440. package/dist/profile/state-store.d.ts.map +0 -1
  441. package/dist/profile/state-store.js +0 -144
  442. package/dist/profile/state-store.js.map +0 -1
  443. package/dist/profile/todo-plugin.d.ts +0 -37
  444. package/dist/profile/todo-plugin.d.ts.map +0 -1
  445. package/dist/profile/todo-plugin.js +0 -137
  446. package/dist/profile/todo-plugin.js.map +0 -1
  447. package/dist/server/create-harness.d.ts +0 -26
  448. package/dist/server/create-harness.d.ts.map +0 -1
  449. package/dist/server/create-harness.js +0 -106
  450. package/dist/server/create-harness.js.map +0 -1
  451. /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-MOHOLL3F.js";import"./chunks/chunk-JUUC5AZY.js";import"./chunks/chunk-6ZKDNZHA.js";import"./chunks/chunk-XDUWOHPL.js";import"./chunks/chunk-3QKHSPQL.js";import"./chunks/chunk-BFC2BDVJ.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":"auth-check.d.ts","sourceRoot":"","sources":["../../src/cli/auth-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;AAChE,MAAM,MAAM,eAAe,GACxB,oBAAoB,GACpB,4BAA4B,GAC5B,0BAA0B,GAC1B,eAAe,CAAC;AAEnB,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC/B;AAED,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAuB,GAChD,OAAO,CAAC,eAAe,CAAC,CA2B1B;AAED,wBAAsB,qBAAqB,CAC1C,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,eAAe,EAC5B,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAC3B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAI7B;AAED,wBAAsB,2BAA2B,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CAOrG","sourcesContent":["import type { CredentialStore } from \"@agent-forge/ai\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { resolveCliModel } from \"../core/model-resolver.ts\";\nimport { ModelRuntime } from \"../core/model-runtime.ts\";\nimport { InMemoryCodingAgentModelsStore } from \"../core/models-store.ts\";\nimport type { Args } from \"./args.ts\";\nimport { AuthCommandError, getAuthCredential, validateAuthCommandArgs } from \"./auth-command.ts\";\n\nexport type AuthCheckStatus = \"ready\" | \"not_ready\" | \"invalid\";\nexport type AuthCheckReason =\n\t| \"provider_not_found\"\n\t| \"credentials_not_configured\"\n\t| \"credential_not_available\"\n\t| \"invalid_state\";\n\nexport interface AuthCheckResult {\n\tstatus: AuthCheckStatus;\n\tprovider: string;\n\treason?: AuthCheckReason;\n\tauthType?: \"api_key\" | \"oauth\";\n}\n\nexport async function checkProviderAuth(\n\targs: Args,\n\tmodelRuntime: ModelRuntime,\n\toptions: { refresh: boolean } = { refresh: false },\n): Promise<AuthCheckResult> {\n\tconst { provider: cliProvider, model: cliModel } = validateAuthCommandArgs(args, \"check\");\n\tlet provider = cliProvider;\n\tif (cliModel) {\n\t\tconst resolved = resolveCliModel({ cliProvider, cliModel, modelRuntime });\n\t\tif (resolved.error || !resolved.model) {\n\t\t\tthrow new AuthCommandError(resolved.error ?? t('Unable to resolve model \"{model}\"', { model: cliModel }));\n\t\t}\n\t\tprovider = resolved.model.provider;\n\t}\n\tif (!provider) throw new AuthCommandError(t(\"Unable to resolve an auth provider\"));\n\tif (modelRuntime.getError()) {\n\t\treturn { status: \"invalid\", provider, reason: \"invalid_state\" };\n\t}\n\tif (!modelRuntime.getProvider(provider)) {\n\t\treturn { status: \"not_ready\", provider, reason: \"provider_not_found\" };\n\t}\n\ttry {\n\t\tconst auth = await modelRuntime.checkAuth(provider);\n\t\tif (!auth) return { status: \"not_ready\", provider, reason: \"credentials_not_configured\" };\n\t\tif (options.refresh && !(await modelRuntime.getAuth(provider))) {\n\t\t\treturn { status: \"not_ready\", provider, reason: \"credentials_not_configured\" };\n\t\t}\n\t\treturn { status: \"ready\", provider, authType: auth.type };\n\t} catch {\n\t\treturn { status: \"invalid\", provider, reason: \"invalid_state\" };\n\t}\n}\n\nexport async function getProviderCredential(\n\tproviderId: string,\n\tmodelRuntime: ModelRuntime,\n\tcredentials: CredentialStore,\n\toptions: { refresh: boolean },\n): Promise<string | undefined> {\n\tconst credential = await credentials.read(providerId);\n\tif (!options.refresh && credential?.type === \"oauth\") return credential.access;\n\treturn getAuthCredential(await modelRuntime.getAuth(providerId));\n}\n\nexport async function createAuthCheckModelRuntime(credentials: CredentialStore): Promise<ModelRuntime> {\n\treturn ModelRuntime.create({\n\t\tcredentials,\n\t\tmodelsStore: new InMemoryCodingAgentModelsStore(),\n\t\tallowModelNetwork: false,\n\t\trefreshOnCreate: false,\n\t});\n}\n"]}
1
+ {"version":3,"file":"auth-check.d.ts","sourceRoot":"","sources":["../../src/cli/auth-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;AAChE,MAAM,MAAM,eAAe,GACxB,oBAAoB,GACpB,4BAA4B,GAC5B,0BAA0B,GAC1B,eAAe,CAAC;AAEnB,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC/B;AAED,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAuB,GAChD,OAAO,CAAC,eAAe,CAAC,CA2B1B;AAED,wBAAsB,qBAAqB,CAC1C,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,eAAe,EAC5B,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAC3B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B;AAED,wBAAsB,2BAA2B,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CAOrG","sourcesContent":["import type { CredentialStore } from \"@agent-forge/ai\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { resolveCliModel } from \"../core/model-resolver.ts\";\nimport { ModelRuntime } from \"../core/model-runtime.ts\";\nimport { InMemoryCodingAgentModelsStore } from \"../core/models-store.ts\";\nimport { isCommandConfigValue } from \"../core/resolve-config-value.ts\";\nimport type { Args } from \"./args.ts\";\nimport { AuthCommandError, getAuthCredential, validateAuthCommandArgs } from \"./auth-command.ts\";\n\nexport type AuthCheckStatus = \"ready\" | \"not_ready\" | \"invalid\";\nexport type AuthCheckReason =\n\t| \"provider_not_found\"\n\t| \"credentials_not_configured\"\n\t| \"credential_not_available\"\n\t| \"invalid_state\";\n\nexport interface AuthCheckResult {\n\tstatus: AuthCheckStatus;\n\tprovider: string;\n\treason?: AuthCheckReason;\n\tauthType?: \"api_key\" | \"oauth\";\n}\n\nexport async function checkProviderAuth(\n\targs: Args,\n\tmodelRuntime: ModelRuntime,\n\toptions: { refresh: boolean } = { refresh: false },\n): Promise<AuthCheckResult> {\n\tconst { provider: cliProvider, model: cliModel } = validateAuthCommandArgs(args, \"check\");\n\tlet provider = cliProvider;\n\tif (cliModel) {\n\t\tconst resolved = resolveCliModel({ cliProvider, cliModel, modelRuntime });\n\t\tif (resolved.error || !resolved.model) {\n\t\t\tthrow new AuthCommandError(resolved.error ?? t('Unable to resolve model \"{model}\"', { model: cliModel }));\n\t\t}\n\t\tprovider = resolved.model.provider;\n\t}\n\tif (!provider) throw new AuthCommandError(t(\"Unable to resolve an auth provider\"));\n\tif (modelRuntime.getError()) {\n\t\treturn { status: \"invalid\", provider, reason: \"invalid_state\" };\n\t}\n\tif (!modelRuntime.getProvider(provider)) {\n\t\treturn { status: \"not_ready\", provider, reason: \"provider_not_found\" };\n\t}\n\ttry {\n\t\tconst auth = await modelRuntime.checkAuth(provider);\n\t\tif (!auth) return { status: \"not_ready\", provider, reason: \"credentials_not_configured\" };\n\t\tif (options.refresh && !(await modelRuntime.getAuth(provider))) {\n\t\t\treturn { status: \"not_ready\", provider, reason: \"credentials_not_configured\" };\n\t\t}\n\t\treturn { status: \"ready\", provider, authType: auth.type };\n\t} catch {\n\t\treturn { status: \"invalid\", provider, reason: \"invalid_state\" };\n\t}\n}\n\nexport async function getProviderCredential(\n\tproviderId: string,\n\tmodelRuntime: ModelRuntime,\n\tcredentials: CredentialStore,\n\toptions: { refresh: boolean },\n): Promise<string | undefined> {\n\tconst credential = await credentials.read(providerId);\n\tif (!options.refresh) {\n\t\t// --no-refresh is the side-effect-free read path: a stored `!command` key is\n\t\t// never executed here, so emitting it would print the command itself instead\n\t\t// of the credential. Report it as unavailable; rerunning without --no-refresh\n\t\t// resolves it. The check runs on the value the store returned, so an escaped\n\t\t// literal (`$!...`) or a resolved value that itself starts with `!` is treated\n\t\t// as command-backed too (fail-closed; rerun without --no-refresh to emit it).\n\t\tif (credential?.type === \"api_key\" && credential.key !== undefined && isCommandConfigValue(credential.key)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (credential?.type === \"oauth\") return credential.access;\n\t}\n\treturn getAuthCredential(await modelRuntime.getAuth(providerId));\n}\n\nexport async function createAuthCheckModelRuntime(credentials: CredentialStore): Promise<ModelRuntime> {\n\treturn ModelRuntime.create({\n\t\tcredentials,\n\t\tmodelsStore: new InMemoryCodingAgentModelsStore(),\n\t\tallowModelNetwork: false,\n\t\trefreshOnCreate: false,\n\t});\n}\n"]}
@@ -2,6 +2,7 @@ import { t } from "../core/i18n/index.js";
2
2
  import { resolveCliModel } from "../core/model-resolver.js";
3
3
  import { ModelRuntime } from "../core/model-runtime.js";
4
4
  import { InMemoryCodingAgentModelsStore } from "../core/models-store.js";
5
+ import { isCommandConfigValue } from "../core/resolve-config-value.js";
5
6
  import { AuthCommandError, getAuthCredential, validateAuthCommandArgs } from "./auth-command.js";
6
7
  export async function checkProviderAuth(args, modelRuntime, options = { refresh: false }) {
7
8
  const { provider: cliProvider, model: cliModel } = validateAuthCommandArgs(args, "check");
@@ -36,8 +37,19 @@ export async function checkProviderAuth(args, modelRuntime, options = { refresh:
36
37
  }
37
38
  export async function getProviderCredential(providerId, modelRuntime, credentials, options) {
38
39
  const credential = await credentials.read(providerId);
39
- if (!options.refresh && credential?.type === "oauth")
40
- return credential.access;
40
+ if (!options.refresh) {
41
+ // --no-refresh is the side-effect-free read path: a stored `!command` key is
42
+ // never executed here, so emitting it would print the command itself instead
43
+ // of the credential. Report it as unavailable; rerunning without --no-refresh
44
+ // resolves it. The check runs on the value the store returned, so an escaped
45
+ // literal (`$!...`) or a resolved value that itself starts with `!` is treated
46
+ // as command-backed too (fail-closed; rerun without --no-refresh to emit it).
47
+ if (credential?.type === "api_key" && credential.key !== undefined && isCommandConfigValue(credential.key)) {
48
+ return undefined;
49
+ }
50
+ if (credential?.type === "oauth")
51
+ return credential.access;
52
+ }
41
53
  return getAuthCredential(await modelRuntime.getAuth(providerId));
42
54
  }
43
55
  export async function createAuthCheckModelRuntime(credentials) {
@@ -1 +1 @@
1
- {"version":3,"file":"auth-check.js","sourceRoot":"","sources":["../../src/cli/auth-check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAgBjG,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACtC,IAAU,EACV,YAA0B,EAC1B,OAAO,GAAyB,EAAE,OAAO,EAAE,KAAK,EAAE,EACvB;IAC3B,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,uBAAuB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1F,IAAI,QAAQ,GAAG,WAAW,CAAC;IAC3B,IAAI,QAAQ,EAAE,CAAC;QACd,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAA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MAAM,CAAC;QACR,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACjE,CAAC;AAAA,CACD;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAC1C,UAAkB,EAClB,YAA0B,EAC1B,WAA4B,EAC5B,OAA6B,EACC;IAC9B,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtD,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,UAAU,EAAE,IAAI,KAAK,OAAO;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC;IAC/E,OAAO,iBAAiB,CAAC,MAAM,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAAA,CACjE;AAED,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,WAA4B,EAAyB;IACtG,OAAO,YAAY,CAAC,MAAM,CAAC;QAC1B,WAAW;QACX,WAAW,EAAE,IAAI,8BAA8B,EAAE;QACjD,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,KAAK;KACtB,CAAC,CAAC;AAAA,CACH","sourcesContent":["import type { CredentialStore } from \"@agent-forge/ai\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { resolveCliModel } from \"../core/model-resolver.ts\";\nimport { ModelRuntime } from \"../core/model-runtime.ts\";\nimport { InMemoryCodingAgentModelsStore } from \"../core/models-store.ts\";\nimport type { Args } from \"./args.ts\";\nimport { AuthCommandError, getAuthCredential, validateAuthCommandArgs } from \"./auth-command.ts\";\n\nexport type AuthCheckStatus = \"ready\" | \"not_ready\" | \"invalid\";\nexport type AuthCheckReason =\n\t| \"provider_not_found\"\n\t| \"credentials_not_configured\"\n\t| \"credential_not_available\"\n\t| \"invalid_state\";\n\nexport interface AuthCheckResult {\n\tstatus: AuthCheckStatus;\n\tprovider: string;\n\treason?: AuthCheckReason;\n\tauthType?: \"api_key\" | \"oauth\";\n}\n\nexport async function checkProviderAuth(\n\targs: Args,\n\tmodelRuntime: ModelRuntime,\n\toptions: { refresh: boolean } = { refresh: false },\n): Promise<AuthCheckResult> {\n\tconst { provider: cliProvider, model: cliModel } = validateAuthCommandArgs(args, \"check\");\n\tlet provider = cliProvider;\n\tif (cliModel) {\n\t\tconst resolved = resolveCliModel({ cliProvider, cliModel, modelRuntime });\n\t\tif (resolved.error || !resolved.model) {\n\t\t\tthrow new AuthCommandError(resolved.error ?? t('Unable to resolve model \"{model}\"', { model: cliModel }));\n\t\t}\n\t\tprovider = resolved.model.provider;\n\t}\n\tif (!provider) throw new AuthCommandError(t(\"Unable to resolve an auth provider\"));\n\tif (modelRuntime.getError()) {\n\t\treturn { status: \"invalid\", provider, reason: \"invalid_state\" };\n\t}\n\tif (!modelRuntime.getProvider(provider)) {\n\t\treturn { status: \"not_ready\", provider, reason: \"provider_not_found\" };\n\t}\n\ttry {\n\t\tconst auth = await modelRuntime.checkAuth(provider);\n\t\tif (!auth) return { status: \"not_ready\", provider, reason: \"credentials_not_configured\" };\n\t\tif (options.refresh && !(await modelRuntime.getAuth(provider))) {\n\t\t\treturn { status: \"not_ready\", provider, reason: \"credentials_not_configured\" };\n\t\t}\n\t\treturn { status: \"ready\", provider, authType: auth.type };\n\t} catch {\n\t\treturn { status: \"invalid\", provider, reason: \"invalid_state\" };\n\t}\n}\n\nexport async function getProviderCredential(\n\tproviderId: string,\n\tmodelRuntime: ModelRuntime,\n\tcredentials: CredentialStore,\n\toptions: { refresh: boolean },\n): Promise<string | undefined> {\n\tconst credential = await credentials.read(providerId);\n\tif (!options.refresh && credential?.type === \"oauth\") return credential.access;\n\treturn getAuthCredential(await modelRuntime.getAuth(providerId));\n}\n\nexport async function createAuthCheckModelRuntime(credentials: CredentialStore): Promise<ModelRuntime> {\n\treturn ModelRuntime.create({\n\t\tcredentials,\n\t\tmodelsStore: new InMemoryCodingAgentModelsStore(),\n\t\tallowModelNetwork: false,\n\t\trefreshOnCreate: false,\n\t});\n}\n"]}
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;QAC/E,8EAA8E;QAC9E,IAAI,UAAU,EAAE,IAAI,KAAK,SAAS,IAAI,UAAU,CAAC,GAAG,KAAK,SAAS,IAAI,oBAAoB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5G,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,IAAI,UAAU,EAAE,IAAI,KAAK,OAAO;YAAE,OAAO,UAAU,CAAC,MAAM,CAAC;IAC5D,CAAC;IACD,OAAO,iBAAiB,CAAC,MAAM,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAAA,CACjE;AAED,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,WAA4B,EAAyB;IACtG,OAAO,YAAY,CAAC,MAAM,CAAC;QAC1B,WAAW;QACX,WAAW,EAAE,IAAI,8BAA8B,EAAE;QACjD,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,KAAK;KACtB,CAAC,CAAC;AAAA,CACH","sourcesContent":["import type { CredentialStore } from \"@agent-forge/ai\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { resolveCliModel } from \"../core/model-resolver.ts\";\nimport { ModelRuntime } from \"../core/model-runtime.ts\";\nimport { InMemoryCodingAgentModelsStore } from \"../core/models-store.ts\";\nimport { isCommandConfigValue } from \"../core/resolve-config-value.ts\";\nimport type { Args } from \"./args.ts\";\nimport { AuthCommandError, getAuthCredential, validateAuthCommandArgs } from \"./auth-command.ts\";\n\nexport type AuthCheckStatus = \"ready\" | \"not_ready\" | \"invalid\";\nexport type AuthCheckReason =\n\t| \"provider_not_found\"\n\t| \"credentials_not_configured\"\n\t| \"credential_not_available\"\n\t| \"invalid_state\";\n\nexport interface AuthCheckResult {\n\tstatus: AuthCheckStatus;\n\tprovider: string;\n\treason?: AuthCheckReason;\n\tauthType?: \"api_key\" | \"oauth\";\n}\n\nexport async function checkProviderAuth(\n\targs: Args,\n\tmodelRuntime: ModelRuntime,\n\toptions: { refresh: boolean } = { refresh: false },\n): Promise<AuthCheckResult> {\n\tconst { provider: cliProvider, model: cliModel } = validateAuthCommandArgs(args, \"check\");\n\tlet provider = cliProvider;\n\tif (cliModel) {\n\t\tconst resolved = resolveCliModel({ cliProvider, cliModel, modelRuntime });\n\t\tif (resolved.error || !resolved.model) {\n\t\t\tthrow new AuthCommandError(resolved.error ?? t('Unable to resolve model \"{model}\"', { model: cliModel }));\n\t\t}\n\t\tprovider = resolved.model.provider;\n\t}\n\tif (!provider) throw new AuthCommandError(t(\"Unable to resolve an auth provider\"));\n\tif (modelRuntime.getError()) {\n\t\treturn { status: \"invalid\", provider, reason: \"invalid_state\" };\n\t}\n\tif (!modelRuntime.getProvider(provider)) {\n\t\treturn { status: \"not_ready\", provider, reason: \"provider_not_found\" };\n\t}\n\ttry {\n\t\tconst auth = await modelRuntime.checkAuth(provider);\n\t\tif (!auth) return { status: \"not_ready\", provider, reason: \"credentials_not_configured\" };\n\t\tif (options.refresh && !(await modelRuntime.getAuth(provider))) {\n\t\t\treturn { status: \"not_ready\", provider, reason: \"credentials_not_configured\" };\n\t\t}\n\t\treturn { status: \"ready\", provider, authType: auth.type };\n\t} catch {\n\t\treturn { status: \"invalid\", provider, reason: \"invalid_state\" };\n\t}\n}\n\nexport async function getProviderCredential(\n\tproviderId: string,\n\tmodelRuntime: ModelRuntime,\n\tcredentials: CredentialStore,\n\toptions: { refresh: boolean },\n): Promise<string | undefined> {\n\tconst credential = await credentials.read(providerId);\n\tif (!options.refresh) {\n\t\t// --no-refresh is the side-effect-free read path: a stored `!command` key is\n\t\t// never executed here, so emitting it would print the command itself instead\n\t\t// of the credential. Report it as unavailable; rerunning without --no-refresh\n\t\t// resolves it. The check runs on the value the store returned, so an escaped\n\t\t// literal (`$!...`) or a resolved value that itself starts with `!` is treated\n\t\t// as command-backed too (fail-closed; rerun without --no-refresh to emit it).\n\t\tif (credential?.type === \"api_key\" && credential.key !== undefined && isCommandConfigValue(credential.key)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (credential?.type === \"oauth\") return credential.access;\n\t}\n\treturn getAuthCredential(await modelRuntime.getAuth(providerId));\n}\n\nexport async function createAuthCheckModelRuntime(credentials: CredentialStore): Promise<ModelRuntime> {\n\treturn ModelRuntime.create({\n\t\tcredentials,\n\t\tmodelsStore: new InMemoryCodingAgentModelsStore(),\n\t\tallowModelNetwork: false,\n\t\trefreshOnCreate: false,\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"auth-command.d.ts","sourceRoot":"","sources":["../../src/cli/auth-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,cAAc,CAAC;AAEnE,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,gBAAiB,SAAQ,KAAK;CAAG;AAQ9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAEhE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAEjE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAKzD;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAO3C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW,GAAG,SAAS,CAqDxE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAmBhH;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAMlF","sourcesContent":["import type { AuthResult } from \"@agent-forge/ai\";\nimport { APP_NAME } from \"../config.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { Args } from \"./args.ts\";\n\nexport type AuthCommandKind = \"check\" | \"api_key\" | \"bearer_token\";\n\nexport interface AuthCommand {\n\tkind: AuthCommandKind;\n\targs: string[];\n\tjson: boolean;\n\tcredentials: boolean;\n\tnoRefresh: boolean;\n\tminExpiryMs?: number;\n}\n\nexport class AuthCommandError extends Error {}\n\nconst AUTH_COMMAND_USAGE: Record<AuthCommandKind, string> = {\n\tcheck: `${APP_NAME} auth check --provider <provider> [--json] [--credentials] [--no-refresh]`,\n\tapi_key: `${APP_NAME} auth print-api-key --provider <provider> [--model <model>]`,\n\tbearer_token: `${APP_NAME} auth print-bearer-token --provider <provider> [--model <model>] [--min-expiry <duration>]`,\n};\n\nexport function getAuthCommandName(kind: AuthCommandKind): string {\n\treturn kind === \"check\" ? \"auth check\" : kind === \"api_key\" ? \"auth print-api-key\" : \"auth print-bearer-token\";\n}\n\nexport function getAuthCommandUsage(kind: AuthCommandKind): string {\n\treturn AUTH_COMMAND_USAGE[kind];\n}\n\nexport function isAuthCommandHelp(args: string[]): boolean {\n\treturn (\n\t\targs[0] === \"auth\" &&\n\t\t(args[1] === undefined || args[1] === \"help\" || args.includes(\"--help\") || args.includes(\"-h\"))\n\t);\n}\n\nexport function printAuthCommandHelp(): void {\n\tconsole.log(`${t(\"Usage:\")}\n ${APP_NAME} auth print-api-key [--provider <provider>] [--model <model>]\n ${APP_NAME} auth print-bearer-token [--provider <provider>] [--model <model>] [--min-expiry <duration>]\n ${APP_NAME} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]\n\n${t(\"Auth commands require at least one of --provider or --model. Checks refresh expired OAuth credentials by default; --no-refresh prevents this. --credentials emits the credential, or includes it in JSON output.\")}`);\n}\n\nexport function parseAuthCommand(args: string[]): AuthCommand | undefined {\n\tif (args[0] !== \"auth\") return undefined;\n\n\tconst kind =\n\t\targs[1] === \"check\"\n\t\t\t? \"check\"\n\t\t\t: args[1] === \"print-api-key\"\n\t\t\t\t? \"api_key\"\n\t\t\t\t: args[1] === \"print-bearer-token\"\n\t\t\t\t\t? \"bearer_token\"\n\t\t\t\t\t: undefined;\n\tif (!kind) {\n\t\tthrow new AuthCommandError(\n\t\t\tt('Unknown auth command \"{command}\". Use \"{apiKey}\", \"{bearerToken}\", or \"{check}\".', {\n\t\t\t\tcommand: args[1] ?? \"\",\n\t\t\t\tapiKey: `${APP_NAME} auth print-api-key`,\n\t\t\t\tbearerToken: `${APP_NAME} auth print-bearer-token`,\n\t\t\t\tcheck: `${APP_NAME} auth check`,\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst commandArgs: string[] = [];\n\tlet json = false;\n\tlet credentials = false;\n\tlet noRefresh = false;\n\tlet minExpiryMs: number | undefined;\n\tfor (let index = 2; index < args.length; index++) {\n\t\tconst arg = args[index];\n\t\tif (arg === \"--min-expiry\") {\n\t\t\tif (kind !== \"bearer_token\")\n\t\t\t\tthrow new AuthCommandError(t(\"--min-expiry is only supported by print-bearer-token\"));\n\t\t\tconst value = args[++index];\n\t\t\tconst match = value ? /^(\\d+)(ms|s|m|h)$/iu.exec(value) : undefined;\n\t\t\tif (!match) throw new AuthCommandError(t(\"--min-expiry must use a duration such as 30m or 1h\"));\n\t\t\tconst amount = Number(match[1]);\n\t\t\tconst unit = match[2];\n\t\t\tminExpiryMs = amount * (unit === \"ms\" ? 1 : unit === \"s\" ? 1_000 : unit === \"m\" ? 60_000 : 3_600_000);\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg === \"--json\" || arg === \"--credentials\" || arg === \"--no-refresh\") {\n\t\t\tif (kind !== \"check\") throw new AuthCommandError(t(\"{arg} is only supported by auth check\", { arg }));\n\t\t\tif (arg === \"--json\") json = true;\n\t\t\telse if (arg === \"--credentials\") credentials = true;\n\t\t\telse noRefresh = true;\n\t\t\tcontinue;\n\t\t}\n\t\tcommandArgs.push(arg);\n\t}\n\n\treturn minExpiryMs === undefined\n\t\t? { kind, args: commandArgs, json, credentials, noRefresh }\n\t\t: { kind, args: commandArgs, json, credentials, noRefresh, minExpiryMs };\n}\n\nexport function validateAuthCommandArgs(args: Args, kind: AuthCommandKind): { provider?: string; model?: string } {\n\tconst provider = args.provider?.trim() || undefined;\n\tconst model = args.model?.trim() || undefined;\n\tif (args.diagnostics.length > 0) {\n\t\tthrow new AuthCommandError(args.diagnostics.map((diagnostic) => diagnostic.message).join(\"; \"));\n\t}\n\tif (args.apiKey !== undefined || args.messages.length > 0 || args.fileArgs.length > 0) {\n\t\tthrow new AuthCommandError(t(\"Auth commands only accept --provider and --model\"));\n\t}\n\tif (kind === \"check\") {\n\t\tif (!provider && !model) {\n\t\t\tthrow new AuthCommandError(t(\"Auth checks require --provider <provider> or --model <model>\"));\n\t\t}\n\t\treturn { provider, model };\n\t}\n\tif (!provider && !model) {\n\t\tthrow new AuthCommandError(t(\"Credential printing requires --provider <provider> or --model <model>\"));\n\t}\n\treturn { provider, model };\n}\n\nexport function getAuthCredential(auth: AuthResult | undefined): string | undefined {\n\tif (auth?.auth.apiKey) return auth.auth.apiKey;\n\tconst authorization = Object.entries(auth?.auth.headers ?? {}).find(\n\t\t([name]) => name.toLowerCase() === \"authorization\",\n\t)?.[1];\n\treturn typeof authorization === \"string\" ? /^Bearer\\s+(.+)$/iu.exec(authorization)?.[1] : undefined;\n}\n"]}
1
+ {"version":3,"file":"auth-command.d.ts","sourceRoot":"","sources":["../../src/cli/auth-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,cAAc,CAAC;AAEnE,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,gBAAiB,SAAQ,KAAK;CAAG;AAQ9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAEhE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAEjE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAKzD;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAO3C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW,GAAG,SAAS,CAqDxE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAmBhH;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAMlF","sourcesContent":["import type { AuthResult } from \"@agent-forge/ai\";\nimport { APP_NAME } from \"../config.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { Args } from \"./args.ts\";\n\nexport type AuthCommandKind = \"check\" | \"api_key\" | \"bearer_token\";\n\nexport interface AuthCommand {\n\tkind: AuthCommandKind;\n\targs: string[];\n\tjson: boolean;\n\tcredentials: boolean;\n\tnoRefresh: boolean;\n\tminExpiryMs?: number;\n}\n\nexport class AuthCommandError extends Error {}\n\nconst AUTH_COMMAND_USAGE: Record<AuthCommandKind, string> = {\n\tcheck: `${APP_NAME} auth check --provider <provider> [--json] [--credentials] [--no-refresh]`,\n\tapi_key: `${APP_NAME} auth print-api-key --provider <provider> [--model <model>]`,\n\tbearer_token: `${APP_NAME} auth print-bearer-token --provider <provider> [--model <model>] [--min-expiry <duration>]`,\n};\n\nexport function getAuthCommandName(kind: AuthCommandKind): string {\n\treturn kind === \"check\" ? \"auth check\" : kind === \"api_key\" ? \"auth print-api-key\" : \"auth print-bearer-token\";\n}\n\nexport function getAuthCommandUsage(kind: AuthCommandKind): string {\n\treturn AUTH_COMMAND_USAGE[kind];\n}\n\nexport function isAuthCommandHelp(args: string[]): boolean {\n\treturn (\n\t\targs[0] === \"auth\" &&\n\t\t(args[1] === undefined || args[1] === \"help\" || args.includes(\"--help\") || args.includes(\"-h\"))\n\t);\n}\n\nexport function printAuthCommandHelp(): void {\n\tconsole.log(`${t(\"Usage:\")}\n ${APP_NAME} auth print-api-key [--provider <provider>] [--model <model>]\n ${APP_NAME} auth print-bearer-token [--provider <provider>] [--model <model>] [--min-expiry <duration>]\n ${APP_NAME} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]\n\n${t(\"Auth commands require at least one of --provider or --model. Checks refresh expired OAuth credentials by default; --no-refresh prevents this. --credentials emits the credential, or includes it in JSON output. --no-refresh also leaves command-backed keys unresolved: --credentials reports them as unavailable instead of running the command.\")}`);\n}\n\nexport function parseAuthCommand(args: string[]): AuthCommand | undefined {\n\tif (args[0] !== \"auth\") return undefined;\n\n\tconst kind =\n\t\targs[1] === \"check\"\n\t\t\t? \"check\"\n\t\t\t: args[1] === \"print-api-key\"\n\t\t\t\t? \"api_key\"\n\t\t\t\t: args[1] === \"print-bearer-token\"\n\t\t\t\t\t? \"bearer_token\"\n\t\t\t\t\t: undefined;\n\tif (!kind) {\n\t\tthrow new AuthCommandError(\n\t\t\tt('Unknown auth command \"{command}\". Use \"{apiKey}\", \"{bearerToken}\", or \"{check}\".', {\n\t\t\t\tcommand: args[1] ?? \"\",\n\t\t\t\tapiKey: `${APP_NAME} auth print-api-key`,\n\t\t\t\tbearerToken: `${APP_NAME} auth print-bearer-token`,\n\t\t\t\tcheck: `${APP_NAME} auth check`,\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst commandArgs: string[] = [];\n\tlet json = false;\n\tlet credentials = false;\n\tlet noRefresh = false;\n\tlet minExpiryMs: number | undefined;\n\tfor (let index = 2; index < args.length; index++) {\n\t\tconst arg = args[index];\n\t\tif (arg === \"--min-expiry\") {\n\t\t\tif (kind !== \"bearer_token\")\n\t\t\t\tthrow new AuthCommandError(t(\"--min-expiry is only supported by print-bearer-token\"));\n\t\t\tconst value = args[++index];\n\t\t\tconst match = value ? /^(\\d+)(ms|s|m|h)$/iu.exec(value) : undefined;\n\t\t\tif (!match) throw new AuthCommandError(t(\"--min-expiry must use a duration such as 30m or 1h\"));\n\t\t\tconst amount = Number(match[1]);\n\t\t\tconst unit = match[2];\n\t\t\tminExpiryMs = amount * (unit === \"ms\" ? 1 : unit === \"s\" ? 1_000 : unit === \"m\" ? 60_000 : 3_600_000);\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg === \"--json\" || arg === \"--credentials\" || arg === \"--no-refresh\") {\n\t\t\tif (kind !== \"check\") throw new AuthCommandError(t(\"{arg} is only supported by auth check\", { arg }));\n\t\t\tif (arg === \"--json\") json = true;\n\t\t\telse if (arg === \"--credentials\") credentials = true;\n\t\t\telse noRefresh = true;\n\t\t\tcontinue;\n\t\t}\n\t\tcommandArgs.push(arg);\n\t}\n\n\treturn minExpiryMs === undefined\n\t\t? { kind, args: commandArgs, json, credentials, noRefresh }\n\t\t: { kind, args: commandArgs, json, credentials, noRefresh, minExpiryMs };\n}\n\nexport function validateAuthCommandArgs(args: Args, kind: AuthCommandKind): { provider?: string; model?: string } {\n\tconst provider = args.provider?.trim() || undefined;\n\tconst model = args.model?.trim() || undefined;\n\tif (args.diagnostics.length > 0) {\n\t\tthrow new AuthCommandError(args.diagnostics.map((diagnostic) => diagnostic.message).join(\"; \"));\n\t}\n\tif (args.apiKey !== undefined || args.messages.length > 0 || args.fileArgs.length > 0) {\n\t\tthrow new AuthCommandError(t(\"Auth commands only accept --provider and --model\"));\n\t}\n\tif (kind === \"check\") {\n\t\tif (!provider && !model) {\n\t\t\tthrow new AuthCommandError(t(\"Auth checks require --provider <provider> or --model <model>\"));\n\t\t}\n\t\treturn { provider, model };\n\t}\n\tif (!provider && !model) {\n\t\tthrow new AuthCommandError(t(\"Credential printing requires --provider <provider> or --model <model>\"));\n\t}\n\treturn { provider, model };\n}\n\nexport function getAuthCredential(auth: AuthResult | undefined): string | undefined {\n\tif (auth?.auth.apiKey) return auth.auth.apiKey;\n\tconst authorization = Object.entries(auth?.auth.headers ?? {}).find(\n\t\t([name]) => name.toLowerCase() === \"authorization\",\n\t)?.[1];\n\treturn typeof authorization === \"string\" ? /^Bearer\\s+(.+)$/iu.exec(authorization)?.[1] : undefined;\n}\n"]}
@@ -23,7 +23,7 @@ export function printAuthCommandHelp() {
23
23
  ${APP_NAME} auth print-bearer-token [--provider <provider>] [--model <model>] [--min-expiry <duration>]
24
24
  ${APP_NAME} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]
25
25
 
26
- ${t("Auth commands require at least one of --provider or --model. Checks refresh expired OAuth credentials by default; --no-refresh prevents this. --credentials emits the credential, or includes it in JSON output.")}`);
26
+ ${t("Auth commands require at least one of --provider or --model. Checks refresh expired OAuth credentials by default; --no-refresh prevents this. --credentials emits the credential, or includes it in JSON output. --no-refresh also leaves command-backed keys unresolved: --credentials reports them as unavailable instead of running the command.")}`);
27
27
  }
28
28
  export function parseAuthCommand(args) {
29
29
  if (args[0] !== "auth")
@@ -1 +1 @@
1
- {"version":3,"file":"auth-command.js","sourceRoot":"","sources":["../../src/cli/auth-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAA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AC,IAAI,CAClE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,eAAe,CAClD,EAAE,CAAC,CAAC,CAAC,CAAC;IACP,OAAO,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAAA,CACpG","sourcesContent":["import type { AuthResult } from \"@agent-forge/ai\";\nimport { APP_NAME } from \"../config.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { Args } from \"./args.ts\";\n\nexport type AuthCommandKind = \"check\" | \"api_key\" | \"bearer_token\";\n\nexport interface AuthCommand {\n\tkind: AuthCommandKind;\n\targs: string[];\n\tjson: boolean;\n\tcredentials: boolean;\n\tnoRefresh: boolean;\n\tminExpiryMs?: number;\n}\n\nexport class AuthCommandError extends Error {}\n\nconst AUTH_COMMAND_USAGE: Record<AuthCommandKind, string> = {\n\tcheck: `${APP_NAME} auth check --provider <provider> [--json] [--credentials] [--no-refresh]`,\n\tapi_key: `${APP_NAME} auth print-api-key --provider <provider> [--model <model>]`,\n\tbearer_token: `${APP_NAME} auth print-bearer-token --provider <provider> [--model <model>] [--min-expiry <duration>]`,\n};\n\nexport function getAuthCommandName(kind: AuthCommandKind): string {\n\treturn kind === \"check\" ? \"auth check\" : kind === \"api_key\" ? \"auth print-api-key\" : \"auth print-bearer-token\";\n}\n\nexport function getAuthCommandUsage(kind: AuthCommandKind): string {\n\treturn AUTH_COMMAND_USAGE[kind];\n}\n\nexport function isAuthCommandHelp(args: string[]): boolean {\n\treturn (\n\t\targs[0] === \"auth\" &&\n\t\t(args[1] === undefined || args[1] === \"help\" || args.includes(\"--help\") || args.includes(\"-h\"))\n\t);\n}\n\nexport function printAuthCommandHelp(): void {\n\tconsole.log(`${t(\"Usage:\")}\n ${APP_NAME} auth print-api-key [--provider <provider>] [--model <model>]\n ${APP_NAME} auth print-bearer-token [--provider <provider>] [--model <model>] [--min-expiry <duration>]\n ${APP_NAME} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]\n\n${t(\"Auth commands require at least one of --provider or --model. Checks refresh expired OAuth credentials by default; --no-refresh prevents this. --credentials emits the credential, or includes it in JSON output.\")}`);\n}\n\nexport function parseAuthCommand(args: string[]): AuthCommand | undefined {\n\tif (args[0] !== \"auth\") return undefined;\n\n\tconst kind =\n\t\targs[1] === \"check\"\n\t\t\t? \"check\"\n\t\t\t: args[1] === \"print-api-key\"\n\t\t\t\t? \"api_key\"\n\t\t\t\t: args[1] === \"print-bearer-token\"\n\t\t\t\t\t? \"bearer_token\"\n\t\t\t\t\t: undefined;\n\tif (!kind) {\n\t\tthrow new AuthCommandError(\n\t\t\tt('Unknown auth command \"{command}\". Use \"{apiKey}\", \"{bearerToken}\", or \"{check}\".', {\n\t\t\t\tcommand: args[1] ?? \"\",\n\t\t\t\tapiKey: `${APP_NAME} auth print-api-key`,\n\t\t\t\tbearerToken: `${APP_NAME} auth print-bearer-token`,\n\t\t\t\tcheck: `${APP_NAME} auth check`,\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst commandArgs: string[] = [];\n\tlet json = false;\n\tlet credentials = false;\n\tlet noRefresh = false;\n\tlet minExpiryMs: number | undefined;\n\tfor (let index = 2; index < args.length; index++) {\n\t\tconst arg = args[index];\n\t\tif (arg === \"--min-expiry\") {\n\t\t\tif (kind !== \"bearer_token\")\n\t\t\t\tthrow new AuthCommandError(t(\"--min-expiry is only supported by print-bearer-token\"));\n\t\t\tconst value = args[++index];\n\t\t\tconst match = value ? /^(\\d+)(ms|s|m|h)$/iu.exec(value) : undefined;\n\t\t\tif (!match) throw new AuthCommandError(t(\"--min-expiry must use a duration such as 30m or 1h\"));\n\t\t\tconst amount = Number(match[1]);\n\t\t\tconst unit = match[2];\n\t\t\tminExpiryMs = amount * (unit === \"ms\" ? 1 : unit === \"s\" ? 1_000 : unit === \"m\" ? 60_000 : 3_600_000);\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg === \"--json\" || arg === \"--credentials\" || arg === \"--no-refresh\") {\n\t\t\tif (kind !== \"check\") throw new AuthCommandError(t(\"{arg} is only supported by auth check\", { arg }));\n\t\t\tif (arg === \"--json\") json = true;\n\t\t\telse if (arg === \"--credentials\") credentials = true;\n\t\t\telse noRefresh = true;\n\t\t\tcontinue;\n\t\t}\n\t\tcommandArgs.push(arg);\n\t}\n\n\treturn minExpiryMs === undefined\n\t\t? { kind, args: commandArgs, json, credentials, noRefresh }\n\t\t: { kind, args: commandArgs, json, credentials, noRefresh, minExpiryMs };\n}\n\nexport function validateAuthCommandArgs(args: Args, kind: AuthCommandKind): { provider?: string; model?: string } {\n\tconst provider = args.provider?.trim() || undefined;\n\tconst model = args.model?.trim() || undefined;\n\tif (args.diagnostics.length > 0) {\n\t\tthrow new AuthCommandError(args.diagnostics.map((diagnostic) => diagnostic.message).join(\"; \"));\n\t}\n\tif (args.apiKey !== undefined || args.messages.length > 0 || args.fileArgs.length > 0) {\n\t\tthrow new AuthCommandError(t(\"Auth commands only accept --provider and --model\"));\n\t}\n\tif (kind === \"check\") {\n\t\tif (!provider && !model) {\n\t\t\tthrow new AuthCommandError(t(\"Auth checks require --provider <provider> or --model <model>\"));\n\t\t}\n\t\treturn { provider, model };\n\t}\n\tif (!provider && !model) {\n\t\tthrow new AuthCommandError(t(\"Credential printing requires --provider <provider> or --model <model>\"));\n\t}\n\treturn { provider, model };\n}\n\nexport function getAuthCredential(auth: AuthResult | undefined): string | undefined {\n\tif (auth?.auth.apiKey) return auth.auth.apiKey;\n\tconst authorization = Object.entries(auth?.auth.headers ?? {}).find(\n\t\t([name]) => name.toLowerCase() === \"authorization\",\n\t)?.[1];\n\treturn typeof authorization === \"string\" ? /^Bearer\\s+(.+)$/iu.exec(authorization)?.[1] : undefined;\n}\n"]}
1
+ {"version":3,"file":"auth-command.js","sourceRoot":"","sources":["../../src/cli/auth-command.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C,MAAM,CAAC;IAC/C,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CAClE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,eAAe,CAClD,EAAE,CAAC,CAAC,CAAC,CAAC;IACP,OAAO,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAAA,CACpG","sourcesContent":["import type { AuthResult } from \"@agent-forge/ai\";\nimport { APP_NAME } from \"../config.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { Args } from \"./args.ts\";\n\nexport type AuthCommandKind = \"check\" | \"api_key\" | \"bearer_token\";\n\nexport interface AuthCommand {\n\tkind: AuthCommandKind;\n\targs: string[];\n\tjson: boolean;\n\tcredentials: boolean;\n\tnoRefresh: boolean;\n\tminExpiryMs?: number;\n}\n\nexport class AuthCommandError extends Error {}\n\nconst AUTH_COMMAND_USAGE: Record<AuthCommandKind, string> = {\n\tcheck: `${APP_NAME} auth check --provider <provider> [--json] [--credentials] [--no-refresh]`,\n\tapi_key: `${APP_NAME} auth print-api-key --provider <provider> [--model <model>]`,\n\tbearer_token: `${APP_NAME} auth print-bearer-token --provider <provider> [--model <model>] [--min-expiry <duration>]`,\n};\n\nexport function getAuthCommandName(kind: AuthCommandKind): string {\n\treturn kind === \"check\" ? \"auth check\" : kind === \"api_key\" ? \"auth print-api-key\" : \"auth print-bearer-token\";\n}\n\nexport function getAuthCommandUsage(kind: AuthCommandKind): string {\n\treturn AUTH_COMMAND_USAGE[kind];\n}\n\nexport function isAuthCommandHelp(args: string[]): boolean {\n\treturn (\n\t\targs[0] === \"auth\" &&\n\t\t(args[1] === undefined || args[1] === \"help\" || args.includes(\"--help\") || args.includes(\"-h\"))\n\t);\n}\n\nexport function printAuthCommandHelp(): void {\n\tconsole.log(`${t(\"Usage:\")}\n ${APP_NAME} auth print-api-key [--provider <provider>] [--model <model>]\n ${APP_NAME} auth print-bearer-token [--provider <provider>] [--model <model>] [--min-expiry <duration>]\n ${APP_NAME} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]\n\n${t(\"Auth commands require at least one of --provider or --model. Checks refresh expired OAuth credentials by default; --no-refresh prevents this. --credentials emits the credential, or includes it in JSON output. --no-refresh also leaves command-backed keys unresolved: --credentials reports them as unavailable instead of running the command.\")}`);\n}\n\nexport function parseAuthCommand(args: string[]): AuthCommand | undefined {\n\tif (args[0] !== \"auth\") return undefined;\n\n\tconst kind =\n\t\targs[1] === \"check\"\n\t\t\t? \"check\"\n\t\t\t: args[1] === \"print-api-key\"\n\t\t\t\t? \"api_key\"\n\t\t\t\t: args[1] === \"print-bearer-token\"\n\t\t\t\t\t? \"bearer_token\"\n\t\t\t\t\t: undefined;\n\tif (!kind) {\n\t\tthrow new AuthCommandError(\n\t\t\tt('Unknown auth command \"{command}\". Use \"{apiKey}\", \"{bearerToken}\", or \"{check}\".', {\n\t\t\t\tcommand: args[1] ?? \"\",\n\t\t\t\tapiKey: `${APP_NAME} auth print-api-key`,\n\t\t\t\tbearerToken: `${APP_NAME} auth print-bearer-token`,\n\t\t\t\tcheck: `${APP_NAME} auth check`,\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst commandArgs: string[] = [];\n\tlet json = false;\n\tlet credentials = false;\n\tlet noRefresh = false;\n\tlet minExpiryMs: number | undefined;\n\tfor (let index = 2; index < args.length; index++) {\n\t\tconst arg = args[index];\n\t\tif (arg === \"--min-expiry\") {\n\t\t\tif (kind !== \"bearer_token\")\n\t\t\t\tthrow new AuthCommandError(t(\"--min-expiry is only supported by print-bearer-token\"));\n\t\t\tconst value = args[++index];\n\t\t\tconst match = value ? /^(\\d+)(ms|s|m|h)$/iu.exec(value) : undefined;\n\t\t\tif (!match) throw new AuthCommandError(t(\"--min-expiry must use a duration such as 30m or 1h\"));\n\t\t\tconst amount = Number(match[1]);\n\t\t\tconst unit = match[2];\n\t\t\tminExpiryMs = amount * (unit === \"ms\" ? 1 : unit === \"s\" ? 1_000 : unit === \"m\" ? 60_000 : 3_600_000);\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg === \"--json\" || arg === \"--credentials\" || arg === \"--no-refresh\") {\n\t\t\tif (kind !== \"check\") throw new AuthCommandError(t(\"{arg} is only supported by auth check\", { arg }));\n\t\t\tif (arg === \"--json\") json = true;\n\t\t\telse if (arg === \"--credentials\") credentials = true;\n\t\t\telse noRefresh = true;\n\t\t\tcontinue;\n\t\t}\n\t\tcommandArgs.push(arg);\n\t}\n\n\treturn minExpiryMs === undefined\n\t\t? { kind, args: commandArgs, json, credentials, noRefresh }\n\t\t: { kind, args: commandArgs, json, credentials, noRefresh, minExpiryMs };\n}\n\nexport function validateAuthCommandArgs(args: Args, kind: AuthCommandKind): { provider?: string; model?: string } {\n\tconst provider = args.provider?.trim() || undefined;\n\tconst model = args.model?.trim() || undefined;\n\tif (args.diagnostics.length > 0) {\n\t\tthrow new AuthCommandError(args.diagnostics.map((diagnostic) => diagnostic.message).join(\"; \"));\n\t}\n\tif (args.apiKey !== undefined || args.messages.length > 0 || args.fileArgs.length > 0) {\n\t\tthrow new AuthCommandError(t(\"Auth commands only accept --provider and --model\"));\n\t}\n\tif (kind === \"check\") {\n\t\tif (!provider && !model) {\n\t\t\tthrow new AuthCommandError(t(\"Auth checks require --provider <provider> or --model <model>\"));\n\t\t}\n\t\treturn { provider, model };\n\t}\n\tif (!provider && !model) {\n\t\tthrow new AuthCommandError(t(\"Credential printing requires --provider <provider> or --model <model>\"));\n\t}\n\treturn { provider, model };\n}\n\nexport function getAuthCredential(auth: AuthResult | undefined): string | undefined {\n\tif (auth?.auth.apiKey) return auth.auth.apiKey;\n\tconst authorization = Object.entries(auth?.auth.headers ?? {}).find(\n\t\t([name]) => name.toLowerCase() === \"authorization\",\n\t)?.[1];\n\treturn typeof authorization === \"string\" ? /^Bearer\\s+(.+)$/iu.exec(authorization)?.[1] : undefined;\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/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;AAOvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AA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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.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,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,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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AG,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