@getplumb/core 0.1.6 → 0.3.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 +2 -2
- package/dist/embedder.d.ts +16 -2
- package/dist/embedder.d.ts.map +1 -1
- package/dist/embedder.js +23 -4
- package/dist/embedder.js.map +1 -1
- package/dist/extraction-queue.d.ts +13 -3
- package/dist/extraction-queue.d.ts.map +1 -1
- package/dist/extraction-queue.js +21 -4
- package/dist/extraction-queue.js.map +1 -1
- package/dist/extractor.d.ts +2 -1
- package/dist/extractor.d.ts.map +1 -1
- package/dist/extractor.js +106 -7
- package/dist/extractor.js.map +1 -1
- package/dist/extractor.test.d.ts +2 -0
- package/dist/extractor.test.d.ts.map +1 -0
- package/dist/extractor.test.js +158 -0
- package/dist/extractor.test.js.map +1 -0
- package/dist/fact-search.d.ts +9 -5
- package/dist/fact-search.d.ts.map +1 -1
- package/dist/fact-search.js +25 -16
- package/dist/fact-search.js.map +1 -1
- package/dist/fact-search.test.d.ts +12 -0
- package/dist/fact-search.test.d.ts.map +1 -0
- package/dist/fact-search.test.js +117 -0
- package/dist/fact-search.test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/llm-client.d.ts +11 -2
- package/dist/llm-client.d.ts.map +1 -1
- package/dist/llm-client.js +47 -3
- package/dist/llm-client.js.map +1 -1
- package/dist/local-store.d.ts +32 -1
- package/dist/local-store.d.ts.map +1 -1
- package/dist/local-store.js +510 -35
- package/dist/local-store.js.map +1 -1
- package/dist/local-store.test.d.ts +2 -0
- package/dist/local-store.test.d.ts.map +1 -0
- package/dist/local-store.test.js +146 -0
- package/dist/local-store.test.js.map +1 -0
- package/dist/raw-log-search.d.ts +9 -5
- package/dist/raw-log-search.d.ts.map +1 -1
- package/dist/raw-log-search.js +107 -29
- package/dist/raw-log-search.js.map +1 -1
- package/dist/raw-log-search.test.d.ts +12 -0
- package/dist/raw-log-search.test.d.ts.map +1 -0
- package/dist/raw-log-search.test.js +124 -0
- package/dist/raw-log-search.test.js.map +1 -0
- package/dist/read-path.test.d.ts +15 -0
- package/dist/read-path.test.d.ts.map +1 -0
- package/dist/read-path.test.js +393 -0
- package/dist/read-path.test.js.map +1 -0
- package/dist/schema.d.ts +2 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +58 -1
- package/dist/schema.js.map +1 -1
- package/dist/scorer.test.d.ts +10 -0
- package/dist/scorer.test.d.ts.map +1 -0
- package/dist/scorer.test.js +169 -0
- package/dist/scorer.test.js.map +1 -0
- package/dist/store.d.ts +3 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/wasm-db.d.ts +63 -8
- package/dist/wasm-db.d.ts.map +1 -1
- package/dist/wasm-db.js +124 -31
- package/dist/wasm-db.js.map +1 -1
- package/package.json +14 -2
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scorer.test.ts — decay curve verification for scoreFact() and scoreRawLog().
|
|
3
|
+
*
|
|
4
|
+
* Note on the "~0.31 at 49 days medium" reference in the architecture doc:
|
|
5
|
+
* With lambda=0.012 the correct value at 49 days is ~0.528 (confidence=0.95).
|
|
6
|
+
* The ~0.31 figure likely derives from an earlier lambda value (~0.023).
|
|
7
|
+
* These tests assert against the actual computed values for the specified lambdas.
|
|
8
|
+
*/
|
|
9
|
+
import { strict as assert } from 'node:assert';
|
|
10
|
+
import { describe, it } from 'node:test';
|
|
11
|
+
import { DecayRate } from './types.js';
|
|
12
|
+
import { computeDecay, scoreFact, scoreRawLog } from './scorer.js';
|
|
13
|
+
/** Build a minimal Fact for testing. */
|
|
14
|
+
function makeFact(opts) {
|
|
15
|
+
const now = opts.now ?? new Date('2026-01-01T00:00:00.000Z');
|
|
16
|
+
const timestamp = new Date(now.getTime() - opts.ageInDays * 24 * 60 * 60 * 1_000);
|
|
17
|
+
return {
|
|
18
|
+
fact: {
|
|
19
|
+
id: 'test-id',
|
|
20
|
+
subject: 'test subject',
|
|
21
|
+
predicate: 'test predicate',
|
|
22
|
+
object: 'test object',
|
|
23
|
+
confidence: opts.confidence,
|
|
24
|
+
decayRate: opts.decayRate,
|
|
25
|
+
timestamp,
|
|
26
|
+
sourceSessionId: 'session-1',
|
|
27
|
+
},
|
|
28
|
+
now,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
describe('computeDecay', () => {
|
|
32
|
+
it('returns 1.0 at age 0 regardless of lambda', () => {
|
|
33
|
+
assert.equal(computeDecay(0.003, 0), 1.0);
|
|
34
|
+
assert.equal(computeDecay(0.012, 0), 1.0);
|
|
35
|
+
assert.equal(computeDecay(0.05, 0), 1.0);
|
|
36
|
+
});
|
|
37
|
+
it('medium lambda at 49 days matches expected decay', () => {
|
|
38
|
+
const decay = computeDecay(0.012, 49);
|
|
39
|
+
// e^(-0.012 * 49) = e^(-0.588) ≈ 0.5557
|
|
40
|
+
assert.ok(decay > 0.55 && decay < 0.57, `expected ~0.5557, got ${decay}`);
|
|
41
|
+
});
|
|
42
|
+
it('fast lambda decays faster than slow at same age', () => {
|
|
43
|
+
assert.ok(computeDecay(0.05, 30) < computeDecay(0.003, 30));
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe('scoreFact — decay curves', () => {
|
|
47
|
+
it('age=0, slow decay, confidence=0.95 → ~0.95', () => {
|
|
48
|
+
const { fact, now } = makeFact({
|
|
49
|
+
confidence: 0.95,
|
|
50
|
+
decayRate: DecayRate.slow,
|
|
51
|
+
ageInDays: 0,
|
|
52
|
+
});
|
|
53
|
+
const result = scoreFact(fact, now);
|
|
54
|
+
assert.ok(result.score > 0.949 && result.score <= 0.95, `expected ~0.95, got ${result.score}`);
|
|
55
|
+
assert.equal(result.isCold, false);
|
|
56
|
+
});
|
|
57
|
+
it('age=49 days, medium decay, confidence=0.95 → ~0.528', () => {
|
|
58
|
+
const { fact, now } = makeFact({
|
|
59
|
+
confidence: 0.95,
|
|
60
|
+
decayRate: DecayRate.medium,
|
|
61
|
+
ageInDays: 49,
|
|
62
|
+
});
|
|
63
|
+
const result = scoreFact(fact, now);
|
|
64
|
+
// 0.95 × e^(-0.012 × 49) ≈ 0.5277
|
|
65
|
+
assert.ok(result.score > 0.52 && result.score < 0.54, `expected ~0.528, got ${result.score}`);
|
|
66
|
+
assert.equal(result.isCold, false);
|
|
67
|
+
});
|
|
68
|
+
it('age=365 days, medium decay, confidence=0.95 → ~0.012 (near cold)', () => {
|
|
69
|
+
const { fact, now } = makeFact({
|
|
70
|
+
confidence: 0.95,
|
|
71
|
+
decayRate: DecayRate.medium,
|
|
72
|
+
ageInDays: 365,
|
|
73
|
+
});
|
|
74
|
+
const result = scoreFact(fact, now);
|
|
75
|
+
// 0.95 × e^(-0.012 × 365) ≈ 0.01190
|
|
76
|
+
assert.ok(result.score > 0.01 && result.score < 0.02, `expected ~0.012, got ${result.score}`);
|
|
77
|
+
assert.equal(result.isCold, false);
|
|
78
|
+
});
|
|
79
|
+
it('age=400 days, medium decay, confidence=0.95 → isCold (score < 0.01)', () => {
|
|
80
|
+
const { fact, now } = makeFact({
|
|
81
|
+
confidence: 0.95,
|
|
82
|
+
decayRate: DecayRate.medium,
|
|
83
|
+
ageInDays: 400,
|
|
84
|
+
});
|
|
85
|
+
const result = scoreFact(fact, now);
|
|
86
|
+
// 0.95 × e^(-0.012 × 400) ≈ 0.00782
|
|
87
|
+
assert.ok(result.score < 0.01, `expected score < 0.01, got ${result.score}`);
|
|
88
|
+
assert.equal(result.isCold, true);
|
|
89
|
+
});
|
|
90
|
+
it('age=30 days, fast decay, confidence=0.95 → < 0.25', () => {
|
|
91
|
+
const { fact, now } = makeFact({
|
|
92
|
+
confidence: 0.95,
|
|
93
|
+
decayRate: DecayRate.fast,
|
|
94
|
+
ageInDays: 30,
|
|
95
|
+
});
|
|
96
|
+
const result = scoreFact(fact, now);
|
|
97
|
+
// 0.95 × e^(-0.05 × 30) ≈ 0.2120
|
|
98
|
+
assert.ok(result.score < 0.25, `expected < 0.25, got ${result.score}`);
|
|
99
|
+
assert.equal(result.isCold, false);
|
|
100
|
+
});
|
|
101
|
+
it('confidence=0 → score=0, isCold=true', () => {
|
|
102
|
+
const { fact, now } = makeFact({
|
|
103
|
+
confidence: 0,
|
|
104
|
+
decayRate: DecayRate.medium,
|
|
105
|
+
ageInDays: 49,
|
|
106
|
+
});
|
|
107
|
+
const result = scoreFact(fact, now);
|
|
108
|
+
assert.equal(result.score, 0);
|
|
109
|
+
assert.equal(result.isCold, true);
|
|
110
|
+
});
|
|
111
|
+
it('score is bounded between 0 and 1', () => {
|
|
112
|
+
const ages = [0, 1, 30, 100, 365, 730];
|
|
113
|
+
const rates = [DecayRate.slow, DecayRate.medium, DecayRate.fast];
|
|
114
|
+
for (const ageInDays of ages) {
|
|
115
|
+
for (const decayRate of rates) {
|
|
116
|
+
const { fact, now } = makeFact({ confidence: 0.95, decayRate, ageInDays });
|
|
117
|
+
const { score } = scoreFact(fact, now);
|
|
118
|
+
assert.ok(score >= 0 && score <= 1, `score out of range: ${score}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
it('uses current time when now is omitted (smoke test)', () => {
|
|
123
|
+
const fact = {
|
|
124
|
+
id: 'x',
|
|
125
|
+
subject: 's',
|
|
126
|
+
predicate: 'p',
|
|
127
|
+
object: 'o',
|
|
128
|
+
confidence: 0.8,
|
|
129
|
+
decayRate: DecayRate.slow,
|
|
130
|
+
timestamp: new Date(),
|
|
131
|
+
sourceSessionId: 'sess',
|
|
132
|
+
};
|
|
133
|
+
// Should not throw; score should be close to 0.8 for age≈0
|
|
134
|
+
const { score } = scoreFact(fact);
|
|
135
|
+
assert.ok(score > 0.79 && score <= 0.8, `expected ~0.8, got ${score}`);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
describe('scoreRawLog — medium decay', () => {
|
|
139
|
+
it('age=0 → score ≈ 1.0, not cold', () => {
|
|
140
|
+
const now = new Date('2026-01-01T00:00:00.000Z');
|
|
141
|
+
const chunk = { timestamp: now };
|
|
142
|
+
const result = scoreRawLog(chunk, now);
|
|
143
|
+
assert.equal(result.score, 1.0);
|
|
144
|
+
assert.equal(result.isCold, false);
|
|
145
|
+
});
|
|
146
|
+
it('age=49 days → score ~0.557 (medium decay on base 1.0)', () => {
|
|
147
|
+
const now = new Date('2026-01-01T00:00:00.000Z');
|
|
148
|
+
const timestamp = new Date(now.getTime() - 49 * 24 * 60 * 60 * 1_000);
|
|
149
|
+
const result = scoreRawLog({ timestamp }, now);
|
|
150
|
+
// e^(-0.012 × 49) ≈ 0.5557
|
|
151
|
+
assert.ok(result.score > 0.54 && result.score < 0.57, `expected ~0.556, got ${result.score}`);
|
|
152
|
+
assert.equal(result.isCold, false);
|
|
153
|
+
});
|
|
154
|
+
it('age=365 days → score ~0.0125, not yet cold', () => {
|
|
155
|
+
const now = new Date('2026-01-01T00:00:00.000Z');
|
|
156
|
+
const timestamp = new Date(now.getTime() - 365 * 24 * 60 * 60 * 1_000);
|
|
157
|
+
const result = scoreRawLog({ timestamp }, now);
|
|
158
|
+
assert.ok(result.score > 0.01 && result.score < 0.02, `expected ~0.0125, got ${result.score}`);
|
|
159
|
+
assert.equal(result.isCold, false);
|
|
160
|
+
});
|
|
161
|
+
it('age=400 days → isCold', () => {
|
|
162
|
+
const now = new Date('2026-01-01T00:00:00.000Z');
|
|
163
|
+
const timestamp = new Date(now.getTime() - 400 * 24 * 60 * 60 * 1_000);
|
|
164
|
+
const result = scoreRawLog({ timestamp }, now);
|
|
165
|
+
assert.ok(result.score < 0.01, `expected < 0.01, got ${result.score}`);
|
|
166
|
+
assert.equal(result.isCold, true);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
//# sourceMappingURL=scorer.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scorer.test.js","sourceRoot":"","sources":["../src/scorer.test.ts"],"names":[],"mappings":"AAAA;;;;;;;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AK,GAAG,IAAI,IAAI,MAAM,CAAC,KAAK,GAAG,IAAI,EAC1C,yBAAyB,MAAM,CAAC,KAAK,EAAE,CACxC,CAAC;QACF,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC;QACvE,MAAM,MAAM,GAAG,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,GAAG,CAAC,CAAC;QAC/C,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,EAAE,wBAAwB,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACvE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/store.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import type { Fact, IngestResult, MessageExchange, SearchResult, StoreStatus } f
|
|
|
2
2
|
export interface MemoryStore {
|
|
3
3
|
/**
|
|
4
4
|
* Write a fact to the store. The store generates and returns the id.
|
|
5
|
+
* @param fact - The fact to store (id will be generated).
|
|
6
|
+
* @param sourceChunkId - Optional raw_log chunk ID (T-079 processing state machine).
|
|
5
7
|
*/
|
|
6
|
-
store(fact: Omit<Fact, 'id'
|
|
8
|
+
store(fact: Omit<Fact, 'id'>, sourceChunkId?: string): Promise<string>;
|
|
7
9
|
/**
|
|
8
10
|
* Search for facts matching the query. Returns ranked results with score and age.
|
|
9
11
|
*/
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEjG,MAAM,WAAW,WAAW;IAC1B
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEjG,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvE;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAAC;IAExE;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAE/B;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1D"}
|
package/dist/wasm-db.d.ts
CHANGED
|
@@ -1,14 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* SQLite database wrapper using better-sqlite3.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the previous @sqlite.org/sqlite-wasm implementation which cannot
|
|
5
|
+
* open real filesystem paths in a Node.js environment.
|
|
6
|
+
*
|
|
7
|
+
* Exposes a WasmDb-compatible interface so local-store.ts and schema.ts
|
|
8
|
+
* require no changes:
|
|
9
|
+
* - db.exec(sql: string)
|
|
10
|
+
* - db.exec({ sql, rowMode: 'object', returnValue: 'resultRows' }) → rows[]
|
|
11
|
+
* - db.prepare(sql) → stmt with .bind([...]), .step(), .get(colOrObj), .finalize()
|
|
12
|
+
* - db.selectValue(sql)
|
|
13
|
+
* - db.close()
|
|
5
14
|
*/
|
|
6
|
-
import
|
|
7
|
-
type
|
|
8
|
-
|
|
15
|
+
import Database from 'better-sqlite3';
|
|
16
|
+
type ExecOptions = {
|
|
17
|
+
sql: string;
|
|
18
|
+
rowMode?: 'object' | 'array';
|
|
19
|
+
returnValue?: 'resultRows';
|
|
20
|
+
};
|
|
9
21
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
22
|
+
* Thin statement wrapper that adapts better-sqlite3's API to the wasm oo1 style
|
|
23
|
+
* used throughout local-store.ts, fact-search.ts, and raw-log-search.ts.
|
|
24
|
+
*/
|
|
25
|
+
declare class CompatStatement {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(stmt: Database.Statement);
|
|
28
|
+
bind(params: unknown[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Execute the statement. For SELECT statements, caches all rows for get().
|
|
31
|
+
* For write statements (INSERT/UPDATE/DELETE/PRAGMA writes), runs immediately.
|
|
32
|
+
*/
|
|
33
|
+
step(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Get a value from the current row.
|
|
36
|
+
* - get(colIndex: number) → scalar at that column index
|
|
37
|
+
* - get({}) → plain object with column names as keys
|
|
38
|
+
*/
|
|
39
|
+
get(colOrObj: number | Record<string, unknown>): unknown;
|
|
40
|
+
finalize(): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Thin database wrapper adapting better-sqlite3 to the wasm oo1 API surface
|
|
44
|
+
* used by local-store.ts and schema.ts.
|
|
45
|
+
*/
|
|
46
|
+
declare class CompatDb {
|
|
47
|
+
#private;
|
|
48
|
+
constructor(path: string);
|
|
49
|
+
/**
|
|
50
|
+
* Execute SQL.
|
|
51
|
+
* - exec(sql: string) — plain execution, no return value
|
|
52
|
+
* - exec({ sql, returnValue: 'resultRows' }) — returns array of row objects
|
|
53
|
+
*/
|
|
54
|
+
exec(sqlOrOpts: string | ExecOptions): unknown[] | void;
|
|
55
|
+
prepare(sql: string): CompatStatement;
|
|
56
|
+
/**
|
|
57
|
+
* Execute a single-value query and return the first column of the first row.
|
|
58
|
+
*/
|
|
59
|
+
selectValue(sql: string): unknown;
|
|
60
|
+
close(): void;
|
|
61
|
+
}
|
|
62
|
+
export type WasmDb = CompatDb;
|
|
63
|
+
/**
|
|
64
|
+
* Open a SQLite database file.
|
|
65
|
+
* Creates the file if it doesn't exist.
|
|
66
|
+
* Returns a promise for API compatibility with the previous wasm implementation.
|
|
12
67
|
*/
|
|
13
68
|
export declare function openDb(path: string): Promise<WasmDb>;
|
|
14
69
|
export {};
|
package/dist/wasm-db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-db.d.ts","sourceRoot":"","sources":["../src/wasm-db.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wasm-db.d.ts","sourceRoot":"","sources":["../src/wasm-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,cAAM,eAAe;;gBAOP,IAAI,EAAE,QAAQ,CAAC,SAAS;IAIpC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI;IAI7B;;;OAGG;IACH,IAAI,IAAI,OAAO;IAqBf;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO;IAgBxD,QAAQ,IAAI,IAAI;CAMjB;AAED;;;GAGG;AACH,cAAM,QAAQ;;gBAGA,IAAI,EAAE,MAAM;IAIxB;;;;OAIG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,EAAE,GAAG,IAAI;IAYvD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe;IAKrC;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAKjC,KAAK,IAAI,IAAI;CAGd;AAED,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;AAE9B;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1D"}
|
package/dist/wasm-db.js
CHANGED
|
@@ -1,39 +1,132 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* SQLite database wrapper using better-sqlite3.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the previous @sqlite.org/sqlite-wasm implementation which cannot
|
|
5
|
+
* open real filesystem paths in a Node.js environment.
|
|
6
|
+
*
|
|
7
|
+
* Exposes a WasmDb-compatible interface so local-store.ts and schema.ts
|
|
8
|
+
* require no changes:
|
|
9
|
+
* - db.exec(sql: string)
|
|
10
|
+
* - db.exec({ sql, rowMode: 'object', returnValue: 'resultRows' }) → rows[]
|
|
11
|
+
* - db.prepare(sql) → stmt with .bind([...]), .step(), .get(colOrObj), .finalize()
|
|
12
|
+
* - db.selectValue(sql)
|
|
13
|
+
* - db.close()
|
|
5
14
|
*/
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
import Database from 'better-sqlite3';
|
|
16
|
+
/**
|
|
17
|
+
* Thin statement wrapper that adapts better-sqlite3's API to the wasm oo1 style
|
|
18
|
+
* used throughout local-store.ts, fact-search.ts, and raw-log-search.ts.
|
|
19
|
+
*/
|
|
20
|
+
class CompatStatement {
|
|
21
|
+
#stmt;
|
|
22
|
+
#params = [];
|
|
23
|
+
#rows = null;
|
|
24
|
+
#rowIndex = 0;
|
|
25
|
+
#columnNames = [];
|
|
26
|
+
constructor(stmt) {
|
|
27
|
+
this.#stmt = stmt;
|
|
28
|
+
}
|
|
29
|
+
bind(params) {
|
|
30
|
+
this.#params = params;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Execute the statement. For SELECT statements, caches all rows for get().
|
|
34
|
+
* For write statements (INSERT/UPDATE/DELETE/PRAGMA writes), runs immediately.
|
|
35
|
+
*/
|
|
36
|
+
step() {
|
|
37
|
+
if (this.#stmt.reader) {
|
|
38
|
+
// SELECT — cache all rows on first call
|
|
39
|
+
if (this.#rows === null) {
|
|
40
|
+
const raw = this.#stmt.raw(true).all(...this.#params);
|
|
41
|
+
this.#rows = raw;
|
|
42
|
+
this.#rowIndex = 0;
|
|
43
|
+
this.#columnNames = this.#stmt.columns().map((c) => c.name);
|
|
44
|
+
}
|
|
45
|
+
if (this.#rowIndex < this.#rows.length) {
|
|
46
|
+
this.#rowIndex++;
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Write statement
|
|
53
|
+
this.#stmt.run(...this.#params);
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get a value from the current row.
|
|
59
|
+
* - get(colIndex: number) → scalar at that column index
|
|
60
|
+
* - get({}) → plain object with column names as keys
|
|
61
|
+
*/
|
|
62
|
+
get(colOrObj) {
|
|
63
|
+
if (this.#rows === null || this.#rowIndex === 0)
|
|
64
|
+
return null;
|
|
65
|
+
const row = this.#rows[this.#rowIndex - 1];
|
|
66
|
+
if (row === undefined)
|
|
67
|
+
return null;
|
|
68
|
+
if (typeof colOrObj === 'number') {
|
|
69
|
+
return row[colOrObj];
|
|
70
|
+
}
|
|
71
|
+
// Object form — zip column names with row values
|
|
72
|
+
const obj = {};
|
|
73
|
+
for (let i = 0; i < this.#columnNames.length; i++) {
|
|
74
|
+
obj[this.#columnNames[i]] = row[i];
|
|
75
|
+
}
|
|
76
|
+
return obj;
|
|
77
|
+
}
|
|
78
|
+
finalize() {
|
|
79
|
+
// better-sqlite3 statements don't need explicit finalization
|
|
80
|
+
this.#rows = null;
|
|
81
|
+
this.#rowIndex = 0;
|
|
82
|
+
this.#params = [];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Thin database wrapper adapting better-sqlite3 to the wasm oo1 API surface
|
|
87
|
+
* used by local-store.ts and schema.ts.
|
|
88
|
+
*/
|
|
89
|
+
class CompatDb {
|
|
90
|
+
#db;
|
|
91
|
+
constructor(path) {
|
|
92
|
+
this.#db = new Database(path);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Execute SQL.
|
|
96
|
+
* - exec(sql: string) — plain execution, no return value
|
|
97
|
+
* - exec({ sql, returnValue: 'resultRows' }) — returns array of row objects
|
|
98
|
+
*/
|
|
99
|
+
exec(sqlOrOpts) {
|
|
100
|
+
if (typeof sqlOrOpts === 'string') {
|
|
101
|
+
this.#db.exec(sqlOrOpts);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Object form — run as query and return rows
|
|
105
|
+
const { sql } = sqlOrOpts;
|
|
106
|
+
const rows = this.#db.prepare(sql).all();
|
|
107
|
+
return rows;
|
|
108
|
+
}
|
|
109
|
+
prepare(sql) {
|
|
110
|
+
const stmt = this.#db.prepare(sql);
|
|
111
|
+
return new CompatStatement(stmt);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Execute a single-value query and return the first column of the first row.
|
|
115
|
+
*/
|
|
116
|
+
selectValue(sql) {
|
|
117
|
+
const row = this.#db.prepare(sql).raw(true).get();
|
|
118
|
+
return row ? row[0] : null;
|
|
119
|
+
}
|
|
120
|
+
close() {
|
|
121
|
+
this.#db.close();
|
|
122
|
+
}
|
|
28
123
|
}
|
|
29
124
|
/**
|
|
30
|
-
* Open a
|
|
31
|
-
*
|
|
125
|
+
* Open a SQLite database file.
|
|
126
|
+
* Creates the file if it doesn't exist.
|
|
127
|
+
* Returns a promise for API compatibility with the previous wasm implementation.
|
|
32
128
|
*/
|
|
33
129
|
export async function openDb(path) {
|
|
34
|
-
|
|
35
|
-
// 'ct' flags: create if not exists, throw on error
|
|
36
|
-
const db = new sqlite3.oo1.DB(path, 'ct');
|
|
37
|
-
return db;
|
|
130
|
+
return new CompatDb(path);
|
|
38
131
|
}
|
|
39
132
|
//# sourceMappingURL=wasm-db.js.map
|
package/dist/wasm-db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-db.js","sourceRoot":"","sources":["../src/wasm-db.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wasm-db.js","sourceRoot":"","sources":["../src/wasm-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAQtC;;;GAGG;AACH,MAAM,eAAe;IACV,KAAK,CAAqB;IACnC,OAAO,GAAc,EAAE,CAAC;IACxB,KAAK,GAAuB,IAAI,CAAC;IACjC,SAAS,GAAG,CAAC,CAAC;IACd,YAAY,GAAa,EAAE,CAAC;IAE5B,YAAY,IAAwB;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAI,CAAC,MA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;OAEG;IACH,WAAW,CAAC,GAAW;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,EAA2B,CAAC;QAC3E,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;CACF;AAID;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAY;IACvC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getplumb/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Plumb memory engine — storage abstraction, types, and local SQLite driver",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"author": "Clay Waters <hello@plumb.run>",
|
|
7
|
+
"homepage": "https://plumb.run",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/getplumb/plumb",
|
|
11
|
+
"directory": "packages/core"
|
|
12
|
+
},
|
|
6
13
|
"type": "module",
|
|
7
14
|
"main": "./dist/index.js",
|
|
8
15
|
"types": "./dist/index.d.ts",
|
|
@@ -14,6 +21,9 @@
|
|
|
14
21
|
"publishConfig": {
|
|
15
22
|
"access": "public"
|
|
16
23
|
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
17
27
|
"exports": {
|
|
18
28
|
".": {
|
|
19
29
|
"import": "./dist/index.js",
|
|
@@ -25,14 +35,16 @@
|
|
|
25
35
|
"test": "node --import tsx/esm --test src/**/*.test.ts",
|
|
26
36
|
"lint": "echo \"No lint yet\" && exit 0",
|
|
27
37
|
"clean": "rm -rf dist *.tsbuildinfo",
|
|
28
|
-
"prepublishOnly": "
|
|
38
|
+
"prepublishOnly": "pnpm build"
|
|
29
39
|
},
|
|
30
40
|
"devDependencies": {
|
|
41
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
31
42
|
"tsx": "^4.0.0",
|
|
32
43
|
"typescript": "^5.4.0"
|
|
33
44
|
},
|
|
34
45
|
"dependencies": {
|
|
35
46
|
"@sqlite.org/sqlite-wasm": "3.47.2-build1",
|
|
47
|
+
"better-sqlite3": "^12.6.2",
|
|
36
48
|
"openai": "^4.80.0"
|
|
37
49
|
},
|
|
38
50
|
"optionalDependencies": {
|