@remnic/core 9.3.758 → 9.3.759

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 (119) hide show
  1. package/dist/access-admin-ops-surface.d.ts +2 -2
  2. package/dist/access-admin-ops-surface.js +4 -4
  3. package/dist/access-boundary.d.ts +2 -2
  4. package/dist/access-boundary.js +5 -5
  5. package/dist/access-cli.js +25 -25
  6. package/dist/access-http.d.ts +2 -2
  7. package/dist/access-http.js +9 -9
  8. package/dist/access-identity-continuity-surface.d.ts +1 -1
  9. package/dist/access-identity-continuity-surface.js +4 -4
  10. package/dist/access-lcm-surface.d.ts +2 -2
  11. package/dist/access-lcm-surface.js +4 -4
  12. package/dist/access-mcp.d.ts +2 -2
  13. package/dist/access-mcp.js +8 -8
  14. package/dist/access-observe-write-surface.d.ts +2 -2
  15. package/dist/access-observe-write-surface.js +4 -4
  16. package/dist/access-operations-batch.js +6 -6
  17. package/dist/access-operations.d.ts +6 -6
  18. package/dist/access-operations.js +7 -7
  19. package/dist/access-recall-surface.d.ts +2 -2
  20. package/dist/access-recall-surface.js +4 -4
  21. package/dist/access-schema.d.ts +68 -68
  22. package/dist/{access-service-Z-8CnmrW.d.ts → access-service-BW-gb3DL.d.ts} +1 -1
  23. package/dist/access-service.d.ts +2 -2
  24. package/dist/access-service.js +4 -4
  25. package/dist/access-surface-catalog.d.ts +2 -2
  26. package/dist/bootstrap.d.ts +1 -1
  27. package/dist/briefing.js +2 -2
  28. package/dist/causal-consolidation.js +3 -3
  29. package/dist/{chunk-QJUZAUAD.js → chunk-2XE4F3VZ.js} +12 -12
  30. package/dist/{chunk-HO3VUUGI.js → chunk-3JBW3GHN.js} +2 -2
  31. package/dist/{chunk-CJDGB3EG.js → chunk-6CUUFFU7.js} +2 -2
  32. package/dist/{chunk-7I2QTC2K.js → chunk-7HWOEYHW.js} +2 -2
  33. package/dist/{chunk-YQYG24C6.js → chunk-AZSSKOG6.js} +3 -3
  34. package/dist/{chunk-RF6BZHOD.js → chunk-DTSOB2YF.js} +2 -2
  35. package/dist/{chunk-LQDA67TT.js → chunk-EGQ3AVZV.js} +2 -2
  36. package/dist/{chunk-ILB2MFTS.js → chunk-FYJWEGYP.js} +2 -2
  37. package/dist/{chunk-LX4ZWRGD.js → chunk-ILVF6TIY.js} +2 -2
  38. package/dist/{chunk-ZFYML7C3.js → chunk-IOZZG75J.js} +2 -2
  39. package/dist/{chunk-6C6BBBCI.js → chunk-IZLGHKWA.js} +4 -4
  40. package/dist/{chunk-EOTTKLPJ.js → chunk-LLVKDFNU.js} +2 -2
  41. package/dist/{chunk-QEAOKI4U.js → chunk-M2AAYJVI.js} +2 -2
  42. package/dist/{chunk-ZLOD23PD.js → chunk-OLEBPUZ7.js} +4 -4
  43. package/dist/{chunk-QKOTOUVR.js → chunk-P26O6R3Q.js} +3 -3
  44. package/dist/{chunk-K2DJQOE3.js → chunk-PKRRBRY2.js} +2 -2
  45. package/dist/{chunk-TMXTQCJ7.js → chunk-QOM3F6YW.js} +4 -4
  46. package/dist/{chunk-IWI2ICTF.js → chunk-QQJMVF6P.js} +3 -3
  47. package/dist/{chunk-TVWF3GNF.js → chunk-QUGPXPFJ.js} +5 -5
  48. package/dist/{chunk-PJ5AG6D4.js → chunk-SLAZZXBU.js} +2 -2
  49. package/dist/{chunk-7ME6VBF7.js → chunk-SMLMH7S5.js} +118 -79
  50. package/dist/chunk-SMLMH7S5.js.map +1 -0
  51. package/dist/{chunk-CQCCVJZO.js → chunk-SN2EWIAI.js} +2 -2
  52. package/dist/{chunk-RQNV75HR.js → chunk-WIXQ3F5P.js} +2 -2
  53. package/dist/{chunk-DUQHQ3TL.js → chunk-YP23FQPT.js} +3 -4
  54. package/dist/chunk-YP23FQPT.js.map +1 -0
  55. package/dist/{chunk-ODC4HOUZ.js → chunk-ZEQVS6AZ.js} +2 -2
  56. package/dist/{cli-C5pCwszN.d.ts → cli-D551dnva.d.ts} +2 -2
  57. package/dist/cli.d.ts +3 -3
  58. package/dist/cli.js +19 -19
  59. package/dist/compounding/engine.js +2 -2
  60. package/dist/connectors/codex-materialize-runner.js +2 -2
  61. package/dist/connectors/index.js +2 -2
  62. package/dist/entity-retrieval.js +2 -2
  63. package/dist/explicit-capture.d.ts +1 -1
  64. package/dist/index.d.ts +4 -4
  65. package/dist/index.js +25 -25
  66. package/dist/maintenance/memory-governance.js +2 -2
  67. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +2 -2
  68. package/dist/maintenance/rebuild-memory-projection.js +3 -3
  69. package/dist/mcp-memory-inspector-app.d.ts +2 -2
  70. package/dist/namespaces/migrate.js +3 -3
  71. package/dist/namespaces/storage.js +2 -2
  72. package/dist/operator-toolkit.js +6 -6
  73. package/dist/orchestration/maintenance.js +4 -4
  74. package/dist/{orchestrator-Xm6sK5jw.d.ts → orchestrator-BnM187cb.d.ts} +2 -1
  75. package/dist/orchestrator.d.ts +1 -1
  76. package/dist/orchestrator.js +25 -25
  77. package/dist/schemas.d.ts +90 -90
  78. package/dist/semantic-consolidation.js +3 -3
  79. package/dist/semantic-rule-promotion.js +2 -2
  80. package/dist/semantic-rule-verifier.js +2 -2
  81. package/dist/shared-context/manager.d.ts +8 -8
  82. package/dist/storage.js +1 -1
  83. package/dist/transfer/types.d.ts +66 -66
  84. package/dist/verified-recall.js +2 -2
  85. package/package.json +2 -2
  86. package/src/orchestration/recall-background-writes.ts +24 -0
  87. package/src/orchestration/recall-entry.ts +5 -0
  88. package/src/orchestration/recall-internal.ts +15 -11
  89. package/src/orchestration/recall-introspection.ts +5 -0
  90. package/src/orchestrator-background-writes.test.ts +101 -0
  91. package/src/orchestrator.ts +13 -13
  92. package/src/storage-contract/round-trip.test.ts +5 -0
  93. package/src/storage.ts +2 -3
  94. package/src/trust-score-recall-paths.test.ts +2 -0
  95. package/dist/chunk-7ME6VBF7.js.map +0 -1
  96. package/dist/chunk-DUQHQ3TL.js.map +0 -1
  97. /package/dist/{chunk-QJUZAUAD.js.map → chunk-2XE4F3VZ.js.map} +0 -0
  98. /package/dist/{chunk-HO3VUUGI.js.map → chunk-3JBW3GHN.js.map} +0 -0
  99. /package/dist/{chunk-CJDGB3EG.js.map → chunk-6CUUFFU7.js.map} +0 -0
  100. /package/dist/{chunk-7I2QTC2K.js.map → chunk-7HWOEYHW.js.map} +0 -0
  101. /package/dist/{chunk-YQYG24C6.js.map → chunk-AZSSKOG6.js.map} +0 -0
  102. /package/dist/{chunk-RF6BZHOD.js.map → chunk-DTSOB2YF.js.map} +0 -0
  103. /package/dist/{chunk-LQDA67TT.js.map → chunk-EGQ3AVZV.js.map} +0 -0
  104. /package/dist/{chunk-ILB2MFTS.js.map → chunk-FYJWEGYP.js.map} +0 -0
  105. /package/dist/{chunk-LX4ZWRGD.js.map → chunk-ILVF6TIY.js.map} +0 -0
  106. /package/dist/{chunk-ZFYML7C3.js.map → chunk-IOZZG75J.js.map} +0 -0
  107. /package/dist/{chunk-6C6BBBCI.js.map → chunk-IZLGHKWA.js.map} +0 -0
  108. /package/dist/{chunk-EOTTKLPJ.js.map → chunk-LLVKDFNU.js.map} +0 -0
  109. /package/dist/{chunk-QEAOKI4U.js.map → chunk-M2AAYJVI.js.map} +0 -0
  110. /package/dist/{chunk-ZLOD23PD.js.map → chunk-OLEBPUZ7.js.map} +0 -0
  111. /package/dist/{chunk-QKOTOUVR.js.map → chunk-P26O6R3Q.js.map} +0 -0
  112. /package/dist/{chunk-K2DJQOE3.js.map → chunk-PKRRBRY2.js.map} +0 -0
  113. /package/dist/{chunk-TMXTQCJ7.js.map → chunk-QOM3F6YW.js.map} +0 -0
  114. /package/dist/{chunk-IWI2ICTF.js.map → chunk-QQJMVF6P.js.map} +0 -0
  115. /package/dist/{chunk-TVWF3GNF.js.map → chunk-QUGPXPFJ.js.map} +0 -0
  116. /package/dist/{chunk-PJ5AG6D4.js.map → chunk-SLAZZXBU.js.map} +0 -0
  117. /package/dist/{chunk-CQCCVJZO.js.map → chunk-SN2EWIAI.js.map} +0 -0
  118. /package/dist/{chunk-RQNV75HR.js.map → chunk-WIXQ3F5P.js.map} +0 -0
  119. /package/dist/{chunk-ODC4HOUZ.js.map → chunk-ZEQVS6AZ.js.map} +0 -0
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-5QANTTY2.js";
11
11
  import {
12
12
  MaintenanceScheduler
13
- } from "./chunk-7I2QTC2K.js";
13
+ } from "./chunk-7HWOEYHW.js";
14
14
  import {
15
15
  runPeerProfileReasoner
16
16
  } from "./chunk-I74SUMNI.js";
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  CompoundingEngine,
28
28
  defaultTierMigrationCycleBudget
29
- } from "./chunk-ODC4HOUZ.js";
29
+ } from "./chunk-ZEQVS6AZ.js";
30
30
  import {
31
31
  SharedContextManager
32
32
  } from "./chunk-JRZV3767.js";
@@ -191,7 +191,7 @@ import {
191
191
  buildEntityRecallSection,
192
192
  entityRecentTranscriptLookbackHours,
193
193
  readRecentEntityTranscriptEntries
194
- } from "./chunk-K2DJQOE3.js";
194
+ } from "./chunk-PKRRBRY2.js";
195
195
  import {
196
196
  buildEventOrderRecallSection,
197
197
  shouldRecallEventOrderEvidence
@@ -208,14 +208,14 @@ import {
208
208
  import {
209
209
  compareVerifiedEpisodeResults,
210
210
  searchVerifiedEpisodes
211
- } from "./chunk-ILB2MFTS.js";
211
+ } from "./chunk-FYJWEGYP.js";
212
212
  import {
213
213
  ThreadingManager
214
214
  } from "./chunk-QRDOSYOR.js";
215
215
  import {
216
216
  compareVerifiedSemanticRuleResults,
217
217
  searchVerifiedSemanticRules
218
- } from "./chunk-ZFYML7C3.js";
218
+ } from "./chunk-IOZZG75J.js";
219
219
  import {
220
220
  searchWorkProductLedgerEntries
221
221
  } from "./chunk-ZRWB5D4H.js";
@@ -228,14 +228,14 @@ import {
228
228
  import {
229
229
  runNamespaceMaintenanceFanout,
230
230
  summarizeNamespaceMaintenanceHealth
231
- } from "./chunk-TVWF3GNF.js";
231
+ } from "./chunk-QUGPXPFJ.js";
232
232
  import {
233
233
  NamespaceCatalog,
234
234
  planNamespaceMaintenance
235
- } from "./chunk-CJDGB3EG.js";
235
+ } from "./chunk-6CUUFFU7.js";
236
236
  import {
237
237
  NamespaceStorageRouter
238
- } from "./chunk-LQDA67TT.js";
238
+ } from "./chunk-EGQ3AVZV.js";
239
239
  import {
240
240
  isAboveImportanceThreshold,
241
241
  scoreImportance
@@ -270,7 +270,7 @@ import {
270
270
  materializeAfterSemanticConsolidation,
271
271
  parseConsolidationResponse,
272
272
  parseOperatorAwareConsolidationResponse
273
- } from "./chunk-LX4ZWRGD.js";
273
+ } from "./chunk-ILVF6TIY.js";
274
274
  import {
275
275
  BoxBuilder
276
276
  } from "./chunk-7FL4CNPV.js";
@@ -316,7 +316,7 @@ import {
316
316
  createCorrectionService,
317
317
  detectPassiveCorrections,
318
318
  qmdCollectionPathParts
319
- } from "./chunk-6C6BBBCI.js";
319
+ } from "./chunk-IZLGHKWA.js";
320
320
  import {
321
321
  importCapsule
322
322
  } from "./chunk-M5QKGHCR.js";
@@ -383,7 +383,7 @@ import {
383
383
  } from "./chunk-SQNED75R.js";
384
384
  import {
385
385
  buildChainFollowupGenerator
386
- } from "./chunk-RF6BZHOD.js";
386
+ } from "./chunk-DTSOB2YF.js";
387
387
  import {
388
388
  ContentHashIndex,
389
389
  StorageManager,
@@ -392,7 +392,7 @@ import {
392
392
  normalizeAttributePairs,
393
393
  parseEntityFile,
394
394
  selfDeps
395
- } from "./chunk-DUQHQ3TL.js";
395
+ } from "./chunk-YP23FQPT.js";
396
396
  import {
397
397
  isValidTranscriptDate,
398
398
  loadSpeakerRegistry,
@@ -6366,33 +6366,36 @@ var RecallInternalCoordinator = class {
6366
6366
  }
6367
6367
  }
6368
6368
  if (sessionKey) {
6369
- this.deps.lastRecall.record({
6370
- sessionKey,
6371
- query: retrievalQuery,
6372
- memoryIds: [],
6373
- namespace: selfNamespace,
6374
- traceId,
6375
- plannerMode: recallMode,
6376
- requestedMode,
6377
- source: recallSource,
6378
- fallbackUsed: false,
6379
- sourcesUsed: [],
6380
- budgetsApplied: this.deps.buildLastRecallBudgetSummary({
6381
- requestedTopK,
6382
- recallResultLimit,
6383
- qmdFetchLimit,
6384
- qmdHybridFetchLimit
6369
+ this.deps.trackRecallBackgroundWrite(
6370
+ this.deps.lastRecall.record({
6371
+ sessionKey,
6372
+ query: retrievalQuery,
6373
+ memoryIds: [],
6374
+ namespace: selfNamespace,
6375
+ traceId,
6376
+ plannerMode: recallMode,
6377
+ requestedMode,
6378
+ source: recallSource,
6379
+ fallbackUsed: false,
6380
+ sourcesUsed: [],
6381
+ budgetsApplied: this.deps.buildLastRecallBudgetSummary({
6382
+ requestedTopK,
6383
+ recallResultLimit,
6384
+ qmdFetchLimit,
6385
+ qmdHybridFetchLimit
6386
+ }),
6387
+ latencyMs: Date.now() - recallStart,
6388
+ resultPaths: [],
6389
+ policyVersion,
6390
+ appendImpression: this.deps.config.recordEmptyRecallImpressions,
6391
+ identityInjection: {
6392
+ mode: identityInjectionModeUsed,
6393
+ injectedChars: identityInjectedChars,
6394
+ truncated: identityInjectionTruncated
6395
+ }
6385
6396
  }),
6386
- latencyMs: Date.now() - recallStart,
6387
- resultPaths: [],
6388
- policyVersion,
6389
- appendImpression: this.deps.config.recordEmptyRecallImpressions,
6390
- identityInjection: {
6391
- mode: identityInjectionModeUsed,
6392
- injectedChars: identityInjectedChars,
6393
- truncated: identityInjectionTruncated
6394
- }
6395
- }).catch((err) => log.debug(`last recall record failed: ${err}`));
6397
+ "last recall record"
6398
+ );
6396
6399
  }
6397
6400
  if (sessionKey) {
6398
6401
  this.deps.queueEvalShadowRecall({
@@ -9848,41 +9851,47 @@ _Context: ${topQuestion.context}_`
9848
9851
  }
9849
9852
  if (sessionKey) {
9850
9853
  throwIfRecallAborted(options.abortSignal);
9851
- this.deps.lastRecall.record({
9852
- sessionKey,
9853
- query: retrievalQuery,
9854
- memoryIds: recalledMemoryIds,
9855
- namespace: selfNamespace,
9856
- recallNamespaces,
9857
- traceId,
9858
- plannerMode: recallMode,
9859
- requestedMode,
9860
- source: recallSource,
9861
- fallbackUsed: recallSource !== "none" && recallSource !== "hot_qmd",
9862
- sourcesUsed,
9863
- budgetsApplied,
9864
- latencyMs: Date.now() - recallStart,
9865
- resultPaths: recalledMemoryPaths,
9866
- policyVersion,
9867
- appendImpression: impressionRecorded || recalledMemoryIds.length > 0 || this.deps.config.recordEmptyRecallImpressions,
9868
- identityInjection: {
9869
- mode: identityInjectionModeUsed,
9870
- injectedChars: identityInjectedChars,
9871
- truncated: identityInjectionTruncated
9872
- },
9873
- // Included at record time so the published snapshot is born
9874
- // annotated a post-record annotation leaves a window where
9875
- // readers see the snapshot without degradations, and a concurrent
9876
- // same-session recall could drop them entirely (codex + cursor
9877
- // reviews on #1544).
9878
- backendDegradations: backendDegradations.length > 0 ? backendDegradations : void 0
9879
- }).catch((err) => log.debug(`last recall record failed: ${err}`));
9854
+ this.deps.trackRecallBackgroundWrite(
9855
+ this.deps.lastRecall.record({
9856
+ sessionKey,
9857
+ query: retrievalQuery,
9858
+ memoryIds: recalledMemoryIds,
9859
+ namespace: selfNamespace,
9860
+ recallNamespaces,
9861
+ traceId,
9862
+ plannerMode: recallMode,
9863
+ requestedMode,
9864
+ source: recallSource,
9865
+ fallbackUsed: recallSource !== "none" && recallSource !== "hot_qmd",
9866
+ sourcesUsed,
9867
+ budgetsApplied,
9868
+ latencyMs: Date.now() - recallStart,
9869
+ resultPaths: recalledMemoryPaths,
9870
+ policyVersion,
9871
+ appendImpression: impressionRecorded || recalledMemoryIds.length > 0 || this.deps.config.recordEmptyRecallImpressions,
9872
+ identityInjection: {
9873
+ mode: identityInjectionModeUsed,
9874
+ injectedChars: identityInjectedChars,
9875
+ truncated: identityInjectionTruncated
9876
+ },
9877
+ // Included at record time so the published snapshot is born
9878
+ // annotated a post-record annotation leaves a window where
9879
+ // readers see the snapshot without degradations, and a concurrent
9880
+ // same-session recall could drop them entirely (codex + cursor
9881
+ // reviews on #1544).
9882
+ backendDegradations: backendDegradations.length > 0 ? backendDegradations : void 0
9883
+ }),
9884
+ "last recall record"
9885
+ );
9880
9886
  if (this.deps.config.recallMemoryHandles && recalledMemoryIds.length > 0) {
9881
9887
  const handleEligibleIds = recalledMemoryIds.filter(
9882
9888
  (id) => MEMORY_ID_PATTERN.test(id)
9883
9889
  );
9884
9890
  if (handleEligibleIds.length > 0) {
9885
- this.deps.handleHistory.record(sessionKey, handleEligibleIds).catch((err) => log.debug(`handle history record failed: ${err}`));
9891
+ this.deps.trackRecallBackgroundWrite(
9892
+ this.deps.handleHistory.record(sessionKey, handleEligibleIds),
9893
+ "handle history record"
9894
+ );
9886
9895
  }
9887
9896
  }
9888
9897
  }
@@ -12359,6 +12368,10 @@ var RecallIntrospectionCoordinator = class {
12359
12368
  log.debug(`direct-answer observation chain error: ${err}`);
12360
12369
  }
12361
12370
  });
12371
+ this.deps.trackRecallBackgroundWrite(
12372
+ this.deps.directAnswerObservationChain,
12373
+ "direct-answer observation"
12374
+ );
12362
12375
  }
12363
12376
  async annotateDirectAnswerTier(prompt, sessionKey, namespaces, expectedIdentity, caps, _parentAbortSignal) {
12364
12377
  const tierStart = Date.now();
@@ -14868,6 +14881,10 @@ var RecallEntryCoordinator = class {
14868
14881
  log.debug(`eval shadow recall write failed: ${err}`);
14869
14882
  }
14870
14883
  });
14884
+ this.deps.trackRecallBackgroundWrite(
14885
+ this.deps.evalShadowWriteChain,
14886
+ "eval shadow recall write"
14887
+ );
14871
14888
  }
14872
14889
  publishRecallResults(options) {
14873
14890
  const sectionId = "memories";
@@ -15143,6 +15160,28 @@ var SessionContextCoordinator = class {
15143
15160
  }
15144
15161
  };
15145
15162
 
15163
+ // src/orchestration/recall-background-writes.ts
15164
+ var pendingWritesByOwner = /* @__PURE__ */ new WeakMap();
15165
+ function trackRecallWrite(owner, promise, label) {
15166
+ const observed = promise.catch((err) => {
15167
+ log.debug(`${label} failed: ${err}`);
15168
+ });
15169
+ const pendingWrites = pendingWritesByOwner.get(owner) ?? /* @__PURE__ */ new Set();
15170
+ pendingWritesByOwner.set(owner, pendingWrites);
15171
+ pendingWrites.add(observed);
15172
+ void observed.finally(() => {
15173
+ pendingWrites.delete(observed);
15174
+ if (pendingWrites.size === 0) pendingWritesByOwner.delete(owner);
15175
+ });
15176
+ }
15177
+ async function drainRecallWrites(owner) {
15178
+ while (true) {
15179
+ const pendingWrites = pendingWritesByOwner.get(owner);
15180
+ if (!pendingWrites || pendingWrites.size === 0) return;
15181
+ await Promise.all(pendingWrites);
15182
+ }
15183
+ }
15184
+
15146
15185
  // src/orchestrator.ts
15147
15186
  var Orchestrator = class {
15148
15187
  storage;
@@ -15281,8 +15320,7 @@ var Orchestrator = class {
15281
15320
  artifactSourceStatusCache = /* @__PURE__ */ new WeakMap();
15282
15321
  /** Read by NamespaceReadFanoutCoordinator (seam 26), hence not `private`. */
15283
15322
  static ARTIFACT_STATUS_CACHE_TTL_MS = 6e4;
15284
- // Access tracking buffer (Phase 1A)
15285
- // Maps memoryId -> {count, lastAccessed} for batched updates
15323
+ // Batched access-tracking counts and timestamps (Phase 1A).
15286
15324
  accessTrackingBuffer = /* @__PURE__ */ new Map();
15287
15325
  // Passive correction capture (issue #1581) — dedup state + lazy service.
15288
15326
  passiveCorrectionDedup = /* @__PURE__ */ new Set();
@@ -15445,9 +15483,7 @@ var Orchestrator = class {
15445
15483
  runtimePolicyValues = null;
15446
15484
  utilityRuntimeValues = null;
15447
15485
  evalShadowWriteChain = Promise.resolve();
15448
- // Pending background observation-mode direct-answer annotations (#518).
15449
- // Tracks fire-and-forget `annotateDirectAnswerTier` calls so callers (tests,
15450
- // waitForDirectAnswerObservationIdle) can await settlement.
15486
+ // Pending fire-and-forget direct-answer tier annotations (#518).
15451
15487
  directAnswerObservationChain = Promise.resolve();
15452
15488
  // Initialization gate: recall() awaits this before proceeding
15453
15489
  initPromise = null;
@@ -15487,8 +15523,9 @@ var Orchestrator = class {
15487
15523
  this.deferredInitAbort = null;
15488
15524
  }
15489
15525
  }
15490
- async disposeSearchBackendIfNeeded() {
15491
- await this.qmd.dispose?.();
15526
+ /** Track a recall-side write so destroy() can wait for it before teardown. @internal */
15527
+ trackRecallBackgroundWrite(promise, label) {
15528
+ trackRecallWrite(this, promise, label);
15492
15529
  }
15493
15530
  /**
15494
15531
  * Stop background initialization and release runtime-owned handles.
@@ -15502,8 +15539,9 @@ var Orchestrator = class {
15502
15539
  this.wearablesAutoSyncHandle = null;
15503
15540
  }
15504
15541
  this.maintenanceScheduler.dispose();
15542
+ await drainRecallWrites(this);
15505
15543
  await this.namespaceSearchRouter.dispose();
15506
- await this.disposeSearchBackendIfNeeded();
15544
+ await this.qmd.dispose?.();
15507
15545
  if (this.conversationQmd && this.conversationQmd !== this.qmd) {
15508
15546
  await this.conversationQmd.dispose?.();
15509
15547
  }
@@ -17212,8 +17250,9 @@ ${doc.content}` : doc.content,
17212
17250
  });
17213
17251
  }
17214
17252
  if (this.accessTrackingBuffer.size >= this.config.accessTrackingBufferMaxSize) {
17215
- this.flushAccessTracking().catch(
17216
- (err) => log.debug(`background access tracking flush failed: ${err}`)
17253
+ this.trackRecallBackgroundWrite(
17254
+ this.flushAccessTracking(),
17255
+ "background access tracking flush"
17217
17256
  );
17218
17257
  }
17219
17258
  }
@@ -22684,4 +22723,4 @@ export {
22684
22723
  blendGraphExpandedRecallScore,
22685
22724
  Orchestrator
22686
22725
  };
22687
- //# sourceMappingURL=chunk-7ME6VBF7.js.map
22726
+ //# sourceMappingURL=chunk-SMLMH7S5.js.map