@sema-agent/core 7.55.0 → 7.57.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 (502) hide show
  1. package/CHANGELOG.md +1054 -0
  2. package/LICENSE +1 -1
  3. package/dist/agents/cascade.js +1 -1
  4. package/dist/agents/cc-peer-directory.js +1 -0
  5. package/dist/agents/child-model-seat.d.ts +0 -11
  6. package/dist/agents/child-model-seat.js +0 -3
  7. package/dist/agents/list-agents-tool.d.ts +3 -1
  8. package/dist/agents/list-agents-tool.js +7 -7
  9. package/dist/agents/org-delivery-gate.js +3 -4
  10. package/dist/agents/peer-directory.d.ts +22 -4
  11. package/dist/agents/peer-directory.js +24 -2
  12. package/dist/agents/peer-held-queue.d.ts +69 -49
  13. package/dist/agents/peer-held-queue.js +255 -106
  14. package/dist/agents/peer-session-drain.js +65 -45
  15. package/dist/agents/repair-loop.js +2 -2
  16. package/dist/agents/send-message-tool.js +7 -6
  17. package/dist/agents/subagent.d.ts +6 -4
  18. package/dist/agents/subagent.js +72 -68
  19. package/dist/agents/tool-filter.d.ts +7 -5
  20. package/dist/agents/tool-filter.js +12 -9
  21. package/dist/agents/verify.d.ts +3 -2
  22. package/dist/agents/verify.js +3 -3
  23. package/dist/brain/anthropic.js +45 -80
  24. package/dist/brain/media-degrade.d.ts +18 -7
  25. package/dist/brain/media-degrade.js +13 -2
  26. package/dist/brain/model-capability.d.ts +37 -0
  27. package/dist/brain/model-capability.js +34 -0
  28. package/dist/brain/model-presets.d.ts +2 -8
  29. package/dist/brain/model-presets.js +1 -6
  30. package/dist/brain/open-responses.js +23 -34
  31. package/dist/brain/openai.js +25 -96
  32. package/dist/brain/provider-dialect.d.ts +3 -2
  33. package/dist/brain/provider-dialect.js +2 -2
  34. package/dist/brain/reasoning-request.d.ts +96 -0
  35. package/dist/brain/reasoning-request.js +174 -0
  36. package/dist/brain/reasoning.d.ts +11 -11
  37. package/dist/brain/reasoning.js +4 -3
  38. package/dist/brain/request-params.d.ts +13 -4
  39. package/dist/brain/request-params.js +21 -5
  40. package/dist/brain/status-sink.d.ts +20 -0
  41. package/dist/brain/status-sink.js +7 -0
  42. package/dist/brain/stream-engine.d.ts +9 -0
  43. package/dist/brain/stream-engine.js +24 -10
  44. package/dist/brain/stream-shared.d.ts +5 -4
  45. package/dist/brain/stream-shared.js +4 -4
  46. package/dist/core/a2a.d.ts +2 -1
  47. package/dist/core/a2a.js +19 -13
  48. package/dist/core/agent-definition.d.ts +10 -0
  49. package/dist/core/allow-entry.d.ts +23 -23
  50. package/dist/core/allow-entry.js +42 -46
  51. package/dist/core/allow-rule-shadow.d.ts +3 -3
  52. package/dist/core/approval-object.d.ts +21 -5
  53. package/dist/core/approval-object.js +44 -17
  54. package/dist/core/ask-origin.d.ts +66 -20
  55. package/dist/core/ask-origin.js +63 -23
  56. package/dist/core/ask-question.d.ts +51 -8
  57. package/dist/core/ask-question.js +3 -4
  58. package/dist/core/ask-unresolvable-notice.d.ts +8 -3
  59. package/dist/core/ask-unresolvable-notice.js +16 -2
  60. package/dist/core/auto-compaction.d.ts +71 -6
  61. package/dist/core/auto-compaction.js +42 -26
  62. package/dist/core/background-agent-store.d.ts +6 -2
  63. package/dist/core/background-agent-store.js +1 -1
  64. package/dist/core/checkpoint-generation.d.ts +53 -0
  65. package/dist/core/checkpoint-generation.js +35 -0
  66. package/dist/core/checkpoint-queries.d.ts +180 -0
  67. package/dist/core/checkpoint-queries.js +272 -0
  68. package/dist/core/checkpoint-requirements.d.ts +19 -1
  69. package/dist/core/checkpoint-requirements.js +6 -0
  70. package/dist/core/checkpoint-store.d.ts +105 -53
  71. package/dist/core/checkpoint-store.js +43 -20
  72. package/dist/core/cross-boundary-taint.d.ts +6 -5
  73. package/dist/core/cross-boundary-taint.js +5 -5
  74. package/dist/core/decision-receipt.d.ts +37 -3
  75. package/dist/core/decision-receipt.js +17 -17
  76. package/dist/core/delegation-not-started.d.ts +6 -0
  77. package/dist/core/delegation-not-started.js +17 -0
  78. package/dist/core/engine-attestation.d.ts +93 -0
  79. package/dist/core/engine-attestation.js +70 -0
  80. package/dist/core/engine-capabilities.d.ts +4 -1
  81. package/dist/core/engine-capabilities.js +1 -1
  82. package/dist/core/engine-notice.d.ts +32 -12
  83. package/dist/core/engine-notice.js +6 -0
  84. package/dist/core/file-history-store.d.ts +104 -22
  85. package/dist/core/file-history-store.js +37 -19
  86. package/dist/core/gate-fold.d.ts +1 -1
  87. package/dist/core/gate-fold.js +22 -10
  88. package/dist/core/gate-lanes.js +73 -65
  89. package/dist/core/gate-outcome.d.ts +26 -5
  90. package/dist/core/gate-outcome.js +26 -0
  91. package/dist/core/governance-codes.d.ts +5 -1
  92. package/dist/core/governance-codes.js +6 -0
  93. package/dist/core/hooks.d.ts +19 -18
  94. package/dist/core/hooks.js +3 -1
  95. package/dist/core/host-floor.d.ts +128 -0
  96. package/dist/core/host-floor.js +206 -0
  97. package/dist/core/host-target.d.ts +38 -3
  98. package/dist/core/host-target.js +38 -5
  99. package/dist/core/mailbox-store.d.ts +62 -1
  100. package/dist/core/mailbox-store.js +59 -0
  101. package/dist/core/mcp-name-judge.d.ts +46 -0
  102. package/dist/core/mcp-name-judge.js +61 -0
  103. package/dist/core/mcp-probe.d.ts +1 -1
  104. package/dist/core/mcp-probe.js +2 -5
  105. package/dist/core/mcp.d.ts +5 -1
  106. package/dist/core/mcp.js +70 -64
  107. package/dist/core/memory-engine/consolidation-driver.js +4 -3
  108. package/dist/core/memory-engine/delegation-settlement.js +15 -24
  109. package/dist/core/memory-engine/distiller.js +26 -17
  110. package/dist/core/memory-engine/engine.js +4 -4
  111. package/dist/core/memory-engine/layout.d.ts +60 -8
  112. package/dist/core/memory-engine/layout.js +70 -8
  113. package/dist/core/model-seat.d.ts +10 -3
  114. package/dist/core/mods/classic-events.d.ts +67 -0
  115. package/dist/core/mods/classic-events.js +1 -0
  116. package/dist/core/mods/dollar.d.ts +13 -0
  117. package/dist/core/mods/extension-call.d.ts +31 -0
  118. package/dist/core/mods/extension-call.js +43 -0
  119. package/dist/core/mods/kernel/dispatch.d.ts +20 -3
  120. package/dist/core/mods/kernel/dispatch.js +140 -69
  121. package/dist/core/mods/kernel/events.d.ts +47 -11
  122. package/dist/core/mods/kernel/events.js +66 -42
  123. package/dist/core/mods/kernel/index.d.ts +4 -4
  124. package/dist/core/mods/kernel/index.js +2 -2
  125. package/dist/core/mods/kernel/receive.d.ts +39 -5
  126. package/dist/core/mods/kernel/receive.js +290 -17
  127. package/dist/core/mods/kernel/registration.d.ts +33 -2
  128. package/dist/core/mods/kernel/registration.js +6 -7
  129. package/dist/core/mods/kernel/site-rules.d.ts +44 -16
  130. package/dist/core/mods/kernel/site-rules.js +24 -42
  131. package/dist/core/mods/spec-seats.d.ts +69 -0
  132. package/dist/core/mods/spec-seats.js +114 -0
  133. package/dist/core/mods/stations.d.ts +28 -8
  134. package/dist/core/mods/stations.js +29 -13
  135. package/dist/core/mods/tool-call.d.ts +79 -0
  136. package/dist/core/mods/tool-call.js +152 -0
  137. package/dist/core/namespaced-rule-name.d.ts +32 -38
  138. package/dist/core/namespaced-rule-name.js +29 -36
  139. package/dist/core/parent-spec-seat.d.ts +6 -1
  140. package/dist/core/parent-spec-seat.js +2 -0
  141. package/dist/core/park-selfcheck.js +3 -0
  142. package/dist/core/permission-rule-consent.d.ts +24 -3
  143. package/dist/core/permission-rule-consent.js +136 -41
  144. package/dist/core/permission-rule-model.d.ts +57 -5
  145. package/dist/core/permission-rule-model.js +90 -31
  146. package/dist/core/permission-rule-org.d.ts +6 -2
  147. package/dist/core/permission-rule-org.js +8 -4
  148. package/dist/core/permission-rule-provider.d.ts +5 -2
  149. package/dist/core/permission-rule-provider.js +41 -11
  150. package/dist/core/permission-rule-store.d.ts +3 -2
  151. package/dist/core/permission-rule-store.js +11 -2
  152. package/dist/core/permission-rule-sync.js +3 -2
  153. package/dist/core/permission-rule-syntax.d.ts +5 -4
  154. package/dist/core/permission-rule-syntax.js +2 -2
  155. package/dist/core/permission-rules.d.ts +4 -4
  156. package/dist/core/permission-rules.js +11 -20
  157. package/dist/core/persisted-rule-arms.d.ts +2 -2
  158. package/dist/core/persisted-rule-arms.js +10 -12
  159. package/dist/core/principal-name.d.ts +20 -0
  160. package/dist/core/principal-name.js +22 -0
  161. package/dist/core/prompt-section-seat.js +4 -6
  162. package/dist/core/protocol-http-auth.d.ts +40 -5
  163. package/dist/core/protocol-http-auth.js +168 -4
  164. package/dist/core/protocol-naming.d.ts +20 -0
  165. package/dist/core/protocol-naming.js +20 -3
  166. package/dist/core/read-only-shell.d.ts +20 -5
  167. package/dist/core/read-only-shell.js +29 -14
  168. package/dist/core/remote-env.d.ts +37 -1
  169. package/dist/core/remote-env.js +11 -0
  170. package/dist/core/resume-startup-cause.d.ts +24 -2
  171. package/dist/core/resume-startup-cause.js +20 -1
  172. package/dist/core/retired-keys.d.ts +16 -0
  173. package/dist/core/retired-keys.js +16 -4
  174. package/dist/core/rewrite-rejudge.d.ts +60 -0
  175. package/dist/core/rewrite-rejudge.js +36 -0
  176. package/dist/core/roles.d.ts +28 -1
  177. package/dist/core/roles.js +81 -26
  178. package/dist/core/rule-lane-reads.d.ts +20 -15
  179. package/dist/core/rule-lane-reads.js +45 -17
  180. package/dist/core/rule-owner.d.ts +3 -3
  181. package/dist/core/rule-owner.js +3 -2
  182. package/dist/core/runner/announce-once-ledger.d.ts +14 -0
  183. package/dist/core/runner/announce-once-ledger.js +5 -0
  184. package/dist/core/runner/assemble-result.d.ts +1 -0
  185. package/dist/core/runner/assemble-result.js +1 -1
  186. package/dist/core/runner/call-hook-stations.d.ts +3 -2
  187. package/dist/core/runner/caller-roster.d.ts +16 -4
  188. package/dist/core/runner/caller-roster.js +33 -6
  189. package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
  190. package/dist/core/runner/capability-withheld-seat.js +24 -0
  191. package/dist/core/runner/classifier-ladder.d.ts +7 -9
  192. package/dist/core/runner/classifier-ladder.js +3 -3
  193. package/dist/core/runner/compact-session.d.ts +10 -0
  194. package/dist/core/runner/compact-session.js +202 -0
  195. package/dist/core/runner/compaction-call-options.d.ts +2 -2
  196. package/dist/core/runner/compaction-seams.d.ts +21 -1
  197. package/dist/core/runner/compaction-seams.js +11 -8
  198. package/dist/core/runner/construction-doors.js +3 -0
  199. package/dist/core/runner/contracts.d.ts +50 -40
  200. package/dist/core/runner/cross-boundary-lane.d.ts +17 -13
  201. package/dist/core/runner/cross-boundary-lane.js +40 -27
  202. package/dist/core/runner/denial-limit-arms.d.ts +2 -2
  203. package/dist/core/runner/denial-limit-arms.js +1 -1
  204. package/dist/core/runner/derived-route-fallback.d.ts +13 -0
  205. package/dist/core/runner/derived-route-fallback.js +6 -0
  206. package/dist/core/runner/env-capability-census.d.ts +3 -2
  207. package/dist/core/runner/env-capability-census.js +9 -3
  208. package/dist/core/runner/file-history-request.d.ts +18 -0
  209. package/dist/core/runner/file-history-request.js +21 -13
  210. package/dist/core/runner/file-history-restore.d.ts +45 -0
  211. package/dist/core/runner/file-history-restore.js +46 -0
  212. package/dist/core/runner/gate-exit.d.ts +3 -3
  213. package/dist/core/runner/gate-exit.js +4 -3
  214. package/dist/core/runner/image.d.ts +7 -17
  215. package/dist/core/runner/image.js +9 -60
  216. package/dist/core/runner/permission-rule-lanes.d.ts +11 -11
  217. package/dist/core/runner/permission-rule-lanes.js +39 -17
  218. package/dist/core/runner/person-path-rows.d.ts +12 -9
  219. package/dist/core/runner/person-path-rows.js +18 -7
  220. package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -0
  221. package/dist/core/runner/prepare-acquire-reconcile.js +2 -1
  222. package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
  223. package/dist/core/runner/prepare-ask-lane.js +5 -2
  224. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
  225. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  226. package/dist/core/runner/prepare-config-doors.d.ts +35 -38
  227. package/dist/core/runner/prepare-config-doors.js +46 -28
  228. package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
  229. package/dist/core/runner/prepare-defer-classify.js +7 -8
  230. package/dist/core/runner/prepare-file-history.d.ts +48 -8
  231. package/dist/core/runner/prepare-file-history.js +7 -39
  232. package/dist/core/runner/prepare-gate-stations.d.ts +1 -1
  233. package/dist/core/runner/prepare-gate-stations.js +10 -1
  234. package/dist/core/runner/prepare-hands-readface.d.ts +5 -9
  235. package/dist/core/runner/prepare-hands-readface.js +17 -14
  236. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
  237. package/dist/core/runner/prepare-inherited-gate.js +5 -3
  238. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  239. package/dist/core/runner/prepare-park-ask.d.ts +2 -0
  240. package/dist/core/runner/prepare-park-ask.js +7 -7
  241. package/dist/core/runner/prepare-policy-chain.d.ts +6 -3
  242. package/dist/core/runner/prepare-policy-chain.js +67 -76
  243. package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
  244. package/dist/core/runner/prepare-prompt-assembly.js +10 -8
  245. package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
  246. package/dist/core/runner/prepare-prompt-inputs.js +3 -5
  247. package/dist/core/runner/prepare-protocol-tools.d.ts +2 -0
  248. package/dist/core/runner/prepare-protocol-tools.js +3 -3
  249. package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
  250. package/dist/core/runner/prepare-safety-scan.js +0 -17
  251. package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
  252. package/dist/core/runner/prepare-suspend-saga.js +5 -6
  253. package/dist/core/runner/prepare-task.d.ts +5 -2
  254. package/dist/core/runner/prepare-task.js +48 -43
  255. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +20 -4
  256. package/dist/core/runner/prepare-tool-disclosure-mount.js +33 -23
  257. package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
  258. package/dist/core/runner/prepare-turn-wiring.js +2 -7
  259. package/dist/core/runner/prepare-wiring-manifest.d.ts +6 -2
  260. package/dist/core/runner/prepare-wiring-manifest.js +3 -3
  261. package/dist/core/runner/resume-admission.js +1 -1
  262. package/dist/core/runner/resume-apply.js +11 -12
  263. package/dist/core/runner/resume-checkpoint-screen.js +3 -0
  264. package/dist/core/runner/resume-claim.d.ts +4 -2
  265. package/dist/core/runner/resume-claim.js +15 -8
  266. package/dist/core/runner/retired-runner-deps.js +1 -0
  267. package/dist/core/runner/rewind-files.d.ts +12 -0
  268. package/dist/core/runner/rewind-files.js +90 -0
  269. package/dist/core/runner/run-attachment-seats.js +2 -1
  270. package/dist/core/runner/run-brain-sinks.d.ts +4 -1
  271. package/dist/core/runner/run-brain-sinks.js +4 -2
  272. package/dist/core/runner/run-harness-handlers.js +12 -4
  273. package/dist/core/runner/run-leg.d.ts +1 -1
  274. package/dist/core/runner/run-leg.js +40 -39
  275. package/dist/core/runner/run-notification-lane.d.ts +2 -0
  276. package/dist/core/runner/run-notification-lane.js +2 -2
  277. package/dist/core/runner/run-recovery-lanes.js +3 -4
  278. package/dist/core/runner/run-settle-and-teardown.js +7 -12
  279. package/dist/core/runner/run-terminal-adoption.js +3 -4
  280. package/dist/core/runner/run-turn-boundary.js +4 -15
  281. package/dist/core/runner/runtask.d.ts +10 -0
  282. package/dist/core/runner/runtask.js +35 -42
  283. package/dist/core/runner/send-message-continuation.js +1 -1
  284. package/dist/core/runner/session-read-file-states.d.ts +15 -0
  285. package/dist/core/runner/session-read-file-states.js +28 -0
  286. package/dist/core/runner/session-rule-policy.js +4 -3
  287. package/dist/core/runner/session-verb-doors.d.ts +28 -0
  288. package/dist/core/runner/session-verb-doors.js +48 -0
  289. package/dist/core/runner/session-write-ledger.d.ts +30 -0
  290. package/dist/core/runner/session-write-ledger.js +101 -0
  291. package/dist/core/runner/shell-env-withheld.d.ts +33 -0
  292. package/dist/core/runner/shell-env-withheld.js +51 -0
  293. package/dist/core/runner/skills-seat.js +6 -2
  294. package/dist/core/runner/stream-settle-backstop.js +12 -15
  295. package/dist/core/runner/sub-agent-deny-lists.d.ts +25 -3
  296. package/dist/core/runner/sub-agent-deny-lists.js +25 -17
  297. package/dist/core/runner/synthetic-tools.d.ts +6 -0
  298. package/dist/core/runner/synthetic-tools.js +4 -1
  299. package/dist/core/runner/teardown-bounded.d.ts +1 -0
  300. package/dist/core/runner/teardown-bounded.js +1 -0
  301. package/dist/core/runner/tool-disclosure.d.ts +10 -12
  302. package/dist/core/runner/tool-disclosure.js +1 -3
  303. package/dist/core/runner/tool-end-body.d.ts +1 -1
  304. package/dist/core/runner/tool-end-body.js +10 -9
  305. package/dist/core/runner/tool-not-executed.d.ts +5 -0
  306. package/dist/core/runner/tool-not-executed.js +11 -0
  307. package/dist/core/runner/tool-occurrence.d.ts +8 -0
  308. package/dist/core/runner/tool-occurrence.js +7 -0
  309. package/dist/core/runner/turn-attachments.d.ts +33 -15
  310. package/dist/core/runner/turn-attachments.js +62 -37
  311. package/dist/core/runner-deps.d.ts +7 -7
  312. package/dist/core/safety-axis-vocab.d.ts +6 -4
  313. package/dist/core/safety-axis-vocab.js +6 -5
  314. package/dist/core/safety-merge-corpus.js +11 -3
  315. package/dist/core/secret-env.d.ts +30 -3
  316. package/dist/core/secret-env.js +47 -8
  317. package/dist/core/select-model.js +3 -3
  318. package/dist/core/session-policy-store.d.ts +32 -15
  319. package/dist/core/session-policy-store.js +156 -36
  320. package/dist/core/session-store.d.ts +29 -10
  321. package/dist/core/session-store.js +51 -19
  322. package/dist/core/session.d.ts +82 -16
  323. package/dist/core/session.js +53 -0
  324. package/dist/core/shell-read-silence.d.ts +11 -12
  325. package/dist/core/shell-read-silence.js +9 -5
  326. package/dist/core/shell-run-candidates.js +3 -1
  327. package/dist/core/shell-wrapper-projection.d.ts +1 -1
  328. package/dist/core/shell-wrapper-projection.js +1 -1
  329. package/dist/core/shell-wrapper-table.d.ts +14 -7
  330. package/dist/core/shell-wrapper-table.js +5 -4
  331. package/dist/core/side-query.js +10 -1
  332. package/dist/core/skill-grant.d.ts +7 -2
  333. package/dist/core/skill-grant.js +5 -0
  334. package/dist/core/skills-directory.js +6 -2
  335. package/dist/core/store-contracts/background-agent-store-contract.js +1 -0
  336. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
  337. package/dist/core/store-contracts/checkpoint-store-contract.js +141 -2
  338. package/dist/core/store-contracts/file-history-store-contract.js +40 -1
  339. package/dist/core/store-contracts/mailbox-store-contract.js +49 -1
  340. package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
  341. package/dist/core/store-contracts/peer-directory-contract.js +14 -2
  342. package/dist/core/store-contracts/session-repo-contract.js +51 -0
  343. package/dist/core/store-contracts/session-store-contract.d.ts +2 -1
  344. package/dist/core/store-contracts/session-store-contract.js +150 -14
  345. package/dist/core/stub-env.d.ts +2 -0
  346. package/dist/core/stub-env.js +1 -0
  347. package/dist/core/synthetic-read-verdict.js +3 -3
  348. package/dist/core/task-event.d.ts +32 -4
  349. package/dist/core/task-notification.d.ts +16 -12
  350. package/dist/core/task-registry-agent.d.ts +8 -4
  351. package/dist/core/task-registry-agent.js +14 -8
  352. package/dist/core/task-registry-shared.d.ts +35 -6
  353. package/dist/core/task-registry-shared.js +11 -0
  354. package/dist/core/task-registry.d.ts +10 -1
  355. package/dist/core/task-registry.js +12 -2
  356. package/dist/core/task-result.d.ts +18 -0
  357. package/dist/core/task-spec.d.ts +18 -13
  358. package/dist/core/tighten-task-spec.js +2 -1
  359. package/dist/core/tool-catalog-entries.d.ts +23 -0
  360. package/dist/core/tool-catalog-entries.js +14 -2
  361. package/dist/core/tool-check-reading.d.ts +11 -0
  362. package/dist/core/tool-check-reading.js +11 -6
  363. package/dist/core/tool-model-gate.d.ts +2 -2
  364. package/dist/core/tool-name-aliases.d.ts +48 -18
  365. package/dist/core/tool-name-aliases.js +36 -19
  366. package/dist/core/tool-name-readings.d.ts +6 -32
  367. package/dist/core/tool-name-readings.js +2 -9
  368. package/dist/core/tool-policy.d.ts +78 -204
  369. package/dist/core/tool-policy.js +152 -204
  370. package/dist/core/tool-result-store.js +3 -0
  371. package/dist/core/tool-roster.d.ts +14 -19
  372. package/dist/core/tool-roster.js +11 -44
  373. package/dist/core/tool-spec-members.js +7 -2
  374. package/dist/core/tool-spec.d.ts +19 -11
  375. package/dist/core/tools.js +49 -9
  376. package/dist/core/trace.d.ts +6 -3
  377. package/dist/core/trace.js +2 -1
  378. package/dist/core/types.d.ts +1 -1
  379. package/dist/core/untrusted-egress.d.ts +20 -0
  380. package/dist/core/untrusted-egress.js +77 -3
  381. package/dist/core/user-attachment.d.ts +8 -1
  382. package/dist/core/user-attachment.js +64 -4
  383. package/dist/core/wiring-manifest.d.ts +9 -0
  384. package/dist/core/wiring-manifest.js +1 -0
  385. package/dist/core/workflow-journal-store.js +1 -1
  386. package/dist/engine/compaction/compaction.js +3 -2
  387. package/dist/engine/execution-env/node-execution-env.d.ts +7 -3
  388. package/dist/engine/execution-env/node-execution-env.js +11 -2
  389. package/dist/engine/harness/agent-harness.d.ts +32 -6
  390. package/dist/engine/harness/agent-harness.js +65 -9
  391. package/dist/engine/harness/types.d.ts +29 -2
  392. package/dist/engine/llm/types.d.ts +28 -11
  393. package/dist/engine/loop/agent-loop.d.ts +23 -4
  394. package/dist/engine/loop/agent-loop.js +42 -30
  395. package/dist/engine/loop/types.d.ts +16 -6
  396. package/dist/engine/session/memory-repo.d.ts +9 -2
  397. package/dist/engine/session/memory-repo.js +11 -1
  398. package/dist/engine/session/repo-utils.d.ts +6 -5
  399. package/dist/engine/session/repo-utils.js +14 -6
  400. package/dist/index.d.ts +34 -17
  401. package/dist/index.js +22 -11
  402. package/dist/internal/harness-types.d.ts +1 -1
  403. package/dist/internal/harness.d.ts +2 -1
  404. package/dist/internal/harness.js +1 -0
  405. package/dist/internal/llm.d.ts +1 -1
  406. package/dist/orchestration/run-workflow-tool.d.ts +6 -4
  407. package/dist/orchestration/run-workflow-tool.js +5 -3
  408. package/dist/orchestration/workflow.d.ts +3 -0
  409. package/dist/orchestration/workflow.js +36 -18
  410. package/dist/primitives/credential-ref.d.ts +89 -0
  411. package/dist/primitives/credential-ref.js +125 -0
  412. package/dist/primitives/index.d.ts +2 -0
  413. package/dist/primitives/index.js +1 -0
  414. package/dist/prompt-assembly/artifact.d.ts +2 -2
  415. package/dist/prompt-assembly/artifact.js +5 -3
  416. package/dist/prompt-assembly/assemble.d.ts +3 -2
  417. package/dist/prompt-assembly/assemble.js +1 -1
  418. package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
  419. package/dist/prompt-assembly/catalog/schema.js +34 -2
  420. package/dist/prompt-assembly/catalog/sections.js +0 -1
  421. package/dist/prompt-assembly/composer.d.ts +3 -1
  422. package/dist/prompt-assembly/composer.js +1 -1
  423. package/dist/prompt-assembly/event-registry.js +1 -0
  424. package/dist/prompt-assembly/overlay.js +3 -3
  425. package/dist/prompt-assembly/renderers.d.ts +1 -1
  426. package/dist/prompt-assembly/renderers.js +0 -3
  427. package/dist/prompt-assembly/role-base.d.ts +15 -0
  428. package/dist/prompt-assembly/role-base.js +9 -0
  429. package/dist/prompt-assembly/select.d.ts +39 -14
  430. package/dist/prompt-assembly/select.js +47 -16
  431. package/dist/prompt-assembly/sugar.d.ts +17 -11
  432. package/dist/prompt-assembly/sugar.js +8 -3
  433. package/dist/prompt-assembly/tool-catalog.d.ts +37 -3
  434. package/dist/prompt-assembly/tool-catalog.js +114 -4
  435. package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
  436. package/dist/prompt-assembly/turn-snapshot.js +0 -3
  437. package/dist/prompt-assembly/types.d.ts +0 -7
  438. package/dist/scenarios/full-body.d.ts +11 -11
  439. package/dist/scenarios/full-body.js +4 -3
  440. package/dist/shell/lex.js +10 -1
  441. package/dist/stores/file/adoption/adopt.js +4 -3
  442. package/dist/stores/file/adoption/marker.js +3 -2
  443. package/dist/stores/file/checkpoint-store.d.ts +21 -4
  444. package/dist/stores/file/checkpoint-store.js +38 -7
  445. package/dist/stores/file/file-history-store.js +18 -11
  446. package/dist/stores/file/index.js +2 -1
  447. package/dist/stores/file/mailbox-store.d.ts +2 -1
  448. package/dist/stores/file/mailbox-store.js +26 -1
  449. package/dist/stores/file/permission-rule-adopt.js +4 -3
  450. package/dist/stores/file/permission-rule-store.js +11 -5
  451. package/dist/stores/file/session-store.d.ts +29 -6
  452. package/dist/stores/file/session-store.js +42 -50
  453. package/dist/tools/artifact/artifact-tool.js +3 -2
  454. package/dist/tools/fs/bash-program-position.d.ts +19 -2
  455. package/dist/tools/fs/bash-program-position.js +56 -9
  456. package/dist/tools/fs/bash-readonly-classifier.d.ts +15 -19
  457. package/dist/tools/fs/bash-readonly-classifier.js +5 -10
  458. package/dist/tools/fs/fs-bash.js +15 -8
  459. package/dist/tools/fs/fs-glob.d.ts +86 -0
  460. package/dist/tools/fs/fs-glob.js +226 -0
  461. package/dist/tools/fs/fs-read.js +14 -14
  462. package/dist/tools/fs/fs-search-tools.js +7 -7
  463. package/dist/tools/fs/pattern-kill-guard.d.ts +23 -0
  464. package/dist/tools/fs/pattern-kill-guard.js +429 -0
  465. package/dist/tools/fs/pdf.d.ts +9 -6
  466. package/dist/tools/fs/pdf.js +3 -3
  467. package/dist/tools/fs/program-read-model.d.ts +57 -7
  468. package/dist/tools/fs/program-read-model.js +11 -1
  469. package/dist/tools/fs/program-read-model.rows.js +78 -21
  470. package/dist/tools/fs/read-deny-home.js +3 -2
  471. package/dist/tools/fs/removal-targets.d.ts +17 -7
  472. package/dist/tools/fs/removal-targets.js +47 -20
  473. package/dist/tools/fs/search.d.ts +10 -0
  474. package/dist/tools/fs/search.js +20 -26
  475. package/dist/tools/fs/shell-read-argv.js +89 -12
  476. package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
  477. package/dist/tools/fs/shell-read-bindings.js +41 -0
  478. package/dist/tools/fs/shell-read-check.d.ts +10 -0
  479. package/dist/tools/fs/shell-read-check.js +13 -20
  480. package/dist/tools/fs/shell-read-environment.d.ts +5 -1
  481. package/dist/tools/fs/shell-read-environment.js +3 -2
  482. package/dist/tools/fs/shell-read-establish.d.ts +15 -0
  483. package/dist/tools/fs/shell-read-establish.js +19 -20
  484. package/dist/tools/fs/shell-read-identity.d.ts +12 -9
  485. package/dist/tools/fs/shell-read-identity.js +9 -4
  486. package/dist/tools/fs/shell-read-plan.js +24 -16
  487. package/dist/tools/fs/shell-read-start.d.ts +6 -1
  488. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
  489. package/dist/tools/fs/shell-read-write-targets.js +2 -3
  490. package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
  491. package/dist/tools/fs/shell-reentry-text.js +40 -2
  492. package/dist/tools/todo.js +63 -63
  493. package/dist/tools/web.d.ts +19 -14
  494. package/dist/tools/web.js +46 -61
  495. package/package.json +1 -1
  496. package/test/export-surface.snapshot.json +221 -7
  497. package/wire-changes/core-stores-sql@7.57.0.json +29 -0
  498. package/wire-changes/core@7.56.0.json +3891 -0
  499. package/wire-changes/core@7.57.0.json +1487 -0
  500. package/wire-changes/mods-kernel@7.56.0.json +303 -0
  501. package/wire-changes/mods-kernel@7.57.0.json +29 -0
  502. package/wire-changes/primitives@7.57.0.json +245 -0
@@ -2,7 +2,6 @@ import { Type, type Static, type TSchema } from "typebox";
2
2
  import type { AgentTool } from "../internal/harness-types.js";
3
3
  import { type ReservedApprovalCard, type ToolApprovalCard, type ToolFamily, type ToolHostTarget, type ToolRosterPathTarget, type ToolMountTag, type ToolPathTarget, type ToolRenderHints, type ToolRuleFace } from "./tool-face.js";
4
4
  import type { ToolContentOrigin, ToolEffect } from "./tool-spec.js";
5
- import type { ToolMarkSource } from "./ask-origin.js";
6
5
  export declare const ROSTER_SOURCES: readonly ["builtin", "caller", "host", "mcp", "a2a", "external", "synthetic"];
7
6
  export type RosterSource = (typeof ROSTER_SOURCES)[number];
8
7
  export declare const ToolRosterRenderHints: Type.TObject<{
@@ -322,9 +321,11 @@ export declare function parkedToolIdentity(roster: ToolRoster | undefined, toolN
322
321
  /** design/388 B6 × B18 — the FACE members a park row carries beside its identity: the display family, the declared
323
322
  * path target or URL slot, and the names the parked call was judged under. `names` is copied from the face the gate stamped on the
324
323
  * request (the model's spelling first — the row carries the judged fact, it is not re-derived); a request with no face
325
- * takes the roster's names for its row. A recheck that runs before the leg's roster exists (the pre-CAS resume-edit
326
- * re-adjudication) rebuilds the call face from the row through {@link parkedCallFaceOf}, so it judges the same object
327
- * the live gate judged. An empty object when the name is not on the snapshot (the row then reads pre-face and the
324
+ * takes the roster's names for its row. The mount site (`engineMounted`) is the roster entry's, as the identity and face members
325
+ * beside it are: a fact of the tool, not of the call, and never read off the request's face, which the policy that judges the call
326
+ * can write. A recheck that runs before the leg's roster exists (the pre-CAS resume-edit
327
+ * re-adjudication) rebuilds the call face from the row through {@link parkedCallFaceOf}, so it judges the members the row
328
+ * recorded (identity, family, targets, names, mount site) — not the live face's rule name values or approval card. An empty object when the name is not on the snapshot (the row then reads pre-face and the
328
329
  * recheck falls to the catalog for the name). */
329
330
  export declare function parkedToolFace(roster: ToolRoster | undefined, req: {
330
331
  readonly toolName: string;
@@ -336,6 +337,7 @@ export declare function parkedToolFace(roster: ToolRoster | undefined, req: {
336
337
  pathTarget?: ToolRosterEntry["pathTarget"];
337
338
  hostTarget?: ToolHostTarget;
338
339
  names?: readonly string[];
340
+ engineMounted?: true;
339
341
  };
340
342
  /** The live face a resumed park row is re-judged under: minted under the row's recorded spelling (`names[0]`) when that
341
343
  * spelling still resolves to the row's own tool on this roster, else under the row's wire name — a spelling that no
@@ -356,6 +358,7 @@ export declare function parkedCallFaceOf(pending: {
356
358
  contractId?: string;
357
359
  shapeDigest?: string;
358
360
  implementationRevision?: string;
361
+ engineMounted?: true;
359
362
  }): import("./tool-policy.js").ToolCallFace | undefined;
360
363
  /** The optional `face` seat of a ToolCallRequest: present iff a face was read (a bare request carries no key). */
361
364
  export declare function callFaceSeat(face: import("./tool-policy.js").ToolCallFace | undefined): {
@@ -427,6 +430,8 @@ export declare function ruleFaceOfInstance(schema: TSchema | undefined, declared
427
430
  primaryParams: string[];
428
431
  params: string[];
429
432
  };
433
+ /** The instance `row` describes: what runs when a call is judged by that row. A row no snapshot minted has none. */
434
+ export declare function rowMember(row: ToolRosterEntry): AgentTool | undefined;
430
435
  /** The instance each NAME dispatches to when several are mounted under it: the LATER mount (the harness keeps the
431
436
  * later one). The one selection — the roster's snapshot and every table keyed by a caller tool's name read it here. */
432
437
  export declare function survivorsByName<T extends {
@@ -478,28 +483,18 @@ export interface RosterSnapshotFacts {
478
483
  /** `TaskSpec.memory.trustedTools` — the exemption channel for an undeclared content class. */
479
484
  trustedTools: ReadonlySet<string>;
480
485
  }
481
- /** The leg's per-name safety-axis tables the builder keeps aligned with its mounts beside the effect map (the safety scan mints
482
- * them; the protocol folds and the shell seat also write them). */
483
- export interface RosterAxisTables {
484
- irreversibilityTier: Map<string, "never" | "maybe" | "always">;
485
- irreversibleTools: Set<string>;
486
- reversibilityProbes: Map<string, unknown>;
487
- egressTools: Set<string>;
488
- toolMarkSources: Map<string, Set<ToolMarkSource>>;
489
- }
490
486
  export declare class RosterBuilder {
491
487
  #private;
492
- /** `axes` — the leg's safety-axis tables beside the effect map (a builder for a single probe tool may go without). */
493
- constructor(effects: Map<string, ToolEffect>, axes?: RosterAxisTables);
488
+ /** `effects` — the leg's by-name effect map, which the builder keeps equal to the mounted set's answering members. The leg's
489
+ * safety-axis tables are not the builder's: their marks live under the names they were laid on, and a call reads them under
490
+ * the names it answers to. */
491
+ constructor(effects: Map<string, ToolEffect>);
494
492
  /** The mount array as a READ face. The order is the wire order. */
495
493
  get tools(): readonly AgentTool[];
496
494
  get length(): number;
497
495
  metaOf(tool: AgentTool): RosterMountMeta | undefined;
498
496
  /** Mount one instance at the tail; the leg's effect map then follows the mounted set (`#settleEffects`). The later mount under
499
- * a name is the one the harness dispatches to (`snapshot`'s yield rule). A `scenario` mount (a caller's own `TaskSpec.tools`
500
- * entry, the driver's frozen face — the declaration the safety scan judged) leaves the three safety axes as the scan wrote them;
501
- * any other mount under a name displaces the instance there, and the axes of the aliases the displaced instance answered to
502
- * move to the member they now resolve to (`#resettleAliases`). */
497
+ * a name is the one the harness dispatches to (`snapshot`'s yield rule). */
503
498
  mount(tool: AgentTool, meta: RosterMountMeta): void;
504
499
  /** An ENGINE-INJECTED instance the harness list carries outside the mount array (the ToolSearch lane): a roster
505
500
  * row — the model can call it — never a mount-array element (the disclosure lane owns that list and appends the
@@ -140,7 +140,7 @@ export function parkedToolFace(roster, req) {
140
140
  if (e === undefined)
141
141
  return {};
142
142
  const judged = req.face?.names;
143
- return { family: e.family, ...(e.pathTarget !== undefined ? { pathTarget: e.pathTarget } : {}), ...(e.hostTarget !== undefined ? { hostTarget: e.hostTarget } : {}), names: judged !== undefined && judged.includes(req.toolName) ? [...judged] : namesResolvingTo(roster, e) };
143
+ return { family: e.family, ...(e.pathTarget !== undefined ? { pathTarget: e.pathTarget } : {}), ...(e.hostTarget !== undefined ? { hostTarget: e.hostTarget } : {}), names: judged !== undefined && judged.includes(req.toolName) ? [...judged] : namesResolvingTo(roster, e), ...(engineMountedRow(e) ? { engineMounted: true } : {}) };
144
144
  }
145
145
  export function parkedRowLiveFace(roster, row) {
146
146
  const spelled = row.names?.[0];
@@ -159,6 +159,7 @@ export function parkedCallFaceOf(pending) {
159
159
  contractId: pending.contractId,
160
160
  shapeDigest: pending.shapeDigest,
161
161
  implementationRevision: pending.implementationRevision,
162
+ ...(pending.engineMounted === true ? { engineMounted: true } : {}),
162
163
  };
163
164
  }
164
165
  export function callFaceSeat(face) {
@@ -305,6 +306,10 @@ function capRenderHints(h) {
305
306
  out.approvalCard = h.approvalCard;
306
307
  return Object.keys(out).length > 0 ? out : undefined;
307
308
  }
309
+ const ROW_MEMBERS = new WeakMap();
310
+ export function rowMember(row) {
311
+ return ROW_MEMBERS.get(row);
312
+ }
308
313
  export function survivorsByName(mounted) {
309
314
  const winner = new Map();
310
315
  for (const t of mounted)
@@ -313,18 +318,6 @@ export function survivorsByName(mounted) {
313
318
  }
314
319
  export const faceOf = (t) => t;
315
320
  const protocolFolded = (source) => source === "mcp" || source === "a2a";
316
- const setOrClear = (m, key, value) => {
317
- if (value === undefined)
318
- m.delete(key);
319
- else
320
- m.set(key, value);
321
- };
322
- const memberIf = (s, key, member) => {
323
- if (member)
324
- s.add(key);
325
- else
326
- s.delete(key);
327
- };
328
321
  function configError(code, message) {
329
322
  const e = new Error(message);
330
323
  e.code = code;
@@ -335,10 +328,8 @@ export class RosterBuilder {
335
328
  #engineLane = [];
336
329
  #meta = new WeakMap();
337
330
  #effects;
338
- #axes;
339
- constructor(effects, axes) {
331
+ constructor(effects) {
340
332
  this.#effects = effects;
341
- this.#axes = axes;
342
333
  }
343
334
  get tools() {
344
335
  return this.#tools;
@@ -356,10 +347,7 @@ export class RosterBuilder {
356
347
  const displaced = this.#survivorNamed(tool.name);
357
348
  this.#admit(tool, meta);
358
349
  lane.push(tool);
359
- const aliases = [...(displaced?.aliases ?? []), ...(tool.aliases ?? [])];
360
- if (meta.mountedBy !== "scenario")
361
- this.#resettleAliases(aliases);
362
- return [tool.name, ...aliases];
350
+ return [tool.name, ...(displaced?.aliases ?? []), ...(tool.aliases ?? [])];
363
351
  }
364
352
  mountEngineLane(tool, meta) {
365
353
  this.#settleEffects(this.#mountOne(tool, meta, this.#engineLane));
@@ -389,28 +377,6 @@ export class RosterBuilder {
389
377
  #survivorNamed(name) {
390
378
  return survivorsByName([...this.#tools, ...this.#engineLane]).get(name);
391
379
  }
392
- #resettleAliases(aliases) {
393
- if (aliases.length === 0)
394
- return;
395
- const answering = toolNameIndex([...survivorsByName([...this.#tools, ...this.#engineLane]).values()]);
396
- for (const a of new Set(aliases)) {
397
- const owner = answering(a);
398
- if (owner?.name === a)
399
- continue;
400
- this.#repoint(a, owner?.name);
401
- }
402
- }
403
- #repoint(key, from) {
404
- if (this.#axes === undefined)
405
- return;
406
- const pick = (m) => (from === undefined ? undefined : m.get(from));
407
- const marks = pick(this.#axes.toolMarkSources);
408
- setOrClear(this.#axes.irreversibilityTier, key, pick(this.#axes.irreversibilityTier));
409
- setOrClear(this.#axes.reversibilityProbes, key, pick(this.#axes.reversibilityProbes));
410
- setOrClear(this.#axes.toolMarkSources, key, marks === undefined ? undefined : new Set(marks));
411
- memberIf(this.#axes.irreversibleTools, key, from !== undefined && this.#axes.irreversibleTools.has(from));
412
- memberIf(this.#axes.egressTools, key, from !== undefined && this.#axes.egressTools.has(from));
413
- }
414
380
  mountAll(tools, meta) {
415
381
  this.#settleEffects(tools.flatMap((t) => this.#mountOne(t, meta, this.#tools)));
416
382
  }
@@ -424,7 +390,6 @@ export class RosterBuilder {
424
390
  }
425
391
  }
426
392
  this.#settleEffects(this.#namesAfterRemoval(removed));
427
- this.#resettleAliases(removed.flatMap((t) => t.aliases ?? []));
428
393
  return removed;
429
394
  }
430
395
  replaceAt(index, tool) {
@@ -465,7 +430,9 @@ export class RosterBuilder {
465
430
  emitted.add(t.name);
466
431
  const survivor = winner.get(t.name);
467
432
  const meta = this.#meta.get(survivor) ?? { source: "caller", mountedBy: "scenario" };
468
- entries.push(mintRosterEntry(survivor, meta, facts));
433
+ const row = mintRosterEntry(survivor, meta, facts);
434
+ ROW_MEMBERS.set(row, survivor);
435
+ entries.push(row);
469
436
  }
470
437
  const roster = { schemaVersion: 1, count: entries.length, entries, digest: rosterDigestOf(entries) };
471
438
  const worn = rosterEngineNamesProblem(roster);
@@ -1,6 +1,9 @@
1
+ import { assertNoRetiredKeys, RETIRED_TOOL_SPEC_KEYS } from "./retired-keys.js";
1
2
  import { UNREADABLE_LIST, snapshotToolNameList } from "./tool-name-list.js";
3
+ import { isCatalogContract } from "./tool-catalog-entries.js";
4
+ import { isEngineDescriptor } from "../prompt-assembly/tool-catalog.js";
2
5
  export const TOOL_SPEC_MEMBERS = Object.keys({
3
- name: true, aliases: true, description: true, descriptionClassic: true, label: true, parameters: true, execute: true, effect: true,
6
+ name: true, aliases: true, description: true, descriptionVariants: true, label: true, parameters: true, execute: true, effect: true,
4
7
  egress: true, irreversibility: true, reversibilityProbe: true, permissionSeat: true, isConcurrencySafe: true, executionMode: true,
5
8
  contentOrigin: true, offload: true, offloadThresholdChars: true, defer: true, alwaysLoad: true, prepareArguments: true,
6
9
  validateInput: true, approvalPreview: true, family: true, pathTarget: true, hostTarget: true, ruleFace: true, renderHints: true, compactable: true,
@@ -14,6 +17,7 @@ const FACE_PLACES = { elementKeys: FACE_LIST_KEYS };
14
17
  const MAX_NODES = 20_000;
15
18
  const MAX_DEPTH = 64;
16
19
  const COPIED = new WeakSet();
20
+ const isEngineMint = (value) => isCatalogContract(value) || isEngineDescriptor(value);
17
21
  class DeclarationRefused extends Error {
18
22
  }
19
23
  function refuse(path, why) {
@@ -46,7 +50,7 @@ function copyNode(value, path, depth, state, lenient, places) {
46
50
  return value;
47
51
  if (typeof value === "function")
48
52
  return lenient ? inertFunction() : refuse(path, "a function inside declaration data");
49
- if (COPIED.has(value))
53
+ if (COPIED.has(value) || isEngineMint(value))
50
54
  return value;
51
55
  const seen = lenient ? state.seenLenient : state.seen;
52
56
  const shared = seen.get(value);
@@ -158,6 +162,7 @@ export function frozenExtra(key, value, state) {
158
162
  }
159
163
  }
160
164
  export function frozenToolSpec(spec) {
165
+ assertNoRetiredKeys(spec, RETIRED_TOOL_SPEC_KEYS, "ToolSpec");
161
166
  const copy = {};
162
167
  const state = newCopyState();
163
168
  for (const name of TOOL_SPEC_MEMBERS) {
@@ -9,7 +9,7 @@
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";
@@ -148,15 +148,18 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
148
148
  * across a canonical rename. Each alias keeps the same contract as {@link name} (a rule naming an alias reaches the tool).
149
149
  */
150
150
  aliases?: string[];
151
+ /** The model-facing description — the card's unconditional text: what the tool says when none of
152
+ * {@link descriptionVariants} holds. */
151
153
  description: string;
152
154
  /**
153
- * R2 双形轴(2026-07-18 裁):the CLASSIC-profile variant of {@link description}. The reference
154
- * keys its tool descriptions on `LT(model_id)` (simple short form vs classic long form); sema's
155
- * counterpart is {@link TaskSpec.promptProfile} — default "simple" (what CC serves every BYOM
156
- * model id). When the run resolves to "classic" and this field is present, it REPLACES
157
- * `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`).
158
161
  */
159
- descriptionClassic?: string;
162
+ descriptionVariants?: readonly ToolDescriptionVariant[];
160
163
  /**
161
164
  * Human label for UIs. Defaults to `name`. When it differs from `name`, it rides the call's `tool_start` and `tool_end`
162
165
  * frames as `label` (the run builds the table from the leg's mounted tools) — the advisor tool's label is its advisor
@@ -816,6 +819,10 @@ export interface ToolExecuteContext {
816
819
  * the tool runs outside a Runner task.
817
820
  */
818
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;
819
826
  /**
820
827
  * The RUNNING task's file-history LINEAGE (Runner-filled, read-only, never a model/tool argument;
821
828
  * present iff the run records file history — a `RunnerDeps.fileHistoryStore` wired, capture not `"off"`, not `"disabled"`): the history scope this run
@@ -1068,10 +1075,11 @@ export interface ToolExecuteContext {
1068
1075
  * dropping the selector in transit would trim a same-model child's roster in a way nobody
1069
1076
  * chose (the gate is a default, not a policy; there is no tighten-only axis to protect). */
1070
1077
  restoreGatedTools?: readonly string[] | true;
1071
- /** R2 双形轴 — the parent's resolved prompt profile, inherited down the delegation tree like the
1072
- * tool-face controls (Runner-filled): a classic-profile parent's children speak classic too
1073
- * unless the child spec says otherwise (child spec wins — profile is presentation, not policy). */
1074
- 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;
1075
1083
  /**
1076
1084
  * The parent SPEC seat this run hands its children ({@link import("./parent-spec-seat.js").ParentSpecSeat}):
1077
1085
  * `principal`, `oneShot` (only `true`), `clientContext` (the user's TZ/email facts), `onQuestion` (the FROZEN
@@ -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, contractOriginOf } 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,
@@ -121,7 +160,7 @@ function buildProduct(spec, owner, options) {
121
160
  const baseCtx = { toolCallId, signal };
122
161
  const ctx = options?.enrichCtx ? stampCallIdentity(options.enrichCtx(baseCtx), toolCallId, signal) : baseCtx;
123
162
  const ret = await spec.execute.call(owner, params, ctx);
124
- const { content, details, terminate, isError } = normalizeContent(ret);
163
+ const { content, details, terminate, isError } = receiveToolReturn(ret);
125
164
  const guarded = isEmptyToolContent(content)
126
165
  ? [{ type: "text", text: isError ? `(${spec.name} reported an error with no further output)` : `(${spec.name} completed with no output)` }]
127
166
  : content;
@@ -129,7 +168,7 @@ function buildProduct(spec, owner, options) {
129
168
  }
130
169
  catch (err) {
131
170
  const wrapped = new Error(formatToolError(err));
132
- const marks = readMember(err, "details");
171
+ const marks = receivedData(readMember(err, "details"));
133
172
  if (marks !== undefined)
134
173
  wrapped.details = marks;
135
174
  const errorKind = readMember(err, "errorKind");
@@ -141,7 +180,8 @@ function buildProduct(spec, owner, options) {
141
180
  };
142
181
  carryDelegationName(spec.execute, tool.execute);
143
182
  if (spec.contract) {
144
- attachToolContract(tool, {
183
+ const attach = isCatalogContract(spec.contract) ? attachEngineToolContract : attachToolContract;
184
+ attach(tool, {
145
185
  contractId: spec.contract.contractId,
146
186
  implementationRevision: spec.contract.implementationRevision,
147
187
  origin: contractOriginOf(spec.contract.contractId),
@@ -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>;
@@ -984,5 +984,8 @@ export type TraceEvent = {
984
984
  * await it; the default (absent) hook is a no-op the JIT can elide. Must not throw or do sync I/O.
985
985
  */
986
986
  export type TracerHook = (e: TraceEvent) => void;
987
- /** Invoke a tracer without ever letting it break the task (absent → no-op; throws swallowed). */
987
+ /** Invoke a tracer without ever letting it break the task (absent → no-op; throws swallowed). A frame is the engine's own account: it
988
+ * leaves minted HERE, the one throat — every string leaf through the same-principal tier's text pass, member names as written
989
+ * (`egressAccount`) — so a frame that carries a host's, a store's or a remote's words (a thrown text, a failure reason) needs no
990
+ * remembering at its mint site. */
988
991
  export declare function emitTrace(tracer: TracerHook | undefined, build: () => TraceEvent): void;
@@ -1,8 +1,9 @@
1
+ import { egressAccount } from "./untrusted-egress.js";
1
2
  export function emitTrace(tracer, build) {
2
3
  if (!tracer)
3
4
  return;
4
5
  try {
5
- tracer(build());
6
+ tracer(egressAccount("same-principal", build()));
6
7
  }
7
8
  catch {
8
9
  }
@@ -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";
@@ -60,6 +60,26 @@ export declare function redactHostLeaks(s: string, report?: RedactionReport): Eg
60
60
  * - cycles and shared members stay shared on the snapshot.
61
61
  */
62
62
  export declare function egressValue<T extends EgressTier, V>(tier: T, value: V): V;
63
+ /**
64
+ * Tier `tier`'s pass over an engine ACCOUNT value — a notice's detail, a trace frame: data the engine shaped, carrying words that may have
65
+ * come from a host, a store or a remote. Returned as a new value, never the one handed in. The rules, one each:
66
+ * - a string, at any depth, goes through {@link egressText};
67
+ * - a member NAME of plain data is the engine's own closed word and is kept as written (a detail's `key` or `tokenCount` is not a
68
+ * credential name, and reading it as one would blank the engine's own facts);
69
+ * - plain data is an array or an object whose prototype is `Object.prototype` or `null`, and is not a proxy (whose traps answer what
70
+ * they choose, a fresh value at every read included); its own enumerable members are read once, a function member is code and is
71
+ * not carried;
72
+ * - any other object (an error, a class instance, a `Map`, a `Date`, a proxy) came from elsewhere and leaves as
73
+ * {@link egressValue} reads it — there, and only there, a credential-named member's string is the marker whole, and there, and
74
+ * only there, a member bound applies (one per such value);
75
+ * - no member bound applies to plain data: the account is the engine's own, and its size is the engine's to answer for;
76
+ * - one walk: an object reached twice — through the data and through a value from elsewhere included — is read once and answers one
77
+ * snapshot (cycles and shared members stay shared); past {@link VALUE_DEPTH_MAX} the marker stands in.
78
+ * Every pass it runs is a fixed point, so an account value minted twice reads the same.
79
+ */
80
+ export declare function egressAccount<T extends EgressTier, V>(tier: T, value: V): V;
81
+ /** Where the markers sit in `s`, as [start, end) spans, leftmost first. */
82
+ export declare function redactionMarkerSpans(s: string): Array<[number, number]>;
63
83
  /** The `same-principal` tier's pass + size-bound (NO injection fence): workflow outputs/results/errors riding back to
64
84
  * the launching model/script, run rows behind scope-gated observe. Paths/URLs survive (the assertion pattern depends on
65
85
  * them); secrets never do. */
@@ -1,3 +1,4 @@
1
+ import { types } from "node:util";
1
2
  import { delimitUntrusted, inlineUntrusted, neutralizeForFence } from "./untrusted-text.js";
2
3
  import { egressPasses, runRedactionPasses } from "./redaction-passes.js";
3
4
  import { CREDENTIAL_VOCABULARY, egressPassGroups, isSensitiveRecordKey, URI_SCHEME_SOURCE } from "./credential-vocabulary.js";
@@ -44,7 +45,9 @@ const VALUE_DEPTH_MAX = 32;
44
45
  const VALUE_MEMBERS_MAX = 2_000;
45
46
  const WHOLE = "[redacted]";
46
47
  export function egressValue(tier, value) {
47
- const snapshots = new Map();
48
+ return foreignValue(tier, value, new Map());
49
+ }
50
+ function foreignValue(tier, value, snapshots) {
48
51
  let budget = VALUE_MEMBERS_MAX;
49
52
  const ownKeys = (o, all) => {
50
53
  try {
@@ -143,9 +146,80 @@ export function egressValue(tier, value) {
143
146
  }
144
147
  return pass(value, 0, "");
145
148
  }
146
- const REDACTION_MARKER_RE = /\[redacted(?:-[a-z]+)?\]/g;
149
+ export function egressAccount(tier, value) {
150
+ const snapshots = new Map();
151
+ const plainShape = (o) => {
152
+ try {
153
+ if (types.isProxy(o))
154
+ return undefined;
155
+ if (Array.isArray(o))
156
+ return "array";
157
+ const proto = Object.getPrototypeOf(o);
158
+ return proto === Object.prototype || proto === null ? "record" : undefined;
159
+ }
160
+ catch {
161
+ return undefined;
162
+ }
163
+ };
164
+ function pass(v, depth) {
165
+ if (typeof v === "string")
166
+ return egressText(tier, v);
167
+ if (typeof v === "function")
168
+ return undefined;
169
+ if (typeof v !== "object" || v === null)
170
+ return v;
171
+ const known = snapshots.get(v);
172
+ if (known !== undefined)
173
+ return known;
174
+ if (depth >= VALUE_DEPTH_MAX)
175
+ return WHOLE;
176
+ const shape = plainShape(v);
177
+ if (shape === undefined)
178
+ return foreignValue(tier, v, snapshots);
179
+ let keys;
180
+ try {
181
+ keys = Object.keys(v);
182
+ }
183
+ catch {
184
+ return foreignValue(tier, v, snapshots);
185
+ }
186
+ const snapshot = shape === "array" ? [] : prototypeIsNull(v) ? Object.create(null) : {};
187
+ snapshots.set(v, snapshot);
188
+ for (const key of keys) {
189
+ let read;
190
+ let isData = false;
191
+ try {
192
+ const d = Reflect.getOwnPropertyDescriptor(v, key);
193
+ if (d === undefined)
194
+ continue;
195
+ isData = "value" in d;
196
+ read = isData ? pass(d.value, depth + 1) : foreignValue(tier, d.get?.call(v), snapshots);
197
+ if (read === undefined && !(isData && d.value === undefined))
198
+ continue;
199
+ }
200
+ catch {
201
+ continue;
202
+ }
203
+ Object.defineProperty(snapshot, key, { value: read, enumerable: true, writable: true, configurable: true });
204
+ }
205
+ return snapshot;
206
+ }
207
+ const prototypeIsNull = (o) => {
208
+ try {
209
+ return Object.getPrototypeOf(o) === null;
210
+ }
211
+ catch {
212
+ return false;
213
+ }
214
+ };
215
+ return pass(value, 0);
216
+ }
217
+ const REDACTION_MARKER_RE = /\[redacted(?:-(?:credentials|url|path))?\]/g;
218
+ export function redactionMarkerSpans(s) {
219
+ return [...s.matchAll(REDACTION_MARKER_RE)].map((m) => [m.index, m.index + m[0].length]);
220
+ }
147
221
  function countRedactionMarkers(s) {
148
- return (s.match(REDACTION_MARKER_RE) ?? []).length;
222
+ return redactionMarkerSpans(s).length;
149
223
  }
150
224
  function safeEllipsisTruncate(s, max) {
151
225
  if (max < 1)
@@ -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
  }>;