@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
@@ -10,17 +10,17 @@ import {
10
10
  import {
11
11
  FAILURE_CAUSE_TAGS,
12
12
  buildEvidence
13
- } from "./chunk-QQL5RT5M.js";
13
+ } from "./chunk-QM3F2GKX.js";
14
14
  import {
15
15
  normalizeCostProvenance
16
- } from "./chunk-QWU7ZBO7.js";
16
+ } from "./chunk-DJVECN66.js";
17
17
  import {
18
18
  clioDataDir,
19
19
  clioStateDir
20
20
  } from "./chunk-BNAZZHFG.js";
21
21
  import {
22
22
  BusChannels
23
- } from "./chunk-TTNYS3EA.js";
23
+ } from "./chunk-G7MUEIGA.js";
24
24
  import {
25
25
  init_esm_shims
26
26
  } from "./chunk-3R73A4XB.js";
@@ -71,7 +71,7 @@ function createCostTracker() {
71
71
  let total = 0;
72
72
  const totals = emptyBreakdown();
73
73
  return {
74
- accumulate(providerId, modelId, tokens, usd, breakdown, costProvenance) {
74
+ accumulate(providerId, attributedModelId, tokens, usd, breakdown, costProvenance, modelIdFacts) {
75
75
  const resolvedUsd = usd ?? 0;
76
76
  const provenance = normalizeCostProvenance(costProvenance);
77
77
  const input = breakdown?.input ?? 0;
@@ -82,7 +82,14 @@ function createCostTracker() {
82
82
  const apiCalls = breakdown?.apiCalls;
83
83
  log.push({
84
84
  providerId,
85
- modelId,
85
+ attributedModelId,
86
+ requestedModelIds: [...modelIdFacts?.requestedModelIds ?? [attributedModelId]],
87
+ responseModelIdObservationCounts: modelIdFacts ? { ...modelIdFacts.responseModelIdObservationCounts } : {
88
+ reportedCalls: 0,
89
+ notReportedCalls: 0,
90
+ notObservedCalls: apiCalls ?? 1,
91
+ legacyDifferenceOnlyCalls: 0
92
+ },
86
93
  tokens,
87
94
  usd: resolvedUsd,
88
95
  provenance,
@@ -742,9 +749,9 @@ function createObservabilityBundle(context, options = {}) {
742
749
  latestThroughput = null;
743
750
  projection.refresh();
744
751
  },
745
- recordTokens(providerId, modelId, tokens, costUsd, breakdown, costProvenance) {
752
+ recordTokens(providerId, attributedModelId, tokens, costUsd, breakdown, costProvenance, modelIdFacts) {
746
753
  telemetry.record("counter", "tokens.total", tokens);
747
- cost.accumulate(providerId, modelId, tokens, costUsd, breakdown, costProvenance);
754
+ cost.accumulate(providerId, attributedModelId, tokens, costUsd, breakdown, costProvenance, modelIdFacts);
748
755
  projection.refresh();
749
756
  },
750
757
  recordSessionTurn(sessionTurn) {
@@ -794,4 +801,4 @@ export {
794
801
  ObservabilityDomainModule,
795
802
  createObservabilityDomainModule
796
803
  };
797
- //# sourceMappingURL=chunk-35MKKU5R.js.map
804
+ //# sourceMappingURL=chunk-K7T3E2SR.js.map
@@ -337,7 +337,7 @@ async function runDoctorFleetChecks(projectRoot = process.cwd()) {
337
337
  }
338
338
  const nodes = settings.fleet?.nodes ?? [];
339
339
  if (nodes.length === 0) return [];
340
- const { recordFleetPreflight, runFleetNodePreflight } = await import("./fleet-preflight-AQNAH644.js");
340
+ const { recordFleetPreflight, runFleetNodePreflight } = await import("./fleet-preflight-BHSNPBMH.js");
341
341
  const targets = (settings.targets ?? []).map((target) => ({
342
342
  id: target.id,
343
343
  runtimeId: target.runtime,
@@ -437,4 +437,4 @@ export {
437
437
  runDoctorInteropChecks,
438
438
  runDoctorRuntimeChecks
439
439
  };
440
- //# sourceMappingURL=chunk-VAWWTKDP.js.map
440
+ //# sourceMappingURL=chunk-KHSFENX2.js.map
@@ -0,0 +1,57 @@
1
+ import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
+ import {
3
+ init_esm_shims
4
+ } from "./chunk-3R73A4XB.js";
5
+
6
+ // src/core/toml.ts
7
+ init_esm_shims();
8
+ import { readFileSync } from "node:fs";
9
+ import { createRequire } from "node:module";
10
+ import { join } from "node:path";
11
+ var require2 = createRequire(import.meta.url);
12
+ var parse;
13
+ function parser() {
14
+ parse ??= require2("smol-toml").parse;
15
+ return parse;
16
+ }
17
+ function parseTomlDocument(raw) {
18
+ try {
19
+ return parser()(raw);
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+ function isTomlTable(value) {
25
+ return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date);
26
+ }
27
+ function tomlTableAt(document, path) {
28
+ let value = document;
29
+ for (const segment of path) {
30
+ if (!isTomlTable(value) || !Object.hasOwn(value, segment)) return null;
31
+ value = value[segment];
32
+ }
33
+ return isTomlTable(value) ? value : null;
34
+ }
35
+ function createTomlFileReader(root) {
36
+ const documents = /* @__PURE__ */ new Map();
37
+ return {
38
+ read(relativePath) {
39
+ if (documents.has(relativePath)) return documents.get(relativePath) ?? null;
40
+ let document = null;
41
+ try {
42
+ document = parseTomlDocument(readFileSync(join(root, relativePath), "utf8"));
43
+ } catch {
44
+ document = null;
45
+ }
46
+ documents.set(relativePath, document);
47
+ return document;
48
+ }
49
+ };
50
+ }
51
+
52
+ export {
53
+ parseTomlDocument,
54
+ tomlTableAt,
55
+ createTomlFileReader
56
+ };
57
+ //# sourceMappingURL=chunk-LCGCVYZ4.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
  assertAgentIdNamespace
4
- } from "./chunk-KRPY7NTG.js";
4
+ } from "./chunk-R46L2BIR.js";
5
5
  import {
6
6
  parseFrontmatter
7
7
  } from "./chunk-QKMUKYO7.js";
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  createSafetyPolicyEngine,
23
23
  parseResultContract
24
- } from "./chunk-7RXG6QRZ.js";
24
+ } from "./chunk-EKY57CSP.js";
25
25
  import {
26
26
  assertAgentSpecPolicy,
27
27
  classify,
@@ -42,7 +42,7 @@ import {
42
42
  import {
43
43
  BusChannels,
44
44
  isRunAbortedPayload
45
- } from "./chunk-TTNYS3EA.js";
45
+ } from "./chunk-G7MUEIGA.js";
46
46
  import {
47
47
  resolvePackageRoot
48
48
  } from "./chunk-IWHMRKLL.js";
@@ -65,20 +65,16 @@ import path2 from "node:path";
65
65
  // src/domains/agents/recipe.ts
66
66
  init_esm_shims();
67
67
  import path from "node:path";
68
- var AGENT_BUDGET_KEYS = ["toolCalls", "readReserve", "synthesis"];
69
- function parseAgentBudget(value, sourcePath) {
70
- if (value === void 0) return void 0;
71
- const prefix = `agent budget: ${sourcePath}: budget`;
68
+ var AGENT_BUDGET_KEYS = ["toolCalls", "readReserve", "synthesis", "maximum"];
69
+ function parseAgentBudgetPhase(value, prefix, relationTarget) {
72
70
  if (value === null || typeof value !== "object" || Array.isArray(value)) {
73
71
  throw new Error(`${prefix} must be a non-null YAML object`);
74
72
  }
75
73
  const record = value;
76
74
  for (const key of Object.keys(record)) {
77
- if (!AGENT_BUDGET_KEYS.includes(key)) {
78
- throw new Error(`${prefix}.${key} is unknown`);
79
- }
75
+ if (key !== "toolCalls" && key !== "readReserve") throw new Error(`${prefix}.${key} is unknown`);
80
76
  }
81
- for (const key of AGENT_BUDGET_KEYS) {
77
+ for (const key of ["toolCalls", "readReserve"]) {
82
78
  if (!Object.hasOwn(record, key)) throw new Error(`${prefix}.${key} is required`);
83
79
  }
84
80
  const toolCalls = record.toolCalls;
@@ -91,10 +87,41 @@ function parseAgentBudget(value, sourcePath) {
91
87
  throw new Error(`${prefix}.readReserve must be a finite safe integer`);
92
88
  }
93
89
  if (readReserve < 0) throw new Error(`${prefix}.readReserve must be greater than or equal to 0`);
94
- if (readReserve >= toolCalls) throw new Error(`${prefix}.readReserve must be less than budget.toolCalls`);
90
+ if (readReserve >= toolCalls) throw new Error(`${prefix}.readReserve must be less than ${relationTarget}`);
91
+ return { toolCalls, readReserve };
92
+ }
93
+ function parseAgentBudget(value, sourcePath) {
94
+ if (value === void 0) return void 0;
95
+ const prefix = `agent budget: ${sourcePath}: budget`;
96
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
97
+ throw new Error(`${prefix} must be a non-null YAML object`);
98
+ }
99
+ const record = value;
100
+ for (const key of Object.keys(record)) {
101
+ if (!AGENT_BUDGET_KEYS.includes(key)) {
102
+ throw new Error(`${prefix}.${key} is unknown`);
103
+ }
104
+ }
105
+ for (const key of ["toolCalls", "readReserve", "synthesis"]) {
106
+ if (!Object.hasOwn(record, key)) throw new Error(`${prefix}.${key} is required`);
107
+ }
108
+ const phase = parseAgentBudgetPhase(
109
+ { toolCalls: record.toolCalls, readReserve: record.readReserve },
110
+ prefix,
111
+ "budget.toolCalls"
112
+ );
95
113
  const synthesis = record.synthesis;
96
114
  if (typeof synthesis !== "boolean") throw new Error(`${prefix}.synthesis must be a boolean`);
97
- return { toolCalls, readReserve, synthesis };
115
+ const maximum = record.maximum === void 0 ? void 0 : parseAgentBudgetPhase(record.maximum, `${prefix}.maximum`, "budget.maximum.toolCalls");
116
+ if (maximum !== void 0) {
117
+ if (maximum.toolCalls < phase.toolCalls) {
118
+ throw new Error(`${prefix}.maximum.toolCalls must be greater than or equal to budget.toolCalls`);
119
+ }
120
+ if (maximum.readReserve < phase.readReserve) {
121
+ throw new Error(`${prefix}.maximum.readReserve must be greater than or equal to budget.readReserve`);
122
+ }
123
+ }
124
+ return { ...phase, synthesis, ...maximum === void 0 ? {} : { maximum } };
98
125
  }
99
126
  function recipeIdFromPath(absPath, rootDir) {
100
127
  const resolvedRoot = path.resolve(rootDir);
@@ -1036,4 +1063,4 @@ export {
1036
1063
  AgentsDomainModule,
1037
1064
  SafetyDomainModule
1038
1065
  };
1039
- //# sourceMappingURL=chunk-X6COSD2O.js.map
1066
+ //# sourceMappingURL=chunk-LYF7OHWH.js.map
@@ -3,7 +3,7 @@ import {
3
3
  createSlicer,
4
4
  isIndexablePath,
5
5
  languageForPath
6
- } from "./chunk-VJWL6YS5.js";
6
+ } from "./chunk-UUVG37B4.js";
7
7
  import {
8
8
  CODEWIKI_VERSION
9
9
  } from "./chunk-LBMZMYH2.js";
@@ -11,7 +11,7 @@ import {
11
11
  WORKSPACE_EXCLUDED_DIRS,
12
12
  enumerateWorkspaceFilesAsync,
13
13
  filterWorkspaceFileCandidates
14
- } from "./chunk-EKMEHE4H.js";
14
+ } from "./chunk-33YXPOE3.js";
15
15
  import {
16
16
  classifyCHeaderLanguage,
17
17
  isAmbiguousHeaderPath
@@ -1183,4 +1183,4 @@ export {
1183
1183
  updateCodewikiPaths,
1184
1184
  syncCodewiki
1185
1185
  };
1186
- //# sourceMappingURL=chunk-POHLU5DW.js.map
1186
+ //# sourceMappingURL=chunk-M6L6IDJG.js.map
@@ -2,7 +2,7 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
2
2
  import {
3
3
  computeFingerprint,
4
4
  computeFingerprintAsync
5
- } from "./chunk-VJWL6YS5.js";
5
+ } from "./chunk-UUVG37B4.js";
6
6
  import {
7
7
  require_dist
8
8
  } from "./chunk-APJ265NV.js";
@@ -638,4 +638,4 @@ export {
638
638
  wikiStaleness,
639
639
  wikiStalenessAsync
640
640
  };
641
- //# sourceMappingURL=chunk-X4RCMKVQ.js.map
641
+ //# sourceMappingURL=chunk-NDINPTJ4.js.map
@@ -47,18 +47,16 @@ function truncateTail2(content, options = {}) {
47
47
  return truncateTail(content, withClioDefaults(options));
48
48
  }
49
49
 
50
- // src/tools/observation.ts
51
- init_esm_shims();
52
-
53
50
  // src/tools/result-shaping.ts
54
51
  init_esm_shims();
55
52
  import { createHash as createHash2 } from "node:crypto";
56
- import { mkdirSync, writeFileSync } from "node:fs";
53
+ import { mkdirSync, readdirSync, rmdirSync, rmSync, statSync, writeFileSync } from "node:fs";
57
54
  import { isAbsolute, join, relative, resolve } from "node:path";
58
55
 
59
56
  // src/tools/result-disposition.ts
60
57
  init_esm_shims();
61
58
  import { createHash } from "node:crypto";
59
+ var TOOL_RESULT_DIGEST_MAX_BYTES = 240;
62
60
  var ESSENTIAL_DETAIL_KEYS = /* @__PURE__ */ new Set([
63
61
  "aborted",
64
62
  "continuation",
@@ -158,6 +156,13 @@ function utf8Suffix(text, maxBytes) {
158
156
  function capUtf8(text, maxBytes) {
159
157
  return byteLength(text) <= maxBytes ? text : utf8Prefix(text, maxBytes);
160
158
  }
159
+ function capDigestUtf8(text, maxBytes) {
160
+ if (byteLength(text) <= maxBytes) return text;
161
+ const marker = "\u2026";
162
+ const markerBytes = byteLength(marker);
163
+ if (markerBytes >= maxBytes) return utf8Prefix(text, maxBytes);
164
+ return `${utf8Prefix(text, maxBytes - markerBytes).trimEnd()}${marker}`;
165
+ }
161
166
  function boundedToolResultExcerpt(text, maxBytes, bias = "head-tail") {
162
167
  if (maxBytes <= 0) return "";
163
168
  if (byteLength(text) <= maxBytes) return text;
@@ -349,6 +354,105 @@ ${trailer}`;
349
354
  truncated: byteLength(header) + 1 + byteLength(body) > maxBytes || !capturedTextIsComplete
350
355
  };
351
356
  }
357
+ var DIGEST_FACT_KEYS = [
358
+ "outcome",
359
+ "exitCode",
360
+ "timedOut",
361
+ "aborted",
362
+ "outputCapped",
363
+ "signal",
364
+ "status",
365
+ "error",
366
+ "decision",
367
+ "next"
368
+ ];
369
+ function digestFactText(details) {
370
+ if (details === void 0) return "";
371
+ const facts = [];
372
+ for (const key of DIGEST_FACT_KEYS) {
373
+ if (details[key] !== void 0) facts.push(`${key}=${stableJson(details[key])}`);
374
+ }
375
+ return facts.join(" ");
376
+ }
377
+ function projectionBody(input, projection) {
378
+ if (projection.appliedMode === "metadata-only") return "";
379
+ if (projection.appliedMode === "full") {
380
+ const trailer = fullTrailer(input);
381
+ return trailer.length > 0 && projection.text.endsWith(`
382
+
383
+ ${trailer}`) ? projection.text.slice(0, -(trailer.length + 2)) : projection.text;
384
+ }
385
+ const header = contextHeader(input, projection.appliedMode, projection.truncated, projection.summaryProvenance);
386
+ const prefix = `${header}
387
+ `;
388
+ return projection.text.startsWith(prefix) ? projection.text.slice(prefix.length) : "";
389
+ }
390
+ function digestText(status, facts, body, redactions, maxBytes) {
391
+ const tally = createRedactionTally();
392
+ const safeStatus = redactSecretsText(status, tally);
393
+ const safeFacts = redactSecretsText(facts, tally);
394
+ const statusAndFacts = [safeStatus, safeFacts].filter((value) => value.length > 0).join(" ");
395
+ const bodyBudget = Math.max(0, maxBytes - byteLength(statusAndFacts) - 2);
396
+ const selected = deterministicDiagnosticSummary(body, bodyBudget, true);
397
+ const candidate = [statusAndFacts, selected.text.replace(/\s+/gu, " ").trim()].filter((value) => value.length > 0).join("; ");
398
+ return {
399
+ text: capDigestUtf8(candidate, maxBytes),
400
+ redactions: redactions + tally.count + selected.redactions
401
+ };
402
+ }
403
+ function deterministicToolResultDigest(input, maxBytes = TOOL_RESULT_DIGEST_MAX_BYTES) {
404
+ const projection = projectToolResultContext(input);
405
+ const status = [
406
+ `kind=${input.kind}`,
407
+ `mode=${projection.appliedMode}`,
408
+ `truncated=${String(projection.truncated)}`,
409
+ ...projection.appliedMode === "metadata-only" || projection.truncated ? [`capturedBytes=${input.capturedBytes}`] : []
410
+ ].join(" ");
411
+ const digest = digestText(
412
+ status,
413
+ digestFactText(input.details),
414
+ projectionBody(input, projection),
415
+ projection.summaryProvenance?.redactions ?? 0,
416
+ Math.max(1, Math.floor(maxBytes))
417
+ );
418
+ return {
419
+ text: digest.text,
420
+ provenance: {
421
+ producer: "code",
422
+ source: "canonical-result-disposition",
423
+ algorithm: "redacted-context-digest-v1",
424
+ contextMode: projection.appliedMode,
425
+ ...projection.summaryProvenance === void 0 ? {} : { summaryAlgorithm: projection.summaryProvenance.algorithm },
426
+ ...digest.redactions > 0 ? { redactions: digest.redactions } : {}
427
+ }
428
+ };
429
+ }
430
+ function legacyToolResultDigest(text, options) {
431
+ const maxBytes = Math.max(1, Math.floor(options.maxBytes ?? TOOL_RESULT_DIGEST_MAX_BYTES));
432
+ const fallback = options.outcome === "error" && text.trim().length === 0 ? "an unknown tool error" : text;
433
+ const digest = digestText("", "", fallback, 0, maxBytes);
434
+ return {
435
+ text: digest.text,
436
+ provenance: {
437
+ producer: "code",
438
+ source: "legacy-fallback",
439
+ algorithm: "redacted-legacy-digest-v1",
440
+ ...digest.redactions > 0 ? { redactions: digest.redactions } : {}
441
+ }
442
+ };
443
+ }
444
+ function sanitizeToolResultDigest(digest, maxBytes = TOOL_RESULT_DIGEST_MAX_BYTES) {
445
+ const tally = createRedactionTally();
446
+ const safe = redactSecretsText(digest.text, tally).replace(/\s+/gu, " ").trim();
447
+ const redactions = (digest.provenance.redactions ?? 0) + tally.count;
448
+ return {
449
+ text: capDigestUtf8(safe, Math.max(1, Math.floor(maxBytes))),
450
+ provenance: {
451
+ ...digest.provenance,
452
+ ...redactions > 0 ? { redactions } : {}
453
+ }
454
+ };
455
+ }
352
456
  function toolResultContextText(result) {
353
457
  if (result.modelContext !== void 0) return result.modelContext;
354
458
  return result.kind === "ok" ? result.output : result.message;
@@ -387,6 +491,7 @@ var DEFAULT_TOOL_RESULT_MAX_BYTES = DEFAULT_MAX_BYTES + 2 * 1024;
387
491
  var RESULT_TRUNCATION_MARKER = "\n[tool result truncated]";
388
492
  var RESULT_OFFLOAD_MAX_BYTES = 10 * 1024 * 1024;
389
493
  var TAIL_NOTICE_RESERVE_BYTES = 512;
494
+ var TOOL_OFFLOAD_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
390
495
  function mergeDetails(details, resultSize) {
391
496
  return { ...details ?? {}, resultSize };
392
497
  }
@@ -401,6 +506,25 @@ function offloadMaxBytesFor(spec) {
401
506
  const configured = spec.metadata?.resultSizePolicy?.offloadMaxBytes;
402
507
  return typeof configured === "number" && Number.isFinite(configured) && configured > 0 ? Math.floor(configured) : RESULT_OFFLOAD_MAX_BYTES;
403
508
  }
509
+ function toolResultDigestFor(spec, result, requestedDisposition) {
510
+ const text = resultText(result);
511
+ const disposition = normalizeToolResultDisposition(spec, maxBytesFor(spec), requestedDisposition);
512
+ if (disposition === null) {
513
+ const projected = shapeLegacyToolResult(spec, result);
514
+ return legacyToolResultDigest(resultText(projected), { outcome: result.kind });
515
+ }
516
+ const capturedBytes = capturedBytesFor(result, text);
517
+ return deterministicToolResultDigest({
518
+ text,
519
+ kind: result.kind,
520
+ details: result.details,
521
+ disposition,
522
+ capturedBytes,
523
+ displayedBytes: Math.min(capturedBytes, disposition.presentation.maxBytes),
524
+ offloadPath: existingOffloadPath(result.details),
525
+ followUpHint: followUpHint(spec)
526
+ });
527
+ }
404
528
  function detailsRecord(details, key) {
405
529
  const candidate = details?.[key];
406
530
  return candidate !== null && typeof candidate === "object" && !Array.isArray(candidate) ? candidate : null;
@@ -426,6 +550,33 @@ function offloadBody(text, bytes, maxBytes) {
426
550
  const prefixBudget = maxBytes - byteLength(notice);
427
551
  return `${truncateUtf8(text, Math.max(0, prefixBudget), "")}${notice}`;
428
552
  }
553
+ function sweepExpiredToolOffloads(now = Date.now()) {
554
+ const root = join(clioStateDir(), "scratch");
555
+ const cutoff = now - TOOL_OFFLOAD_MAX_AGE_MS;
556
+ let removed = 0;
557
+ try {
558
+ for (const session of readdirSync(root, { withFileTypes: true })) {
559
+ if (!session.isDirectory()) continue;
560
+ const sessionDir = join(root, session.name);
561
+ for (const entry of readdirSync(sessionDir, { withFileTypes: true })) {
562
+ if (!entry.isFile()) continue;
563
+ const path = join(sessionDir, entry.name);
564
+ try {
565
+ if (statSync(path).mtimeMs >= cutoff) continue;
566
+ rmSync(path, { force: true });
567
+ removed += 1;
568
+ } catch {
569
+ }
570
+ }
571
+ try {
572
+ if (readdirSync(sessionDir).length === 0) rmdirSync(sessionDir);
573
+ } catch {
574
+ }
575
+ }
576
+ } catch {
577
+ }
578
+ return removed;
579
+ }
429
580
  function writeToolOffload(text, context, maxBytes = RESULT_OFFLOAD_MAX_BYTES, digest = createHash2("sha256").update(text).digest("hex")) {
430
581
  try {
431
582
  const bytes = byteLength(text);
@@ -673,6 +824,7 @@ function shapeToolResult(spec, result, context, requestedDisposition) {
673
824
  }
674
825
 
675
826
  // src/tools/observation.ts
827
+ init_esm_shims();
676
828
  var OBSERVATION_POLICY_SLACK_BYTES = 2 * 1024;
677
829
  var OBSERVE_SELF_CAPS = {
678
830
  grepContent: 16 * 1024,
@@ -904,6 +1056,8 @@ ${limitedBudgetNote(input.reservation)}`;
904
1056
 
905
1057
  export {
906
1058
  deterministicDiagnosticSummary,
1059
+ legacyToolResultDigest,
1060
+ sanitizeToolResultDigest,
907
1061
  toolResultContextText,
908
1062
  isDispositionedToolResultError,
909
1063
  toolResultPresentationText,
@@ -913,6 +1067,8 @@ export {
913
1067
  truncateHead2 as truncateHead,
914
1068
  truncateTail2 as truncateTail,
915
1069
  DEFAULT_TOOL_RESULT_MAX_BYTES,
1070
+ toolResultDigestFor,
1071
+ sweepExpiredToolOffloads,
916
1072
  isSessionOffloadPath,
917
1073
  shapeToolResult,
918
1074
  OBSERVATION_POLICY_SLACK_BYTES,
@@ -923,4 +1079,4 @@ export {
923
1079
  observationBudgetExhausted,
924
1080
  finalizeObservation
925
1081
  };
926
- //# sourceMappingURL=chunk-5M54SPOL.js.map
1082
+ //# sourceMappingURL=chunk-ODFEOB4F.js.map
@@ -79,6 +79,8 @@ var RECEIPT_INTEGRITY_FIELD_COVERAGE = {
79
79
  agentAudience: true,
80
80
  requestOrigin: true,
81
81
  task: true,
82
+ // Historical receipts omit this field, so their receipt and ledger payloads remain unchanged.
83
+ budget: true,
82
84
  targetId: true,
83
85
  wireModelId: true,
84
86
  runtimeId: true,
@@ -175,6 +177,7 @@ function ledgerDigestFields(envelope) {
175
177
  agentId: envelope.agentId,
176
178
  executionRole: envelope.executionRole,
177
179
  task: envelope.task,
180
+ ...envelope.budget !== void 0 ? { budget: envelope.budget } : {},
178
181
  targetId: envelope.targetId,
179
182
  wireModelId: envelope.wireModelId,
180
183
  runtimeId: envelope.runtimeId,
@@ -303,6 +306,7 @@ function firstLedgerMismatch(receipt, envelope) {
303
306
  if (!Object.is(receiptValue, ledgerValue)) return field;
304
307
  }
305
308
  if (canonicalJson(receipt.briefing ?? null) !== canonicalJson(envelope.briefing ?? null)) return "briefing";
309
+ if (canonicalJson(receipt.budget ?? null) !== canonicalJson(envelope.budget ?? null)) return "budget";
306
310
  if (canonicalJson(receipt.steering ?? null) !== canonicalJson(envelope.steering ?? null)) return "steering";
307
311
  return null;
308
312
  }
@@ -1066,4 +1070,4 @@ export {
1066
1070
  loadEvalTaskFile,
1067
1071
  EvalTaskFileError
1068
1072
  };
1069
- //# sourceMappingURL=chunk-3JLKSKD7.js.map
1073
+ //# sourceMappingURL=chunk-OH3TOQTB.js.map
@@ -2,7 +2,12 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
2
2
  import {
3
3
  canonicalJson,
4
4
  sha256
5
- } from "./chunk-QQL5RT5M.js";
5
+ } from "./chunk-QM3F2GKX.js";
6
+ import {
7
+ addResponseModelIdObservationCount,
8
+ emptyResponseModelIdObservationCounts,
9
+ responseModelIdObservationFromRecord
10
+ } from "./chunk-CJUB2JJ2.js";
6
11
  import {
7
12
  ToolNames
8
13
  } from "./chunk-CGKSTWHD.js";
@@ -12,7 +17,7 @@ import {
12
17
  import {
13
18
  ceilChars,
14
19
  extractReasoningTokens
15
- } from "./chunk-BPGS2WCQ.js";
20
+ } from "./chunk-GEYXPTRF.js";
16
21
  import {
17
22
  expandConfigPath
18
23
  } from "./chunk-SST6Z5JA.js";
@@ -304,6 +309,7 @@ function createAskUserToolPolicy(activeTools) {
304
309
  status: "idle",
305
310
  startedAt: now,
306
311
  updatedAt: now,
312
+ exposure: "local",
307
313
  rounds: [],
308
314
  decisions: [],
309
315
  inFlight: false,
@@ -325,14 +331,21 @@ function sumRunUsage(messages) {
325
331
  reasoning: 0,
326
332
  apiCalls: 0,
327
333
  hadReasoning: false,
328
- hadUsage: false
334
+ hadUsage: false,
335
+ responseModelIdObservationCounts: emptyResponseModelIdObservationCounts(),
336
+ lastResponseModelIdObservation: { state: "not-observed" },
337
+ lastDifferingResponseModelId: null
329
338
  };
330
339
  for (const raw of messages) {
331
340
  const message = raw;
332
341
  if (!message || typeof message !== "object") continue;
333
342
  if (message.role !== "assistant") continue;
343
+ const record = message;
334
344
  const usage = message.usage;
335
345
  if (!usage || typeof usage !== "object") continue;
346
+ summary.lastResponseModelIdObservation = responseModelIdObservationFromRecord(record, "not-observed");
347
+ addResponseModelIdObservationCount(summary.responseModelIdObservationCounts, summary.lastResponseModelIdObservation);
348
+ summary.lastDifferingResponseModelId = typeof record.responseModel === "string" && record.responseModel.trim().length > 0 ? record.responseModel.trim() : null;
336
349
  summary.hadUsage = true;
337
350
  summary.apiCalls += 1;
338
351
  const input = typeof usage.input === "number" ? usage.input : 0;
@@ -369,6 +382,7 @@ function assistantSessionPayload(message, failure) {
369
382
  const raw = message;
370
383
  if (Array.isArray(raw.content)) payload.content = raw.content;
371
384
  if (thinking.length > 0) payload.thinking = thinking;
385
+ payload.responseModelIdObservation = responseModelIdObservationFromRecord(raw, "not-observed");
372
386
  for (const key of ["usage", "api", "provider", "model", "responseModel", "responseId", "diagnostics"]) {
373
387
  if (raw[key] !== void 0) payload[key] = raw[key];
374
388
  }
@@ -1080,4 +1094,4 @@ export {
1080
1094
  readFileArgsAsync,
1081
1095
  expandInlineFileReferencesAsync
1082
1096
  };
1083
- //# sourceMappingURL=chunk-MEQ45TQ4.js.map
1097
+ //# sourceMappingURL=chunk-PBTHKCPN.js.map
@@ -65,6 +65,13 @@ function globalFlagPositionHint(arg, command) {
65
65
  if (usage === void 0) return null;
66
66
  return `${arg} is a global option and must come before the subcommand: clio-coder ${usage} ${command} ...`;
67
67
  }
68
+ function unknownGlobalOptionError(arg) {
69
+ const bare = arg.replace(/=.*$/u, "");
70
+ if (bare === "--resume" || bare === "--continue" || bare === "-r" || bare === "-c") {
71
+ return `unknown global option: ${arg}. Sessions are resumed from inside the app: start clio-coder, then type /resume to pick one.`;
72
+ }
73
+ return `unknown global option: ${arg}`;
74
+ }
68
75
  function extractGlobalFlags(argv, isSubcommand = () => false) {
69
76
  const rest = [];
70
77
  let apiKey;
@@ -116,7 +123,7 @@ function extractGlobalFlags(argv, isSubcommand = () => false) {
116
123
  noSkills,
117
124
  skillPaths,
118
125
  rest,
119
- error: `unknown global option: ${arg}`,
126
+ error: unknownGlobalOptionError(arg),
120
127
  ...apiKey === void 0 ? {} : { apiKey }
121
128
  };
122
129
  }
@@ -140,4 +147,4 @@ export {
140
147
  globalFlagPositionHint,
141
148
  extractGlobalFlags
142
149
  };
143
- //# sourceMappingURL=chunk-ED4KHGC3.js.map
150
+ //# sourceMappingURL=chunk-PPAMZ32Z.js.map