@cortexkit/opencode-magic-context 0.49.25 → 0.49.26

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 (89) hide show
  1. package/dist/auto-search-worker.js +4 -4
  2. package/dist/chunk-embedding-write-worker.js +4 -4
  3. package/dist/{compartment-chunk-embedding-eypvn607.js → compartment-chunk-embedding-96ec8a7h.js} +3 -3
  4. package/dist/{conflict-warning-hook-a27bhggg.js → conflict-warning-hook-dv8fdc2w.js} +4 -4
  5. package/dist/{context-keb00be8.js → context-pjqa24nd.js} +17 -17
  6. package/dist/{embedding-backfill-vddgmem3.js → embedding-backfill-a91rvdf9.js} +5 -5
  7. package/dist/hooks/magic-context/caveman-cleanup.d.ts +14 -0
  8. package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -1
  9. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +11 -0
  10. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  11. package/dist/hooks/magic-context/foreign-text-parts.d.ts +47 -0
  12. package/dist/hooks/magic-context/foreign-text-parts.d.ts.map +1 -0
  13. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  14. package/dist/hooks/magic-context/read-session-chunk.d.ts +21 -0
  15. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  16. package/dist/hooks/magic-context/read-session-raw.d.ts +20 -0
  17. package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
  18. package/dist/hooks/magic-context/tag-messages.d.ts +15 -0
  19. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  20. package/dist/hooks/magic-context/transform.d.ts +7 -0
  21. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  22. package/dist/{index-2haxh8h3.js → index-064v90e8.js} +1 -1
  23. package/dist/{index-awcftgmx.js → index-40ma8m0c.js} +3 -3
  24. package/dist/{index-y6xpzjzr.js → index-56tfs78r.js} +37 -27
  25. package/dist/{index-q7ywt6xt.js → index-6g1zq1sk.js} +2 -2
  26. package/dist/{index-3d5wnkq7.js → index-6tmf87w0.js} +1 -1
  27. package/dist/{index-yrrsp47d.js → index-dn2ke3b9.js} +17 -3
  28. package/dist/{index-t6j3qxnd.js → index-e5b61ty6.js} +1 -1
  29. package/dist/{index-0s8454t2.js → index-hjnrp6vy.js} +61 -15
  30. package/dist/{index-c9zrgcnt.js → index-j43m40zd.js} +1 -1
  31. package/dist/{index-7tdtpqrg.js → index-m8va3mma.js} +39 -6
  32. package/dist/{index-z928hmnp.js → index-mphkpyap.js} +1 -1
  33. package/dist/{index-n18sch77.js → index-r3bteyev.js} +5 -5
  34. package/dist/{index-axjgxeww.js → index-rp78nqvr.js} +166 -10
  35. package/dist/{index-z05n7702.js → index-sgchhbvy.js} +1 -1
  36. package/dist/{index-zzrzjnx5.js → index-va2g2q57.js} +3 -3
  37. package/dist/{index-jcr6pe7z.js → index-w55zp7kf.js} +1 -1
  38. package/dist/{index-szf8r0ba.js → index-xbbgcwd2.js} +1 -1
  39. package/dist/{index-ebsvmc5s.js → index-xyx2ge2y.js} +4 -4
  40. package/dist/{index-bhyksfyy.js → index-zn2n24yr.js} +3 -3
  41. package/dist/index.js +30 -28
  42. package/dist/{message-fts-rowid-map-9e1getgs.js → message-fts-rowid-map-4ksatb6f.js} +2 -2
  43. package/dist/{message-index-bounded-vaeqhp9w.js → message-index-bounded-whh5wv4a.js} +6 -6
  44. package/dist/{message-index-3g966xn7.js → message-index-ywx53y30.js} +6 -6
  45. package/dist/migration-worker.js +3 -3
  46. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  47. package/dist/{project-embedding-registry-rstzmb60.js → project-embedding-registry-t9fx6jwh.js} +4 -4
  48. package/dist/raw-ordinal-warmup-worker.js +6 -6
  49. package/dist/{read-session-chunk-z5gnc0zb.js → read-session-chunk-mqmkgdx0.js} +5 -3
  50. package/dist/{read-session-raw-s4amywnh.js → read-session-raw-dy2xxafq.js} +3 -1
  51. package/dist/{recomp-orchestrator-qwqeskhq.js → recomp-orchestrator-qwcz86r1.js} +13 -13
  52. package/dist/{search-archive-mfabzyn2.js → search-archive-8md3twv2.js} +4 -4
  53. package/dist/{search-84zfqeky.js → search-y2t97tbb.js} +10 -10
  54. package/dist/{send-session-notification-ygj4mja0.js → send-session-notification-kzazs7fy.js} +3 -3
  55. package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
  56. package/dist/{transform-postprocess-phase-hr1ntmjj.js → transform-postprocess-phase-ppm1tfa7.js} +13 -13
  57. package/dist/v2/auto-search-worker.js +4 -4
  58. package/dist/v2/chunk-embedding-write-worker.js +4 -4
  59. package/dist/v2/{compartment-chunk-embedding-tk6g4q80.js → compartment-chunk-embedding-5rmrn09z.js} +3 -3
  60. package/dist/v2/{context-y7wfvdve.js → context-10pj3bwd.js} +176 -27
  61. package/dist/v2/{embedding-backfill-w5qp7t28.js → embedding-backfill-r9mzt2eg.js} +5 -5
  62. package/dist/v2/{message-fts-rowid-map-pqk3a55v.js → message-fts-rowid-map-2s3ta05x.js} +2 -2
  63. package/dist/v2/{message-index-bounded-te303atj.js → message-index-bounded-f4269d3a.js} +5 -5
  64. package/dist/v2/{message-index-fz6b4jeh.js → message-index-v6g8mgn7.js} +5 -5
  65. package/dist/v2/migration-worker.js +3 -3
  66. package/dist/v2/{project-embedding-registry-e7zftfvj.js → project-embedding-registry-tgtmart7.js} +4 -4
  67. package/dist/v2/raw-ordinal-warmup-worker.js +6 -6
  68. package/dist/v2/{read-session-chunk-knvkq1hf.js → read-session-chunk-ym5zvexn.js} +4 -2
  69. package/dist/v2/{read-session-raw-ppjxnqk4.js → read-session-raw-484g8kf2.js} +3 -1
  70. package/dist/v2/{recomp-orchestrator-e8a4jpvr.js → recomp-orchestrator-b44s2snm.js} +10 -10
  71. package/dist/v2/{search-hav4dggf.js → search-75tf953m.js} +9 -9
  72. package/dist/v2/{search-archive-vrwgxv6z.js → search-archive-pmf2c1kb.js} +3 -3
  73. package/dist/v2/{send-session-notification-f8scq6ae.js → send-session-notification-gd21f5rq.js} +1 -1
  74. package/dist/v2/{server-e75vag9d.js → server-317f3x9y.js} +2 -2
  75. package/dist/v2/{server-wxrdher8.js → server-4frtg2z1.js} +1 -1
  76. package/dist/v2/{server-pw21ypwb.js → server-7dpnt0ys.js} +1 -1
  77. package/dist/v2/{server-7weh65vd.js → server-9zh78t8y.js} +59 -13
  78. package/dist/v2/{server-swvhxhxz.js → server-erk2bvdf.js} +39 -6
  79. package/dist/v2/{server-q5z0gag0.js → server-hnmm8yzq.js} +1 -1
  80. package/dist/v2/{server-5brp2rfn.js → server-jcsw05aa.js} +16 -2
  81. package/dist/v2/{server-6a8pxpxg.js → server-k46ec388.js} +3 -3
  82. package/dist/v2/{server-9xbbaekh.js → server-nmwhe524.js} +1 -1
  83. package/dist/v2/{server-tfawsj08.js → server-vjer2jdn.js} +5 -5
  84. package/dist/v2/{server-m6yyn961.js → server-w7x9wgm0.js} +2 -2
  85. package/dist/v2/{server-8j2e7t31.js → server-wj8h2q21.js} +1 -1
  86. package/dist/v2/server.js +2 -2
  87. package/dist/v2/{wrapup-orchestrator-ycs8y6n4.js → wrapup-orchestrator-gwww44st.js} +10 -10
  88. package/dist/{wrapup-orchestrator-f642w8n3.js → wrapup-orchestrator-a9r8r4sk.js} +14 -14
  89. package/package.json +1 -1
@@ -24,7 +24,7 @@ import {
24
24
  loadCompartmentChunkEmbeddingsForSearch2,
25
25
  peekCompartmentChunkSearchPool2,
26
26
  warmCompartmentChunkSearchPool2
27
- } from "./index-3d5wnkq7.js";
27
+ } from "./index-6tmf87w0.js";
28
28
  import {
29
29
  recordEmbeddingMeasurement,
30
30
  saveCommitEmbedding,
@@ -41,7 +41,7 @@ import {
41
41
  enqueueShadowEmbeddingItems2,
42
42
  getProjectEmbeddingSnapshot2,
43
43
  embedItemsForProject2
44
- } from "./index-z05n7702.js";
44
+ } from "./index-sgchhbvy.js";
45
45
  import {
46
46
  getProjectEmbeddings2
47
47
  } from "./index-4dhv7mqz.js";
@@ -50,7 +50,7 @@ import {
50
50
  isEmbeddingEnabled,
51
51
  embedText,
52
52
  ensureMemoryEmbeddings2
53
- } from "./index-t6j3qxnd.js";
53
+ } from "./index-e5b61ty6.js";
54
54
  import {
55
55
  ModuleMemoryAuthorityError2,
56
56
  getMemoriesByProject2,
@@ -65,13 +65,13 @@ import {
65
65
  sanitizeFtsQuery,
66
66
  searchMemoriesFTS,
67
67
  searchMemoriesFTSUnion
68
- } from "./index-z928hmnp.js";
68
+ } from "./index-mphkpyap.js";
69
69
  import {
70
70
  cleanSearchText,
71
71
  keywordRelevance,
72
72
  matchedSearchSnippet,
73
73
  getIndexedMessageCorpusSize2
74
- } from "./index-awcftgmx.js";
74
+ } from "./index-40ma8m0c.js";
75
75
  import {
76
76
  MESSAGE_FTS_SESSION_FILTER_SQL,
77
77
  withMessageFtsSessionFilter
@@ -98,13 +98,13 @@ import {
98
98
  getProjectEmbeddingSnapshot2,
99
99
  embedTextForProject2,
100
100
  embedBatchForProject2
101
- } from "./index-z05n7702.js";
101
+ } from "./index-sgchhbvy.js";
102
102
  import {
103
103
  createWorkerShutdown
104
104
  } from "./index-cpjk5jd2.js";
105
105
  import {
106
106
  runSessionWarmupWorker
107
- } from "./index-7tdtpqrg.js";
107
+ } from "./index-m8va3mma.js";
108
108
  import {
109
109
  getMaxM0MutationId,
110
110
  getLastCompartmentEndMessage,
@@ -140,11 +140,11 @@ import {
140
140
  peekNoteNudgeText,
141
141
  markNoteNudgeDelivered,
142
142
  getActiveCompartmentRun
143
- } from "./index-0s8454t2.js";
143
+ } from "./index-hjnrp6vy.js";
144
144
  import {
145
145
  cleanSearchText,
146
146
  matchedSearchSnippet
147
- } from "./index-awcftgmx.js";
147
+ } from "./index-40ma8m0c.js";
148
148
  import {
149
149
  stripSystemInjection,
150
150
  isTextPart,
@@ -242,7 +242,7 @@ import {
242
242
  extractToolCallObservation,
243
243
  ToolMutationBatch,
244
244
  createToolDropTarget
245
- } from "./index-yrrsp47d.js";
245
+ } from "./index-dn2ke3b9.js";
246
246
  import {
247
247
  isValidLanguageCode
248
248
  } from "./index-nxrsns5x.js";
@@ -253,13 +253,13 @@ import {
253
253
  openCodeDbExists,
254
254
  withReadOnlySessionDb,
255
255
  getMessageTimesFromOpenCodeDb
256
- } from "./index-c9zrgcnt.js";
256
+ } from "./index-j43m40zd.js";
257
257
  import {
258
258
  BoundedSessionMap
259
259
  } from "./index-cfaet9cg.js";
260
260
  import {
261
261
  userFacingFailureCode
262
- } from "./index-z928hmnp.js";
262
+ } from "./index-mphkpyap.js";
263
263
  import {
264
264
  normalizeProtectedToolName,
265
265
  mergeProtectedTools
@@ -3224,6 +3224,23 @@ function applyCompressedText(target, tagNumber, originalText, depth, state) {
3224
3224
  target.setContent(`${target.textPrefix ?? ""}${compressed}`, { keepReasoning: true });
3225
3225
  return target.getContent ? target.getContent() !== before : true;
3226
3226
  }
3227
+ function cavemanReplayText(tagNumber, originalText, depth, state, textPrefix) {
3228
+ const level = DEPTH_TO_LEVEL[depth];
3229
+ if (!level)
3230
+ return null;
3231
+ let served = null;
3232
+ if (!state.currentRules || state.legacyReasoningTags.has(tagNumber)) {
3233
+ const legacy = cavemanCompress(originalText, level, "ascii-v1");
3234
+ if (legacy.length > 0)
3235
+ served = { text: legacy, dropsReasoning: true };
3236
+ if (!state.currentRules)
3237
+ return served;
3238
+ }
3239
+ const compressed = cavemanCompress(originalText, level, CURRENT_CAVEMAN_RULES, wordRulesFor(state));
3240
+ if (compressed.length === 0)
3241
+ return served;
3242
+ return { text: `${textPrefix}${compressed}`, dropsReasoning: served?.dropsReasoning ?? false };
3243
+ }
3227
3244
  function replayCavemanCompression(sessionId, db, targets, tags) {
3228
3245
  const compressedTags = tags.filter((tag) => tag.type === "message" && tag.status === "active" && tag.cavemanDepth > 0 && targets.has(tag.tagNumber));
3229
3246
  if (compressedTags.length === 0)
@@ -4548,6 +4565,58 @@ function stripStructuralNoise(messages) {
4548
4565
  }
4549
4566
  return strippedParts;
4550
4567
  }
4568
+ // src/hooks/magic-context/foreign-text-parts.ts
4569
+ function hasStringId(part) {
4570
+ return part !== null && typeof part === "object" && typeof part.id === "string";
4571
+ }
4572
+ function lastStoredPartIndex(parts) {
4573
+ for (let index = parts.length - 1;index >= 0; index -= 1) {
4574
+ if (hasStringId(parts[index]))
4575
+ return index;
4576
+ }
4577
+ return -1;
4578
+ }
4579
+ function collectForeignTextParts(messages) {
4580
+ let foreign;
4581
+ for (const message of messages) {
4582
+ if (typeof message.info.id !== "string")
4583
+ continue;
4584
+ if (!message.parts.some(hasStringId))
4585
+ continue;
4586
+ for (const part of message.parts) {
4587
+ if (isTextPart(part) && !hasStringId(part)) {
4588
+ foreign ??= new WeakSet;
4589
+ foreign.add(part);
4590
+ }
4591
+ }
4592
+ }
4593
+ return foreign;
4594
+ }
4595
+ var legacyForeignTextTags = new Map;
4596
+ function rememberLegacyForeignTextTags(sessionId, tagNumbers) {
4597
+ for (const tagNumber of tagNumbers) {
4598
+ let known = legacyForeignTextTags.get(sessionId);
4599
+ if (!known) {
4600
+ known = new Set;
4601
+ legacyForeignTextTags.set(sessionId, known);
4602
+ }
4603
+ known.add(tagNumber);
4604
+ }
4605
+ }
4606
+ function isLegacyForeignTextTag(sessionId, tagNumber) {
4607
+ return legacyForeignTextTags.get(sessionId)?.has(tagNumber) ?? false;
4608
+ }
4609
+ var pendingOpForTagStatements = new WeakMap;
4610
+ function discardPendingOpForForeignTag(db, sessionId, tagNumber) {
4611
+ let statement = pendingOpForTagStatements.get(db);
4612
+ if (!statement) {
4613
+ statement = db.prepare("SELECT 1 AS present FROM pending_ops WHERE session_id = ? AND tag_id = ? LIMIT 1");
4614
+ pendingOpForTagStatements.set(db, statement);
4615
+ }
4616
+ if (statement.get(sessionId, tagNumber))
4617
+ removePendingOp(db, sessionId, tagNumber);
4618
+ }
4619
+
4551
4620
  // src/hooks/magic-context/tag-id-fallback.ts
4552
4621
  function parseScopedContentId(contentId) {
4553
4622
  const match = /^(.*):(p|file)(\d+)$/.exec(contentId);
@@ -4739,6 +4808,62 @@ function deriveToolOwnerMessageId(sessionId, db, message, obs, unpaired, cache,
4739
4808
  }
4740
4809
  return obs.callId;
4741
4810
  }
4811
+ function serveLegacyForeignText(legacy, current, options) {
4812
+ const prefixed = options.skipPrefixInjection ? current : prependTag(legacy.tagNumber, current);
4813
+ if (options.pastPartialEnd)
4814
+ return { text: prefixed, dropsReasoning: false };
4815
+ if (legacy.status === "dropped") {
4816
+ return { text: buildReplacementContent(legacy.tagNumber), dropsReasoning: true };
4817
+ }
4818
+ const unchanged = legacy.savedText !== undefined && stripTagPrefix(current) === legacy.savedText;
4819
+ if (legacy.status === "active" && legacy.cavemanDepth > 0 && options.caveman && unchanged && legacy.savedText) {
4820
+ const replayed = cavemanReplayText(legacy.tagNumber, legacy.savedText, legacy.cavemanDepth, options.caveman, options.skipPrefixInjection ? "" : prependTag(legacy.tagNumber, ""));
4821
+ if (replayed)
4822
+ return replayed;
4823
+ }
4824
+ return { text: prefixed, dropsReasoning: false };
4825
+ }
4826
+ function findLegacyForeignTextTags(sessionId, messages, assignments, db, isForeignTextPart, inertWhitespaceTagNumbers) {
4827
+ const legacy = new Map;
4828
+ for (const message of messages) {
4829
+ const messageId = typeof message.info.id === "string" ? message.info.id : null;
4830
+ if (!messageId)
4831
+ continue;
4832
+ const firstTrailingIndex = lastStoredPartIndex(message.parts) + 1;
4833
+ for (let partIndex = firstTrailingIndex;partIndex < message.parts.length; partIndex += 1) {
4834
+ const part = message.parts[partIndex];
4835
+ if (!isTextPart(part) || !isForeignTextPart(part))
4836
+ continue;
4837
+ const contentId = `${messageId}:p${partIndex}`;
4838
+ const tagNumber = assignments.get(contentId) ?? getTagNumberByMessageId2(db, sessionId, contentId);
4839
+ if (tagNumber === null || tagNumber === undefined)
4840
+ continue;
4841
+ if (inertWhitespaceTagNumbers.has(tagNumber))
4842
+ continue;
4843
+ const tag = getTagById2(db, sessionId, tagNumber);
4844
+ if (tag?.type !== "message")
4845
+ continue;
4846
+ legacy.set(part, {
4847
+ tagNumber,
4848
+ status: tag.status,
4849
+ cavemanDepth: tag.cavemanDepth
4850
+ });
4851
+ }
4852
+ }
4853
+ if (legacy.size > 0) {
4854
+ const tagNumbers = [...legacy.values()].map((entry) => entry.tagNumber);
4855
+ rememberLegacyForeignTextTags(sessionId, tagNumbers);
4856
+ for (const tagNumber of tagNumbers)
4857
+ discardPendingOpForForeignTag(db, sessionId, tagNumber);
4858
+ const compressed = [...legacy.values()].filter((entry) => entry.status === "active" && entry.cavemanDepth > 0);
4859
+ if (compressed.length > 0) {
4860
+ const saved = getSourceContents(db, sessionId, compressed.map((entry) => entry.tagNumber));
4861
+ for (const entry of compressed)
4862
+ entry.savedText = saved.get(entry.tagNumber);
4863
+ }
4864
+ }
4865
+ return legacy;
4866
+ }
4742
4867
  function collectRelevantSourceTagIds(messages, assignments) {
4743
4868
  const currentMessageIds = new Set(messages.flatMap((message) => typeof message.info.id === "string" ? [message.info.id] : []));
4744
4869
  const relevantTagIds = new Set;
@@ -4861,8 +4986,17 @@ function tagMessages(sessionId, messages, tagger, db, options = {}) {
4861
4986
  logTransformTiming(sessionId, "tag.inertWhitespace", tInertWhitespace);
4862
4987
  const assignments = tagger.getAssignments(sessionId);
4863
4988
  const resolver = createExistingTagResolver(sessionId, tagger, db);
4989
+ const foreignTextParts = options.foreignTextParts;
4990
+ const isForeignTextPart = (part) => foreignTextParts !== undefined && part !== null && typeof part === "object" && foreignTextParts.has(part);
4991
+ const legacyForeignTags = findLegacyForeignTextTags(sessionId, messages, assignments, db, isForeignTextPart, inertWhitespaceTagNumbers);
4992
+ const legacyForeignTagNumbers = new Set([...legacyForeignTags.values()].map((legacy) => legacy.tagNumber));
4993
+ let cavemanState;
4994
+ const legacyCavemanState = () => {
4995
+ cavemanState ??= options.replaysCaveman ? getCavemanReplayState(db, sessionId) : null;
4996
+ return cavemanState;
4997
+ };
4864
4998
  const tGetSourceContents = performance.now();
4865
- const sourceContents = getSourceContents(db, sessionId, collectRelevantSourceTagIds(messages, assignments));
4999
+ const sourceContents = getSourceContents(db, sessionId, collectRelevantSourceTagIds(messages, assignments).filter((tagNumber) => !legacyForeignTagNumbers.has(tagNumber)));
4866
5000
  logTransformTiming(sessionId, "tag.getSourceContents", tGetSourceContents);
4867
5001
  let partialEndsCache;
4868
5002
  const loadPartialEnds = () => {
@@ -4956,6 +5090,28 @@ function tagMessages(sessionId, messages, tagger, db, options = {}) {
4956
5090
  }
4957
5091
  ownerByPartKey.set(part, { ownerMsgId, callId: toolObservation.callId });
4958
5092
  }
5093
+ if (messageId && isTextPart(part) && isForeignTextPart(part)) {
5094
+ const legacy = legacyForeignTags.get(part);
5095
+ if (legacy) {
5096
+ const partialEnd = getPartialEnds().get(messageId);
5097
+ const served = serveLegacyForeignText(legacy, part.text, {
5098
+ skipPrefixInjection,
5099
+ pastPartialEnd: partialEnd !== undefined && partIndex > partialEnd,
5100
+ caveman: legacy.cavemanDepth > 0 ? legacyCavemanState() : null
5101
+ });
5102
+ part.text = served.text;
5103
+ if (served.dropsReasoning) {
5104
+ for (const thinkingPart of messageThinkingParts) {
5105
+ if (protectedThinkingParts.has(thinkingPart))
5106
+ continue;
5107
+ if (partialEnd !== undefined && message.parts.indexOf(thinkingPart) > partialEnd)
5108
+ continue;
5109
+ neutralizeDroppedReasoningPart(thinkingPart);
5110
+ }
5111
+ }
5112
+ }
5113
+ continue;
5114
+ }
4959
5115
  if (messageId && isTextPart(part)) {
4960
5116
  const textPart = part;
4961
5117
  const thinkingParts = messageThinkingParts;
@@ -4997,7 +5153,7 @@ function tagMessages(sessionId, messages, tagger, db, options = {}) {
4997
5153
  }
4998
5154
  } else {
4999
5155
  existingTagId = resolver.resolve(messageId, "message", contentId, textOrdinal, {
5000
- accept: (tagNumber) => !inertWhitespaceTagNumbers.has(tagNumber)
5156
+ accept: (tagNumber) => !inertWhitespaceTagNumbers.has(tagNumber) && !legacyForeignTagNumbers.has(tagNumber)
5001
5157
  });
5002
5158
  if (existingTagId === undefined && inertWhitespaceTagNumbers.has(tagger.getTag(sessionId, contentId, "message") ?? -1)) {
5003
5159
  tagger.unbindTag(sessionId, contentId);
@@ -7425,4 +7581,4 @@ function checkM0MutationDriftAndSignal2(args) {
7425
7581
  return false;
7426
7582
  }
7427
7583
 
7428
- export { makeToolCompositeKey, createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, diagnosticStateChanged, clearDiagnosticLogState, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRidePermitted, reclaimRideLabel, pendingDropEligibilityKey, createPendingDropEligibilityCache, readExecuteReclaimState, writeExecuteReclaimState, maintainExecuteFloorMark, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, replayCavemanCompression, DegradedPassRefusalError, degradedPassError, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners, stripStructuralNoise, withTransformTimingSummary, logTransformTiming, hasRecentAssistantCommit, tagMessages, resetDegradedCacheCount2, isSyntheticHeadMessage2, applyTodoSynthesis2, freezeReasoningOnBustingPass2, servesThinkingBlock2, firstServedDivergenceIndex2, rustModeServedKeyAfterPersistedStrips2, replayRustModeBindingMismatchStrips2, RUST_MARKER_LOCK_SKIP_LOG2, applyRustModeDeferredCompactionMarker2, clearRustModeBoundaryRecord2, runRustModePostprocess2, reconcileMarkerRepresentation2, clearPendingCompactionMarkerAfterSuccessfulDrain2, defaultCompactionMarkerStrategy2, abortSessionFailClosed2, evaluateEmergencyFailClosed2, finalizeMessageRepresentation2, runPostTransformPhase2, checkM0MutationDriftAndSignal2 };
7584
+ export { makeToolCompositeKey, createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, diagnosticStateChanged, clearDiagnosticLogState, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRidePermitted, reclaimRideLabel, pendingDropEligibilityKey, createPendingDropEligibilityCache, readExecuteReclaimState, writeExecuteReclaimState, maintainExecuteFloorMark, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, replayCavemanCompression, DegradedPassRefusalError, degradedPassError, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners, stripStructuralNoise, collectForeignTextParts, isLegacyForeignTextTag, withTransformTimingSummary, logTransformTiming, hasRecentAssistantCommit, tagMessages, resetDegradedCacheCount2, isSyntheticHeadMessage2, applyTodoSynthesis2, freezeReasoningOnBustingPass2, servesThinkingBlock2, firstServedDivergenceIndex2, rustModeServedKeyAfterPersistedStrips2, replayRustModeBindingMismatchStrips2, RUST_MARKER_LOCK_SKIP_LOG2, applyRustModeDeferredCompactionMarker2, clearRustModeBoundaryRecord2, runRustModePostprocess2, reconcileMarkerRepresentation2, clearPendingCompactionMarkerAfterSuccessfulDrain2, defaultCompactionMarkerStrategy2, abortSessionFailClosed2, evaluateEmergencyFailClosed2, finalizeMessageRepresentation2, runPostTransformPhase2, checkM0MutationDriftAndSignal2 };
@@ -41,7 +41,7 @@ import {
41
41
  countSessionCompartmentEmbedCoverage2,
42
42
  countSessionCompartmentEmbedCoveragePolite2,
43
43
  countUnembeddedSessionCompartmentsPolite2
44
- } from "./index-3d5wnkq7.js";
44
+ } from "./index-6tmf87w0.js";
45
45
  import {
46
46
  DEFAULT_LOCAL_EMBEDDING_MODEL
47
47
  } from "./index-nxrsns5x.js";
@@ -3,16 +3,16 @@ import {
3
3
  } from "./index-h7tgn49j.js";
4
4
  import {
5
5
  clearEmergencyRecovery
6
- } from "./index-yrrsp47d.js";
6
+ } from "./index-dn2ke3b9.js";
7
7
  import {
8
8
  requestPendingMaterialization,
9
9
  dropSlot,
10
10
  executeContextRecomp
11
- } from "./index-0s8454t2.js";
11
+ } from "./index-hjnrp6vy.js";
12
12
  import {
13
13
  renderUserFacingFailure,
14
14
  userFacingFailureCode
15
- } from "./index-z928hmnp.js";
15
+ } from "./index-mphkpyap.js";
16
16
 
17
17
  // src/hooks/magic-context/recomp-orchestrator.ts
18
18
  function resolveLiveModelKey(liveSessionState, sessionId) {
@@ -10,7 +10,7 @@ import {
10
10
  } from "./index-rrv26qjz.js";
11
11
  import {
12
12
  shouldHoldIgnoredNotification
13
- } from "./index-c9zrgcnt.js";
13
+ } from "./index-j43m40zd.js";
14
14
  import {
15
15
  getErrorMessage
16
16
  } from "./index-y8v6yerm.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./index-gzy5w8ya.js";
6
6
  import {
7
7
  runSessionWarmupWorker
8
- } from "./index-7tdtpqrg.js";
8
+ } from "./index-m8va3mma.js";
9
9
  import {
10
10
  logSlowWriteTransaction
11
11
  } from "./index-t5pck3ss.js";
@@ -15,7 +15,7 @@ import {
15
15
  getActiveCompartmentRun,
16
16
  markActiveCompartmentRunPublished,
17
17
  registerActiveCompartmentRun
18
- } from "./index-0s8454t2.js";
18
+ } from "./index-hjnrp6vy.js";
19
19
  import {
20
20
  inRootAsyncContext2
21
21
  } from "./index-gzy5w8ya.js";
@@ -27,17 +27,17 @@ import {
27
27
  getHistorianFailureState,
28
28
  clearEmergencyRecovery,
29
29
  prepareRawSessionOrdinals2
30
- } from "./index-yrrsp47d.js";
30
+ } from "./index-dn2ke3b9.js";
31
31
  import {
32
32
  pushNotification2
33
33
  } from "./index-x8a7jmkh.js";
34
34
  import {
35
35
  sendStatusNotification2
36
- } from "./index-jcr6pe7z.js";
36
+ } from "./index-w55zp7kf.js";
37
37
  import {
38
38
  setRecompStarting2,
39
39
  setRecompTerminal2
40
- } from "./index-zzrzjnx5.js";
40
+ } from "./index-va2g2q57.js";
41
41
 
42
42
  // src/hooks/magic-context/wrapup-orchestrator.ts
43
43
  import * as crypto from "node:crypto";
@@ -6,18 +6,18 @@ import {
6
6
  } from "./index-gzy5w8ya.js";
7
7
  import {
8
8
  runSessionWarmupWorker
9
- } from "./index-7tdtpqrg.js";
9
+ } from "./index-m8va3mma.js";
10
10
  import {
11
11
  estimateTokens
12
12
  } from "./index-b88dwwrh.js";
13
13
  import {
14
14
  openCodeDbExists,
15
15
  withReadOnlySessionDb
16
- } from "./index-c9zrgcnt.js";
16
+ } from "./index-j43m40zd.js";
17
17
  import {
18
18
  hasRawMessageProvider2,
19
19
  readRawSessionMessageIdOrdinalsForRange2
20
- } from "./index-yrrsp47d.js";
20
+ } from "./index-dn2ke3b9.js";
21
21
 
22
22
  // src/tools/ctx-expand/search-archive.ts
23
23
  var archiveReadsOnThisThread = 0;
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  detectOverflow,
29
29
  isAnthropicFamilyRoute,
30
30
  readRawSessionMessages2
31
- } from "./index-yrrsp47d.js";
31
+ } from "./index-dn2ke3b9.js";
32
32
  import {
33
33
  setHarness2
34
34
  } from "./index-pavzsdc6.js";
@@ -97,7 +97,7 @@ import {
97
97
  checkCompactionMarkerConsistency,
98
98
  clearInjectionCache,
99
99
  clearNoteNudgeTriggerOnly
100
- } from "./index-0s8454t2.js";
100
+ } from "./index-hjnrp6vy.js";
101
101
  import"./index-sd3egckz.js";
102
102
  import {
103
103
  hasTrustedAbsoluteWall,
@@ -185,7 +185,7 @@ import {
185
185
  parameterDescriptionsFor,
186
186
  MagicContextRpcServer,
187
187
  applyHiddenSubagentTemperature
188
- } from "./index-y6xpzjzr.js";
188
+ } from "./index-56tfs78r.js";
189
189
  import {
190
190
  resolveOpenCodeDbPath,
191
191
  openCodeDbPathExists,
@@ -209,7 +209,7 @@ import {
209
209
  openDatabaseAsync,
210
210
  isDatabasePersisted,
211
211
  getDatabasePersistenceError
212
- } from "./index-q7ywt6xt.js";
212
+ } from "./index-6g1zq1sk.js";
213
213
  import {
214
214
  setHomeProjectPermission,
215
215
  ProjectIdentityError,
@@ -228,7 +228,7 @@ import {
228
228
  observeSessionActivity,
229
229
  backfillSessionActivity,
230
230
  deleteIndexedMessage2
231
- } from "./index-awcftgmx.js";
231
+ } from "./index-40ma8m0c.js";
232
232
  import {
233
233
  recordSessionProjectIdentity
234
234
  } from "./index-kfyb3k6n.js";
@@ -241,8 +241,8 @@ import {
241
241
  import"./index-cpjk5jd2.js";
242
242
  import {
243
243
  forgetRawSessionOrdinalWatermark2
244
- } from "./index-7tdtpqrg.js";
245
- import"./index-szf8r0ba.js";
244
+ } from "./index-m8va3mma.js";
245
+ import"./index-xbbgcwd2.js";
246
246
  import"./index-9q1g3c5q.js";
247
247
  import"./index-fr0wbhdn.js";
248
248
  import {
@@ -257,18 +257,18 @@ import"./index-wfybj1dw.js";
257
257
  import {
258
258
  getDefaultSubcConnectionFile,
259
259
  SubcModuleTransport
260
- } from "./index-n18sch77.js";
260
+ } from "./index-r3bteyev.js";
261
261
  import"./index-qt1qqasc.js";
262
262
  import"./index-rrv26qjz.js";
263
263
  import {
264
264
  observeOpenCodeTurnEvent,
265
265
  clearTrackedOpenCodeSession,
266
266
  findLastAssistantModelFromOpenCodeDb
267
- } from "./index-c9zrgcnt.js";
267
+ } from "./index-j43m40zd.js";
268
268
  import {
269
269
  sendCommandResult2,
270
270
  sendStatusNotification2
271
- } from "./index-jcr6pe7z.js";
271
+ } from "./index-w55zp7kf.js";
272
272
  import {
273
273
  detectConflicts,
274
274
  resolveCompactionForBoot
@@ -276,7 +276,7 @@ import {
276
276
  import {
277
277
  sendConflictWarning2,
278
278
  cleanupConflictWarnings2
279
- } from "./index-2haxh8h3.js";
279
+ } from "./index-064v90e8.js";
280
280
  import"./index-1zx87sdm.js";
281
281
  import {
282
282
  stripPersistedAssistantText,
@@ -292,15 +292,15 @@ import {
292
292
  getEmbedDrainUiStatus,
293
293
  clearEmbedSessionState,
294
294
  getEmbeddingCoverageStatus2
295
- } from "./index-z05n7702.js";
296
- import"./index-3d5wnkq7.js";
297
- import"./index-z928hmnp.js";
295
+ } from "./index-sgchhbvy.js";
296
+ import"./index-6tmf87w0.js";
297
+ import"./index-mphkpyap.js";
298
298
  import {
299
299
  pushNotification2
300
300
  } from "./index-x8a7jmkh.js";
301
301
  import"./index-51rdvtkz.js";
302
302
  import"./index-4dhv7mqz.js";
303
- import"./index-t6j3qxnd.js";
303
+ import"./index-e5b61ty6.js";
304
304
  import"./index-jjvbk92s.js";
305
305
  import"./index-qgh1qwjj.js";
306
306
  import {
@@ -308,11 +308,12 @@ import {
308
308
  cavemanWordRulesForLanguage,
309
309
  setCtxReduceRegisteredGlobally,
310
310
  clearToolPermissionDenied,
311
+ collectForeignTextParts,
311
312
  resetDegradedCacheCount2
312
- } from "./index-axjgxeww.js";
313
+ } from "./index-rp78nqvr.js";
313
314
  import {
314
315
  runManagedRecomp2
315
- } from "./index-zzrzjnx5.js";
316
+ } from "./index-va2g2q57.js";
316
317
  import {
317
318
  isValidSemver,
318
319
  compareSemverCore
@@ -320,9 +321,9 @@ import {
320
321
  import"./index-fmsr7v69.js";
321
322
  import {
322
323
  runManagedWrapup2
323
- } from "./index-ebsvmc5s.js";
324
+ } from "./index-xyx2ge2y.js";
324
325
  import"./index-kaqs6h31.js";
325
- import"./index-bhyksfyy.js";
326
+ import"./index-zn2n24yr.js";
326
327
  import {
327
328
  isDreamerRunnable,
328
329
  isSmartNoteSurfaceAvailable,
@@ -8190,7 +8191,7 @@ var require_src2 = __commonJS(function(exports, module) {
8190
8191
  // package.json
8191
8192
  var package_default = {
8192
8193
  name: "@cortexkit/opencode-magic-context",
8193
- version: "0.49.25",
8194
+ version: "0.49.26",
8194
8195
  type: "module",
8195
8196
  description: "OpenCode plugin for Magic Context — cross-session memory and context management",
8196
8197
  main: "dist/index.js",
@@ -10493,6 +10494,7 @@ function createMagicContextHook(deps) {
10493
10494
  cacheTtlConfigured: deps.config.cacheTtlConfigured,
10494
10495
  sampleCacheTtlConfig: () => deps.sampleHistorianConfig?.() ?? deps.config,
10495
10496
  tagger: deps.tagger,
10497
+ collectForeignTextParts,
10496
10498
  scheduler: deps.scheduler,
10497
10499
  contextUsageMap,
10498
10500
  db,
@@ -12043,7 +12045,7 @@ async function setup(context) {
12043
12045
  if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
12044
12046
  log2(`[magic-context] Magic Context storage is at ${storageDir}, outside the folder Engram backs up (~/.local/share/cortexkit/magic-context). It is not included in CortexKit backups.`);
12045
12047
  }
12046
- const { registerContext } = await import("./context-keb00be8.js");
12048
+ const { registerContext } = await import("./context-pjqa24nd.js");
12047
12049
  setHarness2("opencode2");
12048
12050
  bindStaleBuildNotice({}, import.meta.url, "opencode2");
12049
12051
  const duties = await registerContext(context);
@@ -12122,7 +12124,7 @@ var server = async (ctx) => {
12122
12124
  if (hasBannerEntries)
12123
12125
  setTimeout(async () => {
12124
12126
  try {
12125
- const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-ygj4mja0.js"));
12127
+ const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-kzazs7fy.js"));
12126
12128
  const clientWithSessions = ctx.client;
12127
12129
  const sessions = await Promise.resolve(clientWithSessions.session?.list?.()).catch(() => null);
12128
12130
  const sessionList = Array.isArray(sessions) ? sessions : sessions?.data;
@@ -12140,7 +12142,7 @@ var server = async (ctx) => {
12140
12142
  log2(`[magic-context] opencode_db_missing path=${openCodeDbResolution.path} source=${openCodeDbResolution.source}`);
12141
12143
  setTimeout(async () => {
12142
12144
  try {
12143
- const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-ygj4mja0.js"));
12145
+ const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-kzazs7fy.js"));
12144
12146
  const clientWithSessions = ctx.client;
12145
12147
  const sessions = await Promise.resolve(clientWithSessions.session?.list?.()).catch(() => null);
12146
12148
  const sessionList = Array.isArray(sessions) ? sessions : sessions?.data;
@@ -12417,12 +12419,12 @@ var server = async (ctx) => {
12417
12419
  {
12418
12420
  const fence = getSchemaFenceRejection();
12419
12421
  if (fence) {
12420
- importPluginModule(() => import("./conflict-warning-hook-a27bhggg.js")).then(({ sendSchemaFenceWarning }) => sendSchemaFenceWarning(ctx.client, ctx.directory, fence)).catch((error) => log2("[magic-context] schema-fence warning unavailable:", error));
12422
+ importPluginModule(() => import("./conflict-warning-hook-dv8fdc2w.js")).then(({ sendSchemaFenceWarning }) => sendSchemaFenceWarning(ctx.client, ctx.directory, fence)).catch((error) => log2("[magic-context] schema-fence warning unavailable:", error));
12421
12423
  }
12422
12424
  }
12423
12425
  const serverUrl = ctx.serverUrl;
12424
12426
  const serverUrlStr = serverUrl instanceof URL ? serverUrl.toString().replace(/\/$/, "") : typeof serverUrl === "string" ? serverUrl.replace(/\/$/, "") : undefined;
12425
- importPluginModule(() => import("./send-session-notification-ygj4mja0.js")).then(({ setNotificationServerUrl }) => {
12427
+ importPluginModule(() => import("./send-session-notification-kzazs7fy.js")).then(({ setNotificationServerUrl }) => {
12426
12428
  setNotificationServerUrl(serverUrlStr);
12427
12429
  }).catch((error) => log2("[magic-context] notification transport unavailable:", error));
12428
12430
  if (conflictResult?.hasConflict) {
@@ -12445,7 +12447,7 @@ var server = async (ctx) => {
12445
12447
  }) => {
12446
12448
  if (!shouldShowAnnouncement())
12447
12449
  return;
12448
- return importPluginModule(() => import("./conflict-warning-hook-a27bhggg.js")).then(({ sendStartupAnnouncement }) => sendStartupAnnouncement(ctx.client, ctx.directory, ANNOUNCEMENT_VERSION, ANNOUNCEMENT_FEATURES, ANNOUNCEMENT_FOOTER, markAnnouncementSeen));
12450
+ return importPluginModule(() => import("./conflict-warning-hook-dv8fdc2w.js")).then(({ sendStartupAnnouncement }) => sendStartupAnnouncement(ctx.client, ctx.directory, ANNOUNCEMENT_VERSION, ANNOUNCEMENT_FEATURES, ANNOUNCEMENT_FOOTER, markAnnouncementSeen));
12449
12451
  }).catch(() => {});
12450
12452
  }, 8000);
12451
12453
  }
@@ -12519,8 +12521,8 @@ var server = async (ctx) => {
12519
12521
  tryReopenStorage,
12520
12522
  rustReplayParticipant: () => magicContextRuntime.magicContext?.getRustReplayParticipant?.() ?? null,
12521
12523
  onStorageBusyRefusal: async (sessionId, message) => {
12522
- const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-ygj4mja0.js"));
12523
- const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-hr1ntmjj.js"));
12524
+ const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-kzazs7fy.js"));
12525
+ const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-ppm1tfa7.js"));
12524
12526
  await sendStatusNotification(ctx.client, sessionId, message, {
12525
12527
  toastDurationMs: 15000
12526
12528
  });
@@ -6,8 +6,8 @@ import {
6
6
  messageFtsOrdinalRangeIsMapped2,
7
7
  getMessageFtsRowidMapBackfillProgress2,
8
8
  deleteUnmappedMessageFtsRows2
9
- } from "./index-szf8r0ba.js";
10
- import"./index-7tdtpqrg.js";
9
+ } from "./index-xbbgcwd2.js";
10
+ import"./index-m8va3mma.js";
11
11
  import"./index-v0p37hm2.js";
12
12
  import"./index-t5pck3ss.js";
13
13
  import"./index-gzy5w8ya.js";
@@ -14,7 +14,7 @@ import {
14
14
  markMessageIndexDirty2,
15
15
  getIndexableContent2,
16
16
  indexSingleMessage2
17
- } from "./index-awcftgmx.js";
17
+ } from "./index-40ma8m0c.js";
18
18
  import"./index-1zx87sdm.js";
19
19
  import"./index-whcgcfrv.js";
20
20
  import"./index-b88dwwrh.js";
@@ -22,14 +22,14 @@ import"./index-x9k3mqrf.js";
22
22
  import"./index-nxrsns5x.js";
23
23
  import"./index-v0p37hm2.js";
24
24
  import"./index-cpjk5jd2.js";
25
- import"./index-7tdtpqrg.js";
25
+ import"./index-m8va3mma.js";
26
26
  import"./index-58e3y90n.js";
27
- import"./index-c9zrgcnt.js";
28
- import"./index-yrrsp47d.js";
27
+ import"./index-j43m40zd.js";
28
+ import"./index-dn2ke3b9.js";
29
29
  import"./index-cfaet9cg.js";
30
- import"./index-szf8r0ba.js";
30
+ import"./index-xbbgcwd2.js";
31
31
  import"./index-wfybj1dw.js";
32
- import"./index-3d5wnkq7.js";
32
+ import"./index-6tmf87w0.js";
33
33
  import"./index-t5pck3ss.js";
34
34
 
35
35
  // src/features/magic-context/message-index-bounded.ts