@namzu/cli 26.2.0 → 27.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/CHANGELOG.md +312 -0
  2. package/README.md +49 -34
  3. package/dist/bin.js +7 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/checkpoints/store.d.ts +17 -4
  6. package/dist/checkpoints/store.d.ts.map +1 -1
  7. package/dist/checkpoints/store.js +20 -5
  8. package/dist/checkpoints/store.js.map +1 -1
  9. package/dist/cli.js +2 -2
  10. package/dist/cli.js.map +1 -1
  11. package/dist/commands/acp.d.ts +23 -1
  12. package/dist/commands/acp.d.ts.map +1 -1
  13. package/dist/commands/acp.js +41 -2
  14. package/dist/commands/acp.js.map +1 -1
  15. package/dist/commands/drain.d.ts +69 -2
  16. package/dist/commands/drain.d.ts.map +1 -1
  17. package/dist/commands/drain.js +214 -134
  18. package/dist/commands/drain.js.map +1 -1
  19. package/dist/commands/eval.js +1 -1
  20. package/dist/commands/eval.js.map +1 -1
  21. package/dist/commands/provider-wait.d.ts +5 -5
  22. package/dist/commands/provider-wait.d.ts.map +1 -1
  23. package/dist/commands/provider-wait.js +2 -2
  24. package/dist/commands/resident.d.ts.map +1 -1
  25. package/dist/commands/resident.js +2 -1
  26. package/dist/commands/resident.js.map +1 -1
  27. package/dist/commands/run-flags.d.ts +7 -7
  28. package/dist/commands/run-flags.js +4 -4
  29. package/dist/commands/run-stream.d.ts +16 -12
  30. package/dist/commands/run-stream.d.ts.map +1 -1
  31. package/dist/commands/run-stream.js +142 -98
  32. package/dist/commands/run-stream.js.map +1 -1
  33. package/dist/commands/run.d.ts +6 -4
  34. package/dist/commands/run.d.ts.map +1 -1
  35. package/dist/commands/run.js +129 -45
  36. package/dist/commands/run.js.map +1 -1
  37. package/dist/commands/serve.js +2 -2
  38. package/dist/commands/serve.js.map +1 -1
  39. package/dist/commands/state.js +8 -8
  40. package/dist/commands/state.js.map +1 -1
  41. package/dist/config/load.d.ts +1 -1
  42. package/dist/config/load.d.ts.map +1 -1
  43. package/dist/config/load.js +17 -5
  44. package/dist/config/load.js.map +1 -1
  45. package/dist/config/run-limits.d.ts +20 -8
  46. package/dist/config/run-limits.d.ts.map +1 -1
  47. package/dist/config/run-limits.js +28 -46
  48. package/dist/config/run-limits.js.map +1 -1
  49. package/dist/config/schema.d.ts +44 -19
  50. package/dist/config/schema.d.ts.map +1 -1
  51. package/dist/config/schema.js.map +1 -1
  52. package/dist/config/tool-result-screens.js +1 -1
  53. package/dist/context/directories.d.ts +37 -0
  54. package/dist/context/directories.d.ts.map +1 -0
  55. package/dist/context/directories.js +69 -0
  56. package/dist/context/directories.js.map +1 -0
  57. package/dist/context/environment.d.ts +55 -0
  58. package/dist/context/environment.d.ts.map +1 -1
  59. package/dist/context/environment.js +96 -0
  60. package/dist/context/environment.js.map +1 -1
  61. package/dist/context/project-tracker.d.ts +3 -3
  62. package/dist/context/project-tracker.d.ts.map +1 -1
  63. package/dist/context/project-tracker.js +3 -3
  64. package/dist/context/project-tracker.js.map +1 -1
  65. package/dist/context/project.d.ts +1 -1
  66. package/dist/context/project.js +1 -1
  67. package/dist/context/sandbox.d.ts +22 -3
  68. package/dist/context/sandbox.d.ts.map +1 -1
  69. package/dist/context/sandbox.js +42 -4
  70. package/dist/context/sandbox.js.map +1 -1
  71. package/dist/doctor/checks/chain.d.ts +1 -1
  72. package/dist/doctor/checks/chain.js +5 -5
  73. package/dist/doctor/checks/chain.js.map +1 -1
  74. package/dist/doctor/checks/invariants.d.ts +2 -2
  75. package/dist/doctor/checks/invariants.js +5 -5
  76. package/dist/doctor/checks/invariants.js.map +1 -1
  77. package/dist/doctor/checks/logging.js +1 -1
  78. package/dist/doctor/checks/logging.js.map +1 -1
  79. package/dist/doctor/checks/sandbox.js +1 -1
  80. package/dist/doctor/checks/sandbox.js.map +1 -1
  81. package/dist/doctor/checks/session-export.d.ts +1 -1
  82. package/dist/doctor/checks/session-export.js +2 -2
  83. package/dist/doctor/checks/session-export.js.map +1 -1
  84. package/dist/doctor/checks/telemetry.d.ts +1 -1
  85. package/dist/doctor/checks/telemetry.js +1 -1
  86. package/dist/doctor/registry.js +2 -2
  87. package/dist/doctor/registry.js.map +1 -1
  88. package/dist/exit-codes.d.ts +2 -2
  89. package/dist/exit-codes.js +2 -2
  90. package/dist/integrations/mcp/servers.d.ts +1 -1
  91. package/dist/integrations/providers/chain-capabilities.d.ts +6 -6
  92. package/dist/integrations/providers/chain-capabilities.js +8 -8
  93. package/dist/integrations/providers/chain-capabilities.js.map +1 -1
  94. package/dist/integrations/providers/index.d.ts +1 -1
  95. package/dist/integrations/providers/index.d.ts.map +1 -1
  96. package/dist/integrations/providers/index.js +1 -1
  97. package/dist/integrations/providers/index.js.map +1 -1
  98. package/dist/integrations/providers/register.d.ts +1 -1
  99. package/dist/integrations/providers/register.js +1 -1
  100. package/dist/integrations/providers/registry.d.ts +74 -1
  101. package/dist/integrations/providers/registry.d.ts.map +1 -1
  102. package/dist/integrations/providers/registry.js +75 -0
  103. package/dist/integrations/providers/registry.js.map +1 -1
  104. package/dist/integrations/resident/inspection.d.ts +4 -1
  105. package/dist/integrations/resident/inspection.d.ts.map +1 -1
  106. package/dist/integrations/resident/inspection.js +53 -34
  107. package/dist/integrations/resident/inspection.js.map +1 -1
  108. package/dist/integrations/resident/learning-storage.d.ts +7 -2
  109. package/dist/integrations/resident/learning-storage.d.ts.map +1 -1
  110. package/dist/integrations/resident/learning-storage.js +12 -8
  111. package/dist/integrations/resident/learning-storage.js.map +1 -1
  112. package/dist/integrations/resident/runner-store.d.ts +1 -1
  113. package/dist/integrations/resident/runner-store.d.ts.map +1 -1
  114. package/dist/integrations/resident/runner-store.js +5 -2
  115. package/dist/integrations/resident/runner-store.js.map +1 -1
  116. package/dist/integrations/resident/runner-worker.js +1 -0
  117. package/dist/integrations/resident/runner-worker.js.map +1 -1
  118. package/dist/integrations/resident/session-log-reads.d.ts +37 -0
  119. package/dist/integrations/resident/session-log-reads.d.ts.map +1 -0
  120. package/dist/integrations/resident/session-log-reads.js +125 -0
  121. package/dist/integrations/resident/session-log-reads.js.map +1 -0
  122. package/dist/integrations/resident/session-step.d.ts +2 -0
  123. package/dist/integrations/resident/session-step.d.ts.map +1 -1
  124. package/dist/integrations/resident/session-step.js +15 -13
  125. package/dist/integrations/resident/session-step.js.map +1 -1
  126. package/dist/integrations/resident/storage.d.ts +23 -1
  127. package/dist/integrations/resident/storage.d.ts.map +1 -1
  128. package/dist/integrations/resident/storage.js +60 -17
  129. package/dist/integrations/resident/storage.js.map +1 -1
  130. package/dist/integrations/resident/tool-evidence.d.ts +4 -2
  131. package/dist/integrations/resident/tool-evidence.d.ts.map +1 -1
  132. package/dist/integrations/resident/tool-evidence.js +36 -30
  133. package/dist/integrations/resident/tool-evidence.js.map +1 -1
  134. package/dist/integrations/resident/verification.d.ts +2 -2
  135. package/dist/integrations/resident/verification.d.ts.map +1 -1
  136. package/dist/integrations/resident/verification.js +4 -4
  137. package/dist/integrations/resident/verification.js.map +1 -1
  138. package/dist/integrations/sessions/checkpoint-view.d.ts +13 -0
  139. package/dist/integrations/sessions/checkpoint-view.d.ts.map +1 -0
  140. package/dist/integrations/sessions/checkpoint-view.js +48 -0
  141. package/dist/integrations/sessions/checkpoint-view.js.map +1 -0
  142. package/dist/integrations/sessions/context-inventory.js +1 -1
  143. package/dist/integrations/sessions/context-inventory.js.map +1 -1
  144. package/dist/integrations/sessions/conversation-search.d.ts +16 -20
  145. package/dist/integrations/sessions/conversation-search.d.ts.map +1 -1
  146. package/dist/integrations/sessions/conversation-search.js +305 -731
  147. package/dist/integrations/sessions/conversation-search.js.map +1 -1
  148. package/dist/integrations/sessions/evidence-page-validation.d.ts +4 -4
  149. package/dist/integrations/sessions/evidence-page-validation.d.ts.map +1 -1
  150. package/dist/integrations/sessions/evidence-page-validation.js +1 -1
  151. package/dist/integrations/sessions/evidence-page-validation.js.map +1 -1
  152. package/dist/integrations/sessions/evidence-recall.d.ts +40 -2
  153. package/dist/integrations/sessions/evidence-recall.d.ts.map +1 -1
  154. package/dist/integrations/sessions/evidence-recall.js +41 -97
  155. package/dist/integrations/sessions/evidence-recall.js.map +1 -1
  156. package/dist/integrations/sessions/store.d.ts +153 -85
  157. package/dist/integrations/sessions/store.d.ts.map +1 -1
  158. package/dist/integrations/sessions/store.js +414 -484
  159. package/dist/integrations/sessions/store.js.map +1 -1
  160. package/dist/integrations/sessions/task-context.d.ts +15 -2
  161. package/dist/integrations/sessions/task-context.d.ts.map +1 -1
  162. package/dist/integrations/sessions/task-context.js +34 -11
  163. package/dist/integrations/sessions/task-context.js.map +1 -1
  164. package/dist/integrations/sessions/transcript-export.d.ts +13 -6
  165. package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
  166. package/dist/integrations/sessions/transcript-export.js +148 -263
  167. package/dist/integrations/sessions/transcript-export.js.map +1 -1
  168. package/dist/integrations/state/home.d.ts +4 -16
  169. package/dist/integrations/state/home.d.ts.map +1 -1
  170. package/dist/integrations/state/home.js +6 -42
  171. package/dist/integrations/state/home.js.map +1 -1
  172. package/dist/integrations/state/project.d.ts +6 -7
  173. package/dist/integrations/state/project.d.ts.map +1 -1
  174. package/dist/integrations/state/project.js +7 -9
  175. package/dist/integrations/state/project.js.map +1 -1
  176. package/dist/integrations/state/report.d.ts +27 -41
  177. package/dist/integrations/state/report.d.ts.map +1 -1
  178. package/dist/integrations/state/report.js +172 -464
  179. package/dist/integrations/state/report.js.map +1 -1
  180. package/dist/integrations/state/retention.d.ts +18 -0
  181. package/dist/integrations/state/retention.d.ts.map +1 -0
  182. package/dist/integrations/state/retention.js +18 -0
  183. package/dist/integrations/state/retention.js.map +1 -0
  184. package/dist/integrations/subagents/activity.d.ts +36 -31
  185. package/dist/integrations/subagents/activity.d.ts.map +1 -1
  186. package/dist/integrations/subagents/activity.js +27 -23
  187. package/dist/integrations/subagents/activity.js.map +1 -1
  188. package/dist/integrations/subagents/batches.d.ts +91 -0
  189. package/dist/integrations/subagents/batches.d.ts.map +1 -0
  190. package/dist/integrations/subagents/batches.js +172 -0
  191. package/dist/integrations/subagents/batches.js.map +1 -0
  192. package/dist/integrations/subagents/parent.d.ts +26 -11
  193. package/dist/integrations/subagents/parent.d.ts.map +1 -1
  194. package/dist/integrations/subagents/parent.js +13 -28
  195. package/dist/integrations/subagents/parent.js.map +1 -1
  196. package/dist/integrations/subagents/policy.d.ts +2 -2
  197. package/dist/integrations/subagents/policy.d.ts.map +1 -1
  198. package/dist/integrations/subagents/policy.js +2 -2
  199. package/dist/integrations/subagents/policy.js.map +1 -1
  200. package/dist/integrations/subagents/replay.d.ts +91 -26
  201. package/dist/integrations/subagents/replay.d.ts.map +1 -1
  202. package/dist/integrations/subagents/replay.js +216 -114
  203. package/dist/integrations/subagents/replay.js.map +1 -1
  204. package/dist/integrations/subagents/runtime.d.ts +50 -26
  205. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  206. package/dist/integrations/subagents/runtime.js +132 -126
  207. package/dist/integrations/subagents/runtime.js.map +1 -1
  208. package/dist/integrations/subagents/saved-agents.d.ts +57 -0
  209. package/dist/integrations/subagents/saved-agents.d.ts.map +1 -0
  210. package/dist/integrations/subagents/saved-agents.js +102 -0
  211. package/dist/integrations/subagents/saved-agents.js.map +1 -0
  212. package/dist/integrations/subagents/slash.d.ts +55 -0
  213. package/dist/integrations/subagents/slash.d.ts.map +1 -0
  214. package/dist/integrations/subagents/slash.js +45 -0
  215. package/dist/integrations/subagents/slash.js.map +1 -0
  216. package/dist/integrations/telemetry/session-export.d.ts +6 -6
  217. package/dist/integrations/telemetry/session-export.d.ts.map +1 -1
  218. package/dist/integrations/telemetry/session-export.js +2 -2
  219. package/dist/memory/presentation.d.ts +11 -0
  220. package/dist/memory/presentation.d.ts.map +1 -1
  221. package/dist/memory/presentation.js +25 -0
  222. package/dist/memory/presentation.js.map +1 -1
  223. package/dist/memory/store.d.ts +13 -7
  224. package/dist/memory/store.d.ts.map +1 -1
  225. package/dist/memory/store.js +37 -11
  226. package/dist/memory/store.js.map +1 -1
  227. package/dist/memory/typed.d.ts +116 -0
  228. package/dist/memory/typed.d.ts.map +1 -0
  229. package/dist/memory/typed.js +336 -0
  230. package/dist/memory/typed.js.map +1 -0
  231. package/dist/permissions/checks.d.ts +1 -1
  232. package/dist/permissions/checks.js +1 -1
  233. package/dist/permissions/headless-trust.d.ts +2 -2
  234. package/dist/permissions/headless-trust.d.ts.map +1 -1
  235. package/dist/permissions/headless-trust.js +3 -3
  236. package/dist/permissions/headless-trust.js.map +1 -1
  237. package/dist/permissions/mode.d.ts +4 -4
  238. package/dist/permissions/mode.js +1 -1
  239. package/dist/permissions/rules.d.ts +1 -1
  240. package/dist/permissions/rules.js +1 -1
  241. package/dist/termination.d.ts +75 -0
  242. package/dist/termination.d.ts.map +1 -0
  243. package/dist/termination.js +143 -0
  244. package/dist/termination.js.map +1 -0
  245. package/dist/tui/AgentExplorer.d.ts +2 -2
  246. package/dist/tui/AgentExplorer.js +4 -4
  247. package/dist/tui/AgentExplorer.js.map +1 -1
  248. package/dist/tui/App.d.ts +9 -1
  249. package/dist/tui/App.d.ts.map +1 -1
  250. package/dist/tui/App.js +458 -304
  251. package/dist/tui/App.js.map +1 -1
  252. package/dist/tui/LiveActivity.d.ts +1 -1
  253. package/dist/tui/LiveActivity.d.ts.map +1 -1
  254. package/dist/tui/PermissionOverlay.d.ts +8 -0
  255. package/dist/tui/PermissionOverlay.d.ts.map +1 -1
  256. package/dist/tui/PermissionOverlay.js +25 -2
  257. package/dist/tui/PermissionOverlay.js.map +1 -1
  258. package/dist/tui/Picker.d.ts +14 -1
  259. package/dist/tui/Picker.d.ts.map +1 -1
  260. package/dist/tui/Picker.js +598 -132
  261. package/dist/tui/Picker.js.map +1 -1
  262. package/dist/tui/agent.d.ts +208 -132
  263. package/dist/tui/agent.d.ts.map +1 -1
  264. package/dist/tui/agent.js +523 -313
  265. package/dist/tui/agent.js.map +1 -1
  266. package/dist/tui/conversation-evidence-view.js +3 -3
  267. package/dist/tui/conversation-evidence-view.js.map +1 -1
  268. package/dist/tui/conversation-history.d.ts +4 -21
  269. package/dist/tui/conversation-history.d.ts.map +1 -1
  270. package/dist/tui/conversation-history.js +4 -28
  271. package/dist/tui/conversation-history.js.map +1 -1
  272. package/dist/tui/index.d.ts.map +1 -1
  273. package/dist/tui/index.js +27 -1
  274. package/dist/tui/index.js.map +1 -1
  275. package/dist/tui/log-pane.js +1 -1
  276. package/dist/tui/markdownParser.d.ts +1 -1
  277. package/dist/tui/markdownParser.js +1 -1
  278. package/dist/tui/model-choices.d.ts.map +1 -1
  279. package/dist/tui/model-choices.js +20 -1
  280. package/dist/tui/model-choices.js.map +1 -1
  281. package/dist/tui/permission-review.d.ts +16 -0
  282. package/dist/tui/permission-review.d.ts.map +1 -1
  283. package/dist/tui/permission-review.js +25 -2
  284. package/dist/tui/permission-review.js.map +1 -1
  285. package/dist/tui/provider-list.d.ts +206 -41
  286. package/dist/tui/provider-list.d.ts.map +1 -1
  287. package/dist/tui/provider-list.js +248 -52
  288. package/dist/tui/provider-list.js.map +1 -1
  289. package/dist/tui/slashCommands.d.ts +29 -40
  290. package/dist/tui/slashCommands.d.ts.map +1 -1
  291. package/dist/tui/slashCommands.js +70 -61
  292. package/dist/tui/slashCommands.js.map +1 -1
  293. package/dist/tui/terminal-choice-text.d.ts +22 -0
  294. package/dist/tui/terminal-choice-text.d.ts.map +1 -1
  295. package/dist/tui/terminal-choice-text.js +81 -0
  296. package/dist/tui/terminal-choice-text.js.map +1 -1
  297. package/dist/tui/{run-interruption.d.ts → turn-interruption.d.ts} +4 -4
  298. package/dist/tui/turn-interruption.d.ts.map +1 -0
  299. package/dist/tui/{run-interruption.js → turn-interruption.js} +20 -20
  300. package/dist/tui/turn-interruption.js.map +1 -0
  301. package/dist/tui/turn-limits-settings.d.ts +39 -0
  302. package/dist/tui/turn-limits-settings.d.ts.map +1 -0
  303. package/dist/tui/{run-limits-settings.js → turn-limits-settings.js} +18 -18
  304. package/dist/tui/turn-limits-settings.js.map +1 -0
  305. package/dist/tui/types.d.ts +3 -3
  306. package/dist/tui/types.d.ts.map +1 -1
  307. package/dist/user-commands/store.d.ts +1 -1
  308. package/dist/user-commands/store.js +1 -1
  309. package/package.json +8 -8
  310. package/dist/integrations/sessions/compaction-evidence.d.ts +0 -5
  311. package/dist/integrations/sessions/compaction-evidence.d.ts.map +0 -1
  312. package/dist/integrations/sessions/compaction-evidence.js +0 -59
  313. package/dist/integrations/sessions/compaction-evidence.js.map +0 -1
  314. package/dist/integrations/sessions/database.d.ts +0 -5
  315. package/dist/integrations/sessions/database.d.ts.map +0 -1
  316. package/dist/integrations/sessions/database.js +0 -34
  317. package/dist/integrations/sessions/database.js.map +0 -1
  318. package/dist/integrations/sessions/paths.d.ts +0 -7
  319. package/dist/integrations/sessions/paths.d.ts.map +0 -1
  320. package/dist/integrations/sessions/paths.js +0 -14
  321. package/dist/integrations/sessions/paths.js.map +0 -1
  322. package/dist/integrations/sessions/run-discovery.d.ts +0 -24
  323. package/dist/integrations/sessions/run-discovery.d.ts.map +0 -1
  324. package/dist/integrations/sessions/run-discovery.js +0 -142
  325. package/dist/integrations/sessions/run-discovery.js.map +0 -1
  326. package/dist/integrations/sessions/turn-evidence.d.ts +0 -129
  327. package/dist/integrations/sessions/turn-evidence.d.ts.map +0 -1
  328. package/dist/integrations/sessions/turn-evidence.js +0 -517
  329. package/dist/integrations/sessions/turn-evidence.js.map +0 -1
  330. package/dist/integrations/subagents/history.d.ts +0 -26
  331. package/dist/integrations/subagents/history.d.ts.map +0 -1
  332. package/dist/integrations/subagents/history.js +0 -76
  333. package/dist/integrations/subagents/history.js.map +0 -1
  334. package/dist/integrations/subagents/runs.d.ts +0 -72
  335. package/dist/integrations/subagents/runs.d.ts.map +0 -1
  336. package/dist/integrations/subagents/runs.js +0 -155
  337. package/dist/integrations/subagents/runs.js.map +0 -1
  338. package/dist/tui/run-interruption.d.ts.map +0 -1
  339. package/dist/tui/run-interruption.js.map +0 -1
  340. package/dist/tui/run-limits-settings.d.ts +0 -39
  341. package/dist/tui/run-limits-settings.d.ts.map +0 -1
  342. package/dist/tui/run-limits-settings.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,317 @@
1
1
  # @namzu/cli
2
2
 
3
+ ## 27.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 518b0d3: Every turn the CLI starts keeps its newest 10 checkpoints instead of all of
8
+ them. That covers interactive turns, `namzu run`, resumed and drained turns,
9
+ and delegated child sessions. A turn takes a checkpoint every iteration plus
10
+ one per tool review, and nothing set a limit, so a long session kept every
11
+ one. On one machine that came to 19,014 checkpoint files and 6.33 GB.
12
+
13
+ **What changes for you.** Only the newest 10 checkpoint documents of each turn
14
+ stay in `<session-id>/checkpoints/`, and `namzu drain` reports at most that
15
+ many per turn. A checkpoint whose decision is still outstanding is never
16
+ pruned. Resuming is unaffected, because every resume reads the checkpoint it
17
+ was handed or the newest one. If you inspect intermediate checkpoints by hand,
18
+ copy them out while the turn is still going.
19
+
20
+ - b064cea: **The OS sandbox is now off by default.** Shell commands and file tools run
21
+ on the host under the permission system, the way other coding agents run
22
+ them: each shell command goes through your permission rules and mode, and a
23
+ file tool's path outside the working directory and the added directories is
24
+ shown to you as an approval request (`Outside the working directory: <path>`)
25
+ instead of being refused. It is asked every time — `auto`, `--yolo`, `plan`
26
+ (for a read) and an earlier "allow all tools for this session" included —
27
+ while `strict` and a `deny` rule still refuse it. **A headless turn refuses it**: pass the
28
+ directory with `--add-dir` (or `additionalDirectories`) when an unattended run
29
+ needs it. Each answer is an audit record.
30
+
31
+ **To keep the previous behaviour** (every command confined), write
32
+ `sandbox.enabled: true` in `namzu.config.json` or `~/.namzu/config.yaml`. The
33
+ sandbox is also on, without that line, when `sandbox.requireIsolation` names a
34
+ control or `sandbox.workspace` is `ephemeral`. `sandbox.enabled: false` keeps
35
+ working as before.
36
+
37
+ With the sandbox on, a `bash` call may set `dangerously_disable_sandbox: true`
38
+ to run one command on the host. It is asked about every time, `auto` and
39
+ `--yolo` included (`plan` and `strict` refuse it); it is refused when nobody can
40
+ be asked, unless `sandbox.allowUnattendedEscape: true`; `sandbox.allowEscape:
41
+ false` refuses it always. Each approval or refusal is an audit record.
42
+
43
+ `/add-dir` of a directory outside the working directory now asks before adding
44
+ it, deciding after links are followed (a link inside that points outside is
45
+ asked about under the path it leads to, and that canonical path is what is
46
+ added). A directory inside the working directory is no longer added: the tools
47
+ already reach it. The system prompt states where tools run and how to reach past that, and
48
+ on WSL where the Windows drives are and how to start a Windows program.
49
+
50
+ - 7cac6dc: `#note` and `/memory add` now save a typed memory file instead of appending a bullet to `<project>/.namzu/MEMORY.md`.
51
+
52
+ What changes for you:
53
+
54
+ - **Where a note goes.** `#note <text>` and `/memory add <text>` write `<name>.md` (type `project`; `/memory add --type user|feedback|project|reference <text>` picks another) into the project's stored memory — `<NAMZU_HOME>/projects/<slug>/memory/` by default — the same files the model's `save_memory`, `search_memory` and `read_memory` use. The terminal names the file. `/memory --user add <text>` is unchanged and still appends to `~/.namzu/MEMORY.md`. To keep writing a note into the curated project file, edit `<project>/.namzu/MEMORY.md` directly; it is still read into every turn.
55
+ - **Old notes are copied only when you ask, and your file is never changed.** The project's curated `MEMORY.md` is not rewritten, at launch or ever: nothing can tell a bullet `#note` appended from one you wrote. When it holds top-level bullets, the launch says how many, once per curated file, and `/memory import-notes` copies every top-level bullet (its first line) into a typed `project` memory, skipping any already stored — by an earlier import, a `#note` with the same text, or a copy you archived — so running it twice creates no duplicates. The bullets stay curated text in every turn until you delete them from the file yourself.
56
+ - **A one-time move of the JSON store on first launch.** An earlier JSON memory store (`index.json` + `content/`) in the same directory is imported with its ids and renamed `*.migrated`; the launch says so. A record too large for a memory file (over 256 KiB) is not imported and is named, with the retired file that still holds it.
57
+ - **The prompt.** Every turn carries a `## Stored memories (index)` section — one line per memory you or the model saved, at most 200, your `feedback` and `user` memories first. What the session memory promoter (or `compaction.consolidate`) writes after a turn is searchable but not listed, so a turn's record does not change the next turn's system prompt — and the curated sections are renamed `## Curated memory (all projects)` and `## Curated memory (this project)` (they were `## Durable memory` and `## Project memory`). Anything that matched those headings in a captured prompt must match the new ones.
58
+ - **`/memory show`** lists stored memories' index lines before the curated files, and what turns recorded on their own in a separate `Recorded by turns (N)` section, so those records are visible even though the prompt's index leaves them out.
59
+ - **Note names are short.** A note's file is named after its first words, at most 32 characters, so its index line keeps room for the note itself.
60
+
61
+ Nothing in the CLI's library exports changed.
62
+
63
+ - 3e7a97b: The CLI moves to the SDK's session → turn → message model and to one state
64
+ layout under `NAMZU_HOME` (default `~/.namzu`). Conversations, checkpoints,
65
+ memory and resident state written by 26.x are **not read** by this version.
66
+
67
+ **Before you upgrade.**
68
+
69
+ - **Run `namzu drain` on 26.x** until it reports nothing parked. A turn still
70
+ parked on a decision or a provider wait when you upgrade cannot be resumed.
71
+ - **Export any conversation you want to keep** with
72
+ `namzu history --session <id> > conversation.json` on 26.x (with no
73
+ `--session`, the latest one in the folder); it prints the messages as JSON.
74
+ There is no migration: nothing is imported, so nothing is lost silently or
75
+ brought back half-read.
76
+
77
+ ## What changes for you
78
+
79
+ - **Where state lives.** Each working directory gets
80
+ `~/.namzu/projects/<slug>/`, where the slug is the directory's canonical
81
+ path with every character outside `[A-Za-z0-9]` replaced by `-`. A session is
82
+ `<session-id>.jsonl` there, with its child sessions, checkpoints, tasks,
83
+ feedback, goals, tool-result spills and file-history snapshots under
84
+ `<session-id>/`. Memory moves to `projects/<slug>/memory/`, resident state to
85
+ `projects/<slug>/residents/`, and git worktrees to
86
+ `projects/<slug>/worktrees/`. `~/.namzu/index.sqlite` is an index rebuilt
87
+ from the logs whenever it is missing or out of date; deleting it loses
88
+ nothing. The CLI still never writes into the working directory; `.namzu/`
89
+ there is read only, for the agents, skills, commands, plugins and
90
+ `MEMORY.md` you put in it.
91
+ - **Old state is left alone and reported.** `namzu state` now prints report
92
+ `version: 2` with a `legacy` category: the old top-level `state/`,
93
+ `sessions/`, `titles.json`, `desktop-sessions.json`, `delegation-history/`,
94
+ `checkpoints/`, `tenants/`, `goals/`, `feedback/`, `learning/`,
95
+ `residents/`, `worktrees/` and `memory/`, and every `projects/<uuid>/`
96
+ directory. It lists their paths and sizes and never opens, moves or deletes
97
+ them; remove them yourself once you have exported what you need. A new
98
+ `projects/<slug>/` is never reported as legacy.
99
+ - **One turn at a time per session.** A session has at most one active turn.
100
+ `namzu run` and `namzu run-stream` against a session whose turn is still
101
+ running, paused or interrupted now exit **75** (EX_TEMPFAIL) and name that
102
+ turn: on stderr for `run`, as an NDJSON
103
+ `{"kind":"error","code":"turn_in_progress",…}` event for `run-stream`. 75
104
+ keeps its existing meaning for a provider pause too; a wrapper that already
105
+ retries later on 75 needs no change. In the TUI the refusal offers
106
+ `/resume` or the new **`/abandon`**, which closes the paused turn so the next
107
+ prompt can start.
108
+ - **A rate limit on the first request pauses the turn.** A provider rate
109
+ limit or outage on a turn's first request used to fail it (`namzu run`
110
+ exit 1) with nothing to continue; it now pauses it at a checkpoint like the
111
+ same fault later in the turn: `namzu run` exits 75 naming the checkpoint,
112
+ `--wait-for-provider` waits and resumes it, and `/resume` or `namzu drain`
113
+ continues it.
114
+ - **`/agents runs` is now `/agents batches`**, with no alias. `/agents runs`
115
+ prints the unknown-subcommand usage.
116
+ - **NDJSON gains ids.** `run-stream`'s `done` and `usage` events carry
117
+ `sessionId` and `turnId`, and a `paused` event names its `turnId` instead
118
+ of a run id.
119
+ - **Hooks.** The events `run_start`, `run_end` and `run_interrupt` are
120
+ `turn_start`, `turn_end` and `turn_interrupt`; a config that names an old
121
+ event is refused at load with a message naming the new one. A hook's stdin
122
+ carries `turn_id` (not `run_id`) and, on `subagent_stop`,
123
+ `parent_session_id` and `parent_turn_id` (not `parent_run_id`); its
124
+ environment carries `NAMZU_TURN_ID` (not `NAMZU_RUN_ID`). `session_id` and
125
+ `NAMZU_SESSION_ID` are always set. `session_start` and `session_end` hooks
126
+ receive no turn id: the CLI no longer invents one for them.
127
+ - **`namzu drain`** keeps its flag names and exit codes (0, 1, 64, 77), but
128
+ `--store` means something else: it was the `runs/` directory a checkpoint
129
+ store wrote to, and it is now the namzu home (`NAMZU_HOME`, `~/.namzu` by
130
+ default) whose `projects/` hold the session logs. A `--store` without a
131
+ `projects/` directory is refused with 64, so a wrapper that still passes its
132
+ old `runs/` path must pass the home instead. A scope the store does not hold
133
+ (an unknown session, one under another project or tenant, a child session)
134
+ is also 64; state that cannot be read is 1. It finds parked turns through
135
+ the session index, takes each session's lease, and continues the same turn
136
+ from its checkpoint; a turn whose session lease another worker holds is
137
+ skipped and reported.
138
+ - **Delegation history is not carried over.** The history block and
139
+ `/agents` read finished child sessions from their logs; children recorded by
140
+ 26.x do not appear.
141
+ - **Checkpoints.** A session keeps each turn's newest 10 checkpoints under
142
+ `<session-id>/checkpoints/`; one an open decision references is never
143
+ pruned. `/restore` snapshots are under `<session-id>/file-history/`.
144
+ - **Crash dumps are gone.** The session log and per-iteration checkpoints hold
145
+ everything an interrupted turn needs, so no `emergency/` dumps are written.
146
+ An interactive session that was interrupted closes that turn as interrupted
147
+ when you send the next prompt.
148
+ - **A stopped process gives its conversation back.** On SIGTERM, SIGHUP (a
149
+ closed terminal) or SIGINT, the TUI, `namzu run` and `namzu run-stream`
150
+ release the conversation's writer lease first, then stop the turn, close
151
+ the session (tool servers, background jobs, the `session_end` hook) and give
152
+ the terminal back, and then die of the signal they were sent: a wrapper
153
+ sees 143, 129 or 130 as before. The turn is left interrupted, so `/abandon`,
154
+ `/resume`, `namzu drain` or the TUI's next prompt take it at once; before,
155
+ they were refused as "leased by a live writer" for up to five minutes. A
156
+ second signal exits immediately. `run-stream` writes
157
+ `{"kind":"error","code":"terminated",…}` and a final `done` before it exits,
158
+ and `run` names the session on stderr. SIGKILL still leaves the lease to
159
+ expire. The message follows where the signal found the turn: a turn that
160
+ had already ended (the session still closing) is reported as recorded, not
161
+ interrupted, and `run-stream`'s one `done` is then the turn's own; a
162
+ `run --wait-for-provider` stopped during its wait says the turn is paused
163
+ at its checkpoint, and does not resume it.
164
+
165
+ ### Patch Changes
166
+
167
+ - 96ac3ec: A session never writes generated state into its working directory, and a
168
+ session started in the home directory no longer reads the same memory file
169
+ twice.
170
+
171
+ Every entry point — `namzu`, `namzu run`, `namzu run-stream`, `namzu drain`
172
+ and resident runs — keeps its sessions, memory and task state under the
173
+ application home (`NAMZU_HOME`, else `~/.namzu`), in the working directory's
174
+ `projects/<slug>/`, and files them under that directory's one Project.
175
+ `<cwd>/.namzu` is only read, for the agents, skills, commands, plugins and
176
+ `MEMORY.md` you keep there.
177
+
178
+ Started in `$HOME` with no `NAMZU_HOME`, the project's `.namzu/MEMORY.md` and
179
+ the user's `~/.namzu/MEMORY.md` are one file. It was injected into every
180
+ prompt twice, under both headings. It is now read once, as the user memory.
181
+
182
+ - 3641102: The turn-start repository snapshot (`git status` and recent commits, sent on a
183
+ send's first request) now reaches the model as request-only context after the
184
+ conversation, not as a system message. On Anthropic, each new send used to
185
+ change the system prompt and re-read the whole conversation uncached. Now the
186
+ cached conversation is kept and only the snapshot's own tokens are new.
187
+
188
+ What the model reads changes in two ways: the snapshot arrives in a user-role
189
+ message rather than a system message, and it follows the line
190
+ `Current step context (runtime-generated; not a new user request):`, which
191
+ every request-only context message opens with. The snapshot text itself is
192
+ unchanged.
193
+
194
+ - Updated dependencies [8805360]
195
+ - Updated dependencies [a729b17]
196
+ - Updated dependencies [9355755]
197
+ - Updated dependencies [755a81a]
198
+ - Updated dependencies [cb1f00c]
199
+ - Updated dependencies [3641102]
200
+ - Updated dependencies [933ba6d]
201
+ - Updated dependencies [3e7a97b]
202
+ - Updated dependencies [a84dc1c]
203
+ - Updated dependencies [b064cea]
204
+ - Updated dependencies [9238347]
205
+ - Updated dependencies [a14b013]
206
+ - Updated dependencies [3641102]
207
+ - Updated dependencies [3641102]
208
+ - Updated dependencies [3e43fc2]
209
+ - @namzu/sdk@44.0.0
210
+ - @namzu/anthropic@6.0.1
211
+ - @namzu/openrouter@3.0.1
212
+ - @namzu/zen@2.4.0
213
+ - @namzu/computer-use@1.4.3
214
+ - @namzu/ollama@2.2.4
215
+ - @namzu/openai@4.0.0
216
+
217
+ ## 26.3.0
218
+
219
+ ### Minor Changes
220
+
221
+ - 5d902f2: The provider picker draws one row per vendor, and offers each way to
222
+ authenticate that vendor inside the row.
223
+
224
+ The duplicate was real and it was reported from a screen like this one: a
225
+ machine with the subscription signed in drew `OpenAI (Codex subscription)` as a
226
+ detected row and, below it under `Not detected — enter a credential to use
227
+ these:`, the same vendor again asking for `OPENAI_API_KEY`. The registry models
228
+ a subscription sign-in and an API key as two provider ids, and the list was a
229
+ list of ids — so one product read as two, and the operator holding the key had
230
+ to work out which of the two rows was theirs.
231
+
232
+ A row is now a vendor. It says what this machine has (`Codex session · this
233
+ device`) or what is missing (`needs OPENAI_API_KEY`), and entering it offers its
234
+ ways in — the detected subscription first, then the API key, then a sign-in
235
+ where nothing works yet. Each choice leads where that way in already led: a
236
+ detected session opens the vendor's models, a credential opens the paste field,
237
+ a sign-in starts the operation `l` starts. No second credential mechanism was
238
+ built: a typed key still travels the same `setKeyEntry` → `acceptKey` →
239
+ session-credential path, and nothing about credential resolution at run time
240
+ changed. No config key was added.
241
+
242
+ **What moves.** Five shapes a reader may have matched change on this screen.
243
+ The detected block keeps discovery's order, but a vendor that was two rows is
244
+ one, so rows below it renumber. A detected row is titled by its vendor rather
245
+ than by its registry entry, which changes exactly one row in this registry —
246
+ the subscription row now reads `OpenAI` with its session in the source column,
247
+ where it used to read `OpenAI (Codex subscription)`. Where a row's ways in name
248
+ more than one provider, Enter opens a choice screen instead of acting
249
+ immediately; in this registry that is one row, the vendor whose two ids are a
250
+ subscription and a key, and its detected session is the first item and the
251
+ initial cursor. Every other row keeps the keystroke it always had — an
252
+ unconfigured row opens its paste field, a detected row opens its models — so
253
+ the daily path is unchanged. One row that had only one way in now has two: a
254
+ vendor with neither a session nor a key offers the key first and the sign-in
255
+ second, where before it went straight to the paste field. And the list is
256
+ shorter: nine vendors is the most it can draw, so the digit shortcut's nine-row
257
+ limit is now a bound this screen cannot pass, and the sentence about the rows
258
+ past nine no longer appears.
259
+
260
+ That last one is why this is `minor` rather than `patch` — the same reason the
261
+ previous picker change gave. No exported symbol, CLI flag, config key, default
262
+ or wire shape moved; `ProviderRegistryEntry` gained a required `vendor` field
263
+ and a vendor table, which is the CLI's own integration layer rather than a
264
+ published surface. A screen whose rows a script or a reader may have matched is
265
+ a screen whose changes are visible to them, and a renumbered list is the most
266
+ visible kind.
267
+
268
+ **What did not merge.** Zen and Zen Go are one company's two services, not two
269
+ credentials for one product: separate catalogues, separate billing routes and
270
+ keys that do not open each other, so a single row would put a product decision
271
+ under a heading about authentication, and the word `Go` is the only thing
272
+ telling an operator they are choosing between two priced things. Ollama and LM
273
+ Studio are two different local servers. AWS Bedrock and `http` remain absent
274
+ from the list entirely, for the reasons recorded beside them.
275
+
276
+ **The sub-menu asks about ways, not about ids.** It was gated on a row's ways
277
+ coming from more than one registry id, which answered the wrong question in both
278
+ directions. `anthropic` is ONE id that takes a signed-in session and an API key,
279
+ so a machine with the Claude session found had two real choices — keep using
280
+ that session, or enter a key of one's own — and was asked nothing; two ids that
281
+ happened to be the same key would have been asked twice. The gate is the number
282
+ of ways in, and the key is offered beside what discovery found whenever what was
283
+ found is not itself a key (asked with `signedInSubscriptionProviders`, the
284
+ predicate the sign-in screen already decides that by, so an OAuth token in an
285
+ environment variable counts as the session it is on both screens). A vendor
286
+ whose free catalogue works without a credential gets the same treatment: the
287
+ free models are one way in and the key is another. Everything else is unchanged
288
+ — what follows each answer, the wording and the ordering — and a row with one
289
+ way in keeps the keystroke it always had, so an exported key, a local server or
290
+ an unconfigured vendor still goes straight to its models or its paste field with
291
+ nothing in between.
292
+
293
+ **Four more things, found by running it on a real terminal at 60x20 and 50x20** —
294
+ sizes no rendering test used, which is why the tests were green. The text area
295
+ was computed as `columns - 4` and the app's own one-column inset on each side
296
+ was not counted, so a row was measured two columns wider than it was drawn and
297
+ the note beside the model just marked `(current)` wrapped onto a line of its
298
+ own; the width is derived from all three terms now. A row wider than the box is
299
+ squeezed by the renderer and loses the trailing space of the text nodes it is
300
+ built from, which is how the cursor row came out as `›6. DeepSeek` — the row's
301
+ segments are children of one text node now, and its source column is wrapped by
302
+ the screen so it stays inside the box. The box was as tall as its rows wanted,
303
+ so on a 20-row terminal Ink scrolled it and the notice explaining the screen —
304
+ the first thing an operator needs — was above the top of it; the height is
305
+ counted from the lines the screen will draw, and the list is windowed to fit
306
+ with the window following the cursor. And `(free)` printed twice on 22 of the
307
+ 25 zero-priced rows of the catalogue this was measured against, whose own names
308
+ end in `(free)`: the marker stays, the repetition goes, and the rule reads the
309
+ word rather than one vendor's punctuation. Two smaller ones: the sentences the
310
+ box is sized against are wrapped by the screen, so a continuation no longer
311
+ begins with the space Ink broke at, and the footer says what `esc` does —
312
+ `esc cancel` returns to the session behind the picker, `esc exit namzu` closes
313
+ the program, which is what it did all along with nothing behind it.
314
+
3
315
  ## 26.2.0
4
316
 
5
317
  ### Minor Changes
package/README.md CHANGED
@@ -112,27 +112,30 @@ once in PowerShell or Git Bash using the Node installation that owns Namzu.
112
112
  For a custom global prefix, include `--prefix "<existing-prefix>"`. Restart
113
113
  Namzu afterward; the updated CLI includes the corrected npm launcher.
114
114
 
115
- Generated CLI state now lives below the application home: `~/.namzu` by
116
- default, or the existing real directory named by `NAMZU_HOME`. New directories
117
- inside the same checkout share one Project, keyed by its canonical root; a
118
- standalone directory is its own project. Worktrees and nested repositories
119
- remain separate. Existing central bindings for individual subdirectories keep
120
- their own histories. Bash, Write and Edit still use the selected working
121
- directory while transcripts, runs, memory and tasks live centrally. A local
122
- `.namzu` holds authored `commands`, `plugins`, `skills` and `MEMORY.md`.
123
- Older project-local runtime and global `cli.json` pointers are inventory data;
124
- the CLI does not automatically adopt or migrate them. See
125
- [Project and session state](../../docs/cli/project-state.md) for identity and
126
- compatibility details.
127
-
128
- `namzu state` inventories the current workspace's legacy `.namzu` tree and the
129
- resolved application-home tree without loading either config cascade or
130
- changing either tree. It reports authored/configuration/runtime/control bytes, canonical
131
- sessions and runs, raw checkpoint and emergency-save files, attachment pairs,
132
- privacy boundaries, and project binding health. JSON and YAML use the global
133
- `--format` flag. The snapshot is best-effort and unlocked: origin-only sessions
134
- are candidates for investigation, never an automatic deletion claim, and the
135
- command does not repair, move, chmod, or delete anything.
115
+ Generated CLI state lives below the application home: `~/.namzu` by default,
116
+ or the existing real directory named by `NAMZU_HOME`. Each working directory
117
+ gets `projects/<slug>/`, where the slug is its canonical path with every
118
+ character outside `[A-Za-z0-9]` replaced by `-`; a project id is minted once
119
+ into `projects/<slug>/project.json`. A session is one append-only log,
120
+ `projects/<slug>/<session-id>.jsonl`, with its child sessions, checkpoints,
121
+ tasks and file-history snapshots under `<session-id>/`; memory, resident state
122
+ and worktrees are under `projects/<slug>/` too. `~/.namzu/index.sqlite` is an
123
+ index rebuilt from the logs, so deleting it loses nothing. Bash, Write and
124
+ Edit still use the selected working directory, and nothing generated is
125
+ written there: a local `.namzu` holds only the `agents`, `commands`,
126
+ `plugins`, `skills` and `MEMORY.md` you author. See
127
+ [Session storage](../../docs/cli/session-storage.md) for the layout and
128
+ [Project and session state](../../docs/cli/project-state.md) for identity.
129
+
130
+ `namzu state` inventories the application-home tree without loading a config
131
+ cascade or changing anything. It reports authored/configuration/runtime/control
132
+ bytes, sessions and turns, checkpoint files, attachment pairs, privacy
133
+ boundaries and project health, and a `legacy` category (report `version: 2`)
134
+ listing state an earlier CLI wrote — the old top-level `sessions/`, `state/`,
135
+ `checkpoints/` and similar directories, and every `projects/<uuid>/` — which
136
+ this version never reads. JSON and YAML use the global `--format` flag. The
137
+ snapshot is best-effort and unlocked, and the command does not repair, move,
138
+ chmod, or delete anything.
136
139
 
137
140
  Desktop control is separate from attaching a clipboard image. Ctrl+V/Alt+V
138
141
  adds an image to the current prompt; the TUI's `computer_use` tool lets the
@@ -202,7 +205,7 @@ provider/model flags work with `run-stream`.
202
205
  The picker lists each service's supported models from the provider catalogue;
203
206
  an explicit model selection is saved using the existing preferences flow.
204
207
  Go requests carry the actual Namzu conversation ID in `x-opencode-session`,
205
- stable across turns and resumed runs. Delegated work shares its invoking
208
+ stable across turns and resumed turns. Delegated work shares its invoking
206
209
  conversation's upstream session; switching conversations changes that ID.
207
210
 
208
211
  Bare `/help` opens the session's complete command vocabulary as a keyboard
@@ -324,16 +327,25 @@ session. In particular, `sandbox yes` describes the local runtime provider that
324
327
  will execute tools; it is independent of the optional-package installation row
325
328
  reported by `namzu doctor`.
326
329
 
327
- The coding session defaults that provider to the canonical working directory.
330
+ Tools run on the host under the permission system by default: each shell
331
+ command goes through the permission rules and mode, and a file tool's path
332
+ outside the working directory is an approval request rather than a refusal —
333
+ asked every time (`strict` refuses it, `plan` asks only for a read), and
334
+ refused when nobody can be asked (add the directory with `--add-dir` instead). The OS sandbox is opt-in with `sandbox.enabled: true`; a sandboxed `bash` call
335
+ may ask to run one command outside it, and that request is put to you every
336
+ time (`plan` and `strict` refuse it), and refused when nobody can be asked. See
337
+ `docs/cli/tool-boundary.md`.
338
+
339
+ With the sandbox on, the provider defaults to the canonical working directory.
328
340
  Each turn owns and tears down a fresh sandbox handle, while the caller-owned
329
341
  project files survive and remain visible to later turns and delegated agents.
330
- Set `sandbox.workspace` to `ephemeral` only when a disposable per-run tree is
342
+ Set `sandbox.workspace` to `ephemeral` only when a disposable per-turn tree is
331
343
  the intended behavior; `/status` reports which mode is active.
332
344
 
333
- The default sandbox exposes Bash as a foreground, serialized operation. It does
334
- not advertise the background-job tool or a `run_in_background` input that the
335
- sandbox cannot preserve. Use delegated agents for independent concurrent work;
336
- turning the sandbox off restores the host background-job capability.
345
+ A sandbox that cannot start a detached process exposes Bash as a foreground,
346
+ serialized operation and refuses `run_in_background`. Use delegated agents for
347
+ independent concurrent work; host execution keeps the background-job
348
+ capability.
337
349
 
338
350
  Ctrl+L clears only the rendered terminal transcript while idle. It preserves
339
351
  model context, durable conversation history and copy/export targets; an active
@@ -344,8 +356,8 @@ Bare `/export` opens a destination chooser for the complete verified Markdown
344
356
  conversation. Copy to clipboard sends one bounded terminal request and reports
345
357
  that the request may be ignored by terminal policy; Save to file opens a
346
358
  prefilled filename editor and never overwrites an existing file. `/export <path>`
347
- remains the direct file shortcut. Both routes read the durable turn/run
348
- evidence rather than reconstructing source from the painted transcript.
359
+ remains the direct file shortcut. Both routes read the session log rather than
360
+ reconstructing source from the painted transcript.
349
361
 
350
362
  Repository policy stays live for the whole session. The CLI starts with the
351
363
  applicable `AGENTS.md` chain, discovers nested instruction files after
@@ -360,7 +372,7 @@ both scopes. Project plugins are not read before the project trust gate, and
360
372
  plugin paths are canonicalized against the trusted project or user-home root;
361
373
  links that leave that scope and symlinked manifests are refused. Plugin
362
374
  settings cannot be activated by an environment-selected profile. The
363
- same plugin hooks and skills reach interactive turns, headless runs, durable
375
+ same plugin hooks and skills reach interactive turns, headless turns, durable
364
376
  resumes, and ACP sessions; session shutdown settles live work before unloading
365
377
  them.
366
378
 
@@ -368,13 +380,16 @@ them.
368
380
 
369
381
  ```bash
370
382
  namzu run "fix the failing test" --format json
371
- namzu run-stream "refactor the parser" | jq -c 'select(.type == "tool_call")'
383
+ namzu run-stream "refactor the parser" | jq -c 'select(.kind == "tool-start")'
372
384
  ```
373
385
 
374
386
  `run` prints a result; `run-stream` emits one structured event per line as the
375
- run happens, so a script can act on a tool call before the run is over. Both
387
+ turn happens, so a script can act on a tool call before the turn is over. Both
376
388
  take `--verbose`/`--quiet`, and both write logs to stderr so stdout stays a
377
- clean protocol stream.
389
+ clean protocol stream. A session has one active turn at a time: either command
390
+ aimed at a session whose turn is still running or paused exits 75 and names
391
+ that turn. See [Exit codes](../../docs/cli/run-exit-codes.md) and
392
+ [`run-stream`](../../docs/cli/run-stream.md).
378
393
 
379
394
  Recoverable provider stops are explicit `paused` events carrying their
380
395
  checkpoint and any structured retry guidance. The interactive transcript shows
package/dist/bin.js CHANGED
@@ -3,14 +3,21 @@ import { fileURLToPath } from 'node:url';
3
3
  import { runCli } from './cli.js';
4
4
  import { EXIT_INTERNAL_ERROR } from './exit-codes.js';
5
5
  import { resumeInvocation } from './resume-invocation.js';
6
+ import { terminationInProgress } from './termination.js';
6
7
  // Preserve source loaders and alternate installations when the public command differs.
7
8
  const entrypoint = fileURLToPath(import.meta.url);
8
9
  runCli({
9
10
  argv: process.argv,
10
11
  resumeCommand: resumeInvocation(entrypoint),
11
12
  }).then((code) => {
13
+ // A command stopped by a signal can return while its handler is still
14
+ // giving the conversation back; the handler ends the process.
15
+ if (terminationInProgress() !== null)
16
+ return;
12
17
  process.exit(code);
13
18
  }, (err) => {
19
+ if (terminationInProgress() !== null)
20
+ return;
14
21
  process.stderr.write(`Fatal: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}\n`);
15
22
  process.exit(EXIT_INTERNAL_ERROR);
16
23
  });
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,uFAAuF;AACvF,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,CAAC;IACN,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,aAAa,EAAE,gBAAgB,CAAC,UAAU,CAAC;CAC3C,CAAC,CAAC,IAAI,CACN,CAAC,IAAI,EAAE,EAAE;IACR,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACnB,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;IACP,OAAO,CAAC,MAAM,CAAC,KAAK,CACnB,UAAU,GAAG,YAAY,KAAK,CAAC,C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;AAClC,CAAC,CACD,CAAA"}
@@ -6,7 +6,7 @@
6
6
  * Not git. A checkpoint is taken by the tool wrapper immediately before an
7
7
  * `edit` or `write` runs, whatever the repository's state, and it records
8
8
  * absence too, so a file the model created is removed on restore. Kept per
9
- * session under the project's private state and dropped when the session
9
+ * session in its `<session-id>/file-history/` directory and dropped when the session
10
10
  * closes: a checkpoint outlives a turn, not a session — the conversation
11
11
  * can be forked and resumed, and its files are the working tree's.
12
12
  */
@@ -30,18 +30,31 @@ export interface RestoreReport {
30
30
  /** Files larger than this are not snapshotted; the transcript says so. */
31
31
  export declare const CHECKPOINT_MAX_BYTES: number;
32
32
  export declare class FileCheckpointStore {
33
- /** Where blobs go, e.g. `<state>/checkpoints/<sessionId>`. */
33
+ /**
34
+ * Where blobs go: the session's `file-history/` (`SessionPaths.fileHistory`).
35
+ * A function is read at each turn's first snapshot, so a store that
36
+ * outlives a conversation switch (`/resume`, `/new`) writes into the
37
+ * conversation the turn belongs to, not the one the process started in.
38
+ */
34
39
  private readonly root;
35
40
  /** Only files under here are checkpointed. */
36
41
  private readonly cwd;
37
42
  private readonly turns;
38
43
  private current;
39
44
  private readonly skipped;
45
+ /** Every `file-history/` a blob was written under, so closing drops them all. */
46
+ private readonly roots;
40
47
  constructor(
41
- /** Where blobs go, e.g. `<state>/checkpoints/<sessionId>`. */
42
- root: string,
48
+ /**
49
+ * Where blobs go: the session's `file-history/` (`SessionPaths.fileHistory`).
50
+ * A function is read at each turn's first snapshot, so a store that
51
+ * outlives a conversation switch (`/resume`, `/new`) writes into the
52
+ * conversation the turn belongs to, not the one the process started in.
53
+ */
54
+ root: string | (() => string),
43
55
  /** Only files under here are checkpointed. */
44
56
  cwd: string);
57
+ private currentRoot;
45
58
  /** The next tool write belongs to this turn. Returns its index. */
46
59
  beginTurn(label: string): number;
47
60
  /** Whether a host path is one this store would checkpoint. */
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/checkpoints/store.ts"],"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,EAAE,CAAA"}
@@ -6,7 +6,7 @@
6
6
  * Not git. A checkpoint is taken by the tool wrapper immediately before an
7
7
  * `edit` or `write` runs, whatever the repository's state, and it records
8
8
  * absence too, so a file the model created is removed on restore. Kept per
9
- * session under the project's private state and dropped when the session
9
+ * session in its `<session-id>/file-history/` directory and dropped when the session
10
10
  * closes: a checkpoint outlives a turn, not a session — the conversation
11
11
  * can be forked and resumed, and its files are the working tree's.
12
12
  */
@@ -21,14 +21,24 @@ export class FileCheckpointStore {
21
21
  turns = [];
22
22
  current;
23
23
  skipped = new Set();
24
+ /** Every `file-history/` a blob was written under, so closing drops them all. */
25
+ roots = new Set();
24
26
  constructor(
25
- /** Where blobs go, e.g. `<state>/checkpoints/<sessionId>`. */
27
+ /**
28
+ * Where blobs go: the session's `file-history/` (`SessionPaths.fileHistory`).
29
+ * A function is read at each turn's first snapshot, so a store that
30
+ * outlives a conversation switch (`/resume`, `/new`) writes into the
31
+ * conversation the turn belongs to, not the one the process started in.
32
+ */
26
33
  root,
27
34
  /** Only files under here are checkpointed. */
28
35
  cwd) {
29
36
  this.root = root;
30
37
  this.cwd = cwd;
31
38
  }
39
+ currentRoot() {
40
+ return typeof this.root === 'function' ? this.root() : this.root;
41
+ }
32
42
  /** The next tool write belongs to this turn. Returns its index. */
33
43
  beginTurn(label) {
34
44
  const index = this.turns.length + 1;
@@ -74,7 +84,9 @@ export class FileCheckpointStore {
74
84
  }
75
85
  let blob = null;
76
86
  if (content !== null) {
77
- const dir = join(this.root, String(turn.index));
87
+ const dir = turn.dir ?? join(this.currentRoot(), String(turn.index));
88
+ turn.dir = dir;
89
+ this.roots.add(dirname(dir));
78
90
  await mkdir(dir, { recursive: true });
79
91
  blob = join(dir, `${turn.entries.length}.blob`);
80
92
  await writeFile(blob, content);
@@ -131,14 +143,17 @@ export class FileCheckpointStore {
131
143
  // tree no longer builds on.
132
144
  const dropped = this.turns.splice(this.turns.findIndex((t) => t.index === index));
133
145
  for (const turn of dropped) {
134
- await rm(join(this.root, String(turn.index)), { recursive: true, force: true });
146
+ if (turn.dir)
147
+ await rm(turn.dir, { recursive: true, force: true });
135
148
  }
136
149
  this.current = undefined;
137
150
  return { turn: index, restored: [...restored], removed: [...removed] };
138
151
  }
139
152
  /** Drop every blob. The session is over. */
140
153
  async close() {
141
- await rm(this.root, { recursive: true, force: true });
154
+ for (const root of new Set([...this.roots, this.currentRoot()])) {
155
+ await rm(root, { recursive: true, force: true });
156
+ }
142
157
  }
143
158
  /** A write outside any turn — a host command, say — gets a turn of its own. */
144
159
  turnForStrayWrite() {