sensemaking 0.5.0 → 0.7.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 +13 -6
- package/dist/cjs/cli.js +8 -1
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/commands/check.d.cts +3 -0
- package/dist/cjs/commands/check.d.ts +3 -0
- package/dist/cjs/commands/check.js +130 -0
- package/dist/cjs/commands/check.js.map +1 -0
- package/dist/cjs/commands/find.js +173 -10
- package/dist/cjs/commands/find.js.map +1 -1
- package/dist/cjs/commands/index.js +5 -0
- package/dist/cjs/commands/index.js.map +1 -1
- package/dist/cjs/commands/map.js +1 -1
- package/dist/cjs/commands/map.js.map +1 -1
- package/dist/cjs/commands/peek.js +1 -1
- package/dist/cjs/commands/peek.js.map +1 -1
- package/dist/cjs/commands/shared.d.cts +1 -1
- package/dist/cjs/commands/shared.d.ts +1 -1
- package/dist/cjs/commands/shared.js +166 -8
- package/dist/cjs/commands/shared.js.map +1 -1
- package/dist/cjs/commands/status.js +72 -5
- package/dist/cjs/commands/status.js.map +1 -1
- package/dist/cjs/commands/types.d.cts +1 -0
- package/dist/cjs/commands/types.d.ts +1 -0
- package/dist/cjs/config.d.cts +32 -2
- package/dist/cjs/config.d.ts +32 -2
- package/dist/cjs/config.js +199 -11
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/db.d.cts +1 -1
- package/dist/cjs/db.d.ts +1 -1
- package/dist/cjs/db.js +47 -17
- package/dist/cjs/db.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.d.cts +15 -0
- package/dist/cjs/features/embed.d.ts +15 -0
- package/dist/cjs/features/embed.js +844 -0
- package/dist/cjs/features/embed.js.map +1 -0
- package/dist/cjs/features/index.js +3 -1
- package/dist/cjs/features/index.js.map +1 -1
- package/dist/cjs/features/types.d.cts +4 -1
- package/dist/cjs/features/types.d.ts +4 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/output.d.cts +5 -0
- package/dist/cjs/output.d.ts +5 -0
- package/dist/cjs/output.js +48 -9
- package/dist/cjs/output.js.map +1 -1
- package/dist/cjs/scan.d.cts +1 -1
- package/dist/cjs/scan.d.ts +1 -1
- package/dist/cjs/scan.js +17 -10
- package/dist/cjs/scan.js.map +1 -1
- package/dist/cjs/verbs.d.cts +8 -2
- package/dist/cjs/verbs.d.ts +8 -2
- package/dist/cjs/verbs.js +308 -81
- package/dist/cjs/verbs.js.map +1 -1
- package/dist/esm/cli.js +8 -1
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/commands/check.d.ts +3 -0
- package/dist/esm/commands/check.js +56 -0
- package/dist/esm/commands/check.js.map +1 -0
- package/dist/esm/commands/find.js +5 -4
- package/dist/esm/commands/find.js.map +1 -1
- package/dist/esm/commands/index.js +1 -0
- package/dist/esm/commands/index.js.map +1 -1
- package/dist/esm/commands/map.js +1 -3
- package/dist/esm/commands/map.js.map +1 -1
- package/dist/esm/commands/peek.js +1 -1
- package/dist/esm/commands/peek.js.map +1 -1
- package/dist/esm/commands/shared.d.ts +1 -1
- package/dist/esm/commands/shared.js +2 -2
- package/dist/esm/commands/shared.js.map +1 -1
- package/dist/esm/commands/status.js +43 -5
- package/dist/esm/commands/status.js.map +1 -1
- package/dist/esm/commands/types.d.ts +1 -0
- package/dist/esm/commands/types.js.map +1 -1
- package/dist/esm/config.d.ts +32 -2
- package/dist/esm/config.js +98 -9
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/db.d.ts +1 -1
- package/dist/esm/db.js +20 -11
- package/dist/esm/db.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.d.ts +15 -0
- package/dist/esm/features/embed.js +299 -0
- package/dist/esm/features/embed.js.map +1 -0
- package/dist/esm/features/index.js +3 -1
- package/dist/esm/features/index.js.map +1 -1
- package/dist/esm/features/types.d.ts +4 -1
- package/dist/esm/features/types.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/output.d.ts +5 -0
- package/dist/esm/output.js +40 -8
- package/dist/esm/output.js.map +1 -1
- package/dist/esm/scan.d.ts +1 -1
- package/dist/esm/scan.js +17 -10
- package/dist/esm/scan.js.map +1 -1
- package/dist/esm/verbs.d.ts +8 -2
- package/dist/esm/verbs.js +92 -18
- package/dist/esm/verbs.js.map +1 -1
- package/package.json +2 -1
- package/schema.json +35 -1
- package/skills/sense/EXAMPLES.md +16 -0
- package/skills/sense/SKILL.md +60 -20
- package/skills/sense-setup/SKILL.md +91 -0
|
@@ -29,6 +29,35 @@ function _array_like_to_array(arr, len) {
|
|
|
29
29
|
function _array_without_holes(arr) {
|
|
30
30
|
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
31
31
|
}
|
|
32
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
33
|
+
try {
|
|
34
|
+
var info = gen[key](arg);
|
|
35
|
+
var value = info.value;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
reject(error);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (info.done) {
|
|
41
|
+
resolve(value);
|
|
42
|
+
} else {
|
|
43
|
+
Promise.resolve(value).then(_next, _throw);
|
|
44
|
+
}
|
|
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
|
+
}
|
|
32
61
|
function _iterable_to_array(iter) {
|
|
33
62
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
34
63
|
}
|
|
@@ -46,6 +75,105 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
46
75
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
47
76
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
48
77
|
}
|
|
78
|
+
function _ts_generator(thisArg, body) {
|
|
79
|
+
var f, y, t, _ = {
|
|
80
|
+
label: 0,
|
|
81
|
+
sent: function() {
|
|
82
|
+
if (t[0] & 1) throw t[1];
|
|
83
|
+
return t[1];
|
|
84
|
+
},
|
|
85
|
+
trys: [],
|
|
86
|
+
ops: []
|
|
87
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
88
|
+
return d(g, "next", {
|
|
89
|
+
value: verb(0)
|
|
90
|
+
}), d(g, "throw", {
|
|
91
|
+
value: verb(1)
|
|
92
|
+
}), d(g, "return", {
|
|
93
|
+
value: verb(2)
|
|
94
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
95
|
+
value: function() {
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
}), g;
|
|
99
|
+
function verb(n) {
|
|
100
|
+
return function(v) {
|
|
101
|
+
return step([
|
|
102
|
+
n,
|
|
103
|
+
v
|
|
104
|
+
]);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function step(op) {
|
|
108
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
109
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
110
|
+
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;
|
|
111
|
+
if (y = 0, t) op = [
|
|
112
|
+
op[0] & 2,
|
|
113
|
+
t.value
|
|
114
|
+
];
|
|
115
|
+
switch(op[0]){
|
|
116
|
+
case 0:
|
|
117
|
+
case 1:
|
|
118
|
+
t = op;
|
|
119
|
+
break;
|
|
120
|
+
case 4:
|
|
121
|
+
_.label++;
|
|
122
|
+
return {
|
|
123
|
+
value: op[1],
|
|
124
|
+
done: false
|
|
125
|
+
};
|
|
126
|
+
case 5:
|
|
127
|
+
_.label++;
|
|
128
|
+
y = op[1];
|
|
129
|
+
op = [
|
|
130
|
+
0
|
|
131
|
+
];
|
|
132
|
+
continue;
|
|
133
|
+
case 7:
|
|
134
|
+
op = _.ops.pop();
|
|
135
|
+
_.trys.pop();
|
|
136
|
+
continue;
|
|
137
|
+
default:
|
|
138
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
139
|
+
_ = 0;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
143
|
+
_.label = op[1];
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
147
|
+
_.label = t[1];
|
|
148
|
+
t = op;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
if (t && _.label < t[2]) {
|
|
152
|
+
_.label = t[2];
|
|
153
|
+
_.ops.push(op);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (t[2]) _.ops.pop();
|
|
157
|
+
_.trys.pop();
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
op = body.call(thisArg, _);
|
|
161
|
+
} catch (e) {
|
|
162
|
+
op = [
|
|
163
|
+
6,
|
|
164
|
+
e
|
|
165
|
+
];
|
|
166
|
+
y = 0;
|
|
167
|
+
} finally{
|
|
168
|
+
f = t = 0;
|
|
169
|
+
}
|
|
170
|
+
if (op[0] & 5) throw op[1];
|
|
171
|
+
return {
|
|
172
|
+
value: op[0] ? op[1] : void 0,
|
|
173
|
+
done: true
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
49
177
|
function printWarnings(warnings) {
|
|
50
178
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
51
179
|
try {
|
|
@@ -69,14 +197,44 @@ function printWarnings(warnings) {
|
|
|
69
197
|
}
|
|
70
198
|
}
|
|
71
199
|
function withDb(ctx, fn) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
200
|
+
return _async_to_generator(function() {
|
|
201
|
+
var cfg, _open, db, warnings;
|
|
202
|
+
return _ts_generator(this, function(_state) {
|
|
203
|
+
switch(_state.label){
|
|
204
|
+
case 0:
|
|
205
|
+
cfg = ctx.resolveConfig();
|
|
206
|
+
_open = (0, _dbts.open)(cfg), db = _open.db, warnings = _open.warnings;
|
|
207
|
+
printWarnings(warnings);
|
|
208
|
+
_state.label = 1;
|
|
209
|
+
case 1:
|
|
210
|
+
_state.trys.push([
|
|
211
|
+
1,
|
|
212
|
+
,
|
|
213
|
+
3,
|
|
214
|
+
4
|
|
215
|
+
]);
|
|
216
|
+
return [
|
|
217
|
+
4,
|
|
218
|
+
fn(db, cfg)
|
|
219
|
+
];
|
|
220
|
+
case 2:
|
|
221
|
+
_state.sent();
|
|
222
|
+
return [
|
|
223
|
+
3,
|
|
224
|
+
4
|
|
225
|
+
];
|
|
226
|
+
case 3:
|
|
227
|
+
db.close();
|
|
228
|
+
return [
|
|
229
|
+
7
|
|
230
|
+
];
|
|
231
|
+
case 4:
|
|
232
|
+
return [
|
|
233
|
+
2
|
|
234
|
+
];
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
})();
|
|
80
238
|
}
|
|
81
239
|
function runSql(cfg, sql, params, format, label) {
|
|
82
240
|
var _db_prepare;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/commands/shared.ts"],"sourcesContent":["import type { ResolvedConfig } from '../config.ts';\nimport type { OpenResult } from '../db.ts';\nimport { open } from '../db.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport type { Ctx } from './types.ts';\n\n// Shared open-query-close envelope for commands that touch the tree.\n\nexport function printWarnings(warnings: string[]): void {\n for (const w of warnings) console.warn(w);\n}\n\nexport function withDb(ctx: Ctx, fn: (db: OpenResult['db'], cfg: ResolvedConfig) => void): void {\n const cfg = ctx.resolveConfig();\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n try {\n fn(db, cfg);\n } finally {\n db.close();\n }\n}\n\n// An unbound `?` silently binds NULL, so mismatched param counts fail loudly instead.\nexport function runSql(cfg: ResolvedConfig, sql: string, params: string[], format: 'table' | 'json', label: string): void {\n const placeholderCount = (sql.match(/\\?/g) ?? []).length;\n if (params.length !== placeholderCount) {\n console.error(`${label} expects ${placeholderCount} parameter(s), got ${params.length}`);\n process.exit(2);\n }\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n printRows(db.prepare(sql).all(...params) as Row[], format);\n db.close();\n}\n"],"names":["printWarnings","runSql","withDb","warnings","w","console","warn","ctx","fn","cfg","
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/commands/shared.ts"],"sourcesContent":["import type { ResolvedConfig } from '../config.ts';\nimport type { OpenResult } from '../db.ts';\nimport { open } from '../db.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport type { Ctx } from './types.ts';\n\n// Shared open-query-close envelope for commands that touch the tree.\n\nexport function printWarnings(warnings: string[]): void {\n for (const w of warnings) console.warn(w);\n}\n\nexport async function withDb(ctx: Ctx, fn: (db: OpenResult['db'], cfg: ResolvedConfig) => void | Promise<void>): Promise<void> {\n const cfg = ctx.resolveConfig();\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n try {\n await fn(db, cfg);\n } finally {\n db.close();\n }\n}\n\n// An unbound `?` silently binds NULL, so mismatched param counts fail loudly instead.\nexport function runSql(cfg: ResolvedConfig, sql: string, params: string[], format: 'table' | 'json', label: string): void {\n const placeholderCount = (sql.match(/\\?/g) ?? []).length;\n if (params.length !== placeholderCount) {\n console.error(`${label} expects ${placeholderCount} parameter(s), got ${params.length}`);\n process.exit(2);\n }\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n printRows(db.prepare(sql).all(...params) as Row[], format);\n db.close();\n}\n"],"names":["printWarnings","runSql","withDb","warnings","w","console","warn","ctx","fn","cfg","open","db","resolveConfig","close","sql","params","format","label","placeholderCount","match","length","error","process","exit","printRows","prepare","all"],"mappings":";;;;;;;;;;;QASgBA;eAAAA;;QAgBAC;eAAAA;;QAZMC;eAAAA;;;oBAXD;wBAEK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKnB,SAASF,cAAcG,QAAkB;QACzC,kCAAA,2BAAA;;QAAL,QAAK,YAAWA,6BAAX,SAAA,6BAAA,QAAA,yBAAA;YAAA,IAAMC,IAAN;YAAqBC,QAAQC,IAAI,CAACF;;;QAAlC;QAAA;;;iBAAA,6BAAA;gBAAA;;;gBAAA;sBAAA;;;;AACP;AAEO,SAAeF,OAAOK,GAAQ,EAAEC,EAAuE;;YACtGC,KACmBC,OAAjBC,IAAIR;;;;oBADNM,MAAMF,IAAIK,aAAa;oBACJF,QAAAA,IAAAA,UAAI,EAACD,MAAtBE,KAAiBD,MAAjBC,IAAIR,WAAaO,MAAbP;oBACZH,cAAcG;;;;;;;;;oBAEZ;;wBAAMK,GAAGG,IAAIF;;;oBAAb;;;;;;oBAEAE,GAAGE,KAAK;;;;;;;;;;IAEZ;;AAGO,SAASZ,OAAOQ,GAAmB,EAAEK,GAAW,EAAEC,MAAgB,EAAEC,MAAwB,EAAEC,KAAa;QAQtGN;QAPgBG;IAA1B,IAAMI,mBAAmB,EAACJ,aAAAA,IAAIK,KAAK,CAAC,oBAAVL,wBAAAA,aAAoB,EAAE,EAAEM,MAAM;IACxD,IAAIL,OAAOK,MAAM,KAAKF,kBAAkB;QACtCb,QAAQgB,KAAK,CAAC,AAAC,GAAmBH,OAAjBD,OAAM,aAAiDF,OAAtCG,kBAAiB,uBAAmC,OAAdH,OAAOK,MAAM;QACrFE,QAAQC,IAAI,CAAC;IACf;IACA,IAAyBb,QAAAA,IAAAA,UAAI,EAACD,MAAtBE,KAAiBD,MAAjBC,IAAIR,WAAaO,MAAbP;IACZH,cAAcG;IACdqB,IAAAA,mBAAS,EAACb,CAAAA,cAAAA,GAAGc,OAAO,CAACX,MAAKY,GAAG,OAAnBf,aAAoB,qBAAGI,UAAkBC;IACnDL,GAAGE,KAAK;AACV"}
|
|
@@ -8,16 +8,83 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _configts = require("../config.js");
|
|
11
12
|
var _dbts = require("../db.js");
|
|
12
13
|
var _sharedts = require("./shared.js");
|
|
14
|
+
function _define_property(obj, key, value) {
|
|
15
|
+
if (key in obj) {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
value: value,
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
obj[key] = value;
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
function _object_spread(target) {
|
|
28
|
+
for(var i = 1; i < arguments.length; i++){
|
|
29
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
30
|
+
var ownKeys = Object.keys(source);
|
|
31
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
32
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
33
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
ownKeys.forEach(function(key) {
|
|
37
|
+
_define_property(target, key, source[key]);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return target;
|
|
41
|
+
}
|
|
42
|
+
// Vectors are computed on the first semantic query, not at reconcile, so a tree can be
|
|
43
|
+
// embed-enabled with nothing embedded yet -- reported here because a fast `rebuild` on an
|
|
44
|
+
// embed tree otherwise reads as "the feature isn't on".
|
|
45
|
+
function vectorState(db) {
|
|
46
|
+
try {
|
|
47
|
+
var row = db.prepare('SELECT COUNT(vector) AS embedded, COUNT(*) - COUNT(vector) AS pending FROM embeddings').get();
|
|
48
|
+
return row;
|
|
49
|
+
} catch (unused) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
13
53
|
var status = function status(ctx) {
|
|
14
|
-
var
|
|
54
|
+
var _ref;
|
|
55
|
+
var _cfg_defaults_find, _cfg_defaults;
|
|
56
|
+
var cfg = ctx.resolveConfig();
|
|
57
|
+
var _open = (0, _dbts.open)(cfg), db = _open.db, dbPath = _open.dbPath, warnings = _open.warnings;
|
|
15
58
|
(0, _sharedts.printWarnings)(warnings);
|
|
16
|
-
|
|
17
|
-
|
|
59
|
+
var features = (0, _configts.featureStates)(cfg);
|
|
60
|
+
var e = (0, _configts.embedConfig)(cfg);
|
|
61
|
+
var vectors = e ? vectorState(db) : null;
|
|
18
62
|
var heartbeat = (0, _dbts.getMeta)(db, 'watch_heartbeat');
|
|
19
|
-
|
|
20
|
-
|
|
63
|
+
var result = {
|
|
64
|
+
db: dbPath,
|
|
65
|
+
docs: (0, _dbts.docCount)(db),
|
|
66
|
+
features: features.on,
|
|
67
|
+
featuresOff: features.off,
|
|
68
|
+
embed: e ? _object_spread({
|
|
69
|
+
type: e.type,
|
|
70
|
+
model: e.model
|
|
71
|
+
}, vectors !== null && vectors !== void 0 ? vectors : {}) : null,
|
|
72
|
+
findDefaultWhere: (_ref = (_cfg_defaults = cfg.defaults) === null || _cfg_defaults === void 0 ? void 0 : (_cfg_defaults_find = _cfg_defaults.find) === null || _cfg_defaults_find === void 0 ? void 0 : _cfg_defaults_find.where) !== null && _ref !== void 0 ? _ref : null,
|
|
73
|
+
watcherHeartbeatSecondsAgo: heartbeat ? Math.round((Date.now() - Date.parse(heartbeat)) / 1000) : null
|
|
74
|
+
};
|
|
75
|
+
if (ctx.format === 'json') {
|
|
76
|
+
console.log(JSON.stringify(result, null, 2));
|
|
77
|
+
} else {
|
|
78
|
+
console.log("db: ".concat(result.db));
|
|
79
|
+
console.log("docs: ".concat(result.docs));
|
|
80
|
+
var off = features.off.length > 0 ? " \xb7 off: ".concat(features.off.map(function(name) {
|
|
81
|
+
return "".concat(name, " (features.").concat(name, ")");
|
|
82
|
+
}).join(', ')) : '';
|
|
83
|
+
console.log("features: ".concat(features.on.join(', ')).concat(off));
|
|
84
|
+
if (e) console.log("embed: ".concat(e.type, " ").concat(e.model).concat(vectors ? " (vectors: ".concat(vectors.embedded, " embedded, ").concat(vectors.pending, " pending — embedded on first --semantic query)") : ''));
|
|
85
|
+
if (result.findDefaultWhere) console.log("find default scope: ".concat(result.findDefaultWhere, " (--where replaces it)"));
|
|
86
|
+
console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: no watcher' : "watcher: last heartbeat ".concat(result.watcherHeartbeatSecondsAgo, "s ago"));
|
|
87
|
+
}
|
|
21
88
|
db.close();
|
|
22
89
|
};
|
|
23
90
|
var _default = status;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/commands/status.ts"],"sourcesContent":["import { docCount, getMeta, open } from '../db.ts';\nimport { printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst status: Command = (ctx) => {\n const { db, dbPath, warnings } = open(
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/commands/status.ts"],"sourcesContent":["import { embedConfig, featureStates } from '../config.ts';\nimport { docCount, getMeta, open } from '../db.ts';\nimport { printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// Vectors are computed on the first semantic query, not at reconcile, so a tree can be\n// embed-enabled with nothing embedded yet -- reported here because a fast `rebuild` on an\n// embed tree otherwise reads as \"the feature isn't on\".\nfunction vectorState(db: ReturnType<typeof open>['db']): { embedded: number; pending: number } | null {\n try {\n const row = db.prepare('SELECT COUNT(vector) AS embedded, COUNT(*) - COUNT(vector) AS pending FROM embeddings').get() as { embedded: number; pending: number };\n return row;\n } catch {\n return null;\n }\n}\n\nconst status: Command = (ctx) => {\n const cfg = ctx.resolveConfig();\n const { db, dbPath, warnings } = open(cfg);\n printWarnings(warnings);\n\n const features = featureStates(cfg);\n const e = embedConfig(cfg);\n const vectors = e ? vectorState(db) : null;\n const heartbeat = getMeta(db, 'watch_heartbeat');\n const result = {\n db: dbPath,\n docs: docCount(db),\n features: features.on,\n featuresOff: features.off,\n embed: e ? { type: e.type, model: e.model, ...(vectors ?? {}) } : null,\n findDefaultWhere: cfg.defaults?.find?.where ?? null,\n watcherHeartbeatSecondsAgo: heartbeat ? Math.round((Date.now() - Date.parse(heartbeat)) / 1000) : null,\n };\n\n if (ctx.format === 'json') {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`db: ${result.db}`);\n console.log(`docs: ${result.docs}`);\n const off = features.off.length > 0 ? ` · off: ${features.off.map((name) => `${name} (features.${name})`).join(', ')}` : '';\n console.log(`features: ${features.on.join(', ')}${off}`);\n if (e) console.log(`embed: ${e.type} ${e.model}${vectors ? ` (vectors: ${vectors.embedded} embedded, ${vectors.pending} pending — embedded on first --semantic query)` : ''}`);\n if (result.findDefaultWhere) console.log(`find default scope: ${result.findDefaultWhere} (--where replaces it)`);\n console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: no watcher' : `watcher: last heartbeat ${result.watcherHeartbeatSecondsAgo}s ago`);\n }\n db.close();\n};\nexport default status;\n"],"names":["vectorState","db","row","prepare","get","status","ctx","cfg","resolveConfig","open","dbPath","warnings","printWarnings","features","featureStates","e","embedConfig","vectors","heartbeat","getMeta","result","docs","docCount","on","featuresOff","off","embed","type","model","findDefaultWhere","defaults","find","where","watcherHeartbeatSecondsAgo","Math","round","Date","now","parse","format","console","log","JSON","stringify","length","map","name","join","embedded","pending","close"],"mappings":";;;;+BAiDA;;;eAAA;;;wBAjD2C;oBACH;wBACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,uFAAuF;AACvF,0FAA0F;AAC1F,wDAAwD;AACxD,SAASA,YAAYC,EAAiC;IACpD,IAAI;QACF,IAAMC,MAAMD,GAAGE,OAAO,CAAC,yFAAyFC,GAAG;QACnH,OAAOF;IACT,EAAE,eAAM;QACN,OAAO;IACT;AACF;AAEA,IAAMG,SAAkB,gBAACC;;QAeHC,oBAAAA;IAdpB,IAAMA,MAAMD,IAAIE,aAAa;IAC7B,IAAiCC,QAAAA,IAAAA,UAAI,EAACF,MAA9BN,KAAyBQ,MAAzBR,IAAIS,SAAqBD,MAArBC,QAAQC,WAAaF,MAAbE;IACpBC,IAAAA,uBAAa,EAACD;IAEd,IAAME,WAAWC,IAAAA,uBAAa,EAACP;IAC/B,IAAMQ,IAAIC,IAAAA,qBAAW,EAACT;IACtB,IAAMU,UAAUF,IAAIf,YAAYC,MAAM;IACtC,IAAMiB,YAAYC,IAAAA,aAAO,EAAClB,IAAI;IAC9B,IAAMmB,SAAS;QACbnB,IAAIS;QACJW,MAAMC,IAAAA,cAAQ,EAACrB;QACfY,UAAUA,SAASU,EAAE;QACrBC,aAAaX,SAASY,GAAG;QACzBC,OAAOX,IAAI;YAAEY,MAAMZ,EAAEY,IAAI;YAAEC,OAAOb,EAAEa,KAAK;WAAMX,oBAAAA,qBAAAA,UAAW,CAAC,KAAO;QAClEY,gBAAgB,WAAEtB,gBAAAA,IAAIuB,QAAQ,cAAZvB,qCAAAA,qBAAAA,cAAcwB,IAAI,cAAlBxB,yCAAAA,mBAAoByB,KAAK,uCAAI;QAC/CC,4BAA4Bf,YAAYgB,KAAKC,KAAK,CAAC,AAACC,CAAAA,KAAKC,GAAG,KAAKD,KAAKE,KAAK,CAACpB,UAAS,IAAK,QAAQ;IACpG;IAEA,IAAIZ,IAAIiC,MAAM,KAAK,QAAQ;QACzBC,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAACvB,QAAQ,MAAM;IAC3C,OAAO;QACLoB,QAAQC,GAAG,CAAC,AAAC,OAAgB,OAAVrB,OAAOnB,EAAE;QAC5BuC,QAAQC,GAAG,CAAC,AAAC,SAAoB,OAAZrB,OAAOC,IAAI;QAChC,IAAMI,MAAMZ,SAASY,GAAG,CAACmB,MAAM,GAAG,IAAI,AAAC,cAA8E,OAApE/B,SAASY,GAAG,CAACoB,GAAG,CAAC,SAACC;mBAAS,AAAC,GAAoBA,OAAlBA,MAAK,eAAkB,OAALA,MAAK;WAAIC,IAAI,CAAC,SAAU;QACzHP,QAAQC,GAAG,CAAC,AAAC,aAAqChB,OAAzBZ,SAASU,EAAE,CAACwB,IAAI,CAAC,OAAY,OAAJtB;QAClD,IAAIV,GAAGyB,QAAQC,GAAG,CAAC,AAAC,UAAmB1B,OAAVA,EAAEY,IAAI,EAAC,KAAaV,OAAVF,EAAEa,KAAK,EAA8H,OAA3HX,UAAU,AAAC,cAA2CA,OAA9BA,QAAQ+B,QAAQ,EAAC,eAA6B,OAAhB/B,QAAQgC,OAAO,EAAC,oDAAkD;QACzK,IAAI7B,OAAOS,gBAAgB,EAAEW,QAAQC,GAAG,CAAC,AAAC,uBAA8C,OAAxBrB,OAAOS,gBAAgB,EAAC;QACxFW,QAAQC,GAAG,CAACrB,OAAOa,0BAA0B,KAAK,OAAO,wBAAwB,AAAC,2BAA4D,OAAlCb,OAAOa,0BAA0B,EAAC;IAChJ;IACAhC,GAAGiD,KAAK;AACV;IACA,WAAe7C"}
|
package/dist/cjs/config.d.cts
CHANGED
|
@@ -1,24 +1,53 @@
|
|
|
1
1
|
export declare const CONFIG_FILENAME = "sense.config.json";
|
|
2
2
|
export declare const STATE_DIR = ".sense";
|
|
3
3
|
export declare const SUPPORTED_CONFIG_VERSION = 2;
|
|
4
|
-
|
|
4
|
+
declare const FEATURE_NAMES: readonly ["links", "sections", "rank", "embed"];
|
|
5
5
|
export type FeatureName = (typeof FEATURE_NAMES)[number];
|
|
6
|
+
export interface EmbedConfig {
|
|
7
|
+
model?: string;
|
|
8
|
+
type?: 'static' | 'api';
|
|
9
|
+
url?: string;
|
|
10
|
+
key?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_EMBED_MODEL = "minishlab/potion-retrieval-32M";
|
|
6
13
|
export interface Config {
|
|
7
14
|
$schema?: string;
|
|
8
15
|
version?: number;
|
|
9
16
|
scan: {
|
|
10
17
|
include: string[];
|
|
11
18
|
};
|
|
12
|
-
features?:
|
|
19
|
+
features?: {
|
|
20
|
+
links?: boolean;
|
|
21
|
+
sections?: boolean;
|
|
22
|
+
rank?: boolean;
|
|
23
|
+
embed?: boolean | EmbedConfig;
|
|
24
|
+
};
|
|
25
|
+
defaults?: {
|
|
26
|
+
find?: {
|
|
27
|
+
where?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
13
30
|
queries: Record<string, string>;
|
|
14
31
|
}
|
|
15
32
|
export interface ResolvedConfig extends Config {
|
|
16
33
|
baseDir: string;
|
|
17
34
|
configPath: string | null;
|
|
35
|
+
unknownKeys?: string[];
|
|
18
36
|
migratedFrom?: number;
|
|
19
37
|
}
|
|
20
38
|
export declare function featureEnabled(cfg: Config, name: FeatureName): boolean;
|
|
21
39
|
export declare function enabledFeatures(cfg: Config): FeatureName[];
|
|
40
|
+
export declare function featureStates(cfg: Config): {
|
|
41
|
+
on: FeatureName[];
|
|
42
|
+
off: FeatureName[];
|
|
43
|
+
};
|
|
44
|
+
export declare function embedConfig(cfg: Config): {
|
|
45
|
+
model: string;
|
|
46
|
+
type: 'static' | 'api';
|
|
47
|
+
url?: string;
|
|
48
|
+
key?: string;
|
|
49
|
+
} | null;
|
|
50
|
+
export declare function featureSignature(cfg: Config): string;
|
|
22
51
|
export declare function migrateConfig(cfg: Config): {
|
|
23
52
|
cfg: Config;
|
|
24
53
|
from: number;
|
|
@@ -26,3 +55,4 @@ export declare function migrateConfig(cfg: Config): {
|
|
|
26
55
|
export declare function initConfig(dir: string): string;
|
|
27
56
|
export declare function findConfigPath(startDir: string): string | null;
|
|
28
57
|
export declare function loadConfig(explicitPath?: string): ResolvedConfig;
|
|
58
|
+
export {};
|
package/dist/cjs/config.d.ts
CHANGED
|
@@ -1,24 +1,53 @@
|
|
|
1
1
|
export declare const CONFIG_FILENAME = "sense.config.json";
|
|
2
2
|
export declare const STATE_DIR = ".sense";
|
|
3
3
|
export declare const SUPPORTED_CONFIG_VERSION = 2;
|
|
4
|
-
|
|
4
|
+
declare const FEATURE_NAMES: readonly ["links", "sections", "rank", "embed"];
|
|
5
5
|
export type FeatureName = (typeof FEATURE_NAMES)[number];
|
|
6
|
+
export interface EmbedConfig {
|
|
7
|
+
model?: string;
|
|
8
|
+
type?: 'static' | 'api';
|
|
9
|
+
url?: string;
|
|
10
|
+
key?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_EMBED_MODEL = "minishlab/potion-retrieval-32M";
|
|
6
13
|
export interface Config {
|
|
7
14
|
$schema?: string;
|
|
8
15
|
version?: number;
|
|
9
16
|
scan: {
|
|
10
17
|
include: string[];
|
|
11
18
|
};
|
|
12
|
-
features?:
|
|
19
|
+
features?: {
|
|
20
|
+
links?: boolean;
|
|
21
|
+
sections?: boolean;
|
|
22
|
+
rank?: boolean;
|
|
23
|
+
embed?: boolean | EmbedConfig;
|
|
24
|
+
};
|
|
25
|
+
defaults?: {
|
|
26
|
+
find?: {
|
|
27
|
+
where?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
13
30
|
queries: Record<string, string>;
|
|
14
31
|
}
|
|
15
32
|
export interface ResolvedConfig extends Config {
|
|
16
33
|
baseDir: string;
|
|
17
34
|
configPath: string | null;
|
|
35
|
+
unknownKeys?: string[];
|
|
18
36
|
migratedFrom?: number;
|
|
19
37
|
}
|
|
20
38
|
export declare function featureEnabled(cfg: Config, name: FeatureName): boolean;
|
|
21
39
|
export declare function enabledFeatures(cfg: Config): FeatureName[];
|
|
40
|
+
export declare function featureStates(cfg: Config): {
|
|
41
|
+
on: FeatureName[];
|
|
42
|
+
off: FeatureName[];
|
|
43
|
+
};
|
|
44
|
+
export declare function embedConfig(cfg: Config): {
|
|
45
|
+
model: string;
|
|
46
|
+
type: 'static' | 'api';
|
|
47
|
+
url?: string;
|
|
48
|
+
key?: string;
|
|
49
|
+
} | null;
|
|
50
|
+
export declare function featureSignature(cfg: Config): string;
|
|
22
51
|
export declare function migrateConfig(cfg: Config): {
|
|
23
52
|
cfg: Config;
|
|
24
53
|
from: number;
|
|
@@ -26,3 +55,4 @@ export declare function migrateConfig(cfg: Config): {
|
|
|
26
55
|
export declare function initConfig(dir: string): string;
|
|
27
56
|
export declare function findConfigPath(startDir: string): string | null;
|
|
28
57
|
export declare function loadConfig(explicitPath?: string): ResolvedConfig;
|
|
58
|
+
export {};
|