@cortexkit/opencode-magic-context 0.49.6 → 0.49.7

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 (153) hide show
  1. package/dist/auto-search-worker.js +10 -7
  2. package/dist/{compaction-marker-candidates-cz72pm1t.js → compaction-marker-candidates-a0edbqrr.js} +2 -2
  3. package/dist/compaction-marker-candidates-worker.js +2 -2
  4. package/dist/{conflict-warning-hook-1jq1rxx7.js → conflict-warning-hook-myk5hbt9.js} +5 -5
  5. package/dist/{context-ae3gxdye.js → context-ffr7e0g7.js} +46 -34
  6. package/dist/{embedding-backfill-dtjmyktb.js → embedding-backfill-re16xncd.js} +6 -6
  7. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  8. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +6 -3
  9. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
  10. package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +7 -1
  11. package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -1
  12. package/dist/features/magic-context/dreamer/map-memories.d.ts +2 -2
  13. package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
  14. package/dist/features/magic-context/dreamer/primer-seed.d.ts +2 -0
  15. package/dist/features/magic-context/dreamer/primer-seed.d.ts.map +1 -1
  16. package/dist/features/magic-context/dreamer/refresh-primers.d.ts +2 -2
  17. package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
  18. package/dist/features/magic-context/storage-meta-persisted.d.ts +10 -3
  19. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  20. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  21. package/dist/features/magic-context/storage-replay-document.d.ts +4 -0
  22. package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -1
  23. package/dist/hooks/magic-context/apply-operations.d.ts +7 -0
  24. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  25. package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
  26. package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
  27. package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/note-nudger.d.ts +5 -3
  29. package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -1
  30. package/dist/hooks/magic-context/postprocess-read-cache.d.ts.map +1 -1
  31. package/dist/hooks/magic-context/read-session-chunk.d.ts +7 -0
  32. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  33. package/dist/hooks/magic-context/replay-committed-drops.d.ts +9 -0
  34. package/dist/hooks/magic-context/replay-committed-drops.d.ts.map +1 -0
  35. package/dist/hooks/magic-context/rust-lkg-freeze-registry.d.ts +2 -2
  36. package/dist/hooks/magic-context/rust-lkg-freeze-registry.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/rust-mode-transform.d.ts +3 -0
  38. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/rust-served-raw.d.ts +29 -0
  40. package/dist/hooks/magic-context/rust-served-raw.d.ts.map +1 -0
  41. package/dist/hooks/magic-context/strip-content.d.ts +23 -24
  42. package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
  44. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/tool-drop-target.d.ts +2 -0
  46. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  48. package/dist/{index-6q5h70h2.js → index-0gyq3djm.js} +1 -1
  49. package/dist/{index-vnjhmkwk.js → index-37q80veb.js} +1 -1
  50. package/dist/{index-besxhcsh.js → index-4btknbqh.js} +9 -8
  51. package/dist/{index-vh3e2mvr.js → index-5tbvdff4.js} +59 -28
  52. package/dist/{index-cm4hmxyk.js → index-9yyqq3mm.js} +1 -1
  53. package/dist/{index-ab3bgm2m.js → index-a8acx4gc.js} +2 -2
  54. package/dist/{index-j55vn694.js → index-ax2jhztn.js} +1 -1
  55. package/dist/{index-zgzdm6dg.js → index-ebnngykq.js} +145 -94
  56. package/dist/{index-g9exahnx.js → index-g8qbdb03.js} +1 -1
  57. package/dist/{index-ch08qwgd.js → index-j58gqrn2.js} +65 -65
  58. package/dist/{index-xqyj5c85.js → index-j5hce1ab.js} +2 -2
  59. package/dist/{index-0nnd4bry.js → index-j8epsc0g.js} +34 -13
  60. package/dist/{index-vztbgcdk.js → index-n5a170gs.js} +227 -38
  61. package/dist/{index-s0gsmthp.js → index-n7kwfw2r.js} +4 -4
  62. package/dist/{index-ck6y3td2.js → index-rwmpkss5.js} +3 -3
  63. package/dist/{index-bg5qqene.js → index-rzmjkdd6.js} +1 -1
  64. package/dist/{index-9s58tq95.js → index-sf94at64.js} +3 -3
  65. package/dist/{index-f3dnvnw6.js → index-sh91t19a.js} +1 -1
  66. package/dist/{index-mj1fgfrk.js → index-tagss15p.js} +857 -125
  67. package/dist/{index-1j8jcjpa.js → index-tmtty2x5.js} +1 -1
  68. package/dist/{index-hr64sth2.js → index-vt4sf4ep.js} +1 -1
  69. package/dist/{index-9m7bn21d.js → index-w4mw92w3.js} +1 -1
  70. package/dist/{index-7q1m1qjk.js → index-w6bd03dc.js} +1 -1
  71. package/dist/{index-a796ct3s.js → index-w6vr754t.js} +4 -4
  72. package/dist/{index-1xaw2pq8.js → index-wq16ahsn.js} +5 -5
  73. package/dist/index.js +36 -36
  74. package/dist/{message-index-bounded-630j53ps.js → message-index-bounded-04rycpx4.js} +9 -9
  75. package/dist/{message-index-c84wm2g0.js → message-index-rqtse28y.js} +9 -9
  76. package/dist/{message-time-backfill-8kj57qe3.js → message-time-backfill-a5ytnp53.js} +1 -1
  77. package/dist/migration-worker.js +6 -6
  78. package/dist/plugin/messages-transform.d.ts.map +1 -1
  79. package/dist/{project-embedding-registry-vv59t7ah.js → project-embedding-registry-k0sd9k7v.js} +5 -5
  80. package/dist/raw-ordinal-warmup-worker.js +17 -15
  81. package/dist/{read-session-chunk-t3vjd0h0.js → read-session-chunk-h1btx938.js} +7 -5
  82. package/dist/{read-session-raw-gf7eytnm.js → read-session-raw-vdf4wh78.js} +2 -2
  83. package/dist/{recomp-orchestrator-1d08g57a.js → recomp-orchestrator-trcgmm23.js} +20 -20
  84. package/dist/{search-kth2p6cc.js → search-3rbdx6hw.js} +16 -16
  85. package/dist/{send-session-notification-3j6krd4w.js → send-session-notification-2tp44tfa.js} +4 -4
  86. package/dist/shared/processed-image-eligibility.d.ts +22 -0
  87. package/dist/shared/processed-image-eligibility.d.ts.map +1 -0
  88. package/dist/shared/recovery-reasoning-prefix.d.ts +9 -0
  89. package/dist/shared/recovery-reasoning-prefix.d.ts.map +1 -0
  90. package/dist/shared/sqlite.d.ts +1 -1
  91. package/dist/shared/sqlite.d.ts.map +1 -1
  92. package/dist/shared/tag-transcript.d.ts +9 -0
  93. package/dist/shared/tag-transcript.d.ts.map +1 -1
  94. package/dist/{sqlite-d7edbk1s.js → sqlite-j3tvg8r0.js} +1 -1
  95. package/dist/{storage-memory-af5zdz98.js → storage-memory-8168bgef.js} +2 -2
  96. package/dist/{storage-tags-dyj7mmbq.js → storage-tags-61z5j2f9.js} +2 -2
  97. package/dist/tools/ctx-expand/search-archive.d.ts +4 -0
  98. package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -0
  99. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  100. package/dist/{transform-postprocess-phase-bv3kb5s1.js → transform-postprocess-phase-7qts7h54.js} +20 -20
  101. package/dist/v2/auto-search-worker.js +10 -7
  102. package/dist/v2/{compaction-marker-candidates-6gqp5wrc.js → compaction-marker-candidates-6nypjkpf.js} +2 -2
  103. package/dist/v2/compaction-marker-candidates-worker.js +2 -2
  104. package/dist/v2/{context-p8f2shp1.js → context-xq4rtywr.js} +1019 -233
  105. package/dist/v2/{embedding-backfill-cg4rv90f.js → embedding-backfill-xd9ygzgd.js} +6 -6
  106. package/dist/v2/hooks/payload.d.ts.map +1 -1
  107. package/dist/v2/{message-index-3ws17x1g.js → message-index-8e5z2xx8.js} +9 -9
  108. package/dist/v2/{message-index-bounded-yzxmf6vp.js → message-index-bounded-5vh1h2g7.js} +9 -9
  109. package/dist/v2/{message-time-backfill-5nf10c65.js → message-time-backfill-2z365239.js} +1 -1
  110. package/dist/v2/migration-worker.js +6 -6
  111. package/dist/v2/{project-embedding-registry-rsnf2263.js → project-embedding-registry-b77awytr.js} +5 -5
  112. package/dist/v2/raw-ordinal-warmup-worker.js +17 -15
  113. package/dist/v2/{read-session-chunk-vtb0w2kd.js → read-session-chunk-4sat83cx.js} +7 -5
  114. package/dist/v2/{read-session-raw-gpcddemt.js → read-session-raw-a3hw9jsp.js} +2 -2
  115. package/dist/v2/{recomp-orchestrator-v64r4s4r.js → recomp-orchestrator-n11zv1f1.js} +19 -19
  116. package/dist/v2/{search-bpa4fxq1.js → search-mvgqtkkz.js} +16 -16
  117. package/dist/v2/{send-session-notification-5aj2j7vf.js → send-session-notification-ppgc8qdz.js} +4 -4
  118. package/dist/v2/{server-wrem2nmz.js → server-1rfgbjfn.js} +1 -1
  119. package/dist/v2/{server-qn23p4h7.js → server-7srtwsa4.js} +5 -5
  120. package/dist/v2/{server-cm4hmxyk.js → server-9yyqq3mm.js} +1 -1
  121. package/dist/v2/{server-yezz0cp2.js → server-brhj8qtd.js} +1 -1
  122. package/dist/v2/{server-387vkhjq.js → server-dd0nja67.js} +1 -1
  123. package/dist/v2/{server-keswwkvv.js → server-fpqe39as.js} +1 -1
  124. package/dist/v2/{server-158ehmk2.js → server-fw31krgq.js} +3 -3
  125. package/dist/v2/{server-fby0cxbq.js → server-gtv9wbhq.js} +227 -38
  126. package/dist/v2/{server-ww9nr8pe.js → server-hcvcxzx7.js} +2 -2
  127. package/dist/v2/{server-0nnd4bry.js → server-j8epsc0g.js} +34 -13
  128. package/dist/v2/{server-x2r63c0x.js → server-jdwd03ep.js} +4 -4
  129. package/dist/v2/{server-btgnsv7w.js → server-kdrezdy0.js} +1 -1
  130. package/dist/v2/{server-7skbfb81.js → server-mv1w7t6z.js} +61 -30
  131. package/dist/v2/{server-aa9w15cs.js → server-nfan6zb6.js} +65 -65
  132. package/dist/v2/{server-9zqewm6g.js → server-qcw43339.js} +1 -1
  133. package/dist/v2/{server-f9py7s7a.js → server-sy4b1sra.js} +1 -1
  134. package/dist/v2/{server-09g9pkvx.js → server-v4fwha43.js} +9 -8
  135. package/dist/v2/{server-yd01snxq.js → server-w3zeywp1.js} +1 -1
  136. package/dist/v2/{server-4tn95znb.js → server-wkdgjjch.js} +1 -1
  137. package/dist/v2/{server-6a9mxnb2.js → server-x08d1xf3.js} +1 -1
  138. package/dist/v2/server.js +4 -4
  139. package/dist/v2/{sqlite-d7edbk1s.js → sqlite-j3tvg8r0.js} +1 -1
  140. package/dist/v2/{storage-memory-af5zdz98.js → storage-memory-8168bgef.js} +2 -2
  141. package/dist/v2/{storage-tags-d47bpaqa.js → storage-tags-j2fzq3sw.js} +2 -2
  142. package/dist/v2/{wrapup-orchestrator-cahk37n7.js → wrapup-orchestrator-s92ebfzv.js} +19 -19
  143. package/dist/{wrapup-orchestrator-mqp0v195.js → wrapup-orchestrator-df61jmz9.js} +21 -21
  144. package/package.json +3 -3
  145. package/src/shared/processed-image-eligibility.test.ts +68 -0
  146. package/src/shared/processed-image-eligibility.ts +41 -0
  147. package/src/shared/processed-image-position-review.json +20 -0
  148. package/src/shared/processed-image-position-review.test.ts +19 -0
  149. package/src/shared/recovery-reasoning-prefix.test.ts +34 -0
  150. package/src/shared/recovery-reasoning-prefix.ts +35 -0
  151. package/src/shared/sqlite-writer-diagnostics.test.ts +31 -0
  152. package/src/shared/sqlite.ts +63 -22
  153. package/src/shared/tag-transcript.ts +118 -0
@@ -14,19 +14,22 @@ var [
14
14
  { installProjectEmbeddingSearchBridge },
15
15
  { searchMessageHistory, unifiedSearch },
16
16
  { setEmbeddingSessionBusy },
17
- { setHarness },
18
- { Database }
17
+ { getHarness, setHarness },
18
+ { Database, registerSqliteDiagnosticSink },
19
+ { log }
19
20
  ] = await Promise.all([
20
- import("./embedding-backfill-dtjmyktb.js"),
21
+ import("./embedding-backfill-re16xncd.js"),
21
22
  import("./embedding-cache-mgyr73ef.js"),
22
- import("./storage-memory-af5zdz98.js"),
23
- import("./project-embedding-registry-vv59t7ah.js"),
24
- import("./search-kth2p6cc.js"),
23
+ import("./storage-memory-8168bgef.js"),
24
+ import("./project-embedding-registry-k0sd9k7v.js"),
25
+ import("./search-3rbdx6hw.js"),
25
26
  import("./embedding-activity-g1dhes6g.js"),
26
27
  import("./harness-e4avh192.js"),
27
- import("./sqlite-d7edbk1s.js")
28
+ import("./sqlite-j3tvg8r0.js"),
29
+ import("./logger-ewak5q1s.js")
28
30
  ]);
29
31
  setHarness(input.harness);
32
+ registerSqliteDiagnosticSink(log, getHarness);
30
33
  setEmbeddingSessionBusy(input.sessionId, input.embeddingHostBusy === true);
31
34
  var nextId = 0;
32
35
  var pending = new Map;
@@ -4,9 +4,9 @@ import {
4
4
  readMarkerCandidateBasis2,
5
5
  prepareMarkerCandidateBasis2,
6
6
  scanMarkerCandidateSnapshot2
7
- } from "./index-f3dnvnw6.js";
7
+ } from "./index-sh91t19a.js";
8
8
  import"./index-v0p37hm2.js";
9
- import"./index-0nnd4bry.js";
9
+ import"./index-j8epsc0g.js";
10
10
  import"./index-nsjyysj0.js";
11
11
  import"./index-0sahzkwr.js";
12
12
  import"./index-pavzsdc6.js";
@@ -5,8 +5,8 @@ if (!port)
5
5
  throw new Error("marker candidate worker requires a parent port");
6
6
  port.postMessage({ kind: "accepted" });
7
7
  var [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
8
- import("./sqlite-d7edbk1s.js"),
9
- import("./compaction-marker-candidates-cz72pm1t.js")
8
+ import("./sqlite-j3tvg8r0.js"),
9
+ import("./compaction-marker-candidates-a0edbqrr.js")
10
10
  ]);
11
11
  var input = workerData;
12
12
  var db;
@@ -4,17 +4,17 @@ import {
4
4
  cleanupConflictWarnings2,
5
5
  sendSchemaFenceWarning2,
6
6
  sendStartupAnnouncement2
7
- } from "./index-6q5h70h2.js";
7
+ } from "./index-0gyq3djm.js";
8
8
  import"./index-z1tjp257.js";
9
9
  import"./index-sd3egckz.js";
10
- import"./index-hr64sth2.js";
10
+ import"./index-vt4sf4ep.js";
11
11
  import"./index-qt1qqasc.js";
12
12
  import"./index-tqf7yg27.js";
13
- import"./index-ab3bgm2m.js";
14
- import"./index-vnjhmkwk.js";
13
+ import"./index-a8acx4gc.js";
14
+ import"./index-37q80veb.js";
15
15
  import"./index-v0p37hm2.js";
16
16
  import"./index-58e3y90n.js";
17
- import"./index-0nnd4bry.js";
17
+ import"./index-j8epsc0g.js";
18
18
  import"./index-nsjyysj0.js";
19
19
  import"./index-0sahzkwr.js";
20
20
  import"./index-pavzsdc6.js";
@@ -59,7 +59,7 @@ import {
59
59
  rebaseSessionCoordinatesAsync,
60
60
  resolveOpenCodeProtectedTailBoundary,
61
61
  getActiveCompartmentRun
62
- } from "./index-vh3e2mvr.js";
62
+ } from "./index-5tbvdff4.js";
63
63
  import"./index-sd3egckz.js";
64
64
  import {
65
65
  getHarness2
@@ -105,12 +105,12 @@ import {
105
105
  openDatabaseAsync,
106
106
  isDatabasePersisted,
107
107
  getDatabasePersistenceError
108
- } from "./index-besxhcsh.js";
108
+ } from "./index-4btknbqh.js";
109
109
  import {
110
110
  setHomeProjectPermission,
111
111
  resolveProjectIdentityForSession,
112
112
  scheduleAfterBootQuiet
113
- } from "./index-g9exahnx.js";
113
+ } from "./index-g8qbdb03.js";
114
114
  import {
115
115
  markHostUnservedRow,
116
116
  DreamTokenBudgetExceeded,
@@ -130,16 +130,18 @@ import {
130
130
  setPersistedCompactionMarkerState,
131
131
  getPendingPiCompactionMarkerState,
132
132
  clearPendingPiCompactionMarkerStateIf,
133
+ logPiCompactionMarkerClear,
133
134
  getObservedEpochFloor,
134
135
  detectOverflow,
135
136
  modelAcceptsEmptyContent,
137
+ getEmptyImageParts,
136
138
  estimateFinalWireInputTokens,
137
139
  hasRawMessageProvider2,
138
140
  setBoundedRawMessageProvider2,
139
141
  cleanUserText2,
140
142
  readRawSessionMessageIdOrdinalsForRange2,
141
143
  readRawSessionMessageOrdinalById2
142
- } from "./index-vztbgcdk.js";
144
+ } from "./index-n5a170gs.js";
143
145
  import {
144
146
  hasMeaningfulUserText2,
145
147
  preloadTokenizer,
@@ -151,19 +153,19 @@ import {
151
153
  withoutSqliteTransformPass2,
152
154
  isTransientSqliteError2,
153
155
  withAsyncPrivilegedWriter2
154
- } from "./index-0nnd4bry.js";
156
+ } from "./index-j8epsc0g.js";
155
157
  import {
156
158
  sameProjectDirectory
157
- } from "./index-bg5qqene.js";
159
+ } from "./index-rzmjkdd6.js";
158
160
  import {
159
161
  deleteChunkEmbedBackoffForSession
160
- } from "./index-j55vn694.js";
161
- import"./index-9m7bn21d.js";
162
+ } from "./index-ax2jhztn.js";
163
+ import"./index-w4mw92w3.js";
162
164
  import {
163
165
  BoundedSessionMap,
164
166
  advanceSessionActivity,
165
167
  backfillSessionActivity
166
- } from "./index-1xaw2pq8.js";
168
+ } from "./index-wq16ahsn.js";
167
169
  import"./index-1bt88epp.js";
168
170
  import"./index-1zx87sdm.js";
169
171
  import {
@@ -172,23 +174,23 @@ import {
172
174
  evaluateChannel2,
173
175
  reclaimableToolOutputCount,
174
176
  buildChannel2Reminder
175
- } from "./index-1j8jcjpa.js";
177
+ } from "./index-tmtty2x5.js";
176
178
  import"./index-v0p37hm2.js";
177
- import"./index-vnjhmkwk.js";
179
+ import"./index-37q80veb.js";
178
180
  import"./index-58e3y90n.js";
179
- import"./index-ab3bgm2m.js";
181
+ import"./index-a8acx4gc.js";
180
182
  import {
181
183
  getCurrentToolSetHash,
182
184
  recordToolDefinition
183
185
  } from "./index-h2wc01qk.js";
184
186
  import"./index-fr0wbhdn.js";
185
- import"./index-xqyj5c85.js";
186
- import"./index-9s58tq95.js";
187
+ import"./index-j5hce1ab.js";
188
+ import"./index-sf94at64.js";
187
189
  import"./index-fb3zxn06.js";
188
190
  import {
189
191
  renderUserFacingFailure,
190
192
  userFacingFailureCode
191
- } from "./index-s0gsmthp.js";
193
+ } from "./index-n7kwfw2r.js";
192
194
  import {
193
195
  runSessionProjectBackfill,
194
196
  createLiveSessionState,
@@ -239,7 +241,7 @@ import {
239
241
  applyJsonSchemaParameterDescriptions,
240
242
  MagicContextRpcServer,
241
243
  subagentTemperature
242
- } from "./index-mj1fgfrk.js";
244
+ } from "./index-tagss15p.js";
243
245
  import {
244
246
  createTagger,
245
247
  setCtxReduceRegisteredGlobally,
@@ -247,21 +249,21 @@ import {
247
249
  EmergencyFailClosedError,
248
250
  DegradedPassRefusalError,
249
251
  isSyntheticHeadMessage2
250
- } from "./index-zgzdm6dg.js";
251
- import"./index-f3dnvnw6.js";
252
+ } from "./index-ebnngykq.js";
253
+ import"./index-sh91t19a.js";
252
254
  import"./index-qt1qqasc.js";
253
255
  import"./index-4dhv7mqz.js";
254
256
  import"./index-gbmqa9x9.js";
255
- import"./index-7q1m1qjk.js";
256
- import"./index-cm4hmxyk.js";
257
+ import"./index-w6bd03dc.js";
258
+ import"./index-9yyqq3mm.js";
257
259
  import {
258
260
  pushNotification2,
259
261
  isTuiConnected2
260
262
  } from "./index-x8a7jmkh.js";
261
263
  import"./index-tqf7yg27.js";
262
- import"./index-hr64sth2.js";
263
- import"./index-ch08qwgd.js";
264
- import"./index-ck6y3td2.js";
264
+ import"./index-vt4sf4ep.js";
265
+ import"./index-j58gqrn2.js";
266
+ import"./index-rwmpkss5.js";
265
267
  import"./index-mw7c950g.js";
266
268
  import {
267
269
  detectConflicts
@@ -301,6 +303,7 @@ function forgetCachedPrefix(sessionId) {
301
303
  function dropCompartmentsAfter(db, sessionId, anchor, holderId, activeBranch = false, onRetire) {
302
304
  db.exec("BEGIN IMMEDIATE");
303
305
  let finished = false;
306
+ let clearedMarker = null;
304
307
  try {
305
308
  if (!isCompartmentLeaseHeld(db, sessionId, holderId)) {
306
309
  db.exec("ROLLBACK");
@@ -317,14 +320,16 @@ function dropCompartmentsAfter(db, sessionId, anchor, holderId, activeBranch = f
317
320
  if (activeBranch) {
318
321
  db.prepare("UPDATE session_meta SET prior_boundary_ordinal = ? WHERE session_id = ?").run((anchor?.endMessage ?? 0) + 1, sessionId);
319
322
  const marker = getPendingPiCompactionMarkerState(db, sessionId);
320
- if (marker)
321
- clearPendingPiCompactionMarkerStateIf(db, sessionId, marker);
323
+ if (marker && clearPendingPiCompactionMarkerStateIf(db, sessionId, marker, null))
324
+ clearedMarker = marker;
322
325
  }
323
326
  deleteChunkEmbedBackoffForSession(db, sessionId);
324
327
  queueM0Mutation(db, { sessionId, mutationType: "recomp_boundary_change" });
325
328
  clearCachedM0M1(db, sessionId);
326
329
  db.exec("COMMIT");
327
330
  finished = true;
331
+ if (clearedMarker)
332
+ logPiCompactionMarkerClear(sessionId, clearedMarker, "active-branch-retired");
328
333
  return dropped.map((row) => row.sequence);
329
334
  } finally {
330
335
  if (!finished) {
@@ -1027,12 +1032,12 @@ function placeCacheHint(content, hint) {
1027
1032
  const index = lastText >= 0 ? lastText : content.length - 1;
1028
1033
  content[index] = { ...content[index], cache: hint };
1029
1034
  }
1030
- function removeEmptyTextParts(content, rendered) {
1035
+ function removeEmptyTextParts(content, rendered, mayRemove) {
1031
1036
  let hint;
1032
1037
  let removed = 0;
1033
1038
  for (let index = content.length - 1;index >= 0; index -= 1) {
1034
1039
  const part = content[index];
1035
- if (part?.type !== "text" || part.text !== "")
1040
+ if (part?.type !== "text" || part.text !== "" || !mayRemove(part))
1036
1041
  continue;
1037
1042
  if (hint === undefined)
1038
1043
  hint = part.cache;
@@ -1108,12 +1113,14 @@ function contentValueAttachments(value) {
1108
1113
  ...typeof item.name === "string" ? { filename: item.name } : {}
1109
1114
  }));
1110
1115
  }
1111
- function rebuildFileContent(value, output) {
1116
+ function rebuildFileContent(value, output, attachments) {
1112
1117
  if (isDroppedToolOutput(output))
1113
1118
  return { type: "text", value: output };
1114
1119
  const rebuilt = [];
1115
1120
  let placed = false;
1116
1121
  for (const item of value) {
1122
+ if (item?.type === "file" && Array.isArray(attachments) && !attachments.some((attachment) => attachment?.url === item.uri && attachment?.mime === item.mime))
1123
+ continue;
1117
1124
  if (item?.type !== "text") {
1118
1125
  rebuilt.push(item);
1119
1126
  continue;
@@ -1256,14 +1263,16 @@ function adaptPayload(draft, admittedIDs = new Set) {
1256
1263
  let head = 0;
1257
1264
  const rendered = [];
1258
1265
  const emptyTextGuard = modelAcceptsEmptyContent(draft.model.providerID);
1266
+ const imageOmissions = getEmptyImageParts(messages);
1259
1267
  let omitted = 0;
1260
1268
  let emptyTextParts = 0;
1261
1269
  for (const message of messages) {
1262
1270
  const original = originals.get(message) ?? (typeof message.info.id === "string" ? originalsByID.get(message.info.id) : undefined);
1263
1271
  const id = message.info.syntheticHead ? HEAD_IDS[head++] : original?.id;
1264
1272
  const content = [];
1273
+ const emptyImages = new Set;
1265
1274
  const following = [];
1266
- for (const candidate of message.parts) {
1275
+ for (const [partIndex, candidate] of message.parts.entries()) {
1267
1276
  const part = candidate;
1268
1277
  const bridge = bridges.get(part) ?? (part.type === "tool" && typeof part.callID === "string" ? bridgesFor(message)?.get(part.callID) : undefined);
1269
1278
  if (!bridge) {
@@ -1319,7 +1328,10 @@ function adaptPayload(draft, admittedIDs = new Set) {
1319
1328
  }
1320
1329
  const { synthetic: _synthetic, ...clean } = part;
1321
1330
  const original = hostPartTypes.has(clean.type) && !containsHostInstance(clean) ? hostParts.get(contentKey(clean)) : undefined;
1322
- content.push(original ?? clean);
1331
+ const projected = original ?? clean;
1332
+ if (imageOmissions.get(message.info.id ?? "")?.has(partIndex))
1333
+ emptyImages.add(projected);
1334
+ content.push(projected);
1323
1335
  continue;
1324
1336
  }
1325
1337
  const state = part.state;
@@ -1351,7 +1363,7 @@ function adaptPayload(draft, admittedIDs = new Set) {
1351
1363
  if (bridge.result && bridge.resultMessage) {
1352
1364
  const result = {
1353
1365
  ...bridge.result,
1354
- result: state.output === bridge.output ? bridge.result.result : bridge.files && typeof state.output === "string" ? rebuildFileContent(bridge.files, state.output) : {
1366
+ result: state.output === bridge.output ? bridge.result.result : bridge.files && typeof state.output === "string" ? rebuildFileContent(bridge.files, state.output, state.attachments) : {
1355
1367
  type: state.status === "error" ? "error" : "text",
1356
1368
  value: state.output
1357
1369
  }
@@ -1362,7 +1374,7 @@ function adaptPayload(draft, admittedIDs = new Set) {
1362
1374
  following.push({ ...bridge.resultMessage, content: [result] });
1363
1375
  }
1364
1376
  }
1365
- const guarded = emptyTextGuard ? removeEmptyTextParts(content, rendered) : 0;
1377
+ const guarded = removeEmptyTextParts(content, rendered, (part) => emptyTextGuard || emptyImages.has(part));
1366
1378
  if (content.length || !original?.content.length && guarded === 0) {
1367
1379
  const value = {
1368
1380
  ...original,
@@ -1372,7 +1384,7 @@ function adaptPayload(draft, admittedIDs = new Set) {
1372
1384
  };
1373
1385
  const existing = id ? existingHeads.get(id) : undefined;
1374
1386
  rendered.push(existing ? Object.assign(existing, { content }) : value);
1375
- } else if (emptyTextGuard) {
1387
+ } else if (emptyTextGuard || guarded > 0) {
1376
1388
  omitted += 1;
1377
1389
  }
1378
1390
  emptyTextParts += guarded;
@@ -1380,7 +1392,7 @@ function adaptPayload(draft, admittedIDs = new Set) {
1380
1392
  }
1381
1393
  if (omitted + emptyTextParts > 0 && !emptyTextOmissionLogged.has(draft.sessionID)) {
1382
1394
  emptyTextOmissionLogged.add(draft.sessionID);
1383
- sessionLog2(draft.sessionID, `v2 payload: left out ${omitted} emptied messages and ${emptyTextParts} empty text parts, because Anthropic rejects an empty text block (logged once per session)`);
1395
+ sessionLog2(draft.sessionID, `v2 payload: left out ${omitted} emptied messages and ${emptyTextParts} empty text parts, ${emptyTextGuard ? "because Anthropic rejects an empty text block" : "to replay frozen image omissions"} (logged once per session)`);
1384
1396
  }
1385
1397
  draft.messages.splice(0, draft.messages.length, ...rendered);
1386
1398
  }
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  ensureMemoryEmbeddings2
3
- } from "./index-7q1m1qjk.js";
4
- import"./index-9s58tq95.js";
5
- import"./index-j55vn694.js";
3
+ } from "./index-w6bd03dc.js";
4
+ import"./index-sf94at64.js";
5
+ import"./index-ax2jhztn.js";
6
6
  import"./index-4dhv7mqz.js";
7
7
  import"./index-qt1qqasc.js";
8
8
  import"./index-gbmqa9x9.js";
9
9
  import"./index-vkbqdnkj.js";
10
- import"./index-g9exahnx.js";
11
- import"./index-bg5qqene.js";
10
+ import"./index-g8qbdb03.js";
11
+ import"./index-rzmjkdd6.js";
12
12
  import"./index-k6xvbj2e.js";
13
13
  import"./index-4mjhqadz.js";
14
- import"./index-0nnd4bry.js";
14
+ import"./index-j8epsc0g.js";
15
15
  import"./index-qx53vezw.js";
16
16
  import"./index-nsjyysj0.js";
17
17
  import"./index-0sahzkwr.js";
@@ -1 +1 @@
1
- {"version":3,"file":"compaction-marker.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compaction-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAaH,OAAO,EAIH,KAAK,iCAAiC,EAGzC,MAAM,gCAAgC,CAAC;AAqCxC,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,SAAK,EAAE,QAAQ,SAAK,GAAG,MAAM,CAE1F;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,SAAK,EAAE,QAAQ,SAAK,GAAG,MAAM,CAEvF;AAID,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAkLD,wBAAgB,uBAAuB,IAAI,IAAI,CAc9C;AAID,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACvB;AA6BD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,SAAS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;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,8BAA8B,CAC1C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GACpB,0BAA0B,CAwN5B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAgB5E"}
1
+ {"version":3,"file":"compaction-marker.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compaction-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAaH,OAAO,EAIH,KAAK,iCAAiC,EAGzC,MAAM,gCAAgC,CAAC;AAqCxC,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,SAAK,EAAE,QAAQ,SAAK,GAAG,MAAM,CAE1F;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,SAAK,EAAE,QAAQ,SAAK,GAAG,MAAM,CAEvF;AAID,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAyMD,wBAAgB,uBAAuB,IAAI,IAAI,CAc9C;AAID,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACvB;AA6BD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACrB,mBAAmB,GAAG,IAAI,CAuD5B;AAED,wBAAgB,uCAAuC,CACnD,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACvB,MAAM,GAAG,IAAI,CASf;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CACxC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACf,OAAO,CA4BT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAClC,SAAS,EAAE,MAAM,EACjB,SA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,CAAC;AAIhE,wBAAgB,uBAAuB,CACnC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,EACtC,IAAI,EAAE,0BAA0B,GACjC,kCAAkC,CAmDpC;AAID;;;;;;;;GAQG;AACH,MAAM,WAAW,2BAA2B;IACxC,sEAAsE;IACtE,gBAAgB,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uEAAuE;IACvE,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,2BAA2B,EAAE,CAkE7F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,6BAA6B,CACzC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,2BAA2B,EACnC,yBAAyB,EAAE,MAAM,GAAG,IAAI,GACzC,OAAO,CAyBT;AAID;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,wFAAwF;IACxF,eAAe,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;;OAOG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,8BAA8B,CAC1C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GACpB,0BAA0B,CAwN5B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAgB5E"}
@@ -21,6 +21,8 @@ export interface HiddenSingleShotArgs<T> {
21
21
  privacySensitive?: boolean;
22
22
  /** The curation task can finish after completed memory updates without a final text response. */
23
23
  allowEmpty?: boolean;
24
+ /** Read completed per-memory XML entries before closing a failed hidden session. */
25
+ onFailureOutput?: (completion: HiddenCompletion) => void;
24
26
  /**
25
27
  * Turn the complete assistant text into the caller's result. Throwing here
26
28
  * rejects this model's answer and advances to the next configured fallback.
@@ -36,9 +38,10 @@ export interface HiddenSingleShotResult<T> {
36
38
  * Run one Dreamer prompt through a hidden completion carrier and hand the
37
39
  * caller the parsed answer. The carrier owns any tool steps for its agent.
38
40
  *
39
- * Every task routed through here answers with one self-contained document
40
- * (a JSON object or an XML manifest), so a partial answer is never safe to
41
- * apply. Two guards make that fail closed, matching what the memory classifier
41
+ * Tasks normally answer with one self-contained document (JSON or XML), so
42
+ * incomplete output is rejected. Mapping alone can recover closed per-memory
43
+ * entries through onFailureOutput. Two guards keep normal completion fail-closed,
44
+ * matching what the memory classifier
42
45
  * already does on this same transport:
43
46
  * - a completion the provider cut short at the output limit is rejected before
44
47
  * the parser sees it, so a truncated prefix can never be applied; and
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-single-shot.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/hidden-single-shot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,gBAAgB,EAChB,wBAAwB,EAC3B,MAAM,uDAAuD,CAAC;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAKnE,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACnC,QAAQ,EAAE,wBAAwB,CAAC;IACnC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,0FAA0F;IAC1F,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,cAAc,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iGAAiG;IACjG,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,KAAK,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC;IACb,UAAU,EAAE,gBAAgB,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,yBAAyB,CAAC,CAAC,EAC7C,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC9B,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAwEpC"}
1
+ {"version":3,"file":"hidden-single-shot.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/hidden-single-shot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,gBAAgB,EAChB,wBAAwB,EAC3B,MAAM,uDAAuD,CAAC;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAKnE,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACnC,QAAQ,EAAE,wBAAwB,CAAC;IACnC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,0FAA0F;IAC1F,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,cAAc,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iGAAiG;IACjG,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oFAAoF;IACpF,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzD;;;OAGG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,KAAK,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC;IACb,UAAU,EAAE,gBAAgB,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,yBAAyB,CAAC,CAAC,EAC7C,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC9B,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CA4FpC"}
@@ -12,7 +12,7 @@
12
12
  * verified). The prompt was calibrated in the shadow harness on real memory
13
13
  * pools (DeepSeek-v4-Flash); see .alfonso/plans/dreamer-v2-rework.md.
14
14
  */
15
- export declare const MAP_MEMORIES_SYSTEM_PROMPT = "You are a memory mapper for the magic-context system. You map project memories to the repository files that back them.\n\nA memory's BACKING FILES are the file(s) whose code the memory makes a claim about \u2014 the files you would open to check whether the memory is accurate. You do NOT judge accuracy, rewrite, or remove anything. You only LOCATE backing files.\n\nTools (read-only): read, grep, glob. Request line ranges rather than full files; use offset/limit for longer files. Each memory may come with \"Likely files\" already named in it and confirmed to exist \u2014 confirm those FIRST (cheap) instead of searching. Use search/grep to FIND code only when no likely files are given. Do not guess \u2014 confirm a file exists and genuinely backs the memory before listing it. Keep reads minimal: you do not need to read a whole file to confirm it backs a one-line claim.\n\nFor each memory decide ONE of:\n- Backing files found \u2192 the COMPLETE set of repo-relative paths whose code the memory is about.\n- File-independent \u2192 the memory describes EXTERNAL behavior (a provider / API / platform / protocol limit, e.g. \"Anthropic returns 400 on empty content\"), or a pure process / workflow / philosophy rule, with NO specific local file that backs it. A BEHAVIORAL claim (when to act, how to work, who decides, or tool-usage discipline) is file-independent even when it cites file paths or commands as examples: a named file is not the file backing the rule.\n\nOutput ONE XML manifest at the very end and NOTHING else \u2014 no narration, no per-memory commentary, no reasoning:\n<mappings>\n<memory id=\"N\" files=\"path/a.ts,path/b.ts\"/>\n<memory id=\"M\" independent=\"true\"/>\n</mappings>\n\nRules:\n- Every input memory id MUST appear exactly once.\n- files: repo-relative, comma-separated, no spaces inside a path. Only files that actually exist and genuinely back the memory.\n- A BACKING FILE is CODE that implements or handles the claim \u2014 not a file that merely mentions it. A path named inside a process directive is an action target or example, not evidence that the file backs the directive. A markdown doc (.md), a PARITY/notes file, or a test that only DESCRIBES an external fact is NOT a backing file. If the only place a memory's fact appears is prose/docs/a test (no code implements or handles it), mark it independent=\"true\".\n- Many CONSTRAINTS are HYBRID: \"external system does X, and OUR code handles it here.\" Map those to the HANDLING code (you can verify the handling, even though you can't verify the external behavior). Only mark independent when there is NO local code that implements or handles the fact.\n- Prefer the most specific file(s); do not pad with tangential files. Most memories map to one file; some to a few.\n- When you genuinely cannot find any local backing and it is not clearly external, still emit the memory with independent=\"true\" (do not drop it).";
15
+ export declare const MAP_MEMORIES_SYSTEM_PROMPT = "You are a memory mapper for the magic-context system. You map project memories to the repository files that back them.\n\nA memory's BACKING FILES are the file(s) whose code the memory makes a claim about \u2014 the files you would open to check whether the memory is accurate. You do NOT judge accuracy, rewrite, or remove anything. You only LOCATE backing files.\n\nTools (read-only): read, grep, glob. Use at most 3 tool calls per memory, including searches and reads. Never read the same file twice in a batch; reuse what you already learned. Never repeat an identical search or use broad searches such as \"fn \" or \".*\". Request one useful line range, not repeated slices. Each memory may come with \"Likely files\" from paths it names or a literal identifier search, confirmed to exist \u2014 confirm those FIRST (cheap) instead of searching. Use search/grep to FIND code only when no likely files are given. Do not guess \u2014 confirm a file exists and genuinely backs the memory before listing it. You are locating code, not exhaustively verifying the claim. If the call budget runs out before you can decide, leave that id unmapped and move on; uncertainty is not evidence of file-independence.\n\nFor each memory decide ONE of:\n- Backing files found \u2192 the specific repo-relative paths whose code the memory is about; do not chase every caller or related implementation.\n- File-independent \u2192 the memory describes EXTERNAL behavior (a provider / API / platform / protocol limit, e.g. \"Anthropic returns 400 on empty content\"), or a pure process / workflow / philosophy rule, with NO specific local file that backs it. A BEHAVIORAL claim (when to act, how to work, who decides, or tool-usage discipline) is file-independent even when it cites file paths or commands as examples: a named file is not the file backing the rule.\n\nOutput ONE XML manifest and NOTHING else \u2014 no narration, no per-memory commentary, no reasoning. Open <mappings> before investigating. Emit each <memory> element as soon as you decide its mapping, before investigating the next memory, so an interruption cannot lose completed work. Close </mappings> when finished:\n<mappings>\n<memory id=\"N\" files=\"path/a.ts,path/b.ts\"/>\n<memory id=\"M\" independent=\"true\"/>\n</mappings>\n\nRules:\n- Every decided input memory id MUST appear exactly once. Omit uncertain ids rather than inventing backing files or declaring them independent.\n- files: repo-relative, comma-separated, no spaces inside a path. Only files that actually exist and genuinely back the memory.\n- A BACKING FILE is CODE that implements or handles the claim \u2014 not a file that merely mentions it. A path named inside a process directive is an action target or example, not evidence that the file backs the directive. A markdown doc (.md), a PARITY/notes file, or a test that only DESCRIBES an external fact is NOT a backing file. If the only place a memory's fact appears is prose/docs/a test (no code implements or handles it), mark it independent=\"true\".\n- Many CONSTRAINTS are HYBRID: \"external system does X, and OUR code handles it here.\" Map those to the HANDLING code (you can verify the handling, even though you can't verify the external behavior). Only mark independent when there is NO local code that implements or handles the fact.\n- Prefer the most specific file(s); do not pad with tangential files. Most memories map to one file; some to a few.\n- Mark independent=\"true\" only for the file-independent cases above; an investigation that runs out of calls stays unmapped.";
16
16
  export declare const MAX_SEED_PATHS_PER_MEMORY = 3;
17
17
  /** Extract candidate backing-file paths a memory NAMES, keep only those that
18
18
  * EXIST in the repo, dedupe, cap. Pure host-side seeding — no LLM, no contents. */
@@ -23,6 +23,9 @@ export interface MapMemoryInput {
23
23
  content: string;
24
24
  candidates: string[];
25
25
  }
26
+ /** One bounded literal source search per batch; only paths enter the model context.
27
+ * An unavailable repository or oversized/slow search leaves path seeds intact. */
28
+ export declare function seedIdentifierCandidates(memories: MapMemoryInput[], repoDir: string): Promise<MapMemoryInput[]>;
26
29
  export declare function buildMapMemoriesPrompt(projectPath: string, memories: MapMemoryInput[]): string;
27
30
  export interface ParsedMemoryMapping {
28
31
  id: number;
@@ -40,4 +43,7 @@ export declare function parseMapMemoriesManifest(text: string): ParsedMemoryMapp
40
43
  * truncated. The mapper commits valid expected ids and retries only omissions.
41
44
  * Duplicate expected ids are rejected; duplicate unknown ids are ignored. */
42
45
  export declare function validateMapMemoriesManifest(text: string, expectedIds: ReadonlySet<number>): ParsedMemoryMapping[];
46
+ /** Recover only closed, individually valid decisions from an interrupted manifest.
47
+ * Conflicting decisions for one id are left unmapped, never resolved by guessing. */
48
+ export declare function parsePartialMapMemoriesManifest(text: string, expectedIds: ReadonlySet<number>): ParsedMemoryMapping[];
43
49
  //# sourceMappingURL=map-memories-prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"map-memories-prompt.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/map-memories-prompt.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,0BAA0B,s3FAsB4G,CAAC;AAMpJ,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAW3C;oFACoF;AACpF,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBtF;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAkB9F;AAED,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACxB;AA4BD;;;;wEAIwE;AACxE,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAmC5E;AAED;;;8EAG8E;AAC9E,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,mBAAmB,EAAE,CAQvB"}
1
+ {"version":3,"file":"map-memories-prompt.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/map-memories-prompt.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,0BAA0B,8/GAsBsF,CAAC;AAM9H,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAW3C;oFACoF;AACpF,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBtF;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB;AAID;kFACkF;AAClF,wBAAsB,wBAAwB,CAC1C,QAAQ,EAAE,cAAc,EAAE,EAC1B,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,EAAE,CAAC,CAmE3B;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAkB9F;AAED,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACxB;AA4BD;;;;wEAIwE;AACxE,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAmC5E;AAED;;;8EAG8E;AAC9E,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,mBAAmB,EAAE,CAQvB;AAED;qFACqF;AACrF,wBAAgB,+BAA+B,CAC3C,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,mBAAmB,EAAE,CAqBvB"}
@@ -18,7 +18,7 @@ export declare const MAP_BATCH_FLOOR_MS = 240000;
18
18
  * parse miss used to persist `independent=true` for memories that name real
19
19
  * files; those rows never enter verify. Heal at most one extra batch so new
20
20
  * unmapped memories stay first in line. */
21
- export declare const MAX_INDEPENDENT_REQUEUE_PER_RUN = 20;
21
+ export declare const MAX_INDEPENDENT_REQUEUE_PER_RUN = 5;
22
22
  export interface MapMemoriesArgs {
23
23
  db: Database;
24
24
  client?: PluginContext["client"];
@@ -67,7 +67,7 @@ export declare function shouldRequeueIndependentMapping(state: {
67
67
  /** Unmapped active memories first, then a bounded heal of corrupted
68
68
  * independent rows. Exported so tests can assert the re-queue predicate
69
69
  * without standing up a child session. */
70
- export declare function selectMapMemoryInputs(db: Database, projectIdentity: string, repoDir: string): MapMemoryInput[];
70
+ export declare function selectMapMemoryInputs(db: Database, projectIdentity: string, repoDir: string, includeDeferred?: boolean): MapMemoryInput[];
71
71
  export declare function mapMemories(args: MapMemoriesArgs): Promise<MapMemoriesResult>;
72
72
  /** Parse a complete manifest and commit the entries that belong to this batch.
73
73
  * A closed root proves the parser did not see a truncated prefix, so omitted ids
@@ -1 +1 @@
1
- {"version":3,"file":"map-memories.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/map-memories.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AACtG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAS3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAIH,KAAK,mBAAmB,EAG3B,MAAM,WAAW,CAAC;AAKnB,OAAO,EAAE,KAAK,gBAAgB,EAA6C,MAAM,SAAS,CAAC;AAE3F,OAAO,EAIH,KAAK,cAAc,EAItB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAEH,KAAK,kBAAkB,EAE1B,MAAM,gBAAgB,CAAC;AA0BxB;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,SAAU,CAAC;AAO1C;;;4CAG4C;AAC5C,eAAO,MAAM,+BAA+B,KAAiB,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjC,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,cAAc,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM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,MAAM,GACrB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAOlD"}
@@ -28,4 +28,6 @@ export declare function selectPrimerOriginCandidate(db: Database, primer: Primer
28
28
  * registered for the session; Pi never falls back to OpenCode's store.
29
29
  */
30
30
  export declare function buildPrimerSeed(db: Database, primer: Primer): PrimerSeed;
31
+ /** Await historical messages, render U:/TC: orientation, and fall back to compartment P1 if absent. */
32
+ export declare function buildPrimerSeedAsync(db: Database, primer: Primer): Promise<PrimerSeed>;
31
33
  //# sourceMappingURL=primer-seed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"primer-seed.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/primer-seed.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAA4B,KAAK,MAAM,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEjG;;0BAE0B;AAC1B,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,MAAM,WAAW,UAAU;IACvB;mDAC+C;IAC/C,IAAI,EAAE,KAAK,GAAG,aAAa,CAAC;IAC5B,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAkED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACvC,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,MAAM,GACf,eAAe,GAAG,SAAS,CAI7B;AAgDD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAuCxE"}
1
+ {"version":3,"file":"primer-seed.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/primer-seed.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAA4B,KAAK,MAAM,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEjG;;0BAE0B;AAC1B,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,MAAM,WAAW,UAAU;IACvB;mDAC+C;IAC/C,IAAI,EAAE,KAAK,GAAG,aAAa,CAAC;IAC5B,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAsED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACvC,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,MAAM,GACf,eAAe,GAAG,SAAS,CAI7B;AAgDD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAMxE;AAED,uGAAuG;AACvG,wBAAsB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAuB5F"}
@@ -29,8 +29,8 @@ export interface RefreshPrimersArgs {
29
29
  * (JSONL), so the orientation seed read works on Pi-only installs where there
30
30
  * is no opencode.db. OpenCode leaves this undefined — the seed read falls to
31
31
  * the read-only opencode.db path. Returning null → closed-book fallback.
32
- * May be async (Pi JSONL discovery is async); the returned provider serves
33
- * synchronous summary pages without retaining the historical transcript.
32
+ * May be async (Pi JSONL discovery is async); background seed assembly prefers
33
+ * its async range reader without retaining the historical transcript.
34
34
  */
35
35
  rawProviderFactory?: (sessionId: string) => Promise<RawMessageProvider | null> | RawMessageProvider | null;
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"storage-clone.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/stor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C3C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,OAAO,CAAC;CAClC;AAoYD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACpC,EAAE,EAAE,QAAQ,EACZ,eAAe,EAAE,MAAM,EACvB,oBAAoB,EAAE,MAAM,EAC5B,MAAM,EAAE,uBAAuB,GAChC,8BAA8B,CAuUhC"}
1
+ {"version":3,"file":"storage-clone.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage-clone.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAwBpD,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACpC,0FAA0F;IAC1F,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9D,UAAU,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC;IACtC,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7C,oEAAoE;IACpE,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,uFAAuF;IACvF,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,KAAK,MAAM,CAAC;IACrE,2EAA2E;IAC3E,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,qEAAqE;IACrE,UAAU,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC3D,qBAAqB,CACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,kBAAkB,EAAE,SAAS,mBAAmB,EAAE,GACnD,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,8BAA8B;IAC3C,IAAI,EAAE,UAAU,GAAG,uBAAuB,CAAC;IAC3C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,OAAO,CAAC;CAClC;AA8YD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACpC,EAAE,EAAE,QAAQ,EACZ,eAAe,EAAE,MAAM,EACvB,oBAAoB,EAAE,MAAM,EAC5B,MAAM,EAAE,uBAAuB,GAChC,8BAA8B,CA6UhC"}
@@ -524,13 +524,18 @@ export declare function addStaleReduceStrippedIds(db: Database, sessionId: strin
524
524
  * because the empty sentinel is filtered off the Anthropic wire).
525
525
  */
526
526
  export declare function getProcessedImageStrippedIds(db: Database, sessionId: string): Set<string>;
527
+ export type ProcessedImageMarker = "" | "[image stripped]";
528
+ /** Old string arrays stored message ids rendered with empty text; provider switches must preserve that text. */
529
+ export declare function parseProcessedImageMarkers(raw: string | null | undefined): Map<string, ProcessedImageMarker>;
530
+ export declare function serializeProcessedImageMarkers(markers: ReadonlyMap<string, ProcessedImageMarker>): string;
531
+ export declare function getProcessedImageMarkers(db: Database, sessionId: string): Map<string, ProcessedImageMarker>;
527
532
  /**
528
533
  * CAS-merge new processed-image message ids into the frozen set, retrying on a
529
534
  * concurrent write so sibling processes sharing the session DB merge instead of
530
535
  * clobbering. Returns true when the set ended in the intended state (incl.
531
536
  * no-op), false only when retries were exhausted.
532
537
  */
533
- export declare function addProcessedImageStrippedIds(db: Database, sessionId: string, ids: Iterable<string>): boolean;
538
+ export declare function addProcessedImageStrippedIds(db: Database, sessionId: string, ids: Iterable<string>, marker?: ProcessedImageMarker | ReadonlyMap<string, ProcessedImageMarker>): boolean;
534
539
  /**
535
540
  * Payload stored in `session_meta.pending_compaction_marker_state` between
536
541
  * a background historian/compressor publish and its consuming pass in the
@@ -572,6 +577,7 @@ export declare function getCompactionMarkerHealth(db: Database, sessionId: strin
572
577
  export interface PostprocessReplaySnapshot {
573
578
  staleReduceStrippedIds: Set<string>;
574
579
  processedImageStrippedIds: Set<string>;
580
+ processedImageMarkers: Map<string, ProcessedImageMarker>;
575
581
  strippedPlaceholderIds: Set<string>;
576
582
  hiddenSeamPlaceholderIds: Set<string>;
577
583
  noteNudgeAnchors: NoteNudgeAnchor[];
@@ -626,8 +632,9 @@ export interface PendingPiCompactionMarker {
626
632
  publishedAt: number;
627
633
  }
628
634
  export declare function getPendingPiCompactionMarkerState(db: Database, sessionId: string): PendingPiCompactionMarker | null;
629
- export declare function setPendingPiCompactionMarkerState(db: Database, sessionId: string, state: PendingPiCompactionMarker | null): void;
630
- export declare function clearPendingPiCompactionMarkerStateIf(db: Database, sessionId: string, expected: PendingPiCompactionMarker): boolean;
635
+ export declare function setPendingPiCompactionMarkerState(db: Database, sessionId: string, state: PendingPiCompactionMarker | null, clearReason?: string): void;
636
+ export declare function clearPendingPiCompactionMarkerStateIf(db: Database, sessionId: string, expected: PendingPiCompactionMarker, reason?: string | null): boolean;
637
+ export declare function logPiCompactionMarkerClear(sessionId: string, marker: PendingPiCompactionMarker, reason: string): void;
631
638
  export declare function getSessionsWithPendingPiMarker(db: Database): string[];
632
639
  /**
633
640
  * List all sessions with a deferred marker still pending. Used at hook init