@loreai/core 0.0.1 → 0.10.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/LICENSE +21 -0
- package/README.md +26 -5
- package/dist/bun/agents-file.d.ts +59 -0
- package/dist/bun/agents-file.d.ts.map +1 -0
- package/dist/bun/config.d.ts +58 -0
- package/dist/bun/config.d.ts.map +1 -0
- package/dist/bun/curator.d.ts +35 -0
- package/dist/bun/curator.d.ts.map +1 -0
- package/dist/bun/db/driver.bun.d.ts +5 -0
- package/dist/bun/db/driver.bun.d.ts.map +1 -0
- package/dist/bun/db/driver.node.d.ts +15 -0
- package/dist/bun/db/driver.node.d.ts.map +1 -0
- package/dist/bun/db.d.ts +22 -0
- package/dist/bun/db.d.ts.map +1 -0
- package/dist/bun/distillation.d.ts +32 -0
- package/dist/bun/distillation.d.ts.map +1 -0
- package/dist/bun/embedding.d.ts +90 -0
- package/dist/bun/embedding.d.ts.map +1 -0
- package/dist/bun/gradient.d.ts +73 -0
- package/dist/bun/gradient.d.ts.map +1 -0
- package/dist/bun/index.d.ts +19 -0
- package/dist/bun/index.d.ts.map +1 -0
- package/dist/bun/index.js +28236 -0
- package/dist/bun/index.js.map +7 -0
- package/dist/bun/lat-reader.d.ts +69 -0
- package/dist/bun/lat-reader.d.ts.map +1 -0
- package/dist/bun/log.d.ts +17 -0
- package/dist/bun/log.d.ts.map +1 -0
- package/dist/bun/ltm.d.ts +138 -0
- package/dist/bun/ltm.d.ts.map +1 -0
- package/dist/bun/markdown.d.ts +37 -0
- package/dist/bun/markdown.d.ts.map +1 -0
- package/dist/bun/prompt.d.ts +47 -0
- package/dist/bun/prompt.d.ts.map +1 -0
- package/dist/bun/recall.d.ts +41 -0
- package/dist/bun/recall.d.ts.map +1 -0
- package/dist/bun/search.d.ts +113 -0
- package/dist/bun/search.d.ts.map +1 -0
- package/dist/bun/temporal.d.ts +66 -0
- package/dist/bun/temporal.d.ts.map +1 -0
- package/dist/bun/types.d.ts +180 -0
- package/dist/bun/types.d.ts.map +1 -0
- package/dist/bun/worker.d.ts +6 -0
- package/dist/bun/worker.d.ts.map +1 -0
- package/dist/node/agents-file.d.ts +59 -0
- package/dist/node/agents-file.d.ts.map +1 -0
- package/dist/node/config.d.ts +58 -0
- package/dist/node/config.d.ts.map +1 -0
- package/dist/node/curator.d.ts +35 -0
- package/dist/node/curator.d.ts.map +1 -0
- package/dist/node/db/driver.bun.d.ts +5 -0
- package/dist/node/db/driver.bun.d.ts.map +1 -0
- package/dist/node/db/driver.node.d.ts +15 -0
- package/dist/node/db/driver.node.d.ts.map +1 -0
- package/dist/node/db.d.ts +22 -0
- package/dist/node/db.d.ts.map +1 -0
- package/dist/node/distillation.d.ts +32 -0
- package/dist/node/distillation.d.ts.map +1 -0
- package/dist/node/embedding.d.ts +90 -0
- package/dist/node/embedding.d.ts.map +1 -0
- package/dist/node/gradient.d.ts +73 -0
- package/dist/node/gradient.d.ts.map +1 -0
- package/dist/node/index.d.ts +19 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +28253 -0
- package/dist/node/index.js.map +7 -0
- package/dist/node/lat-reader.d.ts +69 -0
- package/dist/node/lat-reader.d.ts.map +1 -0
- package/dist/node/log.d.ts +17 -0
- package/dist/node/log.d.ts.map +1 -0
- package/dist/node/ltm.d.ts +138 -0
- package/dist/node/ltm.d.ts.map +1 -0
- package/dist/node/markdown.d.ts +37 -0
- package/dist/node/markdown.d.ts.map +1 -0
- package/dist/node/prompt.d.ts +47 -0
- package/dist/node/prompt.d.ts.map +1 -0
- package/dist/node/recall.d.ts +41 -0
- package/dist/node/recall.d.ts.map +1 -0
- package/dist/node/search.d.ts +113 -0
- package/dist/node/search.d.ts.map +1 -0
- package/dist/node/temporal.d.ts +66 -0
- package/dist/node/temporal.d.ts.map +1 -0
- package/dist/node/types.d.ts +180 -0
- package/dist/node/types.d.ts.map +1 -0
- package/dist/node/worker.d.ts +6 -0
- package/dist/node/worker.d.ts.map +1 -0
- package/dist/types/agents-file.d.ts +59 -0
- package/dist/types/agents-file.d.ts.map +1 -0
- package/dist/types/config.d.ts +58 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/curator.d.ts +35 -0
- package/dist/types/curator.d.ts.map +1 -0
- package/dist/types/db/driver.bun.d.ts +5 -0
- package/dist/types/db/driver.bun.d.ts.map +1 -0
- package/dist/types/db/driver.node.d.ts +15 -0
- package/dist/types/db/driver.node.d.ts.map +1 -0
- package/dist/types/db.d.ts +22 -0
- package/dist/types/db.d.ts.map +1 -0
- package/dist/types/distillation.d.ts +32 -0
- package/dist/types/distillation.d.ts.map +1 -0
- package/dist/types/embedding.d.ts +90 -0
- package/dist/types/embedding.d.ts.map +1 -0
- package/dist/types/gradient.d.ts +73 -0
- package/dist/types/gradient.d.ts.map +1 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lat-reader.d.ts +69 -0
- package/dist/types/lat-reader.d.ts.map +1 -0
- package/dist/types/log.d.ts +17 -0
- package/dist/types/log.d.ts.map +1 -0
- package/dist/types/ltm.d.ts +138 -0
- package/dist/types/ltm.d.ts.map +1 -0
- package/dist/types/markdown.d.ts +37 -0
- package/dist/types/markdown.d.ts.map +1 -0
- package/dist/types/prompt.d.ts +47 -0
- package/dist/types/prompt.d.ts.map +1 -0
- package/dist/types/recall.d.ts +41 -0
- package/dist/types/recall.d.ts.map +1 -0
- package/dist/types/search.d.ts +113 -0
- package/dist/types/search.d.ts.map +1 -0
- package/dist/types/temporal.d.ts +66 -0
- package/dist/types/temporal.d.ts.map +1 -0
- package/dist/types/types.d.ts +180 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/worker.d.ts +6 -0
- package/dist/types/worker.d.ts.map +1 -0
- package/package.json +48 -5
- package/src/agents-file.ts +406 -0
- package/src/config.ts +132 -0
- package/src/curator.ts +220 -0
- package/src/db/driver.bun.ts +18 -0
- package/src/db/driver.node.ts +54 -0
- package/src/db.ts +433 -0
- package/src/distillation.ts +433 -0
- package/src/embedding.ts +528 -0
- package/src/gradient.ts +1387 -0
- package/src/index.ts +109 -0
- package/src/lat-reader.ts +374 -0
- package/src/log.ts +27 -0
- package/src/ltm.ts +861 -0
- package/src/markdown.ts +129 -0
- package/src/prompt.ts +454 -0
- package/src/recall.ts +446 -0
- package/src/search.ts +330 -0
- package/src/temporal.ts +379 -0
- package/src/types.ts +199 -0
- package/src/worker.ts +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BYK
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
# @loreai/core
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
> **Experimental** — Under active development. APIs, storage format, and behavior may change.
|
|
4
|
+
|
|
5
|
+
Shared memory engine for [Lore](https://github.com/BYK/loreai) — three-tier storage, distillation, curation, gradient context management, and FTS5-backed recall.
|
|
6
|
+
|
|
7
|
+
This package is host-agnostic. It doesn't ship a user-facing extension on its own; it's consumed by adapter packages that wire it into a specific coding agent:
|
|
8
|
+
|
|
9
|
+
- [`@loreai/opencode`](https://www.npmjs.com/package/@loreai/opencode) — [OpenCode](https://opencode.ai) plugin (also published as [`opencode-lore`](https://www.npmjs.com/package/opencode-lore) legacy alias)
|
|
10
|
+
- [`@loreai/pi`](https://www.npmjs.com/package/@loreai/pi) — [Pi coding-agent](https://github.com/badlogic/pi-mono) extension
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @loreai/core
|
|
16
|
+
# or
|
|
17
|
+
bun add @loreai/core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You only need to install this directly if you're building a new adapter. End users install one of the host packages above.
|
|
21
|
+
|
|
22
|
+
## Documentation
|
|
23
|
+
|
|
24
|
+
Full architecture, benchmarks, and rationale: **[github.com/BYK/loreai](https://github.com/BYK/loreai)**
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agents-file.ts — AGENTS.md export/import/sync for lore.
|
|
3
|
+
*
|
|
4
|
+
* Lore owns a clearly delimited section inside the file, bounded by HTML
|
|
5
|
+
* comment markers. Everything outside those markers is preserved verbatim.
|
|
6
|
+
* Each knowledge entry is preceded by a hidden <!-- lore:UUID --> comment so
|
|
7
|
+
* the same entry can be tracked across machines and merge conflicts resolved
|
|
8
|
+
* without duplication.
|
|
9
|
+
*/
|
|
10
|
+
export declare const LORE_SECTION_START = "<!-- This section is maintained by the coding agent via lore (https://github.com/BYK/loreai) -->";
|
|
11
|
+
export declare const LORE_SECTION_END = "<!-- End lore-managed section -->";
|
|
12
|
+
export type ParsedFileEntry = {
|
|
13
|
+
/** UUID from `<!-- lore:UUID -->` marker, or null for hand-written entries. */
|
|
14
|
+
id: string | null;
|
|
15
|
+
category: string;
|
|
16
|
+
title: string;
|
|
17
|
+
content: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Extract ParsedFileEntry objects from a markdown section body.
|
|
21
|
+
* Handles:
|
|
22
|
+
* - `<!-- lore:UUID -->` markers before bullet points → id set
|
|
23
|
+
* - Bare bullet points without markers → id null
|
|
24
|
+
* - Category derived from the nearest preceding `### Heading`
|
|
25
|
+
* - Malformed or non-UUID markers → id null (hand-written)
|
|
26
|
+
* - Duplicate UUIDs → both returned; caller deduplicates
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseEntriesFromSection(section: string): ParsedFileEntry[];
|
|
29
|
+
/**
|
|
30
|
+
* Write current knowledge entries into the AGENTS.md file, preserving all
|
|
31
|
+
* non-lore content. Creates the file if it doesn't exist.
|
|
32
|
+
*/
|
|
33
|
+
export declare function exportToFile(input: {
|
|
34
|
+
projectPath: string;
|
|
35
|
+
filePath: string;
|
|
36
|
+
}): void;
|
|
37
|
+
/**
|
|
38
|
+
* Returns true if the file needs to be imported:
|
|
39
|
+
* - File exists and has never been processed (no lore markers)
|
|
40
|
+
* - File exists and its lore section differs from what lore would currently produce
|
|
41
|
+
*/
|
|
42
|
+
export declare function shouldImport(input: {
|
|
43
|
+
projectPath: string;
|
|
44
|
+
filePath: string;
|
|
45
|
+
}): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Import knowledge entries from the agents file into the local DB.
|
|
48
|
+
*
|
|
49
|
+
* Behaviour per entry:
|
|
50
|
+
* - Known UUID (already in DB) → update content if it changed (manual edit)
|
|
51
|
+
* - Unknown UUID (other machine)→ create with that exact ID
|
|
52
|
+
* - No UUID (hand-written) → create with a new UUIDv7
|
|
53
|
+
* - Duplicate UUID in same file → first occurrence wins, rest ignored
|
|
54
|
+
*/
|
|
55
|
+
export declare function importFromFile(input: {
|
|
56
|
+
projectPath: string;
|
|
57
|
+
filePath: string;
|
|
58
|
+
}): void;
|
|
59
|
+
//# sourceMappingURL=agents-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-file.d.ts","sourceRoot":"","sources":["../../src/agents-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,eAAO,MAAM,kBAAkB,qGACqE,CAAC;AACrG,eAAO,MAAM,gBAAgB,sCAAsC,CAAC;AAyBpE,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;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAsBP;AAMD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAcV;AAMD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CA2DP"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const LoreConfig: z.ZodObject<{
|
|
3
|
+
model: z.ZodOptional<z.ZodObject<{
|
|
4
|
+
providerID: z.ZodString;
|
|
5
|
+
modelID: z.ZodString;
|
|
6
|
+
}, z.core.$strip>>;
|
|
7
|
+
budget: z.ZodDefault<z.ZodObject<{
|
|
8
|
+
distilled: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
raw: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
output: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
ltm: z.ZodDefault<z.ZodNumber>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
distillation: z.ZodDefault<z.ZodObject<{
|
|
14
|
+
minMessages: z.ZodDefault<z.ZodNumber>;
|
|
15
|
+
maxSegment: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
metaThreshold: z.ZodDefault<z.ZodNumber>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
knowledge: z.ZodDefault<z.ZodObject<{
|
|
19
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
curator: z.ZodDefault<z.ZodObject<{
|
|
22
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
+
onIdle: z.ZodDefault<z.ZodBoolean>;
|
|
24
|
+
afterTurns: z.ZodDefault<z.ZodNumber>;
|
|
25
|
+
maxEntries: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
pruning: z.ZodDefault<z.ZodObject<{
|
|
28
|
+
retention: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
maxStorage: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
search: z.ZodDefault<z.ZodObject<{
|
|
32
|
+
ftsWeights: z.ZodDefault<z.ZodObject<{
|
|
33
|
+
title: z.ZodDefault<z.ZodNumber>;
|
|
34
|
+
content: z.ZodDefault<z.ZodNumber>;
|
|
35
|
+
category: z.ZodDefault<z.ZodNumber>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
recallLimit: z.ZodDefault<z.ZodNumber>;
|
|
38
|
+
queryExpansion: z.ZodDefault<z.ZodBoolean>;
|
|
39
|
+
embeddings: z.ZodDefault<z.ZodObject<{
|
|
40
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
provider: z.ZodDefault<z.ZodEnum<{
|
|
42
|
+
voyage: "voyage";
|
|
43
|
+
openai: "openai";
|
|
44
|
+
}>>;
|
|
45
|
+
model: z.ZodDefault<z.ZodString>;
|
|
46
|
+
dimensions: z.ZodDefault<z.ZodNumber>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
crossProject: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
agentsFile: z.ZodDefault<z.ZodObject<{
|
|
51
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
path: z.ZodDefault<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type LoreConfig = z.infer<typeof LoreConfig>;
|
|
56
|
+
export declare function config(): LoreConfig;
|
|
57
|
+
export declare function load(directory: string): Promise<LoreConfig>;
|
|
58
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4GrB,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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LLMClient } from "./types";
|
|
2
|
+
export declare function run(input: {
|
|
3
|
+
llm: LLMClient;
|
|
4
|
+
projectPath: string;
|
|
5
|
+
sessionID: string;
|
|
6
|
+
model?: {
|
|
7
|
+
providerID: string;
|
|
8
|
+
modelID: string;
|
|
9
|
+
};
|
|
10
|
+
}): Promise<{
|
|
11
|
+
created: number;
|
|
12
|
+
updated: number;
|
|
13
|
+
deleted: number;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function resetCurationTracker(sessionID?: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Consolidation pass: reviews ALL project entries and merges/trims/deletes
|
|
18
|
+
* to reduce entry count to cfg.curator.maxEntries. Only runs when the current
|
|
19
|
+
* entry count exceeds the target. Uses the same worker session as curation.
|
|
20
|
+
*
|
|
21
|
+
* Only "update" and "delete" ops are applied — consolidation never creates entries.
|
|
22
|
+
*/
|
|
23
|
+
export declare function consolidate(input: {
|
|
24
|
+
llm: LLMClient;
|
|
25
|
+
projectPath: string;
|
|
26
|
+
sessionID: string;
|
|
27
|
+
model?: {
|
|
28
|
+
providerID: string;
|
|
29
|
+
modelID: string;
|
|
30
|
+
};
|
|
31
|
+
}): Promise<{
|
|
32
|
+
updated: number;
|
|
33
|
+
deleted: number;
|
|
34
|
+
}>;
|
|
35
|
+
//# sourceMappingURL=curator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curator.d.ts","sourceRoot":"","sources":["../../src/curator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AA+CzC,wBAAsB,GAAG,CAAC,KAAK,EAAE;IAC/B,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,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAsFjE;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,CAsDhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.bun.d.ts","sourceRoot":"","sources":["../../../src/db/driver.bun.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,4EAA4E;AAC5E,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DatabaseSync, type StatementSync } from "node:sqlite";
|
|
2
|
+
/**
|
|
3
|
+
* Drop-in replacement for `bun:sqlite`'s `Database`.
|
|
4
|
+
*
|
|
5
|
+
* Adds a `.query()` method that caches the underlying `StatementSync`
|
|
6
|
+
* per SQL string. All other methods (`.prepare()`, `.exec()`, `.run()`,
|
|
7
|
+
* `.close()`, PRAGMAs, transactions) come from `DatabaseSync` unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Database extends DatabaseSync {
|
|
10
|
+
/** Cached prepared statement for this SQL. Compiled on first call. */
|
|
11
|
+
query(sql: string): StatementSync;
|
|
12
|
+
}
|
|
13
|
+
/** Stable SHA-256 hex digest — replaces the Bun-only `Bun.CryptoHasher`. */
|
|
14
|
+
export declare function sha256(input: string): string;
|
|
15
|
+
//# sourceMappingURL=driver.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.node.d.ts","sourceRoot":"","sources":["../../../src/db/driver.node.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAgB/D;;;;;;GAMG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC,sEAAsE;IACtE,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa;CAalC;AAED,4EAA4E;AAC5E,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C"}
|
package/dist/bun/db.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Database } from "#db/driver";
|
|
2
|
+
export declare function db(): Database;
|
|
3
|
+
export declare function close(): void;
|
|
4
|
+
export declare function ensureProject(path: string, name?: string): string;
|
|
5
|
+
export declare function projectId(path: string): string | undefined;
|
|
6
|
+
/** Look up a project's display name by its internal ID. */
|
|
7
|
+
export declare function projectName(id: string): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if Lore has never been used before (no projects in the DB).
|
|
10
|
+
* Must be called before ensureProject() to get an accurate result.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isFirstRun(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Load persisted forceMinLayer for a session. Returns 0 if none stored.
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadForceMinLayer(sessionID: string): number;
|
|
17
|
+
/**
|
|
18
|
+
* Persist forceMinLayer for a session. Deletes the row when layer is 0
|
|
19
|
+
* (consumed) to avoid unbounded growth.
|
|
20
|
+
*/
|
|
21
|
+
export declare function saveForceMinLayer(sessionID: string, layer: number): void;
|
|
22
|
+
//# sourceMappingURL=db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAqStC,wBAAgB,EAAE,IAAI,QAAQ,CAwB7B;AAqCD,wBAAgB,KAAK,SAKpB;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAYjE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK1D;AAED,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKrD;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAKpC;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK3D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAYxE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { workerSessionIDs } from "./worker";
|
|
2
|
+
import type { LLMClient } from "./types";
|
|
3
|
+
export { workerSessionIDs };
|
|
4
|
+
/** Safely parse the source_ids JSON column. Defaults to [] on corrupt data. */
|
|
5
|
+
export declare function parseSourceIds(raw: string): string[];
|
|
6
|
+
export type Distillation = {
|
|
7
|
+
id: string;
|
|
8
|
+
project_id: string;
|
|
9
|
+
session_id: string;
|
|
10
|
+
observations: string;
|
|
11
|
+
source_ids: string[];
|
|
12
|
+
generation: number;
|
|
13
|
+
token_count: number;
|
|
14
|
+
created_at: number;
|
|
15
|
+
};
|
|
16
|
+
/** Load all distillations for a session, oldest first. */
|
|
17
|
+
export declare function loadForSession(projectPath: string, sessionID: string): Distillation[];
|
|
18
|
+
export declare function run(input: {
|
|
19
|
+
llm: LLMClient;
|
|
20
|
+
projectPath: string;
|
|
21
|
+
sessionID: string;
|
|
22
|
+
model?: {
|
|
23
|
+
providerID: string;
|
|
24
|
+
modelID: string;
|
|
25
|
+
};
|
|
26
|
+
/** Skip minMessages threshold check — distill whatever is pending */
|
|
27
|
+
force?: boolean;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
rounds: number;
|
|
30
|
+
distilled: number;
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=distillation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distillation.d.ts","sourceRoot":"","sources":["../../src/distillation.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAuE5B,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAQpD;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,0DAA0D;AAC1D,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,YAAY,EAAE,CAoBhB;AAuID,wBAAsB,GAAG,CAAC,KAAK,EAAE;IAC/B,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,qEAAqE;IACrE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CA4DjD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedding integration for vector search.
|
|
3
|
+
*
|
|
4
|
+
* Supports multiple embedding providers (Voyage AI, OpenAI) behind a common
|
|
5
|
+
* interface. Provides embedding generation, pure-JS cosine similarity, and
|
|
6
|
+
* vector search over the knowledge and distillation tables. All operations
|
|
7
|
+
* are gated behind `search.embeddings.enabled` config + the provider's API
|
|
8
|
+
* key env var — falls back silently to FTS-only when unavailable.
|
|
9
|
+
*/
|
|
10
|
+
export interface EmbeddingProvider {
|
|
11
|
+
embed(texts: string[], inputType: "document" | "query"): Promise<Float32Array[]>;
|
|
12
|
+
readonly maxBatchSize: number;
|
|
13
|
+
}
|
|
14
|
+
/** Reset cached provider — called when config changes. */
|
|
15
|
+
export declare function resetProvider(): void;
|
|
16
|
+
/** Returns true if embedding is available.
|
|
17
|
+
* Active when the configured provider's API key is set, unless explicitly
|
|
18
|
+
* disabled via `search.embeddings.enabled: false` in .lore.json. */
|
|
19
|
+
export declare function isAvailable(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Generate embeddings for the given texts using the configured provider.
|
|
22
|
+
*
|
|
23
|
+
* @param texts Array of texts to embed
|
|
24
|
+
* @param inputType "document" for storage, "query" for search
|
|
25
|
+
* @returns Float32Array per input text
|
|
26
|
+
* @throws On API errors or missing provider
|
|
27
|
+
*/
|
|
28
|
+
export declare function embed(texts: string[], inputType: "document" | "query"): Promise<Float32Array[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Cosine similarity between two Float32Array vectors.
|
|
31
|
+
* Returns -1.0 to 1.0 where 1.0 = identical direction.
|
|
32
|
+
* Returns 0 if either vector is zero-length.
|
|
33
|
+
*/
|
|
34
|
+
export declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
|
|
35
|
+
/** Convert Float32Array to Buffer for SQLite BLOB storage. */
|
|
36
|
+
export declare function toBlob(arr: Float32Array): Buffer;
|
|
37
|
+
/** Convert SQLite BLOB (Buffer/Uint8Array) back to Float32Array. */
|
|
38
|
+
export declare function fromBlob(blob: Buffer | Uint8Array): Float32Array;
|
|
39
|
+
type VectorHit = {
|
|
40
|
+
id: string;
|
|
41
|
+
similarity: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Search all knowledge entries with embeddings by cosine similarity.
|
|
45
|
+
* Returns top-k entries sorted by similarity descending.
|
|
46
|
+
* Pure brute-force — fine for <100 entries (microseconds).
|
|
47
|
+
*/
|
|
48
|
+
export declare function vectorSearch(queryEmbedding: Float32Array, limit?: number): VectorHit[];
|
|
49
|
+
/**
|
|
50
|
+
* Search non-archived distillations with embeddings by cosine similarity.
|
|
51
|
+
* Returns top-k entries sorted by similarity descending.
|
|
52
|
+
* Pure brute-force — fine for ~50 entries.
|
|
53
|
+
*/
|
|
54
|
+
export declare function vectorSearchDistillations(queryEmbedding: Float32Array, limit?: number): VectorHit[];
|
|
55
|
+
/**
|
|
56
|
+
* Embed a knowledge entry and store the result in the DB.
|
|
57
|
+
* Fire-and-forget — errors are logged, never thrown.
|
|
58
|
+
* The entry remains usable via FTS even if embedding fails.
|
|
59
|
+
*/
|
|
60
|
+
export declare function embedKnowledgeEntry(id: string, title: string, content: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Embed a distillation and store the result in the DB.
|
|
63
|
+
* Fire-and-forget — errors are logged, never thrown.
|
|
64
|
+
* The distillation remains searchable via FTS even if embedding fails.
|
|
65
|
+
*/
|
|
66
|
+
export declare function embedDistillation(id: string, observations: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Check if embedding config has changed since the last backfill.
|
|
69
|
+
* If so, clear all existing embeddings (they're incompatible) and
|
|
70
|
+
* update the stored fingerprint.
|
|
71
|
+
*
|
|
72
|
+
* Returns true if embeddings were cleared (full re-embed needed).
|
|
73
|
+
*/
|
|
74
|
+
export declare function checkConfigChange(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Embed all knowledge entries that are missing embeddings.
|
|
77
|
+
* Called on startup when embeddings are first enabled.
|
|
78
|
+
* Also handles config changes: if provider/model/dimensions changed, clears
|
|
79
|
+
* stale embeddings first, then re-embeds all entries.
|
|
80
|
+
* Returns the number of entries embedded.
|
|
81
|
+
*/
|
|
82
|
+
export declare function backfillEmbeddings(): Promise<number>;
|
|
83
|
+
/**
|
|
84
|
+
* Embed all non-archived distillations that are missing embeddings.
|
|
85
|
+
* Called on startup alongside knowledge backfill.
|
|
86
|
+
* Returns the number of distillations embedded.
|
|
87
|
+
*/
|
|
88
|
+
export declare function backfillDistillationEmbeddings(): Promise<number>;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=embedding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/embedding.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IACjF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAoKD,0DAA0D;AAC1D,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAMD;;qEAEqE;AACrE,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAMD;;;;;;;GAOG;AACH,wBAAsB,KAAK,CACzB,KAAK,EAAE,MAAM,EAAE,EACf,SAAS,EAAE,UAAU,GAAG,OAAO,GAC9B,OAAO,CAAC,YAAY,EAAE,CAAC,CAIzB;AAMD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,MAAM,CAazE;AAMD,8DAA8D;AAC9D,wBAAgB,MAAM,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAEhD;AAED,oEAAoE;AACpE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,CAGhE;AAMD,KAAK,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,cAAc,EAAE,YAAY,EAC5B,KAAK,SAAK,GACT,SAAS,EAAE,CAcb;AAMD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,cAAc,EAAE,YAAY,EAC5B,KAAK,SAAK,GACT,SAAS,EAAE,CAgBb;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACd,IAAI,CAWN;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,MAAM,GACnB,IAAI,CAUN;AAkBD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAoC3C;AAMD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAuC1D;AAMD;;;;GAIG;AACH,wBAAsB,8BAA8B,IAAI,OAAO,CAAC,MAAM,CAAC,CAsCtE"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { LoreMessageWithParts } from "./types";
|
|
2
|
+
type MessageWithParts = LoreMessageWithParts;
|
|
3
|
+
export declare function setModelLimits(limits: {
|
|
4
|
+
context: number;
|
|
5
|
+
output: number;
|
|
6
|
+
}): void;
|
|
7
|
+
/** Called by the system transform hook after formatting LTM knowledge. */
|
|
8
|
+
export declare function setLtmTokens(tokens: number): void;
|
|
9
|
+
/** Returns the current LTM token count (for tests and diagnostics). */
|
|
10
|
+
export declare function getLtmTokens(): number;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the token budget available for LTM system-prompt injection.
|
|
13
|
+
* This is the usable context (after output + overhead) multiplied by
|
|
14
|
+
* the configured ltm budget fraction. Call this from the system transform
|
|
15
|
+
* hook to cap how many tokens formatKnowledge may use.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getLtmBudget(ltmFraction: number): number;
|
|
18
|
+
export declare function calibrate(actualInput: number, sessionID?: string, messageCount?: number): void;
|
|
19
|
+
export declare function getOverhead(): number;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the number of messages in the most recent transform() output for
|
|
22
|
+
* the given session. Used by calibrate() to track the compressed window size.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getLastTransformedCount(sessionID: string): number;
|
|
25
|
+
/** Returns the token estimate from the most recent transform() output. */
|
|
26
|
+
export declare function getLastTransformEstimate(sessionID: string): number;
|
|
27
|
+
/** Returns the layer used by the most recent transform() call. For testing. */
|
|
28
|
+
export declare function getLastLayer(sessionID?: string): SafetyLayer;
|
|
29
|
+
/**
|
|
30
|
+
* Force the next transform() call for this session to use at least the given layer.
|
|
31
|
+
* Called when the API returns "prompt is too long" so the next attempt
|
|
32
|
+
* trims the context enough to fit within the model's context window.
|
|
33
|
+
*/
|
|
34
|
+
export declare function setForceMinLayer(layer: SafetyLayer, sessionID?: string): void;
|
|
35
|
+
export declare function resetCalibration(sessionID?: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Replace duplicate tool outputs with compact back-references, keeping only
|
|
38
|
+
* the latest occurrence of each unique output. Reduces context token usage
|
|
39
|
+
* without information loss — the model sees the most recent content intact.
|
|
40
|
+
*
|
|
41
|
+
* Deduplicates by:
|
|
42
|
+
* 1. Exact content hash: identical tool outputs (same file read twice, same command output)
|
|
43
|
+
* 2. Same-file reads: read_file outputs for the same path (content may differ due to edits)
|
|
44
|
+
*
|
|
45
|
+
* The current turn (from currentTurnIdx onward) is never touched — the model
|
|
46
|
+
* needs full context for its active work. Tool parts are never removed entirely;
|
|
47
|
+
* only state.output is replaced with a compact annotation.
|
|
48
|
+
*
|
|
49
|
+
* Returns the original array reference (not a copy) when no duplicates exist.
|
|
50
|
+
*/
|
|
51
|
+
export declare function deduplicateToolOutputs(messages: MessageWithParts[], currentTurnIdx: number): MessageWithParts[];
|
|
52
|
+
export declare function resetPrefixCache(sessionID?: string): void;
|
|
53
|
+
export declare function resetRawWindowCache(sessionID?: string): void;
|
|
54
|
+
export type SafetyLayer = 0 | 1 | 2 | 3 | 4;
|
|
55
|
+
export type TransformResult = {
|
|
56
|
+
messages: MessageWithParts[];
|
|
57
|
+
layer: SafetyLayer;
|
|
58
|
+
distilledTokens: number;
|
|
59
|
+
rawTokens: number;
|
|
60
|
+
totalTokens: number;
|
|
61
|
+
usable: number;
|
|
62
|
+
distilledBudget: number;
|
|
63
|
+
rawBudget: number;
|
|
64
|
+
};
|
|
65
|
+
export declare function needsUrgentDistillation(): boolean;
|
|
66
|
+
export declare function transform(input: {
|
|
67
|
+
messages: MessageWithParts[];
|
|
68
|
+
projectPath: string;
|
|
69
|
+
sessionID?: string;
|
|
70
|
+
}): TransformResult;
|
|
71
|
+
export declare function estimateMessages(messages: MessageWithParts[]): number;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=gradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/gradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,oBAAoB,EAAqE,MAAM,SAAS,CAAC;AAO9I,KAAK,gBAAgB,GAAG,oBAAoB,CAAC;AAmH7C,wBAAgB,cAAc,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,QASzE;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,QAE1C;AAED,uEAAuE;AACvE,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAIxD;AAWD,wBAAgB,SAAS,CACvB,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,QA2BtB;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAK5D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,QAWtE;AAGD,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,QAWlD;AA0ID;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,cAAc,EAAE,MAAM,GACrB,gBAAgB,EAAE,CA0EpB;AA4YD,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,QAOlD;AA0BD,wBAAgB,mBAAmB,CAAC,SAAS,CAAC,EAAE,MAAM,QAOrD;AAuFD,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAIF,wBAAgB,uBAAuB,IAAI,OAAO,CAIjD;AAiPD,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,eAAe,CAiBlB;AAGD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAErE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * as temporal from "./temporal";
|
|
2
|
+
export * as ltm from "./ltm";
|
|
3
|
+
export * as distillation from "./distillation";
|
|
4
|
+
export * as curator from "./curator";
|
|
5
|
+
export * as embedding from "./embedding";
|
|
6
|
+
export * as latReader from "./lat-reader";
|
|
7
|
+
export * as log from "./log";
|
|
8
|
+
export { runRecall, RECALL_TOOL_DESCRIPTION, RECALL_PARAM_DESCRIPTIONS, type RecallInput, type RecallResult, type RecallScope, type ScoredDistillation, } from "./recall";
|
|
9
|
+
export type { LoreMessage, LoreUserMessage, LoreAssistantMessage, LorePart, LoreTextPart, LoreReasoningPart, LoreToolPart, LoreGenericPart, LoreToolState, LoreToolStatePending, LoreToolStateRunning, LoreToolStateCompleted, LoreToolStateError, LoreMessageWithParts, LLMClient, } from "./types";
|
|
10
|
+
export { isTextPart, isReasoningPart, isToolPart } from "./types";
|
|
11
|
+
export { load, config, type LoreConfig } from "./config";
|
|
12
|
+
export { db, ensureProject, isFirstRun, projectId, projectName, loadForceMinLayer, saveForceMinLayer, close, } from "./db";
|
|
13
|
+
export { transform, setModelLimits, needsUrgentDistillation, calibrate, setLtmTokens, getLtmTokens, getLtmBudget, setForceMinLayer, getLastTransformedCount, getLastTransformEstimate, } from "./gradient";
|
|
14
|
+
export { formatKnowledge, formatDistillations, DISTILLATION_SYSTEM, distillationUser, RECURSIVE_SYSTEM, recursiveUser, CURATOR_SYSTEM, curatorUser, CONSOLIDATION_SYSTEM, consolidationUser, QUERY_EXPANSION_SYSTEM, } from "./prompt";
|
|
15
|
+
export { shouldImport, importFromFile, exportToFile } from "./agents-file";
|
|
16
|
+
export { workerSessionIDs, isWorkerSession } from "./worker";
|
|
17
|
+
export { ftsQuery, ftsQueryOr, EMPTY_QUERY, reciprocalRankFusion, expandQuery, extractTopTerms, } from "./search";
|
|
18
|
+
export { serialize, inline, h, p, ul, lip, liph, t, root, strong, normalize, sanitizeSurrogates, unescapeMarkdown, } from "./markdown";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAE7B,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,kBAAkB,GACxB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EACL,EAAE,EACF,aAAa,EACb,UAAU,EACV,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,GACN,MAAM,MAAM,CAAC;AACd,OAAO,EACL,SAAS,EACT,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,eAAe,GAChB,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,GACjB,MAAM,YAAY,CAAC"}
|