dsh-boost 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.en.md +141 -51
  2. package/README.md +115 -47
  3. package/dist/admission/usage.js +41 -7
  4. package/dist/admission/usage.js.map +1 -1
  5. package/dist/gate/decide.js +33 -2
  6. package/dist/gate/decide.js.map +1 -1
  7. package/dist/hooks/llm-stream.js +232 -58
  8. package/dist/hooks/llm-stream.js.map +1 -1
  9. package/dist/hooks/post-execute.js +206 -39
  10. package/dist/hooks/post-execute.js.map +1 -1
  11. package/dist/hooks/session-state.js +18 -8
  12. package/dist/hooks/session-state.js.map +1 -1
  13. package/dist/index.js +601 -72
  14. package/dist/index.js.map +1 -1
  15. package/dist/scope/doc.js.map +1 -1
  16. package/dist/scope/store.js +24 -9
  17. package/dist/scope/store.js.map +1 -1
  18. package/dist/tools/boost.js +82 -2
  19. package/dist/tools/boost.js.map +1 -1
  20. package/package.json +9 -5
  21. package/dist/admission/fixed-cost.d.ts +0 -23
  22. package/dist/admission/ledger.d.ts +0 -113
  23. package/dist/admission/retrieval.d.ts +0 -65
  24. package/dist/admission/usage.d.ts +0 -75
  25. package/dist/config.d.ts +0 -43
  26. package/dist/gate/binding.d.ts +0 -113
  27. package/dist/gate/decide.d.ts +0 -82
  28. package/dist/gate/guard.d.ts +0 -69
  29. package/dist/gate/invalidate.d.ts +0 -112
  30. package/dist/gate/plan.d.ts +0 -86
  31. package/dist/hooks/clock.d.ts +0 -68
  32. package/dist/hooks/execute.d.ts +0 -79
  33. package/dist/hooks/llm-stream.d.ts +0 -283
  34. package/dist/hooks/pending.d.ts +0 -89
  35. package/dist/hooks/post-execute.d.ts +0 -257
  36. package/dist/hooks/session-state.d.ts +0 -158
  37. package/dist/hooks/synthesize.d.ts +0 -74
  38. package/dist/host/loader.d.ts +0 -23
  39. package/dist/host/platform.d.ts +0 -18
  40. package/dist/host/root.d.ts +0 -25
  41. package/dist/projection/apply.d.ts +0 -174
  42. package/dist/projection/canonicalise.d.ts +0 -43
  43. package/dist/projection/counters.d.ts +0 -65
  44. package/dist/projection/truncate.d.ts +0 -47
  45. package/dist/prompt/protocol.d.ts +0 -45
  46. package/dist/receipts/store.d.ts +0 -198
  47. package/dist/scope/doc.d.ts +0 -117
  48. package/dist/scope/resolve.d.ts +0 -91
  49. package/dist/scope/store.d.ts +0 -135
  50. package/dist/selector/jev.d.ts +0 -93
  51. package/dist/tools/boost.d.ts +0 -380
  52. package/dist/tools/family.d.ts +0 -26
@@ -192,6 +192,20 @@ export function sessionBudget(deps, sessionId) {
192
192
  ? deps.budget
193
193
  : undefined;
194
194
  }
195
+ /**
196
+ * Whether a substitution budget is wired at all.
197
+ *
198
+ * `undefined` from {@link sessionBudget} has two meanings and callers must not
199
+ * conflate them (row 21): with neither `deps.budget` nor a per-session runtime,
200
+ * the embedder never asked for a cap, so the substitution is unconstrained; a
201
+ * wired budget that this session may not borrow is the opposite — the shared
202
+ * instance belongs to another session and the step cannot be paid. Treating the
203
+ * refusal as "no cap" let an unbudgeted substitution through without ever
204
+ * incrementing the live budget.
205
+ */
206
+ export function budgetWired(deps) {
207
+ return deps.budget !== undefined || deps.sessions !== undefined;
208
+ }
195
209
  /** The session's usage ledger; the same precedence as {@link sessionClock}. */
196
210
  export function sessionUsage(deps, sessionId) {
197
211
  try {
@@ -206,13 +220,26 @@ export function sessionUsage(deps, sessionId) {
206
220
  ? deps.usage
207
221
  : undefined;
208
222
  }
209
- /** The session's anchors without ever failing the request. */
223
+ /**
224
+ * The session's anchors, distinguishing a record from a cold store.
225
+ *
226
+ * A substitution is only legitimate against the receipt the model still holds,
227
+ * so every missing answer is a lost anchor (row 28). `post-execute` writes
228
+ * anchors with every commit, so a live queue entry with no record means that
229
+ * write failed; synthesizing then would skip the only verification the design
230
+ * has. A throwing read is equally unverifiable. Both fail closed through the
231
+ * ordinary reset path instead of substituting on unseen evidence.
232
+ */
210
233
  function anchorsOf(deps, sessionId) {
234
+ const store = deps.anchors;
235
+ if (store == null || typeof store.get !== 'function')
236
+ return { kind: 'unreadable' };
211
237
  try {
212
- return deps.anchors?.get(sessionId);
238
+ const anchors = store.get(sessionId);
239
+ return anchors == null ? { kind: 'cold' } : { kind: 'record', anchors };
213
240
  }
214
241
  catch {
215
- return undefined;
242
+ return { kind: 'unreadable' };
216
243
  }
217
244
  }
218
245
  /**
@@ -406,6 +433,74 @@ function prunedCarries(body, anchor) {
406
433
  return (points.slice(0, headPoints.length).join('') === head &&
407
434
  points.slice(-tailPoints.length).join('') === tail);
408
435
  }
436
+ /**
437
+ * The locator phrase every host spill notice carries.
438
+ *
439
+ * Both outer shapers end a rewrite with a parenthesised notice naming where the
440
+ * complete result lives: `dsh-spill-policy` renders `(Omitted N bytes. Full
441
+ * formatted result stored at: …)` and `dsh-tool-fs-search` renders `(Showing N
442
+ * of M paths. Full sorted result stored at: …)`. The counts and the sentence
443
+ * around them differ by shaper and result kind; the locator phrase is the part
444
+ * both always include.
445
+ */
446
+ const SPILL_LOCATION = ' stored at: ';
447
+ /**
448
+ * Where a trailing host-shape spill footer starts, or `-1` when the body does
449
+ * not end in one.
450
+ *
451
+ * The footer is a final parenthesised block introduced by a blank line, and the
452
+ * locator phrase separates it from an ordinary parenthetical. This is a shape
453
+ * check, not authentication: the identity evidence remains the anchor's own
454
+ * head and tail, which the caller requires at the two ends of the rewritten
455
+ * body.
456
+ */
457
+ function trailingSpillFooterStart(body) {
458
+ if (!body.endsWith(')'))
459
+ return -1;
460
+ const start = body.lastIndexOf('\n\n(');
461
+ if (start === -1)
462
+ return -1;
463
+ const notice = body.slice(start + 2);
464
+ if (!notice.includes(SPILL_LOCATION))
465
+ return -1;
466
+ // The notice must also name how much was dropped. A footer carrying only a
467
+ // locator is not evidence that a shaper rewrote this receipt, and without a
468
+ // count the only remaining identity check would be "shares the first and last
469
+ // window" — the edited-then-re-read collision `prunedCarries` rejects.
470
+ return OMITTED_BYTES.test(notice) ? start : -1;
471
+ }
472
+ /** An omitted-byte notice: the only in-body evidence a shaper rewrote the middle. */
473
+ const OMITTED_BYTES = /\([^)]*\d[\d,]*\s*(?:bytes|characters)[^)]*\)/i;
474
+ /**
475
+ * Whether `core` is `anchor` rewritten by a foreign shaper.
476
+ *
477
+ * The anchor's head must sit at the very start and its tail at the very end of
478
+ * the rewritten body, and a spill footer must be the rewrite's evidence: either
479
+ * the trailing notice the caller stripped (`strippedFooter`), or one sitting
480
+ * between the two windows. A full receipt that merely shares the two probes —
481
+ * the edited-then-re-read collision `prunedCarries` exists to reject — has no
482
+ * footer, and a wrapper that embeds the anchor does not start with its head, so
483
+ * neither qualifies. The length guard rejects a body that is only the two
484
+ * windows with nothing rewritten between them.
485
+ */
486
+ function foreignShaperCarries(core, anchor, head, tail, strippedFooter) {
487
+ if (core === anchor)
488
+ return false;
489
+ if (head.length > 0 && !core.startsWith(head))
490
+ return false;
491
+ if (tail.length > 0 && !core.endsWith(tail))
492
+ return false;
493
+ if (core.length <= head.length + tail.length)
494
+ return false;
495
+ if (strippedFooter)
496
+ return true;
497
+ const middle = core.slice(head.length, core.length - tail.length);
498
+ const footerStart = middle.indexOf('\n\n(');
499
+ if (footerStart === -1)
500
+ return false;
501
+ const footerEnd = middle.indexOf(')', footerStart);
502
+ return footerEnd !== -1 && middle.slice(footerStart, footerEnd + 1).includes(SPILL_LOCATION);
503
+ }
409
504
  /**
410
505
  * Whether `body` still carries `anchor`, verbatim or as a verified in-place
411
506
  * rewrite.
@@ -416,11 +511,29 @@ function prunedCarries(body, anchor) {
416
511
  * beginning and end, so a body holding both probes *and* the rewrite's own
417
512
  * evidence is the same receipt rewritten in place.
418
513
  *
514
+ * An outer shaper (`dsh-spill-policy` for non-`read`, `dsh-tool-fs-search` for
515
+ * `glob`/`grep`) also keeps the head and tail but appends its footer after the
516
+ * tail, so the model-visible body ends with the notice. That case is checked
517
+ * twice: the trailing notice is stripped and our own projection is verified on
518
+ * the remaining body, then the remaining body is accepted as a foreign rewrite
519
+ * only when it still starts with the anchor's head and ends with its tail.
520
+ *
419
521
  * Sharing the two probes alone is not identity: a file edited in the middle and
420
522
  * re-read produces a full receipt with the same 32-character head and tail but
421
- * a different body. Accepting it would substitute against content the model no
422
- * longer holds, so a probe match must be accompanied by the pruner marker or
423
- * our projection's head line. Anything else is a lost anchor (fail closed).
523
+ * a different body.
524
+ *
525
+ * Residual, accepted: for a foreign shaper's rewrite the middle cannot be
526
+ * verified from the model-visible body — we keep neither the anchor's byte
527
+ * length nor a digest of it, and the shaper's own window (120 code points) need
528
+ * not equal our probe window. What is checked is the shape (head at index 0,
529
+ * tail at the end, a spill notice naming both a location and an omitted-byte
530
+ * count) and that the body is longer than the two windows. A re-spilled receipt
531
+ * that happens to share both probes would be accepted; rejecting every foreign
532
+ * rewrite instead would discard every spilled receipt, which is the common
533
+ * case. Fail closed only where the shape does not hold. Accepting it would substitute against content the model no
534
+ * longer holds, so a probe match must be accompanied by the pruner marker, our
535
+ * projection's head line, or a spill footer. Anything else is a lost anchor
536
+ * (fail closed).
424
537
  *
425
538
  * Probes are sliced by **code point**, exactly like `truncate`: a UTF-16 slice
426
539
  * can end on half a surrogate pair, and a lone surrogate is not a substring a
@@ -445,7 +558,17 @@ function carriesAnchor(body, anchor, probe) {
445
558
  return false;
446
559
  if (tailLen > 0 && body.indexOf(tail, start + headLen) === -1)
447
560
  return false;
448
- return prunedCarries(body, anchor) || ownProjectionCarries(body, anchor);
561
+ if (prunedCarries(body, anchor) || ownProjectionCarries(body, anchor))
562
+ return true;
563
+ // An outer shaper's footer follows the rewrite, so the model-visible body
564
+ // ends with the notice rather than with the anchor's tail. Verify the same
565
+ // body with that notice removed; without one, the in-middle footer shape is
566
+ // checked instead.
567
+ const footerStart = trailingSpillFooterStart(body);
568
+ const core = footerStart === -1 ? body : body.slice(0, footerStart);
569
+ if (footerStart !== -1 && ownProjectionCarries(core, anchor))
570
+ return true;
571
+ return foreignShaperCarries(core, anchor, head, tail, footerStart !== -1);
449
572
  }
450
573
  /**
451
574
  * Why the decision's anchored receipts are no longer trustworthy, if they are.
@@ -454,24 +577,30 @@ function carriesAnchor(body, anchor, probe) {
454
577
  * pruner literal means `pruned-reset`, because the pruner is the common case
455
578
  * and it leaves the receipt in place. Only when no anchor was pruned does a
456
579
  * missing carrier mean `compaction-reset` (the history was replaced by a
457
- * summary). No anchors at all is vacuously intact: `post-execute` always writes
458
- * them with a commit, but a missing evidence store must not block substitution
459
- * forever.
580
+ * summary).
460
581
  *
461
- * An empty anchor cannot be located in any message and is skipped; `invalidate`
462
- * treats an empty anchor as a real value, but the stream hook has no receipt
463
- * body to compare it with, and refusing every substitution on one empty tool
464
- * result would be worse than the uncertainty.
582
+ * A missing record, a record with no entries and a record whose shape cannot be
583
+ * read are all unverifiable and therefore `compaction-reset` (row 28): the
584
+ * commit that parked the decision writes anchors, so their absence is a failed
585
+ * write, not a reason to substitute with zero verification. An empty anchor
586
+ * string is a real value the check skips; `invalidate` treats an empty anchor
587
+ * as a real value, and the stream hook has no receipt body to compare it with.
465
588
  */
466
589
  function anchorResetOf(anchors, messages, probe) {
467
590
  if (anchors == null)
468
- return undefined;
469
- const record = anchors.anchors;
591
+ return 'compaction-reset';
592
+ let record;
593
+ try {
594
+ record = anchors.anchors;
595
+ }
596
+ catch {
597
+ return 'compaction-reset';
598
+ }
470
599
  if (typeof record !== 'object' || record === null)
471
- return undefined;
600
+ return 'compaction-reset';
472
601
  const values = Object.values(record);
473
602
  if (values.length === 0)
474
- return undefined;
603
+ return 'compaction-reset';
475
604
  const texts = values.filter((text) => typeof text === 'string' && text.length > 0);
476
605
  if (texts.length === 0) {
477
606
  // An empty anchor is a real value the check skips (it cannot be located in
@@ -495,6 +624,15 @@ function anchorResetOf(anchors, messages, probe) {
495
624
  }
496
625
  return compacted ? 'compaction-reset' : undefined;
497
626
  }
627
+ /** The anchored step id a reset receipt names, never throwing on a foreign shape. */
628
+ function anchorStepIdOf(anchors) {
629
+ try {
630
+ return typeof anchors.stepId === 'string' ? anchors.stepId : 'root';
631
+ }
632
+ catch {
633
+ return 'root';
634
+ }
635
+ }
498
636
  /**
499
637
  * Per-session synthesis history, keyed by `HookDeps` first so two plugin
500
638
  * instances in one process cannot read each other's session. It holds one turn
@@ -554,8 +692,10 @@ function synthesisBlocked(deps, sessionId, entry, turn) {
554
692
  if (current !== undefined && current.callIds.has(entry.callId))
555
693
  return true;
556
694
  const budget = sessionBudget(deps, sessionId);
695
+ // Row 21: a wired budget that was not lent to this session is unpayable, not
696
+ // "no cap". Only a completely unwired budget leaves the step unconstrained.
557
697
  if (budget === undefined)
558
- return false;
698
+ return budgetWired(deps);
559
699
  let spent;
560
700
  try {
561
701
  spent = budget.count();
@@ -594,14 +734,6 @@ function resolveStreamPlan(deps, options) {
594
734
  const entry = peekPending(deps, sessionId);
595
735
  if (entry === undefined)
596
736
  return { kind: 'pass', sessionId };
597
- const turn = clockTurnOf(deps, sessionId);
598
- if (turn === undefined || !sameTurn(entry.turn, turn)) {
599
- return {
600
- kind: 'pass',
601
- sessionId,
602
- abandon: { entry, clearQueue: true, clearAnchors: false },
603
- };
604
- }
605
737
  // A blank call id cannot be dispatched and must not be "repaired" here: the
606
738
  // execute-side tamper check would compare a different id and reject silently.
607
739
  if (typeof entry.callId !== 'string' || entry.callId.trim().length === 0) {
@@ -611,22 +743,29 @@ function resolveStreamPlan(deps, options) {
611
743
  abandon: { entry, clearQueue: true, clearAnchors: false },
612
744
  };
613
745
  }
614
- const anchors = anchorsOf(deps, sessionId);
615
- const reset = anchorResetOf(anchors, options?.messages, anchorProbe(deps));
746
+ const turn = clockTurnOf(deps, sessionId);
747
+ // The reset receipt pairs with the entry's own turn when the clock cannot
748
+ // name a real one; a turn-0 commit still wrote (or failed to write) anchors.
749
+ const resetTurn = turn ?? turnNumberOf(entry.turn);
750
+ // Row 28: anchor evidence is checked before turn validity. A decision whose
751
+ // anchors were never written (the commit's `set` failed), a store that holds
752
+ // no record for a live entry, and a throwing read are all unverifiable;
753
+ // dropping them as an ordinary stale entry would hide the lost evidence.
754
+ // Intact anchors on a stale turn still take the silent abandon below: there
755
+ // the decision is dead by identity, not because its evidence vanished.
756
+ const anchorRead = anchorsOf(deps, sessionId);
757
+ if (anchorRead.kind !== 'record') {
758
+ return resetPlan(sessionId, entry, 'compaction-reset', 'root', resetTurn);
759
+ }
760
+ const reset = anchorResetOf(anchorRead.anchors, options?.messages, anchorProbe(deps));
616
761
  if (reset !== undefined) {
762
+ return resetPlan(sessionId, entry, reset, anchorStepIdOf(anchorRead.anchors), resetTurn);
763
+ }
764
+ if (turn === undefined || !sameTurn(entry.turn, turn)) {
617
765
  return {
618
766
  kind: 'pass',
619
767
  sessionId,
620
- abandon: {
621
- entry,
622
- clearQueue: true,
623
- clearAnchors: true,
624
- reset: {
625
- code: reset,
626
- stepId: typeof anchors?.stepId === 'string' ? anchors.stepId : 'root',
627
- turn: turn,
628
- },
629
- },
768
+ abandon: { entry, clearQueue: true, clearAnchors: false },
630
769
  };
631
770
  }
632
771
  // Re-check the step immediately before synthesizing. The turn/step checks
@@ -644,6 +783,24 @@ function resolveStreamPlan(deps, options) {
644
783
  }
645
784
  return { kind: 'synthesize', sessionId, entry };
646
785
  }
786
+ /**
787
+ * Abandon a decision whose anchored evidence cannot be verified.
788
+ *
789
+ * The reset receipt explains the lost anchor; the queue and anchors go with it,
790
+ * and the usage mark is settled as discarded by `applyAbandon`.
791
+ */
792
+ function resetPlan(sessionId, entry, code, stepId, turn) {
793
+ return {
794
+ kind: 'pass',
795
+ sessionId,
796
+ abandon: {
797
+ entry,
798
+ clearQueue: true,
799
+ clearAnchors: true,
800
+ reset: { code, stepId, turn },
801
+ },
802
+ };
803
+ }
647
804
  /**
648
805
  * A pass plan that abandons the session's pending entry, when one exists.
649
806
  *
@@ -687,30 +844,28 @@ export function settleDiscarded(deps, sessionId) {
687
844
  /**
688
845
  * Plan/guards evidence parked between synthesis and settlement.
689
846
  *
690
- * The settled receipt is written at the first real request after the
691
- * synthesized turn, when the queue entry is already gone; the synth-time
692
- * receipt has it from the entry, this park hands it to the settle. Keyed by
693
- * `HookDeps` first so two plugin instances in one process cannot read each
694
- * other's session, and a `WeakMap` lets the whole map die with the assembly.
847
+ * Keyed by `HookDeps` first so two plugin instances in one process cannot read
848
+ * each other's session, and a `WeakMap` lets the whole map die with the
849
+ * assembly.
695
850
  */
696
851
  const PENDING_EVIDENCE = new WeakMap();
697
- /** Park the evidence for the session's next settlement, replacing any earlier. */
698
- function rememberEvidence(deps, sessionId, evidence) {
852
+ /** Park the fact for the session's next settlement, replacing any earlier. */
853
+ function rememberEvidence(deps, sessionId, fact) {
699
854
  let bySession = PENDING_EVIDENCE.get(deps);
700
855
  if (bySession === undefined) {
701
856
  bySession = new Map();
702
857
  PENDING_EVIDENCE.set(deps, bySession);
703
858
  }
704
- bySession.set(sessionId, evidence);
859
+ bySession.set(sessionId, fact);
705
860
  }
706
- /** Take (and forget) the evidence one settlement consumes. */
861
+ /** Take (and forget) the fact one settlement consumes. */
707
862
  function takeEvidence(deps, sessionId) {
708
863
  const bySession = PENDING_EVIDENCE.get(deps);
709
- const evidence = bySession?.get(sessionId);
864
+ const fact = bySession?.get(sessionId);
710
865
  bySession?.delete(sessionId);
711
- return evidence;
866
+ return fact;
712
867
  }
713
- /** Drop evidence that no settlement will ever consume. */
868
+ /** Drop a fact that no settlement will ever consume. */
714
869
  function forgetEvidence(deps, sessionId) {
715
870
  PENDING_EVIDENCE.get(deps)?.delete(sessionId);
716
871
  }
@@ -759,27 +914,38 @@ async function settlePendingMark(deps, sessionId) {
759
914
  let settled;
760
915
  try {
761
916
  const pending = ledger.pendingCandidateId();
762
- if (typeof pending !== 'string' || pending.length === 0)
917
+ if (typeof pending !== 'string' || pending.length === 0) {
918
+ // A parked fact without a mark can never be settled; drop it rather than
919
+ // let a later, unrelated mark pick up this turn's evidence.
920
+ forgetEvidence(deps, sessionId);
763
921
  return;
922
+ }
764
923
  candidateId = pending;
765
924
  settled = ledger.settle();
766
925
  }
767
926
  catch {
927
+ forgetEvidence(deps, sessionId);
768
928
  return;
769
929
  }
930
+ const fact = takeEvidence(deps, sessionId);
770
931
  await appendReceipt(deps, {
771
932
  version: 1,
772
933
  ts: new Date().toISOString(),
773
934
  sessionId,
774
- turn: clockTurnOf(deps, sessionId) ?? 0,
935
+ // Row 26: the synthesized turn is the substitution's turn; the request that
936
+ // happens to settle it may already be the next one.
937
+ turn: fact?.turn ?? clockTurnOf(deps, sessionId) ?? 0,
775
938
  stepId: 'root',
776
939
  kind: 'substitute-settled',
777
940
  code: 'substitute-settled',
778
941
  candidateId,
779
942
  // G2 applies to the settled line too: the goal and guards are the same
780
943
  // evidence the synth-time line carried, parked when that line was written.
781
- ...(takeEvidence(deps, sessionId) ?? {}),
944
+ ...(fact?.evidence ?? {}),
782
945
  saved_input_tokens: settled.saved_input_tokens,
946
+ // Row 7: the settled line carries both estimates — the upper input figure
947
+ // and the lower whole-request figure from the plan's own request.
948
+ avoided_total_tokens: settled.avoided_total_tokens,
783
949
  cache_hit_delta: settled.cache_hit_delta,
784
950
  output_tokens: settled.output_tokens,
785
951
  });
@@ -918,11 +1084,19 @@ async function* synthesizeBranch(deps, sessionId, entry, upstream) {
918
1084
  return;
919
1085
  }
920
1086
  markSubstitutedFor(deps, sessionId, current.candidateId);
921
- // Park the plan evidence for the settled line, which runs at the next real
922
- // request after this entry has left the queue.
1087
+ // Park the plan evidence and the synthesis turn for the settled line, which
1088
+ // runs at the next real request after this entry has left the queue.
923
1089
  const evidence = current.evidence;
924
- if (evidence !== undefined)
925
- rememberEvidence(deps, sessionId, evidence);
1090
+ const turn = turnNumberOf(current.turn);
1091
+ rememberEvidence(deps, sessionId, {
1092
+ turn,
1093
+ ...(evidence === undefined ? {} : { evidence }),
1094
+ });
1095
+ // Row 27: mirror the synthesis fact now, not when `tools/execute` accepts the
1096
+ // dispatch. A call denied by `tools/pre-execute` never reaches that hook, and
1097
+ // a rollover must still report the model round this turn skipped. The mirror
1098
+ // only feeds the settle path; it never claims a measured saving.
1099
+ deps.noteSynthesis?.(sessionId, turn, current.candidateId, evidence);
926
1100
  await appendSubstituteReceipt(deps, sessionId, current);
927
1101
  yield* synthesizeTurn(current);
928
1102
  }