@iowarp/clio-coder 0.3.8 → 0.3.9

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 (333) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +7 -3
  3. package/dist/{acp-U67UHUK2.js → acp-7LOELQFP.js} +6 -6
  4. package/dist/{agents-YU6SGALZ.js → agents-FIBG2SHA.js} +27 -25
  5. package/dist/assets/codewiki.json +1 -1
  6. package/dist/{auth-5ZPJOIVG.js → auth-OI4LIH2I.js} +11 -12
  7. package/dist/{builtins-C6JMZVV6.js → builtins-AD25UL3C.js} +5 -5
  8. package/dist/{chunk-5FR74PWO.js → chunk-2JDWVJND.js} +2 -2
  9. package/dist/chunk-3DPEIQKN.js +113 -0
  10. package/dist/{chunk-4SPRNWDE.js → chunk-3DUR4WUA.js} +15 -15
  11. package/dist/{chunk-VHN4MY6O.js → chunk-3MRC2YSQ.js} +2 -2
  12. package/dist/{chunk-5DHKRSMQ.js → chunk-3UUY7R3Z.js} +11 -7
  13. package/dist/{chunk-IGWKHNIQ.js → chunk-3V5AYSEQ.js} +8 -8
  14. package/dist/{chunk-FHJEP5SW.js → chunk-465CC7FK.js} +8 -5
  15. package/dist/{chunk-5WIGXA4T.js → chunk-47CMYGET.js} +111 -4
  16. package/dist/{chunk-A3WNZD3P.js → chunk-4H6ULJ3H.js} +67 -21
  17. package/dist/{chunk-TB5666IT.js → chunk-4LJX2PUC.js} +3 -3
  18. package/dist/{chunk-XWSF374K.js → chunk-56KB5IJP.js} +2 -2
  19. package/dist/{chunk-SPULKLCF.js → chunk-5DQRIYDZ.js} +2 -2
  20. package/dist/{chunk-2HEJ2F35.js → chunk-5HFBWUMU.js} +20 -8
  21. package/dist/{chunk-WNIJTQQK.js → chunk-5PVQ4SRS.js} +78 -6
  22. package/dist/{chunk-DYIM5TJT.js → chunk-5QKCQQ3E.js} +262 -6
  23. package/dist/{chunk-TYPGUK6W.js → chunk-5T7RBWN2.js} +111 -5
  24. package/dist/{chunk-IIZWH4XA.js → chunk-774ILSRL.js} +2 -2
  25. package/dist/chunk-7C6RYZGQ.js +391 -0
  26. package/dist/{chunk-TANS5ZJS.js → chunk-AD7Y7STJ.js} +3 -3
  27. package/dist/{chunk-RWSI4YD7.js → chunk-AEYBF3TB.js} +33 -12
  28. package/dist/{chunk-DGSYXYMX.js → chunk-AMKHQW3C.js} +2 -2
  29. package/dist/{chunk-VWZOAB7K.js → chunk-B5XRQOLB.js} +7 -7
  30. package/dist/{chunk-WXY7KU3G.js → chunk-BVDVID7E.js} +2 -2
  31. package/dist/{chunk-PMDBGQSJ.js → chunk-CA42X6KT.js} +2 -2
  32. package/dist/{chunk-HLE42MG7.js → chunk-D73KXYPF.js} +3 -3
  33. package/dist/{chunk-5Q2VVUKB.js → chunk-DG4M6ZUE.js} +3 -3
  34. package/dist/{chunk-ME6CCNFO.js → chunk-EBOC7MT3.js} +6 -6
  35. package/dist/{chunk-MXKJU4JB.js → chunk-ECUO3KDP.js} +48 -7
  36. package/dist/{chunk-26LEYJZH.js → chunk-FALJGAWU.js} +2 -2
  37. package/dist/{chunk-GWS3VEIW.js → chunk-FWDFM5ZU.js} +24 -3
  38. package/dist/{chunk-7RGZWPB6.js → chunk-GAYUJ7LE.js} +67 -13
  39. package/dist/{chunk-VCBR6CU7.js → chunk-HAY4ZE2P.js} +2 -2
  40. package/dist/{chunk-FBVTI2TJ.js → chunk-HCBCAYZU.js} +11 -130
  41. package/dist/{chunk-WSB3FPX7.js → chunk-HJB5IUKP.js} +32 -136
  42. package/dist/{chunk-J3YUBZWY.js → chunk-HKO36JWF.js} +33 -5
  43. package/dist/{chunk-E77JEWSD.js → chunk-HPCTNZM2.js} +6 -36
  44. package/dist/{chunk-FJ3H4MN5.js → chunk-IHKBWSXF.js} +2 -2
  45. package/dist/{chunk-NMPKI6XL.js → chunk-JEQQR47K.js} +37 -18
  46. package/dist/{chunk-3BINW3FP.js → chunk-KV2AOLDF.js} +24 -4
  47. package/dist/{chunk-YS5VLNH5.js → chunk-LXPJXFM5.js} +7 -7
  48. package/dist/{chunk-7RFXX52T.js → chunk-MIX5N5AC.js} +271 -41
  49. package/dist/{chunk-K4XHGFR5.js → chunk-MLOK6ZOS.js} +1297 -218
  50. package/dist/{chunk-ZNLWCMVZ.js → chunk-MV2VUEJC.js} +2 -2
  51. package/dist/{chunk-MVVUPGPW.js → chunk-MXHC5QYU.js} +6 -6
  52. package/dist/{chunk-5H3GB5BO.js → chunk-N3PBVRTZ.js} +4 -382
  53. package/dist/{chunk-2HFZQUHL.js → chunk-N5XKWMDW.js} +17 -7
  54. package/dist/{chunk-5C3AQNDW.js → chunk-NNNWO6F2.js} +124 -36
  55. package/dist/{chunk-GU2UIAFZ.js → chunk-NQ6UCCOD.js} +3 -3
  56. package/dist/{chunk-N22QMJKY.js → chunk-NZU6YDNV.js} +4 -4
  57. package/dist/{chunk-ZVJ5BLO2.js → chunk-O6I4CIEU.js} +151 -13
  58. package/dist/{chunk-XN3L4EYL.js → chunk-OEDBCISO.js} +2 -2
  59. package/dist/{chunk-VAWNZU7Z.js → chunk-P3JGPQFL.js} +2 -2
  60. package/dist/{chunk-IJ7RPIYJ.js → chunk-PNY46YEY.js} +20 -3
  61. package/dist/{chunk-U6MBIEMB.js → chunk-PZ4I4JE2.js} +56 -35
  62. package/dist/{chunk-GPIEI3LY.js → chunk-QQ7EKM72.js} +2 -2
  63. package/dist/{chunk-WLFILSD5.js → chunk-R7LNVMCS.js} +66 -28
  64. package/dist/{chunk-GOXNB3AO.js → chunk-RAPCMZL4.js} +75 -4
  65. package/dist/chunk-RKKLTLYB.js +45 -0
  66. package/dist/{chunk-TT36MB5S.js → chunk-RKRLDWD3.js} +3 -1
  67. package/dist/{chunk-TTHACPOM.js → chunk-S4COXYBG.js} +456 -18
  68. package/dist/{chunk-WWCZ5F23.js → chunk-T3Z6VAAF.js} +69 -10
  69. package/dist/{chunk-GN57SG4G.js → chunk-TD7UE2L5.js} +9 -7
  70. package/dist/{chunk-TLQJPP24.js → chunk-TEO2TLVN.js} +523 -322
  71. package/dist/{chunk-FCSXB6T2.js → chunk-UOSL25KY.js} +14 -2
  72. package/dist/{chunk-KTYTFRMB.js → chunk-VKBMFOYV.js} +17 -15
  73. package/dist/{chunk-PT7HYKEM.js → chunk-VO2LKSTM.js} +2 -2
  74. package/dist/{chunk-P43ETTHK.js → chunk-VPTUJU4P.js} +2 -2
  75. package/dist/{chunk-WEH5XRJQ.js → chunk-WIE7ZOSW.js} +2 -2
  76. package/dist/{chunk-EMYUUSFG.js → chunk-WXCJ7VME.js} +5 -5
  77. package/dist/{chunk-4DGYLA73.js → chunk-XDOQXGFO.js} +22 -7
  78. package/dist/{chunk-JOZYP4GM.js → chunk-YKOFT37S.js} +5 -5
  79. package/dist/chunk-YSEHGPCT.js +127 -0
  80. package/dist/{chunk-HFSBBKSQ.js → chunk-YW7UVM5V.js} +138 -3
  81. package/dist/cli/index.js +27 -27
  82. package/dist/{clio-QVTYJ57A.js → clio-LT5V7SSZ.js} +6 -6
  83. package/dist/{code-nav-FGGFIE7L.js → code-nav-LMW275PA.js} +4 -4
  84. package/dist/{config-LW5IJFQN.js → config-RXS5T3JT.js} +71 -43
  85. package/dist/{configure-7XIZCOU4.js → configure-2WYWSCSD.js} +14 -15
  86. package/dist/{context-Y6Y7QPR6.js → context-I3BTOTCS.js} +12 -12
  87. package/dist/{context-L3WL3X7K.js → context-MVOORGMF.js} +34 -33
  88. package/dist/{context-N52ZA626.js → context-PALKKQYL.js} +20 -20
  89. package/dist/{context-clear-MBQRLSDQ.js → context-clear-N2WOYZ2K.js} +34 -33
  90. package/dist/{context-index-HVMFQHK3.js → context-index-HNG3MOME.js} +2 -2
  91. package/dist/{context-working-set-GS6DSO7F.js → context-working-set-MIEVECVZ.js} +10 -11
  92. package/dist/{dispatch-runner-22ZCNOM3.js → dispatch-runner-VVA4SRRH.js} +34 -33
  93. package/dist/doctor-TWBWFK5V.js +165 -0
  94. package/dist/{eval-BEC2WHDA.js → eval-IJ5VEZDJ.js} +2016 -142
  95. package/dist/{evidence-REJUMSKM.js → evidence-L5APPXNV.js} +29 -28
  96. package/dist/{evolve-PY5ZBA5K.js → evolve-RGNKFJ52.js} +29 -28
  97. package/dist/{extensions-HVKU65YU.js → extensions-7WYWUX5A.js} +9 -3
  98. package/dist/{fleet-7WZEWRFA.js → fleet-6CNVBZZP.js} +87 -55
  99. package/dist/{fleet-commands-UVHWM76J.js → fleet-commands-L2SXSYEI.js} +6 -6
  100. package/dist/{fleet-graph-6ULH7PES.js → fleet-graph-2J3OOIPO.js} +14 -12
  101. package/dist/{fleet-preflight-J53T6CCE.js → fleet-preflight-CZRJ4JP5.js} +3 -4
  102. package/dist/{fleet-validate-72PC4SLA.js → fleet-validate-C5RI6DP7.js} +16 -15
  103. package/dist/{init-OG3TPGQG.js → init-VBN2ACVA.js} +50 -48
  104. package/dist/{library-CNTMPLRF.js → library-JHGUMLY2.js} +13 -11
  105. package/dist/{memory-6IS7F275.js → memory-K4OQIYWG.js} +31 -30
  106. package/dist/{models-ENRJDA5W.js → models-2NCZUWDD.js} +23 -22
  107. package/dist/{monitor-XLDVO7TN.js → monitor-MMVTJABD.js} +35 -34
  108. package/dist/{orchestrator-6KSPYRHA.js → orchestrator-ZKBPCHW6.js} +1627 -294
  109. package/dist/{reset-RZ4ER727.js → reset-DD5JGOY3.js} +3 -3
  110. package/dist/{run-Y2CNK5RU.js → run-QEGNX7FL.js} +56 -55
  111. package/dist/{share-A55GYP6Z.js → share-JKD3BQMW.js} +13 -11
  112. package/dist/{skills-ALC5J6AT.js → skills-LMQIKDOZ.js} +14 -12
  113. package/dist/{skills-eval-JPBEBYQU.js → skills-eval-I7X2774U.js} +34 -32
  114. package/dist/{steer-GGWFUJUD.js → steer-CF5TDANS.js} +3 -3
  115. package/dist/{support-MIETYA5E.js → support-I7LOJLIF.js} +4 -4
  116. package/dist/{targets-VGNXIR3S.js → targets-RUSR6B5Z.js} +58 -32
  117. package/dist/{terminal-lease-WOBR64YA.js → terminal-lease-QYVORFR4.js} +6 -4
  118. package/dist/{trace-PNCASAXC.js → trace-ODOQIVIW.js} +61 -6
  119. package/dist/{upgrade-FUSUAGHR.js → upgrade-XANW3FXB.js} +17 -16
  120. package/dist/{usage-N4MKVHKD.js → usage-4H7ZRXQT.js} +88 -44
  121. package/dist/{verifiers-YAWOJ3H2.js → verifiers-UZXNBZEB.js} +6 -6
  122. package/dist/{verify-LTDHYBGY.js → verify-BVKWTNDL.js} +5 -5
  123. package/dist/{wiki-generate-6M7GHTBJ.js → wiki-generate-MY7WV2QI.js} +49 -47
  124. package/dist/worker/entry.js +29 -33
  125. package/docs/alcf-provider.md +1 -1
  126. package/docs/architecture.md +1 -1
  127. package/docs/artifact-versions.md +6 -1
  128. package/docs/built-in-agents.md +1 -1
  129. package/docs/capacity-and-scheduling.md +23 -2
  130. package/docs/commands-and-modes.md +1 -1
  131. package/docs/configuration-and-targets.md +30 -3
  132. package/docs/context-engine.md +63 -4
  133. package/docs/documentation-coverage.md +3 -3
  134. package/docs/documentation-guide.md +1 -1
  135. package/docs/environment-variables.md +2 -0
  136. package/docs/eval-runner.md +262 -11
  137. package/docs/evals-internal.md +72 -2
  138. package/docs/evidence-and-memory.md +11 -10
  139. package/docs/evolution.md +1 -1
  140. package/docs/extensions-and-sharing.md +3 -1
  141. package/docs/fleet-dispatch.md +4 -4
  142. package/docs/installation-and-lifecycle.md +1 -1
  143. package/docs/middleware-and-components.md +1 -1
  144. package/docs/model-catalog.md +1 -1
  145. package/docs/observability.md +53 -2
  146. package/docs/proactive-memory.md +127 -14
  147. package/docs/prompt-envelope-and-tools.md +19 -1
  148. package/docs/provider-adapter-cookbook.md +1 -1
  149. package/docs/release-cut-checklist.md +19 -3
  150. package/docs/safety-model.md +1 -1
  151. package/docs/scientific-validation.md +1 -1
  152. package/docs/skills-marketplace.md +1 -1
  153. package/docs/tool-usage.md +1 -1
  154. package/docs/trace-store.md +1 -1
  155. package/docs/troubleshooting.md +87 -0
  156. package/docs/tui-design.md +1 -1
  157. package/docs/worker-dispatch-mechanics.md +1 -1
  158. package/package.json +2 -1
  159. package/src/cli/agents.ts +1 -1
  160. package/src/cli/config-inspect.ts +33 -6
  161. package/src/cli/config.ts +1 -1
  162. package/src/cli/doctor-state-size.ts +82 -0
  163. package/src/cli/doctor.ts +3 -1
  164. package/src/cli/eval.ts +80 -16
  165. package/src/cli/extensions.ts +5 -1
  166. package/src/cli/fleet.ts +32 -3
  167. package/src/cli/targets.ts +44 -13
  168. package/src/cli/trace.ts +63 -4
  169. package/src/cli/usage.ts +63 -14
  170. package/src/core/bus-events.ts +29 -1
  171. package/src/core/cache-telemetry.ts +42 -0
  172. package/src/core/config.ts +18 -0
  173. package/src/core/defaults.ts +36 -6
  174. package/src/core/endpoint-key.ts +27 -0
  175. package/src/core/residency-target-key.ts +25 -0
  176. package/src/core/response-schema.ts +36 -2
  177. package/src/domains/config/classify.ts +3 -0
  178. package/src/domains/context/codewiki/coordinator.ts +12 -4
  179. package/src/domains/dispatch/admission.ts +40 -3
  180. package/src/domains/dispatch/capacity-lease.ts +98 -9
  181. package/src/domains/dispatch/contract.ts +11 -0
  182. package/src/domains/dispatch/execution-plan.ts +44 -4
  183. package/src/domains/dispatch/extension.ts +166 -42
  184. package/src/domains/dispatch/fleet-run.ts +23 -3
  185. package/src/domains/dispatch/heartbeat.ts +32 -8
  186. package/src/domains/dispatch/index.ts +3 -0
  187. package/src/domains/dispatch/orphan-recovery.ts +5 -0
  188. package/src/domains/dispatch/reservation-store.ts +116 -8
  189. package/src/domains/dispatch/state.ts +4 -0
  190. package/src/domains/dispatch/worker-spawn.ts +25 -11
  191. package/src/domains/dispatch/write-boundary-enforcer.ts +20 -3
  192. package/src/domains/dispatch/write-boundary.ts +62 -1
  193. package/src/domains/eval/artifacts/store.ts +62 -0
  194. package/src/domains/eval/compare/behavioral.ts +224 -0
  195. package/src/domains/eval/compare/compare.ts +355 -2
  196. package/src/domains/eval/compare/envelope.ts +128 -0
  197. package/src/domains/eval/compare/gates.ts +24 -6
  198. package/src/domains/eval/compare/thresholds.ts +30 -3
  199. package/src/domains/eval/execution-provenance.ts +240 -0
  200. package/src/domains/eval/metrics/aggregate.ts +136 -0
  201. package/src/domains/eval/metrics/call-ledger-stream.ts +112 -0
  202. package/src/domains/eval/metrics/tracked.ts +413 -0
  203. package/src/domains/eval/provenance.ts +117 -0
  204. package/src/domains/eval/reports/comparison.ts +128 -0
  205. package/src/domains/eval/reports/junit.ts +17 -3
  206. package/src/domains/eval/reports/markdown.ts +3 -3
  207. package/src/domains/eval/reports/text.ts +14 -0
  208. package/src/domains/eval/run-compare.ts +20 -0
  209. package/src/domains/eval/runners/clio-run.ts +127 -0
  210. package/src/domains/eval/runners/external-command.ts +28 -3
  211. package/src/domains/eval/schema/adapter.ts +111 -0
  212. package/src/domains/eval/schema/artifact.ts +20 -0
  213. package/src/domains/eval/schema/behavioral-metrics.ts +204 -0
  214. package/src/domains/eval/schema/behavioral.ts +520 -0
  215. package/src/domains/eval/schema/execution-envelope.ts +194 -0
  216. package/src/domains/eval/schema/serving.ts +74 -0
  217. package/src/domains/eval/schema/suite.ts +38 -8
  218. package/src/domains/eval/schema/validate.ts +58 -3
  219. package/src/domains/eval/schema/verdict.ts +237 -0
  220. package/src/domains/eval/suites/resolve.ts +2 -0
  221. package/src/domains/eval/suites/run.ts +264 -33
  222. package/src/domains/eval/verifiers/command.ts +2 -1
  223. package/src/domains/eval/workspaces/temp-copy.ts +145 -13
  224. package/src/domains/evidence/build.ts +2 -13
  225. package/src/domains/evidence/eval.ts +2 -12
  226. package/src/domains/evidence/findings-markdown.ts +33 -0
  227. package/src/domains/evidence/run-trust.ts +7 -113
  228. package/src/domains/evidence/trust-projection.ts +2 -2
  229. package/src/domains/extensions/compatibility.ts +285 -0
  230. package/src/domains/extensions/discovery.ts +38 -3
  231. package/src/domains/extensions/resources.ts +1 -1
  232. package/src/domains/extensions/state.ts +12 -3
  233. package/src/domains/extensions/types.ts +2 -0
  234. package/src/domains/lifecycle/doctor.ts +69 -1
  235. package/src/domains/memory/index.ts +14 -0
  236. package/src/domains/memory/task-bank-promotion.ts +64 -0
  237. package/src/domains/memory/task-memory-policy.ts +77 -8
  238. package/src/domains/memory/task-memory-spend.ts +131 -0
  239. package/src/domains/memory/task-memory-status.ts +7 -0
  240. package/src/domains/memory/task-memory-telemetry.ts +2 -0
  241. package/src/domains/middleware/index.ts +1 -0
  242. package/src/domains/middleware/memory-intervention.ts +69 -5
  243. package/src/domains/middleware/memory-step-endpoint.ts +71 -0
  244. package/src/domains/observability/background-memory-usage.ts +140 -0
  245. package/src/domains/observability/cost.ts +1 -1
  246. package/src/domains/observability/index.ts +7 -0
  247. package/src/domains/observability/out-of-turn-usage.ts +51 -2
  248. package/src/domains/observability/trace-store.ts +192 -2
  249. package/src/domains/prompts/compiler.ts +100 -13
  250. package/src/domains/providers/endpoint-capacity.ts +96 -0
  251. package/src/domains/providers/index.ts +10 -0
  252. package/src/domains/providers/models/local-models/clio-local-coding-targets.yaml +243 -1
  253. package/src/domains/providers/runtime-resolution.ts +8 -1
  254. package/src/domains/providers/runtimes/common/probe-helpers.ts +31 -9
  255. package/src/domains/providers/runtimes/local-native/llamacpp-anthropic.ts +1 -1
  256. package/src/domains/providers/runtimes/local-native/llamacpp-completion.ts +1 -1
  257. package/src/domains/providers/runtimes/local-native/llamacpp-embed.ts +1 -1
  258. package/src/domains/providers/runtimes/local-native/llamacpp-rerank.ts +1 -1
  259. package/src/domains/providers/runtimes/local-native/llamacpp.ts +4 -1
  260. package/src/domains/providers/runtimes/local-native/lmstudio.ts +4 -1
  261. package/src/domains/providers/runtimes/local-native/ollama-native.ts +6 -1
  262. package/src/domains/providers/types/capability-flags.ts +2 -0
  263. package/src/domains/providers/types/target-descriptor.ts +2 -0
  264. package/src/domains/resources/prompts/loader.ts +95 -33
  265. package/src/domains/safety/call-target.ts +52 -0
  266. package/src/domains/safety/run-effects.ts +35 -4
  267. package/src/domains/session/context-accounting.ts +52 -1
  268. package/src/domains/session/context-ledger.ts +37 -13
  269. package/src/domains/session/index.ts +6 -0
  270. package/src/domains/session/prompt-cache.ts +140 -0
  271. package/src/domains/session/prompt-manifest.ts +42 -0
  272. package/src/engine/acp/adapter.ts +18 -3
  273. package/src/engine/ai.ts +35 -0
  274. package/src/engine/apis/llamacpp-residency.ts +55 -3
  275. package/src/engine/apis/lmstudio.ts +25 -5
  276. package/src/engine/apis/ollama-native.ts +2 -1
  277. package/src/engine/apis/openai-completions.ts +80 -17
  278. package/src/engine/apis/residency-lock.ts +3 -1
  279. package/src/engine/apis/residency.ts +34 -1
  280. package/src/engine/provider-payload.ts +29 -1
  281. package/src/entry/orchestrator.ts +176 -30
  282. package/src/interactive/chat-loop-messages.ts +26 -7
  283. package/src/interactive/chat-loop.ts +318 -41
  284. package/src/interactive/chat-panel.ts +62 -8
  285. package/src/interactive/clio-editor.ts +45 -8
  286. package/src/interactive/context-activity.ts +5 -1
  287. package/src/interactive/context-meter.ts +1 -1
  288. package/src/interactive/context-overlay.ts +40 -10
  289. package/src/interactive/cost-overlay.ts +64 -6
  290. package/src/interactive/dispatch-board.ts +84 -12
  291. package/src/interactive/fleet-run-preview.ts +41 -15
  292. package/src/interactive/handoff-round.ts +41 -2
  293. package/src/interactive/interactive-application.ts +24 -1
  294. package/src/interactive/interactive-input-runtime.ts +8 -0
  295. package/src/interactive/interactive-presentation.ts +4 -0
  296. package/src/interactive/interactive-shell.ts +20 -17
  297. package/src/interactive/interactive-slash-runtime.ts +27 -4
  298. package/src/interactive/memory-overlay.ts +8 -0
  299. package/src/interactive/mutation-preview.ts +295 -0
  300. package/src/interactive/overlay-general-openers.ts +16 -0
  301. package/src/interactive/overlay-key-routing.ts +38 -0
  302. package/src/interactive/overlay-lifecycle.ts +38 -5
  303. package/src/interactive/overlay-permission-lifecycle.ts +22 -2
  304. package/src/interactive/overlay-session-lifecycle.ts +73 -9
  305. package/src/interactive/overlays/ask-user.ts +91 -19
  306. package/src/interactive/overlays/help-reference.ts +4 -0
  307. package/src/interactive/overlays/prompts.ts +11 -1
  308. package/src/interactive/overlays/settings.ts +35 -1
  309. package/src/interactive/permission-hint.ts +34 -2
  310. package/src/interactive/permission-overlay.ts +159 -9
  311. package/src/interactive/prewarm.ts +197 -0
  312. package/src/interactive/render-trace.ts +162 -15
  313. package/src/interactive/renderers/tool-execution.ts +4 -0
  314. package/src/interactive/side-question.ts +58 -1
  315. package/src/interactive/status/controller.ts +11 -0
  316. package/src/interactive/status/state-machine.ts +54 -2
  317. package/src/interactive/status/types.ts +7 -0
  318. package/src/interactive/terminal-lease.ts +2 -0
  319. package/src/interactive/turn-context.ts +299 -31
  320. package/src/interactive/turn-persistence.ts +14 -4
  321. package/src/interactive/turn-prewarm.ts +364 -0
  322. package/src/interactive/turn-queues.ts +7 -4
  323. package/src/interactive/turn-runtime.ts +8 -1
  324. package/src/interactive/turn-state.ts +23 -0
  325. package/src/interactive/view/view-overlay.ts +28 -3
  326. package/src/tools/ask-user.ts +43 -2
  327. package/src/tools/dispatch-plan.ts +17 -9
  328. package/src/tools/dispatch-scout.ts +1 -1
  329. package/src/tools/registry.ts +16 -0
  330. package/dist/chunk-AOCYTWAV.js +0 -449
  331. package/dist/chunk-HWUFFB6L.js +0 -83
  332. package/dist/chunk-R346GLFC.js +0 -31
  333. package/dist/doctor-M7YEDGAE.js +0 -91
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-W6GROXXM.js";
15
15
  import {
16
16
  ceilChars
17
- } from "./chunk-RWSI4YD7.js";
17
+ } from "./chunk-AEYBF3TB.js";
18
18
  import {
19
19
  init_esm_shims
20
20
  } from "./chunk-3R73A4XB.js";
@@ -119,4 +119,4 @@ export {
119
119
  recallableRefListing,
120
120
  recallErrorMessage
121
121
  };
122
- //# sourceMappingURL=chunk-ZNLWCMVZ.js.map
122
+ //# sourceMappingURL=chunk-MV2VUEJC.js.map
@@ -108,9 +108,9 @@ function enqueueWorkspace(cwd, task) {
108
108
  }
109
109
  function coordinateCodewikiWrite(cwd, select, options = {}) {
110
110
  const workspace = resolve(cwd);
111
- return enqueueWorkspace(
112
- workspace,
113
- () => withStateFileLock(codewikiPath(workspace), async () => {
111
+ return enqueueWorkspace(workspace, () => {
112
+ if (options.requireExisting && !existsSync(codewikiPath(workspace))) return Promise.resolve(null);
113
+ return withStateFileLock(codewikiPath(workspace), async () => {
114
114
  if (options.requireExisting && !existsSync(codewikiPath(workspace))) return null;
115
115
  const current = options.readCurrent?.(workspace) ?? readCodewiki(workspace);
116
116
  const request = await select(current, workspace);
@@ -121,8 +121,8 @@ function coordinateCodewikiWrite(cwd, select, options = {}) {
121
121
  if (wrote) writeCodewiki(workspace, worker.codewiki);
122
122
  await options.afterCommit?.(worker, workspace);
123
123
  return { codewiki: !worker.changed && current ? current : worker.codewiki, worker, wrote };
124
- })
125
- );
124
+ });
125
+ });
126
126
  }
127
127
  function coordinateCodewikiExclusive(cwd, task) {
128
128
  const workspace = resolve(cwd);
@@ -277,4 +277,4 @@ export {
277
277
  readClioState,
278
278
  writeClioState
279
279
  };
280
- //# sourceMappingURL=chunk-MVVUPGPW.js.map
280
+ //# sourceMappingURL=chunk-MXHC5QYU.js.map
@@ -3,25 +3,17 @@ import {
3
3
  loadProjectVerifierCatalog
4
4
  } from "./chunk-A2NJGIB3.js";
5
5
  import {
6
+ classify,
6
7
  pathBoundaryCovers,
7
8
  resolvePathBoundary
8
- } from "./chunk-TTHACPOM.js";
9
- import {
10
- classify
11
- } from "./chunk-AOCYTWAV.js";
9
+ } from "./chunk-S4COXYBG.js";
12
10
  import {
13
11
  artifactDefaultPath,
14
- detectValidationCommand,
15
12
  extractCommandDeleteTargets,
16
13
  extractCommandWriteTargets,
17
14
  inlineShellScript,
18
- tokenizeShellLike,
19
- toolMutationPaths
15
+ tokenizeShellLike
20
16
  } from "./chunk-MV3K5QF2.js";
21
- import {
22
- isProjectVerifierCheckId,
23
- isVerificationScriptName
24
- } from "./chunk-UL3WSD3F.js";
25
17
  import {
26
18
  canonicalizeExistingPath
27
19
  } from "./chunk-ECH6PKUQ.js";
@@ -45,373 +37,6 @@ import {
45
37
  init_esm_shims
46
38
  } from "./chunk-3R73A4XB.js";
47
39
 
48
- // src/domains/safety/finish-contract.ts
49
- init_esm_shims();
50
- var FINISH_CONTRACT_ADVISORY_MESSAGE = "[Clio Coder] finish-contract advisory: you changed files this turn without recording validation evidence or an explicit limitation. Run a verification command or state what could not be verified.";
51
- var DEFAULT_RECENT_ENTRY_LIMIT = 80;
52
- var LIMITATION_PATTERNS = [
53
- /\b(?:blocked by|blocker|blockers|unable to|not able to|could not|couldn't|cannot|can't)\b/i,
54
- /\b(?:did not|didn't|have not|haven't|has not|hasn't|was not able|wasn't able)\b/i,
55
- /\b(?:not complete|incomplete)\b/i,
56
- /\b(?:not|un)(?:\s|-)?(?:validated|verified|tested)\b/i,
57
- /^\s*Tests\s*:\s*(?:not run|not executed|not available|failed|blocked|skipped)\b/im,
58
- /^\s*Known gaps?\s*:\s*(?!\s*(?:none|no\b|n\/a|not applicable)\b).+/im,
59
- /\bremaining(?:\s+\w+){0,3}\s+(?:work|issue|issues|gap|gaps|blocker|blockers)\b/i
60
- ];
61
- function assessFinishContract(input) {
62
- const assistantText = input.assistantText.trim();
63
- const sessionEntries = input.sessionEntries ?? [];
64
- const assistantTurnId = input.assistantTurnId ?? null;
65
- const window = recentEntries(sessionEntries, assistantTurnId, input.recentEntryLimit ?? DEFAULT_RECENT_ENTRY_LIMIT);
66
- const mutatedPaths = mutatingReceipts(window);
67
- if (mutatedPaths.length === 0) {
68
- return { kind: "ok", reason: "no_mutation", evidence: [], mutatedPaths };
69
- }
70
- const evidence = collectValidationEvidence(window);
71
- if (evidence.length > 0) {
72
- return { kind: "ok", reason: "validation_evidence", evidence, mutatedPaths };
73
- }
74
- if (hasExplicitLimitation(assistantText)) {
75
- return { kind: "ok", reason: "explicit_limitation", evidence: [], mutatedPaths };
76
- }
77
- return {
78
- kind: "engage",
79
- reason: "unvalidated_mutation",
80
- message: FINISH_CONTRACT_ADVISORY_MESSAGE,
81
- evidence: [],
82
- mutatedPaths
83
- };
84
- }
85
- function hasExplicitLimitation(text) {
86
- const normalized = text.trim();
87
- if (normalized.length === 0) return false;
88
- return LIMITATION_PATTERNS.some((pattern) => pattern.test(normalized));
89
- }
90
- function mutatingReceipts(recent) {
91
- const mutationCalls = /* @__PURE__ */ new Map();
92
- const paths = [];
93
- const seen = /* @__PURE__ */ new Set();
94
- for (const entry of recent) {
95
- const bashMutation = bashExecutionMutationPaths(entry);
96
- if (bashMutation !== null) {
97
- for (const path4 of bashMutation) pushPath(paths, seen, path4);
98
- continue;
99
- }
100
- const call = mutatingToolCall(entry);
101
- if (call !== null) {
102
- mutationCalls.set(call.toolCallId, call);
103
- continue;
104
- }
105
- const resultId = successfulToolResultId(entry);
106
- if (resultId !== null) {
107
- const candidate = mutationCalls.get(resultId);
108
- if (candidate !== void 0) {
109
- for (const path4 of candidate.paths) pushPath(paths, seen, path4);
110
- }
111
- }
112
- }
113
- return paths;
114
- }
115
- function mutationPathsForTool(toolName, args) {
116
- if (toolName === ToolNames.Bash) {
117
- const command = typeof args?.command === "string" ? args.command : null;
118
- if (command === null) return [];
119
- return [...extractCommandWriteTargets(command), ...extractCommandDeleteTargets(command)];
120
- }
121
- return toolMutationPaths(toolName, args);
122
- }
123
- function mutatingToolCall(entry) {
124
- const record = asRecord(entry);
125
- if (record?.kind !== "message" || record.role !== "tool_call") return null;
126
- const payload = asRecord(record.payload);
127
- if (payload === null) return null;
128
- const toolName = stringFromFirst(payload, ["name", "toolName", "tool"]);
129
- if (toolName === null) return null;
130
- const args = asRecord(payload.args ?? payload.arguments ?? payload.input) ?? void 0;
131
- const paths = mutationPathsForTool(toolName, args);
132
- if (paths.length === 0) return null;
133
- const toolCallId = stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]) ?? turnIdOf(entry);
134
- if (toolCallId === null) return null;
135
- return { toolCallId, paths };
136
- }
137
- function bashExecutionMutationPaths(entry) {
138
- const record = asRecord(entry);
139
- if (record?.kind !== "bashExecution") return null;
140
- if (typeof record.command !== "string") return null;
141
- if (record.cancelled === true || record.exitCode !== 0) return null;
142
- return [...extractCommandWriteTargets(record.command), ...extractCommandDeleteTargets(record.command)];
143
- }
144
- function pushPath(paths, seen, path4) {
145
- if (path4.length === 0 || seen.has(path4)) return;
146
- seen.add(path4);
147
- paths.push(path4);
148
- }
149
- function collectValidationEvidence(recent) {
150
- const evidence = [];
151
- const toolCalls = /* @__PURE__ */ new Map();
152
- const dispatchCalls = /* @__PURE__ */ new Map();
153
- const seen = /* @__PURE__ */ new Set();
154
- for (const entry of recent) {
155
- const protectedArtifact = protectedArtifactEvidence(entry);
156
- if (protectedArtifact !== null) {
157
- pushEvidence(evidence, seen, protectedArtifact);
158
- continue;
159
- }
160
- const call = bashValidationCall(entry);
161
- if (call !== null) {
162
- toolCalls.set(call.toolCallId, call);
163
- continue;
164
- }
165
- const typedValidationCall = validationToolCall(entry);
166
- if (typedValidationCall !== null) {
167
- toolCalls.set(typedValidationCall.toolCallId, typedValidationCall);
168
- continue;
169
- }
170
- const dispatchCall = dispatchEvidenceCall(entry);
171
- if (dispatchCall !== null) {
172
- dispatchCalls.set(dispatchCall.toolCallId, dispatchCall);
173
- continue;
174
- }
175
- const resultId = successfulToolResultId(entry);
176
- if (resultId !== null) {
177
- const dispatchCandidate = dispatchCalls.get(resultId);
178
- const dispatchReceipt = dispatchReceiptEvidence(entry, dispatchCandidate);
179
- if (dispatchReceipt !== null) {
180
- pushEvidence(evidence, seen, dispatchReceipt);
181
- continue;
182
- }
183
- const candidate = toolCalls.get(resultId);
184
- if (candidate !== void 0) {
185
- pushEvidence(evidence, seen, validationEvidence(candidate));
186
- }
187
- continue;
188
- }
189
- const bashExecution = bashExecutionEvidence(entry);
190
- if (bashExecution !== null) pushEvidence(evidence, seen, bashExecution);
191
- }
192
- return evidence;
193
- }
194
- function recentEntries(entries, assistantTurnId, recentEntryLimit) {
195
- const boundedLimit = Number.isFinite(recentEntryLimit) && recentEntryLimit > 0 ? Math.floor(recentEntryLimit) : DEFAULT_RECENT_ENTRY_LIMIT;
196
- const assistantIndex = assistantTurnId === null ? -1 : entries.findIndex((entry) => turnIdOf(entry) === assistantTurnId);
197
- const endExclusive = assistantIndex >= 0 ? assistantIndex : entries.length;
198
- let startInclusive = Math.max(0, endExclusive - boundedLimit);
199
- for (let index = endExclusive - 1; index >= startInclusive; index -= 1) {
200
- if (isUserMessageEntry(entries[index])) {
201
- startInclusive = index + 1;
202
- break;
203
- }
204
- }
205
- return entries.slice(startInclusive, endExclusive);
206
- }
207
- function bashValidationCall(entry) {
208
- const record = asRecord(entry);
209
- if (record?.kind !== "message" || record.role !== "tool_call") return null;
210
- const payload = asRecord(record.payload);
211
- if (payload === null) return null;
212
- const toolName = stringFromFirst(payload, ["name", "toolName", "tool"]);
213
- if (toolName !== "bash") return null;
214
- const args = asRecord(payload.args ?? payload.arguments ?? payload.input);
215
- const command = typeof args?.command === "string" ? args.command : null;
216
- if (command === null) return null;
217
- const detected = detectValidationCommand(command);
218
- if (detected.kind !== "validation") return null;
219
- const toolCallId = stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]) ?? turnIdOf(entry);
220
- if (toolCallId === null) return null;
221
- const candidate = {
222
- toolCallId,
223
- command: detected.matched
224
- };
225
- const turnId = turnIdOf(entry);
226
- if (turnId !== null) candidate.turnId = turnId;
227
- return candidate;
228
- }
229
- function dispatchEvidenceCall(entry) {
230
- const record = asRecord(entry);
231
- if (record?.kind !== "message" || record.role !== "tool_call") return null;
232
- const payload = asRecord(record.payload);
233
- if (payload === null) return null;
234
- const toolName = stringFromFirst(payload, ["name", "toolName", "tool"]);
235
- if (toolName !== "dispatch") return null;
236
- const args = asRecord(payload.args ?? payload.arguments ?? payload.input);
237
- const { agentId, task } = dispatchCallDescriptor(args);
238
- const toolCallId = stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]) ?? turnIdOf(entry);
239
- if (toolCallId === null) return null;
240
- const candidate = {
241
- toolCallId,
242
- command: `agent=${agentId}${task.length > 0 ? ` task=${task}` : ""}`
243
- };
244
- const turnId = turnIdOf(entry);
245
- if (turnId !== null) candidate.turnId = turnId;
246
- return candidate;
247
- }
248
- function dispatchCallDescriptor(args) {
249
- const defaultAgent = stringFromFirst(args ?? {}, ["agent", "agent_id", "agentId"]);
250
- const tasks = Array.isArray(args?.tasks) ? args.tasks : null;
251
- if (tasks !== null && tasks.length > 0) {
252
- const first = tasks[0];
253
- if (typeof first === "string") {
254
- return { agentId: defaultAgent ?? "coder", task: first.trim() };
255
- }
256
- const firstRecord = asRecord(first);
257
- const itemAgent = firstRecord === null ? null : stringFromFirst(firstRecord, ["agent", "agent_id", "agentId"]);
258
- const itemTask = typeof firstRecord?.task === "string" ? firstRecord.task.trim() : "";
259
- return { agentId: itemAgent ?? defaultAgent ?? "coder", task: itemTask };
260
- }
261
- const singleTask = typeof args?.task === "string" ? args.task.trim() : "";
262
- return { agentId: defaultAgent ?? "coder", task: singleTask };
263
- }
264
- function validationToolCall(entry) {
265
- const record = asRecord(entry);
266
- if (record?.kind !== "message" || record.role !== "tool_call") return null;
267
- const payload = asRecord(record.payload);
268
- if (payload === null) return null;
269
- const toolName = stringFromFirst(payload, ["name", "toolName", "tool"]);
270
- if (toolName === null) return null;
271
- const summary = typedValidationSummary(toolName, payload);
272
- if (summary === null) return null;
273
- const toolCallId = stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]) ?? turnIdOf(entry);
274
- if (toolCallId === null) return null;
275
- const candidate = {
276
- toolCallId,
277
- command: summary
278
- };
279
- const turnId = turnIdOf(entry);
280
- if (turnId !== null) candidate.turnId = turnId;
281
- return candidate;
282
- }
283
- function typedValidationSummary(toolName, payload) {
284
- const args = asRecord(payload.args ?? payload.arguments ?? payload.input);
285
- if (toolName === "verify") {
286
- const check = typeof args?.check === "string" ? args.check.trim() : "";
287
- if (check === "frontend") {
288
- const path4 = typeof args?.path === "string" && args.path.trim().length > 0 ? args.path.trim() : "artifact";
289
- return `verify frontend ${path4}`;
290
- }
291
- if (isVerificationScriptName(check)) return `npm run ${check}`;
292
- if (isProjectVerifierCheckId(check)) return `verify ${check}`;
293
- return null;
294
- }
295
- return null;
296
- }
297
- function successfulToolResultId(entry) {
298
- const record = asRecord(entry);
299
- if (record?.kind !== "message" || record.role !== "tool_result") return null;
300
- const payload = asRecord(record.payload);
301
- if (payload === null) return null;
302
- if (payload.isError === true || payload.error === true) return null;
303
- const result = asRecord(payload.result);
304
- const details = asRecord(result?.details);
305
- if (details?.kind === "error") return null;
306
- return stringFromFirst(payload, ["toolCallId", "tool_call_id", "id"]);
307
- }
308
- function dispatchReceiptEvidence(entry, candidate) {
309
- const record = asRecord(entry);
310
- if (record?.kind !== "message" || record.role !== "tool_result") return null;
311
- const payload = asRecord(record.payload);
312
- if (payload === null) return null;
313
- const toolName = stringFromFirst(payload, ["toolName", "name", "tool"]);
314
- if (toolName !== null && toolName !== "dispatch") return null;
315
- const result = asRecord(payload.result);
316
- const details = asRecord(result?.details);
317
- if (details === null) return null;
318
- const summary = passedDispatchReceiptSummary(details, candidate);
319
- if (summary === null) return null;
320
- const evidence = {
321
- kind: "dispatch_receipt",
322
- summary
323
- };
324
- const turnId = candidate?.turnId ?? turnIdOf(entry);
325
- if (turnId !== null && turnId !== void 0) evidence.turnId = turnId;
326
- return evidence;
327
- }
328
- function passedDispatchReceiptSummary(details, candidate) {
329
- if (Array.isArray(details.runs)) {
330
- const runs = details.runs.map(asRecord);
331
- if (runs.length === 0 || runs.some((run) => run === null || run.exitCode !== 0)) return null;
332
- if (typeof details.failedCount === "number" && details.failedCount !== 0) return null;
333
- const first = runs[0];
334
- const runId = typeof first?.runId === "string" && first.runId.length > 0 ? first.runId : "unknown";
335
- const agentId = dispatchReceiptAgentId(typeof first?.agentId === "string" ? first.agentId : void 0, candidate);
336
- const extra = runs.length > 1 ? ` (+${runs.length - 1} more)` : "";
337
- return `dispatch receipt passed: run ${runId} agent ${agentId}${extra}`;
338
- }
339
- if (details.exitCode === 0) {
340
- const runId = typeof details.runId === "string" && details.runId.length > 0 ? details.runId : "unknown";
341
- const agentId = dispatchReceiptAgentId(typeof details.agentId === "string" ? details.agentId : void 0, candidate);
342
- return `dispatch receipt passed: run ${runId} agent ${agentId}`;
343
- }
344
- return null;
345
- }
346
- function dispatchReceiptAgentId(receiptAgentId, candidate) {
347
- if (receiptAgentId !== void 0 && receiptAgentId.length > 0) return receiptAgentId;
348
- return candidate?.command.match(/^agent=([^\s]+)/)?.[1] ?? "unknown";
349
- }
350
- function bashExecutionEvidence(entry) {
351
- const record = asRecord(entry);
352
- if (record?.kind !== "bashExecution") return null;
353
- if (typeof record.command !== "string") return null;
354
- if (record.cancelled === true) return null;
355
- if (record.exitCode !== 0) return null;
356
- const detected = detectValidationCommand(record.command);
357
- if (detected.kind !== "validation") return null;
358
- const evidence = {
359
- kind: "validation_command",
360
- summary: `validation command passed: ${detected.matched}`
361
- };
362
- const turnId = turnIdOf(entry);
363
- if (turnId !== null) evidence.turnId = turnId;
364
- return evidence;
365
- }
366
- function protectedArtifactEvidence(entry) {
367
- const record = asRecord(entry);
368
- if (record?.kind !== "protectedArtifact" || record.action !== "protect") return null;
369
- const artifact = asRecord(record.artifact);
370
- const path4 = typeof artifact?.path === "string" && artifact.path.trim().length > 0 ? artifact.path.trim() : null;
371
- if (path4 === null) return null;
372
- const evidence = {
373
- kind: "protected_artifact",
374
- summary: `protected artifact recorded: ${path4}`
375
- };
376
- const turnId = turnIdOf(entry);
377
- if (turnId !== null) evidence.turnId = turnId;
378
- return evidence;
379
- }
380
- function validationEvidence(candidate) {
381
- const evidence = {
382
- kind: "validation_command",
383
- summary: `validation command passed: ${candidate.command}`
384
- };
385
- if (candidate.turnId !== void 0) evidence.turnId = candidate.turnId;
386
- return evidence;
387
- }
388
- function pushEvidence(evidence, seen, item) {
389
- const key = `${item.kind}\0${item.summary}\0${item.turnId ?? ""}`;
390
- if (seen.has(key)) return;
391
- seen.add(key);
392
- evidence.push(item);
393
- }
394
- function isUserMessageEntry(entry) {
395
- const record = asRecord(entry);
396
- if (record?.kind !== "message" || record.role !== "user") return false;
397
- const payload = asRecord(record.payload);
398
- return payload?.synthetic !== true;
399
- }
400
- function turnIdOf(entry) {
401
- const record = asRecord(entry);
402
- return typeof record?.turnId === "string" ? record.turnId : null;
403
- }
404
- function stringFromFirst(record, keys) {
405
- for (const key of keys) {
406
- const value = record[key];
407
- if (typeof value === "string" && value.length > 0) return value;
408
- }
409
- return null;
410
- }
411
- function asRecord(value) {
412
- return value !== null && typeof value === "object" ? value : null;
413
- }
414
-
415
40
  // src/domains/safety/path-policy.ts
416
41
  init_esm_shims();
417
42
  import { homedir } from "node:os";
@@ -1709,11 +1334,8 @@ function packPayload(rules) {
1709
1334
  }
1710
1335
 
1711
1336
  export {
1712
- DEFAULT_RECENT_ENTRY_LIMIT,
1713
- assessFinishContract,
1714
- typedValidationSummary,
1715
1337
  formatModelRejection,
1716
1338
  WRITE_ROOT_REFUSED_TOOLS,
1717
1339
  createSafetyPolicyEngine
1718
1340
  };
1719
- //# sourceMappingURL=chunk-5H3GB5BO.js.map
1341
+ //# sourceMappingURL=chunk-N3PBVRTZ.js.map
@@ -2,28 +2,31 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
2
2
  import {
3
3
  canonicalJson,
4
4
  sha256
5
- } from "./chunk-TLQJPP24.js";
5
+ } from "./chunk-MLOK6ZOS.js";
6
6
  import {
7
7
  addResponseModelIdObservationCount,
8
8
  emptyResponseModelIdObservationCounts,
9
9
  responseModelIdObservationFromRecord
10
- } from "./chunk-YS5VLNH5.js";
10
+ } from "./chunk-LXPJXFM5.js";
11
+ import {
12
+ uncachedPrefillTokens
13
+ } from "./chunk-3DPEIQKN.js";
11
14
  import {
12
15
  ToolNames
13
16
  } from "./chunk-CGKSTWHD.js";
14
17
  import {
15
18
  ceilChars,
16
19
  extractReasoningTokens
17
- } from "./chunk-RWSI4YD7.js";
20
+ } from "./chunk-AEYBF3TB.js";
18
21
  import {
19
22
  settingsPath
20
- } from "./chunk-IJ7RPIYJ.js";
23
+ } from "./chunk-PNY46YEY.js";
21
24
  import {
22
25
  expandConfigPath
23
26
  } from "./chunk-SST6Z5JA.js";
24
27
  import {
25
28
  isEngineContextOverflow
26
- } from "./chunk-FCSXB6T2.js";
29
+ } from "./chunk-UOSL25KY.js";
27
30
  import {
28
31
  init_esm_shims
29
32
  } from "./chunk-3R73A4XB.js";
@@ -371,10 +374,17 @@ function sumRunUsage(messages) {
371
374
  }
372
375
  return summary;
373
376
  }
374
- function backendCacheVerdict(input, cacheRead) {
377
+ function classifyCacheUsage(input, cacheRead) {
375
378
  if (cacheRead > 0) return input >= 2e3 ? "partial" : "hot";
376
379
  return input >= 2e3 ? "cold" : "small";
377
380
  }
381
+ function backendCacheVerdict(input, cacheRead, backend) {
382
+ if (cacheRead === 0 && backend?.cachedTokens !== null && backend?.cachedTokens !== void 0) {
383
+ const backendInput = uncachedPrefillTokens(backend);
384
+ if (backendInput !== null) return classifyCacheUsage(backendInput, backend.cachedTokens);
385
+ }
386
+ return classifyCacheUsage(input, cacheRead);
387
+ }
378
388
  function assistantSessionPayload(message, failure) {
379
389
  const text = extractText(message).trim();
380
390
  const thinking = extractThinking(message).trim();
@@ -1094,4 +1104,4 @@ export {
1094
1104
  readFileArgsAsync,
1095
1105
  expandInlineFileReferencesAsync
1096
1106
  };
1097
- //# sourceMappingURL=chunk-2HFZQUHL.js.map
1107
+ //# sourceMappingURL=chunk-N5XKWMDW.js.map