@iowarp/clio-coder 0.3.4 → 0.3.6

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 (265) hide show
  1. package/CHANGELOG.md +37 -2
  2. package/CONTRIBUTING.md +6 -6
  3. package/README.md +2 -2
  4. package/dist/{acp-S5R4RR5B.js → acp-2BEHC4DL.js} +4 -4
  5. package/dist/{agents-P6DMMVZY.js → agents-LNNFTM53.js} +13 -11
  6. package/dist/assets/codewiki.json +1 -1
  7. package/dist/{auth-2XCZLPKS.js → auth-KXXFI2VS.js} +6 -6
  8. package/dist/{chunk-YCWGATWI.js → chunk-24I7BN55.js} +2 -2
  9. package/dist/{chunk-EKMEHE4H.js → chunk-33YXPOE3.js} +2 -3
  10. package/dist/chunk-3BPUFZDL.js +37 -0
  11. package/dist/{chunk-WPQLXFOZ.js → chunk-43AOLP7E.js} +2 -2
  12. package/dist/{chunk-N4CZJQRK.js → chunk-5JGRAMKL.js} +4 -4
  13. package/dist/{chunk-BRXQQJFP.js → chunk-6US73PDB.js} +568 -47
  14. package/dist/{chunk-K6WL7QZT.js → chunk-6XXKFVSN.js} +2 -2
  15. package/dist/{chunk-QQK64KLB.js → chunk-CJUB2JJ2.js} +138 -20
  16. package/dist/{chunk-HV5X7OR2.js → chunk-CKXWIANG.js} +12 -12
  17. package/dist/{chunk-UZHIZC5S.js → chunk-CYQKWTG3.js} +61 -76
  18. package/dist/{chunk-QWU7ZBO7.js → chunk-DJVECN66.js} +204 -45
  19. package/dist/{chunk-ZWMF7253.js → chunk-E2ER4LJF.js} +304 -9
  20. package/dist/{chunk-7RXG6QRZ.js → chunk-EKY57CSP.js} +2 -75
  21. package/dist/{chunk-EDRHSCIE.js → chunk-EYPA3EGJ.js} +10 -2
  22. package/dist/{chunk-TTNYS3EA.js → chunk-G7MUEIGA.js} +1 -1
  23. package/dist/{chunk-BPGS2WCQ.js → chunk-GEYXPTRF.js} +2 -1
  24. package/dist/{chunk-BEY543CS.js → chunk-GOXNB3AO.js} +5 -2
  25. package/dist/{chunk-G4BMMOKF.js → chunk-HVDIIIQW.js} +2 -2
  26. package/dist/chunk-HWUFFB6L.js +83 -0
  27. package/dist/{chunk-35MKKU5R.js → chunk-K7T3E2SR.js} +15 -8
  28. package/dist/{chunk-VAWWTKDP.js → chunk-KHSFENX2.js} +2 -2
  29. package/dist/chunk-LCGCVYZ4.js +57 -0
  30. package/dist/{chunk-X6COSD2O.js → chunk-LYF7OHWH.js} +41 -14
  31. package/dist/{chunk-POHLU5DW.js → chunk-M6L6IDJG.js} +3 -3
  32. package/dist/{chunk-X4RCMKVQ.js → chunk-NDINPTJ4.js} +2 -2
  33. package/dist/{chunk-5M54SPOL.js → chunk-ODFEOB4F.js} +161 -5
  34. package/dist/{chunk-3JLKSKD7.js → chunk-OH3TOQTB.js} +5 -1
  35. package/dist/{chunk-MEQ45TQ4.js → chunk-PBTHKCPN.js} +18 -4
  36. package/dist/{chunk-ED4KHGC3.js → chunk-PPAMZ32Z.js} +9 -2
  37. package/dist/{chunk-QQL5RT5M.js → chunk-QM3F2GKX.js} +94 -36
  38. package/dist/{chunk-A2GZF7DC.js → chunk-QNQHSOLF.js} +4 -4
  39. package/dist/{chunk-KRPY7NTG.js → chunk-R46L2BIR.js} +3 -3
  40. package/dist/{chunk-BP4OYD6A.js → chunk-RY3LY4J5.js} +20 -2
  41. package/dist/{chunk-34475P3I.js → chunk-TSHXZTOQ.js} +5 -4
  42. package/dist/{chunk-VJWL6YS5.js → chunk-UUVG37B4.js} +2 -2
  43. package/dist/{chunk-2TZWSW76.js → chunk-WHGPSPT5.js} +2 -2
  44. package/dist/{chunk-TW3WDMVS.js → chunk-WHJYKASB.js} +2 -2
  45. package/dist/{chunk-YHZX5GEU.js → chunk-XAKHZX5N.js} +2 -2
  46. package/dist/{chunk-HXG4IURW.js → chunk-XE2VEJHX.js} +2 -2
  47. package/dist/{chunk-3HZ5RWN2.js → chunk-XF5N4U5A.js} +7 -6
  48. package/dist/{chunk-ZYKPLLNQ.js → chunk-XXQNGV4M.js} +590 -32
  49. package/dist/{chunk-4JUF2NNX.js → chunk-XYDYPRZI.js} +4 -4
  50. package/dist/{chunk-VMNQ6OZA.js → chunk-ZRGEBJ4T.js} +971 -794
  51. package/dist/{chunk-2LZI5CAG.js → chunk-ZXF4XRKW.js} +75 -33
  52. package/dist/{chunk-VSNATDE6.js → chunk-ZZMN5OM4.js} +2 -2
  53. package/dist/cli/index.js +31 -31
  54. package/dist/{clio-J5JIOIDS.js → clio-M2KGYUFZ.js} +2 -2
  55. package/dist/{code-nav-AXCXSBHX.js → code-nav-GQNL7XA6.js} +5 -5
  56. package/dist/codewiki/build-worker.js +4 -4
  57. package/dist/{components-KELWS457.js → components-5TTYYX6G.js} +3 -3
  58. package/dist/{config-OEBMIN2U.js → config-XUUYQIWO.js} +27 -25
  59. package/dist/{configure-PUQOSIXQ.js → configure-IHJ7YOMV.js} +7 -7
  60. package/dist/{context-URSXPBCK.js → context-74JLXAWD.js} +12 -12
  61. package/dist/{context-MGSE4Z2T.js → context-75MIWW3U.js} +24 -22
  62. package/dist/{context-EKDCKUUZ.js → context-ZQ7SIFJV.js} +8 -7
  63. package/dist/{context-clear-KDAJRNUK.js → context-clear-GYKWNUML.js} +24 -22
  64. package/dist/{context-index-BZ4UYMTC.js → context-index-SSR5ECNE.js} +3 -3
  65. package/dist/{context-working-set-SBKMPPI2.js → context-working-set-UX5KEP4J.js} +11 -10
  66. package/dist/{dispatch-runner-MSWN72NK.js → dispatch-runner-GIJBHNFL.js} +21 -20
  67. package/dist/{docs-2C2LTVT2.js → docs-6FZSCG5B.js} +3 -3
  68. package/dist/{doctor-7BSE27PJ.js → doctor-SVJ5BZCW.js} +4 -4
  69. package/dist/{eval-IZGDOO4H.js → eval-CG6LLBLD.js} +47 -232
  70. package/dist/{evidence-SR7WXB5B.js → evidence-ZYFIEN42.js} +19 -18
  71. package/dist/{evolve-K7VE2CBX.js → evolve-QGEXEMDW.js} +19 -18
  72. package/dist/{extensions-QVDOHDGJ.js → extensions-ADGNCJJD.js} +3 -3
  73. package/dist/{fleet-7XMJNQNF.js → fleet-S5R4ZOQY.js} +49 -30
  74. package/dist/{fleet-preflight-AQNAH644.js → fleet-preflight-BHSNPBMH.js} +2 -2
  75. package/dist/{init-JGNPAYXT.js → init-5DRU55YR.js} +31 -29
  76. package/dist/memory-7YKKR6UC.js +467 -0
  77. package/dist/{models-ZMMLFJNN.js → models-ZPOLRU2C.js} +10 -10
  78. package/dist/{monitor-2F3T5KHP.js → monitor-US5F5YGZ.js} +33 -18
  79. package/dist/{orchestrator-ORHT43JB.js → orchestrator-E2AL4T5N.js} +1092 -659
  80. package/dist/{paths-UXLN5YYZ.js → paths-E7KYAQWE.js} +3 -3
  81. package/dist/{reset-NXGTYNUO.js → reset-KZ652EK6.js} +3 -3
  82. package/dist/{run-RF4WJGMT.js → run-SRNBKDWD.js} +52 -40
  83. package/dist/{share-UT3W6E4M.js → share-CGZE33UP.js} +3 -3
  84. package/dist/{skills-PSACKC5Q.js → skills-S2X4DLY5.js} +4 -4
  85. package/dist/{skills-eval-WJSI55RZ.js → skills-eval-W2GGIC4R.js} +19 -18
  86. package/dist/{targets-PIIRAOYS.js → targets-54SWINWB.js} +14 -12
  87. package/dist/{terminal-lease-ULWXWNVY.js → terminal-lease-SAIF2OGY.js} +5 -4
  88. package/dist/{uninstall-FZCQCDKC.js → uninstall-BVLWXKBT.js} +3 -3
  89. package/dist/{upgrade-346TZ6AV.js → upgrade-JKAR27XC.js} +8 -8
  90. package/dist/{usage-6KKXR32N.js → usage-MSAWCLX4.js} +60 -27
  91. package/dist/{verifiers-4UUM6TEE.js → verifiers-NCBTHHN2.js} +60 -54
  92. package/dist/{wiki-generate-7STOCIFZ.js → wiki-generate-GUSOQ6ZP.js} +30 -28
  93. package/dist/worker/entry.js +69 -58
  94. package/dist/{workspace-G4ZWUIPR.js → workspace-ZJ6BFM3Q.js} +4 -4
  95. package/docs/README.md +3 -3
  96. package/docs/acp.md +1 -1
  97. package/docs/alcf-provider.md +1 -1
  98. package/docs/architecture.md +2 -2
  99. package/docs/artifact-placement.md +1 -2
  100. package/docs/artifact-versions.md +1 -1
  101. package/docs/built-in-agents.md +1 -1
  102. package/docs/capacity-and-scheduling.md +1 -1
  103. package/docs/commands-and-modes.md +9 -7
  104. package/docs/configuration-and-targets.md +12 -1
  105. package/docs/context-engine.md +4 -2
  106. package/docs/context-working-set.md +4 -4
  107. package/docs/development-pipeline.md +1 -1
  108. package/docs/documentation-coverage.md +3 -3
  109. package/docs/documentation-guide.md +2 -2
  110. package/docs/eval-runner.md +1 -1
  111. package/docs/evals-internal.md +4 -45
  112. package/docs/evidence-and-memory.md +67 -7
  113. package/docs/evolution.md +1 -1
  114. package/docs/exit-codes-and-output.md +1 -1
  115. package/docs/extensions-and-sharing.md +2 -2
  116. package/docs/fleet-dispatch.md +28 -2
  117. package/docs/installation-and-lifecycle.md +2 -2
  118. package/docs/middleware-and-components.md +19 -2
  119. package/docs/model-catalog.md +1 -1
  120. package/docs/observability.md +3 -3
  121. package/docs/proactive-memory.md +26 -16
  122. package/docs/prompt-envelope-and-tools.md +4 -2
  123. package/docs/provider-adapter-cookbook.md +1 -1
  124. package/docs/release-cut-checklist.md +38 -35
  125. package/docs/safety-model.md +29 -7
  126. package/docs/scientific-validation.md +3 -3
  127. package/docs/session-lifecycle.md +1 -1
  128. package/docs/skills-marketplace.md +1 -1
  129. package/docs/tool-usage.md +2 -2
  130. package/docs/trace-store.md +1 -1
  131. package/docs/troubleshooting.md +1 -1
  132. package/docs/tui-design.md +38 -4
  133. package/docs/worker-dispatch-mechanics.md +1 -1
  134. package/package.json +7 -4
  135. package/src/cli/agents.ts +2 -3
  136. package/src/cli/argv.ts +14 -1
  137. package/src/cli/fleet.ts +15 -0
  138. package/src/cli/index.ts +1 -1
  139. package/src/cli/memory.ts +272 -10
  140. package/src/cli/modes/json-stream.ts +2 -2
  141. package/src/cli/modes/print.ts +12 -1
  142. package/src/cli/run.ts +22 -2
  143. package/src/cli/targets.ts +12 -3
  144. package/src/cli/usage.ts +55 -7
  145. package/src/core/bus-events.ts +3 -0
  146. package/src/core/response-model-id.ts +134 -0
  147. package/src/core/toml.ts +62 -0
  148. package/src/core/workspace-files.ts +0 -1
  149. package/src/domains/agents/builtins/architect.md +1 -1
  150. package/src/domains/agents/catalog.ts +5 -4
  151. package/src/domains/agents/recipe.ts +54 -14
  152. package/src/domains/agents/result-contract.ts +7 -4
  153. package/src/domains/context/bootstrap.ts +36 -27
  154. package/src/domains/context/project-metadata.ts +19 -63
  155. package/src/domains/context/prompt-context.ts +8 -0
  156. package/src/domains/context/working-set/policies/index.ts +3 -4
  157. package/src/domains/dispatch/budget-envelope.ts +396 -0
  158. package/src/domains/dispatch/contract.ts +2 -0
  159. package/src/domains/dispatch/extension.ts +81 -27
  160. package/src/domains/dispatch/orphan-recovery.ts +1 -0
  161. package/src/domains/dispatch/receipt-integrity.ts +4 -0
  162. package/src/domains/dispatch/state.ts +1 -0
  163. package/src/domains/dispatch/types.ts +10 -3
  164. package/src/domains/dispatch/validation.ts +14 -0
  165. package/src/domains/dispatch/worker-spawn.ts +14 -3
  166. package/src/domains/eval/metrics/evidence.ts +0 -116
  167. package/src/domains/eval/metrics/invariants.ts +1 -1
  168. package/src/domains/eval/runners/clio-run.ts +1 -10
  169. package/src/domains/eval/runners/external-command.ts +2 -29
  170. package/src/domains/eval/schema/suite.ts +0 -7
  171. package/src/domains/eval/suites/run.ts +1 -7
  172. package/src/domains/memory/index.ts +22 -0
  173. package/src/domains/memory/operations.ts +58 -1
  174. package/src/domains/memory/promotion.ts +281 -0
  175. package/src/domains/memory/prompt-section.ts +25 -5
  176. package/src/domains/memory/proposal.ts +51 -7
  177. package/src/domains/memory/task-bank.ts +3 -2
  178. package/src/domains/memory/task-memory-handoff.ts +181 -24
  179. package/src/domains/memory/task-memory-policy.ts +3 -1
  180. package/src/domains/memory/types.ts +37 -0
  181. package/src/domains/memory/validate.ts +178 -0
  182. package/src/domains/middleware/memory-intervention.ts +35 -25
  183. package/src/domains/middleware/runtime.ts +6 -0
  184. package/src/domains/middleware/skills-reminder.ts +19 -4
  185. package/src/domains/middleware/stalled-turn.ts +43 -1
  186. package/src/domains/middleware/types.ts +10 -0
  187. package/src/domains/observability/contract.ts +6 -1
  188. package/src/domains/observability/cost.ts +20 -4
  189. package/src/domains/observability/extension.ts +2 -2
  190. package/src/domains/providers/index.ts +3 -0
  191. package/src/domains/providers/model-discovery.ts +9 -0
  192. package/src/domains/providers/runtime-resolution.ts +38 -1
  193. package/src/domains/providers/runtimes/common/probe-helpers.ts +97 -16
  194. package/src/domains/providers/types/context-window-slots.ts +18 -0
  195. package/src/domains/providers/types/runtime-descriptor.ts +3 -1
  196. package/src/domains/safety/call-target.ts +211 -14
  197. package/src/domains/safety/decision-presentation.ts +268 -0
  198. package/src/domains/safety/redaction.ts +73 -0
  199. package/src/domains/session/context-ledger.ts +10 -1
  200. package/src/domains/session/decision-board.ts +4 -0
  201. package/src/domains/session/entries.ts +3 -0
  202. package/src/domains/session/history.ts +68 -19
  203. package/src/domains/session/usage.ts +24 -7
  204. package/src/engine/acp/event-mapper.ts +7 -0
  205. package/src/engine/acp/server.ts +29 -2
  206. package/src/engine/apis/lmstudio.ts +25 -4
  207. package/src/engine/apis/openai-completions.ts +147 -22
  208. package/src/engine/claude/sdk-runtime.ts +8 -2
  209. package/src/engine/claude/tool-safety.ts +13 -0
  210. package/src/engine/loop-guard.ts +27 -3
  211. package/src/engine/worker-events.ts +4 -3
  212. package/src/engine/worker-runtime.ts +59 -54
  213. package/src/entry/orchestrator.ts +18 -1
  214. package/src/interactive/chat-loop-messages.ts +22 -0
  215. package/src/interactive/chat-loop.ts +13 -0
  216. package/src/interactive/chat-renderer.ts +19 -3
  217. package/src/interactive/clio-editor.ts +44 -7
  218. package/src/interactive/context-overlay.ts +43 -5
  219. package/src/interactive/cost-overlay.ts +39 -8
  220. package/src/interactive/dispatch-board.ts +212 -35
  221. package/src/interactive/footer/widgets.ts +13 -0
  222. package/src/interactive/interactive-application.ts +6 -1
  223. package/src/interactive/interactive-input-runtime.ts +11 -1
  224. package/src/interactive/interactive-presentation.ts +11 -1
  225. package/src/interactive/memory-overlay.ts +89 -4
  226. package/src/interactive/overlay-ask-user-lifecycle.ts +1 -1
  227. package/src/interactive/overlay-frame.ts +5 -2
  228. package/src/interactive/overlay-general-openers.ts +40 -1
  229. package/src/interactive/overlay-key-routing.ts +41 -1
  230. package/src/interactive/overlay-lifecycle.ts +11 -4
  231. package/src/interactive/overlay-permission-lifecycle.ts +23 -8
  232. package/src/interactive/overlay-transitions.ts +11 -0
  233. package/src/interactive/overlays/ask-user.ts +74 -30
  234. package/src/interactive/overlays/decisions.ts +3 -1
  235. package/src/interactive/permission-hint.ts +35 -0
  236. package/src/interactive/permission-overlay.ts +95 -45
  237. package/src/interactive/renderers/tool-execution.ts +19 -49
  238. package/src/interactive/session-last-turn.ts +8 -1
  239. package/src/interactive/session-usage-reseed.ts +36 -10
  240. package/src/interactive/slash-commands.ts +2 -2
  241. package/src/interactive/status/summary.ts +5 -0
  242. package/src/interactive/status/types.ts +5 -0
  243. package/src/interactive/terminal-lease.ts +1 -0
  244. package/src/interactive/turn-context.ts +96 -23
  245. package/src/interactive/turn-middleware.ts +1 -0
  246. package/src/interactive/turn-runtime.ts +37 -8
  247. package/src/interactive/turn-state.ts +3 -0
  248. package/src/interactive/worker-progress.ts +440 -0
  249. package/src/interactive/worker-stream.ts +51 -110
  250. package/src/tools/agent-tools.ts +28 -3
  251. package/src/tools/ask-user.ts +21 -1
  252. package/src/tools/context/index.ts +2 -2
  253. package/src/tools/dispatch-arguments.ts +8 -0
  254. package/src/tools/dispatch-event-text.ts +19 -0
  255. package/src/tools/dispatch.ts +24 -1
  256. package/src/tools/monitor.ts +15 -0
  257. package/src/tools/registry.ts +15 -5
  258. package/src/tools/result-disposition.ts +156 -0
  259. package/src/tools/result-shaping.ts +59 -1
  260. package/src/tools/verify/authoring.ts +55 -54
  261. package/src/tools/worker-evidence.ts +19 -0
  262. package/src/worker/spec-contract.ts +43 -3
  263. package/dist/chunk-EFADSJET.js +0 -18
  264. package/dist/memory-4ALKDJ4Q.js +0 -246
  265. package/src/domains/eval/metrics/chaos-stream.ts +0 -93
@@ -2,7 +2,7 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
2
2
  import {
3
3
  readStateInfo,
4
4
  runDoctor
5
- } from "./chunk-VAWWTKDP.js";
5
+ } from "./chunk-KHSFENX2.js";
6
6
  import {
7
7
  getVersionInfo
8
8
  } from "./chunk-XPLRXC72.js";
@@ -158,4 +158,4 @@ export {
158
158
  describeUpgradeNotice,
159
159
  LifecycleDomainModule
160
160
  };
161
- //# sourceMappingURL=chunk-K6WL7QZT.js.map
161
+ //# sourceMappingURL=chunk-6XXKFVSN.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
2
  import {
3
3
  probeWorkspace
4
- } from "./chunk-G4BMMOKF.js";
4
+ } from "./chunk-HVDIIIQW.js";
5
5
  import {
6
6
  entryBelongsToPath
7
7
  } from "./chunk-W6GROXXM.js";
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  isSessionEntry,
13
13
  isSessionHeader
14
- } from "./chunk-BEY543CS.js";
14
+ } from "./chunk-GOXNB3AO.js";
15
15
  import {
16
16
  stripTokenizerSentinels
17
17
  } from "./chunk-CFGTUFWB.js";
@@ -33,11 +33,90 @@ import {
33
33
  } from "./chunk-BNAZZHFG.js";
34
34
  import {
35
35
  BusChannels
36
- } from "./chunk-TTNYS3EA.js";
36
+ } from "./chunk-G7MUEIGA.js";
37
37
  import {
38
38
  init_esm_shims
39
39
  } from "./chunk-3R73A4XB.js";
40
40
 
41
+ // src/core/response-model-id.ts
42
+ init_esm_shims();
43
+ function emptyResponseModelIdObservationCounts() {
44
+ return { reportedCalls: 0, notReportedCalls: 0, notObservedCalls: 0, legacyDifferenceOnlyCalls: 0 };
45
+ }
46
+ function addResponseModelIdObservationCount(counts, observation, calls = 1) {
47
+ switch (observation.state) {
48
+ case "reported":
49
+ counts.reportedCalls += calls;
50
+ break;
51
+ case "not-reported":
52
+ counts.notReportedCalls += calls;
53
+ break;
54
+ case "not-observed":
55
+ counts.notObservedCalls += calls;
56
+ break;
57
+ case "legacy-difference-only":
58
+ counts.legacyDifferenceOnlyCalls += calls;
59
+ break;
60
+ }
61
+ }
62
+ function addResponseModelIdObservationCounts(counts, additional) {
63
+ counts.reportedCalls += additional.reportedCalls;
64
+ counts.notReportedCalls += additional.notReportedCalls;
65
+ counts.notObservedCalls += additional.notObservedCalls;
66
+ counts.legacyDifferenceOnlyCalls += additional.legacyDifferenceOnlyCalls;
67
+ }
68
+ function responseModelIdObservationCountsLabel(counts) {
69
+ const parts = [];
70
+ if (counts.reportedCalls > 0) parts.push(`reported ${counts.reportedCalls}`);
71
+ if (counts.notReportedCalls > 0) parts.push(`not reported ${counts.notReportedCalls}`);
72
+ if (counts.notObservedCalls > 0) parts.push(`not observed ${counts.notObservedCalls}`);
73
+ if (counts.legacyDifferenceOnlyCalls > 0) parts.push(`legacy difference-only ${counts.legacyDifferenceOnlyCalls}`);
74
+ return parts.join(", ");
75
+ }
76
+ function nonEmptyString(value) {
77
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
78
+ }
79
+ function parsedObservation(value) {
80
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
81
+ const record = value;
82
+ switch (record.state) {
83
+ case "reported": {
84
+ const reportedModelId = nonEmptyString(record.reportedModelId);
85
+ return reportedModelId === null ? null : { state: "reported", reportedModelId };
86
+ }
87
+ case "not-reported":
88
+ return { state: "not-reported" };
89
+ case "not-observed":
90
+ return { state: "not-observed" };
91
+ case "legacy-difference-only":
92
+ return { state: "legacy-difference-only", differingModelId: nonEmptyString(record.differingModelId) };
93
+ default:
94
+ return null;
95
+ }
96
+ }
97
+ function responseModelIdObservationFromRecord(record, missing) {
98
+ const current = parsedObservation(record.responseModelIdObservation);
99
+ if (current !== null) return current;
100
+ if (Object.hasOwn(record, "servedModel")) {
101
+ const reportedModelId = nonEmptyString(record.servedModel);
102
+ return reportedModelId === null ? { state: "not-reported" } : { state: "reported", reportedModelId };
103
+ }
104
+ if (missing === "not-observed") return { state: "not-observed" };
105
+ return { state: "legacy-difference-only", differingModelId: nonEmptyString(record.responseModel) };
106
+ }
107
+ function attributedModelId(observation, requestedModelId, differingResponseModelId) {
108
+ switch (observation.state) {
109
+ case "reported":
110
+ return observation.reportedModelId;
111
+ case "not-reported":
112
+ return "unknown";
113
+ case "not-observed":
114
+ return differingResponseModelId ?? requestedModelId;
115
+ case "legacy-difference-only":
116
+ return observation.differingModelId ?? requestedModelId;
117
+ }
118
+ }
119
+
41
120
  // src/domains/session/compaction/session-entries.ts
42
121
  init_esm_shims();
43
122
  function collectSessionEntries(turns, filePath) {
@@ -116,17 +195,11 @@ var PREVIEW_MAX_CHARS = 240;
116
195
  function collapseWhitespace(text) {
117
196
  return text.replace(/\s+/g, " ").trim();
118
197
  }
119
- function extractUserText(payload) {
120
- if (typeof payload === "string") {
121
- const collapsed = collapseWhitespace(payload);
122
- return collapsed.length > 0 ? collapsed : null;
123
- }
198
+ function rawMessageText(payload) {
199
+ if (typeof payload === "string") return payload.trim().length > 0 ? payload : null;
124
200
  if (!payload || typeof payload !== "object") return null;
125
201
  const obj = payload;
126
- if (typeof obj.text === "string") {
127
- const collapsed = collapseWhitespace(obj.text);
128
- if (collapsed.length > 0) return collapsed;
129
- }
202
+ if (typeof obj.text === "string" && obj.text.trim().length > 0) return obj.text;
130
203
  if (Array.isArray(obj.content)) {
131
204
  const parts = [];
132
205
  for (const part of obj.content) {
@@ -134,14 +207,41 @@ function extractUserText(payload) {
134
207
  parts.push(part.text);
135
208
  }
136
209
  }
137
- const joined = collapseWhitespace(parts.join(" "));
138
- if (joined.length > 0) return joined;
210
+ const joined = parts.join("\n");
211
+ if (joined.trim().length > 0) return joined;
139
212
  }
140
213
  return null;
141
214
  }
215
+ function extractMessageText(payload) {
216
+ const raw = rawMessageText(payload);
217
+ if (raw === null) return null;
218
+ const collapsed = collapseWhitespace(raw);
219
+ return collapsed.length > 0 ? collapsed : null;
220
+ }
221
+ function operatorTextOfUserPayload(payload) {
222
+ if (payload && typeof payload === "object" && typeof payload.operatorText === "string") {
223
+ const collapsed = collapseWhitespace(payload.operatorText);
224
+ return collapsed.length > 0 ? collapsed : null;
225
+ }
226
+ const text = rawMessageText(payload);
227
+ if (text === null) return null;
228
+ const stripped = collapseWhitespace(stripInjectedPreamble(text));
229
+ return stripped.length > 0 ? stripped : null;
230
+ }
231
+ var LEADING_SYSTEM_REMINDER = /^\s*<system-reminder>[\s\S]*?<\/system-reminder>\s*/u;
232
+ var LEADING_SKILL_REQUEST = /^\s*\[Skill request\][\s\S]*?Only these pending skill names are allowed this turn\.[^\n]*\s*/u;
233
+ function stripInjectedPreamble(text) {
234
+ let current = text;
235
+ for (; ; ) {
236
+ const next = current.replace(LEADING_SYSTEM_REMINDER, "").replace(LEADING_SKILL_REQUEST, "");
237
+ if (next === current) return current;
238
+ current = next;
239
+ }
240
+ }
142
241
  function scanCurrentJsonl(currentPath) {
143
242
  const result = {
144
243
  firstUserMessage: null,
244
+ firstAssistantMessage: null,
145
245
  messageCount: 0,
146
246
  lastTimestamp: null,
147
247
  name: null,
@@ -156,10 +256,14 @@ function scanCurrentJsonl(currentPath) {
156
256
  if (parsed.kind === "message" && parsed.role === "user") {
157
257
  result.messageCount += 1;
158
258
  if (result.firstUserMessage === null) {
159
- const text = extractUserText(parsed.payload);
259
+ const text = operatorTextOfUserPayload(parsed.payload);
160
260
  if (text !== null) result.firstUserMessage = text;
161
261
  }
162
262
  }
263
+ if (parsed.kind === "message" && parsed.role === "assistant" && result.firstAssistantMessage === null) {
264
+ const text = extractMessageText(parsed.payload);
265
+ if (text !== null) result.firstAssistantMessage = text;
266
+ }
163
267
  if (parsed.kind === "sessionInfo") {
164
268
  const info = parsed;
165
269
  if (info.name !== void 0) {
@@ -188,8 +292,9 @@ function enrichMetaForListing(meta, currentPath) {
188
292
  if (scan.name) meta.name = scan.name;
189
293
  const labelValues = [...scan.labels.values()].map((entry) => entry.label.trim()).filter((label) => label.length > 0);
190
294
  if (labelValues.length > 0) meta.labels = labelValues;
191
- if (scan.firstUserMessage) {
192
- meta.firstMessagePreview = scan.firstUserMessage.length > PREVIEW_MAX_CHARS ? `${scan.firstUserMessage.slice(0, PREVIEW_MAX_CHARS - 1)}\u2026` : scan.firstUserMessage;
295
+ const preview = scan.firstUserMessage ?? scan.firstAssistantMessage;
296
+ if (preview) {
297
+ meta.firstMessagePreview = preview.length > PREVIEW_MAX_CHARS ? `${preview.slice(0, PREVIEW_MAX_CHARS - 1)}\u2026` : preview;
193
298
  }
194
299
  if (scan.messageCount > 0) meta.messageCount = scan.messageCount;
195
300
  const fallbackMtime = readMtimeIso(currentPath);
@@ -1139,7 +1244,9 @@ function ledgerUsageCalls(entries, defaults = {}) {
1139
1244
  if (!usage2 || usage2.totalTokens <= 0) continue;
1140
1245
  calls.push({
1141
1246
  providerId: currentTarget ?? "unknown",
1142
- modelId: currentModel ?? "unknown",
1247
+ attributedModelId: currentModel ?? "unknown",
1248
+ requestedModelId: currentModel ?? "unknown",
1249
+ responseModelIdObservation: { state: "not-observed" },
1143
1250
  input: usage2.input,
1144
1251
  output: usage2.output,
1145
1252
  cacheRead: usage2.cacheRead,
@@ -1177,9 +1284,14 @@ function ledgerUsageCalls(entries, defaults = {}) {
1177
1284
  if (totalTokens === 0) continue;
1178
1285
  const cost = usage.cost;
1179
1286
  const costUsd = cost && typeof cost === "object" ? numberAt(cost, "total") : 0;
1287
+ const requestedModelId = currentModel ?? stringAt(record, "model") ?? "unknown";
1288
+ const differingResponseModelId = stringAt(record, "responseModel");
1289
+ const responseModelIdObservation = responseModelIdObservationFromRecord(record, "legacy-difference-only");
1180
1290
  calls.push({
1181
1291
  providerId: currentTarget ?? stringAt(record, "provider", "api") ?? "unknown",
1182
- modelId: currentModel ?? stringAt(record, "responseModel", "model") ?? "unknown",
1292
+ attributedModelId: attributedModelId(responseModelIdObservation, requestedModelId, differingResponseModelId),
1293
+ requestedModelId,
1294
+ responseModelIdObservation,
1183
1295
  input,
1184
1296
  output,
1185
1297
  cacheRead,
@@ -1346,6 +1458,12 @@ function compareStrings2(a, b) {
1346
1458
  }
1347
1459
 
1348
1460
  export {
1461
+ emptyResponseModelIdObservationCounts,
1462
+ addResponseModelIdObservationCount,
1463
+ addResponseModelIdObservationCounts,
1464
+ responseModelIdObservationCountsLabel,
1465
+ responseModelIdObservationFromRecord,
1466
+ attributedModelId,
1349
1467
  collectSessionEntries,
1350
1468
  readAuditRows,
1351
1469
  readSessionEntriesForId,
@@ -1357,4 +1475,4 @@ export {
1357
1475
  ledgerUsageCalls,
1358
1476
  SessionDomainModule
1359
1477
  };
1360
- //# sourceMappingURL=chunk-QQK64KLB.js.map
1478
+ //# sourceMappingURL=chunk-CJUB2JJ2.js.map
@@ -5,46 +5,46 @@ import {
5
5
  import {
6
6
  SchedulingDomainModule,
7
7
  createPromptsDomainModule
8
- } from "./chunk-3HZ5RWN2.js";
8
+ } from "./chunk-XF5N4U5A.js";
9
9
  import {
10
10
  AgentsDomainModule,
11
11
  SafetyDomainModule
12
- } from "./chunk-X6COSD2O.js";
12
+ } from "./chunk-LYF7OHWH.js";
13
13
  import {
14
14
  ConfigDomainModule,
15
15
  loadDomains
16
- } from "./chunk-KRPY7NTG.js";
16
+ } from "./chunk-R46L2BIR.js";
17
17
  import {
18
18
  createObservabilityDomainModule
19
- } from "./chunk-35MKKU5R.js";
19
+ } from "./chunk-K7T3E2SR.js";
20
20
  import {
21
21
  fallbackBootstrapOutput
22
- } from "./chunk-UZHIZC5S.js";
22
+ } from "./chunk-CYQKWTG3.js";
23
23
  import {
24
24
  renderCodewikiDigest
25
25
  } from "./chunk-5WIGXA4T.js";
26
26
  import {
27
27
  DispatchDomainModule
28
- } from "./chunk-QQL5RT5M.js";
28
+ } from "./chunk-QM3F2GKX.js";
29
29
  import {
30
30
  SessionDomainModule
31
- } from "./chunk-QQK64KLB.js";
31
+ } from "./chunk-CJUB2JJ2.js";
32
32
  import {
33
33
  ResourcesDomainModule
34
34
  } from "./chunk-MFFY33HR.js";
35
35
  import {
36
36
  MiddlewareDomainModule
37
- } from "./chunk-2LZI5CAG.js";
37
+ } from "./chunk-ZXF4XRKW.js";
38
38
  import {
39
39
  UnsupportedResponseSchemaError,
40
40
  isResponseSchemaRejection
41
- } from "./chunk-ZYKPLLNQ.js";
41
+ } from "./chunk-XXQNGV4M.js";
42
42
  import {
43
43
  parseJsonObjectPayload
44
- } from "./chunk-7RXG6QRZ.js";
44
+ } from "./chunk-EKY57CSP.js";
45
45
  import {
46
46
  ProvidersDomainModule
47
- } from "./chunk-QWU7ZBO7.js";
47
+ } from "./chunk-DJVECN66.js";
48
48
  import {
49
49
  init_esm_shims
50
50
  } from "./chunk-3R73A4XB.js";
@@ -673,4 +673,4 @@ export {
673
673
  validateInitOptions,
674
674
  bootstrapInputFromInitOptions
675
675
  };
676
- //# sourceMappingURL=chunk-HV5X7OR2.js.map
676
+ //# sourceMappingURL=chunk-CKXWIANG.js.map
@@ -1,13 +1,17 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
+ import {
3
+ createTomlFileReader,
4
+ tomlTableAt
5
+ } from "./chunk-LCGCVYZ4.js";
2
6
  import {
3
7
  renderCodewikiDigest
4
8
  } from "./chunk-5WIGXA4T.js";
5
9
  import {
6
10
  loadMemoryRecordsSync
7
- } from "./chunk-BRXQQJFP.js";
11
+ } from "./chunk-6US73PDB.js";
8
12
  import {
9
13
  sha256
10
- } from "./chunk-QQL5RT5M.js";
14
+ } from "./chunk-QM3F2GKX.js";
11
15
  import {
12
16
  WIKI_INDEX,
13
17
  WIKI_PLAN_FILE,
@@ -33,7 +37,7 @@ import {
33
37
  wikiStaleness,
34
38
  writeWikiMeta,
35
39
  writeWikiPlanFile
36
- } from "./chunk-X4RCMKVQ.js";
40
+ } from "./chunk-NDINPTJ4.js";
37
41
  import {
38
42
  buildCodewikiCandidate,
39
43
  coordinateCodewikiExclusive,
@@ -49,24 +53,24 @@ import {
49
53
  } from "./chunk-VG7TBQIY.js";
50
54
  import {
51
55
  detectProjectType
52
- } from "./chunk-YHZX5GEU.js";
56
+ } from "./chunk-XAKHZX5N.js";
53
57
  import {
54
58
  computeFingerprintCached,
55
59
  isStale
56
- } from "./chunk-VJWL6YS5.js";
60
+ } from "./chunk-UUVG37B4.js";
57
61
  import {
58
62
  codewikiPath,
59
63
  readCodewiki
60
64
  } from "./chunk-LBMZMYH2.js";
61
65
  import {
62
66
  enumerateWorkspaceFiles
63
- } from "./chunk-EKMEHE4H.js";
67
+ } from "./chunk-33YXPOE3.js";
64
68
  import {
65
69
  INTEROP_AGENT_KINDS
66
70
  } from "./chunk-IHXBNWMM.js";
67
71
  import {
68
72
  ceilChars
69
- } from "./chunk-BPGS2WCQ.js";
73
+ } from "./chunk-GEYXPTRF.js";
70
74
  import {
71
75
  require_dist
72
76
  } from "./chunk-APJ265NV.js";
@@ -76,7 +80,7 @@ import {
76
80
  } from "./chunk-BNAZZHFG.js";
77
81
  import {
78
82
  BusChannels
79
- } from "./chunk-TTNYS3EA.js";
83
+ } from "./chunk-G7MUEIGA.js";
80
84
  import {
81
85
  classifyProjectPreload
82
86
  } from "./chunk-JVCV3ICN.js";
@@ -1103,33 +1107,6 @@ function jsonRecord(cwd, relative6) {
1103
1107
  return null;
1104
1108
  }
1105
1109
  }
1106
- function tomlTableValue(raw, table, key) {
1107
- const lines = raw.split(/\r?\n/u);
1108
- let inTable = false;
1109
- for (const line of lines) {
1110
- const trimmed = line.trim();
1111
- if (trimmed.startsWith("[")) {
1112
- inTable = trimmed === `[${table}]`;
1113
- continue;
1114
- }
1115
- if (!inTable) continue;
1116
- const match = /^([A-Za-z0-9_-]+)\s*=\s*(.*)$/u.exec(trimmed);
1117
- if (!match || match[1] !== key) continue;
1118
- const value = (match[2] ?? "").trim();
1119
- const quoted = /^"((?:[^"\\]|\\.)*)"$/u.exec(value) ?? /^'([^']*)'$/u.exec(value);
1120
- if (!quoted) return null;
1121
- return (quoted[1] ?? "").replace(/\\"/gu, '"');
1122
- }
1123
- return null;
1124
- }
1125
- function hasTomlTable(raw, table) {
1126
- const header = `[${table}]`;
1127
- return raw.split(/\r?\n/u).some((line) => {
1128
- const trimmed = line.trim();
1129
- if (!trimmed.startsWith(header)) return false;
1130
- return /^\s*(?:#.*)?$/u.test(trimmed.slice(header.length));
1131
- });
1132
- }
1133
1110
  function keyEqualsValue(raw, key) {
1134
1111
  const match = new RegExp(`^[ \\t]*${key}[ \\t]*(?:\\+?=)[ \\t]*(.+)$`, "mu").exec(raw);
1135
1112
  const value = match?.[1]?.trim();
@@ -1172,24 +1149,28 @@ var packageJson = (cwd) => {
1172
1149
  if (!record) return null;
1173
1150
  return { file: "package.json", fragment: { name: name(record.name), description: description(record.description) } };
1174
1151
  };
1175
- var pyprojectToml = (cwd) => {
1176
- const raw = readText(cwd, "pyproject.toml");
1177
- if (raw === null) return null;
1178
- const projectName2 = tomlTableValue(raw, "project", "name") ?? tomlTableValue(raw, "tool.poetry", "name");
1179
- const projectDescription = tomlTableValue(raw, "project", "description") ?? tomlTableValue(raw, "tool.poetry", "description");
1152
+ var pyprojectToml = (_cwd, tomlFiles) => {
1153
+ const document = tomlFiles.read("pyproject.toml");
1154
+ if (document === null) return null;
1155
+ const project = tomlTableAt(document, ["project"]);
1156
+ const poetry = tomlTableAt(document, ["tool", "poetry"]);
1180
1157
  return {
1181
1158
  file: "pyproject.toml",
1182
- fragment: { name: name(projectName2), description: description(projectDescription) }
1159
+ fragment: {
1160
+ name: name(project?.name) ?? name(poetry?.name),
1161
+ description: description(project?.description) ?? description(poetry?.description)
1162
+ }
1183
1163
  };
1184
1164
  };
1185
- var cargoToml = (cwd) => {
1186
- const raw = readText(cwd, "Cargo.toml");
1187
- if (raw === null) return null;
1165
+ var cargoToml = (_cwd, tomlFiles) => {
1166
+ const document = tomlFiles.read("Cargo.toml");
1167
+ if (document === null) return null;
1168
+ const packageTable = tomlTableAt(document, ["package"]);
1188
1169
  return {
1189
1170
  file: "Cargo.toml",
1190
1171
  fragment: {
1191
- name: name(tomlTableValue(raw, "package", "name")),
1192
- description: description(tomlTableValue(raw, "package", "description"))
1172
+ name: name(packageTable?.name),
1173
+ description: description(packageTable?.description)
1193
1174
  }
1194
1175
  };
1195
1176
  };
@@ -1376,13 +1357,13 @@ function readmeTitle(content) {
1376
1357
  }
1377
1358
  return null;
1378
1359
  }
1379
- function readProjectMetadata(cwd) {
1360
+ function readProjectMetadata(cwd, tomlFiles = createTomlFileReader(cwd)) {
1380
1361
  const out3 = { name: null, description: null, nameSource: null, descriptionSource: null };
1381
1362
  for (const reader of METADATA_READERS) {
1382
1363
  if (out3.name !== null && out3.description !== null) break;
1383
1364
  let read;
1384
1365
  try {
1385
- read = reader(cwd);
1366
+ read = reader(cwd, tomlFiles);
1386
1367
  } catch {
1387
1368
  continue;
1388
1369
  }
@@ -1418,6 +1399,7 @@ function readProjectMetadata(cwd) {
1418
1399
 
1419
1400
  // src/domains/context/prompt-context.ts
1420
1401
  init_esm_shims();
1402
+ var HANDBOOK_ABSENT_FRAGMENT = "<handbook>none: this workspace has no CLIO-CODER.md, so do not read one; learn the repository from its files, and the operator can run /context init to write a handbook</handbook>";
1421
1403
  function renderPromptContext(cwd) {
1422
1404
  const projectType = detectProjectType(cwd);
1423
1405
  const pieces = [renderProjectTypeFragment(projectType)];
@@ -1428,6 +1410,7 @@ function renderPromptContext(cwd) {
1428
1410
  for (const issue of loadedClioMd.errors) {
1429
1411
  warnings.push(`clio: malformed ${issue.path} ignored: ${issue.error}`);
1430
1412
  }
1413
+ if (loadedClioMd.files.length === 0 && loadedClioMd.errors.length === 0) pieces.push(HANDBOOK_ABSENT_FRAGMENT);
1431
1414
  const codewiki = readCodewiki(cwd);
1432
1415
  if (codewiki) {
1433
1416
  const state = readClioState(cwd);
@@ -1485,8 +1468,8 @@ function projectNameFrom(metadata, cwd) {
1485
1468
  }
1486
1469
  return titleFromPackageName(parse(cwd).base || "Project");
1487
1470
  }
1488
- function projectName(cwd) {
1489
- return projectNameFrom(readProjectMetadata(cwd), cwd);
1471
+ function projectName(cwd, tomlFiles) {
1472
+ return projectNameFrom(readProjectMetadata(cwd, tomlFiles), cwd);
1490
1473
  }
1491
1474
  function projectTypeLabel(projectType) {
1492
1475
  switch (projectType) {
@@ -1521,8 +1504,8 @@ function projectTypeLabel(projectType) {
1521
1504
  function allContextText(files) {
1522
1505
  return files.map((file) => file.content).join("\n\n");
1523
1506
  }
1524
- function resolveDefaultIdentity(cwd, projectType, files) {
1525
- const metadata = readProjectMetadata(cwd);
1507
+ function resolveDefaultIdentity(cwd, projectType, files, tomlFiles) {
1508
+ const metadata = readProjectMetadata(cwd, tomlFiles);
1526
1509
  const name2 = projectNameFrom(metadata, cwd);
1527
1510
  const context = allContextText(files);
1528
1511
  if (/Clio owns the agent loop/i.test(context) && /pi-(?:ai|SDK)/i.test(context)) {
@@ -1544,8 +1527,8 @@ function resolveDefaultIdentity(cwd, projectType, files) {
1544
1527
  const role = /^[a-z]/.test(cleaned) ? `It is ${cleaned}.` : `${cleaned}.`;
1545
1528
  return { text: `${head} ${role}`.slice(0, 600), bare: false, descriptionSource: metadata.descriptionSource };
1546
1529
  }
1547
- function stabilizedIdentity(input, modelIdentity) {
1548
- const deterministic = resolveDefaultIdentity(input.cwd, input.projectType, input.siblingFiles);
1530
+ function stabilizedIdentity(input, modelIdentity, tomlFiles) {
1531
+ const deterministic = resolveDefaultIdentity(input.cwd, input.projectType, input.siblingFiles, tomlFiles);
1549
1532
  const model = typeof modelIdentity === "string" ? modelIdentity.trim() : "";
1550
1533
  if (deterministic.bare && model.length > 0) return model;
1551
1534
  return deterministic.text;
@@ -1687,22 +1670,17 @@ function cmakeVerificationLines(cwd) {
1687
1670
  if (test !== null) lines.push(`Run tests with \`ctest --preset ${test}\`.`);
1688
1671
  return lines;
1689
1672
  }
1690
- function pythonVerificationLines(cwd) {
1691
- let pyproject = "";
1692
- try {
1693
- pyproject = readFileSync4(join4(cwd, "pyproject.toml"), "utf8");
1694
- } catch {
1695
- pyproject = "";
1696
- }
1697
- if (existsSync4(join4(cwd, "tox.ini")) || hasTomlTable(pyproject, "tool.tox")) {
1673
+ function pythonVerificationLines(cwd, tomlFiles) {
1674
+ const pyproject = tomlFiles.read("pyproject.toml");
1675
+ if (existsSync4(join4(cwd, "tox.ini")) || pyproject !== null && tomlTableAt(pyproject, ["tool", "tox"])) {
1698
1676
  return ["Run `tox` before handoff."];
1699
1677
  }
1700
- if (existsSync4(join4(cwd, "pytest.ini")) || hasTomlTable(pyproject, "tool.pytest.ini_options")) {
1678
+ if (existsSync4(join4(cwd, "pytest.ini")) || pyproject !== null && tomlTableAt(pyproject, ["tool", "pytest", "ini_options"])) {
1701
1679
  return ["Run `pytest` before handoff."];
1702
1680
  }
1703
1681
  return [];
1704
1682
  }
1705
- function verificationSection(cwd) {
1683
+ function verificationSection(cwd, tomlFiles) {
1706
1684
  const scripts = packageScripts(cwd);
1707
1685
  const pm = packageManager(cwd);
1708
1686
  const hasScript = (name2) => typeof scripts[name2] === "string";
@@ -1730,13 +1708,14 @@ function verificationSection(cwd) {
1730
1708
  lines.push(`Use ${command("ci")} for the full local gate before committing broad or shared behavior changes.`);
1731
1709
  }
1732
1710
  lines.push(...cmakeVerificationLines(cwd));
1733
- if (existsSync4(join4(cwd, "Cargo.toml"))) {
1711
+ const cargo = tomlFiles.read("Cargo.toml");
1712
+ if (cargo !== null && (tomlTableAt(cargo, ["package"]) || tomlTableAt(cargo, ["workspace"]))) {
1734
1713
  lines.push("Run `cargo build` and `cargo test` before handoff.");
1735
1714
  }
1736
1715
  if (existsSync4(join4(cwd, "go.mod"))) {
1737
1716
  lines.push("Run `go build ./...` and `go test ./...` before handoff.");
1738
1717
  }
1739
- lines.push(...pythonVerificationLines(cwd));
1718
+ lines.push(...pythonVerificationLines(cwd, tomlFiles));
1740
1719
  if (lines.length === 0) return null;
1741
1720
  return { title: "Verification expectations", body: lines.join(" ") };
1742
1721
  }
@@ -1818,6 +1797,7 @@ function sanitizeModelSection(section, evidence) {
1818
1797
  return title.length > 0 ? { title, body } : null;
1819
1798
  }
1820
1799
  function stabilizeGeneratedOutput(input, base, onModelSectionRetained, groundModelOutput = false) {
1800
+ const tomlFiles = input.tomlFiles ?? createTomlFileReader(input.cwd);
1821
1801
  const existing = input.existingClioMd;
1822
1802
  const conventions = [];
1823
1803
  for (const convention of existing?.conventions ?? []) pushUnique(conventions, convention);
@@ -1827,7 +1807,7 @@ function stabilizeGeneratedOutput(input, base, onModelSectionRetained, groundMod
1827
1807
  const invariants = [];
1828
1808
  for (const invariant of existing?.invariants ?? []) pushUnique(invariants, invariant);
1829
1809
  for (const invariant of inferInvariants(input.siblingFiles)) pushUnique(invariants, invariant);
1830
- const verification = verificationSection(input.cwd);
1810
+ const verification = verificationSection(input.cwd, tomlFiles);
1831
1811
  const inferredSections = inferHeuristicSections(input);
1832
1812
  const existingSections = existing?.sections ?? [];
1833
1813
  const ordinarySections = [];
@@ -1854,8 +1834,8 @@ function stabilizeGeneratedOutput(input, base, onModelSectionRetained, groundMod
1854
1834
  }
1855
1835
  return {
1856
1836
  ...base,
1857
- projectName: existing?.projectName ?? projectName(input.cwd),
1858
- identity: existing?.identity ?? stabilizedIdentity(input, base.identity),
1837
+ projectName: existing?.projectName ?? projectName(input.cwd, tomlFiles),
1838
+ identity: existing?.identity ?? stabilizedIdentity(input, base.identity, tomlFiles),
1859
1839
  conventions: conventions.slice(0, 6),
1860
1840
  invariants: invariants.slice(0, 3),
1861
1841
  sections: [...retainedOrdinarySections, ...verification ? [verification] : []]
@@ -1897,9 +1877,11 @@ function inferHeuristicSections(input) {
1897
1877
  return sections.slice(0, 6);
1898
1878
  }
1899
1879
  function heuristicBootstrapOutputSync(input) {
1900
- return stabilizeGeneratedOutput(input, {
1901
- projectName: projectName(input.cwd),
1902
- identity: resolveDefaultIdentity(input.cwd, input.projectType, input.siblingFiles).text,
1880
+ const tomlFiles = input.tomlFiles ?? createTomlFileReader(input.cwd);
1881
+ const sharedInput = input.tomlFiles ? input : { ...input, tomlFiles };
1882
+ return stabilizeGeneratedOutput(sharedInput, {
1883
+ projectName: projectName(input.cwd, tomlFiles),
1884
+ identity: resolveDefaultIdentity(input.cwd, input.projectType, input.siblingFiles, tomlFiles).text,
1903
1885
  conventions: inferConventions(input.cwd, input.siblingFiles, input.codewiki),
1904
1886
  invariants: inferInvariants(input.siblingFiles),
1905
1887
  sections: inferHeuristicSections(input)
@@ -2210,6 +2192,7 @@ function codewikiEntryPoints(codewiki, limit = 6) {
2210
2192
  }
2211
2193
  async function runBootstrap(input = {}) {
2212
2194
  const cwd = input.cwd ?? process.cwd();
2195
+ const tomlFiles = createTomlFileReader(cwd);
2213
2196
  const projectType = detectProjectType(cwd);
2214
2197
  progress(input, {
2215
2198
  phase: "scan",
@@ -2286,7 +2269,8 @@ async function runBootstrap(input = {}) {
2286
2269
  });
2287
2270
  output = await (input.generate ?? heuristicBootstrapOutput)({
2288
2271
  cwd,
2289
- expectedProjectName: projectName(cwd),
2272
+ expectedProjectName: projectName(cwd, tomlFiles),
2273
+ tomlFiles,
2290
2274
  projectType,
2291
2275
  siblingFiles,
2292
2276
  adoption,
@@ -2301,7 +2285,8 @@ async function runBootstrap(input = {}) {
2301
2285
  output = stabilizeGeneratedOutput(
2302
2286
  {
2303
2287
  cwd,
2304
- expectedProjectName: projectName(cwd),
2288
+ expectedProjectName: projectName(cwd, tomlFiles),
2289
+ tomlFiles,
2305
2290
  projectType,
2306
2291
  siblingFiles,
2307
2292
  adoption,
@@ -2329,7 +2314,7 @@ async function runBootstrap(input = {}) {
2329
2314
  detail: `${generation.mode}; parser=${generation.parserOutcome}`
2330
2315
  });
2331
2316
  } else {
2332
- output = existingParsed ? bootstrapOutputFromParsed(existingParsed) : await heuristicBootstrapOutput({ cwd, projectType, siblingFiles, adoption, codewiki });
2317
+ output = existingParsed ? bootstrapOutputFromParsed(existingParsed) : await heuristicBootstrapOutput({ cwd, tomlFiles, projectType, siblingFiles, adoption, codewiki });
2333
2318
  progress(input, {
2334
2319
  phase: "generate",
2335
2320
  status: "completed",
@@ -4172,4 +4157,4 @@ export {
4172
4157
  buildWikiPlanPrompt,
4173
4158
  buildWikiPagePrompt
4174
4159
  };
4175
- //# sourceMappingURL=chunk-UZHIZC5S.js.map
4160
+ //# sourceMappingURL=chunk-CYQKWTG3.js.map