@getplumb/core 0.4.0 → 0.4.2
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/embedder.d.ts +9 -4
- package/dist/embedder.d.ts.map +1 -1
- package/dist/embedder.js +14 -21
- package/dist/embedder.js.map +1 -1
- package/dist/raw-log-search.d.ts.map +1 -1
- package/dist/raw-log-search.js +10 -1
- package/dist/raw-log-search.js.map +1 -1
- package/package.json +1 -1
- package/dist/extraction-queue.d.ts +0 -72
- package/dist/extraction-queue.d.ts.map +0 -1
- package/dist/extraction-queue.js +0 -101
- package/dist/extraction-queue.js.map +0 -1
- package/dist/extractor.d.ts +0 -22
- package/dist/extractor.d.ts.map +0 -1
- package/dist/extractor.js +0 -188
- package/dist/extractor.js.map +0 -1
- package/dist/extractor.test.d.ts +0 -2
- package/dist/extractor.test.d.ts.map +0 -1
- package/dist/extractor.test.js +0 -158
- package/dist/extractor.test.js.map +0 -1
- package/dist/fact-search.d.ts +0 -32
- package/dist/fact-search.d.ts.map +0 -1
- package/dist/fact-search.js +0 -174
- package/dist/fact-search.js.map +0 -1
- package/dist/fact-search.test.d.ts +0 -12
- package/dist/fact-search.test.d.ts.map +0 -1
- package/dist/fact-search.test.js +0 -117
- package/dist/fact-search.test.js.map +0 -1
- package/dist/llm-client.d.ts +0 -59
- package/dist/llm-client.d.ts.map +0 -1
- package/dist/llm-client.js +0 -227
- package/dist/llm-client.js.map +0 -1
- package/dist/local-store.test.d.ts +0 -2
- package/dist/local-store.test.d.ts.map +0 -1
- package/dist/local-store.test.js +0 -146
- package/dist/local-store.test.js.map +0 -1
- package/dist/raw-log-search.test.d.ts +0 -12
- package/dist/raw-log-search.test.d.ts.map +0 -1
- package/dist/raw-log-search.test.js +0 -124
- package/dist/raw-log-search.test.js.map +0 -1
- package/dist/read-path.test.d.ts +0 -15
- package/dist/read-path.test.d.ts.map +0 -1
- package/dist/read-path.test.js +0 -393
- package/dist/read-path.test.js.map +0 -1
- package/dist/scorer.test.d.ts +0 -10
- package/dist/scorer.test.d.ts.map +0 -1
- package/dist/scorer.test.js +0 -169
- package/dist/scorer.test.js.map +0 -1
package/dist/llm-client.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import OpenAI from 'openai';
|
|
2
|
-
/**
|
|
3
|
-
* Default models per provider
|
|
4
|
-
* Recommended: google/gemini-2.5-flash-lite (extremely cheap and fast)
|
|
5
|
-
*/
|
|
6
|
-
const DEFAULT_MODELS = {
|
|
7
|
-
google: 'gemini-2.5-flash-lite',
|
|
8
|
-
openai: 'gpt-4o-mini',
|
|
9
|
-
anthropic: 'claude-haiku-4-5-20251001',
|
|
10
|
-
ollama: 'llama3.1',
|
|
11
|
-
'openai-compatible': 'gpt-4o-mini',
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Resolve the OpenAI API key from environment variables.
|
|
15
|
-
* Returns the key if found, otherwise throws a clear error.
|
|
16
|
-
*
|
|
17
|
-
* Set OPENAI_API_KEY in your environment before using Plumb with the OpenAI provider.
|
|
18
|
-
*
|
|
19
|
-
* @throws Error if no key is found
|
|
20
|
-
*/
|
|
21
|
-
export function resolveOpenAIKey() {
|
|
22
|
-
const envKey = process.env['OPENAI_API_KEY'];
|
|
23
|
-
if (envKey)
|
|
24
|
-
return envKey;
|
|
25
|
-
throw new Error('Plumb fact extraction requires OPENAI_API_KEY. ' +
|
|
26
|
-
'Set the OPENAI_API_KEY environment variable and try again.');
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Resolve the Anthropic API key from environment variables.
|
|
30
|
-
* Returns the key if found, otherwise throws a clear error.
|
|
31
|
-
*
|
|
32
|
-
* Set ANTHROPIC_API_KEY in your environment before using Plumb with the Anthropic provider.
|
|
33
|
-
*
|
|
34
|
-
* @throws Error if no key is found
|
|
35
|
-
*/
|
|
36
|
-
export function resolveAnthropicKey() {
|
|
37
|
-
const envKey = process.env['ANTHROPIC_API_KEY'];
|
|
38
|
-
if (envKey)
|
|
39
|
-
return envKey;
|
|
40
|
-
throw new Error('Plumb fact extraction requires ANTHROPIC_API_KEY. ' +
|
|
41
|
-
'Set the ANTHROPIC_API_KEY environment variable and try again.');
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Resolve the Gemini API key from environment variables.
|
|
45
|
-
* Returns the key if found, otherwise throws a clear error.
|
|
46
|
-
*
|
|
47
|
-
* Set GEMINI_API_KEY in your environment before using Plumb with the Google provider.
|
|
48
|
-
*
|
|
49
|
-
* @throws Error if no key is found
|
|
50
|
-
*/
|
|
51
|
-
export function resolveGeminiKey() {
|
|
52
|
-
const envKey = process.env['GEMINI_API_KEY'];
|
|
53
|
-
if (envKey)
|
|
54
|
-
return envKey;
|
|
55
|
-
throw new Error('Plumb fact extraction requires GEMINI_API_KEY. ' +
|
|
56
|
-
'Set the GEMINI_API_KEY environment variable and try again.');
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Calls the configured LLM with the given prompt and returns the text response.
|
|
60
|
-
* Provider and model are configurable via env:
|
|
61
|
-
* PLUMB_LLM_PROVIDER — 'openai' (default), 'anthropic', 'ollama', 'openai-compatible', 'google'
|
|
62
|
-
* PLUMB_LLM_MODEL — model ID, defaults vary per provider
|
|
63
|
-
* PLUMB_LLM_BASE_URL — for 'openai-compatible' provider
|
|
64
|
-
* OLLAMA_HOST — for 'ollama' provider (default: http://localhost:11434/v1)
|
|
65
|
-
*/
|
|
66
|
-
export async function callLLM(prompt) {
|
|
67
|
-
const provider = process.env['PLUMB_LLM_PROVIDER'] ?? 'openai';
|
|
68
|
-
const model = process.env['PLUMB_LLM_MODEL'] ?? DEFAULT_MODELS[provider] ?? 'gpt-4o-mini';
|
|
69
|
-
if (provider === 'openai') {
|
|
70
|
-
const apiKey = resolveOpenAIKey();
|
|
71
|
-
const client = new OpenAI({ apiKey });
|
|
72
|
-
const response = await client.chat.completions.create({
|
|
73
|
-
model,
|
|
74
|
-
messages: [{ role: 'user', content: prompt }],
|
|
75
|
-
max_tokens: 4096,
|
|
76
|
-
});
|
|
77
|
-
return response.choices[0]?.message?.content ?? '';
|
|
78
|
-
}
|
|
79
|
-
if (provider === 'anthropic') {
|
|
80
|
-
// Dynamic import to handle optional dependency
|
|
81
|
-
let Anthropic;
|
|
82
|
-
try {
|
|
83
|
-
Anthropic = (await import('@anthropic-ai/sdk')).default;
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
throw new Error('Anthropic provider requires @anthropic-ai/sdk. Install it with: npm install @anthropic-ai/sdk');
|
|
87
|
-
}
|
|
88
|
-
const apiKey = resolveAnthropicKey();
|
|
89
|
-
const client = new Anthropic({ apiKey });
|
|
90
|
-
const message = await client.messages.create({
|
|
91
|
-
model,
|
|
92
|
-
max_tokens: 4096,
|
|
93
|
-
messages: [{ role: 'user', content: prompt }],
|
|
94
|
-
});
|
|
95
|
-
const block = message.content[0];
|
|
96
|
-
if (block === undefined || block.type !== 'text') {
|
|
97
|
-
throw new Error('Unexpected response type from Anthropic LLM');
|
|
98
|
-
}
|
|
99
|
-
return block.text;
|
|
100
|
-
}
|
|
101
|
-
if (provider === 'ollama') {
|
|
102
|
-
// Ollama provides an OpenAI-compatible API
|
|
103
|
-
const baseURL = process.env['OLLAMA_HOST'] ?? 'http://localhost:11434/v1';
|
|
104
|
-
const client = new OpenAI({
|
|
105
|
-
baseURL,
|
|
106
|
-
apiKey: 'ollama', // Required by openai package but ignored by Ollama
|
|
107
|
-
});
|
|
108
|
-
const response = await client.chat.completions.create({
|
|
109
|
-
model,
|
|
110
|
-
messages: [{ role: 'user', content: prompt }],
|
|
111
|
-
max_tokens: 4096,
|
|
112
|
-
});
|
|
113
|
-
return response.choices[0]?.message?.content ?? '';
|
|
114
|
-
}
|
|
115
|
-
if (provider === 'google') {
|
|
116
|
-
// Google Gemini via OpenAI-compatible endpoint
|
|
117
|
-
const apiKey = resolveGeminiKey();
|
|
118
|
-
const client = new OpenAI({
|
|
119
|
-
baseURL: 'https://generativelanguage.googleapis.com/v1beta/openai',
|
|
120
|
-
apiKey,
|
|
121
|
-
});
|
|
122
|
-
const response = await client.chat.completions.create({
|
|
123
|
-
model,
|
|
124
|
-
messages: [{ role: 'user', content: prompt }],
|
|
125
|
-
max_tokens: 4096,
|
|
126
|
-
});
|
|
127
|
-
return response.choices[0]?.message?.content ?? '';
|
|
128
|
-
}
|
|
129
|
-
if (provider === 'openai-compatible') {
|
|
130
|
-
const baseURL = process.env['PLUMB_LLM_BASE_URL'];
|
|
131
|
-
if (!baseURL) {
|
|
132
|
-
throw new Error('PLUMB_LLM_BASE_URL is required for openai-compatible provider. ' +
|
|
133
|
-
'Example: export PLUMB_LLM_BASE_URL=https://api.together.xyz/v1');
|
|
134
|
-
}
|
|
135
|
-
const apiKey = resolveOpenAIKey();
|
|
136
|
-
const client = new OpenAI({ baseURL, apiKey });
|
|
137
|
-
const response = await client.chat.completions.create({
|
|
138
|
-
model,
|
|
139
|
-
messages: [{ role: 'user', content: prompt }],
|
|
140
|
-
max_tokens: 4096,
|
|
141
|
-
});
|
|
142
|
-
return response.choices[0]?.message?.content ?? '';
|
|
143
|
-
}
|
|
144
|
-
throw new Error(`Unsupported PLUMB_LLM_PROVIDER: ${provider}. Supported: openai, anthropic, ollama, google, openai-compatible`);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Calls the LLM using explicitly provided config rather than environment variables.
|
|
148
|
-
* Falls back to env vars for any values not provided in config.
|
|
149
|
-
*
|
|
150
|
-
* Use this when you want to pass LLM credentials programmatically (e.g. from plugin config)
|
|
151
|
-
* without mutating process.env.
|
|
152
|
-
*/
|
|
153
|
-
export async function callLLMWithConfig(prompt, config) {
|
|
154
|
-
const provider = config.provider ?? process.env['PLUMB_LLM_PROVIDER'] ?? 'openai';
|
|
155
|
-
const model = config.model ?? process.env['PLUMB_LLM_MODEL'] ?? DEFAULT_MODELS[provider] ?? 'gpt-4o-mini';
|
|
156
|
-
if (provider === 'openai') {
|
|
157
|
-
const apiKey = config.apiKey ?? resolveOpenAIKey();
|
|
158
|
-
const client = new OpenAI({ apiKey });
|
|
159
|
-
const response = await client.chat.completions.create({
|
|
160
|
-
model,
|
|
161
|
-
messages: [{ role: 'user', content: prompt }],
|
|
162
|
-
max_tokens: 4096,
|
|
163
|
-
});
|
|
164
|
-
return response.choices[0]?.message?.content ?? '';
|
|
165
|
-
}
|
|
166
|
-
if (provider === 'anthropic') {
|
|
167
|
-
let Anthropic;
|
|
168
|
-
try {
|
|
169
|
-
Anthropic = (await import('@anthropic-ai/sdk')).default;
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
throw new Error('Anthropic provider requires @anthropic-ai/sdk. Install it with: npm install @anthropic-ai/sdk');
|
|
173
|
-
}
|
|
174
|
-
const apiKey = config.apiKey ?? resolveAnthropicKey();
|
|
175
|
-
const client = new Anthropic({ apiKey });
|
|
176
|
-
const message = await client.messages.create({
|
|
177
|
-
model,
|
|
178
|
-
max_tokens: 4096,
|
|
179
|
-
messages: [{ role: 'user', content: prompt }],
|
|
180
|
-
});
|
|
181
|
-
const block = message.content[0];
|
|
182
|
-
if (block === undefined || block.type !== 'text') {
|
|
183
|
-
throw new Error('Unexpected response type from Anthropic LLM');
|
|
184
|
-
}
|
|
185
|
-
return block.text;
|
|
186
|
-
}
|
|
187
|
-
if (provider === 'ollama') {
|
|
188
|
-
const baseURL = config.baseUrl ?? process.env['OLLAMA_HOST'] ?? 'http://localhost:11434/v1';
|
|
189
|
-
const client = new OpenAI({ baseURL, apiKey: 'ollama' });
|
|
190
|
-
const response = await client.chat.completions.create({
|
|
191
|
-
model,
|
|
192
|
-
messages: [{ role: 'user', content: prompt }],
|
|
193
|
-
max_tokens: 4096,
|
|
194
|
-
});
|
|
195
|
-
return response.choices[0]?.message?.content ?? '';
|
|
196
|
-
}
|
|
197
|
-
if (provider === 'google') {
|
|
198
|
-
const apiKey = config.apiKey ?? resolveGeminiKey();
|
|
199
|
-
const client = new OpenAI({
|
|
200
|
-
baseURL: 'https://generativelanguage.googleapis.com/v1beta/openai',
|
|
201
|
-
apiKey,
|
|
202
|
-
});
|
|
203
|
-
const response = await client.chat.completions.create({
|
|
204
|
-
model,
|
|
205
|
-
messages: [{ role: 'user', content: prompt }],
|
|
206
|
-
max_tokens: 4096,
|
|
207
|
-
});
|
|
208
|
-
return response.choices[0]?.message?.content ?? '';
|
|
209
|
-
}
|
|
210
|
-
if (provider === 'openai-compatible') {
|
|
211
|
-
const baseURL = config.baseUrl ?? process.env['PLUMB_LLM_BASE_URL'];
|
|
212
|
-
if (!baseURL) {
|
|
213
|
-
throw new Error('PLUMB_LLM_BASE_URL is required for openai-compatible provider. ' +
|
|
214
|
-
'Example: export PLUMB_LLM_BASE_URL=https://api.together.xyz/v1');
|
|
215
|
-
}
|
|
216
|
-
const apiKey = config.apiKey ?? resolveOpenAIKey();
|
|
217
|
-
const client = new OpenAI({ baseURL, apiKey });
|
|
218
|
-
const response = await client.chat.completions.create({
|
|
219
|
-
model,
|
|
220
|
-
messages: [{ role: 'user', content: prompt }],
|
|
221
|
-
max_tokens: 4096,
|
|
222
|
-
});
|
|
223
|
-
return response.choices[0]?.message?.content ?? '';
|
|
224
|
-
}
|
|
225
|
-
throw new Error(`Unsupported provider: ${provider}. Supported: openai, anthropic, ollama, google, openai-compatible`);
|
|
226
|
-
}
|
|
227
|
-
//# sourceMappingURL=llm-client.js.map
|
package/dist/llm-client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-client.js","sourceRoot":"","sources":["../src/llm-client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B;;;GAGG;AACH,MAAM,cAAc,GAA2B;IAC7C,MAAM,EAAE,uBAAuB;IAC/B,MAAM,EAAE,aAAa;IACrB,SAAS,EAAE,2BAA2B;IACtC,MAAM,EAAE,UAAU;IAClB,mBAAmB,EAAE,aAAa;CACnC,CAAC;AAiBF;;;;;;;GAOG;AACH,MA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YACpD,KAAK;YACL,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;YAC7C,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC;IACrD,CAAC;IAED,MAAM,IAAI,KAAK,CACb,yBAAyB,QAAQ,mEAAmE,CACrG,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-store.test.d.ts","sourceRoot":"","sources":["../src/local-store.test.ts"],"names":[],"mappings":""}
|
package/dist/local-store.test.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { test, after } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { rmSync } from 'node:fs';
|
|
6
|
-
import { LocalStore } from './local-store.js';
|
|
7
|
-
import { DecayRate } from './types.js';
|
|
8
|
-
// Use a unique temp path per test run so tests don't interfere with each other.
|
|
9
|
-
const dbPath = join(tmpdir(), `plumb-test-${Date.now()}.db`);
|
|
10
|
-
const store = new LocalStore({ dbPath, userId: 'test-user' });
|
|
11
|
-
after(() => {
|
|
12
|
-
store.close();
|
|
13
|
-
rmSync(dbPath, { force: true });
|
|
14
|
-
});
|
|
15
|
-
test('store() inserts a fact and returns a UUID', async () => {
|
|
16
|
-
const id = await store.store({
|
|
17
|
-
subject: 'user',
|
|
18
|
-
predicate: 'prefers',
|
|
19
|
-
object: 'dark mode',
|
|
20
|
-
confidence: 0.95,
|
|
21
|
-
decayRate: DecayRate.slow,
|
|
22
|
-
timestamp: new Date(),
|
|
23
|
-
sourceSessionId: 'session-abc',
|
|
24
|
-
sourceSessionLabel: 'test-session',
|
|
25
|
-
context: 'user mentioned this in passing',
|
|
26
|
-
});
|
|
27
|
-
assert.match(id, /^[0-9a-f-]{36}$/, 'id should be a UUID');
|
|
28
|
-
});
|
|
29
|
-
test('search() retrieves stored fact by keyword', async () => {
|
|
30
|
-
await store.store({
|
|
31
|
-
subject: 'user',
|
|
32
|
-
predicate: 'uses',
|
|
33
|
-
object: 'TypeScript',
|
|
34
|
-
confidence: 0.9,
|
|
35
|
-
decayRate: DecayRate.medium,
|
|
36
|
-
timestamp: new Date(),
|
|
37
|
-
sourceSessionId: 'session-abc',
|
|
38
|
-
});
|
|
39
|
-
const results = await store.search('TypeScript');
|
|
40
|
-
assert.ok(results.length > 0, 'should return at least one result');
|
|
41
|
-
const match = results.find((r) => r.fact.object === 'TypeScript');
|
|
42
|
-
assert.ok(match !== undefined, 'should find the TypeScript fact');
|
|
43
|
-
assert.equal(match.fact.subject, 'user');
|
|
44
|
-
assert.equal(match.fact.predicate, 'uses');
|
|
45
|
-
assert.ok(match.ageInDays >= 0, 'ageInDays should be non-negative');
|
|
46
|
-
assert.ok(match.score >= 0, 'score should be non-negative');
|
|
47
|
-
});
|
|
48
|
-
test('delete() soft-deletes a fact (sets deleted_at, excludes from search)', async () => {
|
|
49
|
-
const id = await store.store({
|
|
50
|
-
subject: 'user',
|
|
51
|
-
predicate: 'dislikes',
|
|
52
|
-
object: 'Comic Sans',
|
|
53
|
-
confidence: 0.99,
|
|
54
|
-
decayRate: DecayRate.slow,
|
|
55
|
-
timestamp: new Date(),
|
|
56
|
-
sourceSessionId: 'session-xyz',
|
|
57
|
-
});
|
|
58
|
-
// Fact should be findable before deletion.
|
|
59
|
-
const before = await store.search('Comic Sans');
|
|
60
|
-
assert.ok(before.some((r) => r.fact.id === id), 'fact should be visible before deletion');
|
|
61
|
-
await store.delete(id);
|
|
62
|
-
// Fact should be excluded after soft delete.
|
|
63
|
-
const after = await store.search('Comic Sans');
|
|
64
|
-
assert.ok(!after.some((r) => r.fact.id === id), 'soft-deleted fact should not appear in search');
|
|
65
|
-
});
|
|
66
|
-
test('status() returns accurate factCount and rawLogCount', async () => {
|
|
67
|
-
const fresh = new LocalStore({
|
|
68
|
-
dbPath: join(tmpdir(), `plumb-status-test-${Date.now()}.db`),
|
|
69
|
-
userId: 'status-test-user',
|
|
70
|
-
});
|
|
71
|
-
try {
|
|
72
|
-
const initial = await fresh.status();
|
|
73
|
-
assert.equal(initial.factCount, 0);
|
|
74
|
-
assert.equal(initial.rawLogCount, 0);
|
|
75
|
-
assert.equal(initial.lastIngestion, null);
|
|
76
|
-
assert.ok(initial.storageBytes > 0, 'storageBytes should be positive even for empty DB');
|
|
77
|
-
await fresh.store({
|
|
78
|
-
subject: 'user',
|
|
79
|
-
predicate: 'is',
|
|
80
|
-
object: 'a developer',
|
|
81
|
-
confidence: 0.8,
|
|
82
|
-
decayRate: DecayRate.slow,
|
|
83
|
-
timestamp: new Date(),
|
|
84
|
-
sourceSessionId: 's1',
|
|
85
|
-
});
|
|
86
|
-
const afterStore = await fresh.status();
|
|
87
|
-
assert.equal(afterStore.factCount, 1);
|
|
88
|
-
assert.equal(afterStore.rawLogCount, 0);
|
|
89
|
-
await fresh.ingest({
|
|
90
|
-
userMessage: 'Hello!',
|
|
91
|
-
agentResponse: 'Hi there!',
|
|
92
|
-
timestamp: new Date(),
|
|
93
|
-
source: 'openclaw',
|
|
94
|
-
sessionId: 'session-1',
|
|
95
|
-
});
|
|
96
|
-
const afterIngest = await fresh.status();
|
|
97
|
-
assert.equal(afterIngest.rawLogCount, 1);
|
|
98
|
-
assert.ok(afterIngest.lastIngestion !== null, 'lastIngestion should be set after ingest');
|
|
99
|
-
}
|
|
100
|
-
finally {
|
|
101
|
-
fresh.close();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
test('ingest() writes to raw_log and returns rawLogId', async () => {
|
|
105
|
-
const result = await store.ingest({
|
|
106
|
-
userMessage: 'What is the capital of France?',
|
|
107
|
-
agentResponse: 'The capital of France is Paris.',
|
|
108
|
-
timestamp: new Date(),
|
|
109
|
-
source: 'claude-code',
|
|
110
|
-
sessionId: 'session-ingest-test',
|
|
111
|
-
sessionLabel: 'geography-chat',
|
|
112
|
-
});
|
|
113
|
-
assert.match(result.rawLogId, /^[0-9a-f-]{36}$/, 'rawLogId should be a UUID');
|
|
114
|
-
assert.equal(result.factsExtracted, 0, 'no facts extracted yet (T-005)');
|
|
115
|
-
assert.deepEqual(result.factIds, []);
|
|
116
|
-
});
|
|
117
|
-
test('ingest() cross-session: facts from different sessions visible in same status()', async () => {
|
|
118
|
-
const crossStore = new LocalStore({
|
|
119
|
-
dbPath: join(tmpdir(), `plumb-cross-session-${Date.now()}.db`),
|
|
120
|
-
userId: 'cross-user',
|
|
121
|
-
});
|
|
122
|
-
try {
|
|
123
|
-
await crossStore.ingest({
|
|
124
|
-
userMessage: 'Planning session A',
|
|
125
|
-
agentResponse: 'Got it.',
|
|
126
|
-
timestamp: new Date(),
|
|
127
|
-
source: 'openclaw',
|
|
128
|
-
sessionId: 'session-A',
|
|
129
|
-
sessionLabel: 'planning',
|
|
130
|
-
});
|
|
131
|
-
await crossStore.ingest({
|
|
132
|
-
userMessage: 'Continuing in session B',
|
|
133
|
-
agentResponse: 'Understood.',
|
|
134
|
-
timestamp: new Date(),
|
|
135
|
-
source: 'openclaw',
|
|
136
|
-
sessionId: 'session-B',
|
|
137
|
-
sessionLabel: 'followup',
|
|
138
|
-
});
|
|
139
|
-
const status = await crossStore.status();
|
|
140
|
-
assert.equal(status.rawLogCount, 2, 'both sessions should be counted in raw_log');
|
|
141
|
-
}
|
|
142
|
-
finally {
|
|
143
|
-
crossStore.close();
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
//# sourceMappingURL=local-store.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-store.test.js","sourceRoot":"","sources":["../src/local-store.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,MAAM,MAAM,oBAAoB,C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ts).
|
|
3
|
-
*
|
|
4
|
-
* Ingests 3 exchanges with distinct topics, then verifies that searchRawLog()
|
|
5
|
-
* returns ranked results with the expected structure.
|
|
6
|
-
*
|
|
7
|
-
* Note: The first test run downloads the BAAI/bge-small-en-v1.5 embedding model
|
|
8
|
-
* (~100 MB) and the ms-marco cross-encoder (~50 MB) — subsequent runs use the
|
|
9
|
-
* local ~/.cache/huggingface/ cache. Tests are marked with a generous timeout.
|
|
10
|
-
*/
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=raw-log-search.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raw-log-search.test.d.ts","sourceRoot":"","sources":["../src/raw-log-search.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for Layer 1 hybrid search (raw-log-search.ts).
|
|
3
|
-
*
|
|
4
|
-
* Ingests 3 exchanges with distinct topics, then verifies that searchRawLog()
|
|
5
|
-
* returns ranked results with the expected structure.
|
|
6
|
-
*
|
|
7
|
-
* Note: The first test run downloads the BAAI/bge-small-en-v1.5 embedding model
|
|
8
|
-
* (~100 MB) and the ms-marco cross-encoder (~50 MB) — subsequent runs use the
|
|
9
|
-
* local ~/.cache/huggingface/ cache. Tests are marked with a generous timeout.
|
|
10
|
-
*/
|
|
11
|
-
import { test, after } from 'node:test';
|
|
12
|
-
import assert from 'node:assert/strict';
|
|
13
|
-
import { tmpdir } from 'node:os';
|
|
14
|
-
import { join } from 'node:path';
|
|
15
|
-
import { rmSync } from 'node:fs';
|
|
16
|
-
import { LocalStore } from './local-store.js';
|
|
17
|
-
const dbPath = join(tmpdir(), `plumb-search-test-${Date.now()}.db`);
|
|
18
|
-
const store = new LocalStore({ dbPath, userId: 'search-test-user' });
|
|
19
|
-
after(() => {
|
|
20
|
-
store.close();
|
|
21
|
-
rmSync(dbPath, { force: true });
|
|
22
|
-
});
|
|
23
|
-
// ─── Fixtures ────────────────────────────────────────────────────────────────
|
|
24
|
-
const EXCHANGES = [
|
|
25
|
-
{
|
|
26
|
-
userMessage: 'How do I configure TypeScript strict mode?',
|
|
27
|
-
agentResponse: 'Enable strict mode in tsconfig.json by setting "strict": true. ' +
|
|
28
|
-
'This enables noImplicitAny, strictNullChecks, and several other checks ' +
|
|
29
|
-
'that catch common bugs at compile time.',
|
|
30
|
-
sessionId: 'session-ts',
|
|
31
|
-
sessionLabel: 'typescript-help',
|
|
32
|
-
source: 'openclaw',
|
|
33
|
-
timestamp: new Date(Date.now() - 1 * 24 * 60 * 60 * 1000), // 1 day ago
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
userMessage: 'What is the best recipe for chocolate cake?',
|
|
37
|
-
agentResponse: 'For a classic chocolate cake, cream 200g butter with 200g sugar, ' +
|
|
38
|
-
'beat in 4 eggs, fold in 175g self-raising flour and 50g cocoa powder. ' +
|
|
39
|
-
'Bake at 180°C for 30 minutes. Frost with ganache when cool.',
|
|
40
|
-
sessionId: 'session-recipe',
|
|
41
|
-
sessionLabel: 'cooking-chat',
|
|
42
|
-
source: 'openclaw',
|
|
43
|
-
timestamp: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000), // 2 days ago
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
userMessage: 'Explain SQLite WAL mode and when to use it.',
|
|
47
|
-
agentResponse: 'WAL (Write-Ahead Log) mode improves SQLite concurrency by allowing ' +
|
|
48
|
-
'readers to proceed while a writer is active. Enable it with PRAGMA ' +
|
|
49
|
-
'journal_mode = WAL. It is recommended for applications with multiple ' +
|
|
50
|
-
'readers and infrequent writers, like desktop apps and local servers.',
|
|
51
|
-
sessionId: 'session-sqlite',
|
|
52
|
-
sessionLabel: 'database-chat',
|
|
53
|
-
source: 'claude-code',
|
|
54
|
-
timestamp: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000), // 3 days ago
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
// ─── Ingest (shared setup) ───────────────────────────────────────────────────
|
|
58
|
-
test('ingest 3 exchanges with distinct topics', { timeout: 120_000 }, async () => {
|
|
59
|
-
for (const exchange of EXCHANGES) {
|
|
60
|
-
const result = await store.ingest(exchange);
|
|
61
|
-
assert.match(result.rawLogId, /^[0-9a-f-]{36}$/, 'rawLogId should be a UUID');
|
|
62
|
-
}
|
|
63
|
-
const status = await store.status();
|
|
64
|
-
assert.equal(status.rawLogCount, 3, 'all 3 exchanges should be in raw_log');
|
|
65
|
-
});
|
|
66
|
-
// ─── Search ──────────────────────────────────────────────────────────────────
|
|
67
|
-
test('searchRawLog returns results with required fields', { timeout: 120_000 }, async () => {
|
|
68
|
-
const results = await store.searchRawLog('TypeScript configuration', 3);
|
|
69
|
-
assert.ok(results.length > 0, 'should return at least one result');
|
|
70
|
-
for (const r of results) {
|
|
71
|
-
assert.ok(typeof r.chunk_text === 'string', 'chunk_text must be a string');
|
|
72
|
-
assert.ok(typeof r.session_id === 'string', 'session_id must be a string');
|
|
73
|
-
assert.ok(typeof r.timestamp === 'string', 'timestamp must be a string');
|
|
74
|
-
assert.ok(typeof r.final_score === 'number', 'final_score must be a number');
|
|
75
|
-
// session_label may be null
|
|
76
|
-
assert.ok(r.session_label === null || typeof r.session_label === 'string', 'session_label must be string or null');
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
test('searchRawLog ranks TypeScript exchange first for TS query', { timeout: 120_000 }, async () => {
|
|
80
|
-
const results = await store.searchRawLog('TypeScript strict mode tsconfig', 3);
|
|
81
|
-
assert.ok(results.length > 0, 'should return results');
|
|
82
|
-
const top = results[0];
|
|
83
|
-
assert.ok(top !== undefined, 'should have a top result');
|
|
84
|
-
// The TypeScript exchange should rank first (or at least in top 2).
|
|
85
|
-
const tsResult = results.find((r) => r.session_id === 'session-ts');
|
|
86
|
-
assert.ok(tsResult !== undefined, 'TypeScript exchange should appear in results');
|
|
87
|
-
// Top result should be the TS exchange (semantic match is strong).
|
|
88
|
-
assert.equal(top.session_id, 'session-ts', 'TypeScript exchange should rank #1');
|
|
89
|
-
});
|
|
90
|
-
test('searchRawLog returns SQLite exchange in top results for database query', { timeout: 120_000 }, async () => {
|
|
91
|
-
const results = await store.searchRawLog('SQLite WAL journal mode database', 3);
|
|
92
|
-
assert.ok(results.length > 0, 'should return results');
|
|
93
|
-
// SQLite exchange should appear in top-3 results — exact rank depends on model scores.
|
|
94
|
-
const sqliteResult = results.find((r) => r.session_id === 'session-sqlite');
|
|
95
|
-
assert.ok(sqliteResult !== undefined, 'SQLite exchange should appear in top-3 results');
|
|
96
|
-
// The recipe exchange (no SQLite content) should NOT rank above SQLite.
|
|
97
|
-
const recipeRank = results.findIndex((r) => r.session_id === 'session-recipe');
|
|
98
|
-
const sqliteRank = results.findIndex((r) => r.session_id === 'session-sqlite');
|
|
99
|
-
assert.ok(recipeRank === -1 || sqliteRank < recipeRank, 'SQLite exchange should outrank the recipe exchange for a database query');
|
|
100
|
-
});
|
|
101
|
-
test('searchRawLog is cross-session (no session filter applied)', { timeout: 120_000 }, async () => {
|
|
102
|
-
// A broad query — all 3 sessions should be retrievable.
|
|
103
|
-
const results = await store.searchRawLog('what did we discuss', 3);
|
|
104
|
-
// We just check structure — cross-session means limit=3 can return up to all 3.
|
|
105
|
-
assert.ok(results.length <= 3);
|
|
106
|
-
assert.ok(results.length >= 1);
|
|
107
|
-
for (const r of results) {
|
|
108
|
-
assert.ok(['session-ts', 'session-recipe', 'session-sqlite'].includes(r.session_id));
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
test('searchRawLog returns empty array when no rows exist', { timeout: 30_000 }, async () => {
|
|
112
|
-
const emptyStore = new LocalStore({
|
|
113
|
-
dbPath: join(tmpdir(), `plumb-empty-${Date.now()}.db`),
|
|
114
|
-
userId: 'empty-user',
|
|
115
|
-
});
|
|
116
|
-
try {
|
|
117
|
-
const results = await emptyStore.searchRawLog('anything', 5);
|
|
118
|
-
assert.deepEqual(results, []);
|
|
119
|
-
}
|
|
120
|
-
finally {
|
|
121
|
-
emptyStore.close();
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
//# sourceMappingURL=raw-log-search.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raw-log-search.test.js","sourceRoot":"","sources":["../src/raw-log-search.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,qBAAqB,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACpE,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAErE,KAAK,CAAC,GAAG,EAAE;IACT,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AAEH,gFAAgF;AAEhF,MAAM,SAAS,GAAG;IAChB;QACE,WAAW,EAAE,4CAA4C;QACzD,aAAa,EACX,iEAAiE;YACjE,yEAAyE;YACzE,yCAAyC;QAC3C,SAAS,EAAE,YAAY;QACvB,YAAY,EAAE,iBAAiB;QAC/B,MAAM,EAAE,UAAmB;QAC3B,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IA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EAAE,OAAO,EAAE,EAAE,KAAK,IAAI,EAAE;IACjG,wDAAwD;IACxD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;IACnE,gFAAgF;IAChF,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,CAAC,EAAE,CAAC,CAAC,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IACvF,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,qDAAqD,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,IAAI,EAAE;IAC1F,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC;QAChC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,eAAe,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QACtD,MAAM,EAAE,YAAY;KACrB,CAAC,CAAC;IACH,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QAC7D,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC;YAAS,CAAC;QACT,UAAU,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/dist/read-path.test.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for read-path.ts (buildMemoryContext) and context-builder.ts (formatContextBlock).
|
|
3
|
-
*
|
|
4
|
-
* Strategy:
|
|
5
|
-
* - Unit tests use a mock ReadPathStore to avoid ML model downloads and keep
|
|
6
|
-
* tests fast and deterministic.
|
|
7
|
-
* - One integration smoke test uses a real LocalStore with real facts inserted
|
|
8
|
-
* via store.store() (keyword search, no embedder needed) to verify the
|
|
9
|
-
* end-to-end cross-session provenance path.
|
|
10
|
-
*
|
|
11
|
-
* Cross-session test (acceptance criteria): facts ingested in session A must
|
|
12
|
-
* be returned when querying in session B context — no session filter applied.
|
|
13
|
-
*/
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=read-path.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-path.test.d.ts","sourceRoot":"","sources":["../src/read-path.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|