@batalabs/virlow-memory 3.11.5 → 3.11.6

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.
@@ -0,0 +1,15 @@
1
+ /** Pinned embedding model. Changing ANY of these invalidates stored embeddings;
2
+ * bump EMBEDDING_MODEL_TAG so clients lazily re-embed (spec: embeddingModel column). */
3
+ export declare const EMBEDDING_MODEL_ID = "Xenova/all-MiniLM-L6-v2";
4
+ /** Pinned HF repo revision. The model repo can re-upload weights under the
5
+ * same id; without this pin, embeddings would drift while EMBEDDING_MODEL_TAG
6
+ * stays unchanged. Bump BOTH this and EMBEDDING_MODEL_TAG together. */
7
+ export declare const EMBEDDING_MODEL_REVISION = "751bff37182d3f1213fa05d7196b954e230abad9";
8
+ export declare const EMBEDDING_MODEL_TAG = "minilm-l6-v2@q8";
9
+ export declare const EMBEDDING_DIM = 384;
10
+ /** add_memory treats similarity >= this as "same memory, update it in place". */
11
+ export declare const DEDUPE_UPDATE_THRESHOLD = 0.9;
12
+ /** Similarity in [DEDUPE_REPORT_THRESHOLD, DEDUPE_UPDATE_THRESHOLD) is close
13
+ * enough to be worth telling the agent about, but not close enough to merge:
14
+ * add_memory stores the new memory and reports these alongside it. */
15
+ export declare const DEDUPE_REPORT_THRESHOLD = 0.7;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEDUPE_REPORT_THRESHOLD = exports.DEDUPE_UPDATE_THRESHOLD = exports.EMBEDDING_DIM = exports.EMBEDDING_MODEL_TAG = exports.EMBEDDING_MODEL_REVISION = exports.EMBEDDING_MODEL_ID = void 0;
4
+ /** Pinned embedding model. Changing ANY of these invalidates stored embeddings;
5
+ * bump EMBEDDING_MODEL_TAG so clients lazily re-embed (spec: embeddingModel column). */
6
+ exports.EMBEDDING_MODEL_ID = 'Xenova/all-MiniLM-L6-v2';
7
+ /** Pinned HF repo revision. The model repo can re-upload weights under the
8
+ * same id; without this pin, embeddings would drift while EMBEDDING_MODEL_TAG
9
+ * stays unchanged. Bump BOTH this and EMBEDDING_MODEL_TAG together. */
10
+ exports.EMBEDDING_MODEL_REVISION = '751bff37182d3f1213fa05d7196b954e230abad9';
11
+ exports.EMBEDDING_MODEL_TAG = 'minilm-l6-v2@q8';
12
+ exports.EMBEDDING_DIM = 384;
13
+ /** add_memory treats similarity >= this as "same memory, update it in place". */
14
+ exports.DEDUPE_UPDATE_THRESHOLD = 0.9;
15
+ /** Similarity in [DEDUPE_REPORT_THRESHOLD, DEDUPE_UPDATE_THRESHOLD) is close
16
+ * enough to be worth telling the agent about, but not close enough to merge:
17
+ * add_memory stores the new memory and reports these alongside it. */
18
+ exports.DEDUPE_REPORT_THRESHOLD = 0.7;
@@ -0,0 +1,19 @@
1
+ export interface Embedder {
2
+ embed(text: string): Promise<Float32Array>;
3
+ }
4
+ /**
5
+ * Load the pinned embedding model. In Node, `cacheDir` controls where the
6
+ * public ONNX weights are cached (the MCP server passes ~/.virlow-mcp/models);
7
+ * in the browser, transformers.js uses the Cache API automatically.
8
+ *
9
+ * `localModelPath` self-hosts the model instead of fetching it from the
10
+ * Hugging Face Hub — the web app's production CSP doesn't allow
11
+ * huggingface.co, and self-hosting is better privacy anyway. Set it to the
12
+ * public URL prefix (e.g. `/models/`) that serves the files fetched by
13
+ * `scripts/fetch-embedding-model.mjs`; transformers.js then resolves
14
+ * `<localModelPath><EMBEDDING_MODEL_ID>/...` instead of hitting the Hub.
15
+ */
16
+ export declare function createEmbedder(opts?: {
17
+ cacheDir?: string;
18
+ localModelPath?: string;
19
+ }): Promise<Embedder>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createEmbedder = createEmbedder;
4
+ const transformers_1 = require("@huggingface/transformers");
5
+ const constants_js_1 = require("./constants.js");
6
+ /**
7
+ * Load the pinned embedding model. In Node, `cacheDir` controls where the
8
+ * public ONNX weights are cached (the MCP server passes ~/.virlow-mcp/models);
9
+ * in the browser, transformers.js uses the Cache API automatically.
10
+ *
11
+ * `localModelPath` self-hosts the model instead of fetching it from the
12
+ * Hugging Face Hub — the web app's production CSP doesn't allow
13
+ * huggingface.co, and self-hosting is better privacy anyway. Set it to the
14
+ * public URL prefix (e.g. `/models/`) that serves the files fetched by
15
+ * `scripts/fetch-embedding-model.mjs`; transformers.js then resolves
16
+ * `<localModelPath><EMBEDDING_MODEL_ID>/...` instead of hitting the Hub.
17
+ */
18
+ async function createEmbedder(opts = {}) {
19
+ if (opts.cacheDir) {
20
+ transformers_1.env.cacheDir = opts.cacheDir;
21
+ }
22
+ if (opts.localModelPath) {
23
+ transformers_1.env.allowRemoteModels = false;
24
+ transformers_1.env.localModelPath = opts.localModelPath;
25
+ }
26
+ const extractor = await (0, transformers_1.pipeline)('feature-extraction', constants_js_1.EMBEDDING_MODEL_ID, {
27
+ dtype: 'q8',
28
+ revision: constants_js_1.EMBEDDING_MODEL_REVISION,
29
+ });
30
+ return {
31
+ async embed(text) {
32
+ const output = await extractor(text, { pooling: 'mean', normalize: true });
33
+ return Float32Array.from(output.data);
34
+ },
35
+ };
36
+ }
@@ -0,0 +1,3 @@
1
+ export { DEDUPE_REPORT_THRESHOLD, DEDUPE_UPDATE_THRESHOLD, EMBEDDING_DIM, EMBEDDING_MODEL_ID, EMBEDDING_MODEL_REVISION, EMBEDDING_MODEL_TAG, } from './constants.js';
2
+ export { bytesToEmbedding, cosineSimilarity, embeddingToBytes, findDuplicate, findSimilar, rankBySimilarity, } from './vectors.js';
3
+ export { createEmbedder, type Embedder } from './embedder.js';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createEmbedder = exports.rankBySimilarity = exports.findSimilar = exports.findDuplicate = exports.embeddingToBytes = exports.cosineSimilarity = exports.bytesToEmbedding = exports.EMBEDDING_MODEL_TAG = exports.EMBEDDING_MODEL_REVISION = exports.EMBEDDING_MODEL_ID = exports.EMBEDDING_DIM = exports.DEDUPE_UPDATE_THRESHOLD = exports.DEDUPE_REPORT_THRESHOLD = void 0;
4
+ var constants_js_1 = require("./constants.js");
5
+ Object.defineProperty(exports, "DEDUPE_REPORT_THRESHOLD", { enumerable: true, get: function () { return constants_js_1.DEDUPE_REPORT_THRESHOLD; } });
6
+ Object.defineProperty(exports, "DEDUPE_UPDATE_THRESHOLD", { enumerable: true, get: function () { return constants_js_1.DEDUPE_UPDATE_THRESHOLD; } });
7
+ Object.defineProperty(exports, "EMBEDDING_DIM", { enumerable: true, get: function () { return constants_js_1.EMBEDDING_DIM; } });
8
+ Object.defineProperty(exports, "EMBEDDING_MODEL_ID", { enumerable: true, get: function () { return constants_js_1.EMBEDDING_MODEL_ID; } });
9
+ Object.defineProperty(exports, "EMBEDDING_MODEL_REVISION", { enumerable: true, get: function () { return constants_js_1.EMBEDDING_MODEL_REVISION; } });
10
+ Object.defineProperty(exports, "EMBEDDING_MODEL_TAG", { enumerable: true, get: function () { return constants_js_1.EMBEDDING_MODEL_TAG; } });
11
+ var vectors_js_1 = require("./vectors.js");
12
+ Object.defineProperty(exports, "bytesToEmbedding", { enumerable: true, get: function () { return vectors_js_1.bytesToEmbedding; } });
13
+ Object.defineProperty(exports, "cosineSimilarity", { enumerable: true, get: function () { return vectors_js_1.cosineSimilarity; } });
14
+ Object.defineProperty(exports, "embeddingToBytes", { enumerable: true, get: function () { return vectors_js_1.embeddingToBytes; } });
15
+ Object.defineProperty(exports, "findDuplicate", { enumerable: true, get: function () { return vectors_js_1.findDuplicate; } });
16
+ Object.defineProperty(exports, "findSimilar", { enumerable: true, get: function () { return vectors_js_1.findSimilar; } });
17
+ Object.defineProperty(exports, "rankBySimilarity", { enumerable: true, get: function () { return vectors_js_1.rankBySimilarity; } });
18
+ var embedder_js_1 = require("./embedder.js");
19
+ Object.defineProperty(exports, "createEmbedder", { enumerable: true, get: function () { return embedder_js_1.createEmbedder; } });
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,34 @@
1
+ export declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
2
+ export declare function rankBySimilarity(query: Float32Array, entries: ReadonlyArray<{
3
+ id: string;
4
+ embedding: Float32Array;
5
+ }>, limit: number): Array<{
6
+ id: string;
7
+ similarity: number;
8
+ }>;
9
+ export declare function findDuplicate(embedding: Float32Array, entries: ReadonlyArray<{
10
+ id: string;
11
+ embedding: Float32Array;
12
+ }>, threshold?: number): {
13
+ id: string;
14
+ similarity: number;
15
+ } | null;
16
+ /**
17
+ * Every entry at or above `threshold`, most similar first. Unlike
18
+ * `rankBySimilarity` this takes no limit: add_memory reports the full set of
19
+ * near-misses so the agent can see everything it might be duplicating.
20
+ */
21
+ export declare function findSimilar(embedding: Float32Array, entries: ReadonlyArray<{
22
+ id: string;
23
+ embedding: Float32Array;
24
+ }>, threshold?: number): Array<{
25
+ id: string;
26
+ similarity: number;
27
+ }>;
28
+ /**
29
+ * Float32Array <-> bytes for encryption/transport. Byte order is the
30
+ * platform's native order — little-endian on every runtime Virlow targets
31
+ * (x86, ARM); embeddings are device-portable in practice.
32
+ */
33
+ export declare function embeddingToBytes(vec: Float32Array): Uint8Array;
34
+ export declare function bytesToEmbedding(bytes: Uint8Array): Float32Array;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cosineSimilarity = cosineSimilarity;
4
+ exports.rankBySimilarity = rankBySimilarity;
5
+ exports.findDuplicate = findDuplicate;
6
+ exports.findSimilar = findSimilar;
7
+ exports.embeddingToBytes = embeddingToBytes;
8
+ exports.bytesToEmbedding = bytesToEmbedding;
9
+ const constants_js_1 = require("./constants.js");
10
+ function cosineSimilarity(a, b) {
11
+ if (a.length !== b.length) {
12
+ throw new Error(`Embedding dimension mismatch: ${a.length} vs ${b.length}`);
13
+ }
14
+ let dot = 0;
15
+ let normA = 0;
16
+ let normB = 0;
17
+ for (let i = 0; i < a.length; i++) {
18
+ dot += a[i] * b[i];
19
+ normA += a[i] * a[i];
20
+ normB += b[i] * b[i];
21
+ }
22
+ if (normA === 0 || normB === 0)
23
+ return 0;
24
+ return dot / (Math.sqrt(normA) * Math.sqrt(normB));
25
+ }
26
+ function rankBySimilarity(query, entries, limit) {
27
+ return entries
28
+ .map((e) => ({ id: e.id, similarity: cosineSimilarity(query, e.embedding) }))
29
+ .sort((x, y) => y.similarity - x.similarity)
30
+ .slice(0, limit);
31
+ }
32
+ function findDuplicate(embedding, entries, threshold = constants_js_1.DEDUPE_UPDATE_THRESHOLD) {
33
+ const [best] = rankBySimilarity(embedding, entries, 1);
34
+ return best && best.similarity >= threshold ? best : null;
35
+ }
36
+ /**
37
+ * Every entry at or above `threshold`, most similar first. Unlike
38
+ * `rankBySimilarity` this takes no limit: add_memory reports the full set of
39
+ * near-misses so the agent can see everything it might be duplicating.
40
+ */
41
+ function findSimilar(embedding, entries, threshold = constants_js_1.DEDUPE_REPORT_THRESHOLD) {
42
+ return rankBySimilarity(embedding, entries, entries.length).filter((e) => e.similarity >= threshold);
43
+ }
44
+ /**
45
+ * Float32Array <-> bytes for encryption/transport. Byte order is the
46
+ * platform's native order — little-endian on every runtime Virlow targets
47
+ * (x86, ARM); embeddings are device-portable in practice.
48
+ */
49
+ function embeddingToBytes(vec) {
50
+ return new Uint8Array(vec.buffer.slice(vec.byteOffset, vec.byteOffset + vec.byteLength));
51
+ }
52
+ function bytesToEmbedding(bytes) {
53
+ if (bytes.byteLength % 4 !== 0) {
54
+ throw new Error(`Embedding byte length ${bytes.byteLength} is not a multiple of 4`);
55
+ }
56
+ return new Float32Array(bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength));
57
+ }
package/dist/embedder.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { env, pipeline } from '@huggingface/transformers';
2
- import { EMBEDDING_MODEL_ID, EMBEDDING_MODEL_REVISION } from './constants';
2
+ import { EMBEDDING_MODEL_ID, EMBEDDING_MODEL_REVISION } from './constants.js';
3
3
  /**
4
4
  * Load the pinned embedding model. In Node, `cacheDir` controls where the
5
5
  * public ONNX weights are cached (the MCP server passes ~/.virlow-mcp/models);
@@ -1 +1 @@
1
- {"version":3,"file":"embedder.js","sourceRoot":"","sources":["../src/embedder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAM3E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAuD,EAAE;IAEzD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/B,CAAC;IACD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,GAAG,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC9B,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAC3C,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,oBAAoB,EAAE,kBAAkB,EAAE;QACzE,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,wBAAwB;KACnC,CAAC,CAAC;IACH,OAAO;QACL,KAAK,CAAC,KAAK,CAAC,IAAY;YACtB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3E,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAoB,CAAC,CAAC;QACxD,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"embedder.js","sourceRoot":"","sources":["../src/embedder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAM9E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAuD,EAAE;IAEzD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/B,CAAC;IACD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,GAAG,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC9B,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAC3C,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,oBAAoB,EAAE,kBAAkB,EAAE;QACzE,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,wBAAwB;KACnC,CAAC,CAAC;IACH,OAAO;QACL,KAAK,CAAC,KAAK,CAAC,IAAY;YACtB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3E,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAoB,CAAC,CAAC;QACxD,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { DEDUPE_REPORT_THRESHOLD, DEDUPE_UPDATE_THRESHOLD, EMBEDDING_DIM, EMBEDDING_MODEL_ID, EMBEDDING_MODEL_REVISION, EMBEDDING_MODEL_TAG, } from './constants';
2
- export { bytesToEmbedding, cosineSimilarity, embeddingToBytes, findDuplicate, findSimilar, rankBySimilarity, } from './vectors';
3
- export { createEmbedder, type Embedder } from './embedder';
1
+ export { DEDUPE_REPORT_THRESHOLD, DEDUPE_UPDATE_THRESHOLD, EMBEDDING_DIM, EMBEDDING_MODEL_ID, EMBEDDING_MODEL_REVISION, EMBEDDING_MODEL_TAG, } from './constants.js';
2
+ export { bytesToEmbedding, cosineSimilarity, embeddingToBytes, findDuplicate, findSimilar, rankBySimilarity, } from './vectors.js';
3
+ export { createEmbedder, type Embedder } from './embedder.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { DEDUPE_REPORT_THRESHOLD, DEDUPE_UPDATE_THRESHOLD, EMBEDDING_DIM, EMBEDDING_MODEL_ID, EMBEDDING_MODEL_REVISION, EMBEDDING_MODEL_TAG, } from './constants';
2
- export { bytesToEmbedding, cosineSimilarity, embeddingToBytes, findDuplicate, findSimilar, rankBySimilarity, } from './vectors';
3
- export { createEmbedder } from './embedder';
1
+ export { DEDUPE_REPORT_THRESHOLD, DEDUPE_UPDATE_THRESHOLD, EMBEDDING_DIM, EMBEDDING_MODEL_ID, EMBEDDING_MODEL_REVISION, EMBEDDING_MODEL_TAG, } from './constants.js';
2
+ export { bytesToEmbedding, cosineSimilarity, embeddingToBytes, findDuplicate, findSimilar, rankBySimilarity, } from './vectors.js';
3
+ export { createEmbedder } from './embedder.js';
4
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAiB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAiB,MAAM,eAAe,CAAC"}
package/dist/vectors.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DEDUPE_REPORT_THRESHOLD, DEDUPE_UPDATE_THRESHOLD, } from './constants';
1
+ import { DEDUPE_REPORT_THRESHOLD, DEDUPE_UPDATE_THRESHOLD, } from './constants.js';
2
2
  export function cosineSimilarity(a, b) {
3
3
  if (a.length !== b.length) {
4
4
  throw new Error(`Embedding dimension mismatch: ${a.length} vs ${b.length}`);
@@ -1 +1 @@
1
- {"version":3,"file":"vectors.js","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K,CAAC,UAAU,yBAAyB,CACnE,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,YAAY,CACrB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAC1E,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,30 +1,42 @@
1
1
  {
2
2
  "name": "@batalabs/virlow-memory",
3
- "version": "3.11.5",
3
+ "version": "3.11.6",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Virlow Memories shared core: embeddings, similarity ranking, dedupe, and encrypted memory payloads.",
7
7
  "license": "MIT",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/cjs/index.d.ts",
16
+ "default": "./dist/cjs/index.js"
17
+ }
12
18
  },
13
19
  "./embedder": {
14
- "types": "./dist/embedder.d.ts",
15
- "import": "./dist/embedder.js"
20
+ "import": {
21
+ "types": "./dist/embedder.d.ts",
22
+ "default": "./dist/embedder.js"
23
+ },
24
+ "require": {
25
+ "types": "./dist/cjs/embedder.d.ts",
26
+ "default": "./dist/cjs/embedder.js"
27
+ }
16
28
  }
17
29
  },
18
30
  "dependencies": {
19
31
  "@huggingface/transformers": "^3.4.0",
20
- "@batalabs/virlow-crypto": "3.11.5"
32
+ "@batalabs/virlow-crypto": "3.11.6"
21
33
  },
22
34
  "devDependencies": {
23
35
  "@types/node": "^22.10.0",
24
36
  "typescript": "^5.8.0",
25
37
  "vitest": "^3.0.0"
26
38
  },
27
- "main": "./dist/index.js",
39
+ "main": "./dist/cjs/index.js",
28
40
  "types": "./dist/index.d.ts",
29
41
  "files": [
30
42
  "LICENSE",
@@ -42,6 +54,6 @@
42
54
  "scripts": {
43
55
  "test": "vitest run",
44
56
  "type-check": "tsc --noEmit",
45
- "build": "tsc -p tsconfig.build.json"
57
+ "build": "tsc -p tsconfig.build.json && tsc -p tsconfig.cjs.json && node -e \"require('fs').writeFileSync('dist/cjs/package.json','{\\\"type\\\":\\\"commonjs\\\"}')\""
46
58
  }
47
59
  }