@sema-agent/core 7.67.3 → 7.68.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 (496) hide show
  1. package/CHANGELOG.md +1516 -0
  2. package/README.md +18 -9
  3. package/README.zh-CN.md +16 -8
  4. package/dist/agents/agent-definition.d.ts +1 -1
  5. package/dist/agents/agent-definition.js +4 -1
  6. package/dist/agents/cascade.d.ts +2 -2
  7. package/dist/agents/cascade.js +3 -1
  8. package/dist/agents/cumulative-stats.d.ts +2 -1
  9. package/dist/agents/cumulative-stats.js +4 -1
  10. package/dist/agents/list-agents-tool.d.ts +30 -0
  11. package/dist/agents/list-agents-tool.js +45 -3
  12. package/dist/agents/peer-admission.d.ts +2 -2
  13. package/dist/agents/peer-session-drain.d.ts +2 -0
  14. package/dist/agents/peer-session-drain.js +1 -0
  15. package/dist/agents/repair-loop.js +3 -1
  16. package/dist/agents/retain-ledger.d.ts +61 -8
  17. package/dist/agents/retain-ledger.js +25 -3
  18. package/dist/agents/roster-store.d.ts +4 -2
  19. package/dist/agents/send-message-tool.d.ts +1 -1
  20. package/dist/agents/send-message-tool.js +20 -15
  21. package/dist/agents/subagent-steps.js +2 -10
  22. package/dist/agents/subagent.d.ts +3 -0
  23. package/dist/agents/subagent.js +106 -76
  24. package/dist/agents/tool-filter.d.ts +20 -11
  25. package/dist/agents/tool-filter.js +8 -4
  26. package/dist/agents/verify.d.ts +3 -1
  27. package/dist/agents/verify.js +2 -0
  28. package/dist/brain/anthropic.js +4 -4
  29. package/dist/brain/open-responses.js +3 -1
  30. package/dist/brain/openai.js +3 -1
  31. package/dist/brain/reasoning-request.d.ts +73 -19
  32. package/dist/brain/reasoning-request.js +164 -72
  33. package/dist/brain/reasoning-stamp.d.ts +26 -0
  34. package/dist/brain/reasoning-stamp.js +10 -0
  35. package/dist/brain/reasoning.d.ts +95 -162
  36. package/dist/brain/reasoning.js +31 -86
  37. package/dist/brain/route-adjudicator.d.ts +9 -7
  38. package/dist/brain/route-adjudicator.js +12 -10
  39. package/dist/brain/status-sink.d.ts +19 -64
  40. package/dist/brain/status-sink.js +5 -21
  41. package/dist/brain/stream-engine.d.ts +11 -2
  42. package/dist/brain/stream-engine.js +10 -0
  43. package/dist/core/a2a.d.ts +17 -5
  44. package/dist/core/a2a.js +11 -3
  45. package/dist/core/allow-entry.d.ts +35 -15
  46. package/dist/core/allow-entry.js +47 -60
  47. package/dist/core/ask-headline.d.ts +68 -0
  48. package/dist/core/ask-headline.js +23 -0
  49. package/dist/core/ask-origin.d.ts +36 -8
  50. package/dist/core/ask-origin.js +17 -10
  51. package/dist/core/ask-question.d.ts +34 -7
  52. package/dist/core/ask-question.js +10 -1
  53. package/dist/core/ask-unresolvable-notice.d.ts +7 -0
  54. package/dist/core/ask-unresolvable-notice.js +9 -3
  55. package/dist/core/auto-strip.d.ts +53 -0
  56. package/dist/core/auto-strip.js +76 -0
  57. package/dist/core/background-agent-store.d.ts +45 -5
  58. package/dist/core/background-agent-store.js +69 -15
  59. package/dist/core/background-shell.d.ts +2 -2
  60. package/dist/core/caller-text.js +2 -2
  61. package/dist/core/canonical-json.d.ts +13 -0
  62. package/dist/core/canonical-json.js +7 -0
  63. package/dist/core/checkpoint-features.d.ts +66 -20
  64. package/dist/core/checkpoint-features.js +12 -1
  65. package/dist/core/checkpoint-generation.d.ts +1 -1
  66. package/dist/core/checkpoint-queries.d.ts +1 -1
  67. package/dist/core/checkpoint-queries.js +4 -1
  68. package/dist/core/checkpoint-requirements.d.ts +25 -1
  69. package/dist/core/checkpoint-requirements.js +5 -1
  70. package/dist/core/checkpoint-row-verdict.d.ts +1 -0
  71. package/dist/core/checkpoint-row-verdict.js +4 -0
  72. package/dist/core/checkpoint-store.d.ts +66 -38
  73. package/dist/core/checkpoint-store.js +15 -6
  74. package/dist/core/child-clamp-seats.d.ts +6 -0
  75. package/dist/core/child-clamp-seats.js +1 -0
  76. package/dist/core/config-refusal-codes.d.ts +1 -1
  77. package/dist/core/config-refusal-codes.js +1 -0
  78. package/dist/core/delegation-frames.d.ts +9 -12
  79. package/dist/core/delegation-frames.js +9 -8
  80. package/dist/core/engine-capabilities.d.ts +21 -8
  81. package/dist/core/engine-capabilities.js +1 -1
  82. package/dist/core/engine-notice.d.ts +147 -34
  83. package/dist/core/engine-notice.js +27 -16
  84. package/dist/core/engine-storage-backend.d.ts +2 -1
  85. package/dist/core/env-budget.js +3 -3
  86. package/dist/core/env-knob-announce.d.ts +10 -10
  87. package/dist/core/env-knob-announce.js +3 -6
  88. package/dist/core/file-history-store.d.ts +29 -4
  89. package/dist/core/file-history-store.js +13 -0
  90. package/dist/core/frame-settlement.d.ts +2 -1
  91. package/dist/core/gate-fold.js +1 -1
  92. package/dist/core/gate-lanes.js +56 -49
  93. package/dist/core/governance-codes.d.ts +39 -3
  94. package/dist/core/governance-codes.js +61 -3
  95. package/dist/core/hooks.d.ts +29 -11
  96. package/dist/core/hooks.js +5 -2
  97. package/dist/core/human-input-projection.js +3 -3
  98. package/dist/core/input-author.d.ts +17 -3
  99. package/dist/core/input-author.js +15 -3
  100. package/dist/core/leg-identity.d.ts +10 -28
  101. package/dist/core/leg-identity.js +1 -21
  102. package/dist/core/lsp.d.ts +18 -13
  103. package/dist/core/lsp.js +30 -22
  104. package/dist/core/mailbox-store.d.ts +1 -1
  105. package/dist/core/mailbox-store.js +4 -4
  106. package/dist/core/mcp-connection-pool.d.ts +93 -4
  107. package/dist/core/mcp-connection-pool.js +104 -1
  108. package/dist/core/mcp-failure.d.ts +38 -12
  109. package/dist/core/mcp-failure.js +9 -13
  110. package/dist/core/mcp-probe.d.ts +4 -3
  111. package/dist/core/mcp-server-link.d.ts +4 -2
  112. package/dist/core/mcp-server-link.js +4 -5
  113. package/dist/core/mcp-server-spec.d.ts +3 -3
  114. package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
  115. package/dist/core/mcp-server-unavailable-notice.js +18 -4
  116. package/dist/core/mcp.d.ts +40 -6
  117. package/dist/core/mcp.js +39 -13
  118. package/dist/core/memory-engine/content-origin.js +2 -2
  119. package/dist/core/memory-engine/control-objects.d.ts +2 -4
  120. package/dist/core/memory-engine/control-objects.js +2 -10
  121. package/dist/core/memory-engine/delegation-settlement.js +6 -1
  122. package/dist/core/memory-engine/dual-root.js +3 -0
  123. package/dist/core/memory-engine/engine.d.ts +6 -4
  124. package/dist/core/memory-engine/engine.js +32 -29
  125. package/dist/core/memory-engine/file-backend.d.ts +20 -5
  126. package/dist/core/memory-engine/file-backend.js +21 -31
  127. package/dist/core/memory-engine/frontmatter.d.ts +2 -0
  128. package/dist/core/memory-engine/frontmatter.js +4 -0
  129. package/dist/core/memory-engine/layout.d.ts +114 -20
  130. package/dist/core/memory-engine/layout.js +340 -22
  131. package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
  132. package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
  133. package/dist/core/memory-engine/mount-failed-notice.js +43 -10
  134. package/dist/core/memory-engine/sync-client.js +4 -5
  135. package/dist/core/model-fallbacks.d.ts +5 -1
  136. package/dist/core/model-fallbacks.js +3 -3
  137. package/dist/core/model-receipt.d.ts +2 -1
  138. package/dist/core/model-receipt.js +12 -1
  139. package/dist/core/mods/kernel/dispatch.d.ts +2 -2
  140. package/dist/core/mods/kernel/dispatch.js +14 -6
  141. package/dist/core/mods/kernel/events.d.ts +8 -5
  142. package/dist/core/mods/kernel/events.js +2 -2
  143. package/dist/core/mods/kernel/index.d.ts +1 -1
  144. package/dist/core/mods/kernel/registration.d.ts +9 -0
  145. package/dist/core/mods/package.js +1 -1
  146. package/dist/core/mods/session-append.d.ts +4 -2
  147. package/dist/core/mods/session-append.js +3 -0
  148. package/dist/core/mods/stations.d.ts +7 -11
  149. package/dist/core/mods/stations.js +4 -7
  150. package/dist/core/mods/tool-call.d.ts +10 -8
  151. package/dist/core/mods/tool-call.js +15 -18
  152. package/dist/core/mounted-mcp.d.ts +0 -4
  153. package/dist/core/mounted-mcp.js +1 -1
  154. package/dist/core/park-noun.d.ts +24 -0
  155. package/dist/core/park-noun.js +21 -0
  156. package/dist/core/park-resumability.d.ts +60 -0
  157. package/dist/core/park-resumability.js +30 -0
  158. package/dist/core/permission-rule-provider.d.ts +24 -2
  159. package/dist/core/permission-rule-provider.js +11 -8
  160. package/dist/core/permission-rule-store.d.ts +8 -1
  161. package/dist/core/permission-rule-store.js +2 -3
  162. package/dist/core/permission-rules.d.ts +2 -1
  163. package/dist/core/permission-rules.js +8 -4
  164. package/dist/core/persisted-rule-arms.d.ts +3 -0
  165. package/dist/core/persisted-rule-arms.js +2 -1
  166. package/dist/core/present-plan-tool.d.ts +47 -3
  167. package/dist/core/present-plan-tool.js +62 -4
  168. package/dist/core/principal-name.d.ts +1 -1
  169. package/dist/core/principal-name.js +5 -5
  170. package/dist/core/process-identity.js +10 -5
  171. package/dist/core/protocol-http-auth.d.ts +20 -14
  172. package/dist/core/protocol-http-auth.js +70 -50
  173. package/dist/core/read-only-shell.js +9 -5
  174. package/dist/core/redaction-marks.d.ts +4 -26
  175. package/dist/core/redaction-marks.js +9 -21
  176. package/dist/core/remote-env.d.ts +43 -16
  177. package/dist/core/remote-env.js +1 -1
  178. package/dist/core/request-copy-projection.d.ts +1 -1
  179. package/dist/core/request-copy-projection.js +40 -50
  180. package/dist/core/resume-config-judge.js +1 -1
  181. package/dist/core/resume-startup-cause.d.ts +35 -18
  182. package/dist/core/resume-startup-cause.js +13 -10
  183. package/dist/core/retention.d.ts +167 -25
  184. package/dist/core/retention.js +100 -20
  185. package/dist/core/roles.d.ts +6 -0
  186. package/dist/core/roles.js +11 -5
  187. package/dist/core/rule-lane-reads.d.ts +3 -0
  188. package/dist/core/rule-lane-reads.js +5 -1
  189. package/dist/core/rule-store-fault.d.ts +70 -0
  190. package/dist/core/rule-store-fault.js +102 -0
  191. package/dist/core/runner/advertised-writable-dirs.js +16 -31
  192. package/dist/core/runner/announce-once-ledger.d.ts +19 -2
  193. package/dist/core/runner/announce-once-ledger.js +24 -2
  194. package/dist/core/runner/assemble-result.d.ts +6 -0
  195. package/dist/core/runner/assemble-result.js +1 -1
  196. package/dist/core/runner/auto-strip-notice.d.ts +36 -0
  197. package/dist/core/runner/auto-strip-notice.js +59 -0
  198. package/dist/core/runner/branch-window.d.ts +3 -0
  199. package/dist/core/runner/branch-window.js +37 -0
  200. package/dist/core/runner/caller-roster.d.ts +8 -3
  201. package/dist/core/runner/capability-withheld-seat.js +3 -9
  202. package/dist/core/runner/clock-and-limits.d.ts +22 -1
  203. package/dist/core/runner/clock-and-limits.js +30 -0
  204. package/dist/core/runner/contracts.d.ts +58 -35
  205. package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
  206. package/dist/core/runner/credential-refusal-seat.js +47 -0
  207. package/dist/core/runner/cross-boundary-lane.js +6 -4
  208. package/dist/core/runner/decide-continuation.js +1 -1
  209. package/dist/core/runner/file-history-restore.d.ts +53 -2
  210. package/dist/core/runner/file-history-restore.js +29 -10
  211. package/dist/core/runner/forward-sink.d.ts +14 -1
  212. package/dist/core/runner/forward-sink.js +14 -12
  213. package/dist/core/runner/gate-exit.d.ts +8 -7
  214. package/dist/core/runner/gate-exit.js +13 -13
  215. package/dist/core/runner/git-status-frame.js +2 -4
  216. package/dist/core/runner/initial-run-state.js +1 -1
  217. package/dist/core/runner/main-call-account.d.ts +3 -1
  218. package/dist/core/runner/main-call-account.js +5 -3
  219. package/dist/core/runner/mcp-redial.d.ts +2 -5
  220. package/dist/core/runner/mcp-redial.js +2 -2
  221. package/dist/core/runner/nested-memory-content.d.ts +7 -1
  222. package/dist/core/runner/nested-memory-content.js +73 -13
  223. package/dist/core/runner/nested-memory-lane.d.ts +44 -19
  224. package/dist/core/runner/nested-memory-lane.js +152 -76
  225. package/dist/core/runner/park-commit.js +3 -1
  226. package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
  227. package/dist/core/runner/permission-rule-lanes.js +29 -3
  228. package/dist/core/runner/person-path-rows.d.ts +3 -11
  229. package/dist/core/runner/person-path-rows.js +21 -24
  230. package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
  231. package/dist/core/runner/prepare-artifact.d.ts +1 -1
  232. package/dist/core/runner/prepare-artifact.js +20 -14
  233. package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
  234. package/dist/core/runner/prepare-ask-lane.js +6 -5
  235. package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
  236. package/dist/core/runner/prepare-boundary-parks.js +27 -24
  237. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
  238. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  239. package/dist/core/runner/prepare-config-doors.d.ts +9 -24
  240. package/dist/core/runner/prepare-config-doors.js +58 -41
  241. package/dist/core/runner/prepare-context-lane.d.ts +2 -2
  242. package/dist/core/runner/prepare-context-lane.js +3 -5
  243. package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
  244. package/dist/core/runner/prepare-defer-classify.js +1 -1
  245. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  246. package/dist/core/runner/prepare-delegation-surface.js +3 -2
  247. package/dist/core/runner/prepare-file-history.d.ts +62 -26
  248. package/dist/core/runner/prepare-file-history.js +117 -46
  249. package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
  250. package/dist/core/runner/prepare-gate-stations.js +6 -5
  251. package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
  252. package/dist/core/runner/prepare-hands-readface.js +8 -4
  253. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  254. package/dist/core/runner/prepare-inherited-gate.js +6 -6
  255. package/dist/core/runner/prepare-listings.d.ts +1 -1
  256. package/dist/core/runner/prepare-listings.js +1 -1
  257. package/dist/core/runner/prepare-memory.js +2 -2
  258. package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
  259. package/dist/core/runner/prepare-offload-wrappers.js +1 -1
  260. package/dist/core/runner/prepare-park-ask.d.ts +10 -3
  261. package/dist/core/runner/prepare-park-ask.js +7 -9
  262. package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
  263. package/dist/core/runner/prepare-policy-chain.js +18 -13
  264. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  265. package/dist/core/runner/prepare-project-context.js +5 -3
  266. package/dist/core/runner/prepare-prompt-assembly.js +2 -1
  267. package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
  268. package/dist/core/runner/prepare-prompt-inputs.js +1 -1
  269. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
  270. package/dist/core/runner/prepare-protocol-tools.js +7 -7
  271. package/dist/core/runner/prepare-question-face.d.ts +4 -2
  272. package/dist/core/runner/prepare-run-refs.d.ts +7 -2
  273. package/dist/core/runner/prepare-run-refs.js +8 -7
  274. package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
  275. package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
  276. package/dist/core/runner/prepare-suspend-saga.js +4 -3
  277. package/dist/core/runner/prepare-task.js +66 -53
  278. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
  279. package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
  280. package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
  281. package/dist/core/runner/prepare-turn-wiring.js +1 -1
  282. package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
  283. package/dist/core/runner/prepare-wiring-manifest.js +14 -6
  284. package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
  285. package/dist/core/runner/prepare-workspace-restore.js +15 -6
  286. package/dist/core/runner/remote-env-retry.d.ts +3 -3
  287. package/dist/core/runner/restore-seat.d.ts +41 -0
  288. package/dist/core/runner/restore-seat.js +38 -0
  289. package/dist/core/runner/resume-admission.js +1 -1
  290. package/dist/core/runner/resume-apply.js +4 -3
  291. package/dist/core/runner/resume-checkpoint-screen.js +2 -1
  292. package/dist/core/runner/resume-internals-and-config.js +2 -1
  293. package/dist/core/runner/resume-preflight.js +2 -1
  294. package/dist/core/runner/rewind-files.js +22 -6
  295. package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
  296. package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
  297. package/dist/core/runner/run-brain-sinks.d.ts +3 -6
  298. package/dist/core/runner/run-brain-sinks.js +6 -6
  299. package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
  300. package/dist/core/runner/run-git-lane.d.ts +2 -0
  301. package/dist/core/runner/run-git-lane.js +2 -1
  302. package/dist/core/runner/run-harness-handlers.js +5 -4
  303. package/dist/core/runner/run-identity-wiring.js +20 -12
  304. package/dist/core/runner/run-leg.js +31 -72
  305. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  306. package/dist/core/runner/run-notification-lane.js +2 -4
  307. package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
  308. package/dist/core/runner/run-reasoning-seat.js +13 -18
  309. package/dist/core/runner/run-settle-and-teardown.js +13 -9
  310. package/dist/core/runner/run-terminal-adoption.js +4 -8
  311. package/dist/core/runner/run-turn-boundary.js +6 -3
  312. package/dist/core/runner/runtask.d.ts +9 -4
  313. package/dist/core/runner/runtask.js +29 -22
  314. package/dist/core/runner/session-rule-policy.d.ts +11 -1
  315. package/dist/core/runner/shell-env-withheld.js +2 -7
  316. package/dist/core/runner/side-call-account.d.ts +5 -6
  317. package/dist/core/runner/side-call-account.js +2 -2
  318. package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
  319. package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
  320. package/dist/core/runner/stream-settle-backstop.js +4 -6
  321. package/dist/core/runner/stream-steer-verb.d.ts +1 -1
  322. package/dist/core/runner/stream-steer-verb.js +4 -4
  323. package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
  324. package/dist/core/runner/sub-agent-deny-lists.js +7 -4
  325. package/dist/core/runner/teardown-bounded.d.ts +7 -0
  326. package/dist/core/runner/teardown-bounded.js +7 -0
  327. package/dist/core/runner/terminal-account.js +41 -13
  328. package/dist/core/runner/terminal-projection.d.ts +1 -5
  329. package/dist/core/runner/tool-end-body.d.ts +9 -3
  330. package/dist/core/runner/tool-end-body.js +6 -3
  331. package/dist/core/runner/tool-output-projection.d.ts +13 -4
  332. package/dist/core/runner/tool-output-projection.js +10 -14
  333. package/dist/core/runner/turn-attachments.d.ts +3 -2
  334. package/dist/core/runner/turn-attachments.js +12 -5
  335. package/dist/core/runner-deps.d.ts +6 -6
  336. package/dist/core/runtime-caps.d.ts +2 -1
  337. package/dist/core/secret-env.d.ts +20 -3
  338. package/dist/core/secret-env.js +13 -15
  339. package/dist/core/session-checkout.d.ts +115 -15
  340. package/dist/core/session-checkout.js +435 -136
  341. package/dist/core/session-policy-store.js +21 -3
  342. package/dist/core/session-reconcile.js +1 -0
  343. package/dist/core/session-store.js +2 -0
  344. package/dist/core/session.d.ts +11 -1
  345. package/dist/core/shell-run-candidates.d.ts +1 -0
  346. package/dist/core/shell-run-candidates.js +1 -1
  347. package/dist/core/shutdown-debug.d.ts +6 -5
  348. package/dist/core/shutdown-debug.js +5 -1
  349. package/dist/core/skill-grant.js +4 -1
  350. package/dist/core/skills-directory.js +5 -3
  351. package/dist/core/spec-contract.d.ts +1 -1
  352. package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
  353. package/dist/core/store-contracts/file-history-store-contract.js +26 -2
  354. package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
  355. package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
  356. package/dist/core/store-contracts/task-list-store-contract.js +28 -1
  357. package/dist/core/task-event.d.ts +48 -27
  358. package/dist/core/task-notification.d.ts +15 -9
  359. package/dist/core/task-notification.js +12 -0
  360. package/dist/core/task-registry-agent.d.ts +24 -22
  361. package/dist/core/task-registry-agent.js +65 -46
  362. package/dist/core/task-registry-shared.d.ts +17 -5
  363. package/dist/core/task-registry.d.ts +17 -6
  364. package/dist/core/task-registry.js +6 -1
  365. package/dist/core/task-result.d.ts +71 -25
  366. package/dist/core/task-spec-members.d.ts +0 -1
  367. package/dist/core/task-spec-members.js +1 -1
  368. package/dist/core/task-spec.d.ts +60 -52
  369. package/dist/core/task-stream.d.ts +45 -12
  370. package/dist/core/terminal-cause.d.ts +45 -8
  371. package/dist/core/terminal-cause.js +5 -0
  372. package/dist/core/tool-card-bound.d.ts +32 -0
  373. package/dist/core/tool-card-bound.js +33 -0
  374. package/dist/core/tool-catalog-entries.d.ts +9 -0
  375. package/dist/core/tool-catalog-entries.js +48 -0
  376. package/dist/core/tool-errors.d.ts +4 -3
  377. package/dist/core/tool-face.d.ts +3 -3
  378. package/dist/core/tool-mount-facts.d.ts +3 -2
  379. package/dist/core/tool-mount-facts.js +1 -1
  380. package/dist/core/tool-mount-static.js +7 -5
  381. package/dist/core/tool-policy.d.ts +21 -19
  382. package/dist/core/tool-policy.js +5 -6
  383. package/dist/core/tool-registry.d.ts +3 -1
  384. package/dist/core/tool-registry.js +15 -1
  385. package/dist/core/tool-result-store.d.ts +9 -3
  386. package/dist/core/tool-result-store.js +14 -1
  387. package/dist/core/tool-roster.d.ts +6 -0
  388. package/dist/core/tool-roster.js +18 -0
  389. package/dist/core/tool-spec.d.ts +17 -8
  390. package/dist/core/trace.d.ts +35 -31
  391. package/dist/core/types.d.ts +2 -2
  392. package/dist/core/untrusted-egress.d.ts +10 -9
  393. package/dist/core/untrusted-egress.js +9 -9
  394. package/dist/core/untrusted-text.d.ts +0 -18
  395. package/dist/core/untrusted-text.js +7 -3
  396. package/dist/core/user-attachment.d.ts +9 -6
  397. package/dist/core/user-attachment.js +12 -10
  398. package/dist/core/user-row-origin.d.ts +44 -25
  399. package/dist/core/user-row-origin.js +30 -20
  400. package/dist/core/wiring-manifest.d.ts +26 -7
  401. package/dist/core/wiring-manifest.js +14 -11
  402. package/dist/core/workspace-snapshot.d.ts +3 -1
  403. package/dist/core/workspace-snapshot.js +1 -0
  404. package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
  405. package/dist/engine/execution-env/node-execution-env.js +127 -67
  406. package/dist/engine/harness/agent-harness.d.ts +4 -5
  407. package/dist/engine/harness/agent-harness.js +2 -7
  408. package/dist/engine/harness/types.d.ts +51 -19
  409. package/dist/engine/harness/types.js +28 -1
  410. package/dist/engine/llm/types.d.ts +26 -14
  411. package/dist/engine/llm/types.js +2 -2
  412. package/dist/engine/loop/agent-loop.d.ts +2 -2
  413. package/dist/engine/loop/agent-loop.js +51 -275
  414. package/dist/engine/loop/types.d.ts +0 -18
  415. package/dist/engine/session/import-validate.d.ts +3 -0
  416. package/dist/engine/session/import-validate.js +34 -2
  417. package/dist/engine/session/repo-utils.d.ts +42 -4
  418. package/dist/engine/session/repo-utils.js +33 -5
  419. package/dist/engine/session/session.d.ts +41 -14
  420. package/dist/engine/session/session.js +96 -25
  421. package/dist/index.d.ts +21 -16
  422. package/dist/index.js +16 -10
  423. package/dist/orchestration/run-spec.d.ts +1 -1
  424. package/dist/orchestration/run-workflow-tool.d.ts +12 -9
  425. package/dist/orchestration/run-workflow-tool.js +15 -19
  426. package/dist/orchestration/workflow-governance.js +13 -21
  427. package/dist/orchestration/workflow-observe.d.ts +4 -3
  428. package/dist/orchestration/workflow-primitives.d.ts +1 -1
  429. package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
  430. package/dist/orchestration/workflow-record-artifact.js +32 -0
  431. package/dist/orchestration/workflow-script-store.d.ts +9 -0
  432. package/dist/orchestration/workflow-script-store.js +20 -1
  433. package/dist/orchestration/workflow-types.d.ts +33 -3
  434. package/dist/orchestration/workflow.d.ts +24 -14
  435. package/dist/orchestration/workflow.js +52 -23
  436. package/dist/prompt-assembly/artifact.js +4 -8
  437. package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
  438. package/dist/prompt-assembly/catalog/engine.js +30 -0
  439. package/dist/prompt-assembly/catalog/index.d.ts +1 -1
  440. package/dist/prompt-assembly/catalog/index.js +2 -2
  441. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
  442. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
  443. package/dist/prompt-assembly/epoch.js +6 -8
  444. package/dist/prompt-assembly/turn-snapshot.js +8 -9
  445. package/dist/stores/file/background-agent-store.js +5 -6
  446. package/dist/stores/file/checkpoint-store.d.ts +0 -4
  447. package/dist/stores/file/checkpoint-store.js +7 -3
  448. package/dist/stores/file/file-history-store.d.ts +8 -0
  449. package/dist/stores/file/file-history-store.js +72 -0
  450. package/dist/stores/file/fs-atomic.js +17 -12
  451. package/dist/stores/file/index.js +11 -5
  452. package/dist/stores/file/mailbox-store.js +13 -4
  453. package/dist/stores/file/permission-rule-store.js +14 -13
  454. package/dist/stores/file/shared-ledger.d.ts +4 -0
  455. package/dist/stores/file/shared-ledger.js +4 -0
  456. package/dist/stores/file/task-list-store.js +12 -3
  457. package/dist/stores/file/workflow-run-store.js +1 -0
  458. package/dist/tools/fs/bash-program-position.d.ts +4 -2
  459. package/dist/tools/fs/bash-program-position.js +1 -1
  460. package/dist/tools/fs/bash-readonly-classifier.js +1 -1
  461. package/dist/tools/fs/bound-open.d.ts +97 -0
  462. package/dist/tools/fs/bound-open.js +103 -0
  463. package/dist/tools/fs/containment-face.d.ts +2 -2
  464. package/dist/tools/fs/fs-pdf.d.ts +7 -1
  465. package/dist/tools/fs/fs-pdf.js +31 -23
  466. package/dist/tools/fs/fs-read.d.ts +24 -17
  467. package/dist/tools/fs/fs-read.js +84 -53
  468. package/dist/tools/fs/fs-shared.d.ts +14 -12
  469. package/dist/tools/fs/fs-shared.js +5 -4
  470. package/dist/tools/fs/fs-write.d.ts +2 -2
  471. package/dist/tools/fs/fs-write.js +20 -12
  472. package/dist/tools/fs/index.d.ts +4 -4
  473. package/dist/tools/fs/index.js +2 -2
  474. package/dist/tools/fs/notebook.d.ts +1 -1
  475. package/dist/tools/fs/pdf.d.ts +12 -3
  476. package/dist/tools/fs/pdf.js +22 -9
  477. package/dist/tools/fs/read-deny-home.d.ts +3 -2
  478. package/dist/tools/fs/read-deny-home.js +8 -11
  479. package/dist/tools/fs/safety.d.ts +3 -2
  480. package/dist/tools/fs/shell-read-check.js +10 -9
  481. package/dist/tools/monitor.d.ts +6 -5
  482. package/dist/tools/task-list.d.ts +16 -6
  483. package/dist/tools/task-list.js +4 -0
  484. package/dist/tools/web.d.ts +9 -1
  485. package/dist/tools/web.js +8 -3
  486. package/dist/tools/worktree.d.ts +7 -5
  487. package/dist/tools/worktree.js +4 -3
  488. package/package.json +4 -3
  489. package/test/export-surface.snapshot.json +93 -7
  490. package/wire-changes/core-stores-sql@7.68.0.json +39 -0
  491. package/wire-changes/core@7.68.0.json +4257 -0
  492. package/wire-changes/mods-kernel@7.68.0.json +129 -0
  493. package/wire-changes/primitives@7.68.0.json +253 -0
  494. package/wire-changes/wiki-gate@7.68.0.json +39 -0
  495. package/dist/core/runner/credential-origin-seat.d.ts +0 -2
  496. package/dist/core/runner/credential-origin-seat.js +0 -20
@@ -265,8 +265,8 @@ export type ToolLegKind = (typeof TOOL_LEG_KINDS)[number];
265
265
  export declare const SPAWNER_SURFACE_LEG_KINDS: readonly ToolLegKind[];
266
266
  /**
267
267
  * One layer of a tool selector, as data: an allowed-tools list (absent = no allowlist on this layer) and a denied-tools list,
268
- * each a frozen copy of the entries a list was written with. A run's own layer is its `allowTools` and `excludeTools`; the
269
- * layers above it are the ones the run that spawned it was bounded by, plus that run's own.
268
+ * each a frozen copy of the entries a list was written with. A run's own layer is its `allowTools` and `excludeTools` — its
269
+ * allowlist names nothing under `excludeAllTools`; the layers above it are the ones the run that spawned it was bounded by, plus that run's own.
270
270
  */
271
271
  export interface ToolSelectorLayer {
272
272
  readonly allow?: readonly string[];
@@ -313,7 +313,7 @@ export interface ToolCatalogEntry {
313
313
  /** A `modelGate` class the default-bundle assembler stamps on this definition's default arm. */
314
314
  modelGate?: string;
315
315
  /** The leg kinds whose legs rely on this tool as part of their protocol: the leg's OWN lists do not decide it (an allowlist need not
316
- * name it), and a denylist of the leg's own that reaches it is a contradiction the run refuses at prepare. Whether the layers ABOVE
316
+ * name it, the whole-face switch does not take it out), and a denylist of the leg's own that reaches it is a contradiction the run refuses at prepare. Whether the layers ABOVE
317
317
  * the leg decide it follows the row's kinds ({@link SPAWNER_SURFACE_LEG_KINDS}): a row some kind of which shares its spawner's tool
318
318
  * surface is held exactly when the spawner may hold it; any other row is the leg's own channel, which no layer decides — an inherited
319
319
  * deny that reaches it is the same contradiction. */
@@ -9,6 +9,7 @@
9
9
  * phase's point) are not here: the phase that computes one states it beside the judgment that reads it.
10
10
  */
11
11
  import type { ExecutionEnv } from "../internal/harness-types.js";
12
+ import type { ApprovalParkNotResumable } from "./park-resumability.js";
12
13
  import type { ToolMountFact } from "./tool-mount-plan.js";
13
14
  import type { RunnerDeps, TaskSpec } from "./types.js";
14
15
  /** Facts a reader of the mount table states; a fact absent from the record is one it cannot read. */
@@ -37,8 +38,8 @@ export interface QuestionSeatInputs<F extends boolean | undefined = boolean | un
37
38
  readonly parkStore: boolean;
38
39
  readonly forceDurableGate: F;
39
40
  readonly durableApprovalDeclared: boolean;
40
- /** The leg's one fact `approvalParkNotResumable` (`approvalParkNotResumableOf`; a static reader reads a top-level leg: `false`). */
41
- readonly approvalParkNotResumable: boolean;
41
+ /** The leg's one fact `approvalParkNotResumable` (`approvalParkNotResumableOf`; a static reader reads a top-level leg: the host's word only). */
42
+ readonly approvalParkNotResumable: ApprovalParkNotResumable | undefined;
42
43
  }
43
44
  /** `seat.question`: a seat that answers — a live face, or the durable park (a store to wait in AND a declared opt-in). */
44
45
  export declare function questionSeatFact(input: QuestionSeatInputs<boolean>): boolean;
@@ -34,7 +34,7 @@ export function offloadSeatFact(effectiveThreshold) {
34
34
  export function questionSeatFact(input) {
35
35
  if (input.face)
36
36
  return true;
37
- if (!input.parkStore)
37
+ if (!input.parkStore || input.approvalParkNotResumable !== undefined)
38
38
  return false;
39
39
  if (input.forceDurableGate === undefined)
40
40
  return input.durableApprovalDeclared ? true : undefined;
@@ -90,8 +90,9 @@ function envFacts(deps) {
90
90
  }
91
91
  function seatFacts(deps, spec, leavesOffloadReader) {
92
92
  const checkpoint = resolveCheckpointStore(spec, deps) !== undefined;
93
+ const hostNotResumable = spec.durableApproval === false;
93
94
  const facts = {
94
- "seat.checkpoint": checkpoint,
95
+ "seat.checkpoint": checkpoint && !hostNotResumable,
95
96
  "seat.offload": offloadSeatFact(offloadThresholdsOf(spec, deps).effective) && leavesOffloadReader,
96
97
  "seat.offloadBytes": offloadSeatFact(offloadThresholdsOf(spec, deps).effective) && deps.toolResultStore?.bytesOf !== undefined,
97
98
  };
@@ -99,8 +100,8 @@ function seatFacts(deps, spec, leavesOffloadReader) {
99
100
  face: (spec.onQuestion ?? deps.onQuestion) !== undefined,
100
101
  parkStore: checkpoint,
101
102
  forceDurableGate: deps.runtimeCapsResolver === undefined ? false : undefined,
102
- durableApprovalDeclared: spec.durableApproval !== undefined,
103
- approvalParkNotResumable: false,
103
+ durableApprovalDeclared: spec.durableApproval !== undefined && !hostNotResumable,
104
+ approvalParkNotResumable: hostNotResumable ? "host" : undefined,
104
105
  });
105
106
  if (question !== undefined)
106
107
  facts["seat.question"] = question;
@@ -132,11 +133,12 @@ export function planStaticToolMounts(deps, spec) {
132
133
  layers: [{ ...(lists.allow !== undefined ? { allow: lists.allow } : {}), deny: lists.exclude ?? [] }],
133
134
  where: undefined,
134
135
  legs: spec.outputSchema !== undefined ? ["structured"] : [],
136
+ spec,
135
137
  });
136
- const leaves = valveLeaves(spec, selector);
138
+ const leaves = valveLeaves(selector);
137
139
  const preflight = spec.mcp !== undefined || spec.a2a !== undefined ? preflightLockedConfig(spec, deps) : undefined;
138
140
  const entries = callerEntries(deps, spec, lists);
139
- const protocol = protocolReading(preflight, valveLeavesPeer(spec, selector));
141
+ const protocol = protocolReading(preflight, valveLeavesPeer(selector));
140
142
  const facts = new Map();
141
143
  const state = (record) => {
142
144
  for (const f of TOOL_MOUNT_FACTS) {
@@ -9,6 +9,7 @@ import { type DecisionReason } from "./decision-receipt.js";
9
9
  export { isEngineRefusal } from "./decision-receipt.js";
10
10
  import { type RuleBehavior } from "./permission-rule-model.js";
11
11
  import { type RemovalGuardSeat } from "../tools/fs/removal-targets.js";
12
+ import type { ApprovalParkNotResumable } from "./park-resumability.js";
12
13
  /** A tool call presented to a policy before it executes. */
13
14
  /** design/388 B6 — the per-call face (see {@link ToolCallRequest.face}). */
14
15
  export interface ToolCallFace {
@@ -1463,6 +1464,12 @@ export interface AskRequest {
1463
1464
  * ask's reasons from {@link askReasons} (the askers' own words) and the typed members (the class, the origin, the mandate
1464
1465
  * word, {@link probeReason}), never from this line. */
1465
1466
  message: string;
1467
+ /** The card's first line for a PERSON — why they are asked, and whether saving an allow rule would stop it being asked again —
1468
+ * in the run's language (canonical where no run called the resolver): a rendering of {@link askClass} alone (`core/ask-headline.ts`),
1469
+ * **for people to read, never a branch input** (branch on the class / origin / mandate words); {@link message} stays the account.
1470
+ * ABSENT ⇔ no {@link askClass}, or the agent's own question (its card is the question): show {@link message}; not "no reason".
1471
+ * Minted at the resolver's chokepoint (a caller's value is replaced); the parked row and the listing carry it under the same name. */
1472
+ readonly headline?: string;
1466
1473
  /** Runner-filled source identity (design S1d §1): the end-user {@link AskRequest} issuing task's
1467
1474
  * `principal` (design/62). An AGGREGATING `onAsk` (one approver fanning over N delegated workers)
1468
1475
  * attributes asks per-user by this. Worker/tool cannot set it (not a tool arg). Undefined ⇒ no principal.
@@ -1491,7 +1498,8 @@ export interface AskRequest {
1491
1498
  * belongs to a DELEGATED SUBAGENT (the prepareTask `isSubagent` fact — trusted `internals.parentTaskId`
1492
1499
  * presence; a child cannot self-declare or suppress it, internals never ride a TaskSpec). Undefined ⇒ the
1493
1500
  * host / a top-level task. THE explicit "from a background agent" discriminator (replaces presence-
1494
- * or equality-heuristics on {@link sourceSessionId}). `readonly`, sync-path-only, S1d posture. */
1501
+ * or equality-heuristics on {@link sourceSessionId}). `readonly`, sync-path-only, S1d posture.
1502
+ * Every row the leg parks records it (`CheckpointState.fromSubagent`); a resumed leg handed no parent task reads it back. */
1495
1503
  readonly fromSubagent?: true;
1496
1504
  /** design/153 §1 — Runner-filled: the issuing task's display identity (a subagent's explicit agent
1497
1505
  * name, else its agent-type; undefined for the host and unnamed children). **UNTRUSTED-for-display**
@@ -1624,11 +1632,8 @@ export interface AskRequest {
1624
1632
  * safety tightens read (tool declarations + caller `toolAxes` folds) — never derived from tool
1625
1633
  * names, never caller/worker-settable. `irreversible: true` covers both the declared-`"always"`
1626
1634
  * and the `"maybe"` (unproven-reversible) tiers. ABSENT — the whole object or either member —
1627
- * means the engine did not judge that axis: render it as unjudged, never fold absence to `false`. */
1628
- readonly riskAxes?: {
1629
- readonly irreversible?: boolean;
1630
- readonly egress?: boolean;
1631
- };
1635
+ * means the engine did not judge that axis: render it as unjudged, never fold absence to `false`. Twin: `RiskDescriptor.riskAxes`. */
1636
+ readonly riskAxes?: import("./ask-origin.js").CallRiskAxes;
1632
1637
  /** Which approval card this ask renders under — the closed set `TOOL_APPROVAL_CARDS`, `generic` when the tool declares
1633
1638
  * none; the same word the parked gate and the pending row carry for the same call. Display routing only: the card is
1634
1639
  * untrusted-for-display input (a tool may declare any non-reserved card), so a specialised card validates the call's
@@ -1979,28 +1984,23 @@ export declare function durableMandateSourceOf(args: {
1979
1984
  * Does this leg carry a durable park opt-in, with NO live-seat narrowing (unlike {@link durableMandateSourceOf}, "is every ask
1980
1985
  * MANDATED to gate durably")? Read by the question face and mount, the inherited-mandate float and the sandbox prerequisite. The
1981
1986
  * sources: the leg's `durableApproval` (a delegated leg's is the one its parent forwarded), or the `forceDurableGate` entitlement
1982
- * (synthesized into an opt-in). Where the leg's approval park cannot be resumed ({@link approvalParkNotResumableOf}) neither counts. */
1987
+ * (synthesized into an opt-in). Where the leg's decision parks cannot be resumed ({@link approvalParkNotResumableOf}) neither counts. */
1983
1988
  export declare function durableParkOptInDeclared(args: {
1984
1989
  forceDurableGate: boolean;
1985
1990
  durableApprovalDeclared: boolean;
1986
- approvalParkNotResumable: boolean;
1987
- }): boolean;
1988
- /** THE leg fact "an approval park of this leg cannot be resumed", derived once per leg (the driver) and read by name: today's one
1989
- * source is a DELEGATED leg its parent forwarded no opt-in to (a synchronous or fork child; a background child whose lane cannot park). */
1990
- export declare function approvalParkNotResumableOf(leg: {
1991
- delegated: boolean;
1992
- durableApprovalDeclared: boolean;
1991
+ approvalParkNotResumable: ApprovalParkNotResumable | undefined;
1993
1992
  }): boolean;
1994
1993
  /** The leg's EFFECTIVE opt-in: its own (the caller's word wins — it may carry a tighter scope / ttl), else the one the entitlement
1995
- * synthesizes where {@link durableParkOptInDeclared} lets it (the leg's scope, no ttl). ONE derivation for the leg's park mint and
1996
- * the opt-in it forwards (a forced root's background child inherits the facility its parent has, not only what the caller wrote). */
1994
+ * synthesizes where {@link durableParkOptInDeclared} lets it (the leg's scope, no ttl) — on ANY leg whose parks can be resumed, a
1995
+ * delegated one included (a background child on a lane that can park synthesizes its own under a forced principal). ONE derivation
1996
+ * for the leg's park mint and the opt-in it forwards. */
1997
1997
  export declare function effectiveDurableApprovalOf(args: {
1998
1998
  declared: {
1999
1999
  scope: string;
2000
2000
  ttlMs?: number;
2001
2001
  } | undefined;
2002
2002
  forceDurableGate: boolean;
2003
- approvalParkNotResumable: boolean;
2003
+ approvalParkNotResumable: ApprovalParkNotResumable | undefined;
2004
2004
  scope: string;
2005
2005
  }): {
2006
2006
  scope: string;
@@ -2314,7 +2314,7 @@ export interface ApproverDefect {
2314
2314
  * another sentence there), the refusal's record carries the literals that sentence quotes. The list's only source is the record
2315
2315
  * of the station that composed the question; the request carries none. Not re-exported from `src/index.ts`.
2316
2316
  */
2317
- export declare function resolveAskFor(req: AskRequest, onAsk: OnAsk | undefined, signal: AbortSignal | undefined, onLateSettlement: ((late: {
2317
+ export declare function resolveAskFor(asRequested: AskRequest, onAsk: OnAsk | undefined, signal: AbortSignal | undefined, onLateSettlement: ((late: {
2318
2318
  kind: "approve";
2319
2319
  } | {
2320
2320
  kind: "error";
@@ -2322,4 +2322,6 @@ export declare function resolveAskFor(req: AskRequest, onAsk: OnAsk | undefined,
2322
2322
  }) => void) | undefined, asked: object | undefined, onApproverDefect?: (defect: ApproverDefect) => void,
2323
2323
  /** The station's carrier for a person's written `feedback` ({@link AskOutcome}). A station without one is a seat with no lane for
2324
2324
  * words: the answer that brings them is refused, never approved with the words gone. */
2325
- approvalWords?: ApprovalWordsSeat): Promise<ResolvedAsk>;
2325
+ approvalWords?: ApprovalWordsSeat,
2326
+ /** The run's engine text reading, which the card's {@link AskRequest.headline} is minted in; absent ⇒ the canonical text. */
2327
+ say?: import("../prompt-assembly/engine-text.js").EngineText): Promise<ResolvedAsk>;
@@ -9,6 +9,7 @@ import { ownReadRootCandidate, readRootGrantSeat } from "./read-root-grant-scree
9
9
  import { liveWordsOf } from "./approval-words.js";
10
10
  import { DECIDED_VIA, decidersNote, isDecidedVia, policyDeciderOf, settledByDecider } from "./gate-outcome.js";
11
11
  import { unjudgedAllowRefused } from "./real-approval.js";
12
+ import { withEngineHeadline } from "./ask-headline.js";
12
13
  import { receiveMembers } from "./own-property-receipt.js";
13
14
  import { isBlankInput } from "./input-author.js";
14
15
  export { policyCannotAnswer, rowDemandsAPerson } from "./real-approval.js";
@@ -978,10 +979,7 @@ export function durableMandateSourceOf(args) {
978
979
  return undefined;
979
980
  }
980
981
  export function durableParkOptInDeclared(args) {
981
- return !args.approvalParkNotResumable && (args.durableApprovalDeclared || args.forceDurableGate);
982
- }
983
- export function approvalParkNotResumableOf(leg) {
984
- return leg.delegated && !leg.durableApprovalDeclared;
982
+ return args.approvalParkNotResumable === undefined && (args.durableApprovalDeclared || args.forceDurableGate);
985
983
  }
986
984
  export function effectiveDurableApprovalOf(args) {
987
985
  if (!durableParkOptInDeclared({ forceDurableGate: args.forceDurableGate, durableApprovalDeclared: args.declared !== undefined, approvalParkNotResumable: args.approvalParkNotResumable }))
@@ -1010,7 +1008,7 @@ export function extensionNamed(registration) {
1010
1008
  }
1011
1009
  export function extensionQuestionText(toolName, entry) {
1012
1010
  const who = entry.registration !== undefined ? extensionNamed(entry.registration) : "an extension";
1013
- const why = entry.cause === "verdict_unreadable" ? ": the hook's verdict could not be read" : entry.cause === "verdict_unfinished" ? ": the hook did not finish with a verdict" : entry.words !== undefined ? `: ${entry.words}` : "";
1011
+ const why = entry.words !== undefined ? `: ${entry.words}` : "";
1014
1012
  return `tool "${toolName}" needs approval (asked by ${who}${why})`;
1015
1013
  }
1016
1014
  export function foldHookAsk(verdict, hookAsk) {
@@ -1208,7 +1206,8 @@ export function cardCarriesBidiControls(card) {
1208
1206
  export async function resolveAsk(req, onAsk, signal, onLateSettlement) {
1209
1207
  return resolveAskFor(req, onAsk, signal, onLateSettlement, undefined);
1210
1208
  }
1211
- export async function resolveAskFor(req, onAsk, signal, onLateSettlement, asked, onApproverDefect, approvalWords) {
1209
+ export async function resolveAskFor(asRequested, onAsk, signal, onLateSettlement, asked, onApproverDefect, approvalWords, say) {
1210
+ const req = withEngineHeadline(asRequested, say);
1212
1211
  const askedDigest = exactBoundInputHashOf(req.toolName, req.args);
1213
1212
  const question = asked !== undefined ? engineSentenceOf(asked, req) : undefined;
1214
1213
  const { settlement, bindingRefusal, quotesQuestion, feedback: words, ...r } = await resolveAskArms(req, onAsk, signal, onLateSettlement, approvalWords !== undefined);
@@ -8,7 +8,7 @@
8
8
  * name matches" — the rule that pins the two fail-open shapes a per-name table had (one name, two
9
9
  * definitions; the table could only hold one).
10
10
  *
11
- * Layer-0 vocabulary: depends on the leaf catalog and the face vocabulary only.
11
+ * Layer-0 vocabulary: depends on the leaf catalog, the face vocabulary and the engine's one name judgment only.
12
12
  */
13
13
  import { type ToolCallPathTarget, type ToolCatalogEntry, type ToolFamily, type ToolHostTarget, type ToolPathAccess } from "./tool-face.js";
14
14
  /** The whole static catalog, one frozen row per definition (design/388 §2.1 `describeToolCatalog()`).
@@ -191,6 +191,8 @@ export declare function handBandEffects(): ReadonlyMap<string, NonNullable<ToolC
191
191
  /** A-3 / L4 — every `details.type` card the engine owns: the catalog's per-definition cards plus the
192
192
  * engine-minted ones (protocol channels, fs refusals). */
193
193
  export declare function engineCardTypes(): ReadonlySet<string>;
194
+ /** The members a card of kind `type` keeps in its skeleton (`CARD_SKELETONS`); none for a kind with no row — a caller's card. */
195
+ export declare function cardSkeletonMembers(type: string): readonly string[];
194
196
  /** The closed set as a Set, for callers that validate a tag read off the wire. */
195
197
  export declare const TOOL_MOUNT_TAG_SET: ReadonlySet<string>;
196
198
  export { HANDS_BAND_TAGS, MOUNT_TAG_IN_HANDS_BAND } from "./tool-face.js";
@@ -1,5 +1,6 @@
1
1
  import { TOOL_MOUNT_TAGS, pathTargetSlotOnly } from "./tool-face.js";
2
- import { ENGINE_CARDS, TOOL_CATALOG_ENTRIES } from "./tool-catalog-entries.js";
2
+ import { CARD_SKELETONS, ENGINE_CARDS, TOOL_CATALOG_ENTRIES } from "./tool-catalog-entries.js";
3
+ import { strayMembersOf } from "./own-property-receipt.js";
3
4
  import { seatOf } from "./tool-name-readings.js";
4
5
  export function describeToolCatalog() {
5
6
  return TOOL_CATALOG_ENTRIES;
@@ -167,5 +168,18 @@ export function engineCardTypes() {
167
168
  out.add(card);
168
169
  return out;
169
170
  }
171
+ {
172
+ const cards = [...engineCardTypes()];
173
+ const moment = "when the tool catalog loads";
174
+ const rowWithoutCard = strayMembersOf(CARD_SKELETONS, { subject: "CARD_SKELETONS", unit: "card", moment }, cards);
175
+ const cardWithoutRow = strayMembersOf(Object.fromEntries(cards.map((c) => [c, true])), { subject: "the engine card set", unit: "skeleton row", moment }, Object.keys(CARD_SKELETONS));
176
+ for (const [stray, what] of [[rowWithoutCard, "CARD_SKELETONS rows naming no card the engine mints"], [cardWithoutRow, "engine cards with no CARD_SKELETONS row"]]) {
177
+ if (stray !== undefined)
178
+ throw new Error(`tool catalog: ${what}: ${stray.names.map((n) => JSON.stringify(String(n))).join(", ")} — refused ${moment}`);
179
+ }
180
+ }
181
+ export function cardSkeletonMembers(type) {
182
+ return Object.hasOwn(CARD_SKELETONS, type) ? CARD_SKELETONS[type] : [];
183
+ }
170
184
  export const TOOL_MOUNT_TAG_SET = new Set(TOOL_MOUNT_TAGS);
171
185
  export { HANDS_BAND_TAGS, MOUNT_TAG_IN_HANDS_BAND } from "./tool-face.js";
@@ -422,6 +422,12 @@ export declare function buildToolResultRef(sessionId: string, toolCallId: string
422
422
  * owner: who may read the bytes is still {@link ToolResultStore.ownerOf}'s answer. A task id the mint had to fold comes back as
423
423
  * its folded segment, which names no task — the reading of a task that is gone. */
424
424
  export declare function taskArtifactOriginOf(ref: string): string | undefined;
425
+ /** Whether `ref` has the shape {@link buildTaskArtifactRef} writes — `tr_<session>~fold.task~<task>~<content>`, four segments, each
426
+ * one {@link isRefSegment} accepts — and nothing else: a string with a path separator, a control character, a quote, whitespace,
427
+ * an empty or over-long segment or a different segment count is not a ref the mint ever wrote. Shape only: it says nothing about
428
+ * whether the row is still held or who may read it ({@link ToolResultStore.ownerOf}), and {@link taskArtifactOriginOf} stays the
429
+ * lenient origin reading a read face's boundary legs rest on. */
430
+ export declare function isTaskArtifactRef(ref: string): boolean;
425
431
  /**
426
432
  * Backlog #119 — the ceiling on a ref this module can mint, so a durable backend can size its key
427
433
  * column from a stated invariant instead of a guess (TiDB's was `VARCHAR(191)`, which a long
@@ -576,7 +582,7 @@ export declare const OFFLOAD_TOOL_NAME = "ReadToolResult";
576
582
  * transient first failure served the marker forever even though the full text was still in hand.
577
583
  * Now the failure arm writes NOTHING (a later persist call retries the real bytes against an empty
578
584
  * ref) and announces the failed write loudly instead: through the deployment's structured notice sink
579
- * when one is wired, else `console.warn` (the loud-bad-value announcement dialect — a silent catch
585
+ * when one is wired, else the process's default seat, else one process line (the loud-bad-value announcement dialect — a silent catch
580
586
  * here would be a silent data loss). The announcement claims only what this arm can know: THIS
581
587
  * attempt stored nothing — the same (toolCallId, fullText) persist recurs per request (write-once
582
588
  * idempotent re-put), so an EARLIER attempt may already have landed the row and a rejected re-put is
@@ -588,8 +594,8 @@ export declare function createOffloadPersist(store: ToolResultStore, sessionId:
588
594
  /** Structured sink for the loss announcement, delivered through the shared guarded form
589
595
  * (`deliverEngineNotice`, #170): a wired FUNCTION seat REPLACES the console line, swallow-guarded
590
596
  * (a throwing/rejecting sink never turns an announcement into a failure); a present NON-function
591
- * seat falls back to `console.warn` plus the once-per-process seat-defect announcement; absent ⇒
592
- * `console.warn`. */
597
+ * seat falls back to the process line plus the once-per-process seat-defect announcement; absent ⇒
598
+ * the process's default seat, else the process line. */
593
599
  onNotice?: (notice: import("./types.js").EngineNotice) => void): (toolCallId: string, fullText: string) => string;
594
600
  /**
595
601
  * The byte sibling of {@link createOffloadPersist}: keep `bytes` (claimed `mimeType`) a tool result carried for the call
@@ -73,8 +73,21 @@ export function taskArtifactOriginOf(ref) {
73
73
  const segments = ref.split(REF_SEGMENT_SEPARATOR);
74
74
  return segments[1] === TASK_ARTIFACT_SEGMENT ? segments[2] : undefined;
75
75
  }
76
+ const TOOL_RESULT_REF_PREFIX = composeToolResultRef("s", []).slice(0, -1);
77
+ function isRefSegment(text) {
78
+ return text.length <= MAX_REF_SEGMENT_CHARS && NATIVE_REF_CHARSET.test(text);
79
+ }
80
+ export function isTaskArtifactRef(ref) {
81
+ const [session, marker, ...ids] = ref.split(REF_SEGMENT_SEPARATOR);
82
+ return (session !== undefined &&
83
+ session.startsWith(TOOL_RESULT_REF_PREFIX) &&
84
+ isRefSegment(session.slice(TOOL_RESULT_REF_PREFIX.length)) &&
85
+ marker === TASK_ARTIFACT_SEGMENT &&
86
+ ids.length === 2 &&
87
+ ids.every(isRefSegment));
88
+ }
76
89
  function refSegment(raw) {
77
- if (raw.length <= MAX_REF_SEGMENT_CHARS && NATIVE_REF_CHARSET.test(raw) && !raw.startsWith(FOLDED_SEGMENT_PREFIX))
90
+ if (isRefSegment(raw) && !raw.startsWith(FOLDED_SEGMENT_PREFIX))
78
91
  return raw;
79
92
  const base = raw.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 32);
80
93
  return `${FOLDED_SEGMENT_PREFIX}${base || "x"}-${digestOfString(raw)}`;
@@ -719,6 +719,12 @@ export declare function boundaryLegsRefusal(toolName: unknown): Error & {
719
719
  * an entry or a list of another prototype (its prototype chain answers), a Proxy, an accessor (or a non-enumerable member the receipt
720
720
  * does not take) as the name, the declaration or a slot of the list. The row mint judges every other source. */
721
721
  export declare function assertToolBoundaryLegs(tools: unknown): void;
722
+ /** Whether a caller roster mounts a delegation tool — an entry carrying the `withAgents` rebuild seam — read as the one receipt reads
723
+ * the roster (no getter or trap runs): `false` when there is no roster, or every entry is a plain record the receipt took whole and none
724
+ * carries a function `withAgents`; `true` when one does; `undefined` when an entry could carry it only by running the caller's code (an
725
+ * entry of another prototype — its prototype chain answers —, a Proxy, an accessor or a member the receipt does not take). A resume's
726
+ * screen asks it before the claim; the `undefined` remainder is answered by the leg's own live read, after the claim. */
727
+ export declare function rosterMountsDelegation(tools: unknown): boolean | undefined;
722
728
  /** One row (design/388 §2.5). Every axis is read off the instance or the leg facts; nothing off a name table. */
723
729
  export declare function mintRosterEntry(tool: AgentTool, meta: RosterMountMeta, facts: RosterSnapshotFacts): ToolRosterEntry;
724
730
  /**
@@ -601,6 +601,24 @@ export function assertToolBoundaryLegs(tools) {
601
601
  throw boundaryLegsRefusal(t["name"]);
602
602
  });
603
603
  }
604
+ export function rosterMountsDelegation(tools) {
605
+ if (tools === undefined)
606
+ return false;
607
+ const got = receive(tools, ROSTER_LEGS_RECEIPT);
608
+ const list = got.ok ? got.value : undefined;
609
+ if (!got.ok || !Array.isArray(list))
610
+ return undefined;
611
+ if ((got.faults ?? []).some((f) => f.path.length <= 1 || f.path[1] === "withAgents"))
612
+ return undefined;
613
+ let mounted = false;
614
+ for (const t of list) {
615
+ if (!isPlainRecord(t))
616
+ return undefined;
617
+ if (typeof t["withAgents"] === "function")
618
+ mounted = true;
619
+ }
620
+ return mounted;
621
+ }
604
622
  export function mintRosterEntry(tool, meta, facts) {
605
623
  const face = faceOf(tool);
606
624
  const fallbackOrigin = meta.source === "builtin" ? "core" : meta.source === "synthetic" ? "synthetic" : meta.source === "mcp" || meta.source === "a2a" ? meta.source : "caller";
@@ -445,10 +445,9 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
445
445
  executionMode?: "sequential" | "parallel";
446
446
  /**
447
447
  * design/120 P1.5 (CC `isConcurrencySafe(parsedInput)` parity): input-level concurrency
448
- * refinement for a non-`"parallel"` tool — return `true` to let THIS CALL run in a parallel batch
449
- * (and, under `streamingToolExecution`, start in-stream). An explicit `executionMode:"parallel"`
450
- * needs no refinement (always safe); a throw = false (fail-closed). In the batch/stream paths the
451
- * hook receives schema-VALIDATED (coerced) args — `parsed.data` parity; a schema-invalid
448
+ * refinement for a non-`"parallel"` tool — return `true` to let THIS CALL run in a parallel batch.
449
+ * An explicit `executionMode:"parallel"` needs no refinement (always safe); a throw = false
450
+ * (fail-closed). The hook receives schema-VALIDATED (coerced) args — `parsed.data` parity; a schema-invalid
452
451
  * call is judged unsafe before the hook runs. Still treat defensively (direct callers may pass raw).
453
452
  * The one real consumer is Bash's read-only classifier.
454
453
  */
@@ -1054,6 +1053,9 @@ export interface ToolExecuteContext {
1054
1053
  * carrier, and independent of {@link readFace}.
1055
1054
  */
1056
1055
  writeFace?: "roots";
1056
+ /** The host's word that this run's decision parks cannot be resumed ({@link TaskSpec.durableApproval} `false`), a tighten-only clamp
1057
+ * carrier: present (as `false`) ONLY when the run was declared so, and handed to every child spec a delegation tool builds. */
1058
+ durableApproval?: false;
1057
1059
  /**
1058
1060
  * design/199 件B — the parent task's OWN deny-set additions ({@link TaskSpec.readDenyPatterns}),
1059
1061
  * traveling the delegation tree add-only (a child judges at least every entry its parent judged).
@@ -1107,12 +1109,18 @@ export interface ToolExecuteContext {
1107
1109
  /**
1108
1110
  * The MCP surface THIS run mounts (Runner-filled, read-only, answered at call time off the live roster): per declared server,
1109
1111
  * the tools of it mounted right now, and the aggregate tools no server owns. A delegation tool reads it AT SPAWN TIME for the
1110
- * protocol half of the one universe a child's lists govern, and declares the child the servers the lists leave — the child
1111
- * connects for itself (it outlives the spawning leg when it runs in the background or is kept for a later turn). Absent when
1112
+ * protocol half of the one universe a child's lists govern, and declares the child the servers the lists leave. Absent when
1112
1113
  * the tool runs outside a Runner task, and for a run that declared no server.
1113
1114
  */
1114
1115
  mountedMcp?: () => import("./mounted-mcp.js").MountedMcp;
1115
- /** The run's compiled tool selector (its `allowTools` / `excludeTools` under the ceiling it was spawned with): `admits` answers
1116
+ /**
1117
+ * The run tree's MCP connection pool (Runner-filled, read-only): a delegation tool and a workflow hand it to every leg they spawn, so
1118
+ * the child leases its connections from it and reads what it remembers of a failed attempt (mcp-connection-pool.ts) — a child that
1119
+ * outlives the spawning leg (background, kept) keeps leasing from it. Inside a Runner it is the session's pool and is present whether
1120
+ * or not the run declared a server; absent outside a Runner task.
1121
+ */
1122
+ mcpPool?: import("./mcp-connection-pool.js").McpConnectionPool;
1123
+ /** The run's compiled tool selector (its `allowTools` / `excludeTools` — the allowlist naming nothing under `excludeAllTools` — under the ceiling it was spawned with): `admits` answers
1116
1124
  * "may this run use this tool", and `layers` is the ceiling every child this run spawns inherits, so a scenario-wide roster cannot
1117
1125
  * be escaped by delegating to a child that remounts a tool this run may not use (Runner-filled, read-only, never a model argument). */
1118
1126
  toolSelector?: import("./tool-face.js").ToolSelector;
@@ -1486,7 +1494,8 @@ export interface ToolExecuteContext {
1486
1494
  * (`status:"needs_review"`) so a human approves/edits/rejects before the run continues. The tool still returns
1487
1495
  * its `content` normally first (the plan/diff lives there → reaches the reviewer via the transcript). HONORED
1488
1496
  * only when the deployment can actually pause (a `checkpointStore` is wired); otherwise the request is a silent
1489
- * no-op (read-only/headless degrade). The first-party `present_plan` tool (CC `ExitPlanMode` parity) is a thin
1497
+ * no-op (read-only/headless degrade) — except on a leg whose parks nobody resumes, where the call THROWS the refusal
1498
+ * ("This plan was not presented to anyone…" + the way out), so the asking call's result never reads as presented. The first-party `present_plan` tool (CC `ExitPlanMode` parity) is a thin
1490
1499
  * caller of this; any tool may use it to gate a high-blast step on human review. Idempotent within a batch (the
1491
1500
  * first request wins; the suspend fires once at the boundary). The Runner fills it; not a tool arg. The Runner
1492
1501
  * binds the id of the calling tool call to the request (a tool cannot name another call): the parked `plan_review`
@@ -18,6 +18,7 @@
18
18
  */
19
19
  import type { BrainRetryErrClass, TaskStatus, ToolEffect } from "./types.js";
20
20
  import type { ThinkingLevel } from "../internal/harness-types.js";
21
+ import type { ReasoningEffective } from "../brain/reasoning.js";
21
22
  import type { ToolManifestRow } from "../prompt-assembly/tool-catalog.js";
22
23
  import type { PromptEpochActivation, PromptIdentityLayers } from "../prompt-assembly/epoch.js";
23
24
  import type { ChainLink, SupersededOverlay } from "../prompt-assembly/overlay.js";
@@ -191,27 +192,23 @@ export type TraceEvent = {
191
192
  ts: number;
192
193
  } | {
193
194
  /**
194
- * How a task's requested reasoning intensity RESOLVED against the model's real capability (design/96 S6).
195
- * Emitted at task start when thinking is on, so a deployment can SEE — not silently swallow (§E
196
- * honesty red-line) — that a binary provider ignored the tier (`graded:false`), that an effort endpoint
197
- * clamped it down (`clamped:true`), or that a NON-reasoning model dropped the request entirely
198
- * (`dropped:true` — the frame fires for that model too; it used to be the one arm with no report).
195
+ * How a task's requested reasoning intensity RESOLVED on the leg's request (design/96 S6): what the request's
196
+ * thinking keys say (`effective`), and its three projections. Emitted at task start for every leg with a tier —
197
+ * `off` included — so a deployment can SEE that a switch-only dialect took the tier as `on`, that an effort
198
+ * endpoint clamped it down (`clamped:true`), or that nothing reached the wire (`dropped:true`).
199
199
  * Metadata-only (tiers + format + endpoint, never prompt content). The resolution is against the
200
200
  * task's PRIMARY serving model at leg entry (same law as `TaskResult.model`): a mid-run
201
201
  * degradation does not re-emit this frame — the switch is observed on its own seats
202
202
  * (`TaskResult.degraded`).
203
203
  *
204
- * A SECOND frame follows, for the same taskId, in exactly one case: the leg's FIRST
205
- * committed request reported wire facts that CHANGE the resolution the task-start frame claimed
206
- * (today: the anthropic budget path's cap-wins skip, where a hard per-request output cap too small
207
- * to host a legal thinking budget deletes the thinking block — so the honest report is
208
- * `dropped:true`, not the gradient the entry frame guessed). The correction is deduped (a first
209
- * request that changes nothing emits nothing) and capped at one (only the FIRST committed request
210
- * is consumed, so the leg's nested internal calls — compaction summary, side query — cannot
211
- * rewrite the leg's posture). A consumer that keeps only the LATEST frame per taskId is therefore
212
- * always reading the truth, and one that kept only the first now under-reports a drop it could not
213
- * have seen before. The result-face twin `TaskResult.effectiveReasoning` moves with it — the two
214
- * faces are one mint at every instant.
204
+ * A SECOND frame follows, for the same taskId, in exactly one case: the leg's first request whose terminal
205
+ * message reaches the leg carried an answer that differs from the task-start frame (a budget knob or a hard
206
+ * output cap only the brain held: a fixed budget says `on`, a cap too small for a legal budget says
207
+ * `provider_default`). It follows that message's `message_end`, is deduped (a first request that changes nothing
208
+ * emits nothing) and capped at one. Requests a mod, a tool or an internal lane makes never reach the leg's
209
+ * messages, so they cannot rewrite the leg's posture. A consumer that keeps only the LATEST frame per taskId
210
+ * reads the truth. The result-face twin `TaskResult.effectiveReasoning` moves with it — the two faces are one
211
+ * mint at every instant.
215
212
  */
216
213
  kind: "reasoning.resolved";
217
214
  version: 1;
@@ -220,24 +217,21 @@ export type TraceEvent = {
220
217
  model: string;
221
218
  /** The intensity the task asked for. */
222
219
  requested: ThinkingLevel;
223
- /** The intensity actually in effect on the wire. */
224
- effective: ThinkingLevel;
225
- /** False = binary enable-only / no-effort endpoint: the tier was NOT honored as a gradient (intent only). */
220
+ /** What the request's thinking keys say: a tier, `"on"` (thinking on, no tier named), or `"provider_default"` on the
221
+ * `dropped` arm, where the request carried no thinking key (the provider's own default governs). */
222
+ effective: ReasoningEffective;
223
+ /** {@link import("../brain/reasoning.js").ResolvedReasoning.graded}, the same value. */
226
224
  graded: boolean;
227
- /** True = `effective` differs from `requested` (the endpoint couldn't honor the request exactly). */
225
+ /** True exactly when `effective` differs from `requested`. */
228
226
  clamped: boolean;
229
227
  /** The wire format the request uses (`openai`/`deepseek`/`qwen`/`budget`/…) — the reason for graded/clamped. */
230
228
  format: string;
231
229
  /** Coarse endpoint label (`model.api`, e.g. `openai-completions` / `anthropic-messages`). */
232
230
  endpoint: string;
233
231
  /**
234
- * Present (true) only when the model declares NO reasoning capability (`Model.reasoning` falsy): the
235
- * brains send no thinking parameter at all, so the requested tier was DROPPED — not clamped.
236
- * `effective:"off"` states the ENGINE side (nothing was requested), not a measured gateway state:
237
- * on the binary enable-only formats (qwen/zai/qwen-chat-template) parameter absence is
238
- * provider-default and a default-on gateway may still reason at its own tier — read `format` to
239
- * know which family applies. `format`/`endpoint` report the family that WOULD have carried the
240
- * tier. Absent on every reasoning-capable resolution (old consumers see identical frames).
232
+ * Present (true) exactly when `effective` is `"provider_default"`: the request carried no thinking key at all (a model
233
+ * that holds no reasoning, an `off` the wire cannot spell, a withheld effort carrier, a cap-wins skip), so a default-on
234
+ * gateway may still reason at its own tier — read `format` to know which family applies. Absent otherwise.
241
235
  */
242
236
  dropped?: true;
243
237
  /** design/148 S3 (additive, §10.2): the eight-element cache identity — digests only. */
@@ -369,7 +363,8 @@ export type TraceEvent = {
369
363
  /** Prompt tokens this call wrote to the provider's prefix cache; ABSENT when the call did not report it (the
370
364
  * OpenAI-shaped wires never do). */
371
365
  cacheWrite?: number;
372
- /** Wall time from the brain request to its final message. */
366
+ /** Wall time from the call's FIRST DELTA to its final message (0 for a call that streamed nothing). The call's wall time from its
367
+ * delivery to the brain is `ts − callStartedAt`. */
373
368
  latencyMs: number;
374
369
  /** Time to the first content delta (excludes thinking) — maps to OTel time_to_first_chunk (×1000). */
375
370
  firstTokenMs?: number;
@@ -378,7 +373,8 @@ export type TraceEvent = {
378
373
  * which anchors on the FIRST DELTA and reads 0 for a zero-delta call). Distinguishes an
379
374
  * in-flight call cut before its first delta (present, latencyMs 0, stopReason "aborted")
380
375
  * from a call that was never issued (absent). Compaction-summarizer rows never carry it (they
381
- * circumvent the loop's per-call closures). */
376
+ * circumvent the loop's per-call closures). `ts − callStartedAt` is this call's API wall time — the row's share of
377
+ * `turn_end.usage.apiDurationMs` / `TaskResult.stats.apiDurationMs` (a row without the stamp shares 0). */
382
378
  callStartedAt?: number;
383
379
  /** ABSENT when THIS call's serving model was unpriced (RB-368 — no fabricated 0). */
384
380
  costMicroUsd?: number;
@@ -593,11 +589,19 @@ export type TraceEvent = {
593
589
  version: 1;
594
590
  taskId: string;
595
591
  runId: string;
596
- /** Where the frame is filed. A top-level leg: its own session, no `occupant`. A delegated leg: the delegation tree's root
597
- * session and, when the tree knows it, the occupant that session held when the tree was born (absent = unknown). */
592
+ /** Where the frame is filed. A top-level leg: its own session, and neither `occupant` nor `occupantUnknown`. A delegated leg
593
+ * whose route names its tree's root: that root session and the occupant it held when the tree was born — or, when the tree
594
+ * does not know that occupant (no token: the root's row has none or the root leg's read of it failed, or the root facts the
595
+ * leg was handed — a host's internals, a revived row — carried none), `occupantUnknown: true` in its place; never both.
596
+ * `occupantUnknown` is that root address with no token, judged as the engine judges the same address for the leg's notices
597
+ * and frames — `sameOccupant(undefined, current)`: the same generation only as a current row with no token, since a row
598
+ * deleted and created again always has one (another generation). The word is the one `delegation.delivery_discarded`
599
+ * carries as `detail.addressed: "unknown"` for an address with no token. A delegated leg whose route names no root (its host
600
+ * handed none) files under its own session, like a top-level leg. */
598
601
  root: {
599
602
  sessionId: string;
600
603
  occupant?: string;
604
+ occupantUnknown?: true;
601
605
  };
602
606
  phase: "prepare" | "resume" | "observed";
603
607
  /** The tree's taint bits after the event. */
@@ -13,7 +13,7 @@ import type { AgentTool, ThinkingLevel, ToolInputValidationContext, ToolInputVer
13
13
  import type { Model, StreamFn } from "../internal/llm.js";
14
14
  export type { ModelRef, ModelRole, RoleSpec, ModelRoles, Brain } from "./model-seat.js";
15
15
  export { MODEL_ROLES } from "./model-seat.js";
16
- export type { StaleToolResultOffloadOptions, ImageInput, TaskSpec, TaskWakeSource, ShellGateDoctrine, UserAttachment, InstructionFamilyDeclaration } from "./task-spec.js";
16
+ export type { StaleToolResultOffloadOptions, ImageInput, TaskSpec, TaskWakeSource, ShellGateDoctrine, UserAttachment, InstructionFamilyDeclaration, DurableApprovalOptIn } from "./task-spec.js";
17
17
  export { TASK_WAKE_SOURCES } from "./task-spec.js";
18
18
  export type { PermissionMode } from "./ask-origin.js";
19
19
  export type { ToolEffect, ToolContentOrigin, ReversibilityVerdict, ReadRootGrantCandidate, ToolSpec, ToolReturn, NestedUsage, NestedUsageAccum, ToolExecuteContext, DelegationSettlementSeat } from "./tool-spec.js";
@@ -23,7 +23,7 @@ export type { McpServerSpec, A2aServerSpec, McpElicitRequest, McpElicitResponse,
23
23
  export { DECLARATION_ENTRY_WORDS, DECLARATION_PATH_RULES, MCP_TRANSPORT_KINDS, NO_DECLARATION_PATH_RULES, TOOL_AXIS_WORDS, declarationFaultOf, declarationPath, declarerWord, perToolEmptyName, perToolEntryRefusal, readMcpToolAxes, readToolAxes, receiveDeclaration, receivePerToolDeclaration, toolAxesRefusal, transportKindOf } from "./mcp-server-spec.js";
24
24
  export { callerText, dataKind } from "./caller-text.js";
25
25
  export type { TaskLimits } from "./task-limits.js";
26
- export type { TaskStatus, RemoteEnvFailureNote, EffectiveMemoryScopes, TaskResult, HumanReviewGateRow } from "./task-result.js";
26
+ export type { TaskStatus, RemoteEnvFailureNote, RefusedAsk, EffectiveMemoryScopes, TaskResult, HumanReviewGateRow } from "./task-result.js";
27
27
  export type { TerminalCause, PausedCause } from "./terminal-cause.js";
28
28
  export type { TaskEventIdentity, BrainStatusPhase, BrainStatusSeat, BrainRetryErrClass, BrainStatus, ToolActivity, ToolGatePhase, HumanInputSource, HumanInputDelivery, DelegationTaskType, TaskEvent, HumanInputEvent, HumanInputAttachment, CompactOutcome, ExtensionRequester, RewriteAuthor, ToolInputRewrite } from "./task-event.js";
29
29
  export type { TaskStream } from "./task-stream.js";