@iowarp/clio-coder 0.4.2 → 0.4.3

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 (369) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/CONTRIBUTING.md +86 -19
  3. package/README.md +35 -6
  4. package/dist/{acp-TMDQZDIG.js → acp-H2NGRPWO.js} +11 -11
  5. package/dist/{agents-5N5NG3XG.js → agents-TL5LLUQP.js} +54 -53
  6. package/dist/assets/codewiki.json +1 -1
  7. package/dist/{auth-Z5CCBXKQ.js → auth-E5SW4HMS.js} +19 -16
  8. package/dist/{builtins-K6TNDT24.js → builtins-IA7V7FUC.js} +9 -4
  9. package/dist/{chunk-ZW4HH5JJ.js → chunk-2APPQIER.js} +6 -6
  10. package/dist/{chunk-72GZI5EV.js → chunk-2JH2WHGE.js} +2 -2
  11. package/dist/{chunk-UBRFI4HS.js → chunk-2UG5F4C5.js} +127 -47
  12. package/dist/{chunk-UH632ZYL.js → chunk-2UH2KFUP.js} +2 -2
  13. package/dist/{chunk-3F7VUY77.js → chunk-2VIKGWFZ.js} +2 -2
  14. package/dist/{chunk-I66EAJFY.js → chunk-2WZ546HR.js} +267 -232
  15. package/dist/{chunk-RKSR6VSF.js → chunk-4IUZQIJ3.js} +29 -1
  16. package/dist/{chunk-2X4RYJTJ.js → chunk-4UVU7BJ5.js} +2 -2
  17. package/dist/{chunk-M2DAX4F6.js → chunk-4WR7VSYB.js} +2 -2
  18. package/dist/{chunk-5KW52TEP.js → chunk-54CBCGIR.js} +5 -5
  19. package/dist/{chunk-3KIPBMUA.js → chunk-5ICU3EUH.js} +2 -2
  20. package/dist/{chunk-77QIVUZB.js → chunk-5MEZN6CB.js} +4 -4
  21. package/dist/{chunk-O42A54GG.js → chunk-5OIVVPHF.js} +2 -2
  22. package/dist/{chunk-LJID3DYZ.js → chunk-64I3JVYM.js} +2 -2
  23. package/dist/{chunk-4JDLP6ZS.js → chunk-6PTFB5VS.js} +7 -7
  24. package/dist/{chunk-VN3SHNBN.js → chunk-7DICMOS6.js} +2 -2
  25. package/dist/{chunk-HLAFFSEK.js → chunk-7DRAWPTZ.js} +2 -2
  26. package/dist/chunk-7E7I3WLS.js +3762 -0
  27. package/dist/{chunk-YJISEZKC.js → chunk-7ZYNNDKC.js} +6 -6
  28. package/dist/{chunk-I66ZTYNP.js → chunk-AF4YM7Z4.js} +236 -101
  29. package/dist/{chunk-2HFQNRV3.js → chunk-AX2THNSA.js} +12 -12
  30. package/dist/{chunk-PGF63K6I.js → chunk-B4OAX3SI.js} +65 -3
  31. package/dist/{chunk-W6NIE6OW.js → chunk-B4VEBZKF.js} +3 -3
  32. package/dist/{chunk-JBCS7CRR.js → chunk-BEPZRGGU.js} +10 -10
  33. package/dist/{chunk-XGDPUNND.js → chunk-CE5AX47J.js} +2 -2
  34. package/dist/{chunk-I64IFBLB.js → chunk-DWUOQKRU.js} +17 -10
  35. package/dist/{chunk-DZAW46HP.js → chunk-E3TPLWFX.js} +3 -3
  36. package/dist/{chunk-HIICAHCJ.js → chunk-EKCHAPYA.js} +2 -2
  37. package/dist/{chunk-XE3PCIXH.js → chunk-F5JHEYZM.js} +7 -7
  38. package/dist/{chunk-5PFYMY2V.js → chunk-FTMGRKEF.js} +2 -2
  39. package/dist/{chunk-ZNT2M6TG.js → chunk-G76U63X4.js} +17 -17
  40. package/dist/{chunk-34BHNEE3.js → chunk-GHS5EBTQ.js} +58 -7
  41. package/dist/{chunk-2NHR3NAY.js → chunk-GI7YYQ3F.js} +40 -34
  42. package/dist/{chunk-DYHAXKHD.js → chunk-GWZNEVM2.js} +12 -8
  43. package/dist/chunk-GYV6VZOC.js +26 -0
  44. package/dist/{chunk-MQXIVJ35.js → chunk-HAXOFFRH.js} +5 -5
  45. package/dist/{chunk-W4YEMFBX.js → chunk-HEQY7ZFI.js} +2 -2
  46. package/dist/{chunk-IKOZFYBN.js → chunk-I7ZPNEJM.js} +145 -102
  47. package/dist/{chunk-WNP7O5WZ.js → chunk-ID64D7PE.js} +4 -4
  48. package/dist/{chunk-XQRY4DTA.js → chunk-IGLP3ODT.js} +10 -10
  49. package/dist/chunk-IJNZMHLA.js +101 -0
  50. package/dist/{chunk-JWJGP5DQ.js → chunk-INY6HTFL.js} +7 -7
  51. package/dist/{chunk-PBP4B7XR.js → chunk-IUE3Y34X.js} +2 -2
  52. package/dist/{chunk-B74PXLU7.js → chunk-IWT4SF4R.js} +3 -3
  53. package/dist/{chunk-B7HM5Z7T.js → chunk-JDAY6FIL.js} +5 -5
  54. package/dist/{chunk-PJX3WQUQ.js → chunk-JEQ3XTHC.js} +2 -2
  55. package/dist/{chunk-FSP7CMNU.js → chunk-JGRC33J2.js} +50 -4
  56. package/dist/{chunk-X7IARSHT.js → chunk-JKKCYP3C.js} +9 -9
  57. package/dist/{chunk-HJWWJ6IL.js → chunk-JSC3U7TI.js} +16 -4
  58. package/dist/{chunk-SSEYRH53.js → chunk-KK4JZPBQ.js} +19 -140
  59. package/dist/{chunk-IHXBNWMM.js → chunk-KXDSS5WJ.js} +7 -3
  60. package/dist/{chunk-Q4XWMHX6.js → chunk-L47TF46W.js} +2 -2
  61. package/dist/{chunk-O3YUNJZ2.js → chunk-LDJG7DW3.js} +81 -24
  62. package/dist/{chunk-CDNVLKUX.js → chunk-LLDJM5XK.js} +13 -7
  63. package/dist/{chunk-F2I26BDK.js → chunk-MUW2BDDH.js} +4 -4
  64. package/dist/{chunk-HKMD33FO.js → chunk-MWUZBSAQ.js} +79 -76
  65. package/dist/{chunk-QQLGQY2A.js → chunk-N2Z7HLVY.js} +20 -20
  66. package/dist/{chunk-DZEK6CJN.js → chunk-NIQJ66N4.js} +19 -19
  67. package/dist/{chunk-CWVRRIEI.js → chunk-NZMNUPZZ.js} +2 -2
  68. package/dist/{chunk-462T4EGZ.js → chunk-O5CVSAG5.js} +2 -2
  69. package/dist/{chunk-TPEQIQIE.js → chunk-OML5D5V5.js} +8 -8
  70. package/dist/{chunk-IKSLQ4XV.js → chunk-PAJQJ7BS.js} +558 -216
  71. package/dist/{chunk-ZW55JB7N.js → chunk-PUVDKJ2Y.js} +2 -2
  72. package/dist/{chunk-UH347SHR.js → chunk-QWGDJJYJ.js} +11 -11
  73. package/dist/chunk-R6Q67RJH.js +134 -0
  74. package/dist/{chunk-CRFOIAX3.js → chunk-RRNP2ANY.js} +6 -6
  75. package/dist/{chunk-IDNA72AH.js → chunk-RSJ25QSL.js} +2 -2
  76. package/dist/chunk-SKHCAU7K.js +385 -0
  77. package/dist/{chunk-RLYRBIYQ.js → chunk-TM6LQDI3.js} +20 -12
  78. package/dist/chunk-UOIZ7DA4.js +41 -0
  79. package/dist/{chunk-P75RZCJW.js → chunk-UPZU6GE4.js} +3 -3
  80. package/dist/{chunk-MCMZMDAC.js → chunk-V2ANDPVT.js} +4 -4
  81. package/dist/{chunk-AK5XEFVZ.js → chunk-VA5FNYMT.js} +26 -13
  82. package/dist/{chunk-IMXMHHMQ.js → chunk-VW6DOEDG.js} +332 -57
  83. package/dist/{chunk-XOXV5GKE.js → chunk-W6RRQCPQ.js} +16 -7
  84. package/dist/{chunk-CYZW7JHJ.js → chunk-WBKFA554.js} +8 -8
  85. package/dist/{chunk-BO7Y52RY.js → chunk-WCXUNS7U.js} +7 -7
  86. package/dist/{chunk-ZGNYYXQ6.js → chunk-WRBAGUNF.js} +3 -3
  87. package/dist/{chunk-FVDGR2ZL.js → chunk-XIVNBFZS.js} +85 -30
  88. package/dist/{chunk-BYMNWQ7O.js → chunk-XPWWI35G.js} +299 -58
  89. package/dist/{chunk-KPXDY6QF.js → chunk-XRZT5WY5.js} +2 -2
  90. package/dist/{chunk-AZ4WMN4W.js → chunk-Y3CBHOR6.js} +2 -2
  91. package/dist/{chunk-VXMFAE2W.js → chunk-YPC6ZR5L.js} +19 -6
  92. package/dist/{chunk-54ODD65L.js → chunk-YQWYVTMC.js} +4 -4
  93. package/dist/{chunk-M2WXEHER.js → chunk-ZA4VCIGV.js} +2 -2
  94. package/dist/{chunk-7BHIY2MW.js → chunk-ZDN3Y73Y.js} +6 -6
  95. package/dist/{chunk-E7GT7O5N.js → chunk-ZWPRK62N.js} +7 -4
  96. package/dist/cli/index.js +38 -37
  97. package/dist/{clio-7VB377CC.js → clio-CMMK4KRR.js} +7 -7
  98. package/dist/{code-nav-YVLCYA7V.js → code-nav-MDZNQS33.js} +7 -7
  99. package/dist/{components-UBWCQSRW.js → components-UCUQ4QXW.js} +4 -4
  100. package/dist/{config-4HVOS65E.js → config-SVM5P5YI.js} +76 -74
  101. package/dist/{configure-PIWO7B24.js → configure-LE3IK2TJ.js} +26 -24
  102. package/dist/{context-IYEHL3WQ.js → context-2OHRKS42.js} +66 -63
  103. package/dist/{context-N6ZE3LGJ.js → context-E3VC7RX5.js} +15 -11
  104. package/dist/{context-KQYIWPWT.js → context-VNCR7KAG.js} +60 -45
  105. package/dist/{context-clear-G4OGZJDS.js → context-clear-BW4O37TG.js} +61 -59
  106. package/dist/context-map-COB37XXN.js +505 -0
  107. package/dist/{context-working-set-BWLF6LJP.js → context-working-set-VDS25HXZ.js} +17 -16
  108. package/dist/{dispatch-runner-2QQAITS3.js → dispatch-runner-5AHT53RF.js} +85 -74
  109. package/dist/{doctor-LHBD36VU.js → doctor-WNNVO6FY.js} +37 -37
  110. package/dist/{eval-C45FYRJ6.js → eval-7G7SGAYO.js} +285 -114
  111. package/dist/{eval-inventory-6DEJPLBF.js → eval-inventory-Y6QRFOH5.js} +4 -4
  112. package/dist/{evidence-6SHONYAF.js → evidence-VD6736FQ.js} +63 -62
  113. package/dist/{evolve-KRKMV72X.js → evolve-AL3NGVRL.js} +62 -61
  114. package/dist/{extensions-KPZ2UHBB.js → extensions-MOVJ32NM.js} +7 -7
  115. package/dist/{fleet-IVTCKDHT.js → fleet-QZHUMAGI.js} +110 -108
  116. package/dist/{fleet-commands-EDWL3IT7.js → fleet-commands-BAYT5FJZ.js} +10 -10
  117. package/dist/{fleet-decisions-YP3YEFGK.js → fleet-decisions-IREVMRU4.js} +7 -6
  118. package/dist/{fleet-graph-ZFWKHY2M.js → fleet-graph-YCTT3HTI.js} +19 -18
  119. package/dist/{fleet-inspect-FVUNCBML.js → fleet-inspect-QVJTDAVB.js} +55 -54
  120. package/dist/{fleet-preflight-UN5XED4R.js → fleet-preflight-25QAFPK4.js} +4 -4
  121. package/dist/{fleet-validate-XOWC4HSX.js → fleet-validate-5O57AAJ7.js} +23 -22
  122. package/dist/{fleet-verify-UN3SODEL.js → fleet-verify-CPH2W2T6.js} +56 -55
  123. package/dist/{fleet-view-TWHJKCN6.js → fleet-view-SWBR3VGQ.js} +55 -54
  124. package/dist/{init-T2QORQ3Y.js → init-J477LKZH.js} +78 -76
  125. package/dist/{interop-IN5I2A66.js → interop-3FCM6XLG.js} +11 -11
  126. package/dist/{library-LSCATDLZ.js → library-QUQEIUG6.js} +28 -27
  127. package/dist/{memory-HYOKAGGJ.js → memory-SGGSEP65.js} +64 -63
  128. package/dist/{models-2GPMFYCM.js → models-HEKUAXXK.js} +49 -43
  129. package/dist/{monitor-E4ASVUJH.js → monitor-HKU57TYQ.js} +61 -60
  130. package/dist/{orchestrator-DDMPR3PY.js → orchestrator-VDFAEFAI.js} +919 -546
  131. package/dist/{panes-E3RUXOW5.js → panes-DN2SSFOH.js} +3 -3
  132. package/dist/{panes-IXKLOKA2.js → panes-TALGNPZT.js} +8 -8
  133. package/dist/{paths-L7LGY6RN.js → paths-NBMFAIEZ.js} +5 -5
  134. package/dist/reset-EAJFFJVB.js +344 -0
  135. package/dist/{resources-OTRSN34L.js → resources-OVKSEFVE.js} +27 -20
  136. package/dist/{run-5DEYH5QK.js → run-7DP7ZF2J.js} +113 -109
  137. package/dist/{share-IHWTLO3M.js → share-WML67FT3.js} +26 -25
  138. package/dist/{skills-IYMXMKW4.js → skills-SG662R2K.js} +39 -31
  139. package/dist/{skills-eval-DROHSJAR.js → skills-eval-VVZEUU46.js} +74 -73
  140. package/dist/{skills-inventory-D7X4L4ZX.js → skills-inventory-I2E23GET.js} +21 -20
  141. package/dist/{slash-commands-QBM7UZ3B.js → slash-commands-S7MBJDQK.js} +35 -34
  142. package/dist/{steer-Z5DO23FJ.js → steer-2LQOMCPB.js} +3 -3
  143. package/dist/{support-U7QOWY26.js → support-CC2UJBJ6.js} +6 -6
  144. package/dist/{targets-P2FUC4IL.js → targets-4QC3HIEW.js} +48 -45
  145. package/dist/{terminal-lease-YREJ3JX2.js → terminal-lease-TUHIJ6Y2.js} +2 -2
  146. package/dist/{tools-5B7RO6MV.js → tools-TFGJICCU.js} +8 -8
  147. package/dist/{trace-YMGMUM6A.js → trace-FXMXUZUF.js} +7 -7
  148. package/dist/uninstall-5PEVOE5B.js +408 -0
  149. package/dist/upgrade-M4WXY6KN.js +303 -0
  150. package/dist/{usage-ME5MPXGX.js → usage-N7ZNVLEM.js} +147 -102
  151. package/dist/{verifiers-BVZ7IWOO.js → verifiers-DJTP4XX6.js} +15 -15
  152. package/dist/{verify-5K7ZKQFC.js → verify-RWE4PPEK.js} +9 -9
  153. package/dist/{wiki-generate-F5W5QTYY.js → wiki-generate-C7IQOXSP.js} +84 -82
  154. package/dist/{with-panes-BYOJCLAM.js → with-panes-4GCGSL7J.js} +9 -9
  155. package/dist/worker/entry.js +61 -60
  156. package/docs/architecture/artifact-placement.md +1 -0
  157. package/docs/architecture/artifact-versions.md +1 -1
  158. package/docs/architecture/context-engine.md +4 -0
  159. package/docs/architecture/middleware-and-components.md +1 -1
  160. package/docs/architecture/model-catalog.md +21 -10
  161. package/docs/architecture/observability.md +12 -1
  162. package/docs/architecture/prompt-envelope-and-tools.md +2 -0
  163. package/docs/architecture/provider-adapter-cookbook.md +63 -0
  164. package/docs/architecture/safety-model.md +15 -5
  165. package/docs/guide/built-in-agents.md +17 -3
  166. package/docs/guide/commands-and-modes.md +1 -1
  167. package/docs/guide/configuration-and-targets.md +97 -9
  168. package/docs/guide/configuration-reference.md +7 -2
  169. package/docs/guide/environment-variables.md +2 -0
  170. package/docs/guide/installation-and-lifecycle.md +37 -4
  171. package/docs/guide/proactive-memory.md +66 -55
  172. package/docs/guide/skills-marketplace.md +18 -0
  173. package/docs/process/development-pipeline.md +34 -1
  174. package/docs/process/eval-runner.md +67 -3
  175. package/evals/behavioral-model.yaml +3 -2
  176. package/package.json +2 -2
  177. package/skills/README.md +7 -5
  178. package/skills/coding/ast-grep/SKILL.md +101 -30
  179. package/skills/coding/ast-grep/evals.md +26 -0
  180. package/skills/coding/coding-standards/SKILL.md +40 -5
  181. package/skills/coding/coding-standards/evals.md +23 -0
  182. package/skills/coding/prototype/SKILL.md +87 -28
  183. package/skills/coding/prototype/evals.md +19 -0
  184. package/skills/coding/tdd/SKILL.md +80 -53
  185. package/skills/coding/tdd/evals.md +20 -0
  186. package/skills/context/context-handoff/SKILL.md +43 -2
  187. package/skills/context/context-handoff/evals.md +44 -0
  188. package/skills/context/context-prime/SKILL.md +45 -15
  189. package/skills/context/context-prime/evals.md +45 -0
  190. package/skills/git/branch-closeout/SKILL.md +132 -0
  191. package/skills/git/branch-closeout/evals.md +133 -0
  192. package/skills/git/branch-closeout/references/closeout-checklist.md +81 -0
  193. package/skills/git/file-ticket/SKILL.md +77 -63
  194. package/skills/git/file-ticket/assets/issue-template.md +22 -0
  195. package/skills/git/file-ticket/evals.md +31 -26
  196. package/skills/git/file-ticket/references/issue-discovery.md +49 -0
  197. package/skills/git/fix-issue/SKILL.md +87 -64
  198. package/skills/git/fix-issue/evals.md +35 -31
  199. package/skills/git/fix-issue/references/diagnosis-and-rca.md +46 -0
  200. package/skills/git/resolve-merge-conflicts/SKILL.md +100 -51
  201. package/skills/git/resolve-merge-conflicts/evals.md +52 -25
  202. package/skills/git/resolve-merge-conflicts/references/conflict-matrix.md +126 -0
  203. package/skills/git/ship/SKILL.md +103 -67
  204. package/skills/git/ship/assets/pr-template.md +21 -0
  205. package/skills/git/ship/evals.md +44 -28
  206. package/skills/git/ship/references/remote-and-branch-policy.md +62 -0
  207. package/skills/git/worktree-create/SKILL.md +80 -50
  208. package/skills/git/worktree-create/evals.md +40 -33
  209. package/skills/git/worktree-create/references/worktree-setup.md +62 -66
  210. package/skills/git/worktree-merge/SKILL.md +112 -65
  211. package/skills/git/worktree-merge/evals.md +42 -34
  212. package/skills/git/worktree-merge/references/merge-strategies.md +52 -0
  213. package/skills/planning/archify/SKILL.md +196 -0
  214. package/skills/planning/archify/evals.md +65 -0
  215. package/skills/planning/architecture/SKILL.md +61 -12
  216. package/skills/planning/architecture/evals.md +65 -0
  217. package/skills/planning/backlog/SKILL.md +130 -14
  218. package/skills/planning/backlog/evals.md +142 -0
  219. package/skills/planning/prd/SKILL.md +46 -6
  220. package/skills/planning/prd/evals.md +54 -0
  221. package/skills/planning/product-intent/SKILL.md +57 -2
  222. package/skills/planning/product-intent/evals.md +70 -0
  223. package/skills/planning/tech-spec/SKILL.md +53 -2
  224. package/skills/planning/tech-spec/evals.md +73 -0
  225. package/skills/registry.yaml +58 -50
  226. package/skills/remote.yaml +13 -0
  227. package/skills/research/arxiv-literature/SKILL.md +76 -18
  228. package/skills/research/arxiv-literature/evals.md +50 -0
  229. package/skills/research/experiment-protocol/SKILL.md +20 -1
  230. package/skills/research/experiment-protocol/evals.md +23 -0
  231. package/skills/research/scientific-debugging/SKILL.md +23 -1
  232. package/skills/research/scientific-debugging/evals.md +18 -0
  233. package/skills/research/scientific-modernization/SKILL.md +26 -1
  234. package/skills/research/scientific-modernization/evals.md +27 -0
  235. package/skills/skill-marketplace.json +63 -28
  236. package/skills/workflow/cut-it/SKILL.md +65 -5
  237. package/skills/workflow/cut-it/evals.md +101 -0
  238. package/skills/workflow/design-council/SKILL.md +117 -27
  239. package/skills/workflow/design-council/evals.md +161 -0
  240. package/skills/workflow/grill-me/SKILL.md +86 -10
  241. package/skills/workflow/grill-me/evals.md +153 -0
  242. package/skills/workflow/workflow-distiller/SKILL.md +76 -17
  243. package/skills/workflow/workflow-distiller/evals.md +118 -0
  244. package/src/cli/configure-interop.ts +105 -13
  245. package/src/cli/configure-oauth.ts +57 -0
  246. package/src/cli/configure-onboarding.ts +980 -0
  247. package/src/cli/configure-target.ts +594 -0
  248. package/src/cli/configure.ts +1082 -528
  249. package/src/cli/context-map.ts +114 -0
  250. package/src/cli/context.ts +4 -0
  251. package/src/cli/index.ts +1 -0
  252. package/src/cli/lifecycle-presenter.ts +436 -0
  253. package/src/cli/models.ts +10 -2
  254. package/src/cli/modes/print.ts +5 -1
  255. package/src/cli/reset.ts +228 -106
  256. package/src/cli/run.ts +7 -2
  257. package/src/cli/select.ts +664 -0
  258. package/src/cli/skills.ts +9 -2
  259. package/src/cli/targets.ts +3 -0
  260. package/src/cli/uninstall.ts +233 -165
  261. package/src/cli/upgrade.ts +204 -149
  262. package/src/cli/usage.ts +86 -27
  263. package/src/cli/validate-model.ts +3 -3
  264. package/src/core/config.ts +56 -0
  265. package/src/core/external-diagnostic.ts +44 -0
  266. package/src/core/gateway-routing.ts +157 -0
  267. package/src/core/safe-exec.ts +17 -2
  268. package/src/core/skill-activation.ts +89 -2
  269. package/src/domains/agents/builtins/world-knowledge.md +31 -0
  270. package/src/domains/agents/catalog.ts +1 -1
  271. package/src/domains/agents/result-contract.ts +70 -0
  272. package/src/domains/context/wiki/map-seed.ts +589 -0
  273. package/src/domains/context/wiki/plan.ts +2 -2
  274. package/src/domains/dispatch/admission.ts +29 -0
  275. package/src/domains/dispatch/agent-candidates.ts +10 -0
  276. package/src/domains/dispatch/budget-envelope.ts +86 -1
  277. package/src/domains/dispatch/capability-match.ts +1 -0
  278. package/src/domains/dispatch/capacity-lease.ts +17 -0
  279. package/src/domains/dispatch/contract.ts +11 -1
  280. package/src/domains/dispatch/extension.ts +134 -29
  281. package/src/domains/dispatch/types.ts +3 -0
  282. package/src/domains/dispatch/worker-model-metadata.ts +38 -0
  283. package/src/domains/eval/metrics/call-ledger-stream.ts +34 -11
  284. package/src/domains/eval/metrics/token-stream.ts +201 -31
  285. package/src/domains/eval/metrics/tracked.ts +40 -4
  286. package/src/domains/eval/runners/clio-run.ts +5 -2
  287. package/src/domains/eval/schema/suite.ts +28 -0
  288. package/src/domains/eval/schema/verdict.ts +2 -2
  289. package/src/domains/eval/suites/resolve.ts +13 -1
  290. package/src/domains/eval/suites/run.ts +24 -3
  291. package/src/domains/interop/registry.ts +6 -2
  292. package/src/domains/interop/types.ts +4 -0
  293. package/src/domains/lifecycle/migrations/index.ts +4 -0
  294. package/src/domains/memory/task-memory-policy.ts +70 -26
  295. package/src/domains/memory/task-memory-telemetry.ts +1 -0
  296. package/src/domains/middleware/index.ts +0 -1
  297. package/src/domains/middleware/marketplace-offer.ts +3 -35
  298. package/src/domains/middleware/memory-intervention.ts +127 -32
  299. package/src/domains/middleware/memory-step-endpoint.ts +3 -2
  300. package/src/domains/middleware/skills-reminder.ts +31 -2
  301. package/src/domains/observability/compaction-usage.ts +118 -0
  302. package/src/domains/observability/cost.ts +1 -1
  303. package/src/domains/observability/extension.ts +6 -1
  304. package/src/domains/observability/out-of-turn-usage.ts +52 -21
  305. package/src/domains/providers/contract.ts +4 -1
  306. package/src/domains/providers/extension.ts +40 -9
  307. package/src/domains/providers/model-capabilities.ts +9 -0
  308. package/src/domains/providers/model-discovery.ts +2 -0
  309. package/src/domains/providers/model-runtime-capabilities.ts +15 -5
  310. package/src/domains/providers/models/local-models/clio-coder-local-coding-targets.yaml +32 -12
  311. package/src/domains/providers/runtimes/antigravity/antigravity-code.ts +225 -45
  312. package/src/domains/providers/runtimes/common/lmstudio-http.ts +6 -2
  313. package/src/domains/providers/runtimes/common/local-synth.ts +2 -0
  314. package/src/domains/providers/runtimes/protocol/litellm.ts +119 -29
  315. package/src/domains/providers/support.ts +11 -5
  316. package/src/domains/providers/target-model-cache.ts +25 -2
  317. package/src/domains/providers/types/capability-flags.ts +2 -0
  318. package/src/domains/providers/types/runtime-descriptor.ts +20 -1
  319. package/src/domains/providers/types/target-descriptor.ts +19 -0
  320. package/src/domains/resources/index.ts +3 -0
  321. package/src/domains/resources/skills/install.ts +72 -7
  322. package/src/domains/resources/skills/loader.ts +7 -0
  323. package/src/domains/resources/skills/marketplace.ts +63 -11
  324. package/src/domains/safety/autonomy.ts +15 -0
  325. package/src/domains/safety/index.ts +1 -0
  326. package/src/domains/safety/path-policy.ts +1 -1
  327. package/src/domains/safety/policy-engine.ts +34 -11
  328. package/src/domains/safety/protected-artifacts.ts +191 -88
  329. package/src/domains/safety/run-effects.ts +2 -22
  330. package/src/domains/safety/skill-authority.ts +55 -0
  331. package/src/domains/session/compaction/compact.ts +72 -22
  332. package/src/domains/session/entries.ts +6 -0
  333. package/src/domains/session/usage.ts +3 -3
  334. package/src/engine/agent.ts +13 -3
  335. package/src/engine/ai.ts +26 -8
  336. package/src/engine/antigravity/subprocess-runtime.ts +386 -120
  337. package/src/engine/api-registry.ts +3 -0
  338. package/src/engine/apis/openai-completions.ts +117 -14
  339. package/src/engine/external-subprocess.ts +114 -6
  340. package/src/entry/background-model-metadata.ts +18 -0
  341. package/src/entry/compaction-prompt.ts +57 -0
  342. package/src/entry/orchestrator.ts +405 -216
  343. package/src/entry/task-memory-lifecycle.ts +35 -0
  344. package/src/interactive/chat-loop-messages.ts +13 -4
  345. package/src/interactive/chat-loop.ts +65 -2
  346. package/src/interactive/chat-renderer.ts +1 -0
  347. package/src/interactive/cost-overlay.ts +26 -2
  348. package/src/interactive/interactive-slash-runtime.ts +2 -1
  349. package/src/interactive/renderers/worker-entry.ts +32 -0
  350. package/src/interactive/slash-commands.ts +24 -6
  351. package/src/interactive/theme/labels.ts +19 -13
  352. package/src/interactive/turn-context.ts +9 -5
  353. package/src/interactive/turn-recovery.ts +8 -0
  354. package/src/interactive/turn-runtime.ts +27 -11
  355. package/src/interactive/turn-state.ts +7 -0
  356. package/src/interactive/worker-receipts.ts +1 -0
  357. package/src/interactive/worker-stream.ts +6 -1
  358. package/src/tools/context/index.ts +30 -9
  359. package/src/tools/dispatch-arguments.ts +1 -0
  360. package/src/tools/dispatch-event-text.ts +10 -0
  361. package/src/tools/dispatch-plan.ts +1 -0
  362. package/src/tools/dispatch-runner.ts +12 -0
  363. package/src/tools/registry.ts +11 -5
  364. package/src/tools/worker-evidence.ts +3 -1
  365. package/src/worker/spec-contract.ts +4 -0
  366. package/dist/chunk-2Z2IKEXI.js +0 -1554
  367. package/dist/reset-OAQP3W4O.js +0 -230
  368. package/dist/uninstall-N34PCTGJ.js +0 -331
  369. package/dist/upgrade-PXK3S2YM.js +0 -325
@@ -1,11 +1,14 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
2
  import {
3
3
  EVAL_SUITE_V2_VERSION
4
- } from "./chunk-RKSR6VSF.js";
4
+ } from "./chunk-4IUZQIJ3.js";
5
5
  import {
6
6
  loadFragments,
7
7
  renderCodewikiDigest
8
- } from "./chunk-AZ4WMN4W.js";
8
+ } from "./chunk-Y3CBHOR6.js";
9
+ import {
10
+ discoverAgentRecipes
11
+ } from "./chunk-RRNP2ANY.js";
9
12
  import {
10
13
  EvalTaskFileError,
11
14
  TRUST_STATUS_AXES,
@@ -20,12 +23,11 @@ import {
20
23
  loadEvalTaskFile,
21
24
  summarizeTrustStatus,
22
25
  verifyReceiptIntegrity
23
- } from "./chunk-B74PXLU7.js";
26
+ } from "./chunk-IWT4SF4R.js";
24
27
  import {
25
28
  listSessionLedgerRefs,
26
29
  parseSessionEntries
27
- } from "./chunk-X7IARSHT.js";
28
- import "./chunk-3DPEIQKN.js";
30
+ } from "./chunk-JKKCYP3C.js";
29
31
  import {
30
32
  EVAL_BEHAVIOR_METRIC_DEFINITIONS_V1,
31
33
  EVAL_EXECUTION_ENVELOPE_SCHEMA_V1,
@@ -46,38 +48,60 @@ import {
46
48
  renderEvalServingConfiguration,
47
49
  sameEvalServingConfiguration,
48
50
  writeEvalArtifactV4
49
- } from "./chunk-5PFYMY2V.js";
51
+ } from "./chunk-FTMGRKEF.js";
50
52
  import "./chunk-W6GROXXM.js";
53
+ import "./chunk-RKKLTLYB.js";
51
54
  import {
52
55
  shellQuote
53
56
  } from "./chunk-TXOTCRLG.js";
57
+ import "./chunk-LDJG7DW3.js";
58
+ import "./chunk-NDDGJUXD.js";
59
+ import "./chunk-CE5AX47J.js";
60
+ import "./chunk-3DPEIQKN.js";
61
+ import "./chunk-7DRAWPTZ.js";
62
+ import "./chunk-5MEZN6CB.js";
63
+ import "./chunk-PUVDKJ2Y.js";
54
64
  import "./chunk-HVDIIIQW.js";
55
65
  import {
56
- discoverAgentRecipes
57
- } from "./chunk-CRFOIAX3.js";
58
- import "./chunk-O3YUNJZ2.js";
59
- import "./chunk-NDDGJUXD.js";
60
- import "./chunk-XGDPUNND.js";
61
- import "./chunk-RKKLTLYB.js";
62
- import "./chunk-HLAFFSEK.js";
63
- import "./chunk-77QIVUZB.js";
64
- import "./chunk-HIICAHCJ.js";
65
- import "./chunk-Q4XWMHX6.js";
66
+ printError
67
+ } from "./chunk-VPKWYKEY.js";
68
+ import "./chunk-5TSRNF4G.js";
69
+ import "./chunk-EKCHAPYA.js";
70
+ import "./chunk-L47TF46W.js";
66
71
  import {
67
72
  createSafetyPolicyEngine
68
- } from "./chunk-FVDGR2ZL.js";
73
+ } from "./chunk-XIVNBFZS.js";
69
74
  import "./chunk-H7IXIC72.js";
70
- import "./chunk-VN3SHNBN.js";
71
- import "./chunk-FSP7CMNU.js";
75
+ import "./chunk-7DICMOS6.js";
72
76
  import "./chunk-HHV2GANA.js";
73
77
  import {
74
78
  agentSpecFingerprint,
75
79
  normalizeAgentSpec
76
- } from "./chunk-PGF63K6I.js";
77
- import "./chunk-IKOZFYBN.js";
80
+ } from "./chunk-B4OAX3SI.js";
81
+ import "./chunk-I7ZPNEJM.js";
82
+ import "./chunk-GYV6VZOC.js";
78
83
  import "./chunk-UL3WSD3F.js";
79
84
  import "./chunk-ECH6PKUQ.js";
85
+ import "./chunk-JGRC33J2.js";
80
86
  import "./chunk-K6BSR66V.js";
87
+ import "./chunk-CFGTUFWB.js";
88
+ import {
89
+ extractReasoningTokens
90
+ } from "./chunk-NZMNUPZZ.js";
91
+ import "./chunk-HAXOFFRH.js";
92
+ import {
93
+ InvalidIdError
94
+ } from "./chunk-R346GLFC.js";
95
+ import "./chunk-KXDSS5WJ.js";
96
+ import "./chunk-GHS5EBTQ.js";
97
+ import {
98
+ namingCompatibilityEnvironment
99
+ } from "./chunk-D7E7WCDF.js";
100
+ import {
101
+ normalizeClioCoderEventRecord,
102
+ normalizeClioCoderEventType
103
+ } from "./chunk-BTK3SSSK.js";
104
+ import "./chunk-F4EKGO4N.js";
81
105
  import {
82
106
  readCodewiki,
83
107
  structuralCodewikiHash
@@ -90,50 +114,27 @@ import {
90
114
  } from "./chunk-33YXPOE3.js";
91
115
  import "./chunk-7CR24IG7.js";
92
116
  import "./chunk-XPLRXC72.js";
93
- import "./chunk-ZW55JB7N.js";
94
- import {
95
- printError
96
- } from "./chunk-VPKWYKEY.js";
97
- import "./chunk-5TSRNF4G.js";
98
- import "./chunk-CFGTUFWB.js";
99
- import {
100
- extractReasoningTokens
101
- } from "./chunk-CWVRRIEI.js";
102
- import "./chunk-MQXIVJ35.js";
103
- import {
104
- InvalidIdError
105
- } from "./chunk-R346GLFC.js";
106
- import {
107
- normalizeClioCoderEventRecord,
108
- normalizeClioCoderEventType
109
- } from "./chunk-BTK3SSSK.js";
110
- import "./chunk-IHXBNWMM.js";
111
- import "./chunk-34BHNEE3.js";
112
- import {
113
- namingCompatibilityEnvironment
114
- } from "./chunk-D7E7WCDF.js";
115
- import "./chunk-HJWWJ6IL.js";
116
- import "./chunk-F4EKGO4N.js";
117
- import "./chunk-JIEGK6UF.js";
118
- import "./chunk-EBY63B7G.js";
119
- import "./chunk-6EJMN2Y3.js";
120
117
  import "./chunk-IWHMRKLL.js";
121
118
  import "./chunk-UXCU4E3T.js";
122
119
  import "./chunk-LL4KHSZI.js";
120
+ import "./chunk-JSC3U7TI.js";
123
121
  import "./chunk-S66XZJOF.js";
124
- import "./chunk-WNP7O5WZ.js";
122
+ import "./chunk-JIEGK6UF.js";
123
+ import "./chunk-EBY63B7G.js";
124
+ import "./chunk-6EJMN2Y3.js";
125
+ import "./chunk-ID64D7PE.js";
125
126
  import "./chunk-336NSSKI.js";
126
127
  import "./chunk-IKCO5N3L.js";
127
128
  import "./chunk-3I7MS7N2.js";
128
129
  import {
129
130
  require_dist
130
131
  } from "./chunk-APJ265NV.js";
132
+ import "./chunk-WEPFGWHJ.js";
133
+ import "./chunk-YXLYO42X.js";
131
134
  import {
132
135
  clioDataDir,
133
136
  clioStateDir
134
137
  } from "./chunk-BYP5D4HI.js";
135
- import "./chunk-WEPFGWHJ.js";
136
- import "./chunk-YXLYO42X.js";
137
138
  import {
138
139
  __toESM,
139
140
  init_esm_shims
@@ -1466,7 +1467,15 @@ function artifactMatrixIdentity(targets) {
1466
1467
  }
1467
1468
  function resolveTargets(targets, options) {
1468
1469
  const filtered = options.target === void 0 ? [...targets] : targets.filter((target) => target.id === options.target);
1469
- const selected = filtered.length > 0 ? filtered : options.target === void 0 ? [...targets] : [{ id: options.target }];
1470
+ const selected = filtered.length > 0 ? filtered : options.target === void 0 ? [...targets] : [
1471
+ {
1472
+ id: options.target,
1473
+ // A one-row suite still owns its thinking dimension when the CLI
1474
+ // substitutes the target/model pair. Dropping it silently changes
1475
+ // an off baseline into the target's configured default.
1476
+ ...targets.length === 1 && targets[0]?.thinking !== void 0 ? { thinking: targets[0].thinking } : {}
1477
+ }
1478
+ ];
1470
1479
  return selected.map((target) => ({
1471
1480
  ...target,
1472
1481
  ...options.model === void 0 ? {} : { model: options.model }
@@ -2285,6 +2294,16 @@ function zeroToolCallMetrics() {
2285
2294
  init_esm_shims();
2286
2295
  import { readFile as readFile2 } from "node:fs/promises";
2287
2296
  import { dirname as dirname2, join as join2 } from "node:path";
2297
+ function selectEvalLedgerEntries(durable, stream) {
2298
+ const sessionCalls = assistantCalls(durable).length;
2299
+ const streamCalls = assistantCalls(stream).length;
2300
+ return {
2301
+ entries: sessionCalls > 0 ? durable : [...durable, ...stream],
2302
+ source: sessionCalls > 0 ? "session" : "stream",
2303
+ sessionCalls,
2304
+ streamCalls
2305
+ };
2306
+ }
2288
2307
  async function readEvalLedgerSnapshot(stateDir) {
2289
2308
  const refs = await listSessionLedgerRefs(stateDir);
2290
2309
  const entries = [];
@@ -2384,7 +2403,7 @@ function emptyEvalTrackedMetrics(source = "estimated") {
2384
2403
  reasoningTokens: { value: null, source },
2385
2404
  toolCalls: zero(),
2386
2405
  toolErrors: zero(),
2387
- ttftMsFirstCall: zero(),
2406
+ ttftMsFirstCall: { value: null, source: "estimated" },
2388
2407
  wallClockMs: zero(),
2389
2408
  contextTokensAtEnd: zero(),
2390
2409
  compactions: zero(),
@@ -2400,6 +2419,7 @@ function assistantCalls(entries) {
2400
2419
  if (promptCache === null && timing === null && usage === null) return [];
2401
2420
  return [
2402
2421
  {
2422
+ timestamp: entry.payload.timestampEstimated === true ? null : entry.timestamp,
2403
2423
  payload: entry.payload,
2404
2424
  promptCache,
2405
2425
  backend: promptCache === null ? null : recordField(promptCache, "backend"),
@@ -2459,9 +2479,19 @@ function reasoningMetric(receipt, calls, compactionUsage) {
2459
2479
  return measured ? { value: total, source: "ledger" } : { value: null, source: "estimated" };
2460
2480
  }
2461
2481
  function firstCallTtft(calls) {
2462
- const first = calls[0];
2482
+ let first;
2483
+ let firstAt = Number.POSITIVE_INFINITY;
2484
+ for (const call of calls) {
2485
+ if (call.timestamp === null) return { value: null, source: "estimated" };
2486
+ const at = Date.parse(call.timestamp);
2487
+ if (!Number.isFinite(at)) return { value: null, source: "estimated" };
2488
+ if (at < firstAt) {
2489
+ first = call;
2490
+ firstAt = at;
2491
+ }
2492
+ }
2463
2493
  const value = first?.timing === null || first?.timing === void 0 ? null : nonNegativeNumber(first.timing.ttftMs);
2464
- return value === null ? { value: 0, source: "estimated" } : { value, source: "ledger" };
2494
+ return value === null ? { value: null, source: "estimated" } : { value, source: "ledger" };
2465
2495
  }
2466
2496
  function wallClockMetric(receipt, fallback) {
2467
2497
  if (receipt !== null) {
@@ -2665,13 +2695,15 @@ init_esm_shims();
2665
2695
  var UNMEASURED_TOKEN_USAGE = {
2666
2696
  measured: false,
2667
2697
  tokens: { input: 0, output: 0, total: 0, cacheRead: 0, cacheWrite: 0 },
2668
- costUsd: 0
2698
+ costUsd: 0,
2699
+ provider: emptyProviderObservation()
2669
2700
  };
2670
2701
  function createTokenUsageFold() {
2671
2702
  const tokens = { input: 0, output: 0, total: 0, cacheRead: 0, cacheWrite: 0 };
2672
2703
  let costUsd = 0;
2673
2704
  let measured = false;
2674
2705
  let pending = "";
2706
+ const provider = emptyProviderObservation();
2675
2707
  const consume = (line) => {
2676
2708
  if (line.trim().length === 0) return;
2677
2709
  let event;
@@ -2680,23 +2712,16 @@ function createTokenUsageFold() {
2680
2712
  } catch {
2681
2713
  return;
2682
2714
  }
2683
- if (!isRecord6(event) || event.type !== "message_end") return;
2684
- const message = isRecord6(event.message) ? event.message : void 0;
2685
- if (message === void 0 || message.role !== "assistant") return;
2686
- const usage = isRecord6(message.usage) ? message.usage : void 0;
2687
- if (usage === void 0) return;
2688
- measured = true;
2689
- const input = numberField2(usage, "input");
2690
- const output = numberField2(usage, "output");
2691
- const cacheRead = numberField2(usage, "cacheRead");
2692
- const cacheWrite = numberField2(usage, "cacheWrite");
2693
- const totalTokens = numberField2(usage, "totalTokens");
2694
- tokens.input += input;
2695
- tokens.output += output;
2696
- tokens.cacheRead += cacheRead;
2697
- tokens.cacheWrite += cacheWrite;
2698
- tokens.total += totalTokens > 0 ? totalTokens : input + output + cacheRead + cacheWrite;
2699
- if (isRecord6(usage.cost)) costUsd += numberField2(usage.cost, "total");
2715
+ if (!isRecord6(event)) return;
2716
+ observeProviderEvent(provider, event);
2717
+ if (event.type !== "message_end" || !isRecord6(event.message) || event.message.role !== "assistant") return;
2718
+ const usage = readMessageUsage(event.message);
2719
+ if (usage === null) return;
2720
+ if (Object.keys(usage.tokens).length > 0) {
2721
+ measured = true;
2722
+ for (const field of TOKEN_FIELDS) tokens[field] += usage.tokens[field] ?? 0;
2723
+ }
2724
+ costUsd += usage.costUsd ?? 0;
2700
2725
  };
2701
2726
  return {
2702
2727
  push(chunk) {
@@ -2713,7 +2738,7 @@ function createTokenUsageFold() {
2713
2738
  consume(pending.replace(/\r$/u, ""));
2714
2739
  pending = "";
2715
2740
  }
2716
- return { measured, tokens: { ...tokens }, costUsd };
2741
+ return { measured, tokens: { ...tokens }, costUsd, provider: structuredClone(provider) };
2717
2742
  }
2718
2743
  };
2719
2744
  }
@@ -2727,24 +2752,145 @@ function addTokenStreamUsage(left, right) {
2727
2752
  cacheRead: left.tokens.cacheRead + right.tokens.cacheRead,
2728
2753
  cacheWrite: left.tokens.cacheWrite + right.tokens.cacheWrite
2729
2754
  },
2730
- costUsd: left.costUsd + right.costUsd
2755
+ costUsd: left.costUsd + right.costUsd,
2756
+ provider: addProviderObservations(left.provider, right.provider)
2731
2757
  };
2732
2758
  }
2733
2759
  function tokenMetricEntries(usage) {
2734
- if (!usage.measured) return { "tokens.measured": false };
2735
2760
  return {
2736
- "tokens.measured": true,
2737
- "tokens.input": usage.tokens.input,
2738
- "tokens.output": usage.tokens.output,
2739
- "tokens.total": usage.tokens.total,
2740
- "tokens.cacheRead": usage.tokens.cacheRead,
2741
- "tokens.cacheWrite": usage.tokens.cacheWrite,
2761
+ ...providerMetricEntries(usage.provider),
2762
+ "tokens.measured": usage.measured,
2763
+ ...usage.measured ? {
2764
+ "tokens.input": usage.tokens.input,
2765
+ "tokens.output": usage.tokens.output,
2766
+ "tokens.total": usage.tokens.total,
2767
+ "tokens.cacheRead": usage.tokens.cacheRead,
2768
+ "tokens.cacheWrite": usage.tokens.cacheWrite
2769
+ } : {},
2742
2770
  ...usage.costUsd > 0 ? { "cost.usd": usage.costUsd } : {}
2743
2771
  };
2744
2772
  }
2745
- function numberField2(record, field) {
2746
- const value = record[field];
2747
- return typeof value === "number" && Number.isFinite(value) ? value : 0;
2773
+ var TOKEN_FIELDS = ["input", "output", "total", "cacheRead", "cacheWrite"];
2774
+ var STOP_REASONS = ["stop", "toolUse", "length", "error", "aborted", "other"];
2775
+ var RETRY_PHASES = {
2776
+ scheduled: "retryScheduled",
2777
+ retrying: "retryStarted",
2778
+ cancelled: "retryCancelled",
2779
+ exhausted: "retryExhausted",
2780
+ recovered: "retryRecovered"
2781
+ };
2782
+ function emptyProviderObservation() {
2783
+ return {
2784
+ measured: false,
2785
+ stops: { stop: 0, toolUse: 0, length: 0, error: 0, aborted: 0, other: 0 },
2786
+ retries: { scheduled: 0, retrying: 0, cancelled: 0, exhausted: 0, recovered: 0 },
2787
+ errorUsageObservedCalls: 0,
2788
+ errorUsageUnobservedCalls: 0,
2789
+ errorUsageIncompleteCalls: 0,
2790
+ errorCostUnobservedCalls: 0,
2791
+ errorReasoningUnobservedCalls: 0,
2792
+ errorReasoningTokens: null,
2793
+ errorTokens: {},
2794
+ errorCostUsd: null
2795
+ };
2796
+ }
2797
+ function readMessageUsage(message) {
2798
+ if (!isRecord6(message.usage)) return null;
2799
+ const usage = message.usage;
2800
+ const failed = message.stopReason === "error" || message.stopReason === "aborted";
2801
+ const raw = {};
2802
+ for (const field of TOKEN_FIELDS) {
2803
+ const value = nonNegativeNumber2(usage[field === "total" ? "totalTokens" : field]);
2804
+ if (value !== null && (!failed || value > 0)) raw[field] = value;
2805
+ }
2806
+ const cost = isRecord6(usage.cost) ? nonNegativeNumber2(usage.cost.total) : null;
2807
+ const costUsd = cost !== null && cost > 0 ? cost : null;
2808
+ const reportedReasoning = extractReasoningTokens({ ...usage, reasoningTokens: void 0 });
2809
+ const reasoningTokens = reportedReasoning !== null && reportedReasoning > 0 ? reportedReasoning : null;
2810
+ const tokens = raw;
2811
+ if (Object.keys(tokens).length === 0 && costUsd === null && reasoningTokens === null) return null;
2812
+ const completeTokens = Object.keys(tokens).length === TOKEN_FIELDS.length;
2813
+ if (Object.keys(tokens).length > 0 && !(tokens.total !== void 0 && tokens.total > 0)) {
2814
+ tokens.total = (tokens.input ?? 0) + (tokens.output ?? 0) + (tokens.cacheRead ?? 0) + (tokens.cacheWrite ?? 0);
2815
+ }
2816
+ return { tokens, costUsd, completeTokens, reasoningTokens };
2817
+ }
2818
+ function observeProviderEvent(provider, event) {
2819
+ if (event.type === "retry_status" && isRecord6(event.status)) {
2820
+ const phase = event.status.phase;
2821
+ if (typeof phase === "string" && Object.hasOwn(RETRY_PHASES, phase)) {
2822
+ provider.measured = true;
2823
+ provider.retries[phase] += 1;
2824
+ }
2825
+ return;
2826
+ }
2827
+ if (event.type !== "message_end" || !isRecord6(event.message) || event.message.role !== "assistant") return;
2828
+ const reason = event.message.stopReason;
2829
+ if (typeof reason !== "string" || reason.length === 0 || reason === "pending") return;
2830
+ provider.measured = true;
2831
+ const stop = STOP_REASONS.includes(reason) ? reason : "other";
2832
+ provider.stops[stop] += 1;
2833
+ if (reason !== "error") return;
2834
+ const usage = readMessageUsage(event.message);
2835
+ if (usage === null) provider.errorUsageUnobservedCalls += 1;
2836
+ else {
2837
+ provider.errorUsageObservedCalls += 1;
2838
+ for (const field of TOKEN_FIELDS) {
2839
+ const value = usage.tokens[field];
2840
+ if (value !== void 0) provider.errorTokens[field] = (provider.errorTokens[field] ?? 0) + value;
2841
+ }
2842
+ }
2843
+ if (usage?.completeTokens !== true) provider.errorUsageIncompleteCalls += 1;
2844
+ if (usage?.costUsd === void 0 || usage.costUsd === null) provider.errorCostUnobservedCalls += 1;
2845
+ else provider.errorCostUsd = (provider.errorCostUsd ?? 0) + usage.costUsd;
2846
+ if (usage?.reasoningTokens === void 0 || usage.reasoningTokens === null)
2847
+ provider.errorReasoningUnobservedCalls += 1;
2848
+ else provider.errorReasoningTokens = (provider.errorReasoningTokens ?? 0) + usage.reasoningTokens;
2849
+ }
2850
+ function addProviderObservations(left, right) {
2851
+ const result = emptyProviderObservation();
2852
+ result.measured = left.measured || right.measured;
2853
+ for (const reason of STOP_REASONS) result.stops[reason] = left.stops[reason] + right.stops[reason];
2854
+ for (const phase of Object.keys(RETRY_PHASES))
2855
+ result.retries[phase] = left.retries[phase] + right.retries[phase];
2856
+ result.errorUsageObservedCalls = left.errorUsageObservedCalls + right.errorUsageObservedCalls;
2857
+ result.errorUsageUnobservedCalls = left.errorUsageUnobservedCalls + right.errorUsageUnobservedCalls;
2858
+ result.errorUsageIncompleteCalls = left.errorUsageIncompleteCalls + right.errorUsageIncompleteCalls;
2859
+ result.errorCostUnobservedCalls = left.errorCostUnobservedCalls + right.errorCostUnobservedCalls;
2860
+ result.errorReasoningUnobservedCalls = left.errorReasoningUnobservedCalls + right.errorReasoningUnobservedCalls;
2861
+ if (left.errorReasoningTokens !== null || right.errorReasoningTokens !== null)
2862
+ result.errorReasoningTokens = (left.errorReasoningTokens ?? 0) + (right.errorReasoningTokens ?? 0);
2863
+ for (const field of TOKEN_FIELDS) {
2864
+ if (left.errorTokens[field] !== void 0 || right.errorTokens[field] !== void 0) {
2865
+ result.errorTokens[field] = (left.errorTokens[field] ?? 0) + (right.errorTokens[field] ?? 0);
2866
+ }
2867
+ }
2868
+ if (left.errorCostUsd !== null || right.errorCostUsd !== null)
2869
+ result.errorCostUsd = (left.errorCostUsd ?? 0) + (right.errorCostUsd ?? 0);
2870
+ return result;
2871
+ }
2872
+ function providerMetricEntries(provider) {
2873
+ if (!provider.measured) return { "provider.measured": false };
2874
+ const metrics = { "provider.measured": true };
2875
+ for (const reason of STOP_REASONS) metrics[`provider.stopReason.${reason}`] = provider.stops[reason];
2876
+ for (const phase of Object.keys(RETRY_PHASES))
2877
+ metrics[`provider.${RETRY_PHASES[phase]}`] = provider.retries[phase];
2878
+ if (provider.stops.error === 0) return metrics;
2879
+ metrics["provider.errorUsageObservedCalls"] = provider.errorUsageObservedCalls;
2880
+ metrics["provider.errorUsageUnobservedCalls"] = provider.errorUsageUnobservedCalls;
2881
+ metrics["provider.errorUsageIncompleteCalls"] = provider.errorUsageIncompleteCalls;
2882
+ metrics["provider.errorCostUnobservedCalls"] = provider.errorCostUnobservedCalls;
2883
+ metrics["provider.errorReasoningUnobservedCalls"] = provider.errorReasoningUnobservedCalls;
2884
+ if (provider.errorReasoningTokens !== null) metrics["provider.errorReasoningTokens"] = provider.errorReasoningTokens;
2885
+ for (const field of TOKEN_FIELDS) {
2886
+ const value = provider.errorTokens[field];
2887
+ if (value !== void 0) metrics[`provider.errorTokens.${field}`] = value;
2888
+ }
2889
+ if (provider.errorCostUsd !== null) metrics["provider.errorCostUsd"] = provider.errorCostUsd;
2890
+ return metrics;
2891
+ }
2892
+ function nonNegativeNumber2(value) {
2893
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
2748
2894
  }
2749
2895
  function isRecord6(value) {
2750
2896
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -2771,7 +2917,7 @@ function createEvalCallLedgerFold(now = () => performance.now()) {
2771
2917
  activeFirstOutputAt = null;
2772
2918
  return;
2773
2919
  }
2774
- if (event.type === "message_update" && activeStartedAt !== null && activeFirstOutputAt === null) {
2920
+ if (isAssistantOutput(event) && activeStartedAt !== null && activeFirstOutputAt === null) {
2775
2921
  activeFirstOutputAt = now();
2776
2922
  return;
2777
2923
  }
@@ -2785,24 +2931,28 @@ function createEvalCallLedgerFold(now = () => performance.now()) {
2785
2931
  }
2786
2932
  const endedAt = now();
2787
2933
  const promptCache = {
2788
- input: nonNegativeNumber2(usage.input) ?? 0,
2789
- cacheRead: nonNegativeNumber2(usage.cacheRead) ?? 0,
2790
- cacheWrite: nonNegativeNumber2(usage.cacheWrite) ?? 0,
2934
+ input: nonNegativeNumber3(usage.input) ?? 0,
2935
+ cacheRead: nonNegativeNumber3(usage.cacheRead) ?? 0,
2936
+ cacheWrite: nonNegativeNumber3(usage.cacheWrite) ?? 0,
2791
2937
  backendVerdict: "unknown"
2792
2938
  };
2793
2939
  if (isRecord7(message.backendTimings)) promptCache.backend = structuredClone(message.backendTimings);
2794
2940
  const previous = entries.at(-1);
2941
+ const timestamp = messageTimestamp(message.timestamp);
2795
2942
  entries.push({
2796
2943
  kind: "message",
2797
2944
  role: "assistant",
2798
2945
  turnId: `eval-call-${entries.length + 1}`,
2799
2946
  parentTurnId: previous?.turnId ?? null,
2800
- timestamp: messageTimestamp(message.timestamp),
2947
+ timestamp: timestamp ?? (/* @__PURE__ */ new Date(0)).toISOString(),
2801
2948
  payload: {
2949
+ // Retain the legacy ISO placeholder without treating it as observed
2950
+ // chronology. Per-call monotonic timing remains usable on its own.
2951
+ ...timestamp === null ? { timestampEstimated: true } : {},
2802
2952
  promptCache,
2803
- timing: {
2804
- ttftMs: activeStartedAt === null ? null : Math.round(Math.max(0, (activeFirstOutputAt ?? endedAt) - activeStartedAt)),
2805
- apiMs: activeStartedAt === null ? 0 : Math.round(Math.max(0, endedAt - activeStartedAt))
2953
+ timing: activeStartedAt === null ? null : {
2954
+ ttftMs: activeFirstOutputAt === null ? null : Math.round(Math.max(0, activeFirstOutputAt - activeStartedAt)),
2955
+ apiMs: Math.round(Math.max(0, endedAt - activeStartedAt))
2806
2956
  },
2807
2957
  usage: structuredClone(usage)
2808
2958
  }
@@ -2829,16 +2979,22 @@ function createEvalCallLedgerFold(now = () => performance.now()) {
2829
2979
  }
2830
2980
  };
2831
2981
  }
2982
+ function isAssistantOutput(event) {
2983
+ const output = event.type === "message_update" ? event.assistantMessageEvent : event;
2984
+ if (!isRecord7(output)) return false;
2985
+ if (output.type === "toolcall_start") return event.type === "message_update";
2986
+ return (output.type === "text_delta" || output.type === "thinking_delta" || output.type === "toolcall_delta") && typeof output.delta === "string" && output.delta.length > 0;
2987
+ }
2832
2988
  function isAssistantMessage(value) {
2833
2989
  return isRecord7(value) && value.role === "assistant";
2834
2990
  }
2835
2991
  function messageTimestamp(value) {
2836
- const milliseconds = nonNegativeNumber2(value);
2837
- if (milliseconds === null) return (/* @__PURE__ */ new Date(0)).toISOString();
2992
+ const milliseconds = nonNegativeNumber3(value);
2993
+ if (milliseconds === null) return null;
2838
2994
  const date = new Date(milliseconds);
2839
- return Number.isFinite(date.getTime()) ? date.toISOString() : (/* @__PURE__ */ new Date(0)).toISOString();
2995
+ return Number.isFinite(date.getTime()) ? date.toISOString() : null;
2840
2996
  }
2841
- function nonNegativeNumber2(value) {
2997
+ function nonNegativeNumber3(value) {
2842
2998
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
2843
2999
  }
2844
3000
  function parseRecord(line) {
@@ -3227,16 +3383,19 @@ function toolBehaviorMetricEntriesFromJsonl(stdout, cwd, readObservation) {
3227
3383
  }
3228
3384
  const terminals = canonicalFinishes.length > 0 ? canonicalFinishes : executionEnds;
3229
3385
  const calls = /* @__PURE__ */ new Map();
3386
+ const succeeded = /* @__PURE__ */ new Map();
3230
3387
  const blocked = /* @__PURE__ */ new Map();
3231
3388
  for (const terminal of terminals) {
3232
3389
  const tool = metricToolName(terminal.tool);
3233
3390
  calls.set(tool, (calls.get(tool) ?? 0) + 1);
3391
+ if (terminal.outcome === "ok") succeeded.set(tool, (succeeded.get(tool) ?? 0) + 1);
3234
3392
  if (terminal.outcome === "blocked") blocked.set(tool, (blocked.get(tool) ?? 0) + 1);
3235
3393
  }
3236
- const namedTools = /* @__PURE__ */ new Set(["bash", "dispatch", "read", ...calls.keys(), ...blocked.keys()]);
3394
+ const namedTools = /* @__PURE__ */ new Set(["bash", "dispatch", "read", ...calls.keys(), ...succeeded.keys(), ...blocked.keys()]);
3237
3395
  const entries = { "tools.read.distinctPaths": readPaths.size };
3238
3396
  for (const tool of [...namedTools].sort()) {
3239
3397
  entries[`tools.calls.${tool}`] = calls.get(tool) ?? 0;
3398
+ entries[`tools.succeeded.${tool}`] = succeeded.get(tool) ?? 0;
3240
3399
  entries[`tools.blocked.${tool}`] = blocked.get(tool) ?? 0;
3241
3400
  }
3242
3401
  if (readObservation !== void 0) {
@@ -3378,21 +3537,21 @@ async function runContextInitRunner(runner, cwd, clioEntry, timeoutMs, target, e
3378
3537
  wallTimeMs: result.wallTimeMs,
3379
3538
  metrics: {
3380
3539
  "latency.wallMs": result.wallTimeMs,
3381
- "latency.modelMs": numberField3(run, "durationMs"),
3382
- "tokens.input": numberField3(tokens, "input"),
3383
- "tokens.output": numberField3(tokens, "output"),
3384
- "tokens.total": numberField3(tokens, "total"),
3385
- "tokens.cacheRead": numberField3(tokens, "cacheRead"),
3386
- "tokens.cacheWrite": numberField3(tokens, "cacheWrite"),
3387
- "tools.totalCalls": numberField3(run, "toolCalls"),
3388
- "tools.failed": numberField3(run, "toolFailures"),
3389
- "tools.blocked": numberField3(run, "toolBlocked"),
3540
+ "latency.modelMs": numberField2(run, "durationMs"),
3541
+ "tokens.input": numberField2(tokens, "input"),
3542
+ "tokens.output": numberField2(tokens, "output"),
3543
+ "tokens.total": numberField2(tokens, "total"),
3544
+ "tokens.cacheRead": numberField2(tokens, "cacheRead"),
3545
+ "tokens.cacheWrite": numberField2(tokens, "cacheWrite"),
3546
+ "tools.totalCalls": numberField2(run, "toolCalls"),
3547
+ "tools.failed": numberField2(run, "toolFailures"),
3548
+ "tools.blocked": numberField2(run, "toolBlocked"),
3390
3549
  "context.clioMdBytes": clioMdBytes,
3391
3550
  "context.initMode": stringField3(generation, "mode") ?? "unknown",
3392
3551
  "context.initParserOutcome": stringField3(generation, "parserOutcome") ?? "unknown",
3393
3552
  "context.initFallback": stringField3(generation, "fallbackReason") !== null,
3394
- "context.initPromptBytes": numberField3(run, "promptBytes"),
3395
- "context.initOutputBytes": numberField3(run, "outputBytes"),
3553
+ "context.initPromptBytes": numberField2(run, "promptBytes"),
3554
+ "context.initOutputBytes": numberField2(run, "outputBytes"),
3396
3555
  "context.initTargetId": effectiveTarget,
3397
3556
  "context.initModelId": effectiveModel,
3398
3557
  "context.initRuntimeId": effectiveRuntime,
@@ -3491,7 +3650,7 @@ function recordField2(value, field) {
3491
3650
  const selected = field && typeof value === "object" && value !== null && !Array.isArray(value) ? value[field] : value;
3492
3651
  return typeof selected === "object" && selected !== null && !Array.isArray(selected) ? selected : null;
3493
3652
  }
3494
- function numberField3(value, field) {
3653
+ function numberField2(value, field) {
3495
3654
  const record = recordField2(value);
3496
3655
  const selected = record?.[field];
3497
3656
  return typeof selected === "number" && Number.isFinite(selected) ? selected : null;
@@ -3916,11 +4075,23 @@ async function runMatrixItem(loaded, task, target, repeatIndex, clioEntry, fresh
3916
4075
  }
3917
4076
  };
3918
4077
  const snapshot = await readEvalLedgerSnapshot(stateDir);
3919
- const ledgerEntries = [...snapshot.entries, ...runner.ledgerEntries ?? []];
4078
+ const selected = selectEvalLedgerEntries(snapshot.entries, runner.ledgerEntries ?? []);
4079
+ result.artifacts.trackedMetricSources = JSON.stringify({
4080
+ assistantCalls: selected.source,
4081
+ sessionCalls: selected.sessionCalls,
4082
+ streamCalls: selected.streamCalls,
4083
+ compactions: "session"
4084
+ });
4085
+ if (selected.sessionCalls > 0 && selected.streamCalls > 0) {
4086
+ result.artifacts.callLedger ??= JSON.stringify(runner.ledgerEntries);
4087
+ if (selected.sessionCalls !== selected.streamCalls || task.runner.kind === "external-command") {
4088
+ result.artifacts.trackedMetricWarning = "Session and stream call coverage may differ; tracked metrics use session calls, not a reconciled union. Inspect callLedger before treating these counts as complete: no shared call identity proves overlap.";
4089
+ }
4090
+ }
3920
4091
  result.verdict = adaptSuiteV2ResultToVerdictV1(
3921
4092
  result,
3922
4093
  buildEvalTrackedMetrics({
3923
- ledgerEntries,
4094
+ ledgerEntries: selected.entries,
3924
4095
  receipt: receipt ?? null,
3925
4096
  fallbackWallClockMs: runner.wallTimeMs
3926
4097
  })
@@ -4326,7 +4497,7 @@ function parseEvalArgs(args) {
4326
4497
  }
4327
4498
  async function runEvalCommand(args) {
4328
4499
  if (args[0] === "inventory") {
4329
- const { runEvalInventory } = await import("./eval-inventory-6DEJPLBF.js");
4500
+ const { runEvalInventory } = await import("./eval-inventory-Y6QRFOH5.js");
4330
4501
  return runEvalInventory(args.slice(1));
4331
4502
  }
4332
4503
  let parsed;
@@ -4501,4 +4672,4 @@ function comparisonFormat(value) {
4501
4672
  export {
4502
4673
  runEvalCommand
4503
4674
  };
4504
- //# sourceMappingURL=eval-C45FYRJ6.js.map
4675
+ //# sourceMappingURL=eval-7G7SGAYO.js.map
@@ -2,19 +2,19 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
2
2
  import {
3
3
  CANONICAL_METRICS,
4
4
  CANONICAL_METRIC_PREFIXES
5
- } from "./chunk-RKSR6VSF.js";
5
+ } from "./chunk-4IUZQIJ3.js";
6
6
  import {
7
7
  EVAL_EXECUTION_MATRIX_DIMENSIONS_V1,
8
8
  evalRoot,
9
9
  evalServingConfigurationOf,
10
10
  loadEvalArtifactV4,
11
11
  sameEvalServingConfiguration
12
- } from "./chunk-5PFYMY2V.js";
12
+ } from "./chunk-FTMGRKEF.js";
13
13
  import "./chunk-R346GLFC.js";
14
+ import "./chunk-WEPFGWHJ.js";
14
15
  import {
15
16
  clioDataDir
16
17
  } from "./chunk-BYP5D4HI.js";
17
- import "./chunk-WEPFGWHJ.js";
18
18
  import {
19
19
  init_esm_shims
20
20
  } from "./chunk-3R73A4XB.js";
@@ -312,4 +312,4 @@ export {
312
312
  EVAL_INVENTORY_MAX_SCENARIOS,
313
313
  runEvalInventory
314
314
  };
315
- //# sourceMappingURL=eval-inventory-6DEJPLBF.js.map
315
+ //# sourceMappingURL=eval-inventory-Y6QRFOH5.js.map