sensemaking 0.12.2 → 0.13.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/dist/cjs/cli/download.js +4 -4
- package/dist/cjs/cli/download.js.map +1 -1
- package/dist/cjs/cli/init.js +4 -4
- package/dist/cjs/cli/init.js.map +1 -1
- package/dist/cjs/cli/map.js +4 -4
- package/dist/cjs/cli/map.js.map +1 -1
- package/dist/cjs/cli/named.js +2 -2
- package/dist/cjs/cli/named.js.map +1 -1
- package/dist/cjs/cli/path.js +6 -6
- package/dist/cjs/cli/path.js.map +1 -1
- package/dist/cjs/cli/peek.js +4 -4
- package/dist/cjs/cli/peek.js.map +1 -1
- package/dist/cjs/cli/related.js +4 -4
- package/dist/cjs/cli/related.js.map +1 -1
- package/dist/cjs/cli/search.js +4 -4
- package/dist/cjs/cli/search.js.map +1 -1
- package/dist/cjs/cli/shared.d.cts +2 -2
- package/dist/cjs/cli/shared.d.ts +2 -2
- package/dist/cjs/cli/shared.js +5 -5
- package/dist/cjs/cli/shared.js.map +1 -1
- package/dist/cjs/cli/status.js +16 -16
- package/dist/cjs/cli/status.js.map +1 -1
- package/dist/cjs/cli/types.d.cts +1 -1
- package/dist/cjs/cli/types.d.ts +1 -1
- package/dist/cjs/cli.js +3 -3
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/commands/index.d.cts +10 -0
- package/dist/cjs/commands/index.d.ts +10 -0
- package/dist/cjs/commands/index.js +42 -0
- package/dist/cjs/commands/index.js.map +1 -0
- package/dist/cjs/commands/map.d.cts +21 -0
- package/dist/cjs/commands/map.d.ts +21 -0
- package/dist/cjs/commands/map.js +90 -0
- package/dist/cjs/commands/map.js.map +1 -0
- package/dist/cjs/commands/peek.d.cts +20 -0
- package/dist/cjs/commands/peek.d.ts +20 -0
- package/dist/cjs/commands/peek.js +175 -0
- package/dist/cjs/commands/peek.js.map +1 -0
- package/dist/cjs/commands/related.d.cts +6 -0
- package/dist/cjs/commands/related.d.ts +6 -0
- package/dist/cjs/commands/related.js +232 -0
- package/dist/cjs/commands/related.js.map +1 -0
- package/dist/cjs/commands/scope.d.cts +10 -0
- package/dist/cjs/commands/scope.d.ts +10 -0
- package/dist/cjs/commands/scope.js +124 -0
- package/dist/cjs/commands/scope.js.map +1 -0
- package/dist/cjs/commands/search.d.cts +12 -0
- package/dist/cjs/commands/search.d.ts +12 -0
- package/dist/cjs/{commands.js → commands/search.js} +20 -358
- package/dist/cjs/commands/search.js.map +1 -0
- package/dist/cjs/commands/status.d.cts +9 -0
- package/dist/cjs/commands/status.d.ts +9 -0
- package/dist/cjs/commands/status.js +25 -0
- package/dist/cjs/commands/status.js.map +1 -0
- package/dist/cjs/config/access.d.cts +19 -0
- package/dist/cjs/config/access.d.ts +19 -0
- package/dist/cjs/config/access.js +149 -0
- package/dist/cjs/config/access.js.map +1 -0
- package/dist/cjs/config/index.d.cts +5 -0
- package/dist/cjs/config/index.d.ts +5 -0
- package/dist/cjs/config/index.js +77 -0
- package/dist/cjs/config/index.js.map +1 -0
- package/dist/cjs/config/load.d.cts +8 -0
- package/dist/cjs/config/load.d.ts +8 -0
- package/dist/cjs/config/load.js +448 -0
- package/dist/cjs/config/load.js.map +1 -0
- package/dist/cjs/config/resolve.d.cts +6 -0
- package/dist/cjs/config/resolve.d.ts +6 -0
- package/dist/cjs/config/resolve.js +50 -0
- package/dist/cjs/config/resolve.js.map +1 -0
- package/dist/{esm/config.d.ts → cjs/config/types.d.cts} +2 -32
- package/dist/cjs/{config.d.cts → config/types.d.ts} +2 -32
- package/dist/cjs/config/types.js +39 -0
- package/dist/cjs/config/types.js.map +1 -0
- package/dist/cjs/config/validate.d.cts +4 -0
- package/dist/cjs/config/validate.d.ts +4 -0
- package/dist/cjs/config/validate.js +363 -0
- package/dist/cjs/config/validate.js.map +1 -0
- package/dist/cjs/db/index.d.cts +4 -0
- package/dist/cjs/db/index.d.ts +4 -0
- package/dist/cjs/db/index.js +42 -0
- package/dist/cjs/db/index.js.map +1 -0
- package/dist/cjs/{db.d.cts → db/open.d.cts} +2 -8
- package/dist/cjs/{db.d.ts → db/open.d.ts} +2 -8
- package/dist/cjs/db/open.js +223 -0
- package/dist/cjs/db/open.js.map +1 -0
- package/dist/cjs/db/reconcile.d.cts +9 -0
- package/dist/cjs/db/reconcile.d.ts +9 -0
- package/dist/cjs/{db.js → db/reconcile.js} +24 -261
- package/dist/cjs/db/reconcile.js.map +1 -0
- package/dist/cjs/db/shared.d.cts +5 -0
- package/dist/cjs/db/shared.d.ts +5 -0
- package/dist/cjs/db/shared.js +45 -0
- package/dist/cjs/db/shared.js.map +1 -0
- package/dist/cjs/features/embed.d.cts +1 -1
- package/dist/cjs/features/embed.d.ts +1 -1
- package/dist/cjs/features/embed.js +4 -3
- 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 +4 -2
- package/dist/cjs/features/index.js.map +1 -1
- package/dist/cjs/features/links.js +38 -20
- package/dist/cjs/features/links.js.map +1 -1
- package/dist/cjs/features/tags.d.cts +2 -0
- package/dist/cjs/features/tags.d.ts +2 -0
- package/dist/cjs/features/tags.js +188 -0
- package/dist/cjs/features/tags.js.map +1 -0
- package/dist/cjs/features/types.d.cts +2 -2
- package/dist/cjs/features/types.d.ts +2 -2
- package/dist/cjs/index.d.cts +6 -6
- package/dist/cjs/index.d.ts +6 -6
- package/dist/cjs/index.js +15 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/scan.d.cts +3 -1
- package/dist/cjs/scan.d.ts +3 -1
- package/dist/cjs/scan.js +9 -6
- package/dist/cjs/scan.js.map +1 -1
- package/dist/cjs/sql-functions.d.cts +2 -0
- package/dist/cjs/sql-functions.d.ts +2 -0
- package/dist/cjs/sql-functions.js +64 -0
- package/dist/cjs/sql-functions.js.map +1 -0
- package/dist/cjs/watch.d.cts +1 -1
- package/dist/cjs/watch.d.ts +1 -1
- package/dist/cjs/watch.js +12 -12
- package/dist/cjs/watch.js.map +1 -1
- package/dist/esm/cli/download.js +1 -1
- package/dist/esm/cli/download.js.map +1 -1
- package/dist/esm/cli/init.js +1 -1
- package/dist/esm/cli/init.js.map +1 -1
- package/dist/esm/cli/map.js +1 -1
- package/dist/esm/cli/map.js.map +1 -1
- package/dist/esm/cli/named.js +1 -1
- package/dist/esm/cli/named.js.map +1 -1
- package/dist/esm/cli/path.js +1 -1
- package/dist/esm/cli/path.js.map +1 -1
- package/dist/esm/cli/peek.js +1 -1
- package/dist/esm/cli/peek.js.map +1 -1
- package/dist/esm/cli/related.js +1 -1
- package/dist/esm/cli/related.js.map +1 -1
- package/dist/esm/cli/search.js +1 -1
- package/dist/esm/cli/search.js.map +1 -1
- package/dist/esm/cli/shared.d.ts +2 -2
- package/dist/esm/cli/shared.js +2 -2
- package/dist/esm/cli/shared.js.map +1 -1
- package/dist/esm/cli/status.js +3 -3
- package/dist/esm/cli/status.js.map +1 -1
- package/dist/esm/cli/types.d.ts +1 -1
- package/dist/esm/cli/types.js.map +1 -1
- package/dist/esm/cli.js +1 -1
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/commands/index.d.ts +10 -0
- package/dist/esm/commands/index.js +8 -0
- package/dist/esm/commands/index.js.map +1 -0
- package/dist/esm/commands/map.d.ts +21 -0
- package/dist/esm/commands/map.js +56 -0
- package/dist/esm/commands/map.js.map +1 -0
- package/dist/esm/commands/peek.d.ts +20 -0
- package/dist/esm/commands/peek.js +63 -0
- package/dist/esm/commands/peek.js.map +1 -0
- package/dist/esm/commands/related.d.ts +6 -0
- package/dist/esm/commands/related.js +47 -0
- package/dist/esm/commands/related.js.map +1 -0
- package/dist/esm/commands/scope.d.ts +10 -0
- package/dist/esm/commands/scope.js +60 -0
- package/dist/esm/commands/scope.js.map +1 -0
- package/dist/esm/commands/search.d.ts +12 -0
- package/dist/esm/commands/search.js +258 -0
- package/dist/esm/commands/search.js.map +1 -0
- package/dist/esm/commands/status.d.ts +9 -0
- package/dist/esm/commands/status.js +16 -0
- package/dist/esm/commands/status.js.map +1 -0
- package/dist/esm/config/access.d.ts +19 -0
- package/dist/esm/config/access.js +89 -0
- package/dist/esm/config/access.js.map +1 -0
- package/dist/esm/config/index.d.ts +5 -0
- package/dist/esm/config/index.js +4 -0
- package/dist/esm/config/index.js.map +1 -0
- package/dist/esm/config/load.d.ts +8 -0
- package/dist/esm/config/load.js +242 -0
- package/dist/esm/config/load.js.map +1 -0
- package/dist/esm/config/resolve.d.ts +6 -0
- package/dist/esm/config/resolve.js +35 -0
- package/dist/esm/config/resolve.js.map +1 -0
- package/dist/{cjs/config.d.ts → esm/config/types.d.ts} +2 -32
- package/dist/esm/config/types.js +15 -0
- package/dist/esm/config/types.js.map +1 -0
- package/dist/esm/config/validate.d.ts +4 -0
- package/dist/esm/config/validate.js +226 -0
- package/dist/esm/config/validate.js.map +1 -0
- package/dist/esm/db/index.d.ts +4 -0
- package/dist/esm/db/index.js +5 -0
- package/dist/esm/db/index.js.map +1 -0
- package/dist/esm/{db.d.ts → db/open.d.ts} +2 -8
- package/dist/esm/db/open.js +160 -0
- package/dist/esm/db/open.js.map +1 -0
- package/dist/esm/db/reconcile.d.ts +9 -0
- package/dist/esm/{db.js → db/reconcile.js} +12 -216
- package/dist/esm/db/reconcile.js.map +1 -0
- package/dist/esm/db/shared.d.ts +5 -0
- package/dist/esm/db/shared.js +20 -0
- package/dist/esm/db/shared.js.map +1 -0
- package/dist/esm/features/embed.d.ts +1 -1
- package/dist/esm/features/embed.js +2 -1
- package/dist/esm/features/embed.js.map +1 -1
- package/dist/esm/features/index.d.ts +1 -1
- package/dist/esm/features/index.js +3 -1
- package/dist/esm/features/index.js.map +1 -1
- package/dist/esm/features/links.js +36 -21
- package/dist/esm/features/links.js.map +1 -1
- package/dist/esm/features/tags.d.ts +2 -0
- package/dist/esm/features/tags.js +80 -0
- package/dist/esm/features/tags.js.map +1 -0
- package/dist/esm/features/types.d.ts +2 -2
- package/dist/esm/features/types.js.map +1 -1
- package/dist/esm/index.d.ts +6 -6
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/scan.d.ts +3 -1
- package/dist/esm/scan.js +5 -2
- package/dist/esm/scan.js.map +1 -1
- package/dist/esm/sql-functions.d.ts +2 -0
- package/dist/esm/sql-functions.js +47 -0
- package/dist/esm/sql-functions.js.map +1 -0
- package/dist/esm/watch.d.ts +1 -1
- package/dist/esm/watch.js +2 -2
- package/dist/esm/watch.js.map +1 -1
- package/package.json +2 -1
- package/schema.json +4 -0
- package/skills/sense/SKILL.md +3 -3
- package/skills/sense-bases/EXAMPLES.md +103 -0
- package/skills/sense-bases/SKILL.md +137 -0
- package/skills/sense-setup/SKILL.md +1 -1
- package/dist/cjs/commands.d.cts +0 -58
- package/dist/cjs/commands.d.ts +0 -58
- package/dist/cjs/commands.js.map +0 -1
- package/dist/cjs/config.js +0 -919
- package/dist/cjs/config.js.map +0 -1
- package/dist/cjs/db.js.map +0 -1
- package/dist/esm/commands.d.ts +0 -58
- package/dist/esm/commands.js +0 -486
- package/dist/esm/commands.js.map +0 -1
- package/dist/esm/config.js +0 -599
- package/dist/esm/config.js.map +0 -1
- package/dist/esm/db.js.map +0 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// The Node floor (>=22.20) is explained here and nowhere else: 22.20 is the first release with
|
|
2
|
+
// both FTS5 and row-returning INSERT ... RETURNING. Raise it only for a load-bearing capability.
|
|
3
|
+
"use strict";
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
function _export(target, all) {
|
|
8
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
_export(exports, {
|
|
14
|
+
get DB_FILENAME () {
|
|
15
|
+
return DB_FILENAME;
|
|
16
|
+
},
|
|
17
|
+
get SCHEMA_VERSION () {
|
|
18
|
+
return SCHEMA_VERSION;
|
|
19
|
+
},
|
|
20
|
+
get clearCache () {
|
|
21
|
+
return clearCache;
|
|
22
|
+
},
|
|
23
|
+
get docCount () {
|
|
24
|
+
return docCount;
|
|
25
|
+
},
|
|
26
|
+
get open () {
|
|
27
|
+
return open;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _nodefs = require("node:fs");
|
|
31
|
+
var _nodepath = require("node:path");
|
|
32
|
+
var _nodesqlite = require("node:sqlite");
|
|
33
|
+
var _indexts = require("../config/index.js");
|
|
34
|
+
var _errorsts = require("../errors.js");
|
|
35
|
+
var _indexts1 = require("../features/index.js");
|
|
36
|
+
var _sqlfunctionsts = require("../sql-functions.js");
|
|
37
|
+
var _reconcilets = require("./reconcile.js");
|
|
38
|
+
var _sharedts = require("./shared.js");
|
|
39
|
+
function _array_like_to_array(arr, len) {
|
|
40
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
41
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
42
|
+
return arr2;
|
|
43
|
+
}
|
|
44
|
+
function _array_without_holes(arr) {
|
|
45
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
46
|
+
}
|
|
47
|
+
function _iterable_to_array(iter) {
|
|
48
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
49
|
+
}
|
|
50
|
+
function _non_iterable_spread() {
|
|
51
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
52
|
+
}
|
|
53
|
+
function _to_consumable_array(arr) {
|
|
54
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
55
|
+
}
|
|
56
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
57
|
+
if (!o) return;
|
|
58
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
59
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
60
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
61
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
62
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
63
|
+
}
|
|
64
|
+
var DB_FILENAME = 'cache.db';
|
|
65
|
+
var SCHEMA_VERSION = '13';
|
|
66
|
+
// Stemming is English-only, but the segmentation underneath it is what decides coverage:
|
|
67
|
+
// unicode61 splits on spaces, so a language written without them (Chinese, Japanese, Thai)
|
|
68
|
+
// indexes a whole run as one token and word search finds nothing. `content.tokenize` is how
|
|
69
|
+
// such a tree picks trigram instead.
|
|
70
|
+
var DEFAULT_TOKENIZE = 'porter unicode61';
|
|
71
|
+
// FTS5 takes its tokenizer as a string literal inside DDL, where nothing can bind, so a
|
|
72
|
+
// configured value has to be concatenated. Probing a throwaway table is what makes that safe
|
|
73
|
+
// and is also the whole validation: anything the linked SQLite accepts passes, anything else
|
|
74
|
+
// fails here with SQLite's own message rather than against the real table. It means no table
|
|
75
|
+
// of which version added which tokenizer has to be maintained.
|
|
76
|
+
function resolveTokenize(db, cfg) {
|
|
77
|
+
var configured = (0, _indexts.contentTokenize)(cfg);
|
|
78
|
+
if (configured === undefined) return DEFAULT_TOKENIZE;
|
|
79
|
+
var literal = configured.replace(/'/g, "''");
|
|
80
|
+
try {
|
|
81
|
+
db.exec('DROP TABLE IF EXISTS temp.sense_tokenize_probe');
|
|
82
|
+
db.exec("CREATE VIRTUAL TABLE temp.sense_tokenize_probe USING fts5(x, tokenize = '".concat(literal, "')"));
|
|
83
|
+
db.exec('DROP TABLE IF EXISTS temp.sense_tokenize_probe');
|
|
84
|
+
} catch (err) {
|
|
85
|
+
throw new _errorsts.SenseError('CONFIG_INVALID', 'content.tokenize "'.concat(configured, '" is not a tokenizer this SQLite accepts (').concat(err.message, "); the built-in choices are unicode61, ascii, porter, and trigram, each with their own options"));
|
|
86
|
+
}
|
|
87
|
+
return literal;
|
|
88
|
+
}
|
|
89
|
+
// The tokenizer the content table was actually built with, from its own DDL -- the one
|
|
90
|
+
// record that cannot desynchronize from the table. NULL when the table does not exist yet.
|
|
91
|
+
function storedTokenize(db) {
|
|
92
|
+
var row = db.prepare("SELECT sql FROM sqlite_master WHERE name = 'content'").get();
|
|
93
|
+
if (!row) return null;
|
|
94
|
+
var m = row.sql.match(/tokenize = '((?:[^']|'')*)'/);
|
|
95
|
+
return m ? m[1] : null;
|
|
96
|
+
}
|
|
97
|
+
// Content is a separate table (not a column on frontmatter) so `SELECT * FROM frontmatter`
|
|
98
|
+
// can't dump file text into context. Features add their own tables after the core ones.
|
|
99
|
+
function ensureSchema(db, cfg, tokenize) {
|
|
100
|
+
db.exec('CREATE TABLE IF NOT EXISTS frontmatter ("path" TEXT PRIMARY KEY, "_mtime" REAL, "_ctime" REAL, "_size" INTEGER, "_parse_error" TEXT)');
|
|
101
|
+
// IF NOT EXISTS is safe against a tokenizer change: open() compares the table's own DDL
|
|
102
|
+
// against the resolved tokenizer before this runs, so a stale table is already gone by now.
|
|
103
|
+
// The three `_seg` sidecars are appended after path, never inserted: bm25(content, ...) and
|
|
104
|
+
// snippet(content, 2, ...) are documented against the first three columns and keep working
|
|
105
|
+
// (FTS5 defaults the weights it was not given). Each carries its field's exploded unspaced
|
|
106
|
+
// runs for text that needs it, and an empty string for text that does not.
|
|
107
|
+
db.exec("CREATE VIRTUAL TABLE IF NOT EXISTS content USING fts5(title, summary, text, path UNINDEXED, title_seg, summary_seg, text_seg, tokenize = '".concat(tokenize, "')"));
|
|
108
|
+
// Coverage, not ownership: a path can appear under several presets. path leads the PK so the
|
|
109
|
+
// per-doc delete is an index hit -- keyed the other way, cold builds went quadratic.
|
|
110
|
+
db.exec('CREATE TABLE IF NOT EXISTS preset_files ("path" TEXT, preset TEXT, PRIMARY KEY ("path", preset))');
|
|
111
|
+
db.exec('CREATE INDEX IF NOT EXISTS preset_files_preset ON preset_files(preset)');
|
|
112
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
113
|
+
try {
|
|
114
|
+
for(var _iterator = (0, _indexts1.activeFeatures)(cfg)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
115
|
+
var feature = _step.value;
|
|
116
|
+
feature.schema(db);
|
|
117
|
+
}
|
|
118
|
+
} catch (err) {
|
|
119
|
+
_didIteratorError = true;
|
|
120
|
+
_iteratorError = err;
|
|
121
|
+
} finally{
|
|
122
|
+
try {
|
|
123
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
124
|
+
_iterator.return();
|
|
125
|
+
}
|
|
126
|
+
} finally{
|
|
127
|
+
if (_didIteratorError) {
|
|
128
|
+
throw _iteratorError;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if ((0, _sharedts.getMeta)(db, 'schema_version') === null) (0, _sharedts.setMeta)(db, 'schema_version', SCHEMA_VERSION);
|
|
133
|
+
if ((0, _sharedts.getMeta)(db, 'features') === null) (0, _sharedts.setMeta)(db, 'features', (0, _indexts.featureSignature)(cfg));
|
|
134
|
+
}
|
|
135
|
+
function docCount(db) {
|
|
136
|
+
var row = db.prepare('SELECT COUNT(*) AS n FROM frontmatter').get();
|
|
137
|
+
return row.n;
|
|
138
|
+
}
|
|
139
|
+
function open(cfg) {
|
|
140
|
+
var _getMeta;
|
|
141
|
+
var stateDir = (0, _nodepath.join)(cfg.baseDir, _indexts.STATE_DIR);
|
|
142
|
+
(0, _nodefs.mkdirSync)(stateDir, {
|
|
143
|
+
recursive: true
|
|
144
|
+
});
|
|
145
|
+
var dbPath = (0, _nodepath.join)(stateDir, DB_FILENAME);
|
|
146
|
+
var db = new _nodesqlite.DatabaseSync(dbPath);
|
|
147
|
+
db.exec('PRAGMA journal_mode = WAL');
|
|
148
|
+
// Covers a concurrent watcher's bulk reconcile (~5s for 500 files at 26k notes). A query
|
|
149
|
+
// that outwaits it still fails loudly.
|
|
150
|
+
db.exec('PRAGMA busy_timeout = 30000');
|
|
151
|
+
(0, _sqlfunctionsts.registerFunctions)(db, (0, _indexts.contentTokenize)(cfg) === undefined);
|
|
152
|
+
db.exec('CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value TEXT)');
|
|
153
|
+
// Before the rebuild branch below, never after: that branch deletes the cache, so a typo'd
|
|
154
|
+
// tokenizer validated later would cost a full re-index (and re-embed) to reach its own error.
|
|
155
|
+
var tokenize = resolveTokenize(db, cfg);
|
|
156
|
+
// Schema-version or feature-set mismatch: reconcile only reparses changed files, so an
|
|
157
|
+
// old cache can't be patched incrementally -- rebuild instead (cheap: nothing expensive lives here).
|
|
158
|
+
var version = (0, _sharedts.getMeta)(db, 'schema_version');
|
|
159
|
+
var features = (0, _sharedts.getMeta)(db, 'features');
|
|
160
|
+
var wantFeatures = (0, _indexts.featureSignature)(cfg);
|
|
161
|
+
var tokenizeOnlyRebuild = false;
|
|
162
|
+
if (version !== null && version !== SCHEMA_VERSION || features !== null && features !== wantFeatures) {
|
|
163
|
+
// Indexing derives from presets, so a config edit rebuilding the cache must say so and
|
|
164
|
+
// name what changed -- silent rebuilds make derived indexing look like a hang or a bug.
|
|
165
|
+
if (version !== null && version !== SCHEMA_VERSION) {
|
|
166
|
+
console.error('sense: cache format changed (new sensemaking version); rebuilding the index');
|
|
167
|
+
db.close();
|
|
168
|
+
clearCache(cfg);
|
|
169
|
+
return open(cfg);
|
|
170
|
+
}
|
|
171
|
+
var changedKeys = (0, _reconcilets.changedSignatureKeys)(features !== null && features !== void 0 ? features : '', wantFeatures);
|
|
172
|
+
// Only the tokenizer moved: frontmatter, links, sections, and embeddings are file-derived
|
|
173
|
+
// and tokenizer-independent, so they don't need re-deriving. Everything else -- a preset
|
|
174
|
+
// edit, an embed model change -- still takes the full clear/reopen below.
|
|
175
|
+
if (changedKeys.size === 1 && changedKeys.has('tokenize')) {
|
|
176
|
+
console.error('sense: config change (content tokenizer) rebuilds the text index; vectors, links, and sections are kept');
|
|
177
|
+
db.exec('DROP TABLE content');
|
|
178
|
+
tokenizeOnlyRebuild = true;
|
|
179
|
+
} else {
|
|
180
|
+
var changed = (0, _reconcilets.signatureDiff)(features !== null && features !== void 0 ? features : '', wantFeatures);
|
|
181
|
+
console.error("sense: config change (".concat(changed, ") rebuilds the index"));
|
|
182
|
+
db.close();
|
|
183
|
+
clearCache(cfg);
|
|
184
|
+
return open(cfg);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// Meta can lie after a crash between table creation and the signature write; the table's
|
|
188
|
+
// own DDL cannot. A mismatch here rebuilds no matter what meta says. A tokenize-only rebuild
|
|
189
|
+
// just dropped content above, so storedTokenize sees no table and this guard is skipped
|
|
190
|
+
// naturally rather than needing its own case.
|
|
191
|
+
var stored = storedTokenize(db);
|
|
192
|
+
if (stored !== null && stored !== tokenize) {
|
|
193
|
+
console.error('sense: cache was built with a different content tokenizer; rebuilding the index');
|
|
194
|
+
db.close();
|
|
195
|
+
clearCache(cfg);
|
|
196
|
+
return open(cfg);
|
|
197
|
+
}
|
|
198
|
+
ensureSchema(db, cfg, tokenize);
|
|
199
|
+
var rebuildWarnings = [];
|
|
200
|
+
if (tokenizeOnlyRebuild) {
|
|
201
|
+
rebuildWarnings = (0, _reconcilets.rebuildContentTable)(db, cfg, cfg.baseDir);
|
|
202
|
+
(0, _sharedts.setMeta)(db, 'features', wantFeatures);
|
|
203
|
+
}
|
|
204
|
+
// 3x the largest reconcile this cache has recorded, floored at 30s and capped at 10min.
|
|
205
|
+
// Installed before reconcile() -- that call is the one that races a watcher's transaction.
|
|
206
|
+
var recordedMaxMs = Number((_getMeta = (0, _sharedts.getMeta)(db, 'reconcile_max_ms')) !== null && _getMeta !== void 0 ? _getMeta : '0');
|
|
207
|
+
db.exec("PRAGMA busy_timeout = ".concat(Math.min(Math.max(30000, 3 * recordedMaxMs), 600000)));
|
|
208
|
+
var _reconcile = (0, _reconcilets.reconcile)(db, cfg, cfg.baseDir), parsed = _reconcile.parsed, warnings = _reconcile.warnings;
|
|
209
|
+
return {
|
|
210
|
+
db: db,
|
|
211
|
+
cfg: cfg,
|
|
212
|
+
dbPath: dbPath,
|
|
213
|
+
parsed: parsed,
|
|
214
|
+
warnings: _to_consumable_array(rebuildWarnings).concat(_to_consumable_array(warnings))
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function clearCache(cfg) {
|
|
218
|
+
(0, _nodefs.rmSync)((0, _nodepath.join)(cfg.baseDir, _indexts.STATE_DIR), {
|
|
219
|
+
recursive: true,
|
|
220
|
+
force: true
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/* 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/db/open.ts"],"sourcesContent":["// The Node floor (>=22.20) is explained here and nowhere else: 22.20 is the first release with\n// both FTS5 and row-returning INSERT ... RETURNING. Raise it only for a load-bearing capability.\nimport { mkdirSync, rmSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { DatabaseSync } from 'node:sqlite';\nimport type { Config, ResolvedConfig } from '../config/index.ts';\nimport { contentTokenize, featureSignature, STATE_DIR } from '../config/index.ts';\nimport { SenseError } from '../errors.ts';\nimport { activeFeatures } from '../features/index.ts';\nimport { registerFunctions } from '../sql-functions.ts';\nimport { changedSignatureKeys, rebuildContentTable, reconcile, signatureDiff } from './reconcile.ts';\nimport { getMeta, setMeta } from './shared.ts';\n\nexport const DB_FILENAME = 'cache.db';\n// Cache shape version, independent of the config's own `version`. Bumping it rebuilds\n// existing trees on first query.\nexport const SCHEMA_VERSION = '13';\n\nexport interface OpenResult {\n db: DatabaseSync;\n cfg: ResolvedConfig;\n dbPath: string;\n parsed: number;\n warnings: string[];\n}\n\n// Stemming is English-only, but the segmentation underneath it is what decides coverage:\n// unicode61 splits on spaces, so a language written without them (Chinese, Japanese, Thai)\n// indexes a whole run as one token and word search finds nothing. `content.tokenize` is how\n// such a tree picks trigram instead.\nconst DEFAULT_TOKENIZE = 'porter unicode61';\n\n// FTS5 takes its tokenizer as a string literal inside DDL, where nothing can bind, so a\n// configured value has to be concatenated. Probing a throwaway table is what makes that safe\n// and is also the whole validation: anything the linked SQLite accepts passes, anything else\n// fails here with SQLite's own message rather than against the real table. It means no table\n// of which version added which tokenizer has to be maintained.\nfunction resolveTokenize(db: DatabaseSync, cfg: Config): string {\n const configured = contentTokenize(cfg);\n if (configured === undefined) return DEFAULT_TOKENIZE;\n const literal = configured.replace(/'/g, \"''\");\n try {\n db.exec('DROP TABLE IF EXISTS temp.sense_tokenize_probe');\n db.exec(`CREATE VIRTUAL TABLE temp.sense_tokenize_probe USING fts5(x, tokenize = '${literal}')`);\n db.exec('DROP TABLE IF EXISTS temp.sense_tokenize_probe');\n } catch (err) {\n throw new SenseError('CONFIG_INVALID', `content.tokenize \"${configured}\" is not a tokenizer this SQLite accepts (${(err as Error).message}); the built-in choices are unicode61, ascii, porter, and trigram, each with their own options`);\n }\n return literal;\n}\n\n// The tokenizer the content table was actually built with, from its own DDL -- the one\n// record that cannot desynchronize from the table. NULL when the table does not exist yet.\nfunction storedTokenize(db: DatabaseSync): string | null {\n const row = db.prepare(`SELECT sql FROM sqlite_master WHERE name = 'content'`).get() as { sql: string } | undefined;\n if (!row) return null;\n const m = row.sql.match(/tokenize = '((?:[^']|'')*)'/);\n return m ? m[1] : null;\n}\n\n// Content is a separate table (not a column on frontmatter) so `SELECT * FROM frontmatter`\n// can't dump file text into context. Features add their own tables after the core ones.\nfunction ensureSchema(db: DatabaseSync, cfg: Config, tokenize: string): void {\n db.exec(`CREATE TABLE IF NOT EXISTS frontmatter (\"path\" TEXT PRIMARY KEY, \"_mtime\" REAL, \"_ctime\" REAL, \"_size\" INTEGER, \"_parse_error\" TEXT)`);\n // IF NOT EXISTS is safe against a tokenizer change: open() compares the table's own DDL\n // against the resolved tokenizer before this runs, so a stale table is already gone by now.\n // The three `_seg` sidecars are appended after path, never inserted: bm25(content, ...) and\n // snippet(content, 2, ...) are documented against the first three columns and keep working\n // (FTS5 defaults the weights it was not given). Each carries its field's exploded unspaced\n // runs for text that needs it, and an empty string for text that does not.\n db.exec(`CREATE VIRTUAL TABLE IF NOT EXISTS content USING fts5(title, summary, text, path UNINDEXED, title_seg, summary_seg, text_seg, tokenize = '${tokenize}')`);\n // Coverage, not ownership: a path can appear under several presets. path leads the PK so the\n // per-doc delete is an index hit -- keyed the other way, cold builds went quadratic.\n db.exec(`CREATE TABLE IF NOT EXISTS preset_files (\"path\" TEXT, preset TEXT, PRIMARY KEY (\"path\", preset))`);\n db.exec('CREATE INDEX IF NOT EXISTS preset_files_preset ON preset_files(preset)');\n for (const feature of activeFeatures(cfg)) feature.schema(db);\n if (getMeta(db, 'schema_version') === null) setMeta(db, 'schema_version', SCHEMA_VERSION);\n if (getMeta(db, 'features') === null) setMeta(db, 'features', featureSignature(cfg));\n}\n\nexport function docCount(db: DatabaseSync): number {\n const row = db.prepare('SELECT COUNT(*) AS n FROM frontmatter').get() as { n: number };\n return row.n;\n}\n\nexport function open(cfg: ResolvedConfig): OpenResult {\n const stateDir = join(cfg.baseDir, STATE_DIR);\n mkdirSync(stateDir, { recursive: true });\n const dbPath = join(stateDir, DB_FILENAME);\n\n const db = new DatabaseSync(dbPath);\n db.exec('PRAGMA journal_mode = WAL');\n // Covers a concurrent watcher's bulk reconcile (~5s for 500 files at 26k notes). A query\n // that outwaits it still fails loudly.\n db.exec('PRAGMA busy_timeout = 30000');\n registerFunctions(db, contentTokenize(cfg) === undefined);\n\n db.exec('CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value TEXT)');\n\n // Before the rebuild branch below, never after: that branch deletes the cache, so a typo'd\n // tokenizer validated later would cost a full re-index (and re-embed) to reach its own error.\n const tokenize = resolveTokenize(db, cfg);\n\n // Schema-version or feature-set mismatch: reconcile only reparses changed files, so an\n // old cache can't be patched incrementally -- rebuild instead (cheap: nothing expensive lives here).\n const version = getMeta(db, 'schema_version');\n const features = getMeta(db, 'features');\n const wantFeatures = featureSignature(cfg);\n let tokenizeOnlyRebuild = false;\n if ((version !== null && version !== SCHEMA_VERSION) || (features !== null && features !== wantFeatures)) {\n // Indexing derives from presets, so a config edit rebuilding the cache must say so and\n // name what changed -- silent rebuilds make derived indexing look like a hang or a bug.\n if (version !== null && version !== SCHEMA_VERSION) {\n console.error('sense: cache format changed (new sensemaking version); rebuilding the index');\n db.close();\n clearCache(cfg);\n return open(cfg);\n }\n const changedKeys = changedSignatureKeys(features ?? '', wantFeatures);\n // Only the tokenizer moved: frontmatter, links, sections, and embeddings are file-derived\n // and tokenizer-independent, so they don't need re-deriving. Everything else -- a preset\n // edit, an embed model change -- still takes the full clear/reopen below.\n if (changedKeys.size === 1 && changedKeys.has('tokenize')) {\n console.error('sense: config change (content tokenizer) rebuilds the text index; vectors, links, and sections are kept');\n db.exec('DROP TABLE content');\n tokenizeOnlyRebuild = true;\n } else {\n const changed = signatureDiff(features ?? '', wantFeatures);\n console.error(`sense: config change (${changed}) rebuilds the index`);\n db.close();\n clearCache(cfg);\n return open(cfg);\n }\n }\n\n // Meta can lie after a crash between table creation and the signature write; the table's\n // own DDL cannot. A mismatch here rebuilds no matter what meta says. A tokenize-only rebuild\n // just dropped content above, so storedTokenize sees no table and this guard is skipped\n // naturally rather than needing its own case.\n const stored = storedTokenize(db);\n if (stored !== null && stored !== tokenize) {\n console.error('sense: cache was built with a different content tokenizer; rebuilding the index');\n db.close();\n clearCache(cfg);\n return open(cfg);\n }\n\n ensureSchema(db, cfg, tokenize);\n\n let rebuildWarnings: string[] = [];\n if (tokenizeOnlyRebuild) {\n rebuildWarnings = rebuildContentTable(db, cfg, cfg.baseDir);\n setMeta(db, 'features', wantFeatures);\n }\n\n // 3x the largest reconcile this cache has recorded, floored at 30s and capped at 10min.\n // Installed before reconcile() -- that call is the one that races a watcher's transaction.\n const recordedMaxMs = Number(getMeta(db, 'reconcile_max_ms') ?? '0');\n db.exec(`PRAGMA busy_timeout = ${Math.min(Math.max(30000, 3 * recordedMaxMs), 600_000)}`);\n\n const { parsed, warnings } = reconcile(db, cfg, cfg.baseDir);\n\n return { db, cfg, dbPath, parsed, warnings: [...rebuildWarnings, ...warnings] };\n}\n\n// Deletes the cache directory, and only that. The rebuild is not this function's job: the next\n// open() reconciles, which is what running any command already does, so a verb that bundled the\n// two described the half that was not its own. Manual reset for a doubted cache; the schema and\n// config-signature mismatches below reset themselves.\nexport function clearCache(cfg: ResolvedConfig): void {\n rmSync(join(cfg.baseDir, STATE_DIR), { recursive: true, force: true });\n}\n"],"names":["DB_FILENAME","SCHEMA_VERSION","clearCache","docCount","open","DEFAULT_TOKENIZE","resolveTokenize","db","cfg","configured","contentTokenize","undefined","literal","replace","exec","err","SenseError","message","storedTokenize","row","prepare","get","m","sql","match","ensureSchema","tokenize","activeFeatures","feature","schema","getMeta","setMeta","featureSignature","n","stateDir","join","baseDir","STATE_DIR","mkdirSync","recursive","dbPath","DatabaseSync","registerFunctions","version","features","wantFeatures","tokenizeOnlyRebuild","console","error","close","changedKeys","changedSignatureKeys","size","has","changed","signatureDiff","stored","rebuildWarnings","rebuildContentTable","recordedMaxMs","Number","Math","min","max","reconcile","parsed","warnings","rmSync","force"],"mappings":"AAAA,+FAA+F;AAC/F,iGAAiG;;;;;;;;;;;;QAYpFA;eAAAA;;QAGAC;eAAAA;;QAyJGC;eAAAA;;QAzFAC;eAAAA;;QAKAC;eAAAA;;;sBAnFkB;wBACb;0BACQ;uBAEgC;wBAClC;wBACI;8BACG;2BACkD;wBACnD;;;;;;;;;;;;;;;;;;;;;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AZuB,sBAAAA,WAAmC;IAChEvB,GAAGO,IAAI,CAAC,AAAC,yBAA8E,OAAtD+C,KAAKC,GAAG,CAACD,KAAKE,GAAG,CAAC,OAAO,IAAIJ,gBAAgB;IAE9E,IAA6BK,aAAAA,IAAAA,sBAAS,EAACzD,IAAIC,KAAKA,IAAI4B,OAAO,GAAnD6B,SAAqBD,WAArBC,QAAQC,WAAaF,WAAbE;IAEhB,OAAO;QAAE3D,IAAAA;QAAIC,KAAAA;QAAKgC,QAAAA;QAAQyB,QAAAA;QAAQC,UAAU,AAAC,qBAAGT,wBAAiB,qBAAGS;IAAU;AAChF;AAMO,SAAShE,WAAWM,GAAmB;IAC5C2D,IAAAA,cAAM,EAAChC,IAAAA,cAAI,EAAC3B,IAAI4B,OAAO,EAAEC,kBAAS,GAAG;QAAEE,WAAW;QAAM6B,OAAO;IAAK;AACtE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { Config } from '../config/index.js';
|
|
3
|
+
export declare function reconcile(db: DatabaseSync, cfg: Config, baseDir: string): {
|
|
4
|
+
parsed: number;
|
|
5
|
+
warnings: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function changedSignatureKeys(before: string, after: string): Set<string>;
|
|
8
|
+
export declare function signatureDiff(before: string, after: string): string;
|
|
9
|
+
export declare function rebuildContentTable(db: DatabaseSync, cfg: Config, baseDir: string): string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { Config } from '../config/index.js';
|
|
3
|
+
export declare function reconcile(db: DatabaseSync, cfg: Config, baseDir: string): {
|
|
4
|
+
parsed: number;
|
|
5
|
+
warnings: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function changedSignatureKeys(before: string, after: string): Set<string>;
|
|
8
|
+
export declare function signatureDiff(before: string, after: string): string;
|
|
9
|
+
export declare function rebuildContentTable(db: DatabaseSync, cfg: Config, baseDir: string): string[];
|