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,6 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { ResolvedConfig, SearchOverrides } from '../config/index.js';
|
|
3
|
+
export declare function relatedNotes(db: DatabaseSync, cfg: ResolvedConfig, pathArg: string, overrides: SearchOverrides, k: number): Promise<Array<{
|
|
4
|
+
path: string;
|
|
5
|
+
similarity: number;
|
|
6
|
+
}>>;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "relatedNotes", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return relatedNotes;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _indexts = require("../config/index.js");
|
|
12
|
+
var _errorsts = require("../errors.js");
|
|
13
|
+
var _embedts = require("../features/embed.js");
|
|
14
|
+
var _peekts = require("./peek.js");
|
|
15
|
+
var _scopets = require("./scope.js");
|
|
16
|
+
function _array_like_to_array(arr, len) {
|
|
17
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
18
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
19
|
+
return arr2;
|
|
20
|
+
}
|
|
21
|
+
function _array_without_holes(arr) {
|
|
22
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
23
|
+
}
|
|
24
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
25
|
+
try {
|
|
26
|
+
var info = gen[key](arg);
|
|
27
|
+
var value = info.value;
|
|
28
|
+
} catch (error) {
|
|
29
|
+
reject(error);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (info.done) {
|
|
33
|
+
resolve(value);
|
|
34
|
+
} else {
|
|
35
|
+
Promise.resolve(value).then(_next, _throw);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function _async_to_generator(fn) {
|
|
39
|
+
return function() {
|
|
40
|
+
var self = this, args = arguments;
|
|
41
|
+
return new Promise(function(resolve, reject) {
|
|
42
|
+
var gen = fn.apply(self, args);
|
|
43
|
+
function _next(value) {
|
|
44
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
45
|
+
}
|
|
46
|
+
function _throw(err) {
|
|
47
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
48
|
+
}
|
|
49
|
+
_next(undefined);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function _iterable_to_array(iter) {
|
|
54
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
55
|
+
}
|
|
56
|
+
function _non_iterable_spread() {
|
|
57
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
58
|
+
}
|
|
59
|
+
function _to_consumable_array(arr) {
|
|
60
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
61
|
+
}
|
|
62
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
63
|
+
if (!o) return;
|
|
64
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
65
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
66
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
67
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
68
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
69
|
+
}
|
|
70
|
+
function _ts_generator(thisArg, body) {
|
|
71
|
+
var f, y, t, _ = {
|
|
72
|
+
label: 0,
|
|
73
|
+
sent: function() {
|
|
74
|
+
if (t[0] & 1) throw t[1];
|
|
75
|
+
return t[1];
|
|
76
|
+
},
|
|
77
|
+
trys: [],
|
|
78
|
+
ops: []
|
|
79
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
80
|
+
return d(g, "next", {
|
|
81
|
+
value: verb(0)
|
|
82
|
+
}), d(g, "throw", {
|
|
83
|
+
value: verb(1)
|
|
84
|
+
}), d(g, "return", {
|
|
85
|
+
value: verb(2)
|
|
86
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
87
|
+
value: function() {
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
}), g;
|
|
91
|
+
function verb(n) {
|
|
92
|
+
return function(v) {
|
|
93
|
+
return step([
|
|
94
|
+
n,
|
|
95
|
+
v
|
|
96
|
+
]);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function step(op) {
|
|
100
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
101
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
102
|
+
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;
|
|
103
|
+
if (y = 0, t) op = [
|
|
104
|
+
op[0] & 2,
|
|
105
|
+
t.value
|
|
106
|
+
];
|
|
107
|
+
switch(op[0]){
|
|
108
|
+
case 0:
|
|
109
|
+
case 1:
|
|
110
|
+
t = op;
|
|
111
|
+
break;
|
|
112
|
+
case 4:
|
|
113
|
+
_.label++;
|
|
114
|
+
return {
|
|
115
|
+
value: op[1],
|
|
116
|
+
done: false
|
|
117
|
+
};
|
|
118
|
+
case 5:
|
|
119
|
+
_.label++;
|
|
120
|
+
y = op[1];
|
|
121
|
+
op = [
|
|
122
|
+
0
|
|
123
|
+
];
|
|
124
|
+
continue;
|
|
125
|
+
case 7:
|
|
126
|
+
op = _.ops.pop();
|
|
127
|
+
_.trys.pop();
|
|
128
|
+
continue;
|
|
129
|
+
default:
|
|
130
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
131
|
+
_ = 0;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
135
|
+
_.label = op[1];
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
139
|
+
_.label = t[1];
|
|
140
|
+
t = op;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
if (t && _.label < t[2]) {
|
|
144
|
+
_.label = t[2];
|
|
145
|
+
_.ops.push(op);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
if (t[2]) _.ops.pop();
|
|
149
|
+
_.trys.pop();
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
op = body.call(thisArg, _);
|
|
153
|
+
} catch (e) {
|
|
154
|
+
op = [
|
|
155
|
+
6,
|
|
156
|
+
e
|
|
157
|
+
];
|
|
158
|
+
y = 0;
|
|
159
|
+
} finally{
|
|
160
|
+
f = t = 0;
|
|
161
|
+
}
|
|
162
|
+
if (op[0] & 5) throw op[1];
|
|
163
|
+
return {
|
|
164
|
+
value: op[0] ? op[1] : void 0,
|
|
165
|
+
done: true
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function relatedNotes(db, cfg, pathArg, overrides, k) {
|
|
170
|
+
return _async_to_generator(function() {
|
|
171
|
+
var paths, path, outbound, backlinks, exclude, effective, allowed;
|
|
172
|
+
return _ts_generator(this, function(_state) {
|
|
173
|
+
switch(_state.label){
|
|
174
|
+
case 0:
|
|
175
|
+
paths = db.prepare('SELECT "path" FROM frontmatter').all().map(function(r) {
|
|
176
|
+
return r.path;
|
|
177
|
+
});
|
|
178
|
+
path = (0, _peekts.resolveNote)(paths, pathArg);
|
|
179
|
+
outbound = db.prepare('SELECT DISTINCT dst FROM links WHERE src = ? AND dst IS NOT NULL').all(path).map(function(r) {
|
|
180
|
+
return r.dst;
|
|
181
|
+
});
|
|
182
|
+
backlinks = db.prepare('SELECT DISTINCT src FROM links WHERE dst = ?').all(path).map(function(r) {
|
|
183
|
+
return r.src;
|
|
184
|
+
});
|
|
185
|
+
exclude = new Set([
|
|
186
|
+
path
|
|
187
|
+
].concat(_to_consumable_array(outbound), _to_consumable_array(backlinks)));
|
|
188
|
+
// Vectors are the only signal `related` has, so every way of not having them is an error
|
|
189
|
+
// naming the cause. An empty table then means one thing: nothing near in meaning that this
|
|
190
|
+
// note does not already link to, which is a real answer.
|
|
191
|
+
effective = (0, _indexts.resolveSearch)(cfg, overrides);
|
|
192
|
+
if (!(0, _indexts.embedEnabled)(cfg)) {
|
|
193
|
+
throw new _errorsts.SenseError('EMBED_DISABLED', 'related ranks notes by meaning, and this tree has no embedding model; add an "embed" block naming one to sense.config.json, then run `sense download` (search works without it, on words and links)');
|
|
194
|
+
}
|
|
195
|
+
// search gates on the same flag (see wantsVectors above); reading it here too keeps
|
|
196
|
+
// `semantic: false` meaning one thing. Without this, an overlapping semantic-on preset's
|
|
197
|
+
// vectors would answer for a scope that declined them.
|
|
198
|
+
if (!effective.semantic) {
|
|
199
|
+
throw new _errorsts.SenseError('PRESET_NOT_SEMANTIC', 'preset "'.concat(effective.presetName, '" sets "semantic": false, so this scope has no vectors and related has no other signal; search it instead (words and links), or set semantic back on for that preset'));
|
|
200
|
+
}
|
|
201
|
+
if (!(0, _embedts.modelPresent)(cfg)) {
|
|
202
|
+
throw new _errorsts.SenseError('EMBED_MODEL_MISSING', 'related ranks notes by meaning, so it needs the embedding model, which is not downloaded; run `sense download` (search still works without it, on words and links)');
|
|
203
|
+
}
|
|
204
|
+
allowed = (0, _scopets.scopedPaths)(db, cfg, overrides);
|
|
205
|
+
// Top up pending rows before the seed check, or a fresh index reports every note as
|
|
206
|
+
// having no indexed text until some search has run.
|
|
207
|
+
return [
|
|
208
|
+
4,
|
|
209
|
+
(0, _embedts.embedPending)(db, cfg, cfg.baseDir)
|
|
210
|
+
];
|
|
211
|
+
case 1:
|
|
212
|
+
_state.sent();
|
|
213
|
+
if (!(0, _embedts.hasEmbedding)(db, path)) {
|
|
214
|
+
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"));
|
|
215
|
+
}
|
|
216
|
+
if (!(0, _scopets.scopeHasEmbeddings)(db, cfg, allowed)) return [
|
|
217
|
+
2,
|
|
218
|
+
[]
|
|
219
|
+
];
|
|
220
|
+
return [
|
|
221
|
+
2,
|
|
222
|
+
(0, _embedts.similarNotes)(db, cfg, path, {
|
|
223
|
+
exclude: exclude,
|
|
224
|
+
allowed: allowed,
|
|
225
|
+
k: k
|
|
226
|
+
})
|
|
227
|
+
];
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
})();
|
|
231
|
+
}
|
|
232
|
+
/* 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/commands/related.ts"],"sourcesContent":["import type { DatabaseSync } from 'node:sqlite';\nimport type { ResolvedConfig, SearchOverrides } from '../config/index.ts';\nimport { embedEnabled, resolveSearch } from '../config/index.ts';\nimport { SenseError } from '../errors.ts';\nimport { embedPending, hasEmbedding, modelPresent, similarNotes } from '../features/embed.ts';\nimport { resolveNote } from './peek.ts';\nimport { scopedPaths, scopeHasEmbeddings } from './scope.ts';\n\n// Notes most similar by cosine, excluding self and everything already linked either way.\n// Its own command, not a peek section: a full embeddings scan is ~480ms at 26k notes.\nexport async function relatedNotes(db: DatabaseSync, cfg: ResolvedConfig, pathArg: string, overrides: SearchOverrides, k: number): Promise<Array<{ path: string; similarity: number }>> {\n const paths = (db.prepare('SELECT \"path\" FROM frontmatter').all() as Array<{ path: string }>).map((r) => r.path);\n const path = resolveNote(paths, pathArg);\n\n const outbound = (db.prepare('SELECT DISTINCT dst FROM links WHERE src = ? AND dst IS NOT NULL').all(path) as Array<{ dst: string }>).map((r) => r.dst);\n const backlinks = (db.prepare('SELECT DISTINCT src FROM links WHERE dst = ?').all(path) as Array<{ src: string }>).map((r) => r.src);\n const exclude = new Set([path, ...outbound, ...backlinks]);\n\n // Vectors are the only signal `related` has, so every way of not having them is an error\n // naming the cause. An empty table then means one thing: nothing near in meaning that this\n // note does not already link to, which is a real answer.\n const effective = resolveSearch(cfg, overrides);\n if (!embedEnabled(cfg)) {\n throw new SenseError('EMBED_DISABLED', 'related ranks notes by meaning, and this tree has no embedding model; add an \"embed\" block naming one to sense.config.json, then run `sense download` (search works without it, on words and links)');\n }\n // search gates on the same flag (see wantsVectors above); reading it here too keeps\n // `semantic: false` meaning one thing. Without this, an overlapping semantic-on preset's\n // vectors would answer for a scope that declined them.\n if (!effective.semantic) {\n throw new SenseError('PRESET_NOT_SEMANTIC', `preset \"${effective.presetName}\" sets \"semantic\": false, so this scope has no vectors and related has no other signal; search it instead (words and links), or set semantic back on for that preset`);\n }\n if (!modelPresent(cfg)) {\n throw new SenseError('EMBED_MODEL_MISSING', 'related ranks notes by meaning, so it needs the embedding model, which is not downloaded; run `sense download` (search still works without it, on words and links)');\n }\n const allowed = scopedPaths(db, cfg, overrides);\n // Top up pending rows before the seed check, or a fresh index reports every note as\n // having no indexed text until some search has run.\n await embedPending(db, cfg, cfg.baseDir);\n if (!hasEmbedding(db, path)) {\n throw new SenseError('NOTE_NOT_EMBEDDED', `${path} has no indexed text to compare -- a note that is frontmatter only, or empty, has nothing to rank by meaning`);\n }\n if (!scopeHasEmbeddings(db, cfg, allowed)) return [];\n return similarNotes(db, cfg, path, { exclude, allowed, k });\n}\n"],"names":["relatedNotes","db","cfg","pathArg","overrides","k","paths","path","outbound","backlinks","exclude","effective","allowed","prepare","all","map","r","resolveNote","dst","src","Set","resolveSearch","embedEnabled","SenseError","semantic","presetName","modelPresent","scopedPaths","embedPending","baseDir","hasEmbedding","scopeHasEmbeddings","similarNotes"],"mappings":";;;;+BAUsBA;;;eAAAA;;;uBARsB;wBACjB;uBAC4C;sBAC3C;uBACoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIzC,SAAeA,aAAaC,EAAgB,EAAEC,GAAmB,EAAEC,OAAe,EAAEC,SAA0B,EAAEC,CAAS;;YACxHC,OACAC,MAEAC,UACAC,WACAC,SAKAC,WAaAC;;;;oBAvBAN,QAAQ,AAACL,GAAGY,OAAO,CAAC,kCAAkCC,GAAG,GAA+BC,GAAG,CAAC,SAACC;+BAAMA,EAAET,IAAI;;oBACzGA,OAAOU,IAAAA,mBAAW,EAACX,OAAOH;oBAE1BK,WAAW,AAACP,GAAGY,OAAO,CAAC,oEAAoEC,GAAG,CAACP,MAAiCQ,GAAG,CAAC,SAACC;+BAAMA,EAAEE,GAAG;;oBAChJT,YAAY,AAACR,GAAGY,OAAO,CAAC,gDAAgDC,GAAG,CAACP,MAAiCQ,GAAG,CAAC,SAACC;+BAAMA,EAAEG,GAAG;;oBAC7HT,UAAU,IAAIU,IAAI;wBAACb;sBAAD,OAAO,qBAAGC,WAAU,qBAAGC;oBAE/C,yFAAyF;oBACzF,2FAA2F;oBAC3F,yDAAyD;oBACnDE,YAAYU,IAAAA,sBAAa,EAACnB,KAAKE;oBACrC,IAAI,CAACkB,IAAAA,qBAAY,EAACpB,MAAM;wBACtB,MAAM,IAAIqB,oBAAU,CAAC,kBAAkB;oBACzC;oBACA,oFAAoF;oBACpF,yFAAyF;oBACzF,uDAAuD;oBACvD,IAAI,CAACZ,UAAUa,QAAQ,EAAE;wBACvB,MAAM,IAAID,oBAAU,CAAC,uBAAuB,AAAC,WAA+B,OAArBZ,UAAUc,UAAU,EAAC;oBAC9E;oBACA,IAAI,CAACC,IAAAA,qBAAY,EAACxB,MAAM;wBACtB,MAAM,IAAIqB,oBAAU,CAAC,uBAAuB;oBAC9C;oBACMX,UAAUe,IAAAA,oBAAW,EAAC1B,IAAIC,KAAKE;oBACrC,oFAAoF;oBACpF,oDAAoD;oBACpD;;wBAAMwB,IAAAA,qBAAY,EAAC3B,IAAIC,KAAKA,IAAI2B,OAAO;;;oBAAvC;oBACA,IAAI,CAACC,IAAAA,qBAAY,EAAC7B,IAAIM,OAAO;wBAC3B,MAAM,IAAIgB,oBAAU,CAAC,qBAAqB,AAAC,GAAO,OAALhB,MAAK;oBACpD;oBACA,IAAI,CAACwB,IAAAA,2BAAkB,EAAC9B,IAAIC,KAAKU,UAAU;;;;oBAC3C;;wBAAOoB,IAAAA,qBAAY,EAAC/B,IAAIC,KAAKK,MAAM;4BAAEG,SAAAA;4BAASE,SAAAA;4BAASP,GAAAA;wBAAE;;;;IAC3D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { ResolvedConfig, SearchOverrides } from '../config/index.js';
|
|
3
|
+
export declare const INTERNAL_COLUMNS: Set<string>;
|
|
4
|
+
export declare function inScope(path: string, include: string[], exclude?: string[]): boolean;
|
|
5
|
+
export declare function scopeHasEmbeddings(db: DatabaseSync, cfg: ResolvedConfig, scopedPaths: Set<string>): boolean;
|
|
6
|
+
export declare function rawScope(db: DatabaseSync, cfg: ResolvedConfig, overrides: SearchOverrides, allPaths?: string[]): Set<string>;
|
|
7
|
+
export declare function narrowByWhere(db: DatabaseSync, paths: Set<string>, where: string | undefined): Set<string>;
|
|
8
|
+
export declare function scopedPaths(db: DatabaseSync, cfg: ResolvedConfig, overrides: SearchOverrides): Set<string>;
|
|
9
|
+
export declare function materializeScope(db: DatabaseSync, table: string, paths: Set<string>): void;
|
|
10
|
+
export declare function setupMapScope(db: DatabaseSync, paths: Set<string>): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { ResolvedConfig, SearchOverrides } from '../config/index.js';
|
|
3
|
+
export declare const INTERNAL_COLUMNS: Set<string>;
|
|
4
|
+
export declare function inScope(path: string, include: string[], exclude?: string[]): boolean;
|
|
5
|
+
export declare function scopeHasEmbeddings(db: DatabaseSync, cfg: ResolvedConfig, scopedPaths: Set<string>): boolean;
|
|
6
|
+
export declare function rawScope(db: DatabaseSync, cfg: ResolvedConfig, overrides: SearchOverrides, allPaths?: string[]): Set<string>;
|
|
7
|
+
export declare function narrowByWhere(db: DatabaseSync, paths: Set<string>, where: string | undefined): Set<string>;
|
|
8
|
+
export declare function scopedPaths(db: DatabaseSync, cfg: ResolvedConfig, overrides: SearchOverrides): Set<string>;
|
|
9
|
+
export declare function materializeScope(db: DatabaseSync, table: string, paths: Set<string>): void;
|
|
10
|
+
export declare function setupMapScope(db: DatabaseSync, paths: Set<string>): void;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get INTERNAL_COLUMNS () {
|
|
13
|
+
return INTERNAL_COLUMNS;
|
|
14
|
+
},
|
|
15
|
+
get inScope () {
|
|
16
|
+
return inScope;
|
|
17
|
+
},
|
|
18
|
+
get materializeScope () {
|
|
19
|
+
return materializeScope;
|
|
20
|
+
},
|
|
21
|
+
get narrowByWhere () {
|
|
22
|
+
return narrowByWhere;
|
|
23
|
+
},
|
|
24
|
+
get rawScope () {
|
|
25
|
+
return rawScope;
|
|
26
|
+
},
|
|
27
|
+
get scopeHasEmbeddings () {
|
|
28
|
+
return scopeHasEmbeddings;
|
|
29
|
+
},
|
|
30
|
+
get scopedPaths () {
|
|
31
|
+
return scopedPaths;
|
|
32
|
+
},
|
|
33
|
+
get setupMapScope () {
|
|
34
|
+
return setupMapScope;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var _nodepath = require("node:path");
|
|
38
|
+
var _indexts = require("../config/index.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 INTERNAL_COLUMNS = new Set([
|
|
65
|
+
'path',
|
|
66
|
+
'_mtime',
|
|
67
|
+
'_ctime',
|
|
68
|
+
'_size',
|
|
69
|
+
'_rank',
|
|
70
|
+
'_parse_error'
|
|
71
|
+
]);
|
|
72
|
+
function inScope(path, include, exclude) {
|
|
73
|
+
if (!include.some(function(g) {
|
|
74
|
+
return (0, _nodepath.matchesGlob)(path, g);
|
|
75
|
+
})) return false;
|
|
76
|
+
if (exclude === null || exclude === void 0 ? void 0 : exclude.some(function(g) {
|
|
77
|
+
return (0, _nodepath.matchesGlob)(path, g);
|
|
78
|
+
})) return false;
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
function scopeHasEmbeddings(db, cfg, scopedPaths) {
|
|
82
|
+
if (!(0, _indexts.anyPresetEmbeds)(cfg)) return false; // the embeddings table doesn't exist at all in this case
|
|
83
|
+
var rows = db.prepare('SELECT DISTINCT "path" FROM embeddings').all();
|
|
84
|
+
return rows.some(function(r) {
|
|
85
|
+
return scopedPaths.has(r.path);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function rawScope(db, cfg, overrides, allPaths) {
|
|
89
|
+
var effective = (0, _indexts.resolveSearch)(cfg, overrides);
|
|
90
|
+
var include = effective.include, exclude = effective.exclude;
|
|
91
|
+
var adHocScope = overrides.include !== undefined || overrides.exclude !== undefined || overrides.noExclude === true;
|
|
92
|
+
if (!adHocScope) return new Set(db.prepare('SELECT "path" FROM preset_files WHERE preset = ?').all(effective.presetName).map(function(r) {
|
|
93
|
+
return r.path;
|
|
94
|
+
}));
|
|
95
|
+
var paths = allPaths !== null && allPaths !== void 0 ? allPaths : db.prepare('SELECT "path" FROM frontmatter').all().map(function(r) {
|
|
96
|
+
return r.path;
|
|
97
|
+
});
|
|
98
|
+
return new Set(paths.filter(function(p) {
|
|
99
|
+
return inScope(p, include, exclude);
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
function narrowByWhere(db, paths, where) {
|
|
103
|
+
if (!where) return paths;
|
|
104
|
+
var whereRows = db.prepare('SELECT "path" FROM frontmatter f WHERE ('.concat(where, ")")).all();
|
|
105
|
+
var wherePaths = new Set(whereRows.map(function(r) {
|
|
106
|
+
return r.path;
|
|
107
|
+
}));
|
|
108
|
+
return new Set(_to_consumable_array(paths).filter(function(p) {
|
|
109
|
+
return wherePaths.has(p);
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
function scopedPaths(db, cfg, overrides) {
|
|
113
|
+
var effective = (0, _indexts.resolveSearch)(cfg, overrides);
|
|
114
|
+
return narrowByWhere(db, rawScope(db, cfg, overrides), effective.where);
|
|
115
|
+
}
|
|
116
|
+
function materializeScope(db, table, paths) {
|
|
117
|
+
db.exec("DROP TABLE IF EXISTS ".concat(table));
|
|
118
|
+
db.exec("CREATE TEMP TABLE ".concat(table, ' ("path" TEXT PRIMARY KEY)'));
|
|
119
|
+
db.prepare("INSERT INTO ".concat(table, " SELECT DISTINCT value FROM json_each(?1)")).run(JSON.stringify(_to_consumable_array(paths)));
|
|
120
|
+
}
|
|
121
|
+
function setupMapScope(db, paths) {
|
|
122
|
+
materializeScope(db, '_map_scope', paths);
|
|
123
|
+
}
|
|
124
|
+
/* 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/commands/scope.ts"],"sourcesContent":["import { matchesGlob } from 'node:path';\nimport type { DatabaseSync } from 'node:sqlite';\nimport type { ResolvedConfig, SearchOverrides } from '../config/index.ts';\nimport { anyPresetEmbeds, resolveSearch } from '../config/index.ts';\n\nexport const INTERNAL_COLUMNS = new Set(['path', '_mtime', '_ctime', '_size', '_rank', '_parse_error']);\n\n// node:path's matchesGlob is experimental (stable behind an unstable-API flag) as of the\n// engines floor (Node >=22.20); scope filtering only ever needs single-pattern matching, so\n// it's used here in JS rather than running a directory walk in the query path.\nexport function inScope(path: string, include: string[], exclude?: string[]): boolean {\n if (!include.some((g) => matchesGlob(path, g))) return false;\n if (exclude?.some((g) => matchesGlob(path, g))) return false;\n return true;\n}\n\nexport function scopeHasEmbeddings(db: DatabaseSync, cfg: ResolvedConfig, scopedPaths: Set<string>): boolean {\n if (!anyPresetEmbeds(cfg)) return false; // the embeddings table doesn't exist at all in this case\n const rows = db.prepare('SELECT DISTINCT \"path\" FROM embeddings').all() as Array<{ path: string }>;\n return rows.some((r) => scopedPaths.has(r.path));\n}\n\n// Scope only (no --where): preset_files for a named preset, JS glob matching for an ad hoc\n// include/exclude override. Shared by scopedPaths() and search(), which also needs the\n// pre-where set to size the candidate-pool filter.\nexport function rawScope(db: DatabaseSync, cfg: ResolvedConfig, overrides: SearchOverrides, allPaths?: string[]): Set<string> {\n const effective = resolveSearch(cfg, overrides);\n const { include, exclude } = effective;\n const adHocScope = overrides.include !== undefined || overrides.exclude !== undefined || overrides.noExclude === true;\n if (!adHocScope) return new Set((db.prepare('SELECT \"path\" FROM preset_files WHERE preset = ?').all(effective.presetName) as Array<{ path: string }>).map((r) => r.path));\n const paths = allPaths ?? (db.prepare('SELECT \"path\" FROM frontmatter').all() as Array<{ path: string }>).map((r) => r.path);\n return new Set(paths.filter((p) => inScope(p, include, exclude)));\n}\n\nexport function narrowByWhere(db: DatabaseSync, paths: Set<string>, where: string | undefined): Set<string> {\n if (!where) return paths;\n const whereRows = db.prepare(`SELECT \"path\" FROM frontmatter f WHERE (${where})`).all() as Array<{ path: string }>;\n const wherePaths = new Set(whereRows.map((r) => r.path));\n return new Set([...paths].filter((p) => wherePaths.has(p)));\n}\n\n// The scope resolver for non-search commands (path, peek, map): same coverage rule search()\n// applies, then narrowed by the resolved `where`.\nexport function scopedPaths(db: DatabaseSync, cfg: ResolvedConfig, overrides: SearchOverrides): Set<string> {\n const effective = resolveSearch(cfg, overrides);\n return narrowByWhere(db, rawScope(db, cfg, overrides), effective.where);\n}\n\n// Materializes a path set into a named temp table (same shape as traverse.ts's allowed_nodes)\n// so a query can join/filter against it cheaply instead of binding a parameter per path.\nexport function materializeScope(db: DatabaseSync, table: string, paths: Set<string>): void {\n db.exec(`DROP TABLE IF EXISTS ${table}`);\n db.exec(`CREATE TEMP TABLE ${table} (\"path\" TEXT PRIMARY KEY)`);\n db.prepare(`INSERT INTO ${table} SELECT DISTINCT value FROM json_each(?1)`).run(JSON.stringify([...paths]));\n}\n\nexport function setupMapScope(db: DatabaseSync, paths: Set<string>): void {\n materializeScope(db, '_map_scope', paths);\n}\n"],"names":["INTERNAL_COLUMNS","inScope","materializeScope","narrowByWhere","rawScope","scopeHasEmbeddings","scopedPaths","setupMapScope","Set","path","include","exclude","some","g","matchesGlob","db","cfg","anyPresetEmbeds","rows","prepare","all","r","has","overrides","allPaths","effective","resolveSearch","adHocScope","undefined","noExclude","presetName","map","paths","filter","p","where","whereRows","wherePaths","table","exec","run","JSON","stringify"],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { ResolvedConfig } from '../config/index.js';
|
|
3
|
+
import type { Row } from '../output.js';
|
|
4
|
+
export interface SearchOptions {
|
|
5
|
+
k?: number;
|
|
6
|
+
where?: string;
|
|
7
|
+
preset?: string;
|
|
8
|
+
include?: string[];
|
|
9
|
+
exclude?: string[];
|
|
10
|
+
noExclude?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function search(db: DatabaseSync, cfg: ResolvedConfig, terms: string, opts?: SearchOptions): Promise<Row[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { ResolvedConfig } from '../config/index.js';
|
|
3
|
+
import type { Row } from '../output.js';
|
|
4
|
+
export interface SearchOptions {
|
|
5
|
+
k?: number;
|
|
6
|
+
where?: string;
|
|
7
|
+
preset?: string;
|
|
8
|
+
include?: string[];
|
|
9
|
+
exclude?: string[];
|
|
10
|
+
noExclude?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function search(db: DatabaseSync, cfg: ResolvedConfig, terms: string, opts?: SearchOptions): Promise<Row[]>;
|