@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
@@ -21,7 +21,7 @@
21
21
  * leg reaches declares itself the target NOW, and the tree's state NOW.
22
22
  */
23
23
  import type { AgentTool } from "../../internal/harness.js";
24
- import type { SessionTreeEntry } from "../../internal/harness-types.js";
24
+ import type { ExecutionEnv, SessionTreeEntry } from "../../internal/harness-types.js";
25
25
  import { type CrossBoundaryCheck, type CrossBoundaryPosture, type CrossBoundaryTreeToken, type OwedDeliveries } from "../cross-boundary-taint.js";
26
26
  import { type ToolRoster } from "../tool-roster.js";
27
27
  import type { RunnerDeps } from "../types.js";
@@ -73,10 +73,8 @@ export interface CrossBoundaryLaneInput {
73
73
  posture: CrossBoundaryPosture | undefined;
74
74
  /** The run fold: this leg's environment declares the target, or the row it resumes was minted on one. */
75
75
  externalContentTargetActive: boolean;
76
- /** The leg's own environment — read for its CURRENT declaration at each judgment. */
77
- env: {
78
- readonly externalContentTarget?: boolean;
79
- };
76
+ /** The leg's own environment — read for its CURRENT declaration (`targetIsExternal`) at each judgment. */
77
+ env: Pick<ExecutionEnv, "capabilities">;
80
78
  session: {
81
79
  getBranch(): Promise<ReadonlyArray<SessionTreeEntry>>;
82
80
  getLeafId(): Promise<string | null>;
@@ -1,3 +1,4 @@
1
+ import { targetIsExternal } from "../remote-env.js";
1
2
  import { BOUNDARY_LEGS, CROSS_BOUNDARY_RECORD_TYPE, CROSS_BOUNDARY_TAINT_BITS, STRICTEST_CROSS_BOUNDARY_TREE, crossBoundaryObligation, crossBoundaryPostureUndeclaredNotice, crossBoundaryRecordUnwrittenNotice, crossBoundaryRecordData, crossBoundaryTreeCovers, crossBoundaryTreeGoverned, joinCrossBoundaryTree, readCrossBoundaryRecord, } from "../cross-boundary-taint.js";
2
3
  import { deliverEngineNotice } from "../engine-notice.js";
3
4
  import { policyCannotAnswer } from "../real-approval.js";
@@ -23,6 +24,14 @@ export function joinedCrossBoundaryTree(handed, report) {
23
24
  const EVERY_LEG = Object.freeze([...BOUNDARY_LEGS]);
24
25
  const ONE_OUTSIDE_READ = Object.freeze([Object.freeze({ legs: Object.freeze(["outside_read"]) })]);
25
26
  const bitsOf = (t) => CROSS_BOUNDARY_TAINT_BITS.filter((b) => t[b] === true);
27
+ function obligationReaching(legs, reached, tree) {
28
+ const declared = reached === undefined ? false : targetIsExternal(reached);
29
+ if (declared !== "undeclared")
30
+ return crossBoundaryObligation(legs, declared, tree);
31
+ const onTarget = crossBoundaryObligation(legs, true, tree);
32
+ const offTarget = crossBoundaryObligation(legs, false, tree);
33
+ return Object.freeze({ mandate: onTarget.mandate || offTarget.mandate, record: onTarget.record || offTarget.record });
34
+ }
26
35
  function legsOfCall(view, legEnv, token, call, report) {
27
36
  const roster = view.roster.current;
28
37
  const row = roster !== undefined ? rosterEntryNamed(roster, call.toolName) : undefined;
@@ -137,7 +146,7 @@ export async function prepareCrossBoundaryLane(input) {
137
146
  const OBSERVED = Object.freeze({ offTargetReadObserved: true });
138
147
  const addedBy = (record) => (record && ref.current.offTargetReadObserved !== true ? OBSERVED : undefined);
139
148
  const owedBit = (owed) => {
140
- const records = (given) => given.some((d) => crossBoundaryObligation(d.legs, d.env?.externalContentTarget === true, ref.current).record);
149
+ const records = (given) => given.some((d) => obligationReaching(d.legs, d.env, ref.current).record);
141
150
  try {
142
151
  return addedBy(records(owed()));
143
152
  }
@@ -166,7 +175,7 @@ export async function prepareCrossBoundaryLane(input) {
166
175
  const obligationOf = (call, say) => {
167
176
  const { legs, env: reached } = legsOfCall(view, env, token, call, say);
168
177
  try {
169
- return crossBoundaryObligation(legs, reached?.externalContentTarget === true, ref.current);
178
+ return obligationReaching(legs, reached, ref.current);
170
179
  }
171
180
  catch (err) {
172
181
  say(`the cross-boundary obligation of "${call.toolName}" could not be read (${thrownText(err)}) — the call reads as every leg, off the target`);
@@ -4,30 +4,25 @@ import type { EngineNotice } from "../engine-notice.js";
4
4
  export interface MalformedCapabilityDeclaration {
5
5
  readonly key: string;
6
6
  readonly valueType: string;
7
- /** The shape the seat takes: a `capabilities.*` boolean, or an optional seam method. */
8
- readonly expected: "boolean" | "function";
7
+ /** The shape the seat takes: a `capabilities.*` boolean (or the block itself, an object), an optional seam method, or
8
+ * nothing (`absent`: a member of the block that is no capability). */
9
+ readonly expected: "boolean" | "object" | "function" | "absent";
9
10
  }
10
11
  /**
11
- * Every boolean capability this env DECLARES with a value that is not a boolean.
12
+ * Every capability this env does not DECLARE as a boolean: each key of the block that is absent, not a boolean, or
13
+ * cannot be received — or the block itself, when it is present but not an object or cannot be received — and each
14
+ * member the block carries outside the eight keys (a misspelled key leaves the key it meant undeclared).
12
15
  *
13
- * The probe is the VALUE, not membership, because the value is what the readers get: a `capabilities`
14
- * that answers `has` and `get` differently (a Proxy) would otherwise hide from the census exactly the
15
- * value a reader goes on to act on. `undefined` is where absence lands — an absent key and an explicit
16
- * `undefined` are the same word to every reader, and both are the documented silent reading of every key
17
- * outside {@link NO_ABSENT_READING} (and announced, alike, for a key inside it) — so one test covers both and
18
- * the census needs no membership rule at all.
16
+ * The block is judged on its one receipt (`capabilityReceiptOf`), the frozen copy every reader reads. `undefined` is
17
+ * where absence lands — an absent key and an explicit `undefined` are the same word to every reader — and both are
18
+ * announced, as a wrong shape is. An env with no block at all is announced once per key: every reader takes every key's
19
+ * safe side, and the operator learns which.
19
20
  *
20
- * TOTAL by construction: a diagnostic may not be the thing that fails a run. Every read of the adapter
21
- * can throw on a getter or a Proxy trap — the structural probe, the block acquisition and each key —
22
- * and a read that throws is itself a declaration nobody can use, so all three are reported rather than
23
- * raised (`unreadable`, under the key when there is one and under `capabilities` when the block itself
24
- * could not be had).
25
- *
26
- * What a snapshot cannot promise: this is taken once, at admission. An adapter whose capability values
27
- * CHANGE afterwards can hand a later reader something this census never saw; the declaration is
28
- * documented as a constant property of the adapter, and a mutable one is outside what any one-time
29
- * reading covers.
21
+ * TOTAL by construction: a diagnostic may not be the thing that fails a run. Every read of the adapter can throw on a
22
+ * getter or a Proxy trap — the block acquisition, each key, each optional method — and a read that throws is itself a
23
+ * declaration nobody can use, so it is reported rather than raised (`unreadable`, under the key when there is one and
24
+ * under `capabilities` when the block itself could not be had).
30
25
  */
31
26
  export declare function malformedCapabilityDeclarations(env: ExecutionEnv): MalformedCapabilityDeclaration[];
32
- /** Announce each malformed declaration once, to the operator who wired the adapter. */
27
+ /** Announce each undeclared or malformed declaration once, to the operator who wired the adapter. */
33
28
  export declare function announceMalformedCapabilities(env: ExecutionEnv, onNotice: ((notice: EngineNotice) => void) | undefined): void;
@@ -1,9 +1,5 @@
1
- import { isRemoteExecutionEnv } from "../remote-env.js";
1
+ import { CAPABILITY_KEYS, UNDECLARED_CAPABILITY_READING, capabilityReceiptOf } from "../remote-env.js";
2
2
  import { deliverEngineNotice } from "../engine-notice.js";
3
- const BOOLEAN_CAPABILITY_KEYS = ["isolation", "suspendable", "canonicalPathAuthoritative", "sharesProcessTable"];
4
- const NO_ABSENT_READING = {
5
- sharesProcessTable: "whether the commands it runs are processes on this engine's own process table has no default, so the Bash tool refuses every pattern kill that needs the question (`pkill`, `killall`, a `kill` fed by `pgrep`; `pkill -P $$`, the shell's own children, runs) on this environment until the adapter declares it — `true` when its commands run on a table that holds the engine (a host lane, or a PID namespace that contains the engine's), `false` only when they run where the engine is not (another machine, a PID namespace that does not contain it)",
6
- };
7
3
  const OPTIONAL_METHOD_KEYS = ["writeFileExclusive", "writeFileGuarded", "setFileMode", "readLink", "canonicalChain", "fileIdentity", "openBound"];
8
4
  export function malformedCapabilityDeclarations(env) {
9
5
  const out = [];
@@ -20,41 +16,36 @@ export function malformedCapabilityDeclarations(env) {
20
16
  continue;
21
17
  out.push({ key, valueType: value === null ? "null" : typeof value, expected: "function" });
22
18
  }
23
- let caps;
24
- try {
25
- if (!isRemoteExecutionEnv(env))
26
- return out;
27
- caps = env.capabilities;
28
- }
29
- catch {
30
- out.push({ key: "capabilities", valueType: "unreadable", expected: "boolean" });
31
- return out;
32
- }
33
- for (const key of BOOLEAN_CAPABILITY_KEYS) {
34
- let value;
35
- try {
36
- value = caps[key];
37
- }
38
- catch {
39
- out.push({ key, valueType: "unreadable", expected: "boolean" });
40
- continue;
41
- }
42
- if (typeof value === "boolean" || (value === undefined && NO_ABSENT_READING[key] === undefined))
43
- continue;
44
- out.push({ key, valueType: value === null ? "null" : typeof value, expected: "boolean" });
45
- }
19
+ for (const finding of capabilityReceiptOf(env).findings)
20
+ out.push(finding);
46
21
  return out;
47
22
  }
23
+ function declaredAs({ key, valueType, expected }) {
24
+ if (expected === "function")
25
+ return `declares ${key} as a ${valueType}, not a function`;
26
+ if (expected === "object")
27
+ return valueType === "unreadable" ? "declares a capabilities block that cannot be read" : `declares capabilities as a ${valueType}, not an object`;
28
+ if (expected === "absent")
29
+ return `declares capabilities.${key}, which is no capability`;
30
+ if (valueType === "undefined")
31
+ return `does not declare capabilities.${key}`;
32
+ if (valueType === "unreadable")
33
+ return `declares capabilities.${key} with a value that cannot be read`;
34
+ return `declares capabilities.${key} as a ${valueType}, not a boolean`;
35
+ }
48
36
  export function announceMalformedCapabilities(env, onNotice) {
49
- for (const { key, valueType, expected } of malformedCapabilityDeclarations(env)) {
50
- const noAbsentReading = NO_ABSENT_READING[key];
37
+ for (const finding of malformedCapabilityDeclarations(env)) {
38
+ const { key, valueType, expected } = finding;
39
+ const row = expected === "boolean" ? UNDECLARED_CAPABILITY_READING[key] : undefined;
51
40
  deliverEngineNotice(onNotice, {
52
41
  code: "config.execution_env_capability_invalid",
53
42
  message: expected === "function"
54
- ? `The execution environment declares ${key} as a ${valueType}, not a function. This seat is declared by being present as a callable method and undeclared by being absent, so every reader takes the absent reading — the reach the adapter meant to declare is silently the old one. Fix the adapter — this is a wiring fault, not a supported way to leave the seat unset.`
55
- : noAbsentReading !== undefined
56
- ? `The execution environment ${valueType === "undefined" ? `does not declare capabilities.${key}` : `declares capabilities.${key} as a ${valueType}, not a boolean`}: ${noAbsentReading}. Fix the adapter — this is a wiring fault, not a supported way to leave the capability unset.`
57
- : `The execution environment declares capabilities.${key} as a ${valueType}, not a boolean. What a reader makes of that is the reader's own business and differs between them — the containment readers take only the boolean, so this reads as undeclared, while the suspend reader takes any truthy value, so a non-empty string reads as TRUE. That is why a declaration of the wrong shape cannot pass quietly: the engine may act on something other than what the adapter meant. Fix the adapter — this is a wiring fault, not a supported way to leave the capability unset.`,
43
+ ? `The execution environment ${declaredAs(finding)}. This seat is declared by being present as a callable method and undeclared by being absent, so every reader takes the absent reading — the reach the adapter meant to declare is silently the old one. Fix the adapter — this is a wiring fault, not a supported way to leave the seat unset.`
44
+ : expected === "absent"
45
+ ? `The execution environment ${declaredAs(finding)}: the block holds exactly ${CAPABILITY_KEYS.join(", ")}, so no reader takes this member, and a misspelled key leaves the key it meant undeclared. Fix the adapter — this is a wiring fault, not a supported extension of the block.`
46
+ : expected === "object"
47
+ ? `The execution environment ${declaredAs(finding)}. Every capability is required and none can be read, so every reader takes its key's undeclared reading (${CAPABILITY_KEYS.map((k) => `${k} as ${JSON.stringify(UNDECLARED_CAPABILITY_READING[k].reads)}`).join(", ")}). Fix the adapter — this is a wiring fault, not a supported way to leave the capabilities unset.`
48
+ : `The execution environment ${declaredAs(finding)}. Every capability is required and has no default reading, so the engine reads it as ${JSON.stringify(row?.reads)}: ${row?.so}. Fix the adapter — this is a wiring fault, not a supported way to leave the capability unset.`,
58
49
  detail: { key, valueType },
59
50
  });
60
51
  }
@@ -4,8 +4,8 @@ import type { RunnerDeps, TaskSpec } from "../types.js";
4
4
  /**
5
5
  * The file-history REQUEST door: every refusal the request (`TaskSpec`) and the deployment's own seats decide
6
6
  * without the session, the env or the store's contents — the three bad-value doors (`RunnerDeps.onTrackFailure`,
7
- * `RunnerDeps.fileHistoryStore` / `fileHistoryCapture`, `TaskSpec.fileHistory`), the retired `rewindFiles` restore
8
- * sense, the restoreFiles / resumeAt / rewindFilesTo contradictions, and a restore asked of a run that holds no
7
+ * `RunnerDeps.fileHistoryStore` / `fileHistoryCapture`, `TaskSpec.fileHistory`), the restoreFiles / resumeAt /
8
+ * rewindFilesTo contradictions, and a restore asked of a run that holds no
9
9
  * history (`rewind.capture_disabled` / `rewind.store_unconfigured`). SYNCHRONOUS and side-effect free; the driver
10
10
  * calls it BEFORE the session is acquired, so a request refused here leaves the session — its leaf included —
11
11
  * exactly as it was. What it resolves rides into the file-history phase (`prepareFileHistory`) unchanged.
@@ -4,14 +4,6 @@ export function resolveFileHistoryRequest(spec, deps) {
4
4
  const declaredOff = wiredSeat === "disabled" || runDeclaredOff;
5
5
  const fileHistoryStore = declaredOff ? undefined : wiredSeat;
6
6
  const captureStore = captureOff ? undefined : fileHistoryStore;
7
- const legacyRewindFiles = spec.rewindFiles;
8
- if (legacyRewindFiles === true) {
9
- if (spec.resumeAt !== undefined) {
10
- const e = new Error(`rewind-files: TaskSpec.rewindFiles is retired (design/381 — rewind now converges the per-edited-file history, not a whole-tree snapshot). This request pairs it with resumeAt, i.e. the RESTORE sense: set restoreFiles: true instead. (The capture sense needs no request anymore — first-touch tracking is on whenever a RunnerDeps.fileHistoryStore is wired and neither RunnerDeps.fileHistoryCapture nor TaskSpec.fileHistory turns it off.)`);
11
- e.code = "rewind.rewind_files_retired";
12
- throw e;
13
- }
14
- }
15
7
  if (spec.restoreFiles === true && spec.resumeAt === undefined) {
16
8
  const e = new Error(`rewind-files: restoreFiles: true needs a resumeAt anchor — restoring files means converging them to a specific prior entry's boundary, and this spec names none. Use resumeAt + restoreFiles to move conversation and files together, or rewindFilesTo alone for a code-only restore.`);
17
9
  e.code = "rewind.invalid_spec";
@@ -140,24 +140,55 @@ export declare function frozenInputSnapshot(input: unknown): unknown;
140
140
  /** What one `classic.PreToolUse` screening came to: an answer the receipt took (`undefined` = no opinion), or the
141
141
  * engine's fail-closed refusal of the call with its sentence (a handler that failed or broke the site's contract,
142
142
  * or a cancel). */
143
- /** A screen's outcome; an answer names the registration whose answer the chain returned (`answeredBy`, absent when no
144
- * handler spoke) and the extensions that authored its `updatedInput` (`rewrittenBy`, in the order they rewrote; absent
145
- * when the answer carries no rewrite). */
143
+ /** A screen's outcome over every installation that screens the call (the leg's own bus, then each inherited installation). An
144
+ * answer is the leg's own verdict — or an inherited installation's `deny`, which ends the screen — naming the registration that
145
+ * answered it (`answeredBy`, absent when no handler spoke); its `updatedInput` is the bytes the screen ended on when any
146
+ * installation rewrote, `rewrittenBy` the extensions that authored them (in the order they rewrote). `contexts` are every
147
+ * `additionalContext` line the screen collected, in raise order. `settled`: an inherited installation's question was refused
148
+ * where its installation froze it (`deniedBy` / `cause` as the pass's ledger read the refusal). A refusal — a deny, a failure, a
149
+ * settled refusal — names the bytes its judge judged (`judged`) when a rewrite earlier in the screen made them other bytes than
150
+ * those the screen was given. */
146
151
  export type PreToolUseScreen = {
147
152
  readonly kind: "answered";
148
153
  readonly answer: PreToolUseResult | undefined;
149
154
  readonly answeredBy?: string;
150
155
  readonly rewrittenBy?: readonly string[];
156
+ readonly contexts: readonly string[];
157
+ readonly inherited?: InheritedScreenRead;
158
+ readonly judged?: unknown;
151
159
  } | {
152
160
  readonly kind: "refused";
153
161
  readonly reason: string; /** the registration the bus names for the failed screening (the mint reads whether it names an extension); absent on a cancel */
154
162
  readonly extension?: string;
163
+ readonly judged?: unknown;
164
+ } | {
165
+ readonly kind: "settled";
166
+ readonly deny: PermissionResult;
167
+ readonly deniedBy: DeniedBy;
168
+ readonly cause?: ClassifierDenyCause;
169
+ readonly judged?: unknown;
155
170
  };
171
+ /** What the inherited installations' `classic.PreToolUse` came to beside the leg's own answer (present when one was raised): the
172
+ * registrations whose `allow` is no objection here (the allow layer's `hook` member discloses them; an inherited allow clears
173
+ * nothing of this leg's), the question a settlement floated to this leg's park (the call is marked; it folds as the leg's own
174
+ * hook ask does), and a person's approval of an edit at an installation's question (the gate's approved-edit pass takes it). */
175
+ export interface InheritedScreenRead {
176
+ readonly allowedBy: readonly string[];
177
+ readonly floated?: Extract<PermissionResult, {
178
+ action: "ask";
179
+ }>;
180
+ readonly approved?: Extract<PermissionResult, {
181
+ action: "allow";
182
+ }> & {
183
+ readonly updatedInput: unknown;
184
+ };
185
+ }
156
186
  /**
157
- * The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus, the
158
- * per-screening e, the answer receipt and the fail-closed sentences behind one method, so the approved-edit re-screen
159
- * in the lanes runs the SAME screening the phase-1 pass ran. Present on the pass exactly when a handler hangs on the
160
- * event (an observe handler runs inside the screening too; it never decides).
187
+ * The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus and then on each
188
+ * inherited installation's, the per-screening e, the answer receipt, the installations' settlements and the fail-closed
189
+ * sentences behind one method, so every re-screen (the fold's second look, the approved-edit pass) runs the SAME screening
190
+ * the phase-1 pass ran. Present on the pass exactly when a handler hangs on the event on one of those buses (an observe
191
+ * handler of the leg's own runs inside the screening too; it never decides).
161
192
  */
162
193
  export interface PreToolUseScreening {
163
194
  /** Raise `classic.PreToolUse` over `args`; `subject` names what is screened in a fail-closed sentence; `readAs` is the call
@@ -169,6 +200,31 @@ export interface PreToolUseScreening {
169
200
  /** The model-facing text for the screen's OWN deny of this call (unwrapped; every exit wraps it with the leg's mark). */
170
201
  deniedReason(answer: PreToolUseResult): string;
171
202
  }
203
+ /** What the inherited installations said in a screen, taken onto the pass — the one reading for phase 1 and the fold's second
204
+ * look: a floated question folds as the leg's own hook ask does (the call is marked, so no layer of this leg answers it), the
205
+ * allow speakers go to the allow layer's disclosure (the latest screen's reading replaces an earlier one), and a person's
206
+ * approved edit waits for the lanes' approved-edit pass. */
207
+ export declare function takeInheritedScreen(pass: GatePass, read: InheritedScreenRead | undefined): void;
208
+ /** A screen's `settled` outcome: an inherited installation's question refused where its installation froze it, in the layer word
209
+ * and the cause its reader read (`policy` when it read none), over the bytes its judge judged when a rewrite made them others. */
210
+ export declare function settledScreen(read: {
211
+ readonly decision: PermissionResult;
212
+ readonly deniedBy?: DeniedBy;
213
+ readonly cause?: ClassifierDenyCause;
214
+ }, judged: {
215
+ readonly judged?: unknown;
216
+ }): Extract<PreToolUseScreen, {
217
+ kind: "settled";
218
+ }>;
219
+ /** A settled screen taken onto the pass — the one reading for phase 1, the fold's second look and the approved-edit pass's two
220
+ * screens: its layer word and cause are the pass's; the refusal is returned for the site to stand (the decision, or the edit's). */
221
+ export declare function takeSettledScreen(pass: GatePass, settled: Extract<PreToolUseScreen, {
222
+ kind: "settled";
223
+ }>): PermissionResult;
224
+ /** A settled screen ends the pass as the call's settlement: its refusal is the decision, through the single deny exit. */
225
+ export declare function settledScreenExit(pass: GatePass, settled: Extract<PreToolUseScreen, {
226
+ kind: "settled";
227
+ }>): Promise<ToolGateResult>;
172
228
  /** The FACE a pass's questions are put on ({@link askFaceOf} of the call's wire name) — the one reading of it the
173
229
  * write-protection tighten (the fold) and every class derivation (the lanes) make. */
174
230
  export declare function passAskFace(pass: Pick<GatePass, "req">): AskFace;
@@ -255,6 +311,18 @@ export interface GatePass {
255
311
  * that answered it: the allow layer's hook member (its `entries`). Writers: the dispatch (phase 1) and the fold's second
256
312
  * look after a policy rewrite (rewrite-rejudge.ts), whose answer replaces the first. Reader: the lanes' allow layer. */
257
313
  hookAllowedBy?: readonly string[];
314
+ /** borrowed-mutable — the inherited installations whose `classic.PreToolUse` answered `allow` for the bytes that run: no
315
+ * objection, disclosed as the allow layer's `hook` member over a standing ask (never a clear). Writers: the dispatch (phase 1)
316
+ * and the fold's second look (its reading replaces the first). Reader: the lanes' allow layer. */
317
+ inheritedAllowedBy?: readonly string[];
318
+ /** borrowed-mutable — a person at an inherited installation's question approved an EDIT of the call during a screen: the lanes
319
+ * take it into the approved-edit pass after the fold (as a `tool.check` raise's approval is taken). Writers: the dispatch
320
+ * (phase 1) and the fold's second look. Reader: the lanes. */
321
+ screenApproval?: Extract<PermissionResult, {
322
+ action: "allow";
323
+ }> & {
324
+ readonly updatedInput: unknown;
325
+ };
258
326
  /** borrowed-mutable — `tool.check` was raised in this pass's first adjudication, which raises it once: set by the
259
327
  * raise in front of the ask branch, read by the raise behind the read-only arm (it then raises nothing). Writer and
260
328
  * reader: the lanes. */
@@ -2,7 +2,7 @@ import { screenGateOutcome, SETTLEMENT_IS_REFUSAL } from "../gate-outcome.js";
2
2
  import { askFaceOf, classifyAsk, headlessApprovalRemedy } from "../ask-origin.js";
3
3
  import { wireOf } from "../tool-name-readings.js";
4
4
  import { isProtectedWrite } from "../tool-registry.js";
5
- import { attestationOf, decisionText, licenseCovers } from "../tool-policy.js";
5
+ import { attestationOf, decisionText, foldHookAsk, licenseCovers } from "../tool-policy.js";
6
6
  import { pathDenialCardOf } from "../../tools/fs/safety.js";
7
7
  import { argsAsTheToolReads } from "../effective-path-target.js";
8
8
  import { rewriteRecordOf } from "../rewrite-rejudge.js";
@@ -218,6 +218,25 @@ function withParkFailureCause(reason, parkFailed, nobodyJudged) {
218
218
  const note = `${reason} — note: a durable approval park was attempted for this call and could not be minted (${inlineUntrusted(parkFailed, PARK_FAILURE_CAUSE_MAX)})`;
219
219
  return nobodyJudged ? `${note}; with nobody to judge the call, that is why it stopped — it can be issued again once its park can be minted.` : `${note}.`;
220
220
  }
221
+ export function takeInheritedScreen(pass, read) {
222
+ if (read?.floated !== undefined)
223
+ pass.hookAsk = pass.hookAsk !== undefined ? foldHookAsk(pass.hookAsk, read.floated) : read.floated;
224
+ pass.inheritedAllowedBy = read !== undefined && read.allowedBy.length > 0 ? read.allowedBy : undefined;
225
+ if (read?.approved !== undefined)
226
+ pass.screenApproval = read.approved;
227
+ }
228
+ export function settledScreen(read, judged) {
229
+ return { kind: "settled", deny: read.decision, deniedBy: read.deniedBy ?? "policy", ...(read.cause !== undefined ? { cause: read.cause } : {}), ...judged };
230
+ }
231
+ export function takeSettledScreen(pass, settled) {
232
+ pass.deniedBy = settled.deniedBy;
233
+ pass.denyCause = settled.cause;
234
+ return settled.deny;
235
+ }
236
+ export async function settledScreenExit(pass, settled) {
237
+ pass.decision = takeSettledScreen(pass, settled);
238
+ return await exitGate(pass);
239
+ }
221
240
  export function passAskFace(pass) {
222
241
  return askFaceOf(wireOf("gate.askFace", pass.req));
223
242
  }
@@ -1,4 +1,4 @@
1
- import type { AgentMessage, ExecutionEnv, GitAnnouncementKind, SessionTreeEntry } from "../../internal/harness-types.js";
1
+ import type { AgentMessage, ExecutionEnv, GitAnnouncementKind, ReadFloor, SessionTreeEntry } from "../../internal/harness-types.js";
2
2
  /** Bound into the hash domain: bump when the frame's wording/structure changes so the upgraded
3
3
  * renderer re-announces on its first leg instead of being suppressed by a pre-upgrade hash. */
4
4
  export declare const GIT_STATUS_FRAME_FORMAT_VERSION = 1;
@@ -155,6 +155,9 @@ export declare function probeGitStatusLane(args: {
155
155
  };
156
156
  handsEnabled: boolean;
157
157
  taskRoot: string;
158
+ /** The byte floor of the run's base read-deny table: the snapshot's lines enter the frame the model reads, so its start
159
+ * carries it (`git config` reads what an `include.path` names). */
160
+ readFloor?: ReadFloor;
158
161
  onDegrade: (reason: string) => void;
159
162
  }): Promise<GitStatusLaneRef>;
160
163
  /**
@@ -189,7 +192,7 @@ export declare function newestEngineGitFrame(branch: SessionTreeEntry[], mark?:
189
192
  entryId: string;
190
193
  positive: boolean;
191
194
  } | undefined;
192
- export declare function stripGitStatusUnits(text: string, mark?: string): string;
195
+ export declare function stripGitStatusUnits(text: string): string;
193
196
  /**
194
197
  * The readable-absence tombstone question (R2-1), answered by the classifier above: does the
195
198
  * branch carry a still-context-visible POSITIVE engine frame as its newest git frame? A newest
@@ -62,7 +62,7 @@ export function resolveGitStatusFrame(outcome, canonicalRoot, degradedMaterial)
62
62
  return resolved;
63
63
  }
64
64
  export async function probeGitStatusLane(args) {
65
- const { executionEnv, envFacts, handsEnabled, taskRoot, onDegrade } = args;
65
+ const { executionEnv, envFacts, handsEnabled, taskRoot, readFloor, onDegrade } = args;
66
66
  const ref = {};
67
67
  if (!handsEnabled)
68
68
  return ref;
@@ -75,7 +75,7 @@ export async function probeGitStatusLane(args) {
75
75
  ...(envFacts.gitDirty !== undefined ? { dirty: envFacts.gitDirty } : {}),
76
76
  };
77
77
  try {
78
- const snap = await executionEnv.exec(`(m=$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null); m=\${m#origin/}; for s in "$m" main master; do if [ -n "$s" ] && git show-ref --verify --quiet "refs/remotes/origin/$s"; then echo "$s"; break; fi; done) || true; echo "${SEP}"; (git config user.name 2>/dev/null || true); echo "${SEP}"; gs=$(git --no-optional-locks status --short) || exit 41; printf '%s\\n' "$gs"; echo "${SEP}"; gl=$(git --no-optional-locks log --oneline -n 5) || exit 42; printf '%s\\n' "$gl"`, { cwd: envFacts.cwd, timeout: 10 });
78
+ const snap = await executionEnv.exec(`(m=$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null); m=\${m#origin/}; for s in "$m" main master; do if [ -n "$s" ] && git show-ref --verify --quiet "refs/remotes/origin/$s"; then echo "$s"; break; fi; done) || true; echo "${SEP}"; (git config user.name 2>/dev/null || true); echo "${SEP}"; gs=$(git --no-optional-locks status --short) || exit 41; printf '%s\\n' "$gs"; echo "${SEP}"; gl=$(git --no-optional-locks log --oneline -n 5) || exit 42; printf '%s\\n' "$gl"`, { cwd: envFacts.cwd, timeout: 10, ...(readFloor !== undefined ? { readFloor } : {}) });
79
79
  if (snap.ok && snap.value.exitCode === 0) {
80
80
  const parts = snap.value.stdout.split(`${SEP}\n`);
81
81
  if (parts.length === 4) {
@@ -208,8 +208,7 @@ function hasNestedReminderOpenTag(seg) {
208
208
  }
209
209
  return false;
210
210
  }
211
- export function stripGitStatusUnits(text, mark) {
212
- void mark;
211
+ export function stripGitStatusUnits(text) {
213
212
  const close = "</system-reminder>";
214
213
  const findHead = (out, from) => {
215
214
  for (let at = out.indexOf("<system-reminder", from); at !== -1; at = out.indexOf("<system-reminder", at + 1)) {
@@ -1,6 +1,7 @@
1
1
  import type { ImageContent } from "../../internal/llm.js";
2
2
  import { type HostFloor } from "../host-floor.js";
3
3
  import type { ImageInput } from "../types.js";
4
+ import { type ImageDownsampler } from "../image-downsample.js";
4
5
  /**
5
6
  * The guard of a remote image URL: https only, then the one egress hop judge with the private-network floor (`hopRefusal`,
6
7
  * host-floor.ts) — the deployment's host floor (`RunnerDeps.hostFloor`, `floor`) must admit the host, and a private host is
@@ -8,5 +9,9 @@ import type { ImageInput } from "../types.js";
8
9
  * `169.254.169.254` or a private box. The host is read literally (no DNS resolution). Throws on a refused URL.
9
10
  */
10
11
  export declare function defaultImageUrlGuard(raw: string, floor?: HostFloor): void;
11
- /** Resolve an {@link ImageInput} (inline base64 or a URL to fetch) into a vendored `ImageContent` block. */
12
- export declare function toImageContent(img: ImageInput, floor: HostFloor | undefined): Promise<ImageContent>;
12
+ /** Resolve an {@link ImageInput} (inline base64 or a URL to fetch) into a vendored `ImageContent` block: both arms pass
13
+ * the one byte admission with the run's processor (inline-image.ts) — a fetched body after the URL's own guard and cap. */
14
+ export declare function toImageContent(img: ImageInput, floor: HostFloor | undefined, processor: ImageDownsampler | "none"): Promise<ImageContent>;
15
+ /** The task's images (`TaskSpec.images`), each through {@link toImageContent} with the run's one processor (`seat` =
16
+ * `RunnerDeps.imageProcessor`); the first one sent unprocessed over the soft target is told to `unprocessed`. */
17
+ export declare function toImageContents(images: readonly ImageInput[], floor: HostFloor | undefined, seat: ImageDownsampler | false | undefined, unprocessed: (bytes: number) => void): Promise<ImageContent[]>;
@@ -1,9 +1,7 @@
1
1
  import { hopRefusal } from "../host-floor.js";
2
- import { ADMITTED_IMAGE_MIME_TYPES, imageMagicMatches } from "../image-admission.js";
2
+ import { firstUnprocessedOverTarget, IMAGE_ADMISSION, sniffImageMime } from "../image-admission.js";
3
+ import { resolveImageProcessor } from "../image-downsample.js";
3
4
  import { admitInlineImage } from "./inline-image.js";
4
- function sniffImageMime(bytes) {
5
- return ADMITTED_IMAGE_MIME_TYPES.find((mime) => imageMagicMatches(bytes, mime));
6
- }
7
5
  export function defaultImageUrlGuard(raw, floor) {
8
6
  let u;
9
7
  try {
@@ -20,7 +18,7 @@ export function defaultImageUrlGuard(raw, floor) {
20
18
  throw new Error(`image url not fetched — ${refused}`);
21
19
  }
22
20
  const IMAGE_FETCH_TIMEOUT_MS = 30_000;
23
- const IMAGE_MAX_BYTES = 20 * 1024 * 1024;
21
+ const IMAGE_MAX_BYTES = IMAGE_ADMISSION.hard.urlBytes;
24
22
  async function readImageBodyCapped(res) {
25
23
  const reader = res.body?.getReader();
26
24
  if (!reader) {
@@ -67,12 +65,20 @@ async function fetchImageCapped(url) {
67
65
  }
68
66
  return { buf, mimeType: sniffed };
69
67
  }
70
- export async function toImageContent(img, floor) {
68
+ export async function toImageContent(img, floor, processor) {
71
69
  if ("url" in img) {
72
70
  const url = img.url;
73
71
  defaultImageUrlGuard(url, floor);
74
72
  const { buf, mimeType } = await fetchImageCapped(url);
75
- return { type: "image", data: buf.toString("base64"), mimeType };
73
+ return admitInlineImage({ data: buf.toString("base64"), mimeType }, processor, "the image fetched from its url");
76
74
  }
77
- return admitInlineImage(img);
75
+ return admitInlineImage(img, processor);
76
+ }
77
+ export async function toImageContents(images, floor, seat, unprocessed) {
78
+ const processor = await resolveImageProcessor(seat);
79
+ const blocks = await Promise.all(images.map((img) => toImageContent(img, floor, processor)));
80
+ const over = firstUnprocessedOverTarget(blocks, processor);
81
+ if (over !== undefined)
82
+ unprocessed(over);
83
+ return blocks;
78
84
  }
@@ -1,14 +1,16 @@
1
1
  /**
2
- * The `TaskSpec.images` INLINE arm's admission: the same byte admission a file the Read tool serves passes
3
- * (image-admission.ts) — a claimed type the API accepts, within the raw cap, that type's signature, under
4
- * the provider's base64 limit. Without it a mis-declared image rode straight to the provider and 400'd the whole
5
- * request. Like the Read lane it checks the SIGNATURE, not decodability: a file cut short after its signature
6
- * passes (KL-1311a-c). No downsampling here: this arm only refuses what would not survive the wire, and a
7
- * valid image reaches the model unchanged. The block is built from the bytes that were checked.
2
+ * The `TaskSpec.images` arms' admission: the same byte admission a file the Read tool serves passes
3
+ * (image-admission.ts), with the run's processor — a claimed type the API accepts, within the raw cap, that type's
4
+ * signature, then the processor (or, with none, a header-stated size within the reject edge), under the provider's
5
+ * base64 limit. Without it a mis-declared image rode straight to the provider and 400'd the whole request. Like the
6
+ * Read lane it checks the SIGNATURE, not decodability: a file cut short after its signature passes when no processor
7
+ * reads it (KL-1311a-c). The block is built from the bytes that were checked (or the processor made from them).
8
8
  */
9
9
  import type { ImageContent } from "../../internal/llm.js";
10
10
  import type { ImageInput } from "../types.js";
11
- /** Admit one inline entry (`{ data, mimeType }`) or throw `config.image_invalid`. */
11
+ import type { ImageDownsampler } from "../image-downsample.js";
12
+ /** Admit one entry's bytes (`{ data, mimeType }` — inline, or a URL arm's fetched body, `subject` naming which) or throw
13
+ * `config.image_invalid`. */
12
14
  export declare function admitInlineImage(img: Extract<ImageInput, {
13
15
  data: string;
14
- }>): Promise<ImageContent>;
16
+ }>, processor: ImageDownsampler | "none", subject?: string): Promise<ImageContent>;
@@ -1,26 +1,28 @@
1
- import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES } from "../image-admission.js";
2
- import { MCP_IMAGE_MAX_BASE64 } from "../image-downsample.js";
1
+ import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES, IMAGE_ADMISSION, unprocessedSizeClause } from "../image-admission.js";
3
2
  function inlineImageRefusal(detail) {
4
3
  const e = new Error(`TaskSpec.images: ${detail}`);
5
4
  e.code = "config.image_invalid";
6
5
  return e;
7
6
  }
8
- export async function admitInlineImage(img) {
7
+ export async function admitInlineImage(img, processor, subject = "an inline image") {
9
8
  const data = img.data;
10
9
  const mimeType = img.mimeType;
11
10
  if (typeof data !== "string" || typeof mimeType !== "string")
12
- throw inlineImageRefusal("an inline image needs a base64 string `data` and a string `mimeType`.");
13
- const admitted = await admitImageBytes(Buffer.from(data, "base64"), mimeType, undefined);
11
+ throw inlineImageRefusal(`${subject} needs a base64 string \`data\` and a string \`mimeType\`.`);
12
+ const admitted = await admitImageBytes(Buffer.from(data, "base64"), mimeType, processor);
14
13
  if (admitted.ok)
15
14
  return admitted.block;
16
15
  switch (admitted.reason) {
17
16
  case "mime_unsupported":
18
- throw inlineImageRefusal(`an inline image declares mimeType ${JSON.stringify(mimeType.slice(0, 80))}, which the model API does not accept (accepted: ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}).`);
17
+ throw inlineImageRefusal(`${subject} declares mimeType ${JSON.stringify(mimeType.slice(0, 80))}, which the model API does not accept (accepted: ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}).`);
19
18
  case "magic_mismatch":
20
- throw inlineImageRefusal(`an inline image's bytes do not open with a valid ${mimeType} header (empty, truncated, mis-declared, not base64, or a variant such as an Apple-optimized PNG that model APIs cannot read) — refused rather than sent.`);
19
+ throw inlineImageRefusal(`${subject}'s bytes do not open with a valid ${mimeType} header (empty, truncated, mis-declared, not base64, or a variant such as an Apple-optimized PNG that model APIs cannot read) — refused rather than sent.`);
21
20
  case "raw_too_large":
22
- throw inlineImageRefusal(`an inline image is ${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
21
+ throw inlineImageRefusal(`${subject} is ${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
22
+ case "dimensions_unreadable":
23
+ case "dimensions_too_large":
24
+ throw inlineImageRefusal(`${subject} is refused rather than sent: ${unprocessedSizeClause(admitted)}.`);
23
25
  case "base64_too_large":
24
- throw inlineImageRefusal(`an inline image's base64 is ${admitted.base64.length} chars, over the ${MCP_IMAGE_MAX_BASE64}-char / 5MB API image limit — shrink it before sending.`);
26
+ throw inlineImageRefusal(`${subject}'s base64 is ${admitted.base64.length} chars, over the ${IMAGE_ADMISSION.hard.imageBase64Chars}-char / 5MB API image limit — shrink it before sending.`);
25
27
  }
26
28
  }
@@ -1,5 +1,5 @@
1
1
  import { brainToRuntime } from "../runtime.js";
2
- import { expandTiers, roleModelIfSet, unheldChainRefusal } from "../roles.js";
2
+ import { catalogOfDeps, roleModelIfSet, unheldChainRefusal } from "../roles.js";
3
3
  import { isAliasModelId, openAiCompatChatSeat } from "../memory-engine/distiller.js";
4
4
  import { runMemoryConsolidationDriver } from "../memory-engine/consolidation-driver.js";
5
5
  import { recommendationUnconsumed } from "../memory-engine/consolidation.js";
@@ -26,7 +26,7 @@ export function resolveMemoryConsolidationDriver(deps) {
26
26
  model = seat.chat.model;
27
27
  }
28
28
  else {
29
- const models = expandTiers(deps.models, deps.tiers);
29
+ const models = catalogOfDeps(deps);
30
30
  const resolved = roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles });
31
31
  if (resolved === undefined) {
32
32
  throw unheldChainRefusal(["consolidate", "summarize"], models, deps.roles) ?? seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
@@ -65,7 +65,7 @@ export function resolveMemoryConsolidationDriver(deps) {
65
65
  export function consolidationSeatResolvable(deps) {
66
66
  if (deps.memoryConsolidationDriver?.chat !== undefined)
67
67
  return true;
68
- const models = expandTiers(deps.models, deps.tiers);
68
+ const models = catalogOfDeps(deps);
69
69
  return (roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles })) !== undefined;
70
70
  }
71
71
  export function autoRunConsolidationFromRecommendation(args) {
@@ -116,6 +116,6 @@ export function assertAutoConsolidationWirable(deps) {
116
116
  throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but RunnerDeps.memoryConsolidation is absent — the recommendation that would trigger a run is never minted (consolidation is OFF) and the engine's verbs refuse coded, so the trigger can never fire. An armed-but-unrunnable trigger is refused, never folded to off: wire memoryConsolidation, or leave autoRunOnRecommendation unset.");
117
117
  }
118
118
  if (!consolidationSeatResolvable(deps)) {
119
- throw unheldChainRefusal(["consolidate", "summarize"], expandTiers(deps.models, deps.tiers), deps.roles) ?? autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
119
+ throw unheldChainRefusal(["consolidate", "summarize"], catalogOfDeps(deps), deps.roles) ?? autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
120
120
  }
121
121
  }
@@ -123,7 +123,7 @@ export function createPermissionRuleLanes(cfg) {
123
123
  if (!judged.some(([, g]) => g === "path") && faceRowsSpeakFor(callPathFaceOf(req)))
124
124
  judged.push([req.toolName, "path"]);
125
125
  const view = await reader.pin(req.toolCallId, req.args);
126
- const ownRow = (r) => judged.some(([n]) => n === r.tool) || wholeToolRuleReaches(r.tool, req);
126
+ const ownRow = (r) => judged.some(([n]) => n === r.tool) || wholeToolRuleReaches(r.tool, req, r.behavior);
127
127
  if (judged.length === 0 && !view.rules.some(ownRow))
128
128
  return view.unreadable !== undefined ? { unreadable: true } : undefined;
129
129
  try {