@openclaw/memory-lancedb 2026.10.5 → 2026.10.7
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.
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { a as __toCommonJS, i as __require, n as __esmMin, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-
|
|
1
|
+
import { a as __toCommonJS, i as __require, n as __esmMin, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-1p2KPIdQ.mjs";
|
|
2
2
|
//#region node_modules/.pnpm/@lancedb+lancedb@0.39.0_@types+node@26.6.4_apache-arrow@21.2.0/node_modules/@lancedb/lancedb/dist/arrow_type.js
|
|
3
3
|
var require_arrow_type = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.typedArrayToArrowType = typedArrayToArrowType;
|
|
6
|
-
const apache_arrow_1
|
|
6
|
+
const apache_arrow_1 = __require("apache-arrow");
|
|
7
7
|
/**
|
|
8
8
|
* Map a JS TypedArray instance to the corresponding Arrow element type and
|
|
9
9
|
* length. Returns undefined when the view is not a supported TypedArray.
|
|
10
10
|
*/
|
|
11
11
|
function typedArrayToArrowType(value) {
|
|
12
12
|
if (value instanceof Float32Array) return {
|
|
13
|
-
elementType: new apache_arrow_1
|
|
13
|
+
elementType: new apache_arrow_1.Float32(),
|
|
14
14
|
length: value.length
|
|
15
15
|
};
|
|
16
16
|
if (value instanceof Float64Array) return {
|
|
17
|
-
elementType: new apache_arrow_1
|
|
17
|
+
elementType: new apache_arrow_1.Float64(),
|
|
18
18
|
length: value.length
|
|
19
19
|
};
|
|
20
20
|
if (value instanceof Uint8Array) return {
|
|
21
|
-
elementType: new apache_arrow_1
|
|
21
|
+
elementType: new apache_arrow_1.Uint8(),
|
|
22
22
|
length: value.length
|
|
23
23
|
};
|
|
24
24
|
if (value instanceof Uint16Array) return {
|
|
25
|
-
elementType: new apache_arrow_1
|
|
25
|
+
elementType: new apache_arrow_1.Uint16(),
|
|
26
26
|
length: value.length
|
|
27
27
|
};
|
|
28
28
|
if (value instanceof Uint32Array) return {
|
|
29
|
-
elementType: new apache_arrow_1
|
|
29
|
+
elementType: new apache_arrow_1.Uint32(),
|
|
30
30
|
length: value.length
|
|
31
31
|
};
|
|
32
32
|
if (value instanceof Int8Array) return {
|
|
33
|
-
elementType: new apache_arrow_1
|
|
33
|
+
elementType: new apache_arrow_1.Int8(),
|
|
34
34
|
length: value.length
|
|
35
35
|
};
|
|
36
36
|
if (value instanceof Int16Array) return {
|
|
37
|
-
elementType: new apache_arrow_1
|
|
37
|
+
elementType: new apache_arrow_1.Int16(),
|
|
38
38
|
length: value.length
|
|
39
39
|
};
|
|
40
40
|
if (value instanceof Int32Array) return {
|
|
41
|
-
elementType: new apache_arrow_1
|
|
41
|
+
elementType: new apache_arrow_1.Int32(),
|
|
42
42
|
length: value.length
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -551,7 +551,7 @@ var require_blob = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
551
551
|
exports.blob = blob;
|
|
552
552
|
exports.isBlobField = isBlobField;
|
|
553
553
|
exports.coerceBlobValue = coerceBlobValue;
|
|
554
|
-
const apache_arrow_1
|
|
554
|
+
const apache_arrow_1 = __require("apache-arrow");
|
|
555
555
|
const native_1 = require_native();
|
|
556
556
|
const BLOB_V2_EXTENSION_NAME = "lance.blob.v2";
|
|
557
557
|
const INLINE_SIZE_THRESHOLD_KEY = "lance-encoding:blob-inline-size-threshold";
|
|
@@ -596,7 +596,7 @@ var require_blob = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
596
596
|
setThreshold(metadata, INLINE_SIZE_THRESHOLD_KEY, "inlineSizeThreshold", options.inlineSizeThreshold, 0);
|
|
597
597
|
setThreshold(metadata, DEDICATED_SIZE_THRESHOLD_KEY, "dedicatedSizeThreshold", options.dedicatedSizeThreshold, 1);
|
|
598
598
|
setThreshold(metadata, PACK_FILE_SIZE_THRESHOLD_KEY, "packFileSizeThreshold", options.packFileSizeThreshold, 1);
|
|
599
|
-
return new apache_arrow_1
|
|
599
|
+
return new apache_arrow_1.Field(name, new apache_arrow_1.Struct([new apache_arrow_1.Field("data", new apache_arrow_1.LargeBinary(), true), new apache_arrow_1.Field("uri", new apache_arrow_1.Utf8(), true)]), options.nullable ?? true, metadata);
|
|
600
600
|
}
|
|
601
601
|
/**
|
|
602
602
|
* Checks for the `lance.blob.v2` extension marker. Does not validate the
|
|
@@ -2122,7 +2122,7 @@ var require_sanitize = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2122
2122
|
exports.sanitizeSchema = sanitizeSchema;
|
|
2123
2123
|
exports.sanitizeTable = sanitizeTable;
|
|
2124
2124
|
exports.dataTypeFromName = dataTypeFromName;
|
|
2125
|
-
const apache_arrow_1
|
|
2125
|
+
const apache_arrow_1 = __require("apache-arrow");
|
|
2126
2126
|
const arrow_1 = require_arrow();
|
|
2127
2127
|
function createSanitizationContext() {
|
|
2128
2128
|
return {
|
|
@@ -2380,7 +2380,7 @@ var require_sanitize = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2380
2380
|
return new arrow_1.RecordBatch(schema, data);
|
|
2381
2381
|
}
|
|
2382
2382
|
function sanitizeData(dataLike, context) {
|
|
2383
|
-
if (dataLike instanceof apache_arrow_1
|
|
2383
|
+
if (dataLike instanceof apache_arrow_1.Data) return dataLike;
|
|
2384
2384
|
const cachedData = context.data.get(dataLike);
|
|
2385
2385
|
if (cachedData !== void 0) return cachedData;
|
|
2386
2386
|
const dictionaryLike = dataLike.dictionary;
|
|
@@ -2388,15 +2388,15 @@ var require_sanitize = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2388
2388
|
if (dictionaryLike !== void 0) {
|
|
2389
2389
|
dictionary = context.vectors.get(dictionaryLike);
|
|
2390
2390
|
if (dictionary === void 0) {
|
|
2391
|
-
dictionary = new apache_arrow_1
|
|
2391
|
+
dictionary = new apache_arrow_1.Vector(dictionaryLike.data.map((data) => sanitizeData(data, context)));
|
|
2392
2392
|
context.vectors.set(dictionaryLike, dictionary);
|
|
2393
2393
|
}
|
|
2394
2394
|
}
|
|
2395
|
-
const data = new apache_arrow_1
|
|
2396
|
-
[apache_arrow_1
|
|
2397
|
-
[apache_arrow_1
|
|
2398
|
-
[apache_arrow_1
|
|
2399
|
-
[apache_arrow_1
|
|
2395
|
+
const data = new apache_arrow_1.Data(sanitizeTypeWithContext(dataLike.type, context), dataLike.offset, dataLike.length, dataLike.nullCount, {
|
|
2396
|
+
[apache_arrow_1.BufferType.OFFSET]: dataLike.valueOffsets,
|
|
2397
|
+
[apache_arrow_1.BufferType.DATA]: dataLike.values,
|
|
2398
|
+
[apache_arrow_1.BufferType.VALIDITY]: dataLike.nullBitmap,
|
|
2399
|
+
[apache_arrow_1.BufferType.TYPE]: dataLike.typeIds
|
|
2400
2400
|
}, dataLike.children.map((child) => sanitizeData(child, context)), dictionary);
|
|
2401
2401
|
context.data.set(dataLike, data);
|
|
2402
2402
|
return data;
|
|
@@ -2442,7 +2442,7 @@ var require_sanitize = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2442
2442
|
var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2443
2443
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2444
2444
|
exports.inferSchema = inferSchema;
|
|
2445
|
-
const apache_arrow_1
|
|
2445
|
+
const apache_arrow_1 = __require("apache-arrow");
|
|
2446
2446
|
const arrow_type_1 = require_arrow_type();
|
|
2447
2447
|
const sanitize_1 = require_sanitize();
|
|
2448
2448
|
/**
|
|
@@ -2465,7 +2465,7 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2465
2465
|
}
|
|
2466
2466
|
infer(data) {
|
|
2467
2467
|
for (const [row, record] of data.entries()) for (const [path, value] of recordPathsAndValues(record)) this.observe(path, value, row);
|
|
2468
|
-
return this.providedSchema === void 0 ? new apache_arrow_1
|
|
2468
|
+
return this.providedSchema === void 0 ? new apache_arrow_1.Schema(fieldsFromTree(this.fields)) : new apache_arrow_1.Schema(matchingFields(this.providedSchema.fields, this.fields));
|
|
2469
2469
|
}
|
|
2470
2470
|
observe(path, value, row) {
|
|
2471
2471
|
const current = this.fields.get(path);
|
|
@@ -2518,21 +2518,21 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2518
2518
|
throw schemaInferenceError(path, row, current.describe(), describeEvidence(newType));
|
|
2519
2519
|
}
|
|
2520
2520
|
inferType(value, path) {
|
|
2521
|
-
if (typeof value === "bigint") return new apache_arrow_1
|
|
2522
|
-
if (typeof value === "number") return new apache_arrow_1
|
|
2523
|
-
if (typeof value === "string") return this.options.dictionaryEncodeStrings ? new apache_arrow_1
|
|
2524
|
-
if (typeof value === "boolean") return new apache_arrow_1
|
|
2525
|
-
if (value instanceof Buffer) return new apache_arrow_1
|
|
2521
|
+
if (typeof value === "bigint") return new apache_arrow_1.Int64();
|
|
2522
|
+
if (typeof value === "number") return new apache_arrow_1.Float64();
|
|
2523
|
+
if (typeof value === "string") return this.options.dictionaryEncodeStrings ? new apache_arrow_1.Dictionary(new apache_arrow_1.Utf8(), new apache_arrow_1.Int32()) : new apache_arrow_1.Utf8();
|
|
2524
|
+
if (typeof value === "boolean") return new apache_arrow_1.Bool();
|
|
2525
|
+
if (value instanceof Buffer) return new apache_arrow_1.Binary();
|
|
2526
2526
|
if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {
|
|
2527
2527
|
const typedArray = (0, arrow_type_1.typedArrayToArrowType)(value);
|
|
2528
|
-
return typedArray === void 0 ? void 0 : new apache_arrow_1
|
|
2528
|
+
return typedArray === void 0 ? void 0 : new apache_arrow_1.FixedSizeList(typedArray.length, new apache_arrow_1.Field("item", typedArray.elementType, true));
|
|
2529
2529
|
}
|
|
2530
2530
|
if (!Array.isArray(value) || value.length === 0) return;
|
|
2531
2531
|
const configuredVector = path.length === 1 ? this.options.vectorColumns[path[0]] : void 0;
|
|
2532
|
-
if (configuredVector !== void 0) return new apache_arrow_1
|
|
2532
|
+
if (configuredVector !== void 0) return new apache_arrow_1.FixedSizeList(value.length, new apache_arrow_1.Field("item", (0, sanitize_1.sanitizeType)(configuredVector.type), true));
|
|
2533
2533
|
const itemType = this.inferArrayItemType(value, path);
|
|
2534
2534
|
if (itemType === void 0) return;
|
|
2535
|
-
return nameSuggestsVectorColumn(path[path.length - 1]) ? new apache_arrow_1
|
|
2535
|
+
return nameSuggestsVectorColumn(path[path.length - 1]) ? new apache_arrow_1.FixedSizeList(value.length, new apache_arrow_1.Field("item", new apache_arrow_1.Float32(), true)) : new apache_arrow_1.List(new apache_arrow_1.Field("item", itemType, true));
|
|
2536
2536
|
}
|
|
2537
2537
|
inferArrayItemType(values, path) {
|
|
2538
2538
|
let itemType;
|
|
@@ -2625,9 +2625,9 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2625
2625
|
}
|
|
2626
2626
|
function fieldsFromTree(tree, path = []) {
|
|
2627
2627
|
const fields = [];
|
|
2628
|
-
for (const [name, value] of tree.entries()) if (value instanceof FieldTree) fields.push(new apache_arrow_1
|
|
2628
|
+
for (const [name, value] of tree.entries()) if (value instanceof FieldTree) fields.push(new apache_arrow_1.Field(name, new apache_arrow_1.Struct(fieldsFromTree(value, [...path, name])), true));
|
|
2629
2629
|
else if (value instanceof DeferredTypeEvidence) throw typeInferenceError([...path, name], value.firstRow());
|
|
2630
|
-
else fields.push(new apache_arrow_1
|
|
2630
|
+
else fields.push(new apache_arrow_1.Field(name, value, true));
|
|
2631
2631
|
return fields;
|
|
2632
2632
|
}
|
|
2633
2633
|
function matchingFields(fields, tree) {
|
|
@@ -2637,7 +2637,7 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2637
2637
|
const value = tree.get([field.name]);
|
|
2638
2638
|
if (value instanceof FieldTree) {
|
|
2639
2639
|
const struct = field.type;
|
|
2640
|
-
matches.push(new apache_arrow_1
|
|
2640
|
+
matches.push(new apache_arrow_1.Field(field.name, new apache_arrow_1.Struct(matchingFields(struct.children, value)), field.nullable, field.metadata));
|
|
2641
2641
|
} else matches.push(field);
|
|
2642
2642
|
}
|
|
2643
2643
|
return matches;
|
|
@@ -2655,7 +2655,7 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2655
2655
|
for (const [index, name] of path.entries()) {
|
|
2656
2656
|
field = fields.find((candidate) => candidate.name === name);
|
|
2657
2657
|
if (field === void 0 || index === path.length - 1) return field;
|
|
2658
|
-
if (!apache_arrow_1
|
|
2658
|
+
if (!apache_arrow_1.DataType.isStruct(field.type)) return;
|
|
2659
2659
|
fields = field.type.children;
|
|
2660
2660
|
}
|
|
2661
2661
|
return field;
|
|
@@ -2666,15 +2666,15 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2666
2666
|
function deferredValueMatchesType(value, type) {
|
|
2667
2667
|
if (value == null) return true;
|
|
2668
2668
|
if (!Array.isArray(value)) return false;
|
|
2669
|
-
if (apache_arrow_1
|
|
2670
|
-
if (apache_arrow_1
|
|
2669
|
+
if (apache_arrow_1.DataType.isList(type)) return value.every((item) => deferredValueMatchesType(item, type.valueType));
|
|
2670
|
+
if (apache_arrow_1.DataType.isFixedSizeList(type)) return value.length === type.listSize && value.every((item) => deferredValueMatchesType(item, type.valueType));
|
|
2671
2671
|
return false;
|
|
2672
2672
|
}
|
|
2673
2673
|
function inferredTypesEqual(current, candidate) {
|
|
2674
|
-
if (apache_arrow_1
|
|
2675
|
-
if (apache_arrow_1
|
|
2676
|
-
if (apache_arrow_1
|
|
2677
|
-
return apache_arrow_1
|
|
2674
|
+
if (apache_arrow_1.DataType.isDictionary(current)) return apache_arrow_1.DataType.isDictionary(candidate) && current.isOrdered === candidate.isOrdered && inferredTypesEqual(current.indices, candidate.indices) && inferredTypesEqual(current.dictionary, candidate.dictionary);
|
|
2675
|
+
if (apache_arrow_1.DataType.isList(current)) return apache_arrow_1.DataType.isList(candidate) && current.valueField.name === candidate.valueField.name && current.valueField.nullable === candidate.valueField.nullable && inferredTypesEqual(current.valueType, candidate.valueType);
|
|
2676
|
+
if (apache_arrow_1.DataType.isFixedSizeList(current)) return apache_arrow_1.DataType.isFixedSizeList(candidate) && current.listSize === candidate.listSize && current.valueField.name === candidate.valueField.name && current.valueField.nullable === candidate.valueField.nullable && inferredTypesEqual(current.valueType, candidate.valueType);
|
|
2677
|
+
return apache_arrow_1.util.compareTypes(current, candidate);
|
|
2678
2678
|
}
|
|
2679
2679
|
function describeEvidence(evidence) {
|
|
2680
2680
|
if (evidence === void 0) return "an unsupported value";
|
|
@@ -2696,8 +2696,8 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2696
2696
|
}));
|
|
2697
2697
|
//#endregion
|
|
2698
2698
|
//#region node_modules/.pnpm/@lancedb+lancedb@0.39.0_@types+node@26.6.4_apache-arrow@21.2.0/node_modules/@lancedb/lancedb/dist/arrow.js
|
|
2699
|
-
var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2700
|
-
var __createBinding =
|
|
2699
|
+
var require_arrow = /* @__PURE__ */ __commonJSMin(((exports, module, this$2) => {
|
|
2700
|
+
var __createBinding = this$2 && this$2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
2701
2701
|
if (k2 === void 0) k2 = k;
|
|
2702
2702
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2703
2703
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
@@ -2711,8 +2711,8 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2711
2711
|
if (k2 === void 0) k2 = k;
|
|
2712
2712
|
o[k2] = m[k];
|
|
2713
2713
|
}));
|
|
2714
|
-
var __exportStar =
|
|
2715
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports
|
|
2714
|
+
var __exportStar = this$2 && this$2.__exportStar || function(m, exports) {
|
|
2715
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2716
2716
|
};
|
|
2717
2717
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2718
2718
|
exports.MakeArrowTableOptions = exports.VectorColumnOptions = void 0;
|
|
@@ -2754,7 +2754,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2754
2754
|
exports.createEmptyTable = createEmptyTable;
|
|
2755
2755
|
exports.ensureNestedFieldsExist = ensureNestedFieldsExist;
|
|
2756
2756
|
exports.dataTypeToJson = dataTypeToJson;
|
|
2757
|
-
const apache_arrow_1
|
|
2757
|
+
const apache_arrow_1 = __require("apache-arrow");
|
|
2758
2758
|
const arrow_type_1 = require_arrow_type();
|
|
2759
2759
|
const blob_1 = require_blob();
|
|
2760
2760
|
const registry_1 = require_registry();
|
|
@@ -2788,80 +2788,80 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2788
2788
|
return null;
|
|
2789
2789
|
}
|
|
2790
2790
|
function isArrowTable(value) {
|
|
2791
|
-
if (value instanceof apache_arrow_1
|
|
2791
|
+
if (value instanceof apache_arrow_1.Table) return true;
|
|
2792
2792
|
return "schema" in value && "batches" in value;
|
|
2793
2793
|
}
|
|
2794
2794
|
function isNull(value) {
|
|
2795
|
-
return value instanceof apache_arrow_1
|
|
2795
|
+
return value instanceof apache_arrow_1.Null || apache_arrow_1.DataType.isNull(value);
|
|
2796
2796
|
}
|
|
2797
2797
|
function isInt(value) {
|
|
2798
|
-
return value instanceof apache_arrow_1
|
|
2798
|
+
return value instanceof apache_arrow_1.Int || apache_arrow_1.DataType.isInt(value);
|
|
2799
2799
|
}
|
|
2800
2800
|
function isFloat(value) {
|
|
2801
|
-
return value instanceof apache_arrow_1
|
|
2801
|
+
return value instanceof apache_arrow_1.Float || apache_arrow_1.DataType.isFloat(value);
|
|
2802
2802
|
}
|
|
2803
2803
|
function isBinary(value) {
|
|
2804
|
-
return value instanceof apache_arrow_1
|
|
2804
|
+
return value instanceof apache_arrow_1.Binary || apache_arrow_1.DataType.isBinary(value);
|
|
2805
2805
|
}
|
|
2806
2806
|
function isLargeBinary(value) {
|
|
2807
|
-
return value instanceof apache_arrow_1
|
|
2807
|
+
return value instanceof apache_arrow_1.LargeBinary || apache_arrow_1.DataType.isLargeBinary(value);
|
|
2808
2808
|
}
|
|
2809
2809
|
function isUtf8(value) {
|
|
2810
|
-
return value instanceof apache_arrow_1
|
|
2810
|
+
return value instanceof apache_arrow_1.Utf8 || apache_arrow_1.DataType.isUtf8(value);
|
|
2811
2811
|
}
|
|
2812
2812
|
function isLargeUtf8(value) {
|
|
2813
|
-
return value instanceof apache_arrow_1
|
|
2813
|
+
return value instanceof apache_arrow_1.Utf8 || apache_arrow_1.DataType.isLargeUtf8(value);
|
|
2814
2814
|
}
|
|
2815
2815
|
function isBool(value) {
|
|
2816
|
-
return value instanceof apache_arrow_1
|
|
2816
|
+
return value instanceof apache_arrow_1.Utf8 || apache_arrow_1.DataType.isBool(value);
|
|
2817
2817
|
}
|
|
2818
2818
|
function isDecimal(value) {
|
|
2819
|
-
return value instanceof apache_arrow_1
|
|
2819
|
+
return value instanceof apache_arrow_1.Utf8 || apache_arrow_1.DataType.isDecimal(value);
|
|
2820
2820
|
}
|
|
2821
2821
|
function isDate(value) {
|
|
2822
|
-
return value instanceof apache_arrow_1
|
|
2822
|
+
return value instanceof apache_arrow_1.Utf8 || apache_arrow_1.DataType.isDate(value);
|
|
2823
2823
|
}
|
|
2824
2824
|
function isTime(value) {
|
|
2825
|
-
return value instanceof apache_arrow_1
|
|
2825
|
+
return value instanceof apache_arrow_1.Utf8 || apache_arrow_1.DataType.isTime(value);
|
|
2826
2826
|
}
|
|
2827
2827
|
function isTimestamp(value) {
|
|
2828
|
-
return value instanceof apache_arrow_1
|
|
2828
|
+
return value instanceof apache_arrow_1.Utf8 || apache_arrow_1.DataType.isTimestamp(value);
|
|
2829
2829
|
}
|
|
2830
2830
|
function isInterval(value) {
|
|
2831
|
-
return value instanceof apache_arrow_1
|
|
2831
|
+
return value instanceof apache_arrow_1.Utf8 || apache_arrow_1.DataType.isInterval(value);
|
|
2832
2832
|
}
|
|
2833
2833
|
function isDuration(value) {
|
|
2834
|
-
return value instanceof apache_arrow_1
|
|
2834
|
+
return value instanceof apache_arrow_1.Utf8 || apache_arrow_1.DataType.isDuration(value);
|
|
2835
2835
|
}
|
|
2836
2836
|
function isList(value) {
|
|
2837
|
-
return value instanceof apache_arrow_1
|
|
2837
|
+
return value instanceof apache_arrow_1.List || apache_arrow_1.DataType.isList(value);
|
|
2838
2838
|
}
|
|
2839
2839
|
function isStruct(value) {
|
|
2840
|
-
return value instanceof apache_arrow_1
|
|
2840
|
+
return value instanceof apache_arrow_1.Struct || apache_arrow_1.DataType.isStruct(value);
|
|
2841
2841
|
}
|
|
2842
2842
|
function isUnion(value) {
|
|
2843
|
-
return value instanceof apache_arrow_1
|
|
2843
|
+
return value instanceof apache_arrow_1.Struct || apache_arrow_1.DataType.isUnion(value);
|
|
2844
2844
|
}
|
|
2845
2845
|
function isFixedSizeBinary(value) {
|
|
2846
|
-
return value instanceof apache_arrow_1
|
|
2846
|
+
return value instanceof apache_arrow_1.FixedSizeBinary || apache_arrow_1.DataType.isFixedSizeBinary(value);
|
|
2847
2847
|
}
|
|
2848
2848
|
function isFixedSizeList(value) {
|
|
2849
|
-
return value instanceof apache_arrow_1
|
|
2849
|
+
return value instanceof apache_arrow_1.FixedSizeList || apache_arrow_1.DataType.isFixedSizeList(value);
|
|
2850
2850
|
}
|
|
2851
2851
|
var VectorColumnOptions = class {
|
|
2852
2852
|
/** Vector column type. */
|
|
2853
|
-
type = new apache_arrow_1
|
|
2853
|
+
type = new apache_arrow_1.Float32();
|
|
2854
2854
|
constructor(values) {
|
|
2855
2855
|
Object.assign(this, values);
|
|
2856
2856
|
}
|
|
2857
2857
|
};
|
|
2858
2858
|
exports.VectorColumnOptions = VectorColumnOptions;
|
|
2859
2859
|
function vectorFromArray(data, type) {
|
|
2860
|
-
if (apache_arrow_1
|
|
2860
|
+
if (apache_arrow_1.DataType.isFixedSizeList(type) && apache_arrow_1.DataType.isFloat(type.valueType)) {
|
|
2861
2861
|
const extendedData = [...data, new Array(type.listSize).fill(0)];
|
|
2862
|
-
return (0, apache_arrow_1
|
|
2863
|
-
} else if (type === void 0) return (0, apache_arrow_1
|
|
2864
|
-
else return (0, apache_arrow_1
|
|
2862
|
+
return (0, apache_arrow_1.vectorFromArray)(extendedData, type).slice(0, data.length);
|
|
2863
|
+
} else if (type === void 0) return (0, apache_arrow_1.vectorFromArray)(data);
|
|
2864
|
+
else return (0, apache_arrow_1.vectorFromArray)(data, type);
|
|
2865
2865
|
}
|
|
2866
2866
|
/** Options to control the makeArrowTable call. */
|
|
2867
2867
|
var MakeArrowTableOptions = class {
|
|
@@ -2990,17 +2990,17 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2990
2990
|
else if (data.length === 0) {
|
|
2991
2991
|
if (schema === void 0) throw new Error("A schema must be provided if data is empty");
|
|
2992
2992
|
else {
|
|
2993
|
-
schema = new apache_arrow_1
|
|
2993
|
+
schema = new apache_arrow_1.Schema(schema.fields, schemaMetadata);
|
|
2994
2994
|
validateBlobSchema(schema);
|
|
2995
|
-
return new apache_arrow_1
|
|
2995
|
+
return new apache_arrow_1.Table(schema);
|
|
2996
2996
|
}
|
|
2997
2997
|
}
|
|
2998
2998
|
let inferredSchema = (0, schema_1.inferSchema)(data, schema, opt);
|
|
2999
|
-
inferredSchema = new apache_arrow_1
|
|
2999
|
+
inferredSchema = new apache_arrow_1.Schema(inferredSchema.fields, schemaMetadata);
|
|
3000
3000
|
validateBlobSchema(inferredSchema);
|
|
3001
3001
|
const finalColumns = {};
|
|
3002
3002
|
for (const field of inferredSchema.fields) finalColumns[field.name] = transposeData(data, field);
|
|
3003
|
-
return new apache_arrow_1
|
|
3003
|
+
return new apache_arrow_1.Table(inferredSchema, finalColumns);
|
|
3004
3004
|
}
|
|
3005
3005
|
function validateBlobSchema(schema) {
|
|
3006
3006
|
for (const field of schema.fields) validateBlobField(field);
|
|
@@ -3027,36 +3027,36 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3027
3027
|
}
|
|
3028
3028
|
function transposeData(data, field, path = []) {
|
|
3029
3029
|
const valuesPath = [...path, field.name];
|
|
3030
|
-
if ((0, blob_1.isBlobField)(field) && field.type instanceof apache_arrow_1
|
|
3030
|
+
if ((0, blob_1.isBlobField)(field) && field.type instanceof apache_arrow_1.Struct) {
|
|
3031
3031
|
const blobRows = data.map((datum) => (0, blob_1.coerceBlobValue)(valueAtPath(datum, valuesPath)));
|
|
3032
3032
|
const childVectors = field.type.children.map((child) => {
|
|
3033
3033
|
return makeVector(blobRows.map((row) => row == null ? null : row[child.name] ?? null), child.type, void 0, child.nullable);
|
|
3034
3034
|
});
|
|
3035
3035
|
const nullCount = blobRows.filter((row) => row === null).length;
|
|
3036
|
-
const structData = (0, apache_arrow_1
|
|
3036
|
+
const structData = (0, apache_arrow_1.makeData)({
|
|
3037
3037
|
type: field.type,
|
|
3038
3038
|
length: blobRows.length,
|
|
3039
3039
|
nullCount,
|
|
3040
|
-
nullBitmap: nullCount > 0 ? apache_arrow_1
|
|
3040
|
+
nullBitmap: nullCount > 0 ? apache_arrow_1.util.packBools(blobRows.map((row) => row !== null)) : void 0,
|
|
3041
3041
|
children: childVectors.map((v) => v.data[0])
|
|
3042
3042
|
});
|
|
3043
|
-
return (0, apache_arrow_1
|
|
3043
|
+
return (0, apache_arrow_1.makeVector)(structData);
|
|
3044
3044
|
}
|
|
3045
3045
|
if (isList(field.type) && containsBlobField(field.type.children[0])) return transposeListData(data, field, valuesPath);
|
|
3046
3046
|
const values = data.map((datum) => valueAtPath(datum, valuesPath));
|
|
3047
|
-
if (field.type instanceof apache_arrow_1
|
|
3047
|
+
if (field.type instanceof apache_arrow_1.Struct) {
|
|
3048
3048
|
const childVectors = field.type.children.map((child) => {
|
|
3049
3049
|
return transposeData(data, child, valuesPath);
|
|
3050
3050
|
});
|
|
3051
3051
|
const nullCount = values.filter((value) => value === null).length;
|
|
3052
|
-
const structData = (0, apache_arrow_1
|
|
3052
|
+
const structData = (0, apache_arrow_1.makeData)({
|
|
3053
3053
|
type: field.type,
|
|
3054
3054
|
length: values.length,
|
|
3055
3055
|
nullCount,
|
|
3056
|
-
nullBitmap: nullCount > 0 ? apache_arrow_1
|
|
3056
|
+
nullBitmap: nullCount > 0 ? apache_arrow_1.util.packBools(values.map((value) => value !== null)) : void 0,
|
|
3057
3057
|
children: childVectors.map((v) => v.data[0])
|
|
3058
3058
|
});
|
|
3059
|
-
return (0, apache_arrow_1
|
|
3059
|
+
return (0, apache_arrow_1.makeVector)(structData);
|
|
3060
3060
|
} else return makeVector(values, field.type, void 0, field.nullable);
|
|
3061
3061
|
}
|
|
3062
3062
|
function transposeListData(data, field, valuesPath) {
|
|
@@ -3079,11 +3079,11 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3079
3079
|
}
|
|
3080
3080
|
const childVector = transposeData(flattened, childField, []);
|
|
3081
3081
|
const nullCount = validity.filter((valid) => !valid).length;
|
|
3082
|
-
return (0, apache_arrow_1
|
|
3082
|
+
return (0, apache_arrow_1.makeVector)((0, apache_arrow_1.makeData)({
|
|
3083
3083
|
type: listType,
|
|
3084
3084
|
length: lists.length,
|
|
3085
3085
|
nullCount,
|
|
3086
|
-
nullBitmap: nullCount > 0 ? apache_arrow_1
|
|
3086
|
+
nullBitmap: nullCount > 0 ? apache_arrow_1.util.packBools(validity) : void 0,
|
|
3087
3087
|
valueOffsets: Int32Array.from(offsets),
|
|
3088
3088
|
child: childVector.data[0]
|
|
3089
3089
|
}));
|
|
@@ -3106,7 +3106,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3106
3106
|
} catch (error) {
|
|
3107
3107
|
throw Error(`Cannot infer list vector. Cannot infer inner type: ${error}`);
|
|
3108
3108
|
}
|
|
3109
|
-
const listBuilder = (0, apache_arrow_1
|
|
3109
|
+
const listBuilder = (0, apache_arrow_1.makeBuilder)({ type: new apache_arrow_1.List(new apache_arrow_1.Field("item", inferredType, true)) });
|
|
3110
3110
|
for (const list of lists) listBuilder.append(list);
|
|
3111
3111
|
return listBuilder.finish().toVector();
|
|
3112
3112
|
}
|
|
@@ -3114,20 +3114,20 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3114
3114
|
function makeVector(values, type, stringAsDictionary, nullable) {
|
|
3115
3115
|
if (type !== void 0) {
|
|
3116
3116
|
if (nullable) values = values.map((v) => v === void 0 ? null : v);
|
|
3117
|
-
if (apache_arrow_1
|
|
3117
|
+
if (apache_arrow_1.DataType.isBool(type)) {
|
|
3118
3118
|
if (!values.some((v) => v !== null && v !== void 0)) {
|
|
3119
3119
|
const nullBitmap = new Uint8Array(Math.ceil(values.length / 8));
|
|
3120
|
-
const data = (0, apache_arrow_1
|
|
3120
|
+
const data = (0, apache_arrow_1.makeData)({
|
|
3121
3121
|
type,
|
|
3122
3122
|
length: values.length,
|
|
3123
3123
|
nullCount: values.length,
|
|
3124
3124
|
nullBitmap
|
|
3125
3125
|
});
|
|
3126
|
-
return (0, apache_arrow_1
|
|
3126
|
+
return (0, apache_arrow_1.makeVector)(data);
|
|
3127
3127
|
}
|
|
3128
3128
|
}
|
|
3129
|
-
if (type instanceof apache_arrow_1
|
|
3130
|
-
if (apache_arrow_1
|
|
3129
|
+
if (type instanceof apache_arrow_1.Int) {
|
|
3130
|
+
if (apache_arrow_1.DataType.isInt(type) && type.bitWidth === 64) values = values.map((v) => {
|
|
3131
3131
|
if (v === null) return v;
|
|
3132
3132
|
else if (typeof v === "bigint") return v;
|
|
3133
3133
|
else if (typeof v === "number") return BigInt(v);
|
|
@@ -3146,13 +3146,13 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3146
3146
|
if (ArrayBuffer.isView(sampleValue) && !(sampleValue instanceof DataView)) {
|
|
3147
3147
|
const info = (0, arrow_type_1.typedArrayToArrowType)(sampleValue);
|
|
3148
3148
|
if (info !== void 0) {
|
|
3149
|
-
const fslType = new apache_arrow_1
|
|
3149
|
+
const fslType = new apache_arrow_1.FixedSizeList(info.length, new apache_arrow_1.Field("item", info.elementType, true));
|
|
3150
3150
|
return vectorFromArray(values, fslType);
|
|
3151
3151
|
}
|
|
3152
3152
|
}
|
|
3153
3153
|
if (Array.isArray(sampleValue)) return makeListVector(values);
|
|
3154
|
-
else if (Buffer.isBuffer(sampleValue)) return vectorFromArray(values, new apache_arrow_1
|
|
3155
|
-
else if (!(stringAsDictionary ?? false) && (typeof sampleValue === "string" || sampleValue instanceof String)) return vectorFromArray(values, new apache_arrow_1
|
|
3154
|
+
else if (Buffer.isBuffer(sampleValue)) return vectorFromArray(values, new apache_arrow_1.Binary());
|
|
3155
|
+
else if (!(stringAsDictionary ?? false) && (typeof sampleValue === "string" || sampleValue instanceof String)) return vectorFromArray(values, new apache_arrow_1.Utf8());
|
|
3156
3156
|
else return vectorFromArray(values);
|
|
3157
3157
|
}
|
|
3158
3158
|
/** Helper function to apply embeddings from metadata to an input table */
|
|
@@ -3181,7 +3181,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3181
3181
|
const nullValues = new Array(table.numRows).fill(null);
|
|
3182
3182
|
columns[field.name] = makeVector(nullValues, field.type, void 0, field.nullable);
|
|
3183
3183
|
}
|
|
3184
|
-
return alignTable(new apache_arrow_1
|
|
3184
|
+
return alignTable(new apache_arrow_1.Table(columns), schema);
|
|
3185
3185
|
}
|
|
3186
3186
|
/** Helper function to apply embeddings to an input table */
|
|
3187
3187
|
async function applyEmbeddings(table, embeddings, schema) {
|
|
@@ -3199,7 +3199,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3199
3199
|
const newColumns = Object.fromEntries(colEntries);
|
|
3200
3200
|
const sourceColumn = newColumns[embeddings.sourceColumn];
|
|
3201
3201
|
const destColumn = embeddings.vectorColumn ?? "vector";
|
|
3202
|
-
const innerDestType = embeddings.function.embeddingDataType() ?? new apache_arrow_1
|
|
3202
|
+
const innerDestType = embeddings.function.embeddingDataType() ?? new apache_arrow_1.Float32();
|
|
3203
3203
|
if (sourceColumn === void 0) throw new Error(`Cannot apply embedding function because the source column '${embeddings.sourceColumn}' was not present in the data`);
|
|
3204
3204
|
if (table.numRows === 0) {
|
|
3205
3205
|
if (Object.prototype.hasOwnProperty.call(newColumns, destColumn)) return table;
|
|
@@ -3214,9 +3214,9 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3214
3214
|
if (Object.prototype.hasOwnProperty.call(newColumns, destColumn)) {
|
|
3215
3215
|
const existingColumn = newColumns[destColumn];
|
|
3216
3216
|
if (existingColumn.nullCount !== existingColumn.length) {
|
|
3217
|
-
let newTable = new apache_arrow_1
|
|
3217
|
+
let newTable = new apache_arrow_1.Table(newColumns);
|
|
3218
3218
|
if (schema != null) newTable = alignTable(newTable, schema);
|
|
3219
|
-
return new apache_arrow_1
|
|
3219
|
+
return new apache_arrow_1.Table(new apache_arrow_1.Schema(newTable.schema.fields, schemaMetadata), newTable.batches);
|
|
3220
3220
|
}
|
|
3221
3221
|
}
|
|
3222
3222
|
if (table.batches.length > 1) throw new Error("Internal error: `makeArrowTable` unexpectedly created a table with more than one batch");
|
|
@@ -3225,12 +3225,12 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3225
3225
|
if (vectors.length !== values.length) throw new Error("Embedding function did not return an embedding for each input element");
|
|
3226
3226
|
newColumns[destColumn] = makeVector(vectors, newVectorType(vectors[0].length, innerDestType));
|
|
3227
3227
|
}
|
|
3228
|
-
let newTable = new apache_arrow_1
|
|
3228
|
+
let newTable = new apache_arrow_1.Table(newColumns);
|
|
3229
3229
|
if (schema != null) {
|
|
3230
3230
|
if (schema.fields.find((f) => f.name === destColumn) === void 0) throw new Error(`When using embedding functions and specifying a schema the schema should include the embedding column but the column ${destColumn} was missing`);
|
|
3231
3231
|
newTable = alignTable(newTable, schema);
|
|
3232
3232
|
}
|
|
3233
|
-
newTable = new apache_arrow_1
|
|
3233
|
+
newTable = new apache_arrow_1.Table(new apache_arrow_1.Schema(newTable.schema.fields, schemaMetadata), newTable.batches);
|
|
3234
3234
|
return newTable;
|
|
3235
3235
|
}
|
|
3236
3236
|
/**
|
|
@@ -3258,8 +3258,8 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3258
3258
|
}
|
|
3259
3259
|
/** Creates the Arrow Type for a Vector column with dimension `dim` */
|
|
3260
3260
|
function newVectorType(dim, innerType) {
|
|
3261
|
-
const children = new apache_arrow_1
|
|
3262
|
-
return new apache_arrow_1
|
|
3261
|
+
const children = new apache_arrow_1.Field("item", (0, sanitize_1.sanitizeType)(innerType), true);
|
|
3262
|
+
return new apache_arrow_1.FixedSizeList(dim, children);
|
|
3263
3263
|
}
|
|
3264
3264
|
/**
|
|
3265
3265
|
* Serialize an Array of records into a buffer using the Arrow IPC File serialization
|
|
@@ -3271,7 +3271,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3271
3271
|
async function fromRecordsToBuffer(data, embeddings, schema) {
|
|
3272
3272
|
if (schema !== void 0 && schema !== null) schema = (0, sanitize_1.sanitizeSchema)(schema);
|
|
3273
3273
|
const table = await convertToTable(data, embeddings, { schema });
|
|
3274
|
-
const writer = apache_arrow_1
|
|
3274
|
+
const writer = apache_arrow_1.RecordBatchFileWriter.writeAll(table);
|
|
3275
3275
|
return Buffer.from(await writer.toUint8Array());
|
|
3276
3276
|
}
|
|
3277
3277
|
/**
|
|
@@ -3284,7 +3284,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3284
3284
|
async function fromRecordsToStreamBuffer(data, embeddings, schema) {
|
|
3285
3285
|
if (schema !== void 0 && schema !== null) schema = (0, sanitize_1.sanitizeSchema)(schema);
|
|
3286
3286
|
const table = await convertToTable(data, embeddings, { schema });
|
|
3287
|
-
const writer = apache_arrow_1
|
|
3287
|
+
const writer = apache_arrow_1.RecordBatchStreamWriter.writeAll(table);
|
|
3288
3288
|
return Buffer.from(await writer.toUint8Array());
|
|
3289
3289
|
}
|
|
3290
3290
|
/**
|
|
@@ -3299,7 +3299,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3299
3299
|
if (schema !== void 0 && schema !== null) schema = (0, sanitize_1.sanitizeSchema)(schema);
|
|
3300
3300
|
const tableWithEmbeddings = await applyEmbeddings(table, embeddings, schema);
|
|
3301
3301
|
validateBlobSchema(tableWithEmbeddings.schema);
|
|
3302
|
-
const writer = apache_arrow_1
|
|
3302
|
+
const writer = apache_arrow_1.RecordBatchFileWriter.writeAll(tableWithEmbeddings);
|
|
3303
3303
|
return Buffer.from(await writer.toUint8Array());
|
|
3304
3304
|
}
|
|
3305
3305
|
/**
|
|
@@ -3324,13 +3324,13 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3324
3324
|
* Returns null if the buffer does not contain a record batch
|
|
3325
3325
|
*/
|
|
3326
3326
|
async function fromBufferToRecordBatch(data) {
|
|
3327
|
-
return (await apache_arrow_1
|
|
3327
|
+
return (await apache_arrow_1.RecordBatchFileReader.readAll(Buffer.from(data)).next().value)?.next().value || null;
|
|
3328
3328
|
}
|
|
3329
3329
|
/**
|
|
3330
3330
|
* Create a buffer containing a single record batch
|
|
3331
3331
|
*/
|
|
3332
3332
|
async function fromRecordBatchToBuffer(batch) {
|
|
3333
|
-
const writer = new apache_arrow_1
|
|
3333
|
+
const writer = new apache_arrow_1.RecordBatchFileWriter().writeAll([batch]);
|
|
3334
3334
|
return Buffer.from(await writer.toUint8Array());
|
|
3335
3335
|
}
|
|
3336
3336
|
/**
|
|
@@ -3339,7 +3339,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3339
3339
|
* batch + EOS) suitable for incremental decode by `arrow_ipc::reader::StreamReader`.
|
|
3340
3340
|
*/
|
|
3341
3341
|
async function fromRecordBatchToStreamBuffer(batch) {
|
|
3342
|
-
const writer = apache_arrow_1
|
|
3342
|
+
const writer = apache_arrow_1.RecordBatchStreamWriter.writeAll([batch]);
|
|
3343
3343
|
return Buffer.from(await writer.toUint8Array());
|
|
3344
3344
|
}
|
|
3345
3345
|
/**
|
|
@@ -3352,7 +3352,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3352
3352
|
*/
|
|
3353
3353
|
async function fromTableToStreamBuffer(table, embeddings, schema) {
|
|
3354
3354
|
const tableWithEmbeddings = await applyEmbeddings(table, embeddings, schema);
|
|
3355
|
-
const writer = apache_arrow_1
|
|
3355
|
+
const writer = apache_arrow_1.RecordBatchStreamWriter.writeAll(tableWithEmbeddings);
|
|
3356
3356
|
return Buffer.from(await writer.toUint8Array());
|
|
3357
3357
|
}
|
|
3358
3358
|
/**
|
|
@@ -3365,26 +3365,26 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3365
3365
|
if (indexInBatch < 0) throw new Error(`The column ${field.name} was not found in the Arrow Table`);
|
|
3366
3366
|
alignedChildren.push(batch.data.children[indexInBatch]);
|
|
3367
3367
|
}
|
|
3368
|
-
const newData = (0, apache_arrow_1
|
|
3369
|
-
type: new apache_arrow_1
|
|
3368
|
+
const newData = (0, apache_arrow_1.makeData)({
|
|
3369
|
+
type: new apache_arrow_1.Struct(schema.fields),
|
|
3370
3370
|
length: batch.numRows,
|
|
3371
3371
|
nullCount: batch.nullCount,
|
|
3372
3372
|
children: alignedChildren
|
|
3373
3373
|
});
|
|
3374
|
-
return new apache_arrow_1
|
|
3374
|
+
return new apache_arrow_1.RecordBatch(schema, newData);
|
|
3375
3375
|
}
|
|
3376
3376
|
/**
|
|
3377
3377
|
* Reorder the columns in `table` so that they agree with the field order in `schema`
|
|
3378
3378
|
*/
|
|
3379
3379
|
function alignTable(table, schema) {
|
|
3380
3380
|
const alignedBatches = table.batches.map((batch) => alignBatch(batch, schema));
|
|
3381
|
-
return new apache_arrow_1
|
|
3381
|
+
return new apache_arrow_1.Table(schema, alignedBatches);
|
|
3382
3382
|
}
|
|
3383
3383
|
/**
|
|
3384
3384
|
* Create an empty table with the given schema
|
|
3385
3385
|
*/
|
|
3386
3386
|
function createEmptyTable(schema) {
|
|
3387
|
-
return new apache_arrow_1
|
|
3387
|
+
return new apache_arrow_1.Table((0, sanitize_1.sanitizeSchema)(schema));
|
|
3388
3388
|
}
|
|
3389
3389
|
function validateSchemaEmbeddings(schema, data, embeddings) {
|
|
3390
3390
|
const fields = [];
|
|
@@ -3403,7 +3403,7 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3403
3403
|
} else fields.push(field);
|
|
3404
3404
|
} else fields.push(field);
|
|
3405
3405
|
if (missingEmbeddingFields.length > 0 && embeddings === void 0) throw new Error(`Table has embeddings: "${missingEmbeddingFields.map((f) => f.name).join(",")}", but no embedding function was provided`);
|
|
3406
|
-
return new apache_arrow_1
|
|
3406
|
+
return new apache_arrow_1.Schema(fields, schema.metadata);
|
|
3407
3407
|
}
|
|
3408
3408
|
/**
|
|
3409
3409
|
* Ensures that all nested fields defined in the schema exist in the data,
|
|
@@ -3435,39 +3435,39 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3435
3435
|
}
|
|
3436
3436
|
function dataTypeToJson(dataType) {
|
|
3437
3437
|
switch (dataType.typeId) {
|
|
3438
|
-
case apache_arrow_1
|
|
3439
|
-
case apache_arrow_1
|
|
3440
|
-
case apache_arrow_1
|
|
3441
|
-
case apache_arrow_1
|
|
3442
|
-
case apache_arrow_1
|
|
3443
|
-
case apache_arrow_1
|
|
3444
|
-
case apache_arrow_1
|
|
3445
|
-
case apache_arrow_1
|
|
3446
|
-
case apache_arrow_1
|
|
3447
|
-
case apache_arrow_1
|
|
3448
|
-
case apache_arrow_1
|
|
3438
|
+
case apache_arrow_1.Type.Null: return { type: "null" };
|
|
3439
|
+
case apache_arrow_1.Type.Bool: return { type: "bool" };
|
|
3440
|
+
case apache_arrow_1.Type.Int8: return { type: "int8" };
|
|
3441
|
+
case apache_arrow_1.Type.Int16: return { type: "int16" };
|
|
3442
|
+
case apache_arrow_1.Type.Int32: return { type: "int32" };
|
|
3443
|
+
case apache_arrow_1.Type.Int64: return { type: "int64" };
|
|
3444
|
+
case apache_arrow_1.Type.Uint8: return { type: "uint8" };
|
|
3445
|
+
case apache_arrow_1.Type.Uint16: return { type: "uint16" };
|
|
3446
|
+
case apache_arrow_1.Type.Uint32: return { type: "uint32" };
|
|
3447
|
+
case apache_arrow_1.Type.Uint64: return { type: "uint64" };
|
|
3448
|
+
case apache_arrow_1.Type.Int: {
|
|
3449
3449
|
const bitWidth = dataType.bitWidth;
|
|
3450
3450
|
return { type: `${dataType.isSigned ? "" : "u"}int${bitWidth}` };
|
|
3451
3451
|
}
|
|
3452
|
-
case apache_arrow_1
|
|
3452
|
+
case apache_arrow_1.Type.Float:
|
|
3453
3453
|
switch (dataType.precision) {
|
|
3454
|
-
case apache_arrow_1
|
|
3455
|
-
case apache_arrow_1
|
|
3456
|
-
case apache_arrow_1
|
|
3454
|
+
case apache_arrow_1.Precision.HALF: return { type: "halffloat" };
|
|
3455
|
+
case apache_arrow_1.Precision.SINGLE: return { type: "float" };
|
|
3456
|
+
case apache_arrow_1.Precision.DOUBLE: return { type: "double" };
|
|
3457
3457
|
}
|
|
3458
3458
|
throw Error("Unsupported float precision");
|
|
3459
|
-
case apache_arrow_1
|
|
3460
|
-
case apache_arrow_1
|
|
3461
|
-
case apache_arrow_1
|
|
3462
|
-
case apache_arrow_1
|
|
3463
|
-
case apache_arrow_1
|
|
3464
|
-
case apache_arrow_1
|
|
3465
|
-
case apache_arrow_1
|
|
3466
|
-
case apache_arrow_1
|
|
3459
|
+
case apache_arrow_1.Type.Float16: return { type: "halffloat" };
|
|
3460
|
+
case apache_arrow_1.Type.Float32: return { type: "float" };
|
|
3461
|
+
case apache_arrow_1.Type.Float64: return { type: "double" };
|
|
3462
|
+
case apache_arrow_1.Type.Utf8: return { type: "string" };
|
|
3463
|
+
case apache_arrow_1.Type.Binary: return { type: "binary" };
|
|
3464
|
+
case apache_arrow_1.Type.LargeUtf8: return { type: "large_string" };
|
|
3465
|
+
case apache_arrow_1.Type.LargeBinary: return { type: "large_binary" };
|
|
3466
|
+
case apache_arrow_1.Type.List: return {
|
|
3467
3467
|
type: "list",
|
|
3468
3468
|
fields: [fieldToJson(dataType.children[0])]
|
|
3469
3469
|
};
|
|
3470
|
-
case apache_arrow_1
|
|
3470
|
+
case apache_arrow_1.Type.FixedSizeList: {
|
|
3471
3471
|
const fixedSizeList = dataType;
|
|
3472
3472
|
return {
|
|
3473
3473
|
type: "fixed_size_list",
|
|
@@ -3475,23 +3475,23 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3475
3475
|
length: fixedSizeList.listSize
|
|
3476
3476
|
};
|
|
3477
3477
|
}
|
|
3478
|
-
case apache_arrow_1
|
|
3478
|
+
case apache_arrow_1.Type.Struct: return {
|
|
3479
3479
|
type: "struct",
|
|
3480
3480
|
fields: dataType.children.map(fieldToJson)
|
|
3481
3481
|
};
|
|
3482
|
-
case apache_arrow_1
|
|
3483
|
-
case apache_arrow_1
|
|
3482
|
+
case apache_arrow_1.Type.Date: return { type: dataType.unit === apache_arrow_1.DateUnit.DAY ? "date32:day" : "date64:ms" };
|
|
3483
|
+
case apache_arrow_1.Type.Timestamp: {
|
|
3484
3484
|
const timestamp = dataType;
|
|
3485
3485
|
const timezone = timestamp.timezone || "-";
|
|
3486
3486
|
return { type: `timestamp:${timestamp.unit}:${timezone}` };
|
|
3487
3487
|
}
|
|
3488
|
-
case apache_arrow_1
|
|
3488
|
+
case apache_arrow_1.Type.Decimal: {
|
|
3489
3489
|
const decimal = dataType;
|
|
3490
3490
|
return { type: `decimal:${decimal.bitWidth}:${decimal.precision}:${decimal.scale}` };
|
|
3491
3491
|
}
|
|
3492
|
-
case apache_arrow_1
|
|
3493
|
-
case apache_arrow_1
|
|
3494
|
-
case apache_arrow_1
|
|
3492
|
+
case apache_arrow_1.Type.Duration: return { type: `duration:${dataType.unit}` };
|
|
3493
|
+
case apache_arrow_1.Type.FixedSizeBinary: return { type: `fixed_size_binary:${dataType.byteWidth}` };
|
|
3494
|
+
case apache_arrow_1.Type.Dictionary: {
|
|
3495
3495
|
const dict = dataType;
|
|
3496
3496
|
const indexType = dataTypeToJson(dict.indices);
|
|
3497
3497
|
return { type: `dict:${dataTypeToJson(dict.valueType).type}:${indexType.type}:false` };
|
|
@@ -3513,28 +3513,28 @@ var require_arrow = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3513
3513
|
const alignedColumns = {};
|
|
3514
3514
|
for (const field of targetSchema.fields) if (existingColumns.has(field.name)) alignedColumns[field.name] = existingColumns.get(field.name);
|
|
3515
3515
|
else alignedColumns[field.name] = createNullVector(field, table.numRows);
|
|
3516
|
-
return new apache_arrow_1
|
|
3516
|
+
return new apache_arrow_1.Table(targetSchema, alignedColumns);
|
|
3517
3517
|
}
|
|
3518
3518
|
function createNullVector(field, numRows) {
|
|
3519
3519
|
if (field.type.constructor.name === "Struct") {
|
|
3520
3520
|
const structType = field.type;
|
|
3521
3521
|
const childVectors = structType.children.map((childField) => createNullVector(childField, numRows));
|
|
3522
|
-
const structData = (0, apache_arrow_1
|
|
3522
|
+
const structData = (0, apache_arrow_1.makeData)({
|
|
3523
3523
|
type: structType,
|
|
3524
3524
|
length: numRows,
|
|
3525
3525
|
nullCount: 0,
|
|
3526
3526
|
children: childVectors.map((v) => v.data[0])
|
|
3527
3527
|
});
|
|
3528
|
-
return (0, apache_arrow_1
|
|
3528
|
+
return (0, apache_arrow_1.makeVector)(structData);
|
|
3529
3529
|
} else {
|
|
3530
3530
|
const nullBitmap = new Uint8Array(Math.ceil(numRows / 8));
|
|
3531
|
-
const data = (0, apache_arrow_1
|
|
3531
|
+
const data = (0, apache_arrow_1.makeData)({
|
|
3532
3532
|
type: field.type,
|
|
3533
3533
|
length: numRows,
|
|
3534
3534
|
nullCount: numRows,
|
|
3535
3535
|
nullBitmap
|
|
3536
3536
|
});
|
|
3537
|
-
return (0, apache_arrow_1
|
|
3537
|
+
return (0, apache_arrow_1.makeVector)(data);
|
|
3538
3538
|
}
|
|
3539
3539
|
}
|
|
3540
3540
|
}));
|
|
@@ -8210,8 +8210,8 @@ var require_rrf = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8210
8210
|
}));
|
|
8211
8211
|
//#endregion
|
|
8212
8212
|
//#region node_modules/.pnpm/@lancedb+lancedb@0.39.0_@types+node@26.6.4_apache-arrow@21.2.0/node_modules/@lancedb/lancedb/dist/rerankers/index.js
|
|
8213
|
-
var require_rerankers = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8214
|
-
var __createBinding =
|
|
8213
|
+
var require_rerankers = /* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
|
|
8214
|
+
var __createBinding = this$1 && this$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
8215
8215
|
if (k2 === void 0) k2 = k;
|
|
8216
8216
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8217
8217
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
@@ -8225,8 +8225,8 @@ var require_rerankers = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8225
8225
|
if (k2 === void 0) k2 = k;
|
|
8226
8226
|
o[k2] = m[k];
|
|
8227
8227
|
}));
|
|
8228
|
-
var __exportStar =
|
|
8229
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports
|
|
8228
|
+
var __exportStar = this$1 && this$1.__exportStar || function(m, exports) {
|
|
8229
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
8230
8230
|
};
|
|
8231
8231
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8232
8232
|
__exportStar(require_rrf(), exports);
|
|
@@ -14,7 +14,7 @@ var __esmMin = (fn, res, err) => () => {
|
|
|
14
14
|
throw err = [e], e;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
17
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
18
18
|
var __exportAll = (all, no_symbols) => {
|
|
19
19
|
let target = {};
|
|
20
20
|
for (var name in all) __defProp(target, name, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as __toESM } from "./.setup/rolldown-runtime-
|
|
1
|
+
import { o as __toESM } from "./.setup/rolldown-runtime-1p2KPIdQ.mjs";
|
|
2
2
|
import { resolveEnvVars } from "./config.js";
|
|
3
3
|
import { MEMORY_AGENT_ID_COLUMN, MEMORY_TABLE_NAME, hasAgentScopeColumn, memoryAgentPredicate, quoteLanceSqlString } from "./lancedb-schema.js";
|
|
4
4
|
import { resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
@@ -79,7 +79,7 @@ async function openMemoryTable(params) {
|
|
|
79
79
|
table: null,
|
|
80
80
|
dbPath
|
|
81
81
|
};
|
|
82
|
-
const lancedb = await import("./.setup/dist-
|
|
82
|
+
const lancedb = await import("./.setup/dist-B7Z5O05L.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
83
83
|
const storageOptions = resolveStorageOptions(params.config, params.env);
|
|
84
84
|
const connection = await lancedb.connect(dbPath, storageOptions ? { storageOptions } : {});
|
|
85
85
|
try {
|
package/dist/lancedb-runtime.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { o as __toESM } from "./.setup/rolldown-runtime-
|
|
1
|
+
import { o as __toESM } from "./.setup/rolldown-runtime-1p2KPIdQ.mjs";
|
|
2
2
|
//#region extensions/memory-lancedb/lancedb-runtime.ts
|
|
3
3
|
const platform = process.platform;
|
|
4
4
|
const arch = process.arch;
|
|
5
5
|
let loadPromise = null;
|
|
6
6
|
async function loadLanceDbModule() {
|
|
7
|
-
if (!loadPromise) loadPromise = import("./.setup/dist-
|
|
7
|
+
if (!loadPromise) loadPromise = import("./.setup/dist-B7Z5O05L.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1)).catch((error) => {
|
|
8
8
|
loadPromise = null;
|
|
9
9
|
if (platform === "darwin" && arch === "x64") throw new Error(`memory-lancedb: LanceDB runtime is unavailable on ${platform}-${arch}. The bundled @lancedb/lancedb dependency does not publish a native package for this platform. Disable memory-lancedb or switch to a supported memory backend/platform.`, { cause: error });
|
|
10
10
|
throw new Error(`memory-lancedb: bundled @lancedb/lancedb dependency is unavailable. Install or repair the memory-lancedb plugin package dependencies, then restart OpenClaw. ${String(error)}`, { cause: error });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/memory-lancedb",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.7",
|
|
4
4
|
"description": "OpenClaw LanceDB-backed long-term memory plugin with auto-recall, auto-capture, and vector search.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"minHostVersion": ">=2026.5.31"
|
|
37
37
|
},
|
|
38
38
|
"compat": {
|
|
39
|
-
"pluginApi": ">=2026.10.
|
|
39
|
+
"pluginApi": ">=2026.10.7"
|
|
40
40
|
},
|
|
41
41
|
"build": {
|
|
42
|
-
"openclawVersion": "2026.10.
|
|
42
|
+
"openclawVersion": "2026.10.7",
|
|
43
43
|
"workerEntries": [
|
|
44
44
|
"./lancedb-runtime.ts"
|
|
45
45
|
]
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"assets/activity/*.svg"
|
|
63
63
|
],
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"openclaw": ">=2026.10.
|
|
65
|
+
"openclaw": ">=2026.10.7"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"openclaw": {
|