@cortexkit/pi-magic-context 0.49.6 → 0.49.8

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 (50) hide show
  1. package/dist/auto-search-worker.js +10 -7
  2. package/dist/{compaction-marker-candidates-9w5g66at.js → compaction-marker-candidates-n4dphyz4.js} +3 -3
  3. package/dist/compaction-marker-candidates-worker.js +2 -2
  4. package/dist/embedding-backfill-chva00z3.js +20 -0
  5. package/dist/embedding-worker-process.js +6 -2
  6. package/dist/embedding-worker.js +6 -5
  7. package/dist/historian-calibration-extension.js +1 -1
  8. package/dist/{index-j7pa3t4s.js → index-18qe4gs1.js} +113 -27
  9. package/dist/{index-0j0zqb4t.js → index-3veejgp8.js} +1 -1
  10. package/dist/{index-0vrkp1jq.js → index-43zqh10z.js} +1 -1
  11. package/dist/{index-r56xgha8.js → index-4pxydwvg.js} +1 -1
  12. package/dist/{index-5rc9kvrk.js → index-4vj37yw9.js} +4 -3
  13. package/dist/{index-fcacf11g.js → index-54r5vs9w.js} +4 -4
  14. package/dist/{index-cd6bjrj4.js → index-6e3yv1jt.js} +4 -4
  15. package/dist/{index-swab4319.js → index-729kkhmf.js} +4 -3
  16. package/dist/{index-gc2749rx.js → index-8yjhda46.js} +9 -6
  17. package/dist/{index-8vbh4tzw.js → index-asrxgdt4.js} +63 -19
  18. package/dist/{index-wf7mwdnf.js → index-fdxzpnbj.js} +2 -2
  19. package/dist/{index-kamhcj15.js → index-gqxsds3q.js} +6 -3
  20. package/dist/{index-x3dcnxh0.js → index-gycf3sp7.js} +5 -1
  21. package/dist/{index-kxxdyjfs.js → index-hy44m6jc.js} +1 -1
  22. package/dist/{index-0p9gemc6.js → index-jsyjxgfy.js} +172 -36
  23. package/dist/{index-290tzwp1.js → index-kh3jt7t9.js} +1 -1
  24. package/dist/{index-hfnjfk4d.js → index-pdhbj18g.js} +71 -70
  25. package/dist/{index-fx0r5485.js → index-qc8e13wc.js} +22 -22
  26. package/dist/{index-9mn34fnx.js → index-r8cy8hmq.js} +5 -5
  27. package/dist/{index-57mvvbbh.js → index-rggtvnbg.js} +40 -29
  28. package/dist/{index-21v1kfs7.js → index-szh001qb.js} +6 -3
  29. package/dist/{index-cyrnv16r.js → index-ta0ed2nc.js} +2 -0
  30. package/dist/{index-5z1h0qsa.js → index-tdhppxwd.js} +9 -9
  31. package/dist/{index-p4matwj0.js → index-v26j81w6.js} +5 -5
  32. package/dist/{index-mcgehvgw.js → index-zzn7qbps.js} +1 -1
  33. package/dist/index.js +1071 -390
  34. package/dist/{logger-j6tecd1h.js → logger-qg51hmp7.js} +1 -1
  35. package/dist/{message-index-m6snq0fh.js → message-index-1wta074c.js} +14 -14
  36. package/dist/{message-index-bounded-8a94k72f.js → message-index-bounded-ss3ctdwb.js} +14 -14
  37. package/dist/{message-time-backfill-xqwg3hg1.js → message-time-backfill-q9s88zdv.js} +3 -3
  38. package/dist/migration-worker.js +10 -10
  39. package/dist/{project-embedding-registry-3x6nmszv.js → project-embedding-registry-bxawck58.js} +11 -11
  40. package/dist/raw-ordinal-warmup-worker.js +17 -15
  41. package/dist/{read-session-chunk-49e1ayzs.js → read-session-chunk-1jagnq05.js} +11 -9
  42. package/dist/{read-session-raw-545mgtjz.js → read-session-raw-hm7ptnrh.js} +3 -3
  43. package/dist/{safe-notification-target-vn9kpmv4.js → safe-notification-target-62ty6rvp.js} +2 -2
  44. package/dist/{search-q76dp7w9.js → search-x7cachq0.js} +21 -21
  45. package/dist/{sqlite-wp7wddw3.js → sqlite-adjpy399.js} +3 -1
  46. package/dist/{storage-memory-7417pbm9.js → storage-memory-axnsk5t1.js} +2 -2
  47. package/dist/{storage-tags-cvjsrbqh.js → storage-tags-6j5s2q49.js} +5 -5
  48. package/dist/subagent-entry.js +24 -24
  49. package/package.json +1 -1
  50. package/dist/embedding-backfill-809pgwvb.js +0 -20
@@ -7,7 +7,7 @@ import {
7
7
  getMagicContextStorageDir,
8
8
  log2,
9
9
  sessionLog2
10
- } from "./index-x3dcnxh0.js";
10
+ } from "./index-gycf3sp7.js";
11
11
  import {
12
12
  piModelRefToCanonical,
13
13
  modelRefLookupOrder,
@@ -20,7 +20,7 @@ import {
20
20
  PER_HARNESS_MODEL_KEYS,
21
21
  ConfigProfilesSchema,
22
22
  MagicContextConfigSchema
23
- } from "./index-cyrnv16r.js";
23
+ } from "./index-ta0ed2nc.js";
24
24
  import {
25
25
  MERGED_REASONING_PARTS_PREFIX,
26
26
  decodeMergedReasoningParts,
@@ -44,14 +44,19 @@ import {
44
44
  serializeStrippedPlaceholderState,
45
45
  THINKING_BINDING_RECOVERY_FROZEN_PREFIX,
46
46
  THINKING_BINDING_STRIP_ORDER_END_MARKER,
47
+ parseProcessedImageMarkers,
48
+ serializeProcessedImageMarkers,
49
+ getPendingPiCompactionMarkerState,
50
+ logPiCompactionMarkerClear,
47
51
  withReadOnlySessionDb,
48
52
  expandToolPart,
49
53
  hasRawMessageProvider2,
50
54
  setRawMessageProvider2,
51
55
  visitRawSessionMessages2,
56
+ readRawSessionMessageIdOrdinalsForRange2,
52
57
  readRawSessionMessageById2,
53
58
  readSessionChunk2
54
- } from "./index-j7pa3t4s.js";
59
+ } from "./index-18qe4gs1.js";
55
60
  import {
56
61
  isRecord,
57
62
  providerVisibleMessage,
@@ -65,31 +70,32 @@ import {
65
70
  getTagNumberByMessageId2,
66
71
  getTagsBySession2,
67
72
  getTagById2
68
- } from "./index-fcacf11g.js";
73
+ } from "./index-54r5vs9w.js";
69
74
  import {
70
75
  estimateTokens
71
- } from "./index-r56xgha8.js";
76
+ } from "./index-4pxydwvg.js";
72
77
  import {
78
+ inRootAsyncContext2,
73
79
  Database2,
74
80
  withSqliteBackgroundWriter2,
75
81
  withoutSqliteTransformPass2
76
- } from "./index-8vbh4tzw.js";
82
+ } from "./index-asrxgdt4.js";
77
83
  import {
78
84
  stableStringify,
79
85
  closeQuietly,
80
86
  getTableColumnNames
81
- } from "./index-mcgehvgw.js";
87
+ } from "./index-zzn7qbps.js";
82
88
  import {
83
89
  resolveOpenCodeDbPath,
84
90
  assertOpenCodeStoreGeneration
85
91
  } from "./index-8976mezv.js";
86
92
  import {
87
93
  noteRawSessionSummaryRowWritten2
88
- } from "./index-5rc9kvrk.js";
94
+ } from "./index-4vj37yw9.js";
89
95
  import {
90
96
  piHarnessKindFromExecutable,
91
97
  isPidAlive
92
- } from "./index-0j0zqb4t.js";
98
+ } from "./index-3veejgp8.js";
93
99
  import {
94
100
  BoundedSessionMap,
95
101
  clearLkgFenceProcessState,
@@ -97,20 +103,20 @@ import {
97
103
  clearLkgRecoveryFence,
98
104
  deleteSessionScopedRows,
99
105
  getLastIndexedOrdinal2
100
- } from "./index-5z1h0qsa.js";
106
+ } from "./index-tdhppxwd.js";
101
107
  import {
102
108
  SubcClient,
103
109
  connectionFileExists,
104
110
  SYNAPSE_DEFAULT_MODEL,
105
111
  toSynapseLaneDescriptor,
106
112
  SynapseEmbeddingProvider
107
- } from "./index-21v1kfs7.js";
113
+ } from "./index-szh001qb.js";
108
114
  import {
109
115
  sameProjectDirectory
110
- } from "./index-wf7mwdnf.js";
116
+ } from "./index-fdxzpnbj.js";
111
117
  import {
112
118
  getErrorMessage
113
- } from "./index-57mvvbbh.js";
119
+ } from "./index-rggtvnbg.js";
114
120
  import {
115
121
  V2_MEMORY_CATEGORIES,
116
122
  CATEGORY_PRIORITY,
@@ -124,13 +130,13 @@ import {
124
130
  expandWorkspaceIdentitySetWithAliases,
125
131
  resolveStoredPathWorkspaceIdentity,
126
132
  storedPathBelongsToWorkspace
127
- } from "./index-9mn34fnx.js";
133
+ } from "./index-r8cy8hmq.js";
128
134
  import {
129
135
  directoryHasGitMetadata,
130
136
  resolveProjectIdentityForSession,
131
137
  normalizeStoredProjectPath,
132
138
  storedPathBelongsToIdentity
133
- } from "./index-kamhcj15.js";
139
+ } from "./index-gqxsds3q.js";
134
140
  import {
135
141
  drainBackgroundBatches,
136
142
  markProjectLoadUntrusted2,
@@ -142,7 +148,7 @@ import {
142
148
  unregisterProjectEmbedding2,
143
149
  getProjectEmbeddingSnapshot2,
144
150
  embedTextForProject2
145
- } from "./index-fx0r5485.js";
151
+ } from "./index-qc8e13wc.js";
146
152
  import {
147
153
  getNoteByIdInScope,
148
154
  getNotes,
@@ -153,12 +159,13 @@ import {
153
159
  updateNote,
154
160
  dismissNotes,
155
161
  dismissNote,
162
+ withMessageFtsSessionFilter,
156
163
  createUnifiedSearchDiagnostics2,
157
164
  parseIdShapedQuery2,
158
165
  resolveMemoriesByIdsForSearch2,
159
166
  unifiedSearch2,
160
167
  formatSearchResults2
161
- } from "./index-hfnjfk4d.js";
168
+ } from "./index-pdhbj18g.js";
162
169
  import {
163
170
  computeCueContentHash,
164
171
  getMuralCueState,
@@ -174,7 +181,7 @@ import {
174
181
  supersededMemory2,
175
182
  mergeMemoryStats2,
176
183
  archiveMemory2
177
- } from "./index-kxxdyjfs.js";
184
+ } from "./index-hy44m6jc.js";
178
185
  import {
179
186
  saveEmbedding,
180
187
  invalidateMemory2
@@ -183,13 +190,13 @@ import {
183
190
  isMarkerCandidateBasisCurrent2,
184
191
  invalidateMarkerCandidateBasis2,
185
192
  readMarkerCandidateBasis2
186
- } from "./index-swab4319.js";
193
+ } from "./index-729kkhmf.js";
187
194
  import {
188
195
  computeNormalizedHash
189
196
  } from "./index-9x1f96r8.js";
190
197
  import {
191
198
  logSlowWriteTransaction
192
- } from "./index-0vrkp1jq.js";
199
+ } from "./index-43zqh10z.js";
193
200
  import {
194
201
  ensureStorageDirectorySync,
195
202
  writeStorageFileAtomicSync
@@ -4206,7 +4213,7 @@ var V2_MESSAGE_PAGE_SQL = `WITH bounds AS (
4206
4213
  SELECT seq FROM session_message
4207
4214
  WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
4208
4215
  ORDER BY seq ASC LIMIT 1 OFFSET ?
4209
- ), -1) END AS after_seq,
4216
+ ), (SELECT MAX(seq) FROM session_message WHERE session_id = ?), -1) END AS after_seq,
4210
4217
  COALESCE((
4211
4218
  SELECT seq FROM session_message
4212
4219
  WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
@@ -4408,7 +4415,7 @@ class V2StoreReader {
4408
4415
  }
4409
4416
  }
4410
4417
  const maximumSeq = Number.MAX_SAFE_INTEGER;
4411
- const rows = this.prepare(V2_MESSAGE_PAGE_SQL).all(afterOrdinal, sessionID, ...RAW_MESSAGE_TYPES, Math.max(0, afterOrdinal - 1), sessionID, ...RAW_MESSAGE_TYPES, finalWatermark - 1, maximumSeq, sessionID, ...RAW_MESSAGE_TYPES, pageSize);
4418
+ const rows = this.prepare(V2_MESSAGE_PAGE_SQL).all(afterOrdinal, sessionID, ...RAW_MESSAGE_TYPES, Math.max(0, afterOrdinal - 1), sessionID, sessionID, ...RAW_MESSAGE_TYPES, finalWatermark - 1, maximumSeq, sessionID, ...RAW_MESSAGE_TYPES, pageSize);
4412
4419
  return rows.map(decode);
4413
4420
  });
4414
4421
  }
@@ -4912,13 +4919,17 @@ async function retryPendingRustSessionCleanupsForProject(db, projectPath, delete
4912
4919
  function clearSession(db, sessionId, rustModuleCleanupAcknowledged = false, permanentlyDeleted = false) {
4913
4920
  cancelAutoSearchWork(sessionId);
4914
4921
  let transactionStartedAt = 0;
4922
+ let clearedMarker = null;
4915
4923
  withoutSqliteTransformPass2(() => withSqliteBackgroundWriter2(() => db.transaction(() => {
4916
4924
  transactionStartedAt = performance.now();
4925
+ clearedMarker = getPendingPiCompactionMarkerState(db, sessionId);
4917
4926
  deleteSessionScopedRows(db, [sessionId], undefined, {
4918
4927
  rustModuleCleanupAcknowledged,
4919
4928
  preserveTagRevisionTombstones: !permanentlyDeleted
4920
4929
  });
4921
4930
  }).immediate()));
4931
+ if (clearedMarker)
4932
+ logPiCompactionMarkerClear(sessionId, clearedMarker, "session-reset");
4922
4933
  clearUnpublishedAutoSearchNoHints(sessionId);
4923
4934
  logSlowWriteTransaction("clear-session", transactionStartedAt);
4924
4935
  }
@@ -5701,6 +5712,9 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
5701
5712
  }
5702
5713
  const layout = layoutLkgPrefix(slot.jsonPrefix);
5703
5714
  try {
5715
+ const inputIdSeq = JSON.stringify(slot.piOutputEntryIds ? { version: 1, inputIds: slot.inputIdSeq, piOutputEntryIds: slot.piOutputEntryIds } : slot.inputIdSeq);
5716
+ const inputContentDigests = JSON.stringify(slot.inputContentDigests);
5717
+ const inputContentSignatures = slot.inputContentSignatures ? JSON.stringify(slot.inputContentSignatures) : null;
5704
5718
  db.transaction(() => {
5705
5719
  const storedHashes = new Map;
5706
5720
  for (const row of db.prepare("SELECT chunk, hash FROM lkg_slot_chunks WHERE session_id = ?").all(sessionId)) {
@@ -5732,11 +5746,7 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
5732
5746
  provider_key = excluded.provider_key,
5733
5747
  captured_at = excluded.captured_at,
5734
5748
  row_version = excluded.row_version,
5735
- capture_sequence = excluded.capture_sequence`).run(sessionId, layout.chars, layout.chunks.length, layout.hash, JSON.stringify(slot.piOutputEntryIds ? {
5736
- version: 1,
5737
- inputIds: slot.inputIdSeq,
5738
- piOutputEntryIds: slot.piOutputEntryIds
5739
- } : slot.inputIdSeq), JSON.stringify(slot.inputContentDigests), slot.inputContentSignatures ? JSON.stringify(slot.inputContentSignatures) : null, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
5749
+ capture_sequence = excluded.capture_sequence`).run(sessionId, layout.chars, layout.chunks.length, layout.hash, inputIdSeq, inputContentDigests, inputContentSignatures, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
5740
5750
  publishMetadata?.();
5741
5751
  }).immediate();
5742
5752
  rememberFingerprint(db, sessionId, fingerprint);
@@ -7234,6 +7244,9 @@ function filterIdBlob(raw, filter) {
7234
7244
  return "";
7235
7245
  }
7236
7246
  }
7247
+ function filterProcessedImageBlob(raw, filter) {
7248
+ return serializeProcessedImageMarkers(new Map([...parseProcessedImageMarkers(raw)].filter(([id]) => filter.includeMessageId(id)).map(([id, marker]) => [mapMessageId(filter, id) ?? id, marker])));
7249
+ }
7237
7250
  function filterStrippedPlaceholderBlob(raw, filter) {
7238
7251
  const state = parseStrippedPlaceholderState(raw);
7239
7252
  const keep = (ids) => ids.filter((id) => filter.includeMessageId(id)).map((id) => mapMessageId(filter, id) ?? id);
@@ -7315,7 +7328,8 @@ function clampWatermark(value, maxCopiedTag) {
7315
7328
  return Math.min(Math.floor(value), maxCopiedTag);
7316
7329
  }
7317
7330
  function copySessionStateForClone(db, sourceSessionId, destinationSessionId, filter) {
7318
- return runImmediate(db, () => {
7331
+ let clearedMarker = null;
7332
+ const result = runImmediate(db, () => {
7319
7333
  const hasTemporalDecisions = tableExists(db, "temporal_decisions");
7320
7334
  if (filter.requireEmptyDestinationMeta === true && countRows(db, "session_meta", destinationSessionId) > 0 || countRows(db, "compartments", destinationSessionId) > 0 || countRows(db, "tags", destinationSessionId) > 0 || hasTemporalDecisions && countRows(db, "temporal_decisions", destinationSessionId) > 0 || filter.copySessionNotesAndFacts === true && (tableExists(db, "notes") && countRows(db, "notes", destinationSessionId) > 0 || tableExists(db, "session_facts") && countRows(db, "session_facts", destinationSessionId) > 0)) {
7321
7335
  return {
@@ -7427,6 +7441,8 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
7427
7441
  FROM session_meta WHERE session_id = ?`).get(sourceSessionId);
7428
7442
  const maxCopiedTag = copiedTagNumbers.reduce((max, value) => Math.max(max, value), 0);
7429
7443
  const pendingMarker = filter.selectPendingPiMarker(meta?.pending_pi_compaction_marker_state ?? null, copiedCompartments);
7444
+ if (pendingMarker === null)
7445
+ clearedMarker = getPendingPiCompactionMarkerState(db, destinationSessionId);
7430
7446
  const todoAnchor = meta?.todo_synthetic_anchor_message_id ?? "";
7431
7447
  const migrateTodo = todoAnchor.length > 0 && filter.includeMessageId(todoAnchor);
7432
7448
  db.prepare(`INSERT INTO session_meta
@@ -7453,7 +7469,7 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
7453
7469
  todo_synthetic_anchor_message_id = excluded.todo_synthetic_anchor_message_id,
7454
7470
  todo_synthetic_state_json = excluded.todo_synthetic_state_json,
7455
7471
  cached_m0_bytes = NULL,
7456
- cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null, filter), filterIdBlob(meta?.stale_reduce_stripped_ids ?? null, filter), filterIdBlob(meta?.processed_image_stripped_ids ?? null, filter), clonePiContentDecisions(meta?.merged_reasoning_stripped_ids ?? null, filter), pendingMarker, migrateTodo ? meta?.last_todo_state ?? "" : "", migrateTodo ? meta?.todo_synthetic_call_id ?? "" : "", migrateTodo ? mapMessageId(filter, todoAnchor) ?? "" : "", migrateTodo ? meta?.todo_synthetic_state_json ?? "" : "");
7472
+ cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null, filter), filterIdBlob(meta?.stale_reduce_stripped_ids ?? null, filter), filterProcessedImageBlob(meta?.processed_image_stripped_ids ?? null, filter), clonePiContentDecisions(meta?.merged_reasoning_stripped_ids ?? null, filter), pendingMarker, migrateTodo ? meta?.last_todo_state ?? "" : "", migrateTodo ? meta?.todo_synthetic_call_id ?? "" : "", migrateTodo ? mapMessageId(filter, todoAnchor) ?? "" : "", migrateTodo ? meta?.todo_synthetic_state_json ?? "" : "");
7457
7473
  const metaColumnRows = db.prepare("PRAGMA table_info(session_meta)").all();
7458
7474
  const metaColumns = new Set(metaColumnRows.map((column) => column.name));
7459
7475
  if (metaColumns.has("trailing_blank_decisions")) {
@@ -7471,6 +7487,9 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
7471
7487
  pendingMarkerMigrated: pendingMarker !== null
7472
7488
  };
7473
7489
  });
7490
+ if (clearedMarker)
7491
+ logPiCompactionMarkerClear(destinationSessionId, clearedMarker, "clone-replaced");
7492
+ return result;
7474
7493
  }
7475
7494
  // ../plugin/src/features/magic-context/historian-failure-reason.ts
7476
7495
  var MAX_HISTORIAN_FAILURE_REASON_LENGTH = 512;
@@ -8262,7 +8281,47 @@ function unreachablePiOrdinalSlot(ordinal) {
8262
8281
  });
8263
8282
  return slot;
8264
8283
  }
8284
+ var READ_ENTRY = Symbol("read Pi entry");
8285
+ var END_ENTRIES = Symbol("end Pi entries");
8265
8286
  function* iterateEntriesToRawMessageRange(entries, afterOrdinal, limit, finalWatermark, ordinalOffset = 0) {
8287
+ const input = entries[Symbol.iterator]();
8288
+ const converter = convertEntryStream(afterOrdinal, limit, finalWatermark, ordinalOffset);
8289
+ let next;
8290
+ try {
8291
+ while (true) {
8292
+ const step = converter.next(next);
8293
+ if (step.done)
8294
+ return;
8295
+ if (step.value === READ_ENTRY) {
8296
+ const entry = input.next();
8297
+ next = entry.done ? END_ENTRIES : entry.value;
8298
+ } else
8299
+ yield step.value;
8300
+ }
8301
+ } finally {
8302
+ input.return?.();
8303
+ }
8304
+ }
8305
+ async function* iterateAsyncEntriesToRawMessageRange(entries, afterOrdinal, limit, finalWatermark) {
8306
+ const input = entries[Symbol.asyncIterator]();
8307
+ const converter = convertEntryStream(afterOrdinal, limit, finalWatermark, 0);
8308
+ let next;
8309
+ try {
8310
+ while (true) {
8311
+ const step = converter.next(next);
8312
+ if (step.done)
8313
+ return;
8314
+ if (step.value === READ_ENTRY) {
8315
+ const entry = await input.next();
8316
+ next = entry.done ? END_ENTRIES : entry.value;
8317
+ } else
8318
+ yield step.value;
8319
+ }
8320
+ } finally {
8321
+ await input.return?.();
8322
+ }
8323
+ }
8324
+ function* convertEntryStream(afterOrdinal, limit, finalWatermark, ordinalOffset = 0) {
8266
8325
  let emitted = 0;
8267
8326
  const normalizedAfter = Math.max(0, Math.floor(afterOrdinal));
8268
8327
  const normalizedLimit = Math.max(1, Math.floor(limit));
@@ -8299,7 +8358,10 @@ function* iterateEntriesToRawMessageRange(entries, afterOrdinal, limit, finalWat
8299
8358
  }
8300
8359
  return emitted >= normalizedLimit || nextOrdinal > normalizedWatermark;
8301
8360
  };
8302
- for (const entry of entries) {
8361
+ while (true) {
8362
+ const entry = yield READ_ENTRY;
8363
+ if (entry === END_ENTRIES)
8364
+ break;
8303
8365
  if (!isMessageEntry(entry))
8304
8366
  continue;
8305
8367
  const msg = entry.message;
@@ -9788,7 +9850,7 @@ function resolveMuralWire(db, projectIdentity, modelKey, enabled, budgetTokens =
9788
9850
 
9789
9851
  // ../plugin/src/features/magic-context/compaction-marker.ts
9790
9852
  import { createHash as createHash7 } from "node:crypto";
9791
- import { existsSync as existsSync6 } from "node:fs";
9853
+ import { existsSync as existsSync6, statSync as statSync6 } from "node:fs";
9792
9854
  var BASE62_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
9793
9855
  var ID_PREFIX_HEX_LENGTH = 12;
9794
9856
  var ID_SUFFIX_LENGTH = 14;
@@ -9823,6 +9885,7 @@ var MARKER_REMOVAL_BUSY_TIMEOUT_MS = 5000;
9823
9885
  function runMarkerWriteTransaction(db, site, operation) {
9824
9886
  if (db.inTransaction)
9825
9887
  return db.transaction(operation).immediate();
9888
+ const walBefore = markerWalPages(db);
9826
9889
  const startedAt = performance.now();
9827
9890
  let acquiredAt;
9828
9891
  let workFinishedAt;
@@ -9846,9 +9909,22 @@ function runMarkerWriteTransaction(db, site, operation) {
9846
9909
  const endMs = workFinishedAt === undefined ? 0 : finishedAt - workFinishedAt;
9847
9910
  try {
9848
9911
  log2(`[magic-context] sqlite writer site=${site} db=opencode acquire_ms=${Math.round(acquireMs)} hold_ms=${Math.round(holdMs)} work_ms=${Math.round(workMs)} end_ms=${Math.round(endMs)} outcome=${acquiredAt === undefined ? "not_acquired" : committed ? "committed" : "failed"}`);
9912
+ if (finishedAt - startedAt > 100) {
9913
+ const autoCheckpoint = db.prepare("PRAGMA wal_autocheckpoint").get();
9914
+ log2(`[magic-context] compaction-marker slow writer site=${site} acquire_ms=${acquireMs.toFixed(1)} statements_ms=${workMs.toFixed(1)} ${committed ? "commit" : "rollback"}_ms=${endMs.toFixed(1)} wal_autocheckpoint=${autoCheckpoint.wal_autocheckpoint} wal_pages_before=${walBefore ?? "unknown"} wal_pages_after=${markerWalPages(db) ?? "unknown"}`);
9915
+ }
9849
9916
  } catch {}
9850
9917
  }
9851
9918
  }
9919
+ function markerWalPages(db) {
9920
+ try {
9921
+ const row = db.prepare("PRAGMA page_size").get();
9922
+ const bytes = statSync6(`${getOpenCodeDbPath()}-wal`).size;
9923
+ return Math.max(0, Math.floor((bytes - 32) / (row.page_size + 24)));
9924
+ } catch {
9925
+ return null;
9926
+ }
9927
+ }
9852
9928
  var REQUIRED_MESSAGE_COLUMNS = ["id", "session_id", "time_created", "time_updated", "data"];
9853
9929
  var REQUIRED_PART_COLUMNS = [
9854
9930
  "id",
@@ -9909,6 +9985,7 @@ function getWritableOpenCodeDb(purpose = "publication") {
9909
9985
  const timeoutMs = purpose === "removal" ? MARKER_REMOVAL_BUSY_TIMEOUT_MS : MARKER_BUSY_TIMEOUT_MS;
9910
9986
  db.exec(`PRAGMA busy_timeout=${timeoutMs}`);
9911
9987
  db.exec("PRAGMA journal_mode=WAL");
9988
+ db.exec("PRAGMA wal_autocheckpoint=0");
9912
9989
  if (purpose === "removal")
9913
9990
  cachedRemovalDb = { path: dbPath, db };
9914
9991
  else
@@ -10987,10 +11064,10 @@ async function probeWakePlaneCatalog() {
10987
11064
  if (!await connectionFileExists(file)) {
10988
11065
  throw new Error("subc connection is not configured");
10989
11066
  }
10990
- const client = await SubcClient.connect({
11067
+ const client = await inRootAsyncContext2(() => SubcClient.connect({
10991
11068
  connectionFile: file,
10992
11069
  handshakeTimeoutMs: WAKE_PLANE_HANDSHAKE_TIMEOUT_MS
10993
- });
11070
+ }));
10994
11071
  try {
10995
11072
  return await client.catalogList();
10996
11073
  } finally {
@@ -11028,7 +11105,7 @@ async function wakePlaneStatus() {
11028
11105
  }
11029
11106
 
11030
11107
  // src/embedding-bootstrap.ts
11031
- import { statSync as statSync6 } from "node:fs";
11108
+ import { statSync as statSync7 } from "node:fs";
11032
11109
 
11033
11110
  // ../plugin/src/plugin/embedding-bootstrap-helpers.ts
11034
11111
  import { createHash as createHash8 } from "node:crypto";
@@ -11740,7 +11817,7 @@ function configCandidatePaths(directory, loadedPaths) {
11740
11817
  function configFingerprint(paths) {
11741
11818
  return paths.map((path) => {
11742
11819
  try {
11743
- const stat = statSync6(path);
11820
+ const stat = statSync7(path);
11744
11821
  return `${path}:${stat.size}:${stat.mtimeMs}`;
11745
11822
  } catch {
11746
11823
  return `${path}:missing`;
@@ -12560,6 +12637,56 @@ function renderItemByTag(db, sessionId, number, textIndexDomain = "part") {
12560
12637
  return selected ? renderPartFull(selected) ?? "" : `Tag ${number}'s original text part is no longer in stored history.`;
12561
12638
  }
12562
12639
 
12640
+ // ../plugin/src/tools/ctx-expand/search-archive.ts
12641
+ function renderSearchArchive(db, sessionId, start, end, tokenBudget, archiveOnly = false) {
12642
+ return withMessageFtsSessionFilter(db, sessionId, (sessionFirst) => {
12643
+ let rawIds;
12644
+ const rows = db.prepare(sessionFirst ? `SELECT f.message_ordinal AS ordinal, f.message_id AS id, f.role, f.content
12645
+ FROM message_fts_rowid_map AS m
12646
+ JOIN message_history_fts AS f ON f.rowid = m.fts_rowid
12647
+ WHERE m.session_id = ?1 AND m.message_ordinal BETWEEN ?2 AND ?3
12648
+ AND f.session_id = ?1 AND f.message_ordinal BETWEEN ?2 AND ?3
12649
+ ORDER BY m.message_ordinal` : `SELECT message_ordinal AS ordinal, message_id AS id, role, content
12650
+ FROM message_history_fts
12651
+ WHERE session_id = ?1 AND message_ordinal BETWEEN ?2 AND ?3
12652
+ ORDER BY CAST(message_ordinal AS INTEGER)`);
12653
+ const blocks = [];
12654
+ let tokens = 0;
12655
+ let lastOrdinal = start - 1;
12656
+ let truncated = false;
12657
+ for (const row of rows.iterate(sessionId, start, end)) {
12658
+ if (!row.content)
12659
+ continue;
12660
+ if (!archiveOnly) {
12661
+ rawIds ??= readRawSessionMessageIdOrdinalsForRange2(sessionId, start, end);
12662
+ if (rawIds.get(row.id) === row.ordinal)
12663
+ continue;
12664
+ }
12665
+ const block = `[${row.ordinal}] ${row.role === "user" ? "U" : "A"}: ${row.content}`;
12666
+ const cost = estimateTokens(block);
12667
+ if (blocks.length > 0 && tokens + cost > tokenBudget) {
12668
+ truncated = true;
12669
+ break;
12670
+ }
12671
+ blocks.push(block);
12672
+ tokens += cost;
12673
+ lastOrdinal = row.ordinal;
12674
+ }
12675
+ if (blocks.length === 0)
12676
+ return null;
12677
+ const text = [
12678
+ "From the search archive: indexed text only; no surrounding messages or tool output.",
12679
+ "",
12680
+ ...blocks
12681
+ ];
12682
+ if (truncated) {
12683
+ text.push("", `Truncated at message ${lastOrdinal} (budget: ~${tokenBudget} tokens). Call ctx_expand(start=${lastOrdinal + 1}, end=${end}) for more archived text.`);
12684
+ }
12685
+ return text.join(`
12686
+ `);
12687
+ });
12688
+ }
12689
+
12563
12690
  // ../plugin/src/tools/unwrap-imitated-reduced-args.ts
12564
12691
  var MAX_DECODED_STRING_LENGTH = 1024 * 1024;
12565
12692
  var MAX_DECODED_ARRAY_ITEMS = 100;
@@ -13004,11 +13131,17 @@ function createCtxExpandTool(deps) {
13004
13131
  }
13005
13132
  const alignment = resolvePiOrdinalAlignmentForContext(deps.db, sessionId, ctx);
13006
13133
  if (isPiOrdinalAlignmentUnanchored(alignment)) {
13134
+ const archived = renderSearchArchive(deps.db, sessionId, mode.kind === "message" ? mode.message : mode.start, mode.kind === "message" ? mode.message : mode.end, CTX_EXPAND_TOKEN_BUDGET, true);
13135
+ if (archived)
13136
+ return ok(archived);
13007
13137
  return err("This session's history numbering can't be verified right now, so message ordinals can't be expanded. Tags (ctx_expand tag=N) still work.");
13008
13138
  }
13009
13139
  const lostThrough = alignment.offset;
13010
13140
  const firstAvailable = lostThrough + 1;
13011
13141
  if (mode.kind === "message") {
13142
+ const archived = renderSearchArchive(deps.db, sessionId, mode.message, mode.message, CTX_EXPAND_TOKEN_BUDGET);
13143
+ if (archived)
13144
+ return ok(archived);
13012
13145
  if (mode.message <= lostThrough) {
13013
13146
  return ok(`No message at ordinal ${mode.message}: it is no longer in this session's history, which now starts at message ${firstAvailable}.`);
13014
13147
  }
@@ -13021,6 +13154,9 @@ function createCtxExpandTool(deps) {
13021
13154
  return ok(`Range ${requestedStart}-${end} is entirely within the live tail (after the last compacted message ${lastCompartmentEnd}); those messages are already visible in context.`);
13022
13155
  }
13023
13156
  const effectiveEnd = lastCompartmentEnd >= 0 ? Math.min(end, lastCompartmentEnd) : end;
13157
+ const archived = renderSearchArchive(deps.db, sessionId, requestedStart, effectiveEnd, CTX_EXPAND_TOKEN_BUDGET);
13158
+ if (archived)
13159
+ return ok(archived);
13024
13160
  if (effectiveEnd <= lostThrough) {
13025
13161
  return ok(`No messages found in range ${requestedStart}-${effectiveEnd}: those messages are no longer in this session's history, which now starts at message ${firstAvailable}.`);
13026
13162
  }
@@ -15405,4 +15541,4 @@ function registerMagicContextTools(pi, opts) {
15405
15541
  }
15406
15542
  }
15407
15543
 
15408
- export { COMPACTION_ENABLED_PATH, isDreamerRunnable, isCompactionEnabled, formatConfigParseStatusLine, formatConfigParseNotice, claimConfigParseFailuresOnce, parseJsoncRecovering, detectConfigFile, MIN_PLAUSIBLE_CONTEXT_LIMIT, catalogOutputReserve, deriveWindowGeometry, hasTrustedAbsoluteWall, applyProvenInputFloor, formatWindowDerivationLine, formatWindowSource, isSaneLimit, resolveOutputReserve, getSdkWindowGeometry, getSdkContextLimit, getSdkOutputLimit, getSdkInputLimit, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, embedPauseBySession, embedRunStateBySession, autoEmbedAttemptedBySession, autoEmbedIdentityBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, HAS_COMPARTMENT_CONTENT_SQL, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndThrough, isPartialCompartmentEnd, readProjectDocsCanonical, providerResponseFailed, isSuccessfulProviderCompletion, requestPendingMaterialization, pendingMaterializationOrigin, clearPendingMaterialization, recordSystemRefreshOwnership, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, acknowledgeSystemPromptDelivery, deferDeliveredSystemRefresh, clearSystemPromptDelivery, saveLkgSlotToDb, loadPersistedLkgSlot, drainStaleLkgSlots, createDbLkgPersistence, replayLkg, registerLkgPersistence, LKG_SNAPSHOT_ARRAY, LKG_SNAPSHOT_OBJECT, LKG_SNAPSHOT_KEY, LKG_SNAPSHOT_STRING, LKG_SNAPSHOT_NUMBER, LKG_SNAPSHOT_BOOLEAN, LKG_SNAPSHOT_NULL, LKG_SNAPSHOT_UNDEFINED, contentSnapshotValue, signatureForFields, lkgContentFields, lkgContentDigestFromFields, isLegacyLkgDigest, legacyLkgDigestFromFields, lkgFieldsMatchDigest, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, dropSlot, TOOL_SWEEP_SCOPED_MARKER, encodePiContentDecision, decodePiContentDecision, getPiContentDecisions, freezePiContentDecision, getNativeReplayState, saveNativeToolInputs, addNativeReasoningIds, copySessionStateForClone, externalHistorianFailureReason, subprocessExitHistorianFailureReason, countHistorianRuns, recordHistorianRun, summarizeImportance, tallyFactsByCategory, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId, noteTouchedAt, noteNudgePickIndex, formatNoteNudge, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, SYNTH_USER_ID_PREFIX, resolvePiStableId, resolvePiRealStableId, isPiContentFallbackId, isPiIndexFallbackId, piContentFallbackIds, readPiSessionSnapshot, readPiSessionMessages, readPiSessionMessagePage, findRestartModelSeedFromBranch, iterateEntriesToRawMessageRange, convertEntriesToRawMessages, convertPiAssistantEntryById, convertEntriesToRawMessagePage, countPiRawMessages, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getTaskScheduleState, getFailingDreamTasks, getSkippedDreamTasks, getMostRecentTaskRunAt, pruneNonCanonicalTaskRows, deleteTaskScheduleRowsForProject, seedTaskScheduleState, writeTaskScheduleState, isRetrospectiveWindowProcessed, recordRetrospectiveWindowProcessed, curateCategoryForMemoryCategory, peekCurateCategoryScope, beginCurateCategoryRun, curateTaskStateAfterSuccess, MEMORY_MURAL_BLOCK, buildMagicContextSection, resolveMuralWire, updateCompactionMarkerAfterPublication, COMPARTMENT_RENDER_EPOCH, MEMORY_RENDER_FORMAT_EPOCH, encodeCachedM0UpgradeIdentity, decodeCachedM0UpgradeIdentity, withCachedM0MemoryIds, readCachedM0MemoryIds, renderBudgetIdentityChanged, renderedBudgetSnapshot, renderedBudgetShrinkReason, DEFAULT_HISTORY_BUDGET_TOKENS, renderCompartmentAtTier, renderDecayedCompartments, extractM0Block, TEMPORAL_MARKER_PATTERN, TEMPORAL_MARKER_REPLAY_PATTERN, temporalMarkerPrefix, renderUserProfileContent, clearInjectionCache, getVisibleMemoryIds, orderHistorianMemories, renderHistorianMemoryBlock, DEFAULT_MEMORY_BUDGET_TOKENS, DEFAULT_USER_PROFILE_BUDGET_TOKENS, trimMemoriesToBudgetV2, trimWorkspaceMemoriesToBudgetV2, trimUserMemoriesToBudget, renderMemoryBlockV2, stripMemoryMuralBlock, resetPrefixTrimFallbackState, isDirectiveShapedProjectRule, takeCurateSafetyRefusalCount, wakePlaneStatus, loadPiConfig, loadPiConfigDetailed, unregisterPiProjectEmbeddings, ensureProjectRegisteredFromPiDirectory, resolvePiHarnessDetection, resolvePiHarnessKind, resolvePiOrdinalAlignment, piRawOrdinalOffsetSource, resolvePiOrdinalAlignmentForContext, isPiOrdinalAlignmentUnanchored, clearPiOrdinalAlignmentSession, rememberTodowriteToolCallTodos, parseTodos, setTodoSnapshot, registerTodoOverlay, registerTodoStateLifecycle, syncCtxMemoryToolEnabled, registerMagicContextTools };
15544
+ export { COMPACTION_ENABLED_PATH, isDreamerRunnable, isCompactionEnabled, formatConfigParseStatusLine, formatConfigParseNotice, claimConfigParseFailuresOnce, parseJsoncRecovering, detectConfigFile, MIN_PLAUSIBLE_CONTEXT_LIMIT, catalogOutputReserve, deriveWindowGeometry, hasTrustedAbsoluteWall, applyProvenInputFloor, formatWindowDerivationLine, formatWindowSource, isSaneLimit, resolveOutputReserve, getSdkWindowGeometry, getSdkContextLimit, getSdkOutputLimit, getSdkInputLimit, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, embedPauseBySession, embedRunStateBySession, autoEmbedAttemptedBySession, autoEmbedIdentityBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, HAS_COMPARTMENT_CONTENT_SQL, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndThrough, isPartialCompartmentEnd, readProjectDocsCanonical, providerResponseFailed, isSuccessfulProviderCompletion, requestPendingMaterialization, pendingMaterializationOrigin, clearPendingMaterialization, recordSystemRefreshOwnership, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, acknowledgeSystemPromptDelivery, deferDeliveredSystemRefresh, clearSystemPromptDelivery, saveLkgSlotToDb, loadPersistedLkgSlot, drainStaleLkgSlots, createDbLkgPersistence, replayLkg, registerLkgPersistence, LKG_SNAPSHOT_ARRAY, LKG_SNAPSHOT_OBJECT, LKG_SNAPSHOT_KEY, LKG_SNAPSHOT_STRING, LKG_SNAPSHOT_NUMBER, LKG_SNAPSHOT_BOOLEAN, LKG_SNAPSHOT_NULL, LKG_SNAPSHOT_UNDEFINED, contentSnapshotValue, signatureForFields, lkgContentFields, lkgContentDigestFromFields, isLegacyLkgDigest, legacyLkgDigestFromFields, lkgFieldsMatchDigest, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, dropSlot, TOOL_SWEEP_SCOPED_MARKER, encodePiContentDecision, decodePiContentDecision, getPiContentDecisions, freezePiContentDecision, getNativeReplayState, saveNativeToolInputs, addNativeReasoningIds, copySessionStateForClone, externalHistorianFailureReason, subprocessExitHistorianFailureReason, countHistorianRuns, recordHistorianRun, summarizeImportance, tallyFactsByCategory, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId, noteTouchedAt, noteNudgePickIndex, formatNoteNudge, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, SYNTH_USER_ID_PREFIX, resolvePiStableId, resolvePiRealStableId, isPiContentFallbackId, isPiIndexFallbackId, piContentFallbackIds, readPiSessionSnapshot, readPiSessionMessages, readPiSessionMessagePage, findRestartModelSeedFromBranch, iterateEntriesToRawMessageRange, iterateAsyncEntriesToRawMessageRange, convertEntriesToRawMessages, convertPiAssistantEntryById, convertEntriesToRawMessagePage, countPiRawMessages, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getTaskScheduleState, getFailingDreamTasks, getSkippedDreamTasks, getMostRecentTaskRunAt, pruneNonCanonicalTaskRows, deleteTaskScheduleRowsForProject, seedTaskScheduleState, writeTaskScheduleState, isRetrospectiveWindowProcessed, recordRetrospectiveWindowProcessed, curateCategoryForMemoryCategory, peekCurateCategoryScope, beginCurateCategoryRun, curateTaskStateAfterSuccess, MEMORY_MURAL_BLOCK, buildMagicContextSection, resolveMuralWire, updateCompactionMarkerAfterPublication, COMPARTMENT_RENDER_EPOCH, MEMORY_RENDER_FORMAT_EPOCH, encodeCachedM0UpgradeIdentity, decodeCachedM0UpgradeIdentity, withCachedM0MemoryIds, readCachedM0MemoryIds, renderBudgetIdentityChanged, renderedBudgetSnapshot, renderedBudgetShrinkReason, DEFAULT_HISTORY_BUDGET_TOKENS, renderCompartmentAtTier, renderDecayedCompartments, extractM0Block, TEMPORAL_MARKER_PATTERN, TEMPORAL_MARKER_REPLAY_PATTERN, temporalMarkerPrefix, renderUserProfileContent, clearInjectionCache, getVisibleMemoryIds, orderHistorianMemories, renderHistorianMemoryBlock, DEFAULT_MEMORY_BUDGET_TOKENS, DEFAULT_USER_PROFILE_BUDGET_TOKENS, trimMemoriesToBudgetV2, trimWorkspaceMemoriesToBudgetV2, trimUserMemoriesToBudget, renderMemoryBlockV2, stripMemoryMuralBlock, resetPrefixTrimFallbackState, isDirectiveShapedProjectRule, takeCurateSafetyRefusalCount, wakePlaneStatus, loadPiConfig, loadPiConfigDetailed, unregisterPiProjectEmbeddings, ensureProjectRegisteredFromPiDirectory, resolvePiHarnessDetection, resolvePiHarnessKind, resolvePiOrdinalAlignment, piRawOrdinalOffsetSource, resolvePiOrdinalAlignmentForContext, isPiOrdinalAlignmentUnanchored, clearPiOrdinalAlignmentSession, rememberTodowriteToolCallTodos, parseTodos, setTodoSnapshot, registerTodoOverlay, registerTodoStateLifecycle, syncCtxMemoryToolEnabled, registerMagicContextTools };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./index-x3dcnxh0.js";
3
+ } from "./index-gycf3sp7.js";
4
4
 
5
5
  // ../plugin/src/shared/safe-notification-target.ts
6
6
  var DEFAULT_TITLE_RE = /^(New session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;