@loreai/core 0.17.0 → 0.18.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 +12 -0
- package/dist/bun/db.d.ts.map +1 -1
- 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 +30 -22
- package/dist/bun/embedding.d.ts.map +1 -1
- package/dist/bun/gradient.d.ts +8 -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 +4 -1
- package/dist/bun/index.d.ts.map +1 -1
- package/dist/bun/index.js +2217 -224
- 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 +40 -0
- 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/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 +12 -0
- package/dist/node/db.d.ts.map +1 -1
- 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 +30 -22
- package/dist/node/embedding.d.ts.map +1 -1
- package/dist/node/gradient.d.ts +8 -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 +4 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +2217 -224
- 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 +40 -0
- 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/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 +12 -0
- package/dist/types/db.d.ts.map +1 -1
- 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 +30 -22
- package/dist/types/embedding.d.ts.map +1 -1
- package/dist/types/gradient.d.ts +8 -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 +4 -1
- 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 +40 -0
- 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/temporal.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +2 -4
- package/src/agents-file.ts +41 -13
- package/src/config.ts +31 -18
- package/src/curator.ts +111 -75
- package/src/data-dir.ts +76 -0
- package/src/db.ts +110 -11
- package/src/distillation.ts +10 -2
- 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 +196 -171
- package/src/gradient.ts +9 -1
- 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 +5 -0
- package/src/instruction-detect.ts +275 -0
- package/src/log.ts +91 -3
- package/src/ltm.ts +316 -3
- 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/temporal.ts +8 -6
- package/src/types.ts +1 -1
|
@@ -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/bun/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/bun/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/bun/ltm.d.ts
CHANGED
|
@@ -27,6 +27,23 @@ 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[];
|
|
31
48
|
/**
|
|
32
49
|
* Build a relevance-ranked, budget-capped list of knowledge entries for injection
|
|
@@ -50,6 +67,8 @@ export declare function forProject(projectPath: string, includeCross?: boolean):
|
|
|
50
67
|
*/
|
|
51
68
|
export declare function forSession(projectPath: string, sessionID: string | undefined, maxTokens: number): KnowledgeEntry[];
|
|
52
69
|
export declare function all(): KnowledgeEntry[];
|
|
70
|
+
/** Return all cross-project and global (user-level) knowledge entries. */
|
|
71
|
+
export declare function crossProject(): KnowledgeEntry[];
|
|
53
72
|
export declare function search(input: {
|
|
54
73
|
query: string;
|
|
55
74
|
projectPath?: string;
|
|
@@ -135,4 +154,25 @@ export type IntegrityIssue = {
|
|
|
135
154
|
* 2. Content quality — empty content, oversized entries
|
|
136
155
|
*/
|
|
137
156
|
export declare function check(projectPath: string): IntegrityIssue[];
|
|
157
|
+
export type DedupCluster = {
|
|
158
|
+
surviving: {
|
|
159
|
+
id: string;
|
|
160
|
+
title: string;
|
|
161
|
+
};
|
|
162
|
+
merged: Array<{
|
|
163
|
+
id: string;
|
|
164
|
+
title: string;
|
|
165
|
+
}>;
|
|
166
|
+
};
|
|
167
|
+
export type DedupResult = {
|
|
168
|
+
clusters: DedupCluster[];
|
|
169
|
+
totalRemoved: number;
|
|
170
|
+
};
|
|
171
|
+
export declare function deduplicate(projectPath: string, opts?: {
|
|
172
|
+
dryRun?: boolean;
|
|
173
|
+
}): Promise<DedupResult>;
|
|
174
|
+
/** Deduplicate global (cross-project) entries that have no project_id. */
|
|
175
|
+
export declare function deduplicateGlobal(opts?: {
|
|
176
|
+
dryRun?: boolean;
|
|
177
|
+
}): Promise<DedupResult>;
|
|
138
178
|
//# sourceMappingURL=ltm.d.ts.map
|
package/dist/bun/ltm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ltm.d.ts","sourceRoot":"","sources":["../../src/ltm.ts"],"names":[],"mapp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MAAM,CAAC;IAChB,IAAI,EAAE,WAAW,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CAAC;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,EAAE,CA8E3D;AAMD,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,MAAM,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AA6JF,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,WAAW,CAAC,CAGtB;AAED,0EAA0E;AAC1E,wBAAsB,iBAAiB,CACrC,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,WAAW,CAAC,CAUtB"}
|
|
@@ -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/bun/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<{
|
package/dist/bun/prompt.d.ts.map
CHANGED
|
@@ -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;CAA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CAAC;CACrC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC,oBAAoB,CAAA;CAAE,GACvD;IACE,MAAM,EAAE,iBAAiB,CAAC;IAC1B,IAAI,EAAE,GAAG,CAAC,oBAAoB,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;CACtB,GACD;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAA;CAAE,GACpD;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC,qBAAqB,CAAA;CAAE,GAC5D;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC,gBAAgB,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA0WvE;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuY/B;AAMD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAoE7C;AAED,wFAAwF;AACxF,wBAAsB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAczE;AAED,sEAAsE;AACtE,eAAO,MAAM,uBAAuB,wiBAC8f,CAAC;AAEniB,mEAAmE;AACnE,eAAO,MAAM,yBAAyB;;;;CAKrC,CAAC"}
|
package/dist/bun/search.d.ts
CHANGED
|
@@ -104,14 +104,15 @@ export declare function normalizeRank(rank: number, minRank: number, maxRank: nu
|
|
|
104
104
|
/**
|
|
105
105
|
* Reciprocal Rank Fusion: merge multiple ranked lists into a single ranked list.
|
|
106
106
|
*
|
|
107
|
-
* RRF score = Σ(
|
|
107
|
+
* RRF score = Σ(weight / (k + rank_i)) for each list where the item appears.
|
|
108
108
|
* k = 60 is standard (from Cormack et al., 2009; also used by QMD).
|
|
109
109
|
*
|
|
110
110
|
* RRF is rank-based, not score-based — raw score magnitude differences across
|
|
111
111
|
* different FTS5 tables don't matter. Only relative ordering within each list.
|
|
112
112
|
*
|
|
113
|
-
* @param lists Each list provides items (in ranked order)
|
|
114
|
-
* for deduplication
|
|
113
|
+
* @param lists Each list provides items (in ranked order), a key function
|
|
114
|
+
* for deduplication, and an optional weight (default 1).
|
|
115
|
+
* Items at the front of the array are rank 0.
|
|
115
116
|
* @param k Smoothing constant. Default 60.
|
|
116
117
|
* @returns Fused list sorted by RRF score descending. When items appear
|
|
117
118
|
* in multiple lists, the first occurrence's item is kept.
|
|
@@ -119,6 +120,7 @@ export declare function normalizeRank(rank: number, minRank: number, maxRank: nu
|
|
|
119
120
|
export declare function reciprocalRankFusion<T>(lists: Array<{
|
|
120
121
|
items: T[];
|
|
121
122
|
key: (item: T) => string;
|
|
123
|
+
weight?: number;
|
|
122
124
|
}>, k?: number): Array<{
|
|
123
125
|
item: T;
|
|
124
126
|
score: number;
|
package/dist/bun/search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/search.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,EAAE,WAAW,CAAC,MAAM,CAmGxC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW,SAAO,CAAC;AAEhC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CASjD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI5C;AAED;;;;GAIG;AACH,wBAAgB,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"temporal.d.ts","sourceRoot":"","sources":["../../src/temporal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,WAAS,CAAC;AAEvC;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAarD;AAiBD,wBAAgB,KAAK,CAAC,KAAK,EAAE;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,QA8CA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,eAAe,EAAE,CASnB;AAED,wBAAgB,SAAS,CACvB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,eAAe,EAAE,CAOnB;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QAQ1C;
|
|
1
|
+
{"version":3,"file":"temporal.d.ts","sourceRoot":"","sources":["../../src/temporal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,WAAS,CAAC;AAEvC;;;;;;;;;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K,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,qBAAqB,EAAE,CAwB1B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,EAAE,EACpB,GAAG,GAAE,MAAmB,GACvB,MAAM,CAoBR;AAED,wBAAgB,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAWrE;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAWR;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAWR;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,WAAW,CA0Ed"}
|
package/dist/bun/types.d.ts
CHANGED
|
@@ -164,7 +164,7 @@ export type LoreMessageWithParts = {
|
|
|
164
164
|
* Host adapters implement this:
|
|
165
165
|
* - OpenCode: wraps `client.session.create()` + `client.session.prompt()`
|
|
166
166
|
* - Pi: wraps `complete()` from `@mariozechner/pi-ai`
|
|
167
|
-
* -
|
|
167
|
+
* - Gateway: direct `fetch()` to provider APIs
|
|
168
168
|
*/
|
|
169
169
|
export interface LLMClient {
|
|
170
170
|
/**
|
|
@@ -87,6 +87,10 @@ export declare function shouldImportLoreFile(projectPath: string): boolean;
|
|
|
87
87
|
/**
|
|
88
88
|
* Import knowledge entries from `.lore.md` into the local DB.
|
|
89
89
|
* Parses the full file content (no section markers to split on).
|
|
90
|
+
*
|
|
91
|
+
* After a successful import, updates the file cache so that
|
|
92
|
+
* `shouldImportLoreFile()` fast-paths on the next check — the file
|
|
93
|
+
* content hasn't changed, only the DB was updated to match it.
|
|
90
94
|
*/
|
|
91
95
|
export declare function importLoreFile(projectPath: string): void;
|
|
92
96
|
//# sourceMappingURL=agents-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-file.d.ts","sourceRoot":"","sources":["../../src/agents-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,eAAO,MAAM,kBAAkB,qGACqE,CAAC;AACrG,eAAO,MAAM,gBAAgB,sCAAsC,CAAC;AAepE;;;;GAIG;AACH,eAAO,MAAM,SAAS,aAAa,CAAC;AA8CpC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAI5D;AAMD,MAAM,MAAM,eAAe,GAAG;IAC5B,+EAA+E;IAC/E,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA+EF;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,CAgD1E;AAmFD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CA8BP;AAMD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAcV;
|
|
1
|
+
{"version":3,"file":"agents-file.d.ts","sourceRoot":"","sources":["../../src/agents-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQ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CAmBxD"}
|
package/dist/node/config.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export declare const LoreConfig: z.ZodObject<{
|
|
|
47
47
|
}, z.core.$strip>>;
|
|
48
48
|
recallLimit: z.ZodDefault<z.ZodNumber>;
|
|
49
49
|
queryExpansion: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
vectorBoostWeight: z.ZodDefault<z.ZodNumber>;
|
|
51
|
+
vectorBoostMinTerms: z.ZodDefault<z.ZodNumber>;
|
|
50
52
|
embeddings: z.ZodDefault<z.ZodObject<{
|
|
51
53
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
52
54
|
provider: z.ZodDefault<z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8OrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAIpD,wBAAgB,MAAM,IAAI,UAAU,CAEnC;AAED,wBAAsB,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CASjE"}
|
package/dist/node/curator.d.ts
CHANGED
|
@@ -1,4 +1,49 @@
|
|
|
1
1
|
import type { LLMClient } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Maximum length (chars) for a single knowledge entry's content.
|
|
4
|
+
* ~400 tokens at chars/3. Entries exceeding this are truncated with a notice.
|
|
5
|
+
* The curator prompt also instructs the model to stay within this limit,
|
|
6
|
+
* so truncation is a last-resort safety net.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MAX_ENTRY_CONTENT_LENGTH = 1200;
|
|
9
|
+
export type CuratorOp = {
|
|
10
|
+
op: "create";
|
|
11
|
+
category: string;
|
|
12
|
+
title: string;
|
|
13
|
+
content: string;
|
|
14
|
+
scope: "project" | "global";
|
|
15
|
+
crossProject?: boolean;
|
|
16
|
+
} | {
|
|
17
|
+
op: "update";
|
|
18
|
+
id: string;
|
|
19
|
+
content?: string;
|
|
20
|
+
confidence?: number;
|
|
21
|
+
} | {
|
|
22
|
+
op: "delete";
|
|
23
|
+
id: string;
|
|
24
|
+
reason: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Parse the LLM's JSON response into typed curator ops.
|
|
28
|
+
* Handles markdown fences and filters invalid entries.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseOps(text: string): CuratorOp[];
|
|
31
|
+
/**
|
|
32
|
+
* Apply a list of curator ops (create/update/delete) to the knowledge DB.
|
|
33
|
+
* Shared by both the live curator and the conversation import system.
|
|
34
|
+
*
|
|
35
|
+
* @returns Counts of applied operations.
|
|
36
|
+
*/
|
|
37
|
+
export declare function applyOps(ops: CuratorOp[], input: {
|
|
38
|
+
projectPath?: string;
|
|
39
|
+
sessionID?: string;
|
|
40
|
+
/** If true, skip "create" ops (used by consolidation). */
|
|
41
|
+
skipCreate?: boolean;
|
|
42
|
+
}): {
|
|
43
|
+
created: number;
|
|
44
|
+
updated: number;
|
|
45
|
+
deleted: number;
|
|
46
|
+
};
|
|
2
47
|
export declare function run(input: {
|
|
3
48
|
llm: LLMClient;
|
|
4
49
|
projectPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curator.d.ts","sourceRoot":"","sources":["../../src/curator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"curator.d.ts","sourceRoot":"","s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O,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAqEjE;AAED,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,QAMtD;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE;IACvC,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAkChD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared data-directory path resolution with one-time migration from the
|
|
3
|
+
* legacy `opencode-lore` directory name to `lore`.
|
|
4
|
+
*
|
|
5
|
+
* Both `db.ts` and `log.ts` need the data directory path. This module
|
|
6
|
+
* provides a single source of truth so the path logic is not duplicated.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Return the resolved data directory path (`~/.local/share/lore` by
|
|
10
|
+
* default), running the legacy-directory migration on the first call.
|
|
11
|
+
*
|
|
12
|
+
* **Callers are responsible for creating the directory** — this function
|
|
13
|
+
* does not call `mkdirSync`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function dataDir(): string;
|
|
16
|
+
/** @internal Visible for testing only — resets the one-shot guard. */
|
|
17
|
+
export declare function _resetMigrationFlag(): void;
|
|
18
|
+
//# sourceMappingURL=data-dir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-dir.d.ts","sourceRoot":"","sources":["../../src/data-dir.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsDH;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAGhC;AAED,sEAAsE;AACtE,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
package/dist/node/db.d.ts
CHANGED
|
@@ -47,6 +47,16 @@ export declare function projectName(id: string): string | null;
|
|
|
47
47
|
* Must be called before ensureProject() to get an accurate result.
|
|
48
48
|
*/
|
|
49
49
|
export declare function isFirstRun(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Get the timestamp of the last conversation import offer/run for a project.
|
|
52
|
+
* Returns null if import has never been offered for this project.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getLastImportAt(projectPath: string): number | null;
|
|
55
|
+
/**
|
|
56
|
+
* Record that conversation import was offered/run for a project.
|
|
57
|
+
* Prevents auto-import from re-prompting, and enables incremental imports.
|
|
58
|
+
*/
|
|
59
|
+
export declare function setLastImportAt(projectPath: string, timestamp: number): void;
|
|
50
60
|
/**
|
|
51
61
|
* Load persisted forceMinLayer for a session. Returns 0 if none stored.
|
|
52
62
|
*/
|
|
@@ -68,6 +78,8 @@ export type SessionCostSnapshot = {
|
|
|
68
78
|
ttlSavings: number;
|
|
69
79
|
ttlHits: number;
|
|
70
80
|
batchSavings: number;
|
|
81
|
+
avoidedCompactions: number;
|
|
82
|
+
avoidedCompactionCost: number;
|
|
71
83
|
};
|
|
72
84
|
/**
|
|
73
85
|
* Persist a session's cost snapshot. Uses INSERT OR REPLACE so it works
|
package/dist/node/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAMvE;
|
|
1
|
+
{"version":3,"file":"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,CAAC,KAAK,EAAE;IACvC,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC/B,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAwGrC;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAkDxC"}
|
|
@@ -1,41 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Vendored
|
|
2
|
+
* Vendored model registration for the standalone Lore binary.
|
|
3
3
|
*
|
|
4
|
-
* The Bun-compiled `lore` binary
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The Bun-compiled `lore` binary bundles `@huggingface/transformers`
|
|
5
|
+
* (which includes ONNX Runtime) into the executable. The model weights
|
|
6
|
+
* and tokenizer files (nomic-embed-text-v1.5, INT8 quantized) are
|
|
7
|
+
* embedded as Bun assets and extracted to a cache dir on first run.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* equivalent) for the actual ONNX Runtime computation library. Bun
|
|
14
|
-
* doesn't follow this kind of dependency. The binary's wrapper
|
|
15
|
-
* pre-loads these libs via `bun:ffi` *before* fastembed evaluates,
|
|
16
|
-
* so when the addon's dlopen fires it finds the cached handle.
|
|
17
|
-
*
|
|
18
|
-
* 2. **Model weights + tokenizer**. fastembed downloads from the HF
|
|
19
|
-
* Hub on first use; we want zero network on first run. The wrapper
|
|
20
|
-
* embeds the bge-small INT8 files as Bun assets, writes them to a
|
|
21
|
-
* real disk dir on first run, and sets `globalThis.__LORE_VENDOR_MODEL__`
|
|
22
|
-
* to that path. This module exposes that registration to the
|
|
23
|
-
* LocalProvider so it can hand the path to fastembed's CUSTOM-mode
|
|
24
|
-
* init (`modelAbsoluteDirPath` + `modelName`).
|
|
9
|
+
* The binary's wrapper sets `globalThis.__LORE_VENDOR_MODEL__` to the
|
|
10
|
+
* extraction path. This module exposes that registration to the
|
|
11
|
+
* `LocalProvider` so it can configure the transformers.js `env` to
|
|
12
|
+
* load from the local path instead of downloading from HuggingFace Hub.
|
|
25
13
|
*
|
|
26
14
|
* In npm-mode usage from `@loreai/opencode` / `@loreai/pi` the global
|
|
27
|
-
* is unset and `vendorModelInfo()` returns `null`, so
|
|
28
|
-
*
|
|
15
|
+
* is unset and `vendorModelInfo()` returns `null`, so transformers.js
|
|
16
|
+
* downloads the model from HF Hub on first use and caches it locally.
|
|
29
17
|
*/
|
|
30
18
|
/** What the binary wrapper writes to globalThis after extracting model files. */
|
|
31
19
|
export interface VendorRegistration {
|
|
32
|
-
/** Absolute path to the dir containing the
|
|
33
|
-
* (config.json, tokenizer.json, model_quantized.onnx, …).
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
/** Filename of the ONNX weights inside that dir. Pass to fastembed
|
|
37
|
-
* as `modelName` in CUSTOM init. */
|
|
38
|
-
modelName: string;
|
|
20
|
+
/** Absolute path to the dir containing the model files in HF layout
|
|
21
|
+
* (config.json, tokenizer.json, onnx/model_quantized.onnx, …).
|
|
22
|
+
* Passed to transformers.js as `env.localModelPath`. */
|
|
23
|
+
localModelPath: string;
|
|
39
24
|
/** Target identifier the binary was built for, e.g. "linux-x64".
|
|
40
25
|
* Diagnostic only — the runtime doesn't branch on it. */
|
|
41
26
|
target: string;
|
|
@@ -46,17 +31,16 @@ export interface VendorRegistration {
|
|
|
46
31
|
* both binary-mode and npm-mode code paths without spinning up a real
|
|
47
32
|
* compiled binary. */
|
|
48
33
|
export declare function _setVendorRegistration(reg: VendorRegistration | null): void;
|
|
49
|
-
/** Subset of the registration
|
|
50
|
-
* diagnostic fields so the LocalProvider has exactly what it should
|
|
51
|
-
* hand to `FlagEmbedding.init`. */
|
|
34
|
+
/** Subset of the registration the LocalProvider needs. */
|
|
52
35
|
export interface VendorModelInfo {
|
|
53
|
-
|
|
54
|
-
|
|
36
|
+
/** Absolute path to the dir containing the model in HF layout.
|
|
37
|
+
* Set as `env.localModelPath` in the worker thread. */
|
|
38
|
+
localModelPath: string;
|
|
55
39
|
}
|
|
56
40
|
/**
|
|
57
|
-
* Resolve the
|
|
58
|
-
* `null` when no vendor is registered (npm-mode), so the caller
|
|
59
|
-
* through to
|
|
41
|
+
* Resolve the vendored model path for transformers.js local loading.
|
|
42
|
+
* Returns `null` when no vendor is registered (npm-mode), so the caller
|
|
43
|
+
* falls through to transformers.js's default HF Hub download + cache.
|
|
60
44
|
*/
|
|
61
45
|
export declare function vendorModelInfo(): VendorModelInfo | null;
|
|
62
46
|
/** True iff this process is running inside a vendored Lore binary. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding-vendor.d.ts","sourceRoot":"","sources":["../../src/embedding-vendor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"embedding-vendor.d.ts","sourceRoot":"","sources":["../../src/embedding-vendor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC;;6DAEyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB;8DAC0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;CACjB;AAUD;;uBAEuB;AACvB,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAI3E;AAMD,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B;4DACwD;IACxD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,eAAe,GAAG,IAAI,CAMxD;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,IAAI,kBAAkB,GAAG,IAAI,CAE9D"}
|