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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (445) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/bundled-plugins/agent-loop-policy/agent-forge.json +19 -0
  3. package/bundled-plugins/agent-loop-policy/dist/entry.d.ts +28 -0
  4. package/bundled-plugins/agent-loop-policy/dist/entry.d.ts.map +1 -0
  5. package/bundled-plugins/agent-loop-policy/dist/entry.js +69 -0
  6. package/bundled-plugins/agent-loop-policy/dist/entry.js.map +1 -0
  7. package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts +199 -0
  8. package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts.map +1 -0
  9. package/bundled-plugins/agent-loop-policy/dist/loop-guard.js +208 -0
  10. package/bundled-plugins/agent-loop-policy/dist/loop-guard.js.map +1 -0
  11. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts +17 -0
  12. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts.map +1 -0
  13. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js +18 -0
  14. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js.map +1 -0
  15. package/bundled-plugins/agent-loop-policy/plugin.json +7 -0
  16. package/bundled-plugins/coding-tools/agent-forge.json +19 -0
  17. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.d.ts +5 -44
  18. package/bundled-plugins/coding-tools/dist/bash.d.ts.map +1 -0
  19. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.js +15 -119
  20. package/bundled-plugins/coding-tools/dist/bash.js.map +1 -0
  21. package/bundled-plugins/coding-tools/dist/capability.d.ts +25 -0
  22. package/bundled-plugins/coding-tools/dist/capability.d.ts.map +1 -0
  23. package/bundled-plugins/coding-tools/dist/capability.js +98 -0
  24. package/bundled-plugins/coding-tools/dist/capability.js.map +1 -0
  25. package/bundled-plugins/coding-tools/dist/config.d.ts +8 -0
  26. package/bundled-plugins/coding-tools/dist/config.d.ts.map +1 -0
  27. package/bundled-plugins/coding-tools/dist/config.js +8 -0
  28. package/bundled-plugins/coding-tools/dist/config.js.map +1 -0
  29. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.d.ts +3 -3
  30. package/bundled-plugins/coding-tools/dist/edit.d.ts.map +1 -0
  31. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.js +12 -10
  32. package/bundled-plugins/coding-tools/dist/edit.js.map +1 -0
  33. package/bundled-plugins/coding-tools/dist/entry.d.ts +14 -0
  34. package/bundled-plugins/coding-tools/dist/entry.d.ts.map +1 -0
  35. package/bundled-plugins/coding-tools/dist/entry.js +23 -0
  36. package/bundled-plugins/coding-tools/dist/entry.js.map +1 -0
  37. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.d.ts +4 -4
  38. package/bundled-plugins/coding-tools/dist/find.d.ts.map +1 -0
  39. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.js +10 -8
  40. package/bundled-plugins/coding-tools/dist/find.js.map +1 -0
  41. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.d.ts +3 -3
  42. package/bundled-plugins/coding-tools/dist/grep.d.ts.map +1 -0
  43. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.js +10 -8
  44. package/bundled-plugins/coding-tools/dist/grep.js.map +1 -0
  45. package/bundled-plugins/coding-tools/dist/index.d.ts +17 -0
  46. package/bundled-plugins/coding-tools/dist/index.d.ts.map +1 -0
  47. package/bundled-plugins/coding-tools/dist/index.js +17 -0
  48. package/bundled-plugins/coding-tools/dist/index.js.map +1 -0
  49. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.d.ts +3 -3
  50. package/bundled-plugins/coding-tools/dist/ls.d.ts.map +1 -0
  51. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js +8 -6
  52. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js.map +1 -1
  53. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.d.ts +2 -1
  54. package/bundled-plugins/coding-tools/dist/powershell.d.ts.map +1 -0
  55. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.js +6 -3
  56. package/bundled-plugins/coding-tools/dist/powershell.js.map +1 -0
  57. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.d.ts +3 -3
  58. package/bundled-plugins/coding-tools/dist/read.d.ts.map +1 -0
  59. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.js +15 -13
  60. package/bundled-plugins/coding-tools/dist/read.js.map +1 -0
  61. package/bundled-plugins/coding-tools/dist/types.d.ts +74 -0
  62. package/bundled-plugins/coding-tools/dist/types.d.ts.map +1 -0
  63. package/bundled-plugins/coding-tools/dist/types.js +28 -0
  64. package/bundled-plugins/coding-tools/dist/types.js.map +1 -0
  65. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.d.ts +2 -2
  66. package/bundled-plugins/coding-tools/dist/write.d.ts.map +1 -0
  67. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.js +11 -9
  68. package/bundled-plugins/coding-tools/dist/write.js.map +1 -0
  69. package/bundled-plugins/coding-tools/plugin.json +10 -0
  70. package/bundled-plugins/compaction-policy/agent-forge.json +19 -0
  71. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts +6 -0
  72. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts.map +1 -0
  73. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js +19 -0
  74. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js.map +1 -0
  75. package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts +6 -0
  76. package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts.map +1 -0
  77. package/bundled-plugins/compaction-policy/dist/compaction-policy.js +38 -0
  78. package/bundled-plugins/compaction-policy/dist/compaction-policy.js.map +1 -0
  79. package/bundled-plugins/compaction-policy/dist/entry.d.ts +13 -0
  80. package/bundled-plugins/compaction-policy/dist/entry.d.ts.map +1 -0
  81. package/bundled-plugins/compaction-policy/dist/entry.js +23 -0
  82. package/bundled-plugins/compaction-policy/dist/entry.js.map +1 -0
  83. package/bundled-plugins/compaction-policy/plugin.json +10 -0
  84. package/bundled-plugins/mcp-http/dist/index.d.ts +8 -0
  85. package/bundled-plugins/mcp-http/dist/index.d.ts.map +1 -0
  86. package/bundled-plugins/mcp-http/dist/index.js +8 -0
  87. package/bundled-plugins/mcp-http/dist/index.js.map +1 -0
  88. package/bundled-plugins/mcp-http/dist/mcp-http.d.ts.map +1 -0
  89. package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.js +1 -1
  90. package/bundled-plugins/mcp-http/dist/mcp-http.js.map +1 -0
  91. package/bundled-plugins/overflow-policy/agent-forge.json +19 -0
  92. package/bundled-plugins/overflow-policy/dist/entry.d.ts +16 -0
  93. package/bundled-plugins/overflow-policy/dist/entry.d.ts.map +1 -0
  94. package/bundled-plugins/overflow-policy/dist/entry.js +35 -0
  95. package/bundled-plugins/overflow-policy/dist/entry.js.map +1 -0
  96. package/bundled-plugins/overflow-policy/plugin.json +10 -0
  97. package/bundled-plugins/provider-failover/agent-forge.json +19 -0
  98. package/bundled-plugins/provider-failover/dist/entry.d.ts +8 -0
  99. package/bundled-plugins/provider-failover/dist/entry.d.ts.map +1 -0
  100. package/bundled-plugins/provider-failover/dist/entry.js +8 -0
  101. package/bundled-plugins/provider-failover/dist/entry.js.map +1 -0
  102. package/bundled-plugins/provider-failover/dist/provider-failover.d.ts +122 -0
  103. package/bundled-plugins/provider-failover/dist/provider-failover.d.ts.map +1 -0
  104. package/{dist/core/extensions → bundled-plugins/provider-failover/dist}/provider-failover.js +143 -56
  105. package/bundled-plugins/provider-failover/dist/provider-failover.js.map +1 -0
  106. package/bundled-plugins/provider-failover/plugin.json +7 -0
  107. package/bundled-plugins/retry-policy/agent-forge.json +19 -0
  108. package/bundled-plugins/retry-policy/dist/entry.d.ts +16 -0
  109. package/bundled-plugins/retry-policy/dist/entry.d.ts.map +1 -0
  110. package/bundled-plugins/retry-policy/dist/entry.js +34 -0
  111. package/bundled-plugins/retry-policy/dist/entry.js.map +1 -0
  112. package/bundled-plugins/retry-policy/plugin.json +10 -0
  113. package/dist/bundle/.build-manifest.json +109 -155
  114. package/dist/bundle/chunks/{anthropic-messages-ALDZBUKI.js → anthropic-messages-PLAKXR73.js} +1 -1
  115. package/dist/bundle/chunks/{azure-openai-responses-A2WJWZFB.js → azure-openai-responses-OUWQ2AZD.js} +1 -1
  116. package/dist/bundle/chunks/chunk-44I47ACN.js +13 -0
  117. package/dist/bundle/chunks/chunk-6F5JWGKE.js +4 -0
  118. package/dist/bundle/chunks/{chunk-CIX3FSBK.js → chunk-A3JYRWB6.js} +1 -1
  119. package/dist/bundle/chunks/{chunk-SQFG22WN.js → chunk-AC2FIS4G.js} +1 -1
  120. package/dist/bundle/chunks/chunk-HTC5K5SM.js +866 -0
  121. package/dist/bundle/chunks/{chunk-YJCQVXW5.js → chunk-HTEVUY7F.js} +1 -1
  122. package/dist/bundle/chunks/{chunk-Y7HXTASS.js → chunk-HV64ASMT.js} +1 -1
  123. package/dist/bundle/chunks/chunk-LSP24WNH.js +665 -0
  124. package/dist/bundle/chunks/{chunk-7ZY7IXZD.js → chunk-TRDNDS6A.js} +1 -1
  125. package/dist/bundle/chunks/{google-generative-ai-NIB4WONV.js → google-generative-ai-DLII6DAT.js} +1 -1
  126. package/dist/bundle/chunks/{google-vertex-DCPYUEUO.js → google-vertex-G7BZL7GM.js} +1 -1
  127. package/dist/bundle/chunks/image-resize-worker.js +4 -4
  128. package/dist/bundle/chunks/{mistral-conversations-OC6LA5XL.js → mistral-conversations-JXUK24ID.js} +1 -1
  129. package/dist/bundle/chunks/{openai-codex-responses-IO2X4Y7L.js → openai-codex-responses-5GSGFIPG.js} +1 -1
  130. package/dist/bundle/chunks/{openai-completions-XYQQHETU.js → openai-completions-EI2I6DTG.js} +1 -1
  131. package/dist/bundle/chunks/{openai-responses-DLIRN3CI.js → openai-responses-AUJQ3NWT.js} +1 -1
  132. package/dist/bundle/chunks/{pi-messages-E6RRYBO7.js → pi-messages-PWU2VJMR.js} +1 -1
  133. package/dist/bundle/chunks/virtual-modules-MRXD3RWG.js +5 -0
  134. package/dist/bundle/cli.js +1 -1
  135. package/dist/bundle/client.js +1 -1
  136. package/dist/bundle/index.js +3 -3
  137. package/dist/bundle/rpc-entry.js +1 -1
  138. package/dist/capabilities/builtin.d.ts +1 -1
  139. package/dist/capabilities/builtin.d.ts.map +1 -1
  140. package/dist/capabilities/builtin.js +5 -0
  141. package/dist/capabilities/builtin.js.map +1 -1
  142. package/dist/cli/plugin-command.d.ts.map +1 -1
  143. package/dist/cli/plugin-command.js +25 -3
  144. package/dist/cli/plugin-command.js.map +1 -1
  145. package/dist/config.d.ts +2 -3
  146. package/dist/config.d.ts.map +1 -1
  147. package/dist/config.js +2 -4
  148. package/dist/config.js.map +1 -1
  149. package/dist/core/agent-session-bash.d.ts +1 -1
  150. package/dist/core/agent-session-bash.d.ts.map +1 -1
  151. package/dist/core/agent-session-bash.js +1 -1
  152. package/dist/core/agent-session-bash.js.map +1 -1
  153. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  154. package/dist/core/agent-session-compaction.js +14 -1
  155. package/dist/core/agent-session-compaction.js.map +1 -1
  156. package/dist/core/agent-session-internal.d.ts +3 -1
  157. package/dist/core/agent-session-internal.d.ts.map +1 -1
  158. package/dist/core/agent-session-internal.js.map +1 -1
  159. package/dist/core/agent-session-loop.d.ts +4 -3
  160. package/dist/core/agent-session-loop.d.ts.map +1 -1
  161. package/dist/core/agent-session-loop.js +9 -6
  162. package/dist/core/agent-session-loop.js.map +1 -1
  163. package/dist/core/agent-session-retry.d.ts +1 -1
  164. package/dist/core/agent-session-retry.d.ts.map +1 -1
  165. package/dist/core/agent-session-retry.js +32 -3
  166. package/dist/core/agent-session-retry.js.map +1 -1
  167. package/dist/core/agent-session-services.d.ts +2 -0
  168. package/dist/core/agent-session-services.d.ts.map +1 -1
  169. package/dist/core/agent-session-services.js +31 -9
  170. package/dist/core/agent-session-services.js.map +1 -1
  171. package/dist/core/agent-session-store.d.ts.map +1 -1
  172. package/dist/core/agent-session-store.js +6 -1
  173. package/dist/core/agent-session-store.js.map +1 -1
  174. package/dist/core/agent-session-tools.d.ts.map +1 -1
  175. package/dist/core/agent-session-tools.js +18 -1
  176. package/dist/core/agent-session-tools.js.map +1 -1
  177. package/dist/core/agent-session.d.ts +34 -11
  178. package/dist/core/agent-session.d.ts.map +1 -1
  179. package/dist/core/agent-session.js +114 -38
  180. package/dist/core/agent-session.js.map +1 -1
  181. package/dist/core/bash-executor.d.ts +1 -1
  182. package/dist/core/bash-executor.d.ts.map +1 -1
  183. package/dist/core/bash-executor.js.map +1 -1
  184. package/dist/core/extensions/bootstrap-agent-loop.d.ts +23 -151
  185. package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
  186. package/dist/core/extensions/bootstrap-agent-loop.js +28 -290
  187. package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
  188. package/dist/core/extensions/capability-runtime-types.d.ts +5 -3
  189. package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
  190. package/dist/core/extensions/capability-runtime-types.js.map +1 -1
  191. package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
  192. package/dist/core/extensions/capability-runtime.js +42 -6
  193. package/dist/core/extensions/capability-runtime.js.map +1 -1
  194. package/dist/core/extensions/index.d.ts +12 -5
  195. package/dist/core/extensions/index.d.ts.map +1 -1
  196. package/dist/core/extensions/index.js +12 -5
  197. package/dist/core/extensions/index.js.map +1 -1
  198. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  199. package/dist/core/extensions/virtual-modules.js +65 -0
  200. package/dist/core/extensions/virtual-modules.js.map +1 -1
  201. package/dist/core/facade/coding-agent-facade.d.ts +1 -1
  202. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  203. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  204. package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -1
  205. package/dist/core/i18n/locales/zh-cn/cli.js +2 -0
  206. package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -1
  207. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +1 -1
  208. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -1
  209. package/dist/core/i18n/locales/zh-cn/core-contract-core.js +1 -1
  210. package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -1
  211. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -1
  212. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +2 -4
  213. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -1
  214. package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
  215. package/dist/core/i18n/locales/zh-cn/core-errors.js +3 -1
  216. package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
  217. package/dist/core/i18n/locales/zh-cn/index.d.ts.map +1 -1
  218. package/dist/core/i18n/locales/zh-cn/index.js +2 -0
  219. package/dist/core/i18n/locales/zh-cn/index.js.map +1 -1
  220. package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -1
  221. package/dist/core/i18n/locales/zh-cn/interactive-mode.js +5 -0
  222. package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -1
  223. package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts +7 -0
  224. package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts.map +1 -0
  225. package/dist/core/i18n/locales/zh-cn/session-cleanup.js +15 -0
  226. package/dist/core/i18n/locales/zh-cn/session-cleanup.js.map +1 -0
  227. package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts.map +1 -1
  228. package/dist/core/i18n/locales/zh-cn/slash-commands.js +1 -0
  229. package/dist/core/i18n/locales/zh-cn/slash-commands.js.map +1 -1
  230. package/dist/core/sdk.d.ts +10 -3
  231. package/dist/core/sdk.d.ts.map +1 -1
  232. package/dist/core/sdk.js +287 -78
  233. package/dist/core/sdk.js.map +1 -1
  234. package/dist/core/session-cleanup.d.ts +49 -0
  235. package/dist/core/session-cleanup.d.ts.map +1 -0
  236. package/dist/core/session-cleanup.js +159 -0
  237. package/dist/core/session-cleanup.js.map +1 -0
  238. package/dist/core/session-index.d.ts +75 -0
  239. package/dist/core/session-index.d.ts.map +1 -0
  240. package/dist/core/session-index.js +455 -0
  241. package/dist/core/session-index.js.map +1 -0
  242. package/dist/core/session-manager.d.ts +9 -0
  243. package/dist/core/session-manager.d.ts.map +1 -1
  244. package/dist/core/session-manager.js +202 -47
  245. package/dist/core/session-manager.js.map +1 -1
  246. package/dist/core/slash-commands.d.ts.map +1 -1
  247. package/dist/core/slash-commands.js +5 -0
  248. package/dist/core/slash-commands.js.map +1 -1
  249. package/dist/core/system-prompt.d.ts.map +1 -1
  250. package/dist/core/system-prompt.js +12 -1
  251. package/dist/core/system-prompt.js.map +1 -1
  252. package/dist/core/tools/bash-operations.d.ts +41 -0
  253. package/dist/core/tools/bash-operations.d.ts.map +1 -0
  254. package/dist/core/tools/bash-operations.js +113 -0
  255. package/dist/core/tools/bash-operations.js.map +1 -0
  256. package/dist/core/tools/capability-mount.d.ts +40 -0
  257. package/dist/core/tools/capability-mount.d.ts.map +1 -0
  258. package/dist/core/tools/capability-mount.js +112 -0
  259. package/dist/core/tools/capability-mount.js.map +1 -0
  260. package/dist/core/tools/index.d.ts +12 -36
  261. package/dist/core/tools/index.d.ts.map +1 -1
  262. package/dist/core/tools/index.js +1 -117
  263. package/dist/core/tools/index.js.map +1 -1
  264. package/dist/core/tools/readme-path.d.ts +3 -0
  265. package/dist/core/tools/readme-path.d.ts.map +1 -0
  266. package/dist/core/tools/readme-path.js +15 -0
  267. package/dist/core/tools/readme-path.js.map +1 -0
  268. package/dist/index.d.ts +3 -19
  269. package/dist/index.d.ts.map +1 -1
  270. package/dist/index.js +6 -39
  271. package/dist/index.js.map +1 -1
  272. package/dist/main.d.ts.map +1 -1
  273. package/dist/main.js +1 -0
  274. package/dist/main.js.map +1 -1
  275. package/dist/modes/interactive/components/assistant-message.d.ts +3 -0
  276. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  277. package/dist/modes/interactive/components/assistant-message.js +27 -5
  278. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  279. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  280. package/dist/modes/interactive/components/session-selector-search.js +5 -1
  281. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  282. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  283. package/dist/modes/interactive/components/session-selector.js +9 -0
  284. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  285. package/dist/modes/interactive/components/tool-execution.d.ts +17 -1
  286. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  287. package/dist/modes/interactive/components/tool-execution.js +52 -25
  288. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  289. package/dist/modes/interactive/components/tool-run-group.d.ts +44 -0
  290. package/dist/modes/interactive/components/tool-run-group.d.ts.map +1 -0
  291. package/dist/modes/interactive/components/tool-run-group.js +121 -0
  292. package/dist/modes/interactive/components/tool-run-group.js.map +1 -0
  293. package/dist/modes/interactive/interactive-commands.d.ts +2 -0
  294. package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
  295. package/dist/modes/interactive/interactive-commands.js +7 -0
  296. package/dist/modes/interactive/interactive-commands.js.map +1 -1
  297. package/dist/modes/interactive/interactive-mode.d.ts +18 -0
  298. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  299. package/dist/modes/interactive/interactive-mode.js +85 -3
  300. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  301. package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
  302. package/dist/plugins/ecosystem/cli.js +20 -5
  303. package/dist/plugins/ecosystem/cli.js.map +1 -1
  304. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts +7 -2
  305. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
  306. package/dist/plugins/ecosystem/node-npm-registry-source.js +64 -9
  307. package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
  308. package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts.map +1 -1
  309. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js +6 -0
  310. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js.map +1 -1
  311. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +7 -1
  312. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
  313. package/dist/plugins/ecosystem/node-plugin-bootstrap.js +50 -3
  314. package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
  315. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +28 -16
  316. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
  317. package/dist/plugins/ecosystem/plugin-bootstrap.js +35 -33
  318. package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
  319. package/dist/profile/plugin-profiles.d.ts +1 -1
  320. package/dist/profile/plugin-profiles.d.ts.map +1 -1
  321. package/dist/profile/plugin-profiles.js +18 -0
  322. package/dist/profile/plugin-profiles.js.map +1 -1
  323. package/dist/profiles/builtin-suites.d.ts +19 -5
  324. package/dist/profiles/builtin-suites.d.ts.map +1 -1
  325. package/dist/profiles/builtin-suites.js +26 -6
  326. package/dist/profiles/builtin-suites.js.map +1 -1
  327. package/docs/settings.md +354 -354
  328. package/docs/usage.md +292 -292
  329. package/examples/extensions/bash-spawn-hook/index.ts +7 -2
  330. package/examples/extensions/built-in-tool-renderer/index.ts +4 -2
  331. package/examples/extensions/minimal-mode/index.ts +2 -2
  332. package/examples/extensions/truncated-tool/index.ts +1 -1
  333. package/examples/extensions/with-deps/package-lock.json +2 -2
  334. package/examples/extensions/with-deps/package.json +1 -1
  335. package/examples/extensions/with-deps/plugin.json +1 -1
  336. package/package.json +3 -2
  337. package/dist/bundle/chunks/chunk-6ZKDNZHA.js +0 -145
  338. package/dist/bundle/chunks/chunk-HLJEVRWP.js +0 -13
  339. package/dist/bundle/chunks/chunk-YGHQME4V.js +0 -1456
  340. package/dist/bundle/chunks/virtual-modules-KZ5DRH7Q.js +0 -2
  341. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts +0 -7
  342. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts.map +0 -1
  343. package/dist/core/extensions/bootstrap-branch-summary-policy.js +0 -28
  344. package/dist/core/extensions/bootstrap-branch-summary-policy.js.map +0 -1
  345. package/dist/core/extensions/bootstrap-compaction-policy.d.ts +0 -7
  346. package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +0 -1
  347. package/dist/core/extensions/bootstrap-compaction-policy.js +0 -48
  348. package/dist/core/extensions/bootstrap-compaction-policy.js.map +0 -1
  349. package/dist/core/extensions/bootstrap-overflow-policy.d.ts +0 -7
  350. package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +0 -1
  351. package/dist/core/extensions/bootstrap-overflow-policy.js +0 -30
  352. package/dist/core/extensions/bootstrap-overflow-policy.js.map +0 -1
  353. package/dist/core/extensions/bootstrap-retry-policy.d.ts +0 -7
  354. package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +0 -1
  355. package/dist/core/extensions/bootstrap-retry-policy.js +0 -29
  356. package/dist/core/extensions/bootstrap-retry-policy.js.map +0 -1
  357. package/dist/core/extensions/bootstrap-tools.d.ts +0 -20
  358. package/dist/core/extensions/bootstrap-tools.d.ts.map +0 -1
  359. package/dist/core/extensions/bootstrap-tools.js +0 -36
  360. package/dist/core/extensions/bootstrap-tools.js.map +0 -1
  361. package/dist/core/extensions/provider-failover.d.ts +0 -110
  362. package/dist/core/extensions/provider-failover.d.ts.map +0 -1
  363. package/dist/core/extensions/provider-failover.js.map +0 -1
  364. package/dist/core/tools/bash.d.ts.map +0 -1
  365. package/dist/core/tools/bash.js.map +0 -1
  366. package/dist/core/tools/edit.d.ts.map +0 -1
  367. package/dist/core/tools/edit.js.map +0 -1
  368. package/dist/core/tools/find.d.ts.map +0 -1
  369. package/dist/core/tools/find.js.map +0 -1
  370. package/dist/core/tools/grep.d.ts.map +0 -1
  371. package/dist/core/tools/grep.js.map +0 -1
  372. package/dist/core/tools/ls.d.ts.map +0 -1
  373. package/dist/core/tools/powershell.d.ts.map +0 -1
  374. package/dist/core/tools/powershell.js.map +0 -1
  375. package/dist/core/tools/read.d.ts.map +0 -1
  376. package/dist/core/tools/read.js.map +0 -1
  377. package/dist/core/tools/write.d.ts.map +0 -1
  378. package/dist/core/tools/write.js.map +0 -1
  379. package/dist/plugins/mcp-http.d.ts.map +0 -1
  380. package/dist/plugins/mcp-http.js.map +0 -1
  381. package/dist/profile/child-facade.d.ts +0 -44
  382. package/dist/profile/child-facade.d.ts.map +0 -1
  383. package/dist/profile/child-facade.js +0 -56
  384. package/dist/profile/child-facade.js.map +0 -1
  385. package/dist/profile/dependency-wiring.d.ts +0 -48
  386. package/dist/profile/dependency-wiring.d.ts.map +0 -1
  387. package/dist/profile/dependency-wiring.js +0 -56
  388. package/dist/profile/dependency-wiring.js.map +0 -1
  389. package/dist/profile/domain-recovery.d.ts +0 -60
  390. package/dist/profile/domain-recovery.d.ts.map +0 -1
  391. package/dist/profile/domain-recovery.js +0 -94
  392. package/dist/profile/domain-recovery.js.map +0 -1
  393. package/dist/profile/first-roles.d.ts +0 -30
  394. package/dist/profile/first-roles.d.ts.map +0 -1
  395. package/dist/profile/first-roles.js +0 -83
  396. package/dist/profile/first-roles.js.map +0 -1
  397. package/dist/profile/goal-plugin.d.ts +0 -38
  398. package/dist/profile/goal-plugin.d.ts.map +0 -1
  399. package/dist/profile/goal-plugin.js +0 -132
  400. package/dist/profile/goal-plugin.js.map +0 -1
  401. package/dist/profile/plan-plugin.d.ts +0 -44
  402. package/dist/profile/plan-plugin.d.ts.map +0 -1
  403. package/dist/profile/plan-plugin.js +0 -157
  404. package/dist/profile/plan-plugin.js.map +0 -1
  405. package/dist/profile/policy-manifest.d.ts +0 -53
  406. package/dist/profile/policy-manifest.d.ts.map +0 -1
  407. package/dist/profile/policy-manifest.js +0 -53
  408. package/dist/profile/policy-manifest.js.map +0 -1
  409. package/dist/profile/role-assembly.d.ts +0 -47
  410. package/dist/profile/role-assembly.d.ts.map +0 -1
  411. package/dist/profile/role-assembly.js +0 -31
  412. package/dist/profile/role-assembly.js.map +0 -1
  413. package/dist/profile/role-catalog.d.ts +0 -43
  414. package/dist/profile/role-catalog.d.ts.map +0 -1
  415. package/dist/profile/role-catalog.js +0 -132
  416. package/dist/profile/role-catalog.js.map +0 -1
  417. package/dist/profile/role-orchestrator.d.ts +0 -123
  418. package/dist/profile/role-orchestrator.d.ts.map +0 -1
  419. package/dist/profile/role-orchestrator.js +0 -195
  420. package/dist/profile/role-orchestrator.js.map +0 -1
  421. package/dist/profile/role-runner.d.ts +0 -99
  422. package/dist/profile/role-runner.d.ts.map +0 -1
  423. package/dist/profile/role-runner.js +0 -79
  424. package/dist/profile/role-runner.js.map +0 -1
  425. package/dist/profile/root-facade.d.ts +0 -36
  426. package/dist/profile/root-facade.d.ts.map +0 -1
  427. package/dist/profile/root-facade.js +0 -49
  428. package/dist/profile/root-facade.js.map +0 -1
  429. package/dist/profile/skill-discovery-wiring.d.ts +0 -58
  430. package/dist/profile/skill-discovery-wiring.d.ts.map +0 -1
  431. package/dist/profile/skill-discovery-wiring.js +0 -80
  432. package/dist/profile/skill-discovery-wiring.js.map +0 -1
  433. package/dist/profile/state-store.d.ts +0 -62
  434. package/dist/profile/state-store.d.ts.map +0 -1
  435. package/dist/profile/state-store.js +0 -144
  436. package/dist/profile/state-store.js.map +0 -1
  437. package/dist/profile/todo-plugin.d.ts +0 -37
  438. package/dist/profile/todo-plugin.d.ts.map +0 -1
  439. package/dist/profile/todo-plugin.js +0 -137
  440. package/dist/profile/todo-plugin.js.map +0 -1
  441. package/examples/extensions/mcp-stdio/index.d.ts +0 -64
  442. package/examples/extensions/mcp-stdio/index.d.ts.map +0 -1
  443. package/examples/extensions/mcp-stdio/index.js +0 -292
  444. package/examples/extensions/mcp-stdio/index.js.map +0 -1
  445. /package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.d.ts +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"role-orchestrator.js","sourceRoot":"","sources":["../../src/profile/role-orchestrator.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAI1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,GAAG,IAAI,CAAC;AAsF9D,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAYxD,iEAAiE;AACjE,MAAM,UAAU,sBAAsB,CAAC,OAAkC,EAAsB;IAC9F,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,2BAA2B,CAAC;IAC3D,uEAAuE;IACvE,2EAA2E;IAC3E,6CAA6C;IAC7C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkE,CAAC;IAC9F,IAAI,eAAe,GAA2C,IAAI,GAAG,EAAE,CAAC;IACxE,IAAI,WAAW,GAAG,KAAK,CAAC;IAExB,SAAS,eAAe,CAAC,MAAc,EAAkB;QACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,wBAAwB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QACxE,OAAO,QAAQ,CAAC;IAAA,CAChB;IAED,SAAS,aAAa,CAAC,MAAc,EAA0D;QAC9F,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAC1B,MAAM,IA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gBACR,MAAM,EACL,OAAO,KAAK,IAAI;oBACf,CAAC,CAAE,WAAqB;oBACxB,CAAC,CAAC,OAAO,KAAK,KAAK;wBAClB,CAAC,CAAE,OAAiB;wBACpB,CAAC,CAAE,WAAqB;aAC3B,CAAC,CAAC;QAAA,CACH,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,CAAC;YACpB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;YACrC,SAAS;YACT,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;SAC7C,CAAC,CAAC;IAAA,CACH;IAED,OAAO;QACN,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,QAAQ;KACR,CAAC;AAAA,CACF","sourcesContent":["/**\n * Role orchestrator (2.2e) — root-side concurrent orchestration of registered\n * roles with bounded aggregation.\n *\n * Spawns one child per requested roleId through the public\n * `AgentCompositionAPI` (create/lease/run/wait bound to the root via\n * `parentInstanceId`), honoring the role's `RoleMetadataV1.concurrency`\n * metadata: `parallel` roles run concurrently, `single` roles execute one at\n * a time in stable roleId order. Aggregation reuses the multi-agent-tasks 6.3\n * semantics — entries sorted by roleId (never completion order), a per-entry\n * byte budget over the JSON-serialized output (`limitBytes`; over-budget\n * entries are dropped whole with an explicit `truncated` flag, outputs that\n * are absent carry `missing`), and `completionCriteria` metadata checked per\n * role into a structured satisfied/unmet/unchecked list (never thrown).\n * Child failures are collected, never swallowed: a failed child lands in its\n * structured entry while the orchestration still resolves (fail-collect at\n * the orchestration level, not fail-fast).\n *\n * Limit constants: multi-agent-tasks itself has no built-in numeric caps —\n * its `limitBytes`/`maxResultBytes` are caller-injected and default to\n * unbounded. This contract therefore defaults `limitBytes` to 16 KiB, the\n * magnitude of the repo's existing `DEFAULT_MAX_RESULT_BYTES_V1` (office\n * writer). No separate entry cap is added: the multi-agent-tasks aggregate\n * has none either, and the entry count here is already bounded by the\n * explicit `roleIds` list.\n *\n * Honest state-namespace boundary: state namespaces are partitioned per\n * plugin owner, not per child instance. Concurrent children therefore do NOT\n * get per-instance state isolation under this contract. The deterministic\n * injected run callbacks of this milestone never write state, so the boundary\n * is not exercised here; concurrent child state writes remain outside this\n * contract.\n */\nimport type { AgentCompositionAPI, AgentDefinition } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { RoleMetadataV1 } from \"./role-catalog.ts\";\nimport type { RoleRunCallbackV1, RoleRunnerInputV1, RoleRunnerResultV1, RoleRunnerV1 } from \"./role-runner.ts\";\n\n/**\n * Default aggregation byte budget. The multi-agent-tasks aggregate defaults\n * to unbounded (caller-injected limits); this default anchors the contract to\n * the repo's existing 16 KiB result-cap magnitude.\n */\nexport const DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES = 16 * 1024;\n\n/** Terminal instance states an orchestrated child can settle into. */\nexport type RoleOrchestrationStatusV1 = \"succeeded\" | \"failed\" | \"cancelled\" | \"disposed\";\n\n/** One orchestrated child's aggregation entry (sorted by roleId, never completion order). */\nexport interface RoleOrchestrationEntryV1 {\n\treadonly roleId: string;\n\treadonly definitionId: string;\n\treadonly childInstanceId: string;\n\t/** Terminal revision of the child instance (result reference half, see 2.2b). */\n\treadonly revision: number;\n\treadonly status: RoleOrchestrationStatusV1;\n\t/** The entry's output exceeded the remaining byte budget and was dropped whole. */\n\treadonly truncated: boolean;\n\t/** No output was available (failure, cancellation, disposal, or truncation). */\n\treadonly missing: boolean;\n\t/** Present only for succeeded entries that fit the byte budget. */\n\treadonly result?: RoleRunnerResultV1;\n\t/** Structured failure text; present when the instance settled with an error. */\n\treadonly error?: string;\n}\n\n/** Per-role completion-criteria verdict produced at aggregation time (never thrown). */\nexport interface RoleCompletionCheckV1 {\n\treadonly roleId: string;\n\treadonly criteria: string;\n\t/**\n\t * `satisfied`/`unmet` come from an injected evaluator; `unchecked` means no\n\t * evaluator was available or the entry had no in-budget output to judge.\n\t */\n\treadonly status: \"satisfied\" | \"unmet\" | \"unchecked\";\n}\n\n/**\n * Deterministic completion evaluator. Returns `true`/`false` for a verdict or\n * `undefined` when the criteria cannot be judged from the result.\n */\nexport type RoleCompletionEvaluatorV1 = (input: {\n\treadonly roleId: string;\n\treadonly criteria: string;\n\treadonly result: RoleRunnerResultV1;\n}) => boolean | undefined;\n\n/** One orchestration request: explicit roleIds plus one shared spec string. */\nexport interface RoleOrchestratorRunRequestV1 {\n\treadonly roleIds: readonly string[];\n\treadonly spec: string;\n\t/** Per-role run overrides taking precedence for this request only. */\n\treadonly runs?: readonly { readonly roleId: string; readonly run: RoleRunCallbackV1 }[];\n\t/** Aggregation byte budget for this request (defaults to the orchestrator option). */\n\treadonly limitBytes?: number;\n\t/** Completion evaluator for this request (defaults to the orchestrator option). */\n\treadonly evaluateCompletion?: RoleCompletionEvaluatorV1;\n}\n\nexport interface RoleOrchestratorOptionsV1 {\n\treadonly composition: AgentCompositionAPI;\n\treadonly runner: RoleRunnerV1;\n\t/** Root instance the children are parented to via `parentInstanceId`. */\n\treadonly parentInstanceId: string;\n\t/** Controller-lease owner for the orchestrated children. */\n\treadonly owner?: string;\n\t/** Default aggregation byte budget (see {@link DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES}). */\n\treadonly limitBytes?: number;\n\t/** Default completion evaluator. Without one every check reports `unchecked`. */\n\treadonly evaluateCompletion?: RoleCompletionEvaluatorV1;\n}\n\n/** Orchestration result: bounded aggregation plus completion verdicts. */\nexport interface RoleOrchestrationResultV1 {\n\t/** One entry per requested role, sorted by roleId (stable, never completion order). */\n\treadonly entries: readonly RoleOrchestrationEntryV1[];\n\t/** True when at least one entry was dropped for exceeding the byte budget. */\n\treadonly truncated: boolean;\n\t/** Completion verdicts per requested role, sorted by roleId. */\n\treadonly completionChecks: readonly RoleCompletionCheckV1[];\n}\n\nexport interface RoleOrchestratorV1 {\n\treadonly composition: AgentCompositionAPI;\n\treadonly runner: RoleRunnerV1;\n\treadonly parentInstanceId: string;\n\trunRoles(request: RoleOrchestratorRunRequestV1): Promise<RoleOrchestrationResultV1>;\n}\n\nconst DEFAULT_ORCHESTRATION_OWNER = \"role-orchestrator\";\n\ninterface SettledChildV1 {\n\treadonly roleId: string;\n\treadonly definitionId: string;\n\treadonly childInstanceId: string;\n\treadonly revision: number;\n\treadonly status: RoleOrchestrationStatusV1;\n\treadonly output?: RoleRunnerResultV1;\n\treadonly error?: string;\n}\n\n/** Creates the root-side concurrent role orchestrator (2.2e). */\nexport function createRoleOrchestrator(options: RoleOrchestratorOptionsV1): RoleOrchestratorV1 {\n\tconst owner = options.owner ?? DEFAULT_ORCHESTRATION_OWNER;\n\t// Definitions are registered once per roleId and reused across runs: a\n\t// composition instance is single-run, so every orchestration creates fresh\n\t// child instances from the same definitions.\n\tconst definitions = new Map<string, AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1>>();\n\tlet activeOverrides: ReadonlyMap<string, RoleRunCallbackV1> = new Map();\n\tlet runInFlight = false;\n\n\tfunction requireMetadata(roleId: string): RoleMetadataV1 {\n\t\tconst metadata = options.runner.catalog.get(roleId);\n\t\tif (!metadata) throw new Error(t(\"Unknown role: {roleId}\", { roleId }));\n\t\treturn metadata;\n\t}\n\n\tfunction definitionFor(roleId: string): AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1> {\n\t\tconst cached = definitions.get(roleId);\n\t\tif (cached) return cached;\n\t\tconst base = options.runner.createDefinition(roleId);\n\t\tconst definition: AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1> = {\n\t\t\t...base,\n\t\t\trun: (input, context) => {\n\t\t\t\tconst override = activeOverrides.get(roleId);\n\t\t\t\treturn override ? override(input, context) : options.runner.run(roleId, input, context);\n\t\t\t},\n\t\t};\n\t\tconst registered = options.composition.define(definition);\n\t\tdefinitions.set(roleId, registered);\n\t\treturn registered;\n\t}\n\n\tasync function runOne(roleId: string, spec: string, settled: Map<string, SettledChildV1>): Promise<void> {\n\t\tconst definition = definitionFor(roleId);\n\t\tconst instance = options.composition.create<RoleRunnerInputV1, RoleRunnerResultV1>(\n\t\t\t{ id: definition.id, version: definition.version },\n\t\t\t{ parentInstanceId: options.parentInstanceId },\n\t\t);\n\t\tconst childInstanceId = instance.id;\n\t\tconst lease = await instance.acquireControllerLease(owner);\n\t\ttry {\n\t\t\tconst operation = instance.run({ spec }, { lease });\n\t\t\ttry {\n\t\t\t\tawait operation.result;\n\t\t\t} catch {\n\t\t\t\t// run() rejects on failure/cancellation mid-flight; instance.wait()\n\t\t\t\t// below yields the terminal status and error.\n\t\t\t}\n\t\t\tconst terminal = await instance.wait();\n\t\t\tconst error =\n\t\t\t\tterminal.error === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: terminal.error instanceof Error\n\t\t\t\t\t\t? terminal.error.message\n\t\t\t\t\t\t: String(terminal.error);\n\t\t\tsettled.set(roleId, {\n\t\t\t\troleId,\n\t\t\t\tdefinitionId: definition.id,\n\t\t\t\tchildInstanceId,\n\t\t\t\trevision: terminal.revision,\n\t\t\t\tstatus: terminal.status,\n\t\t\t\t...(terminal.output !== undefined ? { output: terminal.output } : {}),\n\t\t\t\t...(error !== undefined ? { error } : {}),\n\t\t\t});\n\t\t} finally {\n\t\t\tif (lease.isActive()) await lease.release();\n\t\t}\n\t}\n\n\tasync function runRoles(request: RoleOrchestratorRunRequestV1): Promise<RoleOrchestrationResultV1> {\n\t\tif (runInFlight) throw new Error(t(\"Role orchestrator is already running an orchestration\"));\n\t\t// Input validation fails explicitly before any child is spawned.\n\t\tconst seen = new Set<string>();\n\t\tfor (const roleId of request.roleIds) {\n\t\t\tif (typeof roleId !== \"string\" || roleId.trim().length === 0) {\n\t\t\t\tthrow new Error(t(\"Role id must be a non-empty string\"));\n\t\t\t}\n\t\t\tif (seen.has(roleId)) throw new Error(t(\"Duplicate roleId in orchestration request: {roleId}\", { roleId }));\n\t\t\tseen.add(roleId);\n\t\t}\n\t\tconst overrides = new Map<string, RoleRunCallbackV1>();\n\t\tfor (const override of request.runs ?? []) {\n\t\t\tif (overrides.has(override.roleId))\n\t\t\t\tthrow new Error(t(\"Duplicate run override for role: {roleId}\", { roleId: override.roleId }));\n\t\t\toverrides.set(override.roleId, override.run);\n\t\t}\n\t\tfor (const roleId of overrides.keys()) {\n\t\t\tif (!seen.has(roleId)) throw new Error(t(\"Run override for unrequested role: {roleId}\", { roleId }));\n\t\t}\n\t\t// Stable execution order: roleId-sorted, `parallel` roles concurrent,\n\t\t// `single` roles strictly sequential. Aggregation order is independent\n\t\t// of this execution order.\n\t\tconst sorted = [...request.roleIds].sort((left, right) => left.localeCompare(right));\n\t\tfor (const roleId of sorted) {\n\t\t\trequireMetadata(roleId);\n\t\t\tdefinitionFor(roleId);\n\t\t}\n\n\t\trunInFlight = true;\n\t\ttry {\n\t\t\tactiveOverrides = overrides;\n\t\t\tconst settled = new Map<string, SettledChildV1>();\n\t\t\tif (sorted.length > 0) {\n\t\t\t\tconst parallelIds = sorted.filter((roleId) => requireMetadata(roleId).concurrency === \"parallel\");\n\t\t\t\tconst singleIds = sorted.filter((roleId) => requireMetadata(roleId).concurrency === \"single\");\n\t\t\t\tawait Promise.all(parallelIds.map((roleId) => runOne(roleId, request.spec, settled)));\n\t\t\t\tfor (const roleId of singleIds) await runOne(roleId, request.spec, settled);\n\t\t\t}\n\t\t\treturn aggregate(sorted, settled, request);\n\t\t} finally {\n\t\t\tactiveOverrides = new Map();\n\t\t\trunInFlight = false;\n\t\t}\n\t}\n\n\tfunction aggregate(\n\t\tsorted: readonly string[],\n\t\tsettled: ReadonlyMap<string, SettledChildV1>,\n\t\trequest: RoleOrchestratorRunRequestV1,\n\t): RoleOrchestrationResultV1 {\n\t\tconst limitBytes = request.limitBytes ?? options.limitBytes ?? DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES;\n\t\t// 6.3 budget semantics: a running byte total over roleId-sorted entries;\n\t\t// an entry that would exceed the budget is dropped whole (truncated),\n\t\t// never partially sliced — mirroring multi-agent-tasks aggregate().\n\t\tlet used = 0;\n\t\tlet truncated = false;\n\t\tconst frozenEntries = sorted.map((roleId): RoleOrchestrationEntryV1 => {\n\t\t\tconst outcome = settled.get(roleId);\n\t\t\tif (!outcome) throw new Error(t(\"Orchestration outcome missing for role: {roleId}\", { roleId }));\n\t\t\tconst base = {\n\t\t\t\troleId: outcome.roleId,\n\t\t\t\tdefinitionId: outcome.definitionId,\n\t\t\t\tchildInstanceId: outcome.childInstanceId,\n\t\t\t\trevision: outcome.revision,\n\t\t\t\tstatus: outcome.status,\n\t\t\t};\n\t\t\tif (outcome.status !== \"succeeded\" || outcome.output === undefined) {\n\t\t\t\treturn Object.freeze({\n\t\t\t\t\t...base,\n\t\t\t\t\ttruncated: false,\n\t\t\t\t\tmissing: true,\n\t\t\t\t\t...(outcome.error !== undefined ? { error: outcome.error } : {}),\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst size = JSON.stringify(outcome.output).length;\n\t\t\tif (used + size > limitBytes) {\n\t\t\t\ttruncated = true;\n\t\t\t\treturn Object.freeze({ ...base, truncated: true, missing: false });\n\t\t\t}\n\t\t\tused += size;\n\t\t\treturn Object.freeze({ ...base, truncated: false, missing: false, result: outcome.output });\n\t\t});\n\t\tconst entryByRole = new Map(frozenEntries.map((entry) => [entry.roleId, entry]));\n\t\tconst evaluate = request.evaluateCompletion ?? options.evaluateCompletion;\n\t\tconst frozenChecks = sorted.map((roleId): RoleCompletionCheckV1 => {\n\t\t\tconst criteria = requireMetadata(roleId).completionCriteria;\n\t\t\tconst outcome = settled.get(roleId);\n\t\t\tconst entry = entryByRole.get(roleId);\n\t\t\tconst output = outcome?.output;\n\t\t\t// No evaluator, no output, or an output dropped by the byte budget:\n\t\t\t// the criteria cannot be judged, which is reported as unchecked\n\t\t\t// instead of being silently treated as satisfied or unmet.\n\t\t\tif (!evaluate || !output || entry?.truncated === true) {\n\t\t\t\treturn Object.freeze({ roleId, criteria, status: \"unchecked\" as const });\n\t\t\t}\n\t\t\tconst verdict = evaluate({ roleId, criteria, result: output });\n\t\t\treturn Object.freeze({\n\t\t\t\troleId,\n\t\t\t\tcriteria,\n\t\t\t\tstatus:\n\t\t\t\t\tverdict === true\n\t\t\t\t\t\t? (\"satisfied\" as const)\n\t\t\t\t\t\t: verdict === false\n\t\t\t\t\t\t\t? (\"unmet\" as const)\n\t\t\t\t\t\t\t: (\"unchecked\" as const),\n\t\t\t});\n\t\t});\n\t\treturn Object.freeze({\n\t\t\tentries: Object.freeze(frozenEntries),\n\t\t\ttruncated,\n\t\t\tcompletionChecks: Object.freeze(frozenChecks),\n\t\t});\n\t}\n\n\treturn {\n\t\tcomposition: options.composition,\n\t\trunner: options.runner,\n\t\tparentInstanceId: options.parentInstanceId,\n\t\trunRoles,\n\t};\n}\n"]}
@@ -1,99 +0,0 @@
1
- /**
2
- * Role runner binding (2.2d) — maps registered `RoleMetadataV1` roles to child
3
- * `AgentDefinition`s executable through the experimental `AgentCompositionAPI`.
4
- *
5
- * The default run implementation is the deterministic first-batch role
6
- * callbacks (architecture-analyst / implementer / test-designer, 2.2c); a
7
- * caller may inject a real implementation via `run`. This slice never calls a
8
- * model.
9
- *
10
- * Library-level use works without any guard. When used through the
11
- * capability-runtime guards (`src/core/extensions/capability-runtime-guards.ts`),
12
- * the produced definitions must be defined/created by a manifest that declares
13
- * the `child-agent-controller` role and the `owner` must equal that manifest
14
- * id — the guards enforce this at the plugin boundary; this contract does not
15
- * duplicate guard logic.
16
- *
17
- * Required capability dependencies are checked explicitly (2.5a structured
18
- * `missing` shape) before activation (create/lease); they are never silently
19
- * skipped. Domain role runtimes live INSIDE the composition's child role: the
20
- * root/child two-value role enum is unchanged by design.
21
- */
22
- import type { AgentDefinition, AgentExecutionContext } from "../core/extensions/public-api.ts";
23
- import type { AvailableCapabilityV1 } from "./dependency-wiring.ts";
24
- import type { RoleCatalogV1 } from "./role-catalog.ts";
25
- /** Deterministic role input: a single spec string (first-batch contract). */
26
- export interface RoleRunnerInputV1 {
27
- readonly spec: string;
28
- }
29
- /** Deterministic role output: a single result string (first-batch contract). */
30
- export interface RoleRunnerResultV1 {
31
- readonly result: string;
32
- }
33
- /**
34
- * Per-role run implementation. `context` is present when executed through
35
- * `AgentCompositionAPI`; direct deterministic execution may omit it.
36
- */
37
- export type RoleRunCallbackV1 = (input: RoleRunnerInputV1, context?: AgentExecutionContext) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;
38
- /** Runner-level run resolver; receives the roleId in addition to the callback arguments. */
39
- export type RoleRunResolverV1 = (roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;
40
- /**
41
- * Role capability-dependency diagnostic: the 2.5a structured `missing` shape
42
- * (`capabilityId`/`requestedVersion`/`availableVersion?`/`reason`) with
43
- * `roleId` as the requester.
44
- */
45
- export interface RoleMissingCapabilityV1 {
46
- readonly roleId: string;
47
- readonly capabilityId: string;
48
- readonly requestedVersion: number;
49
- /** Undefined when the capability is entirely absent from the registry. */
50
- readonly availableVersion?: number;
51
- readonly reason: "missing" | "version_mismatch";
52
- }
53
- /** Activation check result for one role's REQUIRED capability dependencies. */
54
- export interface RoleCapabilityCheckV1 {
55
- readonly roleId: string;
56
- readonly status: "satisfied" | "missing";
57
- /** Required dependencies that are absent or version-mismatched; empty when satisfied. */
58
- readonly missing: readonly RoleMissingCapabilityV1[];
59
- }
60
- export interface RoleRunnerOptionsV1 {
61
- readonly catalog: RoleCatalogV1;
62
- /**
63
- * Owner stamped onto produced child definitions. Required to equal the
64
- * declaring plugin manifest id when used behind the capability-runtime
65
- * guards; plain library use may omit it.
66
- */
67
- readonly owner?: string;
68
- /**
69
- * Injected run implementation replacing the deterministic first-batch
70
- * defaults entirely. Roles without any binding still fail explicitly on
71
- * execution.
72
- */
73
- readonly run?: RoleRunResolverV1;
74
- }
75
- export interface RoleRunnerV1 {
76
- readonly catalog: RoleCatalogV1;
77
- /** Sorted registered roleIds. */
78
- listRoleIds(): readonly string[];
79
- /**
80
- * Maps a registered role to a child agent definition (composition role
81
- * `child-agent-controller`, id `role:<roleId>`, version 1). Run the
82
- * capability check before creating/leasing an instance.
83
- */
84
- createDefinition(roleId: string): AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1>;
85
- /**
86
- * Pre-activation capability-dependency check against an exact-version
87
- * registry: a required dependency is satisfied only when the registry
88
- * offers the same capability id at exactly the requested version. Optional
89
- * dependencies never block activation and are not reported as missing.
90
- */
91
- checkCapabilities(roleId: string, availableCapabilities: readonly AvailableCapabilityV1[]): RoleCapabilityCheckV1;
92
- /** Direct deterministic execution (the same run a produced definition binds). */
93
- run(roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext): Promise<RoleRunnerResultV1>;
94
- }
95
- /** Default deterministic run dispatch: first-batch callbacks; explicit failure otherwise. */
96
- export declare function runFirstBatchRole(roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext): RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;
97
- /** Binds the catalog's registered roles to child agent definitions. */
98
- export declare function createRoleRunner(options: RoleRunnerOptionsV1): RoleRunnerV1;
99
- //# sourceMappingURL=role-runner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"role-runner.d.ts","sourceRoot":"","sources":["../../src/profile/role-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAE/F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,mBAAmB,CAAC;AAEvE,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED,gFAAgF;AAChF,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AA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AAM,EAAE,MAAM,GAAG,eAAe,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;IACzF;;;;;OAKG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,SAAS,qBAAqB,EAAE,GAAG,qBAAqB,CAAC;IAClH,iFAAiF;IACjF,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC5G;AAQD,6FAA6F;AAC7F,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,iBAAiB,EACxB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAIlD;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAoE3E","sourcesContent":["/**\n * Role runner binding (2.2d) — maps registered `RoleMetadataV1` roles to child\n * `AgentDefinition`s executable through the experimental `AgentCompositionAPI`.\n *\n * The default run implementation is the deterministic first-batch role\n * callbacks (architecture-analyst / implementer / test-designer, 2.2c); a\n * caller may inject a real implementation via `run`. This slice never calls a\n * model.\n *\n * Library-level use works without any guard. When used through the\n * capability-runtime guards (`src/core/extensions/capability-runtime-guards.ts`),\n * the produced definitions must be defined/created by a manifest that declares\n * the `child-agent-controller` role and the `owner` must equal that manifest\n * id — the guards enforce this at the plugin boundary; this contract does not\n * duplicate guard logic.\n *\n * Required capability dependencies are checked explicitly (2.5a structured\n * `missing` shape) before activation (create/lease); they are never silently\n * skipped. Domain role runtimes live INSIDE the composition's child role: the\n * root/child two-value role enum is unchanged by design.\n */\nimport type { AgentDefinition, AgentExecutionContext } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { AvailableCapabilityV1 } from \"./dependency-wiring.ts\";\nimport { FIRST_BATCH_ROLES } from \"./first-roles.ts\";\nimport type { RoleCatalogV1, RoleMetadataV1 } from \"./role-catalog.ts\";\n\n/** Deterministic role input: a single spec string (first-batch contract). */\nexport interface RoleRunnerInputV1 {\n\treadonly spec: string;\n}\n\n/** Deterministic role output: a single result string (first-batch contract). */\nexport interface RoleRunnerResultV1 {\n\treadonly result: string;\n}\n\n/**\n * Per-role run implementation. `context` is present when executed through\n * `AgentCompositionAPI`; direct deterministic execution may omit it.\n */\nexport type RoleRunCallbackV1 = (\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;\n\n/** Runner-level run resolver; receives the roleId in addition to the callback arguments. */\nexport type RoleRunResolverV1 = (\n\troleId: string,\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;\n\n/**\n * Role capability-dependency diagnostic: the 2.5a structured `missing` shape\n * (`capabilityId`/`requestedVersion`/`availableVersion?`/`reason`) with\n * `roleId` as the requester.\n */\nexport interface RoleMissingCapabilityV1 {\n\treadonly roleId: string;\n\treadonly capabilityId: string;\n\treadonly requestedVersion: number;\n\t/** Undefined when the capability is entirely absent from the registry. */\n\treadonly availableVersion?: number;\n\treadonly reason: \"missing\" | \"version_mismatch\";\n}\n\n/** Activation check result for one role's REQUIRED capability dependencies. */\nexport interface RoleCapabilityCheckV1 {\n\treadonly roleId: string;\n\treadonly status: \"satisfied\" | \"missing\";\n\t/** Required dependencies that are absent or version-mismatched; empty when satisfied. */\n\treadonly missing: readonly RoleMissingCapabilityV1[];\n}\n\nexport interface RoleRunnerOptionsV1 {\n\treadonly catalog: RoleCatalogV1;\n\t/**\n\t * Owner stamped onto produced child definitions. Required to equal the\n\t * declaring plugin manifest id when used behind the capability-runtime\n\t * guards; plain library use may omit it.\n\t */\n\treadonly owner?: string;\n\t/**\n\t * Injected run implementation replacing the deterministic first-batch\n\t * defaults entirely. Roles without any binding still fail explicitly on\n\t * execution.\n\t */\n\treadonly run?: RoleRunResolverV1;\n}\n\nexport interface RoleRunnerV1 {\n\treadonly catalog: RoleCatalogV1;\n\t/** Sorted registered roleIds. */\n\tlistRoleIds(): readonly string[];\n\t/**\n\t * Maps a registered role to a child agent definition (composition role\n\t * `child-agent-controller`, id `role:<roleId>`, version 1). Run the\n\t * capability check before creating/leasing an instance.\n\t */\n\tcreateDefinition(roleId: string): AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1>;\n\t/**\n\t * Pre-activation capability-dependency check against an exact-version\n\t * registry: a required dependency is satisfied only when the registry\n\t * offers the same capability id at exactly the requested version. Optional\n\t * dependencies never block activation and are not reported as missing.\n\t */\n\tcheckCapabilities(roleId: string, availableCapabilities: readonly AvailableCapabilityV1[]): RoleCapabilityCheckV1;\n\t/** Direct deterministic execution (the same run a produced definition binds). */\n\trun(roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext): Promise<RoleRunnerResultV1>;\n}\n\nconst DEFINITION_VERSION = 1;\n\nconst FIRST_BATCH_RUNS = new Map<string, RoleRunCallbackV1>(\n\tFIRST_BATCH_ROLES.map((role) => [role.metadata.roleId, role.run]),\n);\n\n/** Default deterministic run dispatch: first-batch callbacks; explicit failure otherwise. */\nexport function runFirstBatchRole(\n\troleId: string,\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n): RoleRunnerResultV1 | Promise<RoleRunnerResultV1> {\n\tconst callback = FIRST_BATCH_RUNS.get(roleId);\n\tif (!callback) throw new Error(t(\"No run binding for role: {roleId}\", { roleId }));\n\treturn callback(input, context);\n}\n\n/** Binds the catalog's registered roles to child agent definitions. */\nexport function createRoleRunner(options: RoleRunnerOptionsV1): RoleRunnerV1 {\n\tconst catalog = options.catalog;\n\n\tfunction requireRole(roleId: string): RoleMetadataV1 {\n\t\tconst metadata = catalog.get(roleId);\n\t\tif (!metadata) throw new Error(t(\"Unknown role: {roleId}\", { roleId }));\n\t\treturn metadata;\n\t}\n\n\tasync function execute(\n\t\troleId: string,\n\t\tinput: RoleRunnerInputV1,\n\t\tcontext?: AgentExecutionContext,\n\t): Promise<RoleRunnerResultV1> {\n\t\trequireRole(roleId);\n\t\tif (options.run) return options.run(roleId, input, context);\n\t\treturn runFirstBatchRole(roleId, input, context);\n\t}\n\n\treturn {\n\t\tcatalog,\n\t\tlistRoleIds() {\n\t\t\treturn catalog.list().map((role) => role.roleId);\n\t\t},\n\t\tcreateDefinition(roleId) {\n\t\t\tconst metadata = requireRole(roleId);\n\t\t\treturn {\n\t\t\t\tid: `role:${metadata.roleId}`,\n\t\t\t\tversion: DEFINITION_VERSION,\n\t\t\t\trole: \"child-agent-controller\",\n\t\t\t\t...(options.owner === undefined ? {} : { owner: options.owner }),\n\t\t\t\trun: (input, context) => execute(metadata.roleId, input, context),\n\t\t\t};\n\t\t},\n\t\tcheckCapabilities(roleId, availableCapabilities) {\n\t\t\tconst metadata = requireRole(roleId);\n\t\t\tconst registry = new Map(availableCapabilities.map((capability) => [capability.id, capability.version]));\n\t\t\tconst missing: RoleMissingCapabilityV1[] = [];\n\t\t\tfor (const dependency of metadata.capabilityDependencies) {\n\t\t\t\tif (!dependency.required) continue;\n\t\t\t\tconst availableVersion = registry.get(dependency.capabilityId);\n\t\t\t\tif (availableVersion === undefined) {\n\t\t\t\t\tmissing.push({\n\t\t\t\t\t\troleId,\n\t\t\t\t\t\tcapabilityId: dependency.capabilityId,\n\t\t\t\t\t\trequestedVersion: dependency.capabilityVersion,\n\t\t\t\t\t\treason: \"missing\",\n\t\t\t\t\t});\n\t\t\t\t} else if (availableVersion !== dependency.capabilityVersion) {\n\t\t\t\t\tmissing.push({\n\t\t\t\t\t\troleId,\n\t\t\t\t\t\tcapabilityId: dependency.capabilityId,\n\t\t\t\t\t\trequestedVersion: dependency.capabilityVersion,\n\t\t\t\t\t\tavailableVersion,\n\t\t\t\t\t\treason: \"version_mismatch\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\troleId,\n\t\t\t\tstatus: missing.length > 0 ? \"missing\" : \"satisfied\",\n\t\t\t\tmissing,\n\t\t\t};\n\t\t},\n\t\trun(roleId, input, context) {\n\t\t\treturn execute(roleId, input, context);\n\t\t},\n\t};\n}\n"]}
@@ -1,79 +0,0 @@
1
- import { t } from "../core/i18n/index.js";
2
- import { FIRST_BATCH_ROLES } from "./first-roles.js";
3
- const DEFINITION_VERSION = 1;
4
- const FIRST_BATCH_RUNS = new Map(FIRST_BATCH_ROLES.map((role) => [role.metadata.roleId, role.run]));
5
- /** Default deterministic run dispatch: first-batch callbacks; explicit failure otherwise. */
6
- export function runFirstBatchRole(roleId, input, context) {
7
- const callback = FIRST_BATCH_RUNS.get(roleId);
8
- if (!callback)
9
- throw new Error(t("No run binding for role: {roleId}", { roleId }));
10
- return callback(input, context);
11
- }
12
- /** Binds the catalog's registered roles to child agent definitions. */
13
- export function createRoleRunner(options) {
14
- const catalog = options.catalog;
15
- function requireRole(roleId) {
16
- const metadata = catalog.get(roleId);
17
- if (!metadata)
18
- throw new Error(t("Unknown role: {roleId}", { roleId }));
19
- return metadata;
20
- }
21
- async function execute(roleId, input, context) {
22
- requireRole(roleId);
23
- if (options.run)
24
- return options.run(roleId, input, context);
25
- return runFirstBatchRole(roleId, input, context);
26
- }
27
- return {
28
- catalog,
29
- listRoleIds() {
30
- return catalog.list().map((role) => role.roleId);
31
- },
32
- createDefinition(roleId) {
33
- const metadata = requireRole(roleId);
34
- return {
35
- id: `role:${metadata.roleId}`,
36
- version: DEFINITION_VERSION,
37
- role: "child-agent-controller",
38
- ...(options.owner === undefined ? {} : { owner: options.owner }),
39
- run: (input, context) => execute(metadata.roleId, input, context),
40
- };
41
- },
42
- checkCapabilities(roleId, availableCapabilities) {
43
- const metadata = requireRole(roleId);
44
- const registry = new Map(availableCapabilities.map((capability) => [capability.id, capability.version]));
45
- const missing = [];
46
- for (const dependency of metadata.capabilityDependencies) {
47
- if (!dependency.required)
48
- continue;
49
- const availableVersion = registry.get(dependency.capabilityId);
50
- if (availableVersion === undefined) {
51
- missing.push({
52
- roleId,
53
- capabilityId: dependency.capabilityId,
54
- requestedVersion: dependency.capabilityVersion,
55
- reason: "missing",
56
- });
57
- }
58
- else if (availableVersion !== dependency.capabilityVersion) {
59
- missing.push({
60
- roleId,
61
- capabilityId: dependency.capabilityId,
62
- requestedVersion: dependency.capabilityVersion,
63
- availableVersion,
64
- reason: "version_mismatch",
65
- });
66
- }
67
- }
68
- return {
69
- roleId,
70
- status: missing.length > 0 ? "missing" : "satisfied",
71
- missing,
72
- };
73
- },
74
- run(roleId, input, context) {
75
- return execute(roleId, input, context);
76
- },
77
- };
78
- }
79
- //# sourceMappingURL=role-runner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"role-runner.js","sourceRoot":"","sources":["../../src/profile/role-runner.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAwFrD,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAC/B,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CACjE,CAAC;AAEF,6FAA6F;AAC7F,MAAM,UAAU,iBAAiB,CAChC,MAAc,EACd,KAAwB,EACxB,OAA+B,EACoB;IACnD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,mCAAmC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACnF,OAAO,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAAA,CAChC;AA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ACP,CAAC;QAAA,CACF;QACD,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE;YAC3B,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAAA,CACvC;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Role runner binding (2.2d) — maps registered `RoleMetadataV1` roles to child\n * `AgentDefinition`s executable through the experimental `AgentCompositionAPI`.\n *\n * The default run implementation is the deterministic first-batch role\n * callbacks (architecture-analyst / implementer / test-designer, 2.2c); a\n * caller may inject a real implementation via `run`. This slice never calls a\n * model.\n *\n * Library-level use works without any guard. When used through the\n * capability-runtime guards (`src/core/extensions/capability-runtime-guards.ts`),\n * the produced definitions must be defined/created by a manifest that declares\n * the `child-agent-controller` role and the `owner` must equal that manifest\n * id — the guards enforce this at the plugin boundary; this contract does not\n * duplicate guard logic.\n *\n * Required capability dependencies are checked explicitly (2.5a structured\n * `missing` shape) before activation (create/lease); they are never silently\n * skipped. Domain role runtimes live INSIDE the composition's child role: the\n * root/child two-value role enum is unchanged by design.\n */\nimport type { AgentDefinition, AgentExecutionContext } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { AvailableCapabilityV1 } from \"./dependency-wiring.ts\";\nimport { FIRST_BATCH_ROLES } from \"./first-roles.ts\";\nimport type { RoleCatalogV1, RoleMetadataV1 } from \"./role-catalog.ts\";\n\n/** Deterministic role input: a single spec string (first-batch contract). */\nexport interface RoleRunnerInputV1 {\n\treadonly spec: string;\n}\n\n/** Deterministic role output: a single result string (first-batch contract). */\nexport interface RoleRunnerResultV1 {\n\treadonly result: string;\n}\n\n/**\n * Per-role run implementation. `context` is present when executed through\n * `AgentCompositionAPI`; direct deterministic execution may omit it.\n */\nexport type RoleRunCallbackV1 = (\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;\n\n/** Runner-level run resolver; receives the roleId in addition to the callback arguments. */\nexport type RoleRunResolverV1 = (\n\troleId: string,\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;\n\n/**\n * Role capability-dependency diagnostic: the 2.5a structured `missing` shape\n * (`capabilityId`/`requestedVersion`/`availableVersion?`/`reason`) with\n * `roleId` as the requester.\n */\nexport interface RoleMissingCapabilityV1 {\n\treadonly roleId: string;\n\treadonly capabilityId: string;\n\treadonly requestedVersion: number;\n\t/** Undefined when the capability is entirely absent from the registry. */\n\treadonly availableVersion?: number;\n\treadonly reason: \"missing\" | \"version_mismatch\";\n}\n\n/** Activation check result for one role's REQUIRED capability dependencies. */\nexport interface RoleCapabilityCheckV1 {\n\treadonly roleId: string;\n\treadonly status: \"satisfied\" | \"missing\";\n\t/** Required dependencies that are absent or version-mismatched; empty when satisfied. */\n\treadonly missing: readonly RoleMissingCapabilityV1[];\n}\n\nexport interface RoleRunnerOptionsV1 {\n\treadonly catalog: RoleCatalogV1;\n\t/**\n\t * Owner stamped onto produced child definitions. Required to equal the\n\t * declaring plugin manifest id when used behind the capability-runtime\n\t * guards; plain library use may omit it.\n\t */\n\treadonly owner?: string;\n\t/**\n\t * Injected run implementation replacing the deterministic first-batch\n\t * defaults entirely. Roles without any binding still fail explicitly on\n\t * execution.\n\t */\n\treadonly run?: RoleRunResolverV1;\n}\n\nexport interface RoleRunnerV1 {\n\treadonly catalog: RoleCatalogV1;\n\t/** Sorted registered roleIds. */\n\tlistRoleIds(): readonly string[];\n\t/**\n\t * Maps a registered role to a child agent definition (composition role\n\t * `child-agent-controller`, id `role:<roleId>`, version 1). Run the\n\t * capability check before creating/leasing an instance.\n\t */\n\tcreateDefinition(roleId: string): AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1>;\n\t/**\n\t * Pre-activation capability-dependency check against an exact-version\n\t * registry: a required dependency is satisfied only when the registry\n\t * offers the same capability id at exactly the requested version. Optional\n\t * dependencies never block activation and are not reported as missing.\n\t */\n\tcheckCapabilities(roleId: string, availableCapabilities: readonly AvailableCapabilityV1[]): RoleCapabilityCheckV1;\n\t/** Direct deterministic execution (the same run a produced definition binds). */\n\trun(roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext): Promise<RoleRunnerResultV1>;\n}\n\nconst DEFINITION_VERSION = 1;\n\nconst FIRST_BATCH_RUNS = new Map<string, RoleRunCallbackV1>(\n\tFIRST_BATCH_ROLES.map((role) => [role.metadata.roleId, role.run]),\n);\n\n/** Default deterministic run dispatch: first-batch callbacks; explicit failure otherwise. */\nexport function runFirstBatchRole(\n\troleId: string,\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n): RoleRunnerResultV1 | Promise<RoleRunnerResultV1> {\n\tconst callback = FIRST_BATCH_RUNS.get(roleId);\n\tif (!callback) throw new Error(t(\"No run binding for role: {roleId}\", { roleId }));\n\treturn callback(input, context);\n}\n\n/** Binds the catalog's registered roles to child agent definitions. */\nexport function createRoleRunner(options: RoleRunnerOptionsV1): RoleRunnerV1 {\n\tconst catalog = options.catalog;\n\n\tfunction requireRole(roleId: string): RoleMetadataV1 {\n\t\tconst metadata = catalog.get(roleId);\n\t\tif (!metadata) throw new Error(t(\"Unknown role: {roleId}\", { roleId }));\n\t\treturn metadata;\n\t}\n\n\tasync function execute(\n\t\troleId: string,\n\t\tinput: RoleRunnerInputV1,\n\t\tcontext?: AgentExecutionContext,\n\t): Promise<RoleRunnerResultV1> {\n\t\trequireRole(roleId);\n\t\tif (options.run) return options.run(roleId, input, context);\n\t\treturn runFirstBatchRole(roleId, input, context);\n\t}\n\n\treturn {\n\t\tcatalog,\n\t\tlistRoleIds() {\n\t\t\treturn catalog.list().map((role) => role.roleId);\n\t\t},\n\t\tcreateDefinition(roleId) {\n\t\t\tconst metadata = requireRole(roleId);\n\t\t\treturn {\n\t\t\t\tid: `role:${metadata.roleId}`,\n\t\t\t\tversion: DEFINITION_VERSION,\n\t\t\t\trole: \"child-agent-controller\",\n\t\t\t\t...(options.owner === undefined ? {} : { owner: options.owner }),\n\t\t\t\trun: (input, context) => execute(metadata.roleId, input, context),\n\t\t\t};\n\t\t},\n\t\tcheckCapabilities(roleId, availableCapabilities) {\n\t\t\tconst metadata = requireRole(roleId);\n\t\t\tconst registry = new Map(availableCapabilities.map((capability) => [capability.id, capability.version]));\n\t\t\tconst missing: RoleMissingCapabilityV1[] = [];\n\t\t\tfor (const dependency of metadata.capabilityDependencies) {\n\t\t\t\tif (!dependency.required) continue;\n\t\t\t\tconst availableVersion = registry.get(dependency.capabilityId);\n\t\t\t\tif (availableVersion === undefined) {\n\t\t\t\t\tmissing.push({\n\t\t\t\t\t\troleId,\n\t\t\t\t\t\tcapabilityId: dependency.capabilityId,\n\t\t\t\t\t\trequestedVersion: dependency.capabilityVersion,\n\t\t\t\t\t\treason: \"missing\",\n\t\t\t\t\t});\n\t\t\t\t} else if (availableVersion !== dependency.capabilityVersion) {\n\t\t\t\t\tmissing.push({\n\t\t\t\t\t\troleId,\n\t\t\t\t\t\tcapabilityId: dependency.capabilityId,\n\t\t\t\t\t\trequestedVersion: dependency.capabilityVersion,\n\t\t\t\t\t\tavailableVersion,\n\t\t\t\t\t\treason: \"version_mismatch\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\troleId,\n\t\t\t\tstatus: missing.length > 0 ? \"missing\" : \"satisfied\",\n\t\t\t\tmissing,\n\t\t\t};\n\t\t},\n\t\trun(roleId, input, context) {\n\t\t\treturn execute(roleId, input, context);\n\t\t},\n\t};\n}\n"]}
@@ -1,36 +0,0 @@
1
- /**
2
- * Root-agent-controller facade adapter (2.1a).
3
- *
4
- * Proves the default root can be created and run through the public facade:
5
- * the adapter defines (or reuses) a `root-agent-controller` definition on the
6
- * composition and runs each turn on a fresh instance with the controller
7
- * lease acquired and released through the public API — no private main-loop
8
- * access. The TUI keeps its transitional path until 2.1c.
9
- */
10
- import type { AgentCompositionAPI } from "../core/extensions/public-api.ts";
11
- export interface RootAgentFacadeTurnResultV1<TResult> {
12
- readonly status: "succeeded" | "failed" | "cancelled" | "disposed";
13
- readonly output?: TResult;
14
- readonly revision: number;
15
- readonly error?: Error;
16
- readonly instanceId: string;
17
- readonly leaseId: string;
18
- }
19
- export interface RootAgentFacadeV1<TInput = unknown, TResult = unknown> {
20
- readonly definitionId: string;
21
- /** Runs one minimal turn: create instance → acquire controller lease → run → release. */
22
- runTurn(input: TInput, options?: {
23
- readonly signal?: AbortSignal;
24
- }): Promise<RootAgentFacadeTurnResultV1<TResult>>;
25
- }
26
- export declare function createRootAgentFacade<TInput, TResult = unknown>(options: {
27
- readonly composition: AgentCompositionAPI;
28
- readonly rootDefinitionId?: string;
29
- readonly rootVersion?: number;
30
- readonly owner?: string;
31
- /** The root turn implementation (deterministic in tests). */
32
- readonly run: (input: TInput, context: {
33
- readonly signal?: AbortSignal;
34
- }) => Promise<TResult> | TResult;
35
- }): RootAgentFacadeV1<TInput, TResult>;
36
- //# sourceMappingURL=root-facade.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root-facade.d.ts","sourceRoot":"","sources":["../../src/profile/root-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG5E,MAAM,WAAW,2BAA2B,CAAC,OAAO;IACnD,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACrE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,+FAAyF;IACzF,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;CACnH;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,OAAO,EAAE;IACzE,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CACxG,GAAG,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CA4CrC","sourcesContent":["/**\n * Root-agent-controller facade adapter (2.1a).\n *\n * Proves the default root can be created and run through the public facade:\n * the adapter defines (or reuses) a `root-agent-controller` definition on the\n * composition and runs each turn on a fresh instance with the controller\n * lease acquired and released through the public API — no private main-loop\n * access. The TUI keeps its transitional path until 2.1c.\n */\nimport type { AgentCompositionAPI } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\n\nexport interface RootAgentFacadeTurnResultV1<TResult> {\n\treadonly status: \"succeeded\" | \"failed\" | \"cancelled\" | \"disposed\";\n\treadonly output?: TResult;\n\treadonly revision: number;\n\treadonly error?: Error;\n\treadonly instanceId: string;\n\treadonly leaseId: string;\n}\n\nexport interface RootAgentFacadeV1<TInput = unknown, TResult = unknown> {\n\treadonly definitionId: string;\n\t/** Runs one minimal turn: create instance → acquire controller lease → run → release. */\n\trunTurn(input: TInput, options?: { readonly signal?: AbortSignal }): Promise<RootAgentFacadeTurnResultV1<TResult>>;\n}\n\nexport function createRootAgentFacade<TInput, TResult = unknown>(options: {\n\treadonly composition: AgentCompositionAPI;\n\treadonly rootDefinitionId?: string;\n\treadonly rootVersion?: number;\n\treadonly owner?: string;\n\t/** The root turn implementation (deterministic in tests). */\n\treadonly run: (input: TInput, context: { readonly signal?: AbortSignal }) => Promise<TResult> | TResult;\n}): RootAgentFacadeV1<TInput, TResult> {\n\tconst definitionId = options.rootDefinitionId ?? \"root-agent-controller\";\n\tconst owner = options.owner ?? \"root-facade\";\n\tconst definition = options.composition.define({\n\t\tid: definitionId,\n\t\tversion: options.rootVersion ?? 1,\n\t\trole: \"root-agent-controller\",\n\t\trun: (input: TInput, context: { readonly signal?: AbortSignal }) => options.run(input, context),\n\t});\n\tlet turnInFlight = false;\n\n\treturn {\n\t\tdefinitionId,\n\t\tasync runTurn(input, runOptions) {\n\t\t\t// Single-controller rule: one turn at a time per root facade.\n\t\t\tif (turnInFlight) {\n\t\t\t\tthrow new Error(t(\"Root facade is already running a turn\"));\n\t\t\t}\n\t\t\tturnInFlight = true;\n\t\t\ttry {\n\t\t\t\t// A composition instance is single-run; every turn gets a fresh one.\n\t\t\t\tconst instance = options.composition.create<TInput, TResult>(definition);\n\t\t\t\tconst lease = await instance.acquireControllerLease(owner);\n\t\t\t\tconst leaseId = lease.id;\n\t\t\t\ttry {\n\t\t\t\t\tconst operation = instance.run(input, { lease, signal: runOptions?.signal });\n\t\t\t\t\tawait operation.result;\n\t\t\t\t\tconst instanceResult = await instance.wait();\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: instanceResult.status,\n\t\t\t\t\t\t...(instanceResult.output !== undefined ? { output: instanceResult.output } : {}),\n\t\t\t\t\t\t...(instanceResult.error instanceof Error ? { error: instanceResult.error } : {}),\n\t\t\t\t\t\trevision: instanceResult.revision,\n\t\t\t\t\t\tinstanceId: instance.id,\n\t\t\t\t\t\tleaseId,\n\t\t\t\t\t};\n\t\t\t\t} finally {\n\t\t\t\t\tif (lease.isActive()) await lease.release();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tturnInFlight = false;\n\t\t\t}\n\t\t},\n\t};\n}\n"]}
@@ -1,49 +0,0 @@
1
- import { t } from "../core/i18n/index.js";
2
- export function createRootAgentFacade(options) {
3
- const definitionId = options.rootDefinitionId ?? "root-agent-controller";
4
- const owner = options.owner ?? "root-facade";
5
- const definition = options.composition.define({
6
- id: definitionId,
7
- version: options.rootVersion ?? 1,
8
- role: "root-agent-controller",
9
- run: (input, context) => options.run(input, context),
10
- });
11
- let turnInFlight = false;
12
- return {
13
- definitionId,
14
- async runTurn(input, runOptions) {
15
- // Single-controller rule: one turn at a time per root facade.
16
- if (turnInFlight) {
17
- throw new Error(t("Root facade is already running a turn"));
18
- }
19
- turnInFlight = true;
20
- try {
21
- // A composition instance is single-run; every turn gets a fresh one.
22
- const instance = options.composition.create(definition);
23
- const lease = await instance.acquireControllerLease(owner);
24
- const leaseId = lease.id;
25
- try {
26
- const operation = instance.run(input, { lease, signal: runOptions?.signal });
27
- await operation.result;
28
- const instanceResult = await instance.wait();
29
- return {
30
- status: instanceResult.status,
31
- ...(instanceResult.output !== undefined ? { output: instanceResult.output } : {}),
32
- ...(instanceResult.error instanceof Error ? { error: instanceResult.error } : {}),
33
- revision: instanceResult.revision,
34
- instanceId: instance.id,
35
- leaseId,
36
- };
37
- }
38
- finally {
39
- if (lease.isActive())
40
- await lease.release();
41
- }
42
- }
43
- finally {
44
- turnInFlight = false;
45
- }
46
- },
47
- };
48
- }
49
- //# sourceMappingURL=root-facade.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root-facade.js","sourceRoot":"","sources":["../../src/profile/root-facade.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MA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AI,EAAE,CAAC;oBAC7C,OAAO;wBACN,MAAM,EAAE,cAAc,CAAC,MAAM;wBAC7B,GAAG,CAAC,cAAc,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBACjF,GAAG,CAAC,cAAc,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBACjF,QAAQ,EAAE,cAAc,CAAC,QAAQ;wBACjC,UAAU,EAAE,QAAQ,CAAC,EAAE;wBACvB,OAAO;qBACP,CAAC;gBACH,CAAC;wBAAS,CAAC;oBACV,IAAI,KAAK,CAAC,QAAQ,EAAE;wBAAE,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;gBAC7C,CAAC;YACF,CAAC;oBAAS,CAAC;gBACV,YAAY,GAAG,KAAK,CAAC;YACtB,CAAC;QAAA,CACD;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Root-agent-controller facade adapter (2.1a).\n *\n * Proves the default root can be created and run through the public facade:\n * the adapter defines (or reuses) a `root-agent-controller` definition on the\n * composition and runs each turn on a fresh instance with the controller\n * lease acquired and released through the public API — no private main-loop\n * access. The TUI keeps its transitional path until 2.1c.\n */\nimport type { AgentCompositionAPI } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\n\nexport interface RootAgentFacadeTurnResultV1<TResult> {\n\treadonly status: \"succeeded\" | \"failed\" | \"cancelled\" | \"disposed\";\n\treadonly output?: TResult;\n\treadonly revision: number;\n\treadonly error?: Error;\n\treadonly instanceId: string;\n\treadonly leaseId: string;\n}\n\nexport interface RootAgentFacadeV1<TInput = unknown, TResult = unknown> {\n\treadonly definitionId: string;\n\t/** Runs one minimal turn: create instance → acquire controller lease → run → release. */\n\trunTurn(input: TInput, options?: { readonly signal?: AbortSignal }): Promise<RootAgentFacadeTurnResultV1<TResult>>;\n}\n\nexport function createRootAgentFacade<TInput, TResult = unknown>(options: {\n\treadonly composition: AgentCompositionAPI;\n\treadonly rootDefinitionId?: string;\n\treadonly rootVersion?: number;\n\treadonly owner?: string;\n\t/** The root turn implementation (deterministic in tests). */\n\treadonly run: (input: TInput, context: { readonly signal?: AbortSignal }) => Promise<TResult> | TResult;\n}): RootAgentFacadeV1<TInput, TResult> {\n\tconst definitionId = options.rootDefinitionId ?? \"root-agent-controller\";\n\tconst owner = options.owner ?? \"root-facade\";\n\tconst definition = options.composition.define({\n\t\tid: definitionId,\n\t\tversion: options.rootVersion ?? 1,\n\t\trole: \"root-agent-controller\",\n\t\trun: (input: TInput, context: { readonly signal?: AbortSignal }) => options.run(input, context),\n\t});\n\tlet turnInFlight = false;\n\n\treturn {\n\t\tdefinitionId,\n\t\tasync runTurn(input, runOptions) {\n\t\t\t// Single-controller rule: one turn at a time per root facade.\n\t\t\tif (turnInFlight) {\n\t\t\t\tthrow new Error(t(\"Root facade is already running a turn\"));\n\t\t\t}\n\t\t\tturnInFlight = true;\n\t\t\ttry {\n\t\t\t\t// A composition instance is single-run; every turn gets a fresh one.\n\t\t\t\tconst instance = options.composition.create<TInput, TResult>(definition);\n\t\t\t\tconst lease = await instance.acquireControllerLease(owner);\n\t\t\t\tconst leaseId = lease.id;\n\t\t\t\ttry {\n\t\t\t\t\tconst operation = instance.run(input, { lease, signal: runOptions?.signal });\n\t\t\t\t\tawait operation.result;\n\t\t\t\t\tconst instanceResult = await instance.wait();\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: instanceResult.status,\n\t\t\t\t\t\t...(instanceResult.output !== undefined ? { output: instanceResult.output } : {}),\n\t\t\t\t\t\t...(instanceResult.error instanceof Error ? { error: instanceResult.error } : {}),\n\t\t\t\t\t\trevision: instanceResult.revision,\n\t\t\t\t\t\tinstanceId: instance.id,\n\t\t\t\t\t\tleaseId,\n\t\t\t\t\t};\n\t\t\t\t} finally {\n\t\t\t\t\tif (lease.isActive()) await lease.release();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tturnInFlight = false;\n\t\t\t}\n\t\t},\n\t};\n}\n"]}
@@ -1,58 +0,0 @@
1
- /**
2
- * Skill/MCP discovery wiring (4.4) — turns discovered Skill and MCP tool
3
- * capabilities into profile-assembly inputs, with all four failure modes
4
- * explicit BEFORE a session exists: missing dependencies, version conflicts
5
- * between sources, disabled items, and replacements.
6
- *
7
- * Each registered item (a Skill or an MCP server) contributes capability
8
- * declarations; MCP tools derive capability ids `mcp:<serverId>:<toolName>`.
9
- * Two enabled items declaring the SAME capability id with DIFFERENT
10
- * versions is a structured version conflict; identical versions dedupe.
11
- * Disabled items contribute nothing (replacement = disable + register).
12
- * Resolution reuses the 2.5a exact-version wiring — no kernel special
13
- * cases. Implementation lives entirely in profile/assembly land.
14
- */
15
- import type { ProfileDependencyWiringV1 } from "./dependency-wiring.ts";
16
- export type DiscoverySourceKindV1 = "skill" | "mcp";
17
- export interface DiscoveredItemV1 {
18
- readonly sourceKind: DiscoverySourceKindV1;
19
- readonly itemId: string;
20
- readonly version: string;
21
- readonly capabilities: readonly {
22
- readonly id: string;
23
- readonly version: number;
24
- }[];
25
- readonly enabled: boolean;
26
- }
27
- export interface DiscoveryVersionConflictV1 {
28
- readonly capabilityId: string;
29
- readonly declarations: readonly {
30
- readonly sourceKind: DiscoverySourceKindV1;
31
- readonly itemId: string;
32
- readonly version: number;
33
- }[];
34
- }
35
- export interface DiscoveryWiringV1 {
36
- register(item: DiscoveredItemV1): void;
37
- deriveMcpItem(input: {
38
- readonly serverId: string;
39
- readonly version: string;
40
- readonly tools: readonly {
41
- readonly name: string;
42
- readonly description?: string;
43
- }[];
44
- readonly enabled?: boolean;
45
- }): DiscoveredItemV1;
46
- wireDiscoveredDependencies(input: {
47
- readonly availableCapabilities: readonly {
48
- readonly id: string;
49
- readonly version: number;
50
- }[];
51
- readonly disabledItemIds?: readonly string[];
52
- }): {
53
- readonly conflicts: readonly DiscoveryVersionConflictV1[];
54
- readonly wiring: ProfileDependencyWiringV1;
55
- };
56
- }
57
- export declare function createSkillDiscoveryWiring(): DiscoveryWiringV1;
58
- //# sourceMappingURL=skill-discovery-wiring.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill-discovery-wiring.d.ts","sourceRoot":"","sources":["../../src/profile/skill-discovery-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAIxE,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,SAAS;QAC/B,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;QAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KACzB,EAAE,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,aAAa,CAAC,KAAK,EAAE;QACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,SAAS;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACpF,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,gBAAgB,CAAC;IACrB,0BAA0B,CAAC,KAAK,EAAE;QACjC,QAAQ,CAAC,qBAAqB,EAAE,SAAS;YAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC7F,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KAC7C,GAAG;QAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,0BAA0B,EAAE,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAA;KAAE,CAAC;CAC9G;AAED,wBAAgB,0BAA0B,IAAI,iBAAiB,CAoE9D","sourcesContent":["/**\n * Skill/MCP discovery wiring (4.4) — turns discovered Skill and MCP tool\n * capabilities into profile-assembly inputs, with all four failure modes\n * explicit BEFORE a session exists: missing dependencies, version conflicts\n * between sources, disabled items, and replacements.\n *\n * Each registered item (a Skill or an MCP server) contributes capability\n * declarations; MCP tools derive capability ids `mcp:<serverId>:<toolName>`.\n * Two enabled items declaring the SAME capability id with DIFFERENT\n * versions is a structured version conflict; identical versions dedupe.\n * Disabled items contribute nothing (replacement = disable + register).\n * Resolution reuses the 2.5a exact-version wiring — no kernel special\n * cases. Implementation lives entirely in profile/assembly land.\n */\n\nimport { t } from \"../core/i18n/index.ts\";\nimport type { ProfileDependencyWiringV1 } from \"./dependency-wiring.ts\";\nimport { wireProfileDependencies } from \"./dependency-wiring.ts\";\nimport type { ResolvedPluginManifestV1 } from \"./identity.ts\";\n\nexport type DiscoverySourceKindV1 = \"skill\" | \"mcp\";\n\nexport interface DiscoveredItemV1 {\n\treadonly sourceKind: DiscoverySourceKindV1;\n\treadonly itemId: string;\n\treadonly version: string;\n\treadonly capabilities: readonly { readonly id: string; readonly version: number }[];\n\treadonly enabled: boolean;\n}\n\nexport interface DiscoveryVersionConflictV1 {\n\treadonly capabilityId: string;\n\treadonly declarations: readonly {\n\t\treadonly sourceKind: DiscoverySourceKindV1;\n\t\treadonly itemId: string;\n\t\treadonly version: number;\n\t}[];\n}\n\nexport interface DiscoveryWiringV1 {\n\tregister(item: DiscoveredItemV1): void;\n\tderiveMcpItem(input: {\n\t\treadonly serverId: string;\n\t\treadonly version: string;\n\t\treadonly tools: readonly { readonly name: string; readonly description?: string }[];\n\t\treadonly enabled?: boolean;\n\t}): DiscoveredItemV1;\n\twireDiscoveredDependencies(input: {\n\t\treadonly availableCapabilities: readonly { readonly id: string; readonly version: number }[];\n\t\treadonly disabledItemIds?: readonly string[];\n\t}): { readonly conflicts: readonly DiscoveryVersionConflictV1[]; readonly wiring: ProfileDependencyWiringV1 };\n}\n\nexport function createSkillDiscoveryWiring(): DiscoveryWiringV1 {\n\tconst items = new Map<string, DiscoveredItemV1>();\n\tconst keyOf = (item: DiscoveredItemV1): string => `${item.sourceKind}:${item.itemId}`;\n\n\treturn {\n\t\tregister(item) {\n\t\t\tif (item.itemId.trim().length === 0) throw new Error(t(\"Discovered item id must be a non-empty string\"));\n\t\t\tconst existing = items.get(keyOf(item));\n\t\t\tif (existing && existing.version !== item.version) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Item {key} re-registered with a different version ({from} -> {to})\", {\n\t\t\t\t\t\tkey: keyOf(item),\n\t\t\t\t\t\tfrom: existing.version,\n\t\t\t\t\t\tto: item.version,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\titems.set(keyOf(item), { ...item, capabilities: [...item.capabilities] });\n\t\t},\n\t\tderiveMcpItem({ serverId, version, tools, enabled = true }) {\n\t\t\treturn {\n\t\t\t\tsourceKind: \"mcp\",\n\t\t\t\titemId: serverId,\n\t\t\t\tversion,\n\t\t\t\tcapabilities: tools.map((tool) => ({ id: `mcp:${serverId}:${tool.name}`, version: 1 })),\n\t\t\t\tenabled,\n\t\t\t};\n\t\t},\n\t\twireDiscoveredDependencies({ availableCapabilities, disabledItemIds }) {\n\t\t\tconst disabled = new Set(disabledItemIds ?? []);\n\t\t\tconst enabledItems = [...items.values()].filter((item) => item.enabled && !disabled.has(keyOf(item)));\n\n\t\t\t// Version conflicts: same capability id, different declared versions,\n\t\t\t// across different enabled items.\n\t\t\tconst byCapability = new Map<\n\t\t\t\tstring,\n\t\t\t\tArray<{ sourceKind: DiscoverySourceKindV1; itemId: string; version: number }>\n\t\t\t>();\n\t\t\tfor (const item of enabledItems) {\n\t\t\t\tfor (const capability of item.capabilities) {\n\t\t\t\t\tconst list = byCapability.get(capability.id) ?? [];\n\t\t\t\t\tif (!list.some((entry) => entry.itemId === item.itemId)) {\n\t\t\t\t\t\tlist.push({ sourceKind: item.sourceKind, itemId: item.itemId, version: capability.version });\n\t\t\t\t\t}\n\t\t\t\t\tbyCapability.set(capability.id, list);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst conflicts: DiscoveryVersionConflictV1[] = [];\n\t\t\tfor (const [capabilityId, declarations] of byCapability) {\n\t\t\t\tconst versions = new Set(declarations.map((entry) => entry.version));\n\t\t\t\tif (versions.size > 1) conflicts.push({ capabilityId, declarations });\n\t\t\t}\n\n\t\t\t// Disabled items stay in the manifests so the wiring result shows an\n\t\t\t// explicit skipped_disabled entry (visible audit, not silent removal).\n\t\t\tconst manifests: ResolvedPluginManifestV1[] = [...items.values()].map((item) => ({\n\t\t\t\tpluginId: keyOf(item),\n\t\t\t\tpluginVersion: item.version,\n\t\t\t\tcapabilityRefs: [...item.capabilities],\n\t\t\t}));\n\t\t\tconst wiring = wireProfileDependencies({\n\t\t\t\tresolvedPlugins: manifests,\n\t\t\t\tavailableCapabilities,\n\t\t\t\tdisabledPluginIds: disabledItemIds,\n\t\t\t});\n\t\t\treturn { conflicts: Object.freeze(conflicts), wiring };\n\t\t},\n\t};\n}\n"]}
@@ -1,80 +0,0 @@
1
- /**
2
- * Skill/MCP discovery wiring (4.4) — turns discovered Skill and MCP tool
3
- * capabilities into profile-assembly inputs, with all four failure modes
4
- * explicit BEFORE a session exists: missing dependencies, version conflicts
5
- * between sources, disabled items, and replacements.
6
- *
7
- * Each registered item (a Skill or an MCP server) contributes capability
8
- * declarations; MCP tools derive capability ids `mcp:<serverId>:<toolName>`.
9
- * Two enabled items declaring the SAME capability id with DIFFERENT
10
- * versions is a structured version conflict; identical versions dedupe.
11
- * Disabled items contribute nothing (replacement = disable + register).
12
- * Resolution reuses the 2.5a exact-version wiring — no kernel special
13
- * cases. Implementation lives entirely in profile/assembly land.
14
- */
15
- import { t } from "../core/i18n/index.js";
16
- import { wireProfileDependencies } from "./dependency-wiring.js";
17
- export function createSkillDiscoveryWiring() {
18
- const items = new Map();
19
- const keyOf = (item) => `${item.sourceKind}:${item.itemId}`;
20
- return {
21
- register(item) {
22
- if (item.itemId.trim().length === 0)
23
- throw new Error(t("Discovered item id must be a non-empty string"));
24
- const existing = items.get(keyOf(item));
25
- if (existing && existing.version !== item.version) {
26
- throw new Error(t("Item {key} re-registered with a different version ({from} -> {to})", {
27
- key: keyOf(item),
28
- from: existing.version,
29
- to: item.version,
30
- }));
31
- }
32
- items.set(keyOf(item), { ...item, capabilities: [...item.capabilities] });
33
- },
34
- deriveMcpItem({ serverId, version, tools, enabled = true }) {
35
- return {
36
- sourceKind: "mcp",
37
- itemId: serverId,
38
- version,
39
- capabilities: tools.map((tool) => ({ id: `mcp:${serverId}:${tool.name}`, version: 1 })),
40
- enabled,
41
- };
42
- },
43
- wireDiscoveredDependencies({ availableCapabilities, disabledItemIds }) {
44
- const disabled = new Set(disabledItemIds ?? []);
45
- const enabledItems = [...items.values()].filter((item) => item.enabled && !disabled.has(keyOf(item)));
46
- // Version conflicts: same capability id, different declared versions,
47
- // across different enabled items.
48
- const byCapability = new Map();
49
- for (const item of enabledItems) {
50
- for (const capability of item.capabilities) {
51
- const list = byCapability.get(capability.id) ?? [];
52
- if (!list.some((entry) => entry.itemId === item.itemId)) {
53
- list.push({ sourceKind: item.sourceKind, itemId: item.itemId, version: capability.version });
54
- }
55
- byCapability.set(capability.id, list);
56
- }
57
- }
58
- const conflicts = [];
59
- for (const [capabilityId, declarations] of byCapability) {
60
- const versions = new Set(declarations.map((entry) => entry.version));
61
- if (versions.size > 1)
62
- conflicts.push({ capabilityId, declarations });
63
- }
64
- // Disabled items stay in the manifests so the wiring result shows an
65
- // explicit skipped_disabled entry (visible audit, not silent removal).
66
- const manifests = [...items.values()].map((item) => ({
67
- pluginId: keyOf(item),
68
- pluginVersion: item.version,
69
- capabilityRefs: [...item.capabilities],
70
- }));
71
- const wiring = wireProfileDependencies({
72
- resolvedPlugins: manifests,
73
- availableCapabilities,
74
- disabledPluginIds: disabledItemIds,
75
- });
76
- return { conflicts: Object.freeze(conflicts), wiring };
77
- },
78
- };
79
- }
80
- //# sourceMappingURL=skill-discovery-wiring.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill-discovery-wiring.js","sourceRoot":"","sources":["../../src/profile/skill-discovery-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAoCjE,MAAM,UAAU,0BAA0B,GAAsB;IAC/D,MAAM,KAAK,GAAG,IAAI,GAAG,EAA4B,CAAC;IAClD,MAAM,KAAK,GAAG,CAAC,IAAsB,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;IAEtF,OAAO;QACN,QAAQ,CAAC,IAAI,EAAE;YACd,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;gBAAE,MAAM,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AE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAChF,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC;gBACrB,aAAa,EAAE,IAAI,CAAC,OAAO;gBAC3B,cAAc,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;aACtC,CAAC,CAAC,CAAC;YACJ,MAAM,MAAM,GAAG,uBAAuB,CAAC;gBACtC,eAAe,EAAE,SAAS;gBAC1B,qBAAqB;gBACrB,iBAAiB,EAAE,eAAe;aAClC,CAAC,CAAC;YACH,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QAAA,CACvD;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Skill/MCP discovery wiring (4.4) — turns discovered Skill and MCP tool\n * capabilities into profile-assembly inputs, with all four failure modes\n * explicit BEFORE a session exists: missing dependencies, version conflicts\n * between sources, disabled items, and replacements.\n *\n * Each registered item (a Skill or an MCP server) contributes capability\n * declarations; MCP tools derive capability ids `mcp:<serverId>:<toolName>`.\n * Two enabled items declaring the SAME capability id with DIFFERENT\n * versions is a structured version conflict; identical versions dedupe.\n * Disabled items contribute nothing (replacement = disable + register).\n * Resolution reuses the 2.5a exact-version wiring — no kernel special\n * cases. Implementation lives entirely in profile/assembly land.\n */\n\nimport { t } from \"../core/i18n/index.ts\";\nimport type { ProfileDependencyWiringV1 } from \"./dependency-wiring.ts\";\nimport { wireProfileDependencies } from \"./dependency-wiring.ts\";\nimport type { ResolvedPluginManifestV1 } from \"./identity.ts\";\n\nexport type DiscoverySourceKindV1 = \"skill\" | \"mcp\";\n\nexport interface DiscoveredItemV1 {\n\treadonly sourceKind: DiscoverySourceKindV1;\n\treadonly itemId: string;\n\treadonly version: string;\n\treadonly capabilities: readonly { readonly id: string; readonly version: number }[];\n\treadonly enabled: boolean;\n}\n\nexport interface DiscoveryVersionConflictV1 {\n\treadonly capabilityId: string;\n\treadonly declarations: readonly {\n\t\treadonly sourceKind: DiscoverySourceKindV1;\n\t\treadonly itemId: string;\n\t\treadonly version: number;\n\t}[];\n}\n\nexport interface DiscoveryWiringV1 {\n\tregister(item: DiscoveredItemV1): void;\n\tderiveMcpItem(input: {\n\t\treadonly serverId: string;\n\t\treadonly version: string;\n\t\treadonly tools: readonly { readonly name: string; readonly description?: string }[];\n\t\treadonly enabled?: boolean;\n\t}): DiscoveredItemV1;\n\twireDiscoveredDependencies(input: {\n\t\treadonly availableCapabilities: readonly { readonly id: string; readonly version: number }[];\n\t\treadonly disabledItemIds?: readonly string[];\n\t}): { readonly conflicts: readonly DiscoveryVersionConflictV1[]; readonly wiring: ProfileDependencyWiringV1 };\n}\n\nexport function createSkillDiscoveryWiring(): DiscoveryWiringV1 {\n\tconst items = new Map<string, DiscoveredItemV1>();\n\tconst keyOf = (item: DiscoveredItemV1): string => `${item.sourceKind}:${item.itemId}`;\n\n\treturn {\n\t\tregister(item) {\n\t\t\tif (item.itemId.trim().length === 0) throw new Error(t(\"Discovered item id must be a non-empty string\"));\n\t\t\tconst existing = items.get(keyOf(item));\n\t\t\tif (existing && existing.version !== item.version) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Item {key} re-registered with a different version ({from} -> {to})\", {\n\t\t\t\t\t\tkey: keyOf(item),\n\t\t\t\t\t\tfrom: existing.version,\n\t\t\t\t\t\tto: item.version,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\titems.set(keyOf(item), { ...item, capabilities: [...item.capabilities] });\n\t\t},\n\t\tderiveMcpItem({ serverId, version, tools, enabled = true }) {\n\t\t\treturn {\n\t\t\t\tsourceKind: \"mcp\",\n\t\t\t\titemId: serverId,\n\t\t\t\tversion,\n\t\t\t\tcapabilities: tools.map((tool) => ({ id: `mcp:${serverId}:${tool.name}`, version: 1 })),\n\t\t\t\tenabled,\n\t\t\t};\n\t\t},\n\t\twireDiscoveredDependencies({ availableCapabilities, disabledItemIds }) {\n\t\t\tconst disabled = new Set(disabledItemIds ?? []);\n\t\t\tconst enabledItems = [...items.values()].filter((item) => item.enabled && !disabled.has(keyOf(item)));\n\n\t\t\t// Version conflicts: same capability id, different declared versions,\n\t\t\t// across different enabled items.\n\t\t\tconst byCapability = new Map<\n\t\t\t\tstring,\n\t\t\t\tArray<{ sourceKind: DiscoverySourceKindV1; itemId: string; version: number }>\n\t\t\t>();\n\t\t\tfor (const item of enabledItems) {\n\t\t\t\tfor (const capability of item.capabilities) {\n\t\t\t\t\tconst list = byCapability.get(capability.id) ?? [];\n\t\t\t\t\tif (!list.some((entry) => entry.itemId === item.itemId)) {\n\t\t\t\t\t\tlist.push({ sourceKind: item.sourceKind, itemId: item.itemId, version: capability.version });\n\t\t\t\t\t}\n\t\t\t\t\tbyCapability.set(capability.id, list);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst conflicts: DiscoveryVersionConflictV1[] = [];\n\t\t\tfor (const [capabilityId, declarations] of byCapability) {\n\t\t\t\tconst versions = new Set(declarations.map((entry) => entry.version));\n\t\t\t\tif (versions.size > 1) conflicts.push({ capabilityId, declarations });\n\t\t\t}\n\n\t\t\t// Disabled items stay in the manifests so the wiring result shows an\n\t\t\t// explicit skipped_disabled entry (visible audit, not silent removal).\n\t\t\tconst manifests: ResolvedPluginManifestV1[] = [...items.values()].map((item) => ({\n\t\t\t\tpluginId: keyOf(item),\n\t\t\t\tpluginVersion: item.version,\n\t\t\t\tcapabilityRefs: [...item.capabilities],\n\t\t\t}));\n\t\t\tconst wiring = wireProfileDependencies({\n\t\t\t\tresolvedPlugins: manifests,\n\t\t\t\tavailableCapabilities,\n\t\t\t\tdisabledPluginIds: disabledItemIds,\n\t\t\t});\n\t\t\treturn { conflicts: Object.freeze(conflicts), wiring };\n\t\t},\n\t};\n}\n"]}