sensemaking 0.17.0 → 0.18.0
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/README.md +15 -13
- package/dist/cjs/cli/map.js +147 -6
- package/dist/cjs/cli/map.js.map +1 -1
- package/dist/cjs/cli/named.js +20 -12
- package/dist/cjs/cli/named.js.map +1 -1
- package/dist/cjs/cli/path.js +190 -29
- package/dist/cjs/cli/path.js.map +1 -1
- package/dist/cjs/cli/peek.js +148 -7
- package/dist/cjs/cli/peek.js.map +1 -1
- package/dist/cjs/cli/related.js +5 -5
- package/dist/cjs/cli/related.js.map +1 -1
- package/dist/cjs/cli/search.js +5 -5
- package/dist/cjs/cli/search.js.map +1 -1
- package/dist/cjs/cli/shared.d.cts +3 -3
- package/dist/cjs/cli/shared.d.ts +3 -3
- package/dist/cjs/cli/shared.js +156 -58
- package/dist/cjs/cli/shared.js.map +1 -1
- package/dist/cjs/cli/sql.js +151 -10
- package/dist/cjs/cli/sql.js.map +1 -1
- package/dist/cjs/cli/status.js +187 -62
- package/dist/cjs/cli/status.js.map +1 -1
- package/dist/cjs/commands/map.d.cts +2 -2
- package/dist/cjs/commands/map.d.ts +2 -2
- package/dist/cjs/commands/map.js +373 -67
- package/dist/cjs/commands/map.js.map +1 -1
- package/dist/cjs/commands/peek.d.cts +2 -2
- package/dist/cjs/commands/peek.d.ts +2 -2
- package/dist/cjs/commands/peek.js +321 -79
- package/dist/cjs/commands/peek.js.map +1 -1
- package/dist/cjs/commands/related.d.cts +2 -2
- package/dist/cjs/commands/related.d.ts +2 -2
- package/dist/cjs/commands/related.js +55 -10
- package/dist/cjs/commands/related.js.map +1 -1
- package/dist/cjs/commands/scope.d.cts +7 -7
- package/dist/cjs/commands/scope.d.ts +7 -7
- package/dist/cjs/commands/scope.js +382 -45
- package/dist/cjs/commands/scope.js.map +1 -1
- package/dist/cjs/commands/search.d.cts +2 -2
- package/dist/cjs/commands/search.d.ts +2 -2
- package/dist/cjs/commands/search.js +292 -99
- package/dist/cjs/commands/search.js.map +1 -1
- package/dist/cjs/commands/signals.d.cts +4 -10
- package/dist/cjs/commands/signals.d.ts +4 -10
- package/dist/cjs/commands/signals.js +91 -45
- package/dist/cjs/commands/signals.js.map +1 -1
- package/dist/cjs/commands/status.d.cts +2 -2
- package/dist/cjs/commands/status.d.ts +2 -2
- package/dist/cjs/commands/status.js +247 -10
- package/dist/cjs/commands/status.js.map +1 -1
- package/dist/cjs/config/access.d.cts +1 -0
- package/dist/cjs/config/access.d.ts +1 -0
- package/dist/cjs/config/access.js +7 -0
- package/dist/cjs/config/access.js.map +1 -1
- package/dist/cjs/config/index.d.cts +1 -1
- package/dist/cjs/config/index.d.ts +1 -1
- package/dist/cjs/config/index.js +3 -0
- package/dist/cjs/config/index.js.map +1 -1
- package/dist/cjs/config/types.d.cts +1 -0
- package/dist/cjs/config/types.d.ts +1 -0
- package/dist/cjs/config/types.js.map +1 -1
- package/dist/cjs/config/validate.js +10 -1
- package/dist/cjs/config/validate.js.map +1 -1
- package/dist/cjs/embed/distribution.d.cts +4 -0
- package/dist/cjs/embed/distribution.d.ts +4 -0
- package/dist/cjs/embed/distribution.js +186 -0
- package/dist/cjs/embed/distribution.js.map +1 -0
- package/dist/cjs/embed/langfit.d.cts +2 -5
- package/dist/cjs/embed/langfit.d.ts +2 -5
- package/dist/cjs/embed/langfit.js +73 -63
- package/dist/cjs/embed/langfit.js.map +1 -1
- package/dist/cjs/embed/query.d.cts +6 -13
- package/dist/cjs/embed/query.d.ts +6 -13
- package/dist/cjs/embed/query.js +56 -168
- package/dist/cjs/embed/query.js.map +1 -1
- package/dist/cjs/embed/static.js +13 -3
- package/dist/cjs/embed/static.js.map +1 -1
- package/dist/cjs/embed/types.d.cts +1 -0
- package/dist/cjs/embed/types.d.ts +1 -0
- package/dist/cjs/embed/types.js +11 -2
- package/dist/cjs/embed/types.js.map +1 -1
- package/dist/cjs/errors.d.cts +1 -1
- package/dist/cjs/errors.d.ts +1 -1
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/features/embed.js +218 -11
- package/dist/cjs/features/embed.js.map +1 -1
- package/dist/cjs/features/index.d.cts +1 -1
- package/dist/cjs/features/index.d.ts +1 -1
- package/dist/cjs/features/index.js +6 -0
- package/dist/cjs/features/index.js.map +1 -1
- package/dist/cjs/features/links.d.cts +7 -2
- package/dist/cjs/features/links.d.ts +7 -2
- package/dist/cjs/features/links.js +710 -198
- package/dist/cjs/features/links.js.map +1 -1
- package/dist/cjs/features/rank.js +231 -31
- package/dist/cjs/features/rank.js.map +1 -1
- package/dist/cjs/features/sections.js +218 -8
- package/dist/cjs/features/sections.js.map +1 -1
- package/dist/cjs/features/tags.js +236 -40
- package/dist/cjs/features/tags.js.map +1 -1
- package/dist/cjs/features/types.d.cts +9 -5
- package/dist/cjs/features/types.d.ts +9 -5
- package/dist/cjs/graph/traverse.d.cts +2 -2
- package/dist/cjs/graph/traverse.d.ts +2 -2
- package/dist/cjs/graph/traverse.js +321 -42
- package/dist/cjs/graph/traverse.js.map +1 -1
- package/dist/cjs/index.d.cts +3 -2
- package/dist/cjs/index.d.ts +3 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/guarded-tick.d.cts +1 -0
- package/dist/cjs/lib/guarded-tick.d.ts +1 -0
- package/dist/cjs/lib/guarded-tick.js +19 -0
- package/dist/cjs/lib/guarded-tick.js.map +1 -0
- package/dist/cjs/output/column-hint.d.cts +1 -2
- package/dist/cjs/output/column-hint.d.ts +1 -2
- package/dist/cjs/output/column-hint.js +1 -4
- package/dist/cjs/output/column-hint.js.map +1 -1
- package/dist/cjs/output/output.d.cts +2 -1
- package/dist/cjs/output/output.d.ts +2 -1
- package/dist/cjs/output/output.js +515 -97
- package/dist/cjs/output/output.js.map +1 -1
- package/dist/cjs/scan/frontmatter.js.map +1 -1
- package/dist/cjs/scan/index.js.map +1 -1
- package/dist/cjs/scan/reparse.d.cts +10 -0
- package/dist/cjs/scan/reparse.d.ts +10 -0
- package/dist/cjs/scan/reparse.js +104 -0
- package/dist/cjs/scan/reparse.js.map +1 -0
- package/dist/cjs/store/duckdb/batch.d.cts +16 -0
- package/dist/cjs/store/duckdb/batch.d.ts +16 -0
- package/dist/cjs/store/duckdb/batch.js +208 -0
- package/dist/cjs/store/duckdb/batch.js.map +1 -0
- package/dist/cjs/store/duckdb/connection.d.cts +5 -0
- package/dist/cjs/store/duckdb/connection.d.ts +5 -0
- package/dist/cjs/store/duckdb/connection.js +772 -0
- package/dist/cjs/store/duckdb/connection.js.map +1 -0
- package/dist/cjs/store/duckdb/lexical.d.cts +10 -0
- package/dist/cjs/store/duckdb/lexical.d.ts +10 -0
- package/dist/cjs/store/duckdb/lexical.js +502 -0
- package/dist/cjs/store/duckdb/lexical.js.map +1 -0
- package/dist/cjs/store/duckdb/native.d.cts +3 -0
- package/dist/cjs/store/duckdb/native.d.ts +3 -0
- package/dist/cjs/store/duckdb/native.js +360 -0
- package/dist/cjs/store/duckdb/native.js.map +1 -0
- package/dist/cjs/store/duckdb/open.d.cts +12 -0
- package/dist/cjs/store/duckdb/open.d.ts +12 -0
- package/dist/cjs/store/duckdb/open.js +501 -0
- package/dist/cjs/store/duckdb/open.js.map +1 -0
- package/dist/cjs/store/duckdb/reconcile.d.cts +6 -0
- package/dist/cjs/store/duckdb/reconcile.d.ts +6 -0
- package/dist/cjs/store/duckdb/reconcile.js +753 -0
- package/dist/cjs/store/duckdb/reconcile.js.map +1 -0
- package/dist/cjs/store/duckdb/sql-functions.d.cts +2 -0
- package/dist/cjs/store/duckdb/sql-functions.d.ts +2 -0
- package/dist/cjs/store/duckdb/sql-functions.js +203 -0
- package/dist/cjs/store/duckdb/sql-functions.js.map +1 -0
- package/dist/cjs/store/duckdb/store.d.cts +5 -0
- package/dist/cjs/store/duckdb/store.d.ts +5 -0
- package/dist/cjs/store/duckdb/store.js +504 -0
- package/dist/cjs/store/duckdb/store.js.map +1 -0
- package/dist/cjs/store/duckdb/vectors.d.cts +9 -0
- package/dist/cjs/store/duckdb/vectors.d.ts +9 -0
- package/dist/cjs/store/duckdb/vectors.js +502 -0
- package/dist/cjs/store/duckdb/vectors.js.map +1 -0
- package/dist/cjs/store/index.d.cts +7 -0
- package/dist/cjs/store/index.d.ts +7 -0
- package/dist/cjs/store/index.js +201 -0
- package/dist/cjs/store/index.js.map +1 -0
- package/dist/cjs/store/meta.d.cts +3 -0
- package/dist/cjs/store/meta.d.ts +3 -0
- package/dist/cjs/store/meta.js +215 -0
- package/dist/cjs/store/meta.js.map +1 -0
- package/dist/cjs/store/shared.d.cts +5 -0
- package/dist/cjs/store/shared.d.ts +5 -0
- package/dist/cjs/store/shared.js +252 -0
- package/dist/cjs/store/shared.js.map +1 -0
- package/dist/cjs/store/sql-functions.d.cts +2 -0
- package/dist/cjs/store/sql-functions.d.ts +2 -0
- package/dist/cjs/store/sql-functions.js +48 -0
- package/dist/cjs/store/sql-functions.js.map +1 -0
- package/dist/cjs/store/sqlite/connection.d.cts +3 -0
- package/dist/cjs/store/sqlite/connection.d.ts +3 -0
- package/dist/cjs/store/sqlite/connection.js +516 -0
- package/dist/cjs/store/sqlite/connection.js.map +1 -0
- package/dist/cjs/store/sqlite/lexical.d.cts +2 -0
- package/dist/cjs/store/sqlite/lexical.d.ts +2 -0
- package/dist/cjs/store/sqlite/lexical.js +177 -0
- package/dist/cjs/store/sqlite/lexical.js.map +1 -0
- package/dist/cjs/{db → store/sqlite}/open.d.cts +5 -5
- package/dist/cjs/{db → store/sqlite}/open.d.ts +5 -5
- package/dist/cjs/store/sqlite/open.js +604 -0
- package/dist/cjs/store/sqlite/open.js.map +1 -0
- package/dist/cjs/store/sqlite/reconcile.d.cts +10 -0
- package/dist/cjs/store/sqlite/reconcile.d.ts +10 -0
- package/dist/cjs/store/sqlite/reconcile.js +1020 -0
- package/dist/cjs/store/sqlite/reconcile.js.map +1 -0
- package/dist/cjs/store/sqlite/sql-functions.js +34 -0
- package/dist/cjs/store/sqlite/sql-functions.js.map +1 -0
- package/dist/cjs/store/sqlite/store.d.cts +5 -0
- package/dist/cjs/store/sqlite/store.d.ts +5 -0
- package/dist/cjs/store/sqlite/store.js +588 -0
- package/dist/cjs/store/sqlite/store.js.map +1 -0
- package/dist/cjs/store/sqlite/vectors.d.cts +13 -0
- package/dist/cjs/store/sqlite/vectors.d.ts +13 -0
- package/dist/cjs/store/sqlite/vectors.js +470 -0
- package/dist/cjs/store/sqlite/vectors.js.map +1 -0
- package/dist/cjs/store/transaction.d.cts +5 -0
- package/dist/cjs/store/transaction.d.ts +5 -0
- package/dist/cjs/store/transaction.js +297 -0
- package/dist/cjs/store/transaction.js.map +1 -0
- package/dist/cjs/store/types.d.cts +91 -0
- package/dist/cjs/store/types.d.ts +91 -0
- package/dist/cjs/store/types.js +15 -0
- package/dist/cjs/store/types.js.map +1 -0
- package/dist/cjs/watch.d.cts +3 -0
- package/dist/cjs/watch.d.ts +3 -0
- package/dist/cjs/watch.js +215 -73
- package/dist/cjs/watch.js.map +1 -1
- package/dist/esm/cli/map.js +5 -5
- package/dist/esm/cli/map.js.map +1 -1
- package/dist/esm/cli/named.js +3 -3
- package/dist/esm/cli/named.js.map +1 -1
- package/dist/esm/cli/path.js +6 -5
- package/dist/esm/cli/path.js.map +1 -1
- package/dist/esm/cli/peek.js +5 -5
- package/dist/esm/cli/peek.js.map +1 -1
- package/dist/esm/cli/related.js +3 -3
- package/dist/esm/cli/related.js.map +1 -1
- package/dist/esm/cli/search.js +2 -2
- package/dist/esm/cli/search.js.map +1 -1
- package/dist/esm/cli/shared.d.ts +3 -3
- package/dist/esm/cli/shared.js +17 -17
- package/dist/esm/cli/shared.js.map +1 -1
- package/dist/esm/cli/sql.js +2 -2
- package/dist/esm/cli/sql.js.map +1 -1
- package/dist/esm/cli/status.js +25 -24
- package/dist/esm/cli/status.js.map +1 -1
- package/dist/esm/commands/map.d.ts +2 -2
- package/dist/esm/commands/map.js +51 -41
- package/dist/esm/commands/map.js.map +1 -1
- package/dist/esm/commands/peek.d.ts +2 -2
- package/dist/esm/commands/peek.js +58 -50
- package/dist/esm/commands/peek.js.map +1 -1
- package/dist/esm/commands/related.d.ts +2 -2
- package/dist/esm/commands/related.js +9 -9
- package/dist/esm/commands/related.js.map +1 -1
- package/dist/esm/commands/scope.d.ts +7 -7
- package/dist/esm/commands/scope.js +28 -17
- package/dist/esm/commands/scope.js.map +1 -1
- package/dist/esm/commands/search.d.ts +2 -2
- package/dist/esm/commands/search.js +42 -35
- package/dist/esm/commands/search.js.map +1 -1
- package/dist/esm/commands/signals.d.ts +4 -10
- package/dist/esm/commands/signals.js +17 -13
- package/dist/esm/commands/signals.js.map +1 -1
- package/dist/esm/commands/status.d.ts +2 -2
- package/dist/esm/commands/status.js +13 -7
- package/dist/esm/commands/status.js.map +1 -1
- package/dist/esm/config/access.d.ts +1 -0
- package/dist/esm/config/access.js +5 -0
- package/dist/esm/config/access.js.map +1 -1
- package/dist/esm/config/index.d.ts +1 -1
- package/dist/esm/config/index.js +1 -1
- package/dist/esm/config/index.js.map +1 -1
- package/dist/esm/config/types.d.ts +1 -0
- package/dist/esm/config/types.js.map +1 -1
- package/dist/esm/config/validate.js +10 -1
- package/dist/esm/config/validate.js.map +1 -1
- package/dist/esm/embed/distribution.d.ts +4 -0
- package/dist/esm/embed/distribution.js +11 -0
- package/dist/esm/embed/distribution.js.map +1 -0
- package/dist/esm/embed/langfit.d.ts +2 -5
- package/dist/esm/embed/langfit.js +13 -13
- package/dist/esm/embed/langfit.js.map +1 -1
- package/dist/esm/embed/query.d.ts +6 -13
- package/dist/esm/embed/query.js +23 -84
- package/dist/esm/embed/query.js.map +1 -1
- package/dist/esm/embed/static.js +6 -1
- package/dist/esm/embed/static.js.map +1 -1
- package/dist/esm/embed/types.d.ts +1 -0
- package/dist/esm/embed/types.js +5 -3
- package/dist/esm/embed/types.js.map +1 -1
- package/dist/esm/errors.d.ts +1 -1
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/features/embed.js +22 -10
- package/dist/esm/features/embed.js.map +1 -1
- package/dist/esm/features/index.d.ts +1 -1
- package/dist/esm/features/index.js +1 -1
- package/dist/esm/features/index.js.map +1 -1
- package/dist/esm/features/links.d.ts +7 -2
- package/dist/esm/features/links.js +124 -97
- package/dist/esm/features/links.js.map +1 -1
- package/dist/esm/features/rank.js +15 -8
- package/dist/esm/features/rank.js.map +1 -1
- package/dist/esm/features/sections.js +20 -7
- package/dist/esm/features/sections.js.map +1 -1
- package/dist/esm/features/tags.js +19 -18
- package/dist/esm/features/tags.js.map +1 -1
- package/dist/esm/features/types.d.ts +9 -5
- package/dist/esm/features/types.js +1 -1
- package/dist/esm/features/types.js.map +1 -1
- package/dist/esm/graph/traverse.d.ts +2 -2
- package/dist/esm/graph/traverse.js +26 -23
- package/dist/esm/graph/traverse.js.map +1 -1
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/guarded-tick.d.ts +1 -0
- package/dist/esm/lib/guarded-tick.js +8 -0
- package/dist/esm/lib/guarded-tick.js.map +1 -0
- package/dist/esm/output/column-hint.d.ts +1 -2
- package/dist/esm/output/column-hint.js +3 -2
- package/dist/esm/output/column-hint.js.map +1 -1
- package/dist/esm/output/output.d.ts +2 -1
- package/dist/esm/output/output.js +27 -23
- package/dist/esm/output/output.js.map +1 -1
- package/dist/esm/scan/frontmatter.js +1 -1
- package/dist/esm/scan/frontmatter.js.map +1 -1
- package/dist/esm/scan/index.js +1 -1
- package/dist/esm/scan/index.js.map +1 -1
- package/dist/esm/scan/reparse.d.ts +10 -0
- package/dist/esm/scan/reparse.js +30 -0
- package/dist/esm/scan/reparse.js.map +1 -0
- package/dist/esm/store/duckdb/batch.d.ts +16 -0
- package/dist/esm/store/duckdb/batch.js +96 -0
- package/dist/esm/store/duckdb/batch.js.map +1 -0
- package/dist/esm/store/duckdb/connection.d.ts +5 -0
- package/dist/esm/store/duckdb/connection.js +97 -0
- package/dist/esm/store/duckdb/connection.js.map +1 -0
- package/dist/esm/store/duckdb/lexical.d.ts +10 -0
- package/dist/esm/store/duckdb/lexical.js +163 -0
- package/dist/esm/store/duckdb/lexical.js.map +1 -0
- package/dist/esm/store/duckdb/native.d.ts +3 -0
- package/dist/esm/store/duckdb/native.js +96 -0
- package/dist/esm/store/duckdb/native.js.map +1 -0
- package/dist/esm/store/duckdb/open.d.ts +12 -0
- package/dist/esm/store/duckdb/open.js +127 -0
- package/dist/esm/store/duckdb/open.js.map +1 -0
- package/dist/esm/store/duckdb/reconcile.d.ts +6 -0
- package/dist/esm/store/duckdb/reconcile.js +141 -0
- package/dist/esm/store/duckdb/reconcile.js.map +1 -0
- package/dist/esm/store/duckdb/sql-functions.d.ts +2 -0
- package/dist/esm/store/duckdb/sql-functions.js +56 -0
- package/dist/esm/store/duckdb/sql-functions.js.map +1 -0
- package/dist/esm/store/duckdb/store.d.ts +5 -0
- package/dist/esm/store/duckdb/store.js +104 -0
- package/dist/esm/store/duckdb/store.js.map +1 -0
- package/dist/esm/store/duckdb/vectors.d.ts +9 -0
- package/dist/esm/store/duckdb/vectors.js +171 -0
- package/dist/esm/store/duckdb/vectors.js.map +1 -0
- package/dist/esm/store/index.d.ts +7 -0
- package/dist/esm/store/index.js +35 -0
- package/dist/esm/store/index.js.map +1 -0
- package/dist/esm/store/meta.d.ts +3 -0
- package/dist/esm/store/meta.js +17 -0
- package/dist/esm/store/meta.js.map +1 -0
- package/dist/esm/store/shared.d.ts +5 -0
- package/dist/esm/store/shared.js +24 -0
- package/dist/esm/store/shared.js.map +1 -0
- package/dist/esm/store/sql-functions.d.ts +2 -0
- package/dist/esm/store/sql-functions.js +29 -0
- package/dist/esm/store/sql-functions.js.map +1 -0
- package/dist/esm/store/sqlite/connection.d.ts +3 -0
- package/dist/esm/store/sqlite/connection.js +50 -0
- package/dist/esm/store/sqlite/connection.js.map +1 -0
- package/dist/esm/store/sqlite/lexical.d.ts +2 -0
- package/dist/esm/store/sqlite/lexical.js +21 -0
- package/dist/esm/store/sqlite/lexical.js.map +1 -0
- package/dist/esm/{db → store/sqlite}/open.d.ts +5 -5
- package/dist/esm/store/sqlite/open.js +193 -0
- package/dist/esm/store/sqlite/open.js.map +1 -0
- package/dist/esm/store/sqlite/reconcile.d.ts +10 -0
- package/dist/esm/{db → store/sqlite}/reconcile.js +101 -99
- package/dist/esm/store/sqlite/reconcile.js.map +1 -0
- package/dist/esm/store/sqlite/sql-functions.js +23 -0
- package/dist/esm/store/sqlite/sql-functions.js.map +1 -0
- package/dist/esm/store/sqlite/store.d.ts +5 -0
- package/dist/esm/store/sqlite/store.js +82 -0
- package/dist/esm/store/sqlite/store.js.map +1 -0
- package/dist/esm/store/sqlite/vectors.d.ts +13 -0
- package/dist/esm/store/sqlite/vectors.js +90 -0
- package/dist/esm/store/sqlite/vectors.js.map +1 -0
- package/dist/esm/store/transaction.d.ts +5 -0
- package/dist/esm/store/transaction.js +57 -0
- package/dist/esm/store/transaction.js.map +1 -0
- package/dist/esm/store/types.d.ts +91 -0
- package/dist/esm/store/types.js +11 -0
- package/dist/esm/store/types.js.map +1 -0
- package/dist/esm/watch.d.ts +3 -0
- package/dist/esm/watch.js +39 -22
- package/dist/esm/watch.js.map +1 -1
- package/package.json +3 -1
- package/schema.json +5 -0
- package/skills/sense/EXAMPLES.md +3 -3
- package/skills/sense/SKILL.md +16 -14
- package/skills/sense-bases/EXAMPLES.md +2 -2
- package/skills/sense-bases/SKILL.md +6 -6
- package/skills/sense-setup/EXAMPLES.md +1 -1
- package/skills/sense-setup/SKILL.md +5 -4
- package/dist/cjs/db/index.d.cts +0 -4
- package/dist/cjs/db/index.d.ts +0 -4
- package/dist/cjs/db/index.js +0 -42
- package/dist/cjs/db/index.js.map +0 -1
- package/dist/cjs/db/open.js +0 -230
- package/dist/cjs/db/open.js.map +0 -1
- package/dist/cjs/db/reconcile.d.cts +0 -10
- package/dist/cjs/db/reconcile.d.ts +0 -10
- package/dist/cjs/db/reconcile.js +0 -579
- package/dist/cjs/db/reconcile.js.map +0 -1
- package/dist/cjs/db/shared.d.cts +0 -5
- package/dist/cjs/db/shared.d.ts +0 -5
- package/dist/cjs/db/shared.js +0 -45
- package/dist/cjs/db/shared.js.map +0 -1
- package/dist/cjs/db/sql-functions.js +0 -64
- package/dist/cjs/db/sql-functions.js.map +0 -1
- package/dist/esm/db/index.d.ts +0 -4
- package/dist/esm/db/index.js +0 -5
- package/dist/esm/db/index.js.map +0 -1
- package/dist/esm/db/open.js +0 -165
- package/dist/esm/db/open.js.map +0 -1
- package/dist/esm/db/reconcile.d.ts +0 -10
- package/dist/esm/db/reconcile.js.map +0 -1
- package/dist/esm/db/shared.d.ts +0 -5
- package/dist/esm/db/shared.js +0 -20
- package/dist/esm/db/shared.js.map +0 -1
- package/dist/esm/db/sql-functions.js +0 -47
- package/dist/esm/db/sql-functions.js.map +0 -1
- /package/dist/cjs/{db → store/sqlite}/sql-functions.d.cts +0 -0
- /package/dist/cjs/{db → store/sqlite}/sql-functions.d.ts +0 -0
- /package/dist/esm/{db → store/sqlite}/sql-functions.d.ts +0 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
// Store-agnostic joining transaction helper: node:sqlite and DuckDB both support only
|
|
2
|
+
// BEGIN/COMMIT/ROLLBACK, no SAVEPOINT -- nesting joins the outer transaction instead of
|
|
3
|
+
// stacking, so both stores share one semantics through the one thing they have in common,
|
|
4
|
+
// exec(sql).
|
|
5
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
Object.defineProperty(exports, "withTransaction", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return withTransaction;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
16
|
+
try {
|
|
17
|
+
var info = gen[key](arg);
|
|
18
|
+
var value = info.value;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
reject(error);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (info.done) resolve(value);
|
|
24
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
25
|
+
}
|
|
26
|
+
function _async_to_generator(fn) {
|
|
27
|
+
return function() {
|
|
28
|
+
var self = this, args = arguments;
|
|
29
|
+
return new Promise(function(resolve, reject) {
|
|
30
|
+
var gen = fn.apply(self, args);
|
|
31
|
+
function _next(value) {
|
|
32
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
33
|
+
}
|
|
34
|
+
function _throw(err) {
|
|
35
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
36
|
+
}
|
|
37
|
+
_next(undefined);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function _ts_generator(thisArg, body) {
|
|
42
|
+
var f, y, t, _ = {
|
|
43
|
+
label: 0,
|
|
44
|
+
sent: function() {
|
|
45
|
+
if (t[0] & 1) throw t[1];
|
|
46
|
+
return t[1];
|
|
47
|
+
},
|
|
48
|
+
trys: [],
|
|
49
|
+
ops: []
|
|
50
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
51
|
+
return d(g, "next", {
|
|
52
|
+
value: verb(0)
|
|
53
|
+
}), d(g, "throw", {
|
|
54
|
+
value: verb(1)
|
|
55
|
+
}), d(g, "return", {
|
|
56
|
+
value: verb(2)
|
|
57
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
58
|
+
value: function() {
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
}), g;
|
|
62
|
+
function verb(n) {
|
|
63
|
+
return function(v) {
|
|
64
|
+
return step([
|
|
65
|
+
n,
|
|
66
|
+
v
|
|
67
|
+
]);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function step(op) {
|
|
71
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
72
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
73
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
74
|
+
if (y = 0, t) op = [
|
|
75
|
+
op[0] & 2,
|
|
76
|
+
t.value
|
|
77
|
+
];
|
|
78
|
+
switch(op[0]){
|
|
79
|
+
case 0:
|
|
80
|
+
case 1:
|
|
81
|
+
t = op;
|
|
82
|
+
break;
|
|
83
|
+
case 4:
|
|
84
|
+
_.label++;
|
|
85
|
+
return {
|
|
86
|
+
value: op[1],
|
|
87
|
+
done: false
|
|
88
|
+
};
|
|
89
|
+
case 5:
|
|
90
|
+
_.label++;
|
|
91
|
+
y = op[1];
|
|
92
|
+
op = [
|
|
93
|
+
0
|
|
94
|
+
];
|
|
95
|
+
continue;
|
|
96
|
+
case 7:
|
|
97
|
+
op = _.ops.pop();
|
|
98
|
+
_.trys.pop();
|
|
99
|
+
continue;
|
|
100
|
+
default:
|
|
101
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
102
|
+
_ = 0;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
106
|
+
_.label = op[1];
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
110
|
+
_.label = t[1];
|
|
111
|
+
t = op;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
if (t && _.label < t[2]) {
|
|
115
|
+
_.label = t[2];
|
|
116
|
+
_.ops.push(op);
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
if (t[2]) _.ops.pop();
|
|
120
|
+
_.trys.pop();
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
op = body.call(thisArg, _);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
op = [
|
|
126
|
+
6,
|
|
127
|
+
e
|
|
128
|
+
];
|
|
129
|
+
y = 0;
|
|
130
|
+
} finally{
|
|
131
|
+
f = t = 0;
|
|
132
|
+
}
|
|
133
|
+
if (op[0] & 5) throw op[1];
|
|
134
|
+
return {
|
|
135
|
+
value: op[0] ? op[1] : void 0,
|
|
136
|
+
done: true
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Keyed by connection, not a module singleton: two connections can coexist in one process
|
|
141
|
+
// (e.g. watch.ts alongside a CLI query) and must not share depth.
|
|
142
|
+
var states = new WeakMap();
|
|
143
|
+
function stateFor(conn) {
|
|
144
|
+
var state = states.get(conn);
|
|
145
|
+
if (!state) {
|
|
146
|
+
state = {
|
|
147
|
+
depth: 0,
|
|
148
|
+
rollbackOnly: false
|
|
149
|
+
};
|
|
150
|
+
states.set(conn, state);
|
|
151
|
+
}
|
|
152
|
+
return state;
|
|
153
|
+
}
|
|
154
|
+
function enter(conn, state) {
|
|
155
|
+
return _async_to_generator(function() {
|
|
156
|
+
return _ts_generator(this, function(_state) {
|
|
157
|
+
switch(_state.label){
|
|
158
|
+
case 0:
|
|
159
|
+
if (!(state.depth === 0)) return [
|
|
160
|
+
3,
|
|
161
|
+
2
|
|
162
|
+
];
|
|
163
|
+
return [
|
|
164
|
+
4,
|
|
165
|
+
conn.exec('BEGIN')
|
|
166
|
+
];
|
|
167
|
+
case 1:
|
|
168
|
+
_state.sent();
|
|
169
|
+
state.rollbackOnly = false;
|
|
170
|
+
_state.label = 2;
|
|
171
|
+
case 2:
|
|
172
|
+
state.depth++;
|
|
173
|
+
return [
|
|
174
|
+
2
|
|
175
|
+
];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
})();
|
|
179
|
+
}
|
|
180
|
+
// Reaching depth 0 still rollback-only means an inner scope failed and an enclosing catch
|
|
181
|
+
// swallowed it; commit here would persist a partial write, so this rolls back and throws instead.
|
|
182
|
+
function leaveOk(conn, state) {
|
|
183
|
+
return _async_to_generator(function() {
|
|
184
|
+
return _ts_generator(this, function(_state) {
|
|
185
|
+
switch(_state.label){
|
|
186
|
+
case 0:
|
|
187
|
+
state.depth--;
|
|
188
|
+
if (state.depth > 0) return [
|
|
189
|
+
2
|
|
190
|
+
];
|
|
191
|
+
if (!state.rollbackOnly) return [
|
|
192
|
+
3,
|
|
193
|
+
2
|
|
194
|
+
];
|
|
195
|
+
return [
|
|
196
|
+
4,
|
|
197
|
+
conn.exec('ROLLBACK')
|
|
198
|
+
];
|
|
199
|
+
case 1:
|
|
200
|
+
_state.sent();
|
|
201
|
+
throw new Error('transaction rolled back: a nested scope failed');
|
|
202
|
+
case 2:
|
|
203
|
+
return [
|
|
204
|
+
4,
|
|
205
|
+
conn.exec('COMMIT')
|
|
206
|
+
];
|
|
207
|
+
case 3:
|
|
208
|
+
_state.sent();
|
|
209
|
+
return [
|
|
210
|
+
2
|
|
211
|
+
];
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
})();
|
|
215
|
+
}
|
|
216
|
+
function leaveErr(conn, state) {
|
|
217
|
+
return _async_to_generator(function() {
|
|
218
|
+
return _ts_generator(this, function(_state) {
|
|
219
|
+
switch(_state.label){
|
|
220
|
+
case 0:
|
|
221
|
+
state.rollbackOnly = true;
|
|
222
|
+
state.depth--;
|
|
223
|
+
if (!(state.depth === 0)) return [
|
|
224
|
+
3,
|
|
225
|
+
2
|
|
226
|
+
];
|
|
227
|
+
return [
|
|
228
|
+
4,
|
|
229
|
+
conn.exec('ROLLBACK')
|
|
230
|
+
];
|
|
231
|
+
case 1:
|
|
232
|
+
_state.sent();
|
|
233
|
+
_state.label = 2;
|
|
234
|
+
case 2:
|
|
235
|
+
return [
|
|
236
|
+
2
|
|
237
|
+
];
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
})();
|
|
241
|
+
}
|
|
242
|
+
function withTransaction(conn, fn) {
|
|
243
|
+
return _async_to_generator(function() {
|
|
244
|
+
var state, result, err;
|
|
245
|
+
return _ts_generator(this, function(_state) {
|
|
246
|
+
switch(_state.label){
|
|
247
|
+
case 0:
|
|
248
|
+
state = stateFor(conn);
|
|
249
|
+
return [
|
|
250
|
+
4,
|
|
251
|
+
enter(conn, state)
|
|
252
|
+
];
|
|
253
|
+
case 1:
|
|
254
|
+
_state.sent();
|
|
255
|
+
_state.label = 2;
|
|
256
|
+
case 2:
|
|
257
|
+
_state.trys.push([
|
|
258
|
+
2,
|
|
259
|
+
4,
|
|
260
|
+
,
|
|
261
|
+
6
|
|
262
|
+
]);
|
|
263
|
+
return [
|
|
264
|
+
4,
|
|
265
|
+
fn()
|
|
266
|
+
];
|
|
267
|
+
case 3:
|
|
268
|
+
result = _state.sent();
|
|
269
|
+
return [
|
|
270
|
+
3,
|
|
271
|
+
6
|
|
272
|
+
];
|
|
273
|
+
case 4:
|
|
274
|
+
err = _state.sent();
|
|
275
|
+
return [
|
|
276
|
+
4,
|
|
277
|
+
leaveErr(conn, state)
|
|
278
|
+
];
|
|
279
|
+
case 5:
|
|
280
|
+
_state.sent();
|
|
281
|
+
throw err;
|
|
282
|
+
case 6:
|
|
283
|
+
return [
|
|
284
|
+
4,
|
|
285
|
+
leaveOk(conn, state)
|
|
286
|
+
];
|
|
287
|
+
case 7:
|
|
288
|
+
_state.sent();
|
|
289
|
+
return [
|
|
290
|
+
2,
|
|
291
|
+
result
|
|
292
|
+
];
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
})();
|
|
296
|
+
}
|
|
297
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/store/transaction.ts"],"sourcesContent":["// Store-agnostic joining transaction helper: node:sqlite and DuckDB both support only\n// BEGIN/COMMIT/ROLLBACK, no SAVEPOINT -- nesting joins the outer transaction instead of\n// stacking, so both stores share one semantics through the one thing they have in common,\n// exec(sql).\ninterface ExecConnection {\n exec(sql: string): Promise<void>;\n}\n\ninterface TxState {\n depth: number;\n rollbackOnly: boolean;\n}\n\n// Keyed by connection, not a module singleton: two connections can coexist in one process\n// (e.g. watch.ts alongside a CLI query) and must not share depth.\nconst states = new WeakMap<ExecConnection, TxState>();\n\nfunction stateFor(conn: ExecConnection): TxState {\n let state = states.get(conn);\n if (!state) {\n state = { depth: 0, rollbackOnly: false };\n states.set(conn, state);\n }\n return state;\n}\n\nasync function enter(conn: ExecConnection, state: TxState): Promise<void> {\n if (state.depth === 0) {\n await conn.exec('BEGIN');\n state.rollbackOnly = false;\n }\n state.depth++;\n}\n\n// Reaching depth 0 still rollback-only means an inner scope failed and an enclosing catch\n// swallowed it; commit here would persist a partial write, so this rolls back and throws instead.\nasync function leaveOk(conn: ExecConnection, state: TxState): Promise<void> {\n state.depth--;\n if (state.depth > 0) return;\n if (state.rollbackOnly) {\n await conn.exec('ROLLBACK');\n throw new Error('transaction rolled back: a nested scope failed');\n }\n await conn.exec('COMMIT');\n}\n\nasync function leaveErr(conn: ExecConnection, state: TxState): Promise<void> {\n state.rollbackOnly = true;\n state.depth--;\n if (state.depth === 0) await conn.exec('ROLLBACK');\n}\n\n// Depth-0 opens BEGIN; a nested call joins it and issues no SQL of its own. The outermost call\n// owns COMMIT/ROLLBACK. Every store, and every internal write loop (reconcile, runBatch), goes\n// through this one helper, so join semantics never differ by call site.\nexport async function withTransaction<T>(conn: ExecConnection, fn: () => Promise<T>): Promise<T> {\n const state = stateFor(conn);\n await enter(conn, state);\n let result: T;\n try {\n result = await fn();\n } catch (err) {\n await leaveErr(conn, state);\n throw err;\n }\n await leaveOk(conn, state);\n return result;\n}\n"],"names":["withTransaction","states","WeakMap","stateFor","conn","state","get","depth","rollbackOnly","set","enter","exec","leaveOk","Error","leaveErr","fn","result","err"],"mappings":"AAAA,sFAAsF;AACtF,wFAAwF;AACxF,0FAA0F;AAC1F,aAAa;;;;;+BAoDSA;;;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA1CtB,0FAA0F;AAC1F,kEAAkE;AAClE,IAAMC,SAAS,IAAIC;AAEnB,SAASC,SAASC,IAAoB;IACpC,IAAIC,QAAQJ,OAAOK,GAAG,CAACF;IACvB,IAAI,CAACC,OAAO;QACVA,QAAQ;YAAEE,OAAO;YAAGC,cAAc;QAAM;QACxCP,OAAOQ,GAAG,CAACL,MAAMC;IACnB;IACA,OAAOA;AACT;AAEA,SAAeK,MAAMN,IAAoB,EAAEC,KAAc;;;;;yBACnDA,CAAAA,MAAME,KAAK,KAAK,CAAA,GAAhBF;;;;oBACF;;wBAAMD,KAAKO,IAAI,CAAC;;;oBAAhB;oBACAN,MAAMG,YAAY,GAAG;;;oBAEvBH,MAAME,KAAK;;;;;;IACb;;AAEA,0FAA0F;AAC1F,kGAAkG;AAClG,SAAeK,QAAQR,IAAoB,EAAEC,KAAc;;;;;oBACzDA,MAAME,KAAK;oBACX,IAAIF,MAAME,KAAK,GAAG,GAAG;;;yBACjBF,MAAMG,YAAY,EAAlBH;;;;oBACF;;wBAAMD,KAAKO,IAAI,CAAC;;;oBAAhB;oBACA,MAAM,IAAIE,MAAM;;oBAElB;;wBAAMT,KAAKO,IAAI,CAAC;;;oBAAhB;;;;;;IACF;;AAEA,SAAeG,SAASV,IAAoB,EAAEC,KAAc;;;;;oBAC1DA,MAAMG,YAAY,GAAG;oBACrBH,MAAME,KAAK;yBACPF,CAAAA,MAAME,KAAK,KAAK,CAAA,GAAhBF;;;;oBAAmB;;wBAAMD,KAAKO,IAAI,CAAC;;;oBAAhB;;;;;;;;IACzB;;AAKO,SAAeX,gBAAmBI,IAAoB,EAAEW,EAAoB;;YAC3EV,OAEFW,QAGKC;;;;oBALHZ,QAAQF,SAASC;oBACvB;;wBAAMM,MAAMN,MAAMC;;;oBAAlB;;;;;;;;;oBAGW;;wBAAMU;;;oBAAfC,SAAS;;;;;;oBACFC;oBACP;;wBAAMH,SAASV,MAAMC;;;oBAArB;oBACA,MAAMY;;oBAER;;wBAAML,QAAQR,MAAMC;;;oBAApB;oBACA;;wBAAOW;;;;IACT"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type Capability = 'phrases' | 'snippets' | 'watch-concurrency' | 'lexical' | 'vectors';
|
|
2
|
+
export interface RunResult {
|
|
3
|
+
changes: number | bigint;
|
|
4
|
+
lastInsertRowid: number | bigint;
|
|
5
|
+
}
|
|
6
|
+
export interface Statement {
|
|
7
|
+
run(...params: unknown[]): Promise<RunResult>;
|
|
8
|
+
get(...params: unknown[]): Promise<unknown>;
|
|
9
|
+
all(...params: unknown[]): Promise<unknown[]>;
|
|
10
|
+
iterate(...params: unknown[]): AsyncIterable<unknown>;
|
|
11
|
+
columns(): Array<{
|
|
12
|
+
name: string;
|
|
13
|
+
}>;
|
|
14
|
+
setReadBigInts(enabled: boolean): void;
|
|
15
|
+
}
|
|
16
|
+
export interface Connection {
|
|
17
|
+
exec(sql: string): Promise<void>;
|
|
18
|
+
prepare(sql: string): Promise<Statement>;
|
|
19
|
+
runBatch(sql: string, paramRows: unknown[][]): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export interface DocumentStore {
|
|
22
|
+
columns(): Promise<string[]>;
|
|
23
|
+
}
|
|
24
|
+
export interface LexicalHit {
|
|
25
|
+
path: string;
|
|
26
|
+
hit: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface LexicalQueryOptions {
|
|
29
|
+
whereJoin: string;
|
|
30
|
+
whereCond: string;
|
|
31
|
+
scopeCond: string;
|
|
32
|
+
limit: number;
|
|
33
|
+
}
|
|
34
|
+
export interface LexicalIndex {
|
|
35
|
+
query(terms: string, opts: LexicalQueryOptions): Promise<LexicalHit[]>;
|
|
36
|
+
}
|
|
37
|
+
export interface VectorCandidate {
|
|
38
|
+
path: string;
|
|
39
|
+
lines: string;
|
|
40
|
+
similarity: number;
|
|
41
|
+
}
|
|
42
|
+
export interface VectorSimilar {
|
|
43
|
+
path: string;
|
|
44
|
+
similarity: number;
|
|
45
|
+
}
|
|
46
|
+
export interface VectorWriteRow {
|
|
47
|
+
path: string;
|
|
48
|
+
chunk: number;
|
|
49
|
+
scale: number;
|
|
50
|
+
vector: Buffer;
|
|
51
|
+
}
|
|
52
|
+
export interface VectorStore {
|
|
53
|
+
pending(): Promise<Array<{
|
|
54
|
+
path: string;
|
|
55
|
+
chunk: number;
|
|
56
|
+
}>>;
|
|
57
|
+
writeVectors(rows: VectorWriteRow[]): Promise<void>;
|
|
58
|
+
candidates(queryVector: Float32Array, storeDims: number, fetch: number, allowed?: Set<string>): Promise<VectorCandidate[]>;
|
|
59
|
+
similar(path: string, opts: {
|
|
60
|
+
exclude: Set<string>;
|
|
61
|
+
allowed?: Set<string>;
|
|
62
|
+
k: number;
|
|
63
|
+
}): Promise<VectorSimilar[]>;
|
|
64
|
+
hasVector(path: string): Promise<boolean>;
|
|
65
|
+
}
|
|
66
|
+
export interface RawStatement {
|
|
67
|
+
columns(): Array<{
|
|
68
|
+
name: string;
|
|
69
|
+
}>;
|
|
70
|
+
iterate(...params: unknown[]): AsyncIterable<unknown>;
|
|
71
|
+
}
|
|
72
|
+
export interface SqlSession {
|
|
73
|
+
prepare(sql: string): Promise<RawStatement>;
|
|
74
|
+
}
|
|
75
|
+
export interface Store {
|
|
76
|
+
readonly name: 'sqlite' | 'duckdb';
|
|
77
|
+
readonly capabilities: ReadonlySet<Capability>;
|
|
78
|
+
exec(sql: string): Promise<void>;
|
|
79
|
+
prepare(sql: string): Promise<Statement>;
|
|
80
|
+
runBatch(sql: string, paramRows: unknown[][]): Promise<void>;
|
|
81
|
+
transaction<T>(fn: () => Promise<T>): Promise<T>;
|
|
82
|
+
reconcile(): Promise<{
|
|
83
|
+
parsed: number;
|
|
84
|
+
warnings: string[];
|
|
85
|
+
}>;
|
|
86
|
+
docs: DocumentStore;
|
|
87
|
+
lexical: LexicalIndex;
|
|
88
|
+
vectors: VectorStore;
|
|
89
|
+
raw: SqlSession;
|
|
90
|
+
close(): Promise<void>;
|
|
91
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type Capability = 'phrases' | 'snippets' | 'watch-concurrency' | 'lexical' | 'vectors';
|
|
2
|
+
export interface RunResult {
|
|
3
|
+
changes: number | bigint;
|
|
4
|
+
lastInsertRowid: number | bigint;
|
|
5
|
+
}
|
|
6
|
+
export interface Statement {
|
|
7
|
+
run(...params: unknown[]): Promise<RunResult>;
|
|
8
|
+
get(...params: unknown[]): Promise<unknown>;
|
|
9
|
+
all(...params: unknown[]): Promise<unknown[]>;
|
|
10
|
+
iterate(...params: unknown[]): AsyncIterable<unknown>;
|
|
11
|
+
columns(): Array<{
|
|
12
|
+
name: string;
|
|
13
|
+
}>;
|
|
14
|
+
setReadBigInts(enabled: boolean): void;
|
|
15
|
+
}
|
|
16
|
+
export interface Connection {
|
|
17
|
+
exec(sql: string): Promise<void>;
|
|
18
|
+
prepare(sql: string): Promise<Statement>;
|
|
19
|
+
runBatch(sql: string, paramRows: unknown[][]): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export interface DocumentStore {
|
|
22
|
+
columns(): Promise<string[]>;
|
|
23
|
+
}
|
|
24
|
+
export interface LexicalHit {
|
|
25
|
+
path: string;
|
|
26
|
+
hit: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface LexicalQueryOptions {
|
|
29
|
+
whereJoin: string;
|
|
30
|
+
whereCond: string;
|
|
31
|
+
scopeCond: string;
|
|
32
|
+
limit: number;
|
|
33
|
+
}
|
|
34
|
+
export interface LexicalIndex {
|
|
35
|
+
query(terms: string, opts: LexicalQueryOptions): Promise<LexicalHit[]>;
|
|
36
|
+
}
|
|
37
|
+
export interface VectorCandidate {
|
|
38
|
+
path: string;
|
|
39
|
+
lines: string;
|
|
40
|
+
similarity: number;
|
|
41
|
+
}
|
|
42
|
+
export interface VectorSimilar {
|
|
43
|
+
path: string;
|
|
44
|
+
similarity: number;
|
|
45
|
+
}
|
|
46
|
+
export interface VectorWriteRow {
|
|
47
|
+
path: string;
|
|
48
|
+
chunk: number;
|
|
49
|
+
scale: number;
|
|
50
|
+
vector: Buffer;
|
|
51
|
+
}
|
|
52
|
+
export interface VectorStore {
|
|
53
|
+
pending(): Promise<Array<{
|
|
54
|
+
path: string;
|
|
55
|
+
chunk: number;
|
|
56
|
+
}>>;
|
|
57
|
+
writeVectors(rows: VectorWriteRow[]): Promise<void>;
|
|
58
|
+
candidates(queryVector: Float32Array, storeDims: number, fetch: number, allowed?: Set<string>): Promise<VectorCandidate[]>;
|
|
59
|
+
similar(path: string, opts: {
|
|
60
|
+
exclude: Set<string>;
|
|
61
|
+
allowed?: Set<string>;
|
|
62
|
+
k: number;
|
|
63
|
+
}): Promise<VectorSimilar[]>;
|
|
64
|
+
hasVector(path: string): Promise<boolean>;
|
|
65
|
+
}
|
|
66
|
+
export interface RawStatement {
|
|
67
|
+
columns(): Array<{
|
|
68
|
+
name: string;
|
|
69
|
+
}>;
|
|
70
|
+
iterate(...params: unknown[]): AsyncIterable<unknown>;
|
|
71
|
+
}
|
|
72
|
+
export interface SqlSession {
|
|
73
|
+
prepare(sql: string): Promise<RawStatement>;
|
|
74
|
+
}
|
|
75
|
+
export interface Store {
|
|
76
|
+
readonly name: 'sqlite' | 'duckdb';
|
|
77
|
+
readonly capabilities: ReadonlySet<Capability>;
|
|
78
|
+
exec(sql: string): Promise<void>;
|
|
79
|
+
prepare(sql: string): Promise<Statement>;
|
|
80
|
+
runBatch(sql: string, paramRows: unknown[][]): Promise<void>;
|
|
81
|
+
transaction<T>(fn: () => Promise<T>): Promise<T>;
|
|
82
|
+
reconcile(): Promise<{
|
|
83
|
+
parsed: number;
|
|
84
|
+
warnings: string[];
|
|
85
|
+
}>;
|
|
86
|
+
docs: DocumentStore;
|
|
87
|
+
lexical: LexicalIndex;
|
|
88
|
+
vectors: VectorStore;
|
|
89
|
+
raw: SqlSession;
|
|
90
|
+
close(): Promise<void>;
|
|
91
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The backing-store interface: a minimal portable statement surface (exec/prepare, used as-is
|
|
2
|
+
// by feature-owned tables and ad hoc queries) plus dedicated interfaces exactly where engines
|
|
3
|
+
// diverge (lexical index, vector scan, raw sql passthrough).
|
|
4
|
+
// 'lexical'/'vectors' mean the store's LexicalIndex/VectorStore are functionally implemented
|
|
5
|
+
// (rather than present-but-inert); 'phrases'/'snippets'/'watch-concurrency' are the finer
|
|
6
|
+
// behaviors sqlite's FTS5 path carries. A tree whose config needs a capability the chosen
|
|
7
|
+
// store lacks fails at open (or at first use for a lazily-detected need), named.
|
|
8
|
+
// 'phrases' means quoted-phrase (`"..."`) matching only -- not FTS5's wider query grammar
|
|
9
|
+
// (prefix `*`, boolean AND/OR/NOT, NEAR, `^`, column filters), which duckdb's lexical path
|
|
10
|
+
// rejects loudly rather than interpret (see store/duckdb/lexical.ts).
|
|
11
|
+
"use strict";
|
|
12
|
+
Object.defineProperty(exports, "__esModule", {
|
|
13
|
+
value: true
|
|
14
|
+
});
|
|
15
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/store/types.ts"],"sourcesContent":["// The backing-store interface: a minimal portable statement surface (exec/prepare, used as-is\n// by feature-owned tables and ad hoc queries) plus dedicated interfaces exactly where engines\n// diverge (lexical index, vector scan, raw sql passthrough).\n\n// 'lexical'/'vectors' mean the store's LexicalIndex/VectorStore are functionally implemented\n// (rather than present-but-inert); 'phrases'/'snippets'/'watch-concurrency' are the finer\n// behaviors sqlite's FTS5 path carries. A tree whose config needs a capability the chosen\n// store lacks fails at open (or at first use for a lazily-detected need), named.\n// 'phrases' means quoted-phrase (`\"...\"`) matching only -- not FTS5's wider query grammar\n// (prefix `*`, boolean AND/OR/NOT, NEAR, `^`, column filters), which duckdb's lexical path\n// rejects loudly rather than interpret (see store/duckdb/lexical.ts).\nexport type Capability = 'phrases' | 'snippets' | 'watch-concurrency' | 'lexical' | 'vectors';\n\nexport interface RunResult {\n changes: number | bigint;\n lastInsertRowid: number | bigint;\n}\n\n// A prepared statement's async surface: every engine this store supports has to cross a real\n// async boundary for a query (DuckDB has no synchronous client at all), so run/get/all return\n// Promises. iterate() stays an async iterable for the same reason `sense sql` streams.\nexport interface Statement {\n run(...params: unknown[]): Promise<RunResult>;\n get(...params: unknown[]): Promise<unknown>;\n all(...params: unknown[]): Promise<unknown[]>;\n iterate(...params: unknown[]): AsyncIterable<unknown>;\n columns(): Array<{ name: string }>;\n setReadBigInts(enabled: boolean): void;\n}\n\n// Connection surface feature-owned SQL runs against inside a store's own hot loops (schema,\n// reconcile). Portable so a feature never imports an engine-specific client type. `runBatch`\n// is the one call a write loop goes through instead of preparing once and calling `run()` per\n// row itself: one crossing per loop, the engine's own bulk idiom underneath (see each store's\n// implementation for what that idiom is).\nexport interface Connection {\n exec(sql: string): Promise<void>;\n prepare(sql: string): Promise<Statement>;\n runBatch(sql: string, paramRows: unknown[][]): Promise<void>;\n}\n\nexport interface DocumentStore {\n // Frontmatter column names (including internal ones; callers filter).\n columns(): Promise<string[]>;\n}\n\nexport interface LexicalHit {\n path: string;\n hit: string | null;\n}\n\nexport interface LexicalQueryOptions {\n whereJoin: string;\n whereCond: string;\n scopeCond: string;\n limit: number;\n}\n\nexport interface LexicalIndex {\n // Ranked word-match query with excerpt, scoped by the caller-built SQL fragments (the same\n // fragments narrowByWhere/materializeScope produce elsewhere).\n query(terms: string, opts: LexicalQueryOptions): Promise<LexicalHit[]>;\n}\n\nexport interface VectorCandidate {\n path: string;\n lines: string;\n similarity: number;\n}\n\nexport interface VectorSimilar {\n path: string;\n similarity: number;\n}\n\nexport interface VectorWriteRow {\n path: string;\n chunk: number;\n scale: number;\n vector: Buffer;\n}\n\nexport interface VectorStore {\n // Rows whose vector is still NULL (never embedded, or added since).\n pending(): Promise<Array<{ path: string; chunk: number }>>;\n // One batch write per call (never per row) so a provider's embedding batch stays inside a\n // single store method.\n writeVectors(rows: VectorWriteRow[]): Promise<void>;\n candidates(queryVector: Float32Array, storeDims: number, fetch: number, allowed?: Set<string>): Promise<VectorCandidate[]>;\n similar(path: string, opts: { exclude: Set<string>; allowed?: Set<string>; k: number }): Promise<VectorSimilar[]>;\n hasVector(path: string): Promise<boolean>;\n}\n\n// The `sense sql` passthrough: string in, streamed rows out. Each store registers the same\n// sense-supplied functions and applies its own read-bigints/error-translation behavior.\nexport interface RawStatement {\n columns(): Array<{ name: string }>;\n iterate(...params: unknown[]): AsyncIterable<unknown>;\n}\n\nexport interface SqlSession {\n prepare(sql: string): Promise<RawStatement>;\n}\n\nexport interface Store {\n readonly name: 'sqlite' | 'duckdb';\n readonly capabilities: ReadonlySet<Capability>;\n exec(sql: string): Promise<void>;\n prepare(sql: string): Promise<Statement>;\n // One crossing, N rows: every external write loop (search's candidate insert, the graph\n // ring's temp-table writes, etc.) goes through this instead of looping over `run()` itself.\n // See Connection.runBatch -- same contract, same per-store implementation.\n runBatch(sql: string, paramRows: unknown[][]): Promise<void>;\n // Pins one snapshot across multi-statement reads; `map` and `peek` use it. A command whose\n // scope holds a network-bound write (search's embedding top-up) must stay outside it.\n // Nesting joins the enclosing transaction rather than opening a second one.\n transaction<T>(fn: () => Promise<T>): Promise<T>;\n // The whole file-sync pass (parse changed files, run every feature hook, resolve links,\n // recompute rank) behind one method: per-file iteration never crosses the async boundary.\n reconcile(): Promise<{ parsed: number; warnings: string[] }>;\n docs: DocumentStore;\n lexical: LexicalIndex;\n vectors: VectorStore;\n raw: SqlSession;\n close(): Promise<void>;\n}\n"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,8FAA8F;AAC9F,6DAA6D;AAE7D,6FAA6F;AAC7F,0FAA0F;AAC1F,0FAA0F;AAC1F,iFAAiF;AACjF,0FAA0F;AAC1F,2FAA2F;AAC3F,sEAAsE"}
|
package/dist/cjs/watch.d.cts
CHANGED
|
@@ -15,5 +15,8 @@ export type WatchEvent = {
|
|
|
15
15
|
export interface WatchOptions {
|
|
16
16
|
force?: boolean;
|
|
17
17
|
onEvent?: (event: WatchEvent) => void;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
debounceMs?: number;
|
|
20
|
+
heartbeatIntervalMs?: number;
|
|
18
21
|
}
|
|
19
22
|
export declare function runWatch(cfg: ResolvedConfig, opts?: WatchOptions): Promise<void>;
|
package/dist/cjs/watch.d.ts
CHANGED
|
@@ -15,5 +15,8 @@ export type WatchEvent = {
|
|
|
15
15
|
export interface WatchOptions {
|
|
16
16
|
force?: boolean;
|
|
17
17
|
onEvent?: (event: WatchEvent) => void;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
debounceMs?: number;
|
|
20
|
+
heartbeatIntervalMs?: number;
|
|
18
21
|
}
|
|
19
22
|
export declare function runWatch(cfg: ResolvedConfig, opts?: WatchOptions): Promise<void>;
|