@remnic/core 10.0.158 → 10.0.159

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 (40) hide show
  1. package/dist/access-admin-ops-surface.js +2 -2
  2. package/dist/access-cli.js +2 -2
  3. package/dist/access-extraction-force-flush-preempt.js +2 -2
  4. package/dist/access-extraction-force-flush.js +2 -2
  5. package/dist/access-http-briefing.js +2 -2
  6. package/dist/access-http-query.js +2 -2
  7. package/dist/access-http.js +2 -2
  8. package/dist/access-identity-continuity-surface.js +2 -2
  9. package/dist/access-lcm-surface.js +2 -2
  10. package/dist/access-mcp.js +2 -2
  11. package/dist/access-observe-write-surface.js +2 -2
  12. package/dist/access-operations-batch.js +2 -2
  13. package/dist/access-operations.js +2 -2
  14. package/dist/access-recall-concurrency.js +2 -2
  15. package/dist/access-recall-response.js +2 -2
  16. package/dist/access-recall-surface.js +2 -2
  17. package/dist/access-service.js +2 -2
  18. package/dist/{chunk-DQ2N7IN6.js → chunk-3RHD5TF5.js} +32 -24
  19. package/dist/{chunk-DQ2N7IN6.js.map → chunk-3RHD5TF5.js.map} +1 -1
  20. package/dist/{chunk-4IJBNRMZ.js → chunk-DRXFLPSE.js} +12 -2
  21. package/dist/chunk-DRXFLPSE.js.map +1 -0
  22. package/dist/{chunk-RV7IYUBK.js → chunk-XC5BRK7J.js} +2 -2
  23. package/dist/cli.js +2 -2
  24. package/dist/explicit-capture.js +2 -2
  25. package/dist/index.js +2 -2
  26. package/dist/orchestration/backlog-scheduler.js +3 -3
  27. package/dist/orchestration/buffer-drain-runner.js +3 -3
  28. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  29. package/dist/orchestrator.js +2 -2
  30. package/dist/recall-enrichment-promise.d.ts +7 -2
  31. package/dist/recall-enrichment-promise.d.ts.map +1 -1
  32. package/dist/recall-enrichment-promise.js +1 -1
  33. package/dist/recall-navigation.js +2 -2
  34. package/package.json +2 -2
  35. package/src/orchestration/recall-internal.ts +36 -24
  36. package/src/recall-enrichment-promise.ts +20 -2
  37. package/src/recall-qos.test.ts +24 -0
  38. package/src/recall-timings-request-contract.test.ts +10 -8
  39. package/dist/chunk-4IJBNRMZ.js.map +0 -1
  40. /package/dist/{chunk-RV7IYUBK.js.map → chunk-XC5BRK7J.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  // src/recall-enrichment-promise.ts
2
- function createEnrichmentAbortHandle(parentSignal) {
2
+ function createEnrichmentAbortHandle(parentSignal, deadlineMs) {
3
3
  const controller = new AbortController();
4
4
  const onAbort = () => controller.abort();
5
5
  if (parentSignal?.aborted) {
@@ -7,14 +7,24 @@ function createEnrichmentAbortHandle(parentSignal) {
7
7
  } else if (parentSignal) {
8
8
  parentSignal.addEventListener("abort", onAbort, { once: true });
9
9
  }
10
+ let timedOut = false;
11
+ const timer = deadlineMs !== void 0 && Number.isFinite(deadlineMs) && deadlineMs > 0 ? setTimeout(() => {
12
+ timedOut = true;
13
+ controller.abort();
14
+ }, deadlineMs) : void 0;
15
+ timer?.unref?.();
10
16
  let disposed = false;
11
17
  const dispose = () => {
12
18
  if (disposed) return;
13
19
  disposed = true;
20
+ if (timer !== void 0) clearTimeout(timer);
14
21
  parentSignal?.removeEventListener("abort", onAbort);
15
22
  };
16
23
  return {
17
24
  signal: controller.signal,
25
+ get timedOut() {
26
+ return timedOut;
27
+ },
18
28
  cancel: () => {
19
29
  controller.abort();
20
30
  dispose();
@@ -42,4 +52,4 @@ export {
42
52
  createEnrichmentAbortHandle,
43
53
  observeEnrichmentPromise
44
54
  };
45
- //# sourceMappingURL=chunk-4IJBNRMZ.js.map
55
+ //# sourceMappingURL=chunk-DRXFLPSE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/recall-enrichment-promise.ts"],"sourcesContent":["export type DeferredEnrichmentOutcome<T> =\n | { status: \"resolved\"; value: T }\n | { status: \"rejected\"; error: unknown };\n\nexport type ObservedDeferredEnrichmentPromise<T> =\n Promise<DeferredEnrichmentOutcome<T>> & {\n getSettledOutcome: () => DeferredEnrichmentOutcome<T> | undefined;\n cancel: () => void;\n };\n\n/** Cancelable child abort signal owned by one enrichment promise. */\nexport interface EnrichmentAbortHandle {\n signal: AbortSignal;\n /** True only when the handle's own deadline fired — not a parent abort or a manual cancel. */\n readonly timedOut: boolean;\n cancel: () => void;\n dispose: () => void;\n}\n\n/** Child abort controller that follows `parentSignal` and, when `deadlineMs` is\n * finite and positive, fires on its own at that deadline — the metric label the\n * enrichment sections already carried, enforced (#3499). `dispose` detaches the\n * listener and clears the timer. */\nexport function createEnrichmentAbortHandle(parentSignal?: AbortSignal, deadlineMs?: number): EnrichmentAbortHandle {\n const controller = new AbortController();\n const onAbort = () => controller.abort();\n if (parentSignal?.aborted) {\n controller.abort();\n } else if (parentSignal) {\n parentSignal.addEventListener(\"abort\", onAbort, { once: true });\n }\n let timedOut = false;\n const timer =\n deadlineMs !== undefined && Number.isFinite(deadlineMs) && deadlineMs > 0\n ? setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, deadlineMs)\n : undefined;\n timer?.unref?.();\n let disposed = false;\n const dispose = () => {\n if (disposed) return;\n disposed = true;\n if (timer !== undefined) clearTimeout(timer);\n parentSignal?.removeEventListener(\"abort\", onAbort);\n };\n return {\n signal: controller.signal,\n get timedOut() {\n return timedOut;\n },\n cancel: () => {\n controller.abort();\n dispose();\n },\n dispose,\n };\n}\n\n/** Never-rejecting view of `promise` that also exposes its settled outcome and a cancel hook. */\nexport function observeEnrichmentPromise<T>(\n promise: Promise<T>,\n cancel: () => void = () => {},\n): ObservedDeferredEnrichmentPromise<T> {\n let settledOutcome: DeferredEnrichmentOutcome<T> | undefined;\n const settled = promise\n .then<DeferredEnrichmentOutcome<T>, DeferredEnrichmentOutcome<T>>(\n (value) => ({ status: \"resolved\", value }),\n (error) => ({ status: \"rejected\", error }),\n )\n .then((outcome) => {\n settledOutcome = outcome;\n return outcome;\n });\n return Object.assign(settled, {\n getSettledOutcome: () => settledOutcome,\n cancel,\n });\n}\n"],"mappings":";AAuBO,SAAS,4BAA4B,cAA4B,YAA4C;AAClH,QAAM,aAAa,IAAI,gBAAgB;AACvC,QAAM,UAAU,MAAM,WAAW,MAAM;AACvC,MAAI,cAAc,SAAS;AACzB,eAAW,MAAM;AAAA,EACnB,WAAW,cAAc;AACvB,iBAAa,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAAA,EAChE;AACA,MAAI,WAAW;AACf,QAAM,QACJ,eAAe,UAAa,OAAO,SAAS,UAAU,KAAK,aAAa,IACpE,WAAW,MAAM;AACf,eAAW;AACX,eAAW,MAAM;AAAA,EACnB,GAAG,UAAU,IACb;AACN,SAAO,QAAQ;AACf,MAAI,WAAW;AACf,QAAM,UAAU,MAAM;AACpB,QAAI,SAAU;AACd,eAAW;AACX,QAAI,UAAU,OAAW,cAAa,KAAK;AAC3C,kBAAc,oBAAoB,SAAS,OAAO;AAAA,EACpD;AACA,SAAO;AAAA,IACL,QAAQ,WAAW;AAAA,IACnB,IAAI,WAAW;AACb,aAAO;AAAA,IACT;AAAA,IACA,QAAQ,MAAM;AACZ,iBAAW,MAAM;AACjB,cAAQ;AAAA,IACV;AAAA,IACA;AAAA,EACF;AACF;AAGO,SAAS,yBACd,SACA,SAAqB,MAAM;AAAC,GACU;AACtC,MAAI;AACJ,QAAM,UAAU,QACb;AAAA,IACC,CAAC,WAAW,EAAE,QAAQ,YAAY,MAAM;AAAA,IACxC,CAAC,WAAW,EAAE,QAAQ,YAAY,MAAM;AAAA,EAC1C,EACC,KAAK,CAAC,YAAY;AACjB,qBAAiB;AACjB,WAAO;AAAA,EACT,CAAC;AACH,SAAO,OAAO,OAAO,SAAS;AAAA,IAC5B,mBAAmB,MAAM;AAAA,IACzB;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -2,7 +2,7 @@ import {
2
2
  ExtractionDrain,
3
3
  TurnIngestionCoordinator,
4
4
  shouldSkipImplicitExtraction
5
- } from "./chunk-DQ2N7IN6.js";
5
+ } from "./chunk-3RHD5TF5.js";
6
6
  import {
7
7
  headerConnector,
8
8
  renderExtractionConversation,
@@ -447,4 +447,4 @@ export {
447
447
  ClaimBufferStorage,
448
448
  BufferDrainRunner
449
449
  };
450
- //# sourceMappingURL=chunk-RV7IYUBK.js.map
450
+ //# sourceMappingURL=chunk-XC5BRK7J.js.map
package/dist/cli.js CHANGED
@@ -91,7 +91,7 @@ import {
91
91
  runWorkProductStatusCliCommand,
92
92
  runWorkProjectCliCommand,
93
93
  runWorkTaskCliCommand
94
- } from "./chunk-DQ2N7IN6.js";
94
+ } from "./chunk-3RHD5TF5.js";
95
95
  import "./chunk-TH6OYP6I.js";
96
96
  import "./chunk-PQM3B54K.js";
97
97
  import "./chunk-2MWKUVHT.js";
@@ -229,7 +229,7 @@ import "./chunk-VYDGHJIN.js";
229
229
  import "./chunk-6NPLVV6M.js";
230
230
  import "./chunk-7O5EW7KX.js";
231
231
  import "./chunk-H7XKCNR6.js";
232
- import "./chunk-4IJBNRMZ.js";
232
+ import "./chunk-DRXFLPSE.js";
233
233
  import "./chunk-H6OTEBPK.js";
234
234
  import "./chunk-SOBJ6NEY.js";
235
235
  import "./chunk-O7CHKXSF.js";
@@ -8,7 +8,7 @@ import {
8
8
  shouldSkipImplicitExtraction,
9
9
  stripInlineExplicitCaptureNotes,
10
10
  validateExplicitCaptureInput
11
- } from "./chunk-DQ2N7IN6.js";
11
+ } from "./chunk-3RHD5TF5.js";
12
12
  import "./chunk-TH6OYP6I.js";
13
13
  import "./chunk-PQM3B54K.js";
14
14
  import "./chunk-2MWKUVHT.js";
@@ -146,7 +146,7 @@ import "./chunk-VYDGHJIN.js";
146
146
  import "./chunk-6NPLVV6M.js";
147
147
  import "./chunk-7O5EW7KX.js";
148
148
  import "./chunk-H7XKCNR6.js";
149
- import "./chunk-4IJBNRMZ.js";
149
+ import "./chunk-DRXFLPSE.js";
150
150
  import "./chunk-H6OTEBPK.js";
151
151
  import "./chunk-SOBJ6NEY.js";
152
152
  import "./chunk-O7CHKXSF.js";
package/dist/index.js CHANGED
@@ -259,7 +259,7 @@ import {
259
259
  writeManifest,
260
260
  writeMeetingEpisodeMemory,
261
261
  writeTimelineState
262
- } from "./chunk-DQ2N7IN6.js";
262
+ } from "./chunk-3RHD5TF5.js";
263
263
  import "./chunk-TH6OYP6I.js";
264
264
  import "./chunk-PQM3B54K.js";
265
265
  import {
@@ -597,7 +597,7 @@ import "./chunk-VYDGHJIN.js";
597
597
  import "./chunk-6NPLVV6M.js";
598
598
  import "./chunk-7O5EW7KX.js";
599
599
  import "./chunk-H7XKCNR6.js";
600
- import "./chunk-4IJBNRMZ.js";
600
+ import "./chunk-DRXFLPSE.js";
601
601
  import {
602
602
  RECALL_XRAY_FORMATS,
603
603
  parseXrayFormat,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BufferDrainRunner
3
- } from "../chunk-RV7IYUBK.js";
4
- import "../chunk-DQ2N7IN6.js";
3
+ } from "../chunk-XC5BRK7J.js";
4
+ import "../chunk-3RHD5TF5.js";
5
5
  import "../chunk-TH6OYP6I.js";
6
6
  import "../chunk-PQM3B54K.js";
7
7
  import "../chunk-2MWKUVHT.js";
@@ -139,7 +139,7 @@ import "../chunk-VYDGHJIN.js";
139
139
  import "../chunk-6NPLVV6M.js";
140
140
  import "../chunk-7O5EW7KX.js";
141
141
  import "../chunk-H7XKCNR6.js";
142
- import "../chunk-4IJBNRMZ.js";
142
+ import "../chunk-DRXFLPSE.js";
143
143
  import "../chunk-H6OTEBPK.js";
144
144
  import "../chunk-SOBJ6NEY.js";
145
145
  import "../chunk-O7CHKXSF.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  BufferDrainRunner,
3
3
  ClaimBufferStorage
4
- } from "../chunk-RV7IYUBK.js";
5
- import "../chunk-DQ2N7IN6.js";
4
+ } from "../chunk-XC5BRK7J.js";
5
+ import "../chunk-3RHD5TF5.js";
6
6
  import "../chunk-TH6OYP6I.js";
7
7
  import "../chunk-PQM3B54K.js";
8
8
  import "../chunk-2MWKUVHT.js";
@@ -140,7 +140,7 @@ import "../chunk-VYDGHJIN.js";
140
140
  import "../chunk-6NPLVV6M.js";
141
141
  import "../chunk-7O5EW7KX.js";
142
142
  import "../chunk-H7XKCNR6.js";
143
- import "../chunk-4IJBNRMZ.js";
143
+ import "../chunk-DRXFLPSE.js";
144
144
  import "../chunk-H6OTEBPK.js";
145
145
  import "../chunk-SOBJ6NEY.js";
146
146
  import "../chunk-O7CHKXSF.js";
@@ -1 +1 @@
1
- {"version":3,"file":"recall-internal.d.ts","sourceRoot":"","sources":["../../src/orchestration/recall-internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,8BAA8B,EAAE,KAAK,4BAA4B,EAAslB,MAAM,oBAAoB,CAAC;AAgEptB,OAAO,EAiBL,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAU5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAKpE,qBAAa,yBAAyB;IAExB,OAAO,CAAC,QAAQ,CAAC,IAAI;IADjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAwB;gBAChC,IAAI,EAAE,kBAAkB;IAE/C,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,uBAA4B,EACrC,IAAI,GAAE,aAAqD,EAC3D,SAAS,GAAE,8BAAuF,EAClG,aAAa,GAAE,4BAAmF,GACjG,OAAO,CAAC,MAAM,CAAC;CA8kKnB"}
1
+ {"version":3,"file":"recall-internal.d.ts","sourceRoot":"","sources":["../../src/orchestration/recall-internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,8BAA8B,EAAE,KAAK,4BAA4B,EAAslB,MAAM,oBAAoB,CAAC;AAiEptB,OAAO,EAiBL,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAU5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAKpE,qBAAa,yBAAyB;IAExB,OAAO,CAAC,QAAQ,CAAC,IAAI;IADjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAwB;gBAChC,IAAI,EAAE,kBAAkB;IAE/C,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,uBAA4B,EACrC,IAAI,GAAE,aAAqD,EAC3D,SAAS,GAAE,8BAAuF,EAClG,aAAa,GAAE,4BAAmF,GACjG,OAAO,CAAC,MAAM,CAAC;CAylKnB"}
@@ -6,7 +6,7 @@ import {
6
6
  mergeGraphExpandedResults,
7
7
  qmdStartupCollectionChecksWithTimeout,
8
8
  resolveEffectiveIdentityInjectionMode
9
- } from "./chunk-DQ2N7IN6.js";
9
+ } from "./chunk-3RHD5TF5.js";
10
10
  import "./chunk-TH6OYP6I.js";
11
11
  import "./chunk-PQM3B54K.js";
12
12
  import "./chunk-2MWKUVHT.js";
@@ -146,7 +146,7 @@ import "./chunk-VYDGHJIN.js";
146
146
  import "./chunk-6NPLVV6M.js";
147
147
  import "./chunk-7O5EW7KX.js";
148
148
  import "./chunk-H7XKCNR6.js";
149
- import "./chunk-4IJBNRMZ.js";
149
+ import "./chunk-DRXFLPSE.js";
150
150
  import "./chunk-H6OTEBPK.js";
151
151
  import "./chunk-SOBJ6NEY.js";
152
152
  import "./chunk-O7CHKXSF.js";
@@ -12,11 +12,16 @@ export type ObservedDeferredEnrichmentPromise<T> = Promise<DeferredEnrichmentOut
12
12
  /** Cancelable child abort signal owned by one enrichment promise. */
13
13
  export interface EnrichmentAbortHandle {
14
14
  signal: AbortSignal;
15
+ /** True only when the handle's own deadline fired — not a parent abort or a manual cancel. */
16
+ readonly timedOut: boolean;
15
17
  cancel: () => void;
16
18
  dispose: () => void;
17
19
  }
18
- /** Child abort controller that follows `parentSignal`; `dispose` detaches the listener. */
19
- export declare function createEnrichmentAbortHandle(parentSignal?: AbortSignal): EnrichmentAbortHandle;
20
+ /** Child abort controller that follows `parentSignal` and, when `deadlineMs` is
21
+ * finite and positive, fires on its own at that deadline — the metric label the
22
+ * enrichment sections already carried, enforced (#3499). `dispose` detaches the
23
+ * listener and clears the timer. */
24
+ export declare function createEnrichmentAbortHandle(parentSignal?: AbortSignal, deadlineMs?: number): EnrichmentAbortHandle;
20
25
  /** Never-rejecting view of `promise` that also exposes its settled outcome and a cancel hook. */
21
26
  export declare function observeEnrichmentPromise<T>(promise: Promise<T>, cancel?: () => void): ObservedDeferredEnrichmentPromise<T>;
22
27
  //# sourceMappingURL=recall-enrichment-promise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"recall-enrichment-promise.d.ts","sourceRoot":"","sources":["../src/recall-enrichment-promise.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,CAAC,CAAC,IACnC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAChC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3C,MAAM,MAAM,iCAAiC,CAAC,CAAC,IAC7C,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,GAAG;IACtC,iBAAiB,EAAE,MAAM,yBAAyB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAClE,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEJ,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,2FAA2F;AAC3F,wBAAgB,2BAA2B,CAAC,YAAY,CAAC,EAAE,WAAW,GAAG,qBAAqB,CAsB7F;AAED,iGAAiG;AACjG,wBAAgB,wBAAwB,CAAC,CAAC,EACxC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,MAAM,GAAE,MAAM,IAAe,GAC5B,iCAAiC,CAAC,CAAC,CAAC,CAetC"}
1
+ {"version":3,"file":"recall-enrichment-promise.d.ts","sourceRoot":"","sources":["../src/recall-enrichment-promise.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,CAAC,CAAC,IACnC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAChC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3C,MAAM,MAAM,iCAAiC,CAAC,CAAC,IAC7C,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,GAAG;IACtC,iBAAiB,EAAE,MAAM,yBAAyB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAClE,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEJ,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;oCAGoC;AACpC,wBAAgB,2BAA2B,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,qBAAqB,CAmClH;AAED,iGAAiG;AACjG,wBAAgB,wBAAwB,CAAC,CAAC,EACxC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,MAAM,GAAE,MAAM,IAAe,GAC5B,iCAAiC,CAAC,CAAC,CAAC,CAetC"}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createEnrichmentAbortHandle,
3
3
  observeEnrichmentPromise
4
- } from "./chunk-4IJBNRMZ.js";
4
+ } from "./chunk-DRXFLPSE.js";
5
5
  import "./chunk-PZ5AY32C.js";
6
6
  export {
7
7
  createEnrichmentAbortHandle,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRecallNavigation
3
- } from "./chunk-DQ2N7IN6.js";
3
+ } from "./chunk-3RHD5TF5.js";
4
4
  import "./chunk-TH6OYP6I.js";
5
5
  import "./chunk-PQM3B54K.js";
6
6
  import "./chunk-2MWKUVHT.js";
@@ -138,7 +138,7 @@ import "./chunk-VYDGHJIN.js";
138
138
  import "./chunk-6NPLVV6M.js";
139
139
  import "./chunk-7O5EW7KX.js";
140
140
  import "./chunk-H7XKCNR6.js";
141
- import "./chunk-4IJBNRMZ.js";
141
+ import "./chunk-DRXFLPSE.js";
142
142
  import "./chunk-H6OTEBPK.js";
143
143
  import "./chunk-SOBJ6NEY.js";
144
144
  import "./chunk-O7CHKXSF.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/core",
3
- "version": "10.0.158",
3
+ "version": "10.0.159",
4
4
  "description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -3406,7 +3406,7 @@
3406
3406
  "core"
3407
3407
  ],
3408
3408
  "peerDependencies": {
3409
- "@remnic/coding-graph": "^10.0.158"
3409
+ "@remnic/coding-graph": "^10.0.159"
3410
3410
  },
3411
3411
  "peerDependenciesMeta": {
3412
3412
  "@remnic/coding-graph": {
@@ -56,6 +56,7 @@ import {
56
56
  import {
57
57
  createBoundedCoreSectionRunner,
58
58
  createRecallSectionMetricRecorder,
59
+ resolveRecallCoreSectionDeadlineMs,
59
60
  } from "../recall-qos.js";
60
61
  import { buildRecallQueryPolicy } from "../recall-query-policy.js";
61
62
  import { type GraphRecallExpandedEntry, type LastRecallSnapshot } from "../recall-state.js";
@@ -68,7 +69,7 @@ import {
68
69
  import { foldQueueWaitTiming } from "../recall-timings.js";
69
70
  import { emitRecallTiming } from "../recall-attempt-timing.js";
70
71
  import { createPhase2Timer, type Phase2AwaitStatus } from "../recall-phase2-timing.js";
71
- import { createEnrichmentAbortHandle, observeEnrichmentPromise, type DeferredEnrichmentOutcome, type ObservedDeferredEnrichmentPromise } from "../recall-enrichment-promise.js";
72
+ import { createEnrichmentAbortHandle, observeEnrichmentPromise, type DeferredEnrichmentOutcome, type EnrichmentAbortHandle, type ObservedDeferredEnrichmentPromise } from "../recall-enrichment-promise.js";
72
73
  import { findUnresolvedEntityRefs } from "../reconstruct.js";
73
74
  import { rerankLocalOrNoop, reorderByRankedKeys } from "../rerank.js";
74
75
  import { buildResponseGuidanceRecallSection, shouldRecallResponseGuidance } from "../response-guidance-recall.js";
@@ -180,10 +181,15 @@ export class RecallInternalCoordinator {
180
181
  timings,
181
182
  logger: log,
182
183
  });
184
+ const outerDeadlineAtMs =
185
+ recallOuterTimeoutMs > 0 ? recallStart + recallOuterTimeoutMs : null;
186
+ const enrichmentAbort = () =>
187
+ createEnrichmentAbortHandle(options.abortSignal, resolveRecallCoreSectionDeadlineMs({
188
+ configuredCoreDeadlineMs: enrichmentSectionDeadlineMs,
189
+ remainingOuterMs: outerDeadlineAtMs === null ? null : outerDeadlineAtMs - Date.now() }));
183
190
  const runBoundedCoreSection = createBoundedCoreSectionRunner({
184
191
  configuredDeadlineMs: recallSectionDeadlineMs,
185
- outerDeadlineAtMs:
186
- recallOuterTimeoutMs > 0 ? recallStart + recallOuterTimeoutMs : null,
192
+ outerDeadlineAtMs,
187
193
  parentSignal: options.abortSignal,
188
194
  record: recordRecallSectionMetric,
189
195
  logger: log,
@@ -1446,9 +1452,7 @@ export class RecallInternalCoordinator {
1446
1452
  })();
1447
1453
 
1448
1454
  const harmonicStartedMs = performance.now();
1449
- const harmonicRetrievalAbort = createEnrichmentAbortHandle(
1450
- options.abortSignal,
1451
- );
1455
+ const harmonicRetrievalAbort = enrichmentAbort();
1452
1456
  const harmonicRetrievalPromise = observeEnrichmentPromise(
1453
1457
  (async (): Promise<string | null> => {
1454
1458
  const t0 = Date.now();
@@ -1878,7 +1882,7 @@ export class RecallInternalCoordinator {
1878
1882
  vectorTierAvailable: resolveMemoryLifecycleCapabilities(this.deps.config).embeddingFallback,
1879
1883
  });
1880
1884
  })().catch(() => null);
1881
- const qmdEnrichmentAbort = createEnrichmentAbortHandle(options.abortSignal);
1885
+ const qmdEnrichmentAbort = enrichmentAbort();
1882
1886
  const qmdPromise = observeEnrichmentPromise(
1883
1887
  (async (): Promise<QmdPhaseResult> => {
1884
1888
  const t0 = Date.now();
@@ -2485,9 +2489,7 @@ export class RecallInternalCoordinator {
2485
2489
  return section;
2486
2490
  })();
2487
2491
 
2488
- const nativeKnowledgeAbort = createEnrichmentAbortHandle(
2489
- options.abortSignal,
2490
- );
2492
+ const nativeKnowledgeAbort = enrichmentAbort();
2491
2493
  const nativeKnowledgePromise = observeEnrichmentPromise(
2492
2494
  (async (): Promise<string | null> => {
2493
2495
  const t0 = Date.now();
@@ -2851,18 +2853,11 @@ export class RecallInternalCoordinator {
2851
2853
  name: string,
2852
2854
  promise: ObservedDeferredEnrichmentPromise<T>,
2853
2855
  onStatus?: (status: Phase2AwaitStatus) => void,
2856
+ sectionHandle?: EnrichmentAbortHandle,
2854
2857
  ): Promise<T | null> => {
2855
2858
  const finalizeEnrichmentOutcome = (
2856
2859
  outcome: DeferredEnrichmentOutcome<T>,
2857
2860
  ): T | null => {
2858
- if (outcome.status === "resolved") {
2859
- log.debug(
2860
- `recall phase-1 enrichment [${name}]: resolved at +${Date.now() - phase1Start}ms`,
2861
- );
2862
- onStatus?.("ok");
2863
- return outcome.value;
2864
- }
2865
-
2866
2861
  if (options.abortSignal?.aborted) {
2867
2862
  log.debug(
2868
2863
  `recall phase-1 enrichment [${name}]: skipped after abort at +${Date.now() - phase1Start}ms`,
@@ -2870,6 +2865,26 @@ export class RecallInternalCoordinator {
2870
2865
  onStatus?.("skipped");
2871
2866
  return null;
2872
2867
  }
2868
+ if (sectionHandle?.timedOut) {
2869
+ // cancel() routes a deadline cut through the degradation accounting
2870
+ // the assembly race performs; keep a value the section still
2871
+ // delivered (e.g. a stale-cache fallback served before the cut).
2872
+ promise.cancel();
2873
+ if (outcome.status === "resolved" && outcome.value != null) {
2874
+ onStatus?.("ok");
2875
+ return outcome.value;
2876
+ }
2877
+ log.debug(`recall phase-1 enrichment [${name}]: section deadline fired at +${Date.now() - phase1Start}ms`);
2878
+ onStatus?.("timeout");
2879
+ return null;
2880
+ }
2881
+ if (outcome.status === "resolved") {
2882
+ log.debug(
2883
+ `recall phase-1 enrichment [${name}]: resolved at +${Date.now() - phase1Start}ms`,
2884
+ );
2885
+ onStatus?.("ok");
2886
+ return outcome.value;
2887
+ }
2873
2888
  log.warn(
2874
2889
  `recall phase-1 enrichment [${name}] failed open: ` +
2875
2890
  `${outcome.error instanceof Error ? outcome.error.message : String(outcome.error)}`,
@@ -3388,10 +3403,7 @@ export class RecallInternalCoordinator {
3388
3403
  );
3389
3404
  }
3390
3405
 
3391
- const nativeKnowledgeSection = await awaitEnrichmentSection(
3392
- "nativeKnowledge",
3393
- nativeKnowledgePromise,
3394
- );
3406
+ const nativeKnowledgeSection = await awaitEnrichmentSection("nativeKnowledge", nativeKnowledgePromise, undefined, nativeKnowledgeAbort);
3395
3407
  if (nativeKnowledgeSection) {
3396
3408
  this.deps.appendRecallSection(
3397
3409
  sectionBuckets,
@@ -3640,7 +3652,7 @@ export class RecallInternalCoordinator {
3640
3652
  // 2. QMD results — post-process and format
3641
3653
  const qmdWasSettledBeforeAssemblyWait =
3642
3654
  qmdPromise.getSettledOutcome() !== undefined;
3643
- const qmdResult = await awaitEnrichmentSection("qmd", qmdPromise);
3655
+ const qmdResult = await awaitEnrichmentSection("qmd", qmdPromise, undefined, qmdEnrichmentAbort);
3644
3656
  if (qmdResult) {
3645
3657
  const t0 = Date.now();
3646
3658
  const {
@@ -4740,7 +4752,7 @@ export class RecallInternalCoordinator {
4740
4752
  "Harmonic",
4741
4753
  harmonicStartedMs,
4742
4754
  () => timings.harmonicRetrieval?.startsWith("skip") === true,
4743
- (onStatus) => awaitEnrichmentSection("harmonic", harmonicRetrievalPromise, onStatus),
4755
+ (onStatus) => awaitEnrichmentSection("harmonic", harmonicRetrievalPromise, onStatus, harmonicRetrievalAbort),
4744
4756
  );
4745
4757
  if (harmonicRetrievalSection) {
4746
4758
  this.deps.appendRecallSection(
@@ -11,12 +11,17 @@ export type ObservedDeferredEnrichmentPromise<T> =
11
11
  /** Cancelable child abort signal owned by one enrichment promise. */
12
12
  export interface EnrichmentAbortHandle {
13
13
  signal: AbortSignal;
14
+ /** True only when the handle's own deadline fired — not a parent abort or a manual cancel. */
15
+ readonly timedOut: boolean;
14
16
  cancel: () => void;
15
17
  dispose: () => void;
16
18
  }
17
19
 
18
- /** Child abort controller that follows `parentSignal`; `dispose` detaches the listener. */
19
- export function createEnrichmentAbortHandle(parentSignal?: AbortSignal): EnrichmentAbortHandle {
20
+ /** Child abort controller that follows `parentSignal` and, when `deadlineMs` is
21
+ * finite and positive, fires on its own at that deadline — the metric label the
22
+ * enrichment sections already carried, enforced (#3499). `dispose` detaches the
23
+ * listener and clears the timer. */
24
+ export function createEnrichmentAbortHandle(parentSignal?: AbortSignal, deadlineMs?: number): EnrichmentAbortHandle {
20
25
  const controller = new AbortController();
21
26
  const onAbort = () => controller.abort();
22
27
  if (parentSignal?.aborted) {
@@ -24,14 +29,27 @@ export function createEnrichmentAbortHandle(parentSignal?: AbortSignal): Enrichm
24
29
  } else if (parentSignal) {
25
30
  parentSignal.addEventListener("abort", onAbort, { once: true });
26
31
  }
32
+ let timedOut = false;
33
+ const timer =
34
+ deadlineMs !== undefined && Number.isFinite(deadlineMs) && deadlineMs > 0
35
+ ? setTimeout(() => {
36
+ timedOut = true;
37
+ controller.abort();
38
+ }, deadlineMs)
39
+ : undefined;
40
+ timer?.unref?.();
27
41
  let disposed = false;
28
42
  const dispose = () => {
29
43
  if (disposed) return;
30
44
  disposed = true;
45
+ if (timer !== undefined) clearTimeout(timer);
31
46
  parentSignal?.removeEventListener("abort", onAbort);
32
47
  };
33
48
  return {
34
49
  signal: controller.signal,
50
+ get timedOut() {
51
+ return timedOut;
52
+ },
35
53
  cancel: () => {
36
54
  controller.abort();
37
55
  dispose();
@@ -1,6 +1,7 @@
1
1
  import test from "node:test";
2
2
  import assert from "node:assert/strict";
3
3
  import { throwIfAborted } from "./abort-error.js";
4
+ import { createEnrichmentAbortHandle } from "./recall-enrichment-promise.js";
4
5
  import {
5
6
  createBoundedCoreSectionRunner,
6
7
  createRecallSectionMetricRecorder,
@@ -372,3 +373,26 @@ test("yieldToEventLoop lets a pending timer run", async () => {
372
373
 
373
374
  assert.equal(timerFired, true);
374
375
  });
376
+
377
+ test("an enrichment abort handle fires its deadline without a parent abort (#3499)", async () => {
378
+ // Enrichment sections (harmonic retrieval, QMD, native knowledge) only followed
379
+ // the parent signal, so their deadlineMs was a metric label — a slow section ran
380
+ // past the client's budget with nothing to cut it. A real timer is the subject.
381
+ const handle = createEnrichmentAbortHandle(undefined, 15);
382
+ const fired = Promise.withResolvers<void>();
383
+ handle.signal.addEventListener("abort", () => fired.resolve());
384
+ // The deadline timer is unref'd so a stale budget never holds the process;
385
+ // this ref'd wait is only the test keeping the loop alive for it to fire.
386
+ await new Promise((resolve) => setTimeout(resolve, 40));
387
+ assert.equal(handle.signal.aborted, true);
388
+ await fired.promise;
389
+ handle.dispose();
390
+ });
391
+
392
+ test("an enrichment abort handle with no deadline still follows the parent signal", async () => {
393
+ const parent = new AbortController();
394
+ const handle = createEnrichmentAbortHandle(parent.signal);
395
+ parent.abort();
396
+ assert.equal(handle.signal.aborted, true);
397
+ handle.dispose();
398
+ });
@@ -13,6 +13,7 @@ import { CompoundingEngine } from "./compounding/engine.js";
13
13
  import { parseConfig } from "./config.js";
14
14
  import { rebuildMemoryProjection } from "./maintenance/rebuild-memory-projection.js";
15
15
  import { Orchestrator } from "./orchestrator.js";
16
+ import { NamespaceReadFanoutCoordinator } from "./orchestration/namespace-read-fanout.js";
16
17
  import {
17
18
  PHASE2_AWAIT_STATUSES,
18
19
  type Phase2AwaitStatus,
@@ -467,19 +468,20 @@ test("recall response body carries no timing-contract fields", async () => {
467
468
 
468
469
  test("a recall the outer timeout cuts short records outcome error, not ok", async () => {
469
470
  const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-timing-outer-timeout-"));
470
- const config = makeConfig(memoryDir, {
471
- qmdEnabled: true,
472
- harmonicRetrievalEnabled: true,
473
- recallOuterTimeoutMs: 50,
474
- });
471
+ const config = makeConfig(memoryDir, { recallOuterTimeoutMs: 50 });
475
472
  const orchestrator = new Orchestrator(config);
476
- const harness = await makeHarmonicHarness(memoryDir);
477
- stubQmd(orchestrator, harness);
473
+ // Enrichment deadlines can now degrade a slow section inside the request
474
+ // budget, so park the corpus read itself: a recall that never gets its
475
+ // memories still owes the outer timeout its cut.
476
+ mock.method(
477
+ NamespaceReadFanoutCoordinator.prototype,
478
+ "readAllMemoriesForNamespaces",
479
+ () => new Promise<MemoryFile[]>(() => {}),
480
+ );
478
481
  const service = new EngramAccessService(orchestrator);
479
482
  // The entry coordinator swallows the timeout and returns a degraded context,
480
483
  // so the surface call resolves; the record must still say it did not complete.
481
484
  await service.recall({ query: "atlas source lookup", sessionKey: "outer:timeout" });
482
- harness.releaseHarmonicRead();
483
485
  const records = getRecallTimings(config);
484
486
  assert.equal(records.length, 1);
485
487
  assert.equal(records[0]?.outcome, "error");
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/recall-enrichment-promise.ts"],"sourcesContent":["export type DeferredEnrichmentOutcome<T> =\n | { status: \"resolved\"; value: T }\n | { status: \"rejected\"; error: unknown };\n\nexport type ObservedDeferredEnrichmentPromise<T> =\n Promise<DeferredEnrichmentOutcome<T>> & {\n getSettledOutcome: () => DeferredEnrichmentOutcome<T> | undefined;\n cancel: () => void;\n };\n\n/** Cancelable child abort signal owned by one enrichment promise. */\nexport interface EnrichmentAbortHandle {\n signal: AbortSignal;\n cancel: () => void;\n dispose: () => void;\n}\n\n/** Child abort controller that follows `parentSignal`; `dispose` detaches the listener. */\nexport function createEnrichmentAbortHandle(parentSignal?: AbortSignal): EnrichmentAbortHandle {\n const controller = new AbortController();\n const onAbort = () => controller.abort();\n if (parentSignal?.aborted) {\n controller.abort();\n } else if (parentSignal) {\n parentSignal.addEventListener(\"abort\", onAbort, { once: true });\n }\n let disposed = false;\n const dispose = () => {\n if (disposed) return;\n disposed = true;\n parentSignal?.removeEventListener(\"abort\", onAbort);\n };\n return {\n signal: controller.signal,\n cancel: () => {\n controller.abort();\n dispose();\n },\n dispose,\n };\n}\n\n/** Never-rejecting view of `promise` that also exposes its settled outcome and a cancel hook. */\nexport function observeEnrichmentPromise<T>(\n promise: Promise<T>,\n cancel: () => void = () => {},\n): ObservedDeferredEnrichmentPromise<T> {\n let settledOutcome: DeferredEnrichmentOutcome<T> | undefined;\n const settled = promise\n .then<DeferredEnrichmentOutcome<T>, DeferredEnrichmentOutcome<T>>(\n (value) => ({ status: \"resolved\", value }),\n (error) => ({ status: \"rejected\", error }),\n )\n .then((outcome) => {\n settledOutcome = outcome;\n return outcome;\n });\n return Object.assign(settled, {\n getSettledOutcome: () => settledOutcome,\n cancel,\n });\n}\n"],"mappings":";AAkBO,SAAS,4BAA4B,cAAmD;AAC7F,QAAM,aAAa,IAAI,gBAAgB;AACvC,QAAM,UAAU,MAAM,WAAW,MAAM;AACvC,MAAI,cAAc,SAAS;AACzB,eAAW,MAAM;AAAA,EACnB,WAAW,cAAc;AACvB,iBAAa,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAAA,EAChE;AACA,MAAI,WAAW;AACf,QAAM,UAAU,MAAM;AACpB,QAAI,SAAU;AACd,eAAW;AACX,kBAAc,oBAAoB,SAAS,OAAO;AAAA,EACpD;AACA,SAAO;AAAA,IACL,QAAQ,WAAW;AAAA,IACnB,QAAQ,MAAM;AACZ,iBAAW,MAAM;AACjB,cAAQ;AAAA,IACV;AAAA,IACA;AAAA,EACF;AACF;AAGO,SAAS,yBACd,SACA,SAAqB,MAAM;AAAC,GACU;AACtC,MAAI;AACJ,QAAM,UAAU,QACb;AAAA,IACC,CAAC,WAAW,EAAE,QAAQ,YAAY,MAAM;AAAA,IACxC,CAAC,WAAW,EAAE,QAAQ,YAAY,MAAM;AAAA,EAC1C,EACC,KAAK,CAAC,YAAY;AACjB,qBAAiB;AACjB,WAAO;AAAA,EACT,CAAC;AACH,SAAO,OAAO,OAAO,SAAS;AAAA,IAC5B,mBAAmB,MAAM;AAAA,IACzB;AAAA,EACF,CAAC;AACH;","names":[]}