@namzu/sdk 62.6.1 → 62.8.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 (344) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/agents/QueryAgent.d.ts.map +1 -1
  3. package/dist/agents/QueryAgent.js +5 -0
  4. package/dist/agents/QueryAgent.js.map +1 -1
  5. package/dist/agents/examples/SupervisorAgent.d.ts.map +1 -1
  6. package/dist/agents/examples/SupervisorAgent.js +1 -0
  7. package/dist/agents/examples/SupervisorAgent.js.map +1 -1
  8. package/dist/agents/explore.d.ts.map +1 -1
  9. package/dist/agents/explore.js +2 -1
  10. package/dist/agents/explore.js.map +1 -1
  11. package/dist/compaction/index.d.ts +1 -1
  12. package/dist/compaction/index.d.ts.map +1 -1
  13. package/dist/compaction/index.js +1 -1
  14. package/dist/compaction/index.js.map +1 -1
  15. package/dist/compaction/model-summary.js +2 -2
  16. package/dist/compaction/model-summary.js.map +1 -1
  17. package/dist/compaction/summary.d.ts +16 -1
  18. package/dist/compaction/summary.d.ts.map +1 -1
  19. package/dist/compaction/summary.js +25 -2
  20. package/dist/compaction/summary.js.map +1 -1
  21. package/dist/config/runtime.d.ts +8 -0
  22. package/dist/config/runtime.d.ts.map +1 -1
  23. package/dist/config/runtime.js +15 -0
  24. package/dist/config/runtime.js.map +1 -1
  25. package/dist/execution/workflow/runtime.d.ts.map +1 -1
  26. package/dist/execution/workflow/runtime.js +3 -0
  27. package/dist/execution/workflow/runtime.js.map +1 -1
  28. package/dist/execution/workflow/types.d.ts +8 -0
  29. package/dist/execution/workflow/types.d.ts.map +1 -1
  30. package/dist/manager/agent/child-session.d.ts +12 -0
  31. package/dist/manager/agent/child-session.d.ts.map +1 -1
  32. package/dist/manager/agent/child-session.js +29 -0
  33. package/dist/manager/agent/child-session.js.map +1 -1
  34. package/dist/manager/agent/lifecycle.d.ts.map +1 -1
  35. package/dist/manager/agent/lifecycle.js +8 -0
  36. package/dist/manager/agent/lifecycle.js.map +1 -1
  37. package/dist/manager/session/turn-recorder.d.ts +13 -2
  38. package/dist/manager/session/turn-recorder.d.ts.map +1 -1
  39. package/dist/manager/session/turn-recorder.js +107 -29
  40. package/dist/manager/session/turn-recorder.js.map +1 -1
  41. package/dist/prompt/coding-agent-doctrine.d.ts +3 -3
  42. package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
  43. package/dist/prompt/coding-agent-doctrine.js +5 -3
  44. package/dist/prompt/coding-agent-doctrine.js.map +1 -1
  45. package/dist/provider/fallback.d.ts.map +1 -1
  46. package/dist/provider/fallback.js +5 -1
  47. package/dist/provider/fallback.js.map +1 -1
  48. package/dist/provider/retry.d.ts +25 -0
  49. package/dist/provider/retry.d.ts.map +1 -1
  50. package/dist/provider/retry.js +28 -0
  51. package/dist/provider/retry.js.map +1 -1
  52. package/dist/public-runtime.d.ts +3 -3
  53. package/dist/public-runtime.d.ts.map +1 -1
  54. package/dist/public-runtime.js +3 -3
  55. package/dist/public-runtime.js.map +1 -1
  56. package/dist/public-tools.d.ts +4 -2
  57. package/dist/public-tools.d.ts.map +1 -1
  58. package/dist/public-tools.js +5 -2
  59. package/dist/public-tools.js.map +1 -1
  60. package/dist/runtime/query/auto-review/classifier.d.ts +7 -1
  61. package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -1
  62. package/dist/runtime/query/auto-review/classifier.js +8 -4
  63. package/dist/runtime/query/auto-review/classifier.js.map +1 -1
  64. package/dist/runtime/query/auto-review/prompt.d.ts.map +1 -1
  65. package/dist/runtime/query/auto-review/prompt.js +2 -0
  66. package/dist/runtime/query/auto-review/prompt.js.map +1 -1
  67. package/dist/runtime/query/auto-review/script-evidence.d.ts +93 -0
  68. package/dist/runtime/query/auto-review/script-evidence.d.ts.map +1 -0
  69. package/dist/runtime/query/auto-review/script-evidence.js +566 -0
  70. package/dist/runtime/query/auto-review/script-evidence.js.map +1 -0
  71. package/dist/runtime/query/checkpoint.d.ts +13 -0
  72. package/dist/runtime/query/checkpoint.d.ts.map +1 -1
  73. package/dist/runtime/query/checkpoint.js +37 -0
  74. package/dist/runtime/query/checkpoint.js.map +1 -1
  75. package/dist/runtime/query/context.d.ts.map +1 -1
  76. package/dist/runtime/query/context.js +28 -2
  77. package/dist/runtime/query/context.js.map +1 -1
  78. package/dist/runtime/query/executor.d.ts +38 -1
  79. package/dist/runtime/query/executor.d.ts.map +1 -1
  80. package/dist/runtime/query/executor.js +154 -13
  81. package/dist/runtime/query/executor.js.map +1 -1
  82. package/dist/runtime/query/finalize-turn.d.ts +7 -1
  83. package/dist/runtime/query/finalize-turn.d.ts.map +1 -1
  84. package/dist/runtime/query/finalize-turn.js +2 -0
  85. package/dist/runtime/query/finalize-turn.js.map +1 -1
  86. package/dist/runtime/query/index.d.ts +8 -0
  87. package/dist/runtime/query/index.d.ts.map +1 -1
  88. package/dist/runtime/query/index.js +7 -0
  89. package/dist/runtime/query/index.js.map +1 -1
  90. package/dist/runtime/query/iteration/index.d.ts +32 -1
  91. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  92. package/dist/runtime/query/iteration/index.js +158 -10
  93. package/dist/runtime/query/iteration/index.js.map +1 -1
  94. package/dist/runtime/query/iteration/phases/compaction.d.ts +12 -0
  95. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  96. package/dist/runtime/query/iteration/phases/compaction.js +48 -1
  97. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  98. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  99. package/dist/runtime/query/iteration/phases/context.js +5 -0
  100. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  101. package/dist/runtime/query/iteration/stream-turn.js +3 -3
  102. package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
  103. package/dist/runtime/query/prelude-lease.d.ts.map +1 -1
  104. package/dist/runtime/query/prelude-lease.js +22 -0
  105. package/dist/runtime/query/prelude-lease.js.map +1 -1
  106. package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
  107. package/dist/runtime/query/prepare-turn.js +30 -12
  108. package/dist/runtime/query/prepare-turn.js.map +1 -1
  109. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  110. package/dist/runtime/query/review-policy.js +29 -0
  111. package/dist/runtime/query/review-policy.js.map +1 -1
  112. package/dist/runtime/query/session-storage.d.ts.map +1 -1
  113. package/dist/runtime/query/session-storage.js +44 -3
  114. package/dist/runtime/query/session-storage.js.map +1 -1
  115. package/dist/runtime/query/tooling.d.ts +2 -0
  116. package/dist/runtime/query/tooling.d.ts.map +1 -1
  117. package/dist/runtime/query/tooling.js +1 -0
  118. package/dist/runtime/query/tooling.js.map +1 -1
  119. package/dist/runtime/query/turn/completion-audit.d.ts +27 -1
  120. package/dist/runtime/query/turn/completion-audit.d.ts.map +1 -1
  121. package/dist/runtime/query/turn/completion-audit.js +71 -6
  122. package/dist/runtime/query/turn/completion-audit.js.map +1 -1
  123. package/dist/runtime/query/turn/outcome-ledger.d.ts +113 -0
  124. package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -0
  125. package/dist/runtime/query/turn/outcome-ledger.js +578 -0
  126. package/dist/runtime/query/turn/outcome-ledger.js.map +1 -0
  127. package/dist/sandbox/file-walk.d.ts +7 -1
  128. package/dist/sandbox/file-walk.d.ts.map +1 -1
  129. package/dist/sandbox/file-walk.js +30 -4
  130. package/dist/sandbox/file-walk.js.map +1 -1
  131. package/dist/sandbox/glob-segment.d.ts +8 -1
  132. package/dist/sandbox/glob-segment.d.ts.map +1 -1
  133. package/dist/sandbox/glob-segment.js +28 -9
  134. package/dist/sandbox/glob-segment.js.map +1 -1
  135. package/dist/store/checkpoint/contract.d.ts +12 -0
  136. package/dist/store/checkpoint/contract.d.ts.map +1 -1
  137. package/dist/store/checkpoint/contract.js.map +1 -1
  138. package/dist/store/checkpoint/disk.d.ts.map +1 -1
  139. package/dist/store/checkpoint/disk.js +34 -2
  140. package/dist/store/checkpoint/disk.js.map +1 -1
  141. package/dist/store/checkpoint/prune.d.ts.map +1 -1
  142. package/dist/store/checkpoint/prune.js +6 -0
  143. package/dist/store/checkpoint/prune.js.map +1 -1
  144. package/dist/store/evidence/disk.js +40 -3
  145. package/dist/store/evidence/disk.js.map +1 -1
  146. package/dist/store/session-log/incremental.d.ts +23 -0
  147. package/dist/store/session-log/incremental.d.ts.map +1 -0
  148. package/dist/store/session-log/incremental.js +117 -0
  149. package/dist/store/session-log/incremental.js.map +1 -0
  150. package/dist/store/session-log/index.d.ts +1 -0
  151. package/dist/store/session-log/index.d.ts.map +1 -1
  152. package/dist/store/session-log/index.js +1 -0
  153. package/dist/store/session-log/index.js.map +1 -1
  154. package/dist/store/session-log/turn-outcome.d.ts +37 -0
  155. package/dist/store/session-log/turn-outcome.d.ts.map +1 -0
  156. package/dist/store/session-log/turn-outcome.js +77 -0
  157. package/dist/store/session-log/turn-outcome.js.map +1 -0
  158. package/dist/tools/admit-facts.d.ts.map +1 -1
  159. package/dist/tools/admit-facts.js +1 -0
  160. package/dist/tools/admit-facts.js.map +1 -1
  161. package/dist/tools/builtins/bash.d.ts.map +1 -1
  162. package/dist/tools/builtins/bash.js +11 -2
  163. package/dist/tools/builtins/bash.js.map +1 -1
  164. package/dist/tools/builtins/bounded-file-read.d.ts +19 -1
  165. package/dist/tools/builtins/bounded-file-read.d.ts.map +1 -1
  166. package/dist/tools/builtins/bounded-file-read.js +56 -3
  167. package/dist/tools/builtins/bounded-file-read.js.map +1 -1
  168. package/dist/tools/builtins/edit-apply.d.ts.map +1 -1
  169. package/dist/tools/builtins/edit-apply.js +24 -3
  170. package/dist/tools/builtins/edit-apply.js.map +1 -1
  171. package/dist/tools/builtins/edit.d.ts +31 -17
  172. package/dist/tools/builtins/edit.d.ts.map +1 -1
  173. package/dist/tools/builtins/edit.js +92 -27
  174. package/dist/tools/builtins/edit.js.map +1 -1
  175. package/dist/tools/builtins/glob.js +1 -1
  176. package/dist/tools/builtins/glob.js.map +1 -1
  177. package/dist/tools/builtins/grep.d.ts +8 -0
  178. package/dist/tools/builtins/grep.d.ts.map +1 -1
  179. package/dist/tools/builtins/grep.js +148 -21
  180. package/dist/tools/builtins/grep.js.map +1 -1
  181. package/dist/tools/builtins/notebook-guard.d.ts +19 -0
  182. package/dist/tools/builtins/notebook-guard.d.ts.map +1 -0
  183. package/dist/tools/builtins/notebook-guard.js +75 -0
  184. package/dist/tools/builtins/notebook-guard.js.map +1 -0
  185. package/dist/tools/builtins/read-render.d.ts.map +1 -1
  186. package/dist/tools/builtins/read-render.js +8 -2
  187. package/dist/tools/builtins/read-render.js.map +1 -1
  188. package/dist/tools/builtins/search-support.d.ts +8 -0
  189. package/dist/tools/builtins/search-support.d.ts.map +1 -1
  190. package/dist/tools/builtins/search-support.js +66 -0
  191. package/dist/tools/builtins/search-support.js.map +1 -1
  192. package/dist/tools/builtins/write-file.d.ts.map +1 -1
  193. package/dist/tools/builtins/write-file.js +14 -1
  194. package/dist/tools/builtins/write-file.js.map +1 -1
  195. package/dist/tools/coordinator/agent.d.ts.map +1 -1
  196. package/dist/tools/coordinator/agent.js +25 -6
  197. package/dist/tools/coordinator/agent.js.map +1 -1
  198. package/dist/tools/coordinator/index.d.ts.map +1 -1
  199. package/dist/tools/coordinator/index.js +6 -1
  200. package/dist/tools/coordinator/index.js.map +1 -1
  201. package/dist/tools/coordinator/outcome-record.d.ts +22 -0
  202. package/dist/tools/coordinator/outcome-record.d.ts.map +1 -0
  203. package/dist/tools/coordinator/outcome-record.js +91 -0
  204. package/dist/tools/coordinator/outcome-record.js.map +1 -0
  205. package/dist/tools/defineTool.d.ts +2 -0
  206. package/dist/tools/defineTool.d.ts.map +1 -1
  207. package/dist/tools/defineTool.js +1 -0
  208. package/dist/tools/defineTool.js.map +1 -1
  209. package/dist/tools/file-read-tracker.d.ts +23 -2
  210. package/dist/tools/file-read-tracker.d.ts.map +1 -1
  211. package/dist/tools/file-read-tracker.js +37 -2
  212. package/dist/tools/file-read-tracker.js.map +1 -1
  213. package/dist/tools/untrusted-envelope.d.ts +6 -0
  214. package/dist/tools/untrusted-envelope.d.ts.map +1 -1
  215. package/dist/tools/untrusted-envelope.js +22 -1
  216. package/dist/tools/untrusted-envelope.js.map +1 -1
  217. package/dist/toolsets/manager.d.ts.map +1 -1
  218. package/dist/toolsets/manager.js +3 -4
  219. package/dist/toolsets/manager.js.map +1 -1
  220. package/dist/toolsets/validation-issues.d.ts +27 -0
  221. package/dist/toolsets/validation-issues.d.ts.map +1 -0
  222. package/dist/toolsets/validation-issues.js +83 -0
  223. package/dist/toolsets/validation-issues.js.map +1 -0
  224. package/dist/turn/memory-recall.d.ts +13 -0
  225. package/dist/turn/memory-recall.d.ts.map +1 -1
  226. package/dist/turn/memory-recall.js +18 -0
  227. package/dist/turn/memory-recall.js.map +1 -1
  228. package/dist/types/agent/base.d.ts +19 -0
  229. package/dist/types/agent/base.d.ts.map +1 -1
  230. package/dist/types/agent/query.d.ts +2 -0
  231. package/dist/types/agent/query.d.ts.map +1 -1
  232. package/dist/types/common/index.d.ts +17 -0
  233. package/dist/types/common/index.d.ts.map +1 -1
  234. package/dist/types/common/index.js +8 -1
  235. package/dist/types/common/index.js.map +1 -1
  236. package/dist/types/hitl/index.d.ts +22 -0
  237. package/dist/types/hitl/index.d.ts.map +1 -1
  238. package/dist/types/hitl/index.js.map +1 -1
  239. package/dist/types/session/config.d.ts +20 -0
  240. package/dist/types/session/config.d.ts.map +1 -1
  241. package/dist/types/session/events.d.ts +3 -3
  242. package/dist/types/session/events.d.ts.map +1 -1
  243. package/dist/types/session/index.d.ts +1 -0
  244. package/dist/types/session/index.d.ts.map +1 -1
  245. package/dist/types/session/index.js +1 -0
  246. package/dist/types/session/index.js.map +1 -1
  247. package/dist/types/session/outcome.d.ts +95 -0
  248. package/dist/types/session/outcome.d.ts.map +1 -0
  249. package/dist/types/session/outcome.js +45 -0
  250. package/dist/types/session/outcome.js.map +1 -0
  251. package/dist/types/session/prepare-step.d.ts +2 -0
  252. package/dist/types/session/prepare-step.d.ts.map +1 -1
  253. package/dist/types/session/records.d.ts +167 -2
  254. package/dist/types/session/records.d.ts.map +1 -1
  255. package/dist/types/session/records.js +42 -0
  256. package/dist/types/session/records.js.map +1 -1
  257. package/dist/types/session/turn.d.ts +18 -0
  258. package/dist/types/session/turn.d.ts.map +1 -1
  259. package/dist/types/session/turn.js.map +1 -1
  260. package/dist/types/tool/index.d.ts +30 -0
  261. package/dist/types/tool/index.d.ts.map +1 -1
  262. package/dist/types/tool/index.js.map +1 -1
  263. package/dist/types/tool/presentation.d.ts +6 -0
  264. package/dist/types/tool/presentation.d.ts.map +1 -1
  265. package/package.json +1 -1
  266. package/src/agents/QueryAgent.ts +5 -0
  267. package/src/agents/examples/SupervisorAgent.ts +1 -0
  268. package/src/agents/explore.ts +2 -1
  269. package/src/compaction/index.ts +1 -0
  270. package/src/compaction/model-summary.ts +2 -2
  271. package/src/compaction/summary.ts +30 -2
  272. package/src/config/runtime.ts +15 -0
  273. package/src/execution/workflow/runtime.ts +4 -0
  274. package/src/execution/workflow/types.ts +9 -0
  275. package/src/manager/agent/child-session.ts +36 -0
  276. package/src/manager/agent/lifecycle.ts +9 -0
  277. package/src/manager/session/turn-recorder.ts +115 -30
  278. package/src/pricing/rates.source.json +1 -1
  279. package/src/prompt/coding-agent-doctrine.ts +5 -3
  280. package/src/provider/fallback.ts +6 -1
  281. package/src/provider/retry.ts +51 -0
  282. package/src/public-runtime.ts +10 -1
  283. package/src/public-tools.ts +6 -1
  284. package/src/runtime/query/auto-review/classifier.ts +21 -5
  285. package/src/runtime/query/auto-review/prompt.ts +2 -0
  286. package/src/runtime/query/auto-review/script-evidence.ts +618 -0
  287. package/src/runtime/query/checkpoint.ts +53 -1
  288. package/src/runtime/query/context.ts +33 -6
  289. package/src/runtime/query/executor.ts +183 -21
  290. package/src/runtime/query/finalize-turn.ts +8 -1
  291. package/src/runtime/query/index.ts +19 -0
  292. package/src/runtime/query/iteration/index.ts +167 -14
  293. package/src/runtime/query/iteration/phases/compaction.ts +53 -3
  294. package/src/runtime/query/iteration/phases/context.ts +6 -0
  295. package/src/runtime/query/iteration/stream-turn.ts +3 -3
  296. package/src/runtime/query/prelude-lease.ts +19 -0
  297. package/src/runtime/query/prepare-turn.ts +29 -12
  298. package/src/runtime/query/review-policy.ts +33 -0
  299. package/src/runtime/query/session-storage.ts +42 -3
  300. package/src/runtime/query/tooling.ts +3 -0
  301. package/src/runtime/query/turn/completion-audit.ts +76 -5
  302. package/src/runtime/query/turn/outcome-ledger.ts +633 -0
  303. package/src/sandbox/file-walk.ts +41 -4
  304. package/src/sandbox/glob-segment.ts +48 -24
  305. package/src/store/checkpoint/contract.ts +15 -0
  306. package/src/store/checkpoint/disk.ts +34 -2
  307. package/src/store/checkpoint/prune.ts +13 -0
  308. package/src/store/evidence/disk.ts +57 -2
  309. package/src/store/session-log/incremental.ts +147 -0
  310. package/src/store/session-log/index.ts +7 -0
  311. package/src/store/session-log/turn-outcome.ts +84 -0
  312. package/src/tools/admit-facts.ts +1 -0
  313. package/src/tools/builtins/bash.ts +12 -2
  314. package/src/tools/builtins/bounded-file-read.ts +59 -2
  315. package/src/tools/builtins/edit-apply.ts +26 -4
  316. package/src/tools/builtins/edit.ts +106 -41
  317. package/src/tools/builtins/glob.ts +1 -1
  318. package/src/tools/builtins/grep.ts +173 -27
  319. package/src/tools/builtins/notebook-guard.ts +76 -0
  320. package/src/tools/builtins/read-render.ts +12 -2
  321. package/src/tools/builtins/search-support.ts +62 -0
  322. package/src/tools/builtins/write-file.ts +12 -1
  323. package/src/tools/coordinator/agent.ts +31 -7
  324. package/src/tools/coordinator/index.ts +6 -1
  325. package/src/tools/coordinator/outcome-record.ts +93 -0
  326. package/src/tools/defineTool.ts +3 -0
  327. package/src/tools/file-read-tracker.ts +51 -2
  328. package/src/tools/untrusted-envelope.ts +23 -1
  329. package/src/toolsets/manager.ts +6 -10
  330. package/src/toolsets/validation-issues.ts +97 -0
  331. package/src/turn/memory-recall.ts +28 -0
  332. package/src/types/agent/base.ts +20 -0
  333. package/src/types/agent/query.ts +2 -0
  334. package/src/types/common/index.ts +25 -1
  335. package/src/types/hitl/index.ts +27 -0
  336. package/src/types/session/config.ts +20 -0
  337. package/src/types/session/events.ts +3 -3
  338. package/src/types/session/index.ts +1 -0
  339. package/src/types/session/outcome.ts +139 -0
  340. package/src/types/session/prepare-step.ts +2 -0
  341. package/src/types/session/records.ts +67 -1
  342. package/src/types/session/turn.ts +19 -0
  343. package/src/types/tool/index.ts +30 -0
  344. package/src/types/tool/presentation.ts +6 -0
@@ -207,6 +207,12 @@ export type ToolFacts = {
207
207
  readonly reason: ToolFailureReason;
208
208
  /** What it was about: a path, or the tool's name for `unknown_tool`. */
209
209
  readonly subject?: string;
210
+ /**
211
+ * Why a refused call did not run, as one plain line the kernel wrote
212
+ * (a policy rule, the command guard). Absent when no reason was
213
+ * recorded; a host shows nothing for it rather than a guess.
214
+ */
215
+ readonly note?: string;
210
216
  };
211
217
  /** The same shapes, for what a call produced. */
212
218
  export type ToolResultView = ToolCallView;
@@ -1 +1 @@
1
- {"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../../src/types/tool/presentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY;AACvB,4EAA4E;AAC1E;IACA,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,CAAC,EAAE,UAAU,CAAA;IAClC,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAA;IACjC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAA;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAA;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,C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QAAQ,CAAC,cAAc,CAAC,EAAE,IAAI,CAAA;CAC7B,GACD;IACA,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;IAClC,wEAAwE;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAEJ,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG,YAAY,CAAA;AAEzC;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAAC,MAAM,GAAG,OAAO;IACjD,WAAW,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAA;IACrD,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,CAAA;CAC7E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namzu/sdk",
3
- "version": "62.6.1",
3
+ "version": "62.8.0",
4
4
  "description": "Open-source AI kernel for TypeScript: runs an agent the way an operating system runs a process, with an identity and a budget, scheduled tool calls and checkpointed turns.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "engines": {
@@ -40,6 +40,7 @@ const configRoutes = {
40
40
  compactionSummaryRoute: 'query',
41
41
  allowedTools: 'special',
42
42
  toolResultGuardrails: 'query',
43
+ fileReadTracker: 'query',
43
44
  deniedTools: 'special',
44
45
  persona: 'query',
45
46
  logger: 'special',
@@ -49,6 +50,8 @@ const configRoutes = {
49
50
  speed: 'turn',
50
51
  reasoning: 'turn',
51
52
  completionAudit: 'turn',
53
+ maxHookRefusals: 'turn',
54
+ outcome: 'turn',
52
55
  idempotencyKey: 'special',
53
56
  projectId: 'special',
54
57
  topicId: 'special',
@@ -75,6 +78,7 @@ const configRoutes = {
75
78
  sandboxProvider: 'query',
76
79
  sandboxTeardownTimeoutMs: 'query',
77
80
  outsideRootAccess: 'query',
81
+ outsideRootRefusal: 'query',
78
82
  sandboxEscape: 'query',
79
83
  compactionConfig: 'query',
80
84
  workingMemoryProvider: 'query',
@@ -273,6 +277,7 @@ export class QueryAgent extends AbstractAgent<QueryAgentConfig, QueryAgentResult
273
277
  durationMs: Date.now() - startTime,
274
278
  messages: turn.messages,
275
279
  result: turn.result,
280
+ ...(turn.outcome ? { outcome: turn.outcome } : {}),
276
281
  structuredOutput: turn.structuredOutput,
277
282
  lastError: turn.lastError,
278
283
  toolCallCount,
@@ -512,6 +512,7 @@ export class SupervisorAgent extends AbstractAgent<SupervisorAgentConfig, Superv
512
512
  durationMs: Date.now() - startTime,
513
513
  messages: turn.messages,
514
514
  result: turn.result,
515
+ ...(turn.outcome ? { outcome: turn.outcome } : {}),
515
516
  // `BaseAgentResult.structuredOutput` names "an archetype's result
516
517
  // literal did not copy it" as a defect it was written to close.
517
518
  // This literal still did not copy it, so the same defect was live
@@ -27,6 +27,7 @@ export const EXPLORE_AGENT_PROMPT = [
27
27
  'You are a read-only sub-agent dispatched to find things out: where something is defined, which files reference it, how a piece of code works, what a directory contains.',
28
28
  'You cannot see the parent conversation — work only from the prompt you were given.',
29
29
  'You have reading and searching tools only. You cannot edit, write or run commands, and you must not describe a change as made.',
30
- 'Search broadly first, then read what matters. Report file paths with line numbers, quote the relevant lines, and say plainly what you did not find.',
30
+ 'Search broadly first, then read what matters. Report file paths with line numbers, quote the relevant lines, and say plainly what you did not find and what you did not read.',
31
+ 'You are best at locating answers; prefer locating over auditing whole files, and say so when a task asks for more than you can cover.',
31
32
  'End with a concise answer the parent can act on; do not ask the parent questions.',
32
33
  ].join('\n')
@@ -79,6 +79,7 @@ export type { CompactionResult, CompactNowInput, CompactRegionInput } from './ma
79
79
  export {
80
80
  COMPACTION_HEADER,
81
81
  COMPACTION_RECOVERY_NOTE,
82
+ COMPACTION_RESUME_NOTE,
82
83
  buildCompactionMessage,
83
84
  isCompactionMessage,
84
85
  } from './summary.js'
@@ -13,7 +13,7 @@ import { classifyProviderError } from '../types/provider/errors.js'
13
13
  import type { LLMProvider } from '../types/provider/interface.js'
14
14
  import type { WorkingStateManager } from './manager.js'
15
15
  import { serializeState } from './serializer.js'
16
- import { isCompactionMessage } from './summary.js'
16
+ import { isCompactionMessage, withoutClosingNotes } from './summary.js'
17
17
  import {
18
18
  MAX_COMPACTION_INSTRUCTIONS_CHARS,
19
19
  type UsageSink,
@@ -185,7 +185,7 @@ export function fitTranscript(entries: readonly string[], budget: number): strin
185
185
  /** The text of a prior summary without the restored files and skills that follow it. */
186
186
  export function summaryBodyOf(content: string): string {
187
187
  const cut = content.indexOf('\n## Restored after compaction')
188
- return (cut >= 0 ? content.slice(0, cut) : content).trim()
188
+ return withoutClosingNotes((cut >= 0 ? content.slice(0, cut) : content).trim())
189
189
  }
190
190
 
191
191
  /** Replaceable earlier summaries on the leading floor, oldest first. */
@@ -34,14 +34,42 @@ export function isCompactionMessage(content: string | null | undefined): boolean
34
34
  export const COMPACTION_RECOVERY_NOTE =
35
35
  'Earlier output was cut from this summary. To get exact earlier text, call search_conversation, then read_conversation.'
36
36
 
37
+ /**
38
+ * The closing instruction after every summary. It is written for the first
39
+ * request after a pass, when the model has only the summary and no memory of
40
+ * the steps it describes. Kept out of {@link COMPACTION_HEADER}, which prompt
41
+ * caching and the replace-in-place check both read byte for byte, and kept
42
+ * constant so the same summary always renders the same message.
43
+ */
44
+ export const COMPACTION_RESUME_NOTE =
45
+ 'Carry on from where this summary says the work stood, without asking the person to repeat it. Treat steps it marks done as done. Files may have changed or may not be shown in full, so read a file again before editing it. If it names something still running or waiting, check on that first.'
46
+
47
+ /**
48
+ * `text` without any closing notes this module adds, however many are stacked.
49
+ * An earlier summary is handed to the next pass whole, and a model may repeat
50
+ * its ending; cutting them here keeps each message to one note.
51
+ */
52
+ export function withoutClosingNotes(text: string): string {
53
+ let out = text.trimEnd()
54
+ for (;;) {
55
+ const next = [COMPACTION_RESUME_NOTE, COMPACTION_RECOVERY_NOTE].reduce(
56
+ (acc, note) => (acc.endsWith(note) ? acc.slice(0, -note.length).trimEnd() : acc),
57
+ out,
58
+ )
59
+ if (next === out) return out
60
+ out = next
61
+ }
62
+ }
63
+
37
64
  /**
38
65
  * The summary, as the system message that replaces what it summarises.
39
- * `recoveryNote` is appended as its own paragraph.
66
+ * `recoveryNote` is appended as its own paragraph, then the resume note, which
67
+ * always closes the message.
40
68
  */
41
69
  export function buildCompactionMessage(body: string, recoveryNote?: string): Message {
42
70
  return {
43
71
  ...createSystemMessage(
44
- `${COMPACTION_HEADER}\n\n${body}${recoveryNote ? `\n\n${recoveryNote}` : ''}`,
72
+ `${COMPACTION_HEADER}\n\n${withoutClosingNotes(body)}${recoveryNote ? `\n\n${recoveryNote}` : ''}\n\n${COMPACTION_RESUME_NOTE}`,
45
73
  ),
46
74
  source: { type: 'compaction-summary' },
47
75
  }
@@ -138,6 +138,21 @@ export const CompactionConfigSchema = z.object({
138
138
  minToolResultCharsToClear: z.number().min(0).default(1_000),
139
139
  /** Tools whose output is never cleared, by name. */
140
140
  preserveToolResultsFrom: z.array(z.string()).optional(),
141
+ /**
142
+ * Before the first request of a turn, clear the old, large tool results
143
+ * when that saves at least `minSavedTokens` by the kernel's own estimate.
144
+ * Meant for a host that knows the provider's prompt cache has expired since
145
+ * the last request, when the whole prefix is paid for at full price anyway.
146
+ * Off when absent. Keeps the newest `keepRecentToolResults` results, errors,
147
+ * pinned (`retain`) messages and already cleared results, exactly as the
148
+ * in-turn clear does, and records the originals as a `compaction_shed` event.
149
+ */
150
+ clearStaleToolResultsAtStart: z
151
+ .object({
152
+ minSavedTokens: z.number().int().positive(),
153
+ keepRecentToolResults: z.number().int().min(0).optional(),
154
+ })
155
+ .optional(),
141
156
 
142
157
  maxToolResults: z.number().int().positive().default(30),
143
158
  maxListSize: z.number().int().positive().default(25),
@@ -1,6 +1,7 @@
1
1
  import { randomBytes } from 'node:crypto'
2
2
  import { cpus } from 'node:os'
3
3
 
4
+ import type { TurnOutcome } from '../../types/session/outcome.js'
4
5
  import { encodeCodeValue } from '../code-runtime/json-value.js'
5
6
  import type { CodeFrame, CodeRuntime, HostCallResult } from '../code-runtime/types.js'
6
7
  import { WorkerCodeRuntime } from '../code-runtime/worker.js'
@@ -209,6 +210,7 @@ interface AgentRecord {
209
210
  readonly childSessionId?: string
210
211
  }
211
212
  childSessionId?: string
213
+ outcome?: TurnOutcome
212
214
  }
213
215
 
214
216
  interface Waiter {
@@ -504,6 +506,7 @@ export class WorkflowRuntime {
504
506
  ? { interrupted: true as const }
505
507
  : {}),
506
508
  ...(agent.childSessionId !== undefined ? { childSessionId: agent.childSessionId } : {}),
509
+ ...(agent.outcome !== undefined ? { outcome: agent.outcome } : {}),
507
510
  })
508
511
  return { ok: true, value: { v: value, t: totalTokens() } }
509
512
  }
@@ -516,6 +519,7 @@ export class WorkflowRuntime {
516
519
  agent.tokens = count(outcome.tokens)
517
520
  agent.toolCalls = count(outcome.toolCalls)
518
521
  if (outcome.sessionId !== undefined) agent.childSessionId = outcome.sessionId
522
+ if (outcome.outcome !== undefined) agent.outcome = outcome.outcome
519
523
  if (agent.userSkipped || outcome.state === 'skipped') {
520
524
  return settle(agent, { state: 'done', skipped: true })
521
525
  }
@@ -4,6 +4,8 @@
4
4
  * runtime schedules them. See `docs/sdk/workflows.md`.
5
5
  */
6
6
 
7
+ import type { TurnOutcome } from '../../types/session/outcome.js'
8
+
7
9
  /** One phase declared in `meta.phases`. */
8
10
  export interface WorkflowPhaseMeta {
9
11
  readonly title: string
@@ -55,6 +57,11 @@ export interface WorkflowAgentOutcome {
55
57
  readonly error?: string
56
58
  /** The id of the child session the host ran this agent in, recorded in the journal. */
57
59
  readonly sessionId?: string
60
+ /**
61
+ * The kernel's record of what the agent's turn changed and what checked it.
62
+ * Written to the journal beside the outcome; the script never receives it.
63
+ */
64
+ readonly outcome?: TurnOutcome
58
65
  }
59
66
 
60
67
  /**
@@ -245,6 +252,8 @@ export type WorkflowJournalRecord =
245
252
  /** Where a cached result was first recorded. */
246
253
  readonly resultFrom?: { readonly pass: number; readonly index: number }
247
254
  readonly childSessionId?: string
255
+ /** What the agent's turn changed and what checked it; see `TurnOutcome`. */
256
+ readonly outcome?: TurnOutcome
248
257
  }
249
258
  | { readonly type: 'log'; readonly at: number; readonly message: string }
250
259
  | {
@@ -1,6 +1,7 @@
1
1
  import { mkdir, readFile } from 'node:fs/promises'
2
2
  import { dirname } from 'node:path'
3
3
  import type { SessionLog, SessionRecordDraft } from '../../store/session-log/index.js'
4
+ import { parseTurnOutcome } from '../../store/session-log/turn-outcome.js'
4
5
  import type { SessionId } from '../../types/ids/index.js'
5
6
  import { type ChildSessionMeta, ChildSessionMetaSchema } from '../../types/session/records.js'
6
7
  import { atomicWriteFile } from '../../utils/atomic-write.js'
@@ -56,6 +57,41 @@ export async function childSessionEnded(
56
57
  return ended
57
58
  }
58
59
 
60
+ /** `child_outcome_recorded`, as the parent's writer appends it. */
61
+ export type ChildOutcomeRecordedDraft = Extract<
62
+ SessionRecordDraft,
63
+ { type: 'child_outcome_recorded' }
64
+ >
65
+
66
+ /**
67
+ * The parent's `child_outcome_recorded` record for a child: the outcome record
68
+ * the child's last settled turn wrote in its own log. `null` when the child has
69
+ * no settled turn or that turn kept none, so a child whose outcome is unknown
70
+ * is never reported as having changed nothing. The parent's writer appends it
71
+ * just before the child's `child_session_ended`, with the same `turnId` rule.
72
+ */
73
+ export async function childOutcomeRecorded(
74
+ childLog: SessionLog,
75
+ ): Promise<ChildOutcomeRecordedDraft | null> {
76
+ let written: { turnId: string; outcome: Readonly<Record<string, unknown>> } | undefined
77
+ let outcome: Readonly<Record<string, unknown>> | undefined
78
+ for await (const { record } of childLog.read({ mode: 'tolerant' })) {
79
+ if (record.type === 'turn_outcome_recorded') {
80
+ written = { turnId: record.turnId, outcome: record.outcome }
81
+ } else if (record.type === 'turn_completed' || record.type === 'turn_failed') {
82
+ // Only the turn that settled counts: an earlier turn's record does not carry over.
83
+ outcome = written?.turnId === record.turnId ? written.outcome : undefined
84
+ }
85
+ }
86
+ if (outcome === undefined || parseTurnOutcome(outcome) === undefined) return null
87
+ return {
88
+ type: 'child_outcome_recorded',
89
+ ignorable: true,
90
+ childSessionId: childLog.sessionId,
91
+ outcome,
92
+ }
93
+ }
94
+
59
95
  /** A `<child-id>.meta.json` that belongs to another child or another parent. */
60
96
  export class ChildSessionMetaOwnerError extends Error {
61
97
  override readonly name = 'ChildSessionMetaOwnerError'
@@ -933,6 +933,15 @@ export class AgentManager {
933
933
  childConfig.toolResultGuardrails = inheritedScreens
934
934
  }
935
935
 
936
+ // A child of its own reader record over the family's authored ledger, so
937
+ // what the parent wrote is still "this session's" to a child that runs
938
+ // it, while what the child has read stays its own and a write by a
939
+ // sibling still makes its stale. See `BaseAgentConfig.fileReadTracker`.
940
+ const childTracker = options.configOverrides?.fileReadTracker?.forChild?.()
941
+ if (childTracker !== undefined) {
942
+ childConfig.fileReadTracker = childTracker
943
+ }
944
+
936
945
  // Stamped after both branches, beside the screens and for the same
937
946
  // reason: a `configBuilder` cannot forward a field it was never told
938
947
  // about, and the bare-config branch builds its config by hand.
@@ -7,6 +7,7 @@ import { NAMZU } from '../../constants/telemetry/index.js'
7
7
  import { resolveModelPricing } from '../../pricing/index.js'
8
8
  import type { SessionTokenBudget } from '../../store/budget/index.js'
9
9
  import type { SessionCheckpointStore } from '../../store/checkpoint/index.js'
10
+ import { foldSessionLog } from '../../store/session-log/incremental.js'
10
11
  import {
11
12
  type SessionLease,
12
13
  type SessionLog,
@@ -24,6 +25,7 @@ import {
24
25
  accumulateTokenUsage,
25
26
  isTerminalStatus,
26
27
  mergeTokenUsage,
28
+ promptSizeOf,
27
29
  } from '../../types/common/index.js'
28
30
  import { NamzuError } from '../../types/errors/index.js'
29
31
  import type { MessageId, SessionId, TenantId, TurnId } from '../../types/ids/index.js'
@@ -37,10 +39,12 @@ import {
37
39
  isEphemeralEvent,
38
40
  } from '../../types/session/events.js'
39
41
  import type { ProjectId, TopicId } from '../../types/session/ids.js'
42
+ import type { TurnOutcome } from '../../types/session/outcome.js'
40
43
  import type { SessionRecord } from '../../types/session/records.js'
41
44
  import type { StepResult } from '../../types/session/step.js'
42
45
  import type { StopReason } from '../../types/session/stop-reason.js'
43
46
  import {
47
+ type LiveTurnSettlement,
44
48
  type Origin,
45
49
  type Turn,
46
50
  type TurnConfigSnapshot,
@@ -56,7 +60,7 @@ import {
56
60
  accumulateUnpricedCost,
57
61
  } from '../../utils/cost.js'
58
62
  import { asCheckpointId, generateAuditEventId, generateMessageId } from '../../utils/id.js'
59
- import { childSessionEnded } from '../agent/child-session.js'
63
+ import { childOutcomeRecorded, childSessionEnded } from '../agent/child-session.js'
60
64
  import { assertSessionLogAttribution } from './attribution.js'
61
65
  import { takeStreamedMessageIdentity } from './streamed-message-identity.js'
62
66
 
@@ -492,6 +496,12 @@ export class TurnRecorder {
492
496
  this.#turn.abandonedJobIds = [...jobIds]
493
497
  }
494
498
 
499
+ /** The turn's outcome record, set once as the loop ends; absent means none was kept. */
500
+ setOutcome(outcome: TurnOutcome | undefined): void {
501
+ if (outcome === undefined) delete this.#turn.outcome
502
+ else this.#turn.outcome = outcome
503
+ }
504
+
495
505
  setSteps(steps: readonly StepResult[]): void {
496
506
  this.#turn.steps = steps
497
507
  }
@@ -527,7 +537,7 @@ export class TurnRecorder {
527
537
  */
528
538
  recordTurnUsage(usage: TokenUsage, servedBy: PricingSubject): void {
529
539
  this.accumulateUsage(usage, servedBy)
530
- this.#lastPromptTokens = usage.promptTokens
540
+ this.#lastPromptTokens = promptSizeOf(usage)
531
541
  this.#lastPromptMessageCount = this.#turn.messages.length
532
542
  }
533
543
 
@@ -585,7 +595,7 @@ export class TurnRecorder {
585
595
  }
586
596
 
587
597
  /** The settlement a terminal record carries, from the turn as it stands. */
588
- settlement(status: TurnSettlement['status']): TurnSettlement {
598
+ settlement(status: TurnSettlement['status']): LiveTurnSettlement {
589
599
  const turn = this.getTurn()
590
600
  const resultMessageId = this.#lastAssistantEntry()?.id
591
601
  return {
@@ -600,6 +610,7 @@ export class TurnRecorder {
600
610
  ...(turn.metadata.servingProvider ? { servingProvider: turn.metadata.servingProvider } : {}),
601
611
  abandonedTaskIds: [...(turn.abandonedTaskIds ?? [])],
602
612
  abandonedJobIds: [...(turn.abandonedJobIds ?? [])],
613
+ ...(turn.outcome ? { outcome: turn.outcome } : {}),
603
614
  }
604
615
  }
605
616
 
@@ -892,6 +903,26 @@ export class TurnRecorder {
892
903
  return this.#enqueue(() => this.#append(draft))
893
904
  }
894
905
 
906
+ /**
907
+ * Append a record a reader can do without (one flagged `ignorable`), in
908
+ * order with every other record. A write that is refused resolves
909
+ * `undefined` instead of failing the turn: the record is only the outcome's
910
+ * account, and a log that really cannot be written fails the next record on
911
+ * its own.
912
+ */
913
+ appendIgnorableRecord(
914
+ draft: Parameters<SessionLog['append']>[1],
915
+ ): Promise<SessionLogEntry | undefined> {
916
+ this.#syncMessages()
917
+ return this.#enqueue(async () => {
918
+ try {
919
+ return await this.#append(draft)
920
+ } catch {
921
+ return undefined
922
+ }
923
+ })
924
+ }
925
+
895
926
  /**
896
927
  * Append a live event as its record. Resolves `undefined` for an event
897
928
  * the log does not hold: an ephemeral one, or one bound to a turn that is
@@ -925,6 +956,20 @@ export class TurnRecorder {
925
956
  }
926
957
  const draft = eventDraft(event, this.#turnOpen() ? this.turnId : undefined)
927
958
  this.#syncMessages()
959
+ // The outcome is a record of its own, just ahead of the one that ends the
960
+ // turn, never a field of the settlement.
961
+ if (
962
+ (event.type === 'turn_completed' || event.type === 'turn_failed') &&
963
+ event.settlement.outcome !== undefined &&
964
+ this.#turnOpen()
965
+ ) {
966
+ await this.appendIgnorableRecord({
967
+ type: 'turn_outcome_recorded',
968
+ turnId: this.turnId,
969
+ ignorable: true,
970
+ outcome: event.settlement.outcome as unknown as Readonly<Record<string, unknown>>,
971
+ })
972
+ }
928
973
  if (
929
974
  event.type === 'turn_paused' ||
930
975
  event.type === 'turn_completed' ||
@@ -981,6 +1026,16 @@ export class TurnRecorder {
981
1026
  return this.#enqueue(async () => {
982
1027
  const ended = await childSessionEnded(childLog)
983
1028
  if (!ended) return undefined
1029
+ // The child's outcome record goes in a record of its own just ahead of
1030
+ // the end record; it is never a field of it.
1031
+ const outcome = await childOutcomeRecorded(childLog)
1032
+ if (outcome) {
1033
+ try {
1034
+ await this.#append(turnId ? { ...outcome, turnId } : outcome)
1035
+ } catch {
1036
+ // Only the outcome's account; the end record below fails on its own if the log is gone.
1037
+ }
1038
+ }
984
1039
  return this.#append(turnId ? { ...ended, turnId } : ended)
985
1040
  })
986
1041
  }
@@ -1357,6 +1412,11 @@ export function eventDraft(
1357
1412
  ...payload
1358
1413
  } = event as SessionEvent & Record<string, unknown>
1359
1414
  const draft = JSON.parse(JSON.stringify(payload)) as Record<string, unknown>
1415
+ // The outcome rides the live settlement only; the log keeps it in its own record.
1416
+ if (draft.settlement !== undefined && typeof draft.settlement === 'object') {
1417
+ const { outcome: _outcome, ...settlement } = draft.settlement as Record<string, unknown>
1418
+ draft.settlement = settlement
1419
+ }
1360
1420
  return { ...draft, ...(turnId ? { turnId } : {}) } as Parameters<SessionLog['append']>[1]
1361
1421
  }
1362
1422
 
@@ -1382,12 +1442,29 @@ export async function readFoldedHistory(
1382
1442
  log: SessionLog,
1383
1443
  options: { readonly throughSeq?: number } = {},
1384
1444
  ): Promise<RecordedMessage[]> {
1445
+ // Folding the whole log is advanced from the last record the previous call
1446
+ // folded, not redone from byte 0 on every turn. A fold to a seq is a
1447
+ // different question and is read in full.
1448
+ if (options.throughSeq === undefined) {
1449
+ return foldSessionLog(log, {
1450
+ name: 'folded-history',
1451
+ mode: 'strict',
1452
+ create: () => new SessionMessageFold(),
1453
+ apply: (fold, entry) => fold.apply(entry.record as SessionRecord),
1454
+ result: (fold) => recordedMessages(log, fold),
1455
+ })
1456
+ }
1385
1457
  const fold = new SessionMessageFold()
1386
- for await (const entry of log.read(
1387
- options.throughSeq !== undefined ? { throughSeq: options.throughSeq } : {},
1388
- )) {
1458
+ for await (const entry of log.read({ throughSeq: options.throughSeq })) {
1389
1459
  fold.apply(entry.record as SessionRecord)
1390
1460
  }
1461
+ return recordedMessages(log, fold)
1462
+ }
1463
+
1464
+ async function recordedMessages(
1465
+ log: SessionLog,
1466
+ fold: SessionMessageFold,
1467
+ ): Promise<RecordedMessage[]> {
1391
1468
  const out: RecordedMessage[] = []
1392
1469
  const spilled = fold.spilledSummary
1393
1470
  if (spilled) {
@@ -1404,9 +1481,10 @@ export async function readFoldedHistory(
1404
1481
  }
1405
1482
  }
1406
1483
  for (const entry of fold.entries()) {
1484
+ // A message from a shared fold is copied: the caller owns what it gets.
1407
1485
  const message = entry.spill
1408
1486
  ? (JSON.parse(await log.readSpill(entry.spill as SpillRef)) as Message)
1409
- : entry.message
1487
+ : structuredClone(entry.message)
1410
1488
  out.push({
1411
1489
  message: withMessageId(message, entry.messageId),
1412
1490
  ...(entry.messageId ? { messageId: entry.messageId } : {}),
@@ -1429,29 +1507,36 @@ export async function readFoldedHistory(
1429
1507
  export async function readEverRecordedMessages(
1430
1508
  log: SessionLog,
1431
1509
  ): Promise<ReadonlyMap<MessageId, Message>> {
1432
- const latest = new Map<MessageId, { readonly content: Message; readonly spill?: SpillRef }>()
1433
- for await (const entry of log.read()) {
1434
- const record = entry.record as SessionRecord
1435
- if (record.type === 'message') {
1436
- latest.set(record.messageId, {
1437
- content: record.content,
1438
- ...(record.spill ? { spill: record.spill } : {}),
1439
- })
1440
- } else if (record.type === 'message_replaced') {
1441
- latest.set(record.targetMessageId, {
1442
- content: record.content,
1443
- ...(record.spill ? { spill: record.spill } : {}),
1444
- })
1445
- }
1446
- }
1447
- const resolved = new Map<MessageId, Message>()
1448
- for (const [id, entry] of latest) {
1449
- const content = entry.spill
1450
- ? (JSON.parse(await log.readSpill(entry.spill)) as Message)
1451
- : entry.content
1452
- resolved.set(id, withMessageId(content, id))
1453
- }
1454
- return resolved
1510
+ return foldSessionLog(log, {
1511
+ name: 'ever-recorded-messages',
1512
+ mode: 'strict',
1513
+ create: () => new Map<MessageId, { readonly content: Message; readonly spill?: SpillRef }>(),
1514
+ apply: (latest, entry) => {
1515
+ const record = entry.record as SessionRecord
1516
+ if (record.type === 'message') {
1517
+ latest.set(record.messageId, {
1518
+ content: record.content,
1519
+ ...(record.spill ? { spill: record.spill } : {}),
1520
+ })
1521
+ } else if (record.type === 'message_replaced') {
1522
+ latest.set(record.targetMessageId, {
1523
+ content: record.content,
1524
+ ...(record.spill ? { spill: record.spill } : {}),
1525
+ })
1526
+ }
1527
+ },
1528
+ result: async (latest) => {
1529
+ const resolved = new Map<MessageId, Message>()
1530
+ for (const [id, entry] of latest) {
1531
+ // Copied: the map this is read from is shared with the next call.
1532
+ const content = entry.spill
1533
+ ? (JSON.parse(await log.readSpill(entry.spill)) as Message)
1534
+ : structuredClone(entry.content)
1535
+ resolved.set(id, withMessageId(content, id))
1536
+ }
1537
+ return resolved
1538
+ },
1539
+ })
1455
1540
  }
1456
1541
 
1457
1542
  /**
@@ -219,7 +219,7 @@
219
219
  "verified": "2026-08-10",
220
220
  "promptIncludesCacheReads": true,
221
221
  "reportsCacheWrites": false,
222
- "note": "Vendor list prices for text models, cached-input rate included. The driver hard-codes cacheWriteTokens to zero, so no write rate is carried. Embedding models are omitted (no output rate, and a chat turn never reaches one), as are models whose cached-input rate was not published alongside the others — an unestablished rate is left out rather than approximated, which is the rule this whole file follows.",
222
+ "note": "Vendor list prices for text models, cached-input rate included. The driver hard-codes cacheWriteTokens to zero, so no write rate is carried. Embedding models are omitted (no output rate, and a chat turn never reaches one), as are models whose cached-input rate was not published alongside the others — an unestablished rate is left out rather than approximated, which is the rule this whole file follows. gpt-6-astra has no row on purpose: the vendor prices it by input length (read 2026-11-11 on its pricing page, $10 in / $1 cached / $50 out up to 272,000 input tokens, $20 / $2 / $75 above), this table holds one rate per model, and either single rate would be wrong for the other half of requests, so its cost reports unknown.",
223
223
  "models": [
224
224
  {
225
225
  "id": "gpt-5.6-sol",
@@ -81,10 +81,12 @@ export const CODING_AGENT_WORKING_DOCTRINE = `## How you work
81
81
  */
82
82
  export const CODING_AGENT_DELEGATION_DOCTRINE = `### Planning and delegating
83
83
  - A task list is optional. For work of three or more distinct steps — several files, several separate stages — you may keep one: exactly one step marked in progress at a time, each marked done when it is done rather than at the end, and the list cleared away once everything is done. Do not make one for a single inspect-edit-test cycle or a two-step job; a list of one or two items tells the user nothing. Keeping a list is not progress on the task itself.
84
- - When the \`Agent\` tool is available, delegate independent work through it and give each delegation a short, specific description; the user watches those descriptions, not the prompts. Brief each sub-agent with four things: the objective; what is out of bounds; which tools and sources to use; and the shape of the reply you want, such as a short summary with a file path for anything long. A fresh sub-agent starts with none of your context and returns what you ask for.
84
+ - When the \`Agent\` tool is available, do small work, or work whose target you already know, yourself: a file you can name, one search, one edit. A fresh sub-agent starts with none of your context. Delegate work that is independent of your next step, large, or whose output would flood your context, and give each delegation a short, specific description; the user watches those descriptions, not the prompts. Brief each sub-agent with four things: the objective; what is out of bounds; which tools and sources to use; and the shape of the reply you want, such as a short summary with a file path for anything long.
85
+ - You keep the understanding. Pass paths, line numbers and what is already ruled out, never a conclusion for the sub-agent to confirm. Once delegated, do not do the work again yourself.
86
+ - A sub-agent's report is a claim, not a fact. Read any record line shown beside it, and check one claim you will build on against the files. Writers that run in parallel get separate worktrees (\`workspace: "worktree"\`, when the checkout is a git repo) or files that do not overlap, or the later write replaces the earlier one.
85
87
  - When the \`Agent\` tool lists a \`fork\` type, use \`subagent_type: "fork"\` when a side task would fill your context with output you will not need again, such as an open-ended survey. A fork starts from this conversation under your own instructions, so its prompt is only the directive: what to do and where its scope ends, without the background. Never write or guess what a fork will find before its report arrives. A fork cannot start forks of its own.
86
88
  - When delegated agents finish, tell the user what each one found in your next message. Their results reach you and not the user, so a result you do not pass on stays unseen.
87
- - Delegate lookups — where something is defined, which files reference it, how a module works — with \`subagent_type: "explore"\`: it has reading and searching tools only and never interrupts the user for permission. Reserve the default sub-agent for work that changes files or runs commands.
89
+ - Use \`subagent_type: "explore"\` to locate something small — where it is defined, which files reference it; it only reads and searches, and never interrupts the user for permission. It is not for reviewing or auditing whole files. Reserve the default sub-agent for work that changes files or runs commands.
88
90
 
89
91
  ### Answering how work is going
90
92
  - When asked how things stand while background work runs, read the note about running work on your request first if the host gives you one, and add one status read from the tool that started an item only when the note does not say enough. The answer needs no waiting or polling and leaves the work running, because stopping or restarting an item to answer would lose what it has done.
@@ -114,7 +116,7 @@ When you have understood the task, reply with the plan: what you would change, i
114
116
  * doctrine did not already name.
115
117
  */
116
118
  export const CODING_AGENT_HYPERMODE_DOCTRINE = `### Hypermode
117
- This session has hypermode on: treat delegation through \`Agent\` as the default for substantive work, not the exception. Before doing multi-step work yourself, ask whether an independent piece of it — a lookup, a draft, a check — could run as its own delegation, and prefer delegating it when the answer is yes. This changes only how eagerly you reach for \`Agent\` on work you would otherwise do inline; it does not mount a roster or start any delegation by itself. Agents in the same phase are launched in the same response, each with \`run_in_background: true\` when you mean to wait for them together; a phase is never started one agent at a time.`
119
+ This session has hypermode on: treat delegation through \`Agent\` as the default for substantive work, not the exception. Before doing multi-step work yourself, ask whether an independent piece of it — a lookup, a draft, a check — could run as its own delegation, and prefer delegating it when the answer is yes. This overrides the advice above to do small work yourself: while hypermode is on, delegate an independent piece even when it is small. It changes only how eagerly you reach for \`Agent\` on work you would otherwise do inline; it does not mount a roster or start any delegation by itself. Agents in the same phase are launched in the same response, each with \`run_in_background: true\` when you mean to wait for them together; a phase is never started one agent at a time.`
118
120
 
119
121
  /**
120
122
  * @deprecated Renamed {@link CODING_AGENT_HYPERMODE_DOCTRINE}; the mode it
@@ -37,6 +37,7 @@ import {
37
37
  assertHostedWebSearchSupported,
38
38
  assertNativeStructuredOutputSupported,
39
39
  } from './capabilities.js'
40
+ import { wasGivenUpOnEarly } from './retry.js'
40
41
 
41
42
  /**
42
43
  * One member of the chain: a constructed provider, and the model to ask it for.
@@ -468,6 +469,7 @@ export function withProviderFallback(
468
469
  }
469
470
 
470
471
  const classified = classifyProviderError(err, member.provider.id)
472
+ const overloadedCount = wasGivenUpOnEarly(err)
471
473
  cursor = next
472
474
  log?.warn('Provider chain: falling over', {
473
475
  'namzu.provider.from': member.provider.id,
@@ -496,7 +498,10 @@ export function withProviderFallback(
496
498
  ...(to.model !== undefined ? { toModel: to.model } : {}),
497
499
  code: classified.code,
498
500
  ...(classified.status !== undefined ? { status: classified.status } : {}),
499
- reason: classified.message,
501
+ reason:
502
+ overloadedCount !== undefined
503
+ ? `Left after ${overloadedCount} overloaded answers in a row: ${classified.message}`
504
+ : classified.message,
500
505
  ...(fragments ? { restart: true } : {}),
501
506
  },
502
507
  }