@remnic/core 10.0.166 → 10.0.168
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.
- package/dist/access-admin-ops-surface.js +6 -6
- package/dist/access-cli.js +6 -6
- package/dist/access-extraction-force-flush-preempt.js +6 -6
- package/dist/access-extraction-force-flush.js +6 -6
- package/dist/access-http-briefing.js +6 -6
- package/dist/access-http-query.js +6 -6
- package/dist/access-http.js +6 -6
- package/dist/access-identity-continuity-surface.js +6 -6
- package/dist/access-lcm-surface.js +6 -6
- package/dist/access-mcp.js +6 -6
- package/dist/access-observe-write-surface.js +6 -6
- package/dist/access-operations-batch.js +6 -6
- package/dist/access-operations.js +6 -6
- package/dist/access-recall-concurrency.js +6 -6
- package/dist/access-recall-response.js +6 -6
- package/dist/access-recall-surface.d.ts.map +1 -1
- package/dist/access-recall-surface.js +6 -6
- package/dist/access-service.js +6 -6
- package/dist/bulk-import/index.d.ts +1 -1
- package/dist/bulk-import/index.d.ts.map +1 -1
- package/dist/bulk-import/index.js +3 -1
- package/dist/bulk-import/pipeline.d.ts +8 -0
- package/dist/bulk-import/pipeline.d.ts.map +1 -1
- package/dist/{chunk-HSSERO3E.js → chunk-4P4GF76E.js} +8 -1
- package/dist/chunk-4P4GF76E.js.map +1 -0
- package/dist/{chunk-47LDDGAL.js → chunk-5PUZV73Z.js} +2 -2
- package/dist/{chunk-7QF26EWO.js → chunk-BFPQJNFZ.js} +1 -1
- package/dist/{chunk-7QF26EWO.js.map → chunk-BFPQJNFZ.js.map} +1 -1
- package/dist/{chunk-2FCZIWRI.js → chunk-D6BOOYNJ.js} +7 -15
- package/dist/{chunk-2FCZIWRI.js.map → chunk-D6BOOYNJ.js.map} +1 -1
- package/dist/{chunk-XKZBZOKV.js → chunk-JIF22AXI.js} +18 -1
- package/dist/chunk-JIF22AXI.js.map +1 -0
- package/dist/{chunk-E6EESRJ6.js → chunk-MOUSHJAR.js} +3 -3
- package/dist/{chunk-JFZZDMEZ.js → chunk-U3BCW7GX.js} +2 -2
- package/dist/cli.d.ts +1 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -6
- package/dist/connectors/droid-mcp.d.ts +4 -3
- package/dist/connectors/droid-mcp.d.ts.map +1 -1
- package/dist/connectors/index.js +1 -1
- package/dist/explicit-capture.js +6 -6
- package/dist/extraction.js +3 -3
- package/dist/index.js +6 -6
- package/dist/memory-controller.d.ts +8 -0
- package/dist/memory-controller.d.ts.map +1 -1
- package/dist/memory-controller.js +1 -1
- package/dist/orchestration/backlog-scheduler.js +7 -7
- package/dist/orchestration/buffer-drain-runner.js +7 -7
- package/dist/orchestrator.js +6 -6
- package/dist/recall-navigation.js +6 -6
- package/dist/source-agent-qualifier.js +2 -2
- package/package.json +2 -2
- package/src/access-recall-surface.ts +3 -10
- package/src/bulk-import/index.ts +1 -0
- package/src/bulk-import/pipeline.test.ts +31 -0
- package/src/bulk-import/pipeline.ts +14 -0
- package/src/cli.ts +3 -23
- package/src/connectors/droid-mcp.test.ts +46 -0
- package/src/connectors/droid-mcp.ts +5 -5
- package/src/memory-controller.test.ts +38 -0
- package/src/memory-controller.ts +25 -2
- package/dist/chunk-HSSERO3E.js.map +0 -1
- package/dist/chunk-XKZBZOKV.js.map +0 -1
- /package/dist/{chunk-47LDDGAL.js.map → chunk-5PUZV73Z.js.map} +0 -0
- /package/dist/{chunk-E6EESRJ6.js.map → chunk-MOUSHJAR.js.map} +0 -0
- /package/dist/{chunk-JFZZDMEZ.js.map → chunk-U3BCW7GX.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccessRecallSurface
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-D6BOOYNJ.js";
|
|
4
4
|
import "./chunk-TH6OYP6I.js";
|
|
5
5
|
import "./chunk-PQM3B54K.js";
|
|
6
6
|
import "./chunk-2MWKUVHT.js";
|
|
@@ -65,7 +65,7 @@ import "./chunk-JVBAPAWZ.js";
|
|
|
65
65
|
import "./chunk-6O3SGRJD.js";
|
|
66
66
|
import "./chunk-WWQMZBDI.js";
|
|
67
67
|
import "./chunk-SI36RWC3.js";
|
|
68
|
-
import "./chunk-
|
|
68
|
+
import "./chunk-4P4GF76E.js";
|
|
69
69
|
import "./chunk-NOUJNHWG.js";
|
|
70
70
|
import "./chunk-3PNJZTDV.js";
|
|
71
71
|
import "./chunk-SQXCUH4L.js";
|
|
@@ -165,7 +165,7 @@ import "./chunk-573TEZCD.js";
|
|
|
165
165
|
import "./chunk-3GPTTA4J.js";
|
|
166
166
|
import "./chunk-UD7UNYRD.js";
|
|
167
167
|
import "./chunk-IISBCCWR.js";
|
|
168
|
-
import "./chunk-
|
|
168
|
+
import "./chunk-JIF22AXI.js";
|
|
169
169
|
import "./chunk-E4RMZGRS.js";
|
|
170
170
|
import "./chunk-MZUQVWVC.js";
|
|
171
171
|
import "./chunk-M4DB6ZNN.js";
|
|
@@ -193,10 +193,10 @@ import "./chunk-64NJRYU2.js";
|
|
|
193
193
|
import "./chunk-U2PSE7MB.js";
|
|
194
194
|
import "./chunk-BPPUH5JM.js";
|
|
195
195
|
import "./chunk-LEO4MQ3S.js";
|
|
196
|
-
import "./chunk-
|
|
196
|
+
import "./chunk-5PUZV73Z.js";
|
|
197
197
|
import "./chunk-EI6V5UXY.js";
|
|
198
|
-
import "./chunk-
|
|
199
|
-
import "./chunk-
|
|
198
|
+
import "./chunk-U3BCW7GX.js";
|
|
199
|
+
import "./chunk-BFPQJNFZ.js";
|
|
200
200
|
import "./chunk-SMDZTJ2D.js";
|
|
201
201
|
import "./chunk-54V4BZWP.js";
|
|
202
202
|
import "./chunk-DOWACHYO.js";
|
package/dist/access-service.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
buildProjectedGovernanceProposedActions,
|
|
5
5
|
hasGroupedGovernanceActions,
|
|
6
6
|
shapeMemorySummary
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-D6BOOYNJ.js";
|
|
8
8
|
import "./chunk-TH6OYP6I.js";
|
|
9
9
|
import "./chunk-PQM3B54K.js";
|
|
10
10
|
import "./chunk-2MWKUVHT.js";
|
|
@@ -69,7 +69,7 @@ import "./chunk-JVBAPAWZ.js";
|
|
|
69
69
|
import "./chunk-6O3SGRJD.js";
|
|
70
70
|
import "./chunk-WWQMZBDI.js";
|
|
71
71
|
import "./chunk-SI36RWC3.js";
|
|
72
|
-
import "./chunk-
|
|
72
|
+
import "./chunk-4P4GF76E.js";
|
|
73
73
|
import "./chunk-NOUJNHWG.js";
|
|
74
74
|
import "./chunk-3PNJZTDV.js";
|
|
75
75
|
import "./chunk-SQXCUH4L.js";
|
|
@@ -169,7 +169,7 @@ import "./chunk-573TEZCD.js";
|
|
|
169
169
|
import "./chunk-3GPTTA4J.js";
|
|
170
170
|
import "./chunk-UD7UNYRD.js";
|
|
171
171
|
import "./chunk-IISBCCWR.js";
|
|
172
|
-
import "./chunk-
|
|
172
|
+
import "./chunk-JIF22AXI.js";
|
|
173
173
|
import "./chunk-E4RMZGRS.js";
|
|
174
174
|
import "./chunk-MZUQVWVC.js";
|
|
175
175
|
import "./chunk-M4DB6ZNN.js";
|
|
@@ -197,10 +197,10 @@ import "./chunk-64NJRYU2.js";
|
|
|
197
197
|
import "./chunk-U2PSE7MB.js";
|
|
198
198
|
import "./chunk-BPPUH5JM.js";
|
|
199
199
|
import "./chunk-LEO4MQ3S.js";
|
|
200
|
-
import "./chunk-
|
|
200
|
+
import "./chunk-5PUZV73Z.js";
|
|
201
201
|
import "./chunk-EI6V5UXY.js";
|
|
202
|
-
import "./chunk-
|
|
203
|
-
import "./chunk-
|
|
202
|
+
import "./chunk-U3BCW7GX.js";
|
|
203
|
+
import "./chunk-BFPQJNFZ.js";
|
|
204
204
|
import "./chunk-SMDZTJ2D.js";
|
|
205
205
|
import "./chunk-54V4BZWP.js";
|
|
206
206
|
import "./chunk-DOWACHYO.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { type BulkImportSource, type ImportTurn, type BulkImportOptions, type ImportSourceRole, type BulkImportResult, type BulkImportError, type BulkImportSourceAdapter, type ImportTurnValidationIssue, isImportRole, parseIsoTimestamp, validateImportTurn, } from "./types.js";
|
|
2
2
|
export { registerBulkImportSource, getBulkImportSource, listBulkImportSources, clearBulkImportSources, } from "./registry.js";
|
|
3
|
-
export { runBulkImportPipeline, formatBatchTranscript, validateBatchSize, resolveBulkImportContext, type ProcessBatchFn, type ProcessBatchContext, type ProcessBatchResult, } from "./pipeline.js";
|
|
3
|
+
export { runBulkImportPipeline, formatBatchTranscript, processBatchFromIngest, validateBatchSize, resolveBulkImportContext, type ProcessBatchFn, type ProcessBatchContext, type ProcessBatchResult, } from "./pipeline.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bulk-import/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bulk-import/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC"}
|
|
@@ -3,11 +3,12 @@ import {
|
|
|
3
3
|
formatBatchTranscript,
|
|
4
4
|
getBulkImportSource,
|
|
5
5
|
listBulkImportSources,
|
|
6
|
+
processBatchFromIngest,
|
|
6
7
|
registerBulkImportSource,
|
|
7
8
|
resolveBulkImportContext,
|
|
8
9
|
runBulkImportPipeline,
|
|
9
10
|
validateBatchSize
|
|
10
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-4P4GF76E.js";
|
|
11
12
|
import {
|
|
12
13
|
isImportRole,
|
|
13
14
|
parseIsoTimestamp,
|
|
@@ -22,6 +23,7 @@ export {
|
|
|
22
23
|
isImportRole,
|
|
23
24
|
listBulkImportSources,
|
|
24
25
|
parseIsoTimestamp,
|
|
26
|
+
processBatchFromIngest,
|
|
25
27
|
registerBulkImportSource,
|
|
26
28
|
resolveBulkImportContext,
|
|
27
29
|
runBulkImportPipeline,
|
|
@@ -14,6 +14,14 @@ export interface ProcessBatchContext {
|
|
|
14
14
|
namespace?: string;
|
|
15
15
|
}
|
|
16
16
|
export type ProcessBatchFn = (turns: ImportTurn[], context: ProcessBatchContext) => Promise<ProcessBatchResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Batch processor backed by an ingest call that reports what it persisted.
|
|
19
|
+
* `memoriesCreated` is the batch's own `persistedCount`, so concurrent
|
|
20
|
+
* extractions writing to the same memory root cannot inflate it (issue #3554).
|
|
21
|
+
*/
|
|
22
|
+
export declare function processBatchFromIngest(ingest: (turns: ImportTurn[]) => Promise<{
|
|
23
|
+
persistedCount: number;
|
|
24
|
+
}>): ProcessBatchFn;
|
|
17
25
|
export declare function validateBatchSize(value: number | undefined): number;
|
|
18
26
|
export declare function resolveBulkImportContext(options: BulkImportOptions): ProcessBatchContext;
|
|
19
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/bulk-import/pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,YAAY,CAAC;AAMpB,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,QAAQ,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,CAC3B,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,EAAE,mBAAmB,KACzB,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAkBnE;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,iBAAiB,GACzB,mBAAmB,CA0BrB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,CAQjE;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,gBAAgB,E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OAAO,CAAC,gBAAgB,CAAC,CAkE3B"}
|
|
@@ -42,6 +42,12 @@ function clearBulkImportSources() {
|
|
|
42
42
|
var DEFAULT_BATCH_SIZE = 20;
|
|
43
43
|
var MIN_BATCH_SIZE = 1;
|
|
44
44
|
var MAX_BATCH_SIZE = 1e3;
|
|
45
|
+
function processBatchFromIngest(ingest) {
|
|
46
|
+
return async (turns) => {
|
|
47
|
+
const { persistedCount } = await ingest(turns);
|
|
48
|
+
return { memoriesCreated: persistedCount, duplicatesSkipped: 0 };
|
|
49
|
+
};
|
|
50
|
+
}
|
|
45
51
|
function validateBatchSize(value) {
|
|
46
52
|
if (value === void 0) return DEFAULT_BATCH_SIZE;
|
|
47
53
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
@@ -151,9 +157,10 @@ export {
|
|
|
151
157
|
getBulkImportSource,
|
|
152
158
|
listBulkImportSources,
|
|
153
159
|
clearBulkImportSources,
|
|
160
|
+
processBatchFromIngest,
|
|
154
161
|
validateBatchSize,
|
|
155
162
|
resolveBulkImportContext,
|
|
156
163
|
formatBatchTranscript,
|
|
157
164
|
runBulkImportPipeline
|
|
158
165
|
};
|
|
159
|
-
//# sourceMappingURL=chunk-
|
|
166
|
+
//# sourceMappingURL=chunk-4P4GF76E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bulk-import/registry.ts","../src/bulk-import/pipeline.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Bulk-import source adapter registry\n// ---------------------------------------------------------------------------\n\nimport type { BulkImportSourceAdapter } from \"./types.js\";\n\nconst adapters = new Map<string, BulkImportSourceAdapter>();\n\n/**\n * Register a source adapter. Rejects duplicate names and empty names.\n */\nexport function registerBulkImportSource(\n adapter: BulkImportSourceAdapter,\n): void {\n if (!adapter || typeof adapter !== \"object\") {\n throw new Error(\"bulk-import adapter must be an object\");\n }\n if (\n !adapter.name ||\n typeof adapter.name !== \"string\" ||\n adapter.name.trim().length === 0\n ) {\n throw new Error(\"bulk-import adapter name must be a non-empty string\");\n }\n if (typeof adapter.parse !== \"function\") {\n throw new Error(\n `bulk-import adapter '${adapter.name}' must have a parse function`,\n );\n }\n const key = adapter.name.trim();\n if (adapters.has(key)) {\n throw new Error(\n `bulk-import source adapter '${key}' is already registered`,\n );\n }\n // Store adapter with trimmed name so `adapter.name` stays consistent with\n // the registry key returned by `listBulkImportSources()`.\n const normalized: BulkImportSourceAdapter =\n adapter.name === key ? adapter : { ...adapter, name: key };\n adapters.set(key, normalized);\n}\n\n/**\n * Retrieve a registered adapter by name.\n *\n * Names are trimmed on write (see `registerBulkImportSource`), so we\n * also trim on read to avoid the asymmetric-lookup footgun where a\n * whitespace-padded lookup would never find a registered adapter.\n * Non-string or empty-after-trim inputs return undefined.\n */\nexport function getBulkImportSource(\n name: string,\n): BulkImportSourceAdapter | undefined {\n if (typeof name !== \"string\") return undefined;\n const key = name.trim();\n if (key.length === 0) return undefined;\n return adapters.get(key);\n}\n\n/**\n * List all registered adapter names.\n */\nexport function listBulkImportSources(): string[] {\n return [...adapters.keys()];\n}\n\n/**\n * Clear all registered adapters (for testing).\n */\nexport function clearBulkImportSources(): void {\n adapters.clear();\n}\n","// ---------------------------------------------------------------------------\n// Bulk-import batch processing pipeline\n// ---------------------------------------------------------------------------\n\nimport {\n validateImportTurn,\n type BulkImportError,\n type BulkImportOptions,\n type BulkImportResult,\n type BulkImportSource,\n type ImportTurn,\n} from \"./types.js\";\n\nconst DEFAULT_BATCH_SIZE = 20;\nconst MIN_BATCH_SIZE = 1;\nconst MAX_BATCH_SIZE = 1000;\n\nexport interface ProcessBatchResult {\n memoriesCreated: number;\n duplicatesSkipped: number;\n /**\n * Number of entities created by the batch. Optional so Phase-1 stubs that\n * only count memories can omit it; when absent it is treated as 0.\n */\n entitiesCreated?: number;\n}\n\nexport interface ProcessBatchContext {\n dedup: boolean;\n trustLevel: \"import\";\n namespace?: string;\n}\n\nexport type ProcessBatchFn = (\n turns: ImportTurn[],\n context: ProcessBatchContext,\n) => Promise<ProcessBatchResult>;\n\n/**\n * Batch processor backed by an ingest call that reports what it persisted.\n * `memoriesCreated` is the batch's own `persistedCount`, so concurrent\n * extractions writing to the same memory root cannot inflate it (issue #3554).\n */\nexport function processBatchFromIngest(\n ingest: (turns: ImportTurn[]) => Promise<{ persistedCount: number }>,\n): ProcessBatchFn {\n return async (turns) => {\n const { persistedCount } = await ingest(turns);\n return { memoriesCreated: persistedCount, duplicatesSkipped: 0 };\n };\n}\n\nexport function validateBatchSize(value: number | undefined): number {\n if (value === undefined) return DEFAULT_BATCH_SIZE;\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new Error(\n `batchSize must be a finite number, received ${String(value)}`,\n );\n }\n if (!Number.isInteger(value)) {\n throw new Error(\n `batchSize must be an integer, received ${value}`,\n );\n }\n if (value < MIN_BATCH_SIZE || value > MAX_BATCH_SIZE) {\n throw new Error(\n `batchSize must be between ${MIN_BATCH_SIZE} and ${MAX_BATCH_SIZE}, received ${value}`,\n );\n }\n return value;\n}\n\nexport function resolveBulkImportContext(\n options: BulkImportOptions,\n): ProcessBatchContext {\n if (options.dedup !== undefined && typeof options.dedup !== \"boolean\") {\n throw new Error(\n `dedup must be a boolean when provided, received ${String(options.dedup)}`,\n );\n }\n if (options.trustLevel !== undefined && options.trustLevel !== \"import\") {\n throw new Error(\n `trustLevel must be 'import' when provided, received ${String(options.trustLevel)}`,\n );\n }\n if (options.namespace !== undefined) {\n if (typeof options.namespace !== \"string\" || options.namespace.trim().length === 0) {\n throw new Error(\n `namespace must be a non-empty string when provided, received ${String(options.namespace)}`,\n );\n }\n }\n\n return {\n dedup: options.dedup !== false,\n trustLevel: options.trustLevel ?? \"import\",\n ...(options.namespace !== undefined\n ? { namespace: options.namespace }\n : {}),\n };\n}\n\n/**\n * Format a batch of turns into a conversation transcript string.\n */\nexport function formatBatchTranscript(turns: ImportTurn[]): string {\n return turns\n .map((t) => {\n const prefix =\n t.participantName ?? t.participantId ?? t.role;\n return `[${t.timestamp}] ${prefix}: ${t.content}`;\n })\n .join(\"\\n\");\n}\n\n/**\n * Run the bulk-import pipeline over a parsed source.\n *\n * Splits turns into batches and delegates each to `processBatch`.\n * In dryRun mode, validates and counts without calling `processBatch`.\n */\nexport async function runBulkImportPipeline(\n source: BulkImportSource,\n options: BulkImportOptions = {},\n processBatch: ProcessBatchFn,\n): Promise<BulkImportResult> {\n const batchSize = validateBatchSize(options.batchSize);\n const dryRun = options.dryRun === true;\n const batchContext = resolveBulkImportContext(options);\n\n const result: BulkImportResult = {\n memoriesCreated: 0,\n duplicatesSkipped: 0,\n entitiesCreated: 0,\n turnsProcessed: 0,\n batchesProcessed: 0,\n errors: [],\n };\n\n const turns = source.turns;\n\n if (!turns || turns.length === 0) {\n return result;\n }\n\n // Validate all turns upfront; collect validation errors\n const validTurns: ImportTurn[] = [];\n for (let i = 0; i < turns.length; i += 1) {\n const issues = validateImportTurn(turns[i], i);\n if (issues.length > 0) {\n const error: BulkImportError = {\n batchIndex: -1,\n message: issues.map((iss) => iss.message).join(\"; \"),\n };\n result.errors.push(error);\n } else {\n validTurns.push(turns[i]);\n }\n }\n\n if (dryRun) {\n result.turnsProcessed = validTurns.length;\n result.batchesProcessed =\n validTurns.length > 0\n ? Math.ceil(validTurns.length / batchSize)\n : 0;\n return result;\n }\n\n // Process in batches\n let batchIndex = 0;\n for (let i = 0; i < validTurns.length; i += batchSize) {\n const batch = validTurns.slice(i, i + batchSize);\n try {\n const batchResult = await processBatch(batch, batchContext);\n result.memoriesCreated += batchResult.memoriesCreated;\n result.duplicatesSkipped += batchResult.duplicatesSkipped;\n if (typeof batchResult.entitiesCreated === \"number\") {\n result.entitiesCreated += batchResult.entitiesCreated;\n }\n } catch (err: unknown) {\n const message =\n err instanceof Error ? err.message : String(err);\n result.errors.push({ batchIndex, message });\n }\n result.turnsProcessed += batch.length;\n result.batchesProcessed += 1;\n batchIndex += 1;\n }\n\n return result;\n}\n"],"mappings":";;;;;AAMA,IAAM,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AO,mBAAmB,YAAY;AAAA,MACxC;AAAA,IACF,SAAS,KAAc;AACrB,YAAM,UACJ,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AACjD,aAAO,OAAO,KAAK,EAAE,YAAY,QAAQ,CAAC;AAAA,IAC5C;AACA,WAAO,kBAAkB,MAAM;AAC/B,WAAO,oBAAoB;AAC3B,kBAAc;AAAA,EAChB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
headerConnector,
|
|
7
7
|
renderExtractionConversation,
|
|
8
8
|
resolveSourceConnector
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-U3BCW7GX.js";
|
|
10
10
|
import {
|
|
11
11
|
normalizeReasoningTrace
|
|
12
12
|
} from "./chunk-54V4BZWP.js";
|
|
@@ -2458,4 +2458,4 @@ export {
|
|
|
2458
2458
|
shouldEnableLocalExtractionThinking,
|
|
2459
2459
|
ExtractionEngine
|
|
2460
2460
|
};
|
|
2461
|
-
//# sourceMappingURL=chunk-
|
|
2461
|
+
//# sourceMappingURL=chunk-5PUZV73Z.js.map
|