@theokit/sdk 4.58.0 → 4.60.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 (66) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/{agent-MIYY7TXV.cjs → agent-26RMDG4U.cjs} +8 -7
  3. package/dist/{agent-MIYY7TXV.cjs.map → agent-26RMDG4U.cjs.map} +1 -1
  4. package/dist/{agent-6WM4QOWS.js → agent-6ABK2DPG.js} +7 -6
  5. package/dist/{agent-6WM4QOWS.js.map → agent-6ABK2DPG.js.map} +1 -1
  6. package/dist/{chunk-N47KLTKD.cjs → chunk-23GPJGRR.cjs} +45 -28
  7. package/dist/chunk-23GPJGRR.cjs.map +1 -0
  8. package/dist/{chunk-QIRDQZYL.cjs → chunk-3HDTP4ZO.cjs} +4 -4
  9. package/dist/{chunk-QIRDQZYL.cjs.map → chunk-3HDTP4ZO.cjs.map} +1 -1
  10. package/dist/{chunk-GNT35C5U.cjs → chunk-6SBW4QR2.cjs} +2 -2
  11. package/dist/{chunk-GNT35C5U.cjs.map → chunk-6SBW4QR2.cjs.map} +1 -1
  12. package/dist/{chunk-CF5OMCZG.js → chunk-76XTUTKY.js} +34 -17
  13. package/dist/chunk-76XTUTKY.js.map +1 -0
  14. package/dist/{chunk-WLZ7XRWH.js → chunk-7OXXYBHD.js} +7 -179
  15. package/dist/chunk-7OXXYBHD.js.map +1 -0
  16. package/dist/{chunk-5QOIQJ5J.js → chunk-E5MWNLRX.js} +3 -3
  17. package/dist/{chunk-5QOIQJ5J.js.map → chunk-E5MWNLRX.js.map} +1 -1
  18. package/dist/{chunk-XV4IZNV4.js → chunk-FUL2I7G5.js} +2 -2
  19. package/dist/{chunk-XV4IZNV4.js.map → chunk-FUL2I7G5.js.map} +1 -1
  20. package/dist/chunk-JVERBPRD.js +191 -0
  21. package/dist/chunk-JVERBPRD.js.map +1 -0
  22. package/dist/chunk-NY25NBZB.cjs +203 -0
  23. package/dist/chunk-NY25NBZB.cjs.map +1 -0
  24. package/dist/{chunk-27AXGJMV.cjs → chunk-Y2KJ7MYO.cjs} +14 -194
  25. package/dist/chunk-Y2KJ7MYO.cjs.map +1 -0
  26. package/dist/cron.cjs +7 -6
  27. package/dist/cron.js +6 -5
  28. package/dist/eval.cjs +6 -5
  29. package/dist/eval.cjs.map +1 -1
  30. package/dist/eval.js +5 -4
  31. package/dist/eval.js.map +1 -1
  32. package/dist/{index-manager-WYESAVTX.js → index-manager-KP2JAXKN.js} +4 -3
  33. package/dist/{index-manager-WYESAVTX.js.map → index-manager-KP2JAXKN.js.map} +1 -1
  34. package/dist/{index-manager-J2QIDI6I.cjs → index-manager-YUORPS4G.cjs} +5 -4
  35. package/dist/{index-manager-J2QIDI6I.cjs.map → index-manager-YUORPS4G.cjs.map} +1 -1
  36. package/dist/index.cjs +35 -34
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.js +12 -11
  39. package/dist/index.js.map +1 -1
  40. package/dist/internal/memory/storage/chunk-markdown.d.cts +2 -0
  41. package/dist/internal/memory/storage/index.cjs +54 -0
  42. package/dist/internal/memory/storage/index.cjs.map +1 -0
  43. package/dist/internal/memory/storage/index.d.cts +18 -0
  44. package/dist/internal/memory/storage/index.d.ts +18 -0
  45. package/dist/internal/memory/storage/index.js +13 -0
  46. package/dist/internal/memory/storage/index.js.map +1 -0
  47. package/dist/internal/memory/storage/markdown-store.d.cts +77 -0
  48. package/dist/internal/memory/storage/markdown-store.d.ts +46 -5
  49. package/dist/internal/memory/storage/memory-file.d.cts +54 -0
  50. package/dist/internal/memory/storage/reader.d.cts +8 -0
  51. package/dist/internal/memory/storage/session-loader.d.cts +1 -0
  52. package/dist/internal/memory/storage/session-summary-writer.d.cts +2 -0
  53. package/dist/internal/memory/storage/transcript-store.d.cts +1 -0
  54. package/dist/internal/memory/storage/wiki-loader.d.cts +2 -0
  55. package/dist/internal/persistence/session-dir.d.cts +15 -0
  56. package/dist/internal/persistence/session-dir.d.ts +15 -0
  57. package/dist/internal/runtime/memory/memory-store.d.ts +2 -2
  58. package/dist/workflow.cjs +9 -9
  59. package/dist/workflow.js +1 -1
  60. package/docs/error-codes.md +1 -1
  61. package/docs/harness-capability-map.md +15 -1
  62. package/package.json +11 -1
  63. package/dist/chunk-27AXGJMV.cjs.map +0 -1
  64. package/dist/chunk-CF5OMCZG.js.map +0 -1
  65. package/dist/chunk-N47KLTKD.cjs.map +0 -1
  66. package/dist/chunk-WLZ7XRWH.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import type { MemoryChunk } from "../types.js";
2
+ export declare function chunkMarkdown(text: string, options?: ChunkMarkdownOptions): MemoryChunk[];
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ var chunkNY25NBZB_cjs = require('../../../chunk-NY25NBZB.cjs');
4
+ require('../../../chunk-KRD3GQAA.cjs');
5
+ require('../../../chunk-MUUQ2WFJ.cjs');
6
+ require('../../../chunk-R3UPQFKK.cjs');
7
+ require('../../../chunk-VKJ7V7EB.cjs');
8
+ require('../../../chunk-BUIK7GUA.cjs');
9
+ require('../../../chunk-ZF2LDKQQ.cjs');
10
+ require('../../../chunk-I6TGFUCO.cjs');
11
+ require('../../../chunk-K3FW2XZD.cjs');
12
+ require('../../../chunk-JTB5Q42C.cjs');
13
+ require('../../../chunk-NUKRL3I6.cjs');
14
+
15
+
16
+
17
+ Object.defineProperty(exports, "appendFact", {
18
+ enumerable: true,
19
+ get: function () { return chunkNY25NBZB_cjs.appendFact; }
20
+ });
21
+ Object.defineProperty(exports, "appendFactToMarkdown", {
22
+ enumerable: true,
23
+ get: function () { return chunkNY25NBZB_cjs.appendFactToMarkdown; }
24
+ });
25
+ Object.defineProperty(exports, "claudeProjectMemoryDir", {
26
+ enumerable: true,
27
+ get: function () { return chunkNY25NBZB_cjs.claudeProjectMemoryDir; }
28
+ });
29
+ Object.defineProperty(exports, "memoryDir", {
30
+ enumerable: true,
31
+ get: function () { return chunkNY25NBZB_cjs.memoryDir; }
32
+ });
33
+ Object.defineProperty(exports, "memoryMdPath", {
34
+ enumerable: true,
35
+ get: function () { return chunkNY25NBZB_cjs.memoryMdPath; }
36
+ });
37
+ Object.defineProperty(exports, "memoryWriteDir", {
38
+ enumerable: true,
39
+ get: function () { return chunkNY25NBZB_cjs.memoryWriteDir; }
40
+ });
41
+ Object.defineProperty(exports, "notesDir", {
42
+ enumerable: true,
43
+ get: function () { return chunkNY25NBZB_cjs.notesDir; }
44
+ });
45
+ Object.defineProperty(exports, "readFacts", {
46
+ enumerable: true,
47
+ get: function () { return chunkNY25NBZB_cjs.readFacts; }
48
+ });
49
+ Object.defineProperty(exports, "readFactsFromMarkdown", {
50
+ enumerable: true,
51
+ get: function () { return chunkNY25NBZB_cjs.readFactsFromMarkdown; }
52
+ });
53
+ //# sourceMappingURL=index.cjs.map
54
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * #430 — the ONE markdown memory store, shared with `@theokit/sdk-memory`.
3
+ *
4
+ * The satellite carried a full copy, and `Memory.runDreamingSweep` REPLACES this one with the
5
+ * peer's whenever the peer is installed — so the copy that ran was not the copy most people read.
6
+ * The copy stayed on the pre-#389 layout (bullets under `MEMORY.md ## Facts`) while this one moved
7
+ * to a file per memory, which meant installing `@theokit/sdk-memory` made every memory the SDK had
8
+ * written unreadable. It reported `factsBefore: 0`, indistinguishable from an empty store.
9
+ *
10
+ * This is the same defect theokit#160 fixed for the embedding runtime, in the same package pair,
11
+ * with the same remedy: one implementation, imported by both. A second copy is a second place for
12
+ * the layout to drift, and the drift is silent by construction — nothing fails, facts just stop
13
+ * being found.
14
+ *
15
+ * Semver-exempt: NOT part of the stable `@theokit/sdk` API. The sub-path IS declared in
16
+ * `package.json` `exports`, so the names below must survive into the published declarations.
17
+ */
18
+ export { appendFact, appendFactToMarkdown, claudeProjectMemoryDir, memoryDir, memoryMdPath, memoryWriteDir, notesDir, readFacts, readFactsFromMarkdown, } from "./markdown-store.js";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * #430 — the ONE markdown memory store, shared with `@theokit/sdk-memory`.
3
+ *
4
+ * The satellite carried a full copy, and `Memory.runDreamingSweep` REPLACES this one with the
5
+ * peer's whenever the peer is installed — so the copy that ran was not the copy most people read.
6
+ * The copy stayed on the pre-#389 layout (bullets under `MEMORY.md ## Facts`) while this one moved
7
+ * to a file per memory, which meant installing `@theokit/sdk-memory` made every memory the SDK had
8
+ * written unreadable. It reported `factsBefore: 0`, indistinguishable from an empty store.
9
+ *
10
+ * This is the same defect theokit#160 fixed for the embedding runtime, in the same package pair,
11
+ * with the same remedy: one implementation, imported by both. A second copy is a second place for
12
+ * the layout to drift, and the drift is silent by construction — nothing fails, facts just stop
13
+ * being found.
14
+ *
15
+ * Semver-exempt: NOT part of the stable `@theokit/sdk` API. The sub-path IS declared in
16
+ * `package.json` `exports`, so the names below must survive into the published declarations.
17
+ */
18
+ export { appendFact, appendFactToMarkdown, claudeProjectMemoryDir, memoryDir, memoryMdPath, memoryWriteDir, notesDir, readFacts, readFactsFromMarkdown, } from "./markdown-store.js";
@@ -0,0 +1,13 @@
1
+ export { appendFact, appendFactToMarkdown, claudeProjectMemoryDir, memoryDir, memoryMdPath, memoryWriteDir, notesDir, readFacts, readFactsFromMarkdown } from '../../../chunk-JVERBPRD.js';
2
+ import '../../../chunk-KVNWIAO4.js';
3
+ import '../../../chunk-FD2UT76F.js';
4
+ import '../../../chunk-QARJGQSA.js';
5
+ import '../../../chunk-RIAM53CP.js';
6
+ import '../../../chunk-FKMUFNQE.js';
7
+ import '../../../chunk-Q5EWJPRY.js';
8
+ import '../../../chunk-VF7EWVDG.js';
9
+ import '../../../chunk-IDCKSLYH.js';
10
+ import '../../../chunk-T7XEKOVW.js';
11
+ import '../../../chunk-T7O6K6PX.js';
12
+ //# sourceMappingURL=index.js.map
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,77 @@
1
+ import { type MemoryConfig, type MemoryFact } from "../types.js";
2
+ /**
3
+ * The memory root for a workspace: `<cwd>/.theokit/memory`. Every other path here derives from it,
4
+ * and `memory_get` refuses to read outside it. Pure path computation — nothing is created on disk.
5
+ */
6
+ export declare function memoryDir(cwd: string): string;
7
+ /**
8
+ * Where a NEW fact should be written.
9
+ *
10
+ * `.theokit/memory` by default, exactly as before. When the agent was given a `local.sessionDir`,
11
+ * it becomes `<sessionDir>/projects/<encoded-cwd>/memory` — the same place the transcript for that
12
+ * project goes, so a session and the memories recorded during it land beside each other.
13
+ *
14
+ * `local.sessionDir` is the switch because it is already the option this project documents for CLI
15
+ * interop: point it at `~/.claude` and the CLI can `--continue` a session this agent wrote. Someone
16
+ * who set it has said they share state with that CLI, and memory following is what the sentence
17
+ * already implied. It needs no new option, and nothing moves for anyone who never set it.
18
+ *
19
+ * Safe because of the rule this pairs with — WRITE ONE, READ ALL. {@link readFactsFromMarkdown}
20
+ * covers every location, so a consumer whose new facts move keeps every fact they already had. The
21
+ * change relocates where the next one lands; it orphans nothing.
22
+ */
23
+ export declare function memoryWriteDir(cwd: string, sessionDir: string | undefined): string;
24
+ /**
25
+ * Where the Claude Code CLI keeps THIS project's memories.
26
+ *
27
+ * `<claudeHome>/projects/<encoded-cwd>/memory` — the same `encodeProjectDir` scheme the transcripts
28
+ * already use, which is why no new encoding is invented here. `CLAUDE_CONFIG_DIR` names the home
29
+ * when set (the CLI's own variable); `~/.claude` otherwise.
30
+ *
31
+ * Read, never written. Writing here by default would relocate every existing consumer's memories,
32
+ * and an additive change must not move what is already on disk — so this is the direction that
33
+ * costs nothing: a memory the CLI wrote becomes visible, and a memory the SDK wrote stays where the
34
+ * SDK put it.
35
+ */
36
+ export declare function claudeProjectMemoryDir(cwd: string): string;
37
+ /**
38
+ * Path to `MEMORY.md`, the index that points at the per-memory files — and, in stores written before
39
+ * #389, the flat `## Facts` list itself. Pure path computation; the file may not exist.
40
+ */
41
+ export declare function memoryMdPath(cwd: string): string;
42
+ /**
43
+ * Path to `<memory root>/notes`, where per-topic notes and the consolidated notes a dreaming sweep
44
+ * writes live. Pure path computation — the directory may not exist.
45
+ */
46
+ export declare function notesDir(cwd: string): string;
47
+ /**
48
+ * Every memory in the store: the per-memory files, plus any legacy `## Facts` bullets still in
49
+ * `MEMORY.md`. Returns `[]` when the directory does not exist.
50
+ *
51
+ * Reading both is not transitional politeness. Those bullets are already on disk in consumers'
52
+ * repositories, and the store's own header invites editing them by hand — a converged writer that
53
+ * stopped reading them would delete what someone recorded, which is worse than the format it fixes.
54
+ */
55
+ export declare function readFactsFromMarkdown(cwd: string, sessionDir?: string): Promise<MemoryFact[]>;
56
+ /**
57
+ * Write a fact as its own memory file and point the `MEMORY.md` index at it. Atomic + serialized.
58
+ *
59
+ * `modified` is stamped HERE and never read from `fact`: a timestamp a caller can set is a
60
+ * timestamp that can lie about when something was learned, and weighing recency is the point.
61
+ */
62
+ export declare function appendFactToMarkdown(cwd: string, fact: MemoryFact, targetDir?: string): Promise<void>;
63
+ /**
64
+ * Every memory in the store, honouring the `enabled` gate on {@link MemoryConfig}: when memory is
65
+ * disabled the call resolves to `[]` without touching disk. Configuration-aware entry point;
66
+ * {@link readFactsFromMarkdown} is the same read without the gate.
67
+ */
68
+ export declare function readFacts(cwd: string, config: MemoryConfig, memoryHome?: string): Promise<MemoryFact[]>;
69
+ /**
70
+ * Record a fact, honouring the `enabled` gate on {@link MemoryConfig}: when memory is disabled the
71
+ * call resolves without touching disk. Configuration-aware entry point;
72
+ * {@link appendFactToMarkdown} is the same write without the gate.
73
+ *
74
+ * `memoryHome` is the agent's `local.sessionDir` when it has one — see {@link memoryWriteDir} for
75
+ * which store that sends the fact to.
76
+ */
77
+ export declare function appendFact(cwd: string, config: MemoryConfig, fact: MemoryFact, memoryHome?: string): Promise<void>;
@@ -1,5 +1,26 @@
1
1
  import { type MemoryConfig, type MemoryFact } from "../types.js";
2
+ /**
3
+ * The memory root for a workspace: `<cwd>/.theokit/memory`. Every other path here derives from it,
4
+ * and `memory_get` refuses to read outside it. Pure path computation — nothing is created on disk.
5
+ */
2
6
  export declare function memoryDir(cwd: string): string;
7
+ /**
8
+ * Where a NEW fact should be written.
9
+ *
10
+ * `.theokit/memory` by default, exactly as before. When the agent was given a `local.sessionDir`,
11
+ * it becomes `<sessionDir>/projects/<encoded-cwd>/memory` — the same place the transcript for that
12
+ * project goes, so a session and the memories recorded during it land beside each other.
13
+ *
14
+ * `local.sessionDir` is the switch because it is already the option this project documents for CLI
15
+ * interop: point it at `~/.claude` and the CLI can `--continue` a session this agent wrote. Someone
16
+ * who set it has said they share state with that CLI, and memory following is what the sentence
17
+ * already implied. It needs no new option, and nothing moves for anyone who never set it.
18
+ *
19
+ * Safe because of the rule this pairs with — WRITE ONE, READ ALL. {@link readFactsFromMarkdown}
20
+ * covers every location, so a consumer whose new facts move keeps every fact they already had. The
21
+ * change relocates where the next one lands; it orphans nothing.
22
+ */
23
+ export declare function memoryWriteDir(cwd: string, sessionDir: string | undefined): string;
3
24
  /**
4
25
  * Where the Claude Code CLI keeps THIS project's memories.
5
26
  *
@@ -13,7 +34,15 @@ export declare function memoryDir(cwd: string): string;
13
34
  * SDK put it.
14
35
  */
15
36
  export declare function claudeProjectMemoryDir(cwd: string): string;
37
+ /**
38
+ * Path to `MEMORY.md`, the index that points at the per-memory files — and, in stores written before
39
+ * #389, the flat `## Facts` list itself. Pure path computation; the file may not exist.
40
+ */
16
41
  export declare function memoryMdPath(cwd: string): string;
42
+ /**
43
+ * Path to `<memory root>/notes`, where per-topic notes and the consolidated notes a dreaming sweep
44
+ * writes live. Pure path computation — the directory may not exist.
45
+ */
17
46
  export declare function notesDir(cwd: string): string;
18
47
  /**
19
48
  * Every memory in the store: the per-memory files, plus any legacy `## Facts` bullets still in
@@ -23,14 +52,26 @@ export declare function notesDir(cwd: string): string;
23
52
  * repositories, and the store's own header invites editing them by hand — a converged writer that
24
53
  * stopped reading them would delete what someone recorded, which is worse than the format it fixes.
25
54
  */
26
- export declare function readFactsFromMarkdown(cwd: string): Promise<MemoryFact[]>;
55
+ export declare function readFactsFromMarkdown(cwd: string, sessionDir?: string): Promise<MemoryFact[]>;
27
56
  /**
28
57
  * Write a fact as its own memory file and point the `MEMORY.md` index at it. Atomic + serialized.
29
58
  *
30
59
  * `modified` is stamped HERE and never read from `fact`: a timestamp a caller can set is a
31
60
  * timestamp that can lie about when something was learned, and weighing recency is the point.
32
61
  */
33
- export declare function appendFactToMarkdown(cwd: string, fact: MemoryFact): Promise<void>;
34
- /** Configuration-aware accessors honoring the existing MemoryConfig contract. */
35
- export declare function readFacts(cwd: string, config: MemoryConfig): Promise<MemoryFact[]>;
36
- export declare function appendFact(cwd: string, config: MemoryConfig, fact: MemoryFact): Promise<void>;
62
+ export declare function appendFactToMarkdown(cwd: string, fact: MemoryFact, targetDir?: string): Promise<void>;
63
+ /**
64
+ * Every memory in the store, honouring the `enabled` gate on {@link MemoryConfig}: when memory is
65
+ * disabled the call resolves to `[]` without touching disk. Configuration-aware entry point;
66
+ * {@link readFactsFromMarkdown} is the same read without the gate.
67
+ */
68
+ export declare function readFacts(cwd: string, config: MemoryConfig, memoryHome?: string): Promise<MemoryFact[]>;
69
+ /**
70
+ * Record a fact, honouring the `enabled` gate on {@link MemoryConfig}: when memory is disabled the
71
+ * call resolves without touching disk. Configuration-aware entry point;
72
+ * {@link appendFactToMarkdown} is the same write without the gate.
73
+ *
74
+ * `memoryHome` is the agent's `local.sessionDir` when it has one — see {@link memoryWriteDir} for
75
+ * which store that sends the fact to.
76
+ */
77
+ export declare function appendFact(cwd: string, config: MemoryConfig, fact: MemoryFact, memoryHome?: string): Promise<void>;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * One memory as a file, in the shape the Claude Code CLI reads.
3
+ *
4
+ * `@theokit/sdk` already writes native Claude Code `.jsonl` sessions — the README's differentiator
5
+ * is "point `local.sessionDir` at `~/.claude` and the Claude Code CLI can `--continue` a session
6
+ * your agent wrote". Memory had no such convergence: a fact was a bullet under `## Facts` with its
7
+ * kind in an HTML comment (#389), which that CLI reads as prose. Pointing a memory directory at
8
+ * `~/.claude/projects/<project>/memory/` produced nothing it could open.
9
+ *
10
+ * The contract here was measured against a real store rather than inferred from documentation. Of
11
+ * nine files, all nine carry `name`, `description` and `metadata.type`; six also carry
12
+ * `node_type`, `originSessionId` and `modified`, which the runtime stamps on write. So the minimum
13
+ * a reader must accept is the first three — refusing the rest would refuse memories the CLI itself
14
+ * accepts.
15
+ *
16
+ * `originSessionId` is deliberately not written. It identifies the session that learned the fact,
17
+ * and the append path has no session in scope; inventing one would be worse than omitting a field
18
+ * the format already treats as optional.
19
+ *
20
+ * @internal
21
+ */
22
+ import { type MemoryKind } from "../types.js";
23
+ /** The fields one memory file carries. */
24
+ export interface MemoryFileFields {
25
+ /** Slug, and the file's basename. */
26
+ readonly name: string;
27
+ /** One-line summary — what the index shows and what recall ranks. */
28
+ readonly description: string;
29
+ /** `metadata.type`, absent when the file does not declare one this contract admits. */
30
+ readonly kind?: MemoryKind;
31
+ /** `metadata.modified`, an ISO 8601 instant stamped by whoever wrote the file. */
32
+ readonly modified?: string;
33
+ /** The markdown after the frontmatter. */
34
+ readonly body: string;
35
+ }
36
+ /**
37
+ * A readable, filesystem-safe slug for `text`.
38
+ *
39
+ * Readability is the goal — a directory of `h-3f2a…` files is a directory nobody browses — but it
40
+ * is not the floor. The text comes from whatever a caller learned, so anything that fails the safe
41
+ * grammar falls back to {@link safeFilenameForId}, which is total and always yields a valid
42
+ * component.
43
+ */
44
+ export declare function slugForFact(text: string): string;
45
+ /** Render one memory file. `description` is quoted so a colon in the text cannot break the block. */
46
+ export declare function renderMemoryFile(fields: MemoryFileFields): string;
47
+ /**
48
+ * Read one memory file, or `undefined` when the content is not one.
49
+ *
50
+ * `undefined` rather than a throw, and rather than a best-effort object: the directory holds
51
+ * hand-written notes and a `MEMORY.md` index alongside the memories, and turning any of those into
52
+ * a fact would put text into recall that nobody recorded as one.
53
+ */
54
+ export declare function parseMemoryFile(raw: string): MemoryFileFields | undefined;
@@ -0,0 +1,8 @@
1
+ import type { MemoryReadResult } from "../types.js";
2
+ export interface ReadFileOptions {
3
+ cwd: string;
4
+ relPath: string;
5
+ from?: number;
6
+ lines?: number;
7
+ }
8
+ export declare function readMemoryFileBounded(opts: ReadFileOptions): Promise<MemoryReadResult>;
@@ -0,0 +1 @@
1
+ export declare function discoverSessionFiles(cwd: string): Promise<SessionFile[]>;
@@ -0,0 +1,2 @@
1
+ export declare function sessionsDir(cwd: string): string;
2
+ export declare function sessionSummaryPath(cwd: string, runId: string): string;
@@ -0,0 +1 @@
1
+ export declare function persistActiveMemoryTranscript(cwd: string, transcript: ActiveMemoryTranscript): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare function wikiDir(cwd: string): string;
2
+ export declare function discoverWikiFiles(cwd: string): Promise<WikiFile[]>;
@@ -1 +1,16 @@
1
+ /** The subset of `LocalOptions` this resolver reads. */
2
+ interface SessionDirOptions {
3
+ sessionDir?: string;
4
+ baseDir?: string;
5
+ }
6
+ /**
7
+ * The session directory the caller ASKED for, or `undefined` when they asked for nothing.
8
+ *
9
+ * {@link resolveSessionDir} always answers with a path, falling back to the default home — which is
10
+ * the right answer for "where do transcripts go" and the wrong one for "did this consumer opt into
11
+ * sharing state with the Claude Code CLI". Memory writes need the second question, and the two
12
+ * accepted names for the option live here, so asking it anywhere else would put a copy of that
13
+ * knowledge somewhere it can drift.
14
+ */
15
+ export declare function explicitSessionDir(local: SessionDirOptions | undefined): string | undefined;
1
16
  export {};
@@ -1 +1,16 @@
1
+ /** The subset of `LocalOptions` this resolver reads. */
2
+ interface SessionDirOptions {
3
+ sessionDir?: string;
4
+ baseDir?: string;
5
+ }
6
+ /**
7
+ * The session directory the caller ASKED for, or `undefined` when they asked for nothing.
8
+ *
9
+ * {@link resolveSessionDir} always answers with a path, falling back to the default home — which is
10
+ * the right answer for "where do transcripts go" and the wrong one for "did this consumer opt into
11
+ * sharing state with the Claude Code CLI". Memory writes need the second question, and the two
12
+ * accepted names for the option live here, so asking it anywhere else would put a copy of that
13
+ * knowledge somewhere it can drift.
14
+ */
15
+ export declare function explicitSessionDir(local: SessionDirOptions | undefined): string | undefined;
1
16
  export {};
@@ -1,4 +1,4 @@
1
1
  import { type MemoryConfig, type MemoryFact, redactSecrets } from "../../memory/types.js";
2
2
  export { redactSecrets };
3
- export declare function readMemoryFacts(cwd: string, config: MemoryConfig): Promise<MemoryFact[]>;
4
- export declare function appendMemoryFact(cwd: string, config: MemoryConfig, fact: MemoryFact): Promise<void>;
3
+ export declare function readMemoryFacts(cwd: string, config: MemoryConfig, memoryHome?: string): Promise<MemoryFact[]>;
4
+ export declare function appendMemoryFact(cwd: string, config: MemoryConfig, fact: MemoryFact, memoryHome?: string): Promise<void>;
package/dist/workflow.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkGNT35C5U_cjs = require('./chunk-GNT35C5U.cjs');
3
+ var chunk6SBW4QR2_cjs = require('./chunk-6SBW4QR2.cjs');
4
4
  var chunkXWL6O3SW_cjs = require('./chunk-XWL6O3SW.cjs');
5
5
  require('./chunk-VTYY7XL5.cjs');
6
6
  require('./chunk-WJVHMTKB.cjs');
@@ -15,35 +15,35 @@ require('./chunk-NUKRL3I6.cjs');
15
15
 
16
16
  Object.defineProperty(exports, "Workflow", {
17
17
  enumerable: true,
18
- get: function () { return chunkGNT35C5U_cjs.Workflow; }
18
+ get: function () { return chunk6SBW4QR2_cjs.Workflow; }
19
19
  });
20
20
  Object.defineProperty(exports, "WorkflowBuilder", {
21
21
  enumerable: true,
22
- get: function () { return chunkGNT35C5U_cjs.WorkflowBuilder; }
22
+ get: function () { return chunk6SBW4QR2_cjs.WorkflowBuilder; }
23
23
  });
24
24
  Object.defineProperty(exports, "WorkflowToolError", {
25
25
  enumerable: true,
26
- get: function () { return chunkGNT35C5U_cjs.WorkflowToolError; }
26
+ get: function () { return chunk6SBW4QR2_cjs.WorkflowToolError; }
27
27
  });
28
28
  Object.defineProperty(exports, "agentStep", {
29
29
  enumerable: true,
30
- get: function () { return chunkGNT35C5U_cjs.agentStep; }
30
+ get: function () { return chunk6SBW4QR2_cjs.agentStep; }
31
31
  });
32
32
  Object.defineProperty(exports, "cloneWorkflow", {
33
33
  enumerable: true,
34
- get: function () { return chunkGNT35C5U_cjs.cloneWorkflow; }
34
+ get: function () { return chunk6SBW4QR2_cjs.cloneWorkflow; }
35
35
  });
36
36
  Object.defineProperty(exports, "fn", {
37
37
  enumerable: true,
38
- get: function () { return chunkGNT35C5U_cjs.fn; }
38
+ get: function () { return chunk6SBW4QR2_cjs.fn; }
39
39
  });
40
40
  Object.defineProperty(exports, "workflowAsTool", {
41
41
  enumerable: true,
42
- get: function () { return chunkGNT35C5U_cjs.workflowAsTool; }
42
+ get: function () { return chunk6SBW4QR2_cjs.workflowAsTool; }
43
43
  });
44
44
  Object.defineProperty(exports, "workflowStep", {
45
45
  enumerable: true,
46
- get: function () { return chunkGNT35C5U_cjs.workflowStep; }
46
+ get: function () { return chunk6SBW4QR2_cjs.workflowStep; }
47
47
  });
48
48
  Object.defineProperty(exports, "WorkflowAlreadyRunningError", {
49
49
  enumerable: true,
package/dist/workflow.js CHANGED
@@ -1,4 +1,4 @@
1
- export { Workflow, WorkflowBuilder, WorkflowToolError, agentStep, cloneWorkflow, fn, workflowAsTool, workflowStep } from './chunk-XV4IZNV4.js';
1
+ export { Workflow, WorkflowBuilder, WorkflowToolError, agentStep, cloneWorkflow, fn, workflowAsTool, workflowStep } from './chunk-FUL2I7G5.js';
2
2
  export { WorkflowAlreadyRunningError, WorkflowCompensateNotImplementedError, WorkflowDuplicateStepIdError, WorkflowInputError, WorkflowMaxIterationsExceededError, WorkflowNestedError, WorkflowNotSerializableError, WorkflowOutputError, WorkflowParallelError, WorkflowResumeStepNotFoundError, WorkflowSnapshotNotFoundError, WorkflowStateError, __resetSnapshotStoresForTests } from './chunk-AQLGBKNT.js';
3
3
  import './chunk-HY66GLM6.js';
4
4
  import './chunk-4VPXM6UU.js';
@@ -88,7 +88,7 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
88
88
  | `invalid_input` | domain | MemoryAdapterError | `packages/memory-honcho/src/adapter.ts:98` +9 |
89
89
  | `invalid_max_iterations` | domain | ConfigurationError | `packages/sdk/src/internal/local-agent/real-local-run.ts:215` |
90
90
  | `invalid_memory_backend` | domain | ConfigurationError | `packages/sdk/src/internal/memory/index-manager-dispatch.ts:24` +1 |
91
- | `invalid_memory_kind` | domain | ConfigurationError | `packages/sdk/src/internal/memory/storage/markdown-store.ts:150` |
91
+ | `invalid_memory_kind` | domain | ConfigurationError | `packages/sdk/src/internal/memory/storage/markdown-store.ts:196` |
92
92
  | `invalid_model_selection` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/model-selection.ts:21` |
93
93
  | `invalid_request` | transport | — | `packages/sdk/src/internal/error-mappers/vertex.ts:52` +1 |
94
94
  | `invalid_retry_config` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/retry/with-retry.ts:67` |
@@ -4,7 +4,7 @@ Every public symbol the TheoKit workspace publishes, and the exact specifier to
4
4
 
5
5
  A symbol listed under two specifiers is reachable from both, but that does NOT make the two interchangeable: a class emitted separately into a subpath entry is a distinct nominal type from the one in the root bundle, so passing one where the other is expected fails on a private field. When a symbol appears twice, import it and everything it is passed to from the SAME specifier.
6
6
 
7
- 1126 export(s) across 45 entry point(s).
7
+ 1135 export(s) across 46 entry point(s).
8
8
 
9
9
  ## `@theokit/acp`
10
10
 
@@ -1003,6 +1003,20 @@ A symbol listed under two specifiers is reachable from both, but that does NOT m
1003
1003
  | `LruEmbeddingCache` | class | Bounded in-memory LRU cache for embeddings, keyed by `sha256(text)` (or any stable key the caller chooses). |
1004
1004
  | `OpenAiCompatibleConfig` | interface | What one provider adapter tells {@link createOpenAiCompatibleRuntime } about its wire: where to POST, which environment variables carry the key and the base URL, which model to use by default, and ... |
1005
1005
 
1006
+ ## `@theokit/sdk/internal/memory-store`
1007
+
1008
+ | Symbol | Kind | Summary |
1009
+ |---|---|---|
1010
+ | `appendFact` | function | Record a fact, honouring the `enabled` gate on {@link MemoryConfig } : when memory is disabled the call resolves without touching disk. |
1011
+ | `appendFactToMarkdown` | function | Write a fact as its own memory file and point the `MEMORY.md` index at it. |
1012
+ | `claudeProjectMemoryDir` | function | Where the Claude Code CLI keeps THIS project's memories. |
1013
+ | `memoryDir` | function | The memory root for a workspace: `<cwd>/.theokit/memory`. |
1014
+ | `memoryMdPath` | function | Path to `MEMORY.md`, the index that points at the per-memory files — and, in stores written before #389, the flat `## Facts` list itself. |
1015
+ | `memoryWriteDir` | function | Where a NEW fact should be written. |
1016
+ | `notesDir` | function | Path to `<memory root>/notes`, where per-topic notes and the consolidated notes a dreaming sweep writes live. |
1017
+ | `readFacts` | function | Every memory in the store, honouring the `enabled` gate on {@link MemoryConfig } : when memory is disabled the call resolves to `[]` without touching disk. |
1018
+ | `readFactsFromMarkdown` | function | Every memory in the store: the per-memory files, plus any legacy `## Facts` bullets still in `MEMORY.md`. |
1019
+
1006
1020
  ## `@theokit/sdk/internal/persistence`
1007
1021
 
1008
1022
  | Symbol | Kind | Summary |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "4.58.0",
3
+ "version": "4.60.0",
4
4
  "description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/usetheokit/theokit-sdk#readme",
@@ -288,6 +288,16 @@
288
288
  "default": "./dist/internal/memory/adapters/index.cjs"
289
289
  }
290
290
  },
291
+ "./internal/memory-store": {
292
+ "import": {
293
+ "types": "./dist/internal/memory/storage/index.d.ts",
294
+ "default": "./dist/internal/memory/storage/index.js"
295
+ },
296
+ "require": {
297
+ "types": "./dist/internal/memory/storage/index.d.cts",
298
+ "default": "./dist/internal/memory/storage/index.cjs"
299
+ }
300
+ },
291
301
  "./a2a": {
292
302
  "import": {
293
303
  "types": "./dist/a2a/index.d.ts",