@remnic/core 9.63.2 → 9.63.4

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 (124) hide show
  1. package/dist/access-admin-ops-surface.d.ts +4 -4
  2. package/dist/access-admin-ops-surface.js +1 -1
  3. package/dist/access-authorization-probe.d.ts +4 -4
  4. package/dist/access-authorization-probe.js +2 -2
  5. package/dist/access-boundary.d.ts +4 -4
  6. package/dist/access-boundary.js +1 -1
  7. package/dist/access-cli.js +19 -18
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-extraction-force-flush.d.ts +4 -4
  10. package/dist/access-extraction-force-flush.js +1 -1
  11. package/dist/access-http-lcm-compaction.d.ts +4 -4
  12. package/dist/access-http-lifecycle-flush.d.ts +4 -4
  13. package/dist/access-http-offline-stream.d.ts +4 -4
  14. package/dist/access-http-query.d.ts +13 -1
  15. package/dist/access-http-query.js +5 -2
  16. package/dist/access-http.d.ts +5 -5
  17. package/dist/access-http.js +12 -11
  18. package/dist/access-identity-continuity-surface.d.ts +3 -3
  19. package/dist/access-identity-continuity-surface.js +1 -1
  20. package/dist/access-lcm-surface.d.ts +4 -4
  21. package/dist/access-lcm-surface.js +1 -1
  22. package/dist/access-mcp.d.ts +4 -4
  23. package/dist/access-mcp.js +6 -6
  24. package/dist/access-namespace-preflight.js +1 -1
  25. package/dist/access-observe-write-surface.d.ts +4 -4
  26. package/dist/access-observe-write-surface.js +1 -1
  27. package/dist/access-offline-manifest.d.ts +3 -3
  28. package/dist/access-operations-batch.js +2 -2
  29. package/dist/access-operations.d.ts +4 -4
  30. package/dist/access-operations.js +5 -5
  31. package/dist/access-recall-concurrency.d.ts +4 -4
  32. package/dist/access-recall-concurrency.js +1 -1
  33. package/dist/access-recall-response.d.ts +4 -4
  34. package/dist/access-recall-response.js +1 -1
  35. package/dist/access-recall-surface.d.ts +4 -4
  36. package/dist/access-recall-surface.js +1 -1
  37. package/dist/{access-service-DBpEnlzA.d.ts → access-service-D-bi3r01.d.ts} +2 -8
  38. package/dist/access-service-helpers.d.ts +4 -4
  39. package/dist/access-service.d.ts +4 -4
  40. package/dist/access-service.js +1 -1
  41. package/dist/access-surface-catalog.d.ts +4 -4
  42. package/dist/access-surface-catalog.js +3 -3
  43. package/dist/bootstrap.d.ts +3 -3
  44. package/dist/buffer.js +1 -1
  45. package/dist/{catalog-CyYTf_ok.d.ts → catalog-BYIHQw1l.d.ts} +2 -10
  46. package/dist/{chunk-JJ7JW62R.js → chunk-2JL7WPXL.js} +1 -11
  47. package/dist/chunk-2JL7WPXL.js.map +1 -0
  48. package/dist/{chunk-AJSZ2EK6.js → chunk-3USQWITL.js} +2 -2
  49. package/dist/{chunk-RYGJGXL6.js → chunk-4EDAHS6D.js} +2 -2
  50. package/dist/{chunk-5W5N7XJZ.js → chunk-A4HXWNST.js} +19 -752
  51. package/dist/chunk-A4HXWNST.js.map +1 -0
  52. package/dist/{chunk-KWN6NOHQ.js → chunk-BXOZALJ6.js} +2 -2
  53. package/dist/{chunk-6F2UMP4H.js → chunk-CKWOMJDY.js} +2 -2
  54. package/dist/{chunk-MR5HWQHS.js → chunk-DFEYRCG2.js} +2 -2
  55. package/dist/{chunk-6UZR7KEK.js → chunk-DQV3LUQL.js} +7 -1
  56. package/dist/chunk-DQV3LUQL.js.map +1 -0
  57. package/dist/{chunk-EJQXDKYK.js → chunk-EJCN5ATI.js} +3 -3
  58. package/dist/{chunk-TRPX6F2G.js → chunk-GNKY5JEP.js} +10 -13
  59. package/dist/chunk-GNKY5JEP.js.map +1 -0
  60. package/dist/{chunk-XZPSBGHA.js → chunk-ISFUFLFM.js} +2 -2
  61. package/dist/{chunk-4NMVX5U7.js → chunk-JSH2TV34.js} +2 -2
  62. package/dist/{chunk-R74NCKEY.js → chunk-LNFYISZ6.js} +2 -2
  63. package/dist/{chunk-6ZYQ36IB.js → chunk-MRJ43KSG.js} +15 -2
  64. package/dist/chunk-MRJ43KSG.js.map +1 -0
  65. package/dist/{chunk-IM56VPKO.js → chunk-OR7KEGLR.js} +2 -2
  66. package/dist/{chunk-A73QHOZP.js → chunk-QOMUE4FS.js} +2 -2
  67. package/dist/chunk-RSLRGRBJ.js +727 -0
  68. package/dist/chunk-RSLRGRBJ.js.map +1 -0
  69. package/dist/{chunk-44KHFMCM.js → chunk-VG6DC2GO.js} +32 -17
  70. package/dist/{chunk-44KHFMCM.js.map → chunk-VG6DC2GO.js.map} +1 -1
  71. package/dist/{chunk-5UFQCU6M.js → chunk-ZUZD2DRV.js} +5 -5
  72. package/dist/{cli-DJwNNDL1.d.ts → cli-DEoABKXH.d.ts} +2 -2
  73. package/dist/cli.d.ts +5 -5
  74. package/dist/cli.js +15 -14
  75. package/dist/explicit-capture.d.ts +3 -3
  76. package/dist/external-wiki-access.d.ts +4 -4
  77. package/dist/external-wiki-access.js +2 -2
  78. package/dist/external-wiki-mcp-tools.d.ts +4 -4
  79. package/dist/index.d.ts +8 -8
  80. package/dist/index.js +21 -20
  81. package/dist/{maintenance-uJb74j64.d.ts → maintenance-N5ur13Al.d.ts} +1 -1
  82. package/dist/mcp-memory-inspector-app.d.ts +4 -4
  83. package/dist/namespaces/migrate.d.ts +1 -1
  84. package/dist/namespaces/storage.d.ts +1 -1
  85. package/dist/operator-toolkit.js +3 -2
  86. package/dist/orchestration/maintenance.d.ts +2 -2
  87. package/dist/orchestration/maintenance.js +3 -2
  88. package/dist/{orchestrator-CFi-5JSR.d.ts → orchestrator-ByLrpav4.d.ts} +2 -2
  89. package/dist/orchestrator.d.ts +3 -3
  90. package/dist/orchestrator.js +19 -18
  91. package/dist/{public-http-43z1YT-k.d.ts → public-http-DusietP2.d.ts} +1 -1
  92. package/dist/support-passport/index.d.ts +7 -7
  93. package/dist/support-passport/index.js +4 -4
  94. package/package.json +2 -2
  95. package/src/access-http-query.ts +12 -0
  96. package/src/access-http.test.ts +32 -0
  97. package/src/access-http.ts +3 -7
  98. package/src/admin/admin-surfaces.test.ts +5 -10
  99. package/src/admin/admin-surfaces.ts +0 -16
  100. package/src/binary-lifecycle/pipeline.test.ts +1 -1
  101. package/src/binary-lifecycle/pipeline.ts +23 -9
  102. package/src/buffer.ts +6 -0
  103. package/src/maintenance/namespace-planner.ts +0 -2
  104. package/src/namespaces/catalog.test.ts +53 -8
  105. package/src/namespaces/catalog.ts +5 -37
  106. package/src/orchestration/turn-ingestion-snapshot.test.ts +167 -0
  107. package/src/orchestration/turn-ingestion.ts +2 -1
  108. package/dist/chunk-5W5N7XJZ.js.map +0 -1
  109. package/dist/chunk-6UZR7KEK.js.map +0 -1
  110. package/dist/chunk-6ZYQ36IB.js.map +0 -1
  111. package/dist/chunk-JJ7JW62R.js.map +0 -1
  112. package/dist/chunk-TRPX6F2G.js.map +0 -1
  113. /package/dist/{chunk-AJSZ2EK6.js.map → chunk-3USQWITL.js.map} +0 -0
  114. /package/dist/{chunk-RYGJGXL6.js.map → chunk-4EDAHS6D.js.map} +0 -0
  115. /package/dist/{chunk-KWN6NOHQ.js.map → chunk-BXOZALJ6.js.map} +0 -0
  116. /package/dist/{chunk-6F2UMP4H.js.map → chunk-CKWOMJDY.js.map} +0 -0
  117. /package/dist/{chunk-MR5HWQHS.js.map → chunk-DFEYRCG2.js.map} +0 -0
  118. /package/dist/{chunk-EJQXDKYK.js.map → chunk-EJCN5ATI.js.map} +0 -0
  119. /package/dist/{chunk-XZPSBGHA.js.map → chunk-ISFUFLFM.js.map} +0 -0
  120. /package/dist/{chunk-4NMVX5U7.js.map → chunk-JSH2TV34.js.map} +0 -0
  121. /package/dist/{chunk-R74NCKEY.js.map → chunk-LNFYISZ6.js.map} +0 -0
  122. /package/dist/{chunk-IM56VPKO.js.map → chunk-OR7KEGLR.js.map} +0 -0
  123. /package/dist/{chunk-A73QHOZP.js.map → chunk-QOMUE4FS.js.map} +0 -0
  124. /package/dist/{chunk-5UFQCU6M.js.map → chunk-ZUZD2DRV.js.map} +0 -0
@@ -0,0 +1,167 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { SmartBuffer } from "../buffer.js";
4
+ import { parseConfig } from "../config.js";
5
+ import type { BufferState, BufferTurn } from "../types.js";
6
+ import {
7
+ TurnIngestionCoordinator,
8
+ type TurnIngestionDeps,
9
+ } from "./turn-ingestion.js";
10
+
11
+ class FakeStorage {
12
+ constructor(private readonly initial: BufferState) {}
13
+ async loadBuffer(): Promise<BufferState> {
14
+ return structuredClone(this.initial);
15
+ }
16
+ async saveBuffer(_state: BufferState): Promise<void> {}
17
+ }
18
+
19
+ function makeTurn(content: string): BufferTurn {
20
+ return {
21
+ role: "user",
22
+ content,
23
+ timestamp: "2026-08-17T00:00:00.000Z",
24
+ sessionKey: "k",
25
+ };
26
+ }
27
+
28
+ test("#2468 extract trigger returns the mutation snapshot", async () => {
29
+ const buffer = new SmartBuffer(
30
+ parseConfig({ triggerMode: "every_n", bufferMaxTurns: 1 }),
31
+ new FakeStorage({ turns: [], lastExtractionAt: null, extractionCount: 0 }) as never,
32
+ );
33
+ const outcome = await buffer.addTurnWithOutcome("k", makeTurn("only"));
34
+ assert.equal(outcome.decision, "extract_batch");
35
+ assert.equal(outcome.extractionTurns?.length, 1);
36
+ assert.equal(outcome.extractionTurns?.[0]?.content, "only");
37
+ });
38
+
39
+ test("#2468 built-in trigger includes retained turns in the snapshot", async () => {
40
+ const buffer = new SmartBuffer(
41
+ parseConfig({ triggerMode: "every_n", bufferMaxTurns: 1 }),
42
+ new FakeStorage({ turns: [], lastExtractionAt: null, extractionCount: 0 }) as never,
43
+ );
44
+ await buffer.retainDeferredTurns("k", [makeTurn("retained")], 10);
45
+ const outcome = await buffer.addTurnWithOutcome("k", makeTurn("live"));
46
+ assert.equal(outcome.decision, "extract_batch");
47
+ assert.deepEqual(
48
+ outcome.extractionTurns?.map((turn) => turn.content),
49
+ ["retained", "live"],
50
+ );
51
+ });
52
+
53
+ test("#2468 processTurn does not adopt a later getTurns() batch", async () => {
54
+ const snapshot = [makeTurn("first")];
55
+ const later = [makeTurn("first"), makeTurn("later")];
56
+ const queued: BufferTurn[][] = [];
57
+ const buffer = {
58
+ addTurnWithOutcome: async () => ({
59
+ decision: "extract_now" as const,
60
+ extractionTurns: snapshot,
61
+ }),
62
+ getTurns: () => later,
63
+ };
64
+ const deps = {
65
+ buffer,
66
+ config: parseConfig({}),
67
+ getStorage: async () => {
68
+ throw new Error("unexpected getStorage");
69
+ },
70
+ bulkImportWriteNamespace: () => "default",
71
+ get extractionQueueCoordinator(): never {
72
+ throw new Error("unexpected extractionQueueCoordinator");
73
+ },
74
+ heartbeatObserverChains: new Map(),
75
+ lcmEngine: null,
76
+ passiveCorrectionDedup: new Set(),
77
+ passiveCorrectionService: () => {
78
+ throw new Error("unexpected passiveCorrectionService");
79
+ },
80
+ passiveCorrectionTelemetry: {
81
+ detected: 0,
82
+ queued: 0,
83
+ autoApplied: 0,
84
+ suppressedReasonCounts: {},
85
+ },
86
+ queueBufferedExtraction: async (turns: BufferTurn[]) => {
87
+ queued.push(turns);
88
+ },
89
+ resolveMemoryIdOrHandle: () => {
90
+ throw new Error("unexpected resolveMemoryIdOrHandle");
91
+ },
92
+ runExtraction: async () => {
93
+ throw new Error("unexpected runExtraction");
94
+ },
95
+ get sessionObserver(): never {
96
+ throw new Error("unexpected sessionObserver");
97
+ },
98
+ shouldQueueExtraction: () => {
99
+ throw new Error("unexpected shouldQueueExtraction");
100
+ },
101
+ get transcript(): never {
102
+ throw new Error("unexpected transcript");
103
+ },
104
+ } as unknown as TurnIngestionDeps;
105
+ await new TurnIngestionCoordinator(deps).processTurn("user", "first", "k");
106
+ assert.equal(queued.length, 1);
107
+ assert.equal(queued[0]?.length, 1);
108
+ assert.equal(queued[0]?.[0]?.content, "first");
109
+ });
110
+ test("#2468 concurrent processTurn first trigger keeps its mutation snapshot", async () => {
111
+ const queued: BufferTurn[][] = [];
112
+ const buffer = new SmartBuffer(
113
+ parseConfig({ triggerMode: "every_n", bufferMaxTurns: 1, bufferSaveDebounceMs: 0 }),
114
+ new FakeStorage({ turns: [], lastExtractionAt: null, extractionCount: 0 }) as never,
115
+ );
116
+ const deps = {
117
+ buffer,
118
+ config: parseConfig({ triggerMode: "every_n", bufferMaxTurns: 1 }),
119
+ getStorage: async () => {
120
+ throw new Error("unexpected getStorage");
121
+ },
122
+ bulkImportWriteNamespace: () => "default",
123
+ get extractionQueueCoordinator(): never {
124
+ throw new Error("unexpected extractionQueueCoordinator");
125
+ },
126
+ heartbeatObserverChains: new Map(),
127
+ lcmEngine: null,
128
+ passiveCorrectionDedup: new Set(),
129
+ passiveCorrectionService: () => {
130
+ throw new Error("unexpected passiveCorrectionService");
131
+ },
132
+ passiveCorrectionTelemetry: {
133
+ detected: 0,
134
+ queued: 0,
135
+ autoApplied: 0,
136
+ suppressedReasonCounts: {},
137
+ },
138
+ queueBufferedExtraction: async (turns: BufferTurn[]) => {
139
+ queued.push(turns);
140
+ },
141
+ resolveMemoryIdOrHandle: () => {
142
+ throw new Error("unexpected resolveMemoryIdOrHandle");
143
+ },
144
+ runExtraction: async () => {
145
+ throw new Error("unexpected runExtraction");
146
+ },
147
+ get sessionObserver(): never {
148
+ throw new Error("unexpected sessionObserver");
149
+ },
150
+ shouldQueueExtraction: () => {
151
+ throw new Error("unexpected shouldQueueExtraction");
152
+ },
153
+ get transcript(): never {
154
+ throw new Error("unexpected transcript");
155
+ },
156
+ } as unknown as TurnIngestionDeps;
157
+ const coordinator = new TurnIngestionCoordinator(deps);
158
+ await Promise.all([
159
+ coordinator.processTurn("user", "alpha", "shared-key"),
160
+ coordinator.processTurn("user", "beta", "shared-key"),
161
+ ]);
162
+ assert.equal(queued.length, 2);
163
+ assert.ok(
164
+ queued.some((batch) => batch.length === 1),
165
+ "the first trigger must extract only its mutation snapshot",
166
+ );
167
+ });
@@ -201,8 +201,9 @@ export class TurnIngestionCoordinator {
201
201
  : { decision: await this.deps.buffer.addTurn(bufferKey, turn) };
202
202
 
203
203
  if (outcome.decision === "keep_buffering") return;
204
+ if (!outcome.extractionTurns) return;
204
205
  await this.deps.queueBufferedExtraction(
205
- outcome.extractionTurns ?? this.deps.buffer.getTurns(bufferKey),
206
+ outcome.extractionTurns,
206
207
  "trigger_mode",
207
208
  { bufferKey },
208
209
  );