@theokit/sdk-memory 0.6.0 → 0.6.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/index.cjs +174 -1138
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +42 -1107
  6. package/dist/index.js.map +1 -1
  7. package/dist/internal/active-memory/active-memory-cache.d.ts +1 -66
  8. package/dist/internal/active-memory/active-memory-cache.d.ts.map +1 -1
  9. package/dist/internal/active-memory/active-memory-types.d.ts +1 -54
  10. package/dist/internal/active-memory/active-memory-types.d.ts.map +1 -1
  11. package/dist/internal/adapter-http-error.d.ts.map +1 -1
  12. package/dist/internal/dreaming/dreaming-phases.d.ts +5 -53
  13. package/dist/internal/dreaming/dreaming-phases.d.ts.map +1 -1
  14. package/dist/internal/dreaming/dreaming-run.d.ts +3 -83
  15. package/dist/internal/dreaming/dreaming-run.d.ts.map +1 -1
  16. package/dist/internal/index/index-db.d.ts +1 -67
  17. package/dist/internal/index/index-db.d.ts.map +1 -1
  18. package/dist/internal/index/index-manager-dispatch.d.ts +1 -35
  19. package/dist/internal/index/index-manager-dispatch.d.ts.map +1 -1
  20. package/dist/internal/index/index-manager.d.ts +1 -130
  21. package/dist/internal/index/index-manager.d.ts.map +1 -1
  22. package/dist/internal/index/index-schema.d.ts +1 -29
  23. package/dist/internal/index/index-schema.d.ts.map +1 -1
  24. package/dist/internal/index/lance-index.d.ts +1 -91
  25. package/dist/internal/index/lance-index.d.ts.map +1 -1
  26. package/dist/internal/index/lance-memory-adapter.d.ts +16 -115
  27. package/dist/internal/index/lance-memory-adapter.d.ts.map +1 -1
  28. package/dist/internal/index/memory-index.d.ts +3 -12
  29. package/dist/internal/index/memory-index.d.ts.map +1 -1
  30. package/dist/internal/index/migrate-sqlite-to-lance.d.ts +1 -65
  31. package/dist/internal/index/migrate-sqlite-to-lance.d.ts.map +1 -1
  32. package/dist/internal/index/migration.d.ts +1 -35
  33. package/dist/internal/index/migration.d.ts.map +1 -1
  34. package/dist/internal/index/sqlite-vec-loader.d.ts +2 -59
  35. package/dist/internal/index/sqlite-vec-loader.d.ts.map +1 -1
  36. package/dist/internal/index/vec-index.d.ts +1 -131
  37. package/dist/internal/index/vec-index.d.ts.map +1 -1
  38. package/dist/internal/store/chunk-markdown.d.ts +1 -82
  39. package/dist/internal/store/chunk-markdown.d.ts.map +1 -1
  40. package/dist/internal/store/reader.d.ts +1 -86
  41. package/dist/internal/store/reader.d.ts.map +1 -1
  42. package/package.json +3 -3
@@ -1,92 +1,2 @@
1
- import type { EmbeddingRuntime } from "../embedding/embedding-adapter.js";
2
- import { type MemoryRoot } from "../store/markdown-store.js";
3
- /**
4
- * One row of the Lance `facts` table, as it is stored. Field names are the
5
- * on-disk column names, which is why `user_id` is snake_case here while the
6
- * search result reports `userId`.
7
- *
8
- * `embedding` must be exactly as wide as the table was created with; the width
9
- * is fixed by the embedding runtime on the first open and checked on every
10
- * later one.
11
- */
12
- export interface LanceFactRecord {
13
- id: string;
14
- text: string;
15
- source: "memory" | "sessions" | "wiki";
16
- embedding: ReadonlyArray<number>;
17
- namespace: string;
18
- scope: string;
19
- user_id: string;
20
- timestamp: number;
21
- }
22
- /**
23
- * Options for `LanceIndex.open`. The embedding runtime is required, not
24
- * optional: Lance here is vector-only, so there is no text-search fallback to
25
- * open without one.
26
- */
27
- export interface OpenLanceOptions {
28
- cwd: string;
29
- /** The resolved memory root. Defaults to `<cwd>/.theokit/memory` (#463). */
30
- memoryRoot?: MemoryRoot;
31
- embedding: EmbeddingRuntime;
32
- /** Override storage location. Default: `<cwd>/.theokit/memory/lance/`. */
33
- storagePath?: string;
34
- }
35
- /**
36
- * Filters for `LanceIndex.search`. `namespace` is required and `scope` is
37
- * optional; both are applied as a SQL predicate inside Lance. `sources` is
38
- * applied in this process, after the rows come back, so it narrows the result
39
- * without narrowing what `limit` counted.
40
- */
41
- export interface LanceSearchOptions {
42
- namespace: string;
43
- scope?: string;
44
- limit?: number;
45
- sources?: ReadonlyArray<"memory" | "sessions" | "wiki">;
46
- }
47
- /**
48
- * One Lance search result. `score` is a similarity in `(0, 1]` derived from
49
- * Lance's distance as `1 / (1 + distance)`, so higher is better — the opposite
50
- * direction from the raw distance Lance returns.
51
- */
52
- export interface LanceSearchHit {
53
- id: string;
54
- text: string;
55
- source: "memory" | "sessions" | "wiki";
56
- namespace: string;
57
- scope: string;
58
- userId: string;
59
- score: number;
60
- }
61
- /**
62
- * Lance-backed memory index. Public API mirrors the SQLite one logically:
63
- * `addFacts`, `search`, `countFacts`, `removeFacts`, `close`.
64
- *
65
- * @internal
66
- */
67
- export declare class LanceIndex {
68
- private readonly table;
69
- private readonly embedding;
70
- private readonly embeddingDim;
71
- private constructor();
72
- static open(opts: OpenLanceOptions): Promise<LanceIndex>;
73
- addFacts(facts: ReadonlyArray<Omit<LanceFactRecord, "embedding">>): Promise<void>;
74
- /**
75
- * Search facts by semantic similarity. EC-1: filters use Lance's
76
- * SQL string predicate with `'` → `''` escape — bind parameters are
77
- * not supported by Lance 0.30.
78
- */
79
- search(query: string, opts: LanceSearchOptions): Promise<LanceSearchHit[]>;
80
- countFacts(namespace: string): Promise<number>;
81
- removeFacts(ids: ReadonlyArray<string>): Promise<void>;
82
- close(): Promise<void>;
83
- }
84
- /**
85
- * Test helper for {@link LanceIndex}: indicates whether the Lance module
86
- * is loadable in the current environment. Allows tests to gracefully skip
87
- * when the optional dep is absent.
88
- *
89
- * @internal
90
- */
91
- export declare function isLanceAvailable(): boolean;
1
+ export { isLanceAvailable, type LanceFactRecord, LanceIndex, type LanceSearchHit, type LanceSearchOptions, type OpenLanceOptions, } from "@theokit/sdk/internal/memory-store";
92
2
  //# 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":"AAKA,OA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;IACtB,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"}
1
+ {"version":3,"file":"lance-index.d.ts","sourceRoot":"","sources":["../../../src/internal/index/lance-index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,eAAe,EACpB,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,oCAAoC,CAAC"}
@@ -1,124 +1,25 @@
1
+ import { type LanceIndex, LanceMemoryAdapter as SharedLanceMemoryAdapter } from "@theokit/sdk/internal/memory-store";
1
2
  /**
2
- * `LanceMemoryAdapter` — wraps `LanceIndex` to expose the common
3
- * `MemoryIndex` interface (sync/search/status/close) so consumers of
4
- * `IndexManager.open({ backend: "lance" })` get a drop-in replacement
5
- * for the SQLite-backed `IndexManager`.
3
+ * Presents a `LanceIndex` as a `MemoryIndex`, so a consumer written against the SQLite index runs
4
+ * unchanged on `backend: "lance"`.
6
5
  *
7
- * Semantic deltas vs SQLite (documented so callers know what to expect):
6
+ * `sync`, `search`, `status` and `close` are the SDK's adapter, inherited rather than copied
7
+ * (#1068), so they behave the same whether or not this package is installed: `sync()` walks
8
+ * nothing and says so with `supported: false`, `search()` blends Lance's vector score with a
9
+ * term-overlap text score through the caller's `vectorWeight` / `textWeight`, and `status()`
10
+ * reports zero counts with `countsExact: false`. It always queries the `default` namespace.
8
11
  *
9
- * - `sync()` is a NO-OP. Lance is a pure vector store — there is no
10
- * markdown corpus to crawl. Returns zero counts. Consumers writing
11
- * facts use `LanceIndex.addFacts` directly (exposed via the index
12
- * object returned to advanced callers).
13
- * - `search()` performs vector-only retrieval. `MemorySearchHit.textScore`
14
- * is 0 on every hit (no FTS5 layer); `vectorScore === score`.
15
- * - `status()` always reports `backend: "hybrid"` — embedding is required
16
- * at open, so there is no text-only Lance index. Both counts are 0: the
17
- * Lance row count is only available asynchronously and `status()` is
18
- * synchronous, so callers needing a real count call
19
- * `unwrap().countFacts()`. Lance does not track file provenance per row,
20
- * so `filesIndexed` has nothing to report either way.
12
+ * The one member this class adds is {@link LanceMemoryAdapter.unwrap}. The SDK's adapter
13
+ * deliberately has no such member; this package published one, so it stays here. An index opened
14
+ * with `IndexManager.open({ backend: "lance" })` is the SDK's adapter and does not have it: to
15
+ * write facts, open a `LanceIndex` and either use it directly or wrap it with this class.
21
16
  *
22
- * Ships with the lancedb-backend-ship-v1-1 plan (close D12, supersede via
23
- * D43). v1.4.0 of `@theokit/sdk`.
24
- *
25
- * Iter 69 (Stage 3 source-move #26): hybrid copy from sdk-core's
26
- * `internal/memory/lance-memory-adapter.ts`. sdk-core retains its
27
- * copy for v1.x Lance back-compat; sdk-memory ships the canonical
28
- * copy that the future `index-manager-dispatch.ts` move will compose
29
- * with as a sibling. Dependency chain (all sibling, all moved):
30
- * - `IndexStatus`, `MemorySearchHit`, `SearchOptions` from
31
- * `./index-manager-contract.js` (moved iter 47)
32
- * - `LanceIndex` from `./lance-index.js` (moved iter 68)
33
- * - `MemoryIndex`, `parseSearchOptions`, `SyncResult` from
34
- * `./memory-index.js` (moved iter 50)
35
- *
36
- * @internal
37
- */
38
- import type { IndexStatus, MemorySearchHit, SearchOptions } from "./index-manager-contract.js";
39
- import { type MemoryIndex, type SyncResult } from "./memory-index.js";
40
- /**
41
- * **Iter 69 rollup-plugin-dts workaround** (mirrors iter 48/53/55/66/67 pattern).
42
- * Importing `LanceIndex` from sibling `./lance-index.js` fails dts
43
- * emit with `"LanceIndex" is not exported by "src/internal/lance-index.ts"`
44
- * because rollup-dts treeshakes the class when it has no public
45
- * type reaching it transitively — even though the barrel `export *`
46
- * makes it publicly callable. Same class as iter 66/67's MemoryDb.
47
- *
48
- * Fix: inline a structural mirror of the minimal LanceIndex surface
49
- * the adapter actually uses (search + close + identity for unwrap()
50
- * via `inner === actual LanceIndex`). The mirror is purely a TYPE —
51
- * the runtime continues to receive the real LanceIndex instance
52
- * unchanged. When a future move surfaces LanceIndex through a
53
- * different publicly-reachable path, this mirror MUST be deleted +
54
- * the canonical type import restored.
55
- *
56
- * @internal
57
- */
58
- interface LanceIndex {
59
- addFacts(facts: ReadonlyArray<{
60
- id: string;
61
- text: string;
62
- source: "memory" | "sessions" | "wiki";
63
- namespace: string;
64
- scope: string;
65
- user_id: string;
66
- timestamp: number;
67
- }>): Promise<void>;
68
- search(query: string, opts: {
69
- namespace: string;
70
- scope?: string;
71
- limit?: number;
72
- sources?: ReadonlyArray<"memory" | "sessions" | "wiki">;
73
- }): Promise<ReadonlyArray<{
74
- id: string;
75
- text: string;
76
- source: "memory" | "sessions" | "wiki";
77
- namespace: string;
78
- scope: string;
79
- userId: string;
80
- score: number;
81
- }>>;
82
- countFacts(namespace: string): Promise<number>;
83
- removeFacts(ids: ReadonlyArray<string>): Promise<void>;
84
- close(): Promise<void>;
85
- }
86
- /**
87
- * Presents a `LanceIndex` as a {@link MemoryIndex}, so a consumer written
88
- * against the SQLite index runs unchanged on `backend: "lance"`.
89
- *
90
- * Choose it when the corpus is large enough that SQLite plus sqlite-vec is the
91
- * bottleneck and you are willing to feed the index yourself. Stay on the SQLite
92
- * default when you want the markdown corpus crawled for you, or text matching on
93
- * exact terms: this adapter's `sync()` does nothing and its `search()` is
94
- * vector-only, so a query that would have matched by keyword now has to match by
95
- * meaning.
96
- *
97
- * Requires `@lancedb/lancedb`, an optional peer dependency. It is loaded when
98
- * the index is opened, not here.
99
- *
100
- * Two behaviours are worth knowing before switching. Facts only enter the index
101
- * through `unwrap().addFacts(...)` — nothing else writes to it. And `search()`
102
- * always queries the `default` namespace, because `SearchOptions` has no
103
- * namespace field to pass through, so a multi-tenant caller must open one index
104
- * per tenant rather than relying on the filter.
17
+ * Requires `@lancedb/lancedb`, an optional peer dependency, loaded when the index is opened.
105
18
  */
106
- export declare class LanceMemoryAdapter implements MemoryIndex {
107
- private readonly inner;
19
+ export declare class LanceMemoryAdapter extends SharedLanceMemoryAdapter {
20
+ #private;
108
21
  constructor(inner: LanceIndex);
109
- /**
110
- * No-op for Lance — see file header. Returns zero counts so callers'
111
- * existing logging (`filesScanned: X`) does not break.
112
- */
113
- sync(): Promise<SyncResult>;
114
- search(query: string, options?: SearchOptions): Promise<MemorySearchHit[]>;
115
- status(): IndexStatus;
116
- close(): Promise<void>;
117
- /**
118
- * Escape hatch for advanced callers (migration tool, benchmark script)
119
- * that need direct access to addFacts/countFacts/removeFacts.
120
- */
22
+ /** The wrapped `LanceIndex`, for `addFacts`, `countFacts` and `removeFacts`. */
121
23
  unwrap(): LanceIndex;
122
24
  }
123
- export {};
124
25
  //# sourceMappingURL=lance-memory-adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lance-memory-adapter.d.ts","sourceRoot":"","sources":["../../../src/internal/index/lance-memory-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC/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mB,YAAW,WAAW;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,UAAU;IAE9C;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC;IAO3B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAepF,MAAM,IAAI,WAAW;IAWf,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;OAGG;IACH,MAAM,IAAI,UAAU;CAGrB"}
1
+ {"version":3,"file":"lance-memory-adapter.d.ts","sourceRoot":"","sources":["../../../src/internal/index/lance-memory-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,kBAAkB,IAAI,wBAAwB,EAC/C,MAAM,oCAAoC,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAmB,SAAQ,wBAAwB;;gBAGlD,KAAK,EAAE,UAAU;IAK7B,gFAAgF;IAChF,MAAM,IAAI,UAAU;CAGrB"}
@@ -43,16 +43,7 @@ export interface SyncResult {
43
43
  chunksWritten: number;
44
44
  chunksEmbedded: number;
45
45
  }
46
- /**
47
- * Common search-options parser used by both `IndexManager.search` and
48
- * `LanceMemoryAdapter.search`. Returns the normalized cap + minimum-score
49
- * floor — eliminates jscpd duplication while keeping per-backend search
50
- * logic distinct.
51
- */
52
- export declare function parseSearchOptions(options?: SearchOptions): {
53
- maxResults: number;
54
- minScore: number;
55
- };
46
+ export { parseSearchOptions } from "@theokit/sdk/internal/memory-store";
56
47
  /**
57
48
  * The four operations both backends implement, and the type every consumer
58
49
  * should hold. `IndexManager.open` returns this rather than a concrete class
@@ -71,8 +62,8 @@ export interface MemoryIndex {
71
62
  sync(): Promise<SyncResult>;
72
63
  /**
73
64
  * Semantic + textual search over the indexed corpus. Both backends
74
- * return the same `MemorySearchHit[]` shape; Lance reports `textScore` as 0
75
- * on every hit, because it is vector-only and has no FTS5 layer.
65
+ * return the same `MemorySearchHit[]` shape. Lance has no FTS5 layer, so its
66
+ * `textScore` is the share of the query's terms found in the hit's text.
76
67
  */
77
68
  search(query: string, options?: SearchOptions): Promise<MemorySearchHit[]>;
78
69
  /** Snapshot of the index health (backend type + counts). */
@@ -1 +1 @@
1
- {"version":3,"file":"memory-index.d.ts","sourceRoot":"","sources":["../../../src/internal/index/memory-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAW/F;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,aAAkB,GAAG;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAKA;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAE5B;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAE3E,4DAA4D;IAC5D,MAAM,IAAI,WAAW,CAAC;IAEtB,0CAA0C;IAC1C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC/B"}
1
+ {"version":3,"file":"memory-index.d.ts","sourceRoot":"","sources":["../../../src/internal/index/memory-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAW/F;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAKD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAE5B;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAE3E,4DAA4D;IAC5D,MAAM,IAAI,WAAW,CAAC;IAEtB,0CAA0C;IAC1C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC/B"}
@@ -1,66 +1,2 @@
1
- /**
2
- * Migrate Memory.index from SQLite to LanceDB (ADR D44).
3
- *
4
- * EC-3 MUST FIX: validation uses NFC unicode normalization on both sides.
5
- *
6
- * Iter 71 (Stage 3 source-move #28): hybrid copy from sdk-core's
7
- * `internal/memory/migrate-sqlite-to-lance.ts`. sdk-core retains its
8
- * copy for v1.x migration back-compat; sdk-memory ships the canonical
9
- * copy.
10
- *
11
- * Dependency chain (all resolved):
12
- * - `@theokit/sdk/errors` for `ConfigurationError` (public)
13
- * - sibling `./memory-types.js` for `redactSecrets` (moved iter 52)
14
- * - sibling `./index-db.js` for `defaultIndexPath` + `openMemoryDb` (moved iter 65)
15
- * - sibling `./lance-index.js` for `LanceIndex` + `lanceStoragePath` (moved iter 68)
16
- *
17
- * @internal
18
- */
19
- export interface MigrateOptions {
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;
26
- dryRun?: boolean;
27
- batchSize?: number;
28
- /** Inject for tests; defaults to console.log. */
29
- logger?: (msg: string) => void;
30
- }
31
- /**
32
- * Outcome of {@link migrateSqliteToLance}.
33
- *
34
- * Read `committed` first: it is `false` for a dry run and for a failed
35
- * validation, and only `true` when the staging directory was promoted to
36
- * `lance/`. `validated` reports whether the counts matched and the sampled facts
37
- * compared equal; `sampleComparisons` holds up to ten of those comparisons so a
38
- * failure can be inspected rather than merely counted.
39
- *
40
- * The SQLite database is left in place either way — this migration copies, it
41
- * does not move.
42
- */
43
- export interface MigrateResult {
44
- countSqlite: number;
45
- countLance: number;
46
- /** Set when validation succeeded (or dryRun); false on validation failure. */
47
- validated: boolean;
48
- /** Per-fact compare results (size = sample count, up to 10). */
49
- sampleComparisons: ReadonlyArray<{
50
- id: string;
51
- match: boolean;
52
- }>;
53
- /** Lance storage location (final, after migration). */
54
- lancePath: string;
55
- /** Was the migration committed (false for dry-run). */
56
- committed: boolean;
57
- }
58
- /**
59
- * Run the migration. Writes Lance to `<cwd>/.theokit/memory/lance-new/`
60
- * first, validates round-trip, then renames to `lance/` on success.
61
- * SQLite db is preserved (CLI prompts user to delete).
62
- *
63
- * @internal
64
- */
65
- export declare function migrateSqliteToLance(opts: MigrateOptions): Promise<MigrateResult>;
1
+ export { type MigrateOptions, type MigrateResult, migrateSqliteToLance, } from "@theokit/sdk/internal/memory-store";
66
2
  //# sourceMappingURL=migrate-sqlite-to-lance.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"migrate-sqlite-to-lance.d.ts","sourceRoot":"","sources":["../../../src/internal/index/migrate-sqlite-to-lance.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,oBAAoB,GACrB,MAAM,oCAAoC,CAAC"}
@@ -1,36 +1,2 @@
1
- import { type MemoryConfig } from "../memory-types.js";
2
- /**
3
- * Outcome of {@link migrateLegacyJson}. `reason` is present on every non-migrated
4
- * result and says which guard stopped it: `already-migrated` (this key was
5
- * attempted earlier in this process), `no-legacy-json` (nothing to migrate, or
6
- * the file could not be read or parsed), `markdown-exists` (both files present,
7
- * so neither was touched), `readonly-fs` (the write failed).
8
- */
9
- export interface MigrationResult {
10
- migrated: boolean;
11
- factCount: number;
12
- reason?: "already-migrated" | "no-legacy-json" | "markdown-exists" | "readonly-fs";
13
- }
14
- /**
15
- * Move facts from the pre-markdown JSON store into `MEMORY.md`, once.
16
- *
17
- * It runs only when the legacy file exists and `MEMORY.md` does not. When both
18
- * exist it stops and leaves both alone — merging would need a conflict rule
19
- * nobody has picked, and losing hand-written notes is worse than skipping. On
20
- * success each fact is appended as a `## Facts` bullet and the JSON file is
21
- * deleted.
22
- *
23
- * Guarded by a per-process set keyed on cwd, namespace, scope and user id, so
24
- * the second call for the same key returns `already-migrated` without touching
25
- * disk — including after a genuine failure. That set is per module instance, so
26
- * a process that loads both this package's copy and the one inside
27
- * `@theokit/sdk` has two independent sets.
28
- *
29
- * Never throws: a JSON file that cannot be read or parsed reports
30
- * `no-legacy-json`, and a failed write reports `readonly-fs` after a warning on
31
- * stderr.
32
- */
33
- export declare function migrateLegacyJson(cwd: string, config: MemoryConfig): Promise<MigrationResult>;
34
- /** Test-only — reset the in-process migration flag map. */
35
- export declare function resetMigrationStateForTests(): void;
1
+ export { type MigrationResult, migrateLegacyJson, resetMigrationStateForTests, } from "@theokit/sdk/internal/memory-store";
36
2
  //# sourceMappingURL=migration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/internal/index/migration.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,YAAY,EAAmB,MAAM,oBAAoB,CAAC;AAqE9F;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,kBAAkB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,CAAC;CACpF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,eAAe,CAAC,CAmB1B;AAED,2DAA2D;AAC3D,wBAAgB,2BAA2B,IAAI,IAAI,CAElD"}
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/internal/index/migration.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,eAAe,EACpB,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,oCAAoC,CAAC"}
@@ -1,62 +1,5 @@
1
- /**
2
- * **Iter 66 rollup-plugin-dts workaround** (mirrors iter 48/53/55 pattern).
3
- * The canonical sdk-core copy imports `MemoryDb` from `./index-db.js`
4
- * (sibling). In sdk-memory the same interface lives in sibling
5
- * `./index-db.js` (moved iter 65) but rollup-plugin-dts treeshakes
6
- * it out of the bundled .d.ts emit because no PUBLIC type reaches it
7
- * transitively yet — sqlite-vec-loader's signatures would be the
8
- * first consumer BUT rollup-dts resolves the import BEFORE the
9
- * loader's exports are bundled into the public emit. Result:
10
- * "MemoryDb is not exported by src/internal/index-db.ts" build error.
11
- *
12
- * Fix: inline a structural mirror of the minimal MemoryDb shape that
13
- * sqlite-vec-loader actually needs (just `prepare` for the version
14
- * probe; everything else delegated via the loader's untyped
15
- * dynamic-import call to sqlite-vec's native `load`). Mirror is
16
- * narrower than the canonical contract on purpose — this file's
17
- * runtime never touches exec/close/pragma/loadExtension directly.
18
- * When a future move turns MemoryDb into a publicly-reachable type
19
- * through a different path (e.g. vec-index.ts surfacing the interface
20
- * from its own typed signatures), this mirror MUST be deleted +
21
- * the canonical import restored.
22
- *
23
- * @internal
24
- */
25
- interface MemoryDb {
26
- exec(sql: string): void;
27
- prepare(sql: string): {
28
- run(...args: unknown[]): {
29
- changes: number;
30
- lastInsertRowid: number | bigint;
31
- };
32
- get(...args: unknown[]): Record<string, unknown> | undefined;
33
- all(...args: unknown[]): Array<Record<string, unknown>>;
34
- };
35
- pragma(statement: string, options?: {
36
- simple?: boolean;
37
- }): unknown;
38
- close(): void;
39
- loadExtension(path: string): void;
40
- }
41
- /**
42
- * Load the `sqlite-vec` extension into an opened SQLite connection.
43
- *
44
- * Wraps the native `load(db)` call from the `sqlite-vec` npm package with a
45
- * typed error path (EC-8 of the edge-case review) so callers see a
46
- * `sqlite_vec_unavailable` ConfigurationError instead of a raw native error.
47
- *
48
- * Iter 66 (Stage 3 source-move #23): hybrid copy from sdk-core's
49
- * `internal/memory/sqlite-vec-loader.ts`. sdk-core retains its copy
50
- * for v1.x sqlite-vec back-compat; sdk-memory ships the canonical
51
- * copy that future `vec-index.ts` move will compose with as a
52
- * sibling. Dependency chain (all resolved):
53
- * - `@theokit/sdk/errors` for `ConfigurationError` (public)
54
- * - sibling `./index-db.js` for `MemoryDb` (moved iter 65)
55
- *
56
- * @internal
57
- */
58
- export declare function loadSqliteVecExtension(db: MemoryDb): Promise<void>;
1
+ import type { MemoryDb } from "@theokit/sdk/internal/memory-store";
2
+ export { loadSqliteVecExtension } from "@theokit/sdk/internal/memory-store";
59
3
  /** Check whether sqlite-vec is loaded by running a tiny version query. */
60
4
  export declare function isSqliteVecLoaded(db: MemoryDb): boolean;
61
- export {};
62
5
  //# sourceMappingURL=sqlite-vec-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite-vec-loader.d.ts","sourceRoot":"","sources":["../../../src/internal/index/sqlite-vec-loader.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;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;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,sBAAsB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAexE;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAOvD"}
1
+ {"version":3,"file":"sqlite-vec-loader.d.ts","sourceRoot":"","sources":["../../../src/internal/index/sqlite-vec-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAGnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAOvD"}
@@ -1,132 +1,2 @@
1
- import type { EmbeddingRuntime } from "../embedding/embedding-adapter.js";
2
- /**
3
- * **Iter 67 rollup-plugin-dts workaround** (mirrors iter 48/53/55/66 pattern).
4
- * The canonical sdk-core copy imports `MemoryDb` from sibling
5
- * `./index-db.js`. In sdk-memory the same interface lives in sibling
6
- * `./index-db.js` (moved iter 65) but rollup-dts treeshakes it
7
- * out of the bundled .d.ts emit because no PUBLIC type reaches it
8
- * transitively yet. Same pattern as iter 66 with sqlite-vec-loader.
9
- *
10
- * Fix: inline a structural mirror of the minimal MemoryDb shape this
11
- * file actually needs (exec + prepare for SQL emits, plus pragma /
12
- * close / loadExtension on the canonical surface to stay shape-compatible
13
- * with consumers passing the real MemoryDb). When a future move
14
- * surfaces MemoryDb through a different publicly-reachable path,
15
- * this mirror MUST be deleted + the canonical import restored.
16
- *
17
- * @internal
18
- */
19
- interface MemoryDb {
20
- exec(sql: string): void;
21
- prepare(sql: string): {
22
- run(...args: unknown[]): {
23
- changes: number;
24
- lastInsertRowid: number | bigint;
25
- };
26
- get(...args: unknown[]): Record<string, unknown> | undefined;
27
- all(...args: unknown[]): Array<Record<string, unknown>>;
28
- };
29
- pragma(statement: string, options?: {
30
- simple?: boolean;
31
- }): unknown;
32
- close(): void;
33
- loadExtension(path: string): void;
34
- }
35
- /**
36
- * `meta` table key holding the id of the embedding provider that produced the
37
- * vectors currently on disk (for example `openai`, `ollama`).
38
- */
39
- export declare const META_KEY_PROVIDER_ID = "embedding.providerId";
40
- /** `meta` table key holding the embedding model id the vectors were produced with. */
41
- export declare const META_KEY_MODEL = "embedding.model";
42
- /** `meta` table key holding the vector width the `embeddings` vec0 table was created with. */
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
- */
51
- export interface EmbeddingIdentity {
52
- providerId: string;
53
- model: string;
54
- dimension: number;
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
- */
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
- */
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
- */
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
- */
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
- */
94
- export declare function createVectorIndex(db: MemoryDb, dimension: number): void;
95
- /** Pack a Float32Array into a Buffer suitable for sqlite-vec BLOB binding. */
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
- */
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
- */
111
- export interface VectorHitRow {
112
- chunk_id: number;
113
- distance: number;
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
- */
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. */
125
- export interface EmbedAllArgs {
126
- db: MemoryDb;
127
- runtime: EmbeddingRuntime;
128
- }
129
- /** Embed every chunk that doesn't yet have a vector. */
130
- export declare function embedMissingChunks(args: EmbedAllArgs): Promise<number>;
131
- export {};
1
+ export { createVectorIndex, dropVectorIndex, type EmbedAllArgs, type EmbeddingIdentity, embedMissingChunks, identityMatches, META_KEY_DIMENSION, META_KEY_MODEL, META_KEY_PROVIDER_ID, packVector, readEmbeddingIdentity, upsertEmbedding, type VectorHitRow, vectorSearch, writeEmbeddingIdentity, } from "@theokit/sdk/internal/memory-store";
132
2
  //# sourceMappingURL=vec-index.d.ts.map
@@ -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,GA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