@sema-agent/core 7.60.0 → 7.62.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 (560) hide show
  1. package/CHANGELOG.md +917 -0
  2. package/README.md +2 -2
  3. package/dist/agents/agent-transcript-tool.d.ts +2 -2
  4. package/dist/agents/agent-transcript-tool.js +1 -1
  5. package/dist/agents/cascade.d.ts +71 -12
  6. package/dist/agents/cascade.js +61 -21
  7. package/dist/agents/composition-allowance.d.ts +53 -0
  8. package/dist/agents/composition-allowance.js +49 -0
  9. package/dist/agents/composition-placement.d.ts +29 -0
  10. package/dist/agents/composition-placement.js +24 -0
  11. package/dist/agents/cumulative-stats.d.ts +4 -0
  12. package/dist/agents/cumulative-stats.js +3 -0
  13. package/dist/agents/inherited-tool-pool.d.ts +5 -3
  14. package/dist/agents/inherited-tool-pool.js +2 -2
  15. package/dist/agents/list-agents-tool.d.ts +1 -1
  16. package/dist/agents/peer-held-queue.d.ts +27 -4
  17. package/dist/agents/peer-held-queue.js +81 -36
  18. package/dist/agents/peer-notice-route.d.ts +1 -1
  19. package/dist/agents/peer-notice-route.js +4 -3
  20. package/dist/agents/peer-notices.d.ts +4 -4
  21. package/dist/agents/peer-notices.js +8 -4
  22. package/dist/agents/peer-session-drain.d.ts +8 -1
  23. package/dist/agents/peer-session-drain.js +49 -10
  24. package/dist/agents/repair-loop.js +16 -6
  25. package/dist/agents/retain-ledger.js +3 -1
  26. package/dist/agents/roster-store.d.ts +1 -1
  27. package/dist/agents/roster-store.js +7 -4
  28. package/dist/agents/send-message-tool.d.ts +8 -10
  29. package/dist/agents/send-message-tool.js +43 -23
  30. package/dist/agents/subagent-completion-gate.d.ts +35 -0
  31. package/dist/agents/subagent-completion-gate.js +62 -0
  32. package/dist/agents/subagent-steps.d.ts +7 -6
  33. package/dist/agents/subagent.d.ts +36 -41
  34. package/dist/agents/subagent.js +245 -200
  35. package/dist/agents/suspend-guard.d.ts +47 -16
  36. package/dist/agents/suspend-guard.js +13 -4
  37. package/dist/agents/verify.d.ts +41 -14
  38. package/dist/agents/verify.js +41 -30
  39. package/dist/brain/anthropic.js +1 -0
  40. package/dist/brain/errors.d.ts +7 -1
  41. package/dist/brain/errors.js +6 -0
  42. package/dist/brain/failover.js +2 -1
  43. package/dist/brain/open-responses.js +1 -0
  44. package/dist/brain/openai.js +1 -0
  45. package/dist/brain/provider-dialect.d.ts +10 -0
  46. package/dist/brain/provider-dialect.js +13 -2
  47. package/dist/brain/stream-engine.d.ts +3 -0
  48. package/dist/brain/stream-engine.js +4 -0
  49. package/dist/core/agent-state.d.ts +1 -1
  50. package/dist/core/allow-entry.d.ts +59 -23
  51. package/dist/core/allow-entry.js +131 -38
  52. package/dist/core/ask-origin.d.ts +79 -0
  53. package/dist/core/ask-origin.js +76 -0
  54. package/dist/core/ask-question.d.ts +19 -13
  55. package/dist/core/ask-question.js +8 -2
  56. package/dist/core/auto-compaction.d.ts +2 -0
  57. package/dist/core/auto-compaction.js +2 -1
  58. package/dist/core/auto-mode.js +3 -5
  59. package/dist/core/background-agent-store.d.ts +7 -5
  60. package/dist/core/background-agent-store.js +12 -11
  61. package/dist/core/checkpoint-features.d.ts +722 -0
  62. package/dist/core/checkpoint-features.js +98 -0
  63. package/dist/core/checkpoint-requirements.d.ts +33 -5
  64. package/dist/core/checkpoint-requirements.js +18 -5
  65. package/dist/core/checkpoint-row-verdict.d.ts +99 -0
  66. package/dist/core/checkpoint-row-verdict.js +225 -0
  67. package/dist/core/checkpoint-store.d.ts +107 -738
  68. package/dist/core/checkpoint-store.js +45 -143
  69. package/dist/core/child-clamp-seats.d.ts +3 -2
  70. package/dist/core/child-clamp-seats.js +4 -3
  71. package/dist/core/closest-name.d.ts +13 -0
  72. package/dist/core/closest-name.js +35 -0
  73. package/dist/core/context-settings.js +3 -5
  74. package/dist/core/cross-boundary-taint.d.ts +1 -1
  75. package/dist/core/decision-receipt.d.ts +14 -1
  76. package/dist/core/decision-receipt.js +6 -3
  77. package/dist/core/delegation-frames.d.ts +13 -9
  78. package/dist/core/effective-path-target.js +2 -3
  79. package/dist/core/engine-attestation.d.ts +11 -1
  80. package/dist/core/engine-attestation.js +2 -0
  81. package/dist/core/engine-notice.d.ts +68 -21
  82. package/dist/core/engine-notice.js +9 -2
  83. package/dist/core/file-history-retention.d.ts +8 -0
  84. package/dist/core/file-history-retention.js +14 -11
  85. package/dist/core/file-history-store.d.ts +31 -1
  86. package/dist/core/file-history-store.js +31 -2
  87. package/dist/core/frame-settlement.d.ts +10 -0
  88. package/dist/core/frame-settlement.js +6 -1
  89. package/dist/core/fs-write-gate-policy.d.ts +3 -3
  90. package/dist/core/fs-write-gate-policy.js +8 -7
  91. package/dist/core/gate-fold.js +4 -3
  92. package/dist/core/gate-lanes.js +7 -4
  93. package/dist/core/gate-outcome.d.ts +40 -1
  94. package/dist/core/gate-outcome.js +10 -0
  95. package/dist/core/git-worktree-env.d.ts +7 -3
  96. package/dist/core/git-worktree-env.js +16 -13
  97. package/dist/core/governance-codes.d.ts +14 -4
  98. package/dist/core/governance-codes.js +19 -4
  99. package/dist/core/hooks.d.ts +25 -4
  100. package/dist/core/hooks.js +11 -4
  101. package/dist/core/host-floor.js +3 -5
  102. package/dist/core/human-input-projection.d.ts +1 -0
  103. package/dist/core/human-input-projection.js +3 -0
  104. package/dist/core/image-admission.d.ts +47 -7
  105. package/dist/core/image-admission.js +35 -4
  106. package/dist/core/input-author.d.ts +36 -0
  107. package/dist/core/input-author.js +39 -0
  108. package/dist/core/leg-identity.d.ts +62 -0
  109. package/dist/core/leg-identity.js +18 -0
  110. package/dist/core/locked-config.d.ts +4 -3
  111. package/dist/core/locked-config.js +5 -3
  112. package/dist/core/lsp.d.ts +5 -3
  113. package/dist/core/lsp.js +3 -2
  114. package/dist/core/mailbox-store.d.ts +85 -10
  115. package/dist/core/mailbox-store.js +31 -10
  116. package/dist/core/mcp-connection-pool.d.ts +6 -20
  117. package/dist/core/mcp-connection-pool.js +10 -28
  118. package/dist/core/mcp-failure.d.ts +76 -15
  119. package/dist/core/mcp-failure.js +60 -33
  120. package/dist/core/mcp-host-seat.d.ts +92 -53
  121. package/dist/core/mcp-host-seat.js +225 -46
  122. package/dist/core/mcp-probe.js +2 -2
  123. package/dist/core/mcp-server-link.d.ts +18 -6
  124. package/dist/core/mcp-server-link.js +19 -4
  125. package/dist/core/mcp-server-spec.d.ts +2 -1
  126. package/dist/core/mcp-session-end.d.ts +1 -2
  127. package/dist/core/mcp-session-end.js +1 -1
  128. package/dist/core/mcp.d.ts +6 -49
  129. package/dist/core/mcp.js +115 -111
  130. package/dist/core/media-byte-cap.d.ts +21 -46
  131. package/dist/core/media-byte-cap.js +55 -55
  132. package/dist/core/member-group.d.ts +7 -0
  133. package/dist/core/member-group.js +35 -0
  134. package/dist/core/memory-engine/consolidation-driver.d.ts +1 -1
  135. package/dist/core/memory-engine/consolidation.d.ts +1 -1
  136. package/dist/core/memory-engine/consolidation.js +7 -1
  137. package/dist/core/memory-engine/dual-root.d.ts +31 -0
  138. package/dist/core/memory-engine/dual-root.js +59 -11
  139. package/dist/core/memory-engine/engine.js +27 -24
  140. package/dist/core/memory-engine/file-backend.d.ts +13 -0
  141. package/dist/core/memory-engine/file-backend.js +35 -15
  142. package/dist/core/memory-engine/layout.d.ts +3 -0
  143. package/dist/core/memory-engine/layout.js +13 -3
  144. package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
  145. package/dist/core/memory-engine/memory-deployment.js +182 -0
  146. package/dist/core/memory-engine/sync-client.d.ts +39 -18
  147. package/dist/core/memory-engine/sync-client.js +72 -14
  148. package/dist/core/memory-engine/sync-report.d.ts +7 -4
  149. package/dist/core/memory-engine/sync.d.ts +9 -1
  150. package/dist/core/memory-vector.d.ts +1 -1
  151. package/dist/core/memory.d.ts +10 -10
  152. package/dist/core/mode-policy.d.ts +8 -8
  153. package/dist/core/mode-policy.js +8 -6
  154. package/dist/core/mods/agent-stations.d.ts +39 -4
  155. package/dist/core/mods/agent-stations.js +59 -10
  156. package/dist/core/mods/classic-events.d.ts +9 -1
  157. package/dist/core/mods/dollar.d.ts +94 -1
  158. package/dist/core/mods/dollar.js +13 -1
  159. package/dist/core/mods/extension-call.d.ts +15 -1
  160. package/dist/core/mods/extension-call.js +7 -2
  161. package/dist/core/mods/kernel/dispatch.d.ts +4 -3
  162. package/dist/core/mods/kernel/dispatch.js +4 -4
  163. package/dist/core/mods/kernel/events.d.ts +14 -3
  164. package/dist/core/mods/kernel/events.js +18 -15
  165. package/dist/core/mods/kernel/registration.d.ts +3 -0
  166. package/dist/core/mods/kernel/registration.js +5 -0
  167. package/dist/core/mods/kernel/site-rules.d.ts +6 -3
  168. package/dist/core/mods/kernel/site-rules.js +10 -2
  169. package/dist/core/mods/lifecycle-stations.d.ts +36 -4
  170. package/dist/core/mods/lifecycle-stations.js +44 -9
  171. package/dist/core/mods/session-append.d.ts +118 -0
  172. package/dist/core/mods/session-append.js +318 -0
  173. package/dist/core/mods/session-compact.d.ts +48 -0
  174. package/dist/core/mods/session-compact.js +194 -0
  175. package/dist/core/mods/session-receive.d.ts +93 -0
  176. package/dist/core/mods/session-receive.js +138 -0
  177. package/dist/core/mods/session-send.d.ts +72 -0
  178. package/dist/core/mods/session-send.js +88 -0
  179. package/dist/core/mods/stations.d.ts +88 -21
  180. package/dist/core/mods/stations.js +149 -11
  181. package/dist/core/mods/tool-call.d.ts +2 -0
  182. package/dist/core/mods/tool-call.js +4 -4
  183. package/dist/core/output-style.js +3 -4
  184. package/dist/core/own-property-receipt.d.ts +68 -2
  185. package/dist/core/own-property-receipt.js +45 -2
  186. package/dist/core/park-selfcheck.js +4 -2
  187. package/dist/core/path-identity.d.ts +11 -0
  188. package/dist/core/path-identity.js +4 -0
  189. package/dist/core/path-rule-binding.d.ts +3 -1
  190. package/dist/core/path-rule-binding.js +3 -1
  191. package/dist/core/peer-seat.d.ts +3 -3
  192. package/dist/core/peer-seat.js +20 -8
  193. package/dist/core/permission-rule-consent.d.ts +21 -5
  194. package/dist/core/permission-rule-consent.js +21 -1
  195. package/dist/core/permission-rule-model.d.ts +34 -11
  196. package/dist/core/permission-rule-model.js +47 -10
  197. package/dist/core/permission-rule-org.d.ts +1 -1
  198. package/dist/core/permission-rule-provider.js +4 -1
  199. package/dist/core/permission-rules.d.ts +4 -0
  200. package/dist/core/permission-rules.js +11 -16
  201. package/dist/core/read-root-candidate.js +1 -1
  202. package/dist/core/remote-env.d.ts +74 -26
  203. package/dist/core/remote-env.js +20 -0
  204. package/dist/core/resume-startup-cause.d.ts +5 -4
  205. package/dist/core/retention-policy.d.ts +24 -23
  206. package/dist/core/retention-policy.js +36 -2
  207. package/dist/core/retention.d.ts +4 -1
  208. package/dist/core/retired-keys.d.ts +4 -4
  209. package/dist/core/row-admission.d.ts +10 -0
  210. package/dist/core/row-admission.js +5 -0
  211. package/dist/core/runner/advisor-instructions.d.ts +2 -1
  212. package/dist/core/runner/advisor-instructions.js +2 -1
  213. package/dist/core/runner/announce-once-ledger.d.ts +4 -4
  214. package/dist/core/runner/assemble-result.d.ts +13 -3
  215. package/dist/core/runner/assemble-result.js +12 -7
  216. package/dist/core/runner/caller-roster.d.ts +12 -9
  217. package/dist/core/runner/caller-roster.js +5 -2
  218. package/dist/core/runner/checkpoint-scope.d.ts +16 -1
  219. package/dist/core/runner/checkpoint-scope.js +21 -0
  220. package/dist/core/runner/compact-session.js +18 -3
  221. package/dist/core/runner/compaction-call-options.d.ts +1 -1
  222. package/dist/core/runner/compaction-restate.d.ts +2 -2
  223. package/dist/core/runner/compaction-restate.js +4 -3
  224. package/dist/core/runner/construction-doors.d.ts +2 -2
  225. package/dist/core/runner/construction-doors.js +2 -2
  226. package/dist/core/runner/contracts.d.ts +116 -34
  227. package/dist/core/runner/cross-boundary-lane.d.ts +1 -1
  228. package/dist/core/runner/decide-continuation.d.ts +4 -2
  229. package/dist/core/runner/decide-continuation.js +7 -4
  230. package/dist/core/runner/delegation-owner.d.ts +43 -0
  231. package/dist/core/runner/delegation-owner.js +59 -0
  232. package/dist/core/runner/denial-limit-arms.d.ts +15 -21
  233. package/dist/core/runner/denial-limit-arms.js +17 -10
  234. package/dist/core/runner/expire-settle.d.ts +44 -0
  235. package/dist/core/runner/expire-settle.js +55 -0
  236. package/dist/core/runner/git-status-frame.d.ts +3 -3
  237. package/dist/core/runner/git-status-frame.js +2 -1
  238. package/dist/core/runner/halt-attribution.d.ts +2 -1
  239. package/dist/core/runner/halt-attribution.js +2 -1
  240. package/dist/core/runner/lineage-reroot-view.d.ts +56 -0
  241. package/dist/core/runner/lineage-reroot-view.js +108 -0
  242. package/dist/core/runner/local-claims.d.ts +17 -0
  243. package/dist/core/runner/local-claims.js +18 -0
  244. package/dist/core/runner/media-removed-seat.d.ts +46 -0
  245. package/dist/core/runner/media-removed-seat.js +88 -0
  246. package/dist/core/runner/park-commit.d.ts +2 -2
  247. package/dist/core/runner/permission-rule-lanes.d.ts +7 -2
  248. package/dist/core/runner/permission-rule-lanes.js +28 -9
  249. package/dist/core/runner/person-path-rows.d.ts +15 -0
  250. package/dist/core/runner/person-path-rows.js +27 -4
  251. package/dist/core/runner/placement-fence.d.ts +26 -0
  252. package/dist/core/runner/placement-fence.js +38 -0
  253. package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -1
  254. package/dist/core/runner/prepare-acquire-reconcile.js +7 -2
  255. package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
  256. package/dist/core/runner/prepare-ask-lane.js +4 -4
  257. package/dist/core/runner/prepare-boundary-parks.d.ts +4 -1
  258. package/dist/core/runner/prepare-boundary-parks.js +2 -2
  259. package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -0
  260. package/dist/core/runner/prepare-caps-and-workflow.js +2 -1
  261. package/dist/core/runner/prepare-config-doors.d.ts +6 -6
  262. package/dist/core/runner/prepare-config-doors.js +19 -21
  263. package/dist/core/runner/prepare-context-lane.d.ts +6 -2
  264. package/dist/core/runner/prepare-context-lane.js +13 -13
  265. package/dist/core/runner/prepare-delegation-surface.d.ts +9 -9
  266. package/dist/core/runner/prepare-delegation-surface.js +4 -5
  267. package/dist/core/runner/prepare-execution-env.d.ts +5 -2
  268. package/dist/core/runner/prepare-execution-env.js +7 -4
  269. package/dist/core/runner/prepare-gate-stations.d.ts +19 -14
  270. package/dist/core/runner/prepare-gate-stations.js +6 -4
  271. package/dist/core/runner/prepare-hands-readface.d.ts +6 -6
  272. package/dist/core/runner/prepare-hands-readface.js +32 -11
  273. package/dist/core/runner/prepare-inherited-gate.d.ts +8 -0
  274. package/dist/core/runner/prepare-inherited-gate.js +10 -3
  275. package/dist/core/runner/prepare-lsp.d.ts +3 -0
  276. package/dist/core/runner/prepare-lsp.js +2 -2
  277. package/dist/core/runner/prepare-park-ask.d.ts +5 -2
  278. package/dist/core/runner/prepare-park-ask.js +4 -5
  279. package/dist/core/runner/prepare-policy-chain.d.ts +10 -21
  280. package/dist/core/runner/prepare-policy-chain.js +16 -25
  281. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  282. package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -4
  283. package/dist/core/runner/prepare-prompt-inputs.js +3 -2
  284. package/dist/core/runner/prepare-question-face.d.ts +6 -4
  285. package/dist/core/runner/prepare-question-face.js +2 -2
  286. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  287. package/dist/core/runner/prepare-run-refs.js +2 -2
  288. package/dist/core/runner/prepare-suspend-saga.d.ts +11 -7
  289. package/dist/core/runner/prepare-suspend-saga.js +17 -7
  290. package/dist/core/runner/prepare-task.d.ts +1 -1
  291. package/dist/core/runner/prepare-task.js +61 -30
  292. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
  293. package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
  294. package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -0
  295. package/dist/core/runner/prepare-wiring-manifest.js +2 -1
  296. package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
  297. package/dist/core/runner/prepare-workspace-restore.js +10 -6
  298. package/dist/core/runner/read-root-grant.d.ts +1 -1
  299. package/dist/core/runner/read-root-grant.js +2 -1
  300. package/dist/core/runner/resume-admission.d.ts +8 -6
  301. package/dist/core/runner/resume-admission.js +23 -6
  302. package/dist/core/runner/resume-apply.d.ts +4 -0
  303. package/dist/core/runner/resume-apply.js +14 -5
  304. package/dist/core/runner/resume-checkpoint-screen.d.ts +9 -0
  305. package/dist/core/runner/resume-checkpoint-screen.js +4 -84
  306. package/dist/core/runner/resume-claim.d.ts +8 -3
  307. package/dist/core/runner/resume-claim.js +28 -12
  308. package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
  309. package/dist/core/runner/resume-internals-and-config.js +10 -1
  310. package/dist/core/runner/resume-preflight.d.ts +3 -2
  311. package/dist/core/runner/resume-preflight.js +13 -26
  312. package/dist/core/runner/retired-runner-deps.js +2 -0
  313. package/dist/core/runner/run-git-lane.d.ts +2 -0
  314. package/dist/core/runner/run-git-lane.js +6 -2
  315. package/dist/core/runner/run-harness-handlers.d.ts +2 -0
  316. package/dist/core/runner/run-harness-handlers.js +5 -4
  317. package/dist/core/runner/run-identity-wiring.d.ts +2 -2
  318. package/dist/core/runner/run-identity-wiring.js +14 -5
  319. package/dist/core/runner/run-leg.d.ts +3 -3
  320. package/dist/core/runner/run-leg.js +64 -36
  321. package/dist/core/runner/run-notification-lane.js +20 -2
  322. package/dist/core/runner/run-recovery-lanes.js +3 -2
  323. package/dist/core/runner/run-settle-and-teardown.js +12 -9
  324. package/dist/core/runner/run-stop-and-final-verify.js +2 -1
  325. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
  326. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  327. package/dist/core/runner/run-terminal-adoption.js +26 -17
  328. package/dist/core/runner/run-turn-boundary.js +34 -18
  329. package/dist/core/runner/runtask.d.ts +18 -3
  330. package/dist/core/runner/runtask.js +33 -17
  331. package/dist/core/runner/session-rule-policy.d.ts +1 -1
  332. package/dist/core/runner/session-rule-policy.js +6 -1
  333. package/dist/core/runner/shell-env-withheld.d.ts +1 -1
  334. package/dist/core/runner/steering-preview.d.ts +9 -0
  335. package/dist/core/runner/steering-preview.js +5 -0
  336. package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
  337. package/dist/core/runner/stream-halt-verbs.js +4 -3
  338. package/dist/core/runner/stream-reap.d.ts +7 -6
  339. package/dist/core/runner/stream-reap.js +13 -16
  340. package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
  341. package/dist/core/runner/stream-settle-backstop.js +5 -3
  342. package/dist/core/runner/stream-steer-verb.d.ts +5 -2
  343. package/dist/core/runner/stream-steer-verb.js +16 -7
  344. package/dist/core/runner/terminal-account.d.ts +11 -1
  345. package/dist/core/runner/terminal-account.js +20 -0
  346. package/dist/core/runner/terminal-projection.d.ts +8 -2
  347. package/dist/core/runner/terminal-projection.js +2 -2
  348. package/dist/core/runner/tool-disclosure.d.ts +3 -0
  349. package/dist/core/runner/tool-disclosure.js +5 -2
  350. package/dist/core/runner/tool-end-body.d.ts +3 -3
  351. package/dist/core/runner/tool-end-body.js +1 -1
  352. package/dist/core/runner/tool-face-overlay.js +2 -0
  353. package/dist/core/runner/tool-output-projection.d.ts +3 -3
  354. package/dist/core/runner/tool-output-projection.js +7 -6
  355. package/dist/core/runner/tool-table-view.d.ts +56 -0
  356. package/dist/core/runner/tool-table-view.js +51 -0
  357. package/dist/core/runner/turn-attachments.d.ts +8 -2
  358. package/dist/core/runner/turn-attachments.js +2 -2
  359. package/dist/core/runner/void-verifier-pause.d.ts +33 -0
  360. package/dist/core/runner/void-verifier-pause.js +41 -0
  361. package/dist/core/runner-deps.d.ts +26 -27
  362. package/dist/core/secret-env.d.ts +19 -16
  363. package/dist/core/secret-env.js +45 -27
  364. package/dist/core/session-log-transfer.js +9 -10
  365. package/dist/core/session-policy-store.d.ts +1 -1
  366. package/dist/core/session-policy-store.js +5 -2
  367. package/dist/core/session-reconcile.d.ts +3 -2
  368. package/dist/core/session-reconcile.js +7 -4
  369. package/dist/core/session-store.d.ts +3 -1
  370. package/dist/core/session-store.js +10 -8
  371. package/dist/core/session.d.ts +16 -5
  372. package/dist/core/shell-confinement.d.ts +37 -0
  373. package/dist/core/shell-confinement.js +56 -0
  374. package/dist/core/skill-grant.js +1 -1
  375. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +8 -2
  376. package/dist/core/store-contracts/checkpoint-store-contract.js +83 -2
  377. package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
  378. package/dist/core/store-contracts/file-history-store-contract.js +25 -1
  379. package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
  380. package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
  381. package/dist/core/store-contracts/session-store-contract.js +22 -8
  382. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  383. package/dist/core/store-contracts/tool-result-store-contract.js +30 -0
  384. package/dist/core/task-event.d.ts +24 -9
  385. package/dist/core/task-limits.d.ts +5 -0
  386. package/dist/core/task-notification.d.ts +89 -12
  387. package/dist/core/task-notification.js +89 -14
  388. package/dist/core/task-registry-agent.d.ts +32 -50
  389. package/dist/core/task-registry-agent.js +36 -56
  390. package/dist/core/task-registry-monitor.d.ts +1 -1
  391. package/dist/core/task-registry-monitor.js +15 -60
  392. package/dist/core/task-registry-shared.d.ts +22 -112
  393. package/dist/core/task-registry-shared.js +3 -41
  394. package/dist/core/task-registry-workflow.js +5 -21
  395. package/dist/core/task-registry.d.ts +32 -62
  396. package/dist/core/task-registry.js +30 -110
  397. package/dist/core/task-result.d.ts +29 -12
  398. package/dist/core/task-spec-members.d.ts +39 -0
  399. package/dist/core/task-spec-members.js +92 -0
  400. package/dist/core/task-spec.d.ts +11 -11
  401. package/dist/core/task-tool-shape.d.ts +7 -57
  402. package/dist/core/task-tool-shape.js +7 -66
  403. package/dist/core/terminal-cause.d.ts +36 -6
  404. package/dist/core/terminal-cause.js +1 -0
  405. package/dist/core/tool-catalog-entries.js +2 -5
  406. package/dist/core/tool-check-reading.js +16 -10
  407. package/dist/core/tool-conformance.js +1 -2
  408. package/dist/core/tool-errors.d.ts +6 -3
  409. package/dist/core/tool-errors.js +2 -0
  410. package/dist/core/tool-face-reader.js +3 -2
  411. package/dist/core/tool-face.d.ts +8 -5
  412. package/dist/core/tool-face.js +1 -1
  413. package/dist/core/tool-name-aliases.d.ts +5 -29
  414. package/dist/core/tool-name-aliases.js +9 -5
  415. package/dist/core/tool-name-readings.d.ts +14 -3
  416. package/dist/core/tool-name-readings.js +2 -0
  417. package/dist/core/tool-policy.d.ts +109 -18
  418. package/dist/core/tool-policy.js +84 -14
  419. package/dist/core/tool-result-store.d.ts +23 -0
  420. package/dist/core/tool-result-store.js +3 -2
  421. package/dist/core/tool-roster.d.ts +4 -4
  422. package/dist/core/tool-spec.d.ts +23 -6
  423. package/dist/core/trace.d.ts +18 -1
  424. package/dist/core/types.d.ts +1 -1
  425. package/dist/core/types.js +1 -1
  426. package/dist/core/user-attachment.js +26 -21
  427. package/dist/core/workflow-journal-store.d.ts +1 -1
  428. package/dist/core/workflow-run-store.d.ts +2 -0
  429. package/dist/core/workflow-run-store.js +6 -5
  430. package/dist/core/workflow-settled-run.d.ts +5 -0
  431. package/dist/core/workflow-settled-run.js +7 -0
  432. package/dist/engine/execution-env/node-execution-env.d.ts +37 -9
  433. package/dist/engine/execution-env/node-execution-env.js +221 -22
  434. package/dist/engine/harness/agent-harness.d.ts +65 -18
  435. package/dist/engine/harness/agent-harness.js +90 -23
  436. package/dist/engine/harness/messages.d.ts +4 -3
  437. package/dist/engine/harness/messages.js +2 -2
  438. package/dist/engine/harness/types.d.ts +52 -7
  439. package/dist/engine/llm/media-removed.d.ts +14 -0
  440. package/dist/engine/llm/media-removed.js +9 -0
  441. package/dist/engine/llm/rejected-images.d.ts +35 -25
  442. package/dist/engine/llm/rejected-images.js +59 -10
  443. package/dist/engine/llm/types.d.ts +24 -3
  444. package/dist/engine/llm/types.js +7 -3
  445. package/dist/engine/loop/agent-loop.d.ts +6 -1
  446. package/dist/engine/loop/agent-loop.js +20 -11
  447. package/dist/engine/loop/types.d.ts +12 -3
  448. package/dist/engine/session/import-validate.js +7 -0
  449. package/dist/engine/session/parent-chain-guard.d.ts +3 -3
  450. package/dist/engine/session/parent-chain-guard.js +1 -1
  451. package/dist/engine/session/path-to-root.d.ts +18 -3
  452. package/dist/engine/session/path-to-root.js +15 -1
  453. package/dist/engine/session/repo-utils.d.ts +12 -1
  454. package/dist/engine/session/repo-utils.js +41 -0
  455. package/dist/engine/session/session.js +1 -1
  456. package/dist/engine/session/storage-base.d.ts +20 -0
  457. package/dist/engine/session/storage-base.js +28 -9
  458. package/dist/fixtures/index.d.ts +7 -5
  459. package/dist/fixtures/index.js +5 -3
  460. package/dist/index.d.ts +29 -18
  461. package/dist/index.js +19 -11
  462. package/dist/internal/harness-types.d.ts +2 -0
  463. package/dist/internal/harness.d.ts +4 -3
  464. package/dist/internal/harness.js +3 -2
  465. package/dist/internal/llm.d.ts +2 -1
  466. package/dist/internal/llm.js +1 -0
  467. package/dist/orchestration/goal.d.ts +6 -2
  468. package/dist/orchestration/goal.js +6 -3
  469. package/dist/orchestration/run-workflow-tool.d.ts +14 -17
  470. package/dist/orchestration/run-workflow-tool.js +43 -50
  471. package/dist/orchestration/workflow-types.d.ts +2 -2
  472. package/dist/orchestration/workflow.d.ts +7 -0
  473. package/dist/orchestration/workflow.js +10 -12
  474. package/dist/stores/file/background-agent-store.js +18 -15
  475. package/dist/stores/file/checkpoint-store.d.ts +2 -0
  476. package/dist/stores/file/checkpoint-store.js +13 -9
  477. package/dist/stores/file/file-history-store.js +3 -2
  478. package/dist/stores/file/fs-atomic.d.ts +0 -22
  479. package/dist/stores/file/fs-atomic.js +0 -17
  480. package/dist/stores/file/index.d.ts +7 -12
  481. package/dist/stores/file/index.js +25 -12
  482. package/dist/stores/file/ledger-tuning.d.ts +23 -0
  483. package/dist/stores/file/ledger-tuning.js +21 -0
  484. package/dist/stores/file/mailbox-store.js +42 -22
  485. package/dist/stores/file/memory-store.js +3 -2
  486. package/dist/stores/file/permission-rule-adopt.js +24 -21
  487. package/dist/stores/file/permission-rule-store.js +6 -3
  488. package/dist/stores/file/session-policy-store.js +3 -2
  489. package/dist/stores/file/session-store.d.ts +26 -7
  490. package/dist/stores/file/session-store.js +59 -35
  491. package/dist/stores/file/tool-result-store.d.ts +11 -0
  492. package/dist/stores/file/tool-result-store.js +57 -3
  493. package/dist/stores/file/usage-window-store.js +3 -2
  494. package/dist/stores/file/workflow-journal-store.d.ts +0 -2
  495. package/dist/stores/file/workflow-journal-store.js +3 -18
  496. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  497. package/dist/stores/file/workflow-run-store.js +15 -10
  498. package/dist/tools/fs/bash-program-position.d.ts +3 -2
  499. package/dist/tools/fs/bash-program-position.js +7 -7
  500. package/dist/tools/fs/dead-cwd.d.ts +5 -5
  501. package/dist/tools/fs/dead-cwd.js +4 -11
  502. package/dist/tools/fs/fs-bash-background-text.d.ts +6 -0
  503. package/dist/tools/fs/fs-bash-background-text.js +6 -0
  504. package/dist/tools/fs/fs-bash.d.ts +3 -18
  505. package/dist/tools/fs/fs-bash.js +37 -124
  506. package/dist/tools/fs/fs-pdf.js +8 -6
  507. package/dist/tools/fs/fs-read.js +2 -2
  508. package/dist/tools/fs/fs-shared.d.ts +28 -3
  509. package/dist/tools/fs/fs-shared.js +15 -0
  510. package/dist/tools/fs/index.d.ts +1 -1
  511. package/dist/tools/fs/index.js +4 -14
  512. package/dist/tools/fs/pdf.d.ts +4 -4
  513. package/dist/tools/fs/pdf.js +6 -6
  514. package/dist/tools/fs/read-deny-home.js +8 -1
  515. package/dist/tools/fs/read-deny.d.ts +26 -2
  516. package/dist/tools/fs/read-deny.js +9 -2
  517. package/dist/tools/fs/read-floor.d.ts +13 -5
  518. package/dist/tools/fs/read-floor.js +206 -2
  519. package/dist/tools/fs/removal-targets.js +2 -2
  520. package/dist/tools/fs/search.d.ts +3 -2
  521. package/dist/tools/fs/search.js +6 -6
  522. package/dist/tools/fs/shell-read-argv.d.ts +4 -2
  523. package/dist/tools/fs/shell-read-argv.js +14 -3
  524. package/dist/tools/fs/shell-read-bindings.d.ts +18 -2
  525. package/dist/tools/fs/shell-read-bindings.js +148 -68
  526. package/dist/tools/fs/shell-read-check.js +20 -4
  527. package/dist/tools/fs/shell-read-establish.js +25 -9
  528. package/dist/tools/fs/shell-read-functions.js +2 -2
  529. package/dist/tools/fs/shell-read-identity.d.ts +3 -1
  530. package/dist/tools/fs/shell-read-identity.js +4 -2
  531. package/dist/tools/fs/shell-read-judge.d.ts +7 -1
  532. package/dist/tools/fs/shell-read-judge.js +1 -1
  533. package/dist/tools/fs/shell-read-object-path.d.ts +59 -0
  534. package/dist/tools/fs/shell-read-object-path.js +119 -0
  535. package/dist/tools/fs/shell-read-plan.d.ts +8 -0
  536. package/dist/tools/fs/shell-read-plan.js +47 -30
  537. package/dist/tools/fs/shell-read-start.d.ts +66 -13
  538. package/dist/tools/fs/shell-read-start.js +89 -17
  539. package/dist/tools/fs/shell-read-workdir.d.ts +29 -8
  540. package/dist/tools/fs/shell-read-workdir.js +31 -8
  541. package/dist/tools/monitor.d.ts +8 -7
  542. package/dist/tools/monitor.js +12 -10
  543. package/dist/tools/worktree.d.ts +5 -1
  544. package/dist/tools/worktree.js +20 -17
  545. package/package.json +6 -3
  546. package/test/export-surface.snapshot.json +112 -42
  547. package/wire-changes/core-stores-sql@7.61.0.json +480 -0
  548. package/wire-changes/core-stores-sql@7.62.0.json +30 -0
  549. package/wire-changes/core@7.61.0.json +4405 -0
  550. package/wire-changes/core@7.62.0.json +2181 -0
  551. package/wire-changes/mods-kernel@7.61.0.json +65 -0
  552. package/wire-changes/mods-kernel@7.62.0.json +42 -0
  553. package/wire-changes/primitives@7.61.0.json +30 -0
  554. package/wire-changes/primitives@7.62.0.json +30 -0
  555. package/dist/core/consolidate-scope.d.ts +0 -93
  556. package/dist/core/consolidate-scope.js +0 -98
  557. package/dist/core/runner/image-removed-seat.d.ts +0 -12
  558. package/dist/core/runner/image-removed-seat.js +0 -19
  559. package/dist/core/runner/memory-consolidation.d.ts +0 -109
  560. package/dist/core/runner/memory-consolidation.js +0 -251
@@ -6,8 +6,9 @@ import type { HaltRemainingDirective } from "../loop/types.js";
6
6
  import type { AgentMessage, AgentTool, AgentToolCall, LoopMalformedToolUseRecovery, LoopThinkingOnlyRecovery, LoopTruncatedOutputRecovery, QueueMode, ThinkingLevel } from "../loop/types.js";
7
7
  import { type EngineSegment } from "../../core/untrusted-text.js";
8
8
  import { type RunOrigin } from "../../core/run-origin.js";
9
+ import { type InputAuthor } from "../../core/input-author.js";
9
10
  import type { CommittedFrameCarrier } from "../../core/frame-settlement.js";
10
- import type { AbortResult, AgentHarnessEvent, AgentHarnessEventResultMap, AgentHarnessOptions, AgentHarnessOwnEvent, AgentHarnessResources, AgentHarnessStreamOptions, ExecutionEnv, PromptTemplate, Skill } from "./types.js";
11
+ import type { AbortResult, AgentHarnessEvent, AgentHarnessEventResultMap, AgentHarnessOptions, AgentHarnessOwnEvent, AgentHarnessResources, AgentHarnessStreamOptions, ExecutionEnv, PendingSessionWrite, PromptTemplate, RowRaising, Skill } from "./types.js";
11
12
  /** [c209-C] 收口 C1/C2 — engine-provenance metadata a caller can stamp on the user message it
12
13
  * mints (see the field docs on {@link UserMessage}). Threaded from `prompt`/`steer`/`followUp`/
13
14
  * `nextTurn` options into the persisted message so derived views (auto-mode window, compaction
@@ -51,6 +52,12 @@ export interface TrailingMessageSeed {
51
52
  export interface PromptTrailing {
52
53
  trailing?: readonly TrailingMessageSeed[];
53
54
  }
55
+ /** `prompt()` option: the prompt RECORDS a decision that ended the turn awaiting the user (a person's bare refusal) and
56
+ * owes no model turn — what joins it at turn open (engine notes only) rides along unanswered, the steer / follow-up
57
+ * drain points still continue the run, and an ending with no new answer answers with the last assistant message. */
58
+ export interface PromptEndsAwaitingUser {
59
+ endsAwaitingUser?: true;
60
+ }
54
61
  export interface UserMessageProvenance {
55
62
  /** Exact char length of the engine-prepended prefix on `text` (first-frame reminders etc.).
56
63
  * Sugar for the single segment `[0, chars)` — when `engineSegments` is also supplied, segments win. */
@@ -65,13 +72,14 @@ export interface UserMessageProvenance {
65
72
  /** [c209-C] R3: engine-injected note whose content must stay VISIBLE in derived views (diagnostics,
66
73
  * task notifications, steering, recall) but never under user authority — see UserMessage.provenance. */
67
74
  provenance?: "engine-note";
68
- /** The frame's CONTENT is caller/supervisor speech relayed by the engine (a TaskStream steer), not
69
- * engine-authored guidance. Rides only WITH `provenance:"engine-note"` (the projection semantics are
70
- * identical — visible, never `[user]` authority); what it changes is the run-control judgment: the
71
- * human-halt hold below treats a caller-authored frame as USER-provenance input (always passes),
72
- * while an engine-authored one is held. Minter-stated at the single relay seam that mints such
73
- * frames — never inferred from text. Metadata only; not persisted on the message. */
74
- callerAuthored?: true;
75
+ /** Who wrote the input this frame's CONTENT is ({@link InputAuthor}) — an input relayed by the engine (a TaskStream steer, the
76
+ * observer's report), not engine-authored guidance. Rides only WITH `provenance:"engine-note"` (the projection semantics are
77
+ * identical — visible, never `[user]` authority); what it changes is the run-control judgment: the human-halt hold below
78
+ * treats an authored frame as input (always passes) while an engine-authored one is held, and only a frame whose author
79
+ * counts as the operator's (`countsAsOperator`) is the person's input — parkable across a pause, on the undelivered-input
80
+ * account. Minter-stated at the single relay seam that mints such frames — never inferred from text. Metadata only; not
81
+ * persisted on the message. */
82
+ author?: InputAuthor;
75
83
  /** #1036 — the frame's injection-queue dedup key, persisted on the message it becomes
76
84
  * ({@link UserMessage.engineNoteKey}) so a reader of the TRANSCRIPT alone can join an entry back
77
85
  * to its frame. Rides only WITH `provenance:"engine-note"`. */
@@ -155,6 +163,14 @@ export interface HarnessLoopRecovery {
155
163
  withholdErrorEvents?: boolean;
156
164
  };
157
165
  }
166
+ /** How a durable park's commit ended, for the rows its gate took off the port ({@link AgentHarness.parkCapture}): the row
167
+ * holds them (`committed`), no row was written (`absent`), or whether one was is unknown (`indeterminate`). */
168
+ type ParkCaptureOutcome = "committed" | "absent" | "indeterminate";
169
+ /** 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. */
170
+ interface ParkCapture {
171
+ readonly rows: readonly AgentMessage[];
172
+ settle(outcome: ParkCaptureOutcome): void;
173
+ }
158
174
  export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate extends PromptTemplate = PromptTemplate, TTool extends AgentTool = AgentTool> {
159
175
  readonly env: ExecutionEnv;
160
176
  private session;
@@ -179,7 +195,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
179
195
  * per turn, so identity carries the generation); the loop's cut-consumption report is accepted for THIS seat only. */
180
196
  private lastPublishedSeat?;
181
197
  private readonly seatCutSources;
182
- private trailingBatchEndedOn?;
198
+ private endedOnPriorAnswer;
183
199
  private promptReceipt?;
184
200
  private turnCutConsumed?;
185
201
  private readonly committedEntryIds;
@@ -204,6 +220,10 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
204
220
  private runAbortController?;
205
221
  private runPromise?;
206
222
  private pendingSessionWrites;
223
+ /** A park's capture of the port's held rows, from the gate's snapshot until its commit settles: the port waits on it. */
224
+ private parkCaptureInFlight?;
225
+ /** 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). */
226
+ private parkedPortClosed;
207
227
  private model;
208
228
  /** The ref that chose {@link model}, moved by the SAME assignment (one value, never two answers). */
209
229
  private modelRef;
@@ -215,10 +235,16 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
215
235
  * with every request view that needed one (the transcript is never rewritten, so a broken turn is repaired, and
216
236
  * reported, on each request; the sink owns its dedup). Advisory: a throwing sink never breaks the request. */
217
237
  onToolTurnRepaired?: (repairs: readonly ToolTurnRepair[]) => void;
218
- /** Runner-set sink for the images a provider refused in THIS run ({@link removeRejectedImages}) — a refusal recorded
238
+ /** Runner-set sink for the images a provider refused in THIS run ({@link removeRefusedRequestParts}) — a refusal recorded
219
239
  * before the run began is not reported. Every request re-reads the transcript, so the sink owns its dedup (by
220
240
  * `refusalAt`). Advisory: a throwing sink never breaks the request. */
221
241
  onImagesRemoved?: (removals: readonly RejectedImageRemoval[]) => void;
242
+ /** Runner-set sink for a tool whose input schema a provider refused in THIS run, told when the loop re-sends the turn
243
+ * without it (the loop config's `onToolSchemaRefused`). Advisory: a throwing sink never breaks the re-send. */
244
+ onToolSchemaRefused?: (refusal: {
245
+ tool: string;
246
+ refusalAt: number;
247
+ }) => void;
222
248
  /** The image refusals standing in the transcript when the current run began, by their identity
223
249
  * ({@link RejectedImageRemoval.refusalAt}): the run that met them announced them. */
224
250
  private priorImageRefusals?;
@@ -241,6 +267,10 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
241
267
  steer: readonly unknown[];
242
268
  followUp: readonly unknown[];
243
269
  }) => void;
270
+ /** The same terminal moment's inputs that are NOT the operator's ({@link UserMessageProvenance.author} outside
271
+ * `countsAsOperator`, e.g. an observer's report): never parked and never on the account above, they end with the run;
272
+ * handed over by author, in service order, so the runner can say once that they were dropped. */
273
+ onUndrainedOtherInputs?: (authors: readonly InputAuthor[]) => void;
244
274
  /** design/176 — runner-set sink fired at the CONSUMPTION boundary, once per engine-note payload,
245
275
  * in consumption order (steer/followUp drain and the turn-open nextTurn splice — the two points
246
276
  * where a queued frame actually enters the model's input). The runner uses it to record the
@@ -276,7 +306,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
276
306
  * minted it. */
277
307
  engineInjectionsHeld?: () => boolean;
278
308
  /** The provider boundary's tool-turn law: the repaired view goes to the brain, the repairs to the runner's sink. */
279
- /** The request view of `messages` under the provider's image refusals they hold ({@link removeRejectedImages}), and
309
+ /** The request view of `messages` under the provider's image refusals they hold ({@link removeRefusedRequestParts}), and
280
310
  * the removals this run met handed to {@link onImagesRemoved}. */
281
311
  private imageRefusalView;
282
312
  private holdToolTurnLaw;
@@ -294,9 +324,9 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
294
324
  private sweepUndrainedEngineNotes;
295
325
  /**
296
326
  * How much of a PERSON's input is currently accepted-but-unserved, per lane — the one predicate behind
297
- * both readers below, so "a person's input is waiting" cannot come to mean two things. Engine-AUTHORED
298
- * frames are excluded, and the IN-FLIGHT slot counts (a frame spliced out of a queue and never injected
299
- * is as pending as one that never left it).
327
+ * both readers below, so "a person's input is waiting" cannot come to mean two things. Only the operator's
328
+ * input counts ({@link isOperatorInput}: engine-AUTHORED frames and inputs another author wrote are out), and the
329
+ * IN-FLIGHT slot counts (a frame spliced out of a queue and never injected is as pending as one that never left it).
300
330
  */
301
331
  private pendingUserInputFramesByLane;
302
332
  private pendingUserInputsByLane;
@@ -336,6 +366,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
336
366
  private stallTimeoutsPerCall?;
337
367
  private abortResultDetails?;
338
368
  private executeTool?;
369
+ private admitRows;
339
370
  private activeRun?;
340
371
  private loopTrace?;
341
372
  private onToolInputValidationFault?;
@@ -436,7 +467,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
436
467
  images?: ImageContent[];
437
468
  settleUnansweredToolCalls?: TrailingToolBatchOptions;
438
469
  onCommitted?: PromptCommittedCallback;
439
- } & UserMessageProvenance & PromptTrailing): Promise<AssistantMessage | undefined>;
470
+ } & UserMessageProvenance & PromptTrailing & PromptEndsAwaitingUser): Promise<AssistantMessage | undefined>;
440
471
  /** R2-③: an empty/whitespace-only injection with no images carries ZERO information — it
441
472
  * must not mint a user frame (strict endpoints reject empty user content, and an empty follow-up would
442
473
  * pointlessly extend the run by one turn). No-op, not a throw: injection callers are fire-and-
@@ -577,7 +608,11 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
577
608
  nextTurn(text: string, options?: {
578
609
  images?: ImageContent[];
579
610
  } & UserMessageProvenance): Promise<void>;
580
- appendMessage(message: AgentMessage): Promise<void>;
611
+ /** The admission seat first (a raised row carries its `raising`; one the seat does not keep is not stored), then the store:
612
+ * at once when no turn runs and nothing is held before it, else queued for the next serialization point. A park's capture
613
+ * in progress is waited out; once a park took (or may have taken) the held rows, the row is refused — no running loop
614
+ * takes it. */
615
+ appendMessage(message: AgentMessage, raising?: RowRaising): Promise<void>;
581
616
  /** The loop's `afterToolCall`: one `tool_result` hook emit per executed call (every registered handler, one fold). */
582
617
  private afterToolCallHook;
583
618
  /**
@@ -639,6 +674,16 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
639
674
  * the queue is empty.
640
675
  */
641
676
  flushQueuedSessionWrites(): Promise<void>;
677
+ /**
678
+ * A durable park's gate takes the rows the port holds (non-destructive, in queue order) to write them on its checkpoint;
679
+ * until {@link ParkCapture.settle} the port waits. `committed` takes them off the queue (the resumed leg writes them) and
680
+ * closes the port; `indeterminate` closes the port and leaves them queued (this leg's own branch gets them if its
681
+ * transcript is closed again); `absent` changes nothing. Only rows are held at a park: the other queued writes come from
682
+ * turn ends, which flush before any park point.
683
+ */
684
+ parkCapture(): ParkCapture;
685
+ /** The session writes still held (queue order) — what an interrupted run whose batch stayed open cannot write. */
686
+ heldSessionWrites(): readonly PendingSessionWrite[];
642
687
  /**
643
688
  * backlog #389 — the accepted-but-undelivered CALLER frames a durable suspend can carry forward,
644
689
  * in delivery order (steer before followUp, each queue forward — the order the live loop serves).
@@ -646,8 +691,9 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
646
691
  * for a checkpoint that never landed would be lost twice over. {@link dropParkedUserInputs} is the
647
692
  * second half, called only once the checkpoint is durably committed.
648
693
  *
649
- * Only frames carrying a park record are returned — engine-authored notes have their own lossless
650
- * lane (`onUndrainedEngineNotes` → pend per session) and must not be parked twice.
694
+ * Only the operator's frames carrying a park record are returned ({@link isOperatorInput}) — engine-authored notes have
695
+ * their own lossless lane (`onUndrainedEngineNotes` → pend per session) and must not be parked twice, and an input another
696
+ * author wrote is not the person's to carry (it ends with the run, named through `onUndrainedOtherInputs`).
651
697
  */
652
698
  readParkableUserInputs(): unknown[];
653
699
  /**
@@ -704,3 +750,4 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
704
750
  type: TType;
705
751
  }>) => Promise<AgentHarnessEventResultMap[TType]> | AgentHarnessEventResultMap[TType]): () => void;
706
752
  }
753
+ export {};
@@ -1,10 +1,11 @@
1
1
  import { createAssistantMessageEventStream, ensureToolTurnInvariants, findToolByName, snapshotActorAssertion, stripEngineMetadata, userAttachmentOf } from "../llm/index.js";
2
- import { imageRefusalAt, isImageRefusal, removeRejectedImages } from "../llm/rejected-images.js";
3
- import { finalizeToolOutcome, isBatchSafeToolCall, runAgentLoop, runToolCall } from "../loop/agent-loop.js";
2
+ import { imageRefusalAt, isImageRefusal, removeRefusedRequestParts } from "../llm/rejected-images.js";
3
+ import { finalizeToolOutcome, findUnansweredToolBatch, isBatchSafeToolCall, runAgentLoop, runToolCall } from "../loop/agent-loop.js";
4
4
  import { resolveAgentCoreStreamFn } from "../loop/runtime-deps.js";
5
5
  import { normalizeEngineSegments } from "../../core/untrusted-text.js";
6
6
  import { isCredentialHeaderName } from "../../core/secret-env.js";
7
7
  import { isRunOrigin } from "../../core/run-origin.js";
8
+ import { countsAsOperator, readInputAuthor } from "../../core/input-author.js";
8
9
  import { isProviderEchoShape } from "../../brain/errors.js";
9
10
  import { convertToLlm } from "./messages.js";
10
11
  import { readMember, thrownText } from "../../core/thrown-value.js";
@@ -47,6 +48,10 @@ function createTrailingMessage(seed) {
47
48
  }
48
49
  const engineNotePayloads = new WeakMap();
49
50
  const engineAuthoredInjections = new WeakSet();
51
+ const inputAuthors = new WeakMap();
52
+ function isOperatorInput(m) {
53
+ return !engineAuthoredInjections.has(m) && countsAsOperator(readInputAuthor(inputAuthors.get(m)));
54
+ }
50
55
  function isEngineAdvisory(m) {
51
56
  return engineAuthoredInjections.has(m) && !engineNotePayloads.has(m);
52
57
  }
@@ -59,7 +64,7 @@ function isEngineAuthoredInjection(options) {
59
64
  return false;
60
65
  if (options.engineMinted === true || options.enginePayload !== undefined)
61
66
  return true;
62
- return options.provenance === "engine-note" && options.callerAuthored !== true;
67
+ return options.provenance === "engine-note" && options.author === undefined;
63
68
  }
64
69
  const ENGINE_NOTE_STEER_BACKLOG_CAP = 50;
65
70
  function createFailureMessage(model, error, aborted) {
@@ -196,6 +201,7 @@ function normalizeHarnessError(error, fallbackCode) {
196
201
  function normalizeHookError(error) {
197
202
  return normalizeHarnessError(error, "hook");
198
203
  }
204
+ const PORT_PARKED_REFUSAL = "$.session.append: refused: the leg parked durably — the conversation it resumes is its checkpoint's";
199
205
  export class AgentHarness {
200
206
  env;
201
207
  session;
@@ -210,7 +216,7 @@ export class AgentHarness {
210
216
  boundaryStopConsumed;
211
217
  lastPublishedSeat;
212
218
  seatCutSources = new WeakMap();
213
- trailingBatchEndedOn;
219
+ endedOnPriorAnswer = false;
214
220
  promptReceipt;
215
221
  turnCutConsumed;
216
222
  committedEntryIds = new WeakMap();
@@ -220,21 +226,25 @@ export class AgentHarness {
220
226
  runAbortController;
221
227
  runPromise;
222
228
  pendingSessionWrites = [];
229
+ parkCaptureInFlight;
230
+ parkedPortClosed = false;
223
231
  model;
224
232
  modelRef;
225
233
  thinkingLevel;
226
234
  onUndrainedEngineNotes;
227
235
  onToolTurnRepaired;
228
236
  onImagesRemoved;
237
+ onToolSchemaRefused;
229
238
  priorImageRefusals;
230
239
  runHistory;
231
240
  onUndrainedUserInputs;
241
+ onUndrainedOtherInputs;
232
242
  onEngineNoteConsumed;
233
243
  onUserInputConsumed;
234
244
  onFrameCommitted;
235
245
  engineInjectionsHeld;
236
246
  imageRefusalView(messages) {
237
- const view = removeRejectedImages(messages);
247
+ const view = removeRefusedRequestParts(messages);
238
248
  const met = view.removals.filter((r) => this.priorImageRefusals?.has(r.refusalAt) !== true);
239
249
  if (met.length > 0) {
240
250
  try {
@@ -280,10 +290,10 @@ export class AgentHarness {
280
290
  }
281
291
  }
282
292
  pendingUserInputFramesByLane() {
283
- const inFlight = (lane) => this.drainedPendingInjection.filter((m) => !engineAuthoredInjections.has(m) && drainedFromLane.get(m) === lane);
293
+ const inFlight = (lane) => this.drainedPendingInjection.filter((m) => isOperatorInput(m) && drainedFromLane.get(m) === lane);
284
294
  return {
285
- steer: [...inFlight("steer"), ...this.steerQueue.filter((m) => !engineAuthoredInjections.has(m))],
286
- followUp: [...inFlight("followUp"), ...this.followUpQueue.filter((m) => !engineAuthoredInjections.has(m))],
295
+ steer: [...inFlight("steer"), ...this.steerQueue.filter((m) => isOperatorInput(m))],
296
+ followUp: [...inFlight("followUp"), ...this.followUpQueue.filter((m) => isOperatorInput(m))],
287
297
  };
288
298
  }
289
299
  pendingUserInputsByLane() {
@@ -309,6 +319,14 @@ export class AgentHarness {
309
319
  catch {
310
320
  }
311
321
  }
322
+ const others = [this.drainedPendingInjection, this.steerQueue, this.followUpQueue].flatMap((q) => q.flatMap((m) => (engineAuthoredInjections.has(m) || isOperatorInput(m) ? [] : [inputAuthors.get(m)])));
323
+ if (others.length > 0 && this.onUndrainedOtherInputs) {
324
+ try {
325
+ this.onUndrainedOtherInputs(others);
326
+ }
327
+ catch {
328
+ }
329
+ }
312
330
  return counts;
313
331
  }
314
332
  systemPrompt;
@@ -326,6 +344,7 @@ export class AgentHarness {
326
344
  stallTimeoutsPerCall;
327
345
  abortResultDetails;
328
346
  executeTool;
347
+ admitRows;
329
348
  activeRun;
330
349
  loopTrace;
331
350
  onToolInputValidationFault;
@@ -364,6 +383,8 @@ export class AgentHarness {
364
383
  this.stallTimeoutsPerCall = options.stallTimeoutsPerCall;
365
384
  this.abortResultDetails = options.abortResultDetails;
366
385
  this.executeTool = options.executeTool;
386
+ this.admitRows = options.admitRows ?? (async (rows) => rows);
387
+ this.pendingSessionWrites = (options.heldWrites ?? []).map((message) => ({ type: "message", message }));
367
388
  this.loopTrace = options.loopTrace;
368
389
  this.onToolInputValidationFault = options.onToolInputValidationFault;
369
390
  this.toolResultMedia = {
@@ -689,6 +710,7 @@ export class AgentHarness {
689
710
  ...(this.abortResultDetails !== undefined ? { abortResultDetails: this.abortResultDetails } : {}),
690
711
  ...(this.executeTool !== undefined ? { executeTool: this.executeTool } : {}),
691
712
  ...(this.onToolInputValidationFault !== undefined ? { onToolInputValidationFault: this.onToolInputValidationFault } : {}),
713
+ onToolSchemaRefused: (refusal) => this.onToolSchemaRefused?.(refusal),
692
714
  ...this.toolResultMedia,
693
715
  ...(this.resilience !== undefined ? { resilience: this.resilience } : {}),
694
716
  ...(this.maxToolConcurrency !== undefined ? { maxToolConcurrency: this.maxToolConcurrency } : {}),
@@ -820,8 +842,7 @@ export class AgentHarness {
820
842
  if (this.runAbortController?.signal.aborted) {
821
843
  return;
822
844
  }
823
- while (this.pendingSessionWrites.length > 0) {
824
- const write = this.pendingSessionWrites[0];
845
+ for (let write = this.pendingSessionWrites[0]; write !== undefined; write = this.pendingSessionWrites[0]) {
825
846
  if (write.type === "message") {
826
847
  await this.session.appendMessage(write.message);
827
848
  }
@@ -835,7 +856,9 @@ export class AgentHarness {
835
856
  const unreachable = write;
836
857
  throw new AgentHarnessError("invalid_argument", `flushPendingSessionWrites: unhandled queued write type ${unreachable.type}`);
837
858
  }
838
- this.pendingSessionWrites.shift();
859
+ const at = this.pendingSessionWrites.indexOf(write);
860
+ if (at >= 0)
861
+ this.pendingSessionWrites.splice(at, 1);
839
862
  }
840
863
  }
841
864
  async recordApiFailure(failure) {
@@ -843,6 +866,7 @@ export class AgentHarness {
843
866
  const apiErrorStatus = readMember(failure, "apiErrorStatus");
844
867
  const requestId = readMember(failure, "requestId");
845
868
  const errorKind = readMember(failure, "errorKind");
869
+ const refusedTool = readMember(failure, "refusedTool");
846
870
  const raw = typeof errorMessage === "string" ? errorMessage.trim() : undefined;
847
871
  const detail = raw !== undefined && raw.length > API_FAILURE_RECORD_MAX_CHARS
848
872
  ? `${raw.slice(0, API_FAILURE_RECORD_MAX_CHARS)}… (truncated)`
@@ -861,9 +885,11 @@ export class AgentHarness {
861
885
  stopReason: "error",
862
886
  ...(typeof errorMessage === "string" ? { errorMessage } : {}),
863
887
  ...(errorKind === "length_empty" || errorKind === "degenerate" || errorKind === "input_too_long" || errorKind === "image_unprocessable" ? { errorKind } : {}),
888
+ ...(errorKind === "tool_schema_refused" && typeof refusedTool === "string" ? { errorKind, refusedTool } : {}),
864
889
  timestamp: failure.timestamp,
865
890
  };
866
891
  try {
892
+ await this.admitRows([record]);
867
893
  await this.session.appendMessage(record);
868
894
  }
869
895
  catch {
@@ -873,6 +899,7 @@ export class AgentHarness {
873
899
  if (event.type === "message_end") {
874
900
  let entryId;
875
901
  if (!isEmptyFailureAssistant(event.message)) {
902
+ await this.admitRows([event.message]);
876
903
  entryId = await this.session.appendMessage(event.message);
877
904
  this.committedEntryIds.set(event.message, entryId);
878
905
  this.settleInjectedFrame(event.message, entryId);
@@ -1003,11 +1030,12 @@ export class AgentHarness {
1003
1030
  ...(options.settleUnansweredToolCalls.halt !== undefined ? { halt: options.settleUnansweredToolCalls.halt } : {}),
1004
1031
  report: (outcome) => {
1005
1032
  if (outcome.aborted)
1006
- this.trailingBatchEndedOn = outcome.assistantMessage;
1033
+ this.endedOnPriorAnswer = true;
1007
1034
  },
1008
1035
  },
1009
1036
  }
1010
1037
  : {}),
1038
+ ...(options?.endsAwaitingUser === true ? { endsAwaitingUser: true } : {}),
1011
1039
  });
1012
1040
  }
1013
1041
  catch (error) {
@@ -1031,8 +1059,13 @@ export class AgentHarness {
1031
1059
  }
1032
1060
  if (this.stopRequested || abortController.signal.aborted)
1033
1061
  return undefined;
1034
- if (this.trailingBatchEndedOn !== undefined)
1035
- return this.answeredFrom(this.trailingBatchEndedOn, [this.trailingBatchEndedOn]);
1062
+ if (this.endedOnPriorAnswer || options?.endsAwaitingUser === true) {
1063
+ const prior = turnState.messages.findLast((m) => m.role === "assistant");
1064
+ if (prior !== undefined)
1065
+ return this.answeredFrom(prior, [prior]);
1066
+ if (options?.endsAwaitingUser === true)
1067
+ return undefined;
1068
+ }
1036
1069
  throw new AgentHarnessError("invalid_state", "AgentHarness prompt completed without an assistant message");
1037
1070
  }
1038
1071
  finally {
@@ -1051,7 +1084,7 @@ export class AgentHarness {
1051
1084
  if (this.phase !== "idle") {
1052
1085
  throw new AgentHarnessError("busy", "AgentHarness is busy");
1053
1086
  }
1054
- this.trailingBatchEndedOn = undefined;
1087
+ this.endedOnPriorAnswer = false;
1055
1088
  this.stopRequestSources.clear();
1056
1089
  this.boundaryStopConsumed = undefined;
1057
1090
  this.turnCutConsumed = undefined;
@@ -1074,7 +1107,8 @@ export class AgentHarness {
1074
1107
  this.runAbortController = abortController;
1075
1108
  const finishRunPromise = this.startRunPromise();
1076
1109
  try {
1077
- await this.flushPendingSessionWrites();
1110
+ if (this.pendingSessionWrites.length > 0 && findUnansweredToolBatch((await this.session.buildContext()).messages) === undefined)
1111
+ await this.flushPendingSessionWrites();
1078
1112
  const turnState = await this.createTurnState();
1079
1113
  return await this.executeTurn(turnState, text, options, abortController);
1080
1114
  }
@@ -1109,6 +1143,8 @@ export class AgentHarness {
1109
1143
  engineNotePayloads.set(m, options.enginePayload);
1110
1144
  if (isEngineAuthoredInjection(options))
1111
1145
  engineAuthoredInjections.add(m);
1146
+ if (options?.author !== undefined)
1147
+ inputAuthors.set(m, options.author);
1112
1148
  if (options?.parkRecord !== undefined)
1113
1149
  userInputParkRecords.set(m, options.parkRecord);
1114
1150
  if (options?.immediate === true)
@@ -1285,9 +1321,16 @@ export class AgentHarness {
1285
1321
  async nextTurn(text, options) {
1286
1322
  await this.enqueueInjection(this.nextTurnQueue, text, options);
1287
1323
  }
1288
- async appendMessage(message) {
1324
+ async appendMessage(message, raising) {
1325
+ const kept = await this.admitRows([message], raising);
1326
+ if (!kept.includes(message))
1327
+ return;
1328
+ while (this.parkCaptureInFlight !== undefined)
1329
+ await this.parkCaptureInFlight;
1330
+ if (this.parkedPortClosed)
1331
+ throw new AgentHarnessError("invalid_state", PORT_PARKED_REFUSAL);
1289
1332
  try {
1290
- if (this.phase === "idle") {
1333
+ if (this.phase === "idle" && this.pendingSessionWrites.length === 0) {
1291
1334
  await this.session.appendMessage(message);
1292
1335
  }
1293
1336
  else {
@@ -1449,12 +1492,39 @@ export class AgentHarness {
1449
1492
  throw normalizeHarnessError(error, "session");
1450
1493
  }
1451
1494
  }
1495
+ parkCapture() {
1496
+ if (this.parkCaptureInFlight !== undefined)
1497
+ throw new AgentHarnessError("invalid_state", "a park's capture of the held rows is already in progress");
1498
+ const rows = this.pendingSessionWrites.flatMap((write) => (write.type === "message" ? [write.message] : []));
1499
+ let release = () => undefined;
1500
+ this.parkCaptureInFlight = new Promise((resolve) => (release = resolve));
1501
+ let settled = false;
1502
+ return {
1503
+ rows,
1504
+ settle: (outcome) => {
1505
+ if (settled)
1506
+ return;
1507
+ settled = true;
1508
+ if (outcome === "committed") {
1509
+ const taken = new Set(rows);
1510
+ this.pendingSessionWrites = this.pendingSessionWrites.filter((write) => write.type !== "message" || !taken.has(write.message));
1511
+ }
1512
+ if (outcome !== "absent")
1513
+ this.parkedPortClosed = true;
1514
+ this.parkCaptureInFlight = undefined;
1515
+ release();
1516
+ },
1517
+ };
1518
+ }
1519
+ heldSessionWrites() {
1520
+ return [...this.pendingSessionWrites];
1521
+ }
1452
1522
  readParkableUserInputs() {
1453
1523
  const out = [];
1454
1524
  for (const q of [this.drainedPendingInjection, this.steerQueue, this.followUpQueue]) {
1455
1525
  for (const m of q) {
1456
1526
  const record = userInputParkRecords.get(m);
1457
- if (record !== undefined)
1527
+ if (record !== undefined && isOperatorInput(m))
1458
1528
  out.push(record);
1459
1529
  }
1460
1530
  }
@@ -1501,10 +1571,7 @@ export class AgentHarness {
1501
1571
  errors.push(toError(error));
1502
1572
  }
1503
1573
  this.sweepUndrainedEngineNotes([this.drainedPendingInjection, this.nextTurnQueue, this.steerQueue, this.followUpQueue]);
1504
- const userAuthored = (m) => !engineAuthoredInjections.has(m);
1505
- const inFlightOf = (lane) => this.drainedPendingInjection.filter((m) => userAuthored(m) && drainedFromLane.get(m) === lane);
1506
- const undrainedSteer = [...inFlightOf("steer"), ...this.steerQueue.filter(userAuthored)];
1507
- const undrainedFollowUp = [...inFlightOf("followUp"), ...this.followUpQueue.filter(userAuthored)];
1574
+ const { steer: undrainedSteer, followUp: undrainedFollowUp } = this.pendingUserInputFramesByLane();
1508
1575
  try {
1509
1576
  await this.emitOwn({ type: "abort", undrainedSteer, undrainedFollowUp });
1510
1577
  }
@@ -26,7 +26,8 @@ export declare const NORMALIZED_CONTENT_PREFIX = "[invalid content block normali
26
26
  * `convertToLlm` (provider leg) and `serializeConversation` (compaction leg) — one helper, two mouths.
27
27
  */
28
28
  export declare function normalizeLlmMessageContent<T extends Message>(message: T): T;
29
- /** Convert harness transcript messages into the LLM-facing message sequence. A provider's image refusal (live or its
30
- * record) removes the images it refused ({@link removeRejectedImages}) for every leg — provider and compaction alike;
31
- * the request leg applies it earlier, where its view starts, so there this pass is the identity. */
29
+ /** Convert harness transcript messages into the LLM-facing message sequence. A provider's refusal of part of a request
30
+ * (live or its record) leaves the view, and an image refusal removes the images it refused ({@link removeRefusedRequestParts})
31
+ * for every leg — provider and compaction alike; the request leg applies it earlier, where its view starts, so there this
32
+ * pass is the identity. */
32
33
  export declare function convertToLlm(messages: AgentMessage[]): Message[];
@@ -1,5 +1,5 @@
1
1
  import { isSyntheticApiErrorMessage } from "./types.js";
2
- import { removeRejectedImages } from "../llm/rejected-images.js";
2
+ import { removeRefusedRequestParts } from "../llm/rejected-images.js";
3
3
  import { parseSessionTimestampMs, requireSessionTimestampMs } from "../session/timestamps.js";
4
4
  export function asAgentMessage(message) {
5
5
  return message;
@@ -108,7 +108,7 @@ export function normalizeLlmMessageContent(message) {
108
108
  return changed ? { ...message, content: blocks } : message;
109
109
  }
110
110
  export function convertToLlm(messages) {
111
- return removeRejectedImages(messages)
111
+ return removeRefusedRequestParts(messages)
112
112
  .messages.map((m) => {
113
113
  const message = m;
114
114
  switch (message.role) {
@@ -108,7 +108,13 @@ export type FileErrorCode = "aborted" | "not_found" | "permission_denied" | "not
108
108
  /** A name this filesystem cannot hold (POSIX `ENAMETOOLONG` for a path component past `NAME_MAX`) — nothing can be there, and
109
109
  * a program that opens it fails the same way: an absence as conclusive as `not_found`. A path past `PATH_MAX` whose
110
110
  * components are short is not this word (such a file may exist, reached from a directory below it). */
111
- | "name_too_long" | "invalid" | "not_supported"
111
+ | "name_too_long"
112
+ /** A symbolic-link chain that loops (POSIX `ELOOP`: a link that points at itself, a cycle of links, a chain past the platform's
113
+ * follow limit) — nothing can be opened through it, but it is NOT an absence: the entries exist and the path resolves to
114
+ * nothing. The word says "this path leads to no directory": a probe that asks whether a directory is usable reads it as
115
+ * unusable (as `not_found` / `not_directory`), while a judge that must vouch for where a path lands reads it as unresolved
116
+ * (as the catch-all `unknown`), never as "nothing is there". */
117
+ | "symlink_loop" | "invalid" | "not_supported"
112
118
  /** Exclusive create refused because the path already exists ({@link FileSystem.writeFileExclusive},
113
119
  * POSIX `O_EXCL` shape). Discriminable so a caller can distinguish "lost the create race" from a
114
120
  * write failure and give honest guidance instead of overwriting. */
@@ -202,7 +208,7 @@ export declare class ExecutionError extends Error {
202
208
  * never observed, but its captured output is real work). Reference behavior (BashTask settle): a
203
209
  * timed-out command keeps ALL captured stdout/stderr and only APPENDS a "Command timed out after
204
210
  * X" line — discarding 600s of build logs forces the model to rerun blind. Optional: envs that
205
- * cannot capture partial output simply omit these; never-started codes
211
+ * cannot capture partial output omit these (absent = not captured, never "not produced"); never-started codes
206
212
  * (spawn_error/shell_unavailable) have no output by definition.
207
213
  */
208
214
  partialStdout?: string;
@@ -340,15 +346,28 @@ export interface ExecutionEnvExecOptions {
340
346
  * behavior. Envs without detach support ignore this (opt-in, backward compatible).
341
347
  */
342
348
  autoBackgroundOnTimeout?: boolean;
343
- /** VENDORED EDIT (the byte floor) — the read-deny table in force for the call starting this command ({@link ReadFloor}); what its processes OPEN is the environment's to keep,
344
- * and whether it keeps it is its declaration ({@link ExecutionEnvCapabilities.keepsReadFloor}). Carried by every start whose output the engine relays to the model. */
349
+ /** VENDORED EDIT (the byte floor) — the read-deny table this start judges with ({@link ReadFloor}): a call's own pinned table, else the run's; every start a run makes carries it, whether or not its output reaches the model.
350
+ * What its processes OPEN is the environment's to keep ({@link ExecutionEnvCapabilities.keepsReadFloor}). Absent ⇔ the table holds no row, or the start is no run's (`runExecGate`, the oracle's isolation probe). */
345
351
  readFloor?: ReadFloor;
346
352
  }
347
- /** The read-deny table one command start carries ({@link ExecutionEnvExecOptions.readFloor}); what an environment keeps of it is INTEGRATION-CORE §11.1. */
353
+ /** The read-deny table one command start carries ({@link ExecutionEnvExecOptions.readFloor}); what an environment keeps of it is INTEGRATION-CORE §11.1.
354
+ * Path semantics: a path is judged as spelled, never resolved (a hard link is another path; a symbolic link is resolved where the environment opens it). Pinned at the start: a floor with an `id` judges with that start's table for its processes' life. Exec is no read: a `#!` line's bytes, a self-printing binary (KNOWN-LIMITS KL-3190-a). */
348
355
  export interface ReadFloor {
356
+ /** The compiled table this floor stands on (`ReadDenyMatcher.id`): one `id` ⇒ one judgment of every path, so a relay may keep what it derived by it; absent ⇒ no one compiled table (hand-built, or a band's placement in flight) — derive per start. */
357
+ readonly id?: string;
349
358
  readonly rows: readonly string[];
350
359
  /** The row denying an absolute path in this environment's namespace, or `null`: the read station's own judgment. Never throws. */
351
360
  denies(absolutePath: string): string | null;
361
+ /** The floor as an OS confinement profile (`"seatbelt"`: `sandbox-exec -p`), from the table `denies` judges with; a row the
362
+ * dialect cannot express answers `{ ok: false, row, reason }` and the start is refused, never run looser. Never throws. */
363
+ confinement(dialect: "seatbelt"): {
364
+ readonly ok: true;
365
+ readonly profile: string;
366
+ } | {
367
+ readonly ok: false;
368
+ readonly row: string;
369
+ readonly reason: string;
370
+ };
352
371
  }
353
372
  /**
354
373
  * Filesystem capability used by the harness.
@@ -378,7 +397,8 @@ export interface FileSystem {
378
397
  /** Create or overwrite a file, creating parent directories when supported. Implementation note
379
398
  * (RB-221): the Node env replaces the file as a WHOLE (same-directory staging + fsync +
380
399
  * rename; `aborted` ⇒ target untouched), falling back to an in-place rewrite where rename cannot
381
- * apply (cross-device, symlink chains, non-regular targets, read-only parent dir). Atomicity is an
400
+ * apply (cross-device, symlink chains, non-regular targets, read-only parent dir) — a fallback judges
401
+ * the signal once, before its first byte, so `aborted` never describes a truncated file. Atomicity is an
382
402
  * implementation quality, NOT an interface-level contract — a remote/transport env may only have a
383
403
  * plain in-place write. */
384
404
  writeFile(path: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
@@ -647,6 +667,8 @@ export interface ExecutionEnv extends FileSystem, Shell {
647
667
  * re-supply — names and rules, never a value. `[]` = none withheld, or none inherited (a shell environment built
648
668
  * rather than inherited from this process); `"unknown"` = the adapter cannot say. A read: it announces nothing. */
649
669
  readonly withheldEnv: readonly SecretEnvFinding[] | "unknown";
670
+ /** #1726 — the NAMES (never a value) of the environment the shell child receives; omitted ⇒ the adapter cannot say, every name may be there. */
671
+ readonly receivedEnvNames?: readonly string[];
650
672
  }
651
673
  /** Base fields shared by append-only session tree entries. */
652
674
  export interface SessionTreeEntryBase {
@@ -1076,6 +1098,11 @@ export interface SessionWriteOptions {
1076
1098
  */
1077
1099
  expectedLeafId?: string | null;
1078
1100
  }
1101
+ /** What the replay that loaded a stored log dropped: `dropped` of its `total` records could not be read and are not in the log. */
1102
+ export interface ReplayLoss {
1103
+ readonly dropped: number;
1104
+ readonly total: number;
1105
+ }
1079
1106
  export interface SessionStorage<TMetadata extends SessionMetadata = SessionMetadata> {
1080
1107
  getMetadata(): Promise<TMetadata>;
1081
1108
  getLeafId(): Promise<string | null>;
@@ -1107,6 +1134,10 @@ export interface SessionStorage<TMetadata extends SessionMetadata = SessionMetad
1107
1134
  * from a CORRUPT log (a head whose parent is simply missing); the two look identical byte-wise and
1108
1135
  * must not be treated alike. `BaseSessionStorage` implements it for the bundled backends. */
1109
1136
  getFloorId?(): string | null;
1137
+ /** What the replay that loaded this log dropped, or `undefined` when it dropped nothing (or the backend has no replay to lose from). A run
1138
+ * that continues the session tells the person when it is there. Fixed at the load: a later write does not change it.
1139
+ * `BaseSessionStorage` implements it for the bundled backends. */
1140
+ getReplayLoss?(): ReplayLoss | undefined;
1110
1141
  getEpochAnchor?(): Promise<unknown>;
1111
1142
  }
1112
1143
  /**
@@ -1652,5 +1683,19 @@ export interface AgentHarnessOptions<TSkill extends Skill = Skill, TPromptTempla
1652
1683
  * contract, see AgentLoopConfig.streamingToolExecution).
1653
1684
  */
1654
1685
  streamingToolExecution?: boolean;
1655
- }
1686
+ /** The one seat every row passes at each harness commit point (a row the loop ends, an API failure's record, a row handed
1687
+ * to {@link AgentHarness.appendMessage}), before the live context and the store; absent ⇒ every row passes as made. */
1688
+ admitRows?: RowAdmission;
1689
+ /** The rows a parked leg's port held when its checkpoint was taken (`Checkpoint.heldRows`): the queue's first entries, written
1690
+ * at the transcript's first legal point (the prompt start, or — while the branch ends in a batch with unanswered calls — that
1691
+ * batch's settlement boundary), never through the admission seat again. Absent ⇒ the queue starts empty. */
1692
+ heldWrites?: readonly AgentMessage[];
1693
+ }
1694
+ /** A row its caller raises itself: a token the admitting seat minted and knows by identity; the harness hands it on unread. */
1695
+ export interface RowRaising {
1696
+ readonly door: "note";
1697
+ }
1698
+ /** The admission seat ({@link AgentHarnessOptions.admitRows}): the rows to keep, in order — every row handed in, except a
1699
+ * raised one its raiser's handlers refused. A rewrite is made in place, on the row itself. */
1700
+ export type RowAdmission = (rows: readonly AgentMessage[], raising?: RowRaising) => Promise<readonly AgentMessage[]>;
1656
1701
  export type { AgentHarness } from "./agent-harness.js";