@loreai/core 0.17.1 → 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
package/dist/node/embedding.d.ts
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Embedding integration for vector search.
|
|
3
3
|
*
|
|
4
|
-
* Supports multiple embedding providers
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Supports multiple embedding providers behind a common interface:
|
|
5
|
+
* - "local" (default): @huggingface/transformers + nomic-embed-text-v1.5
|
|
6
|
+
* (768 dims, Matryoshka-capable). Runs ONNX inference in a worker thread.
|
|
7
|
+
* - "voyage": Voyage AI API (voyage-code-3, 1024 dims)
|
|
8
|
+
* - "openai": OpenAI API (text-embedding-3-small, 1536 dims)
|
|
9
|
+
*
|
|
10
|
+
* Provides embedding generation, pure-JS cosine similarity, and vector search
|
|
11
|
+
* over the knowledge and distillation tables. All operations are gated behind
|
|
12
|
+
* `search.embeddings.enabled` config + the provider's API key env var — falls
|
|
13
|
+
* back silently to FTS-only when unavailable.
|
|
9
14
|
*/
|
|
10
15
|
export interface EmbeddingProvider {
|
|
11
16
|
embed(texts: string[], inputType: "document" | "query"): Promise<Float32Array[]>;
|
|
12
17
|
readonly maxBatchSize: number;
|
|
13
18
|
}
|
|
14
19
|
/**
|
|
15
|
-
* Thrown when `LocalProvider`
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* the package install still succeeds but local embeddings are disabled.
|
|
19
|
-
* Callers in `recall.ts` / `ltm.ts` / `distillation.ts` already gate on
|
|
20
|
-
* `isAvailable()`, which flips to `false` after this error fires once.
|
|
20
|
+
* Thrown when `LocalProvider` cannot initialize (e.g. ONNX runtime fails
|
|
21
|
+
* to load). Callers in `recall.ts` / `ltm.ts` / `distillation.ts` gate
|
|
22
|
+
* on `isAvailable()`, which flips to `false` after this error fires once.
|
|
21
23
|
*/
|
|
22
24
|
export declare class LocalProviderUnavailableError extends Error {
|
|
23
25
|
constructor(cause?: unknown);
|
|
24
26
|
}
|
|
25
|
-
/** For tests: reset the
|
|
26
|
-
export declare function
|
|
27
|
-
/** For tests: simulate
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
export declare function
|
|
27
|
+
/** For tests: reset the local provider probe state. */
|
|
28
|
+
export declare function _resetLocalProviderProbe(): void;
|
|
29
|
+
/** For tests: simulate the local provider being unavailable, without
|
|
30
|
+
* actually spawning a worker. After this call, `isAvailable()` returns
|
|
31
|
+
* false for the local provider. */
|
|
32
|
+
export declare function _markLocalProviderUnavailable(): void;
|
|
31
33
|
/** Reset cached provider — called when config changes.
|
|
32
34
|
* Shuts down the worker thread if the current provider is a LocalProvider.
|
|
33
35
|
* Returns a promise that resolves once any worker has fully exited.
|
|
@@ -50,7 +52,7 @@ export declare function _saveAndClearProvider(): unknown;
|
|
|
50
52
|
/** Restore a provider previously saved by `_saveAndClearProvider()`. Any
|
|
51
53
|
* provider created between save and restore is discarded (callers must
|
|
52
54
|
* ensure it's not a LocalProvider with a live worker — those suites only
|
|
53
|
-
* use `
|
|
55
|
+
* use `_markLocalProviderUnavailable()` so no worker is spawned). */
|
|
54
56
|
export declare function _restoreProvider(token: unknown): void;
|
|
55
57
|
/**
|
|
56
58
|
* Build a remote `EmbeddingProvider` from whichever API key is in env.
|
|
@@ -69,14 +71,14 @@ export declare function pickRemoteFallback(): {
|
|
|
69
71
|
* Active when the configured provider's API key is set, unless explicitly
|
|
70
72
|
* disabled via `search.embeddings.enabled: false` in .lore.json.
|
|
71
73
|
*
|
|
72
|
-
* For the `local` provider, also returns false once
|
|
73
|
-
*
|
|
74
|
-
*
|
|
74
|
+
* For the `local` provider, also returns false once the worker has reported
|
|
75
|
+
* an init failure — callers (recall, ltm, distillation) use this gate to
|
|
76
|
+
* skip embedding work and fall back to FTS-only search. */
|
|
75
77
|
export declare function isAvailable(): boolean;
|
|
76
78
|
/**
|
|
77
79
|
* Generate embeddings for the given texts using the configured provider.
|
|
78
80
|
*
|
|
79
|
-
* If the configured provider is `local` and
|
|
81
|
+
* If the configured provider is `local` and the local provider turns out to be
|
|
80
82
|
* unavailable at runtime (failed install, vendor extraction blocked, etc.),
|
|
81
83
|
* automatically swap to a remote provider when `VOYAGE_API_KEY` or
|
|
82
84
|
* `OPENAI_API_KEY` is set in env. The swap is permanent for the rest of
|
|
@@ -116,6 +118,12 @@ export declare function vectorSearch(queryEmbedding: Float32Array, limit?: numbe
|
|
|
116
118
|
* Pure brute-force — fine for ~50 entries.
|
|
117
119
|
*/
|
|
118
120
|
export declare function vectorSearchDistillations(queryEmbedding: Float32Array, limit?: number): VectorHit[];
|
|
121
|
+
export type DistillationVectorHit = {
|
|
122
|
+
id: string;
|
|
123
|
+
session_id: string;
|
|
124
|
+
similarity: number;
|
|
125
|
+
};
|
|
126
|
+
export declare function vectorSearchAllDistillations(queryEmbedding: Float32Array, projectId: string, limit?: number): DistillationVectorHit[];
|
|
119
127
|
/**
|
|
120
128
|
* Embed a knowledge entry and store the result in the DB.
|
|
121
129
|
* Fire-and-forget — errors are logged, never thrown.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/embedding.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/embedding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAqBH,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;AAgHD;;;;GAIG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,KAAK,CAAC,EAAE,OAAO;CAS5B;AAQD,uDAAuD;AACvD,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C;AAED;;oCAEoC;AACpC,wBAAgB,6BAA6B,IAAI,IAAI,CAGpD;AAiUD;;;wEAGwE;AACxE,wBAAgB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ7C;AAED;;;uDAGuD;AACvD,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQnD;AAED;;;;;;;gDAOgD;AAChD,wBAAgB,qBAAqB,IAAI,OAAO,CAK/C;AAED;;;sEAGsE;AACtE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAIrD;AAOD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI;IACpC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,GAAG,IAAI,CAgBP;AAMD;;;;;;4DAM4D;AAC5D,wBAAgB,WAAW,IAAI,OAAO,CAKrC;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,KAAK,CACzB,KAAK,EAAE,MAAM,EAAE,EACf,SAAS,EAAE,UAAU,GAAG,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ACH,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,YAAY,EAC5B,SAAS,EAAE,MAAM,EACjB,KAAK,SAAK,EACV,SAAS,CAAC,EAAE,MAAM,GACjB,SAAS,EAAE,CAmBb;AAkBD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAwC3C;AAgBD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAsExD;AAsDD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CA4C1D;AAMD;;;;GAIG;AACH,wBAAsB,8BAA8B,IAAI,OAAO,CAAC,MAAM,CAAC,CAsDtE"}
|
package/dist/node/gradient.d.ts
CHANGED
|
@@ -54,8 +54,15 @@ type DistillationSnapshot = {
|
|
|
54
54
|
*
|
|
55
55
|
* Set `thresholdMs <= 0` to disable. Returns true if a reset fired so the
|
|
56
56
|
* caller can log/observe.
|
|
57
|
+
*
|
|
58
|
+
* @param skipCompact When true, perform all idle-resume housekeeping
|
|
59
|
+
* (clear caches, set cameOutOfIdle) but do NOT set postIdleCompact.
|
|
60
|
+
* Used when the caller knows the upstream prompt cache is still warm
|
|
61
|
+
* (e.g. cache warmer recently refreshed it) — compacting would produce
|
|
62
|
+
* a different prompt body that doesn't match the warmed prefix, causing
|
|
63
|
+
* a cache bust and wasting the warming cost.
|
|
57
64
|
*/
|
|
58
|
-
export declare function onIdleResume(sessionID: string, thresholdMs: number, now?: number): {
|
|
65
|
+
export declare function onIdleResume(sessionID: string, thresholdMs: number, now?: number, skipCompact?: boolean): {
|
|
59
66
|
triggered: false;
|
|
60
67
|
} | {
|
|
61
68
|
triggered: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/gradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,oBAAoB,EAAqE,MAAM,SAAS,CAAC;AAQ9I,K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— scans all registered providers for conversation
|
|
3
|
+
* history matching a given project path.
|
|
4
|
+
*/
|
|
5
|
+
import type { DetectionResult } from "./types";
|
|
6
|
+
/**
|
|
7
|
+
* Scan all registered providers for conversation history matching the
|
|
8
|
+
* given project path.
|
|
9
|
+
*
|
|
10
|
+
* @returns Results from all providers that found data, sorted by
|
|
11
|
+
* total messages descending (richest source first).
|
|
12
|
+
*/
|
|
13
|
+
export declare function detectAll(projectPath: string): DetectionResult[];
|
|
14
|
+
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../src/import/detect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,EAAE,CAsBhE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { LLMClient } from "../types";
|
|
2
|
+
import type { ConversationChunk } from "./types";
|
|
3
|
+
export type ExtractionProgress = {
|
|
4
|
+
/** Current chunk being processed (1-based) */
|
|
5
|
+
current: number;
|
|
6
|
+
/** Total chunks to process */
|
|
7
|
+
total: number;
|
|
8
|
+
/** Knowledge entries created so far */
|
|
9
|
+
created: number;
|
|
10
|
+
/** Knowledge entries updated (dedup hit) so far */
|
|
11
|
+
updated: number;
|
|
12
|
+
};
|
|
13
|
+
export type ExtractionResult = {
|
|
14
|
+
/** Total knowledge entries created */
|
|
15
|
+
created: number;
|
|
16
|
+
/** Total entries that hit dedup (updated existing) */
|
|
17
|
+
updated: number;
|
|
18
|
+
/** Total entries deleted */
|
|
19
|
+
deleted: number;
|
|
20
|
+
/** Chunks processed successfully */
|
|
21
|
+
chunksProcessed: number;
|
|
22
|
+
/** Chunks that failed (LLM error) */
|
|
23
|
+
chunksFailed: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Extract knowledge entries from conversation chunks via the curator LLM.
|
|
27
|
+
*
|
|
28
|
+
* Processes chunks sequentially (not parallel) to avoid rate limits
|
|
29
|
+
* and to let later chunks see entries created by earlier chunks
|
|
30
|
+
* (better dedup via the existing entries list in the prompt).
|
|
31
|
+
*/
|
|
32
|
+
export declare function extractKnowledge(input: {
|
|
33
|
+
llm: LLMClient;
|
|
34
|
+
projectPath: string;
|
|
35
|
+
chunks: ConversationChunk[];
|
|
36
|
+
sessionID?: string;
|
|
37
|
+
model?: {
|
|
38
|
+
providerID: string;
|
|
39
|
+
modelID: string;
|
|
40
|
+
};
|
|
41
|
+
onProgress?: (progress: ExtractionProgress) => void;
|
|
42
|
+
}): Promise<ExtractionResult>;
|
|
43
|
+
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../src/import/extract.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAoBjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE;IAC5C,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACrD,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAmE5B"}
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/import/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,eAAe,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,cAAc,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,gBAAgB,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;;;OAKG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,EAAE,CAAC;IAE/C;;;;;;;;OAQG;IACH,UAAU,CACR,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,iBAAiB,EAAE,CAAC;CACxB"}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -7,12 +7,15 @@ 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, getMeta, setMeta, getInstanceId, close, } from "./db";
|
|
16
19
|
export { normalizeRemoteUrl, getGitRemote, clearGitRemoteCache } from "./git";
|
|
17
20
|
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";
|
|
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";
|
package/dist/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAA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