sensemaking 0.28.1 → 0.28.2
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/cjs/chunk/group.js +1 -1
- package/dist/cjs/cli/path.js +1 -1
- package/dist/cjs/cli/peek.js +1 -1
- package/dist/cjs/cli/related.js +1 -1
- package/dist/cjs/cli/search.js +1 -1
- package/dist/cjs/cli/shared.js +1 -1
- package/dist/cjs/cli/sql.js +1 -1
- package/dist/cjs/cli/status.js +1 -1
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/commands/map.js +1 -1
- package/dist/cjs/commands/peek.js +1 -1
- package/dist/cjs/commands/related.js +1 -1
- package/dist/cjs/commands/scope.js +1 -1
- package/dist/cjs/commands/search.js +1 -1
- package/dist/cjs/commands/signals.js +1 -1
- package/dist/cjs/config/access.js +1 -1
- package/dist/cjs/config/load.js +1 -1
- package/dist/cjs/config/validate.js +1 -1
- package/dist/cjs/embed/identity.js +1 -1
- package/dist/cjs/embed/langfit.js +1 -1
- package/dist/cjs/embed/openai.js +1 -1
- package/dist/cjs/embed/query.js +1 -1
- package/dist/cjs/embed/static.js +1 -1
- package/dist/cjs/embed/store.d.cts +1 -1
- package/dist/cjs/embed/store.d.ts +1 -1
- package/dist/cjs/embed/store.js +154 -31
- package/dist/cjs/embed/store.js.map +1 -1
- package/dist/cjs/features/links.js +1 -1
- package/dist/cjs/features/rank.js +1 -1
- package/dist/cjs/features/tags.js +1 -1
- package/dist/cjs/graph/graph.js +1 -1
- package/dist/cjs/graph/traverse.js +1 -1
- package/dist/cjs/output/column-hint.js +1 -1
- package/dist/cjs/output/output.js +1 -1
- package/dist/cjs/scan/frontmatter.js +1 -1
- package/dist/cjs/scan/list.js +1 -1
- package/dist/cjs/scan/pool.js +1 -1
- package/dist/cjs/scan/reparse.js +1 -1
- package/dist/cjs/store/batch.js +1 -1
- package/dist/cjs/store/builder.js +1 -1
- package/dist/cjs/store/duckdb/batch.js +1 -1
- package/dist/cjs/store/duckdb/connection.js +1 -1
- package/dist/cjs/store/duckdb/fieldStats.js +1 -1
- package/dist/cjs/store/duckdb/lexical.js +1 -1
- package/dist/cjs/store/duckdb/reconcile.js +1 -1
- package/dist/cjs/store/duckdb/store.js +1 -1
- package/dist/cjs/store/duckdb/vectors.js +1 -1
- package/dist/cjs/store/embed-scope.js +1 -1
- package/dist/cjs/store/feature-scope.js +1 -1
- package/dist/cjs/store/native.js +1 -1
- package/dist/cjs/store/open.js +1 -1
- package/dist/cjs/store/preset-scope.js +1 -1
- package/dist/cjs/store/reconcile.js +1 -1
- package/dist/cjs/store/signature.js +1 -1
- package/dist/cjs/store/sqlite/connection.js +1 -1
- package/dist/cjs/store/sqlite/fieldStats.js +1 -1
- package/dist/cjs/store/sqlite/store.js +1 -1
- package/dist/cjs/store/sqlite/vectors.js +1 -1
- package/dist/cjs/store/stages.js +1 -1
- package/dist/cjs/store/turso/connection.js +1 -1
- package/dist/cjs/store/turso/fieldStats.js +1 -1
- package/dist/cjs/store/turso/lexical.js +1 -1
- package/dist/cjs/store/turso/open.js +1 -1
- package/dist/cjs/store/turso/store.js +1 -1
- package/dist/cjs/store/turso/vectors.js +1 -1
- package/dist/esm/embed/store.d.ts +1 -1
- package/dist/esm/embed/store.js +77 -8
- package/dist/esm/embed/store.js.map +1 -1
- package/package.json +3 -2
|
@@ -261,7 +261,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
261
261
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
262
262
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
263
263
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
264
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
264
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
265
265
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
266
266
|
}
|
|
267
267
|
// links(src, target, target_base, dst, embed): target as written, target_base its indexed baseKey, dst the resolved path or NULL (a queryable dead link).
|
|
@@ -192,7 +192,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
192
192
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
193
193
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
194
194
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
195
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
195
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
196
196
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
197
197
|
}
|
|
198
198
|
var rank = {
|
|
@@ -159,7 +159,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
159
159
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
160
160
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
161
161
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
162
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
162
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
163
163
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
164
164
|
}
|
|
165
165
|
// tags(path, tag): Obsidian's file.tags grain -- frontmatter list/string tags plus inline
|
package/dist/cjs/graph/graph.js
CHANGED
|
@@ -74,7 +74,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
74
74
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
75
75
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
76
76
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
77
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
77
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
78
78
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
79
79
|
}
|
|
80
80
|
function pagerank(nodes, edges) {
|
|
@@ -168,7 +168,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
168
168
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
169
169
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
170
170
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
171
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
171
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
172
172
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
173
173
|
}
|
|
174
174
|
function resetVisited(store) {
|
|
@@ -32,7 +32,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
32
32
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
33
33
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
34
34
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
35
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
35
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
36
36
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
37
37
|
}
|
|
38
38
|
// A frontmatter key with punctuation (`plugin-id`, `a.b`) is a real column, but unquoted in SQL
|
|
@@ -272,7 +272,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
272
272
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
273
273
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
274
274
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
275
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
275
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
276
276
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
277
277
|
}
|
|
278
278
|
// Warned about on stderr (keeps --format json stdout machine-readable), never truncated.
|
|
@@ -82,7 +82,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
82
82
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
83
83
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
84
84
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
85
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
85
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
86
86
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
87
87
|
}
|
|
88
88
|
var RESERVED_COLUMNS = new Set([
|
package/dist/cjs/scan/list.js
CHANGED
|
@@ -43,7 +43,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
43
43
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
44
44
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
45
45
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
46
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
46
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
47
47
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
48
48
|
}
|
|
49
49
|
function toPosixPath(relPath) {
|
package/dist/cjs/scan/pool.js
CHANGED
|
@@ -164,7 +164,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
164
164
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
165
165
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
166
166
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
167
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
167
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
168
168
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
169
169
|
}
|
|
170
170
|
// Tinypool is ESM-only; our floor (>=22.20) has native require(esm), so the tier-2 house deferral reaches it.
|
package/dist/cjs/scan/reparse.js
CHANGED
|
@@ -171,7 +171,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
171
171
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
172
172
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
173
173
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
174
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
174
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
175
175
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
176
176
|
}
|
|
177
177
|
var PARSE_BYTES_PER_WORKER = 512 * 1024;
|
package/dist/cjs/store/batch.js
CHANGED
|
@@ -51,7 +51,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
51
51
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
52
52
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
53
53
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
54
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
54
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
55
55
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
56
56
|
}
|
|
57
57
|
// Rewrites a single-row parameterized INSERT into one multi-row statement. Engine-neutral string
|
|
@@ -272,7 +272,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
272
272
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
273
273
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
274
274
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
275
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
275
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
276
276
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
277
277
|
}
|
|
278
278
|
function _wrap_native_super(Class) {
|
|
@@ -80,7 +80,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
80
80
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
81
81
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
82
82
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
83
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
83
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
84
84
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
85
85
|
}
|
|
86
86
|
var UPDATE_RE = RegExp("^UPDATE\\s+(\\S+)\\s+SET\\s+(.+?)\\s+WHERE\\s+(.+)$", "is");
|
|
@@ -402,7 +402,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
402
402
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
403
403
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
404
404
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
405
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
405
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
406
406
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
407
407
|
}
|
|
408
408
|
function _wrap_async_generator(fn) {
|
|
@@ -191,7 +191,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
191
191
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
192
192
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
193
193
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
194
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
194
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
195
195
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
196
196
|
}
|
|
197
197
|
// DuckDB's frontmatter columns are VARIANT (reconcile.ts), so typeof() always reports VARIANT; variant_typeof() reports the boxed native
|
|
@@ -188,7 +188,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
188
188
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
189
189
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
190
190
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
191
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
191
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
192
192
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
193
193
|
}
|
|
194
194
|
var FIELDS = [
|
|
@@ -191,7 +191,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
191
191
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
192
192
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
193
193
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
194
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
194
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
195
195
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
196
196
|
}
|
|
197
197
|
// This store's dialect (types.ts's ReconcileDialect) for the shared orchestration in
|
|
@@ -254,7 +254,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
254
254
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
255
255
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
256
256
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
257
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
257
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
258
258
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
259
259
|
}
|
|
260
260
|
function _wrap_async_generator(fn) {
|
|
@@ -174,7 +174,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
174
174
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
175
175
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
176
176
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
177
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
177
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
178
178
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
179
179
|
}
|
|
180
180
|
// This store keeps vectors as native FLOAT[dims] arrays (dims fixed at DDL time by open.ts's ensureSchema, from embed/types.ts's STORE_DIMS) and
|
|
@@ -53,7 +53,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
53
53
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
54
54
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
55
55
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
56
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
56
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
57
57
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
58
58
|
}
|
|
59
59
|
// One embed segment's provider/model/endpoint/chunkVersion, ignoring any trailing `@identity`.
|
|
@@ -43,7 +43,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
43
43
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
44
44
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
45
45
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
46
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
46
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
47
47
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
48
48
|
}
|
|
49
49
|
var NARROW_FEATURE_TABLE = {
|
package/dist/cjs/store/native.js
CHANGED
|
@@ -209,7 +209,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
209
209
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
210
210
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
211
211
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
212
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
212
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
213
213
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
214
214
|
}
|
|
215
215
|
// install-module-linked is small, but a target native package can be large (@duckdb/node-api's
|
package/dist/cjs/store/open.js
CHANGED
|
@@ -185,7 +185,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
185
185
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
186
186
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
187
187
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
188
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
188
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
189
189
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
190
190
|
}
|
|
191
191
|
var LOCK_POLL_MS = 50;
|
|
@@ -124,7 +124,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
124
124
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
125
125
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
126
126
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
127
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
127
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
128
128
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
129
129
|
}
|
|
130
130
|
function isPresetOnlyChange(changedKeys) {
|
|
@@ -202,7 +202,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
202
202
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
203
203
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
204
204
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
205
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
205
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
206
206
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
207
207
|
}
|
|
208
208
|
var CORE_FRONTMATTER_COLUMNS = new Set([
|
|
@@ -85,7 +85,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
85
85
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
86
86
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
87
87
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
88
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
88
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
89
89
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
90
90
|
}
|
|
91
91
|
function changedSignatureKeys(before, after) {
|
|
@@ -342,7 +342,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
342
342
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
343
343
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
344
344
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
345
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
345
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
346
346
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
347
347
|
}
|
|
348
348
|
function _wrap_async_generator(fn) {
|
|
@@ -158,7 +158,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
158
158
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
159
159
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
160
160
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
161
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
161
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
162
162
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
163
163
|
}
|
|
164
164
|
function fieldStats(conn, columns, scopeWhere) {
|
|
@@ -352,7 +352,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
352
352
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
353
353
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
354
354
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
355
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
355
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
356
356
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
357
357
|
}
|
|
358
358
|
function _wrap_async_generator(fn) {
|
|
@@ -228,7 +228,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
228
228
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
229
229
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
230
230
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
231
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
231
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
232
232
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
233
233
|
}
|
|
234
234
|
function writeVectorBatch(conn, rows) {
|
package/dist/cjs/store/stages.js
CHANGED
|
@@ -198,7 +198,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
198
198
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
199
199
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
200
200
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
201
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
201
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
202
202
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
203
203
|
}
|
|
204
204
|
var STAGES_VERSION = 's1';
|
|
@@ -420,7 +420,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
420
420
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
421
421
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
422
422
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
423
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
423
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
424
424
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
425
425
|
}
|
|
426
426
|
function _wrap_async_generator(fn) {
|
|
@@ -158,7 +158,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
158
158
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
159
159
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
160
160
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
161
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
161
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
162
162
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
163
163
|
}
|
|
164
164
|
function fieldStats(conn, columns, scopeWhere) {
|
|
@@ -163,7 +163,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
163
163
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
164
164
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
165
165
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
166
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
166
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
167
167
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
168
168
|
}
|
|
169
169
|
var FIELDS = [
|
|
@@ -239,7 +239,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
239
239
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
240
240
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
241
241
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
242
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
242
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
243
243
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
244
244
|
}
|
|
245
245
|
var DB_FILENAME = 'cache.turso.db';
|
|
@@ -354,7 +354,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
354
354
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
355
355
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
356
356
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
357
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
357
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
358
358
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
359
359
|
}
|
|
360
360
|
function _wrap_async_generator(fn) {
|
|
@@ -228,7 +228,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
228
228
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
229
229
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
230
230
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
231
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
231
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
232
232
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
233
233
|
}
|
|
234
234
|
// Native F32_BLOB(dims) columns, dims fixed at DDL time (open.ts, STORE_DIMS). Both scans
|
|
@@ -4,5 +4,5 @@ export { hasModelFiles, isDownloadable, MODEL_FILENAMES, MODEL_FILES, modelDir,
|
|
|
4
4
|
export declare function modelPresent(cfg: Config): boolean;
|
|
5
5
|
type ResolvedEmbedConfig = NonNullable<ReturnType<typeof embedConfig>>;
|
|
6
6
|
export declare function localModelMissing(e: ResolvedEmbedConfig | null): e is ResolvedEmbedConfig;
|
|
7
|
-
export declare function downloadModelRevision(model: string, sha: string, onFile?: (file: string, dir: string) => void, root?: string): Promise<string>;
|
|
7
|
+
export declare function downloadModelRevision(model: string, sha: string, onFile?: (file: string, dir: string) => void, root?: string, hub?: string): Promise<string>;
|
|
8
8
|
export declare function downloadModel(model: string, onFile?: (file: string, dir: string) => void, root?: string): Promise<string>;
|
package/dist/esm/embed/store.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
1
2
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
2
3
|
import { join } from 'node:path';
|
|
3
4
|
import { embedConfig } from '../config/index.js';
|
|
@@ -6,6 +7,8 @@ import { writeFileAtomic } from '../lib/atomic-write.js';
|
|
|
6
7
|
import { fetchWithRetry, HTTP_ATTEMPT_TIMEOUT_MS, MODEL_FILE_ATTEMPT_TIMEOUT_MS } from './http.js';
|
|
7
8
|
import { DEFAULT_MODELS_ROOT, hasModelFiles, isDownloadable, languagesPath, MODEL_FILES, readRef, snapshotDir, writeLanguages, writeRef } from './identity.js';
|
|
8
9
|
import { isKnownLanguageTag, MEASURED_MODEL_LANGUAGES } from './languages.js';
|
|
10
|
+
// The Hub base for every request here; downloadModelRevision takes it as a parameter so a test can point it at a local server.
|
|
11
|
+
const HF_HUB = 'https://huggingface.co';
|
|
9
12
|
// identity.ts holds paths and cache identity, no network; store.ts holds the network fetches
|
|
10
13
|
// (downloads, sha resolution, language metadata), re-exported here for its network surface.
|
|
11
14
|
export { hasModelFiles, isDownloadable, MODEL_FILENAMES, MODEL_FILES, modelDir, readLanguages, refsMainPath, snapshotDir, writeLanguages, writeRef } from './identity.js';
|
|
@@ -26,7 +29,7 @@ export function localModelMissing(e) {
|
|
|
26
29
|
async function resolveSha(model, root = DEFAULT_MODELS_ROOT) {
|
|
27
30
|
const existing = readRef(model, root);
|
|
28
31
|
if (existing) return existing;
|
|
29
|
-
const url =
|
|
32
|
+
const url = `${HF_HUB}/${model}/resolve/main/model.safetensors`;
|
|
30
33
|
// redirect: manual -- the header rides the Hub's own response; following the LFS/CDN
|
|
31
34
|
// redirect would read the CDN's headers instead, which do not carry it.
|
|
32
35
|
const res = await fetchWithRetry(url, {
|
|
@@ -80,7 +83,7 @@ async function ensureLanguages(model, root = DEFAULT_MODELS_ROOT) {
|
|
|
80
83
|
}
|
|
81
84
|
let res;
|
|
82
85
|
try {
|
|
83
|
-
res = await fetchWithRetry(
|
|
86
|
+
res = await fetchWithRetry(`${HF_HUB}/api/models/${model}`, {}, {
|
|
84
87
|
attemptTimeoutMs: HTTP_ATTEMPT_TIMEOUT_MS
|
|
85
88
|
});
|
|
86
89
|
} catch {
|
|
@@ -102,24 +105,90 @@ async function ensureLanguages(model, root = DEFAULT_MODELS_ROOT) {
|
|
|
102
105
|
}
|
|
103
106
|
writeLanguages(model, (_languagesFromCard = languagesFromCard(info)) !== null && _languagesFromCard !== void 0 ? _languagesFromCard : [], root);
|
|
104
107
|
}
|
|
105
|
-
|
|
108
|
+
function isHfTreeEntry(value) {
|
|
109
|
+
if (value === null || typeof value !== 'object') return false;
|
|
110
|
+
if (!('path' in value) || typeof value.path !== 'string') return false;
|
|
111
|
+
if (!('oid' in value) || typeof value.oid !== 'string') return false;
|
|
112
|
+
if (!('size' in value) || typeof value.size !== 'number') return false;
|
|
113
|
+
if (!('lfs' in value) || value.lfs === undefined) return true;
|
|
114
|
+
if (value.lfs === null || typeof value.lfs !== 'object') return false;
|
|
115
|
+
return 'oid' in value.lfs && typeof value.lfs.oid === 'string' && 'size' in value.lfs && typeof value.lfs.size === 'number';
|
|
116
|
+
}
|
|
117
|
+
function isHfTree(value) {
|
|
118
|
+
return Array.isArray(value) && value.every(isHfTreeEntry);
|
|
119
|
+
}
|
|
120
|
+
function unverifiable(model, sha, detail) {
|
|
121
|
+
return new SenseError('EMBED_MODEL', `could not get the Hub's published hashes for ${model}@${sha.slice(0, 8)}: ${detail}; no model file was written. Retry \`sense download\`; if it repeats, something between this machine and Hugging Face is changing the response`);
|
|
122
|
+
}
|
|
123
|
+
async function fetchExpected(model, sha, files, hub) {
|
|
124
|
+
const url = `${hub}/api/models/${model}/tree/${sha}`;
|
|
125
|
+
let res;
|
|
126
|
+
try {
|
|
127
|
+
res = await fetchWithRetry(url, {}, {
|
|
128
|
+
attemptTimeoutMs: HTTP_ATTEMPT_TIMEOUT_MS
|
|
129
|
+
});
|
|
130
|
+
} catch (err) {
|
|
131
|
+
throw unverifiable(model, sha, `${url} failed (${err.message})`);
|
|
132
|
+
}
|
|
133
|
+
if (res.status !== 200) throw unverifiable(model, sha, `${url} -> HTTP ${res.status}`);
|
|
134
|
+
let tree;
|
|
135
|
+
try {
|
|
136
|
+
tree = JSON.parse(new TextDecoder().decode(res.body));
|
|
137
|
+
} catch {
|
|
138
|
+
throw unverifiable(model, sha, `${url} did not return JSON`);
|
|
139
|
+
}
|
|
140
|
+
if (!isHfTree(tree)) throw unverifiable(model, sha, `${url} returned an unrecognized tree`);
|
|
141
|
+
const expected = new Map();
|
|
142
|
+
for (const file of files){
|
|
143
|
+
const entry = tree.find((e)=>e.path === file);
|
|
144
|
+
if (!entry) throw unverifiable(model, sha, `the tree has no entry for ${file}`);
|
|
145
|
+
expected.set(file, entry.lfs ? {
|
|
146
|
+
kind: 'sha256',
|
|
147
|
+
hash: entry.lfs.oid,
|
|
148
|
+
size: entry.lfs.size
|
|
149
|
+
} : {
|
|
150
|
+
kind: 'git-sha1',
|
|
151
|
+
hash: entry.oid,
|
|
152
|
+
size: entry.size
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return expected;
|
|
156
|
+
}
|
|
157
|
+
// git blob id: sha1 over "blob <size>\0" then the bytes.
|
|
158
|
+
function digest(kind, bytes) {
|
|
159
|
+
if (kind === 'sha256') return createHash('sha256').update(bytes).digest('hex');
|
|
160
|
+
return createHash('sha1').update(`blob ${bytes.byteLength}\0`).update(bytes).digest('hex');
|
|
161
|
+
}
|
|
162
|
+
async function fetchToFile(url, dest, expected, label) {
|
|
106
163
|
const res = await fetchWithRetry(url, {}, {
|
|
107
164
|
attemptTimeoutMs: MODEL_FILE_ATTEMPT_TIMEOUT_MS
|
|
108
165
|
});
|
|
109
166
|
if (!res.ok) throw new SenseError('EMBED_MODEL', `${res.url} -> HTTP ${res.status}`);
|
|
110
|
-
|
|
167
|
+
const bytes = Buffer.from(res.body);
|
|
168
|
+
const mismatch = (actual)=>new SenseError('EMBED_MODEL', `${label} does not match the Hub's published ${expected.kind}: expected ${expected.hash.slice(0, 12)} (${expected.size} bytes), got ${actual}; ${label} was not written. Retry \`sense download\`; if it repeats, something between this machine and Hugging Face is changing the file`);
|
|
169
|
+
if (bytes.byteLength !== expected.size) throw mismatch(`${bytes.byteLength} bytes`);
|
|
170
|
+
const actual = digest(expected.kind, bytes);
|
|
171
|
+
if (actual !== expected.hash) throw mismatch(`${actual.slice(0, 12)} (${bytes.byteLength} bytes)`);
|
|
172
|
+
writeFileAtomic(dest, bytes);
|
|
111
173
|
}
|
|
112
174
|
// Fetches an already-known sha straight into its snapshot dir, without touching refs/main --
|
|
113
175
|
// for downloadModel below, and for callers pinning an exact revision (the parity suite).
|
|
114
|
-
|
|
176
|
+
// Each fetched file is verified against the Hub's published hash before it is written.
|
|
177
|
+
export async function downloadModelRevision(model, sha, onFile, root = DEFAULT_MODELS_ROOT, hub = HF_HUB) {
|
|
115
178
|
const dir = snapshotDir(model, sha, root);
|
|
116
179
|
mkdirSync(dir, {
|
|
117
180
|
recursive: true
|
|
118
181
|
});
|
|
119
|
-
|
|
120
|
-
|
|
182
|
+
// Files already on disk are not re-hashed (0.3 s per open), including ones written before
|
|
183
|
+
// verification existed; removing the snapshot folder re-downloads and verifies them.
|
|
184
|
+
const missing = MODEL_FILES.filter((file)=>!existsSync(join(dir, file)));
|
|
185
|
+
if (missing.length === 0) return dir;
|
|
186
|
+
const expected = await fetchExpected(model, sha, missing, hub);
|
|
187
|
+
for (const file of missing){
|
|
188
|
+
const want = expected.get(file);
|
|
189
|
+
if (!want) throw unverifiable(model, sha, `no expected value for ${file}`);
|
|
121
190
|
onFile === null || onFile === void 0 ? void 0 : onFile(file, dir);
|
|
122
|
-
await fetchToFile(
|
|
191
|
+
await fetchToFile(`${hub}/${model}/resolve/${sha}/${file}`, join(dir, file), want, `${model}@${sha.slice(0, 8)}/${file}`);
|
|
123
192
|
}
|
|
124
193
|
return dir;
|
|
125
194
|
}
|