@sema-agent/core 7.59.0 → 7.60.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 (360) hide show
  1. package/CHANGELOG.md +564 -0
  2. package/dist/agents/agent-definition.d.ts +7 -0
  3. package/dist/agents/agent-definition.js +12 -0
  4. package/dist/agents/agent-transcript-tool.d.ts +2 -1
  5. package/dist/agents/agent-transcript-tool.js +3 -1
  6. package/dist/agents/child-model-seat.js +6 -3
  7. package/dist/agents/cumulative-stats.js +0 -1
  8. package/dist/agents/inherited-tool-pool.d.ts +26 -1
  9. package/dist/agents/inherited-tool-pool.js +22 -0
  10. package/dist/agents/retain-ledger.d.ts +11 -1
  11. package/dist/agents/retain-ledger.js +13 -2
  12. package/dist/agents/roster-store.d.ts +1 -1
  13. package/dist/agents/roster-store.js +3 -1
  14. package/dist/agents/send-message-tool.d.ts +8 -19
  15. package/dist/agents/send-message-tool.js +11 -38
  16. package/dist/agents/subagent.d.ts +51 -17
  17. package/dist/agents/subagent.js +117 -78
  18. package/dist/agents/tool-filter.d.ts +1 -3
  19. package/dist/agents/tool-filter.js +4 -12
  20. package/dist/bench/metrics.d.ts +3 -5
  21. package/dist/bench/metrics.js +0 -1
  22. package/dist/brain/degrading.js +3 -1
  23. package/dist/brain/route-adjudicator.js +3 -1
  24. package/dist/brain/status-sink.d.ts +7 -1
  25. package/dist/brain/status-sink.js +6 -0
  26. package/dist/brain/timeout.d.ts +3 -1
  27. package/dist/brain/timeout.js +18 -5
  28. package/dist/core/a2a.d.ts +15 -5
  29. package/dist/core/a2a.js +34 -19
  30. package/dist/core/agent-definition.d.ts +20 -0
  31. package/dist/core/allow-entry.d.ts +2 -0
  32. package/dist/core/allow-entry.js +3 -1
  33. package/dist/core/artifact-host.d.ts +0 -2
  34. package/dist/core/artifact-host.js +0 -1
  35. package/dist/core/auto-mode-defaults.d.ts +8 -0
  36. package/dist/core/auto-mode-defaults.js +1 -0
  37. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  38. package/dist/core/auto-mode.d.ts +39 -4
  39. package/dist/core/auto-mode.js +63 -12
  40. package/dist/core/background-agent-store.d.ts +10 -1
  41. package/dist/core/background-agent-store.js +3 -2
  42. package/dist/core/background-shell.d.ts +12 -1
  43. package/dist/core/background-shell.js +12 -0
  44. package/dist/core/checkpoint-store.d.ts +8 -13
  45. package/dist/core/checkpoint-store.js +4 -3
  46. package/dist/core/compliance.d.ts +1 -1
  47. package/dist/core/credential-echo.d.ts +52 -0
  48. package/dist/core/credential-echo.js +65 -0
  49. package/dist/core/credential-vocabulary.d.ts +13 -3
  50. package/dist/core/credential-vocabulary.js +12 -4
  51. package/dist/core/cross-boundary-taint.d.ts +4 -5
  52. package/dist/core/engine-notice.d.ts +58 -15
  53. package/dist/core/frame-settlement.d.ts +5 -0
  54. package/dist/core/frame-settlement.js +4 -0
  55. package/dist/core/gate-fold.js +7 -5
  56. package/dist/core/gate-lanes.js +39 -8
  57. package/dist/core/governance-codes.d.ts +9 -1
  58. package/dist/core/governance-codes.js +12 -0
  59. package/dist/core/hands-band-screen.js +0 -1
  60. package/dist/core/hands-band.d.ts +0 -3
  61. package/dist/core/hooks.d.ts +39 -56
  62. package/dist/core/hooks.js +123 -77
  63. package/dist/core/image-admission.d.ts +104 -51
  64. package/dist/core/image-admission.js +170 -46
  65. package/dist/core/image-downsample.d.ts +36 -69
  66. package/dist/core/image-downsample.js +111 -73
  67. package/dist/core/integer-option.d.ts +21 -0
  68. package/dist/core/integer-option.js +13 -0
  69. package/dist/core/locked-config.d.ts +54 -3
  70. package/dist/core/locked-config.js +81 -50
  71. package/dist/core/mcp-call-meta.d.ts +2 -2
  72. package/dist/core/mcp-call-meta.js +9 -10
  73. package/dist/core/mcp-failure.d.ts +9 -3
  74. package/dist/core/mcp-failure.js +10 -0
  75. package/dist/core/mcp-host-seat.d.ts +92 -0
  76. package/dist/core/mcp-host-seat.js +131 -0
  77. package/dist/core/mcp-probe.d.ts +7 -2
  78. package/dist/core/mcp-probe.js +7 -2
  79. package/dist/core/mcp-server-spec.d.ts +38 -9
  80. package/dist/core/mcp-server-spec.js +55 -21
  81. package/dist/core/mcp.d.ts +17 -6
  82. package/dist/core/mcp.js +67 -55
  83. package/dist/core/memory-admission.d.ts +23 -6
  84. package/dist/core/memory-admission.js +19 -9
  85. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  86. package/dist/core/memory-engine/content-origin.js +21 -3
  87. package/dist/core/memory-engine/index.d.ts +2 -1
  88. package/dist/core/memory-engine/index.js +2 -1
  89. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  90. package/dist/core/memory-engine/scope-contract.js +2 -2
  91. package/dist/core/memory-engine/sync-client.d.ts +45 -11
  92. package/dist/core/memory-engine/sync-client.js +82 -11
  93. package/dist/core/memory-engine/sync-report.d.ts +103 -0
  94. package/dist/core/memory-engine/sync-report.js +119 -0
  95. package/dist/core/memory-engine/sync.d.ts +4 -2
  96. package/dist/core/mode-policy.d.ts +9 -1
  97. package/dist/core/mode-policy.js +11 -1
  98. package/dist/core/model-receipt.d.ts +39 -0
  99. package/dist/core/model-receipt.js +139 -0
  100. package/dist/core/mods/agent-stations.d.ts +65 -0
  101. package/dist/core/mods/agent-stations.js +105 -0
  102. package/dist/core/mods/kernel/dispatch.d.ts +5 -1
  103. package/dist/core/mods/kernel/dispatch.js +4 -4
  104. package/dist/core/mods/kernel/events.d.ts +10 -4
  105. package/dist/core/mods/kernel/events.js +10 -6
  106. package/dist/core/mods/kernel/receive.d.ts +5 -0
  107. package/dist/core/mods/kernel/receive.js +10 -0
  108. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  109. package/dist/core/mods/lifecycle-stations.js +35 -0
  110. package/dist/core/mods/stations.d.ts +51 -59
  111. package/dist/core/mods/stations.js +32 -42
  112. package/dist/core/mods/tool-call.d.ts +10 -4
  113. package/dist/core/mods/tool-call.js +28 -12
  114. package/dist/core/mounted-mcp.d.ts +5 -0
  115. package/dist/core/mounted-mcp.js +2 -2
  116. package/dist/core/namespaced-rule-name.d.ts +7 -1
  117. package/dist/core/namespaced-rule-name.js +13 -2
  118. package/dist/core/oracle-isolation.js +1 -1
  119. package/dist/core/own-property-receipt.d.ts +3 -0
  120. package/dist/core/own-property-receipt.js +3 -0
  121. package/dist/core/park-selfcheck.js +8 -8
  122. package/dist/core/peer-seat.d.ts +63 -8
  123. package/dist/core/peer-seat.js +179 -34
  124. package/dist/core/permission-rule-consent.d.ts +0 -21
  125. package/dist/core/permission-rule-consent.js +1 -2
  126. package/dist/core/permission-rule-model.d.ts +4 -2
  127. package/dist/core/permission-rule-model.js +7 -6
  128. package/dist/core/protocol-http-auth.d.ts +14 -2
  129. package/dist/core/protocol-http-auth.js +16 -7
  130. package/dist/core/read-face-seats.d.ts +7 -5
  131. package/dist/core/read-face-seats.js +4 -1
  132. package/dist/core/redaction-marks.d.ts +4 -3
  133. package/dist/core/redaction-marks.js +2 -2
  134. package/dist/core/remote-env.d.ts +146 -98
  135. package/dist/core/remote-env.js +113 -14
  136. package/dist/core/retention.js +37 -12
  137. package/dist/core/retired-keys.d.ts +6 -1
  138. package/dist/core/retired-keys.js +4 -1
  139. package/dist/core/rewrite-rejudge.d.ts +12 -5
  140. package/dist/core/rewrite-rejudge.js +9 -5
  141. package/dist/core/roles.d.ts +37 -3
  142. package/dist/core/roles.js +126 -78
  143. package/dist/core/rule-owner.d.ts +3 -0
  144. package/dist/core/runner/assemble-result.d.ts +0 -5
  145. package/dist/core/runner/assemble-result.js +0 -1
  146. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  147. package/dist/core/runner/call-hook-stations.js +21 -10
  148. package/dist/core/runner/child-tree.d.ts +7 -8
  149. package/dist/core/runner/child-tree.js +6 -6
  150. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  151. package/dist/core/runner/classifier-ladder.js +39 -8
  152. package/dist/core/runner/construction-doors.js +5 -0
  153. package/dist/core/runner/contracts.d.ts +62 -41
  154. package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
  155. package/dist/core/runner/cross-boundary-lane.js +11 -2
  156. package/dist/core/runner/env-capability-census.d.ts +15 -20
  157. package/dist/core/runner/env-capability-census.js +25 -34
  158. package/dist/core/runner/file-history-request.d.ts +2 -2
  159. package/dist/core/runner/file-history-request.js +0 -8
  160. package/dist/core/runner/gate-exit.d.ts +75 -7
  161. package/dist/core/runner/gate-exit.js +20 -1
  162. package/dist/core/runner/git-status-frame.d.ts +5 -2
  163. package/dist/core/runner/git-status-frame.js +3 -4
  164. package/dist/core/runner/image.d.ts +7 -2
  165. package/dist/core/runner/image.js +14 -8
  166. package/dist/core/runner/inline-image.d.ts +10 -8
  167. package/dist/core/runner/inline-image.js +11 -9
  168. package/dist/core/runner/memory-consolidation-driver.js +4 -4
  169. package/dist/core/runner/permission-rule-lanes.js +1 -1
  170. package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
  171. package/dist/core/runner/prepare-boundary-parks.js +3 -3
  172. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
  173. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  174. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  175. package/dist/core/runner/prepare-config-doors.js +14 -9
  176. package/dist/core/runner/prepare-delegation-surface.d.ts +5 -3
  177. package/dist/core/runner/prepare-delegation-surface.js +4 -4
  178. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  179. package/dist/core/runner/prepare-file-history.js +3 -12
  180. package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
  181. package/dist/core/runner/prepare-gate-stations.js +4 -3
  182. package/dist/core/runner/prepare-hands-readface.d.ts +3 -1
  183. package/dist/core/runner/prepare-hands-readface.js +15 -7
  184. package/dist/core/runner/prepare-inherited-gate.d.ts +5 -4
  185. package/dist/core/runner/prepare-inherited-gate.js +9 -5
  186. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  187. package/dist/core/runner/prepare-memory.d.ts +2 -2
  188. package/dist/core/runner/prepare-memory.js +2 -2
  189. package/dist/core/runner/prepare-park-ask.d.ts +3 -5
  190. package/dist/core/runner/prepare-park-ask.js +3 -8
  191. package/dist/core/runner/prepare-policy-chain.d.ts +5 -4
  192. package/dist/core/runner/prepare-policy-chain.js +120 -108
  193. package/dist/core/runner/prepare-project-context.js +8 -5
  194. package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -1
  195. package/dist/core/runner/prepare-prompt-inputs.js +3 -2
  196. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  197. package/dist/core/runner/prepare-protocol-tools.js +9 -2
  198. package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
  199. package/dist/core/runner/prepare-suspend-saga.js +5 -7
  200. package/dist/core/runner/prepare-task.js +41 -27
  201. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  202. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  203. package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -3
  204. package/dist/core/runner/prepare-wiring-manifest.js +32 -18
  205. package/dist/core/runner/prepare-workspace-restore.js +3 -3
  206. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  207. package/dist/core/runner/retired-runner-deps.js +4 -1
  208. package/dist/core/runner/run-attachment-seats.js +3 -3
  209. package/dist/core/runner/run-brain-sinks.js +1 -0
  210. package/dist/core/runner/run-git-lane.d.ts +3 -1
  211. package/dist/core/runner/run-git-lane.js +1 -1
  212. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  213. package/dist/core/runner/run-harness-handlers.js +3 -1
  214. package/dist/core/runner/run-identity-wiring.js +1 -1
  215. package/dist/core/runner/run-leg.js +26 -28
  216. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  217. package/dist/core/runner/run-notification-lane.js +16 -10
  218. package/dist/core/runner/run-settle-and-teardown.js +5 -1
  219. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  220. package/dist/core/runner/run-stop-and-final-verify.js +12 -4
  221. package/dist/core/runner/run-turn-boundary.js +12 -7
  222. package/dist/core/runner/runtask.d.ts +7 -4
  223. package/dist/core/runner/runtask.js +19 -11
  224. package/dist/core/runner/skills-seat.js +2 -2
  225. package/dist/core/runner/sub-agent-deny-lists.js +10 -7
  226. package/dist/core/runner/synthetic-tools.js +2 -2
  227. package/dist/core/runner/tool-disclosure.js +0 -2
  228. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  229. package/dist/core/runner/tool-face-overlay.js +26 -19
  230. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  231. package/dist/core/runner/tool-result-media-seat.js +17 -1
  232. package/dist/core/runner/turn-attachments.d.ts +3 -5
  233. package/dist/core/runner/turn-attachments.js +3 -16
  234. package/dist/core/runner-deps.d.ts +31 -18
  235. package/dist/core/secret-env.d.ts +3 -2
  236. package/dist/core/session-policy-store.d.ts +9 -2
  237. package/dist/core/session-policy-store.js +16 -1
  238. package/dist/core/session-store.d.ts +3 -2
  239. package/dist/core/session-store.js +50 -11
  240. package/dist/core/skill-grant.d.ts +9 -0
  241. package/dist/core/skill-grant.js +18 -0
  242. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  243. package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
  244. package/dist/core/stub-env.d.ts +5 -5
  245. package/dist/core/stub-env.js +11 -1
  246. package/dist/core/swappable-deps.d.ts +17 -43
  247. package/dist/core/swappable-deps.js +15 -5
  248. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  249. package/dist/core/task-event.d.ts +18 -2
  250. package/dist/core/task-notification.d.ts +88 -5
  251. package/dist/core/task-notification.js +130 -7
  252. package/dist/core/task-registry-agent.d.ts +18 -12
  253. package/dist/core/task-registry-agent.js +18 -6
  254. package/dist/core/task-registry-monitor.d.ts +7 -0
  255. package/dist/core/task-registry-monitor.js +28 -1
  256. package/dist/core/task-registry-shared.d.ts +38 -3
  257. package/dist/core/task-registry-shared.js +21 -7
  258. package/dist/core/task-registry-workflow.js +1 -1
  259. package/dist/core/task-registry.d.ts +50 -35
  260. package/dist/core/task-registry.js +64 -23
  261. package/dist/core/task-result.d.ts +3 -12
  262. package/dist/core/task-spec.d.ts +3 -6
  263. package/dist/core/task-stream.d.ts +1 -1
  264. package/dist/core/tool-catalog-entries.js +1 -1
  265. package/dist/core/tool-face-reader.d.ts +7 -6
  266. package/dist/core/tool-face-reader.js +4 -3
  267. package/dist/core/tool-name-aliases.d.ts +19 -0
  268. package/dist/core/tool-name-aliases.js +54 -2
  269. package/dist/core/tool-policy.d.ts +5 -4
  270. package/dist/core/tool-policy.js +1 -1
  271. package/dist/core/tool-registry.d.ts +5 -5
  272. package/dist/core/tool-registry.js +2 -2
  273. package/dist/core/tool-result-store.d.ts +88 -5
  274. package/dist/core/tool-result-store.js +51 -12
  275. package/dist/core/tool-spec.d.ts +20 -4
  276. package/dist/core/trace.d.ts +0 -1
  277. package/dist/core/types.d.ts +3 -3
  278. package/dist/core/types.js +1 -1
  279. package/dist/core/untrusted-text.js +1 -1
  280. package/dist/core/user-attachment.d.ts +10 -5
  281. package/dist/core/user-attachment.js +14 -6
  282. package/dist/engine/execution-env/node-execution-env.d.ts +7 -2
  283. package/dist/engine/execution-env/node-execution-env.js +12 -1
  284. package/dist/engine/harness/agent-harness.d.ts +1 -1
  285. package/dist/engine/harness/agent-harness.js +8 -4
  286. package/dist/engine/harness/types.d.ts +112 -29
  287. package/dist/engine/loop/agent-loop.d.ts +12 -12
  288. package/dist/engine/loop/agent-loop.js +153 -21
  289. package/dist/engine/loop/types.d.ts +9 -2
  290. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  291. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  292. package/dist/index.d.ts +22 -14
  293. package/dist/index.js +15 -10
  294. package/dist/internal/harness-types.d.ts +1 -1
  295. package/dist/orchestration/run-workflow-tool.d.ts +9 -3
  296. package/dist/orchestration/run-workflow-tool.js +59 -29
  297. package/dist/orchestration/workflow-governance.d.ts +1 -1
  298. package/dist/orchestration/workflow-governance.js +2 -1
  299. package/dist/orchestration/workflow.d.ts +4 -0
  300. package/dist/orchestration/workflow.js +25 -4
  301. package/dist/prompts/default.d.ts +1 -10
  302. package/dist/prompts/default.js +0 -2
  303. package/dist/stores/file/background-agent-store.d.ts +1 -1
  304. package/dist/stores/file/background-agent-store.js +3 -1
  305. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  306. package/dist/stores/file/checkpoint-store.js +19 -14
  307. package/dist/stores/file/file-history-store.d.ts +1 -1
  308. package/dist/stores/file/file-history-store.js +3 -1
  309. package/dist/stores/file/index.d.ts +4 -3
  310. package/dist/stores/file/index.js +17 -8
  311. package/dist/stores/file/mailbox-store.d.ts +1 -1
  312. package/dist/stores/file/mailbox-store.js +3 -1
  313. package/dist/stores/file/memory-store.d.ts +1 -1
  314. package/dist/stores/file/memory-store.js +3 -1
  315. package/dist/stores/file/session-policy-store.d.ts +1 -1
  316. package/dist/stores/file/session-policy-store.js +3 -1
  317. package/dist/stores/file/session-store.d.ts +1 -1
  318. package/dist/stores/file/session-store.js +3 -1
  319. package/dist/stores/file/shared-ledger.d.ts +26 -0
  320. package/dist/stores/file/shared-ledger.js +38 -9
  321. package/dist/stores/file/tool-result-store.d.ts +20 -2
  322. package/dist/stores/file/tool-result-store.js +74 -6
  323. package/dist/stores/file/usage-window-store.d.ts +1 -1
  324. package/dist/stores/file/usage-window-store.js +3 -1
  325. package/dist/stores/file/workflow-journal-store.d.ts +1 -11
  326. package/dist/stores/file/workflow-journal-store.js +3 -2
  327. package/dist/tools/fs/containment-face.d.ts +5 -0
  328. package/dist/tools/fs/encoding.d.ts +13 -4
  329. package/dist/tools/fs/encoding.js +17 -2
  330. package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
  331. package/dist/tools/fs/fs-bash-background-text.js +1 -0
  332. package/dist/tools/fs/fs-bash.d.ts +8 -4
  333. package/dist/tools/fs/fs-bash.js +26 -35
  334. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  335. package/dist/tools/fs/fs-pdf.js +26 -21
  336. package/dist/tools/fs/fs-read.d.ts +5 -4
  337. package/dist/tools/fs/fs-read.js +35 -18
  338. package/dist/tools/fs/fs-search-tools.js +4 -1
  339. package/dist/tools/fs/fs-shared.d.ts +11 -13
  340. package/dist/tools/fs/fs-shared.js +11 -7
  341. package/dist/tools/fs/fs-write.js +5 -5
  342. package/dist/tools/fs/index.d.ts +14 -8
  343. package/dist/tools/fs/index.js +8 -4
  344. package/dist/tools/fs/read-floor.d.ts +44 -1
  345. package/dist/tools/fs/read-floor.js +35 -0
  346. package/dist/tools/fs/removal-targets.d.ts +9 -4
  347. package/dist/tools/fs/removal-targets.js +17 -9
  348. package/dist/tools/fs/search.d.ts +3 -3
  349. package/dist/tools/fs/search.js +4 -4
  350. package/dist/tools/monitor.d.ts +5 -4
  351. package/dist/tools/monitor.js +15 -8
  352. package/dist/tools/scheduler-tools.js +42 -4
  353. package/dist/tools/web.d.ts +0 -10
  354. package/dist/tools/web.js +1 -4
  355. package/package.json +4 -2
  356. package/test/export-surface.snapshot.json +75 -21
  357. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  358. package/wire-changes/core@7.60.0.json +3274 -0
  359. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  360. package/wire-changes/primitives@7.60.0.json +30 -0
@@ -8,8 +8,8 @@ import { boundInputHashOf } from "../canonical-json.js";
8
8
  import { emitTrace } from "../trace.js";
9
9
  import { emitTaskOutcome } from "../task-outcome.js";
10
10
  import { runWithCapabilityWithheld, runWithReasoningWireFacts } from "../../brain/status-sink.js";
11
- import { expandTiers } from "../roles.js";
12
- import { announceReadDenySwap, screenSwappableDeps } from "../swappable-deps.js";
11
+ import { receiveModelCatalog } from "../roles.js";
12
+ import { announceReadDenySwap, catalogGenerationOf, screenSwappableDeps } from "../swappable-deps.js";
13
13
  import { runSideQuery } from "../side-query.js";
14
14
  import { PushQueue } from "../push-queue.js";
15
15
  import { TtlSessionStore } from "../session-store.js";
@@ -67,6 +67,8 @@ import { deploymentCanRerootChild } from "./child-tree.js";
67
67
  import { rewindSessionFiles } from "./rewind-files.js";
68
68
  import { compactIdleSession } from "./compact-session.js";
69
69
  import { egressThrownText } from "../untrusted-egress.js";
70
+ import { holdPeerDeclarations } from "../peer-seat.js";
71
+ import { receivePeerDeclarations, receivedDeclarations } from "../locked-config.js";
70
72
  export class Runner {
71
73
  deps;
72
74
  sessions;
@@ -86,8 +88,8 @@ export class Runner {
86
88
  const runner = this;
87
89
  this.depsSeat = { get deps() { return runner.deps; } };
88
90
  this.deps = withDeploymentAllowedTools(retained);
89
- if (this.deps.tiers) {
90
- this.deps = { ...this.deps, models: expandTiers(this.deps.models, this.deps.tiers) };
91
+ if (this.deps.models !== undefined || this.deps.tiers !== undefined) {
92
+ this.deps = { ...this.deps, ...receiveModelCatalog(this.deps.models, this.deps.tiers, "RunnerDeps") };
91
93
  }
92
94
  if (this.deps.contextSettings !== undefined) {
93
95
  this.deps = { ...this.deps, contextSettings: assertContextSettingsWords(assertContextSettingsValue(this.deps.contextSettings, "RunnerDeps"), this.deps.models, "RunnerDeps") };
@@ -132,6 +134,9 @@ export class Runner {
132
134
  emitTaskOutcome(this.deps, outcome);
133
135
  }
134
136
  canRerootChild() { return deploymentCanRerootChild(this.deps); }
137
+ holdDeclarations(declared, sessionId) {
138
+ return holdPeerDeclarations(this.deps.peerSeat, declared, (err) => this.deps.onError?.(err, { phase: "config", sessionId: sessionId ?? "(pre-session)", classification: "peer-seat-hold" }));
139
+ }
135
140
  get agentCatalog() {
136
141
  return {
137
142
  ...(this.deps.agents ? { agents: [...this.deps.agents] } : {}),
@@ -180,9 +185,9 @@ export class Runner {
180
185
  let expanded;
181
186
  let tiers;
182
187
  if (catalogSwap) {
183
- const models = candidate.models;
184
- tiers = Object.hasOwn(candidate, "tiers") ? candidate.tiers : this.deps.tiers;
185
- expanded = tiers && Object.keys(tiers).length > 0 ? expandTiers({ ...models }, tiers) : { ...models };
188
+ const generation = receiveModelCatalog(candidate.models, Object.hasOwn(candidate, "tiers") ? candidate.tiers : this.deps.tiers, "swapDeps");
189
+ expanded = generation.models;
190
+ tiers = generation.tiers;
186
191
  }
187
192
  const faceSeats = ["readFace", "writeFace"].filter((seat) => seats.includes(seat));
188
193
  const priorFaces = {
@@ -212,7 +217,7 @@ export class Runner {
212
217
  deliverEngineNotice(this.deps.onNotice, {
213
218
  code: "config.models_swapped",
214
219
  message: `model catalog swapped: ${modelCount} model(s), ${tiers ? Object.keys(tiers).length : 0} tier binding(s); in-flight tasks finish on their resolved models, new tasks resolve against the new catalog`,
215
- detail: { models: modelCount, tiers: tiers ? Object.keys(tiers).length : 0, occurrenceId: uuidv7() },
220
+ detail: { models: modelCount, tiers: tiers ? Object.keys(tiers).length : 0, generation: catalogGenerationOf(candidate.models, tiers), occurrenceId: uuidv7() },
216
221
  });
217
222
  }
218
223
  if (seats.includes("contextSettings")) {
@@ -291,6 +296,8 @@ export class Runner {
291
296
  };
292
297
  const namedSessionId = spec.sessionId;
293
298
  const legWrites = this.sessionWrites.openLeg((err, sessionId) => this.deps.onError?.(err, { phase: "degraded", sessionId }));
299
+ const receivedPeers = receivePeerDeclarations(spec, this.deps);
300
+ const declarationHold = this.holdDeclarations(receivedDeclarations(receivedPeers), namedSessionId);
294
301
  const run = (async () => {
295
302
  try {
296
303
  if (namedSessionId)
@@ -333,7 +340,7 @@ export class Runner {
333
340
  manualCompactRef,
334
341
  taskIdRef,
335
342
  resume,
336
- internals: { ...(internals ?? {}), detachHub, forwardScope: createForwardSinkScope(this.deps.onNotice) },
343
+ internals: { ...(internals ?? {}), detachHub, forwardScope: createForwardSinkScope(this.deps.onNotice), receivedPeers },
337
344
  notifyRef,
338
345
  captureOptOutRef,
339
346
  mcpRedialRef,
@@ -363,6 +370,7 @@ export class Runner {
363
370
  locallyClaimedTokens: this.locallyClaimedTokens, parentConstraintRegistry: this.parentConstraintRegistry, suspendedEnvReaps: this.suspendedEnvReaps,
364
371
  }).onRunRejected);
365
372
  void settled.then(() => acceptedSteerInputs.clear(), () => acceptedSteerInputs.clear());
373
+ void settled.then(() => declarationHold.release(), () => declarationHold.release());
366
374
  const { reapSuspended } = streamReap({
367
375
  live, runner: this.depsSeat,
368
376
  locallyClaimedTokens: this.locallyClaimedTokens, parentConstraintRegistry: this.parentConstraintRegistry, suspendedEnvReaps: this.suspendedEnvReaps,
@@ -399,7 +407,7 @@ export class Runner {
399
407
  spec, queue, resume, internals, taskIdRef, holdSessionLock, legWrites,
400
408
  runner: this.depsSeat, self: this, sessions: this.sessions, sessionReadStates: this.sessionReadStates, sessionModeSeats: this.sessionModeSeats, pendingSessionNotifications: this.pendingSessionNotifications,
401
409
  prepareTask,
402
- next: ({ prepared, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef, modelCatalog, notificationLane, unsubscribeTaskNotifications }) => {
410
+ next: ({ prepared, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef, modelCatalog, notificationLane, unsubscribeTaskNotifications, deliveryObligations }) => {
403
411
  const { runSourceTaskId, parentToolCallId, ident, emitDelegationLifecycle, loopLatch, stats, internalsNotifier, undrainedUserAtEnd, userInputLostAtEnd } = runIdentityWiring({
404
412
  spec, queue, prepared, internals, taskIdRef, onReady, manualCompactRef, notifyRef, captureOptOutRef, mcpRedialRef, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef,
405
413
  notificationLane, pendingSessionNotifications: this.pendingSessionNotifications, runner: this.depsSeat,
@@ -433,7 +441,7 @@ export class Runner {
433
441
  },
434
442
  });
435
443
  const { compactionBrain, withinTaskCompaction, compactionBreaker, windowSafetyOptions } = runCompactionMachinery({ spec, prepared, rs, stats, noteUnevaluablePriceTable, modelCatalog, runner: this.depsSeat });
436
- runStopAndFinalVerify({ spec, prepared, queue, rs, stats, ident, walltimeMonotonicDeadline, runner: this.depsSeat });
444
+ runStopAndFinalVerify({ spec, prepared, queue, rs, stats, ident, walltimeMonotonicDeadline, deliveryObligations, runner: this.depsSeat });
437
445
  runRecoveryLanes({ spec, prepared, queue, rs, ident, compactionBrain, compactionBreaker, windowSafetyOptions, callerStop: loopLatch.callerStop, runner: this.depsSeat });
438
446
  const rapidRefill = createRapidRefillState();
439
447
  const drainManualCompact = (outcome) => {
@@ -1,5 +1,5 @@
1
1
  import { readSkillTable } from "../skill-grant.js";
2
- import { assertNoRetiredKeys, RETIRED_TASK_SPEC_KEYS } from "../retired-keys.js";
2
+ import { assertNoRetiredKeys, RETIRED_SKILLS_SEAT_KEYS } from "../retired-keys.js";
3
3
  import { skillBaseDirOf } from "./skill-base-dir.js";
4
4
  const SKILLS_SEAT = "TaskSpec.skills";
5
5
  const kindOf = (v) => (v === null ? "null" : Array.isArray(v) ? "an array" : typeof v);
@@ -32,7 +32,7 @@ export function readSkillsSeat(skills) {
32
32
  return [];
33
33
  if (!Array.isArray(skills))
34
34
  throw skillsSeatRefusal(SKILLS_SEAT, `must be a list (got ${kindOf(skills)})`);
35
- assertNoRetiredKeys({ skills }, RETIRED_TASK_SPEC_KEYS, "TaskSpec");
35
+ assertNoRetiredKeys({ skills }, RETIRED_SKILLS_SEAT_KEYS, "TaskSpec");
36
36
  const seen = new Set();
37
37
  const out = [];
38
38
  for (const [i, raw] of skills.entries()) {
@@ -297,28 +297,31 @@ export function judgeRunToolLists(input) {
297
297
  }
298
298
  const pool = delegationPoolReading(spec.tools ?? [], valveLeaves(spec, selector));
299
299
  const mounted = mountedToolNames([...tools, ...(spec.tools ?? [])]);
300
+ const withOwnServers = (servers) => servers === undefined || servers.length === 0 ? input.declaredPeers : { ...input.declaredPeers, mcp: [...(input.declaredPeers.mcp ?? []), ...servers] };
301
+ const definitionServers = [...(spec.agents ?? []).flatMap((d) => d.mcp ?? []), ...pool.tools.flatMap((t) => (t.agentToolFaces ?? []).flatMap((f) => f.servers ?? []))];
300
302
  if (!input.judgedUpstream) {
301
- const root = rootFacingUniverse(input.ownBy !== undefined ? new Set([...mounted, input.ownBy.toolName]) : mounted, pool, input.declaredPeers);
303
+ const root = rootFacingUniverse(input.ownBy !== undefined ? new Set([...mounted, input.ownBy.toolName]) : mounted, pool, withOwnServers(definitionServers));
302
304
  const own = [["allowed", input.own.allow], ["denied", input.own.exclude]];
303
305
  const tell = input.toldUpstream === true ? () => undefined : advise;
304
306
  for (const [side, value] of own)
305
307
  judgeToolNameList(ownWhere ?? (side === "allowed" ? "TaskSpec.allowTools" : "TaskSpec.excludeTools"), side, value, root, tell, "config.tool_face_control");
306
308
  }
307
- const children = new Map(pool.tools.map((t) => [t, childFacingUniverse(poolOf([t]), input.declaredPeers)]));
308
- const taskTargets = pool.tools.length > 0 ? [...children.values()] : [childFacingUniverse(poolOf([]), input.declaredPeers)];
309
+ const childUniverses = (servers) => pool.tools.length > 0 ? pool.tools.map((t) => childFacingUniverse(poolOf([t]), withOwnServers(servers))) : [childFacingUniverse(poolOf([]), withOwnServers(servers))];
309
310
  for (const def of spec.agents ?? []) {
310
- for (const universe of taskTargets) {
311
+ for (const universe of childUniverses(def.mcp)) {
311
312
  judgeToolNameList(`TaskSpec.agents: agent "${def.name}"`, "allowed", def.allowTools, universe, advise, "config.agent.unknown_tool");
312
313
  judgeToolNameList(`TaskSpec.agents: agent "${def.name}"`, "denied", def.denyTools, universe, advise, "config.agent.unknown_tool");
313
314
  }
314
315
  }
315
316
  const replaced = new Set((spec.agents ?? []).map((d) => d.name));
316
- for (const [t, universe] of children) {
317
+ for (const t of pool.tools) {
318
+ const universe = childFacingUniverse(poolOf([t]), input.declaredPeers);
317
319
  for (const face of t.agentToolFaces ?? []) {
318
320
  if (face.authored === true && !replaced.has(face.name)) {
319
321
  const faceWhere = delegationListWhere(t.name, face.name);
320
- judgeToolNameList(faceWhere, "allowed", face.allowTools, universe, advise, "config.agent.unknown_tool");
321
- judgeToolNameList(faceWhere, "denied", face.denyTools, universe, advise, "config.agent.unknown_tool");
322
+ const faceUniverse = childFacingUniverse(poolOf([t]), withOwnServers(face.servers));
323
+ judgeToolNameList(faceWhere, "allowed", face.allowTools, faceUniverse, advise, "config.agent.unknown_tool");
324
+ judgeToolNameList(faceWhere, "denied", face.denyTools, faceUniverse, advise, "config.agent.unknown_tool");
322
325
  }
323
326
  }
324
327
  judgeToolNameList(delegationListWhere(t.name, undefined), "allowed", t.agentToolLevelAllowTools, universe, advise, "config.agent.unknown_tool");
@@ -2,7 +2,7 @@ import { Type } from "typebox";
2
2
  import { defineTool } from "../tools.js";
3
3
  import { sanitizeUntrustedText, SHELLED_BODY_ENVELOPE_TAGS } from "../untrusted-text.js";
4
4
  import { SKILL_LISTING_DEFAULT_BUDGET, SKILL_LISTING_DESC_MAX_CHARS_DEFAULT } from "../skill-listing-budget.js";
5
- import { readSkillTable, skillNamedBy } from "../skill-grant.js";
5
+ import { readSkillTable, skillNamedBy, skillNameHint } from "../skill-grant.js";
6
6
  import { OUTPUT_TOOL_NAME, mountRuleFace, toolFace } from "../tool-catalog-entries.js";
7
7
  import { skillLoadReading, substituteSkillRoot, substituteSkillRootBounded } from "./skill-base-dir.js";
8
8
  import { readSkillsSeat } from "./skills-seat.js";
@@ -180,7 +180,7 @@ export function createSkillTool(skills, grants) {
180
180
  const name = String(a.skill ?? "");
181
181
  const skill = skillNamedBy(a, skills);
182
182
  if (!skill) {
183
- throw new Error(`Unknown skill "${name}". Available skills: ${names}. ` +
183
+ throw new Error(`Unknown skill "${name}".${skillNameHint(a, skills)} Available skills: ${names}. ` +
184
184
  `(Only skills registered with this deployment are loadable — other products' skills directories are not read. ` +
185
185
  `If the user wants one of those here, read its source file and recreate its content for this deployment instead.)`);
186
186
  }
@@ -312,7 +312,6 @@ export function createToolSearchTool(opts) {
312
312
  missingNote,
313
313
  details: {
314
314
  type: "tool-search",
315
- matched: [],
316
315
  activated: [],
317
316
  matches: [],
318
317
  query: typeof args.query === "string" ? args.query : "",
@@ -366,7 +365,6 @@ export function createToolSearchTool(opts) {
366
365
  content: `${head}\n${lines.join("\n")}${missingNote}${ride !== undefined ? `\n\n${ride}` : ""}`,
367
366
  details: {
368
367
  type: "tool-search",
369
- matched: matched.map(safeName),
370
368
  activated: newly.map(safeName),
371
369
  matches: matched.map(safeName),
372
370
  query: typeof args.query === "string" ? args.query : "",
@@ -16,7 +16,7 @@
16
16
  * materialization entrance; the specs this file consumes carry that reader's copy, never the caller's object.
17
17
  */
18
18
  import type { AgentTool } from "../../internal/harness-types.js";
19
- import type { McpServerSpec } from "../mcp-server-spec.js";
19
+ import { type McpServerSpec } from "../mcp-server-spec.js";
20
20
  import { type ToolApprovalCard } from "../tool-face.js";
21
21
  import { type EngineNotice } from "../engine-notice.js";
22
22
  /** The keys each specialised approval card needs on the call (the SHELL owns the
@@ -1,3 +1,4 @@
1
+ import { callerText } from "../mcp-server-spec.js";
1
2
  import { MCP_NAMESPACE } from "../protocol-table.js";
2
3
  import { mintNamespacePrefix } from "../protocol-naming.js";
3
4
  import { RESERVED_APPROVAL_CARDS, TOOL_APPROVAL_CARDS, TOOL_FAMILIES, TOOL_PATH_ABSENCES, TOOL_PATH_ACCESSES, TOOL_PATH_BASES, RENDER_HINT_ACTIVITY_MAX_CHARS, RENDER_HINT_MAX_CHARS, RENDER_HINT_MAX_LIST, TOOL_KEY_MAX_CHARS, } from "../tool-face.js";
@@ -22,34 +23,39 @@ export function toolFaceProblem(face, schema, tool) {
22
23
  export function faceProblem(face, schema, tool) {
23
24
  const bound = schema === undefined ? undefined : inputKeysOf(schema);
24
25
  const top = bound === undefined ? undefined : new Set(bound.keys.map((k) => k.name));
25
- if (face.family !== undefined && !TOOL_FAMILIES.includes(face.family))
26
- return `family ${JSON.stringify(face.family)} is outside the closed set`;
26
+ const outside = (label, value, words) => value === undefined || words.includes(value) ? undefined : `${label} ${callerText(value)} is outside the closed set (${words.join(" | ")})`;
27
+ const family = outside("family", face.family, TOOL_FAMILIES);
28
+ if (family !== undefined)
29
+ return family;
27
30
  const overlong = (label, values) => {
28
31
  const k = values.find((v) => v.length > TOOL_KEY_MAX_CHARS);
29
- return k === undefined ? undefined : `${label} ${JSON.stringify(k.slice(0, 40) + "…")} is ${k.length} characters; a roster key is at most ${TOOL_KEY_MAX_CHARS}`;
32
+ return k === undefined ? undefined : `${label} has a key of ${k.length} characters; a roster key is at most ${TOOL_KEY_MAX_CHARS}`;
30
33
  };
31
34
  const vocabulary = new Set(bound?.scalar);
32
35
  if (face.pathTarget !== undefined) {
33
36
  if (top !== undefined && (typeof face.pathTarget.param !== "string" || !top.has(face.pathTarget.param)))
34
- return `pathTarget.param ${JSON.stringify(face.pathTarget.param)} is not a top-level property of the tool's schema`;
35
- if (!TOOL_PATH_ACCESSES.includes(face.pathTarget.access))
36
- return `pathTarget.access ${JSON.stringify(face.pathTarget.access)} is outside the closed set`;
37
+ return `pathTarget.param ${callerText(face.pathTarget.param)} is not a top-level property of the tool's schema`;
38
+ const access = outside("pathTarget.access", face.pathTarget.access, TOOL_PATH_ACCESSES);
39
+ if (access !== undefined)
40
+ return access;
37
41
  const base = face.pathTarget.base;
38
- if (base !== undefined && !TOOL_PATH_BASES.includes(base))
39
- return `pathTarget.base ${JSON.stringify(base)} is outside the closed set`;
42
+ const baseWord = outside("pathTarget.base", base, TOOL_PATH_BASES);
43
+ if (baseWord !== undefined)
44
+ return baseWord;
40
45
  if (base === "root" && face.pathTarget.access !== "read")
41
46
  return `pathTarget.base "root" needs pathTarget.access "read" — two write guards (the session-transcript directory guard and the frozen-spec deny) resolve a write target against the call's working directory only, so a write face declaring a root base would be judged on two different files (#638)`;
42
47
  const absent = face.pathTarget.absent;
43
- if (absent !== undefined && !TOOL_PATH_ABSENCES.includes(absent))
44
- return `pathTarget.absent ${JSON.stringify(absent)} is outside the closed set`;
48
+ const absentWord = outside("pathTarget.absent", absent, TOOL_PATH_ABSENCES);
49
+ if (absentWord !== undefined)
50
+ return absentWord;
45
51
  if (absent === "base" && face.pathTarget.access !== "read")
46
52
  return `pathTarget.absent "base" needs pathTarget.access "read" — it says the call is about the whole base directory when the slot is empty, which is a search SCOPE; a write with no path names no file, and the containment fences judge a write on its own target`;
47
53
  const patternParam = face.pathTarget.patternParam;
48
54
  if (patternParam !== undefined) {
49
55
  if (top !== undefined && (typeof patternParam !== "string" || !top.has(patternParam)))
50
- return `pathTarget.patternParam ${JSON.stringify(patternParam)} is not a top-level property of the tool's schema`;
56
+ return `pathTarget.patternParam ${callerText(patternParam)} is not a top-level property of the tool's schema`;
51
57
  if (absent !== "base")
52
- return `pathTarget.patternParam ${JSON.stringify(patternParam)} is declared but pathTarget.absent is ${JSON.stringify(absent ?? "none")} — the pattern base is only ever read for an absent slot, so this declaration would be inert`;
58
+ return `pathTarget.patternParam is declared but pathTarget.absent is ${JSON.stringify(absent ?? "none")} — the pattern base is only ever read for an absent slot, so this declaration would be inert`;
53
59
  }
54
60
  const long = overlong("pathTarget.param", [face.pathTarget.param]) ??
55
61
  overlong("pathTarget.aliases", face.pathTarget.aliases ?? []) ??
@@ -68,7 +74,7 @@ export function faceProblem(face, schema, tool) {
68
74
  if (face.pathTarget !== undefined)
69
75
  return `hostTarget and pathTarget are both declared — a face names one protected target, the URL a call reaches or the path it touches`;
70
76
  if (top !== undefined && (typeof face.hostTarget.param !== "string" || !top.has(face.hostTarget.param)))
71
- return `hostTarget.param ${JSON.stringify(face.hostTarget.param)} is not a top-level property of the tool's schema`;
77
+ return `hostTarget.param ${callerText(face.hostTarget.param)} is not a top-level property of the tool's schema`;
72
78
  const long = overlong("hostTarget.param", [face.hostTarget.param]);
73
79
  if (long !== undefined)
74
80
  return long;
@@ -77,8 +83,9 @@ export function faceProblem(face, schema, tool) {
77
83
  if (hints !== undefined) {
78
84
  const card = hints.approvalCard;
79
85
  if (card !== undefined) {
80
- if (!TOOL_APPROVAL_CARDS.includes(card))
81
- return `renderHints.approvalCard ${JSON.stringify(card)} is outside the closed set`;
86
+ const cardWord = outside("renderHints.approvalCard", card, TOOL_APPROVAL_CARDS);
87
+ if (cardWord !== undefined)
88
+ return cardWord;
82
89
  if (RESERVED_APPROVAL_CARDS.includes(card) && (tool === undefined || engineCardOf(tool) !== card))
83
90
  return `renderHints.approvalCard ${JSON.stringify(card)} is reserved for the engine's own tool that owns it; a declared tool takes another card or none`;
84
91
  const missing = top === undefined ? [] : APPROVAL_CARD_REQUIRED_KEYS[card].filter((k) => !top.has(k));
@@ -98,18 +105,18 @@ export function faceProblem(face, schema, tool) {
98
105
  return long;
99
106
  const foreignCard = tool?.cardId === undefined ? undefined : offendingResultCard(hints, tool.cardId, engineCardTypes());
100
107
  if (foreignCard !== undefined)
101
- return `renderHints.resultCards names ${JSON.stringify(foreignCard.slice(0, 80))}, outside the tool's own card namespace "${tool.cardId}/<card>" (engine cards and other contracts' namespaces are reserved)`;
108
+ return `renderHints.resultCards names ${callerText(foreignCard)}, outside the tool's own card namespace "${tool.cardId}/<card>" (engine cards and other contracts' namespaces are reserved)`;
102
109
  const stray = top === undefined ? undefined : (hints.summaryParams ?? []).find((p) => !top.has(p));
103
110
  if (stray !== undefined)
104
- return `renderHints.summaryParams names ${JSON.stringify(stray)}, which is not a top-level property`;
111
+ return `renderHints.summaryParams names ${callerText(stray)}, which is not a top-level property`;
105
112
  }
106
113
  if (top !== undefined) {
107
114
  for (const p of face.ruleFace?.params ?? [])
108
115
  if (!vocabulary.has(p))
109
- return `ruleFace.params names ${JSON.stringify(p)}, which is neither a scalar top-level property nor the declared path target`;
116
+ return `ruleFace.params names ${callerText(p)}, which is neither a scalar top-level property nor the declared path target`;
110
117
  for (const p of face.ruleFace?.primaryParams ?? [])
111
118
  if (!vocabulary.has(p))
112
- return `ruleFace.primaryParams names ${JSON.stringify(p)}, which is neither a top-level property nor the declared path target`;
119
+ return `ruleFace.primaryParams names ${callerText(p)}, which is neither a top-level property nor the declared path target`;
113
120
  }
114
121
  const long = overlong("ruleFace.params", face.ruleFace?.params ?? []) ?? overlong("ruleFace.primaryParams", face.ruleFace?.primaryParams ?? []);
115
122
  if (long !== undefined)
@@ -6,7 +6,8 @@
6
6
  * closed-set words, counts, the call's identity and a media type only when it can be one — never the bytes.
7
7
  */
8
8
  import { type EngineNotice } from "../engine-notice.js";
9
- import type { ToolResultMediaRefusal } from "../image-admission.js";
9
+ import { type ToolResultMediaRefusal } from "../image-admission.js";
10
+ import type { ImageDownsampler } from "../image-downsample.js";
10
11
  /** The run's attribution pair, as every per-run notice carries it. */
11
12
  export interface ToolResultMediaSeatIds {
12
13
  sessionId: string;
@@ -17,3 +18,10 @@ export declare function toolResultMediaRefusedSeat(onNotice: ((notice: EngineNot
17
18
  toolCallId: string;
18
19
  refused: readonly ToolResultMediaRefusal[];
19
20
  }) => void;
21
+ /**
22
+ * The run's one account of an image that goes to the model unprocessed over `IMAGE_ADMISSION.soft.targetBytes`
23
+ * (`config.image_processor_unavailable`, operator): said ONCE per run, at the first such image wherever it entered — a
24
+ * tool's result (the tool-result seat), the task's images or a person's attachment (the leg). The detail carries the
25
+ * image's decoded size and the target — never the bytes.
26
+ */
27
+ export declare function imageUnprocessedSeat(onNotice: ((notice: EngineNotice) => void) | undefined, seat: ImageDownsampler | false | undefined, ids: ToolResultMediaSeatIds): (bytes: number) => void;
@@ -1,4 +1,5 @@
1
1
  import { deliverEngineNotice } from "../engine-notice.js";
2
+ import { IMAGE_ADMISSION } from "../image-admission.js";
2
3
  export function toolResultMediaRefusedSeat(onNotice, ids) {
3
4
  return ({ toolName, toolCallId, refused }) => {
4
5
  const reasons = [...new Set(refused.map((r) => r.reason))].join(", ");
@@ -6,8 +7,23 @@ export function toolResultMediaRefusedSeat(onNotice, ids) {
6
7
  code: "tool_result.media_refused",
7
8
  message: `The ${JSON.stringify(toolName)} tool's result carried ${refused.length} media block(s) whose bytes the media admission refused (${reasons}). ` +
8
9
  `Each was replaced in the result by a text placeholder naming the refusal, so neither the model nor the event stream received those bytes; ` +
9
- `the tool, or the server behind it, returned bytes that are not what their block claims.`,
10
+ `the tool, or the server behind it, returned bytes that are not what their block claims, or that are beyond what can be sent.`,
10
11
  detail: { toolName, toolCallId, refused: refused.map((r) => ({ ...r })), sessionId: ids.sessionId, runId: ids.runId },
11
12
  });
12
13
  };
13
14
  }
15
+ export function imageUnprocessedSeat(onNotice, seat, ids) {
16
+ let told = false;
17
+ return (bytes) => {
18
+ if (told)
19
+ return;
20
+ told = true;
21
+ const why = seat === false ? "`RunnerDeps.imageProcessor` is `false`" : "the optional sharp dependency did not resolve and `RunnerDeps.imageProcessor` sets none";
22
+ deliverEngineNotice(onNotice, {
23
+ code: "config.image_processor_unavailable",
24
+ message: `An image of ${bytes} bytes went to the model as it was, over the ${IMAGE_ADMISSION.soft.targetBytes}-byte target, because this run has no image processor: ${why}. ` +
25
+ `Images within the hard limits are sent uncompressed (more request bytes and tokens, earlier media-budget trims); set a processor or install sharp to compress them. Said once per run.`,
26
+ detail: { bytes, targetBytes: IMAGE_ADMISSION.soft.targetBytes, sessionId: ids.sessionId, runId: ids.runId },
27
+ });
28
+ };
29
+ }
@@ -2,6 +2,7 @@ import type { McpDroppedTool } from "../mcp.js";
2
2
  import { type McpUnavailableEntry } from "../mcp-failure.js";
3
3
  import type { McpInstructionsEntry } from "../prompt-section-seat.js";
4
4
  import type { TaskSpec } from "../types.js";
5
+ import { type BackgroundTaskTableRow } from "../task-notification.js";
5
6
  import { type SkillListingEntry, type SkillsBlockRender } from "./synthetic-tools.js";
6
7
  import { type ResolvedSkillListingBudget } from "../skill-listing-budget.js";
7
8
  /**
@@ -182,11 +183,8 @@ export interface AgentListingEntry {
182
183
  }
183
184
  /** G1 通告层: a background task visible to THIS run, snapshotted at the boundary by the
184
185
  * runtask-side getter (registry ground truth — the producer never touches the registry itself). */
185
- export interface BackgroundTaskSnapshot {
186
- id: string;
187
- description?: string;
188
- status: string;
189
- }
186
+ /** A row of the background-task table ({@link BackgroundTaskTableRow}). */
187
+ export type BackgroundTaskSnapshot = BackgroundTaskTableRow;
190
188
  export declare function attachmentEnvelopeTags(source: AttachmentSource): string[];
191
189
  /** One due reminder. `body` is the inner text — the steerer adds the `<system-reminder>` wrapper (F3). */
192
190
  export interface TurnAttachment {
@@ -2,6 +2,7 @@ import { isPlainRecord } from "../mods/kernel/receive.js";
2
2
  import { needsAuthorizationArm } from "../mcp-failure.js";
3
3
  import { delimitUntrustedWithClip, inlineUntrusted, sanitizeUntrustedText, SHELLED_BODY_ENVELOPE_TAGS } from "../untrusted-text.js";
4
4
  import { protocolOf } from "../protocol-table.js";
5
+ import { renderBackgroundTaskTable } from "../task-notification.js";
5
6
  import { renderSkillLinesWithin, renderSkillsBlock } from "./synthetic-tools.js";
6
7
  import { SKILL_LISTING_DEFAULT_BUDGET } from "../skill-listing-budget.js";
7
8
  import { foldListingWithin, foldRemovalArmWithin, removalArmFloor } from "./listing-fold.js";
@@ -406,23 +407,9 @@ function renderChangedFiles(paths) {
406
407
  paths.map((p) => `- ${p}`).join("\n"));
407
408
  }
408
409
  function renderBackgroundTasks(tasks) {
409
- const unlisted = tasks.length - PROJECTION_ITEMS_MAX;
410
- const lines = tasks.slice(0, PROJECTION_ITEMS_MAX).map((t) => {
411
- const phrase = t.status === "completed"
412
- ? "completed in background"
413
- : t.status === "killed"
414
- ? "stopped"
415
- : t.status === "running"
416
- ? "still running in background"
417
- : t.status === "parked"
418
- ? "parked awaiting an out-of-band approval — do NOT re-issue the gated call"
419
- : t.status;
420
- return `- [${t.id}] Task "${(t.description ?? "background task").slice(0, PROJECTION_CONTENT_MAX)}" ${phrase}`;
421
- });
422
- return ("Context was compacted. Background tasks from before the compaction (check output with TaskOutput, " +
410
+ return ("Context was compacted. Background tasks from before the compaction (read output where its row says, " +
423
411
  "terminate with TaskStop):\n" +
424
- lines.join("\n") +
425
- (unlisted > 0 ? `\n(+${unlisted} more background tasks, not listed here)` : ""));
412
+ renderBackgroundTaskTable(tasks));
426
413
  }
427
414
  export const TOOLS_DELTA_LIST_MAX = 30;
428
415
  function groupByMcpServer(names) {
@@ -14,14 +14,14 @@ import type { OnElicit } from "./mcp-server-spec.js";
14
14
  import type { Brain, ModelRef, ModelRoles } from "./model-seat.js";
15
15
  import type { RuntimeCaps, WorkflowGovernanceBaseline } from "./runtime-caps.js";
16
16
  /**
17
- * parity-204 — structured `RunnerDeps.loadProjectMemory` return (backward-compatible, RL-1336-project-memory-bare: a bare
18
- * `string | null` keeps its exact historical meaning). Adds the `seededFromContext`
17
+ * parity-204 — the `RunnerDeps.loadProjectMemory` return: the one form a loader answers in (a loader with nothing to
18
+ * inject answers `{ content: null }`; a bare `string | null` is not read). Carries the `seededFromContext`
19
19
  * seam (cc204-bundle @17917159: CC preloads readFileState for CLAUDE.md/nested-memory files it
20
20
  * placed in context, and a DEFAULT whole-file Read of an unchanged seeded file answers with the
21
21
  * already-in-context reminder instead of re-transmitting the body — token economy, GA in 204).
22
22
  */
23
23
  export interface ProjectMemoryLoad {
24
- /** The project-context text to inject — same semantics as returning a bare string (null/blank ⇒ no injection). */
24
+ /** The project-context text to inject (null/blank ⇒ no injection). */
25
25
  content: string | null;
26
26
  /**
27
27
  * Files whose FULL, disk-verbatim text the deployment has placed in the model's context (e.g. the
@@ -223,6 +223,17 @@ export interface RunnerDeps {
223
223
  * ignored). Same deployment-only seat, clamp argument and checkpoint posture as the tiers key.
224
224
  */
225
225
  readDenyBuiltinExclude?: readonly string[];
226
+ /**
227
+ * #2936 — whether the deployment REQUIRES the byte floor kept: `true` ⇒ a run whose read-deny table holds a row, on an
228
+ * execution environment that does not declare it keeps the floor (`capabilities.keepsReadFloor`), is refused at prepare
229
+ * (`config.read_deny_floor_unkept`) before any command starts. Absent or `false` = not required — the documented
230
+ * reading, not a silent default: such a run is then announced once to the operator under the same code, because a
231
+ * recursive read under a root reads the files below it there, deny rows included. A present non-boolean value refuses
232
+ * (`config.read_face_seat`). The read-deny family's deployment seat (hot-swappable with it, `config.read_deny_swapped`);
233
+ * DEPLOYMENT seat ONLY, like the tier switch: a task can add deny rows, never change the deployment's gate. Mirrored on
234
+ * `HandsToolkitOptions.readDenyFloorRequired` for a library-direct band that compiles its own table.
235
+ */
236
+ readDenyFloorRequired?: boolean;
226
237
  /**
227
238
  * Where the host keeps the agent's configuration directory when it is not `<home>/.sema` — an ABSOLUTE path of an
228
239
  * existing directory, resolved by the host (the engine reads no environment variable for it). The rows of the
@@ -347,8 +358,8 @@ export interface RunnerDeps {
347
358
  * (single-process/single-host deployments: byte-identical behavior). A deployment whose control
348
359
  * plane does not survive into resume replicas (the stateless multi-replica server form) supplies
349
360
  * a durable store here; see {@link import("./memory-engine/layout.js").SessionCaptureRecordStore}
350
- * for the per-leg fail-closed contract. Also the §2.1b capability signal: on a REMOTE-execution
351
- * deployment with no store supplied here, a `capture:"off"` declaration is refused
361
+ * for the per-leg fail-closed contract. Also the §2.1b capability signal: where the execution env's paths are not
362
+ * the host's (`pathsAreHostLocal`) and no store is supplied here, a `capture:"off"` declaration is refused
352
363
  * (`config.memory_capture_unsupported`) rather than accepted onto a carrier that the next resume
353
364
  * cannot see — a false privacy promise is worse than a loud one.
354
365
  */
@@ -783,6 +794,8 @@ export interface RunnerDeps {
783
794
  * (`config.auto_mode_classifier_fallback_invalid`) — never clamped, never read as the default.
784
795
  */
785
796
  classifierFallback?: import("./auto-mode.js").AutoModeClassifierFallback;
797
+ /** Consecutive classifications ending on the classifier SEAT's rate limit (an HTTP 429 after the brain's own backoff) before the seat is not asked again this run — the walk starts on the model behind it, `classifier.seat_rate_limited` says so once; default 3 (`AUTO_MODE_RATE_LIMIT_BREAK_AFTER_DEFAULT`); any other outcome zeroes the count; inert under `classifierFallback: "none"`; a value that is not a whole number of at least 1 is REFUSED at every leg's prepare (`config.auto_mode_rate_limit_break_invalid`), never clamped; no OFF. See the header of `auto-mode.ts`. */
798
+ rateLimitBreakAfter?: number;
786
799
  /**
787
800
  * The classifier DENIAL LIMIT: a run whose classifier keeps blocking falls
788
801
  * back to a PERSON instead of being denied without end. Per run: a `block` first increments the
@@ -1136,16 +1149,18 @@ export interface RunnerDeps {
1136
1149
  * unserializable (durable resume) and reading files for an UNTRUSTED caller would be a confused-deputy hole
1137
1150
  * (design/44 §7 Q4). DECOUPLED from `memoryStore` — injects even with NO long-term memory configured (H5).
1138
1151
  *
1139
- * `undefined` (default) ⇒ the whole path is skipped = byte-identical to today (full parity, H3). Returning
1140
- * `null`/blank ⇒ no injection (also byte-identical). The content is fenced/sanitized like every other memory
1152
+ * `undefined` (default) ⇒ the whole path is skipped = byte-identical to today (full parity, H3). The loader answers a
1153
+ * {@link ProjectMemoryLoad}; `{ content: null }` (or blank content) ⇒ no injection (also byte-identical). Any other
1154
+ * answer (a bare string, `null`, a non-object) is not read: it is disclosed on `onError` (phase `config`) and the leg runs
1155
+ * with no project layer, as when the loader throws. The content is fenced/sanitized like every other memory
1141
1156
  * layer (repo-controlled CLAUDE.md is UNTRUSTED data, not an instruction — H2). The ctx lets a profile tailor
1142
- * or suppress: `handsEnabled:false` = a hands-less chat with no real project (return null); `isSubagent` =
1157
+ * or suppress: `handsEnabled:false` = a hands-less chat with no real project (answer `{ content: null }`); `isSubagent` =
1143
1158
  * a delegated child (a profile may trim CLAUDE.md for a cheap "grep this" subagent — H7).
1144
1159
  */
1145
1160
  loadProjectMemory?: (ctx: {
1146
1161
  /** The task's working directory (= the execution env's cwd; a worktree task = its worktree root). */
1147
1162
  cwd: string;
1148
- /** False ⇒ a hands-less chat (no real filesystem/project) — a profile typically returns null. */
1163
+ /** False ⇒ a hands-less chat (no real filesystem/project) — a profile typically answers `{ content: null }`. */
1149
1164
  handsEnabled: boolean;
1150
1165
  /** True ⇒ a delegated subagent run (a profile may trim/suppress project content to control cost). */
1151
1166
  isSubagent: boolean;
@@ -1174,12 +1189,10 @@ export interface RunnerDeps {
1174
1189
  * docs/REVIEW-BACKLOG.md): a compaction followed by a mid-run user-role
1175
1190
  * injection (steer) before the next prepare reads as `"resume"` — the freshness
1176
1191
  * gap is covered by the C-4 `instructions_change` lane, not by this signal.
1177
- * - `"post-clear"` — RESERVED: core has no session-clear primitive today (a CC `/clear` maps to a
1178
- * NEW session ⇒ `"fresh"`; rewinding past the root is rejected), so core never
1179
- * emits this value — it exists so the seam's enum is stable when a clear verb lands.
1192
+ * A session clear starts a NEW session, which reads `"fresh"` (rewinding past the root is rejected).
1180
1193
  */
1181
- phase?: "fresh" | "resume" | "post-compact" | "post-clear";
1182
- }) => Promise<string | null | ProjectMemoryLoad> | string | null | ProjectMemoryLoad;
1194
+ phase?: "fresh" | "resume" | "post-compact";
1195
+ }) => Promise<ProjectMemoryLoad> | ProjectMemoryLoad;
1183
1196
  /**
1184
1197
  * design-A C-4 ([A2]) — the mid-session instruction-file change PROBE (the server half of the
1185
1198
  * `instructions_change` attachment lane). At eligible turn boundaries (continuation-gated like
@@ -1212,11 +1225,11 @@ export interface RunnerDeps {
1212
1225
  */
1213
1226
  onElicit?: OnElicit;
1214
1227
  /**
1215
- * design/116 CONFIRM-1 (加 seam 保体验): resize an over-limit MCP image so the model still SEES a
1216
- * degraded image instead of a spill-to-disk note. Absent ⇒ core auto-detects `sharp` (dynamic import;
1217
- * turnkey deployments with sharp installed get the CC experience with zero config) and otherwise spills.
1228
+ * The ONE image processor seat: every image a run hands the model (Read, PDF pages, Bash data URIs, MCP and any tool's results,
1229
+ * `TaskSpec.images`, attachments) passes the one admission with it (frame ladder, then toward `IMAGE_ADMISSION.soft.targetBytes`).
1230
+ * `false` = none (images go on as they are within the hard limits; the run says so once past the soft target); absent ⇒ detect sharp.
1218
1231
  */
1219
- mcpImageResizer?: import("./mcp.js").McpImageResizer;
1232
+ imageProcessor?: import("./image-downsample.js").ImageDownsampler | false;
1220
1233
  /** Default tool-call gate for all tasks (a task's own `toolPolicy` overrides this). */
1221
1234
  toolPolicy?: import("./tool-policy.js").ToolPolicy;
1222
1235
  /**
@@ -107,8 +107,9 @@ export declare function namesASecret(value: string): boolean;
107
107
  export declare function declareWithheldEnv(table: WithheldEnvDeclaration): void;
108
108
  /**
109
109
  * The engine takes credential values in — each where the engine receives it: a first-party brain's construction
110
- * credential (`brainConfigSnapshot`), a model entry's own credential headers (`resolveRouteCredential`), a protocol
111
- * peer's credential headers (`resolveProtocolHttpHeaders`), the memory distiller's chat seat key (`openAiCompatChatSeat`,
110
+ * credential (`brainConfigSnapshot`), a model entry's own credential headers (`resolveRouteCredential`), the credential
111
+ * headers and variables a protocol peer's seat answers (`PeerCarrier`, before the answer is judged — a refused answer's
112
+ * values are taken in too), the memory distiller's chat seat key (`openAiCompatChatSeat`,
112
113
  * and `RunnerDeps.memoryConsolidationDriver.chat` at `new Runner`, before that seat is built). From then on, for the
113
114
  * life of the process, no child spawned on this host inherits an entry whose value equals one: the same table, the same
114
115
  * subtraction, finding and disclosure as a declared value ({@link declareWithheldEnv}). A credential the engine is handed
@@ -81,7 +81,14 @@ export type SessionRuleEntryField = {
81
81
  * persisted grammar read every bare name as no rule. A session's entries mean what they meant (the entry reader already read a bare
82
82
  * name as the whole tool), so no earlier entry reads differently; the stamp moves for the persisted store's buckets and the sync
83
83
  * wire's states, so an engine of grammar 5 given a bucket written in grammar 6 refuses it whole rather than drop a whole-tool deny
84
- * as damage. No persisted row of an earlier stamp can hold a bare name (every entrance refused one), so none is read anew.
84
+ * as damage. No persisted row of an earlier stamp can hold a bare name (every entrance refused one), so none is read anew;
85
+ * - 7, an exact MCP tool name with `__` in its body (`mcp__a__b`, no `*`) in `toolDeny` reads every MCP server spelling it can
86
+ * stand for (`peerReadingsOf`: tool `b` of server `a` AND every tool of server `a__b`), where grammar 6 read the one exact tool.
87
+ * A session row an earlier grammar wrote reads such an entry as the one exact tool, announced (the revision table); an engine of
88
+ * grammar 6 given a row written in grammar 7 refuses it rather than read the deny as the narrower exact tool. The persisted store
89
+ * and the rule-sync wire stamp 7 as well, so a grammar-6 engine refuses their buckets and states too — but this revision does not
90
+ * pay the persisted store the reading of its earlier stamps owed below: a stored whole-tool deny / ask of such a name in a
91
+ * bucket of stamp 6 reads in this grammar, the wider way (#3085).
85
92
  * A row an earlier grammar wrote keeps the meaning that grammar gave its entries, and an entry that grammar could not read takes
86
93
  * this one's ({@link earlierGrammarReads}, over the revisions above as one table); an entry this grammar reads as no rule reads as
87
94
  * `earlier_grammar` ({@link compileSessionRuleBucket}).
@@ -94,7 +101,7 @@ export type SessionRuleEntryField = {
94
101
  * what an existing persisted rule text means owes that store a reading of its earlier stamps, as {@link earlierGrammarReads}
95
102
  * is for entries. Every stamp is judged by {@link readRuleGrammarStamp}.
96
103
  */
97
- export declare const SESSION_RULES_GRAMMAR = 6;
104
+ export declare const SESSION_RULES_GRAMMAR = 7;
98
105
  /** {@link SessionPermissionRules} plus the monotonic `rev` the store stamps (the OCC key). */
99
106
  export interface StoredSessionRules extends SessionPermissionRules {
100
107
  rev: number;
@@ -7,12 +7,13 @@ import { valueTypeLabel } from "./tool-name-list.js";
7
7
  import { NAME_RULE_FACES, noticeRuleText } from "./permission-rule-model.js";
8
8
  import { parsePermissionRule, ruleSpellingOf } from "./permission-rule-syntax.js";
9
9
  import { splitNamespacedName } from "./tool-name-aliases.js";
10
+ import { namesASetOfTools } from "./namespaced-rule-name.js";
10
11
  const SESSION_RULE_BUCKETS = { toolAllow: "allow", toolDeny: "deny", allowDirs: "dirs" };
11
12
  const BUCKETS = Object.keys(SESSION_RULE_BUCKETS);
12
13
  const ENTRY_FIELDS = BUCKETS.filter((f) => SESSION_RULE_BUCKETS[f] !== "dirs");
13
14
  const STORE_STAMPS = new Set(["rev", "gen", "grammar"]);
14
15
  const OPERATOR_PART = "operatorRules";
15
- export const SESSION_RULES_GRAMMAR = 6;
16
+ export const SESSION_RULES_GRAMMAR = 7;
16
17
  export class SessionPolicyError extends Error {
17
18
  code;
18
19
  detail;
@@ -216,6 +217,20 @@ const GRAMMAR_REVISIONS = [
216
217
  return { ...answer, was: `the exact tool name ${JSON.stringify(pattern)}, so it refused only a tool of that name`, keep: { kind: "row", compiled: { kind: "tool", name: pattern } } };
217
218
  },
218
219
  },
220
+ {
221
+ grammar: 7,
222
+ answer: ({ direction, reading }) => {
223
+ if (direction !== "deny" || reading.kind !== "row" || reading.compiled.kind !== "covering" || namesASetOfTools(reading.compiled.pattern, "deny"))
224
+ return undefined;
225
+ const { pattern } = reading.compiled;
226
+ return {
227
+ was: `the exact tool name ${JSON.stringify(pattern)}, so it refused only a tool of that name`,
228
+ now: "every MCP server spelling the name can stand for — that tool, and every tool of a server whose own name carries the `__`",
229
+ keep: { kind: "row", compiled: { kind: "tool", name: pattern } },
230
+ reader: "grammar_revised",
231
+ };
232
+ },
233
+ },
219
234
  ];
220
235
  function earlierGrammarReads(row, direction, entry, reading, list) {
221
236
  if (row >= SESSION_RULES_GRAMMAR)