@sema-agent/core 7.54.1 → 7.56.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 (621) hide show
  1. package/CHANGELOG.md +950 -0
  2. package/dist/agents/agent-transcript-tool.js +2 -1
  3. package/dist/agents/builtin-agents.d.ts +12 -14
  4. package/dist/agents/cascade.js +1 -1
  5. package/dist/agents/cc-peer-directory.d.ts +36 -0
  6. package/dist/agents/cc-peer-directory.js +139 -0
  7. package/dist/agents/cc-peer-wire.d.ts +105 -0
  8. package/dist/agents/cc-peer-wire.js +98 -0
  9. package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
  10. package/dist/agents/cc-uds-peer-channel.js +457 -0
  11. package/dist/agents/child-model-seat.d.ts +0 -11
  12. package/dist/agents/child-model-seat.js +0 -3
  13. package/dist/agents/cross-session-envelope.d.ts +4 -1
  14. package/dist/agents/cross-session-envelope.js +8 -1
  15. package/dist/agents/cross-session-judge.d.ts +2 -2
  16. package/dist/agents/list-agents-tool.d.ts +3 -1
  17. package/dist/agents/list-agents-tool.js +9 -8
  18. package/dist/agents/observer.d.ts +4 -5
  19. package/dist/agents/observer.js +2 -1
  20. package/dist/agents/peer-admission.d.ts +6 -0
  21. package/dist/agents/peer-admission.js +4 -1
  22. package/dist/agents/peer-directory.d.ts +65 -13
  23. package/dist/agents/peer-directory.js +90 -25
  24. package/dist/agents/peer-notices.d.ts +1 -1
  25. package/dist/agents/peer-session-drain.d.ts +3 -1
  26. package/dist/agents/peer-session-drain.js +3 -2
  27. package/dist/agents/read-inbox-tool.js +2 -1
  28. package/dist/agents/repair-loop.js +2 -2
  29. package/dist/agents/retain-ledger.d.ts +1 -1
  30. package/dist/agents/roster-store.d.ts +1 -1
  31. package/dist/agents/send-message-tool.d.ts +10 -0
  32. package/dist/agents/send-message-tool.js +37 -8
  33. package/dist/agents/subagent.d.ts +39 -82
  34. package/dist/agents/subagent.js +109 -106
  35. package/dist/agents/tool-filter.d.ts +31 -46
  36. package/dist/agents/tool-filter.js +13 -33
  37. package/dist/agents/verify.d.ts +6 -5
  38. package/dist/agents/verify.js +3 -3
  39. package/dist/brain/anthropic.js +43 -81
  40. package/dist/brain/errors.d.ts +15 -0
  41. package/dist/brain/errors.js +10 -0
  42. package/dist/brain/media-degrade.d.ts +18 -7
  43. package/dist/brain/media-degrade.js +13 -2
  44. package/dist/brain/model-capability.d.ts +37 -0
  45. package/dist/brain/model-capability.js +34 -0
  46. package/dist/brain/model-presets.d.ts +6 -12
  47. package/dist/brain/model-presets.js +1 -6
  48. package/dist/brain/open-responses.js +27 -35
  49. package/dist/brain/openai.js +30 -98
  50. package/dist/brain/provider-dialect.d.ts +39 -3
  51. package/dist/brain/provider-dialect.js +28 -0
  52. package/dist/brain/reasoning-request.d.ts +96 -0
  53. package/dist/brain/reasoning-request.js +174 -0
  54. package/dist/brain/reasoning.d.ts +12 -12
  55. package/dist/brain/reasoning.js +4 -3
  56. package/dist/brain/request-params.d.ts +62 -9
  57. package/dist/brain/request-params.js +42 -7
  58. package/dist/brain/retry.d.ts +1 -1
  59. package/dist/brain/route-adjudicator.d.ts +15 -0
  60. package/dist/brain/route-adjudicator.js +15 -0
  61. package/dist/brain/status-sink.d.ts +20 -0
  62. package/dist/brain/status-sink.js +7 -0
  63. package/dist/brain/stream-engine.js +6 -5
  64. package/dist/brain/stream-shared.d.ts +1 -1
  65. package/dist/core/a2a.d.ts +2 -1
  66. package/dist/core/a2a.js +19 -13
  67. package/dist/core/advisor-verdict.d.ts +120 -0
  68. package/dist/core/advisor-verdict.js +92 -0
  69. package/dist/core/agent-definition.d.ts +17 -8
  70. package/dist/core/allow-entry.d.ts +69 -36
  71. package/dist/core/allow-entry.js +81 -52
  72. package/dist/core/allow-rule-shadow.d.ts +10 -3
  73. package/dist/core/approval-object.d.ts +2 -1
  74. package/dist/core/approval-object.js +6 -6
  75. package/dist/core/ask-origin.d.ts +127 -29
  76. package/dist/core/ask-origin.js +87 -25
  77. package/dist/core/ask-question.d.ts +51 -8
  78. package/dist/core/ask-question.js +12 -7
  79. package/dist/core/ask-unresolvable-notice.d.ts +8 -3
  80. package/dist/core/ask-unresolvable-notice.js +16 -2
  81. package/dist/core/auto-compaction.d.ts +11 -8
  82. package/dist/core/auto-compaction.js +4 -2
  83. package/dist/core/auto-mode-arming.d.ts +2 -2
  84. package/dist/core/auto-mode-defaults.d.ts +8 -8
  85. package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
  86. package/dist/core/auto-mode-prompt.d.ts +1 -1
  87. package/dist/core/auto-mode.d.ts +17 -9
  88. package/dist/core/auto-mode.js +9 -6
  89. package/dist/core/background-agent-store.d.ts +3 -3
  90. package/dist/core/canonical-json.d.ts +1 -1
  91. package/dist/core/canonical-json.js +2 -2
  92. package/dist/core/checkpoint-generation.d.ts +53 -0
  93. package/dist/core/checkpoint-generation.js +35 -0
  94. package/dist/core/checkpoint-queries.d.ts +180 -0
  95. package/dist/core/checkpoint-queries.js +272 -0
  96. package/dist/core/checkpoint-requirements.d.ts +19 -4
  97. package/dist/core/checkpoint-requirements.js +8 -14
  98. package/dist/core/checkpoint-store.d.ts +165 -72
  99. package/dist/core/checkpoint-store.js +79 -82
  100. package/dist/core/child-clamp-seats.d.ts +6 -0
  101. package/dist/core/child-clamp-seats.js +3 -16
  102. package/dist/core/compliance.d.ts +2 -2
  103. package/dist/core/context-edit.d.ts +6 -7
  104. package/dist/core/cross-boundary-taint.d.ts +11 -4
  105. package/dist/core/cross-boundary-taint.js +3 -3
  106. package/dist/core/decision-receipt.d.ts +37 -3
  107. package/dist/core/decision-receipt.js +19 -19
  108. package/dist/core/delegation-not-started.d.ts +6 -0
  109. package/dist/core/delegation-not-started.js +17 -0
  110. package/dist/core/effective-path-target.d.ts +1 -1
  111. package/dist/core/engine-attestation.d.ts +93 -0
  112. package/dist/core/engine-attestation.js +70 -0
  113. package/dist/core/engine-capabilities.d.ts +4 -1
  114. package/dist/core/engine-capabilities.js +1 -1
  115. package/dist/core/engine-notice.d.ts +45 -12
  116. package/dist/core/exec-output-tail.d.ts +1 -1
  117. package/dist/core/file-history-retention.d.ts +1 -1
  118. package/dist/core/file-history-store.d.ts +147 -21
  119. package/dist/core/file-history-store.js +58 -32
  120. package/dist/core/gate-fold.d.ts +1 -1
  121. package/dist/core/gate-fold.js +24 -11
  122. package/dist/core/gate-lanes.js +81 -68
  123. package/dist/core/gate-outcome.d.ts +40 -6
  124. package/dist/core/gate-outcome.js +56 -0
  125. package/dist/core/governance-codes.d.ts +17 -3
  126. package/dist/core/governance-codes.js +16 -0
  127. package/dist/core/hands-band.d.ts +1 -1
  128. package/dist/core/hooks.d.ts +21 -20
  129. package/dist/core/hooks.js +3 -1
  130. package/dist/core/host-floor.d.ts +128 -0
  131. package/dist/core/host-floor.js +206 -0
  132. package/dist/core/host-target.d.ts +84 -0
  133. package/dist/core/host-target.js +92 -0
  134. package/dist/core/image-downsample.d.ts +1 -1
  135. package/dist/core/lsp-diagnostics.d.ts +4 -4
  136. package/dist/core/lsp.d.ts +3 -3
  137. package/dist/core/mailbox-store.d.ts +4 -0
  138. package/dist/core/mcp-connection-pool.d.ts +18 -2
  139. package/dist/core/mcp-connection-pool.js +53 -6
  140. package/dist/core/mcp-failure.d.ts +23 -4
  141. package/dist/core/mcp-failure.js +26 -11
  142. package/dist/core/mcp-listing-drift.d.ts +10 -0
  143. package/dist/core/mcp-listing-drift.js +6 -0
  144. package/dist/core/mcp-server-link.d.ts +173 -0
  145. package/dist/core/mcp-server-link.js +127 -0
  146. package/dist/core/mcp-server-spec.d.ts +4 -2
  147. package/dist/core/mcp-session-end.d.ts +26 -0
  148. package/dist/core/mcp-session-end.js +29 -0
  149. package/dist/core/mcp-startup-request.d.ts +17 -0
  150. package/dist/core/mcp-startup-request.js +17 -0
  151. package/dist/core/mcp.d.ts +17 -13
  152. package/dist/core/mcp.js +240 -189
  153. package/dist/core/media-byte-cap.d.ts +1 -1
  154. package/dist/core/memory-engine/delegation-settlement.js +15 -24
  155. package/dist/core/memory-engine/engine.d.ts +9 -9
  156. package/dist/core/memory-engine/engine.js +4 -4
  157. package/dist/core/memory-engine/layout.d.ts +60 -8
  158. package/dist/core/memory-engine/layout.js +65 -6
  159. package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
  160. package/dist/core/memory-engine/tools.js +4 -1
  161. package/dist/core/mode-policy.d.ts +1 -1
  162. package/dist/core/model-seat.d.ts +10 -3
  163. package/dist/core/mods/classic-events.d.ts +67 -0
  164. package/dist/core/mods/classic-events.js +1 -0
  165. package/dist/core/mods/dollar.d.ts +13 -0
  166. package/dist/core/mods/extension-call.d.ts +31 -0
  167. package/dist/core/mods/extension-call.js +43 -0
  168. package/dist/core/mods/kernel/dispatch.d.ts +20 -3
  169. package/dist/core/mods/kernel/dispatch.js +140 -69
  170. package/dist/core/mods/kernel/events.d.ts +47 -11
  171. package/dist/core/mods/kernel/events.js +66 -42
  172. package/dist/core/mods/kernel/index.d.ts +4 -4
  173. package/dist/core/mods/kernel/index.js +2 -2
  174. package/dist/core/mods/kernel/receive.d.ts +39 -5
  175. package/dist/core/mods/kernel/receive.js +290 -17
  176. package/dist/core/mods/kernel/registration.d.ts +33 -2
  177. package/dist/core/mods/kernel/registration.js +6 -7
  178. package/dist/core/mods/kernel/site-rules.d.ts +44 -16
  179. package/dist/core/mods/kernel/site-rules.js +24 -42
  180. package/dist/core/mods/spec-seats.d.ts +69 -0
  181. package/dist/core/mods/spec-seats.js +114 -0
  182. package/dist/core/mods/stations.d.ts +28 -8
  183. package/dist/core/mods/stations.js +29 -13
  184. package/dist/core/mods/tool-call.d.ts +79 -0
  185. package/dist/core/mods/tool-call.js +152 -0
  186. package/dist/core/namespaced-rule-name.d.ts +44 -24
  187. package/dist/core/namespaced-rule-name.js +50 -43
  188. package/dist/core/output-style.d.ts +1 -1
  189. package/dist/core/param-rule-reach.d.ts +15 -0
  190. package/dist/core/param-rule-reach.js +30 -0
  191. package/dist/core/parent-spec-seat.d.ts +13 -1
  192. package/dist/core/parent-spec-seat.js +6 -0
  193. package/dist/core/park-selfcheck.js +1 -0
  194. package/dist/core/pause-registry.d.ts +16 -5
  195. package/dist/core/pause-registry.js +6 -2
  196. package/dist/core/peer-channel.d.ts +70 -0
  197. package/dist/core/peer-channel.js +1 -0
  198. package/dist/core/permission-rule-consent.d.ts +30 -5
  199. package/dist/core/permission-rule-consent.js +147 -50
  200. package/dist/core/permission-rule-model.d.ts +245 -65
  201. package/dist/core/permission-rule-model.js +421 -107
  202. package/dist/core/permission-rule-org.d.ts +6 -2
  203. package/dist/core/permission-rule-org.js +7 -3
  204. package/dist/core/permission-rule-provider.d.ts +6 -2
  205. package/dist/core/permission-rule-provider.js +41 -11
  206. package/dist/core/permission-rule-store.d.ts +22 -26
  207. package/dist/core/permission-rule-store.js +12 -6
  208. package/dist/core/permission-rule-sync.d.ts +11 -2
  209. package/dist/core/permission-rule-sync.js +11 -3
  210. package/dist/core/permission-rule-syntax.d.ts +5 -4
  211. package/dist/core/permission-rule-syntax.js +2 -2
  212. package/dist/core/permission-rules.d.ts +53 -15
  213. package/dist/core/permission-rules.js +125 -100
  214. package/dist/core/persisted-rule-arms.d.ts +6 -4
  215. package/dist/core/persisted-rule-arms.js +10 -12
  216. package/dist/core/present-plan-tool.js +3 -1
  217. package/dist/core/principal-name.d.ts +20 -0
  218. package/dist/core/principal-name.js +22 -0
  219. package/dist/core/prompt-section-seat.js +4 -6
  220. package/dist/core/protocol-http-auth.d.ts +26 -5
  221. package/dist/core/protocol-http-auth.js +137 -4
  222. package/dist/core/protocol-naming.d.ts +2 -2
  223. package/dist/core/read-only-shell-table.d.ts +1 -1
  224. package/dist/core/read-only-shell.d.ts +1 -1
  225. package/dist/core/retired-keys.d.ts +16 -0
  226. package/dist/core/retired-keys.js +16 -4
  227. package/dist/core/rewrite-rejudge.d.ts +60 -0
  228. package/dist/core/rewrite-rejudge.js +36 -0
  229. package/dist/core/roles.d.ts +34 -3
  230. package/dist/core/roles.js +66 -53
  231. package/dist/core/rule-lane-reads.d.ts +20 -15
  232. package/dist/core/rule-lane-reads.js +45 -17
  233. package/dist/core/rule-offer-read.d.ts +53 -0
  234. package/dist/core/rule-offer-read.js +146 -0
  235. package/dist/core/rule-owner.d.ts +46 -0
  236. package/dist/core/rule-owner.js +29 -0
  237. package/dist/core/runner/advisor-instructions.d.ts +70 -0
  238. package/dist/core/runner/advisor-instructions.js +61 -0
  239. package/dist/core/runner/advisor-tool.d.ts +33 -0
  240. package/dist/core/runner/advisor-tool.js +112 -0
  241. package/dist/core/runner/announce-once-ledger.d.ts +18 -26
  242. package/dist/core/runner/announce-once-ledger.js +19 -46
  243. package/dist/core/runner/approval-feedback.js +6 -3
  244. package/dist/core/runner/assemble-result.d.ts +2 -1
  245. package/dist/core/runner/assemble-result.js +1 -1
  246. package/dist/core/runner/call-hook-stations.d.ts +3 -2
  247. package/dist/core/runner/caller-roster.d.ts +21 -2
  248. package/dist/core/runner/caller-roster.js +38 -0
  249. package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
  250. package/dist/core/runner/capability-withheld-seat.js +24 -0
  251. package/dist/core/runner/classifier-ladder.d.ts +33 -13
  252. package/dist/core/runner/classifier-ladder.js +15 -14
  253. package/dist/core/runner/compaction-restate.d.ts +10 -6
  254. package/dist/core/runner/compaction-restate.js +9 -3
  255. package/dist/core/runner/construction-doors.js +3 -0
  256. package/dist/core/runner/contracts.d.ts +40 -33
  257. package/dist/core/runner/conversation-segment.d.ts +28 -0
  258. package/dist/core/runner/conversation-segment.js +42 -0
  259. package/dist/core/runner/cross-boundary-lane.d.ts +21 -16
  260. package/dist/core/runner/cross-boundary-lane.js +58 -34
  261. package/dist/core/runner/decide-continuation.d.ts +7 -4
  262. package/dist/core/runner/decide-continuation.js +2 -2
  263. package/dist/core/runner/denial-limit-arms.d.ts +4 -4
  264. package/dist/core/runner/denial-limit-arms.js +1 -1
  265. package/dist/core/runner/derived-route-fallback.d.ts +24 -24
  266. package/dist/core/runner/derived-route-fallback.js +9 -7
  267. package/dist/core/runner/file-history-request.d.ts +18 -0
  268. package/dist/core/runner/file-history-request.js +21 -13
  269. package/dist/core/runner/file-history-restore.d.ts +45 -0
  270. package/dist/core/runner/file-history-restore.js +46 -0
  271. package/dist/core/runner/gate-exit.d.ts +9 -3
  272. package/dist/core/runner/gate-exit.js +11 -5
  273. package/dist/core/runner/image.d.ts +7 -17
  274. package/dist/core/runner/image.js +9 -60
  275. package/dist/core/runner/initial-run-state.js +1 -1
  276. package/dist/core/runner/permission-rule-lanes.d.ts +6 -6
  277. package/dist/core/runner/permission-rule-lanes.js +38 -15
  278. package/dist/core/runner/person-path-rows.d.ts +12 -9
  279. package/dist/core/runner/person-path-rows.js +19 -8
  280. package/dist/core/runner/prepare-advisor.d.ts +63 -0
  281. package/dist/core/runner/prepare-advisor.js +77 -0
  282. package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
  283. package/dist/core/runner/prepare-ask-lane.js +5 -2
  284. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
  285. package/dist/core/runner/prepare-caps-and-workflow.js +5 -4
  286. package/dist/core/runner/prepare-config-doors.d.ts +31 -38
  287. package/dist/core/runner/prepare-config-doors.js +57 -34
  288. package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
  289. package/dist/core/runner/prepare-defer-classify.js +7 -8
  290. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  291. package/dist/core/runner/prepare-delegation-surface.js +1 -1
  292. package/dist/core/runner/prepare-file-history.d.ts +48 -8
  293. package/dist/core/runner/prepare-file-history.js +41 -73
  294. package/dist/core/runner/prepare-gate-stations.d.ts +2 -5
  295. package/dist/core/runner/prepare-gate-stations.js +12 -8
  296. package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
  297. package/dist/core/runner/prepare-hands-readface.js +15 -14
  298. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -7
  299. package/dist/core/runner/prepare-inherited-gate.js +8 -6
  300. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  301. package/dist/core/runner/prepare-park-ask.js +12 -12
  302. package/dist/core/runner/prepare-policy-chain.d.ts +7 -4
  303. package/dist/core/runner/prepare-policy-chain.js +68 -81
  304. package/dist/core/runner/prepare-project-context.d.ts +5 -2
  305. package/dist/core/runner/prepare-project-context.js +6 -3
  306. package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
  307. package/dist/core/runner/prepare-prompt-assembly.js +10 -8
  308. package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
  309. package/dist/core/runner/prepare-prompt-inputs.js +4 -6
  310. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
  311. package/dist/core/runner/prepare-protocol-tools.js +5 -4
  312. package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
  313. package/dist/core/runner/prepare-safety-scan.js +8 -23
  314. package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
  315. package/dist/core/runner/prepare-suspend-saga.js +5 -6
  316. package/dist/core/runner/prepare-task.d.ts +1 -1
  317. package/dist/core/runner/prepare-task.js +41 -35
  318. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
  319. package/dist/core/runner/prepare-tool-disclosure-mount.js +24 -18
  320. package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
  321. package/dist/core/runner/prepare-turn-wiring.js +2 -7
  322. package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -4
  323. package/dist/core/runner/prepare-wiring-manifest.js +3 -3
  324. package/dist/core/runner/resume-admission.js +1 -1
  325. package/dist/core/runner/resume-apply.js +11 -12
  326. package/dist/core/runner/resume-checkpoint-screen.js +3 -0
  327. package/dist/core/runner/resume-claim.d.ts +4 -2
  328. package/dist/core/runner/resume-claim.js +15 -8
  329. package/dist/core/runner/resume-policy-outcome.js +1 -1
  330. package/dist/core/runner/retired-runner-deps.js +2 -1
  331. package/dist/core/runner/rewind-files.d.ts +15 -0
  332. package/dist/core/runner/rewind-files.js +132 -0
  333. package/dist/core/runner/run-attachment-seats.js +2 -2
  334. package/dist/core/runner/run-brain-sinks.d.ts +4 -1
  335. package/dist/core/runner/run-brain-sinks.js +4 -2
  336. package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
  337. package/dist/core/runner/run-compaction-machinery.js +2 -12
  338. package/dist/core/runner/run-git-lane.d.ts +1 -0
  339. package/dist/core/runner/run-harness-handlers.js +14 -7
  340. package/dist/core/runner/run-leg.d.ts +1 -1
  341. package/dist/core/runner/run-leg.js +43 -18
  342. package/dist/core/runner/run-settle-and-teardown.js +3 -2
  343. package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
  344. package/dist/core/runner/run-turn-boundary.d.ts +1 -0
  345. package/dist/core/runner/run-turn-boundary.js +15 -22
  346. package/dist/core/runner/runtask.d.ts +3 -0
  347. package/dist/core/runner/runtask.js +8 -9
  348. package/dist/core/runner/session-read-file-states.d.ts +15 -0
  349. package/dist/core/runner/session-read-file-states.js +28 -0
  350. package/dist/core/runner/session-rule-policy.d.ts +22 -21
  351. package/dist/core/runner/session-rule-policy.js +17 -31
  352. package/dist/core/runner/shell-env-withheld.d.ts +33 -0
  353. package/dist/core/runner/shell-env-withheld.js +51 -0
  354. package/dist/core/runner/side-call-account.d.ts +32 -8
  355. package/dist/core/runner/side-call-account.js +23 -1
  356. package/dist/core/runner/skills-seat.js +6 -2
  357. package/dist/core/runner/stream-settle-backstop.js +1 -1
  358. package/dist/core/runner/strict-output-schema.d.ts +1 -1
  359. package/dist/core/runner/sub-agent-deny-lists.js +4 -6
  360. package/dist/core/runner/synthetic-tools.d.ts +16 -13
  361. package/dist/core/runner/synthetic-tools.js +8 -3
  362. package/dist/core/runner/tool-disclosure.d.ts +10 -12
  363. package/dist/core/runner/tool-disclosure.js +3 -4
  364. package/dist/core/runner/tool-end-body.d.ts +1 -1
  365. package/dist/core/runner/tool-end-body.js +10 -9
  366. package/dist/core/runner/tool-face-overlay.d.ts +2 -1
  367. package/dist/core/runner/tool-face-overlay.js +17 -1
  368. package/dist/core/runner/tool-not-executed.d.ts +5 -0
  369. package/dist/core/runner/tool-not-executed.js +11 -0
  370. package/dist/core/runner/tool-occurrence.d.ts +8 -0
  371. package/dist/core/runner/tool-occurrence.js +7 -0
  372. package/dist/core/runner/tool-progress-lane.d.ts +2 -2
  373. package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
  374. package/dist/core/runner/turn-attachments.d.ts +91 -80
  375. package/dist/core/runner/turn-attachments.js +62 -37
  376. package/dist/core/runner-deps.d.ts +42 -42
  377. package/dist/core/runtime-caps.d.ts +4 -4
  378. package/dist/core/safety-axis-vocab.d.ts +6 -4
  379. package/dist/core/safety-axis-vocab.js +6 -5
  380. package/dist/core/safety-merge-corpus.js +26 -2
  381. package/dist/core/same-plain-value.d.ts +40 -0
  382. package/dist/core/same-plain-value.js +49 -0
  383. package/dist/core/scheduler.d.ts +1 -1
  384. package/dist/core/secret-env.d.ts +26 -3
  385. package/dist/core/secret-env.js +44 -8
  386. package/dist/core/select-model.js +3 -3
  387. package/dist/core/sensitive-path-policy.d.ts +1 -1
  388. package/dist/core/sensitive-path-policy.js +1 -1
  389. package/dist/core/session-policy-store.d.ts +102 -35
  390. package/dist/core/session-policy-store.js +210 -48
  391. package/dist/core/session-reconcile.d.ts +2 -2
  392. package/dist/core/session-store.d.ts +106 -37
  393. package/dist/core/session-store.js +165 -91
  394. package/dist/core/session.d.ts +101 -57
  395. package/dist/core/session.js +53 -0
  396. package/dist/core/shared-memory/tools.js +3 -1
  397. package/dist/core/shared-memory/types.d.ts +1 -1
  398. package/dist/core/shell-read-silence.d.ts +11 -12
  399. package/dist/core/shell-read-silence.js +9 -5
  400. package/dist/core/shell-run-candidates.js +3 -1
  401. package/dist/core/shell-wrapper-projection.js +1 -1
  402. package/dist/core/shell-wrapper-table.d.ts +14 -7
  403. package/dist/core/shell-wrapper-table.js +5 -4
  404. package/dist/core/side-query.d.ts +10 -0
  405. package/dist/core/side-query.js +15 -1
  406. package/dist/core/skill-grant.d.ts +7 -2
  407. package/dist/core/skill-grant.js +5 -0
  408. package/dist/core/skills-directory.js +6 -2
  409. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
  410. package/dist/core/store-contracts/checkpoint-store-contract.js +168 -3
  411. package/dist/core/store-contracts/file-history-store-contract.js +74 -4
  412. package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
  413. package/dist/core/store-contracts/peer-directory-contract.js +14 -2
  414. package/dist/core/store-contracts/session-policy-store-contract.d.ts +7 -0
  415. package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
  416. package/dist/core/store-contracts/session-repo-contract.js +176 -0
  417. package/dist/core/store-contracts/session-store-contract.d.ts +6 -8
  418. package/dist/core/store-contracts/session-store-contract.js +361 -51
  419. package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
  420. package/dist/core/stub-env.d.ts +2 -0
  421. package/dist/core/stub-env.js +1 -0
  422. package/dist/core/surrogate-safe-slice.d.ts +3 -3
  423. package/dist/core/synthetic-read-verdict.js +3 -3
  424. package/dist/core/task-event.d.ts +42 -8
  425. package/dist/core/task-notification.d.ts +19 -15
  426. package/dist/core/task-registry-agent.d.ts +4 -4
  427. package/dist/core/task-registry-shared.d.ts +4 -4
  428. package/dist/core/task-registry-shared.js +1 -0
  429. package/dist/core/task-registry.d.ts +13 -4
  430. package/dist/core/task-registry.js +14 -2
  431. package/dist/core/task-result.d.ts +21 -3
  432. package/dist/core/task-spec.d.ts +69 -64
  433. package/dist/core/task-stream.d.ts +6 -6
  434. package/dist/core/task-tool-shape.d.ts +4 -4
  435. package/dist/core/tighten-task-spec.d.ts +1 -1
  436. package/dist/core/tighten-task-spec.js +2 -1
  437. package/dist/core/tool-catalog-entries.d.ts +36 -2
  438. package/dist/core/tool-catalog-entries.js +69 -43
  439. package/dist/core/tool-check-reading.d.ts +11 -0
  440. package/dist/core/tool-check-reading.js +11 -6
  441. package/dist/core/tool-conformance.js +1 -0
  442. package/dist/core/tool-errors.d.ts +2 -2
  443. package/dist/core/tool-face-reader.js +5 -3
  444. package/dist/core/tool-face.d.ts +21 -2
  445. package/dist/core/tool-face.js +1 -1
  446. package/dist/core/tool-model-gate.d.ts +5 -5
  447. package/dist/core/tool-name-aliases.d.ts +29 -8
  448. package/dist/core/tool-name-aliases.js +22 -4
  449. package/dist/core/tool-name-readings.d.ts +10 -43
  450. package/dist/core/tool-name-readings.js +2 -11
  451. package/dist/core/tool-policy.d.ts +85 -196
  452. package/dist/core/tool-policy.js +150 -175
  453. package/dist/core/tool-registry.d.ts +14 -7
  454. package/dist/core/tool-registry.js +17 -7
  455. package/dist/core/tool-result-store.js +5 -1
  456. package/dist/core/tool-roster.d.ts +57 -33
  457. package/dist/core/tool-roster.js +56 -68
  458. package/dist/core/tool-spec-members.js +8 -3
  459. package/dist/core/tool-spec.d.ts +53 -31
  460. package/dist/core/tools.js +51 -10
  461. package/dist/core/trace.d.ts +6 -2
  462. package/dist/core/types.d.ts +1 -1
  463. package/dist/core/untrusted-egress.d.ts +1 -1
  464. package/dist/core/untrusted-text.d.ts +1 -1
  465. package/dist/core/user-attachment.d.ts +8 -1
  466. package/dist/core/user-attachment.js +64 -4
  467. package/dist/core/warm-resume.d.ts +1 -1
  468. package/dist/core/wiring-manifest.d.ts +58 -0
  469. package/dist/core/wiring-manifest.js +14 -5
  470. package/dist/core/workflow-journal-store.d.ts +62 -0
  471. package/dist/core/workflow-journal-store.js +78 -2
  472. package/dist/core/workflow-run-store.d.ts +6 -0
  473. package/dist/core/workflow-run-store.js +2 -0
  474. package/dist/engine/compaction/compaction.d.ts +9 -9
  475. package/dist/engine/compaction/compaction.js +3 -2
  476. package/dist/engine/execution-env/node-execution-env.d.ts +26 -8
  477. package/dist/engine/execution-env/node-execution-env.js +54 -24
  478. package/dist/engine/harness/agent-harness.d.ts +39 -9
  479. package/dist/engine/harness/agent-harness.js +87 -33
  480. package/dist/engine/harness/types.d.ts +58 -9
  481. package/dist/engine/harness/types.js +12 -1
  482. package/dist/engine/llm/types.d.ts +36 -19
  483. package/dist/engine/llm/validation.d.ts +4 -1
  484. package/dist/engine/llm/validation.js +13 -1
  485. package/dist/engine/loop/agent-loop.d.ts +23 -1
  486. package/dist/engine/loop/agent-loop.js +26 -34
  487. package/dist/engine/loop/types.d.ts +31 -19
  488. package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
  489. package/dist/engine/session/memory-repo.d.ts +18 -12
  490. package/dist/engine/session/memory-repo.js +24 -9
  491. package/dist/engine/session/parent-chain-guard.d.ts +3 -2
  492. package/dist/engine/session/parent-chain-guard.js +1 -1
  493. package/dist/engine/session/repo-utils.d.ts +32 -3
  494. package/dist/engine/session/repo-utils.js +50 -5
  495. package/dist/index.d.ts +47 -23
  496. package/dist/index.js +35 -17
  497. package/dist/internal/harness-types.d.ts +1 -1
  498. package/dist/internal/harness.d.ts +3 -3
  499. package/dist/internal/harness.js +2 -2
  500. package/dist/internal/llm.d.ts +2 -2
  501. package/dist/internal/llm.js +1 -1
  502. package/dist/orchestration/goal.js +2 -2
  503. package/dist/orchestration/run-workflow-tool.d.ts +8 -6
  504. package/dist/orchestration/run-workflow-tool.js +10 -6
  505. package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
  506. package/dist/orchestration/workflow-types.d.ts +18 -0
  507. package/dist/orchestration/workflow-types.js +6 -0
  508. package/dist/orchestration/workflow.d.ts +5 -13
  509. package/dist/orchestration/workflow.js +57 -49
  510. package/dist/prompt-assembly/artifact.d.ts +2 -2
  511. package/dist/prompt-assembly/artifact.js +5 -3
  512. package/dist/prompt-assembly/assemble.d.ts +3 -2
  513. package/dist/prompt-assembly/assemble.js +1 -1
  514. package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
  515. package/dist/prompt-assembly/catalog/schema.js +34 -2
  516. package/dist/prompt-assembly/catalog/sections.js +0 -1
  517. package/dist/prompt-assembly/composer.d.ts +3 -1
  518. package/dist/prompt-assembly/composer.js +1 -1
  519. package/dist/prompt-assembly/event-registry.js +2 -0
  520. package/dist/prompt-assembly/overlay.js +3 -3
  521. package/dist/prompt-assembly/renderers.d.ts +1 -1
  522. package/dist/prompt-assembly/renderers.js +0 -3
  523. package/dist/prompt-assembly/role-base.d.ts +15 -0
  524. package/dist/prompt-assembly/role-base.js +9 -0
  525. package/dist/prompt-assembly/select.d.ts +39 -14
  526. package/dist/prompt-assembly/select.js +47 -16
  527. package/dist/prompt-assembly/sugar.d.ts +17 -11
  528. package/dist/prompt-assembly/sugar.js +8 -3
  529. package/dist/prompt-assembly/tool-catalog.d.ts +39 -2
  530. package/dist/prompt-assembly/tool-catalog.js +117 -4
  531. package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
  532. package/dist/prompt-assembly/turn-snapshot.js +0 -3
  533. package/dist/prompt-assembly/types.d.ts +0 -7
  534. package/dist/prompts/default.d.ts +14 -14
  535. package/dist/scenarios/full-body.d.ts +15 -15
  536. package/dist/scenarios/full-body.js +4 -3
  537. package/dist/shell/lex.js +10 -1
  538. package/dist/stores/file/adoption/adopt.d.ts +4 -3
  539. package/dist/stores/file/adoption/adopt.js +27 -33
  540. package/dist/stores/file/adoption/marker.d.ts +6 -13
  541. package/dist/stores/file/adoption/marker.js +9 -17
  542. package/dist/stores/file/checkpoint-store.d.ts +24 -0
  543. package/dist/stores/file/checkpoint-store.js +45 -7
  544. package/dist/stores/file/file-history-store.d.ts +20 -19
  545. package/dist/stores/file/file-history-store.js +157 -141
  546. package/dist/stores/file/fs-atomic.d.ts +15 -0
  547. package/dist/stores/file/fs-atomic.js +89 -14
  548. package/dist/stores/file/index.d.ts +1 -1
  549. package/dist/stores/file/index.js +2 -1
  550. package/dist/stores/file/mailbox-store.d.ts +3 -0
  551. package/dist/stores/file/mailbox-store.js +3 -1
  552. package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
  553. package/dist/stores/file/permission-rule-adopt.js +18 -18
  554. package/dist/stores/file/permission-rule-store.d.ts +18 -2
  555. package/dist/stores/file/permission-rule-store.js +31 -18
  556. package/dist/stores/file/session-policy-store.d.ts +3 -3
  557. package/dist/stores/file/session-store.d.ts +54 -16
  558. package/dist/stores/file/session-store.js +114 -85
  559. package/dist/stores/file/workflow-journal-store.d.ts +10 -4
  560. package/dist/stores/file/workflow-journal-store.js +28 -13
  561. package/dist/tools/artifact/artifact-text.d.ts +1 -1
  562. package/dist/tools/artifact/artifact-tool.js +5 -3
  563. package/dist/tools/fs/bash-program-position.d.ts +19 -2
  564. package/dist/tools/fs/bash-program-position.js +56 -9
  565. package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -3
  566. package/dist/tools/fs/fs-bash.d.ts +2 -2
  567. package/dist/tools/fs/fs-bash.js +8 -6
  568. package/dist/tools/fs/fs-glob.d.ts +86 -0
  569. package/dist/tools/fs/fs-glob.js +226 -0
  570. package/dist/tools/fs/fs-read.js +14 -14
  571. package/dist/tools/fs/fs-search-tools.js +7 -7
  572. package/dist/tools/fs/fs-shared.d.ts +8 -8
  573. package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
  574. package/dist/tools/fs/notebook.d.ts +2 -2
  575. package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
  576. package/dist/tools/fs/pattern-kill-guard.js +397 -0
  577. package/dist/tools/fs/pdf.d.ts +9 -6
  578. package/dist/tools/fs/pdf.js +3 -3
  579. package/dist/tools/fs/program-read-model.d.ts +57 -7
  580. package/dist/tools/fs/program-read-model.js +11 -1
  581. package/dist/tools/fs/program-read-model.rows.js +78 -21
  582. package/dist/tools/fs/read-deny-home.js +3 -2
  583. package/dist/tools/fs/read-deny.d.ts +29 -7
  584. package/dist/tools/fs/read-deny.js +63 -22
  585. package/dist/tools/fs/removal-targets.d.ts +18 -8
  586. package/dist/tools/fs/removal-targets.js +47 -20
  587. package/dist/tools/fs/safety.d.ts +9 -9
  588. package/dist/tools/fs/search.d.ts +16 -6
  589. package/dist/tools/fs/search.js +20 -26
  590. package/dist/tools/fs/shell-read-argv.js +89 -12
  591. package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
  592. package/dist/tools/fs/shell-read-bindings.js +41 -0
  593. package/dist/tools/fs/shell-read-check.js +12 -20
  594. package/dist/tools/fs/shell-read-environment.d.ts +5 -1
  595. package/dist/tools/fs/shell-read-environment.js +3 -2
  596. package/dist/tools/fs/shell-read-establish.d.ts +15 -0
  597. package/dist/tools/fs/shell-read-establish.js +19 -20
  598. package/dist/tools/fs/shell-read-judge.d.ts +4 -0
  599. package/dist/tools/fs/shell-read-judge.js +5 -2
  600. package/dist/tools/fs/shell-read-plan.js +24 -16
  601. package/dist/tools/fs/shell-read-start.d.ts +6 -1
  602. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
  603. package/dist/tools/fs/shell-read-write-targets.js +2 -3
  604. package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
  605. package/dist/tools/fs/shell-reentry-text.js +40 -2
  606. package/dist/tools/loop-tick.d.ts +2 -2
  607. package/dist/tools/scheduler-tools.js +5 -1
  608. package/dist/tools/task-list.d.ts +7 -7
  609. package/dist/tools/task-list.js +5 -1
  610. package/dist/tools/todo.js +65 -64
  611. package/dist/tools/web.d.ts +20 -15
  612. package/dist/tools/web.js +55 -69
  613. package/dist/tools/worktree.d.ts +3 -3
  614. package/dist/tools/worktree.js +3 -1
  615. package/package.json +1 -1
  616. package/test/export-surface.snapshot.json +5894 -5638
  617. package/wire-changes/core@7.55.0.json +3318 -0
  618. package/wire-changes/core@7.56.0.json +3891 -0
  619. package/wire-changes/mods-kernel@7.56.0.json +303 -0
  620. package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
  621. package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
@@ -9,13 +9,13 @@
9
9
  */
10
10
  import type { TSchema } from "typebox";
11
11
  import type { ThinkingLevel, ToolInputValidationContext, ToolInputVerdict } from "../internal/harness.js";
12
- import type { DocumentContent, ImageContent, Model, TextContent } from "../internal/llm.js";
12
+ import type { DocumentContent, ImageContent, Model, TextContent, ToolDescriptionVariant } from "../internal/llm.js";
13
13
  import type { AgentDefinition } from "./agent-definition.js";
14
14
  import type { TaskEvent } from "./task-event.js";
15
15
  import type { TaskSpec } from "./task-spec.js";
16
16
  import type { BackgroundChildEvent } from "./delegation-frames.js";
17
17
  import type { ModelRef } from "./model-seat.js";
18
- import type { ToolFamily, ToolPathTarget, ToolRenderHints, ToolRuleFace } from "./tool-face.js";
18
+ import type { ToolFamily, ToolHostTarget, ToolPathTarget, ToolRenderHints, ToolRuleFace } from "./tool-face.js";
19
19
  /**
20
20
  * Side-effect class of a tool. Used by wake/resume reconciliation: when a call was interrupted
21
21
  * before its result was recorded, the outcome is unknown, so core must decide whether re-doing it
@@ -62,12 +62,17 @@ export interface ReversibilityVerdict {
62
62
  * TIGHTENING (one more question survives one more configuration), so an over-claiming probe costs
63
63
  * its own deployment a re-confirmation and can never turn an ask into an allow.
64
64
  *
65
- * The built-in shell probe sets it for exactly one family: a listed reader naming a path outside the
66
- * session's allowed directories. That demotion HAS a clearing channel — widening the declared read
67
- * directories retires it — and where the probe can name the directory, {@link readRootCandidate} carries
68
- * it. A mandated ask WITHOUT that member has no configuration behind it: the rest of the family (an
69
- * operator `shellGate:"always"`, the tool's egress/irreversibility marks, an org demand, an out-of-root
70
- * arm with no named directory) is confirm-or-refuse, and must not be worded as though a grant answers it.
65
+ * The engine's own shell station raises a mandate for a path outside the session's allowed directories
66
+ * (read or written) and for a command whose reads it could not establish. A demotion by a path outside the
67
+ * directories HAS a clearing channel — widening the declared read directories retires it — and where the
68
+ * probe can name the directory, {@link readRootCandidate} carries it. A mandated ask WITHOUT that member has
69
+ * no configuration behind it: the rest of the family (an operator `shellGate:"always"`, the tool's
70
+ * egress/irreversibility marks, an org demand, an out-of-root arm with no named directory) is
71
+ * confirm-or-refuse, and must not be worded as though a grant answers it.
72
+ *
73
+ * WHY a matching allow rule did not clear the ask is said in the account of the finding and nowhere else:
74
+ * the card's disclosure sentence is {@link ReversibilityVerdict.reason} verbatim (the station's own sentence, for its findings).
75
+ * A mandated verdict with no `reason` is stated without one — the card names the outranked rule and stops.
71
76
  */
72
77
  mandated?: boolean;
73
78
  /**
@@ -143,21 +148,22 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
143
148
  * across a canonical rename. Each alias keeps the same contract as {@link name} (a rule naming an alias reaches the tool).
144
149
  */
145
150
  aliases?: string[];
151
+ /** The model-facing description — the card's unconditional text: what the tool says when none of
152
+ * {@link descriptionVariants} holds. */
146
153
  description: string;
147
154
  /**
148
- * R2 双形轴(2026-07-18 裁):the CLASSIC-profile variant of {@link description}. CC 2.1.212
149
- * keys its tool descriptions on `LT(model_id)` (simple short form vs classic long form); sema's
150
- * counterpart is {@link TaskSpec.promptProfile} — default "simple" (what CC serves every BYOM
151
- * model id). When the run resolves to "classic" and this field is present, it REPLACES
152
- * `description` at mount time. Absent = the tool has one form (description serves both profiles).
155
+ * The card's conditional variants, in order: at mount, the first whose `traits` condition holds over the run's
156
+ * prompt traits (`Model.promptTraits` with `TaskSpec.promptLean`) replaces {@link description}; none holds ⇒
157
+ * `description`. The reference keys its tool texts on the same capabilities (a long form where `lean_prompt` is
158
+ * absent): that form is a variant `{ id: "classic", traits: { noneOf: ["lean_prompt"] }, text }`. The chosen
159
+ * variant is reported in the tool's `cardId`. A variant whose id, condition or text is malformed refuses the task
160
+ * (`config.tool_face_invalid`).
153
161
  */
154
- descriptionClassic?: string;
162
+ descriptionVariants?: readonly ToolDescriptionVariant[];
155
163
  /**
156
- * Human label for UIs. Defaults to `name`.
157
- *
158
- * ⚠️ Currently INERT (design/71 liveness sweep, 2026-06-12): mapped onto the tool object but no
159
- * runtime path or emitted event reads it — the model and TaskStream consumers only ever see
160
- * `name`. Kept for API stability; wire it into tool events or drop it before building on it.
164
+ * Human label for UIs. Defaults to `name`. When it differs from `name`, it rides the call's `tool_start` and `tool_end`
165
+ * frames as `label` (the run builds the table from the leg's mounted tools) — the advisor tool's label is its advisor
166
+ * model's id. The model only ever sees `name`.
161
167
  */
162
168
  label?: string;
163
169
  /**
@@ -240,7 +246,7 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
240
246
  * gate station: PreToolUse hooks, policy, the auto-mode classifier), AFTER schema validation. A
241
247
  * refusal (`{ ok: false, message }`) is returned to the model as a typed error result and NO
242
248
  * approval card is shown for the call; `{ ok: true }` / `undefined` lets the call proceed to the
243
- * gate unchanged. Upstream form (CC 2.1.250 `validateInput` → `{result:false, message, errorCode}`,
249
+ * gate unchanged. Upstream form (`validateInput` → `{result:false, message, errorCode}`,
244
250
  * consulted ahead of the permission prompt): a call the tool would refuse on its own precondition —
245
251
  * an Edit/Write/NotebookEdit whose target file was never Read this session — used to reach the
246
252
  * operator as a card that could only ever fail; the model then retried the same failing call under
@@ -425,7 +431,7 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
425
431
  contentOrigin?: ToolContentOrigin;
426
432
  /**
427
433
  * Batch execution mode (design/64 §1 P1, CC reads-parallel/writes-sequential partition). When omitted,
428
- * `defineTool` derives it FAIL-CLOSED from `effect` (CC 2.1.206 `TOOL_DEFAULTS.isConcurrencySafe → false`):
434
+ * `defineTool` derives it FAIL-CLOSED from `effect` (`TOOL_DEFAULTS.isConcurrencySafe → false`):
429
435
  * `read` → `"parallel"`; `write`/`idempotent`/UNDECLARED → `"sequential"` — an unannotated tool never
430
436
  * silently rides a parallel batch, and two writes in one batch never race. Set explicitly to override.
431
437
  */
@@ -435,7 +441,7 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
435
441
  * refinement for a non-`"parallel"` tool — return `true` to let THIS CALL run in a parallel batch
436
442
  * (and, under `streamingToolExecution`, start in-stream). An explicit `executionMode:"parallel"`
437
443
  * needs no refinement (always safe); a throw = false (fail-closed). In the batch/stream paths the
438
- * hook receives schema-VALIDATED (coerced) args — CC 206 `parsed.data` parity; a schema-invalid
444
+ * hook receives schema-VALIDATED (coerced) args — `parsed.data` parity; a schema-invalid
439
445
  * call is judged unsafe before the hook runs. Still treat defensively (direct callers may pass raw).
440
446
  * The one real consumer is Bash's read-only classifier.
441
447
  */
@@ -475,7 +481,7 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
475
481
  */
476
482
  defer?: boolean;
477
483
  /**
478
- * Inline-keep override, judged FIRST in the deferral chain (CC 220 counterpart:
484
+ * Inline-keep override, judged FIRST in the deferral chain (the reference's counterpart:
479
485
  * `alwaysLoad`, declared per MCP tool via `_meta["anthropic/alwaysLoad"]`, whose `isDeferredTool`
480
486
  * checks it before every deferral arm): `true` pins this tool's full schema inline in every
481
487
  * request — it is never deferred, regardless of its own {@link defer}, {@link TaskSpec.deferTools},
@@ -508,7 +514,9 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
508
514
  * CONTRACT this tool implements, independent of its presentation text. `defineTool` attaches it
509
515
  * to the materialized tool via the catalog side-table (identity follows the OBJECT, never the
510
516
  * wire name — a caller tool shadowing a built-in name never inherits the core contract). Omitted
511
- * ⇒ the tool reports a deterministic `legacy:<shapeDigest>` contract in the assembly manifest.
517
+ * ⇒ the tool reports a deterministic `legacy:<shapeDigest>` contract in the assembly manifest. A `core.`
518
+ * id is the engine's: on a `TaskSpec.tools` spec it is refused (`config.tool_face_invalid`) unless it rides
519
+ * the contract object the engine's catalog minted (an engine definition mounted by hand) — never written by hand.
512
520
  */
513
521
  contract?: {
514
522
  /** Stable versioned id, e.g. `core.read@2` (built-ins) or `acme.deploy@1` (caller tools). */
@@ -548,6 +556,15 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
548
556
  * tool that merely takes a built-in's NAME inherits nothing).
549
557
  */
550
558
  pathTarget?: ToolPathTarget;
559
+ /**
560
+ * The parameter that names the URL this tool's call reaches ({@link ToolHostTarget}), for a tool whose own name host rules are
561
+ * written for (the engine's fetch tool name, `WebFetch`). Host rules on that name are then judged on the host this URL names:
562
+ * a deny or an ask reaches the tool whatever it declares (the catalog's slot is the protective floor), an allow only when it
563
+ * declares its own slot here (a tool that merely takes the name inherits nothing). Refused (`config.tool_face_invalid`) on a
564
+ * tool under any other name, an alias included — a host rule's grammar belongs to the rule's tool name, so the slot would never
565
+ * be read — and together with {@link pathTarget} (a face names one protected target). The `param` must be a top-level property.
566
+ */
567
+ hostTarget?: ToolHostTarget;
551
568
  /**
552
569
  * design/388 §2.2 ③ — the parameter vocabulary a permission rule (`Tool(param:pattern)`) may name.
553
570
  * DERIVED from the schema when absent (the scalar top-level parameters plus the path target's
@@ -590,7 +607,7 @@ export type ToolReturn = string | {
590
607
  * Producer side of the tool-result 双面契约: `content` is the MODEL face (may carry model-directed
591
608
  * framing/trailers), `details` is the HOST face (per-tool structured Output). Hosts render from the
592
609
  * structured face and never re-parse the model face — see the `tool_end.structured` JSDoc
593
- * (CC 2.1.207 @765495, CC207-CORE-SWEEP P2-3) for the full contract. */
610
+ * (P2-3) for the full contract. */
594
611
  details?: unknown;
595
612
  /** Hint the agent to stop after this tool batch. */
596
613
  terminate?: boolean;
@@ -802,6 +819,10 @@ export interface ToolExecuteContext {
802
819
  * the tool runs outside a Runner task.
803
820
  */
804
821
  parentCwd?: string;
822
+ /** The deployment's compiled host floor (`RunnerDeps.hostFloor`; Runner-filled, read-only, never a model argument): an engine executor
823
+ * that connects — the fetch tool on every hop, WebSearch's SearXNG backend (handed it in the backend's `opts.hostFloor`) — judges each URL
824
+ * by it before the request. Absent outside a Runner, or when none is declared. */
825
+ hostFloor?: import("./host-floor.js").HostFloor;
805
826
  /**
806
827
  * The RUNNING task's file-history LINEAGE (Runner-filled, read-only, never a model/tool argument;
807
828
  * present iff the run records file history — a `RunnerDeps.fileHistoryStore` wired, capture not `"off"`, not `"disabled"`): the history scope this run
@@ -1054,10 +1075,11 @@ export interface ToolExecuteContext {
1054
1075
  * dropping the selector in transit would trim a same-model child's roster in a way nobody
1055
1076
  * chose (the gate is a default, not a policy; there is no tighten-only axis to protect). */
1056
1077
  restoreGatedTools?: readonly string[] | true;
1057
- /** R2 双形轴 — the parent's resolved prompt profile, inherited down the delegation tree like the
1058
- * tool-face controls (Runner-filled): a classic-profile parent's children speak classic too
1059
- * unless the child spec says otherwise (child spec wins — profile is presentation, not policy). */
1060
- promptProfile?: "simple" | "classic";
1078
+ /** The parent's task-level switch on the lean shape ({@link TaskSpec.promptLean} — its own, or the one it inherited;
1079
+ * absent when neither was written), inherited down the delegation tree like the tool-face controls
1080
+ * (Runner-filled): a child whose spec writes none takes it. Never the parent's effective traits — the child's model
1081
+ * answers the rest of its own trait set. */
1082
+ promptLean?: boolean;
1061
1083
  /**
1062
1084
  * The parent SPEC seat this run hands its children ({@link import("./parent-spec-seat.js").ParentSpecSeat}):
1063
1085
  * `principal`, `oneShot` (only `true`), `clientContext` (the user's TZ/email facts), `onQuestion` (the FROZEN
@@ -1200,7 +1222,7 @@ export interface ToolExecuteContext {
1200
1222
  sessionId: string;
1201
1223
  } | undefined;
1202
1224
  /**
1203
- * RB-201 FO-3 (form-one audit, CC 220 `Ipd`/`ein` parity) — the auto-mode classifier decider ARMED
1225
+ * RB-201 FO-3 (form-one audit) — the auto-mode classifier decider ARMED
1204
1226
  * for THIS task (auto-mode intent ∧ `RunnerDeps.autoMode` present ∧ `RuntimeCaps.autoMode !== false`
1205
1227
  * — see {@link TaskSpec.permissionMode}; the same
1206
1228
  * instance `runToolGate`'s per-call ask review already consults, carrying its own live breaker
@@ -1342,7 +1364,7 @@ export interface ToolExecuteContext {
1342
1364
  */
1343
1365
  insideFork?: boolean;
1344
1366
  /**
1345
- * OBS-2 (CC 2.1.206 observer parity) — present iff this run's principal resolved
1367
+ * OBS-2 — present iff this run's principal resolved
1346
1368
  * {@link RuntimeCaps.allowObservers}` === true` (EXPLICIT opt-in, default OFF — see the polarity
1347
1369
  * note there). The delegation tool honors {@link AgentDefinition.observer} declarations only under
1348
1370
  * this flag; absent ⇒ declarations resolve to unobserved with NO warn (the gate, not a mistake).
@@ -3,13 +3,53 @@ import { formatToolError, formatZodValidationError } from "./tool-errors.js";
3
3
  import { readMember } from "./thrown-value.js";
4
4
  import { frozenToolSpec } from "./tool-spec-members.js";
5
5
  import { carryDelegationName } from "./delegation-name.js";
6
- import { attachToolContract } from "../prompt-assembly/tool-catalog.js";
7
- function normalizeContent(ret) {
6
+ import { attachEngineToolContract, attachToolContract, contractOriginOf } from "../prompt-assembly/tool-catalog.js";
7
+ import { isCatalogContract } from "./tool-catalog-entries.js";
8
+ import { types } from "node:util";
9
+ import { appendOwn, dataMember, isPlainRecord, receive } from "./mods/kernel/receive.js";
10
+ import { carryNotStartedReceipt } from "./delegation-not-started.js";
11
+ const TOOL_DATA_MODE = Object.freeze({ accessors: "call-once", depth: Infinity, others: "copy", contain: true, wire: true, isProxy: (v) => types.isProxy(v) });
12
+ function receivedData(v) {
13
+ if (v === null || v === undefined || typeof v === "string" || typeof v === "number" || typeof v === "boolean")
14
+ return v;
15
+ const r = receive(v, TOOL_DATA_MODE);
16
+ if (!r.ok)
17
+ return undefined;
18
+ carryNotStartedReceipt(v, r.value);
19
+ return r.value;
20
+ }
21
+ const CONTENT_BLOCK_FIELDS = Object.freeze({ text: ["text"], image: ["data", "mimeType"], document: ["data", "mimeType"] });
22
+ function blockOf(element) {
23
+ if (!isPlainRecord(element))
24
+ return element;
25
+ const own = (field) => (Object.hasOwn(element, field) ? element[field] : undefined);
26
+ const type = own("type");
27
+ const fields = typeof type === "string" && Object.hasOwn(CONTENT_BLOCK_FIELDS, type) ? CONTENT_BLOCK_FIELDS[type] : undefined;
28
+ if (fields === undefined)
29
+ return element;
30
+ const block = { type };
31
+ for (const field of fields)
32
+ if (own(field) !== undefined)
33
+ Reflect.defineProperty(block, field, dataMember(own(field)));
34
+ return block;
35
+ }
36
+ function receivedContent(raw) {
37
+ const copy = receivedData(raw);
38
+ if (!Array.isArray(copy))
39
+ return undefined;
40
+ const out = [];
41
+ for (let i = 0; i < copy.length; i++)
42
+ if (Object.hasOwn(copy, i) && copy[i] !== undefined)
43
+ appendOwn(out, blockOf(copy[i]));
44
+ return out;
45
+ }
46
+ function receiveToolReturn(ret) {
8
47
  if (typeof ret === "string") {
9
48
  return { content: [{ type: "text", text: ret }], details: undefined, terminate: false, isError: false };
10
49
  }
11
50
  const raw = readMember(ret, "content");
12
- if (typeof raw !== "string" && !Array.isArray(raw)) {
51
+ const content = typeof raw === "string" ? [{ type: "text", text: raw }] : receivedContent(raw);
52
+ if (content === undefined) {
13
53
  return {
14
54
  content: [{ type: "text", text: "Tool error: content must be a string or an array of content blocks." }],
15
55
  details: undefined,
@@ -17,8 +57,7 @@ function normalizeContent(ret) {
17
57
  isError: true,
18
58
  };
19
59
  }
20
- const content = typeof raw === "string" ? [{ type: "text", text: raw }] : raw;
21
- return { content, details: readMember(ret, "details"), terminate: readMember(ret, "terminate") === true, isError: readMember(ret, "isError") === true };
60
+ return { content: content, details: receivedData(readMember(ret, "details")), terminate: readMember(ret, "terminate") === true, isError: readMember(ret, "isError") === true };
22
61
  }
23
62
  function isEmptyToolContent(content) {
24
63
  if (content.length === 0)
@@ -78,7 +117,7 @@ function buildProduct(spec, owner, options) {
78
117
  name: spec.name,
79
118
  ...(spec.aliases && spec.aliases.length > 0 ? { aliases: [...spec.aliases] } : {}),
80
119
  description: spec.description,
81
- ...(spec.descriptionClassic !== undefined ? { descriptionClassic: spec.descriptionClassic } : {}),
120
+ ...(spec.descriptionVariants !== undefined ? { descriptionVariants: spec.descriptionVariants } : {}),
82
121
  label: spec.label ?? spec.name,
83
122
  parameters: spec.parameters,
84
123
  executionMode,
@@ -98,6 +137,7 @@ function buildProduct(spec, owner, options) {
98
137
  ...(spec.boundaryLegs !== undefined ? { boundaryLegs: spec.boundaryLegs } : {}),
99
138
  ...(spec.boundaryLegsFor !== undefined ? { boundaryLegsFor: spec.boundaryLegsFor } : {}),
100
139
  ...(spec.pathTarget !== undefined ? { pathTarget: spec.pathTarget } : {}),
140
+ ...(spec.hostTarget !== undefined ? { hostTarget: spec.hostTarget } : {}),
101
141
  ...(spec.ruleFace !== undefined ? { ruleFace: spec.ruleFace } : {}),
102
142
  ...(spec.renderHints !== undefined ? { renderHints: spec.renderHints } : {}),
103
143
  ...(spec.compactable === true ? { compactable: true } : {}),
@@ -120,7 +160,7 @@ function buildProduct(spec, owner, options) {
120
160
  const baseCtx = { toolCallId, signal };
121
161
  const ctx = options?.enrichCtx ? stampCallIdentity(options.enrichCtx(baseCtx), toolCallId, signal) : baseCtx;
122
162
  const ret = await spec.execute.call(owner, params, ctx);
123
- const { content, details, terminate, isError } = normalizeContent(ret);
163
+ const { content, details, terminate, isError } = receiveToolReturn(ret);
124
164
  const guarded = isEmptyToolContent(content)
125
165
  ? [{ type: "text", text: isError ? `(${spec.name} reported an error with no further output)` : `(${spec.name} completed with no output)` }]
126
166
  : content;
@@ -128,7 +168,7 @@ function buildProduct(spec, owner, options) {
128
168
  }
129
169
  catch (err) {
130
170
  const wrapped = new Error(formatToolError(err));
131
- const marks = readMember(err, "details");
171
+ const marks = receivedData(readMember(err, "details"));
132
172
  if (marks !== undefined)
133
173
  wrapped.details = marks;
134
174
  const errorKind = readMember(err, "errorKind");
@@ -140,10 +180,11 @@ function buildProduct(spec, owner, options) {
140
180
  };
141
181
  carryDelegationName(spec.execute, tool.execute);
142
182
  if (spec.contract) {
143
- attachToolContract(tool, {
183
+ const attach = isCatalogContract(spec.contract) ? attachEngineToolContract : attachToolContract;
184
+ attach(tool, {
144
185
  contractId: spec.contract.contractId,
145
186
  implementationRevision: spec.contract.implementationRevision,
146
- origin: spec.contract.contractId.startsWith("core.") ? "core" : "caller",
187
+ origin: contractOriginOf(spec.contract.contractId),
147
188
  ...(spec.aliases && spec.aliases.length > 0 ? { aliases: spec.aliases } : {}),
148
189
  });
149
190
  }
@@ -148,7 +148,7 @@ export type TraceEvent = {
148
148
  */
149
149
  tools?: ToolManifestRow[];
150
150
  totalChars: number;
151
- /** design/148 S3 (additive, §10.2): the nine-element cache identity — digests only. */
151
+ /** design/148 S3 (additive, §10.2): the eight-element cache identity — digests only. */
152
152
  snapshot?: {
153
153
  cacheIdentity: string;
154
154
  elements: import("../prompt-assembly/turn-snapshot.js").CacheIdentityElements;
@@ -226,7 +226,7 @@ export type TraceEvent = {
226
226
  * tier. Absent on every reasoning-capable resolution (old consumers see identical frames).
227
227
  */
228
228
  dropped?: true;
229
- /** design/148 S3 (additive, §10.2): the nine-element cache identity — digests only. */
229
+ /** design/148 S3 (additive, §10.2): the eight-element cache identity — digests only. */
230
230
  snapshot?: {
231
231
  cacheIdentity: string;
232
232
  elements: Record<string, string>;
@@ -339,6 +339,10 @@ export type TraceEvent = {
339
339
  * by them.
340
340
  */
341
341
  turn?: number;
342
+ /** Which call beside the loop this row is: a `SideCallLane` word (the closed set lives with the account,
343
+ * `runner/side-call-account.ts`). Present exactly when {@link turn} is absent — the one writer of side-call rows
344
+ * stamps it; a main-loop row carries `turn` and no `lane`. */
345
+ lane?: string;
342
346
  /** Normalized prompt tokens that MISSED the cache (Anthropic-protocol `input_tokens`
343
347
  * shape) — disjoint from `cacheRead`/`cacheWrite`. Carried the cache-inclusive total up to 2.13.x. */
344
348
  promptTokens: number;
@@ -23,7 +23,7 @@ export { DECLARATION_PATH_RULES, NO_DECLARATION_PATH_RULES, dataKind, declaratio
23
23
  export type { TaskLimits } from "./task-limits.js";
24
24
  export type { TaskStatus, RemoteEnvFailureNote, EffectiveMemoryScopes, TaskResult, HumanReviewGateRow } from "./task-result.js";
25
25
  export type { TerminalCause, PausedCause } from "./terminal-cause.js";
26
- export type { TaskEventIdentity, BrainStatusPhase, BrainRetryErrClass, BrainStatus, ToolActivity, HumanInputSource, HumanInputDelivery, DelegationTaskType, TaskEvent, HumanInputEvent, HumanInputAttachment, CompactOutcome } from "./task-event.js";
26
+ export type { TaskEventIdentity, BrainStatusPhase, BrainRetryErrClass, BrainStatus, ToolActivity, HumanInputSource, HumanInputDelivery, DelegationTaskType, TaskEvent, HumanInputEvent, HumanInputAttachment, CompactOutcome, ExtensionRequester } from "./task-event.js";
27
27
  export type { TaskStream } from "./task-stream.js";
28
28
  export type { WorkflowGovernanceBaseline, RuntimeCaps, AutoModeDenySource } from "./runtime-caps.js";
29
29
  export { AUTO_MODE_DENY_SOURCES, isAutoModeDenySource } from "./runtime-caps.js";
@@ -9,7 +9,7 @@ export { summarizeRedactions } from "./redaction-passes.js";
9
9
  * that tier. What a tool RETURNS is its content, read by the model that asked for it, and is not redacted (CC redacts
10
10
  * nothing there either); what is redacted is what the engine itself words or carries: errors, summaries, run rows.
11
11
  *
12
- * Two tiers, because the faces have two audiences (CC 2.1.212 alignment):
12
+ * Two tiers, because the faces have two audiences:
13
13
  * - **`same-principal`** — the model, the script and the host that launched the work (tool results, workflow agent
14
14
  * outputs / results / errors, run rows behind the scope-gated observe API, host error lanes): the credential
15
15
  * vocabulary only. Paths and URLs in a worker's answer are the caller's OWN machine's paths — redacting them killed the
@@ -138,7 +138,7 @@ export interface EnvelopeShapedScan {
138
138
  export declare function scanEnvelopeShaped(text: string): EnvelopeShapedScan;
139
139
  /**
140
140
  * Defuse a caller-declared occurrence of ONE specific envelope tag (opening AND closing) inside
141
- * content, CC `zZe` @8339092 verbatim: ``t.replace(new RegExp(`<(?=/?${e}(?:[>\\s/]|$))`, "gi"), "<\\")``.
141
+ * content, the reference's replacement: ``t.replace(new RegExp(`<(?=/?${e}(?:[>\\s/]|$))`, "gi"), "<\\")``.
142
142
  *
143
143
  * Homed here (beside {@link ENGINE_ENVELOPES}) rather than in the observer module that first needed
144
144
  * it: "escape one named envelope tag" is a containment primitive, and the registry's guard column
@@ -30,6 +30,7 @@ import { type ReminderDisclosureCounts } from "./reminder-disclosure.js";
30
30
  import { type AgentMessage } from "../internal/harness.js";
31
31
  import type { ReadEntry } from "../tools/fs/safety.js";
32
32
  import type { ContextWindowOverlay } from "./context-settings.js";
33
+ import { type LegModBus } from "./mods/stations.js";
33
34
  /** At most this many attachments on one objective. */
34
35
  export declare const USER_ATTACHMENTS_MAX = 20;
35
36
  /** The longest path or name an entry may carry (the platform path limit). */
@@ -148,6 +149,12 @@ export interface ReadUserAttachmentsInput {
148
149
  mark: string | undefined;
149
150
  counts: ReminderDisclosureCounts | undefined;
150
151
  signal: AbortSignal;
152
+ /** The leg's bus, where `prompt.mention` is raised for each attachment (absent ⇒ none is raised), and the delegated
153
+ * leg's id its events carry. */
154
+ mentions?: {
155
+ readonly bus: LegModBus;
156
+ readonly agentId?: string;
157
+ };
151
158
  }
152
159
  /**
153
160
  * Read every declared attachment and mint its frame. Side-effect free toward the run: nothing is committed here — each
@@ -165,7 +172,7 @@ export interface AttachmentWindowInput {
165
172
  /** The objective lane's read: once the UserPromptSubmit hook let the objective through (a blocked objective reads
166
173
  * nothing), and before the pre-call gate, which prices the frames (`chars`). Refuses the whole objective when the frames
167
174
  * and the objective cannot ride one request ({@link refuseFramesOverWindow}). Commits nothing. */
168
- export declare function readObjectiveAttachments(prepared: Pick<import("./runner/contracts.js").Prepared, "userAttachments" | "modelFileReader" | "syntheticReadVerdict" | "cwdRef" | "reminderMark" | "reminderDisclosureCounts" | "abortController" | "harness">, inputId: string, blocked: boolean, window: AttachmentWindowInput): Promise<{
175
+ export declare function readObjectiveAttachments(prepared: Pick<import("./runner/contracts.js").Prepared, "userAttachments" | "modelFileReader" | "syntheticReadVerdict" | "cwdRef" | "reminderMark" | "reminderDisclosureCounts" | "abortController" | "harness" | "modBus" | "hookIdentity">, inputId: string, blocked: boolean, window: AttachmentWindowInput): Promise<{
169
176
  frames: MintedAttachmentFrame[];
170
177
  chars: number;
171
178
  }>;
@@ -10,6 +10,8 @@ import { commitReminderDisclosureEffects, planReminderDisclosure } from "./remin
10
10
  import { DEFAULT_CHARS_PER_TOKEN, estimateTokens, uuidv7 } from "../internal/harness.js";
11
11
  import { thrownText } from "./thrown-value.js";
12
12
  import { guardBudget } from "./context-guard.js";
13
+ import { agentIdOf, failedHandlerClause } from "./mods/stations.js";
14
+ import { extensionWords } from "./untrusted-egress.js";
13
15
  export const USER_ATTACHMENTS_MAX = 20;
14
16
  export const USER_ATTACHMENT_LABEL_MAX = 4096;
15
17
  export const USER_ATTACHMENT_KINDS = Object.freeze(["text", "notebook", "image", "pdf", "directory", "client_text", "client_image"]);
@@ -142,9 +144,12 @@ export function refuseUserAttachmentPathsWithoutWorkspace(screened) {
142
144
  throw userAttachmentRefusal(memberRef(entryRef(i), "path"), "this run has no workspace (its hand tools are off), so the engine has no file to read — send the file's bytes as a `text` or `image` entry instead.");
143
145
  }
144
146
  export function userAttachmentDeclarations(screened) {
145
- return screened.map((a, i) => a.supply === "path"
146
- ? { ordinal: i + 1, supply: a.supply, path: a.path }
147
- : { ordinal: i + 1, supply: a.supply, name: a.name, bytes: a.supply === "content_text" ? Buffer.byteLength(a.text, "utf8") : Buffer.from(a.data, "base64").byteLength });
147
+ return screened.map((a, i) => declarationOf(a, i + 1));
148
+ }
149
+ function declarationOf(a, ordinal) {
150
+ return a.supply === "path"
151
+ ? { ordinal, supply: a.supply, path: a.path }
152
+ : { ordinal, supply: a.supply, name: a.name, bytes: a.supply === "content_text" ? Buffer.byteLength(a.text, "utf8") : Buffer.from(a.data, "base64").byteLength };
148
153
  }
149
154
  export async function admitUserAttachmentImages(screened) {
150
155
  const out = new Map();
@@ -218,6 +223,8 @@ function noteSentence(note, origin) {
218
223
  return "The listing was cut short, so it is incomplete.";
219
224
  case "too_large_to_restore":
220
225
  return "The file was read before the conversation was summarized, but its contents are too large to include here. Use the Read tool if you need them.";
226
+ case "extension_declined":
227
+ return "An extension of this deployment did not let this attachment through, so its contents were not attached; what it said is stated above.";
221
228
  }
222
229
  }
223
230
  function disclosureSentence(v) {
@@ -290,13 +297,65 @@ export async function readUserAttachments(input) {
290
297
  const count = input.screened.length;
291
298
  const seat = disclosureSeatOf(input.reader, input.mark, input.counts);
292
299
  const frames = [];
300
+ const mentions = input.mentions !== undefined && input.mentions.bus.hasHandlers("prompt.mention") ? input.mentions : undefined;
293
301
  for (const [i, a] of input.screened.entries()) {
294
302
  const ordinal = i + 1;
295
- const r = await readOne(a, ordinal, input);
303
+ const r = mentions !== undefined ? await readMentioned(a, ordinal, input, mentions) : await readOne(a, ordinal, input);
296
304
  frames.push(mintFrame(r, { inputId: input.inputId, ordinal, count, mark: input.mark, origin: "user" }, seat));
297
305
  }
298
306
  return frames;
299
307
  }
308
+ const declineOf = (x) => isPlainObject(x) && Object.keys(x).length === 1 && ((typeof x["deny"] === "string" && x["deny"] !== "") || (Object.hasOwn(x, "type") && x["type"] === null))
309
+ ? typeof x["deny"] === "string" ? { reason: x["deny"] } : {}
310
+ : undefined;
311
+ async function readMentioned(a, ordinal, input, mentions) {
312
+ const label = a.supply === "path" ? a.path : a.name;
313
+ const declined = (text) => ({ supply: a.supply, label, outcome: "not_attached", shape: "file", data: [{ type: "text", text }], notes: [{ kind: "extension_declined" }], unscanned: [label, text], truncated: false });
314
+ const window = a.supply === "path" && a.lines !== undefined ? { offset: a.lines.start, ...(a.lines.end !== undefined ? { limit: a.lines.end - a.lines.start + 1 } : {}) } : {};
315
+ const e = { mention: declarationOf(a, ordinal), ...(mentions.agentId !== undefined ? { agentId: mentions.agentId } : {}), ...(a.supply === "path" ? { path: a.path, ...window } : {}) };
316
+ const reads = new Map();
317
+ const bottom = async (handed) => {
318
+ const spelled = respelled(a, handed);
319
+ const read = typeof spelled === "string" ? declined(`Not attached: ${spelled}.`) : await readOne(spelled, ordinal, input);
320
+ const answer = Object.freeze({ type: read.outcome === "not_attached" ? null : (read.kind ?? null), outcome: read.outcome });
321
+ reads.set(answer, read);
322
+ return answer;
323
+ };
324
+ let outcome;
325
+ try {
326
+ outcome = await mentions.bus.dispatch("prompt.mention", e, {
327
+ bottom,
328
+ signal: input.signal,
329
+ checkAnswer: (x) => (typeof x === "object" && x !== null && reads.has(x)) || declineOf(x) !== undefined ? undefined : "prompt.mention takes next(e), { deny: <reason> } or { type: null } — an extension does not supply an attachment's contents",
330
+ ranks: { of: (x) => (typeof x === "object" && x !== null && reads.has(x) ? 0 : 1), top: 1 },
331
+ });
332
+ }
333
+ catch (err) {
334
+ outcome = { kind: "failed", registration: "engine", cause: "threw", reason: `could not raise the station: ${thrownText(err)}`, skipped: [] };
335
+ }
336
+ if (outcome.kind === "aborted")
337
+ return declined("Not attached: the run was cancelled while an extension was judging it.");
338
+ if (outcome.kind === "failed")
339
+ return declined(`Not attached: a prompt.mention extension ${failedHandlerClause(outcome)}.`);
340
+ const read = typeof outcome.answer === "object" && outcome.answer !== null ? reads.get(outcome.answer) : undefined;
341
+ if (read !== undefined)
342
+ return read;
343
+ const reason = declineOf(outcome.answer)?.reason;
344
+ return declined(`Not attached: extension "${extensionWords(outcome.answeredBy ?? "engine", 80)}" declined it${reason !== undefined ? `: ${extensionWords(reason, 300)}` : ""}.`);
345
+ }
346
+ function respelled(a, handed) {
347
+ if (a.supply !== "path") {
348
+ return ["path", "offset", "limit"].some((k) => Object.hasOwn(handed, k)) ? "an extension handed down a path or line window for an attachment the host supplied (its bytes are its own; nothing is read)" : a;
349
+ }
350
+ const { path, offset, limit } = handed;
351
+ const line = (v) => v === undefined || (typeof v === "number" && Number.isInteger(v) && v >= 1);
352
+ if (typeof path !== "string" || path === "" || path.length > USER_ATTACHMENT_LABEL_MAX)
353
+ return "an extension handed down a path that is not one";
354
+ if (!line(offset) || !line(limit))
355
+ return "an extension handed down a line window that is not one (offset and limit are whole numbers from 1)";
356
+ const start = typeof offset === "number" ? offset : typeof limit === "number" ? 1 : undefined;
357
+ return start === undefined ? { supply: "path", path } : { supply: "path", path, lines: { start, ...(typeof limit === "number" ? { end: start + limit - 1 } : {}) } };
358
+ }
300
359
  const refusalData = (r) => {
301
360
  const c = r.refusal?.content;
302
361
  return typeof c === "string" && c.length > 0 ? [{ type: "text", text: c }] : [];
@@ -439,6 +498,7 @@ export async function readObjectiveAttachments(prepared, inputId, blocked, windo
439
498
  mark: prepared.reminderMark,
440
499
  counts: prepared.reminderDisclosureCounts,
441
500
  signal: prepared.abortController.signal,
501
+ mentions: { bus: prepared.modBus, ...(agentIdOf(prepared.hookIdentity) !== undefined ? { agentId: agentIdOf(prepared.hookIdentity) } : {}) },
442
502
  });
443
503
  refuseFramesOverWindow(frames, prepared.harness.getModel(), window);
444
504
  return { frames, chars: frames.reduce((n, f) => n + f.seed.content.reduce((m, b) => m + (b.type === "text" ? b.text.length : 0), 0), 0) };
@@ -5,7 +5,7 @@ import type { TaskResult, TaskSpec } from "./types.js";
5
5
  * session, then run a continuation on the fork. Fork-first is the safe path (design/114 §3.2):
6
6
  * - **idempotent** — each call branches a FRESH session, so resuming twice can't corrupt the source's linear
7
7
  * history (vs `runTask({sessionId})` reuse, which appends two divergent continuations onto one history);
8
- * - **orphan-safe** — the fork drops an in-flight tool call (`settledForkOptions`), so a continuation of an agent
8
+ * - **orphan-safe** — the fork drops an in-flight tool call (`settledForkOptions`, the judge a store's `fork` shares; a package-root export), so a continuation of an agent
9
9
  * that died mid-tool-call gets a clean point rather than inheriting an `[INTERRUPTED]` orphan;
10
10
  * - **fail-loud** — a missing source returns `null`; it NEVER silently starts a fresh EMPTY run the way
11
11
  * `runTask({sessionId})` would via create-on-miss (the "looks warm, actually fresh" trap). Cross-restart /
@@ -472,6 +472,46 @@ export interface WiringManifest {
472
472
  * derivation, never a state. Out of {@link configFingerprint}: the request word is a per-task seat (`mods` reasoning).
473
473
  */
474
474
  fileHistory?: "on" | "disabled";
475
+ /**
476
+ * EFFECTIVE half only, ALWAYS present on an engine-minted effective manifest: did this leg read the deployment's project context, and if not,
477
+ * which half kept it out — one word per state. `"on"` — its prepare called `RunnerDeps.loadProjectMemory` (what the seam answered, content or
478
+ * nothing, is the deployment's). `"disabled"` — a seam is wired and the request turned it off (`TaskSpec.projectMemory: "disabled"`).
479
+ * `"absent"` — no seam is wired (the manifest's word for a seat nothing supplied, as `ask` / `question` spell it), whatever the request said.
480
+ * The member missing = an older mint or an external derivation, never a state. Out of {@link configFingerprint}: the request word is a
481
+ * per-task seat (`fileHistory` reasoning).
482
+ */
483
+ projectMemory?: "on" | "disabled" | "absent";
484
+ /**
485
+ * EFFECTIVE half only, ALWAYS present on an engine-minted effective manifest: are the legs THIS leg delegates (sync,
486
+ * background, forked, workflow, retained, resumed and observer-sidecar legs, at any depth) bound by a rule written to this
487
+ * leg's session AFTER they started. `childrenReadLive: true` ⇔ the leg enforces its own session-rule layer (a
488
+ * `sessionPolicyStore` is wired and the task carries a `sessionId`) and so hands that session's key on to the legs it
489
+ * delegates, each of which re-reads the row at every tool gate: a rule written mid-run binds the agent's next call, whether
490
+ * or not the session had a row when the agent was spawned. `false` ⇒ no layer, so no key is handed on (no store wired, or
491
+ * the task names no session). ABSENT = an older engine: assume nothing. A statement about the DEPS-VISIBLE assembly — a
492
+ * delegation tool mounted over a Runner with no store of its own cannot re-read (it announces
493
+ * `config.session_rules_unreadable` and keeps the spawn-time snapshot). Leg-local (excluded from {@link configFingerprint}:
494
+ * `sessionId` is a per-task seat); the leg-start snapshot, like the rest of this object.
495
+ */
496
+ sessionRules?: {
497
+ childrenReadLive: boolean;
498
+ };
499
+ /**
500
+ * EFFECTIVE half only; present ⇔ the deployment declared a host floor (`RunnerDeps.hostFloor`): its POSTURE — whether an `only` list
501
+ * bounds what is reachable (`onlyMode`; `onlyCount: 0` with it = no structured egress at all) and how many entries each list holds.
502
+ * Deliberately not the entries' text (deployment-supplied hosts, the {@link WiringManifest.readDeny} class). IN the fingerprint: the
503
+ * declaration is the deployment's, so legs of one assembly agree.
504
+ */
505
+ hostFloor?: import("./host-floor.js").HostFloorPosture;
506
+ /**
507
+ * EFFECTIVE half only — the advisor tool on this leg, as the leg STARTED (a snapshot: a switch-off that lands later in the
508
+ * leg is not in it; a host reads the conversation's current state off the transcript, `advisorHoldOf`). Present ⇔ the leg's
509
+ * spec names an advisor model. `requested` = the ref as given (a Model's `id`; absent when the deployment switch ignored it
510
+ * unread); `main` = the leg's resolved model; `state` `on` (with `model`, the resolved advisor), `held` (the conversation
511
+ * switched it off; `hold` = the cause) or `not_attached` (`reason`; `routeCode` on `route_refused`). Out of
512
+ * {@link configFingerprint}: a per-task seat.
513
+ */
514
+ advisor?: WiringAdvisorFact;
475
515
  /** EFFECTIVE half only — a short, non-sensitive fingerprint (sha256 prefix over the canonical
476
516
  * JSON of this manifest's own resolved facts; every field here is an enum/boolean/count, no
477
517
  * secrets) so an operator can correlate legs that ran under the same resolved assembly. */
@@ -573,6 +613,24 @@ export interface WiringFacts {
573
613
  autoConsolidationOnRecommendation?: boolean;
574
614
  /** Effective half only — the file-history phase's word ({@link WiringManifest.fileHistory}); the engine always passes it. */
575
615
  fileHistory?: "on" | "disabled";
616
+ /** Effective half only — the project-context phase's word ({@link WiringManifest.projectMemory}); the engine always passes it. */
617
+ projectMemory?: WiringManifest["projectMemory"];
618
+ /** Effective half only — {@link WiringManifest.sessionRules}`.childrenReadLive`: this leg's session-rule layer published its key for its children's chain. Read off that wiring, never a constant. */
619
+ sessionRulesChildrenReadLive?: boolean;
620
+ /** Effective half only — the advisor phase's answer ({@link WiringManifest.advisor}), relayed, never re-derived. */
621
+ advisor?: WiringAdvisorFact;
622
+ /** Effective half only — the compiled host floor's posture ({@link WiringManifest.hostFloor}); absent ⇒ none declared. */
623
+ hostFloor?: import("./host-floor.js").HostFloorPosture;
624
+ }
625
+ /** {@link WiringManifest.advisor}. */
626
+ export interface WiringAdvisorFact {
627
+ requested?: string;
628
+ main: string;
629
+ state: "on" | "not_attached" | "held";
630
+ model?: string;
631
+ reason?: import("./advisor-verdict.js").AdvisorNotAttachedReason;
632
+ routeCode?: import("../internal/llm.js").RouteRefusalCode;
633
+ hold?: import("./advisor-verdict.js").AdvisorHold;
576
634
  }
577
635
  /** Named view of the deps seats the static half reads (a `Pick` of the real {@link RunnerDeps} —
578
636
  * single-source shapes, no parallel hand-copied interface). */