@cjhyy/code-shell 0.1.0-alpha.1 → 0.1.0-alpha.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 (274) hide show
  1. package/README.md +8 -0
  2. package/dist/anthropic-P5VETAFI.cjs +10 -0
  3. package/dist/{anthropic-NENYS535.js → anthropic-W2GU3D76.js} +3 -2
  4. package/dist/arena/context/context-tools.d.ts +1 -1
  5. package/dist/arena/index.cjs +4 -4
  6. package/dist/arena/index.js +3 -3
  7. package/dist/arena/providers/index.d.ts +19 -3
  8. package/dist/arena/strategies/utils.d.ts +6 -1
  9. package/dist/arena/types.d.ts +10 -1
  10. package/dist/{arena-46QQ6BZQ.js → arena-ENHBHB2W.js} +5 -7
  11. package/dist/{arena-HZZZ2GJH.cjs → arena-HHDYYVHJ.cjs} +19 -21
  12. package/dist/{chunk-BE6IPRDM.js → chunk-2EUAE7AY.js} +1 -1
  13. package/dist/{chunk-WYKNZ54E.cjs → chunk-3CAZIWUA.cjs} +6 -6
  14. package/dist/{chunk-J5XW6UYL.js → chunk-5C5HIOML.js} +63 -4
  15. package/dist/chunk-75E4BBFC.js +224 -0
  16. package/dist/{chunk-ZJV3YSY3.cjs → chunk-BUJ5KYCI.cjs} +53 -11
  17. package/dist/{chunk-BMH65OVB.cjs → chunk-C7C7ZZY4.cjs} +8 -8
  18. package/dist/{chunk-KO2FPF7G.js → chunk-F5BS3GUC.js} +20 -2
  19. package/dist/chunk-FA5KD34T.js +54 -0
  20. package/dist/chunk-FV2ARONZ.cjs +224 -0
  21. package/dist/chunk-G76E5FOB.cjs +54 -0
  22. package/dist/{chunk-DICG4AB7.cjs → chunk-GZBD6QRS.cjs} +42 -3
  23. package/dist/{chunk-FVP7XJGS.cjs → chunk-HOXQLX5R.cjs} +406 -196
  24. package/dist/{chunk-4PKZPFCD.js → chunk-I57ZD5IQ.js} +47 -14
  25. package/dist/{chunk-JUHRV2XF.js → chunk-ID6EJUHP.js} +1703 -438
  26. package/dist/chunk-JHNCK7JP.cjs +202 -0
  27. package/dist/{chunk-MOILS4WE.cjs → chunk-JHXNOB5G.cjs} +3 -3
  28. package/dist/{chunk-UK2SU23S.cjs → chunk-KOGV6PDQ.cjs} +20 -2
  29. package/dist/{chunk-VKGNCYRL.js → chunk-LMEKCQX4.js} +95 -13
  30. package/dist/{chunk-3EAEC566.cjs → chunk-M2QI5X3X.cjs} +51 -18
  31. package/dist/{chunk-YZ25SSWJ.js → chunk-M2SVOKC6.js} +46 -4
  32. package/dist/chunk-OMRGA6TI.js +4753 -0
  33. package/dist/{chunk-NG73UR3L.cjs → chunk-OP57WUWQ.cjs} +23 -1
  34. package/dist/{chunk-ZXYDDJEJ.js → chunk-OUC2DFA7.js} +2 -2
  35. package/dist/{chunk-AP5F6VYE.js → chunk-REFCCVDM.js} +1 -1
  36. package/dist/{chunk-O6F2EF2Z.js → chunk-SCDKLTN3.js} +41 -2
  37. package/dist/{chunk-FECTK5KJ.js → chunk-SW3L7HIM.js} +1 -1
  38. package/dist/chunk-TATCTZSB.cjs +4753 -0
  39. package/dist/{chunk-Q6BYFYGD.cjs → chunk-VWFET3MG.cjs} +1886 -621
  40. package/dist/{chunk-3EUDE77E.cjs → chunk-X2DNIMPC.cjs} +19 -19
  41. package/dist/{chunk-SQZHPD3S.js → chunk-Y7TSCDF6.js} +297 -87
  42. package/dist/{chunk-WHRTARDJ.cjs → chunk-YAFCN7ZW.cjs} +112 -30
  43. package/dist/{chunk-LRAY5IYC.cjs → chunk-YD7XTI7T.cjs} +65 -6
  44. package/dist/{chunk-S74VVJBF.js → chunk-ZLPJJZUW.js} +23 -1
  45. package/dist/chunk-ZRVPCXI7.js +202 -0
  46. package/dist/cli/commands/builtin/advanced-commands.d.ts +1 -1
  47. package/dist/cli/commands/builtin/extra-commands.d.ts +2 -2
  48. package/dist/cli/commands/builtin/more-commands.d.ts +1 -3
  49. package/dist/cli/commands/registry.d.ts +8 -0
  50. package/dist/cli/cost-tracker.d.ts +6 -0
  51. package/dist/cli/main.cjs +3534 -1996
  52. package/dist/cli/main.js +3646 -2108
  53. package/dist/cli/onboarding.d.ts +67 -14
  54. package/dist/client-base-TOVE25FA.js +9 -0
  55. package/dist/client-base-VDDIADAC.cjs +9 -0
  56. package/dist/compaction-D3KV2NWY.cjs +31 -0
  57. package/dist/{compaction-CCHWA4G6.js → compaction-YNWCEF7B.js} +1 -2
  58. package/dist/context/manager.d.ts +9 -0
  59. package/dist/data/openrouter-models.d.ts +35 -0
  60. package/dist/data/openrouter-sync.d.ts +16 -0
  61. package/dist/{devtools-KIY3LWQJ.js → devtools-IRQQPIRY.js} +1 -1
  62. package/dist/{devtools-LRP47DDV.cjs → devtools-WTC3NFNE.cjs} +1 -1
  63. package/dist/engine/engine.d.ts +29 -6
  64. package/dist/engine/turn-loop.d.ts +7 -0
  65. package/dist/engine/turn-state.d.ts +6 -0
  66. package/dist/index.cjs +19 -28
  67. package/dist/index.js +28 -37
  68. package/dist/llm/client-base.d.ts +7 -0
  69. package/dist/llm/model-pool.d.ts +4 -0
  70. package/dist/logging/logger.d.ts +69 -8
  71. package/dist/manager-FWLOVEEK.cjs +7 -0
  72. package/dist/manager-GEXJLOIS.js +7 -0
  73. package/dist/{mcp-manager-OKXHHWYR.js → mcp-manager-37GQLFGX.js} +2 -2
  74. package/dist/mcp-manager-U77NEXBY.cjs +8 -0
  75. package/dist/memory-ADGOWADP.cjs +9 -0
  76. package/dist/memory-EPFDBPII.js +9 -0
  77. package/dist/native-ts/yoga-layout/index.d.ts +2 -2
  78. package/dist/{openai-5HQGBL4L.js → openai-RXU5URYI.js} +3 -2
  79. package/dist/openai-SQW4H2K4.cjs +10 -0
  80. package/dist/openrouter-models-OL725CL6.js +15 -0
  81. package/dist/openrouter-models-UM3AOGZ4.cjs +15 -0
  82. package/dist/openrouter-sync-CWD5VNW2.js +11 -0
  83. package/dist/openrouter-sync-HYZZC6RX.cjs +11 -0
  84. package/dist/product/index.cjs +12 -16
  85. package/dist/product/index.js +11 -15
  86. package/dist/protocol/types.d.ts +11 -3
  87. package/dist/{ink → render}/hooks/use-input.d.ts +1 -1
  88. package/dist/run/index.cjs +12 -16
  89. package/dist/run/index.js +11 -15
  90. package/dist/session/memory.d.ts +23 -3
  91. package/dist/session/session-manager.d.ts +4 -1
  92. package/dist/{session-manager-UQKB564H.cjs → session-manager-HRSKENKB.cjs} +2 -2
  93. package/dist/{session-manager-JIIBCFTC.js → session-manager-NEKFEHF3.js} +1 -1
  94. package/dist/settings/manager.d.ts +9 -0
  95. package/dist/settings/schema.d.ts +48 -39
  96. package/dist/{tool-summary-J2ICNMWP.js → tool-summary-2RUFL5QK.js} +1 -1
  97. package/dist/{tool-summary-5P2GKRA4.cjs → tool-summary-RYNR4DDB.cjs} +2 -2
  98. package/dist/tool-system/builtin/agent.d.ts +3 -26
  99. package/dist/tool-system/builtin/apply-patch/applier.d.ts +26 -0
  100. package/dist/tool-system/builtin/apply-patch/index.d.ts +19 -0
  101. package/dist/tool-system/builtin/apply-patch/parser.d.ts +17 -0
  102. package/dist/tool-system/builtin/apply-patch/seek-sequence.d.ts +18 -0
  103. package/dist/tool-system/builtin/apply-patch/types.d.ts +49 -0
  104. package/dist/tool-system/builtin/arena.d.ts +18 -5
  105. package/dist/tool-system/builtin/ask-user.d.ts +6 -6
  106. package/dist/tool-system/builtin/index.d.ts +11 -1
  107. package/dist/tool-system/builtin/tool-search.d.ts +2 -3
  108. package/dist/tool-system/context.d.ts +74 -0
  109. package/dist/tool-system/executor.d.ts +16 -0
  110. package/dist/tool-system/permission.d.ts +40 -5
  111. package/dist/tool-system/registry.d.ts +2 -0
  112. package/dist/types.d.ts +28 -1
  113. package/dist/ui/App.d.ts +1 -1
  114. package/dist/ui/components/AgentBlock.d.ts +1 -1
  115. package/dist/ui/components/AskUserPrompt.d.ts +7 -0
  116. package/dist/ui/components/MessageContent.d.ts +7 -3
  117. package/dist/ui/components/ModelManager.d.ts +35 -0
  118. package/dist/ui/components/ModelSelector.d.ts +10 -0
  119. package/dist/ui/components/OnboardingPrompt.d.ts +7 -0
  120. package/dist/ui/components/PermissionPrompt.d.ts +5 -2
  121. package/dist/ui/components/SessionPicker.d.ts +14 -0
  122. package/dist/ui/components/StatusLine.d.ts +4 -2
  123. package/dist/ui/components/ThemedBox.d.ts +1 -1
  124. package/dist/ui/components/ToolCall.d.ts +8 -1
  125. package/dist/ui/components/WelcomeTips.d.ts +5 -0
  126. package/dist/ui/onboarding-runner.d.ts +2 -0
  127. package/dist/ui/store.d.ts +1 -0
  128. package/dist/{updater-2N6745WR.cjs → updater-M7L42ASZ.cjs} +4 -4
  129. package/dist/{updater-PV7FKSUI.js → updater-ZRTONIR4.js} +4 -4
  130. package/dist/utils/debug.d.ts +17 -33
  131. package/package.json +4 -4
  132. package/dist/anthropic-XMTTVNSH.cjs +0 -9
  133. package/dist/bridge-4ZRXVWBN.js +0 -98
  134. package/dist/bridge-W476QDFH.cjs +0 -98
  135. package/dist/chunk-4RRUP4MM.js +0 -86
  136. package/dist/chunk-4SFPFHMG.js +0 -132
  137. package/dist/chunk-5LHVI777.cjs +0 -246
  138. package/dist/chunk-6ZIROYXX.js +0 -207
  139. package/dist/chunk-C7JBCO5V.js +0 -80
  140. package/dist/chunk-CSO5EOEP.cjs +0 -132
  141. package/dist/chunk-FGZGCFJX.cjs +0 -207
  142. package/dist/chunk-HD7MT5XU.cjs +0 -86
  143. package/dist/chunk-IMMTBZ33.cjs +0 -63
  144. package/dist/chunk-JT2WSQSR.cjs +0 -335
  145. package/dist/chunk-NZ4DQ72D.cjs +0 -664
  146. package/dist/chunk-OG4MIQJ6.js +0 -335
  147. package/dist/chunk-WRZJUQ5Z.js +0 -664
  148. package/dist/chunk-X4HAERTQ.js +0 -63
  149. package/dist/chunk-XHC2JMEC.cjs +0 -80
  150. package/dist/chunk-ZRSSGYA5.js +0 -246
  151. package/dist/compaction-44I55TLI.cjs +0 -32
  152. package/dist/coordinator-5HY7ALO2.js +0 -7
  153. package/dist/coordinator-INDLPVMF.cjs +0 -7
  154. package/dist/cost-tracker-IWYAUPXH.js +0 -9
  155. package/dist/cost-tracker-JXTJQQWE.cjs +0 -9
  156. package/dist/loader-DXFSUB4R.cjs +0 -91
  157. package/dist/loader-J5UID6CV.js +0 -91
  158. package/dist/manager-ETWDOCHN.cjs +0 -9
  159. package/dist/manager-HGMQNEJB.cjs +0 -11
  160. package/dist/manager-HUAQOORS.js +0 -9
  161. package/dist/manager-VJIZ2CQC.js +0 -11
  162. package/dist/mcp-manager-G4G2QASE.cjs +0 -8
  163. package/dist/memory-AP747G5H.js +0 -7
  164. package/dist/memory-BH3BYUN5.cjs +0 -7
  165. package/dist/onboarding-6WEPV7C2.js +0 -11
  166. package/dist/onboarding-QM5DY2TU.cjs +0 -11
  167. package/dist/openai-656VWUQW.cjs +0 -9
  168. package/dist/skills-63RBYQRX.js +0 -13
  169. package/dist/skills-V3BPLW3D.cjs +0 -13
  170. package/dist/token-counter-CHAXW5O7.cjs +0 -13
  171. package/dist/token-counter-DSOZGZ5Q.js +0 -13
  172. package/dist/utils/log.d.ts +0 -56
  173. package/dist/voice-KTZ7PAGO.js +0 -80
  174. package/dist/voice-KZE25GKB.cjs +0 -80
  175. /package/dist/{ink → render}/Ansi.d.ts +0 -0
  176. /package/dist/{ink → render}/bidi.d.ts +0 -0
  177. /package/dist/{ink → render}/clearTerminal.d.ts +0 -0
  178. /package/dist/{ink → render}/colorize.d.ts +0 -0
  179. /package/dist/{ink → render}/components/AlternateScreen.d.ts +0 -0
  180. /package/dist/{ink → render}/components/App.d.ts +0 -0
  181. /package/dist/{ink → render}/components/AppContext.d.ts +0 -0
  182. /package/dist/{ink → render}/components/Box.d.ts +0 -0
  183. /package/dist/{ink → render}/components/Button.d.ts +0 -0
  184. /package/dist/{ink → render}/components/ClockContext.d.ts +0 -0
  185. /package/dist/{ink → render}/components/CursorDeclarationContext.d.ts +0 -0
  186. /package/dist/{ink → render}/components/ErrorOverview.d.ts +0 -0
  187. /package/dist/{ink → render}/components/Link.d.ts +0 -0
  188. /package/dist/{ink → render}/components/Newline.d.ts +0 -0
  189. /package/dist/{ink → render}/components/NoSelect.d.ts +0 -0
  190. /package/dist/{ink → render}/components/RawAnsi.d.ts +0 -0
  191. /package/dist/{ink → render}/components/ScrollBox.d.ts +0 -0
  192. /package/dist/{ink → render}/components/Spacer.d.ts +0 -0
  193. /package/dist/{ink → render}/components/StdinContext.d.ts +0 -0
  194. /package/dist/{ink → render}/components/TerminalFocusContext.d.ts +0 -0
  195. /package/dist/{ink → render}/components/TerminalSizeContext.d.ts +0 -0
  196. /package/dist/{ink → render}/components/Text.d.ts +0 -0
  197. /package/dist/{ink → render}/constants.d.ts +0 -0
  198. /package/dist/{ink → render}/cursor.d.ts +0 -0
  199. /package/dist/{ink → render}/devtools.d.ts +0 -0
  200. /package/dist/{ink → render}/dom.d.ts +0 -0
  201. /package/dist/{ink → render}/events/click-event.d.ts +0 -0
  202. /package/dist/{ink → render}/events/dispatcher.d.ts +0 -0
  203. /package/dist/{ink → render}/events/emitter.d.ts +0 -0
  204. /package/dist/{ink → render}/events/event-handlers.d.ts +0 -0
  205. /package/dist/{ink → render}/events/event.d.ts +0 -0
  206. /package/dist/{ink → render}/events/focus-event.d.ts +0 -0
  207. /package/dist/{ink → render}/events/input-event.d.ts +0 -0
  208. /package/dist/{ink → render}/events/keyboard-event.d.ts +0 -0
  209. /package/dist/{ink → render}/events/paste-event.d.ts +0 -0
  210. /package/dist/{ink → render}/events/resize-event.d.ts +0 -0
  211. /package/dist/{ink → render}/events/terminal-event.d.ts +0 -0
  212. /package/dist/{ink → render}/events/terminal-focus-event.d.ts +0 -0
  213. /package/dist/{ink → render}/focus.d.ts +0 -0
  214. /package/dist/{ink → render}/frame.d.ts +0 -0
  215. /package/dist/{ink → render}/get-max-width.d.ts +0 -0
  216. /package/dist/{ink → render}/hit-test.d.ts +0 -0
  217. /package/dist/{ink → render}/hooks/use-animation-frame.d.ts +0 -0
  218. /package/dist/{ink → render}/hooks/use-app.d.ts +0 -0
  219. /package/dist/{ink → render}/hooks/use-declared-cursor.d.ts +0 -0
  220. /package/dist/{ink → render}/hooks/use-interval.d.ts +0 -0
  221. /package/dist/{ink → render}/hooks/use-search-highlight.d.ts +0 -0
  222. /package/dist/{ink → render}/hooks/use-selection.d.ts +0 -0
  223. /package/dist/{ink → render}/hooks/use-stdin.d.ts +0 -0
  224. /package/dist/{ink → render}/hooks/use-tab-status.d.ts +0 -0
  225. /package/dist/{ink → render}/hooks/use-terminal-focus.d.ts +0 -0
  226. /package/dist/{ink → render}/hooks/use-terminal-title.d.ts +0 -0
  227. /package/dist/{ink → render}/hooks/use-terminal-viewport.d.ts +0 -0
  228. /package/dist/{ink → render}/index.d.ts +0 -0
  229. /package/dist/{ink → render}/ink.d.ts +0 -0
  230. /package/dist/{ink → render}/instances.d.ts +0 -0
  231. /package/dist/{ink → render}/layout/engine.d.ts +0 -0
  232. /package/dist/{ink → render}/layout/geometry.d.ts +0 -0
  233. /package/dist/{ink → render}/layout/node.d.ts +0 -0
  234. /package/dist/{ink → render}/layout/yoga.d.ts +0 -0
  235. /package/dist/{ink → render}/line-width-cache.d.ts +0 -0
  236. /package/dist/{ink → render}/log-update.d.ts +0 -0
  237. /package/dist/{ink → render}/measure-element.d.ts +0 -0
  238. /package/dist/{ink → render}/measure-text.d.ts +0 -0
  239. /package/dist/{ink → render}/node-cache.d.ts +0 -0
  240. /package/dist/{ink → render}/optimizer.d.ts +0 -0
  241. /package/dist/{ink → render}/output.d.ts +0 -0
  242. /package/dist/{ink → render}/parse-keypress.d.ts +0 -0
  243. /package/dist/{ink → render}/reconciler.d.ts +0 -0
  244. /package/dist/{ink → render}/render-border.d.ts +0 -0
  245. /package/dist/{ink → render}/render-node-to-output.d.ts +0 -0
  246. /package/dist/{ink → render}/render-to-screen.d.ts +0 -0
  247. /package/dist/{ink → render}/renderer.d.ts +0 -0
  248. /package/dist/{ink → render}/root.d.ts +0 -0
  249. /package/dist/{ink → render}/screen.d.ts +0 -0
  250. /package/dist/{ink → render}/searchHighlight.d.ts +0 -0
  251. /package/dist/{ink → render}/selection.d.ts +0 -0
  252. /package/dist/{ink → render}/squash-text-nodes.d.ts +0 -0
  253. /package/dist/{ink → render}/stringWidth.d.ts +0 -0
  254. /package/dist/{ink → render}/styles.d.ts +0 -0
  255. /package/dist/{ink → render}/supports-hyperlinks.d.ts +0 -0
  256. /package/dist/{ink → render}/tabstops.d.ts +0 -0
  257. /package/dist/{ink → render}/terminal-focus-state.d.ts +0 -0
  258. /package/dist/{ink → render}/terminal-querier.d.ts +0 -0
  259. /package/dist/{ink → render}/terminal.d.ts +0 -0
  260. /package/dist/{ink → render}/termio/ansi.d.ts +0 -0
  261. /package/dist/{ink → render}/termio/csi.d.ts +0 -0
  262. /package/dist/{ink → render}/termio/dec.d.ts +0 -0
  263. /package/dist/{ink → render}/termio/esc.d.ts +0 -0
  264. /package/dist/{ink → render}/termio/osc.d.ts +0 -0
  265. /package/dist/{ink → render}/termio/parser.d.ts +0 -0
  266. /package/dist/{ink → render}/termio/sgr.d.ts +0 -0
  267. /package/dist/{ink → render}/termio/tokenize.d.ts +0 -0
  268. /package/dist/{ink → render}/termio/types.d.ts +0 -0
  269. /package/dist/{ink → render}/termio.d.ts +0 -0
  270. /package/dist/{ink → render}/useTerminalNotification.d.ts +0 -0
  271. /package/dist/{ink → render}/warn.d.ts +0 -0
  272. /package/dist/{ink → render}/widest-line.d.ts +0 -0
  273. /package/dist/{ink → render}/wrap-text.d.ts +0 -0
  274. /package/dist/{ink → render}/wrapAnsi.d.ts +0 -0
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkIMMTBZ33cjs = require('./chunk-IMMTBZ33.cjs');
3
+ var _chunkEL2RL5DGcjs = require('./chunk-EL2RL5DG.cjs');
4
4
 
5
5
 
6
- var _chunkEL2RL5DGcjs = require('./chunk-EL2RL5DG.cjs');
6
+ var _chunkJHNCK7JPcjs = require('./chunk-JHNCK7JP.cjs');
7
7
 
8
8
 
9
9
  var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
@@ -18,11 +18,11 @@ async function createLLMClient(config) {
18
18
  let Cls = PROVIDER_REGISTRY.get(config.provider);
19
19
  if (!Cls) {
20
20
  if (config.provider === "anthropic") {
21
- const { AnthropicClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./anthropic-XMTTVNSH.cjs")));
21
+ const { AnthropicClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./anthropic-P5VETAFI.cjs")));
22
22
  registerProvider("anthropic", AnthropicClient);
23
23
  Cls = AnthropicClient;
24
24
  } else if (config.provider === "openai") {
25
- const { OpenAIClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./openai-656VWUQW.cjs")));
25
+ const { OpenAIClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./openai-SQW4H2K4.cjs")));
26
26
  registerProvider("openai", OpenAIClient);
27
27
  Cls = OpenAIClient;
28
28
  }
@@ -151,13 +151,15 @@ function formatFindingReviews(reviews) {
151
151
  }
152
152
  function parseReport(participant, text) {
153
153
  if (!text || text.trim().length === 0) {
154
- _chunkIMMTBZ33cjs.logger.warn("arena.parse_report_empty", { participant });
154
+ _chunkJHNCK7JPcjs.logger.warn("arena.parse_report_empty", { participant });
155
155
  return {
156
156
  participant,
157
157
  contextSummary: "(no response)",
158
158
  findings: []
159
159
  };
160
160
  }
161
+ const xmlReport = tryParseReportXml(participant, text);
162
+ if (xmlReport && xmlReport.findings.length > 0) return xmlReport;
161
163
  try {
162
164
  const json = extractJSON(text);
163
165
  const parsed = JSON.parse(json);
@@ -172,22 +174,82 @@ function parseReport(participant, text) {
172
174
  contextSummary: _nullishCoalesce(_nullishCoalesce(parsed.contextSummary, () => ( parsed.context_summary)), () => ( "")),
173
175
  findings: Array.isArray(findings) ? findings.map(parseFinding) : []
174
176
  };
175
- if (report.findings.length === 0) {
176
- _chunkIMMTBZ33cjs.logger.warn("arena.parse_report_no_findings", {
177
- participant,
178
- textPreview: text.slice(0, 200)
179
- });
180
- }
181
- return report;
177
+ if (report.findings.length > 0) return report;
182
178
  } catch (err) {
183
- _chunkIMMTBZ33cjs.logger.warn("arena.parse_report_json_fail", {
179
+ _chunkJHNCK7JPcjs.logger.warn("arena.parse_report_json_fail", {
184
180
  participant,
185
181
  error: err.message,
186
182
  textLength: text.length,
187
- text: text.slice(0, 2e3)
183
+ text: text.slice(0, 500)
184
+ });
185
+ }
186
+ if (xmlReport) {
187
+ _chunkJHNCK7JPcjs.logger.warn("arena.parse_report_no_findings", {
188
+ participant,
189
+ textPreview: text.slice(0, 200)
190
+ });
191
+ return xmlReport;
192
+ }
193
+ return extractFindingsFromFreeText(participant, text);
194
+ }
195
+ function tryParseReportXml(participant, text) {
196
+ const reportMatch = text.match(/<report\b[^>]*>([\s\S]*?)<\/report>/i);
197
+ if (!reportMatch) return void 0;
198
+ const body = reportMatch[1];
199
+ const contextSummary = decodeXmlText(_nullishCoalesce(extractTag(body, "contextSummary"), () => ( "")));
200
+ const findingsBlock = _nullishCoalesce(extractTag(body, "findings"), () => ( ""));
201
+ const findings = [];
202
+ let i = 0;
203
+ for (const match of findingsBlock.matchAll(/<finding\b([^>]*)>([\s\S]*?)<\/finding>/gi)) {
204
+ const attrs = parseAttrs(match[1]);
205
+ const inner = match[2];
206
+ const title = decodeXmlText(_nullishCoalesce(extractTag(inner, "title"), () => ( "")));
207
+ const summary = decodeXmlText(_nullishCoalesce(extractTag(inner, "summary"), () => ( "")));
208
+ const evidence = [];
209
+ for (const ev of inner.matchAll(/<evidence\b([^>]*)>([\s\S]*?)<\/evidence>/gi)) {
210
+ const evAttrs = parseAttrs(ev[1]);
211
+ evidence.push({
212
+ type: _nullishCoalesce(evAttrs.type, () => ( "doc")),
213
+ ref: _nullishCoalesce(evAttrs.ref, () => ( "")),
214
+ note: decodeXmlText(ev[2].trim())
215
+ });
216
+ }
217
+ const affectedFilesBlock = _nullishCoalesce(extractTag(inner, "affectedFiles"), () => ( ""));
218
+ const affectedFiles = [];
219
+ for (const f of affectedFilesBlock.matchAll(/<file>([\s\S]*?)<\/file>/gi)) {
220
+ affectedFiles.push(decodeXmlText(f[1].trim()));
221
+ }
222
+ const suggestedChange = decodeXmlText(_nullishCoalesce(extractTag(inner, "suggestedChange"), () => ( ""))).trim();
223
+ const confidence = Number(attrs.confidence);
224
+ findings.push({
225
+ id: attrs.id || `f${i + 1}`,
226
+ kind: validateFindingKind(attrs.kind),
227
+ title: title || "Untitled",
228
+ summary,
229
+ severity: attrs.severity || void 0,
230
+ confidence: Number.isFinite(confidence) ? confidence : 0.5,
231
+ evidence,
232
+ affectedFiles,
233
+ suggestedChange: suggestedChange || void 0
188
234
  });
189
- return extractFindingsFromFreeText(participant, text);
235
+ i++;
236
+ }
237
+ return { participant, contextSummary, findings };
238
+ }
239
+ function extractTag(xml, tag) {
240
+ const re = new RegExp(`<${tag}\\b[^>]*>([\\s\\S]*?)<\\/${tag}>`, "i");
241
+ const m = xml.match(re);
242
+ return _optionalChain([m, 'optionalAccess', _ => _[1]]);
243
+ }
244
+ function parseAttrs(attrString) {
245
+ const out = {};
246
+ for (const m of attrString.matchAll(/(\w+)\s*=\s*"([^"]*)"/g)) {
247
+ out[m[1]] = m[2];
190
248
  }
249
+ return out;
250
+ }
251
+ function decodeXmlText(s) {
252
+ return s.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, "$1").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&").trim();
191
253
  }
192
254
  function parseFinding(raw, index) {
193
255
  return {
@@ -371,7 +433,7 @@ function formatDebateHistory(turns) {
371
433
  if (turns.length === 0) return "No prior debate turns.";
372
434
  return turns.map(
373
435
  (t) => `[${t.participant}] stance: ${t.stance}
374
- ${t.summary}` + (_optionalChain([t, 'access', _ => _.newEvidenceRefs, 'optionalAccess', _2 => _2.length]) ? `
436
+ ${t.summary}` + (_optionalChain([t, 'access', _2 => _2.newEvidenceRefs, 'optionalAccess', _3 => _3.length]) ? `
375
437
  New evidence: ${t.newEvidenceRefs.join(", ")}` : "")
376
438
  ).join("\n");
377
439
  }
@@ -405,7 +467,7 @@ function formatClaimSummaryForConsensus(summary) {
405
467
  sections.push(
406
468
  `### Rejected Claims (${summary.rejected.length})
407
469
  ` + summary.rejected.map(
408
- (c) => `- [${c.claimId}] ${sanitizeForPrompt(c.finding.title)} \u2014 rejected: ${sanitizeForPrompt(_nullishCoalesce(_optionalChain([c, 'access', _3 => _3.adjudication, 'optionalAccess', _4 => _4.rationale]), () => ( "no rationale")))}`
470
+ (c) => `- [${c.claimId}] ${sanitizeForPrompt(c.finding.title)} \u2014 rejected: ${sanitizeForPrompt(_nullishCoalesce(_optionalChain([c, 'access', _4 => _4.adjudication, 'optionalAccess', _5 => _5.rationale]), () => ( "no rationale")))}`
409
471
  ).join("\n")
410
472
  );
411
473
  }
@@ -564,13 +626,32 @@ var ReviewStrategy = class {
564
626
  You may have access to read-only tools to fetch additional context. The base context is intentionally lean \u2014 use tools to inspect details as needed.
565
627
 
566
628
  IMPORTANT RULES:
567
- - Limit yourself to 3-5 tool rounds. Do NOT exhaustively read every file.
629
+ - Limit yourself to AT MOST 3 tool rounds. Do NOT exhaustively read every file.
568
630
  - Focus on the HIGHEST-IMPACT findings. Quality over quantity.
569
- - Output as many findings as the topic warrants \u2014 typically 5-15 for a non-trivial subject. Each finding's "summary" should be 80+ words with concrete evidence and rationale, not a one-liner. Rank by confidence.
631
+ - Output as many findings as the topic warrants \u2014 typically 5-15 for a non-trivial subject. Each <summary> should be 80+ words with concrete evidence and rationale, not a one-liner. Rank by confidence.
570
632
  - Prioritize: risks > improvements > questions. Strengths are optional.
571
633
 
572
- When ready, respond ONLY with JSON (no markdown fences):
573
- {"contextSummary": "brief summary of what you investigated", "findings": [{"id": "unique-id", "kind": "risk|improvement|question|strength", "title": "short title", "summary": "detailed explanation", "severity": "high|medium|low", "confidence": 0.0-1.0, "evidence": [{"type": "file|diff|grep|git|doc", "ref": "path", "note": "what it shows"}], "affectedFiles": ["paths"], "suggestedChange": "optional"}]}`;
634
+ When ready, respond ONLY with the following XML structure (no markdown fences, no commentary outside the root element):
635
+
636
+ <report>
637
+ <contextSummary>brief summary of what you investigated</contextSummary>
638
+ <findings>
639
+ <finding id="unique-id" kind="risk|improvement|question|strength" severity="high|medium|low" confidence="0.0-1.0">
640
+ <title>short title</title>
641
+ <summary>detailed explanation, 80+ words, citing specific files/lines</summary>
642
+ <evidence type="file|diff|grep|git|doc" ref="path">what it shows</evidence>
643
+ <evidence type="file" ref="another/path">\u2026</evidence>
644
+ <affectedFiles>
645
+ <file>src/foo.ts</file>
646
+ <file>src/bar.ts</file>
647
+ </affectedFiles>
648
+ <suggestedChange>optional concrete fix</suggestedChange>
649
+ </finding>
650
+ <!-- repeat <finding> blocks as needed -->
651
+ </findings>
652
+ </report>
653
+
654
+ XML is preferred over JSON because thinking-mode models produce more reliable output here. Do not wrap the XML in code fences. Do not include text outside <report>\u2026</report>.`;
574
655
  }
575
656
  researchUserPrompt(topic, baseContext) {
576
657
  return `## Review Topic
@@ -578,7 +659,7 @@ ${topic}
578
659
 
579
660
  ${formatBaseContext(baseContext)}
580
661
 
581
- Use tools to read specific files from the diff. Then output 3-6 highest-confidence findings as JSON.`;
662
+ Use tools to read specific files from the diff. Then output 3-6 highest-confidence findings as a single <report> XML element.`;
582
663
  }
583
664
  parseResearchResponse(participant, text) {
584
665
  return parseReport(participant, text);
@@ -716,7 +797,14 @@ ${debateSummary}
716
797
  ## Evidence Digest
717
798
  ${formatDigestForPrompt(digest)}
718
799
 
719
- As moderator, adjudicate this claim based on all available evidence.
800
+ As moderator, you MUST issue a verdict \u2014 "unresolved" is reserved ONLY for the rare case where the debate produced genuinely irreconcilable interpretations of the same evidence. Default to deciding.
801
+
802
+ Decision rule:
803
+ - "accepted": claim is correct as stated AND has direct evidence (file/line refs).
804
+ - "accepted_with_revision": core insight is correct but the challenge surfaced a real refinement (scope/severity/wording). Issue a corrected finalSummary.
805
+ - "rejected": the challenger demonstrated the claim is factually wrong or already addressed in the code under review.
806
+ - "unresolved": ONLY when no amount of further evidence could break the tie \u2014 e.g., taste-level disagreement on design philosophy. Using this on a verifiable code claim is a failure of adjudication.
807
+
720
808
  Respond ONLY with JSON:
721
809
  {"outcome": "accepted|accepted_with_revision|rejected|unresolved", "rationale": "...", "finalSummary": "revised claim summary if needed", "supportingEvidenceRefs": ["..."]}`;
722
810
  }
@@ -1584,11 +1672,11 @@ Respond ONLY with JSON, no markdown fences:
1584
1672
  "followUpQuestion": "question if confidence is low, or null"
1585
1673
  }`;
1586
1674
  async function planArena(topic, llmConfig, flags, signal) {
1587
- if (_optionalChain([flags, 'optionalAccess', _5 => _5.mode]) && _optionalChain([flags, 'optionalAccess', _6 => _6.base])) {
1675
+ if (_optionalChain([flags, 'optionalAccess', _6 => _6.mode]) && _optionalChain([flags, 'optionalAccess', _7 => _7.base])) {
1588
1676
  return buildExplicitPlan(topic, flags);
1589
1677
  }
1590
1678
  try {
1591
- _optionalChain([signal, 'optionalAccess', _7 => _7.throwIfAborted, 'call', _8 => _8()]);
1679
+ _optionalChain([signal, 'optionalAccess', _8 => _8.throwIfAborted, 'call', _9 => _9()]);
1592
1680
  const client = await createLLMClient({
1593
1681
  ...llmConfig,
1594
1682
  enableStreaming: false,
@@ -1605,21 +1693,21 @@ Analyze the user request above and output the arena plan as JSON.` }],
1605
1693
  signal
1606
1694
  });
1607
1695
  const plan = parsePlanResponse(response.text, topic);
1608
- if (_optionalChain([flags, 'optionalAccess', _9 => _9.mode])) plan.mode = flags.mode;
1609
- if (_optionalChain([flags, 'optionalAccess', _10 => _10.base])) {
1696
+ if (_optionalChain([flags, 'optionalAccess', _10 => _10.mode])) plan.mode = flags.mode;
1697
+ if (_optionalChain([flags, 'optionalAccess', _11 => _11.base])) {
1610
1698
  plan.sources = [{ kind: "git", targets: [flags.base, _nullishCoalesce(flags.head, () => ( "HEAD"))] }];
1611
1699
  plan.subject = { kind: "changes", label: `${flags.base}...${_nullishCoalesce(flags.head, () => ( "HEAD"))}`, targets: [flags.base, _nullishCoalesce(flags.head, () => ( "HEAD"))] };
1612
1700
  }
1613
- _chunkIMMTBZ33cjs.logger.info("arena.planner", { plan });
1701
+ _chunkJHNCK7JPcjs.logger.info("arena.planner", { plan });
1614
1702
  return plan;
1615
1703
  } catch (err) {
1616
- _chunkIMMTBZ33cjs.logger.warn("arena.planner_fallback", { error: err.message });
1704
+ _chunkJHNCK7JPcjs.logger.warn("arena.planner_fallback", { error: err.message });
1617
1705
  return buildFallbackPlan(topic, flags);
1618
1706
  }
1619
1707
  }
1620
1708
  function parsePlanResponse(text, topic) {
1621
1709
  const fenced = text.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);
1622
- const jsonStr = fenced ? fenced[1].trim() : _nullishCoalesce(_optionalChain([text, 'access', _11 => _11.match, 'call', _12 => _12(/\{[\s\S]*\}/), 'optionalAccess', _13 => _13[0]]), () => ( text));
1710
+ const jsonStr = fenced ? fenced[1].trim() : _nullishCoalesce(_optionalChain([text, 'access', _12 => _12.match, 'call', _13 => _13(/\{[\s\S]*\}/), 'optionalAccess', _14 => _14[0]]), () => ( text));
1623
1711
  try {
1624
1712
  const parsed = JSON.parse(jsonStr);
1625
1713
  return {
@@ -1656,7 +1744,7 @@ function buildExplicitPlan(topic, flags) {
1656
1744
  };
1657
1745
  }
1658
1746
  function buildFallbackPlan(topic, flags) {
1659
- if (_optionalChain([flags, 'optionalAccess', _14 => _14.base])) {
1747
+ if (_optionalChain([flags, 'optionalAccess', _15 => _15.base])) {
1660
1748
  return {
1661
1749
  mode: _nullishCoalesce(flags.mode, () => ( "review")),
1662
1750
  lenses: [{ name: "engineering", weight: 1 }],
@@ -1741,7 +1829,7 @@ function buildFallbackPlan(topic, flags) {
1741
1829
  };
1742
1830
  }
1743
1831
  return {
1744
- mode: _nullishCoalesce(_optionalChain([flags, 'optionalAccess', _15 => _15.mode]), () => ( "review")),
1832
+ mode: _nullishCoalesce(_optionalChain([flags, 'optionalAccess', _16 => _16.mode]), () => ( "review")),
1745
1833
  lenses: [{ name: hasRepo ? "architecture" : "general", weight: 1 }],
1746
1834
  sources: hasRepo ? [{ kind: "repo" }, { kind: "docs" }] : [{ kind: "none" }],
1747
1835
  subject: { kind: "topic", label: topic },
@@ -1764,7 +1852,7 @@ function parseLenses(v) {
1764
1852
  if (!Array.isArray(v) || v.length === 0) {
1765
1853
  return [{ name: "general", weight: 1 }];
1766
1854
  }
1767
- const result = v.filter((item) => LENS_NAMES.includes(_optionalChain([item, 'optionalAccess', _16 => _16.name]))).map((item) => ({
1855
+ const result = v.filter((item) => LENS_NAMES.includes(_optionalChain([item, 'optionalAccess', _17 => _17.name]))).map((item) => ({
1768
1856
  name: item.name,
1769
1857
  weight: typeof item.weight === "number" ? item.weight : 1
1770
1858
  }));
@@ -1775,7 +1863,7 @@ function parseSources(v) {
1775
1863
  return [{ kind: "none" }];
1776
1864
  }
1777
1865
  const validKinds = ["git", "repo", "docs", "web", "none"];
1778
- const result = v.filter((item) => validKinds.includes(_optionalChain([item, 'optionalAccess', _17 => _17.kind]))).map((item) => ({
1866
+ const result = v.filter((item) => validKinds.includes(_optionalChain([item, 'optionalAccess', _18 => _18.kind]))).map((item) => ({
1779
1867
  kind: item.kind,
1780
1868
  targets: Array.isArray(item.targets) ? item.targets : void 0
1781
1869
  }));
@@ -1826,9 +1914,9 @@ var gitProvider = {
1826
1914
  kind: "git",
1827
1915
  collect(plan, _topic) {
1828
1916
  const artifacts = [];
1829
- const targets = _optionalChain([plan, 'access', _18 => _18.sources, 'access', _19 => _19.find, 'call', _20 => _20((s) => s.kind === "git"), 'optionalAccess', _21 => _21.targets]);
1830
- const baseRef = sanitizeRef(_optionalChain([targets, 'optionalAccess', _22 => _22[0]]));
1831
- const headRef = _nullishCoalesce(sanitizeRef(_optionalChain([targets, 'optionalAccess', _23 => _23[1]])), () => ( "HEAD"));
1917
+ const targets = _optionalChain([plan, 'access', _19 => _19.sources, 'access', _20 => _20.find, 'call', _21 => _21((s) => s.kind === "git"), 'optionalAccess', _22 => _22.targets]);
1918
+ const baseRef = sanitizeRef(_optionalChain([targets, 'optionalAccess', _23 => _23[0]]));
1919
+ const headRef = _nullishCoalesce(sanitizeRef(_optionalChain([targets, 'optionalAccess', _24 => _24[1]])), () => ( "HEAD"));
1832
1920
  const isCompare = !!baseRef;
1833
1921
  const currentBranch = git(["rev-parse", "--abbrev-ref", "HEAD"]);
1834
1922
  if (currentBranch) {
@@ -1852,15 +1940,15 @@ var gitProvider = {
1852
1940
  });
1853
1941
  }
1854
1942
  const statArgs = isCompare ? ["diff", "--stat", `${baseRef}...${headRef}`] : ["diff", "--stat", "HEAD"];
1855
- let stat = git(statArgs);
1856
- if (!stat && !isCompare) stat = git(["diff", "--stat", "--cached"]);
1857
- if (stat) {
1943
+ let stat2 = git(statArgs);
1944
+ if (!stat2 && !isCompare) stat2 = git(["diff", "--stat", "--cached"]);
1945
+ if (stat2) {
1858
1946
  artifacts.push({
1859
1947
  id: "git-diffstat",
1860
1948
  kind: "doc",
1861
1949
  source: "git",
1862
1950
  title: "Diff Stat",
1863
- preview: stat
1951
+ preview: stat2
1864
1952
  });
1865
1953
  }
1866
1954
  const filesArgs = isCompare ? ["diff", "--name-status", `${baseRef}...${headRef}`] : ["diff", "--name-status", "HEAD"];
@@ -1909,7 +1997,7 @@ var gitProvider = {
1909
1997
  metadata: { totalChars: diff.length, truncated }
1910
1998
  });
1911
1999
  }
1912
- if (!diff && !stat) {
2000
+ if (!diff && !stat2) {
1913
2001
  const status = git(["status", "--short"]);
1914
2002
  if (status) {
1915
2003
  artifacts.push({
@@ -1921,7 +2009,7 @@ var gitProvider = {
1921
2009
  });
1922
2010
  }
1923
2011
  }
1924
- _chunkIMMTBZ33cjs.logger.info("arena.provider.git", {
2012
+ _chunkJHNCK7JPcjs.logger.info("arena.provider.git", {
1925
2013
  artifactCount: artifacts.length,
1926
2014
  hasCompare: isCompare
1927
2015
  });
@@ -1958,15 +2046,20 @@ function clusterByDirectory(paths) {
1958
2046
  // src/arena/providers/repo.ts
1959
2047
  _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
1960
2048
  var _fs = require('fs');
2049
+ var _promises = require('fs/promises');
1961
2050
  var _path = require('path');
1962
2051
 
2052
+ var _util = require('util');
1963
2053
  var MAX_FILE_CHARS = 8e3;
2054
+ var GREP_TIMEOUT_MS = 3e3;
2055
+ var MAX_TREE_NODES = 400;
2056
+ var execFileAsync = _util.promisify.call(void 0, _child_process.execFile);
1964
2057
  var repoProvider = {
1965
2058
  kind: "repo",
1966
- collect(plan, topic) {
2059
+ async collect(plan, topic) {
1967
2060
  const artifacts = [];
1968
- const targets = _nullishCoalesce(_optionalChain([plan, 'access', _24 => _24.sources, 'access', _25 => _25.find, 'call', _26 => _26((s) => s.kind === "repo"), 'optionalAccess', _27 => _27.targets]), () => ( []));
1969
- const tree = buildTree(".", 2);
2061
+ const targets = _nullishCoalesce(_optionalChain([plan, 'access', _25 => _25.sources, 'access', _26 => _26.find, 'call', _27 => _27((s) => s.kind === "repo"), 'optionalAccess', _28 => _28.targets]), () => ( []));
2062
+ const tree = await buildTree(".", 2);
1970
2063
  if (tree) {
1971
2064
  artifacts.push({
1972
2065
  id: "repo-tree",
@@ -1980,7 +2073,7 @@ var repoProvider = {
1980
2073
  if (!_fs.existsSync.call(void 0, target)) continue;
1981
2074
  const st = _fs.statSync.call(void 0, target);
1982
2075
  if (st.isDirectory()) {
1983
- const dirTree = buildTree(target, 3);
2076
+ const dirTree = await buildTree(target, 3);
1984
2077
  if (dirTree) {
1985
2078
  artifacts.push({
1986
2079
  id: `repo-tree-${target}`,
@@ -1990,7 +2083,7 @@ var repoProvider = {
1990
2083
  preview: dirTree
1991
2084
  });
1992
2085
  }
1993
- for (const file of collectEntryFiles(target).slice(0, 3)) {
2086
+ for (const file of (await collectEntryFiles(target)).slice(0, 3)) {
1994
2087
  const content = safeReadFile(file);
1995
2088
  if (content) {
1996
2089
  artifacts.push({
@@ -2018,29 +2111,30 @@ var repoProvider = {
2018
2111
  }
2019
2112
  }
2020
2113
  if (targets.length === 0) {
2021
- const hints = extractSearchHints(topic);
2022
- for (const hint of hints.slice(0, 5)) {
2023
- const grepResult = safeGrep(hint);
2024
- if (grepResult) {
2025
- const files = grepResult.split("\n").filter(Boolean).slice(0, 10);
2026
- for (const file of files) {
2027
- if (!artifacts.some((a) => a.ref === file)) {
2028
- artifacts.push({
2029
- id: `repo-grep-${hint}-${file}`,
2030
- kind: "grep",
2031
- source: "repo",
2032
- title: `Match: ${hint} \u2192 ${file}`,
2033
- ref: file,
2034
- preview: file
2035
- });
2036
- }
2114
+ const hints = extractSearchHints(topic).slice(0, 5);
2115
+ const grepResults = await Promise.all(hints.map((h) => safeGrep(h)));
2116
+ for (let i = 0; i < hints.length; i++) {
2117
+ const hint = hints[i];
2118
+ const result = _nullishCoalesce(grepResults[i], () => ( ""));
2119
+ if (!result) continue;
2120
+ const files = result.split("\n").filter(Boolean).slice(0, 10);
2121
+ for (const file of files) {
2122
+ if (!artifacts.some((a) => a.ref === file)) {
2123
+ artifacts.push({
2124
+ id: `repo-grep-${hint}-${file}`,
2125
+ kind: "grep",
2126
+ source: "repo",
2127
+ title: `Match: ${hint} \u2192 ${file}`,
2128
+ ref: file,
2129
+ preview: file
2130
+ });
2037
2131
  }
2038
2132
  }
2039
2133
  }
2040
2134
  }
2041
2135
  const hasGitSource = plan.sources.some((s) => s.kind === "git");
2042
2136
  if (!hasGitSource) {
2043
- const recentLog = gitLog();
2137
+ const recentLog = await gitLog();
2044
2138
  if (recentLog) {
2045
2139
  artifacts.push({
2046
2140
  id: "repo-recent-activity",
@@ -2051,34 +2145,47 @@ var repoProvider = {
2051
2145
  });
2052
2146
  }
2053
2147
  }
2054
- _chunkIMMTBZ33cjs.logger.info("arena.provider.repo", { artifactCount: artifacts.length });
2148
+ _chunkJHNCK7JPcjs.logger.info("arena.provider.repo", { artifactCount: artifacts.length });
2055
2149
  return artifacts;
2056
2150
  }
2057
2151
  };
2058
- function buildTree(dir, maxDepth, depth = 0, prefix = "") {
2059
- if (depth >= maxDepth) return "";
2152
+ async function buildTree(dir, maxDepth) {
2153
+ const lines = [];
2154
+ const counter = { n: 0 };
2155
+ await walkTree(dir, maxDepth, 0, "", lines, counter);
2156
+ return lines.filter(Boolean).join("\n");
2157
+ }
2158
+ async function walkTree(dir, maxDepth, depth, prefix, out, counter) {
2159
+ if (depth >= maxDepth) return;
2160
+ if (counter.n >= MAX_TREE_NODES) return;
2161
+ let entries;
2060
2162
  try {
2061
- const entries = _fs.readdirSync.call(void 0, dir).filter(
2163
+ entries = (await _promises.readdir.call(void 0, dir)).filter(
2062
2164
  (e) => !e.startsWith(".") && e !== "node_modules" && e !== "dist" && e !== "__pycache__"
2063
2165
  );
2064
- const lines = [];
2065
- for (const entry of entries.slice(0, 30)) {
2066
- const fullPath = _path.join.call(void 0, dir, entry);
2067
- const isDir = _fs.statSync.call(void 0, fullPath).isDirectory();
2068
- lines.push(`${prefix}${isDir ? "/" : ""} ${entry}`);
2069
- if (isDir && depth < maxDepth - 1) {
2070
- lines.push(buildTree(fullPath, maxDepth, depth + 1, prefix + " "));
2071
- }
2072
- }
2073
- return lines.filter(Boolean).join("\n");
2074
2166
  } catch (e10) {
2075
- return "";
2167
+ return;
2168
+ }
2169
+ for (const entry of entries.slice(0, 30)) {
2170
+ if (counter.n >= MAX_TREE_NODES) return;
2171
+ counter.n++;
2172
+ const fullPath = _path.join.call(void 0, dir, entry);
2173
+ let isDir = false;
2174
+ try {
2175
+ isDir = (await _promises.stat.call(void 0, fullPath)).isDirectory();
2176
+ } catch (e11) {
2177
+ continue;
2178
+ }
2179
+ out.push(`${prefix}${isDir ? "/" : ""} ${entry}`);
2180
+ if (isDir && depth < maxDepth - 1) {
2181
+ await walkTree(fullPath, maxDepth, depth + 1, prefix + " ", out, counter);
2182
+ }
2076
2183
  }
2077
2184
  }
2078
- function collectEntryFiles(dir) {
2185
+ async function collectEntryFiles(dir) {
2079
2186
  const files = [];
2080
2187
  try {
2081
- const entries = _fs.readdirSync.call(void 0, dir);
2188
+ const entries = await _promises.readdir.call(void 0, dir);
2082
2189
  const priority = ["index.ts", "index.js", "main.ts", "main.js", "mod.ts", "__init__.py"];
2083
2190
  for (const p of priority) {
2084
2191
  if (entries.includes(p)) files.push(_path.join.call(void 0, dir, p));
@@ -2089,7 +2196,7 @@ function collectEntryFiles(dir) {
2089
2196
  files.push(full);
2090
2197
  }
2091
2198
  }
2092
- } catch (e11) {
2199
+ } catch (e12) {
2093
2200
  }
2094
2201
  return files;
2095
2202
  }
@@ -2099,7 +2206,7 @@ function safeReadFile(filePath) {
2099
2206
  const st = _fs.statSync.call(void 0, filePath);
2100
2207
  if (st.size > 5e5) return null;
2101
2208
  return _fs.readFileSync.call(void 0, filePath, "utf-8");
2102
- } catch (e12) {
2209
+ } catch (e13) {
2103
2210
  return null;
2104
2211
  }
2105
2212
  }
@@ -2110,9 +2217,9 @@ function truncate(content) {
2110
2217
  return t.slice(0, lastNl) + `
2111
2218
  ... (truncated, ${content.length} chars total)`;
2112
2219
  }
2113
- function safeGrep(pattern) {
2220
+ async function safeGrep(pattern) {
2114
2221
  try {
2115
- const result = _child_process.execFileSync.call(void 0, "grep", [
2222
+ const { stdout } = await execFileAsync("grep", [
2116
2223
  "-rl",
2117
2224
  "--include=*.ts",
2118
2225
  "--include=*.js",
@@ -2121,19 +2228,28 @@ function safeGrep(pattern) {
2121
2228
  "-i",
2122
2229
  pattern,
2123
2230
  "."
2124
- ], { encoding: "utf-8", maxBuffer: 1024 * 1024, timeout: 1e4 });
2125
- return result.trim();
2126
- } catch (e13) {
2231
+ ], { encoding: "utf-8", maxBuffer: 1024 * 1024, timeout: GREP_TIMEOUT_MS });
2232
+ return stdout.trim();
2233
+ } catch (err) {
2234
+ const e = err;
2235
+ if (_optionalChain([e, 'optionalAccess', _29 => _29.code]) === 1) return "";
2236
+ _chunkJHNCK7JPcjs.logger.warn("arena.provider.grep_failed", {
2237
+ pattern,
2238
+ code: _optionalChain([e, 'optionalAccess', _30 => _30.code]),
2239
+ killed: _optionalChain([e, 'optionalAccess', _31 => _31.killed]),
2240
+ signal: _optionalChain([e, 'optionalAccess', _32 => _32.signal])
2241
+ });
2127
2242
  return "";
2128
2243
  }
2129
2244
  }
2130
- function gitLog() {
2245
+ async function gitLog() {
2131
2246
  try {
2132
- return _child_process.execFileSync.call(void 0, "git", ["log", "--oneline", "-10"], {
2247
+ const { stdout } = await execFileAsync("git", ["log", "--oneline", "-10"], {
2133
2248
  encoding: "utf-8",
2134
2249
  maxBuffer: 1024 * 1024,
2135
2250
  timeout: 1e4
2136
- }).trim();
2251
+ });
2252
+ return stdout.trim();
2137
2253
  } catch (e14) {
2138
2254
  return "";
2139
2255
  }
@@ -2213,7 +2329,7 @@ var docsProvider = {
2213
2329
  collect(plan, topic) {
2214
2330
  const artifacts = [];
2215
2331
  const sourceSpec = plan.sources.find((s) => s.kind === "docs");
2216
- const targets = _nullishCoalesce(_optionalChain([sourceSpec, 'optionalAccess', _28 => _28.targets]), () => ( []));
2332
+ const targets = _nullishCoalesce(_optionalChain([sourceSpec, 'optionalAccess', _33 => _33.targets]), () => ( []));
2217
2333
  for (const target of targets) {
2218
2334
  const content = safeReadDoc(target);
2219
2335
  if (content) {
@@ -2256,7 +2372,7 @@ var docsProvider = {
2256
2372
  }
2257
2373
  }
2258
2374
  }
2259
- _chunkIMMTBZ33cjs.logger.info("arena.provider.docs", { artifactCount: artifacts.length });
2375
+ _chunkJHNCK7JPcjs.logger.info("arena.provider.docs", { artifactCount: artifacts.length });
2260
2376
  return artifacts;
2261
2377
  }
2262
2378
  };
@@ -2315,26 +2431,42 @@ var PROVIDER_MAP = {
2315
2431
  // web deferred to Phase 4 — falls back to none for now
2316
2432
  none: noneProvider
2317
2433
  };
2318
- function collectEvidence(plan, topic) {
2434
+ var PROVIDER_TIMEOUT_MS = 8e3;
2435
+ async function collectEvidence(plan, topic, options = {}) {
2319
2436
  const artifacts = [];
2320
2437
  const quickFacts = [];
2321
2438
  const seenSources = /* @__PURE__ */ new Set();
2439
+ const { onProgress, signal } = options;
2440
+ const tasks = [];
2322
2441
  for (const sourceSpec of plan.sources) {
2323
2442
  if (seenSources.has(sourceSpec.kind)) continue;
2324
2443
  seenSources.add(sourceSpec.kind);
2325
2444
  const provider = PROVIDER_MAP[sourceSpec.kind];
2326
2445
  if (!provider) continue;
2327
- const collected = provider.collect(plan, topic);
2328
- artifacts.push(...collected);
2329
- _chunkIMMTBZ33cjs.logger.info("arena.evidence_collected", {
2330
- source: sourceSpec.kind,
2331
- count: collected.length
2446
+ _optionalChain([onProgress, 'optionalCall', _34 => _34({ type: "evidence_started", source: sourceSpec.kind })]);
2447
+ tasks.push(runProviderWithTimeout(provider, plan, topic, signal));
2448
+ }
2449
+ const results = await Promise.all(tasks);
2450
+ for (const r of results) {
2451
+ artifacts.push(...r.artifacts);
2452
+ _chunkJHNCK7JPcjs.logger.info("arena.evidence_collected", {
2453
+ source: r.kind,
2454
+ count: r.artifacts.length,
2455
+ durationMs: r.durationMs,
2456
+ timedOut: r.timedOut || void 0
2332
2457
  });
2458
+ _optionalChain([onProgress, 'optionalCall', _35 => _35({
2459
+ type: "evidence_collected",
2460
+ source: r.kind,
2461
+ count: r.artifacts.length,
2462
+ durationMs: r.durationMs,
2463
+ timedOut: r.timedOut
2464
+ })]);
2333
2465
  }
2334
2466
  const branchArtifact = artifacts.find((a) => a.id === "git-branch");
2335
2467
  if (branchArtifact) quickFacts.push({ label: "Branch", value: branchArtifact.preview });
2336
2468
  const changedFilesArtifact = artifacts.find((a) => a.id === "git-changed-files");
2337
- if (_optionalChain([changedFilesArtifact, 'optionalAccess', _29 => _29.metadata, 'optionalAccess', _30 => _30.totalCount])) {
2469
+ if (_optionalChain([changedFilesArtifact, 'optionalAccess', _36 => _36.metadata, 'optionalAccess', _37 => _37.totalCount])) {
2338
2470
  quickFacts.push({ label: "Changed Files", value: String(changedFilesArtifact.metadata.totalCount) });
2339
2471
  }
2340
2472
  const docCount = artifacts.filter((a) => a.source === "docs").length;
@@ -2343,6 +2475,50 @@ function collectEvidence(plan, topic) {
2343
2475
  quickFacts.push({ label: "Lenses", value: plan.lenses.map((l) => l.name).join(", ") });
2344
2476
  return { artifacts, quickFacts };
2345
2477
  }
2478
+ async function runProviderWithTimeout(provider, plan, topic, signal) {
2479
+ const started = Date.now();
2480
+ let timedOut = false;
2481
+ let timer;
2482
+ let abortHandler;
2483
+ const cleanup = () => {
2484
+ if (timer) {
2485
+ clearTimeout(timer);
2486
+ timer = void 0;
2487
+ }
2488
+ if (abortHandler) {
2489
+ _optionalChain([signal, 'optionalAccess', _38 => _38.removeEventListener, 'call', _39 => _39("abort", abortHandler)]);
2490
+ abortHandler = void 0;
2491
+ }
2492
+ };
2493
+ const work = Promise.resolve().then(() => provider.collect(plan, topic));
2494
+ const timeout = new Promise((resolve2) => {
2495
+ timer = setTimeout(() => {
2496
+ timedOut = true;
2497
+ _chunkJHNCK7JPcjs.logger.warn("arena.provider.timeout", { source: provider.kind, ms: PROVIDER_TIMEOUT_MS });
2498
+ resolve2([]);
2499
+ }, PROVIDER_TIMEOUT_MS);
2500
+ if (typeof timer.unref === "function") timer.unref();
2501
+ if (signal) {
2502
+ abortHandler = () => resolve2([]);
2503
+ signal.addEventListener("abort", abortHandler, { once: true });
2504
+ }
2505
+ });
2506
+ let artifacts;
2507
+ try {
2508
+ artifacts = await Promise.race([work, timeout]);
2509
+ } catch (err) {
2510
+ _chunkJHNCK7JPcjs.logger.warn("arena.provider.error", { source: provider.kind, error: err.message });
2511
+ artifacts = [];
2512
+ } finally {
2513
+ cleanup();
2514
+ }
2515
+ return {
2516
+ kind: provider.kind,
2517
+ artifacts,
2518
+ durationMs: Date.now() - started,
2519
+ timedOut
2520
+ };
2521
+ }
2346
2522
 
2347
2523
  // src/arena/tools/selector.ts
2348
2524
  _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
@@ -2353,7 +2529,7 @@ _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
2353
2529
 
2354
2530
 
2355
2531
  var MAX_TOOL_RESULT = 15e3;
2356
- var MAX_TOOL_ROUNDS = 5;
2532
+ var MAX_TOOL_ROUNDS = 3;
2357
2533
  var REPO_ROOT = _path.resolve.call(void 0, ".");
2358
2534
  var CONTEXT_TOOLS = [
2359
2535
  {
@@ -2594,7 +2770,7 @@ async function runParticipantResearchWithDossiers(options) {
2594
2770
  const { participants, strategy, topic, baseContext, enableContextTools, contextTools, signal, onProgress } = options;
2595
2771
  const tools = enableContextTools ? _nullishCoalesce(contextTools, () => ( CONTEXT_TOOLS)) : void 0;
2596
2772
  const tasks = participants.map(async (p) => {
2597
- _optionalChain([onProgress, 'optionalCall', _31 => _31({ type: "research_start", participant: p.name })]);
2773
+ _optionalChain([onProgress, 'optionalCall', _40 => _40({ type: "research_start", participant: p.name })]);
2598
2774
  const client = await createLLMClient({
2599
2775
  ...p.llm,
2600
2776
  enableStreaming: false
@@ -2613,7 +2789,7 @@ async function runParticipantResearchWithDossiers(options) {
2613
2789
  for (let round = 0; round <= MAX_TOOL_ROUNDS; round++) {
2614
2790
  totalRounds = round;
2615
2791
  if (messages.length >= MAX_MESSAGES) {
2616
- _chunkIMMTBZ33cjs.logger.warn("arena.research_message_limit", {
2792
+ _chunkJHNCK7JPcjs.logger.warn("arena.research_message_limit", {
2617
2793
  participant: p.name,
2618
2794
  messageCount: messages.length,
2619
2795
  round
@@ -2628,19 +2804,19 @@ async function runParticipantResearchWithDossiers(options) {
2628
2804
  });
2629
2805
  const toolNames = (_nullishCoalesce(response.toolCalls, () => ( []))).map((tc) => tc.toolName);
2630
2806
  const hasTools2 = response.toolCalls && response.toolCalls.length > 0;
2631
- _chunkIMMTBZ33cjs.logger.info("arena.research_round", {
2807
+ _chunkJHNCK7JPcjs.logger.info("arena.research_round", {
2632
2808
  participant: p.name,
2633
2809
  round,
2634
- toolCount: _nullishCoalesce(_optionalChain([response, 'access', _32 => _32.toolCalls, 'optionalAccess', _33 => _33.length]), () => ( 0)),
2810
+ toolCount: _nullishCoalesce(_optionalChain([response, 'access', _41 => _41.toolCalls, 'optionalAccess', _42 => _42.length]), () => ( 0)),
2635
2811
  toolNames,
2636
- textLen: _nullishCoalesce(_optionalChain([response, 'access', _34 => _34.text, 'optionalAccess', _35 => _35.length]), () => ( 0)),
2812
+ textLen: _nullishCoalesce(_optionalChain([response, 'access', _43 => _43.text, 'optionalAccess', _44 => _44.length]), () => ( 0)),
2637
2813
  stopReason: _nullishCoalesce(response.stopReason, () => ( "unknown"))
2638
2814
  });
2639
2815
  if (!hasTools2) {
2640
2816
  finalText = response.text;
2641
2817
  break;
2642
2818
  }
2643
- _optionalChain([onProgress, 'optionalCall', _36 => _36({
2819
+ _optionalChain([onProgress, 'optionalCall', _45 => _45({
2644
2820
  type: "context_lookup",
2645
2821
  participant: p.name,
2646
2822
  tools: response.toolCalls.map((tc) => `${tc.toolName}(${JSON.stringify(tc.args)})`)
@@ -2679,10 +2855,20 @@ async function runParticipantResearchWithDossiers(options) {
2679
2855
  content: result
2680
2856
  });
2681
2857
  }
2858
+ const remaining = MAX_TOOL_ROUNDS - round;
2859
+ const isLastAllowedRound = remaining <= 0;
2860
+ const isPenultimate = remaining === 1;
2861
+ if (isLastAllowedRound || isPenultimate) {
2862
+ const directive = isLastAllowedRound ? "STOP. You have used your tool budget. Your NEXT response MUST be the findings JSON. Do NOT call any more tools \u2014 any further tool_use will be discarded." : "FINAL ROUND. Use the tool results below plus any prior context to output the findings JSON in your NEXT response. Do not call more tools.";
2863
+ resultBlocks.unshift({
2864
+ type: "text",
2865
+ text: `[arena-research:${p.name}] ${directive}`
2866
+ });
2867
+ }
2682
2868
  messages.push({ role: "user", content: resultBlocks });
2683
2869
  }
2684
2870
  if (!finalText) {
2685
- _chunkIMMTBZ33cjs.logger.warn("arena.research_force_conclude", {
2871
+ _chunkJHNCK7JPcjs.logger.warn("arena.research_force_conclude", {
2686
2872
  participant: p.name,
2687
2873
  totalRounds,
2688
2874
  messageCount: messages.length
@@ -2693,24 +2879,24 @@ async function runParticipantResearchWithDossiers(options) {
2693
2879
  ...messages,
2694
2880
  {
2695
2881
  role: "user",
2696
- content: "You have gathered enough context. Based on ALL the tool results above, output your findings NOW.\n\nRespond ONLY with JSON \u2014 output your highest-confidence findings (typically 5-15 for a substantive topic; each finding's `summary` should be 80+ words with concrete evidence). Do NOT request any more tools. Just output the JSON."
2882
+ content: "You have gathered enough context. Based on ALL the tool results above, output your findings NOW.\n\nRespond ONLY with the <report> XML element specified in the system prompt \u2014 output your highest-confidence findings (typically 5-15 for a substantive topic; each <summary> should be 80+ words with concrete evidence). Do NOT request any more tools. No prose outside the XML."
2697
2883
  }
2698
2884
  ]
2699
2885
  });
2700
- _chunkIMMTBZ33cjs.logger.info("arena.research_force_conclude_response", {
2886
+ _chunkJHNCK7JPcjs.logger.info("arena.research_force_conclude_response", {
2701
2887
  participant: p.name,
2702
- textLen: _nullishCoalesce(_optionalChain([forceResponse, 'access', _37 => _37.text, 'optionalAccess', _38 => _38.length]), () => ( 0)),
2888
+ textLen: _nullishCoalesce(_optionalChain([forceResponse, 'access', _46 => _46.text, 'optionalAccess', _47 => _47.length]), () => ( 0)),
2703
2889
  stopReason: _nullishCoalesce(forceResponse.stopReason, () => ( "unknown"))
2704
2890
  });
2705
2891
  finalText = forceResponse.text;
2706
2892
  }
2707
- _chunkIMMTBZ33cjs.logger.info("arena.research_raw_response", {
2893
+ _chunkJHNCK7JPcjs.logger.info("arena.research_raw_response", {
2708
2894
  participant: p.name,
2709
2895
  textLength: finalText.length,
2710
2896
  text: finalText
2711
2897
  });
2712
2898
  if (!finalText || finalText.trim().length === 0) {
2713
- _chunkIMMTBZ33cjs.logger.warn("arena.research_failed", {
2899
+ _chunkJHNCK7JPcjs.logger.warn("arena.research_failed", {
2714
2900
  participant: p.name,
2715
2901
  totalRounds,
2716
2902
  messageCount: messages.length
@@ -2728,7 +2914,7 @@ async function runParticipantResearchWithDossiers(options) {
2728
2914
  evidencePackets,
2729
2915
  findingEvidenceLinks: []
2730
2916
  };
2731
- _optionalChain([onProgress, 'optionalCall', _39 => _39({ type: "research_done", participant: p.name, report: failedReport })]);
2917
+ _optionalChain([onProgress, 'optionalCall', _48 => _48({ type: "research_done", participant: p.name, report: failedReport })]);
2732
2918
  return { report: failedReport, dossier: failedDossier };
2733
2919
  }
2734
2920
  const report = strategy.parseResearchResponse(p.name, finalText);
@@ -2741,7 +2927,7 @@ async function runParticipantResearchWithDossiers(options) {
2741
2927
  evidencePackets,
2742
2928
  findingEvidenceLinks
2743
2929
  };
2744
- _optionalChain([onProgress, 'optionalCall', _40 => _40({ type: "research_done", participant: p.name, report })]);
2930
+ _optionalChain([onProgress, 'optionalCall', _49 => _49({ type: "research_done", participant: p.name, report })]);
2745
2931
  return { report, dossier };
2746
2932
  });
2747
2933
  return Promise.all(tasks);
@@ -2852,7 +3038,7 @@ function registerClaims(options) {
2852
3038
  ledger.appendClaim(claim);
2853
3039
  }
2854
3040
  }
2855
- _optionalChain([onProgress, 'optionalCall', _41 => _41({ type: "claims_registered", claimCount: claims.length })]);
3041
+ _optionalChain([onProgress, 'optionalCall', _50 => _50({ type: "claims_registered", claimCount: claims.length })]);
2856
3042
  return claims;
2857
3043
  }
2858
3044
  function selectClaimsForReview(claims, maxClaims) {
@@ -3005,7 +3191,7 @@ function validTransitions(claim) {
3005
3191
  _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
3006
3192
  async function runCrossReview(options) {
3007
3193
  const { participants, strategy, topic, reports, signal, onProgress } = options;
3008
- _optionalChain([onProgress, 'optionalCall', _42 => _42({ type: "cross_review_start", round: 1 })]);
3194
+ _optionalChain([onProgress, 'optionalCall', _51 => _51({ type: "cross_review_start", round: 1 })]);
3009
3195
  const allReviews = [];
3010
3196
  const tasks = participants.map(async (p) => {
3011
3197
  const myReport = reports.find((r) => r.participant === p.name);
@@ -3023,13 +3209,13 @@ async function runCrossReview(options) {
3023
3209
  messages: [{ role: "user", content: userContent }],
3024
3210
  signal
3025
3211
  });
3026
- _chunkIMMTBZ33cjs.logger.info("arena.cross_review_raw_response", {
3212
+ _chunkJHNCK7JPcjs.logger.info("arena.cross_review_raw_response", {
3027
3213
  participant: p.name,
3028
3214
  text: response.text,
3029
3215
  stopReason: response.stopReason
3030
3216
  });
3031
3217
  if (response.stopReason === "length") {
3032
- _chunkIMMTBZ33cjs.logger.warn("arena.cross_review_truncated", { participant: p.name });
3218
+ _chunkJHNCK7JPcjs.logger.warn("arena.cross_review_truncated", { participant: p.name });
3033
3219
  const retryResponse = await client.createMessage({
3034
3220
  systemPrompt,
3035
3221
  messages: [
@@ -3042,7 +3228,7 @@ async function runCrossReview(options) {
3042
3228
  ],
3043
3229
  signal
3044
3230
  });
3045
- _chunkIMMTBZ33cjs.logger.info("arena.cross_review_retry", {
3231
+ _chunkJHNCK7JPcjs.logger.info("arena.cross_review_retry", {
3046
3232
  participant: p.name,
3047
3233
  stopReason: retryResponse.stopReason
3048
3234
  });
@@ -3054,7 +3240,7 @@ async function runCrossReview(options) {
3054
3240
  for (const reviews of results) {
3055
3241
  allReviews.push(...reviews);
3056
3242
  }
3057
- _optionalChain([onProgress, 'optionalCall', _43 => _43({ type: "cross_review_done", reviews: allReviews })]);
3243
+ _optionalChain([onProgress, 'optionalCall', _52 => _52({ type: "cross_review_done", reviews: allReviews })]);
3058
3244
  return allReviews;
3059
3245
  }
3060
3246
  async function runVerificationReview(options) {
@@ -3068,9 +3254,9 @@ async function runVerificationReview(options) {
3068
3254
  const digest = buildDigest(ledger, { round: 1, relevantClaimIds });
3069
3255
  const isPlanningMerge = mode === "planning" && isStrategyPlanning(strategy);
3070
3256
  if (isPlanningMerge) {
3071
- _optionalChain([onProgress, 'optionalCall', _44 => _44({ type: "planning_merge_review_start" })]);
3257
+ _optionalChain([onProgress, 'optionalCall', _53 => _53({ type: "planning_merge_review_start" })]);
3072
3258
  } else {
3073
- _optionalChain([onProgress, 'optionalCall', _45 => _45({ type: "verification_start" })]);
3259
+ _optionalChain([onProgress, 'optionalCall', _54 => _54({ type: "verification_start" })]);
3074
3260
  }
3075
3261
  const v2 = isStrategyV2(strategy);
3076
3262
  const allReviews = [];
@@ -3093,7 +3279,7 @@ async function runVerificationReview(options) {
3093
3279
  messages: [{ role: "user", content: userContent }],
3094
3280
  signal
3095
3281
  });
3096
- _chunkIMMTBZ33cjs.logger.info("arena.verification_review_raw", {
3282
+ _chunkJHNCK7JPcjs.logger.info("arena.verification_review_raw", {
3097
3283
  participant: p.name,
3098
3284
  stopReason: response.stopReason
3099
3285
  });
@@ -3168,7 +3354,7 @@ async function runVerificationReview(options) {
3168
3354
  const hasPendingChecks = ledger.getPendingChecksForClaim(claim.claimId).length > 0;
3169
3355
  applyReviewResult(claim, claimChallenges, hasPendingChecks);
3170
3356
  }
3171
- _chunkIMMTBZ33cjs.logger.info("arena.verification_done", {
3357
+ _chunkJHNCK7JPcjs.logger.info("arena.verification_done", {
3172
3358
  reviewCount: allReviews.length,
3173
3359
  challengeCount: allChallenges.length,
3174
3360
  claimStatuses: Object.fromEntries(
@@ -3176,11 +3362,11 @@ async function runVerificationReview(options) {
3176
3362
  )
3177
3363
  });
3178
3364
  if (isPlanningMerge) {
3179
- _optionalChain([onProgress, 'optionalCall', _46 => _46({ type: "planning_merge_review_done", mergeCount: allChallenges.length })]);
3365
+ _optionalChain([onProgress, 'optionalCall', _55 => _55({ type: "planning_merge_review_done", mergeCount: allChallenges.length })]);
3180
3366
  } else {
3181
- _optionalChain([onProgress, 'optionalCall', _47 => _47({ type: "verification_done", challengeCount: allChallenges.length })]);
3367
+ _optionalChain([onProgress, 'optionalCall', _56 => _56({ type: "verification_done", challengeCount: allChallenges.length })]);
3182
3368
  }
3183
- _optionalChain([onProgress, 'optionalCall', _48 => _48({ type: "cross_review_done", reviews: allReviews })]);
3369
+ _optionalChain([onProgress, 'optionalCall', _57 => _57({ type: "cross_review_done", reviews: allReviews })]);
3184
3370
  return { reviews: allReviews, challenges: allChallenges };
3185
3371
  }
3186
3372
 
@@ -3190,17 +3376,17 @@ async function runDebateRounds(options) {
3190
3376
  const { participants, strategy, topic, ledger, limits, maxRounds, signal, onProgress } = options;
3191
3377
  const contested = ledger.getClaimsByStatus("contested").slice(0, limits.maxContestedClaimsForDebate);
3192
3378
  if (contested.length === 0) {
3193
- _chunkIMMTBZ33cjs.logger.info("arena.debate_skip", { reason: "no contested claims" });
3379
+ _chunkJHNCK7JPcjs.logger.info("arena.debate_skip", { reason: "no contested claims" });
3194
3380
  return [];
3195
3381
  }
3196
- _chunkIMMTBZ33cjs.logger.info("arena.debate_start", {
3382
+ _chunkJHNCK7JPcjs.logger.info("arena.debate_start", {
3197
3383
  contestedCount: contested.length,
3198
3384
  maxRounds
3199
3385
  });
3200
3386
  const allDebateRounds = [];
3201
3387
  const v2 = isStrategyV2(strategy);
3202
3388
  for (const claim of contested) {
3203
- _optionalChain([signal, 'optionalAccess', _49 => _49.throwIfAborted, 'call', _50 => _50()]);
3389
+ _optionalChain([signal, 'optionalAccess', _58 => _58.throwIfAborted, 'call', _59 => _59()]);
3204
3390
  const claimDebateRounds = await debateClaim({
3205
3391
  claim,
3206
3392
  participants,
@@ -3222,7 +3408,7 @@ async function debateClaim(options) {
3222
3408
  const owner = participants.find((p) => p.name === claim.owner);
3223
3409
  const primaryChallenger = findPrimaryChallenger(claim, participants);
3224
3410
  if (!owner || !primaryChallenger) {
3225
- _chunkIMMTBZ33cjs.logger.warn("arena.debate_skip_claim", {
3411
+ _chunkJHNCK7JPcjs.logger.warn("arena.debate_skip_claim", {
3226
3412
  claimId: claim.claimId,
3227
3413
  reason: "cannot identify debaters"
3228
3414
  });
@@ -3232,8 +3418,8 @@ async function debateClaim(options) {
3232
3418
  const rounds = [];
3233
3419
  const allTurns = [];
3234
3420
  for (let round = 1; round <= maxRounds; round++) {
3235
- _optionalChain([signal, 'optionalAccess', _51 => _51.throwIfAborted, 'call', _52 => _52()]);
3236
- _optionalChain([onProgress, 'optionalCall', _53 => _53({ type: "debate_round_start", round, claims: [claim.claimId] })]);
3421
+ _optionalChain([signal, 'optionalAccess', _60 => _60.throwIfAborted, 'call', _61 => _61()]);
3422
+ _optionalChain([onProgress, 'optionalCall', _62 => _62({ type: "debate_round_start", round, claims: [claim.claimId] })]);
3237
3423
  const digest = buildDigest(ledger, {
3238
3424
  round,
3239
3425
  relevantClaimIds: [claim.claimId]
@@ -3255,7 +3441,7 @@ async function debateClaim(options) {
3255
3441
  messages: [{ role: "user", content: userContent }],
3256
3442
  signal
3257
3443
  });
3258
- _chunkIMMTBZ33cjs.logger.info("arena.debate_turn", {
3444
+ _chunkJHNCK7JPcjs.logger.info("arena.debate_turn", {
3259
3445
  participant: p.name,
3260
3446
  claimId: claim.claimId,
3261
3447
  round,
@@ -3278,9 +3464,9 @@ async function debateClaim(options) {
3278
3464
  resolutionNote
3279
3465
  };
3280
3466
  rounds.push(debateRound);
3281
- _optionalChain([onProgress, 'optionalCall', _54 => _54({ type: "debate_round_done", round, resolved: resolved ? 1 : 0 })]);
3467
+ _optionalChain([onProgress, 'optionalCall', _63 => _63({ type: "debate_round_done", round, resolved: resolved ? 1 : 0 })]);
3282
3468
  if (resolved) {
3283
- _chunkIMMTBZ33cjs.logger.info("arena.debate_converged", {
3469
+ _chunkJHNCK7JPcjs.logger.info("arena.debate_converged", {
3284
3470
  claimId: claim.claimId,
3285
3471
  round
3286
3472
  });
@@ -3321,10 +3507,10 @@ async function runAdjudication(options) {
3321
3507
  const contestedClaims = ledger.getClaimsByStatus("contested");
3322
3508
  const verifiedClaims = ledger.getClaimsByStatus("verified");
3323
3509
  if (contestedClaims.length === 0 && verifiedClaims.length === 0) {
3324
- _chunkIMMTBZ33cjs.logger.info("arena.adjudication_skip", { reason: "no claims to adjudicate" });
3510
+ _chunkJHNCK7JPcjs.logger.info("arena.adjudication_skip", { reason: "no claims to adjudicate" });
3325
3511
  return [];
3326
3512
  }
3327
- _chunkIMMTBZ33cjs.logger.info("arena.adjudication_start", {
3513
+ _chunkJHNCK7JPcjs.logger.info("arena.adjudication_start", {
3328
3514
  contested: contestedClaims.length,
3329
3515
  verified: verifiedClaims.length
3330
3516
  });
@@ -3333,7 +3519,7 @@ async function runAdjudication(options) {
3333
3519
  enableStreaming: false
3334
3520
  });
3335
3521
  for (const claim of contestedClaims) {
3336
- _optionalChain([signal, 'optionalAccess', _55 => _55.throwIfAborted, 'call', _56 => _56()]);
3522
+ _optionalChain([signal, 'optionalAccess', _64 => _64.throwIfAborted, 'call', _65 => _65()]);
3337
3523
  const digest = buildDigest(ledger, {
3338
3524
  round: 0,
3339
3525
  // adjudication is post-debate
@@ -3351,7 +3537,7 @@ async function runAdjudication(options) {
3351
3537
  messages: [{ role: "user", content: userContent }],
3352
3538
  signal
3353
3539
  });
3354
- _chunkIMMTBZ33cjs.logger.info("arena.adjudication_response", {
3540
+ _chunkJHNCK7JPcjs.logger.info("arena.adjudication_response", {
3355
3541
  claimId: claim.claimId,
3356
3542
  stopReason: response.stopReason
3357
3543
  });
@@ -3385,12 +3571,12 @@ async function runAdjudication(options) {
3385
3571
  (a) => a.outcome === "accepted" || a.outcome === "accepted_with_revision"
3386
3572
  ).length;
3387
3573
  const unresolved = ledger.getClaimsByStatus("unresolved").length;
3388
- _chunkIMMTBZ33cjs.logger.info("arena.adjudication_done", {
3574
+ _chunkJHNCK7JPcjs.logger.info("arena.adjudication_done", {
3389
3575
  total: allAdjudications.length,
3390
3576
  accepted,
3391
3577
  unresolved
3392
3578
  });
3393
- _optionalChain([onProgress, 'optionalCall', _57 => _57({ type: "adjudication_done", accepted, unresolved })]);
3579
+ _optionalChain([onProgress, 'optionalCall', _66 => _66({ type: "adjudication_done", accepted, unresolved })]);
3394
3580
  return allAdjudications;
3395
3581
  }
3396
3582
  function applyAdjudicationOutcome(claim, adjudication) {
@@ -3436,7 +3622,7 @@ Respond ONLY with JSON:
3436
3622
  _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
3437
3623
  async function buildConsensus(options) {
3438
3624
  const { concluder, strategy, topic, reports, reviews, claimSummary, signal, onProgress } = options;
3439
- _optionalChain([onProgress, 'optionalCall', _58 => _58({ type: "consensus_start" })]);
3625
+ _optionalChain([onProgress, 'optionalCall', _67 => _67({ type: "consensus_start" })]);
3440
3626
  const client = await createLLMClient({
3441
3627
  ...concluder.llm,
3442
3628
  enableStreaming: false
@@ -3446,7 +3632,7 @@ async function buildConsensus(options) {
3446
3632
  const v2 = isStrategyV2(strategy);
3447
3633
  if (v2 && claimSummary) {
3448
3634
  userContent = strategy.claimAwareConsensusUserPrompt(topic, reports, reviews, claimSummary);
3449
- _chunkIMMTBZ33cjs.logger.info("arena.consensus_claim_aware", {
3635
+ _chunkJHNCK7JPcjs.logger.info("arena.consensus_claim_aware", {
3450
3636
  verified: claimSummary.verified.length,
3451
3637
  unresolved: claimSummary.unresolved.length,
3452
3638
  contested: claimSummary.contested.length,
@@ -3460,13 +3646,13 @@ async function buildConsensus(options) {
3460
3646
  messages: [{ role: "user", content: userContent }],
3461
3647
  signal
3462
3648
  });
3463
- _chunkIMMTBZ33cjs.logger.info("arena.consensus_raw_response", {
3649
+ _chunkJHNCK7JPcjs.logger.info("arena.consensus_raw_response", {
3464
3650
  text: response.text,
3465
3651
  stopReason: response.stopReason
3466
3652
  });
3467
3653
  if (response.stopReason === "length") {
3468
- _chunkIMMTBZ33cjs.logger.warn("arena.consensus_truncated", {
3469
- textLen: _nullishCoalesce(_optionalChain([response, 'access', _59 => _59.text, 'optionalAccess', _60 => _60.length]), () => ( 0)),
3654
+ _chunkJHNCK7JPcjs.logger.warn("arena.consensus_truncated", {
3655
+ textLen: _nullishCoalesce(_optionalChain([response, 'access', _68 => _68.text, 'optionalAccess', _69 => _69.length]), () => ( 0)),
3470
3656
  maxTokens: concluder.llm.maxTokens
3471
3657
  });
3472
3658
  const retryResponse = await client.createMessage({
@@ -3481,21 +3667,21 @@ async function buildConsensus(options) {
3481
3667
  ],
3482
3668
  signal
3483
3669
  });
3484
- _chunkIMMTBZ33cjs.logger.info("arena.consensus_retry_response", {
3485
- textLen: _nullishCoalesce(_optionalChain([retryResponse, 'access', _61 => _61.text, 'optionalAccess', _62 => _62.length]), () => ( 0)),
3670
+ _chunkJHNCK7JPcjs.logger.info("arena.consensus_retry_response", {
3671
+ textLen: _nullishCoalesce(_optionalChain([retryResponse, 'access', _70 => _70.text, 'optionalAccess', _71 => _71.length]), () => ( 0)),
3486
3672
  stopReason: retryResponse.stopReason
3487
3673
  });
3488
3674
  if (retryResponse.stopReason === "length") {
3489
- _chunkIMMTBZ33cjs.logger.warn("arena.consensus_still_truncated", {
3490
- textLen: _nullishCoalesce(_optionalChain([retryResponse, 'access', _63 => _63.text, 'optionalAccess', _64 => _64.length]), () => ( 0))
3675
+ _chunkJHNCK7JPcjs.logger.warn("arena.consensus_still_truncated", {
3676
+ textLen: _nullishCoalesce(_optionalChain([retryResponse, 'access', _72 => _72.text, 'optionalAccess', _73 => _73.length]), () => ( 0))
3491
3677
  });
3492
3678
  }
3493
3679
  const consensus2 = strategy.parseConsensusResponse(retryResponse.text);
3494
- _optionalChain([onProgress, 'optionalCall', _65 => _65({ type: "consensus_done", consensus: consensus2 })]);
3680
+ _optionalChain([onProgress, 'optionalCall', _74 => _74({ type: "consensus_done", consensus: consensus2 })]);
3495
3681
  return consensus2;
3496
3682
  }
3497
3683
  const consensus = strategy.parseConsensusResponse(response.text);
3498
- _optionalChain([onProgress, 'optionalCall', _66 => _66({ type: "consensus_done", consensus })]);
3684
+ _optionalChain([onProgress, 'optionalCall', _75 => _75({ type: "consensus_done", consensus })]);
3499
3685
  return consensus;
3500
3686
  }
3501
3687
 
@@ -3530,7 +3716,7 @@ var ArenaLedger = class {
3530
3716
  const packets = this.ledger.evidencePackets.length;
3531
3717
  const challenges = this.ledger.challenges.length;
3532
3718
  if (claims === WARN_CLAIMS || packets === WARN_PACKETS || challenges === WARN_CHALLENGES) {
3533
- _chunkIMMTBZ33cjs.logger.warn("arena.ledger_growth", { claims, packets, challenges, toolTraces: this.ledger.toolTraces.length });
3719
+ _chunkJHNCK7JPcjs.logger.warn("arena.ledger_growth", { claims, packets, challenges, toolTraces: this.ledger.toolTraces.length });
3534
3720
  }
3535
3721
  }
3536
3722
  appendDossier(dossier) {
@@ -3640,8 +3826,8 @@ async function runDetailExpansion(options) {
3640
3826
  const { concluder, strategy, topic, phases, ledger, limits, signal, onProgress } = options;
3641
3827
  const tools = options.enableContextTools !== false ? _nullishCoalesce(options.contextTools, () => ( CONTEXT_TOOLS)) : void 0;
3642
3828
  const toExpand = phases.slice(0, limits.maxExpandedPhasesPerRun);
3643
- _optionalChain([onProgress, 'optionalCall', _67 => _67({ type: "roadmap_expansion_start", phaseCount: toExpand.length })]);
3644
- _chunkIMMTBZ33cjs.logger.info("arena.detail_expansion_start", { phaseCount: toExpand.length });
3829
+ _optionalChain([onProgress, 'optionalCall', _76 => _76({ type: "roadmap_expansion_start", phaseCount: toExpand.length })]);
3830
+ _chunkJHNCK7JPcjs.logger.info("arena.detail_expansion_start", { phaseCount: toExpand.length });
3645
3831
  const details = [];
3646
3832
  const client = await createLLMClient({
3647
3833
  ...concluder.llm,
@@ -3649,7 +3835,7 @@ async function runDetailExpansion(options) {
3649
3835
  });
3650
3836
  const systemPrompt = strategy.detailExpansionSystemPrompt();
3651
3837
  for (const phase of toExpand) {
3652
- _optionalChain([signal, 'optionalAccess', _68 => _68.throwIfAborted, 'call', _69 => _69()]);
3838
+ _optionalChain([signal, 'optionalAccess', _77 => _77.throwIfAborted, 'call', _78 => _78()]);
3653
3839
  const relevantClaimIds = _nullishCoalesce(phase.relatedFindings, () => ( []));
3654
3840
  const digest = buildDigest(ledger, { round: 1, relevantClaimIds });
3655
3841
  const userContent = strategy.detailExpansionUserPrompt(topic, phase, digest);
@@ -3664,10 +3850,10 @@ async function runDetailExpansion(options) {
3664
3850
  signal
3665
3851
  });
3666
3852
  const hasTools2 = response.toolCalls && response.toolCalls.length > 0;
3667
- _chunkIMMTBZ33cjs.logger.info("arena.detail_expansion_round", {
3853
+ _chunkJHNCK7JPcjs.logger.info("arena.detail_expansion_round", {
3668
3854
  phase: phase.title,
3669
3855
  round,
3670
- toolCount: _nullishCoalesce(_optionalChain([response, 'access', _70 => _70.toolCalls, 'optionalAccess', _71 => _71.length]), () => ( 0)),
3856
+ toolCount: _nullishCoalesce(_optionalChain([response, 'access', _79 => _79.toolCalls, 'optionalAccess', _80 => _80.length]), () => ( 0)),
3671
3857
  stopReason: response.stopReason
3672
3858
  });
3673
3859
  if (!hasTools2) {
@@ -3704,22 +3890,22 @@ async function runDetailExpansion(options) {
3704
3890
  if (!finalText) {
3705
3891
  finalText = "";
3706
3892
  }
3707
- _chunkIMMTBZ33cjs.logger.info("arena.detail_expansion_phase", {
3893
+ _chunkJHNCK7JPcjs.logger.info("arena.detail_expansion_phase", {
3708
3894
  phase: phase.title,
3709
3895
  textLen: finalText.length
3710
3896
  });
3711
3897
  const detail = strategy.parseDetailExpansionResponse(finalText);
3712
3898
  if (!detail.phaseTitle) detail.phaseTitle = phase.title;
3713
3899
  if (detail.targetFiles.length === 0 && detail.codeChanges.length === 0) {
3714
- _chunkIMMTBZ33cjs.logger.warn("arena.detail_expansion_sparse", {
3900
+ _chunkJHNCK7JPcjs.logger.warn("arena.detail_expansion_sparse", {
3715
3901
  phase: phase.title,
3716
3902
  objective: detail.objective.slice(0, 200)
3717
3903
  });
3718
3904
  }
3719
3905
  details.push(detail);
3720
3906
  }
3721
- _chunkIMMTBZ33cjs.logger.info("arena.detail_expansion_done", { detailCount: details.length });
3722
- _optionalChain([onProgress, 'optionalCall', _72 => _72({ type: "roadmap_expansion_done", detailCount: details.length })]);
3907
+ _chunkJHNCK7JPcjs.logger.info("arena.detail_expansion_done", { detailCount: details.length });
3908
+ _optionalChain([onProgress, 'optionalCall', _81 => _81({ type: "roadmap_expansion_done", detailCount: details.length })]);
3723
3909
  return details;
3724
3910
  }
3725
3911
 
@@ -3841,25 +4027,41 @@ var Arena = class {
3841
4027
  async run(topic, flags) {
3842
4028
  const participantNames = this.config.participants.map((p) => p.name);
3843
4029
  const signal = this.config.signal;
3844
- _chunkIMMTBZ33cjs.logger.info("arena.start", { mode: this.config.mode, participants: participantNames });
3845
- _optionalChain([signal, 'optionalAccess', _73 => _73.throwIfAborted, 'call', _74 => _74()]);
4030
+ _chunkJHNCK7JPcjs.logger.info("arena.start", { mode: this.config.mode, participants: participantNames });
4031
+ _optionalChain([signal, 'optionalAccess', _82 => _82.throwIfAborted, 'call', _83 => _83()]);
3846
4032
  const llmConfig = this.config.participants[0].llm;
3847
4033
  const plan = await planArena(topic, llmConfig, flags, signal);
3848
- _optionalChain([this, 'access', _75 => _75.config, 'access', _76 => _76.onProgress, 'optionalCall', _77 => _77({ type: "plan_resolved", plan })]);
3849
- _chunkIMMTBZ33cjs.logger.info("arena.plan", {
4034
+ _optionalChain([this, 'access', _84 => _84.config, 'access', _85 => _85.onProgress, 'optionalCall', _86 => _86({ type: "plan_resolved", plan })]);
4035
+ _chunkJHNCK7JPcjs.logger.info("arena.plan", {
3850
4036
  mode: plan.mode,
3851
4037
  lenses: plan.lenses.map((l) => l.name),
3852
4038
  sources: plan.sources.map((s) => s.kind),
3853
4039
  subject: plan.subject.label,
3854
4040
  confidence: plan.confidence
3855
4041
  });
3856
- if (!_optionalChain([flags, 'optionalAccess', _78 => _78.mode]) && plan.mode !== this.config.mode) {
4042
+ if (!_optionalChain([flags, 'optionalAccess', _87 => _87.mode]) && plan.mode !== this.config.mode) {
3857
4043
  this.config.mode = plan.mode;
3858
4044
  }
3859
- _optionalChain([signal, 'optionalAccess', _79 => _79.throwIfAborted, 'call', _80 => _80()]);
3860
- const { artifacts, quickFacts } = collectEvidence(plan, topic);
3861
- _optionalChain([this, 'access', _81 => _81.config, 'access', _82 => _82.onProgress, 'optionalCall', _83 => _83({ type: "evidence_collected", artifacts })]);
3862
- _chunkIMMTBZ33cjs.logger.info("arena.evidence", {
4045
+ _optionalChain([signal, 'optionalAccess', _88 => _88.throwIfAborted, 'call', _89 => _89()]);
4046
+ const onProgress = this.config.onProgress;
4047
+ const { artifacts, quickFacts } = await collectEvidence(plan, topic, {
4048
+ signal,
4049
+ onProgress: (e) => {
4050
+ if (e.type === "evidence_started") {
4051
+ _optionalChain([onProgress, 'optionalCall', _90 => _90({ type: "evidence_started", source: e.source })]);
4052
+ } else {
4053
+ _optionalChain([onProgress, 'optionalCall', _91 => _91({
4054
+ type: "evidence_source_done",
4055
+ source: e.source,
4056
+ count: _nullishCoalesce(e.count, () => ( 0)),
4057
+ durationMs: _nullishCoalesce(e.durationMs, () => ( 0)),
4058
+ timedOut: _nullishCoalesce(e.timedOut, () => ( false))
4059
+ })]);
4060
+ }
4061
+ }
4062
+ });
4063
+ _optionalChain([onProgress, 'optionalCall', _92 => _92({ type: "evidence_collected", artifacts })]);
4064
+ _chunkJHNCK7JPcjs.logger.info("arena.evidence", {
3863
4065
  artifactCount: artifacts.length,
3864
4066
  sources: plan.sources.map((s) => s.kind)
3865
4067
  });
@@ -3867,8 +4069,8 @@ var Arena = class {
3867
4069
  this.strategy = _nullishCoalesce(this.config.strategy, () => ( getStrategyForPlan(plan)));
3868
4070
  this.strategy = withLanguage(this.strategy, topic);
3869
4071
  const contextTools = this.config.enableContextTools !== false ? selectTools(plan) : void 0;
3870
- _optionalChain([signal, 'optionalAccess', _84 => _84.throwIfAborted, 'call', _85 => _85()]);
3871
- _chunkIMMTBZ33cjs.logger.info("arena.research_phase", { participants: participantNames });
4072
+ _optionalChain([signal, 'optionalAccess', _93 => _93.throwIfAborted, 'call', _94 => _94()]);
4073
+ _chunkJHNCK7JPcjs.logger.info("arena.research_phase", { participants: participantNames });
3872
4074
  const researchResults = await runParticipantResearchWithDossiers({
3873
4075
  participants: this.config.participants,
3874
4076
  strategy: this.strategy,
@@ -3881,7 +4083,7 @@ var Arena = class {
3881
4083
  });
3882
4084
  const reports = researchResults.map((r) => r.report);
3883
4085
  const dossiers = researchResults.map((r) => r.dossier);
3884
- _optionalChain([signal, 'optionalAccess', _86 => _86.throwIfAborted, 'call', _87 => _87()]);
4086
+ _optionalChain([signal, 'optionalAccess', _95 => _95.throwIfAborted, 'call', _96 => _96()]);
3885
4087
  const ledger = new ArenaLedger();
3886
4088
  for (const dossier of dossiers) {
3887
4089
  ledger.appendDossier(dossier);
@@ -3891,7 +4093,7 @@ var Arena = class {
3891
4093
  ledger,
3892
4094
  onProgress: this.config.onProgress
3893
4095
  });
3894
- _chunkIMMTBZ33cjs.logger.info("arena.claims_registered", {
4096
+ _chunkJHNCK7JPcjs.logger.info("arena.claims_registered", {
3895
4097
  claimCount: claims.length,
3896
4098
  byOwner: Object.fromEntries(
3897
4099
  participantNames.map((name) => [
@@ -3900,11 +4102,11 @@ var Arena = class {
3900
4102
  ])
3901
4103
  )
3902
4104
  });
3903
- _optionalChain([signal, 'optionalAccess', _88 => _88.throwIfAborted, 'call', _89 => _89()]);
4105
+ _optionalChain([signal, 'optionalAccess', _97 => _97.throwIfAborted, 'call', _98 => _98()]);
3904
4106
  const concluderName = _nullishCoalesce(this.config.concluder, () => ( participantNames[0]));
3905
4107
  const concluderMatch = this.config.participants.find((p) => p.name === concluderName);
3906
4108
  if (!concluderMatch && this.config.concluder) {
3907
- _chunkIMMTBZ33cjs.logger.warn("arena.concluder_not_found", {
4109
+ _chunkJHNCK7JPcjs.logger.warn("arena.concluder_not_found", {
3908
4110
  requested: this.config.concluder,
3909
4111
  fallback: this.config.participants[0].name
3910
4112
  });
@@ -3958,7 +4160,7 @@ var Arena = class {
3958
4160
  enableContextTools,
3959
4161
  signal
3960
4162
  } = ctx;
3961
- _chunkIMMTBZ33cjs.logger.info("arena.planning_merge_review_phase");
4163
+ _chunkJHNCK7JPcjs.logger.info("arena.planning_merge_review_phase");
3962
4164
  const { reviews } = await runVerificationReview({
3963
4165
  participants: this.config.participants,
3964
4166
  strategy: this.strategy,
@@ -3970,7 +4172,7 @@ var Arena = class {
3970
4172
  signal,
3971
4173
  onProgress: this.config.onProgress
3972
4174
  });
3973
- _optionalChain([signal, 'optionalAccess', _90 => _90.throwIfAborted, 'call', _91 => _91()]);
4175
+ _optionalChain([signal, 'optionalAccess', _99 => _99.throwIfAborted, 'call', _100 => _100()]);
3974
4176
  const allClaims = ledger.getAllClaims();
3975
4177
  const claimSummary = {
3976
4178
  verified: allClaims.filter((c) => c.status === "verified"),
@@ -3978,7 +4180,7 @@ var Arena = class {
3978
4180
  unresolved: allClaims.filter((c) => c.status === "unresolved"),
3979
4181
  rejected: allClaims.filter((c) => c.status === "rejected")
3980
4182
  };
3981
- _chunkIMMTBZ33cjs.logger.info("arena.planning_consensus_phase", { concluder: concluder.name });
4183
+ _chunkJHNCK7JPcjs.logger.info("arena.planning_consensus_phase", { concluder: concluder.name });
3982
4184
  const consensus = await buildConsensus({
3983
4185
  concluder,
3984
4186
  strategy: this.strategy,
@@ -3989,9 +4191,9 @@ var Arena = class {
3989
4191
  signal,
3990
4192
  onProgress: this.config.onProgress
3991
4193
  });
3992
- _optionalChain([signal, 'optionalAccess', _92 => _92.throwIfAborted, 'call', _93 => _93()]);
4194
+ _optionalChain([signal, 'optionalAccess', _101 => _101.throwIfAborted, 'call', _102 => _102()]);
3993
4195
  if (consensus.roadmap.length > 0 && isStrategyPlanning(this.strategy)) {
3994
- _chunkIMMTBZ33cjs.logger.info("arena.detail_expansion_phase", { phaseCount: consensus.roadmap.length });
4196
+ _chunkJHNCK7JPcjs.logger.info("arena.detail_expansion_phase", { phaseCount: consensus.roadmap.length });
3995
4197
  try {
3996
4198
  const details = await runDetailExpansion({
3997
4199
  concluder,
@@ -4007,7 +4209,7 @@ var Arena = class {
4007
4209
  });
4008
4210
  consensus.roadmapDetails = details;
4009
4211
  } catch (err) {
4010
- _chunkIMMTBZ33cjs.logger.warn("arena.detail_expansion_failed", {
4212
+ _chunkJHNCK7JPcjs.logger.warn("arena.detail_expansion_failed", {
4011
4213
  error: err.message,
4012
4214
  phaseCount: consensus.roadmap.length
4013
4215
  });
@@ -4033,7 +4235,7 @@ var Arena = class {
4033
4235
  */
4034
4236
  async runReviewDiscussionPath(ctx) {
4035
4237
  const { topic, participantNames, plan, baseContext, reports, dossiers, ledger, concluder, signal } = ctx;
4036
- _chunkIMMTBZ33cjs.logger.info("arena.verification_review_phase");
4238
+ _chunkJHNCK7JPcjs.logger.info("arena.verification_review_phase");
4037
4239
  const { reviews } = await runVerificationReview({
4038
4240
  participants: this.config.participants,
4039
4241
  strategy: this.strategy,
@@ -4044,8 +4246,8 @@ var Arena = class {
4044
4246
  signal,
4045
4247
  onProgress: this.config.onProgress
4046
4248
  });
4047
- _optionalChain([signal, 'optionalAccess', _94 => _94.throwIfAborted, 'call', _95 => _95()]);
4048
- _chunkIMMTBZ33cjs.logger.info("arena.debate_phase");
4249
+ _optionalChain([signal, 'optionalAccess', _103 => _103.throwIfAborted, 'call', _104 => _104()]);
4250
+ _chunkJHNCK7JPcjs.logger.info("arena.debate_phase");
4049
4251
  const debateRounds = await runDebateRounds({
4050
4252
  participants: this.config.participants,
4051
4253
  strategy: this.strategy,
@@ -4056,8 +4258,8 @@ var Arena = class {
4056
4258
  signal,
4057
4259
  onProgress: this.config.onProgress
4058
4260
  });
4059
- _optionalChain([signal, 'optionalAccess', _96 => _96.throwIfAborted, 'call', _97 => _97()]);
4060
- _chunkIMMTBZ33cjs.logger.info("arena.adjudication_phase", { concluder: concluder.name });
4261
+ _optionalChain([signal, 'optionalAccess', _105 => _105.throwIfAborted, 'call', _106 => _106()]);
4262
+ _chunkJHNCK7JPcjs.logger.info("arena.adjudication_phase", { concluder: concluder.name });
4061
4263
  const adjudications = await runAdjudication({
4062
4264
  concluder,
4063
4265
  strategy: this.strategy,
@@ -4066,7 +4268,7 @@ var Arena = class {
4066
4268
  signal,
4067
4269
  onProgress: this.config.onProgress
4068
4270
  });
4069
- _optionalChain([signal, 'optionalAccess', _98 => _98.throwIfAborted, 'call', _99 => _99()]);
4271
+ _optionalChain([signal, 'optionalAccess', _107 => _107.throwIfAborted, 'call', _108 => _108()]);
4070
4272
  const allClaims = ledger.getAllClaims();
4071
4273
  const claimSummary = {
4072
4274
  verified: allClaims.filter((c) => c.status === "verified"),
@@ -4074,7 +4276,7 @@ var Arena = class {
4074
4276
  unresolved: allClaims.filter((c) => c.status === "unresolved"),
4075
4277
  rejected: allClaims.filter((c) => c.status === "rejected")
4076
4278
  };
4077
- _chunkIMMTBZ33cjs.logger.info("arena.consensus_phase", {
4279
+ _chunkJHNCK7JPcjs.logger.info("arena.consensus_phase", {
4078
4280
  concluder: concluder.name,
4079
4281
  verified: claimSummary.verified.length,
4080
4282
  unresolved: claimSummary.unresolved.length
@@ -4130,7 +4332,7 @@ function getMaxOutputTokens(model) {
4130
4332
  const byKey = MODEL_PRESETS[model];
4131
4333
  if (byKey) return byKey.maxOutputTokens;
4132
4334
  const byModel = Object.values(MODEL_PRESETS).find((p) => p.model === model);
4133
- return _nullishCoalesce(_optionalChain([byModel, 'optionalAccess', _100 => _100.maxOutputTokens]), () => ( 8192));
4335
+ return _nullishCoalesce(_optionalChain([byModel, 'optionalAccess', _109 => _109.maxOutputTokens]), () => ( 8192));
4134
4336
  }
4135
4337
 
4136
4338
  // src/arena/render/terminal.ts
@@ -4265,7 +4467,7 @@ function formatRoadmapDetailsSection(details) {
4265
4467
  function getOrderedConsensusSections(result) {
4266
4468
  const VALID_KINDS = /* @__PURE__ */ new Set(["strength", "improvement", "risk", "question"]);
4267
4469
  const defaultOrder = ["risk", "improvement", "strength", "question"];
4268
- const emphasize = (_nullishCoalesce(_optionalChain([result, 'access', _101 => _101.plan, 'optionalAccess', _102 => _102.outputShape, 'optionalAccess', _103 => _103.emphasize]), () => ( []))).filter((k) => VALID_KINDS.has(k));
4470
+ const emphasize = (_nullishCoalesce(_optionalChain([result, 'access', _110 => _110.plan, 'optionalAccess', _111 => _111.outputShape, 'optionalAccess', _112 => _112.emphasize]), () => ( []))).filter((k) => VALID_KINDS.has(k));
4269
4471
  const orderedKinds = dedupeFindingKinds([...emphasize, ...defaultOrder]);
4270
4472
  return orderedKinds.map((kind) => {
4271
4473
  switch (kind) {
@@ -4299,6 +4501,14 @@ function createProgressRenderer(sink) {
4299
4501
  `Plan: ${event.plan.mode} | lenses: ${event.plan.lenses.map((l) => l.name).join(", ")} | sources: ${event.plan.sources.map((s) => s.kind).join(", ")}` + (event.plan.confidence !== "high" ? ` (${event.plan.confidence} confidence)` : "")
4300
4502
  ));
4301
4503
  break;
4504
+ case "evidence_started":
4505
+ sink(_chalk2.default.dim(` \xB7 collecting from ${event.source}\u2026`));
4506
+ break;
4507
+ case "evidence_source_done": {
4508
+ const tag = event.timedOut ? _chalk2.default.yellow(" (timed out)") : "";
4509
+ sink(_chalk2.default.dim(` \xB7 ${event.source}: ${event.count} artifacts in ${event.durationMs}ms${tag}`));
4510
+ break;
4511
+ }
4302
4512
  case "evidence_collected":
4303
4513
  sink(_chalk2.default.dim(`Evidence: ${event.artifacts.length} artifacts collected`));
4304
4514
  break;
@@ -4502,7 +4712,7 @@ function formatPhaseDetail(detail) {
4502
4712
  function getOrderedConsensusSections2(result) {
4503
4713
  const VALID_KINDS = /* @__PURE__ */ new Set(["strength", "improvement", "risk", "question"]);
4504
4714
  const defaultOrder = ["risk", "improvement", "strength", "question"];
4505
- const emphasize = (_nullishCoalesce(_optionalChain([result, 'access', _104 => _104.plan, 'optionalAccess', _105 => _105.outputShape, 'optionalAccess', _106 => _106.emphasize]), () => ( []))).filter((k) => VALID_KINDS.has(k));
4715
+ const emphasize = (_nullishCoalesce(_optionalChain([result, 'access', _113 => _113.plan, 'optionalAccess', _114 => _114.outputShape, 'optionalAccess', _115 => _115.emphasize]), () => ( []))).filter((k) => VALID_KINDS.has(k));
4506
4716
  const orderedKinds = dedupeFindingKinds2([...emphasize, ...defaultOrder]);
4507
4717
  const sections = orderedKinds.map((kind) => {
4508
4718
  switch (kind) {