operon-agents-core 0.1.0-alpha.2 → 0.1.0-alpha.21

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 (289) hide show
  1. package/dist/agent/agent.d.ts +8 -7
  2. package/dist/agent/compose-hooks.d.ts +10 -1
  3. package/dist/agent/compose-hooks.js +61 -6
  4. package/dist/agent/concurrency.js +1 -1
  5. package/dist/agent/context-report.d.ts +2 -2
  6. package/dist/agent/durable-state.d.ts +22 -0
  7. package/dist/agent/durable-state.js +54 -0
  8. package/dist/agent/index.d.ts +2 -2
  9. package/dist/agent/index.js +1 -1
  10. package/dist/agent/instruction-context.d.ts +6 -6
  11. package/dist/agent/instruction-context.js +23 -23
  12. package/dist/agent/profile-builtins.js +1 -1
  13. package/dist/agent/run-support.d.ts +1 -1
  14. package/dist/agent/run-support.js +6 -5
  15. package/dist/agent/runner.d.ts +25 -22
  16. package/dist/agent/runner.js +217 -121
  17. package/dist/agent/session.d.ts +262 -156
  18. package/dist/agent/session.js +590 -418
  19. package/dist/agent/subagent-tools.js +3 -3
  20. package/dist/agent/subagent.js +28 -13
  21. package/dist/agent/toolset.d.ts +1 -0
  22. package/dist/agent/toolset.js +13 -7
  23. package/dist/agent/workflow/journal.d.ts +2 -2
  24. package/dist/agent/workflow/journal.js +2 -2
  25. package/dist/agent/workflow/manager.d.ts +1 -1
  26. package/dist/agent/workflow/manager.js +1 -1
  27. package/dist/agent/workflow/prompt.js +2 -2
  28. package/dist/agent/workflow/sandbox.d.ts +1 -1
  29. package/dist/agent/workflow/sandbox.js +1 -1
  30. package/dist/agent/workflow/tool.js +30 -43
  31. package/dist/agent/worktree.d.ts +8 -8
  32. package/dist/agent/worktree.js +15 -15
  33. package/dist/capabilities/assembler.d.ts +29 -5
  34. package/dist/capabilities/assembler.js +85 -9
  35. package/dist/capabilities/background/code-task.d.ts +43 -0
  36. package/dist/capabilities/background/code-task.js +75 -0
  37. package/dist/capabilities/background/command-task.d.ts +9 -2
  38. package/dist/capabilities/background/command-task.js +22 -6
  39. package/dist/capabilities/background/index.d.ts +6 -1
  40. package/dist/capabilities/background/index.js +26 -20
  41. package/dist/capabilities/background/manager.d.ts +57 -1
  42. package/dist/capabilities/background/manager.js +210 -45
  43. package/dist/capabilities/background/persist-disk.d.ts +1 -1
  44. package/dist/capabilities/background/persist-disk.js +1 -1
  45. package/dist/capabilities/background/persist.js +4 -2
  46. package/dist/capabilities/background/projections.d.ts +16 -0
  47. package/dist/capabilities/background/projections.js +86 -0
  48. package/dist/capabilities/background/stall-watchdog.d.ts +41 -0
  49. package/dist/capabilities/background/stall-watchdog.js +85 -0
  50. package/dist/capabilities/background/task.d.ts +8 -7
  51. package/dist/capabilities/background/tools.js +33 -7
  52. package/dist/capabilities/capability-data.d.ts +52 -0
  53. package/dist/capabilities/capability-data.js +88 -0
  54. package/dist/capabilities/capability-state.d.ts +2 -4
  55. package/dist/capabilities/capability-state.js +5 -23
  56. package/dist/capabilities/capability.d.ts +203 -38
  57. package/dist/capabilities/compaction/index.js +10 -4
  58. package/dist/capabilities/compaction/service.d.ts +20 -5
  59. package/dist/capabilities/compaction/service.js +27 -11
  60. package/dist/capabilities/goal/goal-store.d.ts +76 -12
  61. package/dist/capabilities/goal/goal-store.js +137 -53
  62. package/dist/capabilities/goal/index.d.ts +1 -1
  63. package/dist/capabilities/goal/index.js +30 -7
  64. package/dist/capabilities/index.d.ts +9 -6
  65. package/dist/capabilities/index.js +4 -3
  66. package/dist/capabilities/plan/index.js +22 -5
  67. package/dist/capabilities/plan/plan-mode.d.ts +30 -9
  68. package/dist/capabilities/plan/plan-mode.js +57 -32
  69. package/dist/capabilities/plan/tools.js +1 -1
  70. package/dist/capabilities/skills/flow-provider.js +3 -3
  71. package/dist/capabilities/skills/index.d.ts +13 -1
  72. package/dist/capabilities/skills/index.js +30 -21
  73. package/dist/capabilities/skills/parser.d.ts +2 -2
  74. package/dist/capabilities/skills/parser.js +3 -3
  75. package/dist/capabilities/skills/registry.d.ts +5 -6
  76. package/dist/capabilities/skills/registry.js +6 -9
  77. package/dist/capabilities/skills/scanner.d.ts +3 -3
  78. package/dist/capabilities/skills/scanner.js +14 -14
  79. package/dist/capabilities/skills/service.d.ts +2 -1
  80. package/dist/capabilities/skills/service.js +3 -3
  81. package/dist/capabilities/skills/skill-tool.d.ts +2 -0
  82. package/dist/capabilities/skills/skill-tool.js +1 -1
  83. package/dist/capabilities/task/index.js +2 -1
  84. package/dist/capabilities/task/persist-disk.d.ts +1 -1
  85. package/dist/capabilities/task/persist-disk.js +1 -1
  86. package/dist/capabilities/task/persist.js +1 -1
  87. package/dist/capabilities/todo/index.js +11 -6
  88. package/dist/capabilities/todo/injector.js +2 -1
  89. package/dist/capabilities/todo/todo-store.d.ts +28 -7
  90. package/dist/capabilities/todo/todo-store.js +44 -11
  91. package/dist/capabilities/todo/tools.js +8 -3
  92. package/dist/capabilities/tool-provider.d.ts +3 -3
  93. package/dist/capabilities/user-hooks/engine.d.ts +3 -3
  94. package/dist/capabilities/user-hooks/engine.js +7 -7
  95. package/dist/capabilities/user-hooks/index.js +2 -1
  96. package/dist/capabilities/workflow/index.d.ts +5 -3
  97. package/dist/capabilities/workflow/index.js +3 -2
  98. package/dist/commands/index.js +34 -32
  99. package/dist/config/index.d.ts +1 -1
  100. package/dist/config/provider-manager.js +0 -28
  101. package/dist/config/schema.d.ts +53 -4
  102. package/dist/config/schema.js +53 -1
  103. package/dist/events/events.d.ts +43 -11
  104. package/dist/events/events.js +1 -0
  105. package/dist/events/index.d.ts +2 -2
  106. package/dist/events/index.js +1 -1
  107. package/dist/events/projection.d.ts +49 -1
  108. package/dist/events/projection.js +144 -19
  109. package/dist/events/publisher.js +2 -21
  110. package/dist/home.d.ts +1 -1
  111. package/dist/home.js +1 -1
  112. package/dist/index.d.ts +3 -2
  113. package/dist/index.js +2 -1
  114. package/dist/internal.d.ts +5 -2
  115. package/dist/internal.js +5 -2
  116. package/dist/llm/define-model.d.ts +4 -0
  117. package/dist/llm/define-model.js +63 -25
  118. package/dist/llm/index.d.ts +1 -0
  119. package/dist/llm/index.js +1 -0
  120. package/dist/llm/model.d.ts +2 -0
  121. package/dist/llm/provider.d.ts +17 -0
  122. package/dist/llm/provider.js +14 -0
  123. package/dist/llm/retry.js +1 -1
  124. package/dist/loop/context.d.ts +21 -1
  125. package/dist/loop/context.js +47 -9
  126. package/dist/loop/events.d.ts +5 -1
  127. package/dist/loop/index.d.ts +2 -2
  128. package/dist/loop/index.js +1 -1
  129. package/dist/loop/interruption.d.ts +9 -4
  130. package/dist/loop/interruption.js +11 -25
  131. package/dist/loop/run-turn.d.ts +16 -3
  132. package/dist/loop/run-turn.js +13 -4
  133. package/dist/loop/steer.d.ts +78 -12
  134. package/dist/loop/steer.js +101 -38
  135. package/dist/loop/tool-call.d.ts +13 -2
  136. package/dist/loop/tool-call.js +135 -5
  137. package/dist/loop/turn-step.d.ts +13 -2
  138. package/dist/loop/turn-step.js +29 -7
  139. package/dist/loop/types.d.ts +6 -0
  140. package/dist/mcp/auth-tool.d.ts +3 -1
  141. package/dist/mcp/auth-tool.js +2 -2
  142. package/dist/mcp/capability.d.ts +13 -0
  143. package/dist/mcp/capability.js +36 -17
  144. package/dist/mcp/config-loader.d.ts +5 -5
  145. package/dist/mcp/config-loader.js +17 -17
  146. package/dist/mcp/credentials.d.ts +35 -0
  147. package/dist/mcp/credentials.js +2 -0
  148. package/dist/mcp/filter.d.ts +2 -2
  149. package/dist/mcp/index.d.ts +4 -3
  150. package/dist/mcp/index.js +1 -1
  151. package/dist/mcp/manager.d.ts +108 -6
  152. package/dist/mcp/manager.js +262 -18
  153. package/dist/mcp/oauth/callback-server.d.ts +10 -1
  154. package/dist/mcp/oauth/callback-server.js +82 -16
  155. package/dist/mcp/oauth/index.d.ts +2 -2
  156. package/dist/mcp/oauth/provider.d.ts +18 -0
  157. package/dist/mcp/oauth/provider.js +31 -1
  158. package/dist/mcp/oauth/service.d.ts +9 -3
  159. package/dist/mcp/oauth/service.js +29 -4
  160. package/dist/mcp/sdk-transport.js +1 -1
  161. package/dist/mcp/server.js +1 -1
  162. package/dist/permission/auto-approver/prompts-data.d.ts +1 -1
  163. package/dist/permission/auto-approver/prompts-data.js +1 -1
  164. package/dist/permission/manager.d.ts +5 -3
  165. package/dist/permission/manager.js +7 -3
  166. package/dist/permission/policies.d.ts +2 -2
  167. package/dist/permission/policies.js +4 -4
  168. package/dist/plugins/fields.d.ts +14 -0
  169. package/dist/plugins/fields.js +30 -0
  170. package/dist/plugins/hooks.d.ts +2 -2
  171. package/dist/plugins/hooks.js +12 -12
  172. package/dist/plugins/index.js +1 -0
  173. package/dist/plugins/manager.d.ts +8 -3
  174. package/dist/plugins/manager.js +18 -7
  175. package/dist/plugins/manifest.d.ts +2 -2
  176. package/dist/plugins/manifest.js +101 -91
  177. package/dist/plugins/marketplace.js +76 -57
  178. package/dist/plugins/store.d.ts +3 -3
  179. package/dist/plugins/store.js +6 -6
  180. package/dist/protocol/index.d.ts +1 -1
  181. package/dist/store/catalog-store.d.ts +4 -1
  182. package/dist/store/catalog-store.js +5 -1
  183. package/dist/store/checkpointing-store.d.ts +41 -0
  184. package/dist/store/checkpointing-store.js +86 -0
  185. package/dist/store/disk-store.d.ts +8 -0
  186. package/dist/store/disk-store.js +127 -5
  187. package/dist/store/index.d.ts +3 -2
  188. package/dist/store/index.js +2 -1
  189. package/dist/store/log-store.d.ts +9 -1
  190. package/dist/store/log-store.js +68 -4
  191. package/dist/store/migrate.d.ts +8 -2
  192. package/dist/store/migrate.js +9 -2
  193. package/dist/store/origin.d.ts +31 -6
  194. package/dist/store/origin.js +0 -14
  195. package/dist/store/pg.d.ts +1 -0
  196. package/dist/store/pg.js +37 -2
  197. package/dist/store/redis.d.ts +1 -0
  198. package/dist/store/redis.js +30 -0
  199. package/dist/store/repository.d.ts +13 -1
  200. package/dist/store/repository.js +45 -2
  201. package/dist/store/session-catalog.d.ts +4 -0
  202. package/dist/store/session-catalog.js +6 -0
  203. package/dist/store/storage.js +3 -0
  204. package/dist/store/store.d.ts +97 -34
  205. package/dist/store/store.js +64 -10
  206. package/dist/telemetry/appender.d.ts +43 -0
  207. package/dist/telemetry/appender.js +46 -0
  208. package/dist/telemetry/events.d.ts +142 -0
  209. package/dist/telemetry/events.js +141 -0
  210. package/dist/telemetry/index.d.ts +10 -0
  211. package/dist/telemetry/index.js +6 -0
  212. package/dist/telemetry/projection.d.ts +23 -0
  213. package/dist/telemetry/projection.js +185 -0
  214. package/dist/telemetry/redact.d.ts +20 -0
  215. package/dist/telemetry/redact.js +40 -0
  216. package/dist/telemetry/service.d.ts +49 -0
  217. package/dist/telemetry/service.js +137 -0
  218. package/dist/testing.d.ts +58 -0
  219. package/dist/testing.js +123 -0
  220. package/dist/tool/background.d.ts +9 -6
  221. package/dist/tool/background.js +7 -1
  222. package/dist/tool/builtin/ask-user-question.js +6 -5
  223. package/dist/tool/builtin/bash.d.ts +6 -0
  224. package/dist/tool/builtin/bash.js +79 -42
  225. package/dist/tool/builtin/edit.js +82 -109
  226. package/dist/tool/builtin/glob.js +13 -13
  227. package/dist/tool/builtin/grep.js +13 -13
  228. package/dist/tool/builtin/read.js +25 -15
  229. package/dist/tool/builtin/write.js +49 -33
  230. package/dist/tool/define.d.ts +14 -8
  231. package/dist/tool/define.js +8 -2
  232. package/dist/tool/{machine-base.d.ts → environment-base.d.ts} +37 -37
  233. package/dist/tool/{machine-base.js → environment-base.js} +45 -119
  234. package/dist/tool/{machine-local.d.ts → environment-local.d.ts} +9 -8
  235. package/dist/tool/{machine-local.js → environment-local.js} +60 -81
  236. package/dist/tool/{machine-null.d.ts → environment-null.d.ts} +9 -9
  237. package/dist/tool/{machine-null.js → environment-null.js} +9 -9
  238. package/dist/tool/{machine-ssh.d.ts → environment-ssh.d.ts} +33 -18
  239. package/dist/tool/{machine-ssh.js → environment-ssh.js} +118 -149
  240. package/dist/tool/{machine.d.ts → environment.d.ts} +53 -82
  241. package/dist/tool/environment.js +2 -0
  242. package/dist/tool/file-freshness.d.ts +33 -19
  243. package/dist/tool/file-freshness.js +39 -30
  244. package/dist/tool/filesystem-tools.d.ts +1 -1
  245. package/dist/tool/filesystem-tools.js +1 -1
  246. package/dist/tool/git-context.d.ts +2 -2
  247. package/dist/tool/git-context.js +8 -8
  248. package/dist/tool/index.d.ts +12 -12
  249. package/dist/tool/index.js +12 -10
  250. package/dist/tool/policies/path-access.d.ts +4 -4
  251. package/dist/tool/policies/path-access.js +12 -12
  252. package/dist/tool/questions.d.ts +8 -0
  253. package/dist/tool/search/catalog.d.ts +37 -0
  254. package/dist/tool/search/catalog.js +182 -0
  255. package/dist/tool/search/deferral.d.ts +3 -2
  256. package/dist/tool/search/loaded.d.ts +32 -0
  257. package/dist/tool/search/loaded.js +96 -0
  258. package/dist/tool/search/search-tool.d.ts +2 -6
  259. package/dist/tool/search/search-tool.js +16 -15
  260. package/dist/tool/shell-env.js +4 -0
  261. package/dist/tool/support/bash-paths.js +38 -7
  262. package/dist/tool/support/{machine-ops.d.ts → environment-ops.d.ts} +12 -14
  263. package/dist/tool/support/{machine-ops.js → environment-ops.js} +21 -2
  264. package/dist/tool/support/git-worktree.d.ts +3 -3
  265. package/dist/tool/support/git-worktree.js +6 -6
  266. package/dist/tool/support/rg-locator.d.ts +6 -6
  267. package/dist/tool/support/rg-locator.js +6 -6
  268. package/dist/tool/support/ripgrep-run.d.ts +5 -5
  269. package/dist/tool/support/ripgrep-run.js +3 -3
  270. package/dist/tool/support/tool-path.d.ts +3 -3
  271. package/dist/tool/support/tool-path.js +7 -7
  272. package/dist/tool/types.d.ts +54 -10
  273. package/dist/tool/web/fetch-url.js +1 -1
  274. package/dist/tool/web/web-search.js +1 -1
  275. package/dist/tool/workspace-spec.d.ts +3 -3
  276. package/dist/tool/workspace-spec.js +27 -27
  277. package/dist/tracing/bridge.d.ts +9 -1
  278. package/dist/tracing/bridge.js +307 -77
  279. package/dist/tracing/index.d.ts +2 -2
  280. package/dist/tracing/otel.d.ts +28 -1
  281. package/dist/tracing/otel.js +150 -38
  282. package/dist/tracing/processor.d.ts +22 -0
  283. package/dist/tracing/processor.js +2 -0
  284. package/dist/tracing/spans.d.ts +54 -0
  285. package/dist/tracing/spans.js +5 -0
  286. package/package.json +6 -2
  287. package/dist/tool/machine.js +0 -15
  288. package/dist/tool/search/activation.d.ts +0 -13
  289. package/dist/tool/search/activation.js +0 -31
@@ -0,0 +1,86 @@
1
+ import { SessionProjection } from "../events/projection.js";
2
+ import { AUDIT_ADDRESS, isCheckpointRecord, DEFAULT_ADDRESS, } from "./store.js";
3
+ /**
4
+ * Stamps every history checkpoint a session writes with the shard's lifecycle at that instant
5
+ * (`#frame`: agent, open turn, queued steers — see `FrameCheckpoint`).
6
+ *
7
+ * The stamp happens inside `appendRecord`, which a `ConversationContext` calls synchronously in
8
+ * the same block as the history reset — so it is of exactly the lifecycle every record before
9
+ * the checkpoint produced, and of nothing after it. Doing it here rather than in each context
10
+ * means no context, wherever it is built, can write a checkpoint without it. A record that
11
+ * already carries `checkpoint` passes through untouched.
12
+ *
13
+ * The lifecycle is folded here from every record that passes through: this store sits UNDER the
14
+ * event publisher, so the lifecycle records the publisher journals pass through it too, in
15
+ * exactly the order they reach the log. Session and capability state are not stamped — they are
16
+ * kept as current values in the store's key/value side (see `CapabilityDurableState`).
17
+ */
18
+ export class CheckpointingSessionStore {
19
+ inner;
20
+ /** The lifecycle side of every shard written or restored in this process, without history. */
21
+ frames;
22
+ listStateKeys;
23
+ watch;
24
+ flush;
25
+ close;
26
+ rewrite;
27
+ storageDir;
28
+ constructor(inner, sessionId) {
29
+ this.inner = inner;
30
+ this.frames = new SessionProjection(sessionId, { history: false });
31
+ if (inner.listStateKeys !== undefined)
32
+ this.listStateKeys = () => inner.listStateKeys();
33
+ if (inner.watch !== undefined)
34
+ this.watch = (options) => inner.watch(options);
35
+ if (inner.flush !== undefined)
36
+ this.flush = () => inner.flush();
37
+ if (inner.close !== undefined)
38
+ this.close = () => inner.close();
39
+ if (inner.rewrite !== undefined)
40
+ this.rewrite = (address) => inner.rewrite(address);
41
+ if (inner.storageDir !== undefined)
42
+ this.storageDir = () => inner.storageDir();
43
+ }
44
+ /**
45
+ * Fold a shard's records read back from the log (from its checkpoint on, or whole) into the
46
+ * lifecycle state, before this process writes to it again. A shard already folded here is
47
+ * left alone: what this process wrote is newer than anything it could read.
48
+ */
49
+ restoreFrame(address, records) {
50
+ if (this.frames.has(address))
51
+ return;
52
+ for (const record of records) {
53
+ if ((record.address ?? DEFAULT_ADDRESS) === address)
54
+ this.frames.applyRecord(record);
55
+ }
56
+ }
57
+ appendRecord(record) {
58
+ // The audit shard has no lifecycle to fold, and no checkpoint is ever written to it.
59
+ if (record.address === AUDIT_ADDRESS)
60
+ return this.inner.appendRecord(record);
61
+ if (!isCheckpointRecord(record) || record.checkpoint !== undefined) {
62
+ this.frames.applyRecord(record);
63
+ return this.inner.appendRecord(record);
64
+ }
65
+ const address = record.address ?? DEFAULT_ADDRESS;
66
+ const stamped = { ...record, checkpoint: { "#frame": this.frames.frameCheckpoint(address) } };
67
+ this.frames.applyRecord(stamped);
68
+ return this.inner.appendRecord(stamped);
69
+ }
70
+ readRecords(filter) {
71
+ return this.inner.readRecords(filter);
72
+ }
73
+ readRecordPage(options) {
74
+ return this.inner.readRecordPage(options);
75
+ }
76
+ putState(key, value) {
77
+ return this.inner.putState(key, value);
78
+ }
79
+ getState(key) {
80
+ return this.inner.getState(key);
81
+ }
82
+ deleteState(key) {
83
+ return this.inner.deleteState(key);
84
+ }
85
+ }
86
+ //# sourceMappingURL=checkpointing-store.js.map
@@ -23,6 +23,12 @@ export declare class DiskSessionStore implements SessionStore {
23
23
  lastActivityMs(): Promise<number>;
24
24
  appendRecord(record: AgentRecord): Promise<string>;
25
25
  readRecords(filter?: ReadRecordsFilter): AsyncIterable<AgentRecord>;
26
+ /**
27
+ * The shard's records from its indexed checkpoint on — the file read from that byte offset,
28
+ * nothing before it. Undefined when there is no index or it does not land on that checkpoint
29
+ * (the caller reads the whole shard instead, which is always correct).
30
+ */
31
+ private readFromCheckpoint;
26
32
  readRecordPage(options: ReadRecordPageOptions): Promise<RecordPage>;
27
33
  putState(key: StateKey, value: unknown): Promise<void>;
28
34
  getState(key: StateKey): Promise<unknown | null>;
@@ -48,6 +54,8 @@ export declare class DiskSessionStore implements SessionStore {
48
54
  private ensureCurrentVersion;
49
55
  private stampVersion;
50
56
  private rewriteShard;
57
+ /** Every shard a read without an address covers: all of them but the audit shard. */
58
+ private conversationShards;
51
59
  private listShards;
52
60
  private readState;
53
61
  private writeState;
@@ -4,7 +4,7 @@ import { join } from "node:path";
4
4
  import { BlobStore, offloadRecord, rehydrateRecord } from "./blob-store.js";
5
5
  import { compareSequence, pageRecords } from "./log-store.js";
6
6
  import { migrateRecord, WIRE_PROTOCOL_VERSION, WIRE_VERSION_KEY } from "./migrate.js";
7
- import { DEFAULT_ADDRESS, } from "./store.js";
7
+ import { AUDIT_ADDRESS, DEFAULT_ADDRESS, isCheckpointRecord, } from "./store.js";
8
8
  const AGENTS_DIR = "agents";
9
9
  const BLOBS_DIR = "blobs";
10
10
  const LOG_FILE = "log.jsonl";
@@ -74,16 +74,72 @@ export class DiskSessionStore {
74
74
  await this.ensureMetadata(address, dir);
75
75
  const stamped = record.time !== undefined ? record : { ...record, time: Date.now() };
76
76
  const stored = await offloadRecord(stamped, this.blobStore);
77
- return this.appendStored(dir, stored);
77
+ if (!isCheckpointRecord(record))
78
+ return this.appendStored(dir, stored);
79
+ // Index the shard's newest checkpoint by BYTE OFFSET, so a replay reads the file from
80
+ // there rather than from the top. Written after the line: a crash in between leaves the
81
+ // index at an older checkpoint, which is still a valid place to start.
82
+ const offset = await fileSize(join(dir, LOG_FILE));
83
+ const sequence = await this.appendStored(dir, stored);
84
+ await this.putState(checkpointOffsetKey(shardName(address)), { sequence, offset });
85
+ return sequence;
78
86
  });
79
87
  }
80
88
  async *readRecords(filter) {
81
- const shards = filter?.address !== undefined ? [shardName(filter.address)] : await this.listShards();
89
+ const shards = filter?.address !== undefined ? [shardName(filter.address)] : await this.conversationShards();
90
+ if (filter?.fromCheckpoint === true) {
91
+ const all = [];
92
+ for (const shard of shards) {
93
+ const tail = await this.readFromCheckpoint(shard);
94
+ if (tail !== undefined)
95
+ all.push(...tail);
96
+ else
97
+ for await (const item of this.readShardDecoded(shard))
98
+ all.push(item);
99
+ }
100
+ if (shards.length > 1)
101
+ all.sort((a, b) => compareSequence(a.sequence, b.sequence));
102
+ for (const item of all)
103
+ yield item.record;
104
+ return;
105
+ }
82
106
  for (const item of await this.readStored(shards))
83
107
  yield item.record;
84
108
  }
109
+ /**
110
+ * The shard's records from its indexed checkpoint on — the file read from that byte offset,
111
+ * nothing before it. Undefined when there is no index or it does not land on that checkpoint
112
+ * (the caller reads the whole shard instead, which is always correct).
113
+ */
114
+ async readFromCheckpoint(shard) {
115
+ const index = await this.getState(checkpointOffsetKey(shard));
116
+ if (!isCheckpointOffset(index))
117
+ return undefined;
118
+ const filePath = join(this.sessionDir, AGENTS_DIR, shard, LOG_FILE);
119
+ const raw = await readFileFrom(filePath, index.offset);
120
+ if (raw === undefined)
121
+ return undefined;
122
+ const version = await this.version();
123
+ const out = [];
124
+ try {
125
+ for (const stored of parseLogLines(raw, filePath)) {
126
+ if (out.length === 0 && stored.sequence !== index.sequence)
127
+ return undefined;
128
+ const migrated = migrateRecord(stored.record, version);
129
+ if (migrated === null)
130
+ continue;
131
+ out.push({ sequence: stored.sequence, record: await rehydrateRecord(migrated, this.blobStore) });
132
+ }
133
+ }
134
+ catch {
135
+ // The offset no longer lands on a line boundary (the file was replaced underneath us).
136
+ return undefined;
137
+ }
138
+ const head = out[0];
139
+ return head !== undefined && head.sequence === index.sequence && isCheckpointRecord(head.record) ? out : undefined;
140
+ }
85
141
  async readRecordPage(options) {
86
- const shards = options.address !== undefined ? [shardName(options.address)] : await this.listShards();
142
+ const shards = options.address !== undefined ? [shardName(options.address)] : await this.conversationShards();
87
143
  return pageRecords(await this.readStored(shards), options);
88
144
  }
89
145
  async putState(key, value) {
@@ -215,9 +271,27 @@ export class DiskSessionStore {
215
271
  const withMeta = withLeadingMetadata(lines, shardAddress(shard));
216
272
  await mkdir(dir, { recursive: true, mode: 0o700 });
217
273
  const tmp = `${target}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
218
- await writeFile(tmp, withMeta.length > 0 ? `${withMeta.map((line) => JSON.stringify(line)).join("\n")}\n` : "", { encoding: "utf-8", mode: 0o600 });
274
+ const encoded = withMeta.map((line) => `${JSON.stringify(line)}\n`);
275
+ await writeFile(tmp, encoded.join(""), { encoding: "utf-8", mode: 0o600 });
219
276
  await rename(tmp, target);
220
277
  this.metadataChecked.add(shardAddress(shard));
278
+ // The rewrite moved every line, so re-point the checkpoint index at the new byte offset.
279
+ let offset = 0;
280
+ let newest;
281
+ for (let i = 0; i < withMeta.length; i++) {
282
+ if (isCheckpointRecord(withMeta[i].record))
283
+ newest = { sequence: withMeta[i].sequence, offset };
284
+ offset += Buffer.byteLength(encoded[i], "utf-8");
285
+ }
286
+ if (newest !== undefined)
287
+ await this.putState(checkpointOffsetKey(shard), newest);
288
+ else
289
+ await this.deleteState(checkpointOffsetKey(shard));
290
+ }
291
+ /** Every shard a read without an address covers: all of them but the audit shard. */
292
+ async conversationShards() {
293
+ const audit = shardName(AUDIT_ADDRESS);
294
+ return (await this.listShards()).filter((shard) => shard !== audit);
221
295
  }
222
296
  async listShards() {
223
297
  try {
@@ -319,6 +393,50 @@ function shardName(address) {
319
393
  function shardAddress(shard) {
320
394
  return shard;
321
395
  }
396
+ function checkpointOffsetKey(shard) {
397
+ return `checkpoint-offset:${shard}`;
398
+ }
399
+ function isCheckpointOffset(value) {
400
+ if (typeof value !== "object" || value === null)
401
+ return false;
402
+ const { sequence, offset } = value;
403
+ return typeof sequence === "string" && /^[1-9]\d*$/.test(sequence) && typeof offset === "number" && Number.isSafeInteger(offset) && offset >= 0;
404
+ }
405
+ async function fileSize(filePath) {
406
+ try {
407
+ return (await stat(filePath)).size;
408
+ }
409
+ catch {
410
+ return 0;
411
+ }
412
+ }
413
+ /** The file's contents from byte `offset` to its end, or undefined when it is shorter than that. */
414
+ async function readFileFrom(filePath, offset) {
415
+ let handle;
416
+ try {
417
+ handle = await open(filePath, "r");
418
+ }
419
+ catch {
420
+ return undefined;
421
+ }
422
+ try {
423
+ const { size } = await handle.stat();
424
+ if (offset > size)
425
+ return undefined;
426
+ const buffer = Buffer.alloc(size - offset);
427
+ let read = 0;
428
+ while (read < buffer.length) {
429
+ const { bytesRead } = await handle.read(buffer, read, buffer.length - read, offset + read);
430
+ if (bytesRead === 0)
431
+ break;
432
+ read += bytesRead;
433
+ }
434
+ return buffer.subarray(0, read).toString("utf-8");
435
+ }
436
+ finally {
437
+ await handle.close();
438
+ }
439
+ }
322
440
  /** Yield each well-formed JSON record of a log file (a torn trailing line is tolerated). */
323
441
  async function* readRawLines(filePath) {
324
442
  let raw;
@@ -328,6 +446,10 @@ async function* readRawLines(filePath) {
328
446
  catch {
329
447
  return;
330
448
  }
449
+ yield* parseLogLines(raw, filePath);
450
+ }
451
+ /** The records of a log file's text (all of it, or a suffix starting on a line boundary). */
452
+ function* parseLogLines(raw, filePath) {
331
453
  const lines = raw.split("\n");
332
454
  for (let i = 0; i < lines.length; i++) {
333
455
  const line = lines[i].replace(/\r$/, "");
@@ -1,5 +1,6 @@
1
- export type { AgentRecord, AgentRecordBody, SessionStore, StateKey, ReadRecordsFilter, StoredAgentRecord, RecordOrder, ReadRecordPageOptions, RecordPage, WatchRecordsOptions, } from "./store.ts";
2
- export { DEFAULT_ADDRESS, reduceHistory, summaryMessage, customMessage, watchRecordsByPolling } from "./store.ts";
1
+ export type { AgentRecord, AgentRecordBody, SessionStore, StateKey, ReadRecordsFilter, StoredAgentRecord, RecordOrder, ReadRecordPageOptions, RecordPage, WatchRecordsOptions, CheckpointState, CheckpointRecord, } from "./store.ts";
2
+ export { DEFAULT_ADDRESS, reduceHistory, summaryMessage, customMessage, watchRecordsByPolling, isCheckpointRecord, checkpointIndexKey, AUDIT_ADDRESS, appendAudit, readAudit, durableStateKey, SESSION_PERMISSION_KEY, SESSION_USAGE_KEY, } from "./store.ts";
3
+ export { CheckpointingSessionStore } from "./checkpointing-store.ts";
3
4
  export { MemorySessionLock, SessionBusyError } from "./lock.ts";
4
5
  export type { SessionLock, SessionLease, AcquireLeaseOptions } from "./lock.ts";
5
6
  export { LogSessionStore, MemoryStore } from "./log-store.ts";
@@ -1,4 +1,5 @@
1
- export { DEFAULT_ADDRESS, reduceHistory, summaryMessage, customMessage, watchRecordsByPolling } from "./store.js";
1
+ export { DEFAULT_ADDRESS, reduceHistory, summaryMessage, customMessage, watchRecordsByPolling, isCheckpointRecord, checkpointIndexKey, AUDIT_ADDRESS, appendAudit, readAudit, durableStateKey, SESSION_PERMISSION_KEY, SESSION_USAGE_KEY, } from "./store.js";
2
+ export { CheckpointingSessionStore } from "./checkpointing-store.js";
2
3
  export { MemorySessionLock, SessionBusyError } from "./lock.js";
3
4
  export { LogSessionStore, MemoryStore } from "./log-store.js";
4
5
  export { DiskSessionStore } from "./disk-store.js";
@@ -14,7 +14,7 @@ export interface ReadLinesPageOptions {
14
14
  readonly order: "asc" | "desc";
15
15
  }
16
16
  /**
17
- * The **linear** session log implemented once over a tiny physical machine
17
+ * The **linear** session log implemented once over a tiny physical surface
18
18
  * (raw line append/read/rewrite + key-value state + content-addressed blobs). A new backing
19
19
  * (disk, Postgres, Redis, S3…) implements only those primitives; the flat append log, first-
20
20
  * record `metadata` prepend, wire migration, and blob offload are written once here. Records are
@@ -48,6 +48,12 @@ export declare abstract class LogSessionStore implements SessionStore {
48
48
  appendRecord(record: AgentRecord): Promise<string>;
49
49
  private appendRecordNow;
50
50
  readRecords(filter?: ReadRecordsFilter): AsyncIterable<AgentRecord>;
51
+ /**
52
+ * The shard's records from its indexed checkpoint on, or undefined when the index is missing
53
+ * or does not point at a checkpoint of this shard (a fork that renumbered the log, an index
54
+ * written by a crashed process) — the caller then reads the whole shard.
55
+ */
56
+ private recordsFromCheckpoint;
51
57
  readRecordPage(options: ReadRecordPageOptions): Promise<RecordPage>;
52
58
  /** `readRecordPage` over a backing that can seek: read `limit + 1` lines to learn whether a
53
59
  * next page exists, parse only those. Same validation and cursor semantics as `pageRecords`. */
@@ -59,6 +65,8 @@ export declare abstract class LogSessionStore implements SessionStore {
59
65
  /** Parsed + wire-migrated records for an address, in append order (NOT blob-rehydrated).
60
66
  * Records dropped by a migration are skipped. */
61
67
  private parsedRecords;
68
+ /** Every shard a read without an address covers: all of them but the audit shard. */
69
+ private conversationAddresses;
62
70
  private storedRecords;
63
71
  /** Ensure the shard's log opens with a `metadata` record. Cheap after first touch. */
64
72
  private ensureMetadata;
@@ -1,8 +1,8 @@
1
1
  import { BlobStore, offloadRecord, rehydrateRecord } from "./blob-store.js";
2
2
  import { migrateRecord, WIRE_PROTOCOL_VERSION, WIRE_VERSION_KEY } from "./migrate.js";
3
- import { DEFAULT_ADDRESS, } from "./store.js";
3
+ import { AUDIT_ADDRESS, checkpointIndexKey, DEFAULT_ADDRESS, isCheckpointRecord, } from "./store.js";
4
4
  /**
5
- * The **linear** session log implemented once over a tiny physical machine
5
+ * The **linear** session log implemented once over a tiny physical surface
6
6
  * (raw line append/read/rewrite + key-value state + content-addressed blobs). A new backing
7
7
  * (disk, Postgres, Redis, S3…) implements only those primitives; the flat append log, first-
8
8
  * record `metadata` prepend, wire migration, and blob offload are written once here. Records are
@@ -43,12 +43,72 @@ export class LogSessionStore {
43
43
  await this.ensureMetadata(address);
44
44
  const stamped = record.time !== undefined ? record : { ...record, time: Date.now() };
45
45
  const stored = await offloadRecord(stamped, this.#blobs);
46
- return this.appendLine(address, JSON.stringify(stored));
46
+ const sequence = await this.appendLine(address, JSON.stringify(stored));
47
+ // Index the shard's newest checkpoint so a replay can start there. Written after the line:
48
+ // a crash in between leaves the index at an OLDER checkpoint, which is still a valid start.
49
+ if (isCheckpointRecord(record))
50
+ await this.putState(checkpointIndexKey(address), sequence);
51
+ return sequence;
47
52
  }
48
53
  async *readRecords(filter) {
54
+ if (filter?.fromCheckpoint === true) {
55
+ const addresses = filter.address !== undefined ? [filter.address] : await this.conversationAddresses();
56
+ const all = [];
57
+ for (const address of addresses)
58
+ all.push(...((await this.recordsFromCheckpoint(address)) ?? (await this.parsedRecords(address))));
59
+ if (addresses.length > 1)
60
+ all.sort((a, b) => compareSequence(a.sequence, b.sequence));
61
+ for (const item of all)
62
+ yield item.record;
63
+ return;
64
+ }
49
65
  for (const item of await this.storedRecords(filter?.address))
50
66
  yield item.record;
51
67
  }
68
+ /**
69
+ * The shard's records from its indexed checkpoint on, or undefined when the index is missing
70
+ * or does not point at a checkpoint of this shard (a fork that renumbered the log, an index
71
+ * written by a crashed process) — the caller then reads the whole shard.
72
+ */
73
+ async recordsFromCheckpoint(address) {
74
+ const indexed = await this.getState(checkpointIndexKey(address));
75
+ if (typeof indexed !== "string" || !/^[1-9]\d*$/.test(indexed))
76
+ return undefined;
77
+ const start = BigInt(indexed);
78
+ const lines = [];
79
+ if (this.readLinesPage !== undefined) {
80
+ // `after` is exclusive; sequences are positive, so `start - 1` admits the checkpoint itself.
81
+ let after = start > 1n ? String(start - 1n) : undefined;
82
+ while (true) {
83
+ const page = await this.readLinesPage(address, { ...(after !== undefined ? { after } : {}), limit: 512, order: "asc" });
84
+ lines.push(...page);
85
+ if (page.length < 512)
86
+ break;
87
+ after = page[page.length - 1].sequence;
88
+ }
89
+ }
90
+ else {
91
+ for await (const storedLine of this.readLines(address)) {
92
+ if (lines.length > 0 || BigInt(storedLine.sequence) >= start)
93
+ lines.push(storedLine);
94
+ }
95
+ }
96
+ const first = lines[0];
97
+ if (first === undefined || first.sequence !== indexed)
98
+ return undefined;
99
+ const version = await this.version();
100
+ const out = [];
101
+ for (const storedLine of lines) {
102
+ const migrated = migrateRecord(JSON.parse(storedLine.line), version);
103
+ if (migrated === null)
104
+ continue;
105
+ out.push({ sequence: storedLine.sequence, record: await rehydrateRecord(migrated, this.#blobs) });
106
+ }
107
+ const head = out[0];
108
+ if (head === undefined || head.sequence !== indexed || !isCheckpointRecord(head.record))
109
+ return undefined;
110
+ return out;
111
+ }
52
112
  async readRecordPage(options) {
53
113
  if (options.address !== undefined && this.readLinesPage !== undefined) {
54
114
  return this.readRecordPageSeeking(options.address, options);
@@ -123,11 +183,15 @@ export class LogSessionStore {
123
183
  }
124
184
  return out;
125
185
  }
186
+ /** Every shard a read without an address covers: all of them but the audit shard. */
187
+ async conversationAddresses() {
188
+ return (await this.listShardAddresses()).filter((address) => address !== AUDIT_ADDRESS);
189
+ }
126
190
  async storedRecords(address) {
127
191
  if (address !== undefined)
128
192
  return this.parsedRecords(address);
129
193
  const all = [];
130
- for (const shard of await this.listShardAddresses())
194
+ for (const shard of await this.conversationAddresses())
131
195
  all.push(...(await this.parsedRecords(shard)));
132
196
  all.sort((a, b) => compareSequence(a.sequence, b.sequence));
133
197
  return all;
@@ -6,8 +6,13 @@ import type { AgentRecord } from "./store.ts";
6
6
  *
7
7
  * Version 1 introduced the linear `AgentRecord` format. Version 2 adds
8
8
  * durable handoff linkage and seed provenance without invalidating version-1 records.
9
+ * Version 3 makes the history resets self-contained checkpoints: `context.apply_compaction`
10
+ * journals its kept tail (`kept`) instead of a `cutoff` into the history before it, and both
11
+ * resets may carry the session's state (`checkpoint`). A version-2 compaction record cannot be
12
+ * upgraded — its kept tail is not in the record — so it passes through unchanged and replay
13
+ * rejects it (see `foldCompactionRecord`).
9
14
  */
10
- export declare const WIRE_PROTOCOL_VERSION = 2;
15
+ export declare const WIRE_PROTOCOL_VERSION = 3;
11
16
  /** KV state key under which a session stamps the version its log was written at. */
12
17
  export declare const WIRE_VERSION_KEY = "wire_version";
13
18
  /**
@@ -15,7 +20,8 @@ export declare const WIRE_VERSION_KEY = "wire_version";
15
20
  * Returning `null` DROPS the record (for a record that has no place in the new format).
16
21
  */
17
22
  export type RecordMigration = (raw: Record<string, unknown>) => Record<string, unknown> | null;
18
- /** Version 2 adds durable handoff linkage/provenance; every version-1 record remains valid. */
23
+ /** Version 2 adds durable handoff linkage/provenance; every version-1 record remains valid.
24
+ * Version 3 changes only the compaction record, which has no upgrade (see above). */
19
25
  export declare const RECORD_MIGRATIONS: Readonly<Record<number, RecordMigration>>;
20
26
  /**
21
27
  * Apply the migration chain to bring a raw record from `fromVersion` up to `toVersion`.
@@ -5,13 +5,20 @@
5
5
  *
6
6
  * Version 1 introduced the linear `AgentRecord` format. Version 2 adds
7
7
  * durable handoff linkage and seed provenance without invalidating version-1 records.
8
+ * Version 3 makes the history resets self-contained checkpoints: `context.apply_compaction`
9
+ * journals its kept tail (`kept`) instead of a `cutoff` into the history before it, and both
10
+ * resets may carry the session's state (`checkpoint`). A version-2 compaction record cannot be
11
+ * upgraded — its kept tail is not in the record — so it passes through unchanged and replay
12
+ * rejects it (see `foldCompactionRecord`).
8
13
  */
9
- export const WIRE_PROTOCOL_VERSION = 2;
14
+ export const WIRE_PROTOCOL_VERSION = 3;
10
15
  /** KV state key under which a session stamps the version its log was written at. */
11
16
  export const WIRE_VERSION_KEY = "wire_version";
12
- /** Version 2 adds durable handoff linkage/provenance; every version-1 record remains valid. */
17
+ /** Version 2 adds durable handoff linkage/provenance; every version-1 record remains valid.
18
+ * Version 3 changes only the compaction record, which has no upgrade (see above). */
13
19
  export const RECORD_MIGRATIONS = {
14
20
  1: (raw) => raw,
21
+ 2: (raw) => raw,
15
22
  };
16
23
  /**
17
24
  * Apply the migration chain to bring a raw record from `fromVersion` up to `toVersion`.
@@ -1,3 +1,4 @@
1
+ import type { ToolSchema } from "../protocol/tool-schema.ts";
1
2
  /**
2
3
  * `PromptOrigin` — a structured tag on a journaled message record saying WHERE the message
3
4
  * came from. It is the persistence-layer replacement for parsing intent back out of rendered
@@ -14,12 +15,17 @@
14
15
  */
15
16
  export interface UserPromptOrigin {
16
17
  readonly kind: "user";
17
- /** Present when the message arrived via the SteerBus: the enqueue-time correlation id. */
18
+ /**
19
+ * Present when the message arrived via the SteerBus: the id of its `steer.queued` record.
20
+ * Still the user's OWN words — typed mid-turn, or handed over by whoever holds the session's
21
+ * control surface (an app-server client, a managed API caller). Contrast `external`, which
22
+ * relays another party's words.
23
+ */
18
24
  readonly steerId?: string;
19
25
  }
20
26
  export interface UserFollowUpPromptOrigin {
21
27
  readonly kind: "user_follow_up";
22
- /** Present when the message arrived via the SteerBus: the enqueue-time correlation id. */
28
+ /** See `UserPromptOrigin.steerId`. */
23
29
  readonly steerId?: string;
24
30
  }
25
31
  export interface InjectionOrigin {
@@ -64,8 +70,27 @@ export interface CronMissedOrigin {
64
70
  /** Present when the message arrived via the SteerBus: the enqueue-time correlation id. */
65
71
  readonly steerId?: string;
66
72
  }
73
+ export interface LoadedToolSchema {
74
+ readonly sourceName: string;
75
+ readonly schema: ToolSchema;
76
+ }
67
77
  export interface CompactionSummaryOrigin {
68
78
  readonly kind: "compaction_summary";
79
+ /** Deferred-tool definitions the compacted prefix had loaded and the kept tail still calls.
80
+ * Recorded once per compaction so a surviving call stays declared and executable after its
81
+ * load point is gone (the counterpart of Claude Code's pre-compact discovered-tool list;
82
+ * definitions travel with it because nothing else durable holds them). */
83
+ readonly loadedTools?: readonly LoadedToolSchema[];
84
+ }
85
+ /** A catalog announcement actually present in this conversation's model-visible history. */
86
+ export interface ToolCatalogDeltaOrigin {
87
+ readonly kind: "tool_catalog_delta";
88
+ readonly added: readonly {
89
+ readonly name: string;
90
+ readonly sourceName: string;
91
+ readonly fingerprint: string;
92
+ }[];
93
+ readonly removed: readonly string[];
69
94
  }
70
95
  /** A message copied into a fresh conversation shard when ownership is handed to another agent. */
71
96
  export interface HandoffSeedOrigin {
@@ -74,16 +99,16 @@ export interface HandoffSeedOrigin {
74
99
  readonly fromAddress: string;
75
100
  }
76
101
  export type ExternalOriginMetadataValue = string | number | boolean | null;
77
- /** A prompt delivered by another agent/application through the host delivery API. */
102
+ /** Another party's words, relayed onto the session by whoever holds its control surface (a
103
+ * peer network, a webhook bridge, a managed API caller declaring `origin: "external"`). */
78
104
  export interface ExternalPromptOrigin {
79
105
  readonly kind: "external";
80
106
  readonly source: string;
81
- readonly deliveryId: string;
82
107
  readonly actor?: string;
83
108
  readonly metadata?: Readonly<Record<string, ExternalOriginMetadataValue>>;
84
- /** Present when the message was queued through the SteerBus. */
109
+ /** The id of its `steer.queued` record — every external message arrives through the SteerBus. */
85
110
  readonly steerId?: string;
86
111
  }
87
- export type PromptOrigin = UserPromptOrigin | UserFollowUpPromptOrigin | InjectionOrigin | BackgroundTaskOrigin | ExtensionMessageOrigin | CronJobOrigin | CronMissedOrigin | CompactionSummaryOrigin | HandoffSeedOrigin | ExternalPromptOrigin;
112
+ export type PromptOrigin = UserPromptOrigin | UserFollowUpPromptOrigin | InjectionOrigin | BackgroundTaskOrigin | ExtensionMessageOrigin | CronJobOrigin | CronMissedOrigin | CompactionSummaryOrigin | ToolCatalogDeltaOrigin | HandoffSeedOrigin | ExternalPromptOrigin;
88
113
  export declare const USER_PROMPT_ORIGIN: UserPromptOrigin;
89
114
  //# sourceMappingURL=origin.d.ts.map
@@ -1,16 +1,2 @@
1
- /**
2
- * `PromptOrigin` — a structured tag on a journaled message record saying WHERE the message
3
- * came from. It is the persistence-layer replacement for parsing intent back out of rendered
4
- * text: a settle notification carries `{kind:'background_task', …}` so a reducer reads the entity
5
- * id/status structurally instead of regexing a `<background-task-done>` tag.
6
- *
7
- * Lives at the store layer (below `loop`) so `AgentRecordBody` can carry it without a layer
8
- * inversion. Fields are primitives only — no import of capabilities/background types — so this
9
- * stays a leaf module. `status` is a plain string (the domain's own vocabulary).
10
- *
11
- * Pragmatic subset: only the kinds agent-framework produces today. Extensible by adding a
12
- * member when a new kind appears — kept a CLOSED discriminated union (no open `kind`) so
13
- * `origin.kind === '…'` narrows and exhaustiveness is checkable.
14
- */
15
1
  export const USER_PROMPT_ORIGIN = { kind: "user" };
16
2
  //# sourceMappingURL=origin.js.map
@@ -83,6 +83,7 @@ export declare class PgSessionRepository implements SessionRepository {
83
83
  fork(sourceId: string, input?: ForkSessionInput): Promise<SessionHandle>;
84
84
  delete(id: string, options?: DeleteSessionOptions): Promise<void>;
85
85
  restore(id: string): Promise<void>;
86
+ rename(id: string, title: string): Promise<void>;
86
87
  close(): Promise<void>;
87
88
  }
88
89
  /** Postgres-backed {@link SessionStorage}. Inject a `pg.Pool`; tables are created on first use. */