@sema-agent/core 7.71.1 → 7.73.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 (348) hide show
  1. package/CHANGELOG.md +500 -0
  2. package/dist/agents/cross-session-ref.d.ts +2 -2
  3. package/dist/agents/cross-session-ref.js +7 -2
  4. package/dist/agents/inherited-tool-pool.d.ts +30 -2
  5. package/dist/agents/inherited-tool-pool.js +53 -7
  6. package/dist/agents/parked-resume-drive.d.ts +10 -0
  7. package/dist/agents/parked-resume-drive.js +9 -0
  8. package/dist/agents/retain-ledger.d.ts +3 -0
  9. package/dist/agents/send-message-tool.js +7 -2
  10. package/dist/agents/send-user-message-tool.d.ts +12 -0
  11. package/dist/agents/send-user-message-tool.js +67 -0
  12. package/dist/agents/subagent-steps.d.ts +9 -0
  13. package/dist/agents/subagent-steps.js +38 -0
  14. package/dist/agents/subagent.d.ts +2 -0
  15. package/dist/agents/subagent.js +47 -12
  16. package/dist/agents/verify.js +23 -7
  17. package/dist/agents/yield-adoption.js +3 -1
  18. package/dist/brain/anthropic.js +14 -9
  19. package/dist/brain/open-responses.js +4 -5
  20. package/dist/brain/openai.js +30 -23
  21. package/dist/brain/stream-engine.js +159 -151
  22. package/dist/core/a2a.d.ts +24 -3
  23. package/dist/core/a2a.js +27 -8
  24. package/dist/core/actions-digest.d.ts +43 -0
  25. package/dist/core/actions-digest.js +22 -0
  26. package/dist/core/agent-state.d.ts +28 -7
  27. package/dist/core/agent-state.js +19 -6
  28. package/dist/core/allow-entry.js +3 -3
  29. package/dist/core/approval-object.d.ts +7 -3
  30. package/dist/core/approval-object.js +30 -9
  31. package/dist/core/auto-mode.d.ts +7 -9
  32. package/dist/core/auto-mode.js +114 -8
  33. package/dist/core/checkpoint-features.d.ts +16 -5
  34. package/dist/core/checkpoint-features.js +35 -6
  35. package/dist/core/checkpoint-rekey.d.ts +1 -1
  36. package/dist/core/checkpoint-rekey.js +6 -1
  37. package/dist/core/checkpoint-requirements.d.ts +23 -3
  38. package/dist/core/checkpoint-requirements.js +5 -1
  39. package/dist/core/checkpoint-row-verdict.d.ts +1 -1
  40. package/dist/core/checkpoint-row-verdict.js +10 -4
  41. package/dist/core/checkpoint-store.d.ts +24 -2
  42. package/dist/core/checkpoint-store.js +1 -0
  43. package/dist/core/child-clamp-seats.d.ts +15 -0
  44. package/dist/core/child-clamp-seats.js +15 -0
  45. package/dist/core/delegation-frames.d.ts +1 -0
  46. package/dist/core/delegation-frames.js +1 -1
  47. package/dist/core/effective-path-target.d.ts +19 -0
  48. package/dist/core/effective-path-target.js +95 -38
  49. package/dist/core/engine-capabilities.d.ts +5 -1
  50. package/dist/core/engine-capabilities.js +1 -1
  51. package/dist/core/engine-notice.d.ts +34 -23
  52. package/dist/core/engine-version.js +1 -1
  53. package/dist/core/entries-not-applied.d.ts +19 -7
  54. package/dist/core/entries-not-applied.js +33 -1
  55. package/dist/core/file-history-store.d.ts +15 -4
  56. package/dist/core/file-history-store.js +53 -23
  57. package/dist/core/gate-fold.js +3 -1
  58. package/dist/core/governance-codes.d.ts +10 -1
  59. package/dist/core/governance-codes.js +17 -5
  60. package/dist/core/hooks.d.ts +3 -0
  61. package/dist/core/hooks.js +1 -0
  62. package/dist/core/host-instance.d.ts +23 -0
  63. package/dist/core/host-instance.js +69 -0
  64. package/dist/core/instruction-preview.d.ts +63 -0
  65. package/dist/core/instruction-preview.js +406 -0
  66. package/dist/core/judged-read.d.ts +57 -0
  67. package/dist/core/judged-read.js +1 -0
  68. package/dist/core/leg-budget.d.ts +26 -0
  69. package/dist/core/leg-budget.js +9 -0
  70. package/dist/core/leg-identity.d.ts +51 -1
  71. package/dist/core/leg-identity.js +45 -2
  72. package/dist/core/manager-launch-check.d.ts +48 -0
  73. package/dist/core/manager-launch-check.js +64 -0
  74. package/dist/core/mcp-call-meta.d.ts +2 -2
  75. package/dist/core/mcp-host-seat.d.ts +5 -0
  76. package/dist/core/mcp-host-seat.js +7 -1
  77. package/dist/core/mcp-injection-drop.d.ts +20 -10
  78. package/dist/core/mcp-injection-drop.js +9 -3
  79. package/dist/core/mcp-server-spec.d.ts +2 -1
  80. package/dist/core/mcp.js +3 -1
  81. package/dist/core/member-outcome.d.ts +3 -2
  82. package/dist/core/member-outcome.js +1 -1
  83. package/dist/core/memory-engine/deletion-record.d.ts +46 -0
  84. package/dist/core/memory-engine/deletion-record.js +96 -0
  85. package/dist/core/memory-engine/engine.js +24 -16
  86. package/dist/core/memory-engine/file-backend.js +7 -5
  87. package/dist/core/memory-engine/index.d.ts +1 -1
  88. package/dist/core/memory-engine/index.js +1 -1
  89. package/dist/core/memory-engine/layout.js +6 -4
  90. package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
  91. package/dist/core/memory-engine/projection-ledger.js +1 -1
  92. package/dist/core/memory-engine/scope-contract.d.ts +69 -11
  93. package/dist/core/memory-engine/scope-contract.js +99 -34
  94. package/dist/core/memory-engine/sync-client.js +26 -6
  95. package/dist/core/memory-engine/sync.d.ts +20 -2
  96. package/dist/core/memory-engine/sync.js +18 -17
  97. package/dist/core/mode-policy.d.ts +21 -6
  98. package/dist/core/mode-policy.js +15 -6
  99. package/dist/core/mounted-mcp.d.ts +7 -2
  100. package/dist/core/mounted-mcp.js +10 -1
  101. package/dist/core/own-property-receipt.js +11 -4
  102. package/dist/core/param-rule-reach.d.ts +8 -3
  103. package/dist/core/param-rule-reach.js +9 -1
  104. package/dist/core/parent-spec-seat.d.ts +13 -1
  105. package/dist/core/parent-spec-seat.js +18 -0
  106. package/dist/core/peer-registration.d.ts +52 -0
  107. package/dist/core/peer-registration.js +37 -0
  108. package/dist/core/peer-seat.d.ts +3 -1
  109. package/dist/core/peer-seat.js +3 -3
  110. package/dist/core/peer-task-store.d.ts +365 -0
  111. package/dist/core/peer-task-store.js +682 -0
  112. package/dist/core/permission-rule-consent.js +6 -11
  113. package/dist/core/permission-rule-model.d.ts +27 -0
  114. package/dist/core/permission-rule-model.js +34 -6
  115. package/dist/core/permission-rule-provider.d.ts +35 -33
  116. package/dist/core/permission-rule-provider.js +38 -295
  117. package/dist/core/permission-rule-store.d.ts +181 -8
  118. package/dist/core/permission-rule-store.js +420 -17
  119. package/dist/core/permission-rule-sync.js +15 -1
  120. package/dist/core/project-seat.d.ts +55 -0
  121. package/dist/core/project-seat.js +96 -0
  122. package/dist/core/protocol-http-auth.d.ts +3 -2
  123. package/dist/core/protocol-http-auth.js +26 -18
  124. package/dist/core/remote-env.d.ts +4 -4
  125. package/dist/core/retired-keys.js +1 -0
  126. package/dist/core/rule-offer-read.d.ts +1 -1
  127. package/dist/core/rule-offer-read.js +32 -4
  128. package/dist/core/run-ledger-seat.d.ts +66 -0
  129. package/dist/core/run-ledger-seat.js +70 -0
  130. package/dist/core/run-ledger.d.ts +332 -0
  131. package/dist/core/run-ledger.js +550 -0
  132. package/dist/core/runner/chain-mismatch.d.ts +32 -0
  133. package/dist/core/runner/chain-mismatch.js +29 -0
  134. package/dist/core/runner/changes-history.d.ts +1 -0
  135. package/dist/core/runner/changes-history.js +2 -2
  136. package/dist/core/runner/checkpoint-scope.d.ts +13 -3
  137. package/dist/core/runner/checkpoint-scope.js +12 -4
  138. package/dist/core/runner/construction-doors.js +6 -0
  139. package/dist/core/runner/contracts.d.ts +22 -3
  140. package/dist/core/runner/delegation-owner.d.ts +30 -0
  141. package/dist/core/runner/delegation-owner.js +20 -4
  142. package/dist/core/runner/file-history-restore.d.ts +3 -1
  143. package/dist/core/runner/file-history-restore.js +9 -6
  144. package/dist/core/runner/finish-reason-seat.js +4 -2
  145. package/dist/core/runner/leg-frame.js +3 -0
  146. package/dist/core/runner/loaded-skills.d.ts +2 -0
  147. package/dist/core/runner/loaded-skills.js +10 -0
  148. package/dist/core/runner/nested-memory-lane.d.ts +22 -5
  149. package/dist/core/runner/nested-memory-lane.js +91 -30
  150. package/dist/core/runner/person-path-rows.d.ts +23 -20
  151. package/dist/core/runner/person-path-rows.js +82 -18
  152. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
  153. package/dist/core/runner/prepare-caps-and-workflow.js +105 -90
  154. package/dist/core/runner/prepare-config-doors.d.ts +1 -0
  155. package/dist/core/runner/prepare-config-doors.js +5 -3
  156. package/dist/core/runner/prepare-context-lane.js +1 -0
  157. package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
  158. package/dist/core/runner/prepare-delegation-surface.js +6 -0
  159. package/dist/core/runner/prepare-execution-env.d.ts +3 -3
  160. package/dist/core/runner/prepare-file-history.js +1 -1
  161. package/dist/core/runner/prepare-hands-readface.d.ts +10 -2
  162. package/dist/core/runner/prepare-hands-readface.js +36 -22
  163. package/dist/core/runner/prepare-inherited-gate.d.ts +8 -5
  164. package/dist/core/runner/prepare-inherited-gate.js +14 -6
  165. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -2
  166. package/dist/core/runner/prepare-memory-engine-session.js +2 -2
  167. package/dist/core/runner/prepare-memory.js +3 -15
  168. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  169. package/dist/core/runner/prepare-project-context.js +3 -7
  170. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -0
  171. package/dist/core/runner/prepare-protocol-tools.js +2 -2
  172. package/dist/core/runner/prepare-run-refs.d.ts +1 -1
  173. package/dist/core/runner/prepare-run-refs.js +3 -2
  174. package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
  175. package/dist/core/runner/prepare-suspend-saga.js +4 -2
  176. package/dist/core/runner/prepare-task.js +50 -37
  177. package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
  178. package/dist/core/runner/prepare-turn-wiring.js +2 -1
  179. package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -1
  180. package/dist/core/runner/prepare-wiring-manifest.js +8 -4
  181. package/dist/core/runner/read-session-changes.js +1 -1
  182. package/dist/core/runner/resume-apply.js +11 -5
  183. package/dist/core/runner/resume-checkpoint-screen.d.ts +8 -7
  184. package/dist/core/runner/resume-checkpoint-screen.js +7 -6
  185. package/dist/core/runner/resume-review-outcome.d.ts +3 -0
  186. package/dist/core/runner/resume-review-outcome.js +24 -1
  187. package/dist/core/runner/rewind-files.js +3 -2
  188. package/dist/core/runner/run-harness-handlers.js +3 -0
  189. package/dist/core/runner/run-identity-wiring.js +3 -2
  190. package/dist/core/runner/run-leg.js +9 -2
  191. package/dist/core/runner/run-notification-lane.js +20 -1
  192. package/dist/core/runner/run-settle-and-teardown.js +21 -12
  193. package/dist/core/runner/run-stop-and-final-verify.js +6 -0
  194. package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
  195. package/dist/core/runner/runtask.d.ts +6 -2
  196. package/dist/core/runner/runtask.js +21 -9
  197. package/dist/core/runner/shell-env-withheld.d.ts +3 -2
  198. package/dist/core/runner/shell-env-withheld.js +1 -2
  199. package/dist/core/runner/stop-tail-notice.d.ts +10 -2
  200. package/dist/core/runner/stop-tail-notice.js +9 -2
  201. package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
  202. package/dist/core/runner/stream-settle-backstop.js +1 -0
  203. package/dist/core/runner/task-start-doors.js +6 -3
  204. package/dist/core/runner/terminal-account.d.ts +10 -1
  205. package/dist/core/runner/terminal-account.js +23 -3
  206. package/dist/core/runner/tool-face-overlay.d.ts +2 -11
  207. package/dist/core/runner/tool-face-overlay.js +39 -0
  208. package/dist/core/runner/trim-stretch.js +7 -2
  209. package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
  210. package/dist/core/runner-deps.d.ts +13 -10
  211. package/dist/core/scheduler.d.ts +47 -7
  212. package/dist/core/scheduler.js +19 -7
  213. package/dist/core/secret-env.d.ts +60 -37
  214. package/dist/core/secret-env.js +45 -48
  215. package/dist/core/sensitive-path-policy.js +14 -7
  216. package/dist/core/session-checkout.d.ts +3 -0
  217. package/dist/core/session-checkout.js +1 -0
  218. package/dist/core/session-store.d.ts +12 -6
  219. package/dist/core/session-store.js +26 -6
  220. package/dist/core/session.d.ts +31 -8
  221. package/dist/core/shell-read-silence.js +1 -0
  222. package/dist/core/store-contracts/checkpoint-store-contract.js +17 -0
  223. package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
  224. package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
  225. package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
  226. package/dist/core/store-contracts/session-store-contract.js +87 -3
  227. package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
  228. package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
  229. package/dist/core/task-event.d.ts +11 -3
  230. package/dist/core/task-notification.d.ts +97 -10
  231. package/dist/core/task-notification.js +129 -5
  232. package/dist/core/task-registry-shared.d.ts +12 -1
  233. package/dist/core/task-registry-shared.js +3 -1
  234. package/dist/core/task-registry-workflow.d.ts +1 -1
  235. package/dist/core/task-registry-workflow.js +9 -1
  236. package/dist/core/task-registry.d.ts +39 -2
  237. package/dist/core/task-registry.js +76 -12
  238. package/dist/core/task-result.d.ts +13 -0
  239. package/dist/core/task-spec-members.d.ts +3 -1
  240. package/dist/core/task-spec-members.js +11 -3
  241. package/dist/core/task-spec.d.ts +57 -23
  242. package/dist/core/tool-catalog-entries.js +4 -0
  243. package/dist/core/tool-face-reader.js +1 -1
  244. package/dist/core/tool-face.d.ts +7 -0
  245. package/dist/core/tool-face.js +1 -0
  246. package/dist/core/tool-mount-facts.d.ts +5 -3
  247. package/dist/core/tool-mount-facts.js +4 -3
  248. package/dist/core/tool-mount-plan.d.ts +7 -3
  249. package/dist/core/tool-mount-plan.js +11 -5
  250. package/dist/core/tool-mount-static.d.ts +2 -2
  251. package/dist/core/tool-mount-static.js +28 -14
  252. package/dist/core/tool-registry.d.ts +33 -1
  253. package/dist/core/tool-registry.js +33 -0
  254. package/dist/core/tool-result-store.d.ts +19 -2
  255. package/dist/core/tool-result-store.js +51 -2
  256. package/dist/core/tool-roster.d.ts +16 -0
  257. package/dist/core/tool-roster.js +6 -0
  258. package/dist/core/tool-spec.d.ts +13 -4
  259. package/dist/core/tools.d.ts +6 -0
  260. package/dist/core/tools.js +1 -1
  261. package/dist/core/user-attachment.d.ts +5 -1
  262. package/dist/core/user-attachment.js +14 -7
  263. package/dist/core/wiring-manifest.d.ts +89 -29
  264. package/dist/core/wiring-manifest.js +44 -4
  265. package/dist/core/workflow-journal-store.d.ts +53 -10
  266. package/dist/core/workflow-journal-store.js +27 -4
  267. package/dist/core/workflow-run-store-contract.js +16 -0
  268. package/dist/core/workflow-run-store.d.ts +9 -7
  269. package/dist/core/workflow-run-store.js +4 -1
  270. package/dist/engine/execution-env/node-execution-env.js +3 -1
  271. package/dist/engine/harness/messages.d.ts +1 -1
  272. package/dist/engine/harness/messages.js +2 -1
  273. package/dist/engine/harness/types.d.ts +24 -1
  274. package/dist/engine/harness/types.js +10 -0
  275. package/dist/engine/llm/types.d.ts +5 -7
  276. package/dist/engine/loop/types.d.ts +2 -0
  277. package/dist/engine/lsp/node-lsp-manager.js +2 -1
  278. package/dist/engine/session/import-validate.js +6 -1
  279. package/dist/engine/session/session.d.ts +15 -2
  280. package/dist/engine/session/session.js +35 -5
  281. package/dist/index.d.ts +27 -12
  282. package/dist/index.js +20 -8
  283. package/dist/orchestration/run-workflow-tool.js +40 -32
  284. package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
  285. package/dist/orchestration/workflow-park-adoption.js +47 -12
  286. package/dist/orchestration/workflow-stop.d.ts +128 -0
  287. package/dist/orchestration/workflow-stop.js +156 -0
  288. package/dist/orchestration/workflow.d.ts +30 -6
  289. package/dist/orchestration/workflow.js +117 -54
  290. package/dist/prompts/manager-recipe.d.ts +18 -0
  291. package/dist/prompts/manager-recipe.js +24 -0
  292. package/dist/stores/file/adoption/marker.d.ts +2 -27
  293. package/dist/stores/file/adoption/marker.js +12 -0
  294. package/dist/stores/file/index.d.ts +1 -1
  295. package/dist/stores/file/index.js +1 -1
  296. package/dist/stores/file/permission-rule-store.d.ts +3 -1
  297. package/dist/stores/file/permission-rule-store.js +0 -1
  298. package/dist/stores/file/workflow-journal-store.d.ts +16 -3
  299. package/dist/stores/file/workflow-journal-store.js +93 -5
  300. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  301. package/dist/tools/artifact/artifact-tool.js +11 -6
  302. package/dist/tools/fs/file-read-check.d.ts +45 -11
  303. package/dist/tools/fs/file-read-check.js +200 -57
  304. package/dist/tools/fs/file-write-check.js +9 -3
  305. package/dist/tools/fs/index.d.ts +8 -7
  306. package/dist/tools/fs/index.js +4 -4
  307. package/dist/tools/fs/judged-reads.d.ts +51 -0
  308. package/dist/tools/fs/judged-reads.js +68 -0
  309. package/dist/tools/fs/read-deny-home.d.ts +1 -1
  310. package/dist/tools/fs/read-deny-home.js +5 -5
  311. package/dist/tools/fs/read-deny.d.ts +33 -8
  312. package/dist/tools/fs/read-deny.js +114 -25
  313. package/dist/tools/fs/safety.d.ts +12 -1
  314. package/dist/tools/fs/safety.js +16 -3
  315. package/dist/tools/fs/shell-read-check.d.ts +25 -5
  316. package/dist/tools/fs/shell-read-check.js +100 -15
  317. package/dist/tools/fs/shell-read-establish.d.ts +9 -0
  318. package/dist/tools/fs/shell-read-establish.js +34 -14
  319. package/dist/tools/fs/shell-read-judge.d.ts +13 -1
  320. package/dist/tools/fs/shell-read-judge.js +26 -7
  321. package/dist/tools/fs/shell-read-plan.d.ts +5 -0
  322. package/dist/tools/fs/shell-read-write-targets.js +17 -9
  323. package/dist/tools/scheduler-store-move.d.ts +74 -0
  324. package/dist/tools/scheduler-store-move.js +103 -0
  325. package/dist/tools/scheduler-tools.d.ts +43 -29
  326. package/dist/tools/scheduler-tools.js +161 -118
  327. package/package.json +2 -2
  328. package/test/export-surface.snapshot.json +173 -3
  329. package/wire-changes/answers/core-stores-sql@7.72.0.json +12 -0
  330. package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
  331. package/wire-changes/answers/core@7.72.0.json +84 -0
  332. package/wire-changes/answers/core@7.73.0.json +216 -0
  333. package/wire-changes/answers/mods-kernel@7.72.0.json +7 -0
  334. package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
  335. package/wire-changes/answers/primitives@7.72.0.json +6 -0
  336. package/wire-changes/answers/primitives@7.73.0.json +12 -0
  337. package/wire-changes/answers/wiki-gate@7.72.0.json +7 -0
  338. package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
  339. package/wire-changes/core-stores-sql@7.72.0.json +215 -0
  340. package/wire-changes/core-stores-sql@7.73.0.json +326 -0
  341. package/wire-changes/core@7.72.0.json +2426 -0
  342. package/wire-changes/core@7.73.0.json +6480 -0
  343. package/wire-changes/mods-kernel@7.72.0.json +147 -0
  344. package/wire-changes/mods-kernel@7.73.0.json +147 -0
  345. package/wire-changes/primitives@7.72.0.json +143 -0
  346. package/wire-changes/primitives@7.73.0.json +227 -0
  347. package/wire-changes/wiki-gate@7.72.0.json +145 -0
  348. package/wire-changes/wiki-gate@7.73.0.json +145 -0
@@ -1,4 +1,5 @@
1
1
  import type { CompositionLeg, RunInternals } from "./contracts.js";
2
+ import type { CheckpointState } from "../checkpoint-store.js";
2
3
  /**
3
4
  * The SINGLE derivation of a durable-suspend checkpoint's scope — the LEG's scope, computed once per prepare and
4
5
  * read by every mint lane of that leg (approval park, resource and `plan_review` parks, the forceDurableGate
@@ -86,6 +87,15 @@ export declare function compositionLegRecord(leg: CompositionLeg | undefined): C
86
87
  export declare function workSessionOfLeg(leg: CompositionLeg | undefined): string | undefined;
87
88
  /** Whether two composition-leg records name the same leg of the same composition for the same host session. */
88
89
  export declare function sameCompositionLeg(a: CompositionLeg, b: CompositionLeg): boolean;
89
- /** The row a resumed leg runs as ({@link RunInternals.rowTaskId}): the live seat when handed, else the parked row's record —
90
- * folded into internals so the mint at prepare, the resume screen and the throw backstop read one value. */
91
- export declare function restoreRowTaskId(internals: RunInternals | undefined, recorded: string | undefined): RunInternals | undefined;
90
+ /** The identity a resumed leg runs as, read off the parked row it resumes: the registry row it ran as ({@link RunInternals.rowTaskId}),
91
+ * its spawning task ({@link RunInternals.parentTaskId}), its tree's root address — id, box scope and occupant (one anchor: taken
92
+ * whole or not at all) — and its explicit spawn name ({@link RunInternals.explicitAgentName}), each the live seat when the resuming call hands one,
93
+ * else the row's record (`CheckpointState.rowTaskId` / `legIdentity`) — folded into internals once, so the resume screen and every
94
+ * reader of the resumed leg (its prepare's mints, its stations, the throw backstop) read one value. A row that records none leaves
95
+ * the internals as handed. */
96
+ export declare function restoreRowIdentity(internals: RunInternals | undefined, state: Pick<CheckpointState, "rowTaskId" | "legIdentity"> | undefined): RunInternals | undefined;
97
+ /** The task id a resumed leg's host declared: the resume config's, else the one the parked row records its host declared
98
+ * (`CheckpointState.legIdentity.declaredTaskId`) — so a resume that names none runs as the task that parked, never as its session. */
99
+ export declare function resumedDeclaredTaskId(config: {
100
+ readonly taskId?: string | undefined;
101
+ }, state: Pick<CheckpointState, "legIdentity">): string | undefined;
@@ -49,8 +49,16 @@ export function workSessionOfLeg(leg) {
49
49
  export function sameCompositionLeg(a, b) {
50
50
  return a.entry === b.entry && a.leg === b.leg && a.hostSessionId === b.hostSessionId;
51
51
  }
52
- export function restoreRowTaskId(internals, recorded) {
53
- if (internals?.rowTaskId !== undefined || recorded === undefined)
54
- return internals;
55
- return { ...(internals ?? {}), rowTaskId: recorded };
52
+ export function restoreRowIdentity(internals, state) {
53
+ const row = state?.legIdentity;
54
+ const restored = {
55
+ ...(internals?.rowTaskId === undefined && state?.rowTaskId !== undefined ? { rowTaskId: state.rowTaskId } : {}),
56
+ ...(internals?.parentTaskId === undefined && row?.parentTaskId !== undefined ? { parentTaskId: row.parentTaskId } : {}),
57
+ ...(internals?.rootSessionId === undefined && row?.rootSessionId !== undefined && row.rootSessionScope !== undefined ? { rootSessionId: row.rootSessionId, rootSessionScope: row.rootSessionScope, ...(row.rootSessionIncarnation !== undefined ? { rootSessionIncarnation: row.rootSessionIncarnation } : {}) } : {}),
58
+ ...(internals?.explicitAgentName === undefined && row?.spawnName !== undefined ? { explicitAgentName: row.spawnName } : {}),
59
+ };
60
+ return Object.keys(restored).length === 0 ? internals : { ...(internals ?? {}), ...restored };
61
+ }
62
+ export function resumedDeclaredTaskId(config, state) {
63
+ return config.taskId ?? state.legIdentity?.declaredTaskId;
56
64
  }
@@ -5,6 +5,7 @@ import { receiptRefusal, receiveOwnProperties, refuseProxy } from "../own-proper
5
5
  import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
6
6
  import { copyReadDenySeat, READ_DENY_DEPLOYMENT_SEATS } from "../read-face-seats.js";
7
7
  import { receiveHostFloor } from "../host-floor.js";
8
+ import { receiveHostInstance } from "../host-instance.js";
8
9
  import { holdOwnCredentialValues } from "../secret-env.js";
9
10
  import { receivePeerSeat } from "../peer-seat.js";
10
11
  import { receiveProtocolRevocations } from "../protocol-revocation.js";
@@ -12,6 +13,7 @@ import { receiveModelFallbackPolicy } from "../model-fallbacks.js";
12
13
  import { receiveCacheRetention } from "./model-lane-seat.js";
13
14
  import { assertJournalStoreGivesClaimsBack } from "../workflow-journal-store.js";
14
15
  import { screenPermissionModeWhenUnset } from "../mode-policy.js";
16
+ import { receiveAutoModeFace } from "../auto-mode.js";
15
17
  export function retainRunnerDeps(deps) {
16
18
  const words = { subject: "RunnerDeps", unit: "seat", moment: "at new Runner" };
17
19
  refuseProxy(deps, words);
@@ -26,6 +28,8 @@ export function retainRunnerDeps(deps) {
26
28
  }
27
29
  if (Object.hasOwn(retained, "hostFloor"))
28
30
  Object.defineProperty(retained, "hostFloor", { value: receiveHostFloor(Reflect.get(retained, "hostFloor")), enumerable: true, writable: true, configurable: true });
31
+ if (Object.hasOwn(retained, "host"))
32
+ Object.defineProperty(retained, "host", { value: receiveHostInstance(Reflect.get(retained, "host"), "RunnerDeps.host"), enumerable: true, writable: true, configurable: true });
29
33
  if (Object.hasOwn(retained, "peerSeat"))
30
34
  Object.defineProperty(retained, "peerSeat", { value: receivePeerSeat(Reflect.get(retained, "peerSeat"), "RunnerDeps.peerSeat"), enumerable: true, writable: true, configurable: true });
31
35
  if (Object.hasOwn(retained, "protocolRevocations"))
@@ -34,6 +38,8 @@ export function retainRunnerDeps(deps) {
34
38
  Object.defineProperty(retained, "modelFallback", { value: receiveModelFallbackPolicy(Reflect.get(retained, "modelFallback"), "RunnerDeps.modelFallback"), enumerable: true, writable: true, configurable: true });
35
39
  receiveCacheRetention(retained.cacheRetention, "RunnerDeps.cacheRetention");
36
40
  screenPermissionModeWhenUnset(retained.permissionModeWhenUnset);
41
+ if (Object.hasOwn(retained, "autoMode"))
42
+ Object.defineProperty(retained, "autoMode", { value: receiveAutoModeFace(Reflect.get(retained, "autoMode"), "RunnerDeps.autoMode"), enumerable: true, writable: true, configurable: true });
37
43
  const honorsReadChanges = retained.executionEnvFactoryHonorsReadChanges;
38
44
  if (honorsReadChanges !== undefined && typeof honorsReadChanges !== "boolean") {
39
45
  const e = new Error(`RunnerDeps.executionEnvFactoryHonorsReadChanges must be a boolean when given, got ${typeof honorsReadChanges} — refused at new Runner rather than read as false`);
@@ -28,6 +28,12 @@ export interface WriteFaceSeat {
28
28
  readonly inForce: () => ContainmentFace;
29
29
  readonly fenced: boolean;
30
30
  }
31
+ /** The two faces the children of a leg that narrowed only its own hands (`TaskSpec.ownHandsReadOnly`) are handed — resolved
32
+ * without that narrowing (`prepare-hands-readface.ts` `carriedFacesOf`). */
33
+ export interface CarriedFaces {
34
+ readonly read: ContainmentFace;
35
+ readonly write: WriteFaceSeat;
36
+ }
31
37
  import type { MaterializedA2a } from "../a2a.js";
32
38
  import type { CompactionForkContext, RapidRefillState } from "../auto-compaction.js";
33
39
  import type { AutoModeArmingRecipe } from "../auto-mode-arming.js";
@@ -373,6 +379,8 @@ export interface Prepared {
373
379
  * prepare emits run-scoped disclosures of its own and each must have a terminal that names it.
374
380
  */
375
381
  runId: string;
382
+ /** Wall-clock epoch ms minted once beside {@link runId} at prepare entry; every leg-start reader (`manifest.leg.instance.startedAt`, `task_started.startedAt`, `task.start.ts`) reads this value. */
383
+ legStartedAt: number;
376
384
  /** The deployment's host floor as the config doors compiled it (absent ⇒ none declared) — the task images' guard reads it. */
377
385
  hostFloor?: import("../host-floor.js").HostFloor;
378
386
  /** The (owner, scope) key this run's registry-facing tools register rows under — ({@link taskId}, mount domain), minted once at prepare; the teardown sweeps read it and never re-derive it. */
@@ -380,6 +388,9 @@ export interface Prepared {
380
388
  readonly owner: string;
381
389
  readonly scope: string;
382
390
  };
391
+ /** The run's member ledger book (`TaskSpec.runLedger`), present only on a run that declares one: the report tool delivers
392
+ * through it, and the settle reads the final ledger off it onto the result. */
393
+ runLedgerBook?: import("../run-ledger.js").RunLedgerBook;
383
394
  /** The session's reminder provenance mark this run mints under (adopted
384
395
  * through the prepare adoption ladder: checkpoint seed → trusted fork channel → session entry →
385
396
  * fresh mint). Every engine-authored `<system-reminder>` open tag in the run carries it, and the
@@ -631,6 +642,7 @@ export interface Prepared {
631
642
  * on THIS leg — a deny row found now vetoes, an operator's edit is judged on the `rejudge` seat. */
632
643
  shellReadCheck?: import("../../tools/fs/shell-read-check.js").ShellReadCheck;
633
644
  shellReadLandings?: import("../../tools/fs/shell-read-check.js").ShellReadLandings;
645
+ declaredReadKeys?: (toolCallId: string, call: Pick<import("../tool-registry.js").ToolCallLike, "face">) => readonly string[] | "unjudged" | undefined;
634
646
  crossBoundary?: {
635
647
  readonly check: import("../cross-boundary-taint.js").CrossBoundaryCheck | undefined;
636
648
  settle(owed: import("../cross-boundary-taint.js").OwedDeliveries, boundMs?: number): Promise<void>;
@@ -1545,7 +1557,7 @@ export interface PreparedMicroCompact {
1545
1557
  };
1546
1558
  /** The run's ONE offload persist (write-once, idempotent): the frontier pass, the blocking-point arm and the MC-R arm all clear
1547
1559
  * through it, so they compose identical markers. Absent when no offload store is configured. */
1548
- offloadPersist?: (toolCallId: string, fullText: string) => string;
1560
+ offloadPersist?: import("../tool-result-store.js").OffloadPersist;
1549
1561
  }
1550
1562
  /**
1551
1563
  * Resume inputs threaded into {@link prepareTask} to continue a suspended task. The Runner
@@ -1930,6 +1942,9 @@ export interface RunInternals {
1930
1942
  * a root run it starts (`runTask(spec, { toolCeiling })`): the task-start doors judge it as a host-written workflow ceiling is judged (another spelling of a tool the run carries refuses: `config.tool_face_control`, `near_miss`); its rows record it. Trusted, never a TaskSpec field.
1931
1943
  */
1932
1944
  toolCeiling?: readonly import("../tool-face.js").ToolSelectorLayer[];
1945
+ /** The run's member ledger book (`TaskSpec.runLedger`) — always the run's own lane's (its notification lane mints it and hears the
1946
+ * run's frames into it); undefined on a run without a ledger. Trusted, never a TaskSpec field, never handed to a child. */
1947
+ runLedgerBook?: import("../run-ledger.js").RunLedgerBook | undefined;
1933
1948
  /** Set by the delegation lane when the spawning run's prepare judged this leg's own tool lists (its spec's `allowTools` /
1934
1949
  * `excludeTools` — a definition's or the delegation tool's) against a pool it could list: their digest (`toolListsDigest`), the
1935
1950
  * evidence bound to exactly those lists. A prepare whose own lists digest to it does not judge them again, and its rows record it
@@ -2167,6 +2182,9 @@ export interface RunInternals {
2167
2182
  * mirroring `insideFork`.
2168
2183
  */
2169
2184
  isDelegatedChild?: boolean;
2185
+ /** The project seat its spawner (or waker) hands the leg, a DEFAULT: its id only when the leg declares none and has no marker, its texts only
2186
+ * when the leg's verdict is its id (`resolveSessionProject`); screened and copied at the call's internals door (a refused one ends the leg). Trusted internals. */
2187
+ parentProject?: import("../project-seat.js").ProjectSeat;
2170
2188
  /** Who wrote this leg's objective ({@link import("../input-author.js").InputAuthor}), stated by the seat that mints it; absent = the public
2171
2189
  * entry's caller, `operator`. Only the operator's objective passes `classic.UserPromptSubmit`; a non-member reads `unknown`, is screened and
2172
2190
  * reported once (`onError`, `"config"`). Never inherited — each seat says its own. TRUSTED run-scoped channel (NOT a {@link TaskSpec} field). */
@@ -3412,8 +3430,9 @@ export interface RunnerSelfSeat {
3412
3430
  emitTaskOutcome(outcome: TaskOutcome): void;
3413
3431
  /** Announce a fact of a composition's own (the verification gate's `verify.verifier_is_implementer`) on `RunnerDeps.onNotice`, live-read,
3414
3432
  * through the one delivery form every notice leaves by (`deliverEngineNotice`: the same-principal text pass, the session lift, a
3415
- * throwing sink contained). Absent on a hand-built seat ⇒ the composition cannot say it, and says nothing; the Runner always has it. */
3416
- emitNotice?(notice: import("../engine-notice.js").EngineNotice): void;
3433
+ * throwing sink contained). Absent on a hand-built seat ⇒ the composition cannot say it, and says nothing; the Runner always has it. With
3434
+ * a leg's `route` (`noticeAddressOf`) the Runner delivers under that route's admission (`legNoticeAdmission`, its own destination judge). */
3435
+ emitNotice?(notice: import("../engine-notice.js").EngineNotice, route?: import("../leg-identity.js").NoticeRoute): void;
3417
3436
  /** A hold, on the peer seat THIS runner's legs ask, of the references `declared` names — taken by a keeper of declarations outside a
3418
3437
  * leg (which they are: peer-seat.ts's module note), released by it once (peer-seat.ts `holdPeerDeclarations`). */
3419
3438
  holdDeclarations(declared: import("../peer-seat.js").PeerDeclarations): import("../peer-seat.js").PeerDeclarationHold;
@@ -136,6 +136,10 @@ export interface JudgedRow {
136
136
  readonly occupant?: () => Promise<string | undefined>;
137
137
  readonly minted?: boolean;
138
138
  readonly runsOn?: true;
139
+ /** `false`: the claimant's judgement taken without its write — a preview of the leg that would run on the row. Everything the claim
140
+ * needs is judged (a store with no conditional owner write refuses as it refuses the leg); a row that records no owner answers open
141
+ * and unclaimed, and nothing is recorded on it. */
142
+ readonly writes?: false;
139
143
  }
140
144
  /** The one refusal of a claim on a store that has no conditional owner write ({@link SessionStore.recordOwner}) — the whole of what a tree
141
145
  * with an owner meets on a row that records none there; one sentence, one place. */
@@ -188,6 +192,10 @@ export declare function readJudgedRow<T>(sessions: Pick<SessionStore, "headOf" |
188
192
  open: true;
189
193
  }>;
190
194
  }>;
195
+ /** The refusal of a read whose row is not the one judged ({@link readStandsAsJudged}). */
196
+ export declare function rowNotTheOneJudged(): Extract<RowAdmission, {
197
+ kind: "not_ours";
198
+ }>;
191
199
  /** {@link judgeRowForTree} for an entry that reads its CALLER's seat off the tool call (SendMessage, AgentTranscript, an extension's
192
200
  * transcript read): the seat's reading, bounded and ended by the call's stop. A caller that holds no seat — a tool driven with no run around
193
201
  * it, an operator's continuation — is an anonymous tree's ({@link delegationOwnerOf}): it opens only rows that record no owner. What a
@@ -295,6 +303,28 @@ export declare function judgeLegRow(sessions: Pick<SessionStore, "headOf" | "rec
295
303
  }>;
296
304
  };
297
305
  }, leg: JudgedLeg, report?: (err: Error, sessionId: string) => void): Promise<void>;
306
+ /** A leg's refusal of a row its judgement did not open: the store fault's own code ({@link RowStoreFaultCode}) for a store that could not
307
+ * judge it, `delegation.owner_mismatch` for a row that is not the tree's (the row named, no owner). Thrown by the leg's prepare
308
+ * ({@link judgeLegRow}) and answered by a preview of that leg alike. */
309
+ export declare function legRowRefusal(sessionId: string, verdict: Exclude<RowAdmission, {
310
+ open: true;
311
+ }>): Error & {
312
+ code: string;
313
+ };
314
+ /** What a leg's row is judged by ({@link JudgedLeg}), read off its spec, its internals and its tree's owner (`undefined` = the leg holds
315
+ * no seat: nothing is judged). The one reading of a leg's prepare and of a preview of that leg. */
316
+ export declare function judgedLegOf(spec: {
317
+ readonly sessionId?: string;
318
+ readonly requireExistingSession?: boolean;
319
+ readonly signal?: AbortSignal;
320
+ }, internals: {
321
+ readonly sessionIdMintedBySpawner?: boolean;
322
+ } | undefined, treeOwner: {
323
+ readonly owner: string | null;
324
+ } | undefined): JudgedLeg | undefined;
325
+ /** Whether a read of a row stands for the head a judgement read (`judged`; `null` = judged not there): the head after the read records
326
+ * the same owner on the same occupant. A row judged not there stands for no read. */
327
+ export declare function readStandsAsJudged(judged: SessionHead | null, now: SessionHead | undefined): boolean;
298
328
  /** What a delegated leg's row is judged by in prepare: the tree owner its seat bound (`owner`; `null` = anonymous), whether the engine
299
329
  * minted the id for this leg's create-capable acquire (`minted` — no author named it: the store's mint, or the spawning lane's,
300
330
  * `RunInternals.sessionIdMintedBySpawner`), and the leg's own stop (`signal`, its spec's). */
@@ -135,6 +135,8 @@ export async function judgeRowForTree(sessions, row, tree, signal) {
135
135
  const recordOwner = sessions.recordOwner;
136
136
  if (typeof recordOwner !== "function")
137
137
  return claimUnavailable();
138
+ if (row.writes === false)
139
+ return { open: true, claimed: false, head };
138
140
  let answered;
139
141
  try {
140
142
  answered = await boundedOwnerRead(() => Promise.resolve().then(() => recordOwner.call(sessions, sessionId, owner, { row: { owner: null, ...(head.incarnation !== undefined ? { incarnation: head.incarnation } : {}) } })), signal, "delegation owner claim");
@@ -167,10 +169,13 @@ export async function readJudgedRow(sessions, sessionId, verdict, read, signal)
167
169
  throw runAbortedError();
168
170
  return { refused: storeFault("storage", `the row could not be read back after the read (${ownerReadEnd(err) === "unanswered" ? "the session store did not answer in time" : "the session store's read failed"})`, err) };
169
171
  }
170
- if (judged !== null && now !== undefined && (now.owner ?? null) === (judged.owner ?? null) && sameOccupant(now.incarnation, judged.incarnation))
172
+ if (readStandsAsJudged(judged, now))
171
173
  return { read: value };
172
174
  await forgetHeld(sessions, sessionId);
173
- return { refused: refused("the row is not the one judged — it changed hands, was laid down again, or was not there when it was judged") };
175
+ return { refused: rowNotTheOneJudged() };
176
+ }
177
+ export function rowNotTheOneJudged() {
178
+ return { open: false, kind: "not_ours", why: "the row is not the one judged — it changed hands, was laid down again, or was not there when it was judged" };
174
179
  }
175
180
  export async function judgeRowForSeat(sessions, row, seat, signal) {
176
181
  return judgeRowForTree(sessions, row, await delegationOwnerOf(seat, signal), signal);
@@ -268,9 +273,20 @@ export async function judgeLegRow(sessions, held, leg, report) {
268
273
  if (verdict.open)
269
274
  return;
270
275
  await forgetHeld(sessions, held.sessionId, report);
276
+ throw legRowRefusal(held.sessionId, verdict);
277
+ }
278
+ export function legRowRefusal(sessionId, verdict) {
271
279
  if (verdict.kind === "store")
272
- throw rowStoreFaultError(held.sessionId, verdict);
273
- throw Object.assign(new Error(`the session row ${held.sessionId} does not record this delegation tree's owner: ${verdict.why}`), { code: DELEGATION_OWNER_MISMATCH });
280
+ return rowStoreFaultError(sessionId, verdict);
281
+ return Object.assign(new Error(`the session row ${sessionId} does not record this delegation tree's owner: ${verdict.why}`), { code: DELEGATION_OWNER_MISMATCH });
282
+ }
283
+ export function judgedLegOf(spec, internals, treeOwner) {
284
+ if (treeOwner === undefined)
285
+ return undefined;
286
+ return { owner: treeOwner.owner, minted: spec.requireExistingSession !== true && (spec.sessionId === undefined || internals?.sessionIdMintedBySpawner === true), ...(spec.signal !== undefined ? { signal: spec.signal } : {}) };
287
+ }
288
+ export function readStandsAsJudged(judged, now) {
289
+ return judged !== null && now !== undefined && (now.owner ?? null) === (judged.owner ?? null) && sameOccupant(now.incarnation, judged.incarnation);
274
290
  }
275
291
  function forgetHeld(sessions, sessionId, report) {
276
292
  return settleTeardownLeg(() => Promise.resolve(sessions.forget ? sessions.forget(sessionId) : undefined).catch(() => undefined), "forget (acquire-reconcile owner judgement leg)", report && ((e) => report(e, sessionId)));
@@ -47,6 +47,8 @@ export declare function settleFileHistoryRestore(input: {
47
47
  /** Refuse before any file moves when the restore would refuse or fail one ({@link planFileHistoryRestore}) — a caller that does
48
48
  * not accept a partial restore; a caller that reads the ledger itself leaves it off. */
49
49
  wholeOrNothing: boolean;
50
+ /** Handed to the store's restore as it is: the store's restore input (`forkedSession` there) says what the fact is and what it changes. */
51
+ forkedSession?: boolean;
50
52
  /** The rewind's record of whether the tree moved ({@link RewindOutcome.moved}): written here once the restore asked the env what
51
53
  * it asked — whatever the restore then answers, or if it throws; untouched when the restore is refused before it runs. */
52
54
  outcome?: Pick<RewindOutcome, "moved">;
@@ -108,7 +110,7 @@ export declare function refuseFailedPlan(planned: FileHistoryRestoreResult, targ
108
110
  * half on the env it is handed restores such a history). The sentence names the frozen files ({@link listFrozenFileHistoryEntries}'s
109
111
  * same set) and the way on. A plan with no such write returns.
110
112
  */
111
- export declare function refuseUnheldPlan(plan: Pick<FileHistoryRestorePlan, "restore" | "unheld">, target: string, sessionId: string, ask: BoundaryAsk): void;
113
+ export declare function refuseUnheldPlan(plan: Pick<FileHistoryRestorePlan, "restore" | "unheld" | "unplacedForFork">, target: string, sessionId: string, ask: BoundaryAsk): void;
112
114
  /** What {@link refuseTargetOutsideOwnLog} reads of the session: an entry by id. */
113
115
  export interface OwnLogReader {
114
116
  getEntry(id: string): Promise<unknown>;
@@ -3,7 +3,7 @@ import { planFileHistoryRestore, restoreMovedOf, restoreOptionsAt, witnessEnvOf,
3
3
  import { isGovernanceRetryClass } from "../governance-codes.js";
4
4
  export async function settleFileHistoryRestore(input) {
5
5
  const { store, sessionId, scope, target, env, root } = input;
6
- const plan = await planFileHistoryRestore(store, { scope, entryId: target, env, root, ...(input.signal !== undefined ? { signal: input.signal } : {}), ...(input.options !== undefined ? { options: input.options } : {}) });
6
+ const plan = await planFileHistoryRestore(store, { scope, entryId: target, env, root, ...(input.signal !== undefined ? { signal: input.signal } : {}), ...(input.options !== undefined ? { options: input.options } : {}), ...(input.forkedSession === true ? { forkedSession: true } : {}) });
7
7
  refuseUnheldPlan(plan, target, sessionId, input.before ? "before" : "restore");
8
8
  if (input.wholeOrNothing) {
9
9
  const planned = plan.restore;
@@ -12,7 +12,7 @@ export async function settleFileHistoryRestore(input) {
12
12
  throw restoreFailedError({ ...planned, filesChanged: [], identicalSkipped: [] }, `rewind-files: restore to entry "${target}" was refused before any file moved — the restore would be PARTIAL. Nothing was written or deleted; the plan: ${fileHistoryRestoreLedgerLine(planned, true)}. Repeating the same rewind plans the same; a rewind that restores the rest and answers this ledger is Runner.rewindFiles, and a run spec that accepts a partial restore (acceptPartialRestore) does the same where its host offers that member.`, RUN_STOPPED_RESTORE);
13
13
  }
14
14
  }
15
- const witness = witnessEnvOf(env, plan.holds, plan.states);
15
+ const witness = witnessEnvOf(env, plan.holds, plan.states, input.forkedSession === true ? root : undefined);
16
16
  let answered;
17
17
  try {
18
18
  answered = await store.restore(scope, target, witness.env, root, input.signal, restoreOptionsAt(input.options, root));
@@ -59,10 +59,13 @@ export function refuseFailedPlan(planned, target, sessionId, ask) {
59
59
  }
60
60
  export function refuseUnheldPlan(plan, target, sessionId, ask) {
61
61
  const keys = plan.unheld;
62
- if (keys === undefined)
63
- return;
64
62
  const what = ask === "preview" ? `nothing was previewed for entry "${target}"` : `this rewind to entry "${target}" was not done at all: nothing was written or deleted`;
65
- throw restoreFailedError({ ...plan.restore, filesChanged: [], identicalSkipped: [] }, `rewind-files: session "${sessionId}" has ${keys.length} file(s) an earlier version recorded through a link (${keys.join(", ")}), which this engine no longer writes through a link under any key; this deployment's file-history store did not hand the restore of its files to the engine's shared restore step (applyFileRestoreViaEnv, called on the env the store is handed), so which file each of its writes would land on cannot be read, and none of them can be kept off those files — ${what}. Repeating it answers the same until the store restores through that step; listFrozenFileHistoryEntries lists these files.`, RUN_STOPPED_RESTORE);
63
+ if (keys !== undefined) {
64
+ throw restoreFailedError({ ...plan.restore, filesChanged: [], identicalSkipped: [] }, `rewind-files: session "${sessionId}" has ${keys.length} file(s) an earlier version recorded through a link (${keys.join(", ")}), which this engine no longer writes through a link under any key; this deployment's file-history store did not hand the restore of its files to the engine's shared restore step (applyFileRestoreViaEnv, called on the env the store is handed), so which file each of its writes would land on cannot be read, and none of them can be kept off those files — ${what}. Repeating it answers the same until the store restores through that step; listFrozenFileHistoryEntries lists these files.`, RUN_STOPPED_RESTORE);
65
+ }
66
+ if (plan.unplacedForFork) {
67
+ throw restoreFailedError({ ...plan.restore, filesChanged: [], identicalSkipped: [] }, `rewind-files: session "${sessionId}" was forked from another, and a fork's rewind leaves every file outside its root as it is; this deployment's file-history store did not hand the restore of its files to the engine's shared restore step (applyFileRestoreViaEnv, called on the env the store is handed), so which file each of its writes would land on cannot be read, and none of them can be kept inside its root — ${what}. Repeating it answers the same until the store restores through that step.`, RUN_STOPPED_RESTORE);
68
+ }
66
69
  }
67
70
  function noBoundaryFor(target, sessionId, ask) {
68
71
  return ask === "before" ? beforeWithoutBoundaryRefusal(target, sessionId) : noBoundaryRefusal(target, sessionId, ask === "preview");
@@ -92,7 +95,7 @@ const LEFT_AS_IS_WORDS = {
92
95
  },
93
96
  recorded_outside_root: {
94
97
  ledger: "recorded outside this root",
95
- why: "the version to restore was recorded under a directory outside the one this rewind works in (the session, or the session it was forked from, worked there), so this rewind writes or deletes it neither there nor here; a rewind handed the root it was recorded under restores it",
98
+ why: "this file lies in a directory outside the root this rewind works in (either its version was recorded under another root, or this session was forked from another — a forked session's rewind leaves every file outside its root untouched), so this rewind writes or deletes it neither there nor here; for an unforked session, a rewind handed the root it was recorded under restores it, and for a forked session, rewind in the source session or restore it by hand",
96
99
  beforehand: "a preview (Runner.rewindFiles with dryRun) lists such files before a rewind",
97
100
  },
98
101
  };
@@ -26,12 +26,14 @@ export function createFinishReasonSeat(onNotice, ids) {
26
26
  const dropped = readMember(late, "contentDropped");
27
27
  const valid = (statement === "ending" || statement === "error" || statement === "content") && typeof lateWord === "string" && typeof frames === "number";
28
28
  if (valid && typeof dropped === "string") {
29
+ const ending = statement === "ending" ? lateWord : undefined;
29
30
  if (once(`dropped\u0000${dropped}`)) {
30
31
  deliverEngineNotice(onNotice, {
31
32
  code: "route.stream_content_dropped",
32
- message: `After the provider had already ended a response, its stream sent more of the model's output (first: ${dropped} content; ${frames} frame${frames === 1 ? "" : "s"} after the end in all). ` +
33
+ message: `After the provider had already ended a response, its stream sent more of the model's output (first: ${dropped} content` +
34
+ `${ending !== undefined ? ` alongside the ending "${ending}"` : ""}; ${frames} frame${frames === 1 ? "" : "s"} after the end in all). ` +
33
35
  `The first ending stands and that output was not added to the turn — the answer above may be missing what the model sent after it.`,
34
- detail: { word: dropped, frames, sessionId: ids.sessionId, runId: ids.runId },
36
+ detail: { word: dropped, ...(ending !== undefined ? { ending } : {}), frames, sessionId: ids.sessionId, runId: ids.runId },
35
37
  });
36
38
  }
37
39
  }
@@ -1,5 +1,6 @@
1
1
  import { retiredKeyOf, retiredKeyRefusal } from "../retired-keys.js";
2
2
  import { boundedThrownName } from "../thrown-value.js";
3
+ import { captureProjectSeat } from "../project-seat.js";
3
4
  export const DRAINED_LEG_FRAME_TYPES = Object.freeze(["status", "wiring_manifest", "message_committed", "workspace_changed"]);
4
5
  export const LEG_LABEL_KINDS = Object.freeze(["impl", "verifier", "fix", "rung"]);
5
6
  const drained = new WeakSet();
@@ -50,6 +51,8 @@ export function admitLegFrameSeat(internals, entry) {
50
51
  throw retiredKeyRefusal(hit, "RunInternals");
51
52
  }
52
53
  const read = readLegInternals(internals, entry);
54
+ if (read.parentProject !== undefined)
55
+ read.parentProject = captureProjectSeat(read.parentProject, "RunInternals.parentProject");
53
56
  const seat = read.onLegFrame;
54
57
  if (seat === undefined) {
55
58
  refuseHiddenLegFrameSeat(internals, entry);
@@ -0,0 +1,2 @@
1
+ import { normalizeSkills } from "./synthetic-tools.js";
2
+ export declare function loadedSkills(skills: unknown, onRejected?: (skill: ReturnType<typeof normalizeSkills>[number], delivered: number) => void): ReturnType<typeof normalizeSkills>;
@@ -0,0 +1,10 @@
1
+ import { skillLoadReading } from "./skill-base-dir.js";
2
+ import { SKILL_CONTENT_MAX_CHARS, normalizeSkills } from "./synthetic-tools.js";
3
+ export function loadedSkills(skills, onRejected) {
4
+ return normalizeSkills(skills).filter((s) => {
5
+ const { loads, delivered } = skillLoadReading(s, SKILL_CONTENT_MAX_CHARS);
6
+ if (!loads)
7
+ onRejected?.(s, delivered);
8
+ return loads;
9
+ });
10
+ }
@@ -8,6 +8,7 @@ import type { ReminderDisclosureCounts } from "../reminder-disclosure.js";
8
8
  import type { TaskSpec } from "../task-spec.js";
9
9
  import type { EngineNotice, RunnerDeps, TaskEvent, TaskEventIdentity } from "../types.js";
10
10
  import type { WiringManifest } from "../wiring-manifest.js";
11
+ import type { WiringInstructions } from "../instruction-preview.js";
11
12
  import type { Prepared } from "./contracts.js";
12
13
  /** At most this many names in `files` (and in `alternate.files`). */
13
14
  export declare const NESTED_MEMORY_MAX_NAMES = 8;
@@ -144,13 +145,28 @@ interface LaneHands {
144
145
  readonly root: string;
145
146
  readonly additionalRoots?: ReadonlyArray<DeclaredRoot>;
146
147
  }
148
+ /** What the lane reads of the leg it serves: the model it sizes frames for, the transcript's host texts, the leg's ids, its once-told
149
+ * record and identity. A prepared leg is one; a preview of a leg builds one with nothing behind it to write to. */
150
+ export interface InstructionLaneLeg {
151
+ readonly harness: {
152
+ getModel(): ReturnType<Prepared["harness"]["getModel"]>;
153
+ };
154
+ readonly session: {
155
+ buildContext(): ReturnType<Prepared["session"]["buildContext"]>;
156
+ };
157
+ readonly sessionId: string;
158
+ readonly runId: string;
159
+ readonly announcedListingsRef: Prepared["announcedListingsRef"];
160
+ readonly frameReceipts: Pick<Prepared["frameReceipts"], "listingSnapshotOwed">;
161
+ readonly hookIdentity: Pick<Prepared["hookIdentity"], "taskId" | "isDelegatedChild">;
162
+ }
147
163
  interface LaneSeatCommon {
148
164
  readonly declaration: ScreenedNestedMemory;
149
165
  readonly signal: AbortSignal;
150
166
  readonly mark: string | undefined;
151
167
  readonly counts: ReminderDisclosureCounts | undefined;
152
168
  readonly deps: Pick<RunnerDeps, "onNotice" | "onError">;
153
- readonly leg: () => Pick<Prepared, "harness" | "session" | "sessionId" | "runId" | "announcedListingsRef" | "frameReceipts" | "hookIdentity"> | undefined;
169
+ readonly leg: () => InstructionLaneLeg | undefined;
154
170
  /** The file tools the run's roster mounts, read at each mint — what a frame's sentence (a cut file's way to the rest) may send the
155
171
  * model to; absent outside a Runner: every one taken as mounted. */
156
172
  readonly fileTools?: () => FrameFileTools;
@@ -213,15 +229,16 @@ export interface NestedMemoryLane {
213
229
  * out. The load's per-request size cap is not applied (it can only take frames away). Empty once that load is taken. */
214
230
  owedAhead(triggers: readonly string[]): readonly MintedAttachmentFrame[];
215
231
  /** Each root's members the conversation holds (a read-state entry) or a load has on its way, relative to that root,
216
- * `/`-separated — the declared names first, in declaration order (`files`, then `localFiles`), then the rules by path: the
217
- * task root's (`selected`) and, under the opt-in, each additional root's in declaration order (the wiring manifest's
218
- * member); none on a lane with no hands (it reads no file). */
219
- selected(): NonNullable<WiringManifest["instructions"]> | undefined;
232
+ * `/`-separated, plus first-load `@`-included and withheld entries (present iff non-empty); `undefined` on a lane with no
233
+ * hands unless host-text withholds occurred. */
234
+ selected(): WiringInstructions | undefined;
220
235
  /** Is this key a member of the declared family — at a root's own level, or at any level — read off the declaration
221
236
  * and the path alone (a member's name, or a markdown file under a rules directory), whoever wrote its entry? */
222
237
  isMember(key: string, at: "root" | "any"): boolean;
223
238
  }
224
239
  export declare function createNestedMemoryLane(seat: NestedMemoryLaneSeat): NestedMemoryLane;
240
+ /** One first-load reading over a seated lane — shared by `primeInstructionLane` (manifest) and `Runner.previewInstructions`. */
241
+ export declare function primeInstructionReading(lane: NestedMemoryLane, report: (e: Error) => void): Promise<WiringInstructions | undefined>;
225
242
  /** The leg's first load, before its manifest goes out, and the manifest's `instructions` member it answers
226
243
  * ({@link WiringManifest.instructions}). A load that throws leaves the leg's first request to load (the operator hears
227
244
  * why); the manifest then says what the read state holds. */