@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,67 +1,2 @@
1
- import type { ActiveMemoryResult } from "./active-memory-types.js";
2
- /**
3
- * TTL-bounded cache for `runActiveMemory` results. Keyed by
4
- * `sha256(userText + queryMode)` so two identical sends within `cacheTtlMs`
5
- * (default 15s, matching peer-project's `DEFAULT_CACHE_TTL_MS`) share a single
6
- * search.
7
- *
8
- * Bounded size; oldest entries evicted first when capacity is exceeded.
9
- *
10
- * Iter 51 (Stage 3 source-move #8): hybrid copy from sdk-core's
11
- * `internal/memory/active-memory-cache.ts`. sdk-core retains its copy
12
- * for v1.x active-memory back-compat; sdk-memory ships the canonical
13
- * copy that the future `active-memory.ts` move will target as a
14
- * sibling. Depends only on `node:crypto` + `./active-memory-types.js`
15
- * (moved iter 48), so no further dependency chain is required.
16
- *
17
- * @internal
18
- */
19
- export interface ActiveMemoryCacheOptions {
20
- ttlMs?: number;
21
- capacity?: number;
22
- now?: () => number;
23
- }
24
- /**
25
- * A bounded, TTL-expiring cache of recall results, so two identical sends in
26
- * quick succession run one search.
27
- *
28
- * Entries expire `ttlMs` after they were written (default 15s) and are dropped
29
- * on the read that finds them expired. A read that hits also moves the entry to
30
- * the most-recent position, so eviction under pressure removes the
31
- * least-recently-read entry rather than the oldest write.
32
- *
33
- * The key covers the query text, the query mode, and the tenant triple
34
- * (`namespace`, `userId`, `scope`) joined by NUL bytes. Passing no tenant
35
- * context is allowed and hashes as three empty strings — safe only when the
36
- * process serves a single tenant.
37
- *
38
- * Not process-wide: construct one per agent. Nothing here expires in the
39
- * background, so an untouched entry occupies its slot until it is read or
40
- * evicted.
41
- */
42
- export declare class ActiveMemoryCache {
43
- private readonly opts;
44
- private readonly map;
45
- constructor(opts?: ActiveMemoryCacheOptions);
46
- get(userText: string, queryMode: string, tenantCtx?: TenantContext): ActiveMemoryResult | undefined;
47
- set(userText: string, queryMode: string, result: ActiveMemoryResult, tenantCtx?: TenantContext): void;
48
- size(): number;
49
- private now;
50
- }
51
- /**
52
- * T4.9 — Tenant isolation context for cache key derivation.
53
- * Pre-T4.9 the key was `sha256(queryMode + userText)` — two users
54
- * sharing a process with the same query got each other's results.
55
- * CRITICAL cross-tenant data leak (DR4 finding #9).
56
- *
57
- * Synced from sdk-core's `internal/memory/active-memory-cache.ts`
58
- * per ADR 0002 Stage 4 routing byte-equivalence invariant (iter 112).
59
- *
60
- * @internal
61
- */
62
- export interface TenantContext {
63
- namespace?: string;
64
- userId?: string;
65
- scope?: string;
66
- }
1
+ export { ActiveMemoryCache, type ActiveMemoryCacheOptions, type TenantContext, } from "@theokit/sdk/internal/memory-store";
67
2
  //# sourceMappingURL=active-memory-cache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"active-memory-cache.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory-cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAUD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,iBAAiB;IAGhB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAiC;gBAExB,IAAI,GAAE,wBAA6B;IAEhE,GAAG,CACD,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,aAAa,GACxB,kBAAkB,GAAG,SAAS;IAcjC,GAAG,CACD,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,kBAAkB,EAC1B,SAAS,CAAC,EAAE,aAAa,GACxB,IAAI;IAYP,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,GAAG;CAGZ;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
1
+ {"version":3,"file":"active-memory-cache.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,GACnB,MAAM,oCAAoC,CAAC"}
@@ -1,55 +1,2 @@
1
- /**
2
- * Type-leaf — shared types between `active-memory.ts` and
3
- * `active-memory-cache.ts`. Extracted to break LOW type-only cycle #10
4
- * (audit `architecture-output/final_report.md`) per plan
5
- * arch-review-fixes-2026-06-06 § Phase 4 / T4.1 (D438).
6
- *
7
- * Internal — `active-memory.ts` re-exports these for in-tree consumers
8
- * that historically imported from there.
9
- *
10
- * **Iter 48 → iter 50 evolution:** the original `MemorySearchHit`
11
- * import from `./index-manager-contract.js` was temporarily inlined
12
- * as a duplicate interface because rollup-plugin-dts treeshook it out
13
- * of sdk-memory's dist (no reachable consumer yet). Iter 50 moved
14
- * `memory-index.ts` into sdk-memory and the barrel now publicly
15
- * re-exports `MemorySearchHit` — creating the reachable consumer —
16
- * so this file restores the canonical import and the inline mirror
17
- * is gone. Single source of truth is back.
18
- *
19
- * @internal
20
- */
21
- import type { MemorySearchHit } from "../index/index-manager-contract.js";
22
- /**
23
- * How the recall query is built from the conversation.
24
- *
25
- * `message` uses only the incoming user text. `recent` (the default) prepends
26
- * the last few user turns, so a follow-up like "and the other one?" still
27
- * carries its subject. `full` prepends every prior user turn, which broadens
28
- * recall but lets an old topic dominate a long conversation. Assistant turns are
29
- * never included in any mode.
30
- */
31
- export type ActiveMemoryQueryMode = "message" | "recent" | "full";
32
- /**
33
- * Outcome of one recall attempt.
34
- *
35
- * `ok` is the only status that carries a summary. `no-recall` means the search
36
- * ran and matched nothing, or the built query was empty. `skipped` means no
37
- * search was attempted at all — recall disabled, no index, or the circuit
38
- * breaker open. `timeout` means the search outlived `timeoutMs`, and `error`
39
- * that it threw. The four non-`ok` statuses are reported, never thrown: recall
40
- * failing must not fail the agent run.
41
- */
42
- export type ActiveMemoryStatus = "ok" | "timeout" | "skipped" | "no-recall" | "error";
43
- /**
44
- * Result of one recall attempt. `summary` is set only when `status` is `ok`, and
45
- * is the text the system-prompt pipeline injects. `hits` carries the underlying
46
- * matches so a caller can render its own block instead. `durationMs` covers the
47
- * search only, and is 0 on the `skipped` paths.
48
- */
49
- export interface ActiveMemoryResult {
50
- summary: string | undefined;
51
- durationMs: number;
52
- status: ActiveMemoryStatus;
53
- hits: ReadonlyArray<MemorySearchHit>;
54
- }
1
+ export type { ActiveMemoryQueryMode, ActiveMemoryResult, ActiveMemoryStatus, } from "@theokit/sdk/internal/memory-store";
55
2
  //# sourceMappingURL=active-memory-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"active-memory-types.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CACtC"}
1
+ {"version":3,"file":"active-memory-types.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory-types.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,oCAAoC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"adapter-http-error.d.ts","sourceRoot":"","sources":["../../src/internal/adapter-http-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,aAAa,EAGlB,KAAK,iBAAiB,EAEvB,MAAM,qBAAqB,CAAC;AAM7B;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOhF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAKlD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,aAAa,CAWhB;AAED,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,CA6BpF"}
1
+ {"version":3,"file":"adapter-http-error.d.ts","sourceRoot":"","sources":["../../src/internal/adapter-http-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,aAAa,EAGlB,KAAK,iBAAiB,EAEvB,MAAM,qBAAqB,CAAC;AAU7B;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOhF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAMlD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,aAAa,CAWhB;AAED,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,CAuCpF"}
@@ -1,57 +1,9 @@
1
- import type { EmbeddingRuntime } from "../embedding/embedding-adapter.js";
2
- import type { MemoryFact } from "../memory-types.js";
3
1
  /**
4
- * Dreaming/REM phase logic.
2
+ * Dreaming phases — re-exported from `@theokit/sdk`, not reimplemented here (B-444).
5
3
  *
6
- * Three phases:
7
- * - **light** — drop near-duplicate facts (cosine similarity > 0.95).
8
- * - **REM** — cluster thematically related facts (cosine ≥ 0.75).
9
- * - **deep** — pick a representative bullet per cluster (longest text
10
- * wins) and emit consolidated markdown notes.
11
- *
12
- * Iter 54 (Stage 3 source-move #11): hybrid copy from sdk-core's
13
- * `internal/memory/dreaming/phases.ts`. sdk-core retains its copy
14
- * for v1.x dreaming back-compat; sdk-memory ships the canonical copy
15
- * that future `dreaming/run.ts` move will compose with as a sibling.
16
- * Dependencies (both moved): `EmbeddingRuntime` (iter 45) +
17
- * `MemoryFact` (iter 52).
18
- *
19
- * Flat-naming convention (not `dreaming/phases.ts`): sdk-memory's
20
- * `internal/` directory stays flat to keep relative-import paths
21
- * uniform across iter 44-53. The `dreaming-` prefix preserves the
22
- * topical grouping without a sub-directory.
23
- *
24
- * @internal
25
- */
26
- export interface DedupResult {
27
- kept: MemoryFact[];
28
- duplicatesRemoved: number;
29
- }
30
- /**
31
- * A group of facts the REM phase judged related. `representativeText` is the
32
- * text of the longest member, used as the cluster's heading in the consolidated
33
- * note — longest, not most central, so it is a readable label rather than a
34
- * centroid. `members` includes that fact as well.
35
- */
36
- export interface Cluster {
37
- representativeText: string;
38
- members: ReadonlyArray<MemoryFact>;
39
- }
40
- /**
41
- * What {@link remPhase} produced. Every input fact inside the per-sweep cap
42
- * appears in exactly one cluster, so a fact related to nothing comes back as a
43
- * cluster of one — the count is not a count of *interesting* groupings. Facts
44
- * past the cap are counted in `factsLeftOut` and appear in no cluster.
4
+ * This was a copy that had already drifted: it lacked the protected-kind dedup policy. A fix in
5
+ * one copy did not reach the other, and `Memory.runDreamingSweep` runs this package's whenever it
6
+ * is installed.
45
7
  */
46
- export interface ClusterResult {
47
- clusters: Cluster[];
48
- /** How many input facts past the per-sweep cap were not clustered; 0 when none were. */
49
- factsLeftOut: number;
50
- }
51
- /** Light phase — drop facts whose embedding is too similar to one already kept. */
52
- export declare function lightPhase(facts: ReadonlyArray<MemoryFact>, embedding: EmbeddingRuntime, threshold?: number): Promise<DedupResult>;
53
- /** REM phase — single-link agglomerative clustering by cosine similarity. */
54
- export declare function remPhase(facts: ReadonlyArray<MemoryFact>, embedding: EmbeddingRuntime, threshold?: number, maxFactsPerSweep?: number): Promise<ClusterResult>;
55
- /** Deep phase — render consolidated markdown for the dreamed note. */
56
- export declare function deepPhase(clusters: ReadonlyArray<Cluster>, timestampMs: number): string;
8
+ export { type Cluster, type ClusterResult, type DedupResult, deepPhase, lightPhase, remPhase, } from "@theokit/sdk/internal/memory-store";
57
9
  //# sourceMappingURL=dreaming-phases.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dreaming-phases.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-phases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,wFAAwF;IACxF,YAAY,EAAE,MAAM,CAAC;CACtB;AAKD,mFAAmF;AACnF,wBAAsB,UAAU,CAC9B,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EAChC,SAAS,EAAE,gBAAgB,EAC3B,SAAS,GAAE,MAAgC,GAC1C,OAAO,CAAC,WAAW,CAAC,CActB;AAWD,6EAA6E;AAC7E,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EAChC,SAAS,EAAE,gBAAgB,EAC3B,SAAS,GAAE,MAAkC,EAC7C,gBAAgB,GAAE,MAAoC,GACrD,OAAO,CAAC,aAAa,CAAC,CAWxB;AAoCD,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAavF"}
1
+ {"version":3,"file":"dreaming-phases.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-phases.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,SAAS,EACT,UAAU,EACV,QAAQ,GACT,MAAM,oCAAoC,CAAC"}
@@ -1,86 +1,6 @@
1
- import type { EmbeddingRuntime } from "../embedding/embedding-adapter.js";
2
1
  /**
3
- * Dreaming sweep orchestrator (ADR D7 of memory-system-peer-project-parity).
4
- *
5
- * Phases:
6
- * 1. **light** — drop near-duplicate facts via cosine similarity.
7
- * 2. **REM** — cluster thematically related facts.
8
- * 3. **deep** — write a `notes/dreamed-<ts>.md` per sweep with consolidated
9
- * clusters; append a diary entry.
10
- *
11
- * All file writes go through `replaceFileAtomic` (EC-3). The sweep holds a
12
- * mutex for the whole run, so two sweeps over the same workspace serialize.
13
- * Note the key is `dream:<cwd>`, while `appendFactToMarkdown` locks on the
14
- * memory directory — different keys, so a concurrent `Remember:` append is NOT
15
- * excluded by this lock. It cannot corrupt a file (each write is atomic), but a
16
- * fact appended after the sweep read `MEMORY.md` is simply not in the sweep.
17
- *
18
- * Iter 60 (Stage 3 source-move #17): hybrid copy from sdk-core's
19
- * `internal/memory/dreaming/run.ts`. sdk-core retains its copy for
20
- * v1.x dreaming back-compat; sdk-memory ships the canonical
21
- * orchestrator that composes all four sibling moves from iter 45
22
- * (`EmbeddingRuntime`), iter 54 (`lightPhase`+`remPhase`+`deepPhase`),
23
- * iter 56 (`memoryDir`+`readFactsFromMarkdown`), and iter 59
24
- * (`appendDiaryEntry`). Persistence sub-path provides
25
- * `replaceFileAtomic` + `withCwdMutex`. This closes the dreaming/
26
- * cluster — 4 files all in sdk-memory now.
27
- *
28
- * Flat-naming convention (not `dreaming/run.ts`): sdk-memory's
29
- * `internal/` directory stays flat. The `dreaming-` prefix preserves
30
- * the topical grouping (companion to iter 54's `dreaming-phases` and
31
- * iter 59's `dreaming-diary`).
32
- *
33
- * @internal
2
+ * Dreaming sweep orchestrator — re-exported from `@theokit/sdk`, not reimplemented here (B-444).
3
+ * One implementation, so `Memory.runDreamingSweep` answers the same with or without this package.
34
4
  */
35
- export interface DreamingOptions {
36
- cwd: string;
37
- embedding: EmbeddingRuntime;
38
- dedupThreshold?: number;
39
- clusterThreshold?: number;
40
- /** Test hook — fixed timestamp for the run. */
41
- now?: () => number;
42
- }
43
- /**
44
- * What one sweep did. `skipped` means `MEMORY.md` held no facts; `error` means
45
- * the sweep threw and the counts are all zero.
46
- *
47
- * `factsAfter` is the count that survived in-memory deduplication, not a new
48
- * size for `MEMORY.md` — the sweep does not rewrite it, so the duplicates it
49
- * counted are still on disk and will be counted again next time. `notesWritten`
50
- * is 0 or 1: one consolidated note per sweep, holding every cluster.
51
- *
52
- * `diaryEntryHash` is currently always `undefined`, on every path including
53
- * success, even though the diary entry itself is written with a hash.
54
- */
55
- export interface DreamingResult {
56
- status: "ok" | "skipped" | "error";
57
- factsBefore: number;
58
- factsAfter: number;
59
- duplicatesRemoved: number;
60
- clustersCreated: number;
61
- notesWritten: number;
62
- diaryEntryHash: string | undefined;
63
- /**
64
- * Deduplicated facts past the per-sweep cap that were not clustered. Set on `"ok"`, 0 on
65
- * `"skipped"`, and absent on `"error"`, where the sweep cannot say how many it left out.
66
- */
67
- factsLeftOut?: number;
68
- }
69
- /**
70
- * Run one consolidation sweep over `MEMORY.md`: drop near-duplicate facts,
71
- * cluster what is left, write a consolidated note under `notes/`, and append a
72
- * diary entry.
73
- *
74
- * Every fact is embedded on each sweep, and clustering compares every pair, so
75
- * cost grows with the square of the corpus. That is why the REM phase looks at
76
- * the first 500 facts only.
77
- *
78
- * Never rejects: a failure is written to stderr and reported as
79
- * `status: "error"`, so a sweep scheduled inside an agent run cannot break it.
80
- *
81
- * The sweep is read-only with respect to `MEMORY.md`. It produces a note beside
82
- * it and leaves the fact list untouched, which means running it twice produces
83
- * two notes over the same facts.
84
- */
85
- export declare function runDreamingSweep(options: DreamingOptions): Promise<DreamingResult>;
5
+ export { type DreamingOptions, type DreamingResult, runDreamingSweep, } from "@theokit/sdk/internal/memory-store";
86
6
  //# sourceMappingURL=dreaming-run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dreaming-run.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-run.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAK1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,gBAAgB,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAElF"}
1
+ {"version":3,"file":"dreaming-run.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-run.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,gBAAgB,GACjB,MAAM,oCAAoC,CAAC"}
@@ -1,68 +1,2 @@
1
- /**
2
- * Thin wrapper around the SQLite driver. Prefers `node:sqlite` when available
3
- * (Node 22.5+) and falls back to `better-sqlite3`. Both expose nearly the
4
- * same `prepare/exec/close` surface; we normalize via a minimal adapter.
5
- *
6
- * Corrupt-DB recovery (EC-7): when opening fails with a "file is encrypted
7
- * or is not a database" or "malformed" error, the file is renamed aside to
8
- * `<path>.corrupt-<ts>` and the schema is rebuilt from scratch.
9
- *
10
- * Iter 65 (Stage 3 source-move #22): hybrid copy from sdk-core's
11
- * `internal/memory/index-db.ts`. sdk-core retains its copy for v1.x
12
- * sqlite-vec back-compat; sdk-memory ships the canonical copy that
13
- * future `sqlite-vec-loader`, `vec-index`, `index-manager` moves
14
- * will compose with. Dependency chain (all resolved):
15
- * - `@theokit/sdk/errors` for `ConfigurationError` (public)
16
- * - `@theokit/sdk/persistence` for `applyWalWithFallback`
17
- * (ADR D63 — NFS/SMB/FUSE-safe WAL adoption)
18
- * - sibling `./index-schema.js` for SCHEMA + PRAGMA statements (moved iter 49)
19
- *
20
- * @internal
21
- */
22
- export interface MemoryDb {
23
- exec(sql: string): void;
24
- prepare(sql: string): {
25
- run(...args: unknown[]): {
26
- changes: number;
27
- lastInsertRowid: number | bigint;
28
- };
29
- get(...args: unknown[]): Record<string, unknown> | undefined;
30
- all(...args: unknown[]): Array<Record<string, unknown>>;
31
- };
32
- /** SQLite `pragma()` access (used by `applyWalWithFallback`). */
33
- pragma(statement: string, options?: {
34
- simple?: boolean;
35
- }): unknown;
36
- close(): void;
37
- /** Load a SQLite loadable extension at the given path (used by sqlite-vec). */
38
- loadExtension(path: string): void;
39
- }
40
- /** Options for {@link openMemoryDb}. */
41
- export interface OpenDbOptions {
42
- filePath: string;
43
- /**
44
- * When true and opening fails with a corruption error, rename the file aside
45
- * and create a fresh DB. Default true.
46
- */
47
- recoverCorrupt?: boolean;
48
- }
49
- /**
50
- * Open (or create) the SQLite memory index at `filePath`, applying the pragmas
51
- * and creating the schema before returning. Parent directories are created as
52
- * needed, so pointing this at a fresh workspace works.
53
- *
54
- * The driver is chosen at runtime: `node:sqlite` where the running Node exposes
55
- * it, and `better-sqlite3` otherwise. `better-sqlite3` is an optional peer
56
- * dependency of this package — on a Node build without `node:sqlite` and
57
- * without it installed, opening fails.
58
- *
59
- * A file that is corrupt, truncated or encrypted is renamed aside to
60
- * `<path>.corrupt-<timestamp>` and rebuilt empty, unless `recoverCorrupt` is
61
- * `false`. Recovery loses every indexed chunk; the markdown corpus is the source
62
- * of truth and the next `sync()` rebuilds from it.
63
- *
64
- * Loading the sqlite-vec extension is a separate step — this returns an index
65
- * that can do text search only.
66
- */
67
- export declare function openMemoryDb(opts: OpenDbOptions): Promise<MemoryDb>;
1
+ export { type MemoryDb, type OpenDbOptions, openMemoryDb, } from "@theokit/sdk/internal/memory-store";
68
2
  //# 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":"AAGA;;;;;;;;;;;;;;;;;;;;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,+EAA+E;IAC/E,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;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
+ {"version":3,"file":"index-db.d.ts","sourceRoot":"","sources":["../../../src/internal/index/index-db.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,YAAY,GACb,MAAM,oCAAoC,CAAC"}
@@ -1,36 +1,2 @@
1
- /**
2
- * Dispatch helpers for `IndexManager.open`. Extracted to keep
3
- * `index-manager.ts` under the G8 400-LoC budget (lancedb-backend-ship-v1-1).
4
- *
5
- * Iter 70 (Stage 3 source-move #27): hybrid copy from sdk-core's
6
- * `internal/memory/index-manager-dispatch.ts`. sdk-core retains
7
- * its copy for v1.x back-compat; sdk-memory ships the canonical
8
- * copy that the future `index-manager.ts` move will compose with
9
- * as a sibling. Dependency chain (all sibling, all moved):
10
- * - `@theokit/sdk/errors` for `ConfigurationError` (public)
11
- * - `./index-manager-contract.js` for `MemoryBackend` +
12
- * `OpenIndexOptions` (moved iter 47)
13
- * - `./lance-index.js` for `LanceIndex` (moved iter 68)
14
- * - `./lance-memory-adapter.js` for `LanceMemoryAdapter` (moved iter 69)
15
- * - `./memory-index.js` for `MemoryIndex` (moved iter 50)
16
- *
17
- * @internal
18
- */
19
- import type { MemoryBackend, OpenIndexOptions } from "./index-manager-contract.js";
20
- import type { MemoryIndex } from "./memory-index.js";
21
- /** Valid backend identifiers — runtime guard against TS-narrowing escapes (EC-1). */
22
- export declare const VALID_BACKENDS: readonly MemoryBackend[];
23
- /**
24
- * EC-1: runtime guard for `opts.backend`. TS union is compile-time only;
25
- * consumers passing JS `as any` typos must hit a typed error, not silent
26
- * SQLite fallback.
27
- */
28
- export declare function assertValidBackend(backend: string): asserts backend is MemoryBackend;
29
- /**
30
- * Lance-path open. Throws `lance_requires_embedding` when no embedding
31
- * runtime is provided (Lance is vector-only — no FTS fallback).
32
- * Surfaces `lance_backend_unavailable` from LanceIndex.open when peer
33
- * dep is absent.
34
- */
35
- export declare function openLanceIndex(opts: OpenIndexOptions): Promise<MemoryIndex>;
1
+ export { assertValidBackend, openLanceIndex, VALID_BACKENDS, } from "@theokit/sdk/internal/memory-store";
36
2
  //# sourceMappingURL=index-manager-dispatch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-manager-dispatch.d.ts","sourceRoot":"","sources":["../../../src/internal/index/index-manager-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAGnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,qFAAqF;AACrF,eAAO,MAAM,cAAc,EAAE,SAAS,aAAa,EAA4B,CAAC;AAEhF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,IAAI,aAAa,CAOpF;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CAajF"}
1
+ {"version":3,"file":"index-manager-dispatch.d.ts","sourceRoot":"","sources":["../../../src/internal/index/index-manager-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,GACf,MAAM,oCAAoC,CAAC"}
@@ -1,131 +1,2 @@
1
- import type { EmbeddingRuntime } from "../embedding/embedding-adapter.js";
2
- import { type MemoryRoot } from "../store/markdown-store.js";
3
- import { type MemoryIndex } from "./memory-index.js";
4
- /**
5
- * Memory index manager (ADR D2). FTS5-only at Phase 3; vector index lands in
6
- * Phase 5.
7
- *
8
- * Lifecycle:
9
- * const idx = await IndexManager.open({ cwd });
10
- * await idx.sync();
11
- * const hits = await idx.search("query");
12
- * idx.close();
13
- *
14
- * Iter 72 (Stage 3 source-move #29): hybrid copy from sdk-core's
15
- * `internal/memory/index-manager.ts`. sdk-core retains its copy for
16
- * v1.x back-compat; sdk-memory ships the canonical orchestrator
17
- * composing every prior Stage 3 move (sqlite-vec stack iter 47/49/50/53/55-57/62/65-67,
18
- * lance stack iter 68-70, storage iter 56). The biggest move of the
19
- * stage at 446 LOC — closes the index/ cluster.
20
- *
21
- * @internal
22
- */
23
- interface MemorySearchHit {
24
- readonly path: string;
25
- readonly startLine: number;
26
- readonly endLine: number;
27
- readonly score: number;
28
- readonly textScore: number;
29
- readonly vectorScore?: number;
30
- readonly snippet: string;
31
- readonly source: "memory" | "sessions" | "wiki";
32
- readonly citation: string;
33
- }
34
- interface IndexStatus {
35
- backend: "fts-only" | "hybrid";
36
- filesIndexed: number;
37
- chunksIndexed: number;
38
- lastSyncMs?: number;
39
- }
40
- interface SearchOptions {
41
- maxResults?: number;
42
- minScore?: number;
43
- vectorWeight?: number;
44
- textWeight?: number;
45
- sources?: ReadonlyArray<"memory" | "sessions" | "wiki">;
46
- }
47
- interface OpenIndexOptions {
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;
56
- filePath?: string;
57
- embedding?: EmbeddingRuntime;
58
- backend?: "sqlite-vec" | "lance";
59
- }
60
- /**
61
- * The default memory index: SQLite for storage, FTS5 for text matching, and
62
- * sqlite-vec for vectors when an embedding runtime is supplied.
63
- *
64
- * Open it with the static `open`, which is also the dispatch point for
65
- * `backend: "lance"` — that overload returns a `LanceMemoryAdapter`, not an
66
- * `IndexManager`, so hold the result as {@link MemoryIndex} unless you need this
67
- * class specifically.
68
- *
69
- * Storage needs `better-sqlite3` unless the running Node exposes `node:sqlite`,
70
- * and vectors additionally need `sqlite-vec`. Both are optional peer
71
- * dependencies of this package. Without an embedding runtime the index opens
72
- * text-only and reports `backend: "fts-only"`; no vector table is created and
73
- * search degrades to BM25 rather than failing.
74
- *
75
- * `sync()` crawls the markdown corpus — `MEMORY.md`, `notes/`, `wiki/` and
76
- * `sessions/` — skipping files whose content hash has not moved, and re-chunking
77
- * the rest. Nothing is indexed until it runs.
78
- *
79
- * If the embedding provider, model or dimension differs from what the database
80
- * recorded, opening drops the whole vector table so the next `sync()` re-embeds
81
- * from scratch. Switching embedding models is therefore safe but not cheap.
82
- *
83
- * `search()` runs both halves and blends them per chunk, so a chunk found only
84
- * by vector still appears with a text score of 0 and the other way round.
85
- * `close()` releases the database handle; it is synchronous here, unlike the
86
- * Lance adapter's, so a caller holding the {@link MemoryIndex} type must await
87
- * it either way.
88
- */
89
- export declare class IndexManager implements MemoryIndex {
90
- private readonly memoryRoot;
91
- private readonly db;
92
- private readonly embedding;
93
- private lastSyncMs;
94
- private vectorReady;
95
- private constructor();
96
- /**
97
- * Open a memory index. Dispatches to SQLite (default) or Lance (opt-in
98
- * via `backend: "lance"`). See `openLanceIndex` for Lance-specific
99
- * preconditions + typed errors.
100
- */
101
- static open(opts: OpenIndexOptions & {
102
- backend: "lance";
103
- }): Promise<MemoryIndex>;
104
- static open(opts: Omit<OpenIndexOptions, "backend"> | (OpenIndexOptions & {
105
- backend?: "sqlite-vec";
106
- })): Promise<IndexManager>;
107
- /** Internal SQLite-path open. Renamed from previous public `open`. */
108
- private static openSqliteInternal;
109
- private initVectorBackend;
110
- /** Walk the memory corpus + (re)index changed files. */
111
- sync(): Promise<{
112
- filesScanned: number;
113
- filesUpdated: number;
114
- chunksWritten: number;
115
- chunksEmbedded: number;
116
- }>;
117
- search(query: string, options?: SearchOptions): Promise<MemorySearchHit[]>;
118
- status(): IndexStatus;
119
- private ftsSearch;
120
- private vectorSearchById;
121
- private combineHybridScores;
122
- private mergeHits;
123
- private fetchChunksByIds;
124
- private loadFilesIndex;
125
- private upsertFile;
126
- private deleteChunksForFile;
127
- private insertChunk;
128
- close(): void;
129
- }
130
- export {};
1
+ export { IndexManager } from "@theokit/sdk/internal/memory-store";
131
2
  //# sourceMappingURL=index-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-manager.d.ts","sourceRoot":"","sources":["../../../src/internal/index/index-manager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,KAAK,WAAW,EAAsB,MAAM,mBAAmB,CAAC;AAYzE;;;;;;;;;;;;;;;;;;GAkBG;AAmBH,UAAU,eAAe;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,UAAU,WAAW;IACnB,OAAO,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,aAAa;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,aAAa,CAAC,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC;CACzD;AAED,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,YAAa,YAAW,WAAW;IAK5C,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,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
+ {"version":3,"file":"index-manager.d.ts","sourceRoot":"","sources":["../../../src/internal/index/index-manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC"}
@@ -1,30 +1,2 @@
1
- /**
2
- * SQLite schema for the memory index.
3
- *
4
- * Tables:
5
- * - files — one row per indexed markdown file (path, mtime, hash).
6
- * - chunks — one row per chunk produced by `chunkMarkdown`.
7
- * - chunks_fts — FTS5 virtual table mirroring chunks.text for BM25 search.
8
- * - meta — key/value store; persists the active embedding identity
9
- * (provider id, model, dimension) so we detect when the
10
- * index was built against a different embedding setup.
11
- * - embeddings — sqlite-vec virtual table holding the chunk vectors
12
- * (created on demand by `vec-index.ts`).
13
- *
14
- * Iter 49 (Stage 3 source-move #6): pure SQL-string leaf copied from
15
- * sdk-core's `internal/memory/index-schema.ts`. Hybrid dual-copy per
16
- * Phase 2 Stage 1 precedent — sdk-core retains its copy for v1.x
17
- * back-compat; sdk-memory ships the canonical copy that future
18
- * sqlite/lance index moves (`index-db`, `index-manager`, `vec-index`,
19
- * `lance-index`) will target as siblings.
20
- *
21
- * @internal
22
- */
23
- export declare const SCHEMA_STATEMENTS: ReadonlyArray<string>;
24
- /**
25
- * Non-WAL pragmas. WAL is applied separately via
26
- * `applyWalWithFallback` (T4.2, ADR D63) so NFS/SMB users get a graceful
27
- * DELETE fallback instead of crashing.
28
- */
29
- export declare const PRAGMA_STATEMENTS: ReadonlyArray<string>;
1
+ export { PRAGMA_STATEMENTS, SCHEMA_STATEMENTS } from "@theokit/sdk/internal/memory-store";
30
2
  //# sourceMappingURL=index-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-schema.d.ts","sourceRoot":"","sources":["../../../src/internal/index/index-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAkCnD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAGnD,CAAC"}
1
+ {"version":3,"file":"index-schema.d.ts","sourceRoot":"","sources":["../../../src/internal/index/index-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC"}