sensemaking 0.23.0 → 0.23.1

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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/store/batch.d.cts +4 -0
  3. package/dist/cjs/store/batch.d.ts +4 -0
  4. package/dist/cjs/store/batch.js +80 -0
  5. package/dist/cjs/store/batch.js.map +1 -0
  6. package/dist/cjs/store/duckdb/batch.d.cts +0 -4
  7. package/dist/cjs/store/duckdb/batch.d.ts +0 -4
  8. package/dist/cjs/store/duckdb/batch.js +5 -27
  9. package/dist/cjs/store/duckdb/batch.js.map +1 -1
  10. package/dist/cjs/store/turso/connection.d.cts +3 -0
  11. package/dist/cjs/store/turso/connection.d.ts +3 -0
  12. package/dist/cjs/store/turso/connection.js +300 -30
  13. package/dist/cjs/store/turso/connection.js.map +1 -1
  14. package/dist/cjs/store/turso/native.d.cts +4 -0
  15. package/dist/cjs/store/turso/native.d.ts +4 -0
  16. package/dist/cjs/store/turso/native.js +9 -0
  17. package/dist/cjs/store/turso/native.js.map +1 -1
  18. package/dist/cjs/store/turso/open.js +81 -8
  19. package/dist/cjs/store/turso/open.js.map +1 -1
  20. package/dist/cjs/store/turso/store.js +103 -1
  21. package/dist/cjs/store/turso/store.js.map +1 -1
  22. package/dist/esm/store/batch.d.ts +4 -0
  23. package/dist/esm/store/batch.js +21 -0
  24. package/dist/esm/store/batch.js.map +1 -0
  25. package/dist/esm/store/duckdb/batch.d.ts +0 -4
  26. package/dist/esm/store/duckdb/batch.js +2 -19
  27. package/dist/esm/store/duckdb/batch.js.map +1 -1
  28. package/dist/esm/store/turso/connection.d.ts +3 -0
  29. package/dist/esm/store/turso/connection.js +58 -3
  30. package/dist/esm/store/turso/connection.js.map +1 -1
  31. package/dist/esm/store/turso/native.d.ts +4 -0
  32. package/dist/esm/store/turso/native.js +8 -0
  33. package/dist/esm/store/turso/native.js.map +1 -1
  34. package/dist/esm/store/turso/open.js +5 -5
  35. package/dist/esm/store/turso/open.js.map +1 -1
  36. package/dist/esm/store/turso/store.js +29 -2
  37. package/dist/esm/store/turso/store.js.map +1 -1
  38. package/package.json +1 -1
  39. package/skills/sense-setup/SKILL.md +1 -1
@@ -9,14 +9,27 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ get cacheFilePath () {
13
+ return cacheFilePath;
14
+ },
12
15
  get checkpointWal () {
13
16
  return checkpointWal;
14
17
  },
15
18
  get createConnection () {
16
19
  return createConnection;
20
+ },
21
+ get fileSize () {
22
+ return fileSize;
23
+ },
24
+ get reclaimSpace () {
25
+ return reclaimSpace;
17
26
  }
18
27
  });
28
+ var _promises = require("node:fs/promises");
29
+ var _batchts = require("../batch.js");
30
+ var _sharedts = require("../shared.js");
19
31
  var _transactionts = require("../transaction.js");
32
+ var _nativets = require("./native.js");
20
33
  function _array_like_to_array(arr, len) {
21
34
  if (len == null || len > arr.length) len = arr.length;
22
35
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -211,6 +224,17 @@ function _async_to_generator(fn) {
211
224
  function _class_call_check(instance, Constructor) {
212
225
  if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
213
226
  }
227
+ function _define_property(obj, key, value) {
228
+ if (key in obj) {
229
+ Object.defineProperty(obj, key, {
230
+ value: value,
231
+ enumerable: true,
232
+ configurable: true,
233
+ writable: true
234
+ });
235
+ } else obj[key] = value;
236
+ return obj;
237
+ }
214
238
  function _iterable_to_array(iter) {
215
239
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
216
240
  return Array.from(iter);
@@ -219,6 +243,44 @@ function _iterable_to_array(iter) {
219
243
  function _non_iterable_spread() {
220
244
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
221
245
  }
246
+ function _object_spread(target) {
247
+ for(var i = 1; i < arguments.length; i++){
248
+ var source = arguments[i] != null ? arguments[i] : {};
249
+ var ownKeys = Object.keys(source);
250
+ if (typeof Object.getOwnPropertySymbols === "function") {
251
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
252
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
253
+ }));
254
+ }
255
+ ownKeys.forEach(function(key) {
256
+ _define_property(target, key, source[key]);
257
+ });
258
+ }
259
+ return target;
260
+ }
261
+ function ownKeys(object, enumerableOnly) {
262
+ var keys = Object.keys(object);
263
+ if (Object.getOwnPropertySymbols) {
264
+ var symbols = Object.getOwnPropertySymbols(object);
265
+ if (enumerableOnly) {
266
+ symbols = symbols.filter(function(sym) {
267
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
268
+ });
269
+ }
270
+ keys.push.apply(keys, symbols);
271
+ }
272
+ return keys;
273
+ }
274
+ function _object_spread_props(target, source) {
275
+ source = source != null ? source : {};
276
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
277
+ else {
278
+ ownKeys(Object(source)).forEach(function(key) {
279
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
280
+ });
281
+ }
282
+ return target;
283
+ }
222
284
  function _overload_yield(value, kind) {
223
285
  this.v = value;
224
286
  this.k = kind;
@@ -476,6 +538,168 @@ function checkpointWal(db) {
476
538
  });
477
539
  })();
478
540
  }
541
+ function cacheFilePath(conn) {
542
+ return _async_to_generator(function() {
543
+ var _rows_find, rows;
544
+ return _ts_generator(this, function(_state) {
545
+ switch(_state.label){
546
+ case 0:
547
+ return [
548
+ 4,
549
+ conn.prepare('PRAGMA database_list')
550
+ ];
551
+ case 1:
552
+ return [
553
+ 4,
554
+ _state.sent().all()
555
+ ];
556
+ case 2:
557
+ rows = _state.sent();
558
+ return [
559
+ 2,
560
+ ((_rows_find = rows.find(function(r) {
561
+ return r.name === 'main';
562
+ })) === null || _rows_find === void 0 ? void 0 : _rows_find.file) || null
563
+ ];
564
+ }
565
+ });
566
+ })();
567
+ }
568
+ function fileSize(path) {
569
+ return _async_to_generator(function() {
570
+ var unused;
571
+ return _ts_generator(this, function(_state) {
572
+ switch(_state.label){
573
+ case 0:
574
+ _state.trys.push([
575
+ 0,
576
+ 2,
577
+ ,
578
+ 3
579
+ ]);
580
+ return [
581
+ 4,
582
+ (0, _promises.stat)(path)
583
+ ];
584
+ case 1:
585
+ return [
586
+ 2,
587
+ _state.sent().size
588
+ ];
589
+ case 2:
590
+ unused = _state.sent();
591
+ return [
592
+ 2,
593
+ null
594
+ ];
595
+ case 3:
596
+ return [
597
+ 2
598
+ ];
599
+ }
600
+ });
601
+ })();
602
+ }
603
+ function reclaimSpace(path) {
604
+ return _async_to_generator(function() {
605
+ var turso, db, size, err;
606
+ return _ts_generator(this, function(_state) {
607
+ switch(_state.label){
608
+ case 0:
609
+ _state.trys.push([
610
+ 0,
611
+ 12,
612
+ ,
613
+ 13
614
+ ]);
615
+ return [
616
+ 4,
617
+ (0, _nativets.tursoApi)()
618
+ ];
619
+ case 1:
620
+ turso = _state.sent();
621
+ return [
622
+ 4,
623
+ turso.connect(path, _object_spread_props(_object_spread({}, _nativets.CONNECT_OPTS), {
624
+ experimental: _to_consumable_array(_nativets.CONNECT_OPTS.experimental).concat([
625
+ 'vacuum'
626
+ ])
627
+ }))
628
+ ];
629
+ case 2:
630
+ db = _state.sent();
631
+ _state.label = 3;
632
+ case 3:
633
+ _state.trys.push([
634
+ 3,
635
+ ,
636
+ 9,
637
+ 11
638
+ ]);
639
+ return [
640
+ 4,
641
+ db.exec('VACUUM')
642
+ ];
643
+ case 4:
644
+ _state.sent();
645
+ return [
646
+ 4,
647
+ fileSize(path)
648
+ ];
649
+ case 5:
650
+ size = _state.sent();
651
+ if (!(size !== null)) return [
652
+ 3,
653
+ 7
654
+ ];
655
+ return [
656
+ 4,
657
+ (0, _sharedts.setMeta)(createConnection(db), 'compact_size', String(size))
658
+ ];
659
+ case 6:
660
+ _state.sent();
661
+ _state.label = 7;
662
+ case 7:
663
+ return [
664
+ 4,
665
+ checkpointWal(db)
666
+ ];
667
+ case 8:
668
+ _state.sent();
669
+ return [
670
+ 3,
671
+ 11
672
+ ];
673
+ case 9:
674
+ return [
675
+ 4,
676
+ db.close()
677
+ ];
678
+ case 10:
679
+ _state.sent();
680
+ return [
681
+ 7
682
+ ];
683
+ case 11:
684
+ return [
685
+ 3,
686
+ 13
687
+ ];
688
+ case 12:
689
+ err = _state.sent();
690
+ console.error("sense: turso VACUUM failed, the cache will keep the space until one succeeds: ".concat(err.message));
691
+ return [
692
+ 3,
693
+ 13
694
+ ];
695
+ case 13:
696
+ return [
697
+ 2
698
+ ];
699
+ }
700
+ });
701
+ })();
702
+ }
479
703
  function createConnection(db) {
480
704
  var conn = {
481
705
  exec: function exec(sql) {
@@ -519,8 +743,8 @@ function createConnection(db) {
519
743
  });
520
744
  })();
521
745
  },
522
- runBatch: // Prepares once and awaits run() per row: db.batch() re-prepares each statement, which cost as
523
- // much as preparing per row. A literal nested BEGIN hard-errors, so withTransaction's join-not-savepoint helper makes this safe inside reconcile's own transaction too.
746
+ runBatch: // Folds a plain INSERT into one multi-row VALUES statement (shared rewriteInsert, ../batch.ts):
747
+ // no bind-variable ceiling to chunk against, measured empirically. UPDATE/DELETE keep the per-row loop.
524
748
  function runBatch(sql, paramRows) {
525
749
  return _async_to_generator(function() {
526
750
  return _ts_generator(this, function(_state) {
@@ -533,13 +757,18 @@ function createConnection(db) {
533
757
  4,
534
758
  (0, _transactionts.withTransaction)(conn, function() {
535
759
  return _async_to_generator(function() {
536
- var stmt, _stmt, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, row, err;
760
+ var rewritten, stmt, stmt1, _stmt, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, row, err;
537
761
  return _ts_generator(this, function(_state) {
538
762
  switch(_state.label){
539
763
  case 0:
764
+ rewritten = (0, _batchts.rewriteInsert)(sql, paramRows.length);
765
+ if (!rewritten) return [
766
+ 3,
767
+ 7
768
+ ];
540
769
  return [
541
770
  4,
542
- db.prepare(sql)
771
+ db.prepare(rewritten.sql)
543
772
  ];
544
773
  case 1:
545
774
  stmt = _state.sent();
@@ -548,53 +777,94 @@ function createConnection(db) {
548
777
  _state.trys.push([
549
778
  2,
550
779
  ,
551
- 11,
552
- 13
780
+ 4,
781
+ 6
553
782
  ]);
554
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
555
- _state.label = 3;
783
+ // One flat array, not spread: spreading tens of thousands of args hits a JS call-stack
784
+ // limit well before turso enforces any variable-count ceiling (measured; see PLAN.md).
785
+ return [
786
+ 4,
787
+ stmt.run(paramRows.flat())
788
+ ];
556
789
  case 3:
557
- _state.trys.push([
790
+ _state.sent();
791
+ return [
558
792
  3,
559
- 8,
793
+ 6
794
+ ];
795
+ case 4:
796
+ return [
797
+ 4,
798
+ stmt.close()
799
+ ];
800
+ case 5:
801
+ _state.sent();
802
+ return [
803
+ 7
804
+ ];
805
+ case 6:
806
+ return [
807
+ 2
808
+ ];
809
+ case 7:
810
+ return [
811
+ 4,
812
+ db.prepare(sql)
813
+ ];
814
+ case 8:
815
+ stmt1 = _state.sent();
816
+ _state.label = 9;
817
+ case 9:
818
+ _state.trys.push([
560
819
  9,
561
- 10
820
+ ,
821
+ 18,
822
+ 20
823
+ ]);
824
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
825
+ _state.label = 10;
826
+ case 10:
827
+ _state.trys.push([
828
+ 10,
829
+ 15,
830
+ 16,
831
+ 17
562
832
  ]);
563
833
  _iterator = paramRows[Symbol.iterator]();
564
- _state.label = 4;
565
- case 4:
834
+ _state.label = 11;
835
+ case 11:
566
836
  if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
567
837
  3,
568
- 7
838
+ 14
569
839
  ];
570
840
  row = _step.value;
571
841
  return [
572
842
  4,
573
- (_stmt = stmt).run.apply(_stmt, _to_consumable_array(row))
843
+ (_stmt = stmt1).run.apply(_stmt, _to_consumable_array(row))
574
844
  ];
575
- case 5:
845
+ case 12:
576
846
  _state.sent();
577
- _state.label = 6;
578
- case 6:
847
+ _state.label = 13;
848
+ case 13:
579
849
  _iteratorNormalCompletion = true;
580
850
  return [
581
851
  3,
582
- 4
852
+ 11
583
853
  ];
584
- case 7:
854
+ case 14:
585
855
  return [
586
856
  3,
587
- 10
857
+ 17
588
858
  ];
589
- case 8:
859
+ case 15:
590
860
  err = _state.sent();
591
861
  _didIteratorError = true;
592
862
  _iteratorError = err;
593
863
  return [
594
864
  3,
595
- 10
865
+ 17
596
866
  ];
597
- case 9:
867
+ case 16:
598
868
  try {
599
869
  if (!_iteratorNormalCompletion && _iterator.return != null) {
600
870
  _iterator.return();
@@ -607,22 +877,22 @@ function createConnection(db) {
607
877
  return [
608
878
  7
609
879
  ];
610
- case 10:
880
+ case 17:
611
881
  return [
612
882
  3,
613
- 13
883
+ 20
614
884
  ];
615
- case 11:
885
+ case 18:
616
886
  return [
617
887
  4,
618
- stmt.close()
888
+ stmt1.close()
619
889
  ];
620
- case 12:
890
+ case 19:
621
891
  _state.sent();
622
892
  return [
623
893
  7
624
894
  ];
625
- case 13:
895
+ case 20:
626
896
  return [
627
897
  2
628
898
  ];
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/store/turso/connection.ts"],"sourcesContent":["import type { Database } from '@tursodatabase/database';\nimport { BEGIN_WRITE, withTransaction } from '../transaction.ts';\nimport type { Connection, RunResult, Statement } from '../types.ts';\n\n// The client's own Statement class isn't re-exported by name from '@tursodatabase/database',\n// so its type is derived structurally from Database.prepare()'s return type instead.\ntype TursoStatement = Awaited<ReturnType<Database['prepare']>>;\n\n// @tursodatabase/database/compat offers a synchronous escape hatch, but it measured only 4-12%\n// faster than this promise client, so this wraps the async client in the same Connection/Statement shape 1:1.\nclass TursoStatementWrapper implements Statement {\n private stmt: TursoStatement;\n\n constructor(stmt: TursoStatement) {\n this.stmt = stmt;\n }\n\n async run(...params: unknown[]): Promise<RunResult> {\n return this.stmt.run(...params);\n }\n\n async get(...params: unknown[]): Promise<unknown> {\n return this.stmt.get(...params);\n }\n\n async all(...params: unknown[]): Promise<unknown[]> {\n return this.stmt.all(...params);\n }\n\n async *iterate(...params: unknown[]): AsyncIterable<unknown> {\n yield* this.stmt.iterate(...params);\n }\n\n columns(): Array<{ name: string }> {\n return this.stmt.columns();\n }\n\n setReadBigInts(enabled: boolean): void {\n this.stmt.safeIntegers(enabled);\n }\n}\n\n// This client leaves the WAL behind for the next opener, where node:sqlite checkpoints on the last\n// close, so a tree reconciled over and over grows one without bound. Best-effort: close must not throw.\nexport async function checkpointWal(db: Database): Promise<void> {\n try {\n await db.exec('PRAGMA wal_checkpoint(TRUNCATE)');\n } catch (err) {\n console.error(`sense: turso WAL checkpoint failed, the -wal file will keep growing until one succeeds: ${(err as Error).message}`);\n }\n}\n\nexport function createConnection(db: Database): Connection {\n const conn: Connection = {\n async exec(sql: string): Promise<void> {\n await db.exec(sql);\n },\n async prepare(sql: string): Promise<Statement> {\n return new TursoStatementWrapper(await db.prepare(sql));\n },\n // Prepares once and awaits run() per row: db.batch() re-prepares each statement, which cost as\n // much as preparing per row. A literal nested BEGIN hard-errors, so withTransaction's join-not-savepoint helper makes this safe inside reconcile's own transaction too.\n async runBatch(sql: string, paramRows: unknown[][]): Promise<void> {\n if (paramRows.length === 0) return;\n await withTransaction(\n conn,\n async () => {\n const stmt = await db.prepare(sql);\n // Finalized here because nothing else will: open() hands back a connection the caller\n // can hold across many batches, and the db.batch() this replaced finalized its own.\n try {\n for (const row of paramRows) await stmt.run(...row);\n } finally {\n await stmt.close();\n }\n },\n BEGIN_WRITE\n );\n },\n };\n return conn;\n}\n"],"names":["checkpointWal","createConnection","TursoStatementWrapper","stmt","run","params","get","all","iterate","columns","setReadBigInts","enabled","safeIntegers","db","err","exec","console","error","message","conn","sql","prepare","runBatch","paramRows","length","withTransaction","row","close","BEGIN_WRIT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KAAK,GAAG;;;4BAC5B;;gCAAMC,IAAAA,8BAAe,EACnBN,MACA;;4CACQhB,MAI+BA,OAA9B,2BAAA,mBAAA,gBAAA,WAAA,OAAMuB;;;;oDAJA;;wDAAMb,GAAGQ,OAAO,CAACD;;;oDAAxBjB,OAAO;;;;;;;;;oDAIN,kCAAA,2BAAA;;;;;;;;;oDAAA,YAAaoB;;;2DAAb,6BAAA,QAAA;;;;oDAAMG,MAAN;oDAAwB;;wDAAMvB,CAAAA,QAAAA,MAAKC,GAAG,OAARD,OAAS,qBAAGuB;;;oDAAlB;;;oDAAxB;;;;;;;;;;;;oDAAA;oDAAA;;;;;;;6DAAA,6BAAA;4DAAA;;;4DAAA;kEAAA;;;;;;;;;;;;oDAEL;;wDAAMvB,KAAKwB,KAAK;;;oDAAhB;;;;;;;;;;oCAEJ;mCACAC,0BAAW;;;4BAZb;;;;;;YAcF;;IACF;IACA,OAAOT;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/store/turso/connection.ts"],"sourcesContent":["import { stat } from 'node:fs/promises';\nimport type { Database } from '@tursodatabase/database';\nimport { rewriteInsert } from '../batch.ts';\nimport { setMeta } from '../shared.ts';\nimport { BEGIN_WRITE, withTransaction } from '../transaction.ts';\nimport type { Connection, RunResult, Statement } from '../types.ts';\nimport { CONNECT_OPTS, tursoApi } from './native.ts';\n\n// The client's own Statement class isn't re-exported by name from '@tursodatabase/database',\n// so its type is derived structurally from Database.prepare()'s return type instead.\ntype TursoStatement = Awaited<ReturnType<Database['prepare']>>;\n\n// @tursodatabase/database/compat offers a synchronous escape hatch, but it measured only 4-12%\n// faster than this promise client, so this wraps the async client in the same Connection/Statement shape 1:1.\nclass TursoStatementWrapper implements Statement {\n private stmt: TursoStatement;\n\n constructor(stmt: TursoStatement) {\n this.stmt = stmt;\n }\n\n async run(...params: unknown[]): Promise<RunResult> {\n return this.stmt.run(...params);\n }\n\n async get(...params: unknown[]): Promise<unknown> {\n return this.stmt.get(...params);\n }\n\n async all(...params: unknown[]): Promise<unknown[]> {\n return this.stmt.all(...params);\n }\n\n async *iterate(...params: unknown[]): AsyncIterable<unknown> {\n yield* this.stmt.iterate(...params);\n }\n\n columns(): Array<{ name: string }> {\n return this.stmt.columns();\n }\n\n setReadBigInts(enabled: boolean): void {\n this.stmt.safeIntegers(enabled);\n }\n}\n\n// This client leaves the WAL behind for the next opener, where node:sqlite checkpoints on the last\n// close, so a tree reconciled over and over grows one without bound. Best-effort: close must not throw.\nexport async function checkpointWal(db: Database): Promise<void> {\n try {\n await db.exec('PRAGMA wal_checkpoint(TRUNCATE)');\n } catch (err) {\n console.error(`sense: turso WAL checkpoint failed, the -wal file will keep growing until one succeeds: ${(err as Error).message}`);\n }\n}\n\n// The main cache file's path, or null when unresolvable. The store holds a Database and\n// Connection, not a path (PLAN 3.52), so the path is read from the database itself.\nexport async function cacheFilePath(conn: Connection): Promise<string | null> {\n const rows = (await (await conn.prepare('PRAGMA database_list')).all()) as Array<{ name: string; file: string }>;\n return rows.find((r) => r.name === 'main')?.file || null;\n}\n\nexport async function fileSize(path: string): Promise<number | null> {\n try {\n return (await stat(path)).size;\n } catch {\n return null;\n }\n}\n\n// Reclaims turso#8170's FTS space amplification (PLAN 3.41), on a throwaway connection after the\n// store's own has closed: `vacuum` doubles incremental reconcile cost merely by being enabled (3.54).\nexport async function reclaimSpace(path: string): Promise<void> {\n try {\n const turso = await tursoApi();\n const db = await turso.connect(path, { ...CONNECT_OPTS, experimental: [...CONNECT_OPTS.experimental, 'vacuum'] });\n try {\n await db.exec('VACUUM');\n const size = await fileSize(path);\n // Recorded here, not by the caller: this connection is the only one still open on the file.\n if (size !== null) await setMeta(createConnection(db), 'compact_size', String(size));\n await checkpointWal(db);\n } finally {\n await db.close();\n }\n } catch (err) {\n console.error(`sense: turso VACUUM failed, the cache will keep the space until one succeeds: ${(err as Error).message}`);\n }\n}\n\nexport function createConnection(db: Database): Connection {\n const conn: Connection = {\n async exec(sql: string): Promise<void> {\n await db.exec(sql);\n },\n async prepare(sql: string): Promise<Statement> {\n return new TursoStatementWrapper(await db.prepare(sql));\n },\n // Folds a plain INSERT into one multi-row VALUES statement (shared rewriteInsert, ../batch.ts):\n // no bind-variable ceiling to chunk against, measured empirically. UPDATE/DELETE keep the per-row loop.\n async runBatch(sql: string, paramRows: unknown[][]): Promise<void> {\n if (paramRows.length === 0) return;\n await withTransaction(\n conn,\n async () => {\n const rewritten = rewriteInsert(sql, paramRows.length);\n if (rewritten) {\n const stmt = await db.prepare(rewritten.sql);\n try {\n // One flat array, not spread: spreading tens of thousands of args hits a JS call-stack\n // limit well before turso enforces any variable-count ceiling (measured; see PLAN.md).\n await stmt.run(paramRows.flat());\n } finally {\n await stmt.close();\n }\n return;\n }\n // Finalized here because nothing else will: open() hands back a connection the caller\n // can hold across many batches, and the db.batch() this replaced finalized its own.\n const stmt = await db.prepare(sql);\n try {\n for (const row of paramRows) await stmt.run(...row);\n } finally {\n await stmt.close();\n }\n },\n BEGIN_WRITE\n );\n },\n };\n return conn;\n}\n"],"names":["cacheFilePath","checkpointWal","createConnection","fileSize","reclaimSpace","TursoStatementWrapper","stmt","run","params","get","all","iterate","columns","setReadBigInts","enabled","safeIntegers","db","err","exec","console","error","message","conn","rows","prepare","find","r","name","file","path","stat","size","turso","tursoApi","connect","CONNECT_OPTS","experimental","setMeta","String","close","sql","runBatch","paramRows","length","withTransaction","rewritten","row","rewriteInsert","flat","BEGIN_WRITE"],"mappings":";;;;;;;;;;;QA0DsBA;eAAAA;;QAVAC;eAAAA;;QA2CNC;eAAAA;;QA5BMC;eAAAA;;QAUAC;eAAAA;;;wBAzED;uBAES;wBACN;6BACqB;wBAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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DAAMA,KAAKC,GAAG,CAACmC,UAAUM,IAAI;;;oDAA7B;;;;;;oDAEA;;wDAAM1C,KAAKiC,KAAK;;;oDAAhB;;;;;oDAEF;;;;oDAIW;;wDAAMvB,GAAGQ,OAAO,CAACgB;;;oDAAxBlC,QAAO;;;;;;;;;oDAEN,kCAAA,2BAAA;;;;;;;;;oDAAA,YAAaoC;;;2DAAb,6BAAA,QAAA;;;;oDAAMI,MAAN;oDAAwB;;wDAAMxC,CAAAA,QAAAA,OAAKC,GAAG,OAARD,OAAS,qBAAGwC;;;oDAAlB;;;oDAAxB;;;;;;;;;;;;oDAAA;oDAAA;;;;;;;6DAAA,6BAAA;4DAAA;;;4DAAA;kEAAA;;;;;;;;;;;;oDAEL;;wDAAMxC,MAAKiC,KAAK;;;oDAAhB;;;;;;;;;;oCAEJ;mCACAU,0BAAW;;;4BAxBb;;;;;;YA0BF;;IACF;IACA,OAAO3B;AACT"}
@@ -1,2 +1,6 @@
1
1
  export declare const TURSO_PACKAGE = "@tursodatabase/database";
2
+ export declare const CONNECT_OPTS: {
3
+ readonly timeout: 30000;
4
+ readonly experimental: readonly ["index_method"];
5
+ };
2
6
  export declare function tursoApi(): Promise<typeof import('@tursodatabase/database')>;
@@ -1,2 +1,6 @@
1
1
  export declare const TURSO_PACKAGE = "@tursodatabase/database";
2
+ export declare const CONNECT_OPTS: {
3
+ readonly timeout: 30000;
4
+ readonly experimental: readonly ["index_method"];
5
+ };
2
6
  export declare function tursoApi(): Promise<typeof import('@tursodatabase/database')>;
@@ -9,6 +9,9 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ get CONNECT_OPTS () {
13
+ return CONNECT_OPTS;
14
+ },
12
15
  get TURSO_PACKAGE () {
13
16
  return TURSO_PACKAGE;
14
17
  },
@@ -23,6 +26,12 @@ var TURSO = {
23
26
  pkg: TURSO_PACKAGE,
24
27
  sizeHint: '~16MB'
25
28
  };
29
+ var CONNECT_OPTS = {
30
+ timeout: 30000,
31
+ experimental: [
32
+ 'index_method'
33
+ ]
34
+ };
26
35
  var tursoApiPromise;
27
36
  function tursoApi() {
28
37
  if (!tursoApiPromise) tursoApiPromise = (0, _nativets.loadOrInstall)(TURSO, (0, _nativets.packageNodeModules)());
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/store/turso/native.ts"],"sourcesContent":["import { loadOrInstall, type NativeDescriptor, packageNodeModules } from '../native.ts';\n\nexport const TURSO_PACKAGE = '@tursodatabase/database';\n\nconst TURSO: NativeDescriptor = { store: 'turso', pkg: TURSO_PACKAGE, sizeHint: '~16MB' };\n\nlet tursoApiPromise: Promise<typeof import('@tursodatabase/database')> | undefined;\n\n// One accessor every consumer must go through, not each its own bare-specifier import: Node\n// keeps returning a pre-install \"not found\" miss to any new lookup of the same path afterward.\nexport function tursoApi(): Promise<typeof import('@tursodatabase/database')> {\n if (!tursoApiPromise) tursoApiPromise = loadOrInstall<typeof import('@tursodatabase/database')>(TURSO, packageNodeModules());\n return tursoApiPromise;\n}\n"],"names":["TURSO_PACKAGE","tursoApi","TURSO","store","pkg","sizeHint","tursoApiPromise","loadOrInstall","packageNodeModules"],"mappings":";;;;;;;;;;;QAEaA;eAAAA;;QAQGC;eAAAA;;;wBAVyD;AAElE,IAAMD,gBAAgB;AAE7B,IAAME,QAA0B;IAAEC,OAAO;IAASC,KAAKJ;IAAeK,UAAU;AAAQ;AAExF,IAAIC;AAIG,SAASL;IACd,IAAI,CAACK,iBAAiBA,kBAAkBC,IAAAA,uBAAa,EAA2CL,OAAOM,IAAAA,4BAAkB;IACzH,OAAOF;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/store/turso/native.ts"],"sourcesContent":["import { loadOrInstall, type NativeDescriptor, packageNodeModules } from '../native.ts';\n\nexport const TURSO_PACKAGE = '@tursodatabase/database';\n\nconst TURSO: NativeDescriptor = { store: 'turso', pkg: TURSO_PACKAGE, sizeHint: '~16MB' };\n\n// Every connect() in this store goes through these: the same 30s floor sqlite opens with, and the\n// FTS index method ensureSchema() needs. reclaimSpace adds 'vacuum'; nothing else may (PLAN 3.54).\nexport const CONNECT_OPTS = { timeout: 30_000, experimental: ['index_method'] } as const;\n\nlet tursoApiPromise: Promise<typeof import('@tursodatabase/database')> | undefined;\n\n// One accessor every consumer must go through, not each its own bare-specifier import: Node\n// keeps returning a pre-install \"not found\" miss to any new lookup of the same path afterward.\nexport function tursoApi(): Promise<typeof import('@tursodatabase/database')> {\n if (!tursoApiPromise) tursoApiPromise = loadOrInstall<typeof import('@tursodatabase/database')>(TURSO, packageNodeModules());\n return tursoApiPromise;\n}\n"],"names":["CONNECT_OPTS","TURSO_PACKAGE","tursoApi","TURSO","store","pkg","sizeHint","timeout","experimental","tursoApiPromise","loadOrInstall","packageNodeModules"],"mappings":";;;;;;;;;;;QAQaA;eAAAA;;QANAC;eAAAA;;QAYGC;eAAAA;;;wBAdyD;AAElE,IAAMD,gBAAgB;AAE7B,IAAME,QAA0B;IAAEC,OAAO;IAASC,KAAKJ;IAAeK,UAAU;AAAQ;AAIjF,IAAMN,eAAe;IAAEO,SAAS;IAAQC,cAAc;QAAC;KAAe;AAAC;AAE9E,IAAIC;AAIG,SAASP;IACd,IAAI,CAACO,iBAAiBA,kBAAkBC,IAAAA,uBAAa,EAA2CP,OAAOQ,IAAAA,4BAAkB;IACzH,OAAOF;AACT"}
@@ -32,6 +32,14 @@ var _connectionts = require("./connection.js");
32
32
  var _nativets = require("./native.js");
33
33
  var _reconcilets = require("./reconcile.js");
34
34
  var _storets = require("./store.js");
35
+ function _array_like_to_array(arr, len) {
36
+ if (len == null || len > arr.length) len = arr.length;
37
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
38
+ return arr2;
39
+ }
40
+ function _array_without_holes(arr) {
41
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
42
+ }
35
43
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
36
44
  try {
37
45
  var info = gen[key](arg);
@@ -58,12 +66,72 @@ function _async_to_generator(fn) {
58
66
  });
59
67
  };
60
68
  }
69
+ function _define_property(obj, key, value) {
70
+ if (key in obj) {
71
+ Object.defineProperty(obj, key, {
72
+ value: value,
73
+ enumerable: true,
74
+ configurable: true,
75
+ writable: true
76
+ });
77
+ } else obj[key] = value;
78
+ return obj;
79
+ }
61
80
  function _instanceof(left, right) {
62
81
  "@swc/helpers - instanceof";
63
82
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
64
83
  return !!right[Symbol.hasInstance](left);
65
84
  } else return left instanceof right;
66
85
  }
86
+ function _iterable_to_array(iter) {
87
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
88
+ return Array.from(iter);
89
+ }
90
+ }
91
+ function _non_iterable_spread() {
92
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
93
+ }
94
+ function _object_spread(target) {
95
+ for(var i = 1; i < arguments.length; i++){
96
+ var source = arguments[i] != null ? arguments[i] : {};
97
+ var ownKeys = Object.keys(source);
98
+ if (typeof Object.getOwnPropertySymbols === "function") {
99
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
100
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
101
+ }));
102
+ }
103
+ ownKeys.forEach(function(key) {
104
+ _define_property(target, key, source[key]);
105
+ });
106
+ }
107
+ return target;
108
+ }
109
+ function ownKeys(object, enumerableOnly) {
110
+ var keys = Object.keys(object);
111
+ if (Object.getOwnPropertySymbols) {
112
+ var symbols = Object.getOwnPropertySymbols(object);
113
+ if (enumerableOnly) {
114
+ symbols = symbols.filter(function(sym) {
115
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
116
+ });
117
+ }
118
+ keys.push.apply(keys, symbols);
119
+ }
120
+ return keys;
121
+ }
122
+ function _object_spread_props(target, source) {
123
+ source = source != null ? source : {};
124
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
125
+ else {
126
+ ownKeys(Object(source)).forEach(function(key) {
127
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
128
+ });
129
+ }
130
+ return target;
131
+ }
132
+ function _to_consumable_array(arr) {
133
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
134
+ }
67
135
  function _ts_generator(thisArg, body) {
68
136
  var f, y, t, _ = {
69
137
  label: 0,
@@ -163,6 +231,14 @@ function _ts_generator(thisArg, body) {
163
231
  };
164
232
  }
165
233
  }
234
+ function _unsupported_iterable_to_array(o, minLen) {
235
+ if (!o) return;
236
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
237
+ var n = Object.prototype.toString.call(o).slice(8, -1);
238
+ if (n === "Object" && o.constructor) n = o.constructor.name;
239
+ if (n === "Map" || n === "Set") return Array.from(n);
240
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
241
+ }
166
242
  var DB_FILENAME = 'cache.turso.db';
167
243
  var SCHEMA_VERSION = '5';
168
244
  // This store's Handle (types.ts's OpenDialect<Handle>) is the connected Database itself: no
@@ -444,16 +520,13 @@ function connect(dbPath, _cfg) {
444
520
  ]);
445
521
  return [
446
522
  4,
447
- turso.connect(dbPath, {
448
- timeout: 30000,
449
- experimental: [
450
- 'index_method'
451
- ]
452
- })
523
+ turso.connect(dbPath, _object_spread_props(_object_spread({}, _nativets.CONNECT_OPTS), {
524
+ experimental: _to_consumable_array(_nativets.CONNECT_OPTS.experimental)
525
+ }))
453
526
  ];
454
527
  case 4:
455
- // Floored at the same 30s sqlite opens with. `timeout` is connect-time only in this client;
456
- // the derived value is set via runtime PRAGMA below. `index_method` is required for ensureSchema()'s FTS indexes (T1).
528
+ // `timeout` is connect-time only in this client; the derived value is set via runtime PRAGMA
529
+ // below. Options in native.ts, shared with reclaimSpace's own connection.
457
530
  db = _state.sent();
458
531
  return [
459
532
  3,