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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import type { FeatureName, ResolvedConfig, SearchOverrides } from '../config/index.js';
|
|
3
2
|
import type { Row } from '../output/output.js';
|
|
3
|
+
import type { Store } from '../store/types.js';
|
|
4
4
|
export declare function resolveNote(paths: string[], arg: string): string;
|
|
5
5
|
export interface Peek {
|
|
6
6
|
path: string;
|
|
@@ -17,4 +17,4 @@ export interface Peek {
|
|
|
17
17
|
unresolvedTotal: number;
|
|
18
18
|
off: FeatureName[];
|
|
19
19
|
}
|
|
20
|
-
export declare function peek(
|
|
20
|
+
export declare function peek(store: Store, cfg: ResolvedConfig, pathArg: string, overrides?: SearchOverrides): Promise<Peek>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import type { FeatureName, ResolvedConfig, SearchOverrides } from '../config/index.js';
|
|
3
2
|
import type { Row } from '../output/output.js';
|
|
3
|
+
import type { Store } from '../store/types.js';
|
|
4
4
|
export declare function resolveNote(paths: string[], arg: string): string;
|
|
5
5
|
export interface Peek {
|
|
6
6
|
path: string;
|
|
@@ -17,4 +17,4 @@ export interface Peek {
|
|
|
17
17
|
unresolvedTotal: number;
|
|
18
18
|
off: FeatureName[];
|
|
19
19
|
}
|
|
20
|
-
export declare function peek(
|
|
20
|
+
export declare function peek(store: Store, cfg: ResolvedConfig, pathArg: string, overrides?: SearchOverrides): Promise<Peek>;
|
|
@@ -32,6 +32,32 @@ function _array_with_holes(arr) {
|
|
|
32
32
|
function _array_without_holes(arr) {
|
|
33
33
|
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
34
34
|
}
|
|
35
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
36
|
+
try {
|
|
37
|
+
var info = gen[key](arg);
|
|
38
|
+
var value = info.value;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
reject(error);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (info.done) resolve(value);
|
|
44
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
45
|
+
}
|
|
46
|
+
function _async_to_generator(fn) {
|
|
47
|
+
return function() {
|
|
48
|
+
var self = this, args = arguments;
|
|
49
|
+
return new Promise(function(resolve, reject) {
|
|
50
|
+
var gen = fn.apply(self, args);
|
|
51
|
+
function _next(value) {
|
|
52
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
53
|
+
}
|
|
54
|
+
function _throw(err) {
|
|
55
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
56
|
+
}
|
|
57
|
+
_next(undefined);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
}
|
|
35
61
|
function _interop_require_default(obj) {
|
|
36
62
|
return obj && obj.__esModule ? obj : {
|
|
37
63
|
default: obj
|
|
@@ -78,6 +104,105 @@ function _sliced_to_array(arr, i) {
|
|
|
78
104
|
function _to_consumable_array(arr) {
|
|
79
105
|
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
80
106
|
}
|
|
107
|
+
function _ts_generator(thisArg, body) {
|
|
108
|
+
var f, y, t, _ = {
|
|
109
|
+
label: 0,
|
|
110
|
+
sent: function() {
|
|
111
|
+
if (t[0] & 1) throw t[1];
|
|
112
|
+
return t[1];
|
|
113
|
+
},
|
|
114
|
+
trys: [],
|
|
115
|
+
ops: []
|
|
116
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
117
|
+
return d(g, "next", {
|
|
118
|
+
value: verb(0)
|
|
119
|
+
}), d(g, "throw", {
|
|
120
|
+
value: verb(1)
|
|
121
|
+
}), d(g, "return", {
|
|
122
|
+
value: verb(2)
|
|
123
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
124
|
+
value: function() {
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
}), g;
|
|
128
|
+
function verb(n) {
|
|
129
|
+
return function(v) {
|
|
130
|
+
return step([
|
|
131
|
+
n,
|
|
132
|
+
v
|
|
133
|
+
]);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function step(op) {
|
|
137
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
138
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
139
|
+
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;
|
|
140
|
+
if (y = 0, t) op = [
|
|
141
|
+
op[0] & 2,
|
|
142
|
+
t.value
|
|
143
|
+
];
|
|
144
|
+
switch(op[0]){
|
|
145
|
+
case 0:
|
|
146
|
+
case 1:
|
|
147
|
+
t = op;
|
|
148
|
+
break;
|
|
149
|
+
case 4:
|
|
150
|
+
_.label++;
|
|
151
|
+
return {
|
|
152
|
+
value: op[1],
|
|
153
|
+
done: false
|
|
154
|
+
};
|
|
155
|
+
case 5:
|
|
156
|
+
_.label++;
|
|
157
|
+
y = op[1];
|
|
158
|
+
op = [
|
|
159
|
+
0
|
|
160
|
+
];
|
|
161
|
+
continue;
|
|
162
|
+
case 7:
|
|
163
|
+
op = _.ops.pop();
|
|
164
|
+
_.trys.pop();
|
|
165
|
+
continue;
|
|
166
|
+
default:
|
|
167
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
168
|
+
_ = 0;
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
172
|
+
_.label = op[1];
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
176
|
+
_.label = t[1];
|
|
177
|
+
t = op;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
if (t && _.label < t[2]) {
|
|
181
|
+
_.label = t[2];
|
|
182
|
+
_.ops.push(op);
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
if (t[2]) _.ops.pop();
|
|
186
|
+
_.trys.pop();
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
op = body.call(thisArg, _);
|
|
190
|
+
} catch (e) {
|
|
191
|
+
op = [
|
|
192
|
+
6,
|
|
193
|
+
e
|
|
194
|
+
];
|
|
195
|
+
y = 0;
|
|
196
|
+
} finally{
|
|
197
|
+
f = t = 0;
|
|
198
|
+
}
|
|
199
|
+
if (op[0] & 5) throw op[1];
|
|
200
|
+
return {
|
|
201
|
+
value: op[0] ? op[1] : void 0,
|
|
202
|
+
done: true
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
81
206
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
82
207
|
if (!o) return;
|
|
83
208
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -100,85 +225,202 @@ function resolveNote(paths, arg) {
|
|
|
100
225
|
throw new _errorsts.SenseError('NOTE_NOT_FOUND', 'no note matches "'.concat(arg, '"'));
|
|
101
226
|
}
|
|
102
227
|
var PEEK_LIST_LIMIT = 20;
|
|
103
|
-
function peek(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
228
|
+
function peek(_0, _1, _2) {
|
|
229
|
+
return _async_to_generator(function(store, cfg, pathArg) {
|
|
230
|
+
var overrides;
|
|
231
|
+
var _arguments = arguments;
|
|
232
|
+
return _ts_generator(this, function(_state) {
|
|
233
|
+
overrides = _arguments.length > 3 && _arguments[3] !== void 0 ? _arguments[3] : {};
|
|
234
|
+
return [
|
|
235
|
+
2,
|
|
236
|
+
store.transaction(function() {
|
|
237
|
+
return _async_to_generator(function() {
|
|
238
|
+
var _row__parse_error, _row__size, _this, pathsStmt, paths, path, rowStmt, row, parseError, frontmatter, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, sectionsTotal, sections, outbound, backlinks, unresolved, backlinksTotal, out, body, byteTokens, tokens;
|
|
239
|
+
return _ts_generator(this, function(_state) {
|
|
240
|
+
switch(_state.label){
|
|
241
|
+
case 0:
|
|
242
|
+
return [
|
|
243
|
+
4,
|
|
244
|
+
store.prepare('SELECT "path" FROM frontmatter')
|
|
245
|
+
];
|
|
246
|
+
case 1:
|
|
247
|
+
pathsStmt = _state.sent();
|
|
248
|
+
return [
|
|
249
|
+
4,
|
|
250
|
+
pathsStmt.all()
|
|
251
|
+
];
|
|
252
|
+
case 2:
|
|
253
|
+
paths = _state.sent().map(function(r) {
|
|
254
|
+
return r.path;
|
|
255
|
+
});
|
|
256
|
+
path = resolveNote(paths, pathArg);
|
|
257
|
+
return [
|
|
258
|
+
4,
|
|
259
|
+
store.prepare('SELECT * FROM frontmatter WHERE "path" = ?')
|
|
260
|
+
];
|
|
261
|
+
case 3:
|
|
262
|
+
rowStmt = _state.sent();
|
|
263
|
+
return [
|
|
264
|
+
4,
|
|
265
|
+
rowStmt.get(path)
|
|
266
|
+
];
|
|
267
|
+
case 4:
|
|
268
|
+
row = _state.sent();
|
|
269
|
+
parseError = (_row__parse_error = row._parse_error) !== null && _row__parse_error !== void 0 ? _row__parse_error : null;
|
|
270
|
+
frontmatter = {};
|
|
271
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
272
|
+
try {
|
|
273
|
+
for(_iterator = Object.entries(row)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
274
|
+
_step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
275
|
+
if (!_scopets.INTERNAL_COLUMNS.has(key) && value !== null) frontmatter[key] = value;
|
|
276
|
+
}
|
|
277
|
+
} catch (err) {
|
|
278
|
+
_didIteratorError = true;
|
|
279
|
+
_iteratorError = err;
|
|
280
|
+
} finally{
|
|
281
|
+
try {
|
|
282
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
283
|
+
_iterator.return();
|
|
284
|
+
}
|
|
285
|
+
} finally{
|
|
286
|
+
if (_didIteratorError) {
|
|
287
|
+
throw _iteratorError;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
sectionsTotal = 0;
|
|
292
|
+
sections = [];
|
|
293
|
+
if (!(0, _indexts1.featureEnabled)(cfg, 'sections')) return [
|
|
294
|
+
3,
|
|
295
|
+
9
|
|
296
|
+
];
|
|
297
|
+
return [
|
|
298
|
+
4,
|
|
299
|
+
store.prepare('SELECT COUNT(*) AS n FROM sections WHERE "path" = ?')
|
|
300
|
+
];
|
|
301
|
+
case 5:
|
|
302
|
+
return [
|
|
303
|
+
4,
|
|
304
|
+
_state.sent().get(path)
|
|
305
|
+
];
|
|
306
|
+
case 6:
|
|
307
|
+
sectionsTotal = _state.sent().n;
|
|
308
|
+
return [
|
|
309
|
+
4,
|
|
310
|
+
store.prepare('SELECT level, heading, start_line, end_line, tokens FROM sections WHERE "path" = ? ORDER BY idx LIMIT ?')
|
|
311
|
+
];
|
|
312
|
+
case 7:
|
|
313
|
+
return [
|
|
314
|
+
4,
|
|
315
|
+
_state.sent().all(path, PEEK_LIST_LIMIT)
|
|
316
|
+
];
|
|
317
|
+
case 8:
|
|
318
|
+
sections = _state.sent();
|
|
319
|
+
_state.label = 9;
|
|
320
|
+
case 9:
|
|
321
|
+
outbound = [];
|
|
322
|
+
backlinks = [];
|
|
323
|
+
unresolved = [];
|
|
324
|
+
backlinksTotal = 0;
|
|
325
|
+
return [
|
|
326
|
+
4,
|
|
327
|
+
(0, _scopets.scopedPaths)(store, cfg, overrides)
|
|
328
|
+
];
|
|
329
|
+
case 10:
|
|
330
|
+
_state.sent(); // validates --preset/--where/--include/--exclude even though peek's own output isn't scope-filtered
|
|
331
|
+
if (!(0, _indexts1.featureEnabled)(cfg, 'links')) return [
|
|
332
|
+
3,
|
|
333
|
+
17
|
|
334
|
+
];
|
|
335
|
+
return [
|
|
336
|
+
4,
|
|
337
|
+
store.prepare('SELECT target, dst FROM links WHERE src = ? AND (dst IS NULL OR dst != src) ORDER BY target')
|
|
338
|
+
];
|
|
339
|
+
case 11:
|
|
340
|
+
return [
|
|
341
|
+
4,
|
|
342
|
+
_state.sent().all(path)
|
|
343
|
+
];
|
|
344
|
+
case 12:
|
|
345
|
+
out = _state.sent();
|
|
346
|
+
outbound = _to_consumable_array(new Set(out.filter(function(l) {
|
|
347
|
+
return l.dst !== null;
|
|
348
|
+
}).map(function(l) {
|
|
349
|
+
return l.dst;
|
|
350
|
+
})));
|
|
351
|
+
unresolved = out.filter(function(l) {
|
|
352
|
+
return l.dst === null;
|
|
353
|
+
}).map(function(l) {
|
|
354
|
+
return l.target;
|
|
355
|
+
});
|
|
356
|
+
return [
|
|
357
|
+
4,
|
|
358
|
+
store.prepare('SELECT COUNT(DISTINCT src) AS n FROM links WHERE dst = ? AND src != dst')
|
|
359
|
+
];
|
|
360
|
+
case 13:
|
|
361
|
+
return [
|
|
362
|
+
4,
|
|
363
|
+
_state.sent().get(path)
|
|
364
|
+
];
|
|
365
|
+
case 14:
|
|
366
|
+
backlinksTotal = _state.sent().n;
|
|
367
|
+
return [
|
|
368
|
+
4,
|
|
369
|
+
store.prepare('SELECT DISTINCT src FROM links WHERE dst = ? AND src != dst ORDER BY src LIMIT ?')
|
|
370
|
+
];
|
|
371
|
+
case 15:
|
|
372
|
+
return [
|
|
373
|
+
4,
|
|
374
|
+
_state.sent().all(path, PEEK_LIST_LIMIT)
|
|
375
|
+
];
|
|
376
|
+
case 16:
|
|
377
|
+
backlinks = _state.sent().map(function(r) {
|
|
378
|
+
return r.src;
|
|
379
|
+
});
|
|
380
|
+
_state.label = 17;
|
|
381
|
+
case 17:
|
|
382
|
+
return [
|
|
383
|
+
4,
|
|
384
|
+
store.prepare('SELECT text FROM content WHERE "path" = ?')
|
|
385
|
+
];
|
|
386
|
+
case 18:
|
|
387
|
+
return [
|
|
388
|
+
4,
|
|
389
|
+
_state.sent().get(path)
|
|
390
|
+
];
|
|
391
|
+
case 19:
|
|
392
|
+
body = (_this = _state.sent()) === null || _this === void 0 ? void 0 : _this.text;
|
|
393
|
+
byteTokens = Math.ceil(((_row__size = row._size) !== null && _row__size !== void 0 ? _row__size : 0) / 4);
|
|
394
|
+
tokens = body !== undefined ? Math.max(Math.ceil((0, _indexts.estimateTokens)(body)), byteTokens) : byteTokens;
|
|
395
|
+
return [
|
|
396
|
+
2,
|
|
397
|
+
{
|
|
398
|
+
path: path,
|
|
399
|
+
tokens: tokens,
|
|
400
|
+
frontmatter: frontmatter,
|
|
401
|
+
parseError: parseError,
|
|
402
|
+
sections: sections,
|
|
403
|
+
outbound: outbound.slice(0, PEEK_LIST_LIMIT),
|
|
404
|
+
backlinks: backlinks,
|
|
405
|
+
unresolved: unresolved.slice(0, PEEK_LIST_LIMIT),
|
|
406
|
+
sectionsTotal: sectionsTotal,
|
|
407
|
+
outboundTotal: outbound.length,
|
|
408
|
+
backlinksTotal: backlinksTotal,
|
|
409
|
+
unresolvedTotal: unresolved.length,
|
|
410
|
+
off: [
|
|
411
|
+
'sections',
|
|
412
|
+
'links'
|
|
413
|
+
].filter(function(name) {
|
|
414
|
+
return !(0, _indexts1.featureEnabled)(cfg, name);
|
|
415
|
+
})
|
|
416
|
+
}
|
|
417
|
+
];
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
})();
|
|
421
|
+
})
|
|
422
|
+
];
|
|
152
423
|
});
|
|
153
|
-
|
|
154
|
-
backlinks = db.prepare('SELECT DISTINCT src FROM links WHERE dst = ? AND src != dst ORDER BY src LIMIT ?').all(path, PEEK_LIST_LIMIT).map(function(r) {
|
|
155
|
-
return r.src;
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
// content.text is the stripped body already computed at reconcile time (no extra file read),
|
|
159
|
-
// floored by the byte/4 estimate so stripped-away syntax and frontmatter can't vanish from the price.
|
|
160
|
-
var body = (_db_prepare_get = db.prepare('SELECT text FROM content WHERE "path" = ?').get(path)) === null || _db_prepare_get === void 0 ? void 0 : _db_prepare_get.text;
|
|
161
|
-
var byteTokens = Math.ceil(((_row__size = row._size) !== null && _row__size !== void 0 ? _row__size : 0) / 4);
|
|
162
|
-
var tokens = body !== undefined ? Math.max(Math.ceil((0, _indexts.estimateTokens)(body)), byteTokens) : byteTokens;
|
|
163
|
-
return {
|
|
164
|
-
path: path,
|
|
165
|
-
tokens: tokens,
|
|
166
|
-
frontmatter: frontmatter,
|
|
167
|
-
parseError: parseError,
|
|
168
|
-
sections: sections,
|
|
169
|
-
outbound: outbound.slice(0, PEEK_LIST_LIMIT),
|
|
170
|
-
backlinks: backlinks,
|
|
171
|
-
unresolved: unresolved.slice(0, PEEK_LIST_LIMIT),
|
|
172
|
-
sectionsTotal: sectionsTotal,
|
|
173
|
-
outboundTotal: outbound.length,
|
|
174
|
-
backlinksTotal: backlinksTotal,
|
|
175
|
-
unresolvedTotal: unresolved.length,
|
|
176
|
-
off: [
|
|
177
|
-
'sections',
|
|
178
|
-
'links'
|
|
179
|
-
].filter(function(name) {
|
|
180
|
-
return !(0, _indexts1.featureEnabled)(cfg, name);
|
|
181
|
-
})
|
|
182
|
-
};
|
|
424
|
+
}).apply(this, arguments);
|
|
183
425
|
}
|
|
184
426
|
/* 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; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/commands/peek.ts"],"sourcesContent":["import posix from 'node:path/posix';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/commands/peek.ts"],"sourcesContent":["import posix from 'node:path/posix';\nimport { estimateTokens } from '../chunk/index.ts';\nimport type { FeatureName, ResolvedConfig, SearchOverrides } from '../config/index.ts';\nimport { featureEnabled } from '../config/index.ts';\nimport { SenseError } from '../errors.ts';\nimport type { Row } from '../output/output.ts';\nimport type { Store } from '../store/types.ts';\nimport { INTERNAL_COLUMNS, scopedPaths } from './scope.ts';\n\n// Note resolution shared by peek and path: an exact path, or a unique basename (case\n// insensitive, .md stripped).\nexport function resolveNote(paths: string[], arg: string): string {\n const exact = paths.find((p) => p === arg);\n if (exact) return exact;\n const base = posix.basename(arg).replace(/\\.md$/i, '').toLowerCase();\n const matches = paths.filter((p) => posix.basename(p).replace(/\\.md$/i, '').toLowerCase() === base);\n if (matches.length === 1) return matches[0];\n if (matches.length > 1) throw new SenseError('NOTE_AMBIGUOUS', `\"${arg}\" is ambiguous: ${matches.join(', ')}`);\n throw new SenseError('NOTE_NOT_FOUND', `no note matches \"${arg}\"`);\n}\n\nexport interface Peek {\n path: string;\n tokens: number;\n frontmatter: Row;\n // Set when the note's frontmatter was refused, so an empty frontmatter block reads as \"did\n // not parse\" rather than \"has none\". Same reason `_parse_error` sits in the row.\n parseError: string | null;\n sections: Row[];\n outbound: string[];\n backlinks: string[];\n unresolved: string[];\n // Totals before truncation: a hub can have thousands of backlinks (or a note thousands of\n // headings), and peek's whole point is bounded output. Query the sections/links tables\n // directly for the full list.\n sectionsTotal: number;\n outboundTotal: number;\n backlinksTotal: number;\n unresolvedTotal: number;\n // Bounded k-hop expansion beyond the immediate ring already shown by outbound/backlinks\n // (depth starts at 2).\n off: FeatureName[]; // disabled features whose blocks are omitted (not empty)\n}\n\nconst PEEK_LIST_LIMIT = 20;\n\n// peek: everything about one note except its prose -- frontmatter, outline with line\n// ranges + token estimates (so the follow-up Read is a range, not the file), links both ways.\nexport async function peek(store: Store, cfg: ResolvedConfig, pathArg: string, overrides: SearchOverrides = {}): Promise<Peek> {\n return store.transaction(async () => {\n const pathsStmt = await store.prepare('SELECT \"path\" FROM frontmatter');\n const paths = ((await pathsStmt.all()) as Array<{ path: string }>).map((r) => r.path);\n const path = resolveNote(paths, pathArg);\n\n const rowStmt = await store.prepare('SELECT * FROM frontmatter WHERE \"path\" = ?');\n const row = (await rowStmt.get(path)) as Row;\n const parseError = (row._parse_error as string | null) ?? null;\n const frontmatter: Row = {};\n for (const [key, value] of Object.entries(row)) {\n if (!INTERNAL_COLUMNS.has(key) && value !== null) frontmatter[key] = value;\n }\n\n let sectionsTotal = 0;\n let sections: Row[] = [];\n if (featureEnabled(cfg, 'sections')) {\n sectionsTotal = ((await (await store.prepare('SELECT COUNT(*) AS n FROM sections WHERE \"path\" = ?')).get(path)) as { n: number }).n;\n sections = (await (await store.prepare('SELECT level, heading, start_line, end_line, tokens FROM sections WHERE \"path\" = ? ORDER BY idx LIMIT ?')).all(path, PEEK_LIST_LIMIT)) as Row[];\n }\n\n let outbound: string[] = [];\n let backlinks: string[] = [];\n let unresolved: string[] = [];\n let backlinksTotal = 0;\n await scopedPaths(store, cfg, overrides); // validates --preset/--where/--include/--exclude even though peek's own output isn't scope-filtered\n if (featureEnabled(cfg, 'links')) {\n const out = (await (await store.prepare('SELECT target, dst FROM links WHERE src = ? AND (dst IS NULL OR dst != src) ORDER BY target')).all(path)) as Array<{ target: string; dst: string | null }>;\n outbound = [...new Set(out.filter((l) => l.dst !== null).map((l) => l.dst as string))];\n unresolved = out.filter((l) => l.dst === null).map((l) => l.target);\n backlinksTotal = ((await (await store.prepare('SELECT COUNT(DISTINCT src) AS n FROM links WHERE dst = ? AND src != dst')).get(path)) as { n: number }).n;\n backlinks = ((await (await store.prepare('SELECT DISTINCT src FROM links WHERE dst = ? AND src != dst ORDER BY src LIMIT ?')).all(path, PEEK_LIST_LIMIT)) as Array<{ src: string }>).map((r) => r.src);\n }\n\n // content.text is the stripped body already computed at reconcile time (no extra file read),\n // floored by the byte/4 estimate so stripped-away syntax and frontmatter can't vanish from the price.\n const body = ((await (await store.prepare('SELECT text FROM content WHERE \"path\" = ?')).get(path)) as { text: string } | undefined)?.text;\n const byteTokens = Math.ceil(((row._size as number) ?? 0) / 4);\n const tokens = body !== undefined ? Math.max(Math.ceil(estimateTokens(body)), byteTokens) : byteTokens;\n\n return {\n path,\n tokens,\n frontmatter,\n parseError,\n sections,\n outbound: outbound.slice(0, PEEK_LIST_LIMIT),\n backlinks,\n unresolved: unresolved.slice(0, PEEK_LIST_LIMIT),\n sectionsTotal,\n outboundTotal: outbound.length,\n backlinksTotal,\n unresolvedTotal: unresolved.length,\n off: (['sections', 'links'] as FeatureName[]).filter((name) => !featureEnabled(cfg, name)),\n };\n });\n}\n"],"names":["peek","resolveNote","paths","arg","exact","find","p","base","posix","basename","replace","toLowerCase","matches","filter","length","SenseError","join","PEEK_LIST_LIMIT","store","cfg","pathArg","overrides","transaction","row","pathsStmt","path","rowStmt","parseError","frontmatter","key","value","sectionsTotal","sections","outbound","backlinks","unresolved","backlinksTotal","out","body","byteTokens","tokens","prepare","all","map","r","get","_parse_error","Object","entries","INTERNAL_COLUMNS","has","featureEnabled","n","scopedPaths","Set","l","dst","target","src","text","Math","ceil","_size","undefined","max","estimateTokens","slice","outboundTotal","unresolvedTotal","off","name"],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import type { ResolvedConfig, SearchOverrides } from '../config/index.js';
|
|
3
|
-
|
|
2
|
+
import type { Store } from '../store/types.js';
|
|
3
|
+
export declare function relatedNotes(store: Store, cfg: ResolvedConfig, pathArg: string, overrides: SearchOverrides, k: number): Promise<Array<{
|
|
4
4
|
path: string;
|
|
5
5
|
similarity: number;
|
|
6
6
|
}>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import type { ResolvedConfig, SearchOverrides } from '../config/index.js';
|
|
3
|
-
|
|
2
|
+
import type { Store } from '../store/types.js';
|
|
3
|
+
export declare function relatedNotes(store: Store, cfg: ResolvedConfig, pathArg: string, overrides: SearchOverrides, k: number): Promise<Array<{
|
|
4
4
|
path: string;
|
|
5
5
|
similarity: number;
|
|
6
6
|
}>>;
|
|
@@ -166,20 +166,50 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
166
166
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
167
167
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
168
168
|
}
|
|
169
|
-
function relatedNotes(
|
|
169
|
+
function relatedNotes(store, cfg, pathArg, overrides, k) {
|
|
170
170
|
return _async_to_generator(function() {
|
|
171
171
|
var paths, path, outbound, backlinks, exclude, effective, e, allowed;
|
|
172
172
|
return _ts_generator(this, function(_state) {
|
|
173
173
|
switch(_state.label){
|
|
174
174
|
case 0:
|
|
175
|
-
|
|
175
|
+
return [
|
|
176
|
+
4,
|
|
177
|
+
store.prepare('SELECT "path" FROM frontmatter')
|
|
178
|
+
];
|
|
179
|
+
case 1:
|
|
180
|
+
return [
|
|
181
|
+
4,
|
|
182
|
+
_state.sent().all()
|
|
183
|
+
];
|
|
184
|
+
case 2:
|
|
185
|
+
paths = _state.sent().map(function(r) {
|
|
176
186
|
return r.path;
|
|
177
187
|
});
|
|
178
188
|
path = (0, _peekts.resolveNote)(paths, pathArg);
|
|
179
|
-
|
|
189
|
+
return [
|
|
190
|
+
4,
|
|
191
|
+
store.prepare('SELECT DISTINCT dst FROM links WHERE src = ? AND dst IS NOT NULL AND dst != src')
|
|
192
|
+
];
|
|
193
|
+
case 3:
|
|
194
|
+
return [
|
|
195
|
+
4,
|
|
196
|
+
_state.sent().all(path)
|
|
197
|
+
];
|
|
198
|
+
case 4:
|
|
199
|
+
outbound = _state.sent().map(function(r) {
|
|
180
200
|
return r.dst;
|
|
181
201
|
});
|
|
182
|
-
|
|
202
|
+
return [
|
|
203
|
+
4,
|
|
204
|
+
store.prepare('SELECT DISTINCT src FROM links WHERE dst = ? AND src != dst')
|
|
205
|
+
];
|
|
206
|
+
case 5:
|
|
207
|
+
return [
|
|
208
|
+
4,
|
|
209
|
+
_state.sent().all(path)
|
|
210
|
+
];
|
|
211
|
+
case 6:
|
|
212
|
+
backlinks = _state.sent().map(function(r) {
|
|
183
213
|
return r.src;
|
|
184
214
|
});
|
|
185
215
|
exclude = new Set([
|
|
@@ -204,25 +234,40 @@ function relatedNotes(db, cfg, pathArg, overrides, k) {
|
|
|
204
234
|
if ((0, _storets.localModelMissing)(e)) {
|
|
205
235
|
throw new _errorsts.SenseError('EMBED_MODEL_MISSING', 'related ranks notes by meaning, so it needs the embedding model, but the local model path "'.concat(e.model, '" is missing ').concat(_storets.MODEL_FILENAMES, "; point embed.model at a directory containing them (search still works without it, on words and links)"));
|
|
206
236
|
}
|
|
207
|
-
|
|
237
|
+
return [
|
|
238
|
+
4,
|
|
239
|
+
(0, _scopets.scopedPaths)(store, cfg, overrides)
|
|
240
|
+
];
|
|
241
|
+
case 7:
|
|
242
|
+
allowed = _state.sent();
|
|
208
243
|
// Top up pending rows before the seed check, or a fresh index reports every note as
|
|
209
244
|
// having no indexed text until some search has run.
|
|
210
245
|
return [
|
|
211
246
|
4,
|
|
212
|
-
(0, _queryts.embedPending)(
|
|
247
|
+
(0, _queryts.embedPending)(store, cfg, cfg.baseDir)
|
|
213
248
|
];
|
|
214
|
-
case
|
|
249
|
+
case 8:
|
|
215
250
|
_state.sent();
|
|
216
|
-
|
|
251
|
+
return [
|
|
252
|
+
4,
|
|
253
|
+
(0, _queryts.hasEmbedding)(store, path)
|
|
254
|
+
];
|
|
255
|
+
case 9:
|
|
256
|
+
if (!_state.sent()) {
|
|
217
257
|
throw new _errorsts.SenseError('NOTE_NOT_EMBEDDED', "".concat(path, " has no indexed text to compare -- a note that is frontmatter only, or empty, has nothing to rank by meaning"));
|
|
218
258
|
}
|
|
219
|
-
|
|
259
|
+
return [
|
|
260
|
+
4,
|
|
261
|
+
(0, _scopets.scopeHasEmbeddings)(store, cfg, allowed)
|
|
262
|
+
];
|
|
263
|
+
case 10:
|
|
264
|
+
if (!_state.sent()) return [
|
|
220
265
|
2,
|
|
221
266
|
[]
|
|
222
267
|
];
|
|
223
268
|
return [
|
|
224
269
|
2,
|
|
225
|
-
(0, _queryts.similarNotes)(
|
|
270
|
+
(0, _queryts.similarNotes)(store, cfg, path, {
|
|
226
271
|
exclude: exclude,
|
|
227
272
|
allowed: allowed,
|
|
228
273
|
k: k
|