@cortexkit/opencode-magic-context 0.48.0 → 0.49.0

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 (203) hide show
  1. package/dist/auto-search-worker.js +3 -3
  2. package/dist/{conflict-warning-hook-w8cykrnf.js → conflict-warning-hook-kzx4dmk1.js} +7 -7
  3. package/dist/{context-m0cy262m.js → context-nj5f293n.js} +96 -43
  4. package/dist/{derive-budgets-sg0xsq7s.js → derive-budgets-qz5rrr08.js} +2 -2
  5. package/dist/embedding-backfill-aetxv1vt.js +21 -0
  6. package/dist/embedding-worker.js +4 -4
  7. package/dist/features/magic-context/git-commits/search-git-commits.d.ts +2 -0
  8. package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -1
  9. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  10. package/dist/features/magic-context/pi-content-decisions.d.ts +1 -1
  11. package/dist/features/magic-context/pi-content-decisions.d.ts.map +1 -1
  12. package/dist/features/magic-context/search-rerank.d.ts +35 -0
  13. package/dist/features/magic-context/search-rerank.d.ts.map +1 -0
  14. package/dist/features/magic-context/search.d.ts +11 -0
  15. package/dist/features/magic-context/search.d.ts.map +1 -1
  16. package/dist/features/magic-context/storage-meta-persisted.d.ts +13 -2
  17. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  18. package/dist/features/magic-context/storage-meta-session.d.ts +1 -1
  19. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  20. package/dist/features/magic-context/storage-meta.d.ts +1 -1
  21. package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
  22. package/dist/features/magic-context/storage-session-tables.d.ts +2 -0
  23. package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
  24. package/dist/features/magic-context/storage-tag-identity-revision.d.ts +29 -9
  25. package/dist/features/magic-context/storage-tag-identity-revision.d.ts.map +1 -1
  26. package/dist/features/magic-context/storage-tags.d.ts +9 -0
  27. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  28. package/dist/features/magic-context/storage.d.ts +1 -1
  29. package/dist/features/magic-context/storage.d.ts.map +1 -1
  30. package/dist/features/magic-context/tagger.d.ts +2 -0
  31. package/dist/features/magic-context/tagger.d.ts.map +1 -1
  32. package/dist/features/magic-context/transform-decision-log.d.ts +3 -0
  33. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/auto-search-deadline.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/auto-search-replay.fixture.d.ts +24 -0
  36. package/dist/hooks/magic-context/auto-search-replay.fixture.d.ts.map +1 -0
  37. package/dist/hooks/magic-context/auto-search-runner.d.ts +1 -1
  38. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/auto-search-worker-client.d.ts +2 -0
  40. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/command-handler.d.ts +2 -0
  42. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/emergency-fail-closed.d.ts +28 -0
  44. package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/historian-host-runner.d.ts +8 -0
  47. package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/hook.d.ts +2 -1
  49. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  51. package/dist/hooks/magic-context/latest-thinking-recovery.d.ts +7 -0
  52. package/dist/hooks/magic-context/latest-thinking-recovery.d.ts.map +1 -1
  53. package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/pass-outcome.d.ts +1 -0
  55. package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -1
  56. package/dist/hooks/magic-context/read-session-chunk.d.ts +7 -1
  57. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  58. package/dist/hooks/magic-context/read-session-raw.d.ts +35 -0
  59. package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
  60. package/dist/hooks/magic-context/rust-mode-transform.d.ts +36 -0
  61. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  62. package/dist/hooks/magic-context/shared-compartment-boundaries.d.ts +8 -1
  63. package/dist/hooks/magic-context/shared-compartment-boundaries.d.ts.map +1 -1
  64. package/dist/hooks/magic-context/strict-thinking-prefix.d.ts +8 -0
  65. package/dist/hooks/magic-context/strict-thinking-prefix.d.ts.map +1 -0
  66. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  67. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +13 -0
  68. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  69. package/dist/hooks/magic-context/transform.d.ts +1 -0
  70. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  71. package/dist/{index-db7zwa3v.js → index-1bt88epp.js} +93 -9
  72. package/dist/{index-f0h6xwqm.js → index-1g30axtz.js} +229 -67
  73. package/dist/{index-k1xb52kd.js → index-1r0k9js3.js} +5 -5
  74. package/dist/{index-692jzy0p.js → index-2jcbj7r1.js} +122 -371
  75. package/dist/{index-bdckkfw6.js → index-2jgwttpt.js} +16 -8
  76. package/dist/{index-2y0s2hep.js → index-4mjhqadz.js} +1 -1
  77. package/dist/{index-pdecwzrd.js → index-57mrqed8.js} +1 -1
  78. package/dist/{index-ty64eqcn.js → index-9qjqq45k.js} +3 -3
  79. package/dist/{index-yq8n9qcb.js → index-9rt53q79.js} +4 -4
  80. package/dist/{index-pg50n748.js → index-b7mv1jx3.js} +4 -4
  81. package/dist/{index-mmyh6d8f.js → index-ezmszwbd.js} +6 -4
  82. package/dist/{index-fbv1dn35.js → index-gzcmtmar.js} +1 -1
  83. package/dist/{index-0an7742d.js → index-h2py7207.js} +549 -973
  84. package/dist/{index-0qhce371.js → index-h2wc01qk.js} +2 -2
  85. package/dist/{index-dhwzyd54.js → index-h5zfkjyk.js} +160 -25
  86. package/dist/{index-q2tqeqde.js → index-ha87j7a8.js} +1229 -78
  87. package/dist/{index-14cjxt20.js → index-hj2q50k0.js} +45 -8
  88. package/dist/{index-cb7emxgj.js → index-kmpvemph.js} +336 -6
  89. package/dist/{index-c43kr12f.js → index-kp5qe690.js} +7 -7
  90. package/dist/{index-bhvjj0ys.js → index-kq57tdf0.js} +2 -2
  91. package/dist/{index-7mx8v0pw.js → index-nm6a8xpd.js} +4 -4
  92. package/dist/{index-8j7gqj40.js → index-nsjyysj0.js} +6 -2
  93. package/dist/{index-k9nnwad5.js → index-nydv6g8r.js} +44 -7
  94. package/dist/{index-5zygecde.js → index-peshmj6h.js} +4 -4
  95. package/dist/{index-knh4y330.js → index-pxwp2hjk.js} +7 -2
  96. package/dist/{index-1qb0z7wa.js → index-qx53vezw.js} +1 -1
  97. package/dist/{index-q7h7csab.js → index-s4j7t92z.js} +9 -9
  98. package/dist/{index-z8e0psj8.js → index-stbr4ce6.js} +3 -3
  99. package/dist/{index-jcbd3znx.js → index-tqf7yg27.js} +1 -1
  100. package/dist/{index-72nhv486.js → index-vkbqdnkj.js} +2 -2
  101. package/dist/{index-eeezr5zz.js → index-z1tjp257.js} +1 -1
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +61 -44
  104. package/dist/{logger-d3wex3dz.js → logger-ewak5q1s.js} +1 -1
  105. package/dist/{message-index-bounded-7ezbgddp.js → message-index-bounded-h0mrd4pr.js} +13 -13
  106. package/dist/{message-time-backfill-brbd63hv.js → message-time-backfill-8x06r9kx.js} +2 -2
  107. package/dist/migration-worker.js +9 -9
  108. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
  109. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  110. package/dist/plugin/tool-registry.d.ts.map +1 -1
  111. package/dist/{project-embedding-registry-7qzptcw7.js → project-embedding-registry-rtt0djyb.js} +9 -9
  112. package/dist/raw-ordinal-warmup-worker.js +4 -4
  113. package/dist/{read-session-chunk-6k83m4fj.js → read-session-chunk-ty89v75e.js} +10 -8
  114. package/dist/{read-session-raw-3g9qy1xa.js → read-session-raw-8sjbc9h0.js} +5 -3
  115. package/dist/{recomp-orchestrator-d3fp1cy0.js → recomp-orchestrator-4f1yyd1q.js} +25 -25
  116. package/dist/{safe-notification-target-5ffqq32m.js → safe-notification-target-q0cyrx3x.js} +2 -2
  117. package/dist/{search-epax1ecv.js → search-pz4f4wge.js} +20 -20
  118. package/dist/{send-session-notification-erecz4y4.js → send-session-notification-38cd5dqt.js} +5 -5
  119. package/dist/shared/auto-search-lifecycle.d.ts +14 -0
  120. package/dist/shared/auto-search-lifecycle.d.ts.map +1 -1
  121. package/dist/shared/logger.d.ts.map +1 -1
  122. package/dist/shared/models-dev-temperature.d.ts +18 -0
  123. package/dist/shared/models-dev-temperature.d.ts.map +1 -0
  124. package/dist/shared/project-directory-key.d.ts +16 -0
  125. package/dist/shared/project-directory-key.d.ts.map +1 -1
  126. package/dist/shared/subagent-temperature.d.ts +46 -0
  127. package/dist/shared/subagent-temperature.d.ts.map +1 -0
  128. package/dist/{storage-tags-d3b0v2ss.js → storage-tags-k0pda32s.js} +6 -4
  129. package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
  130. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  131. package/dist/tools/ctx-search/types.d.ts +1 -0
  132. package/dist/tools/ctx-search/types.d.ts.map +1 -1
  133. package/dist/{transform-postprocess-phase-spcy2qre.js → transform-postprocess-phase-tck4g20s.js} +25 -25
  134. package/dist/v2/auto-search-worker.js +3 -3
  135. package/dist/v2/{context-sf98kstd.js → context-crbt6p1y.js} +809 -1052
  136. package/dist/v2/{derive-budgets-3vc0y84t.js → derive-budgets-fgej9j46.js} +3 -3
  137. package/dist/v2/embedding-backfill-ph1qfyn3.js +21 -0
  138. package/dist/v2/embedding-worker.js +4 -4
  139. package/dist/v2/hidden-child-native.d.ts.map +1 -1
  140. package/dist/v2/hidden-completion.d.ts +7 -0
  141. package/dist/v2/hidden-completion.d.ts.map +1 -1
  142. package/dist/v2/hooks/context.d.ts.map +1 -1
  143. package/dist/v2/hooks/dream-trigger.d.ts +4 -1
  144. package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
  145. package/dist/v2/hooks/generate.d.ts +9 -2
  146. package/dist/v2/hooks/generate.d.ts.map +1 -1
  147. package/dist/v2/{logger-mxd0ym09.js → logger-pj02s7sr.js} +1 -1
  148. package/dist/v2/{message-index-bounded-dy3s2k1e.js → message-index-bounded-xwqdywxg.js} +13 -13
  149. package/dist/v2/{message-time-backfill-gtx1pwk1.js → message-time-backfill-cje68egj.js} +2 -2
  150. package/dist/v2/migration-worker.js +9 -9
  151. package/dist/v2/{project-embedding-registry-1tgba5dv.js → project-embedding-registry-d6m7tyxr.js} +9 -9
  152. package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
  153. package/dist/v2/{read-session-chunk-rh4khdkv.js → read-session-chunk-8p5mdryx.js} +10 -8
  154. package/dist/v2/{read-session-raw-bsbmf0vj.js → read-session-raw-j8dvp7f4.js} +5 -3
  155. package/dist/v2/{recomp-orchestrator-az61rfcg.js → recomp-orchestrator-ckfgt6wq.js} +26 -26
  156. package/dist/v2/{safe-notification-target-73ax1p5v.js → safe-notification-target-y3p1hce9.js} +2 -2
  157. package/dist/v2/{search-nzkwrc6n.js → search-ym8rehhz.js} +20 -20
  158. package/dist/v2/{send-session-notification-6km439kn.js → send-session-notification-5m0yapqx.js} +5 -5
  159. package/dist/v2/{server-x2g40a71.js → server-19zjmn02.js} +2 -2
  160. package/dist/v2/{server-sggvvzhb.js → server-1tk82krw.js} +45 -8
  161. package/dist/v2/{server-vqpf3167.js → server-2s6ayq3t.js} +2 -2
  162. package/dist/v2/{server-z2037m6z.js → server-2s9qz6n7.js} +2 -2
  163. package/dist/v2/{server-k228xhjg.js → server-3j4d00kf.js} +1 -1
  164. package/dist/v2/{server-aan4q8mx.js → server-3t0q2cqx.js} +1 -1
  165. package/dist/v2/{server-2fbhp79z.js → server-4ez8mntn.js} +16 -8
  166. package/dist/v2/{server-zxhgvsf9.js → server-676xw7at.js} +1 -1
  167. package/dist/v2/{server-52awr2mw.js → server-6byqfbqf.js} +93 -9
  168. package/dist/v2/{server-qye6ykf7.js → server-7ekna9zs.js} +2 -2
  169. package/dist/v2/{server-g5r0n3b6.js → server-7h861yms.js} +160 -25
  170. package/dist/v2/{server-v06jcv0w.js → server-8k2agx29.js} +1 -1
  171. package/dist/v2/{server-686jg6eb.js → server-c5rrgrcd.js} +44 -7
  172. package/dist/v2/{server-4k748ke6.js → server-hb6xhh9q.js} +2 -2
  173. package/dist/v2/{server-7wwc2nga.js → server-jvxzm1jy.js} +7 -7
  174. package/dist/v2/{server-1r6pmz4f.js → server-kzns2hbz.js} +1 -1
  175. package/dist/v2/{server-xdfwt6kh.js → server-pj4pjv02.js} +2 -2
  176. package/dist/v2/{server-psqc7e9n.js → server-q4ph9bwn.js} +1227 -78
  177. package/dist/v2/{server-8pyt7hev.js → server-sa8jvrfc.js} +9 -9
  178. package/dist/v2/{server-ezhze64f.js → server-ss95ky04.js} +4 -4
  179. package/dist/v2/{server-5m3dt5r1.js → server-t4k4qexw.js} +6 -2
  180. package/dist/v2/{server-e0vdaae2.js → server-v4mewb78.js} +4 -4
  181. package/dist/v2/{server-gjcr4w98.js → server-w32kmdez.js} +4 -4
  182. package/dist/v2/{server-k8x2rbxc.js → server-x4hscabv.js} +119 -365
  183. package/dist/v2/{server-yczc713m.js → server-xwz4dqh9.js} +7 -2
  184. package/dist/v2/{server-xxm59eww.js → server-ycw9qqcy.js} +4 -4
  185. package/dist/v2/{server-8tqanswc.js → server-zp53y8js.js} +331 -4
  186. package/dist/v2/server.js +4 -4
  187. package/dist/v2/{storage-tags-w4tv77sn.js → storage-tags-8vw924zn.js} +6 -4
  188. package/dist/v2/store-reader.d.ts +8 -2
  189. package/dist/v2/store-reader.d.ts.map +1 -1
  190. package/dist/v2/{wrapup-orchestrator-mz7efs7w.js → wrapup-orchestrator-a7efxaax.js} +26 -26
  191. package/dist/wrapup-orchestrator-barbc6h9.js +44 -0
  192. package/package.json +1 -1
  193. package/src/shared/auto-search-lifecycle.ts +43 -0
  194. package/src/shared/logger.test.ts +38 -0
  195. package/src/shared/logger.ts +10 -2
  196. package/src/shared/models-dev-temperature.ts +107 -0
  197. package/src/shared/project-directory-key.test.ts +59 -0
  198. package/src/shared/project-directory-key.ts +20 -0
  199. package/src/shared/subagent-temperature.test.ts +270 -0
  200. package/src/shared/subagent-temperature.ts +110 -0
  201. package/dist/embedding-backfill-9rcm1mfy.js +0 -21
  202. package/dist/v2/embedding-backfill-vn8g1nh1.js +0 -21
  203. package/dist/wrapup-orchestrator-amzta1t4.js +0 -44
@@ -9,7 +9,7 @@ import {
9
9
  sanitizeDiagnosticText,
10
10
  log2,
11
11
  sessionLog2
12
- } from "./server-5m3dt5r1.js";
12
+ } from "./server-t4k4qexw.js";
13
13
  import {
14
14
  parseJsoncRecovering,
15
15
  detectConfigFile,
@@ -17,13 +17,13 @@ import {
17
17
  cortexKitProjectConfigBasePath,
18
18
  resolveLegacyConfigSourcesForHarness,
19
19
  loadPluginConfigDetailed
20
- } from "./server-x2g40a71.js";
20
+ } from "./server-19zjmn02.js";
21
21
  import {
22
22
  catalogOutputReserve,
23
23
  getSdkContextLimit,
24
24
  modelSupportsVision,
25
25
  getSdkOutputLimit
26
- } from "./server-v06jcv0w.js";
26
+ } from "./server-8k2agx29.js";
27
27
  import {
28
28
  withContentLanguageDirective,
29
29
  buildPrimaryLanguageDirective,
@@ -36,7 +36,7 @@ import {
36
36
  hasMeaningfulUserText2,
37
37
  estimateTokens,
38
38
  estimateFixedPromptTokens
39
- } from "./server-1r6pmz4f.js";
39
+ } from "./server-kzns2hbz.js";
40
40
  import {
41
41
  Database2,
42
42
  prepareCachedStatement2,
@@ -53,7 +53,7 @@ import {
53
53
  replaceCompartmentChunkEmbeddings,
54
54
  deleteChunkEmbedBackoffForSession,
55
55
  chunkWindowSourceKey
56
- } from "./server-ezhze64f.js";
56
+ } from "./server-ss95ky04.js";
57
57
  import {
58
58
  FAIL_CLOSED_DOCTOR_COMMAND,
59
59
  isPidAlive,
@@ -61,7 +61,7 @@ import {
61
61
  LATEST_SUPPORTED_VERSION,
62
62
  getPersistedSchemaVersion,
63
63
  openDatabase
64
- } from "./server-8pyt7hev.js";
64
+ } from "./server-sa8jvrfc.js";
65
65
  import {
66
66
  clearCompressionDepth,
67
67
  clearCompressionDepthRange,
@@ -69,11 +69,11 @@ import {
69
69
  toMessageIndexSource,
70
70
  clearIndexedMessagesInTransaction,
71
71
  indexSourcesAfterOrdinal
72
- } from "./server-sggvvzhb.js";
72
+ } from "./server-1tk82krw.js";
73
73
  import {
74
74
  getTableColumnNames,
75
75
  stableStringify
76
- } from "./server-52awr2mw.js";
76
+ } from "./server-6byqfbqf.js";
77
77
  import {
78
78
  resolveDecisionCalibration,
79
79
  providerMass,
@@ -93,11 +93,11 @@ import {
93
93
  getTagNumberByMessageId2,
94
94
  TAG_SELECT_COLUMNS2,
95
95
  getActiveTagsBySession2
96
- } from "./server-686jg6eb.js";
96
+ } from "./server-c5rrgrcd.js";
97
97
  import {
98
98
  isStrictGapHealingMessage2,
99
99
  noteRawSessionSummaryRowWritten2
100
- } from "./server-g5r0n3b6.js";
100
+ } from "./server-7h861yms.js";
101
101
  import {
102
102
  resolveOpenCodeDbPath,
103
103
  assertOpenCodeStoreGeneration,
@@ -107,7 +107,7 @@ import {
107
107
  import {
108
108
  withReadOnlySessionDb,
109
109
  getMessageTimesFromOpenCodeDb
110
- } from "./server-xdfwt6kh.js";
110
+ } from "./server-pj4pjv02.js";
111
111
  import {
112
112
  detectOverflow,
113
113
  retreatPastHostUnservedRows,
@@ -140,10 +140,10 @@ import {
140
140
  getRawSessionTagKeysThrough2,
141
141
  getLegacyProtectedTailStartOrdinal2,
142
142
  readSessionChunk2
143
- } from "./server-2fbhp79z.js";
143
+ } from "./server-4ez8mntn.js";
144
144
  import {
145
145
  getMeasuredToolDefinitionTokens
146
- } from "./server-qye6ykf7.js";
146
+ } from "./server-7ekna9zs.js";
147
147
  import {
148
148
  V2_MEMORY_CATEGORIES,
149
149
  CATEGORY_PRIORITY,
@@ -157,25 +157,28 @@ import {
157
157
  resolveStoredPathWorkspaceIdentity,
158
158
  sourceNameForMemory,
159
159
  computeWorkspaceEpochFingerprint
160
- } from "./server-e0vdaae2.js";
160
+ } from "./server-v4mewb78.js";
161
161
  import {
162
+ sameProjectDirectory,
162
163
  shouldSkipHomeProjectMemory,
163
164
  resolveProjectIdentity
164
- } from "./server-yczc713m.js";
165
+ } from "./server-xwz4dqh9.js";
165
166
  import {
166
167
  contentSha2562,
167
168
  enqueueShadowEmbeddingItems2,
168
169
  getProjectChunkEmbeddingModelId2,
169
170
  getProjectEmbeddingMaxInputTokens2,
170
171
  embedItemsForProject2
171
- } from "./server-7wwc2nga.js";
172
+ } from "./server-jvxzm1jy.js";
172
173
  import {
173
174
  getSessionNotes,
174
175
  getReadySmartNotes,
175
176
  insertPrimerCandidates,
177
+ renderUserFacingFailure,
178
+ userFacingFailureCode,
176
179
  promoteSessionFactsDurable,
177
180
  embedPromotedFacts
178
- } from "./server-8tqanswc.js";
181
+ } from "./server-zp53y8js.js";
179
182
  import {
180
183
  computeCueContentHash,
181
184
  getMuralCueState,
@@ -191,10 +194,10 @@ import {
191
194
  deriveTriggerBudget2,
192
195
  resolveHistorianProducerLimits2,
193
196
  producerSourceLocalBudget2
194
- } from "./server-z2037m6z.js";
197
+ } from "./server-2s9qz6n7.js";
195
198
  import {
196
199
  sendStatusNotification2
197
- } from "./server-xxm59eww.js";
200
+ } from "./server-ycw9qqcy.js";
198
201
  import {
199
202
  getErrorMessage,
200
203
  describeError
@@ -208,7 +211,7 @@ import {
208
211
  import {
209
212
  logSlowWriteTransaction,
210
213
  WriteTransactionSteps
211
- } from "./server-aan4q8mx.js";
214
+ } from "./server-3t0q2cqx.js";
212
215
 
213
216
  // src/shared/bounded-session-map.ts
214
217
  class BoundedSessionMap {
@@ -2965,14 +2968,50 @@ function pruneNoteNudgeAnchors(db, sessionId, visibleMessageIds) {
2965
2968
  });
2966
2969
  return pruned;
2967
2970
  }
2968
- function pruneAutoSearchHintDecisions(db, sessionId, visibleMessageIds) {
2971
+ var pendingAutoSearchRetirements = new WeakMap;
2972
+ var AUTO_SEARCH_DECISION_SOFT_LIMIT = 2000;
2973
+ function queueAutoSearchHintDecisionRetirement(db, sessionId, messageIds) {
2974
+ if (messageIds.size === 0)
2975
+ return;
2976
+ let sessions = pendingAutoSearchRetirements.get(db);
2977
+ if (!sessions) {
2978
+ sessions = new Map;
2979
+ pendingAutoSearchRetirements.set(db, sessions);
2980
+ }
2981
+ let retired = sessions.get(sessionId);
2982
+ if (!retired) {
2983
+ retired = new Set;
2984
+ sessions.set(sessionId, retired);
2985
+ }
2986
+ for (const id of messageIds)
2987
+ retired.add(id);
2988
+ }
2989
+ function flushAutoSearchHintDecisionRetirement(db, sessionId, visibleMessageIds) {
2990
+ const sessions = pendingAutoSearchRetirements.get(db);
2991
+ const retired = sessions?.get(sessionId) ?? new Set;
2992
+ const outcome = updateAutoSearchHintRetirement(db, sessionId, retired, visibleMessageIds);
2993
+ if (outcome.ok)
2994
+ sessions?.delete(sessionId);
2995
+ return outcome.pruned;
2996
+ }
2997
+ function updateAutoSearchHintRetirement(db, sessionId, retiredMessageIds, visibleMessageIds) {
2969
2998
  let pruned = 0;
2970
- casUpdateJsonArrayColumn(db, sessionId, "auto_search_hint_decisions", isValidAutoSearchHintDecision, (current) => {
2971
- const next = current.filter((decision) => visibleMessageIds.has(decision.messageId));
2999
+ const ok = casUpdateJsonArrayColumn(db, sessionId, "auto_search_hint_decisions", isValidAutoSearchHintDecision, (current) => {
3000
+ let next = current.filter((decision) => !retiredMessageIds.has(decision.messageId) || visibleMessageIds?.has(decision.messageId));
3001
+ let excess = next.length - AUTO_SEARCH_DECISION_SOFT_LIMIT;
3002
+ if (visibleMessageIds && excess > 0) {
3003
+ next = next.filter((decision) => {
3004
+ if (excess > 0 && decision.decision === "no-hint" && !visibleMessageIds.has(decision.messageId)) {
3005
+ excess--;
3006
+ return false;
3007
+ }
3008
+ return true;
3009
+ });
3010
+ }
2972
3011
  pruned = current.length - next.length;
2973
3012
  return pruned > 0 ? next : null;
2974
- });
2975
- return pruned;
3013
+ }, { ensureRow: false });
3014
+ return { ok, pruned: ok ? pruned : 0 };
2976
3015
  }
2977
3016
  function getPersistedTodoPermissionDenied(db, sessionId) {
2978
3017
  const row = db.prepare("SELECT todo_permission_denied FROM session_meta WHERE session_id = ?").get(sessionId);
@@ -3755,8 +3794,8 @@ function clearCapturedLkgMeasurement(sessionId) {
3755
3794
  }
3756
3795
 
3757
3796
  // src/hooks/magic-context/lkg-slot.ts
3758
- var LKG_TOTAL_BYTES = 64 * 1024 * 1024;
3759
- var LKG_SINGLE_SLOT_BYTES = 24 * 1024 * 1024;
3797
+ var LKG_SINGLE_SLOT_BYTES = 72 * 1024 * 1024;
3798
+ var LKG_TOTAL_BYTES = 160 * 1024 * 1024;
3760
3799
  var LKG_METADATA_BYTES = 256;
3761
3800
 
3762
3801
  class MagicContextLkgHeapHolder {
@@ -4596,7 +4635,7 @@ function decodePiContentDecision(value) {
4596
4635
  return null;
4597
4636
  try {
4598
4637
  const pair = JSON.parse(value.slice(PREFIX.length));
4599
- if (Array.isArray(pair) && pair.length === 2 && (pair[0] === "reminder-strip" || pair[0] === "seam-temporal-strip" || pair[0] === "tag-identity-repair-once" || pair[0] === "tag-identity-repair-pending" || pair[0] === "tag-identity-recurring") && typeof pair[1] === "string" && pair[1].length > 0)
4638
+ if (Array.isArray(pair) && pair.length === 2 && (pair[0] === "reminder-strip" || pair[0] === "seam-temporal-strip" || pair[0] === "tag-identity-repair-once" || pair[0] === "tag-identity-repair-pending" || pair[0] === "tag-identity-rebuild-failed" || pair[0] === "tag-identity-recurring") && typeof pair[1] === "string" && pair[1].length > 0)
4600
4639
  return [pair[0], pair[1]];
4601
4640
  } catch {}
4602
4641
  return null;
@@ -5270,6 +5309,31 @@ import { Buffer as Buffer3 } from "node:buffer";
5270
5309
 
5271
5310
  // src/shared/auto-search-lifecycle.ts
5272
5311
  var pending = new Map;
5312
+ var unpublishedNoHints = new Map;
5313
+ function rememberUnpublishedAutoSearchNoHint(sessionId, messageId, reason) {
5314
+ let messages = unpublishedNoHints.get(sessionId);
5315
+ if (!messages) {
5316
+ messages = new Map;
5317
+ unpublishedNoHints.set(sessionId, messages);
5318
+ }
5319
+ if (!messages.has(messageId))
5320
+ messages.set(messageId, reason);
5321
+ }
5322
+ function getUnpublishedAutoSearchNoHint(sessionId, messageId) {
5323
+ return unpublishedNoHints.get(sessionId)?.get(messageId);
5324
+ }
5325
+ function forgetUnpublishedAutoSearchNoHint(sessionId, messageId) {
5326
+ const messages = unpublishedNoHints.get(sessionId);
5327
+ messages?.delete(messageId);
5328
+ if (messages?.size === 0)
5329
+ unpublishedNoHints.delete(sessionId);
5330
+ }
5331
+ function clearUnpublishedAutoSearchNoHints(sessionId) {
5332
+ if (sessionId === undefined)
5333
+ unpublishedNoHints.clear();
5334
+ else
5335
+ unpublishedNoHints.delete(sessionId);
5336
+ }
5273
5337
  function registerAutoSearchWork(sessionId) {
5274
5338
  const controller = new AbortController;
5275
5339
  const work = pending.get(sessionId) ?? new Set;
@@ -5609,11 +5673,19 @@ class V2StoreReader {
5609
5673
  const columns = new Set(this.prepare("PRAGMA table_info(session_v2)").all().map((column) => column.name));
5610
5674
  const archived = columns.has("time_archived") ? " AND time_archived IS NULL" : "";
5611
5675
  const order = columns.has("time_updated") ? "time_updated DESC, id DESC" : "id DESC";
5612
- const row = this.prepare(`SELECT id FROM session_v2
5613
- WHERE directory = ? AND parent_id IS NULL${archived}
5676
+ const page = this.prepare(`SELECT id, COALESCE(directory, '') AS directory FROM session_v2
5677
+ WHERE parent_id IS NULL${archived}
5614
5678
  AND COALESCE(json_extract(metadata, '$.magic_context'), '') <> 'hidden-run'
5615
- ORDER BY ${order} LIMIT 1`).get(directory);
5616
- return row?.id;
5679
+ ORDER BY ${order} LIMIT ? OFFSET ?`);
5680
+ const pageSize = 500;
5681
+ for (let offset = 0;; offset += pageSize) {
5682
+ const rows = page.all(pageSize, offset);
5683
+ const match = rows.find((row) => sameProjectDirectory(row.directory, directory));
5684
+ if (match)
5685
+ return match.id;
5686
+ if (rows.length < pageSize)
5687
+ return;
5688
+ }
5617
5689
  }
5618
5690
  rootSessionActivity(sessionIDs) {
5619
5691
  const roots = new Map;
@@ -6047,7 +6119,7 @@ function retryPendingSessionCleanups(db, limit = 200) {
6047
6119
  try {
6048
6120
  withoutSqliteTransformPass2(() => withSqliteBackgroundWriter2(() => {
6049
6121
  db.prepare("UPDATE pending_session_cleanup SET last_attempt_at = ? WHERE session_id = ?").run(Date.now(), row.session_id);
6050
- clearSession(db, row.session_id);
6122
+ clearSession(db, row.session_id, false, true);
6051
6123
  }));
6052
6124
  cleared += 1;
6053
6125
  } catch {
@@ -6073,7 +6145,7 @@ async function retryPendingRustSessionCleanupsForProject(db, projectPath, delete
6073
6145
  try {
6074
6146
  withoutSqliteTransformPass2(() => withSqliteBackgroundWriter2(() => db.prepare("UPDATE pending_session_cleanup SET last_attempt_at = ? WHERE session_id = ?").run(Date.now(), row.session_id)));
6075
6147
  await deleteSession(row.session_id);
6076
- clearSession(db, row.session_id, true);
6148
+ clearSession(db, row.session_id, true, true);
6077
6149
  cleared += 1;
6078
6150
  } catch {
6079
6151
  failedSessionIds.push(row.session_id);
@@ -6081,15 +6153,17 @@ async function retryPendingRustSessionCleanupsForProject(db, projectPath, delete
6081
6153
  }
6082
6154
  return { attempted: rows.length, cleared, failedSessionIds };
6083
6155
  }
6084
- function clearSession(db, sessionId, rustModuleCleanupAcknowledged = false) {
6156
+ function clearSession(db, sessionId, rustModuleCleanupAcknowledged = false, permanentlyDeleted = false) {
6085
6157
  cancelAutoSearchWork(sessionId);
6086
6158
  let transactionStartedAt = 0;
6087
6159
  withoutSqliteTransformPass2(() => withSqliteBackgroundWriter2(() => db.transaction(() => {
6088
6160
  transactionStartedAt = performance.now();
6089
6161
  deleteSessionScopedRows(db, [sessionId], undefined, {
6090
- rustModuleCleanupAcknowledged
6162
+ rustModuleCleanupAcknowledged,
6163
+ preserveTagRevisionTombstones: !permanentlyDeleted
6091
6164
  });
6092
6165
  }).immediate()));
6166
+ clearUnpublishedAutoSearchNoHints(sessionId);
6093
6167
  logSlowWriteTransaction("clear-session", transactionStartedAt);
6094
6168
  }
6095
6169
  // src/features/magic-context/storage-project-state.ts
@@ -6882,332 +6956,6 @@ class HiddenCompletionRefusal extends Error {
6882
6956
  }
6883
6957
  }
6884
6958
 
6885
- // src/shared/user-facing-codes.ts
6886
- var USER_FACING_FAILURES = {
6887
- historian_unavailable: {
6888
- code: "MC-H01",
6889
- sentence: "History compression could not finish this turn.",
6890
- action: "It will retry automatically."
6891
- },
6892
- historian_saved_history_misaligned: {
6893
- code: "MC-H03",
6894
- sentence: "History compression is paused because this session's saved summaries no longer line up with its messages.",
6895
- action: "Run /ctx-recomp to rebuild them."
6896
- },
6897
- history_boundary_unresolved: {
6898
- code: "MC-H04",
6899
- sentence: "This request was not sent: the message that marks where this session's history summary ends is missing from the OpenCode store, and without it the request is larger than the model's context window.",
6900
- action: "Run /ctx-recomp to rebuild the history summary."
6901
- },
6902
- history_over_window_unmanaged: {
6903
- code: "MC-H06",
6904
- sentence: "This request was not sent: this session's history is larger than the model's context window, and Magic Context does not have a summary of it yet to send in its place.",
6905
- action: "Send your message again once history compression has caught up, or switch to a model with a larger context window."
6906
- },
6907
- frozen_history_over_window: {
6908
- code: "MC-H07",
6909
- sentence: "This request was not sent: the conversation is larger than the context window the provider reported, and the compressed history Magic Context has ready does not fit either.",
6910
- action: "Run /ctx-flush to compress it now, then send your message again."
6911
- },
6912
- historian_window_too_small: {
6913
- code: "MC-H05",
6914
- sentence: "History compression is paused because the history model's context window is too small for its instructions.",
6915
- action: "Set historian.model in magic-context.jsonc to a model with a larger context window."
6916
- },
6917
- recomp_unavailable: {
6918
- code: "MC-R01",
6919
- sentence: "History compression could not be rebuilt.",
6920
- action: "Run /ctx-recomp again."
6921
- },
6922
- dream_provider_timeout: {
6923
- code: "MC-D01",
6924
- sentence: "Memory maintenance took too long to respond.",
6925
- action: "Run /ctx-dream again."
6926
- },
6927
- dream_provider_error: {
6928
- code: "MC-D02",
6929
- sentence: "Memory maintenance could not reach its model.",
6930
- action: "Check the model connection, then run /ctx-dream again."
6931
- },
6932
- dream_local_refusal: {
6933
- code: "MC-D12",
6934
- sentence: "Memory maintenance was refused before reaching the model.",
6935
- action: "Check the hidden-request diagnostic in the Magic Context log before retrying."
6936
- },
6937
- dream_step_limit: {
6938
- code: "MC-D10",
6939
- sentence: "Memory maintenance stopped at its hidden agent step limit.",
6940
- action: "This task needs less work per run; changing the model connection will not help."
6941
- },
6942
- dream_token_budget: {
6943
- code: "MC-D11",
6944
- sentence: "Memory maintenance reached its prompt-token budget.",
6945
- action: "The unfinished items will be retried on the next run."
6946
- },
6947
- dream_empty_completion: {
6948
- code: "MC-D03",
6949
- sentence: "Memory maintenance received no usable response.",
6950
- action: "Run /ctx-dream again."
6951
- },
6952
- dream_no_models: {
6953
- code: "MC-D04",
6954
- sentence: "Memory maintenance has no model available.",
6955
- action: "Check the model settings, then run /ctx-dream again."
6956
- },
6957
- dream_child_aborted: {
6958
- code: "MC-D05",
6959
- sentence: "Memory maintenance was interrupted.",
6960
- action: "Run /ctx-dream again."
6961
- },
6962
- dream_parse_failed: {
6963
- code: "MC-D06",
6964
- sentence: "Memory maintenance could not use the model response.",
6965
- action: "Run /ctx-dream again."
6966
- },
6967
- dream_unknown: {
6968
- code: "MC-D07",
6969
- sentence: "Memory maintenance could not finish.",
6970
- action: "Run /ctx-dream again."
6971
- },
6972
- dreamer_tick_blocked: {
6973
- code: "MC-D09",
6974
- sentence: "Background maintenance is not running: its last pass stopped before it reached the scheduled tasks.",
6975
- action: "It is retried automatically; if it keeps happening, check the Magic Context log for the stage that stopped and run `npx @cortexkit/magic-context doctor`."
6976
- },
6977
- dream_task_needs_tool_loop: {
6978
- code: "MC-D08",
6979
- sentence: "Some memory maintenance tasks need a tool loop this host does not provide.",
6980
- action: "The remaining tasks still run; the listed ones are skipped on this host."
6981
- },
6982
- embedding_substitution_rejected: {
6983
- code: "MC-E01",
6984
- sentence: "Search indexing could not use the selected model.",
6985
- action: "Check the embedding model setting, then run /ctx-embed start again."
6986
- },
6987
- embedding_http_error: {
6988
- code: "MC-E02",
6989
- sentence: "The search indexing provider refused the request.",
6990
- action: "Check the provider connection and credentials, then run /ctx-embed start again."
6991
- },
6992
- embedding_transport_error: {
6993
- code: "MC-E03",
6994
- sentence: "Search indexing could not reach its provider.",
6995
- action: "Check the connection, then run /ctx-embed start again."
6996
- },
6997
- embedding_invalid_envelope: {
6998
- code: "MC-E04",
6999
- sentence: "Search indexing received an unsupported response.",
7000
- action: "Check the embedding endpoint, then run /ctx-embed start again."
7001
- },
7002
- embedding_empty_result: {
7003
- code: "MC-E05",
7004
- sentence: "Search indexing received no usable result.",
7005
- action: "Run /ctx-embed start again."
7006
- },
7007
- embedding_certification_refusal: {
7008
- code: "MC-E06",
7009
- sentence: "Search indexing is not ready for this provider.",
7010
- action: "Finish the provider setup, or set a fallback provider in the embedding settings, then run /ctx-embed start again."
7011
- },
7012
- embedding_credential_required: {
7013
- code: "MC-E07",
7014
- sentence: "Search indexing needs provider credentials.",
7015
- action: "Sign in to the provider, then run /ctx-embed start again."
7016
- },
7017
- embedding_local_binding_missing: {
7018
- code: "MC-E08",
7019
- sentence: "Local search indexing is unavailable on this system.",
7020
- action: "Run `npx @cortexkit/magic-context doctor`, then retry."
7021
- },
7022
- embedding_local_fs_unavailable: {
7023
- code: "MC-E09",
7024
- sentence: "Local search indexing cannot save its model files.",
7025
- action: "Update or reinstall Magic Context, then retry."
7026
- },
7027
- embedding_local_download_failure: {
7028
- code: "MC-E10",
7029
- sentence: "Local search indexing could not download its model.",
7030
- action: "Check the network connection, then retry."
7031
- },
7032
- embedding_local_runtime_error: {
7033
- code: "MC-E11",
7034
- sentence: "Local search indexing could not start.",
7035
- action: "Run `npx @cortexkit/magic-context doctor`, then retry."
7036
- },
7037
- embedding_unavailable: {
7038
- code: "MC-E12",
7039
- sentence: "Search indexing could not finish.",
7040
- action: "Run /ctx-embed start again."
7041
- },
7042
- status_unavailable: {
7043
- code: "MC-S01",
7044
- sentence: "Magic Context status is temporarily unavailable.",
7045
- action: "Retry /ctx-status in a moment."
7046
- },
7047
- transform_update_failed: {
7048
- code: "MC-S02",
7049
- sentence: "The last context update did not finish.",
7050
- action: "Send another message to retry."
7051
- },
7052
- transform_pass_degraded: {
7053
- code: "MC-S06",
7054
- sentence: "This request was not sent: Magic Context could not finish preparing it, and without that preparation it could be far larger than the previous request.",
7055
- action: "Send your message again."
7056
- },
7057
- configuration_warning: {
7058
- code: "MC-S03",
7059
- sentence: "Some configuration settings could not be applied.",
7060
- action: "Fix the configuration warning shown in /ctx-status, then restart."
7061
- },
7062
- status_log_unavailable: {
7063
- code: "MC-S04",
7064
- sentence: "Some diagnostic details could not be saved.",
7065
- action: "Retry /ctx-status in a moment."
7066
- },
7067
- memory_writes_paused: {
7068
- code: "MC-C01",
7069
- sentence: "Memory writes are paused while the engine syncs.",
7070
- action: "Retry in a moment."
7071
- },
7072
- memory_access_unavailable: {
7073
- code: "MC-C02",
7074
- sentence: "Memory access is temporarily unavailable.",
7075
- action: "Retry in a moment."
7076
- },
7077
- note_changes_paused: {
7078
- code: "MC-C03",
7079
- sentence: "Note changes are paused while the engine syncs.",
7080
- action: "Retry in a moment."
7081
- },
7082
- note_access_unavailable: {
7083
- code: "MC-C04",
7084
- sentence: "Notes are temporarily unavailable.",
7085
- action: "Retry in a moment."
7086
- },
7087
- context_cleanup_paused: {
7088
- code: "MC-C05",
7089
- sentence: "Context cleanup is paused while the engine syncs.",
7090
- action: "Retry in a moment."
7091
- },
7092
- partial_history_unavailable: {
7093
- code: "MC-C06",
7094
- sentence: "Partial history compression is not available in the current mode.",
7095
- action: "Run /ctx-recomp without a range."
7096
- },
7097
- smart_note_conditions_unavailable: {
7098
- code: "MC-C08",
7099
- sentence: "Conditional notes are not available in the current mode.",
7100
- action: "Save a regular note without a condition."
7101
- },
7102
- history_compression_paused: {
7103
- code: "MC-C09",
7104
- sentence: "History compression is paused while the engine syncs.",
7105
- action: "Retry in a moment."
7106
- },
7107
- history_compression_needs_message: {
7108
- code: "MC-C12",
7109
- sentence: "History compression has not seen this session since Magic Context reconnected.",
7110
- action: "Send a message in this session first, then run /ctx-wrapup again."
7111
- },
7112
- context_service_unavailable: {
7113
- code: "MC-C10",
7114
- sentence: "Magic Context is temporarily unavailable.",
7115
- action: "Retry in a moment."
7116
- },
7117
- context_db_missing: {
7118
- code: "MC-C15",
7119
- sentence: "Magic Context has no context.db.",
7120
- action: "Run `npx @cortexkit/magic-context doctor store init`, then restart ck-mc."
7121
- },
7122
- single_store_migration_required: {
7123
- code: "MC-C14",
7124
- sentence: "Magic Context's Rust mode needs a one-time migration of its store.",
7125
- action: "Quit OpenCode and every ck-mc process, then run `magic-context doctor single-store migrate`."
7126
- },
7127
- store_ahead_of_binary: {
7128
- code: "MC-C13",
7129
- sentence: "Magic Context refused to start: its store (store.db) was migrated by a newer ck-mc build than the one running.",
7130
- action: "Update ck-mc, or roll back by restoring ck-mc together with context.db and store.db from the same backup."
7131
- },
7132
- compaction_marker_missing: {
7133
- code: "MC-C11",
7134
- sentence: "The history boundary marker is missing from the OpenCode store, so requests carry the full session.",
7135
- action: "It is retried on every message; if this persists, run `/ctx-flush`."
7136
- },
7137
- memory_mirror_stalled: {
7138
- code: "MC-M01",
7139
- sentence: "Memory synchronization stopped before the host mirror caught up.",
7140
- action: "Send another message to resume it, or run `ck doctor drain-authority`."
7141
- },
7142
- memory_authority_mismatch: {
7143
- code: "MC-M02",
7144
- sentence: "Memory authority is inconsistent between the host and module.",
7145
- action: "Run `ck doctor drain-authority` before changing Rust mode."
7146
- },
7147
- dreamer_task_failing: {
7148
- code: "MC-S05",
7149
- sentence: "A background maintenance task keeps failing on its schedule.",
7150
- action: "Check the Magic Context log for the failing task and its error."
7151
- }
7152
- };
7153
- function renderUserFacingFailure(key, style = "markdown") {
7154
- const failure = USER_FACING_FAILURES[key];
7155
- const action = style === "plain" ? failure.action.replaceAll("`", "") : failure.action;
7156
- return `${failure.sentence} ${action} (${failure.code})`;
7157
- }
7158
- function userFacingFailureCode(key) {
7159
- return USER_FACING_FAILURES[key].code;
7160
- }
7161
- var CAPABILITY_FAILURES = {
7162
- memory_write: "memory_writes_paused",
7163
- memory_access: "memory_access_unavailable",
7164
- note_change: "note_changes_paused",
7165
- note_access: "note_access_unavailable",
7166
- context_cleanup: "context_cleanup_paused",
7167
- partial_history: "partial_history_unavailable",
7168
- smart_note_condition: "smart_note_conditions_unavailable",
7169
- history_compression: "history_compression_paused",
7170
- context_service: "context_service_unavailable"
7171
- };
7172
- function renderCapabilityRefusal(capability) {
7173
- return renderUserFacingFailure(CAPABILITY_FAILURES[capability]);
7174
- }
7175
- var DREAM_FAILURE_KEYS = {
7176
- provider_timeout: "dream_provider_timeout",
7177
- provider_error: "dream_provider_error",
7178
- local_refusal: "dream_local_refusal",
7179
- step_limit: "dream_step_limit",
7180
- token_budget: "dream_token_budget",
7181
- empty_completion: "dream_empty_completion",
7182
- no_models: "dream_no_models",
7183
- child_aborted: "dream_child_aborted",
7184
- parse_failed: "dream_parse_failed",
7185
- unknown: "dream_unknown"
7186
- };
7187
- var EMBEDDING_FAILURE_KEYS = {
7188
- substitution_rejected: "embedding_substitution_rejected",
7189
- http_error: "embedding_http_error",
7190
- transport_error: "embedding_transport_error",
7191
- invalid_envelope: "embedding_invalid_envelope",
7192
- empty_result: "embedding_empty_result",
7193
- certification_refusal: "embedding_certification_refusal",
7194
- credential_required: "embedding_credential_required",
7195
- local_binding_missing: "embedding_local_binding_missing",
7196
- local_fs_unavailable: "embedding_local_fs_unavailable",
7197
- local_download_failure: "embedding_local_download_failure",
7198
- local_runtime_error: "embedding_local_runtime_error"
7199
- };
7200
- function renderDreamFailure(failureClass, style = "markdown", refusalReason) {
7201
- const rendered = renderUserFacingFailure(DREAM_FAILURE_KEYS[failureClass], style);
7202
- return failureClass === "local_refusal" && refusalReason ? `${rendered} Reason: ${sanitizeDiagnosticText(refusalReason).slice(0, 500)}` : rendered;
7203
- }
7204
- function dreamFailureCode(failureClass) {
7205
- return userFacingFailureCode(DREAM_FAILURE_KEYS[failureClass]);
7206
- }
7207
- function renderEmbeddingFailure(failureClass, style = "markdown") {
7208
- return renderUserFacingFailure(EMBEDDING_FAILURE_KEYS[failureClass], style);
7209
- }
7210
-
7211
6959
  // src/features/magic-context/compartment-embedding.ts
7212
6960
  async function embedAndStoreCompartmentChunks(db, sessionId, projectPath, compartments) {
7213
6961
  if (compartments.length === 0)
@@ -14308,7 +14056,7 @@ function withCompartmentDates(db, sessionId, compartments, temporalAwareness) {
14308
14056
  const indexedRows = db.prepare(`SELECT message_ordinal AS ordinal, message_time_ms AS time
14309
14057
  FROM message_fts_rowid_map
14310
14058
  WHERE session_id = ?
14311
- AND message_time_ms IS NOT NULL
14059
+ AND +message_time_ms IS NOT NULL
14312
14060
  AND message_ordinal IN (SELECT value FROM json_each(?))`).all(sessionId, JSON.stringify([...ordinals]));
14313
14061
  const indexedTimes = new Map(indexedRows.map((row) => [row.ordinal, row.time]));
14314
14062
  const fallbackIds = new Set;
@@ -15298,6 +15046,9 @@ function trimToPreparedPrefix(options, prepared) {
15298
15046
  const boundary = prepared.preparedTrimBoundaryId;
15299
15047
  let status = "not-required";
15300
15048
  if (boundary) {
15049
+ const retireDecisions = (messageIds) => {
15050
+ queueAutoSearchHintDecisionRetirement(options.db, options.sessionId, new Set(messageIds));
15051
+ };
15301
15052
  const sourceOrder = options.prefixTrimSourceOrder;
15302
15053
  if (sourceOrder) {
15303
15054
  const refuse = (reason) => {
@@ -15350,6 +15101,8 @@ function trimToPreparedPrefix(options, prepared) {
15350
15101
  status = refuse(liveOrderError);
15351
15102
  else {
15352
15103
  options.messages.splice(0, options.messages.length, ...retained);
15104
+ const preserveBoundary = isPartialCompartmentEnd(options.db, options.sessionId, boundary);
15105
+ retireDecisions(sourceOrder.messageIds.slice(0, boundaryPosition + (preserveBoundary ? 0 : 1)));
15353
15106
  status = "applied";
15354
15107
  }
15355
15108
  }
@@ -15357,7 +15110,8 @@ function trimToPreparedPrefix(options, prepared) {
15357
15110
  } else {
15358
15111
  const index = findBoundaryIndex(options.sessionId, options.messages, boundary);
15359
15112
  if (index >= 0) {
15360
- options.messages.splice(0, index + (isPartialCompartmentEnd(options.db, options.sessionId, boundary) ? 0 : 1));
15113
+ const removed = options.messages.splice(0, index + (isPartialCompartmentEnd(options.db, options.sessionId, boundary) ? 0 : 1));
15114
+ retireDecisions(removed.map((message) => message.info.id).filter((id) => typeof id === "string"));
15361
15115
  resetPrefixTrimFallbackState(options.sessionId);
15362
15116
  status = "applied";
15363
15117
  } else {
@@ -20416,4 +20170,4 @@ ${failure}`;
20416
20170
  }
20417
20171
  }
20418
20172
 
20419
- export { BoundedSessionMap, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, embedPauseBySession, embedRunStateBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, ensureSessionMetaRow, clearCachedM0M1, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, readFrozenMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, getProtectionWindowForSession, isRustMarkerAdmissionFenced, setRustMarkerAdmissionFence, ReplayDocumentError, readReplayEnvelope, updateReplayDocument, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, loadPersistedUsage, loadProtectedTailMeta, resetProtectedTailNoEligibleHead, getWrapupInProgressState, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getProtectedTailDrainBudgetSkip, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, setPersistedNoteNudgeTrigger, getNoteNudgeAnchors, getAutoSearchHintDecisions, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, pruneAutoSearchHintDecisions, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, setNoteLastReadAt, getHistorianFailureState, clearHistorianFailureState, getOverflowState, loadTransformPassStateSnapshot, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, getDeferredClearedCompactionMarkerState, retireDeferredClearedCompactionMarkerState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, thinkingBindingRecoveryFrozenId, getThinkingBindingRecoveryTarget, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getTrailingBlankDecisions, addTrailingBlankDecisions, demoteTrailingBlankKeepDecisions, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, setPendingCompactionMarkerState, replacePendingCompactionMarkerStateIf, clearPendingCompactionMarkerStateIf, setSessionWorkMetrics, getObservedEpochFloor, resolveEpochFloorForPass, providerResponseFailed, isSuccessfulProviderCompletion, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, isLegacyLkgDigest, exactReusablePrefix, incrementalLkgContentDigests, lkgContentDigest, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, LkgEntryDigestCache, sharedLkgEntryDigests, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, registerAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, USER_FACING_FAILURES, renderUserFacingFailure, userFacingFailureCode, renderCapabilityRefusal, renderDreamFailure, dreamFailureCode, renderEmbeddingFailure, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
20173
+ export { BoundedSessionMap, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, embedPauseBySession, embedRunStateBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, ensureSessionMetaRow, clearCachedM0M1, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, readFrozenMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, getProtectionWindowForSession, isRustMarkerAdmissionFenced, setRustMarkerAdmissionFence, ReplayDocumentError, readReplayEnvelope, updateReplayDocument, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, loadPersistedUsage, loadProtectedTailMeta, resetProtectedTailNoEligibleHead, getWrapupInProgressState, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getProtectedTailDrainBudgetSkip, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, setPersistedNoteNudgeTrigger, getNoteNudgeAnchors, getAutoSearchHintDecisions, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, flushAutoSearchHintDecisionRetirement, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, setNoteLastReadAt, getHistorianFailureState, clearHistorianFailureState, getOverflowState, loadTransformPassStateSnapshot, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, getDeferredClearedCompactionMarkerState, retireDeferredClearedCompactionMarkerState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, thinkingBindingRecoveryFrozenId, getThinkingBindingRecoveryTarget, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getTrailingBlankDecisions, addTrailingBlankDecisions, demoteTrailingBlankKeepDecisions, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, setPendingCompactionMarkerState, replacePendingCompactionMarkerStateIf, clearPendingCompactionMarkerStateIf, setSessionWorkMetrics, getObservedEpochFloor, resolveEpochFloorForPass, providerResponseFailed, isSuccessfulProviderCompletion, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, isLegacyLkgDigest, exactReusablePrefix, incrementalLkgContentDigests, lkgContentDigest, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, LkgEntryDigestCache, sharedLkgEntryDigests, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };