@cortexkit/opencode-magic-context 0.49.8 → 0.49.10

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 (105) hide show
  1. package/dist/agents/hidden-agent-registrations.d.ts +5 -3
  2. package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
  3. package/dist/auto-search-worker.js +1 -1
  4. package/dist/config/schema/agent-overrides.d.ts +13 -13
  5. package/dist/config/schema/magic-context.d.ts +500 -500
  6. package/dist/{context-x0ccfv0f.js → context-ey3ap3cc.js} +29 -24
  7. package/dist/features/magic-context/primer-clustering.d.ts.map +1 -1
  8. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts +1 -1
  9. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts.map +1 -1
  10. package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
  11. package/dist/hooks/magic-context/__fixtures__/tail-hygiene-refresh.d.ts +34 -0
  12. package/dist/hooks/magic-context/__fixtures__/tail-hygiene-refresh.d.ts.map +1 -0
  13. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  14. package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +1 -0
  15. package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
  16. package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
  17. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +2 -0
  18. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
  19. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  20. package/dist/hooks/magic-context/provider-visible-parts.d.ts +10 -4
  21. package/dist/hooks/magic-context/provider-visible-parts.d.ts.map +1 -1
  22. package/dist/hooks/magic-context/supersession-reclaim.d.ts +5 -3
  23. package/dist/hooks/magic-context/supersession-reclaim.d.ts.map +1 -1
  24. package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts +18 -0
  25. package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts.map +1 -0
  26. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +5 -1
  27. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/tool-reclaim.d.ts +5 -2
  29. package/dist/hooks/magic-context/tool-reclaim.d.ts.map +1 -1
  30. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +1 -0
  31. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  33. package/dist/{index-b4gcb3rk.js → index-0x9cn9w1.js} +2 -2
  34. package/dist/{index-ydjgz36f.js → index-16vwdyy5.js} +1 -1
  35. package/dist/{index-xf6k8szp.js → index-21919gcq.js} +3 -3
  36. package/dist/{index-hxrvx6cy.js → index-3403gbzj.js} +129 -103
  37. package/dist/{index-gzg9ekc1.js → index-6k86es2p.js} +129 -15
  38. package/dist/{index-8kk7yh6m.js → index-9jvab89d.js} +1 -1
  39. package/dist/{index-qgp5vnt4.js → index-a865mj02.js} +1 -1
  40. package/dist/{index-xpn05jxq.js → index-f8cn4xqa.js} +287 -58
  41. package/dist/{index-2rw244rh.js → index-ffa8x2as.js} +4 -4
  42. package/dist/{index-bd9cjab3.js → index-g7jkrz0x.js} +35 -15
  43. package/dist/{index-pjgzdezw.js → index-nenz4gpb.js} +3 -3
  44. package/dist/{index-zf9nydbd.js → index-swgpe402.js} +4 -4
  45. package/dist/{index-9g1c4bt9.js → index-wpwpn7nj.js} +88 -8
  46. package/dist/{index-w1ejb9qr.js → index-x57ep4fp.js} +33 -19
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +50 -46
  49. package/dist/{message-index-zs882h8e.js → message-index-6r1x9cqh.js} +5 -5
  50. package/dist/{message-index-bounded-hxjp56qk.js → message-index-bounded-fskdyc81.js} +5 -5
  51. package/dist/migration-worker.js +4 -4
  52. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  53. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  54. package/dist/raw-ordinal-warmup-worker.js +3 -3
  55. package/dist/{read-session-chunk-t9r7r0sg.js → read-session-chunk-zgpvs423.js} +4 -4
  56. package/dist/{recomp-orchestrator-gr36zvd2.js → recomp-orchestrator-77xc8wpe.js} +10 -10
  57. package/dist/{search-qjen1pmz.js → search-72fkjwk2.js} +8 -8
  58. package/dist/shared/hidden-zen-read.d.ts +24 -0
  59. package/dist/shared/hidden-zen-read.d.ts.map +1 -0
  60. package/dist/shared/reclaim-distance.d.ts +33 -0
  61. package/dist/shared/reclaim-distance.d.ts.map +1 -0
  62. package/dist/shared/stable-json.d.ts +7 -0
  63. package/dist/shared/stable-json.d.ts.map +1 -1
  64. package/dist/shared/tail-hygiene-json.d.ts +22 -0
  65. package/dist/shared/tail-hygiene-json.d.ts.map +1 -0
  66. package/dist/shared/transcript.d.ts +5 -0
  67. package/dist/shared/transcript.d.ts.map +1 -1
  68. package/dist/{storage-tags-a513rkj3.js → storage-tags-35m4gms2.js} +2 -2
  69. package/dist/{transform-postprocess-phase-yv463b7y.js → transform-postprocess-phase-r8d406j0.js} +10 -10
  70. package/dist/v2/auto-search-worker.js +1 -1
  71. package/dist/v2/{context-wd82v9z6.js → context-z2yagwy4.js} +168 -35
  72. package/dist/v2/hidden-completion.d.ts.map +1 -1
  73. package/dist/v2/hooks/hidden-child.d.ts +2 -2
  74. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  75. package/dist/v2/{message-index-yd94vt9n.js → message-index-9ezq6wze.js} +5 -5
  76. package/dist/v2/{message-index-bounded-madg2kfr.js → message-index-bounded-rqc603f2.js} +5 -5
  77. package/dist/v2/migration-worker.js +4 -4
  78. package/dist/v2/raw-ordinal-warmup-worker.js +3 -3
  79. package/dist/v2/{read-session-chunk-7qs791f3.js → read-session-chunk-7f87tg2q.js} +4 -4
  80. package/dist/v2/{recomp-orchestrator-ee91r9s6.js → recomp-orchestrator-s5tdpsbs.js} +9 -9
  81. package/dist/v2/{search-pn15rr52.js → search-2td1b1wy.js} +8 -8
  82. package/dist/v2/{server-08k4zkfk.js → server-23znwjqk.js} +4 -4
  83. package/dist/v2/{server-y5g32dhq.js → server-2hxypdx5.js} +4 -4
  84. package/dist/v2/{server-yak3sxya.js → server-4zwx20yg.js} +1 -1
  85. package/dist/v2/{server-shme41gj.js → server-89fcbe37.js} +35 -15
  86. package/dist/v2/{server-q360kdb8.js → server-c9w52qss.js} +30 -13
  87. package/dist/v2/{server-4gz0xkrc.js → server-f27he3j1.js} +1 -1
  88. package/dist/v2/{server-xj4mewze.js → server-gc8x2xdb.js} +66 -8
  89. package/dist/v2/{server-jjsf29aq.js → server-kmapq3v0.js} +286 -57
  90. package/dist/v2/{server-adfte03x.js → server-xqf2d2mg.js} +1 -1
  91. package/dist/v2/{server-j3dm74ey.js → server-z0rjemg1.js} +2 -2
  92. package/dist/v2/server.js +2 -2
  93. package/dist/v2/{storage-tags-spa92sgj.js → storage-tags-c4zfcxv4.js} +2 -2
  94. package/dist/v2/{wrapup-orchestrator-5wxy1ggv.js → wrapup-orchestrator-wg8dmmm9.js} +9 -9
  95. package/dist/{wrapup-orchestrator-gv08c6f9.js → wrapup-orchestrator-b1z99yg5.js} +11 -11
  96. package/package.json +1 -1
  97. package/src/agents/hidden-agent-registrations.ts +22 -4
  98. package/src/shared/hidden-zen-read.test.ts +99 -0
  99. package/src/shared/hidden-zen-read.ts +88 -0
  100. package/src/shared/reclaim-distance.test.ts +111 -0
  101. package/src/shared/reclaim-distance.ts +91 -0
  102. package/src/shared/stable-json.ts +56 -14
  103. package/src/shared/tail-hygiene-json.test.ts +117 -0
  104. package/src/shared/tail-hygiene-json.ts +217 -0
  105. package/src/shared/transcript.ts +7 -0
@@ -6,7 +6,7 @@ import {
6
6
  getTemporalDecisions,
7
7
  freezeTemporalDecisions,
8
8
  stableStringify
9
- } from "./index-bd9cjab3.js";
9
+ } from "./index-g7jkrz0x.js";
10
10
  import {
11
11
  protectedToolTagNumbers,
12
12
  byteSize,
@@ -69,7 +69,7 @@ import {
69
69
  adoptNullOwnerToolTag2,
70
70
  getCandidateToolOwners2,
71
71
  pickNearestPriorOwner2
72
- } from "./index-xpn05jxq.js";
72
+ } from "./index-f8cn4xqa.js";
73
73
  import {
74
74
  textMentionsRecentCommit,
75
75
  hasMeaningfulUserText2,
@@ -183,12 +183,13 @@ import {
183
183
  reasoningStepCost,
184
184
  reasoningTextAndOpaque,
185
185
  opencodeReasoningBudgetCutoff,
186
+ estimatePartImageTokens,
186
187
  SKELETON_REAL_INPUT_MAX_BYTES,
187
188
  partHasCompletedResult,
188
189
  extractToolCallObservation,
189
190
  ToolMutationBatch,
190
191
  createToolDropTarget
191
- } from "./index-9g1c4bt9.js";
192
+ } from "./index-wpwpn7nj.js";
192
193
  import {
193
194
  getMaxM0MutationId,
194
195
  rememberUnpublishedAutoSearchNoHint,
@@ -222,7 +223,7 @@ import {
222
223
  peekNoteNudgeText,
223
224
  markNoteNudgeDelivered,
224
225
  getActiveCompartmentRun
225
- } from "./index-hxrvx6cy.js";
226
+ } from "./index-3403gbzj.js";
226
227
  import {
227
228
  runSessionWarmupWorker
228
229
  } from "./index-angx1s0k.js";
@@ -233,10 +234,10 @@ import {
233
234
  } from "./index-q76br5zn.js";
234
235
  import {
235
236
  BoundedSessionMap
236
- } from "./index-b4gcb3rk.js";
237
+ } from "./index-0x9cn9w1.js";
237
238
  import {
238
239
  renderUserFacingFailure
239
- } from "./index-ydjgz36f.js";
240
+ } from "./index-16vwdyy5.js";
240
241
  import {
241
242
  getErrorMessage
242
243
  } from "./index-y8v6yerm.js";
@@ -3736,7 +3737,7 @@ function buildEditSupersessionReclaim(input) {
3736
3737
  seenFile.add(filePath);
3737
3738
  continue;
3738
3739
  }
3739
- if (input.recentMessageIds && (tag.toolOwnerMessageId === null || input.recentMessageIds.has(tag.toolOwnerMessageId))) {
3740
+ if (tag.tagNumber > input.watermark || input.recentMessageIds && (tag.toolOwnerMessageId === null || input.recentMessageIds.has(tag.toolOwnerMessageId))) {
3740
3741
  continue;
3741
3742
  }
3742
3743
  if (realPendingTagIds.has(tag.tagNumber))
@@ -3834,6 +3835,51 @@ async function waitForTagOwners(db, sessionId, ratio, waitMs = 250) {
3834
3835
  }
3835
3836
  }
3836
3837
 
3838
+ // src/shared/reclaim-distance.ts
3839
+ var RECLAIM_DISTANCE_USER_TURNS = 3;
3840
+ var RECLAIM_DISTANCE_WINDOW_FRACTION = 0.25;
3841
+ function isReclaimUserTurn(args) {
3842
+ return args.role === "user" && !args.syntheticHead && !args.synthetic && !args.ignored && args.parts.some((part) => {
3843
+ if (part.synthetic || part.ignored)
3844
+ return false;
3845
+ if (part.kind !== "text" && part.kind !== "image" && part.kind !== "file")
3846
+ return false;
3847
+ if (part.kind !== "text")
3848
+ return true;
3849
+ return stripReclaimMcText(part.text ?? "").trim().length > 0;
3850
+ });
3851
+ }
3852
+ function stripReclaimMcText(text) {
3853
+ return text.replace(/^§\d+§\s*/, "").replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, (reminder) => /^(?:Your next step: call ctx_reduce on the outputs you've already used|Still unstamped:|Housekeeping: .* are reclaimable\. Stamp each output with ctx_reduce|.* are reclaimable\. Make a ctx_reduce pass now|.* are still unstamped\. Call ctx_reduce now)/.test(reminder.slice("<system-reminder>".length).trimStart()) ? "" : reminder).replace(/<instruction name="deferred_notes">[\s\S]*?<\/instruction>/g, "");
3854
+ }
3855
+ function farBehindToolBookmark(entries, usableWindow) {
3856
+ let newerTurns = 0;
3857
+ let newerTokens = 0;
3858
+ const farTags = [];
3859
+ let firstYoungTag = Infinity;
3860
+ const seenOutputs = new Set;
3861
+ const tokenDistance = usableWindow > 0 && Number.isFinite(usableWindow) ? usableWindow * RECLAIM_DISTANCE_WINDOW_FRACTION : Infinity;
3862
+ for (let index = entries.length - 1;index >= 0; index--) {
3863
+ const entry = entries[index];
3864
+ if (!entry)
3865
+ continue;
3866
+ const tag = entry.toolOutputTag;
3867
+ if (tag !== undefined && !seenOutputs.has(tag)) {
3868
+ seenOutputs.add(tag);
3869
+ if (newerTurns >= RECLAIM_DISTANCE_USER_TURNS || newerTokens >= tokenDistance) {
3870
+ farTags.push(tag);
3871
+ } else {
3872
+ firstYoungTag = Math.min(firstYoungTag, tag);
3873
+ }
3874
+ }
3875
+ if (entry.userTurn)
3876
+ newerTurns++;
3877
+ if (Number.isFinite(entry.tokens) && entry.tokens > 0)
3878
+ newerTokens += entry.tokens;
3879
+ }
3880
+ return farTags.reduce((bookmark, tag) => tag < firstYoungTag ? Math.max(bookmark, tag) : bookmark, 0);
3881
+ }
3882
+
3837
3883
  // src/hooks/magic-context/tool-reclaim.ts
3838
3884
  function buildSyntheticToolReclaimOps(input) {
3839
3885
  const watermark = Math.max(0, input.watermark);
@@ -3865,10 +3911,74 @@ function buildSyntheticToolReclaimOps(input) {
3865
3911
  }
3866
3912
  return synthetic;
3867
3913
  }
3868
- function advanceToolReclaimWatermarkToCurrentMax(db, sessionId) {
3869
- const maxTagNumber = getMaxTagNumberBySession2(db, sessionId);
3870
- advanceToolReclaimWatermark(db, sessionId, maxTagNumber);
3871
- return maxTagNumber;
3914
+ function advanceToolReclaimWatermarkByDistance(db, sessionId, entries, usableWindow) {
3915
+ const bookmark = farBehindToolBookmark(entries, usableWindow);
3916
+ advanceToolReclaimWatermark(db, sessionId, bookmark);
3917
+ return bookmark;
3918
+ }
3919
+ function toolReclaimDistanceEntries(messages, targets) {
3920
+ const outputTags = new Map;
3921
+ for (const [tag, target] of targets) {
3922
+ for (const location of target.mutationParts ?? []) {
3923
+ const part = distancePart(location.part);
3924
+ if (part.kind === "tool_result" || part.kind === "tool")
3925
+ outputTags.set(location.part, tag);
3926
+ }
3927
+ }
3928
+ const entries = [];
3929
+ for (const message of messages) {
3930
+ const parts = message.parts.map(distancePart);
3931
+ let userTurn = isReclaimUserTurn({ ...message.info, parts });
3932
+ for (const [index, part] of parts.entries()) {
3933
+ const authored = isReclaimUserTurn({ role: "user", parts: [part] });
3934
+ entries.push({
3935
+ tokens: message.info.syntheticHead ? 0 : estimateTokens(stripReclaimMcText(part.text ?? "")) + part.imageTokens,
3936
+ userTurn: userTurn && authored,
3937
+ toolOutputTag: outputTags.get(message.parts[index])
3938
+ });
3939
+ if (authored)
3940
+ userTurn = false;
3941
+ }
3942
+ }
3943
+ return entries;
3944
+ }
3945
+ function distancePart(raw) {
3946
+ if (!raw || typeof raw !== "object")
3947
+ return { kind: "structural", imageTokens: 0 };
3948
+ const part = raw;
3949
+ const provenance = { synthetic: part.synthetic === true, ignored: part.ignored === true };
3950
+ if (typeof part.getText === "function") {
3951
+ const text = part.getText();
3952
+ return {
3953
+ ...provenance,
3954
+ kind: String(part.kind),
3955
+ text: typeof text === "string" ? text : undefined,
3956
+ imageTokens: typeof part.imageTokens === "function" ? Number(part.imageTokens()) : 0
3957
+ };
3958
+ }
3959
+ const metadata = { ...provenance, imageTokens: estimatePartImageTokens(raw) };
3960
+ if (part.type === "tool") {
3961
+ const state = part.state;
3962
+ return {
3963
+ ...metadata,
3964
+ kind: "tool",
3965
+ text: `${JSON.stringify(state?.input ?? {})}
3966
+ ${typeof state?.output === "string" ? state.output : JSON.stringify(state?.output ?? "")}`
3967
+ };
3968
+ }
3969
+ if (part.type === "tool_use")
3970
+ return { ...metadata, kind: "tool_use", text: JSON.stringify(part.input ?? {}) };
3971
+ if (part.type === "tool_result")
3972
+ return {
3973
+ ...metadata,
3974
+ kind: "tool_result",
3975
+ text: typeof part.content === "string" ? part.content : JSON.stringify(part.content ?? "")
3976
+ };
3977
+ return {
3978
+ ...metadata,
3979
+ kind: String(part.type),
3980
+ text: typeof part.text === "string" ? part.text : typeof part.thinking === "string" ? part.thinking : undefined
3981
+ };
3872
3982
  }
3873
3983
  // src/hooks/magic-context/strip-structural-noise.ts
3874
3984
  var STRUCTURAL_PART_TYPES = new Set(["meta", "step-start", "step-finish", "reasoning"]);
@@ -5417,6 +5527,7 @@ async function runPostTransformPhase2(args) {
5417
5527
  const shouldApplyPendingOps = publishedWorkDrainAllowed;
5418
5528
  const shouldRunHeuristics = publishedWorkDrainAllowed && (rideSignals.publishedHistory || materializationRequested || forceMaterialization || foldBustsServedPrefixThisPass || firstRenderBust || heldIdleExpiryRebuild || emergencyDropEligible || args.schedulerDecision === "execute" && (!alreadyRanThisTurn || !args.fullFeatureMode));
5419
5529
  const isCacheBustingPass = publishedWorkDrainAllowed;
5530
+ const reclaimDistance = isCacheBustingPass ? toolReclaimDistanceEntries(args.messages, args.targets) : [];
5420
5531
  const canEditWholePrefix = isCacheBustingPass && !activeThinkingPrefixHold;
5421
5532
  const previousTemporalDecisions = args.temporalCandidates && !compactionOff ? new Map([
5422
5533
  ...args.temporalObservedDecisions ?? [],
@@ -5760,6 +5871,7 @@ async function runPostTransformPhase2(args) {
5760
5871
  }
5761
5872
  }
5762
5873
  const editReclaim = buildEditSupersessionReclaim({
5874
+ watermark: args.sessionMeta.toolReclaimWatermark ?? 0,
5763
5875
  db: args.db,
5764
5876
  sessionId: args.sessionId,
5765
5877
  targets: newTargets,
@@ -5798,7 +5910,7 @@ async function runPostTransformPhase2(args) {
5798
5910
  const tBatchFinalize = performance.now();
5799
5911
  args.batch?.finalize();
5800
5912
  if (toolReclaimApplicationOpportunity) {
5801
- const maxTagNumber = advanceToolReclaimWatermarkToCurrentMax(args.db, args.sessionId);
5913
+ const maxTagNumber = advanceToolReclaimWatermarkByDistance(args.db, args.sessionId, reclaimDistance, args.usableWindow);
5802
5914
  args.sessionMeta.toolReclaimWatermark = Math.max(args.sessionMeta.toolReclaimWatermark ?? 0, maxTagNumber);
5803
5915
  }
5804
5916
  if (autoReclaimTargetCount > 0) {
@@ -6477,6 +6589,7 @@ async function runPostTransformPhase2(args) {
6477
6589
  const hygieneCalibration = sessionDecisionCalibration(args.db, args.sessionId);
6478
6590
  const hygieneUnitsVersion = transitionSessionHygieneUnits(args.db, args.sessionId, bustedThisPass, hygieneCalibration);
6479
6591
  const baseline = refreshTailHygieneBaseline({
6592
+ opencode2: args.opencode2,
6480
6593
  messages: args.messages,
6481
6594
  tags,
6482
6595
  protectedTagNumbers: args.protectedTagNumbers,
@@ -6493,7 +6606,7 @@ async function runPostTransformPhase2(args) {
6493
6606
  sessionLog2(args.sessionId, formatTailHygienePrefixMismatch(baseline.lastPrefixMismatch, baseline.baselineGeneration));
6494
6607
  }
6495
6608
  const tTailState = performance.now();
6496
- const structuralSignature = tailHygieneStructuralSignature(args.messages);
6609
+ const structuralSignature = tailHygieneStructuralSignature(args.messages, args.opencode2);
6497
6610
  const effective = effectiveTailHygiene(baseline);
6498
6611
  const durableGrace = baseline.evaluable && !baseline.generationInvalidated ? captureChannel1PostReduceGraceBaseline(args.db, args.sessionId, effective.u) : getChannel1NudgeState(args.db, args.sessionId);
6499
6612
  baseline.channel1PostReduceGrace = durableGrace.postReduceGracePending || durableGrace.postReduceGraceBaselineU !== undefined ? {
@@ -6505,7 +6618,7 @@ async function runPostTransformPhase2(args) {
6505
6618
  ...baseline,
6506
6619
  usableWindow: args.usableWindow,
6507
6620
  realUserTurnCount: countRealUserMessages(args.messages),
6508
- reducedSinceRefresh: baseline.baselineGeneration !== previous?.baselineGeneration ? false : previous?.reducedSinceRefresh ?? false,
6621
+ reducedSinceRefresh: baseline.baselineGeneration !== previous?.baselineGeneration || (previous?.generationInvalidated === true || previous?.evaluable === false) && baseline.evaluable && !baseline.generationInvalidated ? false : previous?.reducedSinceRefresh ?? false,
6509
6622
  agentDropsAppliedThisPass: pendingOpsDidMutate,
6510
6623
  oldestReclaimableToolTags: postprocessOldestTags(args.db, args.sessionId, args.protectedTagNumbers)
6511
6624
  });
@@ -6543,7 +6656,7 @@ async function runPostTransformPhase2(args) {
6543
6656
  const tTailGuard = performance.now();
6544
6657
  if (assertedBaseline) {
6545
6658
  try {
6546
- const servedSignature = tailHygieneStructuralSignature(args.messages);
6659
+ const servedSignature = tailHygieneStructuralSignature(args.messages, args.opencode2);
6547
6660
  if (!sameTailHygieneStructuralSignature(assertedBaseline.structuralSignature, servedSignature)) {
6548
6661
  sessionLog2(args.sessionId, `ERROR [tail-hygiene-last-writer-mismatch]: served messages changed after tail-hygiene baseline refresh (expected messages=${assertedBaseline.structuralSignature.messageCount}, parts=[${assertedBaseline.structuralSignature.partCounts.join(",")}], bytes=${assertedBaseline.structuralSignature.totalBytes}; actual messages=${servedSignature.messageCount}, parts=[${servedSignature.partCounts.join(",")}], bytes=${servedSignature.totalBytes})`);
6549
6662
  }
@@ -6551,6 +6664,7 @@ async function runPostTransformPhase2(args) {
6551
6664
  sessionLog2(args.sessionId, "ERROR [tail-hygiene-last-writer-check-failed]: structural production guard failed open:", error);
6552
6665
  }
6553
6666
  assertTailHygieneContentUnchangedIfEnabled({
6667
+ opencode2: args.opencode2,
6554
6668
  messages: args.messages,
6555
6669
  tags: assertedBaseline.tags,
6556
6670
  protectedTagNumbers: assertedBaseline.protectedTagNumbers,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-gjvjh960.js";
4
4
  import {
5
5
  stableStringify
6
- } from "./index-bd9cjab3.js";
6
+ } from "./index-g7jkrz0x.js";
7
7
 
8
8
  // src/features/magic-context/tool-definition-tokens.ts
9
9
  import { createHash } from "node:crypto";
@@ -8,7 +8,7 @@ import {
8
8
  ensureColumn,
9
9
  healAllNullColumns,
10
10
  installV95PerfSchema
11
- } from "./index-bd9cjab3.js";
11
+ } from "./index-g7jkrz0x.js";
12
12
  import {
13
13
  resolveOpenCodeDbPath,
14
14
  openCodeDbPathExists,