@theokit/sdk-memory 0.4.0 → 0.5.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/index.cjs +106 -235
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +27 -223
  5. package/dist/index.js.map +1 -1
  6. package/dist/internal/active-memory/active-memory.d.ts.map +1 -1
  7. package/dist/internal/dreaming/dreaming-diary.d.ts +6 -61
  8. package/dist/internal/dreaming/dreaming-diary.d.ts.map +1 -1
  9. package/dist/internal/index/index-db.d.ts +0 -7
  10. package/dist/internal/index/index-db.d.ts.map +1 -1
  11. package/dist/internal/index/index-manager.d.ts +9 -1
  12. package/dist/internal/index/index-manager.d.ts.map +1 -1
  13. package/dist/internal/index/lance-index.d.ts +3 -6
  14. package/dist/internal/index/lance-index.d.ts.map +1 -1
  15. package/dist/internal/index/migrate-sqlite-to-lance.d.ts +5 -0
  16. package/dist/internal/index/migrate-sqlite-to-lance.d.ts.map +1 -1
  17. package/dist/internal/store/markdown-store.d.ts +1 -1
  18. package/dist/internal/store/markdown-store.d.ts.map +1 -1
  19. package/dist/internal/store/session-loader.d.ts +3 -27
  20. package/dist/internal/store/session-loader.d.ts.map +1 -1
  21. package/dist/internal/store/session-summary-writer.d.ts +6 -53
  22. package/dist/internal/store/session-summary-writer.d.ts.map +1 -1
  23. package/dist/internal/store/transcript-store.d.ts +3 -45
  24. package/dist/internal/store/transcript-store.d.ts.map +1 -1
  25. package/dist/internal/store/wiki-loader.d.ts +3 -32
  26. package/dist/internal/store/wiki-loader.d.ts.map +1 -1
  27. package/dist/internal/tools.d.ts +3 -1
  28. package/dist/internal/tools.d.ts.map +1 -1
  29. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"active-memory.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;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AAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AASD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsD5F"}
1
+ {"version":3,"file":"active-memory.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAC;AAIjF,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAmB9E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3E,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,wCAAwC;IACxC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AASD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsD5F"}
@@ -1,65 +1,10 @@
1
1
  /**
2
- * Dream-diary append (ADR D7).
2
+ * The dreaming diary re-exported from `@theokit/sdk`, not reimplemented here.
3
3
  *
4
- * Diary lives at `.theokit/memory/dream-diary.md` and grows with one entry
5
- * per sweep. Each entry is content-hashed so the same input produces the
6
- * same entry idempotency contract.
7
- *
8
- * Writes go through `replaceFileAtomic` (EC-3 of edge-case review) so a
9
- * crash mid-write can never leave a half-written diary.
10
- *
11
- * Iter 59 (Stage 3 source-move #16): hybrid copy from sdk-core's
12
- * `internal/memory/dreaming/diary.ts`. sdk-core retains its copy for
13
- * v1.x dream-diary back-compat; sdk-memory ships the canonical copy
14
- * that the future `dreaming-run.ts` move will compose with as a
15
- * sibling (run.ts imports `appendDiaryEntry` after each dreaming
16
- * sweep). Dependency chain (both resolved):
17
- * - `@theokit/sdk/persistence` for `replaceFileAtomic`
18
- * - sibling `./markdown-store.js` for `memoryDir` (moved iter 56)
19
- *
20
- * Flat-naming convention (not `dreaming/diary.ts`): sdk-memory's
21
- * `internal/` directory stays flat. The `dreaming-` prefix preserves
22
- * the topical grouping (companion to iter 54's `dreaming-phases`).
23
- *
24
- * @internal
25
- */
26
- export interface DiaryEntry {
27
- timestampMs: number;
28
- factsBefore: number;
29
- factsAfter: number;
30
- duplicatesRemoved: number;
31
- clustersCreated: number;
32
- notesWritten: number;
33
- }
34
- /** Path to the dream diary, `<memory root>/dream-diary.md`. Pure path computation. */
35
- export declare function diaryPath(cwd: string): string;
36
- /**
37
- * Render one entry as the markdown block {@link appendDiaryEntry} writes: an h2
38
- * heading carrying the ISO timestamp, then a bullet list of the counts, prefixed
39
- * by the first eight hex characters of {@link entryHash}.
40
- */
41
- export declare function renderDiaryEntry(entry: DiaryEntry): string;
42
- /**
43
- * Append one entry to the dream diary, creating the file with a `# Dream Diary`
44
- * header when it does not exist yet. The whole file is rewritten through an
45
- * atomic replace, so a crash mid-write leaves the previous diary intact rather
46
- * than a truncated one.
47
- *
48
- * The parent directory is not created here. Call this against a workspace whose
49
- * memory directory already exists — a dreaming sweep does, because it has just
50
- * read `MEMORY.md` from it.
51
- *
52
- * Appending is unconditional: passing an entry that was already written adds a
53
- * second block. The hash identifies repeated content, it does not suppress it.
54
- */
55
- export declare function appendDiaryEntry(cwd: string, entry: DiaryEntry): Promise<void>;
56
- /**
57
- * A sha256 over the five counts of an entry, as a hex string.
58
- *
59
- * The timestamp is deliberately NOT part of the hash, so two sweeps that changed
60
- * nothing produce the same hash at different times — that is the signal the
61
- * diary is meant to carry. It also means the hash does not identify an entry
62
- * uniquely.
4
+ * This was a copy: 39 lines across `diaryPath`, `renderDiaryEntry`, `entryHash` and
5
+ * `appendDiaryEntry`, with zero diverging from the SDK's. `Memory.runDreamingSweep` routes through
6
+ * this package whenever it is installed, so a copy here is a second thing that has to be kept
7
+ * right, and the record of this package pair is that the copy is the one nobody updates (#430).
63
8
  */
64
- export declare function entryHash(entry: DiaryEntry): string;
9
+ export { appendDiaryEntry, type DiaryEntry, diaryPath, entryHash, renderDiaryEntry, } from "@theokit/sdk/internal/memory-store";
65
10
  //# sourceMappingURL=dreaming-diary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dreaming-diary.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-diary.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAc1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAUpF;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAYnD"}
1
+ {"version":3,"file":"dreaming-diary.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-diary.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,gBAAgB,EAChB,KAAK,UAAU,EACf,SAAS,EACT,SAAS,EACT,gBAAgB,GACjB,MAAM,oCAAoC,CAAC"}
@@ -65,11 +65,4 @@ export interface OpenDbOptions {
65
65
  * that can do text search only.
66
66
  */
67
67
  export declare function openMemoryDb(opts: OpenDbOptions): Promise<MemoryDb>;
68
- /**
69
- * Where the SQLite index lives when the caller does not name a path:
70
- * `<cwd>/.theokit/memory/.index/memory.sqlite`. Pure path computation. The file
71
- * sits under the memory root but outside the markdown corpus, so it is never
72
- * indexed as content.
73
- */
74
- export declare function defaultIndexPath(cwd: string): string;
75
68
  //# sourceMappingURL=index-db.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-db.d.ts","sourceRoot":"","sources":["../../../src/internal/index/index-db.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,QAAQ;IACvB,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,iEAAiE;IACjE,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,+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C;CACnC;AAED,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAWzE"}
@@ -1,4 +1,5 @@
1
1
  import type { EmbeddingRuntime } from "../embedding/embedding-adapter.js";
2
+ import { type MemoryRoot } from "../store/markdown-store.js";
2
3
  import { type MemoryIndex } from "./memory-index.js";
3
4
  /**
4
5
  * Memory index manager (ADR D2). FTS5-only at Phase 3; vector index lands in
@@ -45,6 +46,13 @@ interface SearchOptions {
45
46
  }
46
47
  interface OpenIndexOptions {
47
48
  cwd: string;
49
+ /**
50
+ * The memory root to index and to place the database under. Defaults to `<cwd>/.theokit/memory`.
51
+ *
52
+ * Optional here and required below: this is the entry point a caller reaches with a workspace in
53
+ * hand, while every path helper under it demands a resolved root (#463).
54
+ */
55
+ memoryRoot?: MemoryRoot;
48
56
  filePath?: string;
49
57
  embedding?: EmbeddingRuntime;
50
58
  backend?: "sqlite-vec" | "lance";
@@ -79,7 +87,7 @@ interface OpenIndexOptions {
79
87
  * it either way.
80
88
  */
81
89
  export declare class IndexManager implements MemoryIndex {
82
- private readonly cwd;
90
+ private readonly memoryRoot;
83
91
  private readonly db;
84
92
  private readonly embedding;
85
93
  private lastSyncMs;
@@ -1 +1 @@
1
- {"version":3,"file":"index-manager.d.ts","sourceRoot":"","sources":["../../../src/internal/index/index-manager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAO1E,OAAO,EAAE,KAAK,WAAW,EAAsB,MAAM,mBAAmB,CAAC;AAYzE;;;;;;;;;;;;;;;;;;GAkBG;AAmBH,UAAU,eAAe;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;I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,OAAO,CAAC,QAAQ,CAAC,SAAS;IAN5B,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO;IAMP;;;;OAIG;WACU,IAAI,CAAC,IAAI,EAAE,gBAAgB,GAAG;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;WACzE,IAAI,CACf,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,CAAC,gBAAgB,GAAG;QAAE,OAAO,CAAC,EAAE,YAAY,CAAA;KAAE,CAAC,GACxF,OAAO,CAAC,YAAY,CAAC;IAQxB,sEAAsE;mBACjD,kBAAkB;YAUzB,iBAAiB;IAkB/B,wDAAwD;IAClD,IAAI,IAAI,OAAO,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IAkCI,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAYpF,MAAM,IAAI,WAAW;IAcrB,OAAO,CAAC,SAAS;YA4CH,gBAAgB;IAiB9B,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,SAAS;IAejB,OAAO,CAAC,gBAAgB;IAkCxB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,UAAU;IAgBlB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,WAAW;IAcnB,KAAK,IAAI,IAAI;CAGd"}
@@ -1,4 +1,5 @@
1
1
  import type { EmbeddingRuntime } from "../embedding/embedding-adapter.js";
2
+ import { type MemoryRoot } from "../store/markdown-store.js";
2
3
  /**
3
4
  * One row of the Lance `facts` table, as it is stored. Field names are the
4
5
  * on-disk column names, which is why `user_id` is snake_case here while the
@@ -25,6 +26,8 @@ export interface LanceFactRecord {
25
26
  */
26
27
  export interface OpenLanceOptions {
27
28
  cwd: string;
29
+ /** The resolved memory root. Defaults to `<cwd>/.theokit/memory` (#463). */
30
+ memoryRoot?: MemoryRoot;
28
31
  embedding: EmbeddingRuntime;
29
32
  /** Override storage location. Default: `<cwd>/.theokit/memory/lance/`. */
30
33
  storagePath?: string;
@@ -86,10 +89,4 @@ export declare class LanceIndex {
86
89
  * @internal
87
90
  */
88
91
  export declare function isLanceAvailable(): boolean;
89
- /**
90
- * Test helper: re-export the storage path computation.
91
- *
92
- * @internal
93
- */
94
- export declare function lanceStoragePath(cwd: string): string;
95
92
  //# sourceMappingURL=lance-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lance-index.d.ts","sourceRoot":"","sources":["../../../src/internal/index/lance-index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AA+D1E;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IACvC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,gBAAgB,CAAC;IAC5B,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,aAAa,CAAC,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,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAH/B,OAAO;WAMM,IAAI,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IA4CxD,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvF;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IA+B1E,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ9C,WAAW,CAAC,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAUtD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B;AAiCD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAQ1C"}
@@ -18,6 +18,11 @@
18
18
  */
19
19
  export interface MigrateOptions {
20
20
  cwd: string;
21
+ /**
22
+ * Absolute path (or `~/`-prefixed) of the memory root to migrate, when the agent that wrote it
23
+ * set `memory.directory`. Defaults to `<cwd>/.theokit/memory` (#463).
24
+ */
25
+ directory?: string;
21
26
  dryRun?: boolean;
22
27
  batchSize?: number;
23
28
  /** Inject for tests; defaults to console.log. */
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-sqlite-to-lance.d.ts","sourceRoot":"","sources":["../../../src/internal/index/migrate-sqlite-to-lance.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,SAAS,EAAE,OAAO,CAAC;IACnB,gEAAgE;IAChE,iBAAiB,EAAE,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACjE,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC;CACpB;AA0DD;;;;;;GAMG;AAEH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAmJvF"}
1
+ {"version":3,"file":"migrate-sqlite-to-lance.d.ts","sourceRoot":"","sources":["../../../src/internal/index/migrate-sqlite-to-lance.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,SAAS,EAAE,OAAO,CAAC;IACnB,gEAAgE;IAChE,iBAAiB,EAAE,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACjE,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC;CACpB;AAaD;;;;;;GAMG;AAEH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAqJvF"}
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * @internal
20
20
  */
21
- export { appendFact, appendFactToMarkdown, claudeProjectMemoryDir, memoryDir, memoryMdPath, memoryWriteDir, notesDir, readFacts, readFactsFromMarkdown, } from "@theokit/sdk/internal/memory-store";
21
+ export { appendFact, appendFactToMarkdown, asMemoryRoot, claudeProjectMemoryDir, collectMarkdownFiles, type DiscoveredFile, defaultIndexPath, indexBudgetWarning, lanceStoragePath, MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, type MemoryLocationConfig, type MemoryRoot, memoryMdPath, memoryReadRoots, notesDir, projectMemoryDir, readAllSqliteFacts, readFacts, readFactsFromMarkdown, resolveMemoryRoot, type SqliteFactRow, } from "@theokit/sdk/internal/memory-store";
22
22
  /** One note discovered under `notes/`: its file name without the `.md` suffix, and its absolute path. */
23
23
  export interface NoteFile {
24
24
  slug: string;
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-store.d.ts","sourceRoot":"","sources":["../../../src/internal/store/markdown-store.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,SAAS,EACT,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAE5C,yGAAyG;AACzG,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAUhE"}
1
+ {"version":3,"file":"markdown-store.d.ts","sourceRoot":"","sources":["../../../src/internal/store/markdown-store.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,cAAc,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,oCAAoC,CAAC;AAE5C,yGAAyG;AACzG,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAahE"}
@@ -1,30 +1,6 @@
1
1
  /**
2
- * Session summary discovery (ADR D20).
3
- *
4
- * Mirrors `wiki-loader.ts:discoverWikiFiles`: scans
5
- * `.theokit/memory/sessions/*.md` and returns `MemoryFileEntry`-shaped
6
- * records. IndexManager tags each chunk with `source="sessions"` so
7
- * `memory_search({ corpus: "sessions" })` filters them in.
8
- *
9
- * Iter 62 (Stage 3 source-move #19): hybrid copy from sdk-core's
10
- * `internal/memory/storage/session-loader.ts`. sdk-core retains its
11
- * copy for v1.x sessions back-compat; sdk-memory ships the canonical
12
- * copy. **Closes the sessions/ cluster in sdk-memory** — session
13
- * summary writer (iter 61) + session-loader (this iter) are both
14
- * canonical. Dependencies (sibling, both moved):
15
- * - `memoryDir` from `./markdown-store.js` (moved iter 56)
16
- * - `sessionsDir` from `./session-summary-writer.js` (moved iter 61)
17
- *
18
- * @internal
2
+ * Session summary discovery (ADR D20) — re-exported from `@theokit/sdk`, not reimplemented here.
3
+ * See `session-summary-writer.ts` in this directory for why the copy was removed.
19
4
  */
20
- export interface SessionFile {
21
- absolutePath: string;
22
- relPath: string;
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
- */
29
- export declare function discoverSessionFiles(cwd: string): Promise<SessionFile[]>;
5
+ export { discoverSessionFiles, type SessionFile } from "@theokit/sdk/internal/memory-store";
30
6
  //# 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;;;;GAIG;AACH,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":"AAAA;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,oCAAoC,CAAC"}
@@ -1,57 +1,10 @@
1
1
  /**
2
- * Per-run session summary writer (ADR D20).
2
+ * Session summary writing (ADR D20) — re-exported from `@theokit/sdk`, not reimplemented here.
3
3
  *
4
- * After every finished run, write a markdown summary to
5
- * `.theokit/memory/sessions/<runId>.md`. IndexManager picks these up with
6
- * `source="sessions"` so `memory_search({ corpus: "sessions" })` can recall
7
- * past conversations.
8
- *
9
- * EC-9: only `status === "finished"` runs trigger a write. Cancelled/errored
10
- * runs would otherwise pollute the recall corpus with partial transcripts.
11
- *
12
- * Iter 61 (Stage 3 source-move #18): hybrid copy from sdk-core's
13
- * `internal/memory/storage/session-summary-writer.ts`. sdk-core
14
- * retains its copy for v1.x sessions back-compat; sdk-memory ships
15
- * the canonical copy that the future `session-loader.ts` move will
16
- * compose with as a sibling (loader reads back the markdown files
17
- * this writer emits). Dependency chain (all resolved):
18
- * - `@theokit/sdk/persistence` for `replaceFileAtomic`
19
- * - sibling `./markdown-store.js` for `memoryDir` (moved iter 56)
20
- * - sibling `./memory-types.js` for `redactSecrets` (moved iter 52)
21
- *
22
- * @internal
23
- */
24
- export interface SessionSummaryInput {
25
- cwd: string;
26
- runId: string;
27
- agentId: string;
28
- userText: string;
29
- assistantText: string;
30
- status: "finished" | "running" | "error" | "cancelled";
31
- at: number;
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
- */
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
- */
48
- export declare function sessionSummaryPath(cwd: string, runId: string): string;
49
- /**
50
- * Write a session summary file. EC-9: a non-finished status returns early
51
- * without touching disk. Secrets in both user and assistant text are
52
- * redacted via the shared `redactSecrets` pattern.
53
- *
54
- * @internal
4
+ * This was a byte-identical copy of the SDK's, and `Memory.runDreamingSweep` swaps this package's
5
+ * implementation in whenever it is installed — so the copy that RAN was not the copy anyone had
6
+ * updated. That is the defect #430 removed for `markdown-store`, and the one #463 had to be fixed
7
+ * twice because these four modules were still copies. Same remedy: one implementation, imported.
55
8
  */
56
- export declare function writeSessionSummary(input: SessionSummaryInput): Promise<void>;
9
+ export { type SessionSummaryInput, sessionSummaryPath, sessionsDir, writeSessionSummary, } from "@theokit/sdk/internal/memory-store";
57
10
  //# sourceMappingURL=session-summary-writer.d.ts.map
@@ -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;;;;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"}
1
+ {"version":3,"file":"session-summary-writer.d.ts","sourceRoot":"","sources":["../../../src/internal/store/session-summary-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,GACpB,MAAM,oCAAoC,CAAC"}
@@ -1,48 +1,6 @@
1
1
  /**
2
- * Optional on-disk persistence for Active Memory recall transcripts (ADR D6).
3
- *
4
- * Writes one JSON file per run under
5
- * `.theokit/memory/transcripts/active-memory/<runId>.json` when the agent
6
- * passes `persistTranscripts: true`. Failures are swallowed with a stderr
7
- * warning so transcript IO never crashes the agent run.
8
- *
9
- * Iter 58 (Stage 3 source-move #15): hybrid copy from sdk-core's
10
- * `internal/memory/storage/transcript-store.ts`. sdk-core retains its
11
- * copy for v1.x active-memory back-compat; sdk-memory ships the
12
- * canonical copy that the future `active-memory.ts` move will compose
13
- * with as a sibling. Dependency chain (both resolved):
14
- * - `@theokit/sdk/persistence` for `atomicWriteJson`
15
- * - sibling `./markdown-store.js` for `memoryDir` (moved iter 56)
16
- *
17
- * @internal
2
+ * Active-memory transcript persistence re-exported from `@theokit/sdk`, not reimplemented here.
3
+ * See `session-summary-writer.ts` in this directory for why the copy was removed.
18
4
  */
19
- export interface ActiveMemoryTranscript {
20
- runId: string;
21
- startedAtMs: number;
22
- userText: string;
23
- queryMode: string;
24
- status: string;
25
- durationMs: number;
26
- summary: string | undefined;
27
- hits: ReadonlyArray<{
28
- path: string;
29
- startLine: number;
30
- endLine: number;
31
- score: number;
32
- snippet: string;
33
- }>;
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
- */
47
- export declare function persistActiveMemoryTranscript(cwd: string, transcript: ActiveMemoryTranscript): Promise<void>;
5
+ export { type ActiveMemoryTranscript, persistActiveMemoryTranscript, } from "@theokit/sdk/internal/memory-store";
48
6
  //# 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;;;;;;;;;;;GAWG;AACH,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":"AAAA;;;GAGG;AACH,OAAO,EACL,KAAK,sBAAsB,EAC3B,6BAA6B,GAC9B,MAAM,oCAAoC,CAAC"}
@@ -1,35 +1,6 @@
1
1
  /**
2
- * Wiki supplement discovery (ADR Phase 10 of memory-system-peer-project-parity).
3
- *
4
- * Wiki files live under `.theokit/memory/wiki/*.md`. They are READ-ONLY —
5
- * the SDK never writes here. Each indexed chunk carries `source="wiki"` so
6
- * `memory_search { corpus: "wiki" }` and `corpus: "all"` can scope hits.
7
- *
8
- * Iter 57 (Stage 3 source-move #14): hybrid copy from sdk-core's
9
- * `internal/memory/storage/wiki-loader.ts`. sdk-core retains its copy
10
- * for v1.x back-compat; sdk-memory ships the canonical copy that
11
- * future `index-db` + `index-manager` moves will compose with
12
- * (memory_search corpus filter scopes wiki hits via this loader's
13
- * relPath convention). `memoryDir` comes from sibling
14
- * `./markdown-store.js` (moved iter 56).
15
- *
16
- * @internal
2
+ * Wiki file discovery re-exported from `@theokit/sdk`, not reimplemented here.
3
+ * See `session-summary-writer.ts` in this directory for why the copy was removed.
17
4
  */
18
- export interface WikiFile {
19
- absolutePath: string;
20
- relPath: string;
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
- */
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
- */
34
- export declare function discoverWikiFiles(cwd: string): Promise<WikiFile[]>;
5
+ export { discoverWikiFiles, type WikiFile, wikiDir } from "@theokit/sdk/internal/memory-store";
35
6
  //# 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;;;;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"}
1
+ {"version":3,"file":"wiki-loader.d.ts","sourceRoot":"","sources":["../../../src/internal/store/wiki-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,KAAK,QAAQ,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { MemoryIndex } from "./index/memory-index.js";
2
+ import type { MemoryRoot } from "./store/markdown-store.js";
2
3
  /**
3
4
  * Memory tools (`memory_search` + `memory_get`) — ADR D5 of
4
5
  * memory-system-peer-project-parity. Tool schemas mirror peer-project
@@ -64,7 +65,8 @@ export interface MemorySearchToolOptions {
64
65
  export declare function createMemorySearchTool(opts: MemorySearchToolOptions): MemoryTool;
65
66
  /** Options for {@link createMemoryGetTool}. `cwd` is the workspace root, not the memory directory. */
66
67
  export interface MemoryGetToolOptions {
67
- cwd: string;
68
+ /** The RESOLVED memory root the tool may read inside — not a cwd (#463). */
69
+ root: MemoryRoot;
68
70
  }
69
71
  /**
70
72
  * Build the `memory_get` tool, which reads an exact excerpt from a file under
@@ -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;;;;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"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/internal/tools.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;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,4EAA4E;IAC5E,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,UAAU,CA4B1E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk-memory",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
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
6
  "homepage": "https://github.com/usetheokit/theokit-sdk#readme",
@@ -61,7 +61,7 @@
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.60.0"
64
+ "@theokit/sdk": "4.63.0"
65
65
  },
66
66
  "publishConfig": {
67
67
  "provenance": true,