@loreai/core 0.17.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bun/agents-file.d.ts +4 -0
- package/dist/bun/agents-file.d.ts.map +1 -1
- package/dist/bun/config.d.ts +2 -0
- package/dist/bun/config.d.ts.map +1 -1
- package/dist/bun/curator.d.ts +45 -0
- package/dist/bun/curator.d.ts.map +1 -1
- package/dist/bun/data-dir.d.ts +18 -0
- package/dist/bun/data-dir.d.ts.map +1 -0
- package/dist/bun/db.d.ts +85 -0
- package/dist/bun/db.d.ts.map +1 -1
- package/dist/bun/distillation.d.ts +2 -13
- package/dist/bun/distillation.d.ts.map +1 -1
- package/dist/bun/embedding-vendor.d.ts +22 -38
- package/dist/bun/embedding-vendor.d.ts.map +1 -1
- package/dist/bun/embedding-worker-types.d.ts +17 -12
- package/dist/bun/embedding-worker-types.d.ts.map +1 -1
- package/dist/bun/embedding-worker.d.ts +9 -2
- package/dist/bun/embedding-worker.d.ts.map +1 -1
- package/dist/bun/embedding-worker.js +38864 -33
- package/dist/bun/embedding-worker.js.map +4 -4
- package/dist/bun/embedding.d.ts +35 -23
- package/dist/bun/embedding.d.ts.map +1 -1
- package/dist/bun/gradient.d.ts +17 -1
- package/dist/bun/gradient.d.ts.map +1 -1
- package/dist/bun/import/detect.d.ts +14 -0
- package/dist/bun/import/detect.d.ts.map +1 -0
- package/dist/bun/import/extract.d.ts +43 -0
- package/dist/bun/import/extract.d.ts.map +1 -0
- package/dist/bun/import/history.d.ts +40 -0
- package/dist/bun/import/history.d.ts.map +1 -0
- package/dist/bun/import/index.d.ts +17 -0
- package/dist/bun/import/index.d.ts.map +1 -0
- package/dist/bun/import/providers/aider.d.ts +2 -0
- package/dist/bun/import/providers/aider.d.ts.map +1 -0
- package/dist/bun/import/providers/claude-code.d.ts +2 -0
- package/dist/bun/import/providers/claude-code.d.ts.map +1 -0
- package/dist/bun/import/providers/cline.d.ts +2 -0
- package/dist/bun/import/providers/cline.d.ts.map +1 -0
- package/dist/bun/import/providers/codex.d.ts +2 -0
- package/dist/bun/import/providers/codex.d.ts.map +1 -0
- package/dist/bun/import/providers/continue.d.ts +2 -0
- package/dist/bun/import/providers/continue.d.ts.map +1 -0
- package/dist/bun/import/providers/index.d.ts +19 -0
- package/dist/bun/import/providers/index.d.ts.map +1 -0
- package/dist/bun/import/providers/opencode.d.ts +2 -0
- package/dist/bun/import/providers/opencode.d.ts.map +1 -0
- package/dist/bun/import/providers/pi.d.ts +2 -0
- package/dist/bun/import/providers/pi.d.ts.map +1 -0
- package/dist/bun/import/types.d.ts +82 -0
- package/dist/bun/import/types.d.ts.map +1 -0
- package/dist/bun/index.d.ts +5 -2
- package/dist/bun/index.d.ts.map +1 -1
- package/dist/bun/index.js +3150 -439
- package/dist/bun/index.js.map +4 -4
- package/dist/bun/instruction-detect.d.ts +66 -0
- package/dist/bun/instruction-detect.d.ts.map +1 -0
- package/dist/bun/log.d.ts +9 -0
- package/dist/bun/log.d.ts.map +1 -1
- package/dist/bun/ltm.d.ts +139 -5
- package/dist/bun/ltm.d.ts.map +1 -1
- package/dist/bun/pattern-extract.d.ts +7 -0
- package/dist/bun/pattern-extract.d.ts.map +1 -1
- package/dist/bun/prompt.d.ts +1 -1
- package/dist/bun/prompt.d.ts.map +1 -1
- package/dist/bun/recall.d.ts.map +1 -1
- package/dist/bun/search.d.ts +5 -3
- package/dist/bun/search.d.ts.map +1 -1
- package/dist/bun/session-limiter.d.ts +26 -0
- package/dist/bun/session-limiter.d.ts.map +1 -0
- package/dist/bun/temporal.d.ts +2 -0
- package/dist/bun/temporal.d.ts.map +1 -1
- package/dist/bun/types.d.ts +1 -1
- package/dist/node/agents-file.d.ts +4 -0
- package/dist/node/agents-file.d.ts.map +1 -1
- package/dist/node/config.d.ts +2 -0
- package/dist/node/config.d.ts.map +1 -1
- package/dist/node/curator.d.ts +45 -0
- package/dist/node/curator.d.ts.map +1 -1
- package/dist/node/data-dir.d.ts +18 -0
- package/dist/node/data-dir.d.ts.map +1 -0
- package/dist/node/db.d.ts +85 -0
- package/dist/node/db.d.ts.map +1 -1
- package/dist/node/distillation.d.ts +2 -13
- package/dist/node/distillation.d.ts.map +1 -1
- package/dist/node/embedding-vendor.d.ts +22 -38
- package/dist/node/embedding-vendor.d.ts.map +1 -1
- package/dist/node/embedding-worker-types.d.ts +17 -12
- package/dist/node/embedding-worker-types.d.ts.map +1 -1
- package/dist/node/embedding-worker.d.ts +9 -2
- package/dist/node/embedding-worker.d.ts.map +1 -1
- package/dist/node/embedding-worker.js +38864 -33
- package/dist/node/embedding-worker.js.map +4 -4
- package/dist/node/embedding.d.ts +35 -23
- package/dist/node/embedding.d.ts.map +1 -1
- package/dist/node/gradient.d.ts +17 -1
- package/dist/node/gradient.d.ts.map +1 -1
- package/dist/node/import/detect.d.ts +14 -0
- package/dist/node/import/detect.d.ts.map +1 -0
- package/dist/node/import/extract.d.ts +43 -0
- package/dist/node/import/extract.d.ts.map +1 -0
- package/dist/node/import/history.d.ts +40 -0
- package/dist/node/import/history.d.ts.map +1 -0
- package/dist/node/import/index.d.ts +17 -0
- package/dist/node/import/index.d.ts.map +1 -0
- package/dist/node/import/providers/aider.d.ts +2 -0
- package/dist/node/import/providers/aider.d.ts.map +1 -0
- package/dist/node/import/providers/claude-code.d.ts +2 -0
- package/dist/node/import/providers/claude-code.d.ts.map +1 -0
- package/dist/node/import/providers/cline.d.ts +2 -0
- package/dist/node/import/providers/cline.d.ts.map +1 -0
- package/dist/node/import/providers/codex.d.ts +2 -0
- package/dist/node/import/providers/codex.d.ts.map +1 -0
- package/dist/node/import/providers/continue.d.ts +2 -0
- package/dist/node/import/providers/continue.d.ts.map +1 -0
- package/dist/node/import/providers/index.d.ts +19 -0
- package/dist/node/import/providers/index.d.ts.map +1 -0
- package/dist/node/import/providers/opencode.d.ts +2 -0
- package/dist/node/import/providers/opencode.d.ts.map +1 -0
- package/dist/node/import/providers/pi.d.ts +2 -0
- package/dist/node/import/providers/pi.d.ts.map +1 -0
- package/dist/node/import/types.d.ts +82 -0
- package/dist/node/import/types.d.ts.map +1 -0
- package/dist/node/index.d.ts +5 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +3150 -439
- package/dist/node/index.js.map +4 -4
- package/dist/node/instruction-detect.d.ts +66 -0
- package/dist/node/instruction-detect.d.ts.map +1 -0
- package/dist/node/log.d.ts +9 -0
- package/dist/node/log.d.ts.map +1 -1
- package/dist/node/ltm.d.ts +139 -5
- package/dist/node/ltm.d.ts.map +1 -1
- package/dist/node/pattern-extract.d.ts +7 -0
- package/dist/node/pattern-extract.d.ts.map +1 -1
- package/dist/node/prompt.d.ts +1 -1
- package/dist/node/prompt.d.ts.map +1 -1
- package/dist/node/recall.d.ts.map +1 -1
- package/dist/node/search.d.ts +5 -3
- package/dist/node/search.d.ts.map +1 -1
- package/dist/node/session-limiter.d.ts +26 -0
- package/dist/node/session-limiter.d.ts.map +1 -0
- package/dist/node/temporal.d.ts +2 -0
- package/dist/node/temporal.d.ts.map +1 -1
- package/dist/node/types.d.ts +1 -1
- package/dist/types/agents-file.d.ts +4 -0
- package/dist/types/agents-file.d.ts.map +1 -1
- package/dist/types/config.d.ts +2 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/curator.d.ts +45 -0
- package/dist/types/curator.d.ts.map +1 -1
- package/dist/types/data-dir.d.ts +18 -0
- package/dist/types/data-dir.d.ts.map +1 -0
- package/dist/types/db.d.ts +85 -0
- package/dist/types/db.d.ts.map +1 -1
- package/dist/types/distillation.d.ts +2 -13
- package/dist/types/distillation.d.ts.map +1 -1
- package/dist/types/embedding-vendor.d.ts +22 -38
- package/dist/types/embedding-vendor.d.ts.map +1 -1
- package/dist/types/embedding-worker-types.d.ts +17 -12
- package/dist/types/embedding-worker-types.d.ts.map +1 -1
- package/dist/types/embedding-worker.d.ts +9 -2
- package/dist/types/embedding-worker.d.ts.map +1 -1
- package/dist/types/embedding.d.ts +35 -23
- package/dist/types/embedding.d.ts.map +1 -1
- package/dist/types/gradient.d.ts +17 -1
- package/dist/types/gradient.d.ts.map +1 -1
- package/dist/types/import/detect.d.ts +14 -0
- package/dist/types/import/detect.d.ts.map +1 -0
- package/dist/types/import/extract.d.ts +43 -0
- package/dist/types/import/extract.d.ts.map +1 -0
- package/dist/types/import/history.d.ts +40 -0
- package/dist/types/import/history.d.ts.map +1 -0
- package/dist/types/import/index.d.ts +17 -0
- package/dist/types/import/index.d.ts.map +1 -0
- package/dist/types/import/providers/aider.d.ts +2 -0
- package/dist/types/import/providers/aider.d.ts.map +1 -0
- package/dist/types/import/providers/claude-code.d.ts +2 -0
- package/dist/types/import/providers/claude-code.d.ts.map +1 -0
- package/dist/types/import/providers/cline.d.ts +2 -0
- package/dist/types/import/providers/cline.d.ts.map +1 -0
- package/dist/types/import/providers/codex.d.ts +2 -0
- package/dist/types/import/providers/codex.d.ts.map +1 -0
- package/dist/types/import/providers/continue.d.ts +2 -0
- package/dist/types/import/providers/continue.d.ts.map +1 -0
- package/dist/types/import/providers/index.d.ts +19 -0
- package/dist/types/import/providers/index.d.ts.map +1 -0
- package/dist/types/import/providers/opencode.d.ts +2 -0
- package/dist/types/import/providers/opencode.d.ts.map +1 -0
- package/dist/types/import/providers/pi.d.ts +2 -0
- package/dist/types/import/providers/pi.d.ts.map +1 -0
- package/dist/types/import/types.d.ts +82 -0
- package/dist/types/import/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/instruction-detect.d.ts +66 -0
- package/dist/types/instruction-detect.d.ts.map +1 -0
- package/dist/types/log.d.ts +9 -0
- package/dist/types/log.d.ts.map +1 -1
- package/dist/types/ltm.d.ts +139 -5
- package/dist/types/ltm.d.ts.map +1 -1
- package/dist/types/pattern-extract.d.ts +7 -0
- package/dist/types/pattern-extract.d.ts.map +1 -1
- package/dist/types/prompt.d.ts +1 -1
- package/dist/types/prompt.d.ts.map +1 -1
- package/dist/types/recall.d.ts.map +1 -1
- package/dist/types/search.d.ts +5 -3
- package/dist/types/search.d.ts.map +1 -1
- package/dist/types/session-limiter.d.ts +26 -0
- package/dist/types/session-limiter.d.ts.map +1 -0
- package/dist/types/temporal.d.ts +2 -0
- package/dist/types/temporal.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +3 -4
- package/src/agents-file.ts +41 -13
- package/src/config.ts +31 -18
- package/src/curator.ts +163 -75
- package/src/data-dir.ts +76 -0
- package/src/db.ts +457 -11
- package/src/distillation.ts +65 -16
- package/src/embedding-vendor.ts +23 -40
- package/src/embedding-worker-types.ts +19 -11
- package/src/embedding-worker.ts +111 -47
- package/src/embedding.ts +224 -174
- package/src/gradient.ts +192 -75
- package/src/import/detect.ts +37 -0
- package/src/import/extract.ts +137 -0
- package/src/import/history.ts +99 -0
- package/src/import/index.ts +45 -0
- package/src/import/providers/aider.ts +207 -0
- package/src/import/providers/claude-code.ts +339 -0
- package/src/import/providers/cline.ts +324 -0
- package/src/import/providers/codex.ts +369 -0
- package/src/import/providers/continue.ts +304 -0
- package/src/import/providers/index.ts +32 -0
- package/src/import/providers/opencode.ts +272 -0
- package/src/import/providers/pi.ts +332 -0
- package/src/import/types.ts +91 -0
- package/src/index.ts +13 -0
- package/src/instruction-detect.ts +275 -0
- package/src/log.ts +91 -3
- package/src/ltm.ts +789 -41
- package/src/pattern-extract.ts +41 -0
- package/src/prompt.ts +7 -1
- package/src/recall.ts +43 -5
- package/src/search.ts +7 -5
- package/src/session-limiter.ts +47 -0
- package/src/temporal.ts +18 -6
- package/src/types.ts +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type ImportRecord = {
|
|
2
|
+
id: string;
|
|
3
|
+
project_id: string;
|
|
4
|
+
agent_name: string;
|
|
5
|
+
source_id: string;
|
|
6
|
+
source_hash: string;
|
|
7
|
+
entries_created: number;
|
|
8
|
+
entries_updated: number;
|
|
9
|
+
imported_at: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Check if a specific source has already been imported with the same hash.
|
|
13
|
+
*
|
|
14
|
+
* @returns The existing record if found with the same hash, or null if
|
|
15
|
+
* the source hasn't been imported or the hash has changed.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isImported(projectPath: string, agentName: string, sourceId: string, sourceHash: string): ImportRecord | null;
|
|
18
|
+
/**
|
|
19
|
+
* Record a successful import of a source.
|
|
20
|
+
* Uses INSERT OR REPLACE to handle re-imports of changed sources.
|
|
21
|
+
*/
|
|
22
|
+
export declare function recordImport(projectPath: string, agentName: string, sourceId: string, sourceHash: string, stats: {
|
|
23
|
+
created: number;
|
|
24
|
+
updated: number;
|
|
25
|
+
}): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get all import records for a project.
|
|
28
|
+
* Excludes legacy "__declined__" sentinel rows from pre-v22 databases.
|
|
29
|
+
*/
|
|
30
|
+
export declare function listImports(projectPath: string): ImportRecord[];
|
|
31
|
+
/**
|
|
32
|
+
* Compute a simple hash string for idempotency checks.
|
|
33
|
+
* Uses a fast non-cryptographic approach: file size + message count + last timestamp.
|
|
34
|
+
*/
|
|
35
|
+
export declare function computeHash(parts: {
|
|
36
|
+
size?: number;
|
|
37
|
+
messageCount?: number;
|
|
38
|
+
lastTimestamp?: number;
|
|
39
|
+
}): string;
|
|
40
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/import/history.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,YAAY,GAAG,IAAI,CAarB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC1C,IAAI,CAkBN;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,EAAE,CAS/D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,MAAM,CAET"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversation import system — detects and imports knowledge from
|
|
3
|
+
* external AI coding agent conversation histories.
|
|
4
|
+
*/
|
|
5
|
+
export type { ConversationChunk, DetectedSession, DetectionResult, AgentHistoryProvider, } from "./types";
|
|
6
|
+
export { detectAll } from "./detect";
|
|
7
|
+
export { registerProvider, getProviders, getProvider, clearProviders, } from "./providers";
|
|
8
|
+
export { extractKnowledge, type ExtractionProgress, type ExtractionResult } from "./extract";
|
|
9
|
+
export { isImported, recordImport, computeHash, listImports, type ImportRecord, } from "./history";
|
|
10
|
+
import "./providers/claude-code";
|
|
11
|
+
import "./providers/codex";
|
|
12
|
+
import "./providers/opencode";
|
|
13
|
+
import "./providers/cline";
|
|
14
|
+
import "./providers/continue";
|
|
15
|
+
import "./providers/pi";
|
|
16
|
+
import "./providers/aider";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/import/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7F,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,KAAK,YAAY,GAClB,MAAM,WAAW,CAAC;AAInB,OAAO,yBAAyB,CAAC;AACjC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aider.d.ts","sourceRoot":"","sources":["../../../../src/import/providers/aider.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../../src/import/providers/claude-code.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cline.d.ts","sourceRoot":"","sources":["../../../../src/import/providers/cline.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../../src/import/providers/codex.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continue.d.ts","sourceRoot":"","sources":["../../../../src/import/providers/continue.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider registry — maintains a list of all known agent history providers.
|
|
3
|
+
*
|
|
4
|
+
* Providers register themselves at import time. The detection orchestrator
|
|
5
|
+
* iterates over all registered providers to scan for conversation history.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentHistoryProvider } from "../types";
|
|
8
|
+
/** Register a provider. Called at module load time by each provider module. */
|
|
9
|
+
export declare function registerProvider(provider: AgentHistoryProvider): void;
|
|
10
|
+
/** Get all registered providers. */
|
|
11
|
+
export declare function getProviders(): readonly AgentHistoryProvider[];
|
|
12
|
+
/** Get a provider by internal name. */
|
|
13
|
+
export declare function getProvider(name: string): AgentHistoryProvider | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Clear all registered providers.
|
|
16
|
+
* Test-only — allows resetting the registry between test runs.
|
|
17
|
+
*/
|
|
18
|
+
export declare function clearProviders(): void;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/import/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIrD,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAErE;AAED,oCAAoC;AACpC,wBAAgB,YAAY,IAAI,SAAS,oBAAoB,EAAE,CAE9D;AAED,uCAAuC;AACvC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE1E;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../../../src/import/providers/opencode.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../../../src/import/providers/pi.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the conversation import system.
|
|
3
|
+
*
|
|
4
|
+
* The import system detects and reads conversation history from external
|
|
5
|
+
* AI coding agents (Claude Code, OpenCode, Aider, etc.) and extracts
|
|
6
|
+
* long-term knowledge entries via the curator LLM prompt.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A chunk of conversation text from a foreign agent, ready for
|
|
10
|
+
* knowledge extraction. Chunks are sized to fit within a single
|
|
11
|
+
* LLM curator call (~12K tokens).
|
|
12
|
+
*/
|
|
13
|
+
export type ConversationChunk = {
|
|
14
|
+
/** Human-readable label, e.g. "Claude Code session 2025-05-10 (1 of 3)" */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Plain text of the conversation (role-prefixed lines) */
|
|
17
|
+
text: string;
|
|
18
|
+
/** Estimated token count (~text.length / 3) */
|
|
19
|
+
estimatedTokens: number;
|
|
20
|
+
/** When this chunk's messages were created (epoch ms), for sorting */
|
|
21
|
+
timestamp: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A detected session from a foreign agent.
|
|
25
|
+
*/
|
|
26
|
+
export type DetectedSession = {
|
|
27
|
+
/** Unique identifier (agent-specific: file path, session UUID, etc.) */
|
|
28
|
+
id: string;
|
|
29
|
+
/** Human-readable label */
|
|
30
|
+
label: string;
|
|
31
|
+
/** When this session started (epoch ms) */
|
|
32
|
+
startedAt: number;
|
|
33
|
+
/** When this session last had activity (epoch ms) */
|
|
34
|
+
lastActivityAt: number;
|
|
35
|
+
/** Estimated total tokens across all messages */
|
|
36
|
+
estimatedTokens: number;
|
|
37
|
+
/** Number of conversation messages (user + assistant) */
|
|
38
|
+
messageCount: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Summary of what was detected for a project from one agent.
|
|
42
|
+
*/
|
|
43
|
+
export type DetectionResult = {
|
|
44
|
+
/** Internal agent name (e.g. "claude-code", "opencode", "aider") */
|
|
45
|
+
agentName: string;
|
|
46
|
+
/** Human-readable agent name (e.g. "Claude Code") */
|
|
47
|
+
agentDisplayName: string;
|
|
48
|
+
/** Sessions found for this project */
|
|
49
|
+
sessions: DetectedSession[];
|
|
50
|
+
/** Total estimated tokens across all sessions */
|
|
51
|
+
totalTokens: number;
|
|
52
|
+
/** Total messages across all sessions */
|
|
53
|
+
totalMessages: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Adapter interface for reading conversation history from a specific
|
|
57
|
+
* AI coding agent. Each agent implements this interface.
|
|
58
|
+
*/
|
|
59
|
+
export interface AgentHistoryProvider {
|
|
60
|
+
/** Internal name (e.g. "claude-code", "opencode", "aider") */
|
|
61
|
+
readonly name: string;
|
|
62
|
+
/** Display name (e.g. "Claude Code") */
|
|
63
|
+
readonly displayName: string;
|
|
64
|
+
/**
|
|
65
|
+
* Detect whether this agent has conversation history for the given
|
|
66
|
+
* project path. Should be a fast check — avoid reading full file contents.
|
|
67
|
+
*
|
|
68
|
+
* @returns Array of detected sessions, or empty array if none found.
|
|
69
|
+
*/
|
|
70
|
+
detect(projectPath: string): DetectedSession[];
|
|
71
|
+
/**
|
|
72
|
+
* Read conversation text from specific sessions, chunked for LLM
|
|
73
|
+
* consumption. Each chunk is <= maxTokens estimated tokens.
|
|
74
|
+
*
|
|
75
|
+
* @param projectPath The project directory
|
|
76
|
+
* @param sessionIds Which sessions to import (from detect() results)
|
|
77
|
+
* @param maxTokens Max estimated tokens per chunk (default: 12288)
|
|
78
|
+
* @returns Conversation chunks ready for knowledge extraction
|
|
79
|
+
*/
|
|
80
|
+
readChunks(projectPath: string, sessionIds: string[], maxTokens?: number): ConversationChunk[];
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=types.d.ts.map
|
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,CACR,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,iBAAiB,EAAE,CAAC;CACxB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,14 +7,17 @@ export * as embedding from "./embedding";
|
|
|
7
7
|
export * as embeddingVendor from "./embedding-vendor";
|
|
8
8
|
export * as latReader from "./lat-reader";
|
|
9
9
|
export * as patternExtract from "./pattern-extract";
|
|
10
|
+
export * as instructionDetect from "./instruction-detect";
|
|
10
11
|
export * as log from "./log";
|
|
12
|
+
export * as conversationImport from "./import";
|
|
11
13
|
export { runRecall, searchRecall, recallById, RECALL_TOOL_DESCRIPTION, RECALL_PARAM_DESCRIPTIONS, type RecallInput, type RecallResult, type RecallScope, type ScoredDistillation, type TaggedResult, type ScoredTaggedResult, } from "./recall";
|
|
12
14
|
export type { LoreMessage, LoreUserMessage, LoreAssistantMessage, LorePart, LoreTextPart, LoreReasoningPart, LoreToolPart, LoreGenericPart, LoreToolState, LoreToolStatePending, LoreToolStateRunning, LoreToolStateCompleted, LoreToolStateError, LoreMessageWithParts, LLMClient, } from "./types";
|
|
13
15
|
export { isTextPart, isReasoningPart, isToolPart } from "./types";
|
|
16
|
+
export { dataDir } from "./data-dir";
|
|
14
17
|
export { load, config, type LoreConfig } from "./config";
|
|
15
|
-
export { db, dbPath, ensureProject, isFirstRun, projectId, projectName, mergeProjectInternal, loadForceMinLayer, saveForceMinLayer, saveSessionCosts, loadSessionCosts, loadAllSessionCosts, type SessionCostSnapshot, getMeta, setMeta, getInstanceId, close, } from "./db";
|
|
18
|
+
export { db, dbPath, ensureProject, getLastImportAt, setLastImportAt, isFirstRun, projectId, projectName, mergeProjectInternal, loadForceMinLayer, saveForceMinLayer, saveSessionCosts, loadSessionCosts, loadAllSessionCosts, type SessionCostSnapshot, saveSessionTracking, loadSessionTracking, loadHeaderSessionIndex, type SessionTrackingState, type LoadedSessionTracking, getKV, setKV, getMeta, setMeta, getInstanceId, close, } from "./db";
|
|
16
19
|
export { normalizeRemoteUrl, getGitRemote, clearGitRemoteCache } from "./git";
|
|
17
|
-
export { transform, setModelLimits, setMaxLayer0Tokens, computeLayer0Cap, setMaxContextTokens, computeContextCap, getMaxContextTokens, updateBustRate, needsUrgentDistillation, calibrate, setLtmTokens, getLtmTokens, getLtmBudget, setForceMinLayer, getLastTransformedCount, getLastTransformEstimate, toolStripAnnotation, onIdleResume, getLastTurnAt, consumeCameOutOfIdle, setLastTurnAtForTest, inspectSessionState, } from "./gradient";
|
|
20
|
+
export { transform, setModelLimits, setMaxLayer0Tokens, computeLayer0Cap, setMaxContextTokens, computeContextCap, getMaxContextTokens, updateBustRate, needsUrgentDistillation, calibrate, setLtmTokens, getLtmTokens, getLtmBudget, setForceMinLayer, getLastTransformedCount, getLastTransformEstimate, toolStripAnnotation, onIdleResume, getLastTurnAt, consumeCameOutOfIdle, saveGradientState, setLastTurnAtForTest, inspectSessionState, } from "./gradient";
|
|
18
21
|
export { formatKnowledge, formatDistillations, DISTILLATION_SYSTEM, distillationUser, RECURSIVE_SYSTEM, recursiveUser, CURATOR_SYSTEM, curatorUser, CONSOLIDATION_SYSTEM, consolidationUser, QUERY_EXPANSION_SYSTEM, COMPACT_SUMMARY_TEMPLATE, buildCompactPrompt, } from "./prompt";
|
|
19
22
|
export { shouldImport, importFromFile, exportToFile, exportLoreFile, importLoreFile, shouldImportLoreFile, loreFileExists, clearLoreFileCache, LORE_FILE, } from "./agents-file";
|
|
20
23
|
export { workerSessionIDs, isWorkerSession } from "./worker";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,YAAY,MAAM,gBAAgB,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wBAAwB,EACxB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,MAAM,EACN,CAAC,EACD,CAAC,EACD,EAAE,EACF,GAAG,EACH,IAAI,EACJ,CAAC,EACD,IAAI,EACJ,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-session repeated-instruction detection.
|
|
3
|
+
*
|
|
4
|
+
* Identifies instruction-like user messages in the current session
|
|
5
|
+
* and searches for similar instructions in prior sessions using both
|
|
6
|
+
* embedding-based vector search (semantic similarity) and FTS5 (exact terms).
|
|
7
|
+
*
|
|
8
|
+
* When an instruction appears in N+ prior sessions, it's flagged as a
|
|
9
|
+
* strong LTM candidate and formatted as additional context for the curator.
|
|
10
|
+
*
|
|
11
|
+
* This module does NOT auto-create knowledge entries — it augments the
|
|
12
|
+
* curator's input so the LLM can make the final judgment call on whether
|
|
13
|
+
* a repeated instruction warrants a persistent preference entry.
|
|
14
|
+
*/
|
|
15
|
+
export type InstructionCandidate = {
|
|
16
|
+
/** The matched instruction text. */
|
|
17
|
+
text: string;
|
|
18
|
+
/** Session this candidate was found in. */
|
|
19
|
+
sessionID: string;
|
|
20
|
+
};
|
|
21
|
+
export type RepeatedInstruction = {
|
|
22
|
+
/** The instruction text from the current session. */
|
|
23
|
+
instruction: string;
|
|
24
|
+
/** Number of distinct prior sessions containing similar instructions. */
|
|
25
|
+
priorSessionCount: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Extract instruction-like phrases from user messages.
|
|
29
|
+
* Scans raw user message content for instruction keywords and returns
|
|
30
|
+
* deduplicated candidates.
|
|
31
|
+
*/
|
|
32
|
+
export declare function extractInstructionCandidates(messages: Array<{
|
|
33
|
+
role: string;
|
|
34
|
+
content: string;
|
|
35
|
+
session_id: string;
|
|
36
|
+
}>): InstructionCandidate[];
|
|
37
|
+
/**
|
|
38
|
+
* Search for similar instructions in OTHER sessions via distillation
|
|
39
|
+
* embeddings (semantic) and FTS5 (keyword). Returns instructions that
|
|
40
|
+
* appear in >= threshold prior sessions.
|
|
41
|
+
*/
|
|
42
|
+
export declare function findRepeatedInstructions(input: {
|
|
43
|
+
projectPath: string;
|
|
44
|
+
currentSessionID: string;
|
|
45
|
+
candidates: InstructionCandidate[];
|
|
46
|
+
threshold?: number;
|
|
47
|
+
}): Promise<RepeatedInstruction[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Format repeated instructions as additional context for the curator prompt.
|
|
50
|
+
* Returns empty string if no repeated instructions found.
|
|
51
|
+
*/
|
|
52
|
+
export declare function formatForCurator(instructions: RepeatedInstruction[]): string;
|
|
53
|
+
/**
|
|
54
|
+
* Full detection pipeline: extract candidates from current session →
|
|
55
|
+
* search for repetitions across other sessions → format for curator.
|
|
56
|
+
*
|
|
57
|
+
* Returns a string to append to the curator's user prompt, or "" if
|
|
58
|
+
* nothing was found. Safe to call even when embeddings are unavailable
|
|
59
|
+
* (falls back to FTS-only).
|
|
60
|
+
*/
|
|
61
|
+
export declare function detectAndFormat(input: {
|
|
62
|
+
projectPath: string;
|
|
63
|
+
sessionID: string;
|
|
64
|
+
threshold?: number;
|
|
65
|
+
}): Promise<string>;
|
|
66
|
+
//# sourceMappingURL=instruction-detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instruction-detect.d.ts","sourceRoot":"","sources":["../../src/instruction-detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwCH,MAAM,MAAM,oBAAoB,GAAG;IACjC,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,GACrE,oBAAoB,EAAE,CA+BxB;AAMD;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,KAAK,EAAE;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,oBAAoB,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CA4DjC;AA2CD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAS5E;AAMD;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlB"}
|
package/dist/types/log.d.ts
CHANGED
|
@@ -14,6 +14,13 @@
|
|
|
14
14
|
* When registered, every log call (regardless of `isDebug`) also forwards
|
|
15
15
|
* to the sink. This is used by the gateway to bridge logs → Sentry without
|
|
16
16
|
* adding a Sentry dependency to `@loreai/core`.
|
|
17
|
+
*
|
|
18
|
+
* ## File logging
|
|
19
|
+
*
|
|
20
|
+
* All log calls (info, warn, error) are written to a persistent log file
|
|
21
|
+
* at `~/.local/share/lore/lore.log` regardless of `LORE_DEBUG`.
|
|
22
|
+
* The file is rotated when it exceeds 5 MB (single `.log.1` backup).
|
|
23
|
+
* Use `lore logs` to view; disabled during tests (`NODE_ENV=test`).
|
|
17
24
|
*/
|
|
18
25
|
/** External log consumer registered by the host (e.g. gateway → Sentry). */
|
|
19
26
|
export interface LogSink {
|
|
@@ -24,6 +31,8 @@ export interface LogSink {
|
|
|
24
31
|
}
|
|
25
32
|
/** Register an external log sink. Only one sink is supported at a time. */
|
|
26
33
|
export declare function registerSink(s: LogSink): void;
|
|
34
|
+
/** Return the resolved log file path (or `undefined` if unavailable). */
|
|
35
|
+
export declare function logFilePath(): string | undefined;
|
|
27
36
|
/** Log an informational status message. Suppressed unless LORE_DEBUG=1. */
|
|
28
37
|
export declare function info(...args: unknown[]): void;
|
|
29
38
|
/** Log a warning. Suppressed unless LORE_DEBUG=1. */
|
package/dist/types/log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAUH,4EAA4E;AAC5E,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9D,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;CACtC;AAID,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAE7C;AAiDD,yEAAyE;AACzE,wBAAgB,WAAW,IAAI,MAAM,GAAG,SAAS,CAMhD;AA0CD,2EAA2E;AAC3E,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAK7C;AAED,qDAAqD;AACrD,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAK7C;AAED,mEAAmE;AACnE,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAQ9C"}
|
package/dist/types/ltm.d.ts
CHANGED
|
@@ -27,7 +27,42 @@ export declare function update(id: string, input: {
|
|
|
27
27
|
confidence?: number;
|
|
28
28
|
}): void;
|
|
29
29
|
export declare function remove(id: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Find an existing knowledge entry whose title is fuzzy-similar to the given title.
|
|
32
|
+
*
|
|
33
|
+
* Uses FTS5 to find up to 5 candidates, then applies word-overlap filtering.
|
|
34
|
+
* This is the same algorithm used by `check()` but returns a single match
|
|
35
|
+
* for use in the `create()` dedup guard.
|
|
36
|
+
*
|
|
37
|
+
* @returns The first matching entry (id + title), or null if no fuzzy match.
|
|
38
|
+
*/
|
|
39
|
+
export declare function findFuzzyDuplicate(input: {
|
|
40
|
+
title: string;
|
|
41
|
+
projectId: string | null;
|
|
42
|
+
excludeId?: string;
|
|
43
|
+
}): {
|
|
44
|
+
id: string;
|
|
45
|
+
title: string;
|
|
46
|
+
} | null;
|
|
30
47
|
export declare function forProject(projectPath: string, includeCross?: boolean): KnowledgeEntry[];
|
|
48
|
+
/**
|
|
49
|
+
* Well-known knowledge entry categories managed by the curator.
|
|
50
|
+
* The DB column is a free-form string, but these are the standard values.
|
|
51
|
+
*/
|
|
52
|
+
export type KnowledgeCategory = "decision" | "pattern" | "preference" | "architecture" | "gotcha";
|
|
53
|
+
/** Options for `forSession()` to control entry selection. */
|
|
54
|
+
export type ForSessionOptions = {
|
|
55
|
+
/** Caller-provided context (e.g., user's current message) for relevance
|
|
56
|
+
* scoring when no session context exists in the DB yet. */
|
|
57
|
+
contextHint?: string;
|
|
58
|
+
/** Restrict to these categories (e.g., `['preference']` for turn 1). */
|
|
59
|
+
categories?: (KnowledgeCategory | (string & {}))[];
|
|
60
|
+
/** Exclude these categories (e.g., `['preference']` for context-bound
|
|
61
|
+
* entries when preferences are already injected in a separate block).
|
|
62
|
+
* Mutually exclusive with `categories` — if both are provided,
|
|
63
|
+
* `categories` (include) wins. */
|
|
64
|
+
excludeCategories?: (KnowledgeCategory | (string & {}))[];
|
|
65
|
+
};
|
|
31
66
|
/**
|
|
32
67
|
* Build a relevance-ranked, budget-capped list of knowledge entries for injection
|
|
33
68
|
* into the system prompt of a live session.
|
|
@@ -35,21 +70,27 @@ export declare function forProject(projectPath: string, includeCross?: boolean):
|
|
|
35
70
|
* Strategy:
|
|
36
71
|
* 1. Both project-specific and cross-project entries are scored for relevance
|
|
37
72
|
* against recent session context (last distillation + recent raw messages).
|
|
38
|
-
* 2.
|
|
73
|
+
* 2. When embeddings are available, vector cosine similarity is used for scoring
|
|
74
|
+
* (captures semantic matches that keyword overlap misses). Falls back to
|
|
75
|
+
* FTS5 BM25 when embeddings are unavailable.
|
|
76
|
+
* 3. Project entries get a safety net: the top PROJECT_SAFETY_NET entries by
|
|
39
77
|
* confidence are always included even if they have zero relevance score.
|
|
40
78
|
* This ensures the most important project knowledge is never lost to
|
|
41
|
-
* coarse
|
|
42
|
-
*
|
|
79
|
+
* coarse scoring.
|
|
80
|
+
* 4. All scored entries are merged into a single pool and greedily packed
|
|
43
81
|
* into the token budget by score descending.
|
|
44
|
-
*
|
|
82
|
+
* 5. If there's no session context yet (first turn), fall back to top entries
|
|
45
83
|
* by confidence only (capped at NO_CONTEXT_FALLBACK_CAP per pool).
|
|
46
84
|
*
|
|
47
85
|
* @param projectPath Current project path
|
|
48
86
|
* @param sessionID Current session ID (for context extraction)
|
|
49
87
|
* @param maxTokens Hard token budget for the entire formatted block
|
|
88
|
+
* @param options Optional category filter and context hint
|
|
50
89
|
*/
|
|
51
|
-
export declare function forSession(projectPath: string, sessionID: string | undefined, maxTokens: number): KnowledgeEntry[]
|
|
90
|
+
export declare function forSession(projectPath: string, sessionID: string | undefined, maxTokens: number, options?: ForSessionOptions): Promise<KnowledgeEntry[]>;
|
|
52
91
|
export declare function all(): KnowledgeEntry[];
|
|
92
|
+
/** Return all cross-project and global (user-level) knowledge entries. */
|
|
93
|
+
export declare function crossProject(): KnowledgeEntry[];
|
|
53
94
|
export declare function search(input: {
|
|
54
95
|
query: string;
|
|
55
96
|
projectPath?: string;
|
|
@@ -135,4 +176,97 @@ export type IntegrityIssue = {
|
|
|
135
176
|
* 2. Content quality — empty content, oversized entries
|
|
136
177
|
*/
|
|
137
178
|
export declare function check(projectPath: string): IntegrityIssue[];
|
|
179
|
+
export type DedupCluster = {
|
|
180
|
+
surviving: {
|
|
181
|
+
id: string;
|
|
182
|
+
title: string;
|
|
183
|
+
};
|
|
184
|
+
merged: Array<{
|
|
185
|
+
id: string;
|
|
186
|
+
title: string;
|
|
187
|
+
}>;
|
|
188
|
+
};
|
|
189
|
+
/** Stable pair key for two entry IDs — sorted to ensure order-independence. */
|
|
190
|
+
export declare function dedupPairKey(idA: string, idB: string): string;
|
|
191
|
+
export type DedupResult = {
|
|
192
|
+
clusters: DedupCluster[];
|
|
193
|
+
totalRemoved: number;
|
|
194
|
+
/** Pairwise embedding cosine similarities. Key: dedupPairKey(idA, idB). */
|
|
195
|
+
pairSimilarities: Map<string, number>;
|
|
196
|
+
/** All entry titles by ID — for feedback recording after entries are deleted. */
|
|
197
|
+
entryTitles: Map<string, string>;
|
|
198
|
+
};
|
|
199
|
+
export declare function deduplicate(projectPath: string, opts?: {
|
|
200
|
+
dryRun?: boolean;
|
|
201
|
+
}): Promise<DedupResult>;
|
|
202
|
+
/** Deduplicate global (cross-project) entries that have no project_id. */
|
|
203
|
+
export declare function deduplicateGlobal(opts?: {
|
|
204
|
+
dryRun?: boolean;
|
|
205
|
+
}): Promise<DedupResult>;
|
|
206
|
+
export type DedupFeedbackSource = "auto_dedup" | "cli_yes" | "cli_interactive";
|
|
207
|
+
/** Record a single dedup feedback row. */
|
|
208
|
+
export declare function recordDedupFeedback(input: {
|
|
209
|
+
projectId: string | null;
|
|
210
|
+
entryATitle: string;
|
|
211
|
+
entryBTitle: string;
|
|
212
|
+
similarity: number;
|
|
213
|
+
accepted: boolean;
|
|
214
|
+
source: DedupFeedbackSource;
|
|
215
|
+
}): void;
|
|
216
|
+
/**
|
|
217
|
+
* Bulk-record feedback for all merged pairs in a DedupResult.
|
|
218
|
+
* Only records pairs with embedding similarity > 0 (title-overlap-only
|
|
219
|
+
* matches are excluded from calibration).
|
|
220
|
+
*/
|
|
221
|
+
export declare function recordDedupResultFeedback(projectId: string | null, result: DedupResult, accepted: boolean, source: DedupFeedbackSource): void;
|
|
222
|
+
/**
|
|
223
|
+
* Record automatic calibration signals from a post-curation dedup sweep.
|
|
224
|
+
*
|
|
225
|
+
* Only records **reject** signals — non-merged pairs with similarity in
|
|
226
|
+
* [0.80, threshold). Accept signals from auto-dedup are tautological (the
|
|
227
|
+
* pair was merged *because* its similarity exceeded the threshold), so they
|
|
228
|
+
* provide no new information and would create a self-reinforcing feedback
|
|
229
|
+
* loop. Manual signals (cli_yes, cli_interactive) provide the accept side.
|
|
230
|
+
*
|
|
231
|
+
* Caps at AUTO_SIGNAL_MAX_PAIRS most interesting pairs per run (closest
|
|
232
|
+
* to the threshold boundary) to avoid table bloat.
|
|
233
|
+
*/
|
|
234
|
+
export declare function recordAutoSignals(projectId: string | null, result: DedupResult): void;
|
|
235
|
+
/** Get all feedback for a project (for calibration). */
|
|
236
|
+
export declare function getDedupFeedback(projectId: string | null): Array<{
|
|
237
|
+
similarity: number;
|
|
238
|
+
accepted: boolean;
|
|
239
|
+
source: string;
|
|
240
|
+
}>;
|
|
241
|
+
/** Quick count of feedback rows for a project. */
|
|
242
|
+
export declare function getDedupFeedbackCount(projectId: string | null): number;
|
|
243
|
+
/**
|
|
244
|
+
* Prune old feedback rows for a project, keeping the most recent
|
|
245
|
+
* MAX_FEEDBACK_ROWS_PER_PROJECT rows. Called from recordAutoSignals
|
|
246
|
+
* to prevent unbounded table growth.
|
|
247
|
+
*/
|
|
248
|
+
export declare function pruneDedupFeedback(projectId: string | null): void;
|
|
249
|
+
/**
|
|
250
|
+
* Compute an optimal embedding dedup threshold from user feedback.
|
|
251
|
+
*
|
|
252
|
+
* Algorithm:
|
|
253
|
+
* 1. Load all (similarity, accepted) pairs for the project.
|
|
254
|
+
* 2. If fewer than MIN_CALIBRATION_SAMPLES, return null (use default).
|
|
255
|
+
* 3. If all feedback is "accept" (no rejects), return the minimum
|
|
256
|
+
* accepted similarity minus a small margin (0.005).
|
|
257
|
+
* 4. If all feedback is "reject" (no accepts), return null.
|
|
258
|
+
* 5. Otherwise, find the threshold that maximizes separation:
|
|
259
|
+
* - For each candidate threshold (midpoint between consecutive
|
|
260
|
+
* distinct similarity values), compute accuracy:
|
|
261
|
+
* correct = accepted_pairs_above + rejected_pairs_below
|
|
262
|
+
* accuracy = correct / total
|
|
263
|
+
* - Pick the threshold with highest accuracy.
|
|
264
|
+
* - Tie-break: prefer higher threshold (conservative).
|
|
265
|
+
* - Clamp to [0.85, 0.98].
|
|
266
|
+
*/
|
|
267
|
+
export declare function calibrateDedupThreshold(projectId: string | null): number | null;
|
|
268
|
+
/** Persist the calibrated threshold for a project. */
|
|
269
|
+
export declare function saveCalibratedThreshold(projectId: string | null, threshold: number, sampleSize: number): void;
|
|
270
|
+
/** Load the calibrated threshold for a project, or null if not calibrated. */
|
|
271
|
+
export declare function loadCalibratedThreshold(projectId: string | null): number | null;
|
|
138
272
|
//# sourceMappingURL=ltm.d.ts.map
|
package/dist/types/ltm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ltm.d.ts","sourceRoot":"","sources":["../../src/ltm.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAWF,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+FAA+F;IAC/F,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"ltm.d.ts","sourceRoot":"","sources":["../../src/ltm.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,GAAG,IAAI,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;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,MAAM,EAAE,WAAW,GAClB,IAAI,CAuDN;AAED,wDAAwD;AACxD,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAelE;AAED,kDAAkD;AAClD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAWtE;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAwBjE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CA2C/E;AAED,sDAAsD;AACtD,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,IAAI,CAGN;AAED,8EAA8E;AAC9E,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAU/E"}
|
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
* - "prefers X for Y"
|
|
13
13
|
* - "going with X because Y"
|
|
14
14
|
*
|
|
15
|
+
* Also matches process instruction patterns from distilled observations
|
|
16
|
+
* where the observer normalizes user assertions:
|
|
17
|
+
* - "User stated always X"
|
|
18
|
+
* - "User said never Y"
|
|
19
|
+
* - "User stated make sure to X"
|
|
20
|
+
* - "User stated don't forget to X"
|
|
21
|
+
*
|
|
15
22
|
* Extracted entries participate in the normal curator cycle — the curator
|
|
16
23
|
* can consolidate or remove them based on actual value. The extraction is
|
|
17
24
|
* a cheap seed, not a permanent fixture.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pattern-extract.d.ts","sourceRoot":"","sources":["../../src/pattern-extract.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pattern-extract.d.ts","sourceRoot":"","sources":["../../src/pattern-extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,UAAU,GAAG,YAAY,CAAC;IACpC,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkFF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAyBxE"}
|
package/dist/types/prompt.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const RECURSIVE_SYSTEM = "You are a memory reflector. You are giv
|
|
|
8
8
|
export declare function recursiveUser(distillations: Array<{
|
|
9
9
|
observations: string;
|
|
10
10
|
}>, previousMeta?: string): string;
|
|
11
|
-
export declare const CURATOR_SYSTEM = "You are a long-term memory curator. Your job is to extract durable knowledge from a conversation that should persist across sessions.\n\nFocus ONLY on knowledge that helps a coding agent work effectively on THIS codebase:\n- Architectural decisions and their rationale (why something was built a certain way)\n- Non-obvious implementation patterns and conventions specific to the project\n- Recurring gotchas, constraints, or traps in the codebase\n- Environment/tooling setup details that affect development\n- Important relationships between components that aren't obvious from reading the code\n- User preferences and working style specific to how they use this project\n\nDo NOT extract:\n- Task-specific details (file currently being edited, current bug being fixed)\n- Temporary state (current branch, in-progress work)\n- Information that will change frequently\n- Ecosystem descriptions, product announcements, or marketing content\n- Business strategy, roadmap, or organizational information\n- Information that's readily available in public documentation or READMEs\n- Knowledge about unrelated projects or repositories unless explicitly cross-project\n- Restatements of what the code obviously does (e.g. \"the auth module handles authentication\")\n\nBREVITY IS CRITICAL \u2014 each entry must be concise:\n- content MUST be under 150 words (~600 characters). Capture ONE specific actionable\n insight in 2-3 sentences. Prefer terse technical language.\n- Each \"gotcha\": one specific trap + its fix in 1-2 sentences\n- Each \"architecture\": one design decision and its key constraint\n- Focus on the actionable insight, not the full story behind it\n- If a pattern requires more detail, split into multiple focused entries (each under 150 words)\n- Omit code examples unless a single short snippet is essential\n- Never include full file contents, large diffs, or complete command outputs\n\nPREFER UPDATES OVER CREATES:\n- Before creating a new entry, always check if an existing entry covers the same system\n or component. Update the existing entry rather than creating a new one.\n- When updating, REPLACE the full content with a concise rewrite \u2014 do not append to\n the existing content or repeat what was already there.\n- If multiple existing entries cover the same system from different angles (e.g. different\n bugs in the same module), consolidate them: update one with merged insights, delete the\n rest. Fewer, denser entries are better than many scattered ones.\n\nCROSS-REFERENCES between entries:\n- When an entry relates to another entry, reference it with [[entry-uuid]] using the entry's ID\n from the existing entries list. This creates navigable links between entries.\n- Only reference entries you can see in the existing entries list \u2014 don't guess IDs.\n- Example: \"Uses the gradient system [[019c904b-791e-772a-ab2b-93ac892a960c]] for context management.\"\n\ncrossProject flag:\n- Default is true \u2014 most useful knowledge is worth sharing across projects\n- Set crossProject to false for things that are meaningless outside this specific repo (e.g. a config path, a project-local naming convention that conflicts with your usual style)\n\nProduce a JSON array of operations:\n[\n {\n \"op\": \"create\",\n \"category\": \"decision\" | \"pattern\" | \"preference\" | \"architecture\" | \"gotcha\",\n \"title\": \"Short descriptive title\",\n \"content\": \"Concise knowledge entry \u2014 under 150 words\",\n \"scope\": \"project\" | \"global\",\n \"crossProject\": true\n },\n {\n \"op\": \"update\",\n \"id\": \"existing-entry-id\",\n \"content\": \"Updated content \u2014 under 150 words\",\n \"confidence\": 0.0-1.0\n },\n {\n \"op\": \"delete\",\n \"id\": \"existing-entry-id\",\n \"reason\": \"Why this is no longer relevant\"\n }\n]\n\nIf nothing warrants extraction, return an empty array: []\n\nOutput ONLY valid JSON. No markdown fences, no explanation, no preamble.";
|
|
11
|
+
export declare const CURATOR_SYSTEM = "You are a long-term memory curator. Your job is to extract durable knowledge from a conversation that should persist across sessions.\n\nFocus ONLY on knowledge that helps a coding agent work effectively on THIS codebase:\n- Architectural decisions and their rationale (why something was built a certain way)\n- Non-obvious implementation patterns and conventions specific to the project\n- Recurring gotchas, constraints, or traps in the codebase\n- Environment/tooling setup details that affect development\n- Important relationships between components that aren't obvious from reading the code\n- User preferences and working style specific to how they use this project\n- Repeated user instructions \u2014 when the user says things like \"always\", \"never\",\n \"make sure to\", \"don't forget to\", these are high-value preference candidates.\n If you see instruction-like language, prioritize extracting it as a \"preference\" entry.\n These instructions represent how the user wants to work and should persist across sessions.\n\nDo NOT extract:\n- Task-specific details (file currently being edited, current bug being fixed)\n- Temporary state (current branch, in-progress work)\n- Information that will change frequently\n- Ecosystem descriptions, product announcements, or marketing content\n- Business strategy, roadmap, or organizational information\n- Information that's readily available in public documentation or READMEs\n- Knowledge about unrelated projects or repositories unless explicitly cross-project\n- Restatements of what the code obviously does (e.g. \"the auth module handles authentication\")\n\nBREVITY IS CRITICAL \u2014 each entry must be concise:\n- content MUST be under 150 words (~600 characters). Capture ONE specific actionable\n insight in 2-3 sentences. Prefer terse technical language.\n- Each \"gotcha\": one specific trap + its fix in 1-2 sentences\n- Each \"architecture\": one design decision and its key constraint\n- Focus on the actionable insight, not the full story behind it\n- If a pattern requires more detail, split into multiple focused entries (each under 150 words)\n- Omit code examples unless a single short snippet is essential\n- Never include full file contents, large diffs, or complete command outputs\n\nPREFER UPDATES OVER CREATES:\n- Before creating a new entry, always check if an existing entry covers the same system\n or component. Update the existing entry rather than creating a new one.\n- When updating, REPLACE the full content with a concise rewrite \u2014 do not append to\n the existing content or repeat what was already there.\n- If multiple existing entries cover the same system from different angles (e.g. different\n bugs in the same module), consolidate them: update one with merged insights, delete the\n rest. Fewer, denser entries are better than many scattered ones.\n\nCROSS-REFERENCES between entries:\n- When an entry relates to another entry, reference it with [[entry-uuid]] using the entry's ID\n from the existing entries list. This creates navigable links between entries.\n- Only reference entries you can see in the existing entries list \u2014 don't guess IDs.\n- Example: \"Uses the gradient system [[019c904b-791e-772a-ab2b-93ac892a960c]] for context management.\"\n\ncrossProject flag:\n- Default is true \u2014 most useful knowledge is worth sharing across projects\n- Set crossProject to false for things that are meaningless outside this specific repo (e.g. a config path, a project-local naming convention that conflicts with your usual style)\n\nProduce a JSON array of operations:\n[\n {\n \"op\": \"create\",\n \"category\": \"decision\" | \"pattern\" | \"preference\" | \"architecture\" | \"gotcha\",\n \"title\": \"Short descriptive title\",\n \"content\": \"Concise knowledge entry \u2014 under 150 words\",\n \"scope\": \"project\" | \"global\",\n \"crossProject\": true\n },\n {\n \"op\": \"update\",\n \"id\": \"existing-entry-id\",\n \"content\": \"Updated content \u2014 under 150 words\",\n \"confidence\": 0.0-1.0\n },\n {\n \"op\": \"delete\",\n \"id\": \"existing-entry-id\",\n \"reason\": \"Why this is no longer relevant\"\n }\n]\n\nIf nothing warrants extraction, return an empty array: []\n\nOutput ONLY valid JSON. No markdown fences, no explanation, no preamble.";
|
|
12
12
|
export declare function curatorUser(input: {
|
|
13
13
|
messages: string;
|
|
14
14
|
existing: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,s1OAmHhB,CAAC;AAEjB,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAaT;AAUD,eAAO,MAAM,gBAAgB,mkGAsC2C,CAAC;AAEzE,wBAAgB,aAAa,CAC3B,aAAa,EAAE,KAAK,CAAC;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,EAC9C,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAo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