@theokit/sdk-memory 0.3.1 → 0.3.2
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/CHANGELOG.md +87 -0
- package/LICENSE +2 -2
- package/README.md +42 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/active-memory/active-memory-cache.d.ts +18 -0
- package/dist/internal/active-memory/active-memory-cache.d.ts.map +1 -1
- package/dist/internal/active-memory/active-memory-types.d.ts +25 -0
- package/dist/internal/active-memory/active-memory-types.d.ts.map +1 -1
- package/dist/internal/active-memory/active-memory.d.ts +54 -29
- package/dist/internal/active-memory/active-memory.d.ts.map +1 -1
- package/dist/internal/adapter-http-error.d.ts +18 -0
- package/dist/internal/adapter-http-error.d.ts.map +1 -1
- package/dist/internal/circuit-breaker.d.ts +17 -0
- package/dist/internal/circuit-breaker.d.ts.map +1 -1
- package/dist/internal/dreaming/dreaming-diary.d.ts +27 -0
- package/dist/internal/dreaming/dreaming-diary.d.ts.map +1 -1
- package/dist/internal/dreaming/dreaming-phases.d.ts +11 -0
- package/dist/internal/dreaming/dreaming-phases.d.ts.map +1 -1
- package/dist/internal/dreaming/dreaming-run.d.ts +34 -2
- package/dist/internal/dreaming/dreaming-run.d.ts.map +1 -1
- package/dist/internal/embedding/azure-openai-embedding.d.ts +22 -0
- package/dist/internal/embedding/azure-openai-embedding.d.ts.map +1 -1
- package/dist/internal/embedding/cohere-embedding.d.ts +18 -2
- package/dist/internal/embedding/cohere-embedding.d.ts.map +1 -1
- package/dist/internal/embedding/deepinfra-embedding.d.ts +13 -0
- package/dist/internal/embedding/deepinfra-embedding.d.ts.map +1 -1
- package/dist/internal/embedding/embedding-adapter.d.ts +36 -2
- package/dist/internal/embedding/embedding-adapter.d.ts.map +1 -1
- package/dist/internal/embedding/gemini-embedding.d.ts +9 -0
- package/dist/internal/embedding/gemini-embedding.d.ts.map +1 -1
- package/dist/internal/embedding/jina-embedding.d.ts +9 -0
- package/dist/internal/embedding/jina-embedding.d.ts.map +1 -1
- package/dist/internal/embedding/mistral-embedding.d.ts +8 -0
- package/dist/internal/embedding/mistral-embedding.d.ts.map +1 -1
- package/dist/internal/embedding/ollama-embedding.d.ts +21 -0
- package/dist/internal/embedding/ollama-embedding.d.ts.map +1 -1
- package/dist/internal/embedding/openai-embedding.d.ts +19 -12
- package/dist/internal/embedding/openai-embedding.d.ts.map +1 -1
- package/dist/internal/embedding/openrouter-embedding.d.ts +12 -0
- package/dist/internal/embedding/openrouter-embedding.d.ts.map +1 -1
- package/dist/internal/embedding/voyage-embedding.d.ts +9 -0
- package/dist/internal/embedding/voyage-embedding.d.ts.map +1 -1
- package/dist/internal/index/index-db.d.ts +25 -0
- package/dist/internal/index/index-db.d.ts.map +1 -1
- package/dist/internal/index/index-manager-contract.d.ts +28 -0
- package/dist/internal/index/index-manager-contract.d.ts.map +1 -1
- package/dist/internal/index/index-manager.d.ts +29 -0
- package/dist/internal/index/index-manager.d.ts.map +1 -1
- package/dist/internal/index/lance-index.d.ts +25 -0
- package/dist/internal/index/lance-index.d.ts.map +1 -1
- package/dist/internal/index/lance-memory-adapter.d.ts +27 -5
- package/dist/internal/index/lance-memory-adapter.d.ts.map +1 -1
- package/dist/internal/index/memory-index.d.ts +17 -2
- package/dist/internal/index/memory-index.d.ts.map +1 -1
- package/dist/internal/index/migrate-sqlite-to-lance.d.ts +12 -0
- package/dist/internal/index/migrate-sqlite-to-lance.d.ts.map +1 -1
- package/dist/internal/index/migration.d.ts +26 -0
- package/dist/internal/index/migration.d.ts.map +1 -1
- package/dist/internal/index/vec-index.d.ts +67 -16
- package/dist/internal/index/vec-index.d.ts.map +1 -1
- package/dist/internal/memory-types.d.ts +17 -1
- package/dist/internal/memory-types.d.ts.map +1 -1
- package/dist/internal/store/chunk-markdown.d.ts +17 -0
- package/dist/internal/store/chunk-markdown.d.ts.map +1 -1
- package/dist/internal/store/markdown-store.d.ts +26 -0
- package/dist/internal/store/markdown-store.d.ts.map +1 -1
- package/dist/internal/store/reader.d.ts +26 -3
- package/dist/internal/store/reader.d.ts.map +1 -1
- package/dist/internal/store/session-loader.d.ts +5 -0
- package/dist/internal/store/session-loader.d.ts.map +1 -1
- package/dist/internal/store/session-summary-writer.d.ts +14 -0
- package/dist/internal/store/session-summary-writer.d.ts.map +1 -1
- package/dist/internal/store/transcript-store.d.ts +12 -0
- package/dist/internal/store/transcript-store.d.ts.map +1 -1
- package/dist/internal/store/wiki-loader.d.ts +11 -0
- package/dist/internal/store/wiki-loader.d.ts.map +1 -1
- package/dist/internal/tools.d.ts +38 -0
- package/dist/internal/tools.d.ts.map +1 -1
- package/package.json +7 -6
- package/dist/internal/active-memory/composite-scorer.d.ts +0 -19
- package/dist/internal/active-memory/composite-scorer.d.ts.map +0 -1
- package/dist/internal/active-memory/query-analyzer.d.ts +0 -16
- package/dist/internal/active-memory/query-analyzer.d.ts.map +0 -1
- package/dist/internal/embedding/batch-encoder.d.ts +0 -30
- package/dist/internal/embedding/batch-encoder.d.ts.map +0 -1
- package/dist/internal/memory-scope.d.ts +0 -21
- package/dist/internal/memory-scope.d.ts.map +0 -1
|
@@ -33,44 +33,95 @@ interface MemoryDb {
|
|
|
33
33
|
loadExtension(path: string): void;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* Embeddings live in `embeddings(chunk_id, vec)` — a `vec0` virtual table
|
|
39
|
-
* provided by the sqlite-vec extension. Embedding identity (providerId +
|
|
40
|
-
* model + dimension) lives in the `meta` table; mismatches force a full
|
|
41
|
-
* re-embed sweep (EC-1).
|
|
42
|
-
*
|
|
43
|
-
* Iter 67 (Stage 3 source-move #24): hybrid copy from sdk-core's
|
|
44
|
-
* `internal/memory/vec-index.ts`. sdk-core retains its copy for v1.x
|
|
45
|
-
* sqlite-vec back-compat; sdk-memory ships the canonical copy that
|
|
46
|
-
* future `index-manager.ts` move will compose with as a sibling.
|
|
47
|
-
* Dependency chain (both sibling, both moved):
|
|
48
|
-
* - `EmbeddingRuntime` from `./embedding-adapter.js` (moved iter 45)
|
|
49
|
-
* - `MemoryDb` from `./index-db.js` (moved iter 65)
|
|
50
|
-
*
|
|
51
|
-
* @internal
|
|
36
|
+
* `meta` table key holding the id of the embedding provider that produced the
|
|
37
|
+
* vectors currently on disk (for example `openai`, `ollama`).
|
|
52
38
|
*/
|
|
53
39
|
export declare const META_KEY_PROVIDER_ID = "embedding.providerId";
|
|
40
|
+
/** `meta` table key holding the embedding model id the vectors were produced with. */
|
|
54
41
|
export declare const META_KEY_MODEL = "embedding.model";
|
|
42
|
+
/** `meta` table key holding the vector width the `embeddings` vec0 table was created with. */
|
|
55
43
|
export declare const META_KEY_DIMENSION = "embedding.dimension";
|
|
44
|
+
/**
|
|
45
|
+
* The three facts that decide whether the vectors already stored are still
|
|
46
|
+
* usable: who produced them, with which model, at which width. A change in any
|
|
47
|
+
* of the three invalidates every vector in the index, because embeddings from
|
|
48
|
+
* different models are not comparable and a different width will not even fit
|
|
49
|
+
* the vec0 table.
|
|
50
|
+
*/
|
|
56
51
|
export interface EmbeddingIdentity {
|
|
57
52
|
providerId: string;
|
|
58
53
|
model: string;
|
|
59
54
|
dimension: number;
|
|
60
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Read the embedding identity recorded in the `meta` table.
|
|
58
|
+
*
|
|
59
|
+
* Returns `undefined` when the index has never been embedded, and also when the
|
|
60
|
+
* record is incomplete or unusable: any of the three keys missing, or a stored
|
|
61
|
+
* dimension that is not a finite number greater than zero. Callers treat that as
|
|
62
|
+
* "no identity" and write a fresh one rather than trying to repair it.
|
|
63
|
+
*/
|
|
61
64
|
export declare function readEmbeddingIdentity(db: MemoryDb): EmbeddingIdentity | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Record the embedding identity in the `meta` table, upserting each of the three
|
|
67
|
+
* keys. Call this after {@link createVectorIndex}, so that a later open can tell
|
|
68
|
+
* whether the vectors on disk match the runtime it has been handed.
|
|
69
|
+
*/
|
|
62
70
|
export declare function writeEmbeddingIdentity(db: MemoryDb, identity: EmbeddingIdentity): void;
|
|
71
|
+
/**
|
|
72
|
+
* Compare two embedding identities field by field. All three fields must be
|
|
73
|
+
* equal; there is no tolerance on dimension, because a mismatch there is a hard
|
|
74
|
+
* failure at the vec0 table rather than a quality regression.
|
|
75
|
+
*/
|
|
63
76
|
export declare function identityMatches(a: EmbeddingIdentity, b: EmbeddingIdentity): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Drop the `embeddings` table, discarding every stored vector. `IndexManager`
|
|
79
|
+
* calls this when {@link identityMatches} reports that the persisted identity
|
|
80
|
+
* differs from the embedding runtime it was opened with; the next `sync()` then
|
|
81
|
+
* re-embeds the whole corpus. The `chunks` and `files` tables are untouched, so
|
|
82
|
+
* the text index survives the drop.
|
|
83
|
+
*/
|
|
64
84
|
export declare function dropVectorIndex(db: MemoryDb): void;
|
|
85
|
+
/**
|
|
86
|
+
* Create the `embeddings` vec0 virtual table at the given vector width, if it
|
|
87
|
+
* does not exist already. Requires the sqlite-vec extension to be loaded into
|
|
88
|
+
* `db` first (see `loadSqliteVecExtension`) — without it SQLite has no `vec0`
|
|
89
|
+
* module and the statement fails.
|
|
90
|
+
*
|
|
91
|
+
* `IF NOT EXISTS` means this will NOT widen an existing table: to change the
|
|
92
|
+
* dimension, call {@link dropVectorIndex} first.
|
|
93
|
+
*/
|
|
65
94
|
export declare function createVectorIndex(db: MemoryDb, dimension: number): void;
|
|
66
95
|
/** Pack a Float32Array into a Buffer suitable for sqlite-vec BLOB binding. */
|
|
67
96
|
export declare function packVector(vec: ReadonlyArray<number>): Buffer;
|
|
97
|
+
/**
|
|
98
|
+
* Store the vector for one chunk, replacing any vector already held for it.
|
|
99
|
+
*
|
|
100
|
+
* Implemented as DELETE followed by INSERT because vec0 virtual tables do not
|
|
101
|
+
* support `ON CONFLICT`. The chunk id is bound as a BigInt: vec0 v0.1.9 rejects
|
|
102
|
+
* a JavaScript number for its primary-key column.
|
|
103
|
+
*/
|
|
68
104
|
export declare function upsertEmbedding(db: MemoryDb, chunkId: number, vec: ReadonlyArray<number>): void;
|
|
105
|
+
/**
|
|
106
|
+
* One row of a vec0 KNN result: the chunk id and its raw distance from the query
|
|
107
|
+
* vector. Distance is the sqlite-vec convention — lower is closer — and is NOT a
|
|
108
|
+
* similarity score. `IndexManager` maps it to `1 / (1 + distance)` before
|
|
109
|
+
* blending it with the text score.
|
|
110
|
+
*/
|
|
69
111
|
export interface VectorHitRow {
|
|
70
112
|
chunk_id: number;
|
|
71
113
|
distance: number;
|
|
72
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Run a k-nearest-neighbour query against the `embeddings` table and return the
|
|
117
|
+
* matches ordered by ascending distance (closest first).
|
|
118
|
+
*
|
|
119
|
+
* `query` must have the same width the table was created with. Both the query
|
|
120
|
+
* vector and `k` are bound in the form vec0 expects — the vector as a packed
|
|
121
|
+
* Float32 blob, `k` as a BigInt.
|
|
122
|
+
*/
|
|
73
123
|
export declare function vectorSearch(db: MemoryDb, query: ReadonlyArray<number>, k: number): VectorHitRow[];
|
|
124
|
+
/** Inputs for {@link embedMissingChunks}: the open database and the embedding runtime to call. */
|
|
74
125
|
export interface EmbedAllArgs {
|
|
75
126
|
db: MemoryDb;
|
|
76
127
|
runtime: EmbeddingRuntime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vec-index.d.ts","sourceRoot":"","sources":["../../../src/internal/index/vec-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;;;;;;;;;;;;GAgBG;AACH,UAAU,QAAQ;IAChB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG;QACpB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;QAC/E,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;QAC7D,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KACzD,CAAC;IACF,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC;IACnE,KAAK,IAAI,IAAI,CAAC;IACd,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;
|
|
1
|
+
{"version":3,"file":"vec-index.d.ts","sourceRoot":"","sources":["../../../src/internal/index/vec-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;;;;;;;;;;;;GAgBG;AACH,UAAU,QAAQ;IAChB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG;QACpB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;QAC/E,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;QAC7D,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KACzD,CAAC;IACF,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC;IACnE,KAAK,IAAI,IAAI,CAAC;IACd,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAiBD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAC3D,sFAAsF;AACtF,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAChD,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,iBAAiB,GAAG,SAAS,CAYjF;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAOtF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAEnF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAElD;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAKvE;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAI7D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,CAO/F;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAC5B,CAAC,EAAE,MAAM,GACR,YAAY,EAAE,CAWhB;AAED,kGAAkG;AAClG,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,QAAQ,CAAC;IACb,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,wDAAwD;AACxD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB5E"}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-agent memory configuration. `enabled` gates the configuration-aware
|
|
3
|
+
* accessors (`readFacts`, `appendFact`) — with it `false` they resolve without
|
|
4
|
+
* touching disk, while the lower-level markdown functions ignore it.
|
|
5
|
+
*
|
|
6
|
+
* `namespace`, `scope` and `userId` are only consulted for the legacy JSON path
|
|
7
|
+
* (see {@link legacyMemoryJsonPath}); the markdown store keeps one `MEMORY.md`
|
|
8
|
+
* per workspace and does not partition by them. They are treated as
|
|
9
|
+
* user-supplied and sanitised before they reach a path. `storePath` is treated
|
|
10
|
+
* as trusted and resolved as given.
|
|
11
|
+
*/
|
|
1
12
|
export interface MemoryConfig {
|
|
2
13
|
enabled: boolean;
|
|
3
14
|
namespace?: string;
|
|
@@ -5,6 +16,11 @@ export interface MemoryConfig {
|
|
|
5
16
|
scope?: "agent" | "user" | "team";
|
|
6
17
|
storePath?: string;
|
|
7
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* One remembered statement. `text` is what gets written, embedded and searched;
|
|
21
|
+
* it passes through secret redaction on the way to disk, so what is stored may
|
|
22
|
+
* differ from what was passed in.
|
|
23
|
+
*/
|
|
8
24
|
export interface MemoryFact {
|
|
9
25
|
text: string;
|
|
10
26
|
/**
|
|
@@ -73,7 +89,7 @@ export interface MemoryReadResult {
|
|
|
73
89
|
linesReturned: number;
|
|
74
90
|
/** Total lines in the file (after the read). */
|
|
75
91
|
totalLines: number;
|
|
76
|
-
/** True when
|
|
92
|
+
/** True when content remains after the returned slice, i.e. `remainingLines > 0`. */
|
|
77
93
|
truncated: boolean;
|
|
78
94
|
/** Lines past the returned slice that remain in the file. */
|
|
79
95
|
remainingLines: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-types.d.ts","sourceRoot":"","sources":["../../src/internal/memory-types.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAElF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAY9E;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"memory-types.d.ts","sourceRoot":"","sources":["../../src/internal/memory-types.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAElF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAY9E;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,SAAS,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -61,6 +61,23 @@ export interface ChunkMarkdownOptions {
|
|
|
61
61
|
/** Minimum chars per chunk (avoids splintering tiny lines). Default 80. */
|
|
62
62
|
minChars?: number;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Split markdown into the chunks that get embedded and searched.
|
|
66
|
+
*
|
|
67
|
+
* Boundaries are structural rather than fixed-width: a chunk ends at the next
|
|
68
|
+
* heading, or at a blank line. Each chunk carries the nearest preceding heading,
|
|
69
|
+
* so a hit can be cited with the section it came from. A run of text longer than
|
|
70
|
+
* `maxChars` is then cut at the last whitespace within 200 characters of the
|
|
71
|
+
* limit, falling back to a hard cut when a single token is longer than that.
|
|
72
|
+
*
|
|
73
|
+
* Returns `[]` for empty input. `minChars` on the options is currently not read
|
|
74
|
+
* — small paragraphs are emitted as their own chunks regardless.
|
|
75
|
+
*
|
|
76
|
+
* Line numbers are 1-indexed and inclusive at both ends. They are exact for
|
|
77
|
+
* normal chunks; for a paragraph that had to be split by length, the numbers are
|
|
78
|
+
* derived from newline counts within the slice and mark the span the slice came
|
|
79
|
+
* from rather than a precise per-slice range.
|
|
80
|
+
*/
|
|
64
81
|
export declare function chunkMarkdown(text: string, options?: ChunkMarkdownOptions): MemoryChunk[];
|
|
65
82
|
export {};
|
|
66
83
|
//# sourceMappingURL=chunk-markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk-markdown.d.ts","sourceRoot":"","sources":["../../../src/internal/store/chunk-markdown.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,UAAU,WAAW;IACnB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAWD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,WAAW,EAAE,CAY7F"}
|
|
1
|
+
{"version":3,"file":"chunk-markdown.d.ts","sourceRoot":"","sources":["../../../src/internal/store/chunk-markdown.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,UAAU,WAAW;IACnB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAWD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,WAAW,EAAE,CAY7F"}
|
|
@@ -1,17 +1,43 @@
|
|
|
1
1
|
import { type MemoryConfig, type MemoryFact } from "../memory-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The memory root for a workspace: `<cwd>/.theokit/memory`. Every other path in
|
|
4
|
+
* this package is derived from it, and `memory_get` refuses to read outside it.
|
|
5
|
+
* Pure path computation — nothing is created on disk.
|
|
6
|
+
*/
|
|
2
7
|
export declare function memoryDir(cwd: string): string;
|
|
8
|
+
/** Path to `MEMORY.md`, the single file holding the flat `## Facts` list. Pure path computation. */
|
|
3
9
|
export declare function memoryMdPath(cwd: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Path to `<memory root>/notes`, where per-topic notes and the consolidated
|
|
12
|
+
* notes written by a dreaming sweep live. Pure path computation — the directory
|
|
13
|
+
* may not exist.
|
|
14
|
+
*/
|
|
4
15
|
export declare function notesDir(cwd: string): string;
|
|
5
16
|
/** Read facts from `MEMORY.md`'s `## Facts` section. Returns `[]` when missing. */
|
|
6
17
|
export declare function readFactsFromMarkdown(cwd: string): Promise<MemoryFact[]>;
|
|
7
18
|
/** Append a fact to `MEMORY.md ## Facts`. Creates the section if missing. Atomic + serialized. */
|
|
8
19
|
export declare function appendFactToMarkdown(cwd: string, fact: MemoryFact): Promise<void>;
|
|
20
|
+
/** One note discovered under `notes/`: its file name without the `.md` suffix, and its absolute path. */
|
|
9
21
|
export interface NoteFile {
|
|
10
22
|
slug: string;
|
|
11
23
|
path: string;
|
|
12
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* List the `.md` files directly under `notes/`. Returns `[]` when the directory
|
|
27
|
+
* does not exist, so a workspace that has never written a note is not an error.
|
|
28
|
+
* Does not recurse into sub-directories.
|
|
29
|
+
*/
|
|
13
30
|
export declare function listNotes(cwd: string): Promise<NoteFile[]>;
|
|
14
31
|
/** Configuration-aware accessors honoring the existing MemoryConfig contract. */
|
|
15
32
|
export declare function readFacts(cwd: string, config: MemoryConfig): Promise<MemoryFact[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Append a fact, honouring the `enabled` gate on {@link MemoryConfig}: when
|
|
35
|
+
* memory is disabled the call resolves without touching disk. This is the entry
|
|
36
|
+
* point for configuration-aware callers; `appendFactToMarkdown` is the same
|
|
37
|
+
* write without the gate.
|
|
38
|
+
*
|
|
39
|
+
* The write itself is atomic and serialised per memory root, and the fact text
|
|
40
|
+
* passes through secret redaction first.
|
|
41
|
+
*/
|
|
16
42
|
export declare function appendFact(cwd: string, config: MemoryConfig, fact: MemoryFact): Promise<void>;
|
|
17
43
|
//# sourceMappingURL=markdown-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-store.d.ts","sourceRoot":"","sources":["../../../src/internal/store/markdown-store.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAiB,MAAM,oBAAoB,CAAC;AAqCvF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,mFAAmF;AACnF,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAQ9E;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAcjF;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAUhE;AAsCD,iFAAiF;AACjF,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAGxF;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
1
|
+
{"version":3,"file":"markdown-store.d.ts","sourceRoot":"","sources":["../../../src/internal/store/markdown-store.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAiB,MAAM,oBAAoB,CAAC;AAqCvF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,oGAAoG;AACpG,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,mFAAmF;AACnF,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAQ9E;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAcjF;AAED,yGAAyG;AACzG,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAUhE;AAsCD,iFAAiF;AACjF,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAGxF;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -26,7 +26,7 @@ interface MemoryReadResult {
|
|
|
26
26
|
linesReturned: number;
|
|
27
27
|
/** Total lines in the file (after the read). */
|
|
28
28
|
totalLines: number;
|
|
29
|
-
/** True when
|
|
29
|
+
/** True when content remains after the returned slice, i.e. `remainingLines > 0`. */
|
|
30
30
|
truncated: boolean;
|
|
31
31
|
/** Lines past the returned slice that remain in the file. */
|
|
32
32
|
remainingLines: number;
|
|
@@ -40,8 +40,8 @@ interface MemoryReadResult {
|
|
|
40
40
|
* - `from` is 1-indexed.
|
|
41
41
|
* - `lines` defaults to 200 (`DEFAULT_MEMORY_READ_LINES`).
|
|
42
42
|
* - Returns up to EOF when the requested slice extends past file end.
|
|
43
|
-
* - Sets `truncated: true`
|
|
44
|
-
*
|
|
43
|
+
* - Sets `truncated: true` whenever content remains past the returned slice,
|
|
44
|
+
* whether or not the slice was shorter than requested. (At EOF, `false`.)
|
|
45
45
|
*
|
|
46
46
|
* Iter 55 (Stage 3 source-move #12): hybrid copy from sdk-core's
|
|
47
47
|
* `internal/memory/storage/reader.ts`. sdk-core retains its copy for
|
|
@@ -53,12 +53,35 @@ interface MemoryReadResult {
|
|
|
53
53
|
* @internal
|
|
54
54
|
*/
|
|
55
55
|
export declare const DEFAULT_MEMORY_READ_LINES = 200;
|
|
56
|
+
/**
|
|
57
|
+
* Inputs for {@link readMemoryFileBounded}. `relPath` is resolved against `cwd`,
|
|
58
|
+
* and this function performs no containment check of its own — a `relPath`
|
|
59
|
+
* containing `..` escapes. The `memory_get` tool validates containment before
|
|
60
|
+
* calling in.
|
|
61
|
+
*
|
|
62
|
+
* `from` is 1-indexed and clamped to at least 1; `lines` defaults to 200 and is
|
|
63
|
+
* clamped to at least 1.
|
|
64
|
+
*/
|
|
56
65
|
export interface ReadFileOptions {
|
|
57
66
|
cwd: string;
|
|
58
67
|
relPath: string;
|
|
59
68
|
from?: number;
|
|
60
69
|
lines?: number;
|
|
61
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Read a bounded slice of a text file and report what was left behind.
|
|
73
|
+
*
|
|
74
|
+
* A single trailing newline is not counted as a line, so `totalLines` matches
|
|
75
|
+
* what an editor shows. `from` past the end of the file is not an error: it
|
|
76
|
+
* returns an empty slice with `linesReturned: 0`.
|
|
77
|
+
*
|
|
78
|
+
* `truncated` means content remains after the returned slice — it is exactly
|
|
79
|
+
* `remainingLines > 0`. It does not mean fewer lines were returned than
|
|
80
|
+
* requested: a full 200-line slice of a 1000-line file is `truncated: true`,
|
|
81
|
+
* and a short slice that reached the end is `truncated: false`.
|
|
82
|
+
*
|
|
83
|
+
* Rejects with the underlying filesystem error when the file cannot be read.
|
|
84
|
+
*/
|
|
62
85
|
export declare function readMemoryFileBounded(opts: ReadFileOptions): Promise<MemoryReadResult>;
|
|
63
86
|
export {};
|
|
64
87
|
//# sourceMappingURL=reader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../../src/internal/store/reader.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../../src/internal/store/reader.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,SAAS,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;GAkBG;AAEH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA6B5F"}
|
|
@@ -21,5 +21,10 @@ export interface SessionFile {
|
|
|
21
21
|
absolutePath: string;
|
|
22
22
|
relPath: string;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* List the session summaries under `sessions/`, with each path expressed
|
|
26
|
+
* relative to the memory root so the index can store a stable `sessions/<id>.md`.
|
|
27
|
+
* Returns `[]` when the directory does not exist. Does not recurse.
|
|
28
|
+
*/
|
|
24
29
|
export declare function discoverSessionFiles(cwd: string): Promise<SessionFile[]>;
|
|
25
30
|
//# sourceMappingURL=session-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-loader.d.ts","sourceRoot":"","sources":["../../../src/internal/store/session-loader.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAiB9E"}
|
|
1
|
+
{"version":3,"file":"session-loader.d.ts","sourceRoot":"","sources":["../../../src/internal/store/session-loader.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAiB9E"}
|
|
@@ -30,7 +30,21 @@ export interface SessionSummaryInput {
|
|
|
30
30
|
status: "finished" | "running" | "error" | "cancelled";
|
|
31
31
|
at: number;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Path to `<memory root>/sessions`, where one markdown summary per finished run
|
|
35
|
+
* is written. `IndexManager.sync()` indexes these with `source: "sessions"`.
|
|
36
|
+
* Pure path computation.
|
|
37
|
+
*/
|
|
33
38
|
export declare function sessionsDir(cwd: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Path of the summary file for a run.
|
|
41
|
+
*
|
|
42
|
+
* The run id is sanitised before it reaches the path: every character outside
|
|
43
|
+
* `[a-zA-Z0-9_-]` becomes an underscore and the result is cut to 128
|
|
44
|
+
* characters. That keeps a hostile id inside the sessions directory, and it also
|
|
45
|
+
* means two different ids can collide onto one file — pass ids that are already
|
|
46
|
+
* within the safe alphabet if that matters.
|
|
47
|
+
*/
|
|
34
48
|
export declare function sessionSummaryPath(cwd: string, runId: string): string;
|
|
35
49
|
/**
|
|
36
50
|
* Write a session summary file. EC-9: a non-finished status returns early
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-summary-writer.d.ts","sourceRoot":"","sources":["../../../src/internal/store/session-summary-writer.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IACvD,EAAE,EAAE,MAAM,CAAC;CACZ;AAID,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAErE;AAaD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BnF"}
|
|
1
|
+
{"version":3,"file":"session-summary-writer.d.ts","sourceRoot":"","sources":["../../../src/internal/store/session-summary-writer.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IACvD,EAAE,EAAE,MAAM,CAAC;CACZ;AAID;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAErE;AAaD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BnF"}
|
|
@@ -32,5 +32,17 @@ export interface ActiveMemoryTranscript {
|
|
|
32
32
|
snippet: string;
|
|
33
33
|
}>;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Write one recall transcript to
|
|
37
|
+
* `<memory root>/transcripts/active-memory/<runId>.json`, creating the parent
|
|
38
|
+
* directories and replacing the file atomically.
|
|
39
|
+
*
|
|
40
|
+
* Never rejects. A failure is reported on stderr and swallowed, because losing a
|
|
41
|
+
* diagnostic file must not fail the agent run that produced it. That also means
|
|
42
|
+
* a successful resolution is not evidence the file was written.
|
|
43
|
+
*
|
|
44
|
+
* The run id is used verbatim in the file name — unlike the session summary
|
|
45
|
+
* writer, nothing sanitises it here, so pass an id you control.
|
|
46
|
+
*/
|
|
35
47
|
export declare function persistActiveMemoryTranscript(cwd: string, transcript: ActiveMemoryTranscript): Promise<void>;
|
|
36
48
|
//# sourceMappingURL=transcript-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-store.d.ts","sourceRoot":"","sources":["../../../src/internal/store/transcript-store.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,aAAa,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACJ;AAED,wBAAsB,6BAA6B,CACjD,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,sBAAsB,GACjC,OAAO,CAAC,IAAI,CAAC,CAWf"}
|
|
1
|
+
{"version":3,"file":"transcript-store.d.ts","sourceRoot":"","sources":["../../../src/internal/store/transcript-store.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,aAAa,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACJ;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,sBAAsB,GACjC,OAAO,CAAC,IAAI,CAAC,CAWf"}
|
|
@@ -19,6 +19,17 @@ export interface WikiFile {
|
|
|
19
19
|
absolutePath: string;
|
|
20
20
|
relPath: string;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Path to `<memory root>/wiki`, the read-only supplement directory. Nothing in
|
|
24
|
+
* this package writes there — it is for material a human or another tool puts
|
|
25
|
+
* in place. Pure path computation.
|
|
26
|
+
*/
|
|
22
27
|
export declare function wikiDir(cwd: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* List the `.md` files directly under `wiki/`, with each path expressed relative
|
|
30
|
+
* to the memory root so the index can store a stable `wiki/<name>.md`. Returns
|
|
31
|
+
* `[]` when the directory does not exist. Does not recurse, so wiki material
|
|
32
|
+
* organised into sub-directories is not picked up.
|
|
33
|
+
*/
|
|
23
34
|
export declare function discoverWikiFiles(cwd: string): Promise<WikiFile[]>;
|
|
24
35
|
//# sourceMappingURL=wiki-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiki-loader.d.ts","sourceRoot":"","sources":["../../../src/internal/store/wiki-loader.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,QAAQ;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAkBxE"}
|
|
1
|
+
{"version":3,"file":"wiki-loader.d.ts","sourceRoot":"","sources":["../../../src/internal/store/wiki-loader.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,QAAQ;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAkBxE"}
|
package/dist/internal/tools.d.ts
CHANGED
|
@@ -28,17 +28,55 @@ export interface MemoryToolJson {
|
|
|
28
28
|
description: string;
|
|
29
29
|
inputSchema: Record<string, unknown>;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* A memory tool ready to hand to the agent loop: the JSON-serialisable
|
|
33
|
+
* description an LLM sees, plus the `execute` that runs it. `execute` resolves
|
|
34
|
+
* to a JSON string — the tool layer does no further encoding.
|
|
35
|
+
*/
|
|
31
36
|
export interface MemoryTool extends MemoryToolJson {
|
|
32
37
|
execute(input: Record<string, unknown>): Promise<string>;
|
|
33
38
|
}
|
|
39
|
+
/** Options for {@link createMemorySearchTool}. */
|
|
34
40
|
export interface MemorySearchToolOptions {
|
|
35
41
|
index: MemoryIndex;
|
|
36
42
|
/** Cap on the JSON response size (EC-10 of edge-case review). Default 16384. */
|
|
37
43
|
maxTotalChars?: number;
|
|
38
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Build the `memory_search` tool over an index that is already open. The tool
|
|
47
|
+
* never opens or syncs anything: if `index.sync()` has not run, the search runs
|
|
48
|
+
* against whatever the index last recorded, and a freshly created index returns
|
|
49
|
+
* no hits.
|
|
50
|
+
*
|
|
51
|
+
* The tool accepts `query` (required), `maxResults` (default 10), `minScore`,
|
|
52
|
+
* and `corpus`, where `corpus` maps to the index's source filter: `memory`,
|
|
53
|
+
* `sessions`, `wiki`, or `all` (the default, which applies no filter). An
|
|
54
|
+
* unrecognised `corpus` value is treated as `all` rather than rejected.
|
|
55
|
+
*
|
|
56
|
+
* `execute` returns `{"hits": [...], "truncated": bool}`. Hits are dropped from
|
|
57
|
+
* the tail once their estimated size would exceed `maxTotalChars`, except that
|
|
58
|
+
* the first hit is always kept even when it alone exceeds the cap.
|
|
59
|
+
*
|
|
60
|
+
* Use this for recall by meaning across the whole corpus, and
|
|
61
|
+
* {@link createMemoryGetTool} when the model already knows the file and wants
|
|
62
|
+
* exact lines.
|
|
63
|
+
*/
|
|
39
64
|
export declare function createMemorySearchTool(opts: MemorySearchToolOptions): MemoryTool;
|
|
65
|
+
/** Options for {@link createMemoryGetTool}. `cwd` is the workspace root, not the memory directory. */
|
|
40
66
|
export interface MemoryGetToolOptions {
|
|
41
67
|
cwd: string;
|
|
42
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Build the `memory_get` tool, which reads an exact excerpt from a file under
|
|
71
|
+
* `<cwd>/.theokit/memory`. Needs no index and no embedding runtime — it is
|
|
72
|
+
* plain file reading, so it works in a workspace where search is not configured.
|
|
73
|
+
*
|
|
74
|
+
* The tool accepts `path` (required, relative to the memory root), `from`
|
|
75
|
+
* (1-indexed, default 1) and `lines` (default 200). A `path` whose resolved
|
|
76
|
+
* location falls outside the memory root is rejected with a
|
|
77
|
+
* `ConfigurationError` carrying the code `memory_path_escapes_root`. A path that
|
|
78
|
+
* stays inside but does not exist is not caught here: the underlying read
|
|
79
|
+
* rejects with the filesystem error.
|
|
80
|
+
*/
|
|
43
81
|
export declare function createMemoryGetTool(opts: MemoryGetToolOptions): MemoryTool;
|
|
44
82
|
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/internal/tools.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1D;AAiCD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,WAAW,CAAC;IACnB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,uBAAuB,GAAG,UAAU,CAqBhF;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,UAAU,CA4B1E"}
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/internal/tools.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1D;AAiCD,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,WAAW,CAAC;IACnB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,uBAAuB,GAAG,UAAU,CAqBhF;AAED,sGAAsG;AACtG,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,UAAU,CA4B1E"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theokit/sdk-memory",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Memory subsystem for @theokit/sdk — MemoryProvider impls (markdown file store today; LanceDB + embeddings + circuit breaker next iters). Consumes the kernel-facing port from sdk-core.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"homepage": "https://github.com/
|
|
7
|
-
"bugs": "https://github.com/
|
|
6
|
+
"homepage": "https://github.com/usetheokit/theokit-sdk#readme",
|
|
7
|
+
"bugs": "https://github.com/usetheokit/theokit-sdk/issues",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
10
|
+
"url": "git+https://github.com/usetheokit/theokit-sdk.git",
|
|
11
11
|
"directory": "packages/sdk-memory"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
@@ -61,13 +61,14 @@
|
|
|
61
61
|
"@types/better-sqlite3": "^7.6.13",
|
|
62
62
|
"better-sqlite3": "^12.10.0",
|
|
63
63
|
"sqlite-vec": "^0.1.6",
|
|
64
|
-
"@theokit/sdk": "4.
|
|
64
|
+
"@theokit/sdk": "4.54.0"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
|
+
"provenance": true,
|
|
67
68
|
"access": "public"
|
|
68
69
|
},
|
|
69
70
|
"scripts": {
|
|
70
|
-
"build": "tsup && tsc -p tsconfig.build.json && cp dist/index.d.ts dist/index.d.cts",
|
|
71
|
+
"build": "tsup && tsc -p tsconfig.build.json && cp dist/index.d.ts dist/index.d.cts && node ../../tools/repair-dts-imports.mjs .",
|
|
71
72
|
"test": "vitest run",
|
|
72
73
|
"typecheck": "tsc --noEmit"
|
|
73
74
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Composite scoring — blends semantic, text, recency, and importance signals.
|
|
3
|
-
*
|
|
4
|
-
* Inspired by a peer project's `unified_memory.py` composite scoring (lines 345-381).
|
|
5
|
-
* Default weights: semantic 0.5, text 0.2, recency 0.2, importance 0.1.
|
|
6
|
-
* Backward-compatible: old behavior reproduced with {recencyWeight:0, importanceWeight:0}.
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export interface CompositeScoreConfig {
|
|
11
|
-
semanticWeight: number;
|
|
12
|
-
textWeight: number;
|
|
13
|
-
recencyWeight: number;
|
|
14
|
-
importanceWeight: number;
|
|
15
|
-
recencyHalfLifeMs: number;
|
|
16
|
-
}
|
|
17
|
-
export declare const DEFAULT_COMPOSITE_CONFIG: CompositeScoreConfig;
|
|
18
|
-
export declare function compositeScore(vectorScore: number, textScore: number, createdAt: number | null, importance: number, config?: CompositeScoreConfig): number;
|
|
19
|
-
//# sourceMappingURL=composite-scorer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composite-scorer.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/composite-scorer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,wBAAwB,EAAE,oBAMtC,CAAC;AAEF,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,oBAA+C,GACtD,MAAM,CAUR"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Query analyzer — LLM-driven sub-query distillation for complex queries.
|
|
3
|
-
*
|
|
4
|
-
* Inspired by a peer project's `recall_flow.py`. Opt-in: short queries (≤250 chars)
|
|
5
|
-
* pass through unchanged. Per ADR D3.
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
interface QueryAnalysisResult {
|
|
10
|
-
subQueries: string[];
|
|
11
|
-
timeFilter?: number;
|
|
12
|
-
scopeHint?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function analyzeQuery(query: string, callLlm: (system: string, user: string) => Promise<string>): Promise<QueryAnalysisResult>;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=query-analyzer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-analyzer.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/query-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GACzD,OAAO,CAAC,mBAAmB,CAAC,CAmB9B"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Batch encoding pipeline — embeds N texts in 1 API call with intra-batch dedup.
|
|
3
|
-
*
|
|
4
|
-
* Inspired by a peer project's `encoding_flow.py` Stage 1-2: batch embed + cosine dedup.
|
|
5
|
-
* Per ADR D1: new module alongside sync(), not a replacement.
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
import type { EmbeddingRuntime } from "./embedding-adapter.js";
|
|
10
|
-
interface RememberManyOptions {
|
|
11
|
-
scope?: string;
|
|
12
|
-
importance?: number;
|
|
13
|
-
dedupThreshold?: number;
|
|
14
|
-
}
|
|
15
|
-
interface RememberManyResult {
|
|
16
|
-
total: number;
|
|
17
|
-
deduped: number;
|
|
18
|
-
inserted: number;
|
|
19
|
-
}
|
|
20
|
-
interface KeptItem {
|
|
21
|
-
text: string;
|
|
22
|
-
vector: number[];
|
|
23
|
-
}
|
|
24
|
-
declare function cosineSimilarity(a: number[], b: number[]): number;
|
|
25
|
-
export declare function rememberMany(texts: string[], embedding: EmbeddingRuntime, opts?: RememberManyOptions): Promise<{
|
|
26
|
-
result: RememberManyResult;
|
|
27
|
-
items: KeptItem[];
|
|
28
|
-
}>;
|
|
29
|
-
export { cosineSimilarity };
|
|
30
|
-
//# sourceMappingURL=batch-encoder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-encoder.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/batch-encoder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,iBAAS,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAY1D;AAmBD,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EAAE,EACf,SAAS,EAAE,gBAAgB,EAC3B,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC;IAAE,MAAM,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC,CAiB5D;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hierarchical memory scopes — path-based isolation for multi-agent setups.
|
|
3
|
-
*
|
|
4
|
-
* Inspired by a peer project's `MemoryScope` with path hierarchy.
|
|
5
|
-
* Per ADR D4: scope stored as TEXT column, prefix-matched via LIKE.
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export declare function normalizeScopePath(path: string): string;
|
|
10
|
-
interface ScopeSearchOptions {
|
|
11
|
-
scopePrefix?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class MemoryScope {
|
|
14
|
-
private readonly rootPath;
|
|
15
|
-
constructor(rootPath: string);
|
|
16
|
-
get path(): string;
|
|
17
|
-
child(subPath: string): MemoryScope;
|
|
18
|
-
toSearchOptions(): ScopeSearchOptions;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=memory-scope.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-scope.d.ts","sourceRoot":"","sources":["../../src/internal/memory-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED,UAAU,kBAAkB;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,QAAQ,EAAE,MAAM;IAI5B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IAKnC,eAAe,IAAI,kBAAkB;CAGtC"}
|