@getplumb/core 0.3.0 → 0.4.1
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/context-builder.d.ts +1 -7
- package/dist/context-builder.d.ts.map +1 -1
- package/dist/context-builder.js +7 -44
- package/dist/context-builder.js.map +1 -1
- package/dist/index.d.ts +4 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/local-store.d.ts +7 -82
- package/dist/local-store.d.ts.map +1 -1
- package/dist/local-store.js +84 -468
- package/dist/local-store.js.map +1 -1
- package/dist/read-path.d.ts +6 -23
- package/dist/read-path.d.ts.map +1 -1
- package/dist/read-path.js +9 -48
- package/dist/read-path.js.map +1 -1
- package/dist/schema.d.ts +4 -13
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +6 -73
- package/dist/schema.js.map +1 -1
- package/dist/scorer.d.ts +0 -9
- package/dist/scorer.d.ts.map +1 -1
- package/dist/scorer.js +1 -31
- package/dist/scorer.js.map +1 -1
- package/dist/store.d.ts +2 -16
- package/dist/store.d.ts.map +1 -1
- package/dist/types.d.ts +0 -25
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -6
- package/dist/types.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
|
@@ -6,12 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* [MEMORY CONTEXT]
|
|
8
8
|
*
|
|
9
|
-
* ## High confidence facts
|
|
10
|
-
* - user is building a product called Plumb (0.98, session: tech-planning, today)
|
|
11
|
-
*
|
|
12
|
-
* ## Medium confidence facts
|
|
13
|
-
* - user uses TypeScript (0.65, session: dev-chat, 2 days ago)
|
|
14
|
-
*
|
|
15
9
|
* ## Related conversations
|
|
16
10
|
* - [tech-planning] today: "Let me help you design the memory system..."
|
|
17
11
|
*
|
|
@@ -26,7 +20,7 @@ export declare function formatAge(ageInDays: number): string;
|
|
|
26
20
|
/**
|
|
27
21
|
* Formats a MemoryContext into a [MEMORY CONTEXT] prompt block.
|
|
28
22
|
*
|
|
29
|
-
* Returns an empty string if the context has no
|
|
23
|
+
* Returns an empty string if the context has no raw chunks,
|
|
30
24
|
* so callers can skip injection without additional checks.
|
|
31
25
|
*/
|
|
32
26
|
export declare function formatContextBlock(context: MemoryContext): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-builder.d.ts","sourceRoot":"","sources":["../src/context-builder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context-builder.d.ts","sourceRoot":"","sources":["../src/context-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,gBAAgB,CAAC;AAI9D;;;GAGG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAUnD;AAcD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAYjE"}
|
package/dist/context-builder.js
CHANGED
|
@@ -6,12 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* [MEMORY CONTEXT]
|
|
8
8
|
*
|
|
9
|
-
* ## High confidence facts
|
|
10
|
-
* - user is building a product called Plumb (0.98, session: tech-planning, today)
|
|
11
|
-
*
|
|
12
|
-
* ## Medium confidence facts
|
|
13
|
-
* - user uses TypeScript (0.65, session: dev-chat, 2 days ago)
|
|
14
|
-
*
|
|
15
9
|
* ## Related conversations
|
|
16
10
|
* - [tech-planning] today: "Let me help you design the memory system..."
|
|
17
11
|
*
|
|
@@ -42,13 +36,6 @@ export function formatAge(ageInDays) {
|
|
|
42
36
|
return `${Math.floor(ageInDays / 365)} years ago`;
|
|
43
37
|
}
|
|
44
38
|
// ─── Line formatters ──────────────────────────────────────────────────────────
|
|
45
|
-
function formatFactLine(sf) {
|
|
46
|
-
const { fact, score, ageInDays } = sf;
|
|
47
|
-
const description = `${fact.subject} ${fact.predicate} ${fact.object}`;
|
|
48
|
-
const sessionLabel = fact.sourceSessionLabel ?? fact.sourceSessionId;
|
|
49
|
-
const age = formatAge(ageInDays);
|
|
50
|
-
return `- ${description} (${score.toFixed(2)}, session: ${sessionLabel}, ${age})`;
|
|
51
|
-
}
|
|
52
39
|
function formatChunkLine(chunk) {
|
|
53
40
|
const excerpt = chunk.chunkText.slice(0, 200);
|
|
54
41
|
const sessionLabel = chunk.sessionLabel ?? chunk.sessionId;
|
|
@@ -60,42 +47,18 @@ function formatChunkLine(chunk) {
|
|
|
60
47
|
/**
|
|
61
48
|
* Formats a MemoryContext into a [MEMORY CONTEXT] prompt block.
|
|
62
49
|
*
|
|
63
|
-
* Returns an empty string if the context has no
|
|
50
|
+
* Returns an empty string if the context has no raw chunks,
|
|
64
51
|
* so callers can skip injection without additional checks.
|
|
65
52
|
*/
|
|
66
53
|
export function formatContextBlock(context) {
|
|
67
|
-
const {
|
|
68
|
-
|
|
69
|
-
mediumConfidence.length === 0 &&
|
|
70
|
-
lowConfidence.length === 0 &&
|
|
71
|
-
relatedConversations.length === 0;
|
|
72
|
-
if (isEmpty)
|
|
54
|
+
const { relatedConversations } = context;
|
|
55
|
+
if (relatedConversations.length === 0)
|
|
73
56
|
return '';
|
|
74
57
|
const lines = ['[MEMORY CONTEXT]'];
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
lines.push(formatFactLine(sf));
|
|
80
|
-
}
|
|
81
|
-
if (mediumConfidence.length > 0) {
|
|
82
|
-
lines.push('');
|
|
83
|
-
lines.push('## Medium confidence facts');
|
|
84
|
-
for (const sf of mediumConfidence)
|
|
85
|
-
lines.push(formatFactLine(sf));
|
|
86
|
-
}
|
|
87
|
-
if (lowConfidence.length > 0) {
|
|
88
|
-
lines.push('');
|
|
89
|
-
lines.push('## Low confidence facts');
|
|
90
|
-
for (const sf of lowConfidence)
|
|
91
|
-
lines.push(formatFactLine(sf));
|
|
92
|
-
}
|
|
93
|
-
if (relatedConversations.length > 0) {
|
|
94
|
-
lines.push('');
|
|
95
|
-
lines.push('## Related conversations');
|
|
96
|
-
for (const chunk of relatedConversations)
|
|
97
|
-
lines.push(formatChunkLine(chunk));
|
|
98
|
-
}
|
|
58
|
+
lines.push('');
|
|
59
|
+
lines.push('## Related conversations');
|
|
60
|
+
for (const chunk of relatedConversations)
|
|
61
|
+
lines.push(formatChunkLine(chunk));
|
|
99
62
|
return lines.join('\n');
|
|
100
63
|
}
|
|
101
64
|
//# sourceMappingURL=context-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-builder.js","sourceRoot":"","sources":["../src/context-builder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context-builder.js","sourceRoot":"","sources":["../src/context-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,SAAiB;IACzC,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IAClC,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,WAAW,CAAC;IACtC,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IAC9D,IAAI,SAAS,GAAG,EAAE;QAAE,OAAO,YAAY,CAAC;IACxC,IAAI,SAAS,GAAG,EAAE;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,YAAY,CAAC;IACpE,IAAI,SAAS,GAAG,EAAE;QAAE,OAAO,aAAa,CAAC;IACzC,IAAI,SAAS,GAAG,GAAG;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC,aAAa,CAAC;IACvE,IAAI,SAAS,GAAG,GAAG;QAAE,OAAO,YAAY,CAAC;IACzC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC;AACpD,CAAC;AAED,iFAAiF;AAEjF,SAAS,eAAe,CAAC,KAAe;IACtC,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9C,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,SAAS,CAAC;IAC3D,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACpF,MAAM,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,OAAO,MAAM,YAAY,KAAK,GAAG,MAAM,OAAO,GAAG,CAAC;AACpD,CAAC;AAED,iFAAiF;AAEjF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAsB;IACvD,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IAEzC,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEjD,MAAM,KAAK,GAAa,CAAC,kBAAkB,CAAC,CAAC;IAE7C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACvC,KAAK,MAAM,KAAK,IAAI,oBAAoB;QAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAE7E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export { DecayRate } from './types.js';
|
|
1
|
+
export type { IngestResult, MessageExchange, StoreStatus } from './types.js';
|
|
3
2
|
export type { MemoryStore } from './store.js';
|
|
4
3
|
export type { RawLogChunk, ScoreResult } from './scorer.js';
|
|
5
|
-
export {
|
|
4
|
+
export { scoreRawLog } from './scorer.js';
|
|
6
5
|
export { LocalStore } from './local-store.js';
|
|
7
|
-
export type { LocalStoreOptions, RawLogSearchResult,
|
|
8
|
-
export { ExtractionQueue } from './extraction-queue.js';
|
|
9
|
-
export type { ExtractFn, ExtractionQueueOptions } from './extraction-queue.js';
|
|
10
|
-
export { extractFacts } from './extractor.js';
|
|
11
|
-
export { callLLM, callLLMWithConfig, resolveAnthropicKey } from './llm-client.js';
|
|
12
|
-
export type { LLMConfig } from './llm-client.js';
|
|
6
|
+
export type { LocalStoreOptions, RawLogSearchResult, RawLogEntry, ExportData } from './local-store.js';
|
|
13
7
|
export { embed, embedQuery, rerankScores, EMBED_DIM } from './embedder.js';
|
|
14
8
|
export { Bm25, tokenize } from './bm25.js';
|
|
15
9
|
export { chunkExchange, formatExchange, CHUNK_WORDS, OVERLAP_WORDS } from './chunker.js';
|
|
16
10
|
export type { Chunk } from './chunker.js';
|
|
17
11
|
export { searchRawLog } from './raw-log-search.js';
|
|
18
|
-
export type {
|
|
12
|
+
export type { RawChunk, MemoryContext, ReadPathOptions, ReadPathStore } from './read-path.js';
|
|
19
13
|
export { buildMemoryContext } from './read-path.js';
|
|
20
14
|
export { formatContextBlock, formatAge } from './context-builder.js';
|
|
21
15
|
export { openDb } from './wasm-db.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7E,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvG,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzF,YAAY,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { computeDecay, scoreFact, scoreRawLog } from './scorer.js';
|
|
1
|
+
export { scoreRawLog } from './scorer.js';
|
|
3
2
|
export { LocalStore } from './local-store.js';
|
|
4
|
-
export { ExtractionQueue } from './extraction-queue.js';
|
|
5
|
-
export { extractFacts } from './extractor.js';
|
|
6
|
-
export { callLLM, callLLMWithConfig, resolveAnthropicKey } from './llm-client.js';
|
|
7
3
|
export { embed, embedQuery, rerankScores, EMBED_DIM } from './embedder.js';
|
|
8
4
|
export { Bm25, tokenize } from './bm25.js';
|
|
9
5
|
export { chunkExchange, formatExchange, CHUNK_WORDS, OVERLAP_WORDS } from './chunker.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/local-store.d.ts
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
import { type WasmDb } from './wasm-db.js';
|
|
2
2
|
import type { MemoryStore } from './store.js';
|
|
3
|
-
import type {
|
|
4
|
-
import { type LLMConfig } from './llm-client.js';
|
|
3
|
+
import type { IngestResult, MessageExchange, StoreStatus } from './types.js';
|
|
5
4
|
import { type RawLogSearchResult } from './raw-log-search.js';
|
|
6
|
-
import { ExtractionQueue } from './extraction-queue.js';
|
|
7
5
|
export type { RawLogSearchResult };
|
|
8
|
-
export interface RawFact {
|
|
9
|
-
readonly id: string;
|
|
10
|
-
readonly userId: string;
|
|
11
|
-
readonly subject: string;
|
|
12
|
-
readonly predicate: string;
|
|
13
|
-
readonly object: string;
|
|
14
|
-
readonly confidence: number;
|
|
15
|
-
readonly decayRate: string;
|
|
16
|
-
readonly timestamp: string;
|
|
17
|
-
readonly sourceSessionId: string;
|
|
18
|
-
readonly sourceSessionLabel: string | null;
|
|
19
|
-
readonly context: string | null;
|
|
20
|
-
readonly deleted: boolean;
|
|
21
|
-
readonly deletedAt: string | null;
|
|
22
|
-
}
|
|
23
6
|
export interface RawLogEntry {
|
|
24
7
|
readonly id: string;
|
|
25
8
|
readonly userId: string;
|
|
@@ -35,11 +18,8 @@ export interface RawLogEntry {
|
|
|
35
18
|
readonly embedStatus: string;
|
|
36
19
|
readonly embedError: string | null;
|
|
37
20
|
readonly embedModel: string | null;
|
|
38
|
-
readonly extractStatus: string;
|
|
39
|
-
readonly extractError: string | null;
|
|
40
21
|
}
|
|
41
22
|
export interface ExportData {
|
|
42
|
-
readonly facts: readonly RawFact[];
|
|
43
23
|
readonly rawLog: readonly RawLogEntry[];
|
|
44
24
|
}
|
|
45
25
|
export interface LocalStoreOptions {
|
|
@@ -48,48 +28,26 @@ export interface LocalStoreOptions {
|
|
|
48
28
|
/** User ID for scoping all data. Defaults to 'default' (single-user local install). */
|
|
49
29
|
userId?: string;
|
|
50
30
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
llmConfig?: LLMConfig;
|
|
55
|
-
/**
|
|
56
|
-
* Extraction queue for batched fact extraction. When provided, ingest() enqueues exchanges
|
|
57
|
-
* instead of immediately calling extractFacts(). Defaults to a new ExtractionQueue instance.
|
|
58
|
-
*/
|
|
59
|
-
extractionQueue?: ExtractionQueue;
|
|
60
|
-
/**
|
|
61
|
-
* Backlog processor tuning. Controls concurrency and idle behavior for drain loops.
|
|
62
|
-
* Defaults: concurrency=5, embedIdleMs=5000, extractIdleMs=5000, retryBackoffMs=2000
|
|
31
|
+
* Backlog processor tuning. Controls idle behavior for embed drain loop.
|
|
32
|
+
* Defaults: embedIdleMs=5000
|
|
63
33
|
*/
|
|
64
34
|
backlog?: {
|
|
65
|
-
/** Parallel extract requests (default 5) */
|
|
66
|
-
concurrency?: number;
|
|
67
35
|
/** Sleep duration when embed queue is empty (default 5000ms) */
|
|
68
36
|
embedIdleMs?: number;
|
|
69
|
-
/** Sleep duration when extract queue is empty (default 5000ms) */
|
|
70
|
-
extractIdleMs?: number;
|
|
71
|
-
/** Base backoff for 429 retries (default 2000ms) */
|
|
72
|
-
retryBackoffMs?: number;
|
|
73
37
|
};
|
|
74
38
|
}
|
|
75
|
-
export type { LLMConfig };
|
|
76
39
|
export declare class LocalStore implements MemoryStore {
|
|
77
40
|
#private;
|
|
78
41
|
/** Expose database for plugin use (e.g., NudgeManager) */
|
|
79
42
|
get db(): WasmDb;
|
|
80
43
|
/** Expose userId for plugin use */
|
|
81
44
|
get userId(): string;
|
|
82
|
-
/** Expose extraction queue for lifecycle management (start/stop) */
|
|
83
|
-
get extractionQueue(): ExtractionQueue;
|
|
84
45
|
private constructor();
|
|
85
46
|
/**
|
|
86
47
|
* Create a new LocalStore instance (async factory).
|
|
87
48
|
* Required because WASM initialization is async.
|
|
88
49
|
*/
|
|
89
50
|
static create(options?: LocalStoreOptions): Promise<LocalStore>;
|
|
90
|
-
store(fact: Omit<Fact, 'id'>, sourceChunkId?: string): Promise<string>;
|
|
91
|
-
search(query: string, limit?: number): Promise<readonly SearchResult[]>;
|
|
92
|
-
delete(id: string): Promise<void>;
|
|
93
51
|
status(): Promise<StoreStatus>;
|
|
94
52
|
ingest(exchange: MessageExchange): Promise<IngestResult>;
|
|
95
53
|
/**
|
|
@@ -97,52 +55,19 @@ export declare class LocalStore implements MemoryStore {
|
|
|
97
55
|
* See raw-log-search.ts for the full pipeline description.
|
|
98
56
|
*/
|
|
99
57
|
searchRawLog(query: string, limit?: number): Promise<readonly RawLogSearchResult[]>;
|
|
100
|
-
/**
|
|
101
|
-
* Wait for all queued fact extractions to complete.
|
|
102
|
-
* Call this before close() to ensure all async work is done.
|
|
103
|
-
* Delegates to ExtractionQueue.flush().
|
|
104
|
-
*/
|
|
105
|
-
drain(): Promise<void>;
|
|
106
|
-
/**
|
|
107
|
-
* Re-extract facts for orphaned raw_log chunks (chunks with no corresponding facts).
|
|
108
|
-
*
|
|
109
|
-
* This is useful when fact extraction failed during initial ingest (e.g., missing API key,
|
|
110
|
-
* rate limits, crashes). Re-running the normal seeder won't help because content-hash dedup
|
|
111
|
-
* skips already-ingested chunks before reaching the extraction phase.
|
|
112
|
-
*
|
|
113
|
-
* This method directly calls extractFacts() for each orphaned chunk, bypassing the dedup gate.
|
|
114
|
-
*
|
|
115
|
-
* @param throttleMs - Delay between extractions (default 1000ms) to stay under rate limits
|
|
116
|
-
* @returns Statistics: orphansFound, factsCreated
|
|
117
|
-
*/
|
|
118
|
-
reextractOrphans(throttleMs?: number): Promise<{
|
|
119
|
-
orphansFound: number;
|
|
120
|
-
factsCreated: number;
|
|
121
|
-
}>;
|
|
122
|
-
/**
|
|
123
|
-
* Get top subjects by fact count (for plumb status command).
|
|
124
|
-
* Returns subjects ordered by number of facts (non-deleted only).
|
|
125
|
-
*/
|
|
126
|
-
topSubjects(userId: string, limit?: number): Array<{
|
|
127
|
-
subject: string;
|
|
128
|
-
count: number;
|
|
129
|
-
}>;
|
|
130
58
|
/**
|
|
131
59
|
* Export all data for a user (for plumb export command).
|
|
132
60
|
* Returns raw database rows (no vector data).
|
|
133
|
-
* Includes soft-deleted facts for transparency.
|
|
134
61
|
*/
|
|
135
62
|
exportAll(userId: string): ExportData;
|
|
136
63
|
/**
|
|
137
|
-
* Start background backlog processor drain
|
|
138
|
-
* Launches continuous async
|
|
139
|
-
* Call this after store.extractionQueue.start() in plugin-module.ts.
|
|
64
|
+
* Start background backlog processor drain loop (T-095).
|
|
65
|
+
* Launches continuous async loop for embed backlog.
|
|
140
66
|
*/
|
|
141
67
|
startBacklogProcessor(): void;
|
|
142
68
|
/**
|
|
143
|
-
* Stop background backlog processor drain
|
|
144
|
-
* Signals
|
|
145
|
-
* Call this alongside store.extractionQueue.stop() in session_end and process exit handlers.
|
|
69
|
+
* Stop background backlog processor drain loop (T-095).
|
|
70
|
+
* Signals loop to stop and awaits in-flight work.
|
|
146
71
|
*/
|
|
147
72
|
stopBacklogProcessor(): Promise<void>;
|
|
148
73
|
/** Close the database connection. Call when done (e.g. in tests). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-store.d.ts","sourceRoot":"","sources":["../src/local-store.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"local-store.d.ts","sourceRoot":"","sources":["../src/local-store.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG7E,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG5E,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,iBAAiB;IAChC,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE;QACR,gEAAgE;QAChE,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAgGD,qBAAa,UAAW,YAAW,WAAW;;IAoB5C,0DAA0D;IAC1D,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,mCAAmC;IACnC,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,OAAO;IAYP;;;OAGG;WACU,MAAM,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;IA4CnE,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC;IA2B9B,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IAqI9D;;;OAGG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC;IAKrF;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU;IAiCrC;;;OAGG;IACH,qBAAqB,IAAI,IAAI;IAsB7B;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAyI3C,qEAAqE;IACrE,KAAK,IAAI,IAAI;CAGd"}
|