@cortexkit/pi-magic-context 0.49.19 → 0.49.21

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 (60) hide show
  1. package/dist/auto-search-worker.js +48 -9
  2. package/dist/chunk-embedding-write-worker.js +29 -22
  3. package/dist/{compaction-marker-candidates-wjzqbspm.js → compaction-marker-candidates-p1kqkqhq.js} +3 -3
  4. package/dist/compaction-marker-candidates-worker.js +2 -2
  5. package/dist/compartment-chunk-embedding-y01m95c2.js +64 -0
  6. package/dist/embedding-backfill-2vh6m3bg.js +24 -0
  7. package/dist/embedding-worker-process.js +2 -2
  8. package/dist/embedding-worker.js +6 -6
  9. package/dist/historian-calibration-extension.js +1 -1
  10. package/dist/{index-e1rza8gp.js → index-29nw7n1r.js} +1 -1
  11. package/dist/{index-rrwv9y2k.js → index-2qtx0q6h.js} +214 -5
  12. package/dist/{index-msqrs4nf.js → index-3c3ztwgc.js} +5 -5
  13. package/dist/index-54wmg4rj.js +82 -0
  14. package/dist/{index-yygsh681.js → index-579m1751.js} +3 -3
  15. package/dist/{index-rc1dez8m.js → index-5j6vwg4z.js} +154 -13
  16. package/dist/{index-qpq6w67c.js → index-6wdwv3a6.js} +2 -2
  17. package/dist/{index-vktahpdj.js → index-at6py2k3.js} +9 -3
  18. package/dist/{index-bxmf4dhr.js → index-ccanzg8p.js} +2367 -1243
  19. package/dist/{index-sqt2haap.js → index-dbgg6hsf.js} +28 -14
  20. package/dist/{index-7bqrfyny.js → index-fgs78jyd.js} +12 -15
  21. package/dist/{index-58mj0dzc.js → index-ftvm2acc.js} +181 -46
  22. package/dist/{index-wveb51es.js → index-gqjxy2p7.js} +74 -9
  23. package/dist/{index-d8gc0112.js → index-gwxaz0z5.js} +4 -6
  24. package/dist/{index-d4dt19md.js → index-hqw0rt9k.js} +1 -1
  25. package/dist/{index-g7p75667.js → index-hxp6q5f8.js} +2 -2
  26. package/dist/{index-svgkv4g2.js → index-j3pz3a1b.js} +2 -2
  27. package/dist/{index-f18ec69t.js → index-jn44h81p.js} +1 -1
  28. package/dist/{index-1kcfwk9c.js → index-my0dn413.js} +1 -1
  29. package/dist/{index-apgwdby5.js → index-n4wyxcgr.js} +1 -1
  30. package/dist/{index-rhprywn6.js → index-n8e5e9fp.js} +28 -7
  31. package/dist/{index-z2rkv0mb.js → index-pe5gz5c4.js} +5 -5
  32. package/dist/{index-dtp1efvf.js → index-st4gwt64.js} +2 -2
  33. package/dist/{index-xnch62s6.js → index-vx6f7wff.js} +314 -127
  34. package/dist/{index-jrap43gc.js → index-w1avzkdt.js} +1 -1
  35. package/dist/{index-vmcgew7x.js → index-w1twp2kp.js} +78 -58
  36. package/dist/{index-ek9zvs4f.js → index-w6r3ggnp.js} +57 -27
  37. package/dist/{index-ym6nh2gk.js → index-wgmhk91m.js} +113 -20
  38. package/dist/{index-2mmy81qt.js → index-wqpjhx1p.js} +501 -20
  39. package/dist/index.js +1178 -417
  40. package/dist/{logger-dygt96rn.js → logger-shetp43v.js} +1 -1
  41. package/dist/{message-fts-rowid-map-cvpy2dmb.js → message-fts-rowid-map-59y476bk.js} +6 -5
  42. package/dist/{message-index-rc2x41k4.js → message-index-3snxf11x.js} +15 -14
  43. package/dist/{message-index-bounded-66saeq5j.js → message-index-bounded-4ngt600v.js} +15 -14
  44. package/dist/{message-time-backfill-ssshbdy8.js → message-time-backfill-e3r8ddh1.js} +3 -3
  45. package/dist/migration-worker.js +12 -11
  46. package/dist/{project-embedding-registry-vf1ncptn.js → project-embedding-registry-hfyzs654.js} +14 -13
  47. package/dist/raw-ordinal-warmup-worker.js +136 -101
  48. package/dist/{read-session-chunk-h5bzj91r.js → read-session-chunk-5dmc77q2.js} +10 -9
  49. package/dist/{read-session-raw-9s3xn7fc.js → read-session-raw-yxv2fv34.js} +4 -3
  50. package/dist/{safe-notification-target-2rkvkmw8.js → safe-notification-target-zcpchea6.js} +2 -2
  51. package/dist/search-archive-3daj5ttc.js +21 -0
  52. package/dist/{search-wh7b9zht.js → search-jhfh3tsj.js} +23 -22
  53. package/dist/{sqlite-fsp0sf3r.js → sqlite-v89bj0yy.js} +7 -1
  54. package/dist/{storage-memory-yxxc5v4n.js → storage-memory-0ndn65fm.js} +2 -2
  55. package/dist/{storage-tags-1kets0q8.js → storage-tags-r48vxthe.js} +7 -5
  56. package/dist/subagent-entry.js +28 -26
  57. package/dist/tag-snapshot-worker-pi.js +22 -14
  58. package/package.json +5 -2
  59. package/dist/embedding-backfill-vwag34t0.js +0 -23
  60. package/dist/search-archive-4817pqev.js +0 -20
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sessionLog2
3
- } from "./index-7bqrfyny.js";
3
+ } from "./index-fgs78jyd.js";
4
4
 
5
5
  // ../plugin/src/shared/stable-json.ts
6
6
  function stableStringify(value, seen = new WeakSet) {
@@ -4,54 +4,60 @@ import {
4
4
  withSqliteBackgroundWriter2,
5
5
  withoutSqliteTransformPass2,
6
6
  isTransientSqliteError2
7
- } from "./index-rrwv9y2k.js";
7
+ } from "./index-2qtx0q6h.js";
8
8
  import {
9
9
  estimateTokens
10
- } from "./index-1kcfwk9c.js";
10
+ } from "./index-my0dn413.js";
11
11
  import {
12
12
  getHarness2
13
13
  } from "./index-0h2mkab2.js";
14
14
  import {
15
15
  sanitizeDiagnosticText,
16
16
  log2
17
- } from "./index-7bqrfyny.js";
17
+ } from "./index-fgs78jyd.js";
18
18
  import {
19
19
  SYNAPSE_DEFAULT_MODEL,
20
20
  isSynapseEmbeddingTruncated,
21
21
  getSynapseBatchRequestKey,
22
22
  SynapseEmbeddingProvider
23
- } from "./index-d8gc0112.js";
23
+ } from "./index-gwxaz0z5.js";
24
24
  import {
25
- DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS,
26
- CHUNK_WINDOW_SAFETY_RATIO,
27
- normalizeCompartmentChunkMaxInputTokens,
28
- buildCanonicalChunkTextFromFts,
29
- buildCompartmentSummaryFallbackText,
30
- chunkCanonicalText,
31
- chunkEmbeddingWindowsAreCurrent,
32
- replaceCompartmentChunkEmbeddings,
33
- loadUnembeddedShadowChunkCandidates,
34
- loadUnembeddedCompartmentChunkCandidatesPolite,
35
- recordChunkEmbedBackoff,
36
- chunkWindowSourceKey,
37
- loadUnembeddedSessionChunkCandidatesPolite,
38
- countSessionCompartmentEmbedCoverage,
39
- countSessionCompartmentEmbedCoveragePolite,
40
- countUnembeddedSessionCompartmentsPolite
41
- } from "./index-xnch62s6.js";
25
+ createWorkerShutdown
26
+ } from "./index-54wmg4rj.js";
27
+ import {
28
+ DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2,
29
+ CHUNK_WINDOW_SAFETY_RATIO2,
30
+ normalizeCompartmentChunkMaxInputTokens2,
31
+ buildCanonicalChunkTextFromFts2,
32
+ buildCompartmentSummaryFallbackText2,
33
+ chunkCanonicalText2,
34
+ chunkEmbeddingWindowsAreCurrent2,
35
+ replaceCompartmentChunkEmbeddings2,
36
+ loadUnembeddedShadowChunkCandidates2,
37
+ loadUnembeddedCompartmentChunkCandidatesPolite2,
38
+ recordChunkEmbedBackoff2,
39
+ chunkWindowSourceKey2,
40
+ loadUnembeddedSessionChunkCandidatesPolite2,
41
+ countSessionCompartmentEmbedCoverage2,
42
+ countSessionCompartmentEmbedCoveragePolite2,
43
+ countUnembeddedSessionCompartmentsPolite2
44
+ } from "./index-vx6f7wff.js";
42
45
  import {
43
46
  DEFAULT_LOCAL_EMBEDDING_MODEL
44
- } from "./index-bxmf4dhr.js";
47
+ } from "./index-ccanzg8p.js";
45
48
  import {
46
49
  embeddingModelsMatch,
47
50
  resolveEmbeddingTextPrefixes,
51
+ getCachedLocalEmbeddingPooling,
52
+ logLocalEmbeddingPoolingDecisionOnce,
53
+ logLocalEmbeddingPoolingUnavailableOnce,
48
54
  getEmbeddingProviderIdentity,
49
55
  dominantEmbeddingFailure,
50
56
  LocalEmbeddingProvider
51
- } from "./index-2mmy81qt.js";
57
+ } from "./index-wqpjhx1p.js";
52
58
  import {
53
59
  setBootQuietPeriodForTests
54
- } from "./index-g7p75667.js";
60
+ } from "./index-hxp6q5f8.js";
55
61
  import {
56
62
  isEmbeddingHostBusy2
57
63
  } from "./index-9p40dgkm.js";
@@ -62,7 +68,7 @@ import {
62
68
  acquireGitSweepLease,
63
69
  renewGitSweepLease,
64
70
  releaseGitSweepLease
65
- } from "./index-svgkv4g2.js";
71
+ } from "./index-j3pz3a1b.js";
66
72
  import {
67
73
  saveEmbeddingIfHashMatches,
68
74
  getMemoryEmbedCoverage,
@@ -70,7 +76,7 @@ import {
70
76
  } from "./index-yhzhdp3m.js";
71
77
  import {
72
78
  logSlowWriteTransaction
73
- } from "./index-d4dt19md.js";
79
+ } from "./index-hqw0rt9k.js";
74
80
 
75
81
  // ../plugin/src/hooks/magic-context/embed-session-state.ts
76
82
  var embedPauseBySession = new Set;
@@ -252,7 +258,7 @@ function responseSlots(items, inputCount) {
252
258
  return slots;
253
259
  }
254
260
  function capEmbeddingInput(input, maxInputTokens, purpose) {
255
- const ratio = purpose === "query" ? CHUNK_WINDOW_SAFETY_RATIO : 1;
261
+ const ratio = purpose === "query" ? CHUNK_WINDOW_SAFETY_RATIO2 : 1;
256
262
  const budget = Math.max(1, Math.floor(maxInputTokens * ratio));
257
263
  if (estimateTokens(input) <= budget)
258
264
  return input;
@@ -362,12 +368,12 @@ class OpenAICompatibleEmbeddingProvider {
362
368
  this.truncate = options.truncate?.trim() ?? "";
363
369
  this.rateLimitKey = rateLimitStateKey(this.endpoint, this.apiKey);
364
370
  const maxInputTokensSet = typeof options.maxInputTokens === "number" && Number.isFinite(options.maxInputTokens);
365
- this.maxInputTokens = maxInputTokensSet ? Math.max(1, Math.floor(options.maxInputTokens)) : DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS;
371
+ this.maxInputTokens = maxInputTokensSet ? Math.max(1, Math.floor(options.maxInputTokens)) : DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2;
366
372
  if (!maxInputTokensSet && this.endpoint && this.model) {
367
373
  const warningKey = `${this.endpoint}\x00${this.model}`;
368
374
  if (!maxInputTokensWarnings.has(warningKey)) {
369
375
  maxInputTokensWarnings.add(warningKey);
370
- log2(`[magic-context] embedding.max_input_tokens is not set for openai-compatible model "${sanitizeDiagnosticText(this.model)}"; chunk embeddings use the ${DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS}-token default, which is sized for the bundled local model and splits history into small pieces. Set embedding.max_input_tokens to the model's input limit (changing it re-embeds stored chunks once).`);
376
+ log2(`[magic-context] embedding.max_input_tokens is not set for openai-compatible model "${sanitizeDiagnosticText(this.model)}"; chunk embeddings use the ${DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2}-token default, which is sized for the bundled local model and splits history into small pieces. Set embedding.max_input_tokens to the model's input limit (changing it re-embeds stored chunks once).`);
371
377
  }
372
378
  }
373
379
  this.modelId = getEmbeddingProviderIdentity({
@@ -711,6 +717,7 @@ function createChunkEmbeddingWriter(db) {
711
717
  const entry = new URL(import.meta.url.endsWith(".ts") ? "./chunk-embedding-write-worker.ts" : "./chunk-embedding-write-worker.js", import.meta.url);
712
718
  const timeout = db.prepare("PRAGMA busy_timeout").get().timeout;
713
719
  const worker = inRootAsyncContext2(() => new Worker(entry, { workerData: { path, harness: getHarness2(), timeout } }));
720
+ const shutdown = createWorkerShutdown(worker, "chunk-embedding-writer", timeout + 2000);
714
721
  let pending;
715
722
  let failure;
716
723
  let deadline;
@@ -741,7 +748,7 @@ function createChunkEmbeddingWriter(db) {
741
748
  pending = { resolve, reject };
742
749
  deadline = inRootAsyncContext2(() => setTimeout(() => {
743
750
  fail(new Error("chunk embedding database operation timed out; coverage will be rechecked"));
744
- worker.terminate();
751
+ shutdown.close();
745
752
  }, 30000));
746
753
  deadline.unref();
747
754
  worker.postMessage(message);
@@ -773,7 +780,7 @@ function createChunkEmbeddingWriter(db) {
773
780
  release: (project, holder) => request({ kind: "release", project, holder }),
774
781
  async close() {
775
782
  clearTimeout(deadline);
776
- await worker.terminate();
783
+ await shutdown.close();
777
784
  }
778
785
  };
779
786
  }
@@ -1052,6 +1059,7 @@ var EMBED_SLICE_RETRY_BASE_MS = 250;
1052
1059
  var EMBED_SLOW_FAILURE_NO_RETRY_MS = 1e4;
1053
1060
  var MAX_CONSECUTIVE_FAILED_BATCHES = 3;
1054
1061
  var projectRegistrations = new Map;
1062
+ var projectContextUsers = new Map;
1055
1063
  var shadowRegistrations = new Map;
1056
1064
  var shadowQueue = [];
1057
1065
  var shadowWorker = null;
@@ -1219,7 +1227,7 @@ function resolveEmbeddingConfig(config) {
1219
1227
  model: config?.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL,
1220
1228
  local_runtime: config?.local_runtime ?? "auto",
1221
1229
  ...config?.max_input_tokens ? {
1222
- max_input_tokens: normalizeCompartmentChunkMaxInputTokens(config.max_input_tokens)
1230
+ max_input_tokens: normalizeCompartmentChunkMaxInputTokens2(config.max_input_tokens)
1223
1231
  } : {},
1224
1232
  ...config?.local_dtype ? { local_dtype: config.local_dtype } : {}
1225
1233
  };
@@ -1240,7 +1248,7 @@ function resolveEmbeddingConfig(config) {
1240
1248
  ...config.document_prefix !== undefined ? { document_prefix: config.document_prefix } : {},
1241
1249
  ...truncate ? { truncate } : {},
1242
1250
  ...config.max_input_tokens ? {
1243
- max_input_tokens: normalizeCompartmentChunkMaxInputTokens(config.max_input_tokens)
1251
+ max_input_tokens: normalizeCompartmentChunkMaxInputTokens2(config.max_input_tokens)
1244
1252
  } : {}
1245
1253
  };
1246
1254
  }
@@ -1253,7 +1261,7 @@ function resolveEmbeddingConfig(config) {
1253
1261
  return {
1254
1262
  provider: "synapse",
1255
1263
  model: synapse.model?.trim() || "gte-modernbert-base-f16",
1256
- max_input_tokens: normalizeCompartmentChunkMaxInputTokens(descriptor?.max_tokens ?? synapse.max_input_tokens),
1264
+ max_input_tokens: normalizeCompartmentChunkMaxInputTokens2(descriptor?.max_tokens ?? synapse.max_input_tokens),
1257
1265
  ...synapse.synapse_connection_file ? { synapse_connection_file: synapse.synapse_connection_file } : {},
1258
1266
  ...synapse.synapse_fingerprint ? { synapse_fingerprint: synapse.synapse_fingerprint } : {},
1259
1267
  ...typeof synapse.synapse_table_epoch === "number" ? { synapse_table_epoch: synapse.synapse_table_epoch } : {},
@@ -1341,7 +1349,7 @@ function getChunkEmbeddingModelId(config, providerIdentity) {
1341
1349
  const chunkIdentity = {
1342
1350
  providerIdentity,
1343
1351
  chunkerVersion: 2,
1344
- maxInputTokens: normalizeCompartmentChunkMaxInputTokens("max_input_tokens" in config ? config.max_input_tokens : undefined),
1352
+ maxInputTokens: normalizeCompartmentChunkMaxInputTokens2("max_input_tokens" in config ? config.max_input_tokens : undefined),
1345
1353
  truncate: config.provider === "openai-compatible" ? config.truncate ?? "" : ""
1346
1354
  };
1347
1355
  return `${providerIdentity}:chunk:${sha256Prefix(stableStringify(chunkIdentity))}`;
@@ -1667,6 +1675,17 @@ async function drainStaleEmbeddingIdentitiesForProject2(db, projectIdentity, bud
1667
1675
  }
1668
1676
  function registerProjectEmbedding2(db, projectIdentity, config, features, sourceDirectory) {
1669
1677
  const resolvedConfig = resolveEmbeddingConfig(config);
1678
+ if (resolvedConfig.provider === "local") {
1679
+ const pooling = getCachedLocalEmbeddingPooling(resolvedConfig.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL);
1680
+ if (pooling?.status === "unresolved" || !pooling) {
1681
+ logLocalEmbeddingPoolingUnavailableOnce(resolvedConfig.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL, pooling?.reason ?? "pooling metadata has not been resolved by the background embedding bootstrap", log2);
1682
+ } else {
1683
+ logLocalEmbeddingPoolingDecisionOnce(resolvedConfig.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL, pooling, log2);
1684
+ }
1685
+ if (pooling?.status === "unsupported") {
1686
+ return registerProjectInObservationMode2(db, projectIdentity, sourceDirectory, resolvedConfig, pooling ? `local model pooling is unsupported: ${pooling.reason}` : "local model pooling metadata has not been resolved");
1687
+ }
1688
+ }
1670
1689
  const providerIdentity = getEmbeddingProviderIdentity(resolvedConfig);
1671
1690
  const runtimeFingerprint = getRuntimeFingerprint(resolvedConfig);
1672
1691
  const chunkModelId = getChunkEmbeddingModelId(resolvedConfig, providerIdentity);
@@ -1862,7 +1881,7 @@ function shadowBackfillMissingBase(scope, primaryModelId, shadowModelId, project
1862
1881
  }
1863
1882
  function shadowBackfillMissingIds(db, projectIdentity, scope, primaryModelId, shadowModelId, limit, shadowMaxInputTokens) {
1864
1883
  if (scope === "chunk") {
1865
- return loadUnembeddedShadowChunkCandidates(db, projectIdentity, primaryModelId, shadowModelId, limit, shadowMaxInputTokens).map((candidate) => String(candidate.id));
1884
+ return loadUnembeddedShadowChunkCandidates2(db, projectIdentity, primaryModelId, shadowModelId, limit, shadowMaxInputTokens).map((candidate) => String(candidate.id));
1866
1885
  }
1867
1886
  const { sql, params, orderBy } = shadowBackfillMissingBase(scope, primaryModelId, shadowModelId, projectIdentity);
1868
1887
  const rows = db.prepare(`${sql}${orderBy} LIMIT ?`).all(...params, limit);
@@ -1870,7 +1889,7 @@ function shadowBackfillMissingIds(db, projectIdentity, scope, primaryModelId, sh
1870
1889
  }
1871
1890
  function countShadowBackfillMissing(db, projectIdentity, scope, primaryModelId, shadowModelId, shadowMaxInputTokens) {
1872
1891
  if (scope === "chunk") {
1873
- return loadUnembeddedShadowChunkCandidates(db, projectIdentity, primaryModelId, shadowModelId, Number.MAX_SAFE_INTEGER, shadowMaxInputTokens).length;
1892
+ return loadUnembeddedShadowChunkCandidates2(db, projectIdentity, primaryModelId, shadowModelId, Number.MAX_SAFE_INTEGER, shadowMaxInputTokens).length;
1874
1893
  }
1875
1894
  const { sql, params } = shadowBackfillMissingBase(scope, primaryModelId, shadowModelId, projectIdentity);
1876
1895
  return db.prepare(`SELECT COUNT(*) AS count FROM (${sql})`).get(...params).count;
@@ -1879,7 +1898,7 @@ function shadowModelIdForScope(registration, scope) {
1879
1898
  return scope === "chunk" ? registration.chunkModelId : registration.modelId;
1880
1899
  }
1881
1900
  function shadowMaxInputTokensFor(registration) {
1882
- return normalizeCompartmentChunkMaxInputTokens("max_input_tokens" in registration.config ? registration.config.max_input_tokens : undefined);
1901
+ return normalizeCompartmentChunkMaxInputTokens2("max_input_tokens" in registration.config ? registration.config.max_input_tokens : undefined);
1883
1902
  }
1884
1903
  function shadowBackfillCohortFingerprint(db, projectIdentity, scope, primaryModelId) {
1885
1904
  if (scope === "memory") {
@@ -2217,14 +2236,14 @@ async function processShadowQueueItem(item) {
2217
2236
  let ftsMappingIncomplete = false;
2218
2237
  let emptyCanonicalText = false;
2219
2238
  for (const candidate of candidates) {
2220
- const mappedText = buildCanonicalChunkTextFromFts(db, candidate.session_id, candidate.start_message, candidate.end_message);
2239
+ const mappedText = buildCanonicalChunkTextFromFts2(db, candidate.session_id, candidate.start_message, candidate.end_message);
2221
2240
  if (mappedText === null) {
2222
2241
  ftsMappingIncomplete = true;
2223
2242
  } else {
2224
- const text = mappedText || buildCompartmentSummaryFallbackText(db, candidate.id);
2243
+ const text = mappedText || buildCompartmentSummaryFallbackText2(db, candidate.id);
2225
2244
  const shadowMaxInputTokens = shadowMaxInputTokensFor(registration);
2226
- const windows = chunkCanonicalText(text, candidate.start_message, candidate.end_message, shadowMaxInputTokens);
2227
- const windowSourceKey = chunkWindowSourceKey(text, candidate.start_message, candidate.end_message, shadowMaxInputTokens);
2245
+ const windows = chunkCanonicalText2(text, candidate.start_message, candidate.end_message, shadowMaxInputTokens);
2246
+ const windowSourceKey = chunkWindowSourceKey2(text, candidate.start_message, candidate.end_message, shadowMaxInputTokens);
2228
2247
  if (windows.length > 0)
2229
2248
  prepared.push({ candidate, windows, windowSourceKey });
2230
2249
  else
@@ -2265,7 +2284,7 @@ async function processShadowQueueItem(item) {
2265
2284
  ] : [];
2266
2285
  });
2267
2286
  if (rows.length === item.windows.length) {
2268
- replaceCompartmentChunkEmbeddings(db, rows, item.windowSourceKey);
2287
+ replaceCompartmentChunkEmbeddings2(db, rows, item.windowSourceKey);
2269
2288
  writes += 1;
2270
2289
  } else {
2271
2290
  partialVectorSet = true;
@@ -2400,7 +2419,7 @@ function getProjectChunkEmbeddingModelId2(projectIdentity) {
2400
2419
  function getProjectEmbeddingMaxInputTokens2(projectIdentity) {
2401
2420
  const registration = projectRegistrations.get(projectIdentity);
2402
2421
  const configMax = registration?.config && "max_input_tokens" in registration.config ? registration.config.max_input_tokens : undefined;
2403
- return normalizeCompartmentChunkMaxInputTokens(registration?.provider?.maxInputTokens ?? configMax);
2422
+ return normalizeCompartmentChunkMaxInputTokens2(registration?.provider?.maxInputTokens ?? configMax);
2404
2423
  }
2405
2424
  function getOrCreateProjectProvider(registration) {
2406
2425
  if (registration.providerIdentity === OFF_PROVIDER_IDENTITY || registration.observationMode) {
@@ -2658,7 +2677,7 @@ async function embedCompartmentChunkBatch(db, projectIdentity, batchSize, signal
2658
2677
  const priorModels = db.prepare(`SELECT COUNT(*) AS total,
2659
2678
  COALESCE(MAX(model_id = ?), 0) AS current
2660
2679
  FROM compartment_chunk_embeddings WHERE compartment_id = ?`);
2661
- const candidates = await loadUnembeddedCompartmentChunkCandidatesPolite(db, projectIdentity, snapshot.chunkModelId, batchSize, getProjectEmbeddingMaxInputTokens2(projectIdentity), true, (candidate) => {
2680
+ const candidates = await loadUnembeddedCompartmentChunkCandidatesPolite2(db, projectIdentity, snapshot.chunkModelId, batchSize, getProjectEmbeddingMaxInputTokens2(projectIdentity), true, (candidate) => {
2662
2681
  const activity = activeEmbeddingSessions.get(candidate.sessionId);
2663
2682
  if (activity?.project === projectIdentity && activity.model === snapshot.chunkModelId && !embedPauseBySession.has(candidate.sessionId))
2664
2683
  return true;
@@ -2684,27 +2703,27 @@ async function embedCandidateChunkBatch(db, projectIdentity, modelId, candidates
2684
2703
  const prepared = [];
2685
2704
  for (const candidate of candidates) {
2686
2705
  await new Promise((resolve) => setTimeout(resolve, 0));
2687
- const mappedText = buildCanonicalChunkTextFromFts(db, candidate.sessionId, candidate.startMessage, candidate.endMessage);
2706
+ const mappedText = buildCanonicalChunkTextFromFts2(db, candidate.sessionId, candidate.startMessage, candidate.endMessage);
2688
2707
  if (mappedText === null)
2689
2708
  continue;
2690
- const canonicalText = mappedText || buildCompartmentSummaryFallbackText(db, candidate.id);
2709
+ const canonicalText = mappedText || buildCompartmentSummaryFallbackText2(db, candidate.id);
2691
2710
  if (canonicalText.length === 0) {
2692
2711
  if (writer)
2693
2712
  await writer.backoff(candidate, projectIdentity, modelId);
2694
2713
  else
2695
- recordChunkEmbedBackoff(db, candidate, projectIdentity, modelId);
2714
+ recordChunkEmbedBackoff2(db, candidate, projectIdentity, modelId);
2696
2715
  noWork.push(candidate.id);
2697
2716
  continue;
2698
2717
  }
2699
- const windows = chunkCanonicalText(canonicalText, candidate.startMessage, candidate.endMessage, maxInputTokens);
2700
- if (windows.length === 0 || chunkEmbeddingWindowsAreCurrent(db, candidate.id, modelId, windows, projectIdentity)) {
2718
+ const windows = chunkCanonicalText2(canonicalText, candidate.startMessage, candidate.endMessage, maxInputTokens);
2719
+ if (windows.length === 0 || chunkEmbeddingWindowsAreCurrent2(db, candidate.id, modelId, windows, projectIdentity)) {
2701
2720
  noWork.push(candidate.id);
2702
2721
  continue;
2703
2722
  }
2704
2723
  prepared.push({
2705
2724
  candidate,
2706
2725
  windows,
2707
- windowSourceKey: chunkWindowSourceKey(canonicalText, candidate.startMessage, candidate.endMessage, maxInputTokens)
2726
+ windowSourceKey: chunkWindowSourceKey2(canonicalText, candidate.startMessage, candidate.endMessage, maxInputTokens)
2708
2727
  });
2709
2728
  }
2710
2729
  if (prepared.length === 0)
@@ -2768,7 +2787,7 @@ async function embedCandidateChunkBatch(db, projectIdentity, modelId, candidates
2768
2787
  if (writer)
2769
2788
  await writer.replace(rows, item.windowSourceKey);
2770
2789
  else
2771
- replaceCompartmentChunkEmbeddings(db, rows, item.windowSourceKey);
2790
+ replaceCompartmentChunkEmbeddings2(db, rows, item.windowSourceKey);
2772
2791
  persistedIds.add(item.candidate.id);
2773
2792
  enqueueShadowEmbeddingItems2(projectIdentity, "chunk", [
2774
2793
  String(item.candidate.id)
@@ -2796,7 +2815,7 @@ async function embedCandidateChunkBatch(db, projectIdentity, modelId, candidates
2796
2815
  if (writer)
2797
2816
  await writer.backoff(item.candidate, projectIdentity, modelId);
2798
2817
  else
2799
- recordChunkEmbedBackoff(db, item.candidate, projectIdentity, modelId);
2818
+ recordChunkEmbedBackoff2(db, item.candidate, projectIdentity, modelId);
2800
2819
  failed.push(item.candidate.id);
2801
2820
  }
2802
2821
  }
@@ -2870,7 +2889,7 @@ async function embedSessionCompartmentChunks2(db, projectIdentity, sessionId, op
2870
2889
  else
2871
2890
  recordSessionProjectIdentity(db, sessionId, projectIdentity);
2872
2891
  const maxInputTokens = getProjectEmbeddingMaxInputTokens2(projectIdentity);
2873
- const total = writer ? await writer.count(projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens) : await countUnembeddedSessionCompartmentsPolite(db, projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens);
2892
+ const total = writer ? await writer.count(projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens) : await countUnembeddedSessionCompartmentsPolite2(db, projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens);
2874
2893
  const holderId = `session-embed-${randomUUID()}`;
2875
2894
  const lease = writer ? await writer.acquire(projectIdentity, holderId) : acquireGitSweepLease(db, projectIdentity, holderId, { ignoreCooldown: true });
2876
2895
  if (!lease.acquired)
@@ -2913,7 +2932,7 @@ async function embedSessionCompartmentChunks2(db, projectIdentity, sessionId, op
2913
2932
  break;
2914
2933
  }
2915
2934
  }
2916
- const candidates = writer ? await writer.candidates(projectIdentity, sessionId, snapshot.chunkModelId, batchSize, [...skipIds, ...failedIds], maxInputTokens) : await loadUnembeddedSessionChunkCandidatesPolite(db, projectIdentity, sessionId, snapshot.chunkModelId, batchSize, [...skipIds, ...failedIds], maxInputTokens, true);
2935
+ const candidates = writer ? await writer.candidates(projectIdentity, sessionId, snapshot.chunkModelId, batchSize, [...skipIds, ...failedIds], maxInputTokens) : await loadUnembeddedSessionChunkCandidatesPolite2(db, projectIdentity, sessionId, snapshot.chunkModelId, batchSize, [...skipIds, ...failedIds], maxInputTokens, true);
2917
2936
  if (candidates.length === 0)
2918
2937
  break;
2919
2938
  const {
@@ -2963,7 +2982,7 @@ async function embedSessionCompartmentChunks2(db, projectIdentity, sessionId, op
2963
2982
  if (aborted)
2964
2983
  return { status: "aborted", embedded, total, failed: failedIds.length };
2965
2984
  if (providerDown || failedIds.length > 0) {
2966
- const remaining = Math.max(failedIds.length, (writer ? await writer.count(projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens) : await countUnembeddedSessionCompartmentsPolite(db, projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens)) - skipIds.length);
2985
+ const remaining = Math.max(failedIds.length, (writer ? await writer.count(projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens) : await countUnembeddedSessionCompartmentsPolite2(db, projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens)) - skipIds.length);
2967
2986
  if (remaining > 0) {
2968
2987
  return {
2969
2988
  status: "stalled",
@@ -2991,7 +3010,7 @@ function getEmbeddingCoverageStatus2(db, projectIdentity, sessionId) {
2991
3010
  shadowBackfillStalls: listShadowBackfillStalls2(db, projectIdentity)
2992
3011
  };
2993
3012
  }
2994
- const session = countSessionCompartmentEmbedCoverage(db, projectIdentity, sessionId, snapshot.chunkModelId, getProjectEmbeddingMaxInputTokens2(projectIdentity));
3013
+ const session = countSessionCompartmentEmbedCoverage2(db, projectIdentity, sessionId, snapshot.chunkModelId, getProjectEmbeddingMaxInputTokens2(projectIdentity));
2995
3014
  const memories = snapshot.enabled ? getMemoryEmbedCoverage(db, projectIdentity, snapshot.modelId) : { embedded: 0, total: 0, memoryEnabled: false };
2996
3015
  const gitEnabled = snapshot.gitCommitEnabled;
2997
3016
  const commits = gitEnabled ? {
@@ -3015,7 +3034,7 @@ async function getAutoEmbeddingSessionCoverage2(db, projectIdentity, sessionId)
3015
3034
  if (!snapshot?.historyEnabled || snapshot.chunkModelId === "off") {
3016
3035
  return { enabled: false, embedded: 0, total: 0 };
3017
3036
  }
3018
- const coverage = await countSessionCompartmentEmbedCoveragePolite(db, projectIdentity, sessionId, snapshot.chunkModelId, getProjectEmbeddingMaxInputTokens2(projectIdentity));
3037
+ const coverage = await countSessionCompartmentEmbedCoveragePolite2(db, projectIdentity, sessionId, snapshot.chunkModelId, getProjectEmbeddingMaxInputTokens2(projectIdentity));
3019
3038
  return { enabled: true, ...coverage };
3020
3039
  }
3021
3040
  async function sweepAllRegisteredProjects2(db, batchSize = 10) {
@@ -3083,6 +3102,7 @@ function _resetProjectEmbeddingRegistryForTests2() {
3083
3102
  disposeProvider(registration.provider);
3084
3103
  }
3085
3104
  projectRegistrations.clear();
3105
+ projectContextUsers.clear();
3086
3106
  shadowRegistrations.clear();
3087
3107
  shadowQueue.length = 0;
3088
3108
  pendingShadowBackfills.clear();
@@ -17,7 +17,7 @@ import {
17
17
  getMagicContextStorageDir,
18
18
  log2,
19
19
  sessionLog2
20
- } from "./index-7bqrfyny.js";
20
+ } from "./index-fgs78jyd.js";
21
21
  import {
22
22
  piModelRefToCanonical,
23
23
  modelRefLookupOrder,
@@ -30,7 +30,7 @@ import {
30
30
  PER_HARNESS_MODEL_KEYS,
31
31
  ConfigProfilesSchema,
32
32
  MagicContextConfigSchema
33
- } from "./index-bxmf4dhr.js";
33
+ } from "./index-ccanzg8p.js";
34
34
  import {
35
35
  MERGED_REASONING_PARTS_PREFIX,
36
36
  decodeMergedReasoningParts,
@@ -67,7 +67,7 @@ import {
67
67
  visitRawSessionMessages2,
68
68
  readRawSessionMessageById2,
69
69
  readSessionChunk2
70
- } from "./index-wveb51es.js";
70
+ } from "./index-gqjxy2p7.js";
71
71
  import {
72
72
  isRecord,
73
73
  providerVisibleMessage,
@@ -81,25 +81,25 @@ import {
81
81
  getTagNumberByMessageId2,
82
82
  getTagsBySession2,
83
83
  getTagById2
84
- } from "./index-rhprywn6.js";
84
+ } from "./index-n8e5e9fp.js";
85
85
  import {
86
86
  estimateTokens
87
- } from "./index-1kcfwk9c.js";
87
+ } from "./index-my0dn413.js";
88
88
  import {
89
89
  inRootAsyncContext2,
90
90
  Database2,
91
91
  withSqliteBackgroundWriter2,
92
92
  withoutSqliteTransformPass2
93
- } from "./index-rrwv9y2k.js";
93
+ } from "./index-2qtx0q6h.js";
94
94
  import {
95
95
  stableStringify,
96
96
  closeQuietly,
97
97
  getTableColumnNames
98
- } from "./index-jrap43gc.js";
98
+ } from "./index-w1avzkdt.js";
99
99
  import {
100
100
  piHarnessKindFromExecutable,
101
101
  isPidAlive
102
- } from "./index-apgwdby5.js";
102
+ } from "./index-n4wyxcgr.js";
103
103
  import {
104
104
  BoundedSessionMap,
105
105
  clearLkgFenceProcessState,
@@ -109,21 +109,21 @@ import {
109
109
  V2StoreReader,
110
110
  deleteSessionScopedRows,
111
111
  getLastIndexedOrdinal2
112
- } from "./index-ym6nh2gk.js";
112
+ } from "./index-wgmhk91m.js";
113
113
  import {
114
114
  resolveOpenCodeDbPath,
115
115
  assertOpenCodeStoreGeneration
116
116
  } from "./index-8976mezv.js";
117
117
  import {
118
118
  noteRawSessionSummaryRowWritten2
119
- } from "./index-vktahpdj.js";
119
+ } from "./index-at6py2k3.js";
120
120
  import {
121
121
  SubcClient,
122
122
  connectionFileExists,
123
123
  SYNAPSE_DEFAULT_MODEL,
124
124
  toSynapseLaneDescriptor,
125
125
  SynapseEmbeddingProvider
126
- } from "./index-d8gc0112.js";
126
+ } from "./index-gwxaz0z5.js";
127
127
  import {
128
128
  invalidateAutoEmbedSession,
129
129
  drainBackgroundBatches,
@@ -136,10 +136,10 @@ import {
136
136
  unregisterProjectEmbedding2,
137
137
  getProjectEmbeddingSnapshot2,
138
138
  embedTextForProject2
139
- } from "./index-vmcgew7x.js";
139
+ } from "./index-w1twp2kp.js";
140
140
  import {
141
141
  getErrorMessage
142
- } from "./index-sqt2haap.js";
142
+ } from "./index-dbgg6hsf.js";
143
143
  import {
144
144
  V2_MEMORY_CATEGORIES,
145
145
  CATEGORY_PRIORITY,
@@ -153,13 +153,13 @@ import {
153
153
  expandWorkspaceIdentitySetWithAliases,
154
154
  resolveStoredPathWorkspaceIdentity,
155
155
  storedPathBelongsToWorkspace
156
- } from "./index-msqrs4nf.js";
156
+ } from "./index-3c3ztwgc.js";
157
157
  import {
158
158
  directoryHasGitMetadata,
159
159
  resolveProjectIdentityForSession,
160
160
  normalizeStoredProjectPath,
161
161
  storedPathBelongsToIdentity
162
- } from "./index-g7p75667.js";
162
+ } from "./index-hxp6q5f8.js";
163
163
  import {
164
164
  getNoteByIdInScope,
165
165
  getNotes,
@@ -175,7 +175,7 @@ import {
175
175
  resolveMemoriesByIdsForSearch2,
176
176
  unifiedSearch2,
177
177
  formatSearchResults2
178
- } from "./index-58mj0dzc.js";
178
+ } from "./index-ftvm2acc.js";
179
179
  import {
180
180
  computeCueContentHash,
181
181
  getMuralCueState,
@@ -191,25 +191,28 @@ import {
191
191
  supersededMemory2,
192
192
  mergeMemoryStats2,
193
193
  archiveMemory2
194
- } from "./index-e1rza8gp.js";
194
+ } from "./index-29nw7n1r.js";
195
195
  import {
196
196
  saveEmbedding,
197
197
  invalidateMemory2
198
198
  } from "./index-yhzhdp3m.js";
199
+ import {
200
+ preflightLocalEmbeddingPooling
201
+ } from "./index-wqpjhx1p.js";
199
202
  import {
200
203
  isMarkerCandidateBasisCurrent2,
201
204
  invalidateMarkerCandidateBasis2,
202
205
  readMarkerCandidateBasis2
203
- } from "./index-qpq6w67c.js";
206
+ } from "./index-6wdwv3a6.js";
204
207
  import {
205
208
  renderSearchArchive2
206
- } from "./index-dtp1efvf.js";
209
+ } from "./index-st4gwt64.js";
207
210
  import {
208
211
  computeNormalizedHash
209
212
  } from "./index-9x1f96r8.js";
210
213
  import {
211
214
  logSlowWriteTransaction
212
- } from "./index-d4dt19md.js";
215
+ } from "./index-hqw0rt9k.js";
213
216
  import {
214
217
  ensureStorageDirectorySync,
215
218
  writeStorageFileAtomicSync
@@ -1943,6 +1946,17 @@ function stripUnsafeProjectConfigFields(projectRaw) {
1943
1946
  warnings.push(`Ignoring ${field} from project config (security: daemon routing and developer-only embedding traffic are user-level settings).`);
1944
1947
  }
1945
1948
  }
1949
+ if ("rerank" in projectRaw) {
1950
+ const rerank = projectRaw.rerank;
1951
+ const off = isPlainObject(rerank) && rerank.provider === "off";
1952
+ const removed = !isPlainObject(rerank) || Object.keys(rerank).some((key) => key !== "provider") || !off;
1953
+ if (off)
1954
+ projectRaw.rerank = { provider: "off" };
1955
+ else
1956
+ delete projectRaw.rerank;
1957
+ if (removed)
1958
+ warnings.push("Ignoring rerank settings from project config (security: projects may only set rerank.provider to off; hosted routing, credentials and limits are user-level only).");
1959
+ }
1946
1960
  const embedding = projectRaw.embedding;
1947
1961
  if (isPlainObject(embedding)) {
1948
1962
  const removed = [];
@@ -9932,7 +9946,7 @@ function unregisterPiProjectEmbeddings(db) {
9932
9946
  registeredIdentitiesByDatabase.delete(db);
9933
9947
  registrationFingerprintsByDatabase.get(db)?.clear();
9934
9948
  }
9935
- async function ensureProjectRegisteredFromPiDirectory(directory, db) {
9949
+ async function ensureProjectRegisteredFromPiDirectory(directory, db, options = {}) {
9936
9950
  const detailed = loadPiConfigDetailed({ cwd: directory });
9937
9951
  const projectIdentity = resolveProjectIdentityForSession(directory, detailed.config.allow_home_project);
9938
9952
  if (!projectIdentity)
@@ -9963,6 +9977,9 @@ async function ensureProjectRegisteredFromPiDirectory(directory, db) {
9963
9977
  memoryEnabled: detailed.config.memory.enabled,
9964
9978
  gitCommitEnabled: detailed.config.memory.git_commit_indexing.enabled
9965
9979
  };
9980
+ if (options.preflightLocalPooling && routing.primary.provider === "local") {
9981
+ await preflightLocalEmbeddingPooling(routing.primary.model ?? "Xenova/all-MiniLM-L6-v2");
9982
+ }
9966
9983
  let registered = registeredIdentitiesByDatabase.get(db);
9967
9984
  if (!registered) {
9968
9985
  registered = new Set;
@@ -12717,7 +12734,7 @@ function createCtxReduceTool(deps) {
12717
12734
  params = unwrapImitatedReducedArgs(params, ["drop"], { drop: "string" });
12718
12735
  const sessionId = ctx.sessionManager.getSessionId();
12719
12736
  if (!params.drop) {
12720
- return err4("Error: 'drop' must be provided.");
12737
+ return err4(`Error: 'drop' must be provided as a string of tag numbers, for example {"drop": "3-5,8"}.`);
12721
12738
  }
12722
12739
  let dropIds = [];
12723
12740
  try {
@@ -12881,7 +12898,7 @@ function createCtxSearchTool(deps) {
12881
12898
  label: "Magic Context: Search",
12882
12899
  description: CTX_SEARCH_DESCRIPTION,
12883
12900
  parameters: ParamsSchema4,
12884
- async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
12901
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
12885
12902
  params = unwrapImitatedReducedArgs(params, ["query"], {
12886
12903
  query: "string",
12887
12904
  limit: "number",
@@ -12960,6 +12977,7 @@ function createCtxSearchTool(deps) {
12960
12977
  };
12961
12978
  }
12962
12979
  }
12980
+ let rerankSkipped = "";
12963
12981
  const results = await unifiedSearch2(deps.db, sessionId, projectIdentity, query, {
12964
12982
  limit: normalizeLimit2(params.limit),
12965
12983
  memoryEnabled,
@@ -12977,13 +12995,19 @@ function createCtxSearchTool(deps) {
12977
12995
  gitRepositoryAvailable: directoryHasGitMetadata(ctx.cwd),
12978
12996
  explicitSearch: true,
12979
12997
  rerankConnectionFile: deps.rerankConnectionFile,
12998
+ rerankConfig: deps.rerankConfig,
12999
+ signal,
13000
+ onRerankSkipped: (line) => {
13001
+ rerankSkipped = line;
13002
+ },
12980
13003
  ...dateRange
12981
13004
  });
12982
13005
  return {
12983
13006
  content: [
12984
13007
  {
12985
13008
  type: "text",
12986
- text: formatSearchResults2(query, results, sessionId, diagnostics)
13009
+ text: formatSearchResults2(query, results, sessionId, diagnostics) + (rerankSkipped ? `
13010
+ ${rerankSkipped}` : "")
12987
13011
  }
12988
13012
  ],
12989
13013
  details: undefined
@@ -13521,6 +13545,11 @@ function createTodowriteTool() {
13521
13545
 
13522
13546
  // src/tools/index.ts
13523
13547
  var CTX_MEMORY_TOOL_NAME = "ctx_memory";
13548
+ function setOmpEssentialLoadMode(definition) {
13549
+ if (resolvePiHarnessKind() !== "omp")
13550
+ return definition;
13551
+ return Object.assign(definition, { loadMode: "essential" });
13552
+ }
13524
13553
  function syncCtxMemoryToolEnabled(pi, memoryEnabled) {
13525
13554
  const activeTools = pi.getActiveTools();
13526
13555
  const isActive = activeTools.includes(CTX_MEMORY_TOOL_NAME);
@@ -13539,11 +13568,11 @@ function registerMagicContextTools(pi, opts) {
13539
13568
  const surfaceTool = (definition) => {
13540
13569
  const parameters = structuredClone(definition.parameters);
13541
13570
  applyJsonSchemaParameterDescriptions(definition.name, parameters, registration.preset, smartNotesAvailable ? opts.smartNotesEnabled : false);
13542
- return throwReturnedToolErrors({
13571
+ return setOmpEssentialLoadMode(throwReturnedToolErrors({
13543
13572
  ...definition,
13544
13573
  parameters,
13545
13574
  description: definition.name === "ctx_note" && !smartNotesAvailable ? withoutSmartNoteText(registration.preset === "light" ? CTX_NOTE_LIGHT_DESCRIPTION : definition.description) : registration.descriptionFor(definition.name, definition.description)
13546
- });
13575
+ }));
13547
13576
  };
13548
13577
  pi.registerTool(surfaceTool(createCtxSearchTool({
13549
13578
  db: opts.db,
@@ -13552,6 +13581,7 @@ function registerMagicContextTools(pi, opts) {
13552
13581
  embeddingEnabled: opts.embeddingEnabled,
13553
13582
  gitCommitsEnabled: opts.gitCommitsEnabled,
13554
13583
  rerankConnectionFile: opts.rerankConnectionFile,
13584
+ rerankConfig: opts.rerankConfig,
13555
13585
  resolveProjectIdentity
13556
13586
  })));
13557
13587
  if (opts.memoryToolEnabled !== false) {
@@ -13565,7 +13595,7 @@ function registerMagicContextTools(pi, opts) {
13565
13595
  };
13566
13596
  pi.registerTool(surfaceTool(createCtxMemoryTool(memoryDeps)));
13567
13597
  if (opts.allowDreamerActions === true) {
13568
- pi.registerTool(throwReturnedToolErrors(createCtxMemoryListTool(memoryDeps)));
13598
+ pi.registerTool(setOmpEssentialLoadMode(throwReturnedToolErrors(createCtxMemoryListTool(memoryDeps))));
13569
13599
  }
13570
13600
  }
13571
13601
  if (!opts.sessionScopedToolsDisabled) {