@nojaja/sqlite-vec1-embeddinggemma2-wasm 0.0.1-build1 → 0.0.1-build2

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.
@@ -6,7 +6,7 @@
6
6
  "format": "esm"
7
7
  },
8
8
  "src/official/options.ts": {
9
- "bytes": 4346,
9
+ "bytes": 4655,
10
10
  "imports": [
11
11
  {
12
12
  "path": "src/errors.ts",
@@ -109,7 +109,7 @@
109
109
  "format": "esm"
110
110
  },
111
111
  "src/official/registration.ts": {
112
- "bytes": 7959,
112
+ "bytes": 7474,
113
113
  "imports": [
114
114
  {
115
115
  "path": "src/errors.ts",
@@ -374,7 +374,7 @@
374
374
  "format": "esm"
375
375
  },
376
376
  "src/official/types.ts": {
377
- "bytes": 4478,
377
+ "bytes": 5763,
378
378
  "imports": [],
379
379
  "format": "esm"
380
380
  },
@@ -411,7 +411,7 @@
411
411
  "format": "esm"
412
412
  },
413
413
  "src/official/browser-inference.ts": {
414
- "bytes": 12248,
414
+ "bytes": 12512,
415
415
  "imports": [
416
416
  {
417
417
  "path": "src/errors.ts",
@@ -452,8 +452,13 @@
452
452
  "format": "esm"
453
453
  },
454
454
  "src/official/browser.ts": {
455
- "bytes": 2711,
455
+ "bytes": 7977,
456
456
  "imports": [
457
+ {
458
+ "path": "src/errors.ts",
459
+ "kind": "import-statement",
460
+ "original": "../errors"
461
+ },
457
462
  {
458
463
  "path": "src/official/initialize.ts",
459
464
  "kind": "import-statement",
@@ -478,7 +483,7 @@
478
483
  "format": "esm"
479
484
  },
480
485
  "src/index-browser.ts": {
481
- "bytes": 230,
486
+ "bytes": 300,
482
487
  "imports": [
483
488
  {
484
489
  "path": "src/official/browser.ts",
@@ -1169,6 +1174,17 @@
1169
1174
  ],
1170
1175
  "format": "esm"
1171
1176
  },
1177
+ "src/workers/db-browser.ts": {
1178
+ "bytes": 8807,
1179
+ "imports": [
1180
+ {
1181
+ "path": "src/official/browser.ts",
1182
+ "kind": "import-statement",
1183
+ "original": "../official/browser"
1184
+ }
1185
+ ],
1186
+ "format": "cjs"
1187
+ },
1172
1188
  "samples/official-scenario.ts": {
1173
1189
  "bytes": 4182,
1174
1190
  "imports": [],
@@ -1325,7 +1341,7 @@
1325
1341
  "bytesInOutput": 570
1326
1342
  },
1327
1343
  "src/official/options.ts": {
1328
- "bytesInOutput": 2286
1344
+ "bytesInOutput": 2595
1329
1345
  },
1330
1346
  "src/official/metadata.ts": {
1331
1347
  "bytesInOutput": 4841
@@ -1349,7 +1365,7 @@
1349
1365
  "bytesInOutput": 765
1350
1366
  },
1351
1367
  "src/official/registration.ts": {
1352
- "bytesInOutput": 5106
1368
+ "bytesInOutput": 4626
1353
1369
  },
1354
1370
  "src/official/initialize.ts": {
1355
1371
  "bytesInOutput": 1424
@@ -1376,7 +1392,7 @@
1376
1392
  "bytesInOutput": 3464
1377
1393
  }
1378
1394
  },
1379
- "bytes": 73683
1395
+ "bytes": 73512
1380
1396
  },
1381
1397
  "dist/node/index.js": {
1382
1398
  "imports": [
@@ -1464,7 +1480,7 @@
1464
1480
  "bytesInOutput": 570
1465
1481
  },
1466
1482
  "src/official/options.ts": {
1467
- "bytesInOutput": 2286
1483
+ "bytesInOutput": 2595
1468
1484
  },
1469
1485
  "src/official/metadata.ts": {
1470
1486
  "bytesInOutput": 4841
@@ -1488,7 +1504,7 @@
1488
1504
  "bytesInOutput": 765
1489
1505
  },
1490
1506
  "src/official/registration.ts": {
1491
- "bytesInOutput": 5106
1507
+ "bytesInOutput": 4626
1492
1508
  },
1493
1509
  "src/official/initialize.ts": {
1494
1510
  "bytesInOutput": 1424
@@ -1515,7 +1531,7 @@
1515
1531
  "bytesInOutput": 3464
1516
1532
  }
1517
1533
  },
1518
- "bytes": 73683
1534
+ "bytes": 73512
1519
1535
  },
1520
1536
  "dist/node/index.mjs": {
1521
1537
  "imports": [
@@ -1603,7 +1619,7 @@
1603
1619
  "bytesInOutput": 570
1604
1620
  },
1605
1621
  "src/official/options.ts": {
1606
- "bytesInOutput": 2286
1622
+ "bytesInOutput": 2595
1607
1623
  },
1608
1624
  "src/official/metadata.ts": {
1609
1625
  "bytesInOutput": 4841
@@ -1627,7 +1643,7 @@
1627
1643
  "bytesInOutput": 765
1628
1644
  },
1629
1645
  "src/official/registration.ts": {
1630
- "bytesInOutput": 5106
1646
+ "bytesInOutput": 4626
1631
1647
  },
1632
1648
  "src/official/initialize.ts": {
1633
1649
  "bytesInOutput": 1424
@@ -1657,13 +1673,14 @@
1657
1673
  "bytesInOutput": 32
1658
1674
  }
1659
1675
  },
1660
- "bytes": 71154
1676
+ "bytes": 70983
1661
1677
  },
1662
1678
  "dist/index-browser.mjs": {
1663
1679
  "imports": [],
1664
1680
  "exports": [
1665
1681
  "default",
1666
1682
  "resolveOfficialBrowserAssets",
1683
+ "sqlite3EmbeddingWorkerPromiser",
1667
1684
  "sqlite3Worker1Promiser"
1668
1685
  ],
1669
1686
  "entryPoint": "src/index-browser.ts",
@@ -1678,7 +1695,7 @@
1678
1695
  "bytesInOutput": 570
1679
1696
  },
1680
1697
  "src/official/options.ts": {
1681
- "bytesInOutput": 2286
1698
+ "bytesInOutput": 2595
1682
1699
  },
1683
1700
  "src/official/metadata.ts": {
1684
1701
  "bytesInOutput": 4849
@@ -1702,7 +1719,7 @@
1702
1719
  "bytesInOutput": 765
1703
1720
  },
1704
1721
  "src/official/registration.ts": {
1705
- "bytesInOutput": 5106
1722
+ "bytesInOutput": 4626
1706
1723
  },
1707
1724
  "src/official/initialize.ts": {
1708
1725
  "bytesInOutput": 1424
@@ -1720,16 +1737,16 @@
1720
1737
  "bytesInOutput": 2016
1721
1738
  },
1722
1739
  "src/official/browser-inference.ts": {
1723
- "bytesInOutput": 6377
1740
+ "bytesInOutput": 6555
1724
1741
  },
1725
1742
  "src/official/browser.ts": {
1726
- "bytesInOutput": 1058
1743
+ "bytesInOutput": 3548
1727
1744
  },
1728
1745
  "src/index-browser.ts": {
1729
1746
  "bytesInOutput": 40
1730
1747
  }
1731
1748
  },
1732
- "bytes": 649970
1749
+ "bytes": 652501
1733
1750
  },
1734
1751
  "dist/workers/inference-node.js": {
1735
1752
  "imports": [
@@ -1988,6 +2005,73 @@
1988
2005
  },
1989
2006
  "bytes": 49094
1990
2007
  },
2008
+ "dist/workers/db-browser.mjs": {
2009
+ "imports": [],
2010
+ "exports": [
2011
+ "default"
2012
+ ],
2013
+ "entryPoint": "src/workers/db-browser.ts",
2014
+ "inputs": {
2015
+ "src/errors.ts": {
2016
+ "bytesInOutput": 717
2017
+ },
2018
+ "src/official/options.ts": {
2019
+ "bytesInOutput": 2699
2020
+ },
2021
+ "src/official/metadata.ts": {
2022
+ "bytesInOutput": 5210
2023
+ },
2024
+ "src/official/vector-metadata.ts": {
2025
+ "bytesInOutput": 1387
2026
+ },
2027
+ "src/bridge/inference-health.ts": {
2028
+ "bytesInOutput": 360
2029
+ },
2030
+ "src/inference/statement-embedding-cache.ts": {
2031
+ "bytesInOutput": 6686
2032
+ },
2033
+ "src/sqlite/statement-lifecycle.ts": {
2034
+ "bytesInOutput": 9864
2035
+ },
2036
+ "src/official/lifecycle-adapter.ts": {
2037
+ "bytesInOutput": 10067
2038
+ },
2039
+ "src/official/functions.ts": {
2040
+ "bytesInOutput": 873
2041
+ },
2042
+ "src/official/registration.ts": {
2043
+ "bytesInOutput": 4873
2044
+ },
2045
+ "src/official/initialize.ts": {
2046
+ "bytesInOutput": 1560
2047
+ },
2048
+ "src/runtime-assets/browser-model.ts": {
2049
+ "bytesInOutput": 511
2050
+ },
2051
+ "src/runtime-assets/model-contract.ts": {
2052
+ "bytesInOutput": 2580
2053
+ },
2054
+ "src/bridge/protocol.ts": {
2055
+ "bytesInOutput": 3660
2056
+ },
2057
+ "src/workers/db.ts": {
2058
+ "bytesInOutput": 2192
2059
+ },
2060
+ "src/official/browser-inference.ts": {
2061
+ "bytesInOutput": 6812
2062
+ },
2063
+ "downloads/sqlite-official/sqlite3-bundler-friendly.mjs": {
2064
+ "bytesInOutput": 585891
2065
+ },
2066
+ "src/official/browser.ts": {
2067
+ "bytesInOutput": 1230
2068
+ },
2069
+ "src/workers/db-browser.ts": {
2070
+ "bytesInOutput": 4859
2071
+ }
2072
+ },
2073
+ "bytes": 654544
2074
+ },
1991
2075
  "dist/samples/node/index.js": {
1992
2076
  "imports": [
1993
2077
  {
@@ -2084,7 +2168,7 @@
2084
2168
  "bytesInOutput": 570
2085
2169
  },
2086
2170
  "src/official/options.ts": {
2087
- "bytesInOutput": 2286
2171
+ "bytesInOutput": 2595
2088
2172
  },
2089
2173
  "src/official/metadata.ts": {
2090
2174
  "bytesInOutput": 4841
@@ -2108,7 +2192,7 @@
2108
2192
  "bytesInOutput": 765
2109
2193
  },
2110
2194
  "src/official/registration.ts": {
2111
- "bytesInOutput": 5106
2195
+ "bytesInOutput": 4626
2112
2196
  },
2113
2197
  "src/official/initialize.ts": {
2114
2198
  "bytesInOutput": 1424
@@ -2141,7 +2225,7 @@
2141
2225
  "bytesInOutput": 2455
2142
2226
  }
2143
2227
  },
2144
- "bytes": 79226
2228
+ "bytes": 79055
2145
2229
  },
2146
2230
  "dist/samples/browser/index.mjs": {
2147
2231
  "imports": [],
@@ -2168,7 +2252,7 @@
2168
2252
  "bytesInOutput": 570
2169
2253
  },
2170
2254
  "src/official/options.ts": {
2171
- "bytesInOutput": 2286
2255
+ "bytesInOutput": 2595
2172
2256
  },
2173
2257
  "src/official/metadata.ts": {
2174
2258
  "bytesInOutput": 4855
@@ -2192,7 +2276,7 @@
2192
2276
  "bytesInOutput": 765
2193
2277
  },
2194
2278
  "src/official/registration.ts": {
2195
- "bytesInOutput": 5106
2279
+ "bytesInOutput": 4626
2196
2280
  },
2197
2281
  "src/official/initialize.ts": {
2198
2282
  "bytesInOutput": 1424
@@ -2210,10 +2294,10 @@
2210
2294
  "bytesInOutput": 2016
2211
2295
  },
2212
2296
  "src/official/browser-inference.ts": {
2213
- "bytesInOutput": 6377
2297
+ "bytesInOutput": 6555
2214
2298
  },
2215
2299
  "src/official/browser.ts": {
2216
- "bytesInOutput": 771
2300
+ "bytesInOutput": 1033
2217
2301
  },
2218
2302
  "src/index-browser.ts": {
2219
2303
  "bytesInOutput": 40
@@ -2222,7 +2306,7 @@
2222
2306
  "bytesInOutput": 617
2223
2307
  }
2224
2308
  },
2225
- "bytes": 644210
2309
+ "bytes": 644479
2226
2310
  },
2227
2311
  "dist/samples/browser/server.js": {
2228
2312
  "imports": [
@@ -56,7 +56,7 @@
56
56
  "hashes": [
57
57
  {
58
58
  "alg": "SHA-256",
59
- "content": "7a73b20f03ae0a39c77d4eac120d24c963395334112f3c275f2b185e4a1cf673"
59
+ "content": "08dfe1ad20e10639575dd2c8a2aa08059894c8c95648c6ebdd90e05df61ec753"
60
60
  }
61
61
  ]
62
62
  },
@@ -66,7 +66,7 @@
66
66
  "hashes": [
67
67
  {
68
68
  "alg": "SHA-256",
69
- "content": "b0a256871c295ed7bf177fcff2de562bc9d3c05b08a42314f87ebb34eba2b964"
69
+ "content": "e904227f816f5e205f5c1bef7d75c3168e1b6a6f1d675d0116180f9819458443"
70
70
  }
71
71
  ]
72
72
  },
@@ -96,7 +96,7 @@
96
96
  "hashes": [
97
97
  {
98
98
  "alg": "SHA-256",
99
- "content": "b0a256871c295ed7bf177fcff2de562bc9d3c05b08a42314f87ebb34eba2b964"
99
+ "content": "e904227f816f5e205f5c1bef7d75c3168e1b6a6f1d675d0116180f9819458443"
100
100
  }
101
101
  ]
102
102
  },
@@ -106,7 +106,7 @@
106
106
  "hashes": [
107
107
  {
108
108
  "alg": "SHA-256",
109
- "content": "f4d47f9e315f0d62b59203a20519514d5c95aec4c422358a63ff137b11ed9946"
109
+ "content": "bf7b822a047c9c71e83771386475426d29a52aef117f0ed3f0316f75ad2aef99"
110
110
  }
111
111
  ]
112
112
  },
@@ -116,7 +116,7 @@
116
116
  "hashes": [
117
117
  {
118
118
  "alg": "SHA-256",
119
- "content": "d015967df285db23879216893582b1499fd57396d6479c510bfeab637bd553fc"
119
+ "content": "b10fff6173596a27fffa73696c164ae26b1e7922fe5f047e78eb7a914929950e"
120
120
  }
121
121
  ]
122
122
  },
@@ -166,7 +166,7 @@
166
166
  "hashes": [
167
167
  {
168
168
  "alg": "SHA-256",
169
- "content": "6f816052aacf81cf7f191cbdf87bf8837e322b6a5287cac692a87f4ab33cb259"
169
+ "content": "dae7983b8051a9d448ce70c5d111f20d496fef37a921e16b6b0b52fd35277de5"
170
170
  }
171
171
  ]
172
172
  },
@@ -176,7 +176,7 @@
176
176
  "hashes": [
177
177
  {
178
178
  "alg": "SHA-256",
179
- "content": "01c37b400dec76aec054c2a639be013942784f09bf2afec640021bb4a50dad31"
179
+ "content": "bedef617c96b57d231dbcb5aa840f744f7414b7fb9724b633a12a19fd6978fb4"
180
180
  }
181
181
  ]
182
182
  },
@@ -186,7 +186,7 @@
186
186
  "hashes": [
187
187
  {
188
188
  "alg": "SHA-256",
189
- "content": "b95da98d9110a82df4d19a2e78cf057d49ae0d9f06da25c51e0812f803fb8eaf"
189
+ "content": "fc3bb1c5dff315af2dc96e61edd33945a526d61c4bbdae350cc0cc7fcc9b77b9"
190
190
  }
191
191
  ]
192
192
  },
@@ -216,7 +216,7 @@
216
216
  "hashes": [
217
217
  {
218
218
  "alg": "SHA-256",
219
- "content": "cd8a9a2ccfa56fe750cb2320ec541e7d99f532e74d4caf549e0a32b1f7c795f6"
219
+ "content": "7f7151f38f960e32ce98bff38284001c4985d4bab9c76ffa9a70550c0b3902ab"
220
220
  }
221
221
  ]
222
222
  },
@@ -236,7 +236,7 @@
236
236
  "hashes": [
237
237
  {
238
238
  "alg": "SHA-256",
239
- "content": "d18aefd9f25c2228aacbb55e3c34d30406ed2b5a2fdb388b450994f08327b757"
239
+ "content": "3c3b5baf5b677fcdb687c805d842bbafd6b7072121d990ecf30ea1dc4e4fbc7a"
240
240
  }
241
241
  ]
242
242
  },
@@ -350,6 +350,16 @@
350
350
  }
351
351
  ]
352
352
  },
353
+ {
354
+ "name": "dist/workers/db-browser.mjs",
355
+ "type": "file",
356
+ "hashes": [
357
+ {
358
+ "alg": "SHA-256",
359
+ "content": "0c8f4bc937fa68527324a6ba6ec0cc80834394688920612f2d8108de49e83273"
360
+ }
361
+ ]
362
+ },
353
363
  {
354
364
  "name": "dist/workers/inference-browser.mjs",
355
365
  "type": "file",
@@ -14605,6 +14605,12 @@ function validateEmbeddingOptions(options, env) {
14605
14605
  }
14606
14606
  }
14607
14607
  } else if (env.runtime === "browser") {
14608
+ if (!env.worker) {
14609
+ console.warn(
14610
+ "SQLite synchronous embedding UDFs require Atomics.wait and cannot run on the browser main thread. Run initialize({ embedding }) inside a Dedicated Worker or use sqlite3EmbeddingWorkerPromiser()."
14611
+ );
14612
+ throw new VectorError("E_ENVIRONMENT");
14613
+ }
14608
14614
  if (backend === "directml") {
14609
14615
  throw new VectorError("E_ENVIRONMENT");
14610
14616
  }
@@ -15564,15 +15570,11 @@ function registerEmbeddingExtension(sqlite3, infer, options) {
15564
15570
  }
15565
15571
  return doInfer(req);
15566
15572
  };
15573
+ if (!infer) {
15574
+ return;
15575
+ }
15567
15576
  const embeddingFunc = (_ctx, ...args) => {
15568
- try {
15569
- return embeddingSqlValue("embedding", args, infer ? inferWrapper : void 0);
15570
- } catch (err) {
15571
- if (!infer && err instanceof VectorError && err.code === "E_EMBEDDING_NOT_READY") {
15572
- console.warn("Embedding error: E_EMBEDDING_NOT_READY");
15573
- }
15574
- throw err;
15575
- }
15577
+ return embeddingSqlValue("embedding", args, inferWrapper);
15576
15578
  };
15577
15579
  db.createFunction({
15578
15580
  name: "embedding",
@@ -15587,14 +15589,7 @@ function registerEmbeddingExtension(sqlite3, infer, options) {
15587
15589
  xFunc: embeddingFunc
15588
15590
  });
15589
15591
  const embeddingQueryFunc = (_ctx, ...args) => {
15590
- try {
15591
- return embeddingSqlValue("embedding_query", args, infer ? inferWrapper : void 0);
15592
- } catch (err) {
15593
- if (!infer && err instanceof VectorError && err.code === "E_EMBEDDING_NOT_READY") {
15594
- console.warn("Embedding error: E_EMBEDDING_NOT_READY");
15595
- }
15596
- throw err;
15597
- }
15592
+ return embeddingSqlValue("embedding_query", args, inferWrapper);
15598
15593
  };
15599
15594
  db.createFunction({
15600
15595
  name: "embedding_query",
@@ -15970,10 +15965,12 @@ function resolveOfficialBrowserAssets(entryUrl, optionsOrModelRoot) {
15970
15965
  packageRoot.href += "/";
15971
15966
  }
15972
15967
  const worker = opts.workerUrl !== void 0 ? resolveSecureUrl(opts.workerUrl, entryParsed, false) : new URL("dist/workers/inference-browser.mjs", packageRoot).href;
15968
+ const dbWorker = opts.dbWorkerUrl !== void 0 ? resolveSecureUrl(opts.dbWorkerUrl, entryParsed, false) : new URL("dist/workers/db-browser.mjs", packageRoot).href;
15973
15969
  const manifest = opts.manifestUrl !== void 0 ? resolveSecureUrl(opts.manifestUrl, entryParsed, false) : new URL("manifests/embeddinggemma2-q4.json", packageRoot).href;
15974
15970
  const modelBase = opts.modelBaseUrl !== void 0 ? resolveSecureUrl(opts.modelBaseUrl, entryParsed, true) : DEFAULT_BROWSER_MODEL_BASE_URL;
15975
15971
  return {
15976
15972
  worker,
15973
+ dbWorker,
15977
15974
  manifest,
15978
15975
  modelBase
15979
15976
  };
@@ -16146,9 +16143,19 @@ function resolveBrowserEntryUrl() {
16146
16143
  }
16147
16144
  return "https://localhost/dist/index-browser.mjs";
16148
16145
  }
16146
+ function isBrowserDedicatedWorker() {
16147
+ const hasWindow = typeof globalThis.window !== "undefined";
16148
+ if (hasWindow) {
16149
+ return false;
16150
+ }
16151
+ if (typeof importScripts === "function") {
16152
+ return true;
16153
+ }
16154
+ return typeof globalThis.WorkerGlobalScope !== "undefined";
16155
+ }
16149
16156
  async function initialize(options = {}) {
16150
16157
  const env = {
16151
- worker: typeof importScripts === "function",
16158
+ worker: isBrowserDedicatedWorker(),
16152
16159
  runtime: "browser",
16153
16160
  platform: "browser",
16154
16161
  architecture: "browser"
@@ -87,6 +87,12 @@ function validateEmbeddingOptions(options, env) {
87
87
  }
88
88
  }
89
89
  } else if (env.runtime === "browser") {
90
+ if (!env.worker) {
91
+ console.warn(
92
+ "SQLite synchronous embedding UDFs require Atomics.wait and cannot run on the browser main thread. Run initialize({ embedding }) inside a Dedicated Worker or use sqlite3EmbeddingWorkerPromiser()."
93
+ );
94
+ throw new VectorError("E_ENVIRONMENT");
95
+ }
90
96
  if (backend === "directml") {
91
97
  throw new VectorError("E_ENVIRONMENT");
92
98
  }
@@ -1046,15 +1052,11 @@ function registerEmbeddingExtension(sqlite3, infer, options) {
1046
1052
  }
1047
1053
  return doInfer(req);
1048
1054
  };
1055
+ if (!infer) {
1056
+ return;
1057
+ }
1049
1058
  const embeddingFunc = (_ctx, ...args) => {
1050
- try {
1051
- return embeddingSqlValue("embedding", args, infer ? inferWrapper : void 0);
1052
- } catch (err) {
1053
- if (!infer && err instanceof VectorError && err.code === "E_EMBEDDING_NOT_READY") {
1054
- console.warn("Embedding error: E_EMBEDDING_NOT_READY");
1055
- }
1056
- throw err;
1057
- }
1059
+ return embeddingSqlValue("embedding", args, inferWrapper);
1058
1060
  };
1059
1061
  db.createFunction({
1060
1062
  name: "embedding",
@@ -1069,14 +1071,7 @@ function registerEmbeddingExtension(sqlite3, infer, options) {
1069
1071
  xFunc: embeddingFunc
1070
1072
  });
1071
1073
  const embeddingQueryFunc = (_ctx, ...args) => {
1072
- try {
1073
- return embeddingSqlValue("embedding_query", args, infer ? inferWrapper : void 0);
1074
- } catch (err) {
1075
- if (!infer && err instanceof VectorError && err.code === "E_EMBEDDING_NOT_READY") {
1076
- console.warn("Embedding error: E_EMBEDDING_NOT_READY");
1077
- }
1078
- throw err;
1079
- }
1074
+ return embeddingSqlValue("embedding_query", args, inferWrapper);
1080
1075
  };
1081
1076
  db.createFunction({
1082
1077
  name: "embedding_query",