@bastani/atomic 0.9.38-alpha.1 → 0.9.38-alpha.11

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 (652) hide show
  1. package/CHANGELOG.md +141 -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-3n2bnz64.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-ad83gc5p.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 +29515 -64826
  53. package/dist/builtin/workflows/src/index.js +10767 -45885
  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/session-picker.d.ts +2 -2
  63. package/dist/cli/session-picker.d.ts.map +1 -1
  64. package/dist/cli/session-picker.js +5 -5
  65. package/dist/cli/session-picker.js.map +1 -1
  66. package/dist/core/agent-session-auto-compaction.d.ts +1 -1
  67. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  68. package/dist/core/agent-session-auto-compaction.js +2 -2
  69. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  70. package/dist/core/agent-session-bash.d.ts +2 -3
  71. package/dist/core/agent-session-bash.d.ts.map +1 -1
  72. package/dist/core/agent-session-bash.js +18 -10
  73. package/dist/core/agent-session-bash.js.map +1 -1
  74. package/dist/core/agent-session-boundaries.d.ts +6 -6
  75. package/dist/core/agent-session-boundaries.d.ts.map +1 -1
  76. package/dist/core/agent-session-boundaries.js +22 -22
  77. package/dist/core/agent-session-boundaries.js.map +1 -1
  78. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  79. package/dist/core/agent-session-compaction.js +3 -2
  80. package/dist/core/agent-session-compaction.js.map +1 -1
  81. package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
  82. package/dist/core/agent-session-custom-message-commit.js +10 -12
  83. package/dist/core/agent-session-custom-message-commit.js.map +1 -1
  84. package/dist/core/agent-session-events.d.ts.map +1 -1
  85. package/dist/core/agent-session-events.js +26 -14
  86. package/dist/core/agent-session-events.js.map +1 -1
  87. package/dist/core/agent-session-export.js +1 -1
  88. package/dist/core/agent-session-export.js.map +1 -1
  89. package/dist/core/agent-session-extension-bindings.d.ts +2 -2
  90. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  91. package/dist/core/agent-session-extension-bindings.js +79 -59
  92. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  93. package/dist/core/agent-session-message-queue.d.ts +2 -2
  94. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  95. package/dist/core/agent-session-message-queue.js +17 -8
  96. package/dist/core/agent-session-message-queue.js.map +1 -1
  97. package/dist/core/agent-session-methods.d.ts +15 -15
  98. package/dist/core/agent-session-methods.d.ts.map +1 -1
  99. package/dist/core/agent-session-methods.js.map +1 -1
  100. package/dist/core/agent-session-models.d.ts +2 -2
  101. package/dist/core/agent-session-models.d.ts.map +1 -1
  102. package/dist/core/agent-session-models.js +59 -42
  103. package/dist/core/agent-session-models.js.map +1 -1
  104. package/dist/core/agent-session-persistent-custom-messages.d.ts +4 -4
  105. package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
  106. package/dist/core/agent-session-persistent-custom-messages.js +16 -17
  107. package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
  108. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  109. package/dist/core/agent-session-prompt.js +63 -23
  110. package/dist/core/agent-session-prompt.js.map +1 -1
  111. package/dist/core/agent-session-retry.d.ts.map +1 -1
  112. package/dist/core/agent-session-retry.js +17 -15
  113. package/dist/core/agent-session-retry.js.map +1 -1
  114. package/dist/core/agent-session-runtime.d.ts +7 -8
  115. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  116. package/dist/core/agent-session-runtime.js +88 -100
  117. package/dist/core/agent-session-runtime.js.map +1 -1
  118. package/dist/core/agent-session-services.d.ts +1 -1
  119. package/dist/core/agent-session-services.d.ts.map +1 -1
  120. package/dist/core/agent-session-services.js +2 -2
  121. package/dist/core/agent-session-services.js.map +1 -1
  122. package/dist/core/agent-session-summary.js +1 -1
  123. package/dist/core/agent-session-summary.js.map +1 -1
  124. package/dist/core/agent-session-tree.d.ts +1 -1
  125. package/dist/core/agent-session-tree.d.ts.map +1 -1
  126. package/dist/core/agent-session-tree.js +8 -7
  127. package/dist/core/agent-session-tree.js.map +1 -1
  128. package/dist/core/agent-session-types.d.ts +2 -0
  129. package/dist/core/agent-session-types.d.ts.map +1 -1
  130. package/dist/core/agent-session-types.js.map +1 -1
  131. package/dist/core/auth-storage-backends.d.ts +2 -0
  132. package/dist/core/auth-storage-backends.d.ts.map +1 -1
  133. package/dist/core/auth-storage-backends.js +12 -0
  134. package/dist/core/auth-storage-backends.js.map +1 -1
  135. package/dist/core/auth-storage.d.ts +5 -0
  136. package/dist/core/auth-storage.d.ts.map +1 -1
  137. package/dist/core/auth-storage.js +46 -12
  138. package/dist/core/auth-storage.js.map +1 -1
  139. package/dist/core/cache-warmer.js +1 -1
  140. package/dist/core/cache-warmer.js.map +1 -1
  141. package/dist/core/compaction/branch-summarization.d.ts +3 -5
  142. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  143. package/dist/core/compaction/branch-summarization.js +6 -10
  144. package/dist/core/compaction/branch-summarization.js.map +1 -1
  145. package/dist/core/compaction/compaction-runner.d.ts +1 -0
  146. package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
  147. package/dist/core/compaction/compaction-runner.js +4 -1
  148. package/dist/core/compaction/compaction-runner.js.map +1 -1
  149. package/dist/core/compaction/pi-summary-fallback.d.ts +2 -1
  150. package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
  151. package/dist/core/compaction/pi-summary-fallback.js +6 -8
  152. package/dist/core/compaction/pi-summary-fallback.js.map +1 -1
  153. package/dist/core/compaction/utils.d.ts +2 -1
  154. package/dist/core/compaction/utils.d.ts.map +1 -1
  155. package/dist/core/compaction/utils.js +32 -7
  156. package/dist/core/compaction/utils.js.map +1 -1
  157. package/dist/core/export-html/index.js +1 -1
  158. package/dist/core/export-html/index.js.map +1 -1
  159. package/dist/core/export-html/template-js/entries-navigation.js +1 -1
  160. package/dist/core/export-html/template.js +1 -1
  161. package/dist/core/extensions/api-types.d.ts +12 -12
  162. package/dist/core/extensions/api-types.d.ts.map +1 -1
  163. package/dist/core/extensions/api-types.js.map +1 -1
  164. package/dist/core/extensions/context-types.d.ts +4 -2
  165. package/dist/core/extensions/context-types.d.ts.map +1 -1
  166. package/dist/core/extensions/context-types.js.map +1 -1
  167. package/dist/core/extensions/extension-work.d.ts +1 -0
  168. package/dist/core/extensions/extension-work.d.ts.map +1 -1
  169. package/dist/core/extensions/extension-work.js +5 -1
  170. package/dist/core/extensions/extension-work.js.map +1 -1
  171. package/dist/core/extensions/index.d.ts +1 -1
  172. package/dist/core/extensions/index.d.ts.map +1 -1
  173. package/dist/core/extensions/index.js +1 -1
  174. package/dist/core/extensions/index.js.map +1 -1
  175. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  176. package/dist/core/extensions/loader-api.js +40 -42
  177. package/dist/core/extensions/loader-api.js.map +1 -1
  178. package/dist/core/extensions/loader-host-modules.d.ts +1 -1
  179. package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
  180. package/dist/core/extensions/loader-host-modules.js +6 -2
  181. package/dist/core/extensions/loader-host-modules.js.map +1 -1
  182. package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
  183. package/dist/core/extensions/loader-rollback.js +1 -0
  184. package/dist/core/extensions/loader-rollback.js.map +1 -1
  185. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  186. package/dist/core/extensions/loader-virtual-modules.js +1 -0
  187. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  188. package/dist/core/extensions/runner-context.d.ts +1 -0
  189. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  190. package/dist/core/extensions/runner-context.js +10 -3
  191. package/dist/core/extensions/runner-context.js.map +1 -1
  192. package/dist/core/extensions/runner-handlers.d.ts +1 -1
  193. package/dist/core/extensions/runner-handlers.d.ts.map +1 -1
  194. package/dist/core/extensions/runner-handlers.js.map +1 -1
  195. package/dist/core/extensions/runner.d.ts +5 -2
  196. package/dist/core/extensions/runner.d.ts.map +1 -1
  197. package/dist/core/extensions/runner.js +28 -12
  198. package/dist/core/extensions/runner.js.map +1 -1
  199. package/dist/core/extensions/runtime-types.d.ts +7 -7
  200. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  201. package/dist/core/extensions/runtime-types.js.map +1 -1
  202. package/dist/core/extensions/session-events.d.ts +5 -5
  203. package/dist/core/extensions/session-events.d.ts.map +1 -1
  204. package/dist/core/extensions/session-events.js.map +1 -1
  205. package/dist/core/extensions/workflow-events.d.ts +2 -0
  206. package/dist/core/extensions/workflow-events.d.ts.map +1 -1
  207. package/dist/core/extensions/workflow-events.js.map +1 -1
  208. package/dist/core/extensions/workflow-run-control.d.ts +3 -3
  209. package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
  210. package/dist/core/extensions/workflow-run-control.js +4 -4
  211. package/dist/core/extensions/workflow-run-control.js.map +1 -1
  212. package/dist/core/fast-model-routing.d.ts.map +1 -1
  213. package/dist/core/fast-model-routing.js +1 -0
  214. package/dist/core/fast-model-routing.js.map +1 -1
  215. package/dist/core/intercom-runtime-group.js +1 -1
  216. package/dist/core/intercom-runtime-group.js.map +1 -1
  217. package/dist/core/model-config.d.ts +765 -0
  218. package/dist/core/model-config.d.ts.map +1 -1
  219. package/dist/core/model-config.js +46 -24
  220. package/dist/core/model-config.js.map +1 -1
  221. package/dist/core/model-resolver-defaults.js +5 -5
  222. package/dist/core/model-resolver-defaults.js.map +1 -1
  223. package/dist/core/model-runtime-streaming.d.ts +9 -2
  224. package/dist/core/model-runtime-streaming.d.ts.map +1 -1
  225. package/dist/core/model-runtime-streaming.js +121 -10
  226. package/dist/core/model-runtime-streaming.js.map +1 -1
  227. package/dist/core/model-runtime.d.ts +6 -0
  228. package/dist/core/model-runtime.d.ts.map +1 -1
  229. package/dist/core/model-runtime.js +103 -2
  230. package/dist/core/model-runtime.js.map +1 -1
  231. package/dist/core/provider-attribution.js +1 -1
  232. package/dist/core/provider-attribution.js.map +1 -1
  233. package/dist/core/queued-input-admission.d.ts +20 -0
  234. package/dist/core/queued-input-admission.d.ts.map +1 -0
  235. package/dist/core/queued-input-admission.js +55 -0
  236. package/dist/core/queued-input-admission.js.map +1 -0
  237. package/dist/core/resource-loader-reload.js +1 -1
  238. package/dist/core/resource-loader-reload.js.map +1 -1
  239. package/dist/core/resource-loader-types.d.ts +1 -1
  240. package/dist/core/resource-loader-types.d.ts.map +1 -1
  241. package/dist/core/resource-loader-types.js.map +1 -1
  242. package/dist/core/runtime-credentials.d.ts +1 -0
  243. package/dist/core/runtime-credentials.d.ts.map +1 -1
  244. package/dist/core/runtime-credentials.js +3 -0
  245. package/dist/core/runtime-credentials.js.map +1 -1
  246. package/dist/core/sdk-types.d.ts +4 -0
  247. package/dist/core/sdk-types.d.ts.map +1 -1
  248. package/dist/core/sdk-types.js.map +1 -1
  249. package/dist/core/sdk.d.ts +1 -1
  250. package/dist/core/sdk.d.ts.map +1 -1
  251. package/dist/core/sdk.js +145 -94
  252. package/dist/core/sdk.js.map +1 -1
  253. package/dist/core/session-lifecycle-work.d.ts +3 -0
  254. package/dist/core/session-lifecycle-work.d.ts.map +1 -1
  255. package/dist/core/session-lifecycle-work.js +2 -0
  256. package/dist/core/session-lifecycle-work.js.map +1 -1
  257. package/dist/core/session-manager-archive.d.ts +2 -16
  258. package/dist/core/session-manager-archive.d.ts.map +1 -1
  259. package/dist/core/session-manager-archive.js +8 -109
  260. package/dist/core/session-manager-archive.js.map +1 -1
  261. package/dist/core/session-manager-core.d.ts +53 -51
  262. package/dist/core/session-manager-core.d.ts.map +1 -1
  263. package/dist/core/session-manager-core.js +549 -315
  264. package/dist/core/session-manager-core.js.map +1 -1
  265. package/dist/core/session-manager-entries.d.ts.map +1 -1
  266. package/dist/core/session-manager-entries.js +5 -10
  267. package/dist/core/session-manager-entries.js.map +1 -1
  268. package/dist/core/session-manager-errors.d.ts +10 -0
  269. package/dist/core/session-manager-errors.d.ts.map +1 -0
  270. package/dist/core/session-manager-errors.js +27 -0
  271. package/dist/core/session-manager-errors.js.map +1 -0
  272. package/dist/core/session-manager-list.d.ts +1 -0
  273. package/dist/core/session-manager-list.d.ts.map +1 -1
  274. package/dist/core/session-manager-list.js +23 -25
  275. package/dist/core/session-manager-list.js.map +1 -1
  276. package/dist/core/session-manager-storage.d.ts +3 -12
  277. package/dist/core/session-manager-storage.d.ts.map +1 -1
  278. package/dist/core/session-manager-storage.js +60 -77
  279. package/dist/core/session-manager-storage.js.map +1 -1
  280. package/dist/core/session-manager-types.d.ts +4 -12
  281. package/dist/core/session-manager-types.d.ts.map +1 -1
  282. package/dist/core/session-manager-types.js +2 -1
  283. package/dist/core/session-manager-types.js.map +1 -1
  284. package/dist/core/session-manager-validation.d.ts +3 -0
  285. package/dist/core/session-manager-validation.d.ts.map +1 -1
  286. package/dist/core/session-manager-validation.js +18 -1
  287. package/dist/core/session-manager-validation.js.map +1 -1
  288. package/dist/core/session-manager.d.ts +3 -3
  289. package/dist/core/session-manager.d.ts.map +1 -1
  290. package/dist/core/session-manager.js +3 -3
  291. package/dist/core/session-manager.js.map +1 -1
  292. package/dist/core/session-mutation-queue.d.ts +3 -0
  293. package/dist/core/session-mutation-queue.d.ts.map +1 -0
  294. package/dist/core/session-mutation-queue.js +14 -0
  295. package/dist/core/session-mutation-queue.js.map +1 -0
  296. package/dist/core/session-resume-args.d.ts +4 -0
  297. package/dist/core/session-resume-args.d.ts.map +1 -0
  298. package/dist/core/session-resume-args.js +9 -0
  299. package/dist/core/session-resume-args.js.map +1 -0
  300. package/dist/core/session-storage.d.ts +26 -0
  301. package/dist/core/session-storage.d.ts.map +1 -0
  302. package/dist/core/session-storage.js +171 -0
  303. package/dist/core/session-storage.js.map +1 -0
  304. package/dist/core/session-store-list.d.ts +4 -0
  305. package/dist/core/session-store-list.d.ts.map +1 -0
  306. package/dist/core/session-store-list.js +28 -0
  307. package/dist/core/session-store-list.js.map +1 -0
  308. package/dist/core/settings-manager-basic-accessors.d.ts +0 -1
  309. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  310. package/dist/core/settings-manager-basic-accessors.js +0 -5
  311. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  312. package/dist/core/settings-merge.d.ts.map +1 -1
  313. package/dist/core/settings-merge.js +8 -2
  314. package/dist/core/settings-merge.js.map +1 -1
  315. package/dist/core/settings-schema.d.ts +76 -6
  316. package/dist/core/settings-schema.d.ts.map +1 -1
  317. package/dist/core/settings-schema.js +29 -20
  318. package/dist/core/settings-schema.js.map +1 -1
  319. package/dist/core/storage/database.d.ts +21 -0
  320. package/dist/core/storage/database.d.ts.map +1 -0
  321. package/dist/core/storage/database.js +2 -0
  322. package/dist/core/storage/database.js.map +1 -0
  323. package/dist/core/storage/errors.d.ts +64 -0
  324. package/dist/core/storage/errors.d.ts.map +1 -0
  325. package/dist/core/storage/errors.js +103 -0
  326. package/dist/core/storage/errors.js.map +1 -0
  327. package/dist/core/storage/index.d.ts +10 -0
  328. package/dist/core/storage/index.d.ts.map +1 -0
  329. package/dist/core/storage/index.js +8 -0
  330. package/dist/core/storage/index.js.map +1 -0
  331. package/dist/core/storage/node-sqlite.d.ts +7 -0
  332. package/dist/core/storage/node-sqlite.d.ts.map +1 -0
  333. package/dist/core/storage/node-sqlite.js +202 -0
  334. package/dist/core/storage/node-sqlite.js.map +1 -0
  335. package/dist/core/storage/prefix.d.ts +5 -0
  336. package/dist/core/storage/prefix.d.ts.map +1 -0
  337. package/dist/core/storage/prefix.js +15 -0
  338. package/dist/core/storage/prefix.js.map +1 -0
  339. package/dist/core/storage/provider.d.ts +58 -0
  340. package/dist/core/storage/provider.d.ts.map +1 -0
  341. package/dist/core/storage/provider.js +243 -0
  342. package/dist/core/storage/provider.js.map +1 -0
  343. package/dist/core/storage/run-journal.d.ts +93 -0
  344. package/dist/core/storage/run-journal.d.ts.map +1 -0
  345. package/dist/core/storage/run-journal.js +15 -0
  346. package/dist/core/storage/run-journal.js.map +1 -0
  347. package/dist/core/storage/schema.d.ts +3 -0
  348. package/dist/core/storage/schema.d.ts.map +1 -0
  349. package/dist/core/storage/schema.js +6 -0
  350. package/dist/core/storage/schema.js.map +1 -0
  351. package/dist/core/storage/selection.d.ts +16 -0
  352. package/dist/core/storage/selection.d.ts.map +1 -0
  353. package/dist/core/storage/selection.js +87 -0
  354. package/dist/core/storage/selection.js.map +1 -0
  355. package/dist/core/storage/session/conformance.d.ts +12 -0
  356. package/dist/core/storage/session/conformance.d.ts.map +1 -0
  357. package/dist/core/storage/session/conformance.js +674 -0
  358. package/dist/core/storage/session/conformance.js.map +1 -0
  359. package/dist/core/storage/session/entry-structure.d.ts +4 -0
  360. package/dist/core/storage/session/entry-structure.d.ts.map +1 -0
  361. package/dist/core/storage/session/entry-structure.js +83 -0
  362. package/dist/core/storage/session/entry-structure.js.map +1 -0
  363. package/dist/core/storage/session/errors.d.ts +54 -0
  364. package/dist/core/storage/session/errors.d.ts.map +1 -0
  365. package/dist/core/storage/session/errors.js +95 -0
  366. package/dist/core/storage/session/errors.js.map +1 -0
  367. package/dist/core/storage/session/jsonl-session-store.d.ts +72 -0
  368. package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -0
  369. package/dist/core/storage/session/jsonl-session-store.js +564 -0
  370. package/dist/core/storage/session/jsonl-session-store.js.map +1 -0
  371. package/dist/core/storage/session/legacy-format.d.ts +20 -0
  372. package/dist/core/storage/session/legacy-format.d.ts.map +1 -0
  373. package/dist/core/storage/session/legacy-format.js +89 -0
  374. package/dist/core/storage/session/legacy-format.js.map +1 -0
  375. package/dist/core/storage/session/legacy-session-store.d.ts +63 -0
  376. package/dist/core/storage/session/legacy-session-store.d.ts.map +1 -0
  377. package/dist/core/storage/session/legacy-session-store.js +239 -0
  378. package/dist/core/storage/session/legacy-session-store.js.map +1 -0
  379. package/dist/core/storage/session/legacy-session-summary.d.ts +11 -0
  380. package/dist/core/storage/session/legacy-session-summary.d.ts.map +1 -0
  381. package/dist/core/storage/session/legacy-session-summary.js +103 -0
  382. package/dist/core/storage/session/legacy-session-summary.js.map +1 -0
  383. package/dist/core/storage/session/memory-session-store.d.ts +33 -0
  384. package/dist/core/storage/session/memory-session-store.d.ts.map +1 -0
  385. package/dist/core/storage/session/memory-session-store.js +120 -0
  386. package/dist/core/storage/session/memory-session-store.js.map +1 -0
  387. package/dist/core/storage/session/scratch-directory.d.ts +2 -0
  388. package/dist/core/storage/session/scratch-directory.d.ts.map +1 -0
  389. package/dist/core/storage/session/scratch-directory.js +5 -0
  390. package/dist/core/storage/session/scratch-directory.js.map +1 -0
  391. package/dist/core/storage/session/session-summary.d.ts +24 -0
  392. package/dist/core/storage/session/session-summary.d.ts.map +1 -0
  393. package/dist/core/storage/session/session-summary.js +79 -0
  394. package/dist/core/storage/session/session-summary.js.map +1 -0
  395. package/dist/core/storage/session/sql-session-store.d.ts +49 -0
  396. package/dist/core/storage/session/sql-session-store.d.ts.map +1 -0
  397. package/dist/core/storage/session/sql-session-store.js +246 -0
  398. package/dist/core/storage/session/sql-session-store.js.map +1 -0
  399. package/dist/core/storage/session/types.d.ts +72 -0
  400. package/dist/core/storage/session/types.d.ts.map +1 -0
  401. package/dist/core/storage/session/types.js +2 -0
  402. package/dist/core/storage/session/types.js.map +1 -0
  403. package/dist/core/storage/session/validation.d.ts +7 -0
  404. package/dist/core/storage/session/validation.d.ts.map +1 -0
  405. package/dist/core/storage/session/validation.js +47 -0
  406. package/dist/core/storage/session/validation.js.map +1 -0
  407. package/dist/core/storage/testing.d.ts +15 -0
  408. package/dist/core/storage/testing.d.ts.map +1 -0
  409. package/dist/core/storage/testing.js +309 -0
  410. package/dist/core/storage/testing.js.map +1 -0
  411. package/dist/core/tasks/completion.d.ts.map +1 -1
  412. package/dist/core/tasks/completion.js +2 -4
  413. package/dist/core/tasks/completion.js.map +1 -1
  414. package/dist/core/tools/bash-session-environment.d.ts.map +1 -1
  415. package/dist/core/tools/bash-session-environment.js +0 -2
  416. package/dist/core/tools/bash-session-environment.js.map +1 -1
  417. package/dist/core/tools/read-url.d.ts.map +1 -1
  418. package/dist/core/tools/read-url.js +6 -1
  419. package/dist/core/tools/read-url.js.map +1 -1
  420. package/dist/core/tools/todos-model.js +3 -3
  421. package/dist/core/tools/todos-model.js.map +1 -1
  422. package/dist/core/tools/todos-mutations.js +2 -2
  423. package/dist/core/tools/todos-mutations.js.map +1 -1
  424. package/dist/core/tools/todos-render.js +1 -1
  425. package/dist/core/tools/todos-render.js.map +1 -1
  426. package/dist/core/tools/todos-storage.js +2 -2
  427. package/dist/core/tools/todos-storage.js.map +1 -1
  428. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  429. package/dist/extensions/codemode/execute.js +14 -1
  430. package/dist/extensions/codemode/execute.js.map +1 -1
  431. package/dist/extensions/codemode/tool.d.ts +1 -1
  432. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  433. package/dist/extensions/codemode/tool.js.map +1 -1
  434. package/dist/extensions/herdr/index.d.ts.map +1 -1
  435. package/dist/extensions/herdr/index.js +6 -8
  436. package/dist/extensions/herdr/index.js.map +1 -1
  437. package/dist/extensions/mcp/client/transports/streamable-http.js +9 -8
  438. package/dist/extensions/mcp/client/transports/streamable-http.js.map +1 -1
  439. package/dist/extensions/mcp/index.js +1 -1
  440. package/dist/extensions/mcp/index.js.map +1 -1
  441. package/dist/extensions/mcp/tools.d.ts.map +1 -1
  442. package/dist/extensions/mcp/tools.js +6 -1
  443. package/dist/extensions/mcp/tools.js.map +1 -1
  444. package/dist/index-extensions.d.ts +1 -1
  445. package/dist/index-extensions.d.ts.map +1 -1
  446. package/dist/index-extensions.js +1 -1
  447. package/dist/index-extensions.js.map +1 -1
  448. package/dist/index.d.ts +4 -1
  449. package/dist/index.d.ts.map +1 -1
  450. package/dist/index.js +4 -1
  451. package/dist/index.js.map +1 -1
  452. package/dist/main-session.d.ts +12 -2
  453. package/dist/main-session.d.ts.map +1 -1
  454. package/dist/main-session.js +151 -53
  455. package/dist/main-session.js.map +1 -1
  456. package/dist/main.d.ts.map +1 -1
  457. package/dist/main.js +97 -42
  458. package/dist/main.js.map +1 -1
  459. package/dist/modes/interactive/components/chat-session-host-actions.d.ts +4 -0
  460. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
  461. package/dist/modes/interactive/components/chat-session-host-actions.js +104 -30
  462. package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
  463. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  464. package/dist/modes/interactive/components/chat-session-host-events.js +1 -0
  465. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  466. package/dist/modes/interactive/components/chat-session-host-state.d.ts +4 -0
  467. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  468. package/dist/modes/interactive/components/chat-session-host-state.js +4 -0
  469. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  470. package/dist/modes/interactive/components/chat-session-host.d.ts +3 -1
  471. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  472. package/dist/modes/interactive/components/chat-session-host.js +18 -5
  473. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  474. package/dist/modes/interactive/components/extension-input.d.ts +1 -1
  475. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  476. package/dist/modes/interactive/components/extension-input.js +2 -2
  477. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  478. package/dist/modes/interactive/components/host-session-picker.js +1 -1
  479. package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
  480. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  481. package/dist/modes/interactive/components/scoped-models-selector.js +9 -5
  482. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  483. package/dist/modes/interactive/components/session-selector-delete.d.ts +1 -1
  484. package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
  485. package/dist/modes/interactive/components/session-selector-delete.js.map +1 -1
  486. package/dist/modes/interactive/components/session-selector-list.d.ts +12 -9
  487. package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
  488. package/dist/modes/interactive/components/session-selector-list.js +27 -25
  489. package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
  490. package/dist/modes/interactive/components/session-selector.d.ts +8 -4
  491. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  492. package/dist/modes/interactive/components/session-selector.js +31 -21
  493. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  494. package/dist/modes/interactive/components/tree-selector-component.d.ts +5 -1
  495. package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
  496. package/dist/modes/interactive/components/tree-selector-component.js +20 -3
  497. package/dist/modes/interactive/components/tree-selector-component.js.map +1 -1
  498. package/dist/modes/interactive/interactive-bash-compact.js +1 -1
  499. package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
  500. package/dist/modes/interactive/interactive-deferred-startup.js +2 -2
  501. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  502. package/dist/modes/interactive/interactive-editor-actions.js +2 -2
  503. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
  504. package/dist/modes/interactive/interactive-extension-runtime.js +2 -0
  505. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  506. package/dist/modes/interactive/interactive-input-handling.js +14 -6
  507. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  508. package/dist/modes/interactive/interactive-mode-base.d.ts +4 -0
  509. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  510. package/dist/modes/interactive/interactive-mode-base.js +6 -1
  511. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  512. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  513. package/dist/modes/interactive/interactive-mode-helpers.js +7 -3
  514. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  515. package/dist/modes/interactive/interactive-mode-surface.d.ts +5 -5
  516. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  517. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  518. package/dist/modes/interactive/interactive-model-routing.js +12 -7
  519. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  520. package/dist/modes/interactive/interactive-process-lifecycle.js +8 -2
  521. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
  522. package/dist/modes/interactive/interactive-queueing.js +94 -70
  523. package/dist/modes/interactive/interactive-queueing.js.map +1 -1
  524. package/dist/modes/interactive/interactive-selectors.js +2 -2
  525. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  526. package/dist/modes/interactive/interactive-session-routing.js +38 -14
  527. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  528. package/dist/modes/interactive/interactive-session-runtime.js +7 -0
  529. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  530. package/dist/modes/interactive/interactive-slash-commands.js +5 -3
  531. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  532. package/dist/modes/interactive/interactive-tui.d.ts +1 -0
  533. package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
  534. package/dist/modes/interactive/interactive-tui.js +9 -2
  535. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  536. package/dist/modes/interactive/program-status-reporter.d.ts +4 -0
  537. package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -1
  538. package/dist/modes/interactive/program-status-reporter.js +45 -6
  539. package/dist/modes/interactive/program-status-reporter.js.map +1 -1
  540. package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -1
  541. package/dist/modes/interactive-engine/create-isolated-runtime.js +8 -1
  542. package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
  543. package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
  544. package/dist/modes/interactive-engine/engine-args.js +11 -4
  545. package/dist/modes/interactive-engine/engine-args.js.map +1 -1
  546. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +2 -1
  547. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
  548. package/dist/modes/interactive-engine/extension-ui-bridge.js +9 -1
  549. package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
  550. package/dist/modes/interactive-engine/isolated-runtime.d.ts +1 -1
  551. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  552. package/dist/modes/interactive-engine/isolated-runtime.js +99 -74
  553. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  554. package/dist/modes/interactive-engine/protocol.d.ts +4 -0
  555. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  556. package/dist/modes/interactive-engine/protocol.js +39 -1
  557. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  558. package/dist/modes/rpc/rpc-bash-request-owners.js +1 -1
  559. package/dist/modes/rpc/rpc-bash-request-owners.js.map +1 -1
  560. package/dist/modes/rpc/rpc-client-api.d.ts +1 -1
  561. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  562. package/dist/modes/rpc/rpc-client-api.js +2 -2
  563. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  564. package/dist/modes/rpc/rpc-client-process.d.ts +2 -2
  565. package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
  566. package/dist/modes/rpc/rpc-client-process.js +20 -7
  567. package/dist/modes/rpc/rpc-client-process.js.map +1 -1
  568. package/dist/modes/rpc/rpc-client.d.ts +4 -1
  569. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  570. package/dist/modes/rpc/rpc-client.js +6 -2
  571. package/dist/modes/rpc/rpc-client.js.map +1 -1
  572. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  573. package/dist/modes/rpc/rpc-command-handler.js +12 -9
  574. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  575. package/dist/modes/rpc/rpc-provider-auth.js +2 -2
  576. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  577. package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
  578. package/dist/modes/rpc/rpc-session-binding.js +10 -0
  579. package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
  580. package/dist/modes/rpc/rpc-terminal-drain.d.ts.map +1 -1
  581. package/dist/modes/rpc/rpc-terminal-drain.js +11 -2
  582. package/dist/modes/rpc/rpc-terminal-drain.js.map +1 -1
  583. package/dist/modes/rpc/rpc-types.d.ts +6 -2
  584. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  585. package/dist/modes/rpc/rpc-types.js.map +1 -1
  586. package/dist/utils/canonical-path.d.ts +5 -0
  587. package/dist/utils/canonical-path.d.ts.map +1 -0
  588. package/dist/utils/canonical-path.js +26 -0
  589. package/dist/utils/canonical-path.js.map +1 -0
  590. package/dist/utils/paths.d.ts +1 -7
  591. package/dist/utils/paths.d.ts.map +1 -1
  592. package/dist/utils/paths.js +1 -15
  593. package/dist/utils/paths.js.map +1 -1
  594. package/docs/codemode.md +2 -0
  595. package/docs/compaction.md +2 -2
  596. package/docs/custom-provider/oauth.md +2 -2
  597. package/docs/custom-provider/override.md +3 -3
  598. package/docs/custom-provider/registration.md +7 -7
  599. package/docs/custom-provider/streaming.md +1 -1
  600. package/docs/custom-provider.md +5 -5
  601. package/docs/docs.json +7 -2
  602. package/docs/environment-variables.md +10 -2
  603. package/docs/extensions/api-reference.md +40 -19
  604. package/docs/extensions/authoring.md +1 -1
  605. package/docs/extensions/events.md +12 -8
  606. package/docs/extensions.md +2 -2
  607. package/docs/getting-started/installation.md +2 -4
  608. package/docs/json.md +1 -1
  609. package/docs/llama-cpp.md +94 -1
  610. package/docs/models/reference.md +2 -0
  611. package/docs/models-configuration.md +206 -0
  612. package/docs/models.md +11 -1
  613. package/docs/packages/authoring.md +1 -1
  614. package/docs/providers.md +9 -5
  615. package/docs/quickstart.md +2 -1
  616. package/docs/reference/cli.md +7 -3
  617. package/docs/rpc/protocol.md +10 -4
  618. package/docs/sdk/reference.md +16 -14
  619. package/docs/sdk/web-server.md +6 -7
  620. package/docs/sdk.md +67 -27
  621. package/docs/session-format.md +35 -34
  622. package/docs/sessions.md +52 -17
  623. package/docs/settings.md +35 -22
  624. package/docs/storage.md +387 -0
  625. package/docs/subagents.md +19 -6
  626. package/docs/usage.md +5 -2
  627. package/docs/workflows/api-reference.md +88 -62
  628. package/docs/workflows/authoring.md +2 -1
  629. package/docs/workflows/operations.md +32 -174
  630. package/docs/workflows/reliable-design.md +17 -17
  631. package/examples/extensions/bookmark.ts +2 -2
  632. package/examples/extensions/handoff.ts +2 -2
  633. package/examples/extensions/plan-mode/index.ts +15 -13
  634. package/examples/extensions/preset.ts +8 -8
  635. package/examples/extensions/session-name.ts +1 -1
  636. package/examples/extensions/snake.ts +3 -1
  637. package/examples/extensions/space-invaders.ts +3 -1
  638. package/examples/extensions/tic-tac-toe.ts +80 -80
  639. package/examples/sdk/11-sessions.ts +5 -5
  640. package/examples/sdk/13-session-runtime.ts +7 -7
  641. package/examples/sdk/README.md +1 -1
  642. package/npm-shrinkwrap.json +53 -469
  643. package/package.json +17 -9
  644. package/schemas/models.schema.json +62 -29
  645. package/schemas/settings.schema.json +138 -27
  646. package/dist/builtin/workflows/builtin/chunk-x6az1sxp.js +0 -8
  647. package/dist/builtin/workflows/builtin/chunk-ymwq372z.js +0 -11609
  648. package/dist/core/session-manager-migrations.d.ts +0 -11
  649. package/dist/core/session-manager-migrations.d.ts.map +0 -1
  650. package/dist/core/session-manager-migrations.js +0 -80
  651. package/dist/core/session-manager-migrations.js.map +0 -1
  652. package/docs/nvidia-rtx-llama-cpp.md +0 -101
package/docs/settings.md CHANGED
@@ -149,7 +149,7 @@ If `retry.enabled` is `false`, Atomic skips same-model retries and moves directl
149
149
 
150
150
  The fallback model and its thinking level remain active for later turns in the same main-chat session. Choose another model explicitly with `/model` or model cycle to change them.
151
151
 
152
- Workflow stages that set their own `model` or `fallbackModels` never use this list; they advance only the chain they declare. See [`fallbackModels` / `fallbackThinkingLevels`](/workflows/api-reference#fallbackmodels-/-fallbackthinkinglevels).
152
+ Workflow stages that set their own `model` or `fallbackModels` never use this list; they advance only the chain they declare. See [`fallbackModels`](/workflows/api-reference#fallbackmodels).
153
153
 
154
154
  A failure that another request to the same model cannot repair — a rejected credential, an unavailable model, a request that model cannot serve — takes that model out of the chain for the rest of the turn at **every** reasoning level, so a candidate that differs only by its `:low`/`:high` suffix is skipped rather than spent. Transient rate-limit and transport failures keep those reasoning variants, because retrying them can succeed.
155
155
 
@@ -280,7 +280,7 @@ On a genuine first run, Atomic previews available themes and asks whether to opt
280
280
  | Setting | Type | Default | Description |
281
281
  |---------|------|---------|-------------|
282
282
  | `compaction.enabled` | boolean | `true` | Enable automatic verbatim line compaction |
283
- | `compaction.reserveTokens` | number | `16384` | Tokens reserved for the next model response; automatic threshold compaction begins before this reserve is consumed |
283
+ | `compaction.reserveTokens` | number | `16384` | Free context tokens below which automatic compaction starts; does not limit summary output |
284
284
  | `compaction.compression_ratio` | number | `0.5` | Fraction of compactable transcript **lines to keep** (`0 < value < 1`) |
285
285
  | `compaction.preserve_recent` | number | `2` | Exact number of newest context-visible messages kept outside the compactable region; `0` keeps none |
286
286
  | `compaction.query` | string | last user message | Optional relevance focus for selecting older lines to retain |
@@ -323,7 +323,7 @@ Both fields must be non-negative safe integers, including ordinary settings. Inv
323
323
 
324
324
  | Setting | Type | Default | Description |
325
325
  |---------|------|---------|-------------|
326
- | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved when selecting branch history; output is capped at 4096 tokens |
326
+ | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved when selecting branch history; the provider sizes summary output |
327
327
  | `branchSummary.skipPrompt` | boolean | `false` | Skip "Summarize branch?" prompt on `/tree` navigation (defaults to no summary) |
328
328
 
329
329
  ### Session Summary
@@ -500,13 +500,20 @@ Plain names establish a replacement list before its modifiers apply. A project l
500
500
 
501
501
  | Setting | Type | Default | Description |
502
502
  |---------|------|---------|-------------|
503
- | `sessionDir` | string | - | Directory where session files are stored. Accepts absolute or relative paths, plus `~`. |
503
+ | `sessions.storage` | object | Local SQLite | Session-only storage selection: `{ "path": "..." }`, `{ "dir": "..." }`, `{ "memory": true }`, or `{ "adapter": "...", "options": {}, "secrets": {}, "prefix": "..." }`. |
504
+ | `storage` | object | Local SQLite | Shared selection for sessions and workflow runs. Accepts the same forms except `dir`. |
504
505
 
505
506
  ```json
506
- { "sessionDir": ".atomic/sessions" }
507
+ { "sessions": { "storage": { "path": "sessions.sqlite" } } }
507
508
  ```
508
509
 
509
- When multiple sources specify a session directory, precedence is `--session-dir`, `ATOMIC_CODING_AGENT_SESSION_DIR`, then `sessionDir` in settings.json.
510
+ Without configuration, sessions and workflow runs share `~/.atomic/workflows/journal.sqlite`. Session tables use `session_` names; workflow tables use `wf_` names. If `ATOMIC_CODING_AGENT_DIR` changes the agent directory, this default is `workflows/journal.sqlite` under its parent. JSONL is opt-in through `dir`, `--session-dir`, or `ATOMIC_CODING_AGENT_SESSION_DIR`. The `sessionDir` setting has been removed; use `sessions.storage.dir` instead.
511
+
512
+ Session precedence is SDK `sessionStore`, `--no-session`, `--session-dir` or `--session-store` (mutually exclusive CLI selections), non-empty `ATOMIC_CODING_AGENT_SESSION_DIR`, `sessions.storage`, shared `storage`, then the default SQLite file. Empty environment values are ignored. Project selections replace global selections as whole objects, including options, secrets and prefix; fields are never merged. A present empty `sessions.storage` selects the default session database rather than inheriting `storage`. Relative settings paths resolve against Atomic home, normally `~/.atomic`. CLI paths and environment directories resolve against the working directory.
513
+
514
+ See [Choosing a store](/sessions#choosing-a-store) for CLI selection, prefix rules, and conflicts.
515
+
516
+ Only the selected source is validated; invalid lower-precedence selections do not block an explicit override. Memory must be selected explicitly and is lost on exit. Invalid selected configuration raises `StorageConfigError`, whose `source`, `field`, and `reason` identify the problem. If a selected store cannot open, Atomic raises a typed storage error rather than falling back to memory. See [Sessions](/sessions#session-storage) and [Storage errors](/storage#storage-errors).
510
517
 
511
518
  ### Models
512
519
 
@@ -548,40 +555,46 @@ Paths in `~/.atomic/agent/settings.json` resolve relative to `~/.atomic/agent`.
548
555
  | `skills` | string[] | `[]` | Local skill file paths or directories |
549
556
  | `prompts` | string[] | `[]` | Local prompt template paths or directories |
550
557
  | `themes` | string[] | `[]` | Local theme file paths or directories |
551
- | `workflows` | string[] or object | `[]` | Local workflow paths, or `{ "paths": [...], "durability": {...} }`; see [Workflow database](#workflow-database) |
558
+ | `workflows` | string[] or object | `[]` | Local workflow paths, or `{ "paths": [...] }`; see [Workflow storage](#workflow-storage) |
552
559
  | `enableSkillCommands` | boolean | `true` | Register skills as `/skill:name` commands |
553
560
 
554
561
  Arrays support glob patterns and exclusions. Use `!pattern` to exclude. Use `+path` to force-include an exact path and `-path` to force-exclude an exact path.
555
562
 
556
- #### Workflow database
563
+ #### Workflow storage
557
564
 
558
- Choose an existing PostgreSQL database in global or trusted project settings:
565
+ Workflow runs use a SQLite journal, by default the local file `~/.atomic/workflows/journal.sqlite`. Set `workflows.journal.path` in `settings.json` to choose another file:
559
566
 
560
567
  ```json
561
568
  {
562
569
  "workflows": {
563
570
  "paths": ["./workflows"],
564
- "durability": {
565
- "systemDatabaseUrlFile": "~/.atomic/neon/direct.url"
566
- }
571
+ "journal": { "path": "workflows/project.sqlite" }
567
572
  }
568
573
  }
569
574
  ```
570
575
 
571
- | Setting | Type | Default | Description |
572
- |---------|------|---------|-------------|
573
- | `workflows.paths` | string[] | `[]` | Workflow resource paths in object-form settings; existing `workflows: [...]` settings remain supported |
574
- | `workflows.durability.systemDatabaseUrl` | string | - | PostgreSQL URL for the workflow database |
575
- | `workflows.durability.poolSize` | integer, at least 2 | `10` | Maximum connections per workflow database pool, for managed or remote PostgreSQL |
576
- | `workflows.durability.systemDatabaseUrlFile` | string | - | Read the PostgreSQL URL from a UTF-8 file instead of storing credentials in settings |
576
+ Relative settings paths resolve against the Atomic home directory, normally `~/.atomic`, not the project directory. Precedence is SDK `RunOpts.journal`, non-empty `ATOMIC_WORKFLOW_JOURNAL_PATH`, `workflows.journal`, shared top-level `storage`, then the default journal file. An empty environment variable is ignored. A present empty journal block selects the journal default rather than inheriting shared storage.
577
+
578
+ To keep workflow records only in memory, set `"journal": { "memory": true }`. Do not combine `memory: true` with a non-empty `path`. Memory must be selected explicitly and cannot recover runs after the process exits; an environment path still takes precedence over this setting.
577
579
 
578
- Set only one URL source per scope. A project `durability` object replaces the global database selection; project settings are ignored unless trusted. Relative URL-file paths resolve beside the settings file that declares them: `~/.atomic/agent` for global settings and `.atomic` for project settings, or the matching `.pi` directory for inherited pi settings. Absolute paths and `~/` are supported. Protect credential files with permissions appropriate for your account, and do not commit them.
580
+ Project `workflows.journal` and `storage` each replace their global selection as a whole, including options, secrets, and prefix. For example, a project can select `{ "memory": true }` over a global path. Invalid selected settings raise `StorageConfigError` instead of trying a lower-precedence selection. Combining `memory: true` with a non-empty `path` is an error.
579
581
 
580
- Precedence is nonempty `DBOS_SYSTEM_DATABASE_URL`, then settings, then managed embedded PostgreSQL with Docker as its provisioning fallback. URLs and file contents are trimmed. Invalid settings, including unrecognized `durability` keys, or missing, empty, or invalid URL files stop workflow initialization instead of silently choosing a local database. An explicit URL never starts managed PostgreSQL or Docker, even if the endpoint is unavailable. Existing non-durable fallback warnings still apply when DBOS cannot connect.
582
+ To use your own database driver, install an adapter module and select it by module specifier:
583
+
584
+ ```json
585
+ {
586
+ "storage": {
587
+ "adapter": "@example/atomic-sqlite",
588
+ "options": { "url": "libsql://database.example" },
589
+ "secrets": { "authToken": { "env": "DATABASE_TOKEN" } },
590
+ "prefix": "project_"
591
+ }
592
+ }
593
+ ```
581
594
 
582
- `poolSize` can be set without a URL, and still applies when `DBOS_SYSTEM_DATABASE_URL` supplies the URL. It is **per pool**, not a process-wide connection limit: each process opens at least two pools (DBOS SQL and the ownership fence), plus another fence pool after a recovery. The minimum is 2 because the ownership fence holds one long-lived advisory-lock connection and needs another for transactions. Lower it for hosted plans or poolers such as Neon, Supabase, or PgBouncer with low connection limits, or when many processes share one database. Raise it for one high-throughput process on a large database. Budget for all pools across all processes, and restart Atomic after changing the size.
595
+ The shared `storage` setting supplies defaults for both sessions and the journal. Use `sessions.storage` or `workflows.journal` for a domain-only override. A shared empty selection uses `~/.atomic/storage.sqlite`. Atomic bundles no remote driver. Adapter modules execute code, so review them before trusting project settings. Secret references accept `{ "env": "VARIABLE" }` or `{ "file": "token.txt" }`; relative secret files resolve against Atomic home and their contents are passed verbatim. See [Storage adapters](/storage#selecting-an-adapter).
583
596
 
584
- Restart Atomic after changing the database selection. Selection takes effect on the first workflow action. Interactive and RPC sessions then report the selected provider and host without credentials; headless sessions report only a Docker fallback, on stderr. Changing databases does not migrate existing runs; use the original database to inspect or resume them. See [Durable workflows](/workflows/operations#durable-workflows-and-cross-session-resume).
597
+ Changing the journal selects a different run history. Preserve the original file to inspect or resume its runs. The default local file needs no separate server; a remote database requires an adapter, and every host that shares runs must select the same database and prefix. See [Sharing storage across hosts](/storage#sharing-storage-across-hosts). If the selected journal cannot be opened or written, the action fails with a typed storage error rather than selecting memory. Restore access to the store and inspect the retained run before retrying. See [Durable workflows](/workflows/operations#durable-workflows-and-cross-session-resume).
585
598
 
586
599
  #### packages
587
600
 
@@ -0,0 +1,387 @@
1
+ # SQLite storage API
2
+
3
+ The SDK exposes an async SQLite API from `@bastani/atomic` and `@bastani/atomic/storage`. Sessions and workflow runs default to one local file, `~/.atomic/workflows/journal.sqlite`, with `session_` and `wf_` table prefixes. Use [storage settings](/settings#sessions) to choose a different file, explicit JSONL sessions, explicit memory, or an adapter module. A failed persistent store never falls back to memory.
4
+
5
+ For CLI storage selection and resume commands, see [Choosing a store](/sessions#choosing-a-store).
6
+
7
+ ```ts
8
+ import { openNodeSqliteDatabase } from "@bastani/atomic/storage";
9
+
10
+ const database = await openNodeSqliteDatabase("./data/example.sqlite");
11
+ try {
12
+ await database.exec("CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, text TEXT)");
13
+ await database.transaction(async (transaction) => {
14
+ await transaction.run("INSERT INTO notes(text) VALUES (?)", "hello");
15
+ });
16
+ const notes = await database.all("SELECT id, text FROM notes ORDER BY id");
17
+ } finally {
18
+ await database.close();
19
+ }
20
+ ```
21
+
22
+ `exec`, `run`, `get`, and `all` return promises. Bind values through positional `?` parameters; `run` returns `{ changes }`, `get` returns a row or `undefined`, and `all` returns an array. Values may be null, number, bigint, string, or Uint8Array. Binary values are copied when the call is made, so reusing a buffer afterward does not change queued work. INTEGER values inside the safe integer range are returned as numbers; larger values are returned as bigints.
23
+
24
+ The node adapter creates parent directories and enables WAL, full synchronization, and foreign keys. Its busy timeout defaults to 5000 ms; override it with `openNodeSqliteDatabase(path, { busyTimeoutMs: 1000 })`. Use `:memory:` for an ephemeral database.
25
+
26
+ Transactions from separate `openNodeSqliteDatabase` connections to the same file queue asynchronously within one process; symlink paths refer to the same queue. Separate in-memory databases remain independent. SQLite locking and the busy timeout still govern contention from other processes. Wrap a caller-owned connection consistently: its transaction queue is shared by wrappers of that connection, not by other connections to its file.
27
+
28
+ Use `wrapNodeSqliteDatabase(connection)` to adapt an existing `node:sqlite` `DatabaseSync`. Closing that facade drains its accepted work but leaves your connection open. Route concurrent work through the same facade rather than issuing raw connection commands while a facade transaction is active.
29
+
30
+ Use only the supplied transaction handle inside a transaction callback. Calling the database itself there waits behind the transaction and deadlocks. Keep callbacks short and await only handle operations. A rejected callback rolls back and preserves the rejection. A failed commit rolls back and rejects with `StorageUnavailableError`. Handles expire after their callbacks settle. Other database operations execute in call order. `close()` drains accepted work, releases the database files, and is idempotent; new calls after closing begins reject with `StoreClosedError`.
31
+
32
+ Errors are exported classes with typed fields. `StorageUnavailableError` provides `adapter`, `location`, and `cause`; stop using the affected store after this error. `StorageRollbackError` retains the original `cause` and `rollbackCause` when rollback also fails. Do not assume that transaction rolled back. Branch on error classes rather than message text.
33
+
34
+ String bindings containing U+0000 are rejected before SQL executes with `StorageInvalidTextError`. Its `parameterIndex` is zero-based and its `reason` is `"nul-character"`. This rule applies to database calls and transaction handles. Store JSON with `JSON.stringify`, which escapes NUL characters, or use `Uint8Array` for binary data containing zero bytes. This validation does not inspect SQL source or SQL-generated values.
35
+
36
+ ## Bring your own driver
37
+
38
+ Atomic does not bundle remote database drivers. Install your chosen SQLite-compatible driver in your own project and wrap it as a `SqliteDatabase` from `@bastani/atomic/storage`. The interface consists of a diagnostic `descriptor`, async `exec`, `run`, `get`, `all`, `transaction(callback)`, and `close()` methods, with the return values and transaction-handle rules described above.
39
+
40
+ A wrapper must queue database operations in call order, keeping unrelated calls outside active transactions. Reject NUL text with `StorageInvalidTextError`, snapshot binary parameters before queueing, and normalize returned integers and blobs. Use `StorageUnavailableError` for driver failures, preserve callback failures, and report failed rollbacks with `StorageRollbackError`. Expire transaction handles after their callback settles. On close, reject new calls, drain accepted work, and release driver resources. Do not include credentials in diagnostics or fall back to memory after an opening failure.
41
+
42
+ ### libSQL / Turso example
43
+
44
+ Install `@libsql/client` separately. Save the complete wrapper below as `storage-libsql-wrapper.ts` in your project. It accepts caller-provided credentials only. For a local file, create its parent directory first; no network or credentials are needed.
45
+
46
+ ```ts
47
+ import type { SqliteDatabase } from "@bastani/atomic/storage";
48
+ import { openLibsqlDatabase } from "./storage-libsql-wrapper.js";
49
+
50
+ const database: SqliteDatabase = await openLibsqlDatabase({ url: "file:./data.sqlite" });
51
+ // For Turso instead: { url: "libsql://your-database.turso.io", authToken: token }
52
+ try {
53
+ await database.exec("CREATE TABLE IF NOT EXISTS notes (text TEXT)");
54
+ await database.transaction(async (tx) => {
55
+ await tx.run("INSERT INTO notes VALUES (?)", "hello");
56
+ });
57
+ const notes = await database.all("SELECT text FROM notes");
58
+ } finally {
59
+ await database.close();
60
+ }
61
+ ```
62
+
63
+ Pass the returned facade as SDK `sessionStore: { kind: "database", database, prefix: "project_" }` or workflow `journal: { database, prefix: "project_" }`. Both can use the same facade without closing your database. To select it from settings, expose `openLibsqlDatabase` through an adapter module as described below.
64
+
65
+ <details>
66
+ <summary>Complete wrapper</summary>
67
+
68
+ {/* custom-driver-example */}
69
+ ```ts
70
+ import type { Client, ResultSet, Row, Transaction } from "@libsql/client";
71
+ import {
72
+ type SqliteDatabase,
73
+ type SqliteExecutor,
74
+ type SqliteRow,
75
+ type SqliteValue,
76
+ type StorageDescriptor,
77
+ StorageAdapterLoadError,
78
+ StorageError,
79
+ type StorageFailureCause,
80
+ StorageInvalidTextError,
81
+ StorageRollbackError,
82
+ StorageTransactionClosedError,
83
+ StorageUnavailableError,
84
+ StoreClosedError,
85
+ } from "@bastani/atomic/storage";
86
+
87
+ export interface LibsqlDatabaseOptions {
88
+ url: string;
89
+ authToken?: string;
90
+ }
91
+
92
+ function credentialRedactor(options: LibsqlDatabaseOptions): (text: string) => string {
93
+ const secrets = [options.authToken ?? ""];
94
+ for (const match of options.url.matchAll(/[?&]([^=&#]*)=([^&#]*)/g)) {
95
+ const token = new URLSearchParams(match[0].slice(1)).get("authToken");
96
+ if (token !== null) secrets.push(match[2] ?? "", token);
97
+ }
98
+ const userinfo = options.url.match(/\/\/([^/?#]*)@/)?.[1];
99
+ if (userinfo !== undefined) secrets.push(...userinfo.split(":"));
100
+ try {
101
+ const url = new URL(options.url);
102
+ secrets.push(url.username, url.password, ...url.searchParams.getAll("authToken"));
103
+ } catch {}
104
+ for (const secret of [...secrets]) {
105
+ try {
106
+ secrets.push(encodeURIComponent(secret));
107
+ secrets.push(decodeURIComponent(secret));
108
+ } catch {}
109
+ }
110
+ return (text) =>
111
+ secrets
112
+ .filter(Boolean)
113
+ .sort((first, second) => second.length - first.length)
114
+ .reduce((value, secret) => value.replaceAll(secret, "[redacted]"), text);
115
+ }
116
+
117
+ function redactCause(cause: StorageFailureCause, redact: (text: string) => string): StorageFailureCause {
118
+ if (typeof cause === "string") return redact(cause);
119
+ if (!(cause instanceof Error)) return cause;
120
+ const nested = cause.cause as StorageFailureCause;
121
+ const safeCause = redactCause(nested, redact);
122
+ const message = redact(cause.message);
123
+ const stack = cause.stack === undefined ? undefined : redact(cause.stack);
124
+ if (message === cause.message && stack === cause.stack && safeCause === nested) return cause;
125
+ const safe = new StorageError(message, { cause: safeCause });
126
+ safe.stack = stack;
127
+ return safe;
128
+ }
129
+
130
+ function normalizeRow(row: Row, columns: readonly string[]): SqliteRow {
131
+ return Object.fromEntries(
132
+ columns.map((key, index) => {
133
+ const value = row[index];
134
+ return [
135
+ key,
136
+ typeof value === "bigint" &&
137
+ value >= -BigInt(Number.MAX_SAFE_INTEGER) &&
138
+ value <= BigInt(Number.MAX_SAFE_INTEGER)
139
+ ? Number(value)
140
+ : value instanceof ArrayBuffer
141
+ ? new Uint8Array(value.slice(0))
142
+ : value,
143
+ ];
144
+ }),
145
+ );
146
+ }
147
+
148
+ class LibsqlDatabase implements SqliteDatabase {
149
+ readonly descriptor: StorageDescriptor;
150
+ private readonly client: Client;
151
+ private readonly redact: (text: string) => string;
152
+ private tail: Promise<void> = Promise.resolve();
153
+ private closing = false;
154
+ private closePromise?: Promise<void>;
155
+ private readonly executor: SqliteExecutor;
156
+
157
+ constructor(client: Client, descriptor: StorageDescriptor, redact: (text: string) => string) {
158
+ this.client = client;
159
+ this.descriptor = descriptor;
160
+ this.redact = redact;
161
+ this.executor = this.createExecutor(client, () => true);
162
+ }
163
+
164
+ private async driver<T>(operation: () => T | Promise<T>): Promise<T> {
165
+ try {
166
+ return await operation();
167
+ } catch (cause) {
168
+ throw new StorageUnavailableError(this.descriptor, redactCause(cause as StorageFailureCause, this.redact));
169
+ }
170
+ }
171
+
172
+ private createExecutor(connection: Client | Transaction, active: () => boolean): SqliteExecutor {
173
+ const execute = async <T>(operation: () => Promise<T>, params: readonly SqliteValue[] = []): Promise<T> => {
174
+ if (!active()) throw new StorageTransactionClosedError();
175
+ const invalidIndex = params.findIndex((value) => typeof value === "string" && value.includes("\0"));
176
+ if (invalidIndex !== -1) throw new StorageInvalidTextError(invalidIndex);
177
+ return this.driver(operation);
178
+ };
179
+ const statement = (sql: string, params: readonly SqliteValue[]): Promise<ResultSet> =>
180
+ connection.execute({
181
+ sql,
182
+ args: params.map((value) => (value instanceof Uint8Array ? new Uint8Array(value) : value)),
183
+ });
184
+ return {
185
+ exec: (sql) => execute(() => connection.executeMultiple(sql)),
186
+ run: (sql, ...params) =>
187
+ execute(async () => ({ changes: (await statement(sql, params)).rowsAffected }), params),
188
+ get: <T extends SqliteRow>(sql: string, ...params: readonly SqliteValue[]) =>
189
+ execute(async () => {
190
+ const result = await statement(sql, params);
191
+ const row = result.rows[0];
192
+ return row === undefined ? undefined : (normalizeRow(row, result.columns) as T);
193
+ }, params),
194
+ all: <T extends SqliteRow>(sql: string, ...params: readonly SqliteValue[]) =>
195
+ execute(async () => {
196
+ const result = await statement(sql, params);
197
+ return result.rows.map((row) => normalizeRow(row, result.columns) as T);
198
+ }, params),
199
+ };
200
+ }
201
+
202
+ private enqueue<T>(operation: () => Promise<T>): Promise<T> {
203
+ if (this.closing) return Promise.reject(new StoreClosedError(this.descriptor));
204
+ const result = this.tail.then(operation);
205
+ this.tail = result.then(
206
+ () => {},
207
+ () => {},
208
+ );
209
+ return result;
210
+ }
211
+
212
+ exec(sql: string): Promise<void> {
213
+ return this.enqueue(() => this.executor.exec(sql));
214
+ }
215
+
216
+ run(sql: string, ...params: readonly SqliteValue[]) {
217
+ const bound = params.map((value) => (value instanceof Uint8Array ? new Uint8Array(value) : value));
218
+ return this.enqueue(() => this.executor.run(sql, ...bound));
219
+ }
220
+
221
+ get<T extends SqliteRow>(sql: string, ...params: readonly SqliteValue[]): Promise<T | undefined> {
222
+ const bound = params.map((value) => (value instanceof Uint8Array ? new Uint8Array(value) : value));
223
+ return this.enqueue(() => this.executor.get<T>(sql, ...bound));
224
+ }
225
+
226
+ all<T extends SqliteRow>(sql: string, ...params: readonly SqliteValue[]): Promise<T[]> {
227
+ const bound = params.map((value) => (value instanceof Uint8Array ? new Uint8Array(value) : value));
228
+ return this.enqueue(() => this.executor.all<T>(sql, ...bound));
229
+ }
230
+
231
+ transaction<T>(callback: (transaction: SqliteExecutor) => Promise<T>): Promise<T> {
232
+ return this.enqueue(async () => {
233
+ const connection = await this.driver(() => this.client.transaction("write"));
234
+ let active = true;
235
+ try {
236
+ const result = await callback(this.createExecutor(connection, () => active));
237
+ active = false;
238
+ await this.driver(() => connection.commit());
239
+ return result;
240
+ } catch (cause) {
241
+ active = false;
242
+ try {
243
+ await this.driver(() => connection.rollback());
244
+ } catch (rollbackCause) {
245
+ throw new StorageRollbackError(cause as StorageFailureCause, rollbackCause as StorageFailureCause);
246
+ }
247
+ throw cause;
248
+ } finally {
249
+ await this.driver(() => connection.close());
250
+ }
251
+ });
252
+ }
253
+
254
+ close(): Promise<void> {
255
+ if (!this.closePromise) {
256
+ this.closing = true;
257
+ this.closePromise = this.tail.then(() => this.driver(() => this.client.close()));
258
+ }
259
+ return this.closePromise;
260
+ }
261
+ }
262
+
263
+ export async function openLibsqlDatabase(options: LibsqlDatabaseOptions): Promise<SqliteDatabase> {
264
+ const config = { url: options.url, authToken: options.authToken };
265
+ const redact = credentialRedactor(config);
266
+ const descriptor = { adapter: "libsql", location: redact(config.url) };
267
+ let createClient: typeof import("@libsql/client").createClient;
268
+ try {
269
+ ({ createClient } = await import("@libsql/client"));
270
+ } catch (cause) {
271
+ throw new StorageAdapterLoadError("@libsql/client", redactCause(cause as StorageFailureCause, redact));
272
+ }
273
+ let client: Client | undefined;
274
+ try {
275
+ client = createClient({ ...config, intMode: "bigint" });
276
+ const database = new LibsqlDatabase(client, descriptor, redact);
277
+ await database.exec("PRAGMA foreign_keys = ON");
278
+ return database;
279
+ } catch (cause) {
280
+ try {
281
+ client?.close();
282
+ } catch {}
283
+ throw new StorageUnavailableError(descriptor, redactCause(cause as StorageFailureCause, redact));
284
+ }
285
+ }
286
+ ```
287
+ {/* /custom-driver-example */}
288
+
289
+ </details>
290
+
291
+ ## Selecting an adapter
292
+
293
+ Install your driver separately and export a default `StorageAdapterModule` from your module:
294
+
295
+ ```ts
296
+ import type { StorageAdapterModule } from "@bastani/atomic/storage";
297
+ import { openLibsqlDatabase } from "./storage-libsql-wrapper.js";
298
+
299
+ export default {
300
+ atomicStorageAdapter: 1,
301
+ async openDatabase(options, context) {
302
+ return openLibsqlDatabase({ url: String(options.url), authToken: String(options.authToken) });
303
+ },
304
+ } satisfies StorageAdapterModule;
305
+ ```
306
+
307
+ Select it with `sessions.storage: { "adapter": "@example/atomic-sqlite" }`, `workflows.journal`, or shared top-level `storage` in [settings](/settings#workflow-storage). SDK sessions accept `sessionStore: { kind: "adapter", module, options, secrets, prefix }`; workflow runs accept `journal: { adapter, options, secrets, prefix }`. Module specifiers resolve from the agent directory, normally `~/.atomic/agent`; absolute module paths also work. Project settings follow the same trust boundary as project extensions. A module executes with Atomic's privileges.
308
+
309
+ `options` is an object of SQLite scalar values or booleans. In JSON settings use strings, numbers, booleans, or null. `secrets` maps option names to `{ env }` or `{ file }`; resolved values override same-named options without trimming file contents. Keep credentials out of `options` and database descriptors. `context` contains `agentDir`, `domain: "sessions" | "journal"`, and an optional `signal`.
310
+
311
+ A SQLite adapter implements `openDatabase(options, context): Promise<SqliteDatabase>`. Atomic applies its domain schema and optional table prefix. A full adapter can instead implement `openSessionStore(options, context, storage)` or `openRunJournal(options, context, storage)`; the domain hook takes priority over `openDatabase`. The typed third argument is `{ readonly prefix?: string }`. Domain adapters must honor this prefix to isolate selected stores. A missing domain/database hook raises `StorageConfigError` with reason `"adapter-domain-unsupported"`. Load failures and invalid module contracts raise `StorageAdapterLoadError`; driver opening failures raise `StorageUnavailableError`. None selects memory as a fallback.
312
+
313
+ The exported `StorageProvider` can open either domain explicitly. Construct it with `{ memory: (descriptor) => new MemoryRunJournal(descriptor), sql: SqlRunJournal.open }` from `@bastani/atomic/workflows`, then call `openSessionStore(selection, context)` or `openRunJournal(selection, context)`. For sessions alone, `new StorageProvider()` needs no journal factories. `StorageSelection` uses `kind: "memory"`, `"jsonl"` with `dir` for sessions only, `"sqlite"` with `path`, `"database"` with a caller-owned facade, or `"adapter"` with `module`, optional options/secrets/prefix.
314
+
315
+ One provider shares a database for matching owned SQLite or adapter selections. Close every returned store; the last store closes the owned database. Closing a store is idempotent. A caller-owned `database` is never closed by the provider. A full domain adapter owns its returned store's lifecycle. Invalid configuration stops selection, and a configured persistent store that cannot open never becomes an in-memory store.
316
+
317
+ If opening storage fails and closing its owned database also fails, the original typed opening error is thrown with a `cleanupCause` field containing the cleanup failure. Inspect both errors when diagnosing the failed open.
318
+
319
+ Factory-created journal headers record a credential-free `storage` descriptor for diagnostics. Full domain adapters are responsible for recording their own safe descriptor. Directly supplied journals and their caller-provided headers are not rewritten.
320
+
321
+ ## Sharing storage across hosts
322
+
323
+ By default, sessions and workflow runs live in a local file that serves one machine. To share them across machines, for example several service replicas or a CI fleet, select the same remote SQLite-compatible database on every host through an [adapter](#selecting-an-adapter), such as the libSQL/Turso wrapper above. Give each project or tenant its own `prefix`. Do not put the local SQLite file on a network filesystem; use a database driver instead.
324
+
325
+ With a shared journal:
326
+
327
+ - Any host can inspect any run with `status` or `stages` without taking ownership.
328
+ - Each run has one executor at a time. A run whose owner is alive cannot be claimed from another host. After its owner crashes and stops renewing its lease for about two minutes, the run appears as `crashed` and any host can resume it. Concurrent resume attempts admit one executor.
329
+ - Lease expiry uses the database clock, so clock differences between hosts do not affect ownership.
330
+ - A displaced executor cannot save new checkpoints; its writes fail with `StaleLeaseError`.
331
+
332
+ The database stores sessions and workflow checkpoints only. To resume a run on another host, that host also needs the same workflow definition and the run's original working directory, including any worktrees and artifacts the run uses. Effects that were not checkpointed may run again after a takeover, so make external effects idempotent. Every checkpoint commits before it is reported, so a remote database adds network latency to each durable `ctx.*` step. Backends may also enforce payload limits that raise `StoragePayloadTooLargeError`.
333
+
334
+ Scale by running more workflows, not by splitting one: a single run and a single session each have one writer. The built-in journal uses SQLite SQL, so `openDatabase` adapters need a SQLite-compatible driver. For another kind of database, implement `openRunJournal` and `openSessionStore` and validate them with the conformance suites below.
335
+
336
+ ## Storage errors
337
+
338
+ Use error classes and their fields, not message matching. Configuration and facade errors are exported from `@bastani/atomic/storage`. `@bastani/atomic/workflows` exports the journal contract's error classes.
339
+
340
+ | Error | Fields and response |
341
+ |---|---|
342
+ | `StorageConfigError` | `source`, `field`, `reason` identify an invalid selected option. Correct that selection; Atomic does not try a lower-precedence store. |
343
+ | `StorageAdapterLoadError` | `module`, `cause`. Check installation and the module's default export. |
344
+ | `StorageUnavailableError` | `adapter`, `location`, `cause`. Restore access to the selected store before retrying. |
345
+ | `StoragePrefixError` | `prefix`, `reason`. Use a valid non-reserved prefix. |
346
+ | `StorageSchemaVersionError` | `domain`, `found`, `supported`. Use a supported database; Atomic does not migrate an unknown schema. |
347
+ | `StoreClosedError` / `StorageTransactionClosedError` | The store is closing/closed, or the transaction callback has ended. Open a new store or use the live callback handle. |
348
+ | `StorageRollbackError` | `cause`, `rollbackCause`. Do not assume the transaction rolled back. |
349
+ | `StorageOutcomeUnknownError` | `domain`, `id`, `key`. A driver cannot confirm the write outcome; inspect the keyed record before retrying. |
350
+ | `StoragePayloadTooLargeError` | `limitBytes`, `actualBytes`. Reduce the payload for that backend. |
351
+ | `StorageInvalidTextError` | `parameterIndex`, `reason`. Remove NUL from scalar text bindings or encode the value as JSON/binary. |
352
+
353
+ Session operations can raise `SessionNotFoundError` or `SessionExistsError` with `sessionId`; `SessionIdMismatchError` with `requested` and `found`; and `SessionConflictError` with `sessionId`, `expectedSeq`, and `actualSeq`. Keep one writer per session. After a conflict, reopen the session rather than writing from stale state.
354
+
355
+ `SessionFormatVersionError` identifies `path`, `found`, and `supported`; `SessionInvalidTextError` identifies `field` and `reason`, and `SessionInvalidTimestampError` adds `value`. A JSONL append whose rollback also fails raises `JsonlStoragePoisonedError` with `location`, `cause`, and `rollbackCause`; stop using that store and inspect the file before reopening. These failures never silently select another store.
356
+
357
+ Journal errors include:
358
+
359
+ | Error | Fields and response |
360
+ |---|---|
361
+ | `StaleLeaseError` | `runId`, `heldEpoch`, `currentEpoch`. Stop writing under stale ownership. |
362
+ | `JournalCasConflictError` | `runId`, `expectedSeq`, `actualSeq`. Reload the run before retrying a conflicting operation. |
363
+ | `RunNotFoundError` | `runId`. Check the selected journal and ID. |
364
+ | `JournalSchemaVersionError` | `domain`, `found`, `supported`. No automatic schema migration. |
365
+ | `JournalInvalidTextError` | `field`, `reason`. Identifiers must be well-formed Unicode without NUL. JSON payload text is not restricted this way. |
366
+ | `JournalCounterRangeError` | `runId`, `field`, `value`, `reason`. Sequence and epoch counters must remain non-negative safe integers. |
367
+ | `JournalMetaCorruptError` | `path`, `rowCount`. Inspect or restore the affected database. |
368
+ | `JournalClosedError` | Open another journal before issuing new operations. |
369
+
370
+ Workflow execution can also fail with `JournalOwnershipError` with `runId` and `holderId`, `JournalBackendClosedError`, `JournalOperationAbortedError` with `runId` and optional `cause`, or `JournalExecutionRetiredError` with `runId`. Stop work after losing ownership or cancellation; do not keep using a closed or retired execution. A local database failure does not justify deleting the shared file, which may hold both session and workflow history.
371
+
372
+ ## Adapter conformance
373
+
374
+ Implement `SqliteDatabase` and run the exported suite from `@bastani/atomic/storage/testing`:
375
+
376
+ ```ts
377
+ import { describe, it } from "vitest";
378
+ import { registerSqliteDatabaseConformance } from "@bastani/atomic/storage/testing";
379
+
380
+ registerSqliteDatabaseConformance({ describe, it }, "my adapter", withSubject);
381
+ ```
382
+
383
+ `withSubject` creates a fresh database for every case and calls the supplied callback with `{ database, reopen, withRollbackFailure }`. Clean up afterward, including on failure. `reopen()` closes and reopens the same persistent database and returns the new facade. `withRollbackFailure(error, callback)` injects a driver rollback failure only while running the callback, then restores normal behavior. Run the full suite against a persistent local database: it covers bindings, exact integers, binary snapshots, NUL rejection, transaction ordering and handle lifetime, commit/rollback failures, reopening, and close semantics.
384
+
385
+ For adapters supporting multiple connections to one database, also run `registerSqliteConnectionConformance({ describe, it }, "my adapter connections", withConnections)`. The fixture must open two facades on the same fresh database, pass both to the callback, and close both afterward. This checks concurrent transaction writes and event-loop responsiveness while one callback yields.
386
+
387
+ `validateStoragePrefix(prefix)` accepts an empty prefix or ASCII letters/underscores followed by ASCII letters, digits, or underscores. It rejects names beginning with `sqlite_`, regardless of case. Validate before opening files. `renderStorageIdentifiers(domain, names, prefix)` returns an immutable name map with `wf_` for `journal` or `session_` for `sessions`. `assertStorageSchemaVersion(domain, found, supported)` rejects a mismatched stored version without changing it.
package/docs/subagents.md CHANGED
@@ -245,16 +245,29 @@ Observation yields do not release these worktrees. Cancelling a queued child bef
245
245
 
246
246
  Fresh children inherit the invoking session's SDK configuration, resource-discovery inputs, model/auth runtime and host callbacks. Child tool selections can narrow the parent's permissions but cannot restore disabled packages or excluded tools. Intercom has no mandatory bypass; a child without access receives no supervisor grant. Model fallback keeps the same inherited restrictions. See [SDK child configuration](/sdk#workflow-and-subagent-children).
247
247
 
248
- Top-level parallel calls support up to 50 subagents after expanding each task's optional `count`. Two settings control the set:
249
-
250
- - `parallel.maxTasks` defaults to 50 and can enforce a lower task limit.
251
- - `parallel.concurrency` defaults to 3 and controls how many children run at once. Explicit configuration overrides the default; per-call `concurrency` takes precedence over configuration.
248
+ Top-level parallel calls apply these settings from `~/.atomic/agent/extensions/subagent/config.json` after expanding each task's optional `count`:
249
+
250
+ - `parallel.maxTasks` defaults to 50 and limits the number of tasks in a parallel set. There is no hard upper cap; raise or lower it as needed.
251
+ - `parallel.concurrency` defaults to 3 and limits how many children are dispatched at once. Per-call `concurrency` takes precedence.
252
+ - `parallel.runningCapacity` defaults to 4 and limits simultaneously running child turns per parent.
253
+
254
+ To run up to 100 children at once, raise both concurrency and running capacity as well as the task limit:
255
+
256
+ ```json
257
+ {
258
+ "parallel": {
259
+ "maxTasks": 100,
260
+ "concurrency": 100,
261
+ "runningCapacity": 100
262
+ }
263
+ }
264
+ ```
252
265
 
253
- At most four turns per parent can run at once, even when a higher subagent concurrency is configured.
266
+ Running capacity is selected when a parent's first child is created. Restart Atomic after changing this setting to apply the new capacity.
254
267
 
255
268
  When one assistant response emits several sibling execution-mode `subagent` tool calls, Atomic collects that synchronous burst before starting a child and runs it as one indexed parallel set. Each original tool call still receives one result containing only the children it requested, and its live result, progress, control, and artifact updates are projected to that same route without sibling data. The TUI redraws the shared run as one aggregate parallel widget rather than retaining one widget per original call. A single call keeps its original SINGLE or PARALLEL mode, calls awaited in sequence remain separate runs, and management actions bypass collection. An execution call that arrives after a child has started still receives the existing in-progress rejection. Prefer one explicit `{ tasks: [...] }` call when planning parallel work; burst collection handles sibling calls emitted by a model.
256
269
 
257
- For a collected burst, each call contributes its top-level `agent` task first and then its `tasks` entries in array order. Atomic preserves duplicates, expands `count` in place, and applies the configured task cap after flattening and expansion; the hard maximum remains 50. Each call-level `cwd` selects that call's agent-discovery scope and child base directory. A task-level `cwd` stays relative to that call base and changes only that child's execution directory, not agent discovery. This per-origin discovery rule applies only to collected sibling calls; an ordinary explicit `{ tasks: [...] }` call keeps one discovery scope from its top-level `cwd`. Per-call and per-task `group` values also stay with their originating children. Shared run options must match across every sibling call: `concurrency`, `worktree`, `context`, `share`, `control`, `sessionDir`, `maxOutput`, `artifacts`, `includeProgress`, and `agentScope`. A mismatch rejects the whole burst before any child launches and names the incompatible field.
270
+ For a collected burst, each call contributes its top-level `agent` task first and then its `tasks` entries in array order. Atomic preserves duplicates, expands `count` in place, and applies `parallel.maxTasks` after flattening and expansion. Each call-level `cwd` selects that call's agent-discovery scope and child base directory. A task-level `cwd` stays relative to that call base and changes only that child's execution directory, not agent discovery. This per-origin discovery rule applies only to collected sibling calls; an ordinary explicit `{ tasks: [...] }` call keeps one discovery scope from its top-level `cwd`. Per-call and per-task `group` values also stay with their originating children. Shared run options must match across every sibling call: `concurrency`, `worktree`, `context`, `share`, `control`, `sessionDir`, `maxOutput`, `artifacts`, `includeProgress`, and `agentScope`. A mismatch rejects the whole burst before any child launches and names the incompatible field.
258
271
 
259
272
  For a collected `worktree: true` burst, every call-level `cwd` must resolve to the same path. That common path becomes the shared worktree root; differing origins reject the burst before launch, and any task-level `cwd` must still resolve to that root. Each projected caller result keeps shared worktree diff text and terminal control guidance while its child results and standard child-output sections remain route-local.
260
273
 
package/docs/usage.md CHANGED
@@ -102,6 +102,8 @@ You can submit messages while the agent is still working:
102
102
 
103
103
  Each queue preserves submission order, and steering messages take priority over follow-ups. Messages submitted during compaction keep their queue type and join that queue when compaction finishes or is cancelled, even if the agent is still working.
104
104
 
105
+ If the first message sent after compaction fails, it stays queued with the messages after it, in the order you typed them, and Atomic shows the error. Anything you submit next is queued behind them, and your next submission sends them again in order. **ALT+Up** retrieves them to the editor in that same order.
106
+
105
107
  Both interrupts hold a queued message only while it is still waiting in the queue. A message the agent has already picked up is written into the transcript, and an interrupt that cancels its reply before any output appears no longer strands it: Atomic answers it instead of returning it to the editor. A reply that had already started printing is left as-is and is not restarted. Sending a message while that recovered reply is still streaming is safe — it is delivered as soon as the reply finishes.
106
108
 
107
109
  Both abort routes ask the agent to stop cooperatively. Escape waits as long as the agent needs, and neither route terminates the engine during normal cancellation.
@@ -122,10 +124,11 @@ Sessions are saved automatically to `~/.atomic/agent/sessions/`, organized by wo
122
124
  atomic -c # Continue most recent session
123
125
  atomic -r # Browse and select a session
124
126
  atomic --no-session # Ephemeral mode; do not save
125
- atomic --session <path|id> # Use a file, exact ID, or unique 8-hex UUID prefix
127
+ atomic --session <id|prefix> # Use an exact ID or unique 8-hex UUID prefix
128
+ atomic --import <file> # Import a format-4 JSONL export into session storage
126
129
  atomic --session-id <id> # Use/create an exact project-local session ID
127
130
  atomic --name "Refactor" # Set the session display name
128
- atomic --fork <path|id> # Fork a file, exact ID, or unique 8-hex UUID prefix
131
+ atomic --fork <id|prefix> # Fork an exact ID or unique 8-hex UUID prefix
129
132
  ```
130
133
 
131
134
  When `--session-id` does not match an exact session in the current project, Atomic warns that no session was found and then creates the requested new session. Reusing an existing exact ID opens it without that warning.