@sema-agent/core 7.70.0 → 7.71.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 (434) hide show
  1. package/CHANGELOG.md +728 -0
  2. package/dist/agents/agent-transcript-tool.js +43 -19
  3. package/dist/agents/inherited-tool-pool.d.ts +5 -1
  4. package/dist/agents/inherited-tool-pool.js +6 -0
  5. package/dist/agents/retain-ledger.js +2 -0
  6. package/dist/agents/send-message-tool.d.ts +12 -1
  7. package/dist/agents/send-message-tool.js +47 -9
  8. package/dist/agents/subagent.js +31 -10
  9. package/dist/agents/tool-filter.js +1 -2
  10. package/dist/agents/verify.js +13 -2
  11. package/dist/agents/yield-adoption.js +11 -1
  12. package/dist/brain/claude-model-id.d.ts +11 -0
  13. package/dist/brain/claude-model-id.js +3 -1
  14. package/dist/config/catalog.js +10 -1
  15. package/dist/config/defaults.d.ts +3 -0
  16. package/dist/config/defaults.js +1 -0
  17. package/dist/core/allow-entry.js +1 -2
  18. package/dist/core/ask-origin.d.ts +55 -21
  19. package/dist/core/ask-origin.js +19 -11
  20. package/dist/core/ask-question.d.ts +4 -7
  21. package/dist/core/ask-question.js +2 -4
  22. package/dist/core/ask-unresolvable-notice.d.ts +17 -3
  23. package/dist/core/ask-unresolvable-notice.js +18 -4
  24. package/dist/core/attachment-source.d.ts +1 -1
  25. package/dist/core/attachment-source.js +2 -0
  26. package/dist/core/auto-compaction.d.ts +14 -4
  27. package/dist/core/auto-compaction.js +3 -2
  28. package/dist/core/auto-strip.js +2 -0
  29. package/dist/core/caller-text.d.ts +2 -33
  30. package/dist/core/caller-text.js +2 -23
  31. package/dist/core/caller-tool-name.js +1 -2
  32. package/dist/core/canonical-json.d.ts +9 -0
  33. package/dist/core/canonical-json.js +6 -0
  34. package/dist/core/checkpoint-features.d.ts +43 -80
  35. package/dist/core/checkpoint-features.js +10 -20
  36. package/dist/core/checkpoint-generation.d.ts +89 -19
  37. package/dist/core/checkpoint-generation.js +89 -14
  38. package/dist/core/checkpoint-queries.d.ts +95 -15
  39. package/dist/core/checkpoint-queries.js +108 -7
  40. package/dist/core/checkpoint-rekey.d.ts +2 -1
  41. package/dist/core/checkpoint-rekey.js +2 -2
  42. package/dist/core/checkpoint-requirements.d.ts +7 -6
  43. package/dist/core/checkpoint-requirements.js +2 -5
  44. package/dist/core/checkpoint-row-verdict.d.ts +3 -4
  45. package/dist/core/checkpoint-row-verdict.js +20 -41
  46. package/dist/core/checkpoint-store.d.ts +65 -41
  47. package/dist/core/checkpoint-store.js +28 -14
  48. package/dist/core/command-sandbox.d.ts +5 -3
  49. package/dist/core/command-sandbox.js +17 -9
  50. package/dist/core/config-refusal-codes.d.ts +1 -1
  51. package/dist/core/config-refusal-codes.js +1 -0
  52. package/dist/core/declaration-words.d.ts +2 -1
  53. package/dist/core/declaration-words.js +13 -2
  54. package/dist/core/effective-path-target.d.ts +23 -0
  55. package/dist/core/effective-path-target.js +15 -1
  56. package/dist/core/engine-attestation.d.ts +5 -1
  57. package/dist/core/engine-attestation.js +1 -0
  58. package/dist/core/engine-capabilities.d.ts +14 -9
  59. package/dist/core/engine-capabilities.js +1 -1
  60. package/dist/core/engine-notice.d.ts +62 -32
  61. package/dist/core/engine-version.js +1 -1
  62. package/dist/core/entries-not-applied.d.ts +1 -1
  63. package/dist/core/entries-not-applied.js +1 -0
  64. package/dist/core/file-history-store.d.ts +95 -11
  65. package/dist/core/file-history-store.js +117 -19
  66. package/dist/core/gate-fold.js +13 -7
  67. package/dist/core/gate-lanes.js +9 -9
  68. package/dist/core/governance-codes.d.ts +56 -7
  69. package/dist/core/governance-codes.js +105 -7
  70. package/dist/core/grant-holder.d.ts +53 -0
  71. package/dist/core/grant-holder.js +80 -0
  72. package/dist/core/hooks.d.ts +7 -3
  73. package/dist/core/hooks.js +2 -2
  74. package/dist/core/locked-config.d.ts +7 -1
  75. package/dist/core/locked-config.js +9 -2
  76. package/dist/core/mcp-call-meta.d.ts +52 -7
  77. package/dist/core/mcp-call-meta.js +21 -2
  78. package/dist/core/mcp-host-read.d.ts +1 -1
  79. package/dist/core/mcp-server-spec.d.ts +18 -0
  80. package/dist/core/mcp-server-spec.js +1 -0
  81. package/dist/core/mcp.js +2 -2
  82. package/dist/core/member-outcome.d.ts +22 -1
  83. package/dist/core/member-outcome.js +18 -6
  84. package/dist/core/memory-engine/delegation-settlement.js +5 -5
  85. package/dist/core/memory-engine/engine.js +19 -19
  86. package/dist/core/memory-engine/file-backend.d.ts +7 -2
  87. package/dist/core/memory-engine/file-backend.js +14 -12
  88. package/dist/core/memory-engine/frontmatter.js +1 -1
  89. package/dist/core/memory-engine/index.d.ts +1 -0
  90. package/dist/core/memory-engine/index.js +1 -0
  91. package/dist/core/memory-engine/layout.d.ts +34 -9
  92. package/dist/core/memory-engine/layout.js +36 -19
  93. package/dist/core/memory-engine/memory-deployment.js +8 -8
  94. package/dist/core/memory-engine/mount-failed-notice.d.ts +8 -5
  95. package/dist/core/memory-engine/mount-failed-notice.js +5 -2
  96. package/dist/core/mode-policy.d.ts +5 -0
  97. package/dist/core/mode-policy.js +6 -0
  98. package/dist/core/mods/host.d.ts +2 -1
  99. package/dist/core/mods/host.js +7 -6
  100. package/dist/core/mods/kernel/index.d.ts +1 -1
  101. package/dist/core/mods/kernel/index.js +1 -1
  102. package/dist/core/mods/kernel/registration.d.ts +5 -2
  103. package/dist/core/mods/kernel/registration.js +19 -3
  104. package/dist/core/mods/package.d.ts +12 -1
  105. package/dist/core/mods/package.js +36 -9
  106. package/dist/core/mods/stations.d.ts +7 -1
  107. package/dist/core/mods/stations.js +17 -3
  108. package/dist/core/mods/teammate-stations.d.ts +4 -1
  109. package/dist/core/mods/teammate-stations.js +1 -1
  110. package/dist/core/native-signal.d.ts +13 -0
  111. package/dist/core/native-signal.js +18 -0
  112. package/dist/core/park-resumability.d.ts +16 -14
  113. package/dist/core/park-resumability.js +9 -4
  114. package/dist/core/path-rule-binding.js +1 -1
  115. package/dist/core/permission-rule-model.d.ts +11 -5
  116. package/dist/core/permission-rule-model.js +5 -3
  117. package/dist/core/permission-rule-org.js +1 -1
  118. package/dist/core/permission-rule-provider.d.ts +5 -1
  119. package/dist/core/permission-rule-provider.js +6 -1
  120. package/dist/core/permission-rule-session.d.ts +35 -5
  121. package/dist/core/permission-rule-session.js +32 -1
  122. package/dist/core/permission-rule-store.d.ts +5 -1
  123. package/dist/core/permission-rule-store.js +28 -5
  124. package/dist/core/permission-rules.d.ts +2 -2
  125. package/dist/core/permission-rules.js +2 -3
  126. package/dist/core/principal-name.d.ts +12 -0
  127. package/dist/core/principal-name.js +6 -2
  128. package/dist/core/read-root-grant-screen.d.ts +7 -6
  129. package/dist/core/read-root-grant-screen.js +7 -8
  130. package/dist/core/remote-env.d.ts +42 -8
  131. package/dist/core/resume-config-judge.js +1 -1
  132. package/dist/core/resume-startup-cause.d.ts +19 -4
  133. package/dist/core/resume-startup-cause.js +25 -6
  134. package/dist/core/rewind-conversation.d.ts +4 -0
  135. package/dist/core/rewrite-rejudge.d.ts +9 -1
  136. package/dist/core/rewrite-rejudge.js +11 -1
  137. package/dist/core/rule-offer-read.js +3 -2
  138. package/dist/core/runner/assemble-result.d.ts +21 -11
  139. package/dist/core/runner/assemble-result.js +24 -4
  140. package/dist/core/runner/boundary-reminders.d.ts +104 -0
  141. package/dist/core/runner/boundary-reminders.js +108 -0
  142. package/dist/core/runner/branch-writeback.d.ts +21 -7
  143. package/dist/core/runner/branch-writeback.js +44 -6
  144. package/dist/core/runner/command-sandbox-frame.js +2 -1
  145. package/dist/core/runner/compact-session.js +11 -4
  146. package/dist/core/runner/constraint-layers.d.ts +24 -5
  147. package/dist/core/runner/constraint-layers.js +21 -2
  148. package/dist/core/runner/continuation-gate.js +3 -1
  149. package/dist/core/runner/contracts.d.ts +83 -13
  150. package/dist/core/runner/cross-boundary-lane.js +2 -1
  151. package/dist/core/runner/delegation-owner.d.ts +246 -45
  152. package/dist/core/runner/delegation-owner.js +237 -63
  153. package/dist/core/runner/expire-settle.d.ts +17 -0
  154. package/dist/core/runner/expire-settle.js +8 -2
  155. package/dist/core/runner/file-history-request.d.ts +4 -3
  156. package/dist/core/runner/file-history-request.js +4 -1
  157. package/dist/core/runner/file-history-restore.d.ts +11 -3
  158. package/dist/core/runner/file-history-restore.js +11 -3
  159. package/dist/core/runner/gate-exit.d.ts +22 -1
  160. package/dist/core/runner/gate-exit.js +12 -14
  161. package/dist/core/runner/nested-memory-content.js +1 -1
  162. package/dist/core/runner/nested-memory-lane.d.ts +10 -2
  163. package/dist/core/runner/nested-memory-lane.js +29 -8
  164. package/dist/core/runner/own-model-money-door.d.ts +13 -0
  165. package/dist/core/runner/own-model-money-door.js +17 -0
  166. package/dist/core/runner/park-commit.d.ts +4 -2
  167. package/dist/core/runner/park-commit.js +2 -1
  168. package/dist/core/runner/permission-rule-lanes.d.ts +4 -0
  169. package/dist/core/runner/permission-rule-lanes.js +7 -0
  170. package/dist/core/runner/person-path-rows.js +1 -1
  171. package/dist/core/runner/placement-fence.d.ts +8 -2
  172. package/dist/core/runner/placement-fence.js +8 -3
  173. package/dist/core/runner/policy-throw.d.ts +3 -2
  174. package/dist/core/runner/policy-throw.js +2 -2
  175. package/dist/core/runner/prepare-acquire-reconcile.d.ts +23 -14
  176. package/dist/core/runner/prepare-acquire-reconcile.js +33 -15
  177. package/dist/core/runner/prepare-artifact.d.ts +14 -1
  178. package/dist/core/runner/prepare-artifact.js +7 -2
  179. package/dist/core/runner/prepare-ask-lane.d.ts +8 -0
  180. package/dist/core/runner/prepare-ask-lane.js +14 -5
  181. package/dist/core/runner/prepare-boundary-parks.js +5 -4
  182. package/dist/core/runner/prepare-config-doors.d.ts +9 -4
  183. package/dist/core/runner/prepare-config-doors.js +25 -8
  184. package/dist/core/runner/prepare-defer-classify.d.ts +8 -4
  185. package/dist/core/runner/prepare-defer-classify.js +6 -6
  186. package/dist/core/runner/prepare-execution-env.d.ts +4 -1
  187. package/dist/core/runner/prepare-execution-env.js +8 -3
  188. package/dist/core/runner/prepare-file-history.d.ts +26 -0
  189. package/dist/core/runner/prepare-file-history.js +15 -1
  190. package/dist/core/runner/prepare-inherited-gate.d.ts +8 -3
  191. package/dist/core/runner/prepare-inherited-gate.js +9 -2
  192. package/dist/core/runner/prepare-leg-adoption.d.ts +2 -2
  193. package/dist/core/runner/prepare-park-ask.js +8 -5
  194. package/dist/core/runner/prepare-policy-chain.d.ts +5 -0
  195. package/dist/core/runner/prepare-policy-chain.js +18 -7
  196. package/dist/core/runner/prepare-prompt-assembly.d.ts +3 -0
  197. package/dist/core/runner/prepare-prompt-assembly.js +4 -3
  198. package/dist/core/runner/prepare-suspend-saga.d.ts +4 -1
  199. package/dist/core/runner/prepare-suspend-saga.js +19 -5
  200. package/dist/core/runner/prepare-task.d.ts +2 -5
  201. package/dist/core/runner/prepare-task.js +71 -26
  202. package/dist/core/runner/prepare-turn-wiring.js +7 -5
  203. package/dist/core/runner/prepare-workspace-restore.js +59 -28
  204. package/dist/core/runner/read-root-grant.d.ts +1 -0
  205. package/dist/core/runner/read-root-grant.js +1 -2
  206. package/dist/core/runner/resume-admission.d.ts +3 -0
  207. package/dist/core/runner/resume-admission.js +6 -4
  208. package/dist/core/runner/resume-apply.js +7 -5
  209. package/dist/core/runner/resume-claim.d.ts +2 -2
  210. package/dist/core/runner/resume-claim.js +4 -4
  211. package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
  212. package/dist/core/runner/resume-policy-outcome.js +6 -4
  213. package/dist/core/runner/resume-preflight.d.ts +3 -0
  214. package/dist/core/runner/resume-preflight.js +10 -3
  215. package/dist/core/runner/rewind-conversation.js +11 -4
  216. package/dist/core/runner/rewind-files.js +29 -14
  217. package/dist/core/runner/rewind-outcome.d.ts +27 -0
  218. package/dist/core/runner/rewind-outcome.js +14 -0
  219. package/dist/core/runner/run-attachment-seats.js +2 -1
  220. package/dist/core/runner/run-clock-and-content.js +2 -0
  221. package/dist/core/runner/run-identity-wiring.js +2 -0
  222. package/dist/core/runner/run-leg.js +11 -1
  223. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  224. package/dist/core/runner/run-notification-lane.js +2 -2
  225. package/dist/core/runner/run-settle-and-teardown.d.ts +4 -2
  226. package/dist/core/runner/run-settle-and-teardown.js +52 -40
  227. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  228. package/dist/core/runner/run-stop-and-final-verify.js +5 -4
  229. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  230. package/dist/core/runner/run-terminal-adoption.js +3 -3
  231. package/dist/core/runner/run-turn-boundary.js +7 -0
  232. package/dist/core/runner/runtask.d.ts +7 -4
  233. package/dist/core/runner/runtask.js +18 -9
  234. package/dist/core/runner/session-call-grant-station.d.ts +64 -0
  235. package/dist/core/runner/session-call-grant-station.js +119 -0
  236. package/dist/core/runner/session-file-state-replay.js +2 -2
  237. package/dist/core/runner/session-prompt-seats.d.ts +95 -0
  238. package/dist/core/runner/session-prompt-seats.js +62 -0
  239. package/dist/core/runner/session-rule-policy.js +1 -1
  240. package/dist/core/runner/session-write-ledger.d.ts +8 -0
  241. package/dist/core/runner/session-write-ledger.js +16 -0
  242. package/dist/core/runner/side-call-account.js +5 -1
  243. package/dist/core/runner/stop-tail-notice.d.ts +7 -0
  244. package/dist/core/runner/stop-tail-notice.js +23 -8
  245. package/dist/core/runner/stream-reap.js +4 -2
  246. package/dist/core/runner/stream-settle-backstop.d.ts +1 -1
  247. package/dist/core/runner/stream-settle-backstop.js +17 -18
  248. package/dist/core/runner/terminal-account.js +17 -8
  249. package/dist/core/runner/terminal-projection.d.ts +3 -2
  250. package/dist/core/runner/terminal-projection.js +1 -1
  251. package/dist/core/runner/tool-turn-repair-seat.d.ts +2 -2
  252. package/dist/core/runner/tool-turn-repair-seat.js +12 -7
  253. package/dist/core/runner/turn-attachments.d.ts +22 -1
  254. package/dist/core/runner/turn-attachments.js +20 -3
  255. package/dist/core/runner-deps.d.ts +6 -2
  256. package/dist/core/secret-env.d.ts +26 -6
  257. package/dist/core/secret-env.js +6 -6
  258. package/dist/core/session-call-grant-screen.d.ts +58 -0
  259. package/dist/core/session-call-grant-screen.js +18 -0
  260. package/dist/core/session-call-grant.d.ts +93 -0
  261. package/dist/core/session-call-grant.js +524 -0
  262. package/dist/core/session-checkout.d.ts +3 -0
  263. package/dist/core/session-checkout.js +8 -3
  264. package/dist/core/session-policy-store.d.ts +14 -0
  265. package/dist/core/session-policy-store.js +16 -2
  266. package/dist/core/session-store.d.ts +18 -1
  267. package/dist/core/session-store.js +20 -4
  268. package/dist/core/session.d.ts +36 -4
  269. package/dist/core/shared-artifact-reads.d.ts +93 -0
  270. package/dist/core/shared-artifact-reads.js +94 -0
  271. package/dist/core/skill-grant.js +1 -1
  272. package/dist/core/skills-directory.d.ts +9 -45
  273. package/dist/core/skills-directory.js +9 -722
  274. package/dist/core/spend-account.js +3 -0
  275. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +22 -4
  276. package/dist/core/store-contracts/checkpoint-store-contract.js +363 -29
  277. package/dist/core/store-contracts/file-history-store-contract.d.ts +11 -3
  278. package/dist/core/store-contracts/file-history-store-contract.js +62 -2
  279. package/dist/core/store-contracts/grant-fixture.d.ts +52 -0
  280. package/dist/core/store-contracts/grant-fixture.js +84 -0
  281. package/dist/core/store-contracts/session-repo-contract.js +18 -0
  282. package/dist/core/store-contracts/session-store-contract.d.ts +15 -1
  283. package/dist/core/store-contracts/session-store-contract.js +211 -2
  284. package/dist/core/store-contracts/workflow-journal-store-contract.js +47 -8
  285. package/dist/core/suspend-lane-reasons.d.ts +13 -0
  286. package/dist/core/suspend-lane-reasons.js +5 -0
  287. package/dist/core/synthetic-read-verdict.d.ts +5 -3
  288. package/dist/core/synthetic-read-verdict.js +1 -1
  289. package/dist/core/task-limits.d.ts +15 -0
  290. package/dist/core/task-notification.d.ts +33 -7
  291. package/dist/core/task-notification.js +34 -9
  292. package/dist/core/task-registry-agent.d.ts +1 -1
  293. package/dist/core/task-registry-agent.js +18 -7
  294. package/dist/core/task-registry-shared.d.ts +29 -4
  295. package/dist/core/task-registry-shared.js +7 -0
  296. package/dist/core/task-registry.d.ts +21 -1
  297. package/dist/core/task-registry.js +36 -9
  298. package/dist/core/task-result.d.ts +55 -1
  299. package/dist/core/task-spec.d.ts +17 -3
  300. package/dist/core/terminal-cause.d.ts +68 -5
  301. package/dist/core/tool-catalog-entries.js +1 -1
  302. package/dist/core/tool-check-reading.js +2 -1
  303. package/dist/core/tool-errors.js +1 -0
  304. package/dist/core/tool-list-grammar.d.ts +0 -47
  305. package/dist/core/tool-list-grammar.js +1 -75
  306. package/dist/core/tool-model-gate.d.ts +7 -11
  307. package/dist/core/tool-model-gate.js +5 -8
  308. package/dist/core/tool-name-aliases.js +2 -3
  309. package/dist/core/tool-name-readings.d.ts +4 -0
  310. package/dist/core/tool-name-readings.js +1 -0
  311. package/dist/core/tool-policy.d.ts +46 -4
  312. package/dist/core/tool-policy.js +47 -18
  313. package/dist/core/tool-result-store.d.ts +0 -24
  314. package/dist/core/tool-result-store.js +1 -36
  315. package/dist/core/tool-spec.d.ts +8 -4
  316. package/dist/core/untrusted-egress.js +2 -2
  317. package/dist/core/untrusted-text.d.ts +8 -0
  318. package/dist/core/untrusted-text.js +14 -0
  319. package/dist/core/user-attachment.d.ts +16 -1
  320. package/dist/core/user-attachment.js +42 -18
  321. package/dist/core/wiring-manifest.d.ts +4 -9
  322. package/dist/core/wiring-manifest.js +1 -1
  323. package/dist/core/workflow-journal-store.d.ts +55 -8
  324. package/dist/core/workflow-journal-store.js +34 -10
  325. package/dist/core/workflow-run-store-contract.js +56 -1
  326. package/dist/core/workflow-run-store.d.ts +43 -19
  327. package/dist/core/workflow-run-store.js +17 -2
  328. package/dist/engine/execution-env/node-execution-env.d.ts +3 -0
  329. package/dist/engine/execution-env/node-execution-env.js +4 -0
  330. package/dist/engine/harness/agent-harness.d.ts +10 -5
  331. package/dist/engine/harness/agent-harness.js +12 -4
  332. package/dist/engine/harness/types.d.ts +18 -0
  333. package/dist/engine/llm/tool-turns.d.ts +1 -1
  334. package/dist/engine/llm/types.d.ts +5 -4
  335. package/dist/engine/session/memory-repo.d.ts +15 -3
  336. package/dist/engine/session/memory-repo.js +21 -3
  337. package/dist/engine/session/memory-storage.d.ts +5 -0
  338. package/dist/engine/session/memory-storage.js +8 -3
  339. package/dist/engine/session/repo-utils.d.ts +9 -0
  340. package/dist/engine/session/repo-utils.js +14 -0
  341. package/dist/engine/session/storage-base.d.ts +20 -7
  342. package/dist/engine/session/storage-base.js +13 -1
  343. package/dist/index.d.ts +37 -19
  344. package/dist/index.js +30 -15
  345. package/dist/internal/harness.d.ts +1 -1
  346. package/dist/internal/harness.js +1 -1
  347. package/dist/orchestration/run-workflow-tool.d.ts +13 -1
  348. package/dist/orchestration/run-workflow-tool.js +101 -32
  349. package/dist/orchestration/workflow-park-adoption.d.ts +309 -92
  350. package/dist/orchestration/workflow-park-adoption.js +588 -323
  351. package/dist/orchestration/workflow-tree-id.d.ts +66 -0
  352. package/dist/orchestration/workflow-tree-id.js +66 -0
  353. package/dist/orchestration/workflow-types.d.ts +90 -11
  354. package/dist/orchestration/workflow-types.js +10 -1
  355. package/dist/orchestration/workflow.d.ts +30 -4
  356. package/dist/orchestration/workflow.js +424 -114
  357. package/dist/prompt-assembly/catalog/constitution.js +5 -1
  358. package/dist/prompt-assembly/catalog/core-behavior.d.ts +3 -4
  359. package/dist/prompt-assembly/catalog/core-behavior.js +61 -22
  360. package/dist/prompt-assembly/catalog/environment.js +2 -2
  361. package/dist/prompt-assembly/catalog/events.d.ts +16 -0
  362. package/dist/prompt-assembly/catalog/events.js +2 -0
  363. package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +72 -44
  364. package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.js +2 -2
  365. package/dist/prompt-assembly/catalog/locales/zh-Hans/events.js +2 -0
  366. package/dist/prompt-assembly/catalog/schema.d.ts +5 -1
  367. package/dist/prompt-assembly/catalog/schema.js +2 -0
  368. package/dist/prompt-assembly/catalog/sections.js +3 -14
  369. package/dist/prompt-assembly/event-registry.js +2 -0
  370. package/dist/prompt-assembly/select.js +1 -0
  371. package/dist/prompt-assembly/tool-catalog.d.ts +10 -7
  372. package/dist/prompt-assembly/tool-catalog.js +21 -7
  373. package/dist/prompt-assembly/types.d.ts +3 -0
  374. package/dist/prompts/default.d.ts +4 -1
  375. package/dist/prompts/default.js +6 -0
  376. package/dist/stores/file/checkpoint-store.d.ts +11 -10
  377. package/dist/stores/file/checkpoint-store.js +36 -10
  378. package/dist/stores/file/file-history-store.d.ts +6 -0
  379. package/dist/stores/file/file-history-store.js +21 -4
  380. package/dist/stores/file/fs-atomic.d.ts +1 -1
  381. package/dist/stores/file/index.d.ts +14 -4
  382. package/dist/stores/file/index.js +21 -5
  383. package/dist/stores/file/process-anchor.d.ts +9 -1
  384. package/dist/stores/file/session-policy-store.js +2 -17
  385. package/dist/stores/file/session-store.d.ts +27 -0
  386. package/dist/stores/file/session-store.js +81 -9
  387. package/dist/stores/file/workflow-journal-store.d.ts +14 -4
  388. package/dist/stores/file/workflow-journal-store.js +32 -24
  389. package/dist/stores/file/workflow-run-store.d.ts +15 -4
  390. package/dist/stores/file/workflow-run-store.js +76 -0
  391. package/dist/tools/artifact/artifact-tool.d.ts +10 -3
  392. package/dist/tools/artifact/artifact-tool.js +16 -1
  393. package/dist/tools/fs/bash-program-position.d.ts +10 -4
  394. package/dist/tools/fs/bash-program-position.js +11 -8
  395. package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -1
  396. package/dist/tools/fs/bash-readonly-classifier.js +9 -2
  397. package/dist/tools/fs/find-actions.d.ts +30 -16
  398. package/dist/tools/fs/find-actions.js +272 -19
  399. package/dist/tools/fs/fs-bash.js +8 -5
  400. package/dist/tools/fs/fs-shared.d.ts +0 -29
  401. package/dist/tools/fs/fs-shared.js +0 -5
  402. package/dist/tools/fs/fs-write.js +2 -1
  403. package/dist/tools/fs/read-deny.d.ts +6 -1
  404. package/dist/tools/fs/read-deny.js +6 -1
  405. package/dist/tools/fs/read-floor.d.ts +6 -0
  406. package/dist/tools/fs/read-floor.js +5 -1
  407. package/dist/tools/fs/removal-actions.d.ts +43 -0
  408. package/dist/tools/fs/removal-actions.js +25 -0
  409. package/dist/tools/fs/removal-targets.d.ts +2 -21
  410. package/dist/tools/fs/removal-targets.js +2 -3
  411. package/dist/tools/fs/safety.d.ts +37 -1
  412. package/dist/tools/fs/safety.js +52 -0
  413. package/dist/tools/fs/shell-climb.d.ts +46 -0
  414. package/dist/tools/fs/shell-climb.js +79 -0
  415. package/dist/tools/fs/shell-read-check.js +47 -19
  416. package/dist/tools/fs/shell-read-establish.js +36 -22
  417. package/dist/tools/fs/shell-read-judge.d.ts +10 -2
  418. package/dist/tools/fs/shell-read-judge.js +4 -4
  419. package/dist/tools/fs/shell-read-plan.d.ts +3 -0
  420. package/dist/tools/fs/shell-read-plan.js +1 -1
  421. package/dist/tools/fs/shell-read-workdir.js +3 -2
  422. package/dist/tools/fs/shell-read-write-targets.d.ts +4 -3
  423. package/dist/tools/fs/shell-read-write-targets.js +3 -0
  424. package/package.json +2 -2
  425. package/test/export-surface.snapshot.json +169 -15
  426. package/wire-changes/core-stores-sql@7.71.0.json +40 -0
  427. package/wire-changes/core@7.71.0.json +5827 -0
  428. package/wire-changes/mods-kernel@7.71.0.json +52 -0
  429. package/wire-changes/primitives@7.71.0.json +473 -0
  430. package/wire-changes/wiki-gate@7.71.0.json +40 -0
  431. package/dist/core/frontmatter-fence.d.ts +0 -10
  432. package/dist/core/frontmatter-fence.js +0 -6
  433. package/dist/core/permission-rule-syntax.d.ts +0 -46
  434. package/dist/core/permission-rule-syntax.js +0 -52
@@ -13,9 +13,26 @@ export type WorkflowJournalEntry = {
13
13
  /** The agent's TaskResult, replayed verbatim when a resume's call key matches at the same ordinal. */
14
14
  result: TaskResult;
15
15
  parked?: never;
16
+ stopped?: never;
16
17
  } | {
17
18
  callKey: string;
18
19
  result?: never;
20
+ parked?: never;
21
+ /**
22
+ * #4760 — the ordinal's member was STOPPED by a stop of the member itself (the run's `stopAgent`, a stream handle's `stop`):
23
+ * the leg's result as it ended, and who stopped it. A resume reaching this ordinal with a matching call key replays it as
24
+ * stopped (`killed`, by that stopper — the script gets the same value back) and never runs it again. A different key from
25
+ * `result` for the reason `parked` is one: a reader from before this arm finds neither key it reads and refuses the whole
26
+ * resume (`WorkflowJournalIncompatibleError`) instead of running the stopped member again.
27
+ */
28
+ stopped: {
29
+ readonly result: TaskResult;
30
+ readonly stoppedBy: string;
31
+ };
32
+ } | {
33
+ callKey: string;
34
+ result?: never;
35
+ stopped?: never;
19
36
  /**
20
37
  * The ordinal's leg is PARKED at a durable approval gate: the child's own paused `TaskResult`
21
38
  * (its `terminal` carries the checkpoint token + gate, its `sessionId` the pinned session). A resume
@@ -149,7 +166,22 @@ export declare function readLaunchRecordVerdict(raw: unknown): {
149
166
  * what a writer reads a record through before it keeps it, and what it keeps and compares a second write against
150
167
  * ({@link sameLaunchRecord}). A reader of a KEPT record does not fold a defect into absence: it throws {@link WorkflowLaunchUnreadableError}. */
151
168
  export declare function readWorkflowLaunchRecord(raw: unknown): WorkflowLaunchRecord | undefined;
152
- /** {@link readWorkflowLaunchRecord} at a store's write door: the record to keep, or the refusal that names why there is none to keep. */
169
+ /**
170
+ * {@link readWorkflowLaunchRecord} at a store's write door — the one reading every `recordLaunch` applies before it keeps or compares a record
171
+ * (both bundled stores read the record they are handed through it): the record to keep (its STORAGE form, as {@link readWorkflowLaunchRecord}
172
+ * answers), or a refusal.
173
+ *
174
+ * Throws an `Error` (no subclass, no `code`) whose message is `workflow journal: the launch record for <runId> is not one to keep — <why>`, where
175
+ * `<why>` names the member and, for a payload, the place and the kind of fault, never a value: `it is not a record` (the value is no record);
176
+ * `its effectiveArgs hold <fault> at effectiveArgs.<path>` (the same for `callArgs`; the place is `effectiveArgs` alone for a fault of the payload's own top
177
+ * level, and absent for containers nested deeper than the bound) — a payload value the store's JSON form cannot keep as it is: a number
178
+ * that is not finite, a hole or an undefined element in a list, a named member on a list, one object met twice (a shared reference), a `Date`, a
179
+ * function, a getter or any other object that is not plain data, or containers nested too deep — followed by the clause
180
+ * `— a value a store's JSON form cannot keep as it is`; or `its <member> is not the shape a launch record's is` (the script, the call arguments, the host or the face is
181
+ * not what a record carries; `<member>` is the first defective member, as {@link WorkflowLaunchUnreadableError.member} names one). `runId` is
182
+ * only said in the sentence. A store twin that writes the same record form calls this and lets what it throws through, so the refusal reads the same
183
+ * on every backend.
184
+ */
153
185
  export declare function launchRecordToKeepOrThrow(runId: string, raw: unknown): WorkflowLaunchRecord;
154
186
  /** The `code` of {@link WorkflowLaunchUnreadableError}. */
155
187
  export declare const WORKFLOW_LAUNCH_UNREADABLE_CODE = "workflow.launch_unreadable";
@@ -231,14 +263,27 @@ export interface ResumeClaimArgs {
231
263
  newRunId: string;
232
264
  scope: string;
233
265
  }
266
+ /** The longest remaining time a resume claim's answer can name: 24 hours, in milliseconds. */
267
+ export declare const RESUME_CLAIM_REMAINING_MS_MAX: number;
268
+ /** What a claim expiring at `expiresAt` has left at `now` (one clock), as the answer's member says it — `{ remainingMs }`, the whole
269
+ * millisecond up — or no member where no answer can say it: nothing left, or more than {@link RESUME_CLAIM_REMAINING_MS_MAX} (a clock
270
+ * stepped back past a day). The bundled stores' one reckoning. */
271
+ export declare function resumeClaimRemainingMember(expiresAt: number, now: number): {
272
+ remainingMs?: number;
273
+ };
234
274
  /** What {@link WorkflowJournalStore.resumeClaim} answers — ONE shape for the interface and every implementation. */
235
275
  export interface ResumeClaimAnswer {
236
276
  granted: boolean;
237
277
  /** On a refusal: the run id the claim is held for, when the store can attribute it. */
238
278
  holder?: string;
239
- /** On a refusal: when the store's expiry frees the claim (epoch ms) if its holder never gives it back — the latest instant
240
- * the refusal can stand. Answered only when the store can say; the engine names it in the refusal and never guesses one. */
241
- expiresAt?: number;
279
+ /** How long the claim has left before the store's expiry frees it (if its holder never gives it back), in milliseconds by the
280
+ * STORE'S OWN clock: a safe integer from 1 to {@link RESUME_CLAIM_REMAINING_MS_MAX}, on a grant (the time the caller now holds)
281
+ * and on a refusal (the latest the refusal can stand). Answered only when the store can say. A remaining time, never an
282
+ * instant: no reader compares it with another machine's clock. The engine reads it on a refusal only, once, as it arrives —
283
+ * this machine's clock plus the remaining time, the latest instant the refusal names — and a refusal answering one that does
284
+ * not read (0 or less: refused while expired is a contradiction; not a safe integer; over the bound) names no instant and
285
+ * says the store's answer does not read. */
286
+ remainingMs?: number;
242
287
  }
243
288
  /**
244
289
  * The seam a resume reads/writes its journal through. Core ships {@link InMemoryWorkflowJournalStore}; a durable
@@ -344,8 +389,9 @@ export interface WorkflowJournalStore {
344
389
  * - `granted: false` ⇒ someone else holds it. The engine REFUSES the resume with an explicit error rather
345
390
  * than forking; `holder` (the holding leg's `newRunId`, when the store can attribute it) goes into that
346
391
  * error text so an operator can find the run that is actually still going. `holder` is store-supplied text
347
- * and is charset-clamped before it lands in a message. `expiresAt` (when the store can say) is when its expiry frees
348
- * the claim: the refusal names it as the latest moment the same resume goes through, for a holder that died holding it.
392
+ * and is charset-clamped before it lands in a message. `remainingMs` (when the store can say) is how long its expiry
393
+ * leaves the claim standing, by the store's clock: the refusal names this machine's clock plus it as the latest moment the
394
+ * same resume goes through, for a holder that died holding it.
349
395
  * - IDEMPOTENT for the same holder: a re-claim by the SAME `newRunId` on a claim it already holds MUST be
350
396
  * granted (a retry must not deadlock a run against itself).
351
397
  * - `scope` is the journal scope passed through VERBATIM. A claim is keyed by `(sourceRunId, scope)`,
@@ -450,7 +496,7 @@ export declare function assertJournalEntryFits(entry: WorkflowJournalEntry): voi
450
496
  * oversize payload); keeps taskId/sessionId/stats so the journal read-face still shows the session handle
451
497
  * and the paid spend, and the leg's `continuesFrom` — where that leg left its session is a fact about the leg, not
452
498
  * about the size of its payload. Its own serialization is a few hundred bytes — always under the cap (pinned). */
453
- export declare function journalOversizeTombstone(result: TaskResult, bytes: number): TaskResult;
499
+ export declare function journalOversizeTombstone(result: TaskResult, bytes: number, replay?: "rerun" | "stopped"): TaskResult;
454
500
  /**
455
501
  * The TTL a resume claim {@link
456
502
  * InMemoryWorkflowJournalStore} grants survives WITHOUT an engine release: the backstop for an engine that
@@ -487,7 +533,8 @@ export declare class InMemoryWorkflowJournalStore implements WorkflowJournalStor
487
533
  * SAME holder; an unexpired claim held by someone else refuses (naming the holder); an expired or absent
488
534
  * claim is free to take. Acquisition is a single synchronous Map read-then-write with no `await` between
489
535
  * the check and the publish — there is no window (matching the atomicity RB-354 requires of a durable
490
- * implementation) in which a concurrent caller could observe the key as free mid-acquire. */
536
+ * implementation) in which a concurrent caller could observe the key as free mid-acquire. Both answers say how long the
537
+ * claim has left by this process's clock (a re-claim by its holder starts the lease again). */
491
538
  resumeClaim(input: ResumeClaimArgs): Promise<ResumeClaimAnswer>;
492
539
  /** Release ONLY a claim `newRunId` still holds (a missing/foreign/already-taken-over claim is a
493
540
  * no-op, never an error — matches the file store's contract). */
@@ -14,10 +14,27 @@ export function readWorkflowJournalEntry(raw) {
14
14
  return { corrupt: "wrong-type", why: "has a call key that is not a string" };
15
15
  const result = ownMember(raw, "result");
16
16
  const parked = ownMember(raw, "parked");
17
- if (result === undefined && parked === undefined)
18
- return { corrupt: "missing-required", why: "carries neither a result nor a parked arm" };
19
- if (result !== undefined && parked !== undefined)
20
- return { corrupt: "wrong-type", why: "carries both a result and a parked arm" };
17
+ const stopped = ownMember(raw, "stopped");
18
+ const arms = [
19
+ ["a result", result],
20
+ ["a parked arm", parked],
21
+ ["a stopped arm", stopped],
22
+ ].filter(([, a]) => a !== undefined).map(([name]) => name);
23
+ if (arms.length === 0)
24
+ return { corrupt: "missing-required", why: "carries neither a result nor a parked arm (nor a stopped one)" };
25
+ if (arms.length > 1)
26
+ return { corrupt: "wrong-type", why: `carries ${arms.length === 2 ? "both " : ""}${arms.slice(0, -1).join(", ")} and ${arms.at(-1)}` };
27
+ if (stopped !== undefined) {
28
+ if (!isRecordShaped(stopped))
29
+ return { corrupt: "wrong-type", why: "is recorded as stopped but its stopped arm is not an object" };
30
+ const leg = ownMember(stopped, "result");
31
+ const by = ownMember(stopped, "stoppedBy");
32
+ if (leg === undefined || by === undefined)
33
+ return { corrupt: "missing-required", why: "is recorded as stopped but carries no result or no stopper" };
34
+ if (!isRecordShaped(leg) || !isRecordShaped(ownMember(leg, "terminal")) || typeof by !== "string" || by === "")
35
+ return { corrupt: "wrong-type", why: "is recorded as stopped but its result carries no terminal or its stopper is not a word" };
36
+ return { entry: { callKey, stopped: { result: leg, stoppedBy: by } } };
37
+ }
21
38
  if (parked === undefined) {
22
39
  if (!isRecordShaped(result))
23
40
  return { corrupt: "wrong-type", why: "has a result that is not an object" };
@@ -225,6 +242,11 @@ export function assertJournalStoreGivesClaimsBack(store, seat) {
225
242
  export function journalKeepsLaunches(store) {
226
243
  return typeof store?.recordLaunch === "function" && typeof store.loadLaunch === "function";
227
244
  }
245
+ export const RESUME_CLAIM_REMAINING_MS_MAX = 24 * 60 * 60 * 1000;
246
+ export function resumeClaimRemainingMember(expiresAt, now) {
247
+ const left = Math.ceil(expiresAt - now);
248
+ return Number.isSafeInteger(left) && left >= 1 && left <= RESUME_CLAIM_REMAINING_MS_MAX ? { remainingMs: left } : {};
249
+ }
228
250
  export const MAX_JOURNAL_RESULT_BYTES = 5 * 1024 * 1024;
229
251
  export function oversizeJournalResult(serialized) {
230
252
  return Buffer.byteLength(serialized, "utf8") > MAX_JOURNAL_RESULT_BYTES;
@@ -249,13 +271,14 @@ export class WorkflowJournalOversizeError extends Error {
249
271
  }
250
272
  }
251
273
  export function assertJournalEntryFits(entry) {
252
- const serialized = JSON.stringify(entry.parked !== undefined ? entry.parked : entry.result);
274
+ const serialized = JSON.stringify(entry.parked !== undefined ? entry.parked : entry.stopped !== undefined ? entry.stopped : entry.result);
253
275
  if (oversizeJournalResult(serialized))
254
276
  throw new WorkflowJournalOversizeError(entry.callKey, Buffer.byteLength(serialized, "utf8"));
255
277
  }
256
- export function journalOversizeTombstone(result, bytes) {
278
+ export function journalOversizeTombstone(result, bytes, replay = "rerun") {
279
+ const resume = replay === "stopped" ? "A resume replays this call as stopped (it does not run again) and continues after it." : "A resume re-runs this agent (and everything after it) live.";
257
280
  const message = `[journal] result omitted: ${bytes} bytes exceeds the ${MAX_JOURNAL_RESULT_BYTES}-byte per-entry journal cap; ` +
258
- `the agent's real terminal status was "${terminalProjection(result.terminal).status}". A resume re-runs this agent (and everything after it) live.`;
281
+ `the agent's real terminal status was "${terminalProjection(result.terminal).status}". ${resume}`;
259
282
  return {
260
283
  taskId: result.taskId,
261
284
  sessionId: result.sessionId,
@@ -290,10 +313,11 @@ export class InMemoryWorkflowJournalStore {
290
313
  const now = Date.now();
291
314
  const existing = table.get(input.sourceRunId);
292
315
  if (existing !== undefined && existing.expiresAt > now && existing.holder !== input.newRunId) {
293
- return { granted: false, holder: existing.holder };
316
+ return { granted: false, holder: existing.holder, ...resumeClaimRemainingMember(existing.expiresAt, now) };
294
317
  }
295
- table.set(input.sourceRunId, { holder: input.newRunId, expiresAt: now + IN_MEMORY_RESUME_CLAIM_TTL_MS });
296
- return { granted: true };
318
+ const expiresAt = now + IN_MEMORY_RESUME_CLAIM_TTL_MS;
319
+ table.set(input.sourceRunId, { holder: input.newRunId, expiresAt });
320
+ return { granted: true, ...resumeClaimRemainingMember(expiresAt, now) };
297
321
  }
298
322
  async releaseResumeClaim(input) {
299
323
  const table = this.resumeClaims.get(input.scope);
@@ -1,6 +1,6 @@
1
1
  import { strict as assert } from "node:assert";
2
2
  import { isDeepStrictEqual } from "node:util";
3
- import { WORKFLOW_RUN_ROW_MALFORMED_CODE, WORKFLOW_RUN_UPDATE_CAUSES, summarizeWorkflowRun } from "./workflow-run-store.js";
3
+ import { WORKFLOW_RUN_ROW_MALFORMED_CODE, WORKFLOW_RUN_UPDATE_CAUSES, readStoredWorkflowRun, summarizeWorkflowRun } from "./workflow-run-store.js";
4
4
  import { thrownText } from "./thrown-value.js";
5
5
  import { ANONYMOUS_SCOPE } from "./isolation-scope.js";
6
6
  function readableRows(rows) {
@@ -83,6 +83,61 @@ export async function workflowRunStoreContract(make, runAssertion = defaultSeque
83
83
  assert.equal((await store.get(r.id)).status, "completed");
84
84
  assert.equal(await store.update("ghost", r.scope, createWorkflowRun({ id: "ghost" })), false);
85
85
  });
86
+ run("a record's creationId, treeId and resume.fromCreationId come back from get as put, and survive writing back what get returned", async () => {
87
+ const store = make();
88
+ const r = createWorkflowRun({ id: "ident", creationId: "c-ident", treeId: "root-run", resume: { fromRunId: "root-run", fromCreationId: "c-root", journalEntries: 1, replayed: 1 } });
89
+ await store.put(r.id, r);
90
+ const got = await store.get("ident");
91
+ assert.ok(got);
92
+ assert.equal(got.creationId, "c-ident", "creationId comes back as put");
93
+ assert.equal(got.treeId, "root-run", "treeId comes back as put");
94
+ assert.equal(got.resume?.fromCreationId, "c-root", "resume.fromCreationId comes back as put");
95
+ assert.equal(await store.update("ident", "tenant-a", got, { rev: got.rev ?? 0, creationId: "c-ident" }), true);
96
+ const again = (await store.get("ident"));
97
+ assert.deepEqual([again.creationId, again.treeId, again.resume?.fromCreationId], ["c-ident", "root-run", "c-root"], "writing back what get returned keeps the three members");
98
+ });
99
+ {
100
+ const cells = [
101
+ ["a: row c-1, given c-1, wins", "c-1", "c-1", true],
102
+ ["b: row c-1, given c-2 — another creation of the same id loses", "c-1", "c-2", false],
103
+ ["c: row c-1, given null — another creation of the same id loses", "c-1", null, false],
104
+ ["d: row c-1, given none, wins (not compared)", "c-1", undefined, true],
105
+ ["e: row without the member, given c-1 — another creation of the same id loses", "absent", "c-1", false],
106
+ ["f: row without the member, given null, wins", "absent", null, true],
107
+ ["g: row without the member, given none, wins", "absent", undefined, true],
108
+ ["h: a stored JSON null, given null, wins", "json-null", null, true],
109
+ ["i: a stored JSON null, given c-1 — another creation of the same id loses", "json-null", "c-1", false],
110
+ ["j: a stored JSON null, given none, wins", "json-null", undefined, true],
111
+ ];
112
+ for (const [name, live, given, wins] of cells) {
113
+ run(`update compares the creation it read (expect.creationId), the rev matching — ${name}`, async () => {
114
+ const store = make();
115
+ const base = createWorkflowRun({ id: "cid", status: "failed", error: "parked" });
116
+ const stored = live === "c-1" ? { ...base, creationId: "c-1" } : live === "json-null" ? readStoredWorkflowRun(JSON.parse(JSON.stringify({ ...base, creationId: null })), { key: "cid" }) : base;
117
+ await store.put("cid", stored);
118
+ const before = (await store.get("cid"));
119
+ const expect = given === undefined ? { rev: before.rev ?? 0 } : { rev: before.rev ?? 0, creationId: given };
120
+ const written = { ...before, result: "written" };
121
+ assert.equal(await store.update("cid", "tenant-a", written, expect), wins, `${name}: the write ${wins ? "wins" : "loses"}`);
122
+ const after = (await store.get("cid"));
123
+ if (wins) {
124
+ assert.equal(after.rev, (before.rev ?? 0) + 1, `${name}: the winning write bumps rev`);
125
+ assert.equal(after.result, "written", `${name}: the winning write is persisted`);
126
+ }
127
+ else {
128
+ assert.deepEqual(after, before, `${name}: the losing write changes nothing (rev and the whole row as they were)`);
129
+ }
130
+ });
131
+ }
132
+ }
133
+ run("update with the creation matching and a stale rev loses — the creation id never stands in for the rev — and changes nothing", async () => {
134
+ const store = make();
135
+ await store.put("cid-rev", createWorkflowRun({ id: "cid-rev", status: "running", creationId: "c-1" }));
136
+ const before = (await store.get("cid-rev"));
137
+ assert.equal(await store.update("cid-rev", "tenant-a", { ...before, status: "completed" }, { rev: (before.rev ?? 0) + 1, creationId: "c-1" }), false, "a rev ahead loses though the creation matches");
138
+ assert.deepEqual(await store.get("cid-rev"), before, "the losing write changes nothing");
139
+ assert.equal(await store.update("cid-rev", "tenant-a", { ...before, status: "completed" }, { rev: before.rev ?? 0, creationId: "c-1" }), true, "the current rev and creation win");
140
+ });
86
141
  run("update of a FINISHED run compares and sets on rev like any other: the current rev wins and bumps, a stale one loses", async () => {
87
142
  const store = make();
88
143
  const entry = { callKey: "1:g", sessionId: "child-1", token: "tok-1", originRunId: "fin", parkedBy: "fin", generation: 1 };
@@ -163,6 +163,12 @@ export interface ReadableWorkflowRunSummary {
163
163
  * happened to the card since.
164
164
  */
165
165
  export declare function summarizeWorkflowRun(run: WorkflowRun): ReadableWorkflowRunSummary;
166
+ /** The run a stored record says it resumed: its `resume.fromRunId` when that reads as a string, else nothing. */
167
+ export declare function resumedFromOf(run: WorkflowRun): string | undefined;
168
+ /** The table as a host reads it in a refusal. */
169
+ export declare const WORKFLOW_RUN_ID_CHARACTERS = "1 to 64 of A-Z a-z 0-9 _ . -, and not \".\" or \"..\" alone";
170
+ /** Whether `id` is a workflow run id ({@link WORKFLOW_RUN_ID_CHARACTERS}). */
171
+ export declare function isWorkflowRunId(id: unknown): id is string;
166
172
  /** The refusal code of a workflow run whose stored record (or a write's candidate) does not read as {@link WORKFLOW_RUN_ROW_SHAPE}. */
167
173
  export declare const WORKFLOW_RUN_ROW_MALFORMED_CODE = "workflow_run.row_malformed";
168
174
  /**
@@ -208,17 +214,37 @@ export interface WorkflowRunListByScopeOptions {
208
214
  }
209
215
  /**
210
216
  * The words a {@link WorkflowRunStore.update} call can state about itself ({@link WorkflowRunUpdateOptions.cause}) when it is not the
211
- * owner recording its own run. Two words, each a write of a FINISHED run's record by another party — the whole record as `get` returned
212
- * it with one member added, compared on `rev`, at most three calls per write of which at most one lands:
213
- * - `park_pass` — a later continuation of the run's chain takes over a park that run holds: one park entry's `passedTo` added (#4455).
217
+ * owner recording its own run. Three words, each a write of a FINISHED run's record by another party — the whole record as `get` returned
218
+ * it with one member added, compared on `rev` (and the creation read):
219
+ * - `park_pass` — a later continuation of the run's chain takes over a park that run holds: one park entry's `passedTo` added (#4455);
220
+ * at most three calls per write, of which at most one lands.
214
221
  * - `park_decision_settled` — the engine's continuation records a host's decision for a park that run holds as one it will never use:
215
- * entries added to park entries' `settledDecisions`.
222
+ * entries added to park entries' `settledDecisions`; at most three calls per write, of which at most one lands.
223
+ * - `tree_id_stamp` — a record an older engine wrote is given its tree id (`treeId`, as `workflowTreeIdStampOf` answers it): a pass
224
+ * over a store's finished rows, the bundled file store's at its open.
216
225
  * A store may read the word (one that wraps another and tells its own observers "this run's state changed" can tell these writes from
217
226
  * the owner's: any word present means the run's own state did not change), but what it persists never depends on it: the row written
218
227
  * is the same with the word and without it.
219
228
  */
220
- export declare const WORKFLOW_RUN_UPDATE_CAUSES: readonly ["park_pass", "park_decision_settled"];
229
+ export declare const WORKFLOW_RUN_UPDATE_CAUSES: readonly ["park_pass", "park_decision_settled", "tree_id_stamp"];
221
230
  export type WorkflowRunUpdateCause = (typeof WORKFLOW_RUN_UPDATE_CAUSES)[number];
231
+ /**
232
+ * What a {@link WorkflowRunStore.update} call read of the row it writes — the SINGLE shape the interface method, the shared guard
233
+ * ({@link nextWorkflowRunOnUpdate}) and both bundled implementations reference. A write wins only on the row it read:
234
+ * - `rev` — the live row's revision must be this one (an intervening write bumped it);
235
+ * - `creationId` — which creation of the run id the row is ({@link WorkflowRun.creationId}): a string ⇒ the live row's member must be
236
+ * that same string; `null` ⇒ the live row's member must not be a string (absent and a stored JSON null alike: a row an older engine
237
+ * created); absent ⇒ not compared. The rev never stands in for it, nor it for the rev: both must hold.
238
+ * The engine gives `creationId` on every write it makes (`null` when the row it read carried none), so a row created again under a
239
+ * reused id is never written with what was meant for the earlier one.
240
+ */
241
+ export interface WorkflowRunUpdateExpect {
242
+ rev: number;
243
+ creationId?: string | null;
244
+ }
245
+ /** The creation id a stored run carries ({@link WorkflowRun.creationId}): the member when it is a string, else `null` — absent, a JSON
246
+ * null and any other value alike read as none. The one reading of the member, as {@link WorkflowRunUpdateExpect.creationId} takes it. */
247
+ export declare function workflowRunCreationIdOf(run: WorkflowRun): string | null;
222
248
  /** {@link WorkflowRunStore.update}'s options — the SINGLE shape the interface method and both the In-Memory and File implementations reference. */
223
249
  export interface WorkflowRunUpdateOptions {
224
250
  /** The kind of write, when it is not the owner recording its own run ({@link WORKFLOW_RUN_UPDATE_CAUSES}). PRESENT EXACTLY on such a
@@ -238,10 +264,13 @@ export interface WorkflowRunStore {
238
264
  put(id: string, run: WorkflowRun): Promise<void>;
239
265
  get(id: string): Promise<WorkflowRun | null>;
240
266
  /**
241
- * Atomic CAS update of an EXISTING run (`UPDATE … SET … WHERE id=? AND scope=?` [`AND rev=?`]). Returns
267
+ * Atomic CAS update of an EXISTING run (`UPDATE … SET … WHERE id=? AND scope=?` [`AND rev=?`] [`AND` the creation id]). Returns
242
268
  * `true` for the winner, `false` when the row is missing, the `scope` does not match (multi-tenant
243
- * isolation — a wrong-scope update must not win), or `expect.rev` does not match the live row's `rev`
244
- * (an intervening update bumped it). On success the store bumps the row's `rev` (monotonic) and persists
269
+ * isolation — a wrong-scope update must not win), `expect.rev` does not match the live row's `rev`
270
+ * (an intervening update bumped it), or `expect.creationId` is given and the live row is another creation of the id
271
+ * ({@link WorkflowRunUpdateExpect}: a string must equal the row's member, `null` matches only a row whose member is not a string —
272
+ * a SQL twin compares "is the extracted value a string", never "IS NULL", since a stored JSON null reads differently per dialect).
273
+ * A write that loses changes nothing. On success the store bumps the row's `rev` (monotonic) and persists
245
274
  * the new `run`. The workflow owner writes its record while it runs (best-effort progress recording — design/97 §F);
246
275
  * once the run has finished, a later continuation of its chain may write it again to take over a park it holds
247
276
  * (`WorkflowRun.parks[].passedTo`), and the engine's continuation may write it again to record a decision for a park it holds as
@@ -252,9 +281,7 @@ export interface WorkflowRunStore {
252
281
  * (any word present: the run's own state did not change). It never changes what is persisted: the CAS and the row written are the
253
282
  * same with it and without it, and a store that does not read it is correct.
254
283
  */
255
- update(id: string, scope: string, run: WorkflowRun, expect?: {
256
- rev: number;
257
- }, opts?: WorkflowRunUpdateOptions): Promise<boolean>;
284
+ update(id: string, scope: string, run: WorkflowRun, expect?: WorkflowRunUpdateExpect, opts?: WorkflowRunUpdateOptions): Promise<boolean>;
258
285
  /**
259
286
  * List lightweight {@link WorkflowRunSummary} projections for runs in `scope` — **history included** (the
260
287
  * completed / failed runs, NOT pending-only like `CheckpointStore.listByScope`), so this is the "看之前的"
@@ -309,15 +336,14 @@ export interface WorkflowRunStore {
309
336
  }
310
337
  /**
311
338
  * REF-A5 — THE optimistic-concurrency guard for {@link WorkflowRunStore.update}, shared by every backend:
312
- * scope in the WHERE (multi-tenant isolation — a wrong-scope update never wins), row must exist, and an
313
- * `expect.rev` that no longer matches the LIVE row loses (an intervening update bumped it). Returns the
339
+ * scope in the WHERE (multi-tenant isolation — a wrong-scope update never wins), row must exist, an
340
+ * `expect.rev` that no longer matches the LIVE row loses (an intervening update bumped it), and an `expect.creationId` the live row is
341
+ * not loses ({@link WorkflowRunUpdateExpect}). Returns the
314
342
  * row to persist, or `null` when the CAS lost; PURE — it neither reads nor writes any store state, so
315
343
  * each backend keeps its own persistence mechanism (in-memory `Map.set` vs ledger commit) around it.
316
344
  * RB-59 (a cross-instance CAS both instances won) landed on this predicate.
317
345
  */
318
- export declare function nextWorkflowRunOnUpdate(cur: WorkflowRun | undefined, id: string, scope: string, run: WorkflowRun, expect?: {
319
- rev: number;
320
- }, disclose?: (sentence: string) => void): WorkflowRun | null;
346
+ export declare function nextWorkflowRunOnUpdate(cur: WorkflowRun | undefined, id: string, scope: string, run: WorkflowRun, expect?: WorkflowRunUpdateExpect, disclose?: (sentence: string) => void): WorkflowRun | null;
321
347
  /**
322
348
  * REF-A5 — THE `listByScope` query projection, shared by every backend: scope/status/session filter →
323
349
  * newest-first by `createdAt` → truncate → one summary per row. Pure over the store's `[key, row]` entries. A filter excludes
@@ -414,9 +440,7 @@ export declare class InMemoryWorkflowRunStore implements WorkflowRunStore {
414
440
  private runs;
415
441
  put(id: string, run: WorkflowRun): Promise<void>;
416
442
  get(id: string): Promise<WorkflowRun | null>;
417
- update(id: string, scope: string, run: WorkflowRun, expect?: {
418
- rev: number;
419
- }, _opts?: WorkflowRunUpdateOptions): Promise<boolean>;
443
+ update(id: string, scope: string, run: WorkflowRun, expect?: WorkflowRunUpdateExpect, _opts?: WorkflowRunUpdateOptions): Promise<boolean>;
420
444
  listByScope(scope: string, opts?: WorkflowRunListByScopeOptions): Promise<WorkflowRunSummary[]>;
421
445
  reap(scope: string, now: number, opts?: {
422
446
  maxAgeMs?: number;
@@ -26,10 +26,15 @@ export function summarizeWorkflowRun(run) {
26
26
  ...(resumedFromOf(run) !== undefined ? { resumedFrom: resumedFromOf(run) } : {}),
27
27
  };
28
28
  }
29
- function resumedFromOf(run) {
29
+ export function resumedFromOf(run) {
30
30
  const from = run.resume?.fromRunId;
31
31
  return typeof from === "string" && from !== "" ? from : undefined;
32
32
  }
33
+ const WORKFLOW_RUN_ID = /^[A-Za-z0-9_.-]{1,64}$/;
34
+ export const WORKFLOW_RUN_ID_CHARACTERS = "1 to 64 of A-Z a-z 0-9 _ . -, and not \".\" or \"..\" alone";
35
+ export function isWorkflowRunId(id) {
36
+ return typeof id === "string" && WORKFLOW_RUN_ID.test(id) && id !== "." && id !== "..";
37
+ }
33
38
  export const WORKFLOW_RUN_ROW_MALFORMED_CODE = "workflow_run.row_malformed";
34
39
  const isTimeoutCount = isFiniteNumber;
35
40
  export const WORKFLOW_RUN_ROW_SHAPE = rowShapeReader({
@@ -98,13 +103,23 @@ export class WorkflowRunStoreError extends Error {
98
103
  this.name = "WorkflowRunStoreError";
99
104
  }
100
105
  }
101
- export const WORKFLOW_RUN_UPDATE_CAUSES = Object.freeze(["park_pass", "park_decision_settled"]);
106
+ export const WORKFLOW_RUN_UPDATE_CAUSES = Object.freeze(["park_pass", "park_decision_settled", "tree_id_stamp"]);
107
+ export function workflowRunCreationIdOf(run) {
108
+ const v = run.creationId;
109
+ return typeof v === "string" ? v : null;
110
+ }
102
111
  export function nextWorkflowRunOnUpdate(cur, id, scope, run, expect, disclose) {
112
+ const wanted = expect?.creationId;
113
+ if (wanted !== undefined && wanted !== null && typeof wanted !== "string") {
114
+ throw new TypeError("WorkflowRunStore.update: expect.creationId is a string, null or absent — another value compares against nothing, so the write is refused");
115
+ }
103
116
  if (!cur || cur.scope !== scope)
104
117
  return null;
105
118
  const live = readStoredWorkflowRun(cur, { key: id }, disclose);
106
119
  if (expect !== undefined && (live.rev ?? 0) !== expect.rev)
107
120
  return null;
121
+ if (wanted !== undefined && workflowRunCreationIdOf(live) !== wanted)
122
+ return null;
108
123
  const next = structuredClone(run);
109
124
  next.id = id;
110
125
  next.scope = scope;
@@ -96,6 +96,9 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
96
96
  /** `ExecutionEnv.cdPath` = the `CDPATH` the shell child receives, read LIVE off the same merge each exec gets (never the
97
97
  * engine process's own environment): its entries, `[]` when the child gets none. Residual: a per-exec `env.CDPATH`. */
98
98
  get cdPath(): readonly string[];
99
+ /** `ExecutionEnv.searchPath` = the `PATH` the shell child receives, read LIVE off the same merge each exec gets: its entries,
100
+ * `[]` when the child gets none. Residual: a per-exec `env.PATH`. */
101
+ get searchPath(): readonly string[];
99
102
  /** `ExecutionEnv.receivedEnvNames` = the names of the same merge each exec gets, read LIVE; `[]` when no child would be spawned
100
103
  * at all. Residual: a per-exec `env` adding one. */
101
104
  get receivedEnvNames(): readonly string[];
@@ -577,6 +577,10 @@ export class NodeExecutionEnv {
577
577
  const value = this.childEnvForRead()?.CDPATH;
578
578
  return value === undefined || value === "" ? [] : value.split(":");
579
579
  }
580
+ get searchPath() {
581
+ const value = this.childEnvForRead()?.PATH;
582
+ return value === undefined || value === "" ? [] : value.split(":");
583
+ }
580
584
  get receivedEnvNames() {
581
585
  return Object.entries(this.childEnvForRead() ?? {}).flatMap(([name, value]) => (value === undefined ? [] : [name]));
582
586
  }
@@ -237,8 +237,9 @@ export interface HarnessLoopRecovery {
237
237
  };
238
238
  }
239
239
  /** How a durable park's commit ended, for the rows its gate took off the port ({@link AgentHarness.parkCapture}): the row
240
- * holds them (`committed`), no row was written (`absent`), or whether one was is unknown (`indeterminate`). */
241
- type ParkCaptureOutcome = "committed" | "absent" | "indeterminate";
240
+ * holds them (`committed`), no row was written (`absent`), whether one was is unknown (`indeterminate`), or none was because the
241
+ * store refused the write for the run's grant and the leg is stopping (`superseded`). */
242
+ type ParkCaptureOutcome = "committed" | "absent" | "indeterminate" | "superseded";
242
243
  /** The port's held rows as a park's gate took them, in queue order, and the one call that says how the commit ended. */
243
244
  interface ParkCapture {
244
245
  readonly rows: readonly AgentMessage[];
@@ -302,7 +303,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
302
303
  private pendingSessionWrites;
303
304
  /** A park's capture of the port's held rows, from the gate's snapshot until its commit settles: the port waits on it. */
304
305
  private parkCaptureInFlight?;
305
- /** Set when a park's commit took the port's rows, or may have: the port refuses from then on (this leg's conversation goes on from the checkpoint). */
306
+ /** Set when a park's commit closed the port (it took the rows, may have, or the leg stopped for its grant): the port refuses from then on, saying why. */
306
307
  private parkedPortClosed;
307
308
  private model;
308
309
  /** The ref that chose {@link model}, moved by the SAME assignment (one value, never two answers). */
@@ -741,6 +742,10 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
741
742
  /** The harness's statement of what this run's halt (and its stop siblings) did — {@link HaltConsumption}. Readable
742
743
  * during the run and after `prompt()` settled (cleared by the NEXT prompt). */
743
744
  haltConsumption(): HaltConsumption;
745
+ /** The run's ending is a boundary too: where a stop request ends the run at its stop gate (a halt that ended a one-shot ending's
746
+ * wait), the runner consults the latch there, consumed by the rule of the two loop faces ({@link consultStopLatch}: an aborted
747
+ * run's abort keeps owning the ending). Answers whether a latch was set. */
748
+ consumeStopAtEnding(): boolean;
744
749
  /** The ONE consult behind both boundary faces: a set latch answers true, and the FIRST true answer on a run that is
745
750
  * NOT unwinding is the consumption (the loop exits on it), recorded with the latch's sources at that instant. The run
746
751
  * signal always wins (the loop's cut arms' rule): an unwinding run ends FOR its abort — the latch's true answer is
@@ -837,8 +842,8 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
837
842
  /**
838
843
  * A durable park's gate takes the rows the port holds (non-destructive, in queue order) to write them on its checkpoint;
839
844
  * until {@link ParkCapture.settle} the port waits. `committed` takes them off the queue (the resumed leg writes them) and
840
- * closes the port; `indeterminate` closes the port and leaves them queued (this leg's own branch gets them if its
841
- * transcript is closed again); `absent` changes nothing. Only rows are held at a park: the other queued writes come from
845
+ * closes the port; `indeterminate` and `superseded` close the port and leave them queued (this leg's own branch gets them if its
846
+ * transcript is closed again; a superseded leg's writes are refused by the store anyway); `absent` changes nothing. Only rows are held at a park: the other queued writes come from
842
847
  * turn ends, which flush before any park point.
843
848
  */
844
849
  parkCapture(): ParkCapture;
@@ -244,6 +244,11 @@ function normalizeHookError(error) {
244
244
  return normalizeHarnessError(error, "hook");
245
245
  }
246
246
  const PORT_PARKED_REFUSAL = "$.session.append: refused: the leg parked durably — the conversation it resumes is its checkpoint's";
247
+ const PORT_CLOSED_REFUSAL = {
248
+ committed: PORT_PARKED_REFUSAL,
249
+ indeterminate: PORT_PARKED_REFUSAL,
250
+ superseded: "$.session.append: refused: the leg stopped — its run's grant is no longer current, so nothing more is written for it (no checkpoint was written)",
251
+ };
247
252
  export class AgentHarness {
248
253
  env;
249
254
  session;
@@ -275,7 +280,7 @@ export class AgentHarness {
275
280
  runPromise;
276
281
  pendingSessionWrites = [];
277
282
  parkCaptureInFlight;
278
- parkedPortClosed = false;
283
+ parkedPortClosed;
279
284
  model;
280
285
  modelRef;
281
286
  thinkingLevel;
@@ -1423,6 +1428,9 @@ export class AgentHarness {
1423
1428
  ...(unconsumedCuts.length > 0 ? { unconsumedCuts } : {}),
1424
1429
  };
1425
1430
  }
1431
+ consumeStopAtEnding() {
1432
+ return this.consultStopLatch("post_turn");
1433
+ }
1426
1434
  consultStopLatch(face) {
1427
1435
  if (!this.stopRequested)
1428
1436
  return false;
@@ -1495,8 +1503,8 @@ export class AgentHarness {
1495
1503
  return;
1496
1504
  while (this.parkCaptureInFlight !== undefined)
1497
1505
  await this.parkCaptureInFlight;
1498
- if (this.parkedPortClosed)
1499
- throw new AgentHarnessError("invalid_state", PORT_PARKED_REFUSAL);
1506
+ if (this.parkedPortClosed !== undefined)
1507
+ throw new AgentHarnessError("invalid_state", PORT_CLOSED_REFUSAL[this.parkedPortClosed]);
1500
1508
  try {
1501
1509
  if (this.phase === "idle" && this.pendingSessionWrites.length === 0) {
1502
1510
  await this.session.appendMessage(message);
@@ -1672,7 +1680,7 @@ export class AgentHarness {
1672
1680
  this.pendingSessionWrites = this.pendingSessionWrites.filter((write) => write.type !== "message" || !taken.has(write.message));
1673
1681
  }
1674
1682
  if (outcome !== "absent")
1675
- this.parkedPortClosed = true;
1683
+ this.parkedPortClosed = outcome;
1676
1684
  this.parkCaptureInFlight = undefined;
1677
1685
  release();
1678
1686
  },
@@ -5,6 +5,7 @@ import type { AgentCoreRuntimeDeps } from "../loop/runtime-deps.js";
5
5
  import type { SecretEnvFinding } from "../../core/secret-env.js";
6
6
  import type { CommandSandboxInstruction, CommandSandboxRecord, ConfinementRefusal } from "../../core/command-sandbox.js";
7
7
  import type { SessionRepoRowCells } from "../session/row-cells.js";
8
+ import type { StoreHolderFence } from "../../core/checkpoint-generation.js";
8
9
  import { type CorruptSessionDetail, type CorruptSessionForm } from "../../core/corrupt-session-form.js";
9
10
  /** Result of a fallible operation. Expected failures are returned as `ok: false` instead of thrown. */
10
11
  export type Result<TValue, TError> = {
@@ -734,6 +735,10 @@ export interface ExecutionEnv extends FileSystem, Shell {
734
735
  readonly homeDir?: string;
735
736
  /** #1554 — the `CDPATH` entries the shell child receives (`[]` = none), or `"unknown"` when the adapter cannot say. */
736
737
  readonly cdPath: readonly string[] | "unknown";
738
+ /** OPTIONAL — the `PATH` entries the shell child receives, in order (`[]` = none), or `"unknown"`. Read only by the session call
739
+ * grant, which binds a bare program name to the file it resolves to; omitted / `"unknown"` ⇒ such a card offers no "allow this
740
+ * call for the session" option. E.g. a local adapter reads the env it hands its child; a remote shell asks its shell once. */
741
+ readonly searchPath?: readonly string[] | "unknown";
737
742
  /** #1963 — the entries of the environment the shell child inherits that it does NOT receive: the findings of the one
738
743
  * composition its spawns read (`inheritedHostEnv(policy, findings)`), less the keys the adapter's explicit grants
739
744
  * re-supply — names and rules, never a value. `[]` = none withheld, or none inherited (a shell environment built
@@ -1322,6 +1327,10 @@ export interface SessionWriteOptions {
1322
1327
  * unique-key insert); the in-process base storage checks it against its in-memory leaf.
1323
1328
  */
1324
1329
  expectedLeafId?: string | null;
1330
+ /** The writing run's grant holder (`RunInternals.holder`, verbatim). A storage whose store declares `fence = { holder: "writes" }` judges
1331
+ * it first, in the write's atomic step: not current ⇒ `holder.superseded`, nothing written, whatever the leaf (a superseded leg stops;
1332
+ * it does not retry as on a conflict). A storage with no judge refuses any holder alike. Absent ⇒ the write is judged as before. */
1333
+ holder?: string;
1325
1334
  }
1326
1335
  /** What the replay that loaded a stored log dropped: `dropped` of its `total` records could not be read and are not in the log. */
1327
1336
  export interface ReplayLoss {
@@ -1488,6 +1497,9 @@ export interface SessionRepo<TMetadata extends SessionMetadata = SessionMetadata
1488
1497
  /** Who holds this repo's rows' occupant cells ({@link SessionRepoRowCells}); absent reads as `"engine"` — the repo does. A repo whose
1489
1498
  * host holds them (`"host"`) writes and hands out neither cell, and `TtlSessionStore` refuses it (that layer has no occupant source). */
1490
1499
  readonly rowCells?: SessionRepoRowCells;
1500
+ /** The repo's holder declaration (`StoreHolderFence`): every storage it hands out judges the holder of each append and leaf move.
1501
+ * The source of `SessionStore.fence` (`TtlSessionStore` mirrors it, as {@link headOf}). Absent ⇒ judges no holder. */
1502
+ readonly fence?: StoreHolderFence;
1491
1503
  create(options: TCreateOptions): Promise<Session<TMetadata>>;
1492
1504
  open(metadata: TMetadata): Promise<Session<TMetadata>>;
1493
1505
  /** Every ordinary row (placed rows are not listed), each with the newest write the repo holds for it ({@link SessionRow}), in no
@@ -1552,6 +1564,12 @@ export interface SessionRepo<TMetadata extends SessionMetadata = SessionMetadata
1552
1564
  preserveActorAssertions?: boolean;
1553
1565
  expect?: SessionRowExpectation;
1554
1566
  }): Promise<SessionHead>;
1567
+ /**
1568
+ * The conditional owner write of a row that records none, judged and written in ONE step — the contract is
1569
+ * {@link SessionStore.recordOwner}'s (the head it answers, `conflict` for a row `expect` does not name, `undefined` for no row; only the
1570
+ * owner cell changes). Optional: a repo without it has no way to record an owner on a row that exists.
1571
+ */
1572
+ recordOwner?(sessionId: string, owner: string, expect: SessionRowExpectation): Promise<SessionHead | undefined>;
1555
1573
  }
1556
1574
  export interface JsonlSessionCreateOptions extends SessionCreateOptions {
1557
1575
  cwd: string;
@@ -69,7 +69,7 @@ export declare const TOOL_TURN_REPAIR_DROPS: {
69
69
  };
70
70
  export type DropsTableCoversEveryForm = AssertAllKeysHandled<Exclude<ToolTurnRepairForm, keyof typeof TOOL_TURN_REPAIR_DROPS>>;
71
71
  /**
72
- * Why a tool turn reached the model incomplete — the `task.tool_turn_incomplete` notice's `detail.cause`, the person's
72
+ * Why a tool turn reached the model incomplete — `detail.cause` of both tool-turn notices to the person, the person's
73
73
  * view of facts the model is already told in the turn itself. Closed:
74
74
  * · `truncated` — calls whose argument bytes were cut before they parsed: dropped, the model asked to re-issue them;
75
75
  * · `unnamed` — calls that arrived with no tool name: dropped the same way;