@remnic/core 9.6.27 → 9.6.29

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 (72) hide show
  1. package/dist/access-admin-ops-surface.d.ts +2 -2
  2. package/dist/access-admin-ops-surface.js +1 -1
  3. package/dist/access-boundary.d.ts +2 -2
  4. package/dist/access-boundary.js +2 -2
  5. package/dist/access-cli.js +9 -9
  6. package/dist/access-http.d.ts +2 -2
  7. package/dist/access-http.js +6 -6
  8. package/dist/access-identity-continuity-surface.d.ts +1 -1
  9. package/dist/access-identity-continuity-surface.js +1 -1
  10. package/dist/access-lcm-surface.d.ts +2 -2
  11. package/dist/access-lcm-surface.js +1 -1
  12. package/dist/access-mcp.d.ts +2 -2
  13. package/dist/access-mcp.js +5 -5
  14. package/dist/access-observe-write-surface.d.ts +2 -2
  15. package/dist/access-observe-write-surface.js +1 -1
  16. package/dist/access-operations-batch.js +3 -3
  17. package/dist/access-operations.d.ts +2 -2
  18. package/dist/access-operations.js +4 -4
  19. package/dist/access-recall-surface.d.ts +4 -3
  20. package/dist/access-recall-surface.js +1 -1
  21. package/dist/{access-service-DK7s3wMj.d.ts → access-service-BofDzaPT.d.ts} +3 -2
  22. package/dist/access-service.d.ts +2 -2
  23. package/dist/access-service.js +1 -1
  24. package/dist/access-surface-catalog.d.ts +2 -2
  25. package/dist/bootstrap.d.ts +1 -1
  26. package/dist/{chunk-43VNWTBB.js → chunk-3RROR5KV.js} +4 -4
  27. package/dist/chunk-3RROR5KV.js.map +1 -0
  28. package/dist/{chunk-Y4RKAQZ7.js → chunk-5AJIDEFT.js} +7 -1
  29. package/dist/chunk-5AJIDEFT.js.map +1 -0
  30. package/dist/{chunk-YDF4HL3W.js → chunk-5BHIGBHQ.js} +30 -37
  31. package/dist/chunk-5BHIGBHQ.js.map +1 -0
  32. package/dist/{chunk-XMNVHYI6.js → chunk-5WJ4LBFR.js} +107 -7
  33. package/dist/chunk-5WJ4LBFR.js.map +1 -0
  34. package/dist/{chunk-N6VIXDT7.js → chunk-C2SEH754.js} +4 -4
  35. package/dist/{chunk-MRQN5Q3I.js → chunk-EAREADWV.js} +2 -2
  36. package/dist/{chunk-GXLFDLX2.js → chunk-IF7THCGJ.js} +3 -3
  37. package/dist/{chunk-ARDRBJHD.js → chunk-SGYTQKC2.js} +3 -3
  38. package/dist/{chunk-QLYLTKUG.js → chunk-XA4PWKBW.js} +3 -3
  39. package/dist/{cli-CLSdmOVU.d.ts → cli-3_x5sJTL.d.ts} +2 -2
  40. package/dist/cli.d.ts +3 -3
  41. package/dist/cli.js +7 -7
  42. package/dist/explicit-capture.d.ts +1 -1
  43. package/dist/index.d.ts +4 -4
  44. package/dist/index.js +9 -9
  45. package/dist/lcm/engine.d.ts +10 -6
  46. package/dist/lcm/engine.js +1 -1
  47. package/dist/lcm/index.d.ts +1 -1
  48. package/dist/lcm/index.js +1 -1
  49. package/dist/mcp-memory-inspector-app.d.ts +2 -2
  50. package/dist/{orchestrator-BzXGNHco.d.ts → orchestrator-CAH5-PKN.d.ts} +20 -3
  51. package/dist/orchestrator.d.ts +1 -1
  52. package/dist/orchestrator.js +9 -9
  53. package/package.json +2 -2
  54. package/src/access-recall-surface.ts +46 -49
  55. package/src/access-service.ts +2 -7
  56. package/src/cli.ts +4 -10
  57. package/src/lcm/engine.ts +17 -3
  58. package/src/lcm/index.ts +6 -1
  59. package/src/lcm-engine.test.ts +131 -1
  60. package/src/orchestration/xray-capture-queue.test.ts +42 -0
  61. package/src/orchestration/xray-capture-queue.ts +78 -0
  62. package/src/orchestrator-xray-capture.test.ts +319 -0
  63. package/src/orchestrator.ts +76 -8
  64. package/dist/chunk-43VNWTBB.js.map +0 -1
  65. package/dist/chunk-XMNVHYI6.js.map +0 -1
  66. package/dist/chunk-Y4RKAQZ7.js.map +0 -1
  67. package/dist/chunk-YDF4HL3W.js.map +0 -1
  68. /package/dist/{chunk-N6VIXDT7.js.map → chunk-C2SEH754.js.map} +0 -0
  69. /package/dist/{chunk-MRQN5Q3I.js.map → chunk-EAREADWV.js.map} +0 -0
  70. /package/dist/{chunk-GXLFDLX2.js.map → chunk-IF7THCGJ.js.map} +0 -0
  71. /package/dist/{chunk-ARDRBJHD.js.map → chunk-SGYTQKC2.js.map} +0 -0
  72. /package/dist/{chunk-QLYLTKUG.js.map → chunk-XA4PWKBW.js.map} +0 -0
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-7HYPN2GC.js";
20
20
  import {
21
21
  LcmEngine
22
- } from "./chunk-Y4RKAQZ7.js";
22
+ } from "./chunk-5AJIDEFT.js";
23
23
  import {
24
24
  cleanupConversationChunks
25
25
  } from "./chunk-RP7YXA67.js";
@@ -323,7 +323,7 @@ import {
323
323
  createCorrectionService,
324
324
  detectPassiveCorrections,
325
325
  qmdCollectionPathParts
326
- } from "./chunk-YDF4HL3W.js";
326
+ } from "./chunk-5BHIGBHQ.js";
327
327
  import {
328
328
  importCapsule
329
329
  } from "./chunk-M5QKGHCR.js";
@@ -15511,6 +15511,61 @@ async function drainRecallWrites(owner) {
15511
15511
  }
15512
15512
  }
15513
15513
 
15514
+ // src/orchestration/xray-capture-queue.ts
15515
+ var XrayCaptureQueue = class {
15516
+ tail = Promise.resolve();
15517
+ async run(operation, state, signal) {
15518
+ throwIfAborted(signal, "x-ray capture aborted before queueing");
15519
+ const previous = this.tail;
15520
+ let release = () => {
15521
+ };
15522
+ this.tail = new Promise((resolve) => {
15523
+ release = resolve;
15524
+ });
15525
+ try {
15526
+ await this.waitForTurn(previous, signal);
15527
+ } catch (error) {
15528
+ void previous.then(release, release);
15529
+ throw error;
15530
+ }
15531
+ let previousSnapshot = null;
15532
+ let didReadPreviousSnapshot = false;
15533
+ try {
15534
+ previousSnapshot = state.read();
15535
+ didReadPreviousSnapshot = true;
15536
+ const recallStartedAt = Date.now();
15537
+ state.clear();
15538
+ const result = await operation();
15539
+ const snapshot = state.read();
15540
+ if (!snapshot) state.restore(previousSnapshot);
15541
+ return { result, snapshot, recallStartedAt };
15542
+ } catch (error) {
15543
+ if (didReadPreviousSnapshot) state.restore(previousSnapshot);
15544
+ throw error;
15545
+ } finally {
15546
+ release();
15547
+ }
15548
+ }
15549
+ async waitForTurn(previous, signal) {
15550
+ throwIfAborted(signal, "x-ray capture aborted while queued");
15551
+ if (!signal) {
15552
+ await previous;
15553
+ return;
15554
+ }
15555
+ let onAbort;
15556
+ const aborted = new Promise((_resolve, reject) => {
15557
+ onAbort = () => reject(abortError("x-ray capture aborted while queued"));
15558
+ signal.addEventListener("abort", onAbort, { once: true });
15559
+ });
15560
+ try {
15561
+ await Promise.race([previous, aborted]);
15562
+ throwIfAborted(signal, "x-ray capture aborted while queued");
15563
+ } finally {
15564
+ if (onAbort) signal.removeEventListener("abort", onAbort);
15565
+ }
15566
+ }
15567
+ };
15568
+
15514
15569
  // src/orchestrator.ts
15515
15570
  var Orchestrator = class {
15516
15571
  storage;
@@ -15592,6 +15647,8 @@ var Orchestrator = class {
15592
15647
  * capturing caller can still read their snapshot back.
15593
15648
  */
15594
15649
  lastXraySnapshot = null;
15650
+ /** Per-instance ordering domain for every writer of `lastXraySnapshot`. */
15651
+ xrayCaptureQueue = new XrayCaptureQueue();
15595
15652
  embeddingFallback;
15596
15653
  conversationIndexDir;
15597
15654
  extraction;
@@ -16751,7 +16808,7 @@ ${doc.content}` : doc.content,
16751
16808
  async validateLocalLlmModel() {
16752
16809
  return this.workspaceOpsCoordinator.validateLocalLlmModel();
16753
16810
  }
16754
- async recall(prompt, sessionKey, options = {}) {
16811
+ invokeRecall(prompt, sessionKey, options = {}) {
16755
16812
  return (this.recallEntryCoordinator ?? new RecallEntryCoordinator(
16756
16813
  selfDeps(this)
16757
16814
  )).recall(
@@ -16760,21 +16817,64 @@ ${doc.content}` : doc.content,
16760
16817
  options
16761
16818
  );
16762
16819
  }
16820
+ async recall(prompt, sessionKey, options = {}) {
16821
+ if (options.xrayCapture === true) {
16822
+ const { result } = await this.runRecallWithXrayCapture(
16823
+ prompt,
16824
+ sessionKey,
16825
+ options
16826
+ );
16827
+ return result;
16828
+ }
16829
+ return this.invokeRecall(prompt, sessionKey, options);
16830
+ }
16763
16831
  /**
16764
- * Return the most recent X-ray snapshot captured during a
16765
- * `recall()` call that passed `xrayCapture: true` (issue #570 PR 1).
16832
+ * Return the most recent X-ray snapshot captured during a recall.
16766
16833
  * Returns `null` when no such capture has occurred on this
16767
16834
  * orchestrator instance. Returned snapshot is a deep copy so
16768
16835
  * caller mutation cannot tear the stored value.
16836
+ *
16837
+ * @deprecated Reading this after a separate `recall()` is not atomic. Use
16838
+ * `recallWithXrayCapture()` when the snapshot must belong to that call.
16769
16839
  */
16770
16840
  getLastXraySnapshot() {
16771
16841
  if (!this.lastXraySnapshot) return null;
16772
16842
  return structuredClone(this.lastXraySnapshot);
16773
16843
  }
16774
- /** Clear the captured X-ray snapshot. Exposed for tests / explicit reset. */
16844
+ /**
16845
+ * Clear the captured X-ray snapshot. Exposed for tests / explicit reset.
16846
+ *
16847
+ * @deprecated A separate clear → recall → get sequence is not atomic. Use
16848
+ * `recallWithXrayCapture()` for capture operations.
16849
+ */
16775
16850
  clearLastXraySnapshot() {
16776
16851
  this.lastXraySnapshot = null;
16777
16852
  }
16853
+ /** Atomically run recall and return the cloned X-ray snapshot it published. */
16854
+ async recallWithXrayCapture(prompt, sessionKey, options = {}) {
16855
+ return this.runRecallWithXrayCapture(
16856
+ prompt,
16857
+ sessionKey,
16858
+ options,
16859
+ options.abortSignal
16860
+ );
16861
+ }
16862
+ async runRecallWithXrayCapture(prompt, sessionKey, options, queueAbortSignal) {
16863
+ return this.xrayCaptureQueue.run(
16864
+ () => this.invokeRecall(prompt, sessionKey, {
16865
+ ...options,
16866
+ xrayCapture: true
16867
+ }),
16868
+ {
16869
+ read: () => this.getLastXraySnapshot(),
16870
+ clear: () => this.clearLastXraySnapshot(),
16871
+ restore: (snapshot) => {
16872
+ this.lastXraySnapshot = snapshot;
16873
+ }
16874
+ },
16875
+ queueAbortSignal
16876
+ );
16877
+ }
16778
16878
  async waitForDirectAnswerObservationIdle(timeoutMs = 6e4) {
16779
16879
  return this.recallIntrospection.waitForDirectAnswerObservationIdle(
16780
16880
  timeoutMs
@@ -22992,4 +23092,4 @@ export {
22992
23092
  blendGraphExpandedRecallScore,
22993
23093
  Orchestrator
22994
23094
  };
22995
- //# sourceMappingURL=chunk-XMNVHYI6.js.map
23095
+ //# sourceMappingURL=chunk-5WJ4LBFR.js.map