@bastani/atomic 0.9.37 → 0.9.38-alpha.10

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 (693) hide show
  1. package/CHANGELOG.md +151 -0
  2. package/README.md +8 -6
  3. package/dist/builtin/intercom/CHANGELOG.md +15 -0
  4. package/dist/builtin/intercom/broker/broker.ts +6 -4
  5. package/dist/builtin/intercom/broker/delivered-message-cache.ts +50 -4
  6. package/dist/builtin/intercom/broker/send-handler.ts +6 -4
  7. package/dist/builtin/intercom/index.bundle.mjs +89 -40
  8. package/dist/builtin/intercom/package.json +2 -2
  9. package/dist/builtin/mcp/package.json +1 -1
  10. package/dist/builtin/subagents/CHANGELOG.md +12 -0
  11. package/dist/builtin/subagents/README.md +9 -4
  12. package/dist/builtin/subagents/package.json +3 -3
  13. package/dist/builtin/subagents/src/extension/index.bundle.mjs +163 -158
  14. package/dist/builtin/web-access/CHANGELOG.md +7 -0
  15. package/dist/builtin/web-access/index.bundle.mjs +53 -15
  16. package/dist/builtin/web-access/package.json +2 -2
  17. package/dist/builtin/workflows/CHANGELOG.md +91 -0
  18. package/dist/builtin/workflows/README.md +5 -10
  19. package/dist/builtin/workflows/builtin/adversarial-verification.js +2 -2
  20. package/dist/builtin/workflows/builtin/{chunk-94f8zfz1.js → chunk-454hz1qt.js} +1 -1
  21. package/dist/builtin/workflows/builtin/{chunk-wf876n16.js → chunk-4bwtzyjq.js} +1 -1
  22. package/dist/builtin/workflows/builtin/{chunk-kb7s3gx2.js → chunk-5eh0brtd.js} +1 -1
  23. package/dist/builtin/workflows/builtin/{chunk-nkj4qhj6.js → chunk-85mx6wcf.js} +7 -7
  24. package/dist/builtin/workflows/builtin/{chunk-rhkg3d8e.js → chunk-8kkv04hz.js} +16 -16
  25. package/dist/builtin/workflows/builtin/chunk-8x61e0s7.js +3148 -0
  26. package/dist/builtin/workflows/builtin/{chunk-r97ndfvt.js → chunk-bjva9j5k.js} +1 -1
  27. package/dist/builtin/workflows/builtin/{chunk-a1ar035d.js → chunk-qdd897wm.js} +1 -1
  28. package/dist/builtin/workflows/builtin/{chunk-gyjck9z8.js → chunk-qjqn389g.js} +1 -1
  29. package/dist/builtin/workflows/builtin/{chunk-632fxeb8.js → chunk-x0vvjyzg.js} +1 -1
  30. package/dist/builtin/workflows/builtin/{chunk-3xffzzbg.js → chunk-y45tkftg.js} +11 -18
  31. package/dist/builtin/workflows/builtin/classify-and-act.js +2 -2
  32. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +2 -2
  33. package/dist/builtin/workflows/builtin/generate-and-filter.js +2 -2
  34. package/dist/builtin/workflows/builtin/goal.js +3 -3
  35. package/dist/builtin/workflows/builtin/index.js +11 -11
  36. package/dist/builtin/workflows/builtin/loop-until-done.js +2 -2
  37. package/dist/builtin/workflows/builtin/open-claude-design.js +2 -2
  38. package/dist/builtin/workflows/builtin/ralph.js +3 -3
  39. package/dist/builtin/workflows/builtin/tournament.js +2 -2
  40. package/dist/builtin/workflows/package.json +2 -2
  41. package/dist/builtin/workflows/src/authoring.d.ts +9 -12
  42. package/dist/builtin/workflows/src/durable/journal/conformance.d.ts +12 -0
  43. package/dist/builtin/workflows/src/durable/journal/internal.d.ts +1 -0
  44. package/dist/builtin/workflows/src/durable/journal/lease-expiry.d.ts +2 -0
  45. package/dist/builtin/workflows/src/durable/journal/legacy-journal-tables.d.ts +42 -0
  46. package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +35 -0
  47. package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +32 -0
  48. package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +48 -0
  49. package/dist/builtin/workflows/src/durable/journal/sqlite-run-journal.d.ts +7 -0
  50. package/dist/builtin/workflows/src/durable/journal/types.d.ts +95 -0
  51. package/dist/builtin/workflows/src/durable/journal/values.d.ts +5 -0
  52. package/dist/builtin/workflows/src/extension/index.bundle.mjs +29510 -64819
  53. package/dist/builtin/workflows/src/index.js +10767 -45878
  54. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +8 -14
  55. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +4 -20
  56. package/dist/bun/split-loader.js +0 -13
  57. package/dist/bun/split-loader.js.map +1 -1
  58. package/dist/cli/args.d.ts +3 -0
  59. package/dist/cli/args.d.ts.map +1 -1
  60. package/dist/cli/args.js +35 -5
  61. package/dist/cli/args.js.map +1 -1
  62. package/dist/cli/credential-print.d.ts.map +1 -1
  63. package/dist/cli/credential-print.js +4 -4
  64. package/dist/cli/credential-print.js.map +1 -1
  65. package/dist/cli/session-picker.d.ts +2 -2
  66. package/dist/cli/session-picker.d.ts.map +1 -1
  67. package/dist/cli/session-picker.js +5 -5
  68. package/dist/cli/session-picker.js.map +1 -1
  69. package/dist/core/agent-session-auto-compaction.d.ts +1 -1
  70. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  71. package/dist/core/agent-session-auto-compaction.js +2 -2
  72. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  73. package/dist/core/agent-session-bash.d.ts +2 -3
  74. package/dist/core/agent-session-bash.d.ts.map +1 -1
  75. package/dist/core/agent-session-bash.js +18 -10
  76. package/dist/core/agent-session-bash.js.map +1 -1
  77. package/dist/core/agent-session-boundaries.d.ts +6 -6
  78. package/dist/core/agent-session-boundaries.d.ts.map +1 -1
  79. package/dist/core/agent-session-boundaries.js +22 -22
  80. package/dist/core/agent-session-boundaries.js.map +1 -1
  81. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  82. package/dist/core/agent-session-compaction.js +3 -2
  83. package/dist/core/agent-session-compaction.js.map +1 -1
  84. package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
  85. package/dist/core/agent-session-custom-message-commit.js +10 -12
  86. package/dist/core/agent-session-custom-message-commit.js.map +1 -1
  87. package/dist/core/agent-session-events.d.ts.map +1 -1
  88. package/dist/core/agent-session-events.js +26 -14
  89. package/dist/core/agent-session-events.js.map +1 -1
  90. package/dist/core/agent-session-export.js +1 -1
  91. package/dist/core/agent-session-export.js.map +1 -1
  92. package/dist/core/agent-session-extension-bindings.d.ts +3 -3
  93. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  94. package/dist/core/agent-session-extension-bindings.js +98 -64
  95. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  96. package/dist/core/agent-session-message-queue.d.ts +2 -2
  97. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  98. package/dist/core/agent-session-message-queue.js +17 -8
  99. package/dist/core/agent-session-message-queue.js.map +1 -1
  100. package/dist/core/agent-session-methods.d.ts +17 -17
  101. package/dist/core/agent-session-methods.d.ts.map +1 -1
  102. package/dist/core/agent-session-methods.js.map +1 -1
  103. package/dist/core/agent-session-models.d.ts +2 -2
  104. package/dist/core/agent-session-models.d.ts.map +1 -1
  105. package/dist/core/agent-session-models.js +59 -42
  106. package/dist/core/agent-session-models.js.map +1 -1
  107. package/dist/core/agent-session-persistent-custom-messages.d.ts +4 -4
  108. package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
  109. package/dist/core/agent-session-persistent-custom-messages.js +16 -17
  110. package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
  111. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  112. package/dist/core/agent-session-prompt.js +6 -8
  113. package/dist/core/agent-session-prompt.js.map +1 -1
  114. package/dist/core/agent-session-retry.d.ts.map +1 -1
  115. package/dist/core/agent-session-retry.js +18 -16
  116. package/dist/core/agent-session-retry.js.map +1 -1
  117. package/dist/core/agent-session-runtime.d.ts +7 -8
  118. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  119. package/dist/core/agent-session-runtime.js +88 -100
  120. package/dist/core/agent-session-runtime.js.map +1 -1
  121. package/dist/core/agent-session-services.d.ts +1 -1
  122. package/dist/core/agent-session-services.d.ts.map +1 -1
  123. package/dist/core/agent-session-services.js +2 -2
  124. package/dist/core/agent-session-services.js.map +1 -1
  125. package/dist/core/agent-session-state.d.ts +4 -6
  126. package/dist/core/agent-session-state.d.ts.map +1 -1
  127. package/dist/core/agent-session-state.js +13 -8
  128. package/dist/core/agent-session-state.js.map +1 -1
  129. package/dist/core/agent-session-summary.js +1 -1
  130. package/dist/core/agent-session-summary.js.map +1 -1
  131. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  132. package/dist/core/agent-session-tool-registry.js +3 -1
  133. package/dist/core/agent-session-tool-registry.js.map +1 -1
  134. package/dist/core/agent-session-tree.d.ts +1 -1
  135. package/dist/core/agent-session-tree.d.ts.map +1 -1
  136. package/dist/core/agent-session-tree.js +8 -7
  137. package/dist/core/agent-session-tree.js.map +1 -1
  138. package/dist/core/agent-session-types.d.ts +2 -0
  139. package/dist/core/agent-session-types.d.ts.map +1 -1
  140. package/dist/core/agent-session-types.js.map +1 -1
  141. package/dist/core/agent-session.js +1 -1
  142. package/dist/core/agent-session.js.map +1 -1
  143. package/dist/core/auth-storage-backends.d.ts +2 -0
  144. package/dist/core/auth-storage-backends.d.ts.map +1 -1
  145. package/dist/core/auth-storage-backends.js +12 -0
  146. package/dist/core/auth-storage-backends.js.map +1 -1
  147. package/dist/core/auth-storage.d.ts +5 -0
  148. package/dist/core/auth-storage.d.ts.map +1 -1
  149. package/dist/core/auth-storage.js +46 -12
  150. package/dist/core/auth-storage.js.map +1 -1
  151. package/dist/core/cache-warmer.js +1 -1
  152. package/dist/core/cache-warmer.js.map +1 -1
  153. package/dist/core/compaction/branch-summarization.d.ts +3 -5
  154. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  155. package/dist/core/compaction/branch-summarization.js +6 -10
  156. package/dist/core/compaction/branch-summarization.js.map +1 -1
  157. package/dist/core/compaction/compaction-runner.d.ts +1 -0
  158. package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
  159. package/dist/core/compaction/compaction-runner.js +4 -1
  160. package/dist/core/compaction/compaction-runner.js.map +1 -1
  161. package/dist/core/compaction/pi-summary-fallback.d.ts +2 -1
  162. package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
  163. package/dist/core/compaction/pi-summary-fallback.js +6 -8
  164. package/dist/core/compaction/pi-summary-fallback.js.map +1 -1
  165. package/dist/core/compaction/utils.d.ts +2 -1
  166. package/dist/core/compaction/utils.d.ts.map +1 -1
  167. package/dist/core/compaction/utils.js +32 -7
  168. package/dist/core/compaction/utils.js.map +1 -1
  169. package/dist/core/export-html/index.js +1 -1
  170. package/dist/core/export-html/index.js.map +1 -1
  171. package/dist/core/export-html/template-js/entries-navigation.js +1 -1
  172. package/dist/core/export-html/template-js/message-tools.js +20 -7
  173. package/dist/core/export-html/template-js/tree-filter-render.js +1 -9
  174. package/dist/core/export-html/template.js +22 -17
  175. package/dist/core/extensions/api-types.d.ts +12 -12
  176. package/dist/core/extensions/api-types.d.ts.map +1 -1
  177. package/dist/core/extensions/api-types.js.map +1 -1
  178. package/dist/core/extensions/context-types.d.ts +4 -2
  179. package/dist/core/extensions/context-types.d.ts.map +1 -1
  180. package/dist/core/extensions/context-types.js.map +1 -1
  181. package/dist/core/extensions/extension-work.d.ts +1 -0
  182. package/dist/core/extensions/extension-work.d.ts.map +1 -1
  183. package/dist/core/extensions/extension-work.js +5 -1
  184. package/dist/core/extensions/extension-work.js.map +1 -1
  185. package/dist/core/extensions/index.d.ts +1 -1
  186. package/dist/core/extensions/index.d.ts.map +1 -1
  187. package/dist/core/extensions/index.js +1 -1
  188. package/dist/core/extensions/index.js.map +1 -1
  189. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  190. package/dist/core/extensions/loader-api.js +40 -42
  191. package/dist/core/extensions/loader-api.js.map +1 -1
  192. package/dist/core/extensions/loader-host-modules.d.ts +1 -1
  193. package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
  194. package/dist/core/extensions/loader-host-modules.js +6 -2
  195. package/dist/core/extensions/loader-host-modules.js.map +1 -1
  196. package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
  197. package/dist/core/extensions/loader-rollback.js +1 -0
  198. package/dist/core/extensions/loader-rollback.js.map +1 -1
  199. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  200. package/dist/core/extensions/loader-virtual-modules.js +1 -0
  201. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  202. package/dist/core/extensions/runner-context.d.ts +1 -0
  203. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  204. package/dist/core/extensions/runner-context.js +10 -3
  205. package/dist/core/extensions/runner-context.js.map +1 -1
  206. package/dist/core/extensions/runner-handlers.d.ts +1 -1
  207. package/dist/core/extensions/runner-handlers.d.ts.map +1 -1
  208. package/dist/core/extensions/runner-handlers.js.map +1 -1
  209. package/dist/core/extensions/runner.d.ts +5 -2
  210. package/dist/core/extensions/runner.d.ts.map +1 -1
  211. package/dist/core/extensions/runner.js +28 -12
  212. package/dist/core/extensions/runner.js.map +1 -1
  213. package/dist/core/extensions/runtime-types.d.ts +7 -7
  214. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  215. package/dist/core/extensions/runtime-types.js.map +1 -1
  216. package/dist/core/extensions/session-events.d.ts +5 -5
  217. package/dist/core/extensions/session-events.d.ts.map +1 -1
  218. package/dist/core/extensions/session-events.js.map +1 -1
  219. package/dist/core/extensions/workflow-events.d.ts +2 -0
  220. package/dist/core/extensions/workflow-events.d.ts.map +1 -1
  221. package/dist/core/extensions/workflow-events.js.map +1 -1
  222. package/dist/core/extensions/workflow-run-control.d.ts +3 -3
  223. package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
  224. package/dist/core/extensions/workflow-run-control.js +4 -4
  225. package/dist/core/extensions/workflow-run-control.js.map +1 -1
  226. package/dist/core/fast-model-routing.d.ts.map +1 -1
  227. package/dist/core/fast-model-routing.js +1 -0
  228. package/dist/core/fast-model-routing.js.map +1 -1
  229. package/dist/core/intercom-runtime-group.js +1 -1
  230. package/dist/core/intercom-runtime-group.js.map +1 -1
  231. package/dist/core/model-config.d.ts +774 -9
  232. package/dist/core/model-config.d.ts.map +1 -1
  233. package/dist/core/model-config.js +46 -24
  234. package/dist/core/model-config.js.map +1 -1
  235. package/dist/core/model-fallback-failures.d.ts.map +1 -1
  236. package/dist/core/model-fallback-failures.js +3 -1
  237. package/dist/core/model-fallback-failures.js.map +1 -1
  238. package/dist/core/model-resolver-cli.d.ts +2 -0
  239. package/dist/core/model-resolver-cli.d.ts.map +1 -1
  240. package/dist/core/model-resolver-cli.js +47 -143
  241. package/dist/core/model-resolver-cli.js.map +1 -1
  242. package/dist/core/model-resolver-defaults.js +5 -5
  243. package/dist/core/model-resolver-defaults.js.map +1 -1
  244. package/dist/core/model-resolver-patterns.d.ts +48 -22
  245. package/dist/core/model-resolver-patterns.d.ts.map +1 -1
  246. package/dist/core/model-resolver-patterns.js +154 -105
  247. package/dist/core/model-resolver-patterns.js.map +1 -1
  248. package/dist/core/model-resolver-scope.d.ts +6 -9
  249. package/dist/core/model-resolver-scope.d.ts.map +1 -1
  250. package/dist/core/model-resolver-scope.js +51 -53
  251. package/dist/core/model-resolver-scope.js.map +1 -1
  252. package/dist/core/model-resolver-types.d.ts +0 -6
  253. package/dist/core/model-resolver-types.d.ts.map +1 -1
  254. package/dist/core/model-resolver-types.js.map +1 -1
  255. package/dist/core/model-resolver.d.ts +3 -2
  256. package/dist/core/model-resolver.d.ts.map +1 -1
  257. package/dist/core/model-resolver.js +1 -1
  258. package/dist/core/model-resolver.js.map +1 -1
  259. package/dist/core/model-runtime-streaming.d.ts +9 -2
  260. package/dist/core/model-runtime-streaming.d.ts.map +1 -1
  261. package/dist/core/model-runtime-streaming.js +121 -10
  262. package/dist/core/model-runtime-streaming.js.map +1 -1
  263. package/dist/core/model-runtime.d.ts +6 -0
  264. package/dist/core/model-runtime.d.ts.map +1 -1
  265. package/dist/core/model-runtime.js +103 -2
  266. package/dist/core/model-runtime.js.map +1 -1
  267. package/dist/core/prompt-templates.d.ts.map +1 -1
  268. package/dist/core/prompt-templates.js +6 -2
  269. package/dist/core/prompt-templates.js.map +1 -1
  270. package/dist/core/provider-attribution.js +1 -1
  271. package/dist/core/provider-attribution.js.map +1 -1
  272. package/dist/core/resource-loader-reload.js +1 -1
  273. package/dist/core/resource-loader-reload.js.map +1 -1
  274. package/dist/core/resource-loader-types.d.ts +1 -1
  275. package/dist/core/resource-loader-types.d.ts.map +1 -1
  276. package/dist/core/resource-loader-types.js.map +1 -1
  277. package/dist/core/retry-policy.d.ts +5 -2
  278. package/dist/core/retry-policy.d.ts.map +1 -1
  279. package/dist/core/retry-policy.js +4 -3
  280. package/dist/core/retry-policy.js.map +1 -1
  281. package/dist/core/runtime-credentials.d.ts +1 -0
  282. package/dist/core/runtime-credentials.d.ts.map +1 -1
  283. package/dist/core/runtime-credentials.js +3 -0
  284. package/dist/core/runtime-credentials.js.map +1 -1
  285. package/dist/core/sdk-types.d.ts +4 -0
  286. package/dist/core/sdk-types.d.ts.map +1 -1
  287. package/dist/core/sdk-types.js.map +1 -1
  288. package/dist/core/sdk.d.ts +1 -1
  289. package/dist/core/sdk.d.ts.map +1 -1
  290. package/dist/core/sdk.js +145 -94
  291. package/dist/core/sdk.js.map +1 -1
  292. package/dist/core/session-lifecycle-work.d.ts +3 -0
  293. package/dist/core/session-lifecycle-work.d.ts.map +1 -1
  294. package/dist/core/session-lifecycle-work.js +2 -0
  295. package/dist/core/session-lifecycle-work.js.map +1 -1
  296. package/dist/core/session-manager-archive.d.ts +2 -16
  297. package/dist/core/session-manager-archive.d.ts.map +1 -1
  298. package/dist/core/session-manager-archive.js +8 -109
  299. package/dist/core/session-manager-archive.js.map +1 -1
  300. package/dist/core/session-manager-core.d.ts +53 -51
  301. package/dist/core/session-manager-core.d.ts.map +1 -1
  302. package/dist/core/session-manager-core.js +549 -315
  303. package/dist/core/session-manager-core.js.map +1 -1
  304. package/dist/core/session-manager-entries.d.ts.map +1 -1
  305. package/dist/core/session-manager-entries.js +5 -10
  306. package/dist/core/session-manager-entries.js.map +1 -1
  307. package/dist/core/session-manager-errors.d.ts +10 -0
  308. package/dist/core/session-manager-errors.d.ts.map +1 -0
  309. package/dist/core/session-manager-errors.js +27 -0
  310. package/dist/core/session-manager-errors.js.map +1 -0
  311. package/dist/core/session-manager-list.d.ts +1 -0
  312. package/dist/core/session-manager-list.d.ts.map +1 -1
  313. package/dist/core/session-manager-list.js +23 -25
  314. package/dist/core/session-manager-list.js.map +1 -1
  315. package/dist/core/session-manager-storage.d.ts +3 -12
  316. package/dist/core/session-manager-storage.d.ts.map +1 -1
  317. package/dist/core/session-manager-storage.js +60 -77
  318. package/dist/core/session-manager-storage.js.map +1 -1
  319. package/dist/core/session-manager-types.d.ts +4 -12
  320. package/dist/core/session-manager-types.d.ts.map +1 -1
  321. package/dist/core/session-manager-types.js +2 -1
  322. package/dist/core/session-manager-types.js.map +1 -1
  323. package/dist/core/session-manager-validation.d.ts +3 -0
  324. package/dist/core/session-manager-validation.d.ts.map +1 -1
  325. package/dist/core/session-manager-validation.js +18 -1
  326. package/dist/core/session-manager-validation.js.map +1 -1
  327. package/dist/core/session-manager.d.ts +3 -3
  328. package/dist/core/session-manager.d.ts.map +1 -1
  329. package/dist/core/session-manager.js +3 -3
  330. package/dist/core/session-manager.js.map +1 -1
  331. package/dist/core/session-mutation-queue.d.ts +3 -0
  332. package/dist/core/session-mutation-queue.d.ts.map +1 -0
  333. package/dist/core/session-mutation-queue.js +14 -0
  334. package/dist/core/session-mutation-queue.js.map +1 -0
  335. package/dist/core/session-resume-args.d.ts +4 -0
  336. package/dist/core/session-resume-args.d.ts.map +1 -0
  337. package/dist/core/session-resume-args.js +9 -0
  338. package/dist/core/session-resume-args.js.map +1 -0
  339. package/dist/core/session-storage.d.ts +26 -0
  340. package/dist/core/session-storage.d.ts.map +1 -0
  341. package/dist/core/session-storage.js +171 -0
  342. package/dist/core/session-storage.js.map +1 -0
  343. package/dist/core/session-store-list.d.ts +4 -0
  344. package/dist/core/session-store-list.d.ts.map +1 -0
  345. package/dist/core/session-store-list.js +28 -0
  346. package/dist/core/session-store-list.js.map +1 -0
  347. package/dist/core/settings-manager-basic-accessors.d.ts +1 -1
  348. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  349. package/dist/core/settings-manager-basic-accessors.js +1 -5
  350. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  351. package/dist/core/settings-merge.d.ts.map +1 -1
  352. package/dist/core/settings-merge.js +8 -2
  353. package/dist/core/settings-merge.js.map +1 -1
  354. package/dist/core/settings-schema.d.ts +76 -6
  355. package/dist/core/settings-schema.d.ts.map +1 -1
  356. package/dist/core/settings-schema.js +29 -20
  357. package/dist/core/settings-schema.js.map +1 -1
  358. package/dist/core/storage/database.d.ts +21 -0
  359. package/dist/core/storage/database.d.ts.map +1 -0
  360. package/dist/core/storage/database.js +2 -0
  361. package/dist/core/storage/database.js.map +1 -0
  362. package/dist/core/storage/errors.d.ts +64 -0
  363. package/dist/core/storage/errors.d.ts.map +1 -0
  364. package/dist/core/storage/errors.js +103 -0
  365. package/dist/core/storage/errors.js.map +1 -0
  366. package/dist/core/storage/index.d.ts +10 -0
  367. package/dist/core/storage/index.d.ts.map +1 -0
  368. package/dist/core/storage/index.js +8 -0
  369. package/dist/core/storage/index.js.map +1 -0
  370. package/dist/core/storage/node-sqlite.d.ts +7 -0
  371. package/dist/core/storage/node-sqlite.d.ts.map +1 -0
  372. package/dist/core/storage/node-sqlite.js +202 -0
  373. package/dist/core/storage/node-sqlite.js.map +1 -0
  374. package/dist/core/storage/prefix.d.ts +5 -0
  375. package/dist/core/storage/prefix.d.ts.map +1 -0
  376. package/dist/core/storage/prefix.js +15 -0
  377. package/dist/core/storage/prefix.js.map +1 -0
  378. package/dist/core/storage/provider.d.ts +58 -0
  379. package/dist/core/storage/provider.d.ts.map +1 -0
  380. package/dist/core/storage/provider.js +243 -0
  381. package/dist/core/storage/provider.js.map +1 -0
  382. package/dist/core/storage/run-journal.d.ts +93 -0
  383. package/dist/core/storage/run-journal.d.ts.map +1 -0
  384. package/dist/core/storage/run-journal.js +15 -0
  385. package/dist/core/storage/run-journal.js.map +1 -0
  386. package/dist/core/storage/schema.d.ts +3 -0
  387. package/dist/core/storage/schema.d.ts.map +1 -0
  388. package/dist/core/storage/schema.js +6 -0
  389. package/dist/core/storage/schema.js.map +1 -0
  390. package/dist/core/storage/selection.d.ts +16 -0
  391. package/dist/core/storage/selection.d.ts.map +1 -0
  392. package/dist/core/storage/selection.js +87 -0
  393. package/dist/core/storage/selection.js.map +1 -0
  394. package/dist/core/storage/session/conformance.d.ts +12 -0
  395. package/dist/core/storage/session/conformance.d.ts.map +1 -0
  396. package/dist/core/storage/session/conformance.js +674 -0
  397. package/dist/core/storage/session/conformance.js.map +1 -0
  398. package/dist/core/storage/session/entry-structure.d.ts +4 -0
  399. package/dist/core/storage/session/entry-structure.d.ts.map +1 -0
  400. package/dist/core/storage/session/entry-structure.js +83 -0
  401. package/dist/core/storage/session/entry-structure.js.map +1 -0
  402. package/dist/core/storage/session/errors.d.ts +54 -0
  403. package/dist/core/storage/session/errors.d.ts.map +1 -0
  404. package/dist/core/storage/session/errors.js +95 -0
  405. package/dist/core/storage/session/errors.js.map +1 -0
  406. package/dist/core/storage/session/jsonl-session-store.d.ts +72 -0
  407. package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -0
  408. package/dist/core/storage/session/jsonl-session-store.js +564 -0
  409. package/dist/core/storage/session/jsonl-session-store.js.map +1 -0
  410. package/dist/core/storage/session/legacy-format.d.ts +20 -0
  411. package/dist/core/storage/session/legacy-format.d.ts.map +1 -0
  412. package/dist/core/storage/session/legacy-format.js +89 -0
  413. package/dist/core/storage/session/legacy-format.js.map +1 -0
  414. package/dist/core/storage/session/legacy-session-store.d.ts +63 -0
  415. package/dist/core/storage/session/legacy-session-store.d.ts.map +1 -0
  416. package/dist/core/storage/session/legacy-session-store.js +239 -0
  417. package/dist/core/storage/session/legacy-session-store.js.map +1 -0
  418. package/dist/core/storage/session/legacy-session-summary.d.ts +11 -0
  419. package/dist/core/storage/session/legacy-session-summary.d.ts.map +1 -0
  420. package/dist/core/storage/session/legacy-session-summary.js +103 -0
  421. package/dist/core/storage/session/legacy-session-summary.js.map +1 -0
  422. package/dist/core/storage/session/memory-session-store.d.ts +33 -0
  423. package/dist/core/storage/session/memory-session-store.d.ts.map +1 -0
  424. package/dist/core/storage/session/memory-session-store.js +120 -0
  425. package/dist/core/storage/session/memory-session-store.js.map +1 -0
  426. package/dist/core/storage/session/scratch-directory.d.ts +2 -0
  427. package/dist/core/storage/session/scratch-directory.d.ts.map +1 -0
  428. package/dist/core/storage/session/scratch-directory.js +5 -0
  429. package/dist/core/storage/session/scratch-directory.js.map +1 -0
  430. package/dist/core/storage/session/session-summary.d.ts +24 -0
  431. package/dist/core/storage/session/session-summary.d.ts.map +1 -0
  432. package/dist/core/storage/session/session-summary.js +79 -0
  433. package/dist/core/storage/session/session-summary.js.map +1 -0
  434. package/dist/core/storage/session/sql-session-store.d.ts +49 -0
  435. package/dist/core/storage/session/sql-session-store.d.ts.map +1 -0
  436. package/dist/core/storage/session/sql-session-store.js +246 -0
  437. package/dist/core/storage/session/sql-session-store.js.map +1 -0
  438. package/dist/core/storage/session/types.d.ts +72 -0
  439. package/dist/core/storage/session/types.d.ts.map +1 -0
  440. package/dist/core/storage/session/types.js +2 -0
  441. package/dist/core/storage/session/types.js.map +1 -0
  442. package/dist/core/storage/session/validation.d.ts +7 -0
  443. package/dist/core/storage/session/validation.d.ts.map +1 -0
  444. package/dist/core/storage/session/validation.js +47 -0
  445. package/dist/core/storage/session/validation.js.map +1 -0
  446. package/dist/core/storage/testing.d.ts +15 -0
  447. package/dist/core/storage/testing.d.ts.map +1 -0
  448. package/dist/core/storage/testing.js +309 -0
  449. package/dist/core/storage/testing.js.map +1 -0
  450. package/dist/core/tasks/completion.d.ts.map +1 -1
  451. package/dist/core/tasks/completion.js +2 -4
  452. package/dist/core/tasks/completion.js.map +1 -1
  453. package/dist/core/tools/bash-session-environment.d.ts.map +1 -1
  454. package/dist/core/tools/bash-session-environment.js +0 -2
  455. package/dist/core/tools/bash-session-environment.js.map +1 -1
  456. package/dist/core/tools/malformed-tool-arguments.d.ts +3 -0
  457. package/dist/core/tools/malformed-tool-arguments.d.ts.map +1 -0
  458. package/dist/core/tools/malformed-tool-arguments.js +23 -0
  459. package/dist/core/tools/malformed-tool-arguments.js.map +1 -0
  460. package/dist/core/tools/read-url.d.ts.map +1 -1
  461. package/dist/core/tools/read-url.js +6 -1
  462. package/dist/core/tools/read-url.js.map +1 -1
  463. package/dist/core/tools/render-utils.d.ts +2 -0
  464. package/dist/core/tools/render-utils.d.ts.map +1 -1
  465. package/dist/core/tools/render-utils.js +19 -0
  466. package/dist/core/tools/render-utils.js.map +1 -1
  467. package/dist/core/tools/todos-model.js +3 -3
  468. package/dist/core/tools/todos-model.js.map +1 -1
  469. package/dist/core/tools/todos-mutations.js +2 -2
  470. package/dist/core/tools/todos-mutations.js.map +1 -1
  471. package/dist/core/tools/todos-render.js +1 -1
  472. package/dist/core/tools/todos-render.js.map +1 -1
  473. package/dist/core/tools/todos-storage.js +2 -2
  474. package/dist/core/tools/todos-storage.js.map +1 -1
  475. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  476. package/dist/extensions/codemode/execute.js +14 -1
  477. package/dist/extensions/codemode/execute.js.map +1 -1
  478. package/dist/extensions/codemode/tool.d.ts +1 -1
  479. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  480. package/dist/extensions/codemode/tool.js.map +1 -1
  481. package/dist/extensions/herdr/index.d.ts.map +1 -1
  482. package/dist/extensions/herdr/index.js +6 -8
  483. package/dist/extensions/herdr/index.js.map +1 -1
  484. package/dist/extensions/mcp/index.js +1 -1
  485. package/dist/extensions/mcp/index.js.map +1 -1
  486. package/dist/extensions/mcp/tools.d.ts.map +1 -1
  487. package/dist/extensions/mcp/tools.js +6 -1
  488. package/dist/extensions/mcp/tools.js.map +1 -1
  489. package/dist/index-extensions.d.ts +1 -1
  490. package/dist/index-extensions.d.ts.map +1 -1
  491. package/dist/index-extensions.js +1 -1
  492. package/dist/index-extensions.js.map +1 -1
  493. package/dist/index.d.ts +5 -2
  494. package/dist/index.d.ts.map +1 -1
  495. package/dist/index.js +5 -2
  496. package/dist/index.js.map +1 -1
  497. package/dist/main-session-options.d.ts.map +1 -1
  498. package/dist/main-session-options.js +1 -0
  499. package/dist/main-session-options.js.map +1 -1
  500. package/dist/main-session.d.ts +12 -2
  501. package/dist/main-session.d.ts.map +1 -1
  502. package/dist/main-session.js +151 -53
  503. package/dist/main-session.js.map +1 -1
  504. package/dist/main.d.ts.map +1 -1
  505. package/dist/main.js +97 -42
  506. package/dist/main.js.map +1 -1
  507. package/dist/modes/interactive/components/chat-session-host.d.ts +3 -1
  508. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  509. package/dist/modes/interactive/components/chat-session-host.js +18 -5
  510. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  511. package/dist/modes/interactive/components/extension-input.d.ts +1 -1
  512. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  513. package/dist/modes/interactive/components/extension-input.js +2 -2
  514. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  515. package/dist/modes/interactive/components/host-session-picker.js +1 -1
  516. package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
  517. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  518. package/dist/modes/interactive/components/scoped-models-selector.js +9 -5
  519. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  520. package/dist/modes/interactive/components/session-selector-delete.d.ts +1 -1
  521. package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
  522. package/dist/modes/interactive/components/session-selector-delete.js.map +1 -1
  523. package/dist/modes/interactive/components/session-selector-list.d.ts +12 -9
  524. package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
  525. package/dist/modes/interactive/components/session-selector-list.js +27 -25
  526. package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
  527. package/dist/modes/interactive/components/session-selector.d.ts +8 -4
  528. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  529. package/dist/modes/interactive/components/session-selector.js +31 -21
  530. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  531. package/dist/modes/interactive/components/tree-selector-component.d.ts +5 -1
  532. package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
  533. package/dist/modes/interactive/components/tree-selector-component.js +20 -3
  534. package/dist/modes/interactive/components/tree-selector-component.js.map +1 -1
  535. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
  536. package/dist/modes/interactive/components/tree-selector-content.js +2 -9
  537. package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
  538. package/dist/modes/interactive/interactive-bash-compact.js +1 -1
  539. package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
  540. package/dist/modes/interactive/interactive-deferred-startup.js +2 -2
  541. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  542. package/dist/modes/interactive/interactive-editor-actions.js +2 -2
  543. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
  544. package/dist/modes/interactive/interactive-extension-runtime.js +2 -0
  545. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  546. package/dist/modes/interactive/interactive-input-handling.js +6 -4
  547. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  548. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  549. package/dist/modes/interactive/interactive-mode-base.js +2 -1
  550. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  551. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  552. package/dist/modes/interactive/interactive-mode-helpers.js +7 -3
  553. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  554. package/dist/modes/interactive/interactive-mode-surface.d.ts +5 -5
  555. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  556. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  557. package/dist/modes/interactive/interactive-model-routing.js +12 -7
  558. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  559. package/dist/modes/interactive/interactive-queueing.js +8 -5
  560. package/dist/modes/interactive/interactive-queueing.js.map +1 -1
  561. package/dist/modes/interactive/interactive-selectors.js +2 -2
  562. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  563. package/dist/modes/interactive/interactive-session-routing.js +38 -14
  564. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  565. package/dist/modes/interactive/interactive-session-runtime.js +6 -0
  566. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  567. package/dist/modes/interactive/interactive-slash-commands.js +5 -3
  568. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  569. package/dist/modes/interactive/interactive-tui.d.ts +1 -0
  570. package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
  571. package/dist/modes/interactive/interactive-tui.js +9 -2
  572. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  573. package/dist/modes/interactive/program-status-reporter.d.ts +4 -0
  574. package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -1
  575. package/dist/modes/interactive/program-status-reporter.js +45 -6
  576. package/dist/modes/interactive/program-status-reporter.js.map +1 -1
  577. package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -1
  578. package/dist/modes/interactive-engine/create-isolated-runtime.js +8 -1
  579. package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
  580. package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
  581. package/dist/modes/interactive-engine/engine-args.js +11 -4
  582. package/dist/modes/interactive-engine/engine-args.js.map +1 -1
  583. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +2 -1
  584. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
  585. package/dist/modes/interactive-engine/extension-ui-bridge.js +9 -1
  586. package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
  587. package/dist/modes/interactive-engine/isolated-runtime.d.ts +1 -1
  588. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  589. package/dist/modes/interactive-engine/isolated-runtime.js +99 -74
  590. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  591. package/dist/modes/interactive-engine/protocol.d.ts +4 -0
  592. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  593. package/dist/modes/interactive-engine/protocol.js +39 -1
  594. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  595. package/dist/modes/rpc/rpc-bash-request-owners.js +1 -1
  596. package/dist/modes/rpc/rpc-bash-request-owners.js.map +1 -1
  597. package/dist/modes/rpc/rpc-client-api.d.ts +1 -1
  598. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  599. package/dist/modes/rpc/rpc-client-api.js +2 -2
  600. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  601. package/dist/modes/rpc/rpc-client-process.d.ts +2 -2
  602. package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
  603. package/dist/modes/rpc/rpc-client-process.js +20 -7
  604. package/dist/modes/rpc/rpc-client-process.js.map +1 -1
  605. package/dist/modes/rpc/rpc-client.d.ts +4 -1
  606. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  607. package/dist/modes/rpc/rpc-client.js +6 -2
  608. package/dist/modes/rpc/rpc-client.js.map +1 -1
  609. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  610. package/dist/modes/rpc/rpc-command-handler.js +12 -9
  611. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  612. package/dist/modes/rpc/rpc-provider-auth.js +2 -2
  613. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  614. package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
  615. package/dist/modes/rpc/rpc-session-binding.js +10 -0
  616. package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
  617. package/dist/modes/rpc/rpc-terminal-drain.d.ts.map +1 -1
  618. package/dist/modes/rpc/rpc-terminal-drain.js +11 -2
  619. package/dist/modes/rpc/rpc-terminal-drain.js.map +1 -1
  620. package/dist/modes/rpc/rpc-types.d.ts +6 -2
  621. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  622. package/dist/modes/rpc/rpc-types.js.map +1 -1
  623. package/dist/utils/canonical-path.d.ts +5 -0
  624. package/dist/utils/canonical-path.d.ts.map +1 -0
  625. package/dist/utils/canonical-path.js +26 -0
  626. package/dist/utils/canonical-path.js.map +1 -0
  627. package/dist/utils/paths.d.ts +1 -7
  628. package/dist/utils/paths.d.ts.map +1 -1
  629. package/dist/utils/paths.js +1 -15
  630. package/dist/utils/paths.js.map +1 -1
  631. package/docs/codemode.md +2 -0
  632. package/docs/compaction.md +2 -2
  633. package/docs/custom-provider/oauth.md +2 -2
  634. package/docs/custom-provider/override.md +3 -3
  635. package/docs/custom-provider/registration.md +7 -7
  636. package/docs/custom-provider/streaming.md +1 -1
  637. package/docs/custom-provider.md +5 -5
  638. package/docs/docs.json +6 -0
  639. package/docs/environment-variables.md +10 -2
  640. package/docs/extensions/api-reference.md +40 -19
  641. package/docs/extensions/authoring.md +1 -1
  642. package/docs/extensions/events.md +12 -8
  643. package/docs/extensions/ui.md +10 -0
  644. package/docs/extensions.md +2 -2
  645. package/docs/getting-started/installation.md +2 -4
  646. package/docs/json.md +1 -1
  647. package/docs/llama-cpp.md +95 -0
  648. package/docs/models/reference.md +9 -0
  649. package/docs/models-configuration.md +206 -0
  650. package/docs/models.md +11 -1
  651. package/docs/packages/authoring.md +1 -1
  652. package/docs/prompt-templates.md +2 -0
  653. package/docs/providers.md +13 -5
  654. package/docs/quickstart.md +2 -1
  655. package/docs/reference/cli.md +10 -6
  656. package/docs/rpc/protocol.md +10 -4
  657. package/docs/sdk/reference.md +16 -14
  658. package/docs/sdk/web-server.md +6 -7
  659. package/docs/sdk.md +67 -27
  660. package/docs/session-format.md +35 -34
  661. package/docs/sessions.md +56 -17
  662. package/docs/settings.md +38 -25
  663. package/docs/storage.md +387 -0
  664. package/docs/subagents.md +19 -6
  665. package/docs/tools.md +2 -0
  666. package/docs/usage.md +3 -2
  667. package/docs/workflows/api-reference.md +88 -60
  668. package/docs/workflows/authoring.md +2 -1
  669. package/docs/workflows/operations.md +32 -174
  670. package/docs/workflows/reliable-design.md +17 -17
  671. package/examples/extensions/bookmark.ts +2 -2
  672. package/examples/extensions/handoff.ts +2 -2
  673. package/examples/extensions/minimal-mode.ts +1 -8
  674. package/examples/extensions/plan-mode/index.ts +15 -13
  675. package/examples/extensions/preset.ts +8 -8
  676. package/examples/extensions/session-name.ts +1 -1
  677. package/examples/extensions/snake.ts +3 -1
  678. package/examples/extensions/space-invaders.ts +3 -1
  679. package/examples/extensions/subagent/display.ts +4 -6
  680. package/examples/extensions/tic-tac-toe.ts +80 -80
  681. package/examples/sdk/11-sessions.ts +5 -5
  682. package/examples/sdk/13-session-runtime.ts +7 -7
  683. package/examples/sdk/README.md +1 -1
  684. package/npm-shrinkwrap.json +53 -469
  685. package/package.json +17 -9
  686. package/schemas/models.schema.json +67 -34
  687. package/schemas/settings.schema.json +138 -27
  688. package/dist/builtin/workflows/builtin/chunk-7fvrnzhb.js +0 -8
  689. package/dist/builtin/workflows/builtin/chunk-8c3ae7tt.js +0 -11609
  690. package/dist/core/session-manager-migrations.d.ts +0 -11
  691. package/dist/core/session-manager-migrations.d.ts.map +0 -1
  692. package/dist/core/session-manager-migrations.js +0 -80
  693. package/dist/core/session-manager-migrations.js.map +0 -1
package/docs/sdk.md CHANGED
@@ -24,6 +24,8 @@ This page covers the SDK quick start, its core concepts, and one complete exampl
24
24
 
25
25
  For a custom host that runs background work, see [Owner-bound task supervisor](/sdk/reference#owner-bound-task-supervisor-s1), [Supervised command SDK](/sdk/reference#supervised-command-sdk), and [Task transcript references](/sdk/reference#task-transcript-references).
26
26
 
27
+ For the standalone SQLite facade and adapter conformance suite, see [SQLite storage API](/storage).
28
+
27
29
  Not sure the SDK is the right integration mode? Compare it with RPC and JSON mode on [Programmatic use](/programmatic).
28
30
 
29
31
  To serve an agent over HTTP, see [Embedding Atomic in a web server](/sdk/web-server), which walks through a Next.js App Router route that streams session output to a browser.
@@ -115,7 +117,7 @@ When upgrading an existing host:
115
117
 
116
118
  - Remove manual registration of Atomic's shipped builtin extensions. They and their resources are included by default. Use `builtins` to disable packages; use `tools`/`excludedTools` to control tool access. An empty tool allowlist also excludes Intercom.
117
119
  - Supply all five `HostInput` methods (`confirm`, `select`, `input`, `editor`, `questionnaire`) through `extensionBindings.humanInput`. Preserve question text and option values, honor each request's abort signal, and return literal `true` only for explicit approval. No adapter is not consent: ordinary dialogs reject with `HumanInputUnavailable`, while required durable workflow gates remain pending. Do not translate cancellation into approval.
118
- - Treat a headless workflow launch as acceptance, not completion. Inspect its run ID/status. After reconnecting, resume that existing run and bind the new adapter with `session.bindExtensions({ humanInput })`; do not start a second run to answer an outstanding question. Durable resume requires working workflow persistence; inspect the original run's status and correct the reported database problem before retrying.
120
+ - Treat a headless workflow launch as acceptance, not completion. Inspect its run ID/status. After reconnecting, resume that run and bind the new adapter with `session.bindExtensions({ humanInput })`; do not start a second run to answer an outstanding question. Restore journal access before retrying a storage failure.
119
121
  - Always `await session.dispose()` in `finally`, including on failure. Disposal is asynchronous and can reject with `ShutdownFailed` after attempting all cleanup; do not hide that rejection or call `process.exit()` to force a successful shutdown. Each session owns its own work, even when services are shared.
120
122
 
121
123
  MCP servers and web providers still require their normal configuration and credentials. Importing the SDK does not connect them or take over standard input. Route host diagnostics through `extensionBindings.onDiagnostic`; a missing provider or extractor is an error, not an empty successful result.
@@ -158,6 +160,43 @@ const { session } = await createAgentSession({
158
160
  });
159
161
  ```
160
162
 
163
+ ### Session storage
164
+
165
+ `createAgentSession()` persists sessions in `~/.atomic/workflows/journal.sqlite` by default, sharing the file with workflow runs under separate `session_` and `wf_` table prefixes. Pass `sessionStore` to choose storage explicitly:
166
+
167
+ ```typescript
168
+ const { session } = await createAgentSession({
169
+ sessionStore: { kind: "sqlite", path: "./sessions.sqlite", prefix: "project_" },
170
+ });
171
+ ```
172
+
173
+ Other selections are `{ kind: "jsonl", dir }`, `{ kind: "memory" }`, `{ kind: "database", database, prefix? }`, and `{ kind: "adapter", module, options?, secrets?, prefix? }`. `database` must implement the async `SqliteDatabase` facade. Install your own driver and expose an adapter module for a remote database; Atomic bundles only its local `node:sqlite` adapter. See [Storage adapters](/storage).
174
+
175
+ `sessionStore` also accepts a `SessionStore` instance. A supplied `sessionManager` takes precedence and remains caller-owned. Otherwise, explicit SDK storage wins over the session-directory environment variable, `sessions.storage`, shared `storage`, and the persistent default. Memory is never a default or an opening-failure fallback. The `sessionDir` factory option has been removed; use a JSONL `sessionStore` selection instead. See [Session storage settings](/settings#sessions) for scope and path rules.
176
+
177
+ Atomic closes stores it opens from a selection when the session is disposed, after pending writes finish. Supplied `SessionStore` instances and stores belonging to supplied managers remain caller-owned. With `{ kind: "database", database }`, Atomic closes its store but leaves your database open. Always await `session.dispose()` and close caller-owned stores when no session still uses them.
178
+
179
+ Resume by opening the ID in the chosen store, then pass that manager to the factory:
180
+
181
+ ```typescript
182
+ import { createAgentSession, resolveSessionStore, SessionManager } from "@bastani/atomic";
183
+
184
+ const store = await resolveSessionStore(process.cwd());
185
+ try {
186
+ const manager = await SessionManager.open(store, savedSessionId);
187
+ const { session } = await createAgentSession({ sessionManager: manager });
188
+ try {
189
+ await session.prompt("Continue the task");
190
+ } finally {
191
+ await session.dispose();
192
+ }
193
+ } finally {
194
+ await store.close();
195
+ }
196
+ ```
197
+
198
+ Await every `SessionManager` mutation before reading dependent state. Writes resolve after commit; a failure rejects with a typed error without publishing the failed entry. There is no `flush()` step. Extension `pi.appendEntry`, `pi.setSessionName`, `pi.setLabel`, and `pi.setThinkingLevel` also return promises. `ExtensionContext.sessionSignal` aborts when reload or shutdown starts, before admitted work is drained. Use it to stop waiting on long-running command resources, but keep awaiting any session write already started. See [SessionManager API](/session-format#sessionmanager-api) and [Storage errors](/storage#storage-errors).
199
+
161
200
  ### Human input without a terminal
162
201
 
163
202
  Pass `extensionBindings.humanInput` to answer extension dialogs and `ask_user_question` in a Node host. `HostInput` requires all five methods: `confirm`, `select`, `input`, `editor` and `questionnaire`. `QuestionParams` and `QuestionnaireResult` are exported from `@bastani/atomic`; questionnaire answers retain their question indices, answer kinds, selections, previews and notes.
@@ -230,9 +269,26 @@ Web provider configuration caches are session-local. Configuration discovery and
230
269
 
231
270
  `session.sessionSummary` returns the current branch's latest `SessionSummaryEntry`, or `undefined` when none is available. Read `summary` for the generated text and `summarizedThroughId` for the last message it describes. `SessionManager.list()` and `SessionManager.listAll()` expose those same fields on each `SessionInfo`. Stored summaries remain readable when `sessionSummary.enabled` is false; that setting controls generation only.
232
271
 
272
+ ### Workflow journal selection
273
+
274
+ Standalone workflow `run()` accepts `RunOpts.journal` to choose a local SQLite file, a caller-owned connection, process-local memory, or a supplied `RunJournal`:
275
+
276
+ ```typescript
277
+ import { run } from "@bastani/atomic/workflows";
278
+
279
+ await run(myWorkflow, inputs, { journal: { path: "./workflow-runs.sqlite" } });
280
+ await run(myWorkflow, inputs, { journal: { memory: true } });
281
+ ```
282
+
283
+ Use `{ database, prefix? }` for an async `SqliteDatabase` facade; Atomic never closes the caller-owned database. To use a driver selected by module specifier, pass `{ adapter, options?, secrets?, prefix? }`. Atomic bundles no remote drivers. A supplied `RunJournal` is used as-is. Memory is an explicit opt-in for tests or ephemeral runs and cannot recover runs after process exit. See [Storage adapters](/storage#selecting-an-adapter).
284
+
285
+ Custom journals implement the full `RunJournal` interface, including `deleteOwnedRun(lease, expectSeq?)` for atomic lease-fenced deletion with an optional sequence check. A stale lease rejects with `StaleLeaseError` without deleting the successor's data. Open a facade-backed journal with `await SqlRunJournal.open(database, { prefix })`, or use `await openSqlRunJournal(pathOrDatabase?)` for the node adapter. Validate custom journals with `registerRunJournalConformance`; see [Choosing the durable backend](/workflows/api-reference#choosing-the-durable-backend).
286
+
287
+ Without a per-run option, a non-empty `ATOMIC_WORKFLOW_JOURNAL_PATH` overrides `workflows.journal`, which overrides shared top-level `storage`. Nearer-scope settings replace whole selections. Relative settings paths resolve against Atomic home. The default journal is `~/.atomic/workflows/journal.sqlite`; an empty shared selection uses `~/.atomic/storage.sqlite`. Keep the original journal and working directory to resume saved runs. Invalid configuration and storage failures reject rather than switching to memory. See [Workflow storage settings](/settings#workflow-storage).
288
+
233
289
  ### Workflow run control
234
290
 
235
- `session.workflows` controls this session's workflow runs without slash commands or the model-facing `workflow` tool. A fresh session can also inspect a durable root from another session by its full UUID, within the same working directory and configured workflow database. Inspection stays read-only and does not add the run to `listRuns()`.
291
+ `session.workflows` controls this session's runs without slash commands or the model-facing `workflow` tool. A fresh session can inspect a durable root by its full UUID within the same working directory and journal. Inspection stays read-only and does not add the run to `listRuns()`.
236
292
 
237
293
  ```typescript
238
294
  interface SessionWorkflows {
@@ -251,11 +307,11 @@ interface SessionWorkflows {
251
307
 
252
308
  `listRuns()` returns the same per-run data as `workflow status`: id, workflow name, status, active stages, and unanswered prompts (`awaitingInput`). Run IDs accept the full UUID or a unique 8-character prefix. `getRun()`, `getStages()`, `pause()` and `quit()` resolve a prefix against the runs this session holds and reject it at once when none matches, so pass the full UUID for a run recorded by an earlier process. `pause`, `quit` and `resume` resolve with the tool's acknowledged outcome: `action`, `runId` (`--all` for a batch), a `status` of `ok`, `running`, `paused`, `partial`, `noop` or `cancelled`, and a human-readable `message`. A `noop` means the request was understood and found nothing to change, such as pausing a run that already ended. A `partial` outcome means part of the request took effect. For `pause({ all: true })` and `quit({ all: true })`, `partial` means this call stopped at least one run and others are still active: `failedRuns` lists each run that is still active with its `runId`, a `reason` (for example `pause_failed` or `no_active_stages`) and a `message`, so check `outcome.status === "partial"` before treating a batch stop as complete. If active runs could not be stopped and this call stopped none, the call rejects with `WorkflowRunControlError` (`WORKFLOW_RUN_CONTROL_FAILED`) whose `failedRuns` carries the same list, even when other runs were already paused. Runs that are already paused or already ended are not failures, and a batch with no active run left to stop resolves as a `noop`. Call `getRun()` before retrying.
253
309
 
254
- After an owning process crashes, create a new authorized SDK session with the original `cwd` and workflow database configuration. Keep the workflow definition available, then call `getRun(runId)` with the saved full UUID. Once its progress has been stale for about two minutes and its database ownership connection is gone, status reports `crashed`. `resume(runId)` claims the durable run only after the database excludes the previous owner and any unfinished database writes. It continues under the same UUID and replays completed checkpoints. This works with `SessionManager.inMemory()` and does not require reopening a session file. Concurrent recovery attempts admit only one executor; inspect again if another caller won the claim.
310
+ After an owning process crashes, create a new authorized SDK session with the original `cwd` and workflow journal. Keep the workflow definition available, then call `getRun(runId)` with the saved full UUID. Once the journal lease has expired (about two minutes without renewal), status reports `crashed`. `resume(runId)` claims the run under a new fenced lease, keeps its UUID, and replays completed checkpoints. This works with `SessionManager.inMemory()` and does not require reopening a session file. Concurrent recovery attempts admit only one executor; inspect again if another caller won the claim.
255
311
 
256
- A healthy connected foreign owner remains read-only, even while a long-running tool has not refreshed workflow progress or a VM clone cannot see its PID. `pause()` and `quit()` still require its owning session, and `resume()` cannot adopt another session's live or terminal run, or a paused run whose owning session is still open. Missing ownership metadata, a different working directory, or unavailable database ownership verification prevents adoption. Older runs without database-fenced ownership remain inspectable but cannot use this distributed recovery path. Recovery from a crashed foreign process requires the full UUID, not a prefix. A host using only the non-durable in-memory workflow backend cannot recover after process loss.
312
+ A run with a live foreign lease remains read-only, even while a long-running tool has not refreshed progress. `pause()` and `quit()` require the owning session. Missing ownership metadata, a different working directory, or unavailable journal storage prevents adoption. Use the full UUID to recover a foreign run.
257
313
 
258
- A run launched through the model-facing `workflow` tool can also move to another session without a crash. Disposing its owning session with `session.dispose()` stops that session's in-flight runs at their last checkpoint and records in the workflow database that the session released every checkpointed run it paused. Afterward, any authorized SDK session with the same `cwd` and workflow database can call `resume(runId)` with the full UUID, in the same process or after the owning process has exited. The adopting session becomes the run's owner, the run continues under the same UUID, and completed checkpoints replay without rerunning their callbacks.
314
+ Disposing an owning session with `await session.dispose()` stops its in-flight runs at their last checkpoint and records their release in the journal. Another authorized SDK session with the same `cwd` and journal can then call `resume(runId)`. The adopting session becomes the owner, and completed checkpoints replay without rerunning their callbacks.
259
315
 
260
316
  Workflow resume is project-scoped. SDK and workflow-tool resume calls for a run from a different `cwd` return an actionable error without changing it. To continue in a different project, use `/workflow resume <id>` interactively and confirm the fork into the current directory. The fork receives a new run ID and copies saved progress; the original run is left untouched. To keep the original ID, create the successor session with the original `cwd`.
261
317
 
@@ -265,27 +321,11 @@ await owner.dispose(); // quits in-flight runs at their last checkpoint and rele
265
321
  await successor.workflows.resume(runId); // adopts the run, even from another process
266
322
  ```
267
323
 
268
- Switching the host to another session (`/new`, `/fork`, `/resume`) releases the previous session's paused runs the same way, so the new session can adopt them with `resume(runId)`, through its model's `workflow` tool (`action: "resume"`), or with the `/workflow resume <id>` slash command. Until a run is adopted, the new session's model can inspect it with the tool's `status` and `stages` actions; `pause`, `quit`, and `answer` stay refused until it owns the run. The first session to adopt a released run becomes its owner; a later attempt is refused. In the process that released the run the error reads `Workflow <id> is now owned by another session; it was already adopted after its previous session was switched away.`; a different process sharing the database reports `Workflow instance belongs to another caller/session.`. A paused run whose owner crashed or was killed before leaving, and any run whose owning session is still open, stays refused with `Workflow instance belongs to another caller/session.`. Reloading does not release runs. Finished runs are never resumable, whoever owns them.
269
-
270
- Live-cloned SDK hosts must share one authoritative PostgreSQL server and database. Configure a shared database endpoint for those hosts. Copying the managed PostgreSQL directory into another VM creates an independent database, even if both use the same `localhost` URL; separate databases cannot enforce cross-VM ownership exclusion.
271
-
272
- Use a direct PostgreSQL connection or a proxy that preserves each client's database session. Ownership locks and write authorization depend on session affinity. Transaction-mode and statement-mode pooling, including those PgBouncer modes, are unsupported for the workflow database.
273
-
274
- Database fencing protects ownership and durable checkpoints, not arbitrary external effects. If an owner loses its database connection, recovery may overlap an unfinished callback in that still-running process. The old owner cannot save new checkpoints, but an interrupted `ctx.tool` callback can be retried before the old callback stops. Make external effects idempotent, for example by passing a stable run/node operation key to an API that deduplicates requests. Completed checkpoints are replayed without rerunning their callbacks; unfinished callbacks do not have exactly-once execution guarantees.
275
-
276
- An execution that loses its ownership connection cannot silently regain write authority. Restore database availability, inspect the retained run, and resume explicitly. Recovery uses a fresh execution generation while the disconnected generation stays fenced. Keep the database and completed checkpoints; deleting them is not a recovery step.
277
-
278
- For an older run without database-fenced ownership, stop every older Atomic worker connected to its workflow database before enrollment. Upgrade the recovery host, retain the original database and workflow definition, and create an authorized SDK session with the original `cwd`. Inspect the full UUID, then explicitly confirm the stopped-worker prerequisite:
279
-
280
- ```ts
281
- await session.workflows.resume(runId, {
282
- legacyRecovery: { olderWorkersStopped: true },
283
- });
284
- ```
324
+ Switching sessions (`/new`, `/fork`, `/resume`) also releases the previous session's paused runs for adoption. Reloading does not release runs. A paused run whose owning session has not released it stays protected; finished runs are not resumable.
285
325
 
286
- This enrolls an eligible legacy root in database fencing and resumes it under the same UUID, preserving completed checkpoints. The option is an operator assertion, not a mechanism that stops workers. Never pass it while an older worker may still be executing. It does not permit recovery in another working directory, stage-only enrollment, or overriding a healthy fenced owner. Ordinary `resume(runId)` does not automatically adopt an unfenced legacy owner; inspection and existing owner-scoped controls remain available.
326
+ Journal fencing protects ownership and durable checkpoints, not arbitrary external effects. An interrupted `ctx.tool` callback can run again if its result was not checkpointed. Make external effects idempotent, for example by using a stable run/node operation key with an API that deduplicates requests.
287
327
 
288
- If the recovery host crashes after enrollment but before execution starts, inspect the full UUID and retry the same explicit option from a fresh session. Retry is permitted only for an interrupted enrollment whose database owner is no longer live. It does not allow takeover of another session's generally paused or blocked fenced run.
328
+ If storage fails, preserve the journal and run ID, restore access, inspect the retained run, and resume explicitly. A failed pause leaves the local scheduler paused; resume retries the journal transition before releasing it. A failed resume keeps the scheduler paused and surfaces the error.
289
329
 
290
330
  Pausing a run doesn't park a stage that is waiting on a prompt, including an `ask_user_question` delivered through `HostInput.questionnaire`. If no other work is active, `pause(runId)` and `pause({ all: true })` mark the run `paused` without cancelling its question. Questions not yet shown wait until the run resumes. A later pause counts it as already paused. If your host then answers an already-open prompt, the stage can continue its turn before you call `resume`. To keep a paused run fully stopped, hold prompt answers until you resume it.
291
331
 
@@ -299,7 +339,7 @@ Requests that cannot be carried out reject with a subclass of `WorkflowRunContro
299
339
  | `WorkflowStageNotFoundError` | `WORKFLOW_STAGE_NOT_FOUND` | `stageId` matches no stage of the run, or the stage has no control to pause. |
300
340
  | `WorkflowStageAmbiguousError` | `WORKFLOW_STAGE_AMBIGUOUS` | `stageId` matches more than one stage; pass a more specific identifier. |
301
341
  | `WorkflowStageResumeUnsupportedError` | `WORKFLOW_STAGE_RESUME_UNSUPPORTED` | A durable run resumes as a whole; call `resume()` without `stageId`. |
302
- | `WorkflowRunDatabaseError` | `WORKFLOW_RUN_DATABASE` | Workflow durability is unavailable, including when the database cannot be inspected to check a run's owner during `pause()` or `quit()`. Restore the database, then inspect the run before retrying. |
342
+ | `WorkflowRunStorageError` | `WORKFLOW_RUN_STORAGE` | The workflow journal is unavailable, closed, or failed. Restore storage access and inspect the retained run before retrying. |
303
343
  | `WorkflowRunControlError` | `WORKFLOW_RUN_CONTROL_FAILED` | Another failure; `message` explains it. |
304
344
  | `WorkflowRunControlUnavailableError` | `WORKFLOW_RUN_CONTROL_UNAVAILABLE` | The workflows package is disabled, or the session was disposed. |
305
345
 
@@ -449,7 +489,7 @@ interface AgentSession {
449
489
 
450
490
  Always `await session.dispose()` in `finally`. Disposal immediately refuses new work, cancels and drains owned operations, settles questions, shuts down extensions and releases session leases. Repeated calls await the same outcome.
451
491
 
452
- A `ShutdownFailed` error contains component failures in `errors`; cleanup still attempts the remaining components. Caller-supplied managers and model runtimes remain borrowed, and other sessions remain usable. Use `abort()` to cancel current work without destroying the session.
492
+ A `ShutdownFailed` error contains component failures in `errors`; cleanup still attempts the remaining components. Stores opened by the SDK, including stores created from a `sessionStore` selection, are released after session work and shutdown handlers finish. A failed session initialization releases its acquired store too. Caller-supplied `SessionStore` instances, session managers, databases, and model runtimes retain their caller-managed lifetimes. Close a supplied store or database only after its other users are done. Disposing one session does not close another session's store or a shared journal. Use `abort()` to cancel current work without destroying the session.
453
493
 
454
494
  Captured extension APIs also refuse new execution, mutations and registrations as soon as close or reload begins. Already-admitted `pi.exec()` calls remain part of the awaited drain; provide `signal` or `timeout` when invoking subprocesses that might not finish on their own. `abort()` alone does not retire the API. A rejected transactional reload restores the surviving generation's action admission.
455
495
 
@@ -552,7 +592,7 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
552
592
  const runtime = await createAgentSessionRuntime(createRuntime, {
553
593
  cwd: process.cwd(),
554
594
  agentDir: getAgentDir(),
555
- sessionManager: SessionManager.create(process.cwd()),
595
+ sessionManager: await SessionManager.create(process.cwd()),
556
596
  });
557
597
  ```
558
598
 
@@ -1,30 +1,24 @@
1
1
  # Session File Format
2
2
 
3
- Sessions are stored as JSONL (JSON Lines) files. Each line is a JSON object with a `type` field. Session entries form a tree structure via `id`/`parentId` fields, enabling in-place branching without creating new files.
3
+ This page describes format-4 JSONL files used by explicit JSONL stores and exports. Sessions default to SQLite; see [Session storage](/sessions#session-storage) to choose a store. In JSONL, each line is a JSON object with a `type` field. Session entries form a tree through `id` and `parentId`.
4
4
 
5
5
  ## File Location
6
6
 
7
7
  ```
8
- ~/.atomic/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl
8
+ <selected-jsonl-directory>/<timestamp>_<session-id-hash>.jsonl
9
9
  ```
10
10
 
11
- Where `<path>` is the working directory with `/` replaced by `-`.
11
+ `sessions.storage.dir` and `--session-dir` select the directory containing the JSONL files. Session IDs, not these paths, are used for resume and fork selection. Local artifacts and tool-result files remain on the filesystem even with a database-backed session.
12
12
 
13
13
  ## Deleting Sessions
14
14
 
15
- Sessions can be removed by deleting their `.jsonl` files under `~/.atomic/agent/sessions/` (legacy `~/.pi/agent/sessions/` may exist from older Pi installs).
15
+ For an explicitly selected JSONL store, sessions can be removed by deleting their `.jsonl` files. Do not delete the shared SQLite database to remove a single session.
16
16
 
17
- Atomic also supports deleting sessions interactively from `/resume` (select a session and press `CTRL+D`, then confirm). When available, Atomic uses the `trash` CLI to avoid permanent deletion.
17
+ Delete individual sessions from `/resume`: select a session, press `CTRL+D`, then confirm. Database stores delete the selected session record. JSONL stores use the `trash` CLI when available.
18
18
 
19
19
  ## Session Version
20
20
 
21
- Sessions have a version field in the header:
22
-
23
- - **Version 1**: Linear entry sequence (legacy, auto-migrated on load)
24
- - **Version 2**: Tree structure with `id`/`parentId` linking
25
- - **Version 3**: Renamed `hookMessage` role to `custom` (extensions unification)
26
-
27
- Existing sessions are automatically migrated to the current version (v3) when loaded.
21
+ SessionManager writes version 4 headers with `createdAt` and `parentSessionId`. Sessions in formats 1, 2, and 3, and early version-4 files whose header has `timestamp` and `parentSession` instead, are upgraded automatically when opened, resumed, imported, or forked. Reading converts older records in memory; listing sessions and looking up headers leave files unchanged. Opening an older JSONL session persists its upgrade atomically under the file lock before new entries are saved. Future versions, unrecognized version values, and structurally invalid entries remain rejected; unloadable sessions are omitted from resume listings. A complete final record without a newline is accepted; a torn final record is rejected.
28
22
 
29
23
  ## Source Files
30
24
 
@@ -200,25 +194,25 @@ interface SessionEntryBase {
200
194
 
201
195
  ### SessionHeader
202
196
 
203
- First line of the file. Metadata only, not part of the tree (no `id`/`parentId`).
197
+ First line of the file. Metadata only, not a tree entry. Its `id` identifies the session; it has no `parentId`.
204
198
 
205
199
  ```json
206
- {"type":"session","version":3,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project"}
200
+ {"type":"session","version":4,"id":"uuid","createdAt":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project"}
207
201
  ```
208
202
 
209
203
  For sessions with a parent (created via `/fork`, `/clone`, or `newSession({ parentSession })`):
210
204
 
211
205
  ```json
212
- {"type":"session","version":3,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","parentSession":"/path/to/original/session.jsonl"}
206
+ {"type":"session","version":4,"id":"uuid","createdAt":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","parentSessionId":"original-session-id"}
213
207
  ```
214
208
 
215
209
  Workflow-owned sessions carry both `internal: true` and complete `workflow` linkage. Atomic writes this classification before the transcript becomes visible wherever possible, including workflow stage forks and fresh/forked subagents. A session is excluded from normal resume history only when `internal` is the exact boolean `true` and `workflow.runId`, `workflow.stageId`, and `workflow.stageName` are all non-empty strings:
216
210
 
217
211
  ```json
218
- {"type":"session","version":3,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","internal":true,"workflow":{"runId":"run-1","stageId":"stage-build","stageName":"build"}}
212
+ {"type":"session","version":4,"id":"uuid","createdAt":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","internal":true,"workflow":{"runId":"run-1","stageId":"stage-build","stageName":"build"}}
219
213
  ```
220
214
 
221
- Malformed, incomplete, workflow-only, or truthy non-boolean legacy markers remain visible in normal history. Atomic does not infer workflow ownership from `parentSession`, so ordinary user-created forks are unaffected. Valid workflow classification is inherited when an internal workflow transcript is branched or forked.
215
+ Malformed or incomplete workflow markers remain visible in normal history. Atomic does not infer workflow ownership from `parentSessionId`, so ordinary user-created forks are unaffected. Valid workflow classification is inherited when an internal workflow transcript is branched or forked.
222
216
 
223
217
  ### SessionMessageEntry
224
218
 
@@ -431,25 +425,30 @@ for (const line of lines) {
431
425
 
432
426
  Key methods for working with sessions programmatically.
433
427
 
428
+ Await `create`, `open`, `continueRecent`, `forkFrom`, and all session mutations. A resolved mutation has committed to its store; a failed write rejects with its typed storage error without publishing the failed entry. There is no `flush` method. `inMemory()` explicitly selects memory and performs no filesystem I/O. Factories without an explicit store or directory resolve the configured storage, defaulting to the shared local SQLite database. A directory argument explicitly selects JSONL. Store-open failures never fall back to memory.
429
+
434
430
  ### Static Creation Methods
435
431
 
436
- - `SessionManager.create(cwd, sessionDir?, options?)` - New session. Workflow-owned sessions require the pair `internal: true` and `workflow: { runId, stageId, stageName }`.
437
- - `SessionManager.open(path, sessionDir?)` - Open a specific session file directly, including an internal session.
438
- - `SessionManager.continueRecent(cwd, sessionDir?, options?)` - Continue the most recent regular session or create a new one. Pass `{ includeInternal: true }` only for workflow-specific recovery or diagnostics.
439
- - `SessionManager.inMemory(cwd?, options?)` - No file persistence
440
- - `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?, options?)` - Fork a session from another project. Relevant `NewSessionOptions`, including valid workflow classification, are written in the initial header.
432
+ - `SessionManager.create(cwd, sessionDir?, options?)` - New session in configured storage, or explicit JSONL when a directory is supplied.
433
+ - `SessionManager.create(store, cwd, options?)` - New session in a supplied `SessionStore`. Workflow-owned sessions require the pair `internal: true` and `workflow: { runId, stageId, stageName }`.
434
+ - `SessionManager.open(store, sessionId, cwdOverride?)` - Open an existing session by exact ID in that store. A missing ID raises `SessionNotFoundError`; it does not create a session.
435
+ - `SessionManager.open(path, sessionDir?, cwdOverride?)` - Open a JSONL file directly, creating it if missing. This is a file API, not the CLI session selector.
436
+ - `SessionManager.continueRecent(cwd, sessionDir?, options?)` or `continueRecent(store, cwd, options?)` - Continue the most recent regular session or create one. Pass `{ includeInternal: true }` only to include workflow sessions.
437
+ - `SessionManager.inMemory(cwd?, options?, entries?)` - Explicit memory storage.
438
+ - `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?, options?)` - Fork a JSONL file into the configured or explicit destination. To fork a database session, open it by ID and await `manager.forkTo(targetCwd, targetStore?, options?)`.
439
+ - `SessionManager.importFromJsonl(inputPath, cwd, targetStoreOrDir?)` - Import a JSONL export without changing its ID, upgrading older supported formats. An existing ID raises `SessionExistsError`.
441
440
 
442
441
  ### Static Listing Methods
443
442
 
444
- - `SessionManager.list(cwd, sessionDir?, onProgress?, options?)` - List project sessions. Internal workflow sessions are excluded by default; pass `{ includeInternal: true }` to include them and expose their `SessionInfo.workflow` linkage.
445
- - `SessionManager.listAll(sessionDir?, onProgress?, options?)` - List sessions across projects, or from a custom session directory. The same `includeInternal` default and opt-in apply.
443
+ - `SessionManager.list(cwd, storeOrDir?, onProgress?, options?)` - List project sessions. Internal workflow sessions are excluded by default.
444
+ - `SessionManager.listAll(storeOrDir?, onProgress?, options?)` - List sessions across projects in the selected store. Both methods accept `{ includeInternal: true, signal }` to include workflow sessions or cancel listing.
446
445
 
447
- Normal `/resume`, `atomic -r`, and `--continue` callers use the default filtering. Workflow-specific code can opt in without changing user-facing history:
446
+ Use the returned `SessionInfo.id` to select a session. Its `path` contains a JSONL location when available and otherwise the ID; do not treat it as a filesystem path. To list workflow sessions in the active store:
448
447
 
449
448
  ```typescript
450
- const stages = await SessionManager.list(cwd, sessionDir, undefined, { includeInternal: true });
449
+ const stages = await SessionManager.list(cwd, manager.getSessionStore(), undefined, { includeInternal: true });
451
450
  for (const stage of stages.filter((session) => session.internal)) {
452
- console.log(stage.workflow?.runId, stage.workflow?.stageId, stage.path);
451
+ console.log(stage.workflow?.runId, stage.workflow?.stageId, stage.id);
453
452
  }
454
453
  ```
455
454
 
@@ -457,10 +456,11 @@ for (const stage of stages.filter((session) => session.internal)) {
457
456
 
458
457
  - `newSession(options?)` - Start a new session. Options include `parentSession`, `internal`, and workflow run/stage linkage; classification requires a complete marker pair.
459
458
  - `markSessionInternal(workflow?)` - Apply valid workflow ownership to the current session, repairing malformed markers while preserving an existing valid marker.
460
- - `setSessionFile(path)` - Switch to a different session file
461
- - `createBranchedSession(leafId)` - Extract branch to new session file
459
+ - `setSessionFile(path)` - Switch to a JSONL file directly. For ID-based loading, use `SessionManager.open(store, sessionId)` to obtain a new manager.
460
+ - `createBranchedSession(leafId)` - Extract a branch into a new session in the same store
461
+ - `forkTo(cwd, targetStoreOrDir?, options?)` - Copy the conversation into a new session at the destination
462
462
 
463
- ### Instance Methods - Appending (all return entry ID)
463
+ ### Instance Methods - Appending (all return a promise of the entry ID)
464
464
  - `appendMessage(message)` - Add message
465
465
  - `appendThinkingLevelChange(level)` - Record thinking change
466
466
  - `appendContextWindowChange(contextWindow)` - Record context-window selection in tokens
@@ -494,7 +494,8 @@ for (const stage of stages.filter((session) => session.internal)) {
494
494
  - `getSessionName()` - Get display name from latest session_info entry (`undefined` when cleared or never named)
495
495
  - `getSessionNameState()` - Get the name state: `{ hasName: false }` when never named, `{ hasName: true }` when the latest entry cleared it, `{ hasName: true, name }` when currently named
496
496
  - `getCwd()` - Working directory
497
- - `getSessionDir()` - Session storage directory
498
- - `getSessionId()` - Session UUID
499
- - `getSessionFile()` - Session file path (undefined for in-memory)
500
- - `isPersisted()` - Whether session is saved to disk
497
+ - `getSessionDir()` - Local JSONL directory, or an empty string for non-JSONL storage
498
+ - `getSessionId()` - Exact session ID, not necessarily a UUID
499
+ - `getSessionStore()` - Active `SessionStore`
500
+ - `getSessionFile()` - Optional JSONL file location for display
501
+ - `isPersisted()` - Whether the store is not a `MemorySessionStore`
package/docs/sessions.md CHANGED
@@ -8,30 +8,63 @@ This page covers working with sessions: storage, commands, resuming, naming, and
8
8
 
9
9
  ## Session Storage
10
10
 
11
- Sessions auto-save to `~/.atomic/agent/sessions/`, organized by working directory. Each session is a JSONL file with a tree structure.
11
+ Sessions auto-save to the local SQLite database at `~/.atomic/workflows/journal.sqlite`. Workflow runs use the same file, with `session_` and `wf_` table prefixes separating their records. Session history remains a tree regardless of the selected store.
12
12
 
13
- The session picker also scans linked project directories inside this default store, so project aliases or relocated session folders remain discoverable through `/resume` and `atomic -r`.
13
+ To choose another store, set `sessions.storage` in settings. Use shared `storage` to select one database for both sessions and workflow runs. JSONL is available only when explicitly selected. Memory is available through `--no-session`, `{ "memory": true }` in settings, or an explicit SDK option; it is never a fallback for a failed persistent store.
14
+
15
+ When the default SQLite store is selected, sessions saved before it became the default stay in `~/.atomic/agent/sessions` and appear in `/resume` and `--continue` next to newer ones. This includes sessions in formats 1, 2, and 3 and early 0.9.38 alpha sessions. A session is copied into the database the first time you open it, with `/resume`, `--continue`, `--session`, or `--fork`, and is read from the database afterwards. The original files are never modified or deleted, unreadable files are skipped, and workflow stage sessions stay hidden from `/resume` but remain openable by session ID. Until a session larger than 32 KiB is opened, the list shows it from its first message and its most recent entries, so its message count may be understated and `/resume` search matches only that text; opening it shows the full session. Deleting one of these sessions keeps it out of the list. Selecting a store yourself, as described below, shows only that store.
16
+
17
+ Project-local storage settings apply after you approve project trust, including on the first launch. Atomic re-selects storage before saving a new conversation; resumed conversations stay in their original store. Generated resume commands for JSONL sessions include `--session-dir`; keep that option when reopening the conversation, even if the directory was previously the default.
18
+
19
+ For SQLite, resume with `atomic --session-store "/data/project A/sessions.sqlite" --session-prefix project_ --session <id>`.
14
20
 
15
21
  ```bash
16
22
  atomic -c # Continue most recent session
17
23
  atomic -r # Browse and select from past sessions
18
24
  atomic --no-session # Ephemeral mode; do not save
19
25
  atomic --name "my task" # Set session display name at startup
20
- atomic --session <path|id> # Use a file, exact ID, or unique 8-hex UUID prefix
21
- atomic --fork <path|id> # Fork a file, exact ID, or unique 8-hex UUID prefix
26
+ atomic --session <id|prefix> # Use an exact ID or unique 8-hex UUID prefix
27
+ atomic --import <file> # Import a JSONL export into session storage
28
+ atomic --fork <id|prefix> # Fork an exact ID or unique 8-hex UUID prefix
22
29
  ```
23
30
 
24
- Use `/session` in interactive mode to see the current session file, session ID, message count, tokens, and cost. You can use it while a run is active; its totals update after each completed message, not each streaming text chunk. Detailed cost and cache-waste breakdowns are shown after the run finishes only when the available session history matches those totals; otherwise, only the total cost is shown.
31
+ Use `/session` in interactive mode to see the current session ID, message count, tokens, and cost. A JSONL session also has a file location. You can use it while a run is active; its totals update after each completed message, not each streaming text chunk. Detailed cost and cache-waste breakdowns are shown after the run finishes only when the available session history matches those totals; otherwise, only the total cost is shown.
25
32
 
26
33
  For UUID-backed sessions, `--session` and `--fork` accept either the full UUID or exactly eight hexadecimal prefix characters. A prefix must be unique within the current project (or, if no local session matches, across the global session store); collisions list the matching UUIDs and require the full value. Exact custom session IDs keep their existing priority. `--session-id` remains an exact project-local ID used to open or create a session, not a prefix selector.
27
34
 
28
- ### Custom session directories
35
+ Session locations are for display, not selection. Use `--import <file>` or `/import <file>` to copy a JSONL export into the selected store. The session ID and entries are preserved. An ID already present in that store raises `SessionExistsError`; importing never replaces an existing session. Older supported formats are upgraded automatically when opened for import.
36
+
37
+ Use `atomic --no-session --import <file>` to work with an imported conversation without saving it. `--import` cannot be combined with `--session`, `--fork`, `--session-id`, `--continue`, or `--resume`; choose one way to select the conversation. `--session-dir` remains available when importing into a persistent store.
38
+
39
+ Imported IDs are kept verbatim, including an empty ID. Resume an imported empty ID with `atomic --session ""` or choose its row in the session picker. Picker actions stay bound to the selected project's store even when another project uses the same ID.
40
+
41
+ ### Choosing a store
42
+
43
+ ```json
44
+ { "sessions": { "storage": { "dir": "sessions" } } }
45
+ ```
46
+
47
+ This selects JSONL under `~/.atomic/sessions`. Use `{ "path": "sessions.sqlite" }` for another local SQLite file, `{ "memory": true }` for ephemeral sessions, or an adapter selection for a user-installed database driver. The `sessionDir` setting has been removed without an alias.
48
+
49
+ Precedence is SDK `sessionStore`, `--no-session`, `--session-dir <dir>` or `--session-store <path>` (mutually exclusive CLI selections), non-empty `ATOMIC_CODING_AGENT_SESSION_DIR`, `sessions.storage`, shared `storage`, then the default SQLite file. Each selection wins as a whole; project selections replace global ones rather than merging fields. Relative settings paths resolve against Atomic home; CLI paths and environment directories resolve against the working directory. Changing stores selects a different history, and only the default store shows earlier JSONL sessions; keep the original store to return to it.
29
50
 
30
- Use `--session-dir <dir>`, `ATOMIC_CODING_AGENT_SESSION_DIR`, or the matching settings override to save the active chat outside `~/.atomic/agent/sessions/`.
51
+ `--session-store` cannot be combined with `--session-dir` or `--no-session`. `--session-prefix` requires `--session-store` and defaults to empty, giving `session_` table names. A non-empty prefix is prepended to those names, must match `[A-Za-z_][A-Za-z0-9_]*`, and must not start with `sqlite_` (case-insensitive). Invalid configuration or unavailable storage raises a typed error, never a fallback to another store.
52
+
53
+ Generated SQLite resume hints and Herdr commands always include `--session-store` and include `--session-prefix` when non-empty, regardless of project trust or settings. Keep these flags when reopening the conversation.
54
+
55
+ From the SDK, pass a `SessionStore` or `StorageSelection`:
56
+
57
+ ```ts
58
+ const { session } = await createAgentSession({
59
+ sessionStore: { kind: "sqlite", path: "/data/sessions.sqlite" },
60
+ });
61
+ ```
62
+
63
+ Use `{ kind: "memory" }` for an explicit ephemeral SDK session or `{ kind: "jsonl", dir: "/data/sessions" }` for JSONL. An existing `sessionManager` remains caller-owned and bypasses store selection.
31
64
 
32
65
  Workflows launched from a non-default session directory also save their stage transcripts there. A headless command such as `atomic --mode json --session-dir <dir> -p '/workflow <name> ...'` therefore captures the main and stage transcripts together. An explicit per-stage `sessionDir` overrides the inherited directory.
33
66
 
34
- When the host uses the default session store, stages keep the previous behavior: they write to the global store unless a stage explicitly sets `sessionDir`.
67
+ When the host uses the default store, stages also use the default SQLite database unless they explicitly choose a directory.
35
68
 
36
69
  For the JSONL file format and SessionManager API, see [Session Format](/session-format).
37
70
 
@@ -54,8 +87,14 @@ For the JSONL file format and SessionManager API, see [Session Format](/session-
54
87
 
55
88
  `/resume` opens an interactive session picker for the current project. `atomic -r` opens the same picker at startup.
56
89
 
90
+ Sessions written in formats 1, 2, and 3, and early 0.9.38 alpha sessions whose header uses `timestamp`, appear in the picker and upgrade automatically to format 4. In the default store this happens when you first open one. In an explicit JSONL store it happens when you open them, including with `--continue`, `--session`, or `--fork`; browsing the picker does not change session files, and opening an older session rewrites only that file. No flag or confirmation is needed.
91
+
57
92
  Resuming restores saved verbatim compaction without another planning request. Older sessions with retired logical-deletion compaction can bring previously hidden content back into context.
58
93
 
94
+ When you resume at startup with the default tool selection, Atomic restores the tools recorded in the session, including tools activated during the conversation. `--tools +name,-name` modifies that restored selection. Explicit `--tools name,...`, `--no-tools`, and `--no-builtin-tools` keep their requested tool restrictions, and excluded tools stay excluded. Sessions with no recorded tool selection use the current defaults.
95
+
96
+ Workflow stages and subagents that fork the conversation keep their own configured tools, including stage result tools and child-only extension tools, rather than adopting the parent's recorded selection. Parent tool restrictions still apply.
97
+
59
98
  In the picker you can:
60
99
 
61
100
  - search by typing
@@ -65,11 +104,11 @@ In the picker you can:
65
104
  - rename with CTRL+R
66
105
  - delete with CTRL+D, then confirm
67
106
 
68
- When available, Atomic uses the `trash` CLI for deletion instead of permanently removing files.
107
+ JSONL stores use the `trash` CLI when available. Database stores delete the selected session record, not the database.
69
108
 
70
109
  ### Session summaries
71
110
 
72
- Each row shows a short generated description of what the session was about in its own column, beside the session name or first message, so you can recognize a conversation without opening it. Atomic writes one after the agent goes idle, using the model the session is already configured with, and stores it in the session file as a `session_summary` entry.
111
+ Each row shows a short generated description of what the session was about in its own column, beside the session name or first message, so you can recognize a conversation without opening it. Atomic writes one after the agent goes idle, using the model the session is already configured with, and saves it as a `session_summary` entry in the selected store.
73
112
 
74
113
  A summary describes the conversation up to a specific message and remains visible as newer messages arrive. A later branch summary retires it. "No summary available." means no summary has been generated for the current branch, generation failed, or it is still in flight. The session name and first message are never displaced by a summary, and the column only appears once at least one listed session has a summary. Summaries are also searchable along with the rest of the session text.
75
114
 
@@ -79,9 +118,7 @@ You can search, navigate, or cancel while the picker loads sessions. Closing it
79
118
 
80
119
  ### Internal (workflow) sessions
81
120
 
82
- Sessions created by workflow stage execution are marked as **internal** and are excluded from the standard `/resume`, `atomic -r`, and `--continue` history by default. This keeps the resume picker focused on your interactive coding sessions. Workflow stage sessions remain fully discoverable and resumable through the workflow-specific path: use `/workflow resume <runId>` (or the workflow tool's resume/status actions) to inspect and continue a workflow run and its stages. A workflow stage session can still be opened directly by passing its file path to `--session`.
83
-
84
- Legacy workflow sessions created before this behavior lack the internal marker and will continue to appear in the standard history until they age out or are deleted.
121
+ Sessions created by workflow stage execution are marked as **internal** and are excluded from the standard `/resume`, `atomic -r`, and `--continue` history by default. Use `/workflow resume <runId>` or the workflow tool's resume/status actions to inspect and continue a workflow run and its stages. A workflow stage session can also be opened directly by passing its session ID to `--session`.
85
122
 
86
123
  ## Naming Sessions
87
124
 
@@ -102,7 +139,7 @@ Named sessions are easier to find in `/resume` and `atomic -r`.
102
139
 
103
140
  ## Branching with `/tree`
104
141
 
105
- Sessions are stored as trees. Every entry has an `id` and `parentId`, and the current position is the active leaf. `/tree` lets you jump to any previous point and continue from there without creating a new file.
142
+ Sessions are stored as trees. Every entry has an `id` and `parentId`, and the current position is the active leaf. `/tree` lets you jump to any previous point and continue from there without creating a new session.
106
143
 
107
144
  <p align="center"><img src="images/tree-view.png" alt="Tree View" width="600" /></p>
108
145
 
@@ -133,6 +170,8 @@ Example shape:
133
170
 
134
171
  Filter modes are: default, no-tools, user-only, labeled-only, and all. Configure the default with `treeFilterMode` in [Settings](/settings).
135
172
 
173
+ Label edits are saved before the tree is updated. While a save is pending, the label editor stays open. If saving fails, Atomic displays the error and keeps your text so you can retry with Enter or cancel with Escape.
174
+
136
175
  ### Selection Behavior
137
176
 
138
177
  Selecting a user or custom message:
@@ -153,12 +192,12 @@ Selecting the root user message resets the leaf to an empty conversation and pla
153
192
 
154
193
  | Feature | `/tree` | `/fork` | `/clone` |
155
194
  |---------|---------|---------|----------|
156
- | Output | Same session file | New session file | New session file |
195
+ | Output | Same session | New session | New session |
157
196
  | View | Full tree | User-message selector | Current active branch |
158
197
  | Typical use | Explore alternatives in place | Start a new session from an earlier prompt | Duplicate current work before continuing |
159
198
  | Summary | Optional branch summary | None | None |
160
199
 
161
- Use `/tree` when you want to keep alternatives together. Use `/fork` or `/clone` when you want a separate session file.
200
+ Use `/tree` when you want to keep alternatives together. Use `/fork` or `/clone` when you want a separate session.
162
201
 
163
202
  ## Branch Summaries
164
203
 
@@ -168,6 +207,6 @@ Moved to [Compaction & Branch Summarization](/compaction#branch-summaries).
168
207
 
169
208
  ## Session Format
170
209
 
171
- Session files are JSONL and contain message entries, model changes, thinking-level changes, context-window changes, labels, active verbatim `compaction` boundaries, branch summaries, and extension entries. Retired `context_compaction` and non-verbatim `compaction` records remain parseable but inert.
210
+ Sessions contain message entries, model changes, thinking-level changes, context-window changes, labels, active verbatim `compaction` boundaries, branch summaries, and extension entries. Explicit JSONL stores and exports serialize those entries as JSONL. Retired `context_compaction` and non-verbatim `compaction` records remain parseable but inert.
172
211
 
173
212
  For parsers, extensions, SDK usage, and the full SessionManager API, see [Session Format](/session-format).