@sema-agent/core 7.58.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 (519) hide show
  1. package/CHANGELOG.md +1340 -0
  2. package/README.md +6 -4
  3. package/dist/agents/agent-definition.d.ts +7 -0
  4. package/dist/agents/agent-definition.js +12 -0
  5. package/dist/agents/agent-transcript-tool.d.ts +2 -1
  6. package/dist/agents/agent-transcript-tool.js +3 -1
  7. package/dist/agents/cc-peer-directory.js +8 -8
  8. package/dist/agents/child-model-seat.d.ts +4 -2
  9. package/dist/agents/child-model-seat.js +9 -4
  10. package/dist/agents/cumulative-stats.js +0 -1
  11. package/dist/agents/inherited-tool-pool.d.ts +26 -1
  12. package/dist/agents/inherited-tool-pool.js +22 -0
  13. package/dist/agents/peer-directory.d.ts +9 -0
  14. package/dist/agents/peer-directory.js +6 -2
  15. package/dist/agents/retain-ledger.d.ts +11 -1
  16. package/dist/agents/retain-ledger.js +13 -2
  17. package/dist/agents/roster-store.d.ts +1 -1
  18. package/dist/agents/roster-store.js +3 -1
  19. package/dist/agents/send-message-tool.d.ts +8 -19
  20. package/dist/agents/send-message-tool.js +32 -50
  21. package/dist/agents/subagent.d.ts +51 -17
  22. package/dist/agents/subagent.js +150 -112
  23. package/dist/agents/tool-filter.d.ts +1 -3
  24. package/dist/agents/tool-filter.js +4 -12
  25. package/dist/bench/metrics.d.ts +3 -5
  26. package/dist/bench/metrics.js +0 -1
  27. package/dist/brain/anthropic.js +161 -45
  28. package/dist/brain/degrading.js +3 -1
  29. package/dist/brain/errors.d.ts +9 -3
  30. package/dist/brain/errors.js +7 -1
  31. package/dist/brain/failover.js +2 -1
  32. package/dist/brain/open-responses.js +3 -3
  33. package/dist/brain/openai.js +103 -53
  34. package/dist/brain/provider-dialect.d.ts +11 -0
  35. package/dist/brain/provider-dialect.js +5 -2
  36. package/dist/brain/reasoning-request.js +5 -4
  37. package/dist/brain/reasoning.d.ts +19 -0
  38. package/dist/brain/reasoning.js +17 -2
  39. package/dist/brain/request-route.d.ts +4 -1
  40. package/dist/brain/request-route.js +4 -1
  41. package/dist/brain/route-adjudicator.d.ts +84 -18
  42. package/dist/brain/route-adjudicator.js +90 -22
  43. package/dist/brain/route-conformance.js +1 -1
  44. package/dist/brain/status-sink.d.ts +7 -1
  45. package/dist/brain/status-sink.js +6 -0
  46. package/dist/brain/stream-engine.js +84 -49
  47. package/dist/brain/stream-shared.d.ts +30 -0
  48. package/dist/brain/stream-shared.js +34 -1
  49. package/dist/brain/timeout.d.ts +65 -6
  50. package/dist/brain/timeout.js +111 -11
  51. package/dist/core/a2a.d.ts +15 -5
  52. package/dist/core/a2a.js +34 -19
  53. package/dist/core/account-row.d.ts +61 -0
  54. package/dist/core/account-row.js +51 -0
  55. package/dist/core/advisor-verdict.d.ts +2 -1
  56. package/dist/core/advisor-verdict.js +1 -1
  57. package/dist/core/agent-definition.d.ts +20 -0
  58. package/dist/core/allow-entry.d.ts +20 -6
  59. package/dist/core/allow-entry.js +17 -7
  60. package/dist/core/approval-object.d.ts +29 -15
  61. package/dist/core/approval-object.js +47 -19
  62. package/dist/core/artifact-host.d.ts +0 -2
  63. package/dist/core/artifact-host.js +0 -1
  64. package/dist/core/auto-compaction.js +1 -1
  65. package/dist/core/auto-mode-defaults.d.ts +8 -0
  66. package/dist/core/auto-mode-defaults.js +1 -0
  67. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  68. package/dist/core/auto-mode.d.ts +39 -4
  69. package/dist/core/auto-mode.js +63 -12
  70. package/dist/core/background-agent-store.d.ts +26 -4
  71. package/dist/core/background-agent-store.js +3 -2
  72. package/dist/core/background-shell.d.ts +12 -1
  73. package/dist/core/background-shell.js +12 -0
  74. package/dist/core/checkpoint-requirements.d.ts +13 -1
  75. package/dist/core/checkpoint-requirements.js +3 -1
  76. package/dist/core/checkpoint-store.d.ts +66 -25
  77. package/dist/core/checkpoint-store.js +22 -9
  78. package/dist/core/child-clamp-seats.d.ts +29 -0
  79. package/dist/core/child-clamp-seats.js +56 -1
  80. package/dist/core/compliance.d.ts +3 -3
  81. package/dist/core/compliance.js +1 -1
  82. package/dist/core/credential-echo.d.ts +52 -0
  83. package/dist/core/credential-echo.js +65 -0
  84. package/dist/core/credential-vocabulary.d.ts +13 -3
  85. package/dist/core/credential-vocabulary.js +12 -4
  86. package/dist/core/cross-boundary-taint.d.ts +4 -5
  87. package/dist/core/effective-path-target.d.ts +8 -2
  88. package/dist/core/effective-path-target.js +8 -3
  89. package/dist/core/engine-notice.d.ts +156 -23
  90. package/dist/core/engine-notice.js +19 -5
  91. package/dist/core/frame-settlement.d.ts +5 -0
  92. package/dist/core/frame-settlement.js +4 -0
  93. package/dist/core/gate-fold.js +8 -6
  94. package/dist/core/gate-lanes.js +47 -12
  95. package/dist/core/gate-outcome.d.ts +32 -3
  96. package/dist/core/gate-outcome.js +19 -1
  97. package/dist/core/governance-codes.d.ts +17 -1
  98. package/dist/core/governance-codes.js +25 -0
  99. package/dist/core/hands-band-screen.js +0 -1
  100. package/dist/core/hands-band.d.ts +0 -3
  101. package/dist/core/hooks.d.ts +70 -59
  102. package/dist/core/hooks.js +125 -80
  103. package/dist/core/image-admission.d.ts +106 -52
  104. package/dist/core/image-admission.js +184 -56
  105. package/dist/core/image-downsample.d.ts +36 -69
  106. package/dist/core/image-downsample.js +111 -73
  107. package/dist/core/integer-option.d.ts +21 -0
  108. package/dist/core/integer-option.js +13 -0
  109. package/dist/core/locked-config.d.ts +59 -5
  110. package/dist/core/locked-config.js +82 -50
  111. package/dist/core/mailbox-store.d.ts +45 -1
  112. package/dist/core/mailbox-store.js +53 -9
  113. package/dist/core/mcp-call-meta.d.ts +2 -2
  114. package/dist/core/mcp-call-meta.js +9 -10
  115. package/dist/core/mcp-failure.d.ts +122 -20
  116. package/dist/core/mcp-failure.js +73 -5
  117. package/dist/core/mcp-host-seat.d.ts +92 -0
  118. package/dist/core/mcp-host-seat.js +131 -0
  119. package/dist/core/mcp-probe.d.ts +7 -2
  120. package/dist/core/mcp-probe.js +7 -2
  121. package/dist/core/mcp-server-link.d.ts +22 -1
  122. package/dist/core/mcp-server-link.js +25 -1
  123. package/dist/core/mcp-server-spec.d.ts +38 -9
  124. package/dist/core/mcp-server-spec.js +55 -21
  125. package/dist/core/mcp.d.ts +27 -12
  126. package/dist/core/mcp.js +105 -76
  127. package/dist/core/memory-admission.d.ts +23 -6
  128. package/dist/core/memory-admission.js +19 -9
  129. package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
  130. package/dist/core/memory-engine/consolidation-driver.js +3 -3
  131. package/dist/core/memory-engine/consolidation.d.ts +4 -0
  132. package/dist/core/memory-engine/consolidation.js +1 -0
  133. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  134. package/dist/core/memory-engine/content-origin.js +21 -3
  135. package/dist/core/memory-engine/delegation-settlement.js +5 -12
  136. package/dist/core/memory-engine/distiller.js +2 -2
  137. package/dist/core/memory-engine/dual-root.d.ts +50 -1
  138. package/dist/core/memory-engine/dual-root.js +44 -1
  139. package/dist/core/memory-engine/engine.d.ts +67 -14
  140. package/dist/core/memory-engine/engine.js +384 -212
  141. package/dist/core/memory-engine/export-bundle.d.ts +23 -0
  142. package/dist/core/memory-engine/export-bundle.js +23 -4
  143. package/dist/core/memory-engine/file-backend.d.ts +128 -55
  144. package/dist/core/memory-engine/file-backend.js +290 -117
  145. package/dist/core/memory-engine/index.d.ts +3 -2
  146. package/dist/core/memory-engine/index.js +2 -1
  147. package/dist/core/memory-engine/layout.d.ts +59 -11
  148. package/dist/core/memory-engine/layout.js +190 -40
  149. package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
  150. package/dist/core/memory-engine/memory-backend-contract.js +39 -2
  151. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  152. package/dist/core/memory-engine/scope-contract.js +2 -2
  153. package/dist/core/memory-engine/sync-client.d.ts +51 -9
  154. package/dist/core/memory-engine/sync-client.js +107 -13
  155. package/dist/core/memory-engine/sync-report.d.ts +103 -0
  156. package/dist/core/memory-engine/sync-report.js +119 -0
  157. package/dist/core/memory-engine/sync.d.ts +8 -1
  158. package/dist/core/memory-engine/types.d.ts +6 -0
  159. package/dist/core/mode-policy.d.ts +9 -1
  160. package/dist/core/mode-policy.js +11 -1
  161. package/dist/core/model-receipt.d.ts +39 -0
  162. package/dist/core/model-receipt.js +139 -0
  163. package/dist/core/mods/agent-stations.d.ts +65 -0
  164. package/dist/core/mods/agent-stations.js +105 -0
  165. package/dist/core/mods/classic-events.d.ts +5 -1
  166. package/dist/core/mods/kernel/dispatch.d.ts +5 -1
  167. package/dist/core/mods/kernel/dispatch.js +6 -5
  168. package/dist/core/mods/kernel/events.d.ts +11 -4
  169. package/dist/core/mods/kernel/events.js +11 -7
  170. package/dist/core/mods/kernel/receive.d.ts +5 -0
  171. package/dist/core/mods/kernel/receive.js +10 -0
  172. package/dist/core/mods/kernel/registration.d.ts +4 -0
  173. package/dist/core/mods/kernel/registration.js +3 -0
  174. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  175. package/dist/core/mods/lifecycle-stations.js +35 -0
  176. package/dist/core/mods/stations.d.ts +73 -60
  177. package/dist/core/mods/stations.js +64 -40
  178. package/dist/core/mods/tool-call.d.ts +10 -4
  179. package/dist/core/mods/tool-call.js +28 -12
  180. package/dist/core/mounted-mcp.d.ts +5 -0
  181. package/dist/core/mounted-mcp.js +2 -2
  182. package/dist/core/namespaced-rule-name.d.ts +7 -1
  183. package/dist/core/namespaced-rule-name.js +13 -2
  184. package/dist/core/oracle-isolation.js +1 -1
  185. package/dist/core/own-property-receipt.d.ts +3 -0
  186. package/dist/core/own-property-receipt.js +3 -0
  187. package/dist/core/parent-spec-seat.d.ts +8 -3
  188. package/dist/core/parent-spec-seat.js +2 -0
  189. package/dist/core/park-selfcheck.js +14 -8
  190. package/dist/core/peer-seat.d.ts +133 -16
  191. package/dist/core/peer-seat.js +319 -42
  192. package/dist/core/permission-rule-consent.d.ts +0 -21
  193. package/dist/core/permission-rule-consent.js +11 -6
  194. package/dist/core/permission-rule-model.d.ts +20 -2
  195. package/dist/core/permission-rule-model.js +8 -7
  196. package/dist/core/present-plan-tool.d.ts +11 -3
  197. package/dist/core/present-plan-tool.js +2 -2
  198. package/dist/core/protocol-http-auth.d.ts +14 -2
  199. package/dist/core/protocol-http-auth.js +16 -7
  200. package/dist/core/read-face-seats.d.ts +7 -5
  201. package/dist/core/read-face-seats.js +4 -1
  202. package/dist/core/redaction-marks.d.ts +4 -3
  203. package/dist/core/redaction-marks.js +2 -2
  204. package/dist/core/remote-env.d.ts +146 -98
  205. package/dist/core/remote-env.js +113 -14
  206. package/dist/core/resume-startup-cause.js +1 -0
  207. package/dist/core/retention.js +37 -12
  208. package/dist/core/retired-keys.d.ts +6 -1
  209. package/dist/core/retired-keys.js +4 -1
  210. package/dist/core/rewrite-rejudge.d.ts +13 -5
  211. package/dist/core/rewrite-rejudge.js +9 -5
  212. package/dist/core/roles.d.ts +69 -3
  213. package/dist/core/roles.js +167 -80
  214. package/dist/core/rule-owner.d.ts +3 -0
  215. package/dist/core/runner/announce-once-ledger.d.ts +5 -4
  216. package/dist/core/runner/announce-once-ledger.js +4 -2
  217. package/dist/core/runner/assemble-result.d.ts +0 -5
  218. package/dist/core/runner/assemble-result.js +0 -1
  219. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  220. package/dist/core/runner/call-hook-stations.js +23 -12
  221. package/dist/core/runner/child-tree.d.ts +7 -8
  222. package/dist/core/runner/child-tree.js +6 -6
  223. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  224. package/dist/core/runner/classifier-ladder.js +39 -8
  225. package/dist/core/runner/construction-doors.js +5 -0
  226. package/dist/core/runner/contracts.d.ts +82 -57
  227. package/dist/core/runner/credential-origin-seat.js +4 -3
  228. package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
  229. package/dist/core/runner/cross-boundary-lane.js +11 -2
  230. package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
  231. package/dist/core/runner/cwd-alignment-probe.js +21 -0
  232. package/dist/core/runner/decide-continuation.d.ts +2 -2
  233. package/dist/core/runner/env-capability-census.d.ts +15 -20
  234. package/dist/core/runner/env-capability-census.js +25 -34
  235. package/dist/core/runner/file-history-request.d.ts +2 -2
  236. package/dist/core/runner/file-history-request.js +0 -8
  237. package/dist/core/runner/gate-exit.d.ts +87 -11
  238. package/dist/core/runner/gate-exit.js +30 -8
  239. package/dist/core/runner/git-status-frame.d.ts +5 -2
  240. package/dist/core/runner/git-status-frame.js +3 -4
  241. package/dist/core/runner/image-removed-seat.d.ts +12 -0
  242. package/dist/core/runner/image-removed-seat.js +19 -0
  243. package/dist/core/runner/image.d.ts +7 -2
  244. package/dist/core/runner/image.js +14 -8
  245. package/dist/core/runner/inline-image.d.ts +10 -8
  246. package/dist/core/runner/inline-image.js +11 -9
  247. package/dist/core/runner/memory-consolidation-driver.js +5 -5
  248. package/dist/core/runner/park-commit.d.ts +1 -1
  249. package/dist/core/runner/park-commit.js +3 -0
  250. package/dist/core/runner/permission-rule-lanes.js +1 -1
  251. package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
  252. package/dist/core/runner/prepare-ask-lane.js +2 -1
  253. package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
  254. package/dist/core/runner/prepare-boundary-parks.js +5 -5
  255. package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
  256. package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
  257. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  258. package/dist/core/runner/prepare-config-doors.js +16 -9
  259. package/dist/core/runner/prepare-context-lane.js +2 -0
  260. package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
  261. package/dist/core/runner/prepare-delegation-surface.js +5 -4
  262. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  263. package/dist/core/runner/prepare-file-history.js +3 -12
  264. package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
  265. package/dist/core/runner/prepare-gate-stations.js +4 -3
  266. package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
  267. package/dist/core/runner/prepare-hands-readface.js +19 -6
  268. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
  269. package/dist/core/runner/prepare-inherited-gate.js +22 -31
  270. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  271. package/dist/core/runner/prepare-memory.d.ts +2 -2
  272. package/dist/core/runner/prepare-memory.js +12 -19
  273. package/dist/core/runner/prepare-park-ask.d.ts +4 -6
  274. package/dist/core/runner/prepare-park-ask.js +5 -9
  275. package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
  276. package/dist/core/runner/prepare-policy-chain.js +136 -121
  277. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  278. package/dist/core/runner/prepare-project-context.js +10 -7
  279. package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
  280. package/dist/core/runner/prepare-prompt-inputs.js +10 -20
  281. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  282. package/dist/core/runner/prepare-protocol-tools.js +17 -2
  283. package/dist/core/runner/prepare-run-refs.d.ts +2 -3
  284. package/dist/core/runner/prepare-run-refs.js +4 -1
  285. package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
  286. package/dist/core/runner/prepare-suspend-saga.js +5 -7
  287. package/dist/core/runner/prepare-task.js +44 -28
  288. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  289. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  290. package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
  291. package/dist/core/runner/prepare-wiring-manifest.js +34 -19
  292. package/dist/core/runner/prepare-workspace-restore.js +3 -3
  293. package/dist/core/runner/reply-pricing.d.ts +30 -0
  294. package/dist/core/runner/reply-pricing.js +19 -0
  295. package/dist/core/runner/resume-admission.js +4 -2
  296. package/dist/core/runner/resume-apply.js +6 -1
  297. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  298. package/dist/core/runner/resume-policy-outcome.js +5 -5
  299. package/dist/core/runner/retired-runner-deps.js +4 -1
  300. package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
  301. package/dist/core/runner/role-seat-defaulted.js +40 -0
  302. package/dist/core/runner/run-attachment-seats.js +3 -3
  303. package/dist/core/runner/run-brain-sinks.js +3 -0
  304. package/dist/core/runner/run-git-lane.d.ts +3 -1
  305. package/dist/core/runner/run-git-lane.js +1 -1
  306. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  307. package/dist/core/runner/run-harness-handlers.js +3 -1
  308. package/dist/core/runner/run-identity-wiring.d.ts +2 -5
  309. package/dist/core/runner/run-identity-wiring.js +6 -5
  310. package/dist/core/runner/run-leg.d.ts +2 -0
  311. package/dist/core/runner/run-leg.js +63 -56
  312. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  313. package/dist/core/runner/run-notification-lane.js +16 -10
  314. package/dist/core/runner/run-settle-and-teardown.js +5 -1
  315. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  316. package/dist/core/runner/run-stop-and-final-verify.js +14 -6
  317. package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
  318. package/dist/core/runner/run-terminal-adoption.js +9 -3
  319. package/dist/core/runner/run-turn-boundary.js +89 -77
  320. package/dist/core/runner/runtask.d.ts +8 -5
  321. package/dist/core/runner/runtask.js +21 -13
  322. package/dist/core/runner/side-call-account.d.ts +1 -1
  323. package/dist/core/runner/side-call-account.js +3 -18
  324. package/dist/core/runner/skills-seat.js +2 -2
  325. package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
  326. package/dist/core/runner/sub-agent-deny-lists.js +20 -7
  327. package/dist/core/runner/synthetic-tools.js +2 -2
  328. package/dist/core/runner/tool-disclosure.js +0 -2
  329. package/dist/core/runner/tool-end-body.js +2 -2
  330. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  331. package/dist/core/runner/tool-face-overlay.js +26 -19
  332. package/dist/core/runner/tool-occurrence.d.ts +1 -1
  333. package/dist/core/runner/tool-occurrence.js +2 -2
  334. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  335. package/dist/core/runner/tool-result-media-seat.js +17 -1
  336. package/dist/core/runner/turn-attachments.d.ts +29 -27
  337. package/dist/core/runner/turn-attachments.js +27 -42
  338. package/dist/core/runner-deps.d.ts +32 -19
  339. package/dist/core/secret-env.d.ts +35 -4
  340. package/dist/core/secret-env.js +65 -3
  341. package/dist/core/sensitive-path-policy.js +3 -3
  342. package/dist/core/session-policy-store.d.ts +12 -3
  343. package/dist/core/session-policy-store.js +29 -10
  344. package/dist/core/session-store.d.ts +5 -7
  345. package/dist/core/session-store.js +50 -11
  346. package/dist/core/side-query.d.ts +11 -1
  347. package/dist/core/side-query.js +9 -0
  348. package/dist/core/skill-grant-binding.d.ts +31 -2
  349. package/dist/core/skill-grant-binding.js +31 -1
  350. package/dist/core/skill-grant.d.ts +17 -5
  351. package/dist/core/skill-grant.js +24 -6
  352. package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
  353. package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
  354. package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
  355. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  356. package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
  357. package/dist/core/stub-env.d.ts +5 -5
  358. package/dist/core/stub-env.js +11 -1
  359. package/dist/core/swappable-deps.d.ts +17 -43
  360. package/dist/core/swappable-deps.js +15 -5
  361. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  362. package/dist/core/synthetic-read-verdict.js +2 -1
  363. package/dist/core/task-event.d.ts +50 -10
  364. package/dist/core/task-notification.d.ts +88 -5
  365. package/dist/core/task-notification.js +146 -17
  366. package/dist/core/task-registry-agent.d.ts +18 -12
  367. package/dist/core/task-registry-agent.js +19 -6
  368. package/dist/core/task-registry-monitor.d.ts +7 -0
  369. package/dist/core/task-registry-monitor.js +28 -1
  370. package/dist/core/task-registry-shared.d.ts +43 -3
  371. package/dist/core/task-registry-shared.js +21 -7
  372. package/dist/core/task-registry-workflow.js +1 -1
  373. package/dist/core/task-registry.d.ts +50 -35
  374. package/dist/core/task-registry.js +64 -23
  375. package/dist/core/task-result.d.ts +3 -12
  376. package/dist/core/task-spec.d.ts +15 -7
  377. package/dist/core/task-stream.d.ts +1 -1
  378. package/dist/core/terminal-cause.d.ts +10 -0
  379. package/dist/core/tool-catalog-entries.js +1 -1
  380. package/dist/core/tool-check-reading.d.ts +1 -0
  381. package/dist/core/tool-check-reading.js +3 -3
  382. package/dist/core/tool-face-reader.d.ts +7 -6
  383. package/dist/core/tool-face-reader.js +4 -3
  384. package/dist/core/tool-name-aliases.d.ts +19 -0
  385. package/dist/core/tool-name-aliases.js +54 -2
  386. package/dist/core/tool-policy.d.ts +21 -4
  387. package/dist/core/tool-policy.js +1 -1
  388. package/dist/core/tool-registry.d.ts +5 -5
  389. package/dist/core/tool-registry.js +2 -2
  390. package/dist/core/tool-result-store.d.ts +88 -5
  391. package/dist/core/tool-result-store.js +51 -12
  392. package/dist/core/tool-roster.d.ts +112 -5
  393. package/dist/core/tool-roster.js +42 -1
  394. package/dist/core/tool-spec.d.ts +23 -5
  395. package/dist/core/trace.d.ts +0 -1
  396. package/dist/core/types.d.ts +5 -5
  397. package/dist/core/types.js +2 -2
  398. package/dist/core/untrusted-text.js +1 -1
  399. package/dist/core/user-attachment.d.ts +10 -5
  400. package/dist/core/user-attachment.js +15 -7
  401. package/dist/core/wiring-manifest.d.ts +6 -3
  402. package/dist/engine/compaction/compaction.js +29 -3
  403. package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
  404. package/dist/engine/execution-env/node-execution-env.js +21 -13
  405. package/dist/engine/harness/agent-harness.d.ts +26 -3
  406. package/dist/engine/harness/agent-harness.js +49 -16
  407. package/dist/engine/harness/messages.d.ts +3 -1
  408. package/dist/engine/harness/messages.js +3 -2
  409. package/dist/engine/harness/types.d.ts +119 -28
  410. package/dist/engine/llm/rejected-images.d.ts +46 -0
  411. package/dist/engine/llm/rejected-images.js +54 -0
  412. package/dist/engine/llm/tool-turns.d.ts +2 -1
  413. package/dist/engine/llm/types.d.ts +18 -7
  414. package/dist/engine/loop/agent-loop.d.ts +20 -12
  415. package/dist/engine/loop/agent-loop.js +205 -36
  416. package/dist/engine/loop/types.d.ts +12 -3
  417. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  418. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  419. package/dist/engine/session/path-to-root.d.ts +38 -0
  420. package/dist/engine/session/path-to-root.js +39 -0
  421. package/dist/engine/session/storage-base.js +4 -21
  422. package/dist/index.d.ts +35 -21
  423. package/dist/index.js +26 -17
  424. package/dist/internal/harness-types.d.ts +1 -1
  425. package/dist/internal/harness.d.ts +1 -0
  426. package/dist/internal/llm.d.ts +1 -0
  427. package/dist/orchestration/run-workflow-tool.d.ts +9 -3
  428. package/dist/orchestration/run-workflow-tool.js +59 -29
  429. package/dist/orchestration/workflow-governance.d.ts +1 -1
  430. package/dist/orchestration/workflow-governance.js +2 -1
  431. package/dist/orchestration/workflow-observe.d.ts +17 -1
  432. package/dist/orchestration/workflow-observe.js +20 -0
  433. package/dist/orchestration/workflow-types.d.ts +32 -7
  434. package/dist/orchestration/workflow.d.ts +4 -0
  435. package/dist/orchestration/workflow.js +762 -491
  436. package/dist/prompts/default.d.ts +1 -10
  437. package/dist/prompts/default.js +0 -2
  438. package/dist/shell/counting-pass.d.ts +50 -0
  439. package/dist/shell/counting-pass.js +502 -0
  440. package/dist/shell/lex.d.ts +4 -2
  441. package/dist/shell/lex.js +93 -34
  442. package/dist/shell/shell-words.d.ts +1 -1
  443. package/dist/shell/shell-words.js +7 -6
  444. package/dist/stores/file/background-agent-store.d.ts +1 -1
  445. package/dist/stores/file/background-agent-store.js +3 -1
  446. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  447. package/dist/stores/file/checkpoint-store.js +19 -14
  448. package/dist/stores/file/file-history-store.d.ts +1 -1
  449. package/dist/stores/file/file-history-store.js +3 -1
  450. package/dist/stores/file/index.d.ts +4 -3
  451. package/dist/stores/file/index.js +17 -8
  452. package/dist/stores/file/mailbox-store.d.ts +1 -1
  453. package/dist/stores/file/mailbox-store.js +9 -11
  454. package/dist/stores/file/memory-store.d.ts +1 -1
  455. package/dist/stores/file/memory-store.js +3 -1
  456. package/dist/stores/file/session-policy-store.d.ts +1 -1
  457. package/dist/stores/file/session-policy-store.js +3 -1
  458. package/dist/stores/file/session-store.d.ts +1 -1
  459. package/dist/stores/file/session-store.js +3 -1
  460. package/dist/stores/file/shared-ledger.d.ts +26 -0
  461. package/dist/stores/file/shared-ledger.js +38 -9
  462. package/dist/stores/file/tool-result-store.d.ts +20 -2
  463. package/dist/stores/file/tool-result-store.js +74 -6
  464. package/dist/stores/file/usage-window-store.d.ts +1 -1
  465. package/dist/stores/file/usage-window-store.js +3 -1
  466. package/dist/stores/file/workflow-journal-store.d.ts +1 -11
  467. package/dist/stores/file/workflow-journal-store.js +3 -2
  468. package/dist/tools/fs/containment-face.d.ts +5 -0
  469. package/dist/tools/fs/encoding.d.ts +13 -4
  470. package/dist/tools/fs/encoding.js +17 -2
  471. package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
  472. package/dist/tools/fs/fs-bash-background-text.js +1 -0
  473. package/dist/tools/fs/fs-bash.d.ts +14 -4
  474. package/dist/tools/fs/fs-bash.js +29 -35
  475. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  476. package/dist/tools/fs/fs-pdf.js +26 -21
  477. package/dist/tools/fs/fs-read.d.ts +5 -4
  478. package/dist/tools/fs/fs-read.js +35 -18
  479. package/dist/tools/fs/fs-search-tools.js +4 -1
  480. package/dist/tools/fs/fs-shared.d.ts +11 -13
  481. package/dist/tools/fs/fs-shared.js +11 -7
  482. package/dist/tools/fs/fs-write.js +5 -5
  483. package/dist/tools/fs/index.d.ts +14 -8
  484. package/dist/tools/fs/index.js +13 -5
  485. package/dist/tools/fs/program-read-model.d.ts +13 -0
  486. package/dist/tools/fs/program-read-model.js +15 -0
  487. package/dist/tools/fs/program-read-model.rows.js +1 -1
  488. package/dist/tools/fs/read-deny.d.ts +13 -10
  489. package/dist/tools/fs/read-deny.js +25 -5
  490. package/dist/tools/fs/read-floor.d.ts +62 -0
  491. package/dist/tools/fs/read-floor.js +58 -0
  492. package/dist/tools/fs/removal-targets.d.ts +9 -4
  493. package/dist/tools/fs/removal-targets.js +17 -9
  494. package/dist/tools/fs/search.d.ts +3 -3
  495. package/dist/tools/fs/search.js +4 -4
  496. package/dist/tools/fs/shell-read-check.d.ts +1 -1
  497. package/dist/tools/fs/shell-read-check.js +2 -1
  498. package/dist/tools/fs/shell-read-judge.d.ts +16 -8
  499. package/dist/tools/fs/shell-read-judge.js +10 -6
  500. package/dist/tools/fs/shell-read-plan.d.ts +6 -1
  501. package/dist/tools/fs/shell-read-plan.js +22 -15
  502. package/dist/tools/fs/shell-read-start.js +1 -0
  503. package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
  504. package/dist/tools/fs/shell-reentry-text.js +25 -3
  505. package/dist/tools/monitor.d.ts +9 -4
  506. package/dist/tools/monitor.js +17 -8
  507. package/dist/tools/scheduler-tools.js +42 -4
  508. package/dist/tools/web.d.ts +0 -10
  509. package/dist/tools/web.js +1 -4
  510. package/package.json +5 -2
  511. package/test/export-surface.snapshot.json +161 -21
  512. package/wire-changes/core-stores-sql@7.59.0.json +29 -0
  513. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  514. package/wire-changes/core@7.59.0.json +2459 -0
  515. package/wire-changes/core@7.60.0.json +3274 -0
  516. package/wire-changes/mods-kernel@7.59.0.json +29 -0
  517. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  518. package/wire-changes/primitives@7.59.0.json +29 -0
  519. package/wire-changes/primitives@7.60.0.json +30 -0
@@ -2,7 +2,8 @@
2
2
  * What a Skill card's approval is bound to, as ONE value: the skill the call names and the two lists approving it releases,
3
3
  * in the rule grammar's canonical spelling (de-duplicated, sorted). Its hash is the `boundGrantDigest` a parked approval is
4
4
  * judged by, so a reader holds the list a person approved and the binding that covers it as the same fact — the live
5
- * `AskRequest`, the parked row and the inbox projection all carry it (minted by `skillGrantBindingMembers`).
5
+ * `AskRequest`, the parked row, the inbox projection and the request a Runner hands a policy all carry it (minted by
6
+ * `skillGrantBindingMembers`; on a request through {@link requestGrantBinding}).
6
7
  *
7
8
  * A leaf on purpose: the checkpoint projection reads it at its boundary and may not import the module that mints it (it imports only
8
9
  * the hash).
@@ -18,7 +19,8 @@ export interface BoundSkillGrants {
18
19
  /**
19
20
  * Why a card carries no binding digest — the closed set of `boundGrantAbsence`: `not_bindable` (the call is not an
20
21
  * activation of the engine's `Skill` tool: it binds no grant) or `unreadable` (the card binds a grant and what it binds
21
- * cannot be read: a stored row whose digest is not a string, or that says neither).
22
+ * cannot be read: a stored row whose digest is not a string, or that says neither; a request copied over moved args whose
23
+ * digest the engine did not mint for that call, {@link withArgsBinding}).
22
24
  */
23
25
  export declare const BOUND_GRANT_ABSENCES: readonly ["not_bindable", "unreadable"];
24
26
  export type BoundGrantAbsence = (typeof BOUND_GRANT_ABSENCES)[number];
@@ -63,3 +65,30 @@ export declare function readBoundBinding(row: {
63
65
  } | {
64
66
  boundGrantAbsence: BoundGrantAbsence;
65
67
  };
68
+ /**
69
+ * The grant-binding words of a request a Runner hands a policy — the leg's card factory `of` over the request's own `args` (the members
70
+ * every card of the call carries, by the same function): the digest arm with its value frozen, or the factory's absence word. The digest
71
+ * arm carries a note of how the same call is minted over other args, so a copy of the request over moved args carries the answer for
72
+ * THOSE ({@link withArgsBinding}).
73
+ */
74
+ export declare function requestGrantBinding(of: GrantBindingOf, call: {
75
+ readonly toolName: string;
76
+ }, args: unknown): SkillGrantBindingMembers;
77
+ /** A carrier of a call's binding words — a request or a row: its tool name, its args and the three members, as stored. */
78
+ export interface GrantBindingCarrier {
79
+ readonly toolName?: unknown;
80
+ readonly args: unknown;
81
+ readonly boundGrantDigest?: unknown;
82
+ readonly boundGrants?: unknown;
83
+ readonly boundGrantAbsence?: unknown;
84
+ }
85
+ /**
86
+ * The carrier moved to other args — a copy holding `args` and the binding for THEM (a carrier that holds none moves with none). The
87
+ * binding follows the args by ONE rule: a digest {@link requestGrantBinding} minted for this call is minted again over `args`; a digest
88
+ * with no such note (a clone, a host-built request, a note minted for another call or digest) holds over the same bytes and reads
89
+ * `unreadable` over moved ones — it binds a grant, and what it binds over these args cannot be read here; an absence word holds for any
90
+ * args of the call (args never make a call a `Skill` activation, nor an unreadable binding readable). Every member is read as
91
+ * {@link readBoundBinding} reads a row: a digest that is not a string, or a word outside the set, moves as `unreadable`; lists that do
92
+ * not hash to the digest are dropped (the digest alone holds over the same bytes). Lists a request carries are a frozen copy.
93
+ */
94
+ export declare function withArgsBinding<R extends GrantBindingCarrier>(carrier: R, args: unknown): R;
@@ -1,4 +1,4 @@
1
- import { boundInputHashOf } from "./canonical-json.js";
1
+ import { boundInputHashOf, canonicalize } from "./canonical-json.js";
2
2
  export const BOUND_GRANT_ABSENCES = Object.freeze(["not_bindable", "unreadable"]);
3
3
  const BOUND_GRANT_ABSENCE_SET = new Set(BOUND_GRANT_ABSENCES);
4
4
  const isBoundGrantAbsence = (v) => BOUND_GRANT_ABSENCE_SET.has(v);
@@ -28,3 +28,33 @@ export function readBoundBinding(row) {
28
28
  const word = row.boundGrantAbsence;
29
29
  return { boundGrantAbsence: digest === undefined && isBoundGrantAbsence(word) ? word : "unreadable" };
30
30
  }
31
+ const REMINT = new WeakMap();
32
+ export function requestGrantBinding(of, call, args) {
33
+ const members = of(call, args);
34
+ if (members.boundGrants === undefined)
35
+ return members;
36
+ const boundGrants = frozenGrants(members.boundGrants);
37
+ const toolName = call.toolName;
38
+ REMINT.set(boundGrants, { toolName, digest: members.boundGrantDigest, remint: (moved) => requestGrantBinding(of, { toolName }, moved) });
39
+ return { boundGrantDigest: members.boundGrantDigest, boundGrants };
40
+ }
41
+ export function withArgsBinding(carrier, args) {
42
+ if (carrier.boundGrantDigest === undefined && carrier.boundGrants === undefined && carrier.boundGrantAbsence === undefined)
43
+ return { ...carrier, args };
44
+ return { ...carrier, args, boundGrantDigest: undefined, boundGrants: undefined, boundGrantAbsence: undefined, ...movedBinding(carrier, args) };
45
+ }
46
+ function movedBinding(carrier, args) {
47
+ const grants = carrier.boundGrants;
48
+ const note = typeof grants === "object" && grants !== null ? REMINT.get(grants) : undefined;
49
+ if (note !== undefined && note.digest === carrier.boundGrantDigest && note.toolName === carrier.toolName)
50
+ return note.remint(args);
51
+ const read = readBoundBinding(carrier);
52
+ if (!("boundGrantDigest" in read))
53
+ return read;
54
+ if (canonicalize(args) !== canonicalize(carrier.args))
55
+ return { boundGrantAbsence: "unreadable" };
56
+ return read.boundGrants !== undefined ? { boundGrantDigest: read.boundGrantDigest, boundGrants: frozenGrants(read.boundGrants) } : read;
57
+ }
58
+ function frozenGrants(g) {
59
+ return Object.freeze({ skill: g.skill, allowedTools: Object.freeze([...g.allowedTools]), disallowedTools: Object.freeze([...g.disallowedTools]) });
60
+ }
@@ -46,11 +46,21 @@ export interface SkillGrantSource {
46
46
  * the person's invoked names are read through it ({@link seedSkillGrants}).
47
47
  */
48
48
  export declare function skillNamedBy<T extends Pick<SkillGrantSource, "name">>(args: unknown, skills: readonly T[]): T | undefined;
49
+ /**
50
+ * The listed name a missed `Skill` call most likely meant, for the refusal to say — never to act on ({@link skillNamedBy} stays
51
+ * the ONE resolution: nothing activates, binds or digests under a name the table does not spell exactly). The nearest listed
52
+ * name within two edits ({@link closestName}); failing that, the asked name with the foreign namespace prefix taken off when
53
+ * that bare name is listed. Undefined: nothing near, no `skill` member that is a string, or an empty one.
54
+ */
55
+ export declare function skillNameSuggestion<T extends Pick<SkillGrantSource, "name">>(args: unknown, skills: readonly T[]): string | undefined;
56
+ /** The sentence the refusal of a missed `Skill` call adds for {@link skillNameSuggestion} (leading space included), or `""` when there is nothing to suggest. */
57
+ export declare function skillNameHint<T extends Pick<SkillGrantSource, "name">>(args: unknown, skills: readonly T[]): string;
49
58
  /** The digest of what a Skill card disclosed — `Execute skill: <name>` and the lists approving it releases ({@link skillGrantBinding}). The read point a parked Skill approval binds to (stored beside the row's input binding, compared before the resumed activation). */
50
59
  export declare function skillGrantDigest(skill: Pick<SkillGrantSource, "name" | "allowedTools" | "disallowedTools"> | undefined): string;
51
60
  /**
52
61
  * The card members of a call to the engine's `Skill` tool — the ONE factory every ask spreads them from: the live
53
- * `AskRequest` an approver is handed, an ancestor's, the parked row and (through the row) the inbox projection.
62
+ * `AskRequest` an approver is handed, an ancestor's, the parked row and (through the row) the inbox projection — and, through
63
+ * `requestGrantBinding`, the request a Runner hands a policy (`ToolCallRequest`: the same members over the request's own args).
54
64
  * `boundGrants` is the skill's name and canonical lists, `boundGrantDigest` its hash — the same value, so what a person was
55
65
  * shown and what an approving resume is judged by cannot differ. The binding is a property of the CALL, whoever asked and
56
66
  * however the question was worded. Every other call — and any call when no skill is loaded (no engine `Skill` tool is
@@ -118,9 +128,10 @@ export declare function skillAllowDecision(hit: SkillGrantHit, updatedInput: unk
118
128
  /**
119
129
  * The Skill card's question: the reference implementation's sentence (`Execute skill: <name>`), and — when approving
120
130
  * releases anything — the entries it releases for the rest of the run in this mode (an entry that grants nothing, or
121
- * stands down in this mode, is not named). Deployment text, sanitized and capped.
131
+ * stands down in this mode, is not named — under the leg's `classifyAllShell` in `auto`, no shell entry). Deployment text,
132
+ * sanitized and capped.
122
133
  */
123
- export declare function skillActivationQuestion(skill: SkillGrantSource, mode: PermissionMode | undefined, roster?: ReadonlySet<string>): string;
134
+ export declare function skillActivationQuestion(skill: SkillGrantSource, mode: PermissionMode | undefined, allShell: boolean, roster?: ReadonlySet<string>): string;
124
135
  /** The face the gate and the resumed execution boundary read the table through, bound to the leg's call facts. */
125
136
  export interface SkillGrantLane {
126
137
  /** The allow layer's skill member: what grants this call in this mode, or undefined. */
@@ -150,8 +161,9 @@ export interface SkillGateSeats {
150
161
  }
151
162
  /** The `Skill` tool's per-call seat over the loaded skills: a skill that declares a list states no permission of its own. */
152
163
  export type SkillSeatReader = (args: unknown, mode: PermissionMode | undefined) => PermissionSeatReading | undefined;
153
- /** The reader over these skills (`undefined` when none is loaded): `Execute skill: <name>` for a skill declaring a list. */
154
- export declare function skillSeatReader(skills: readonly SkillGrantSource[], mounted?: MountedToolNames): SkillSeatReader | undefined;
164
+ /** The reader over these skills (`undefined` when none is loaded): `Execute skill: <name>` for a skill declaring a list.
165
+ * `allShell`: the leg's `classifyAllShell` declaration (the card names only what approving releases in the call's mode). */
166
+ export declare function skillSeatReader(skills: readonly SkillGrantSource[], allShell: boolean, mounted?: MountedToolNames): SkillSeatReader | undefined;
155
167
  /**
156
168
  * The gate's seat inputs for one call, composed in ONE place: the mounted instance's static seat (`calledName`), the `Skill`
157
169
  * tool's per-call reader in the leg's live mode (only when the call's wire name is the engine's `Skill` — `skillToolName`),
@@ -5,13 +5,31 @@ import { inlineUntrusted } from "./untrusted-text.js";
5
5
  import { boundInputHashOf } from "./canonical-json.js";
6
6
  import { NOT_BINDABLE } from "./skill-grant-binding.js";
7
7
  import { readToolNameList } from "./tool-name-list.js";
8
- import { allowingRows, autoStripped, compileAllowList, readRuleEntry, inertEntryPhrase, judgeAllowEntries, nonListValueLabel, renderListEntry, spelledListEntry } from "./allow-entry.js";
8
+ import { closestName } from "./task-registry-shared.js";
9
+ import { allowingRows, strippedInAuto, compileAllowList, readRuleEntry, inertEntryPhrase, judgeAllowEntries, nonListValueLabel, renderListEntry, spelledListEntry } from "./allow-entry.js";
9
10
  export const SKILL_GRANT_ORIGINS = Object.freeze(["model", "user", "inherited"]);
10
11
  const FROZEN_SKILL_GRANT_ORIGINS = new Set(["model", "inherited"]);
11
12
  export function skillNamedBy(args, skills) {
12
13
  const named = args?.skill;
13
14
  return typeof named === "string" ? skills.find((s) => s.name === named) : undefined;
14
15
  }
16
+ const FOREIGN_SKILL_NAMESPACE = "anthropic-skills:";
17
+ export function skillNameSuggestion(args, skills) {
18
+ const named = args?.skill;
19
+ if (typeof named !== "string" || named.trim() === "")
20
+ return undefined;
21
+ const nearest = closestName(named, skills.map((s) => s.name));
22
+ if (nearest !== undefined)
23
+ return nearest;
24
+ if (!named.startsWith(FOREIGN_SKILL_NAMESPACE))
25
+ return undefined;
26
+ const bare = named.slice(FOREIGN_SKILL_NAMESPACE.length);
27
+ return skills.some((s) => s.name === bare) ? bare : undefined;
28
+ }
29
+ export function skillNameHint(args, skills) {
30
+ const suggestion = skillNameSuggestion(args, skills);
31
+ return suggestion === undefined ? "" : ` Did you mean ${suggestion}? Invoke it by that full name.`;
32
+ }
15
33
  function readsAsNothingLabel(inert) {
16
34
  return `<reads as nothing (${inert.reason}): ${spelledListEntry(inert.entry)}>`;
17
35
  }
@@ -120,21 +138,21 @@ export function skillAllowDecision(hit, updatedInput) {
120
138
  }
121
139
  const CARD_ENTRIES_MAX = 10;
122
140
  const CARD_ENTRY_MAX_CHARS = 120;
123
- export function skillActivationQuestion(skill, mode, roster) {
141
+ export function skillActivationQuestion(skill, mode, allShell, roster) {
124
142
  const head = `Execute skill: ${inlineUntrusted(skill.name, 200)}`;
125
- const granting = compileSkillGrant(skill, "model", roster).rows.filter((r) => r.behavior === "allow" && !(mode === "auto" && autoStripped(r.compiled, undefined)));
143
+ const granting = compileSkillGrant(skill, "model", roster).rows.filter((r) => r.behavior === "allow" && !strippedInAuto(r.compiled, undefined, mode, allShell));
126
144
  if (granting.length === 0)
127
145
  return head;
128
146
  const shown = granting.slice(0, CARD_ENTRIES_MAX).map((r) => inlineUntrusted(r.entry, CARD_ENTRY_MAX_CHARS));
129
147
  const rest = granting.length - shown.length;
130
148
  return `${head}\nApproving also lets these tools be used without asking for the rest of this run: ${shown.join(", ")}${rest > 0 ? ` and ${rest} more` : ""}`;
131
149
  }
132
- export function skillSeatReader(skills, mounted) {
150
+ export function skillSeatReader(skills, allShell, mounted) {
133
151
  if (skills.length === 0)
134
152
  return undefined;
135
153
  return (args, mode) => {
136
154
  const skill = skillNamedBy(args, skills);
137
- return skill !== undefined && declaresSkillLists(skill) ? { seat: "passthrough", question: skillActivationQuestion(skill, mode, mounted?.()) } : undefined;
155
+ return skill !== undefined && declaresSkillLists(skill) ? { seat: "passthrough", question: skillActivationQuestion(skill, mode, allShell, mounted?.()) } : undefined;
138
156
  };
139
157
  }
140
158
  export function skillGateWiring(opts) {
@@ -233,7 +251,7 @@ export class SkillGrantTable {
233
251
  }
234
252
  lane(ctx) {
235
253
  return {
236
- allowing: (req, mode) => judge(allowingRows(this.rowsHeld, req, mode), req, "allow", ctx),
254
+ allowing: (req, mode) => judge(allowingRows(this.rowsHeld, req, mode, ctx.classifyAllShell === true), req, "allow", ctx),
237
255
  denying: (req) => judge(this.rowsHeld, req, "deny", ctx) ?? this.activationRefused(req),
238
256
  };
239
257
  }
@@ -1,5 +1,6 @@
1
1
  import { strict as assert } from "node:assert";
2
2
  import { STALE_RUNNING_REAP_ATTRIBUTION, } from "../background-agent-store.js";
3
+ import { CLAMP_SEATS, CLAMP_SET } from "../child-clamp-seats.js";
3
4
  import { beginContract } from "./contract-harness.js";
4
5
  export const BACKGROUND_AGENT_CONTRACT_SCOPE = "tenant-A";
5
6
  function record(over = {}) {
@@ -72,6 +73,32 @@ export async function backgroundAgentStoreContract(mk, runAssertion) {
72
73
  assert.deepEqual(afterCas.admittedOrgScopes, ["org:acme"]);
73
74
  assert.equal(afterCas.admittedOrgWriteScope, null);
74
75
  });
76
+ run("the birth floor round-trips verbatim — `{}` stays `{}`, ABSENT stays absent, a CAS carries it", async (make) => {
77
+ const store = make();
78
+ const restricting = Object.fromEntries(CLAMP_SEATS.flatMap((seat) => {
79
+ const row = CLAMP_SET[seat];
80
+ if (row.law !== "restricting")
81
+ return [];
82
+ const field = row.field;
83
+ return [[seat, field === undefined ? row.value : { [field]: row.value }]];
84
+ }));
85
+ const floor = { ...restricting, readDenyPatterns: [".ssh", { pattern: "Secrets", caseSensitive: true }] };
86
+ await store.put(record({ handle: "a1", policyFloor: floor }));
87
+ assert.deepEqual((await held(store, "a1")).policyFloor, floor);
88
+ await store.put(record({ handle: "a2", policyFloor: {} }));
89
+ assert.deepEqual((await held(store, "a2")).policyFloor, {}, "an empty floor is a statement — it must not read back absent");
90
+ await store.put(record({ handle: "a3" }));
91
+ const untouched = await held(store, "a3");
92
+ assert.equal(untouched.policyFloor, undefined, "a row that states no floor must not read back with one");
93
+ for (const handle of ["a1", "a2"]) {
94
+ const before = await held(store, handle);
95
+ assert.equal(await store.update(handle, S, { ...before, status: "completed", settledAt: 2_000 }, { rev: before.rev }), true, `a CAS on a floor-bearing row (${handle}) must land`);
96
+ const after = await held(store, handle);
97
+ assert.equal(after.status, "completed");
98
+ assert.equal(after.rev, before.rev + 1);
99
+ assert.deepEqual(after.policyFloor, before.policyFloor, `a CAS update must carry the floor it did not change (${handle})`);
100
+ }
101
+ });
75
102
  run("put refuses a scopeless row (a row with no tenant partition would be world-readable)", async (make) => {
76
103
  const store = make();
77
104
  await assert.rejects(store.put(record({ scope: "" })), "an empty scope must be refused loudly, not stored");
@@ -308,7 +308,7 @@ export async function checkpointStoreContract(make, runAssertion, options = {})
308
308
  const stored = (await store.get(bitless.token)).pendingAction;
309
309
  assert.equal("hasBidiControls" in stored, false, "projection backfill must not write back to the row");
310
310
  });
311
- run("the approval object's members: a row's identity + face group and its targets (capabilityId/contractId/shapeDigest/implementationRevision + family/pathTarget/hostTarget/names + targets + targetReads + engineMounted) survive the round-trip verbatim; an absent group stays absent", async () => {
311
+ run("the approval object's members: a row's identity + face group and its targets (capabilityId/contractId/shapeDigest/implementationRevision + family/pathTarget/hostTarget/names + targets + targetReads + engineMounted + declarationDigest) survive the round-trip verbatim; an absent group stays absent", async () => {
312
312
  const store = make();
313
313
  const carried = createCheckpointFixture({ token: mintCheckpointToken(), sessionId: "id-carried" });
314
314
  const group = {
@@ -322,6 +322,7 @@ export async function checkpointStoreContract(make, runAssertion, options = {})
322
322
  targets: { protective: "/srv/work/out.txt", declared: "/srv/work/out.txt" },
323
323
  targetReads: { ["0123456789abcdef".repeat(4)]: "fedcba9876543210".repeat(4) },
324
324
  engineMounted: true,
325
+ declarationDigest: "0123456789abcdef".repeat(4),
325
326
  };
326
327
  Object.assign(carried.pendingAction, group);
327
328
  const bare = createCheckpointFixture({ token: mintCheckpointToken(), sessionId: "id-bare" });
@@ -332,7 +333,7 @@ export async function checkpointStoreContract(make, runAssertion, options = {})
332
333
  assert.deepEqual(back[k], v, `the row's ${k} must survive the round-trip verbatim (a whitelisting serializer that drops it makes every resume-edit recheck judge by the catalog's slot for the NAME)`);
333
334
  const bareBack = (await store.get(bare.token)).pendingAction;
334
335
  for (const k of Object.keys(group))
335
- assert.equal(k in bareBack, false, `an absent ${k} must stay OMITTED (a pre-388 row reads name-only, never a partial face)`);
336
+ assert.equal(k in bareBack, false, `an absent ${k} must stay OMITTED (a row without its tool member binds no tool, never a partial one)`);
336
337
  const fetchRow = createCheckpointFixture({ token: mintCheckpointToken(), sessionId: "id-host" });
337
338
  Object.assign(fetchRow.pendingAction, { ...group, family: "web", pathTarget: undefined, targets: undefined, hostTarget: { param: "url" } });
338
339
  delete fetchRow.pendingAction.pathTarget;
@@ -1,5 +1,5 @@
1
1
  import { strict as assert } from "node:assert";
2
- import { MAILBOX_INVALID_PEER_META_CODE, MAILBOX_INVALID_DECISION_MOVE_CODE, MAILBOX_TOMBSTONED_RECIPIENT_CODE } from "../mailbox-store.js";
2
+ import { MAILBOX_DUPLICATE_RECORD_ID_CODE, MAILBOX_INVALID_PEER_META_CODE, MAILBOX_INVALID_DECISION_MOVE_CODE, MAILBOX_INVALID_RECORD_ID_CODE, MAILBOX_TOMBSTONED_RECIPIENT_CODE } from "../mailbox-store.js";
3
3
  import { beginContract } from "./contract-harness.js";
4
4
  import { PRINCIPAL_INBOX_HANDLE } from "../../agents/cross-session-ref.js";
5
5
  import { mintCrossPrincipalRecord } from "../../agents/org-delivery-gate.js";
@@ -50,6 +50,36 @@ export async function mailboxStoreContract(mk, runAssertion) {
50
50
  await s.ack(S, "a1", "w3", 1);
51
51
  assert.equal(await s.append(S, "a1", msg("m2")), 2);
52
52
  });
53
+ run("记录身份:箱持有同 id 时 append = 同记录回原 seq 零写 / 异记录点名拒;坏 id 零副作用拒;id 往返;ack 后 id 自由", async (make) => {
54
+ const s = make();
55
+ const codeOf = async (p) => {
56
+ try {
57
+ await p;
58
+ return undefined;
59
+ }
60
+ catch (e) {
61
+ return e.code;
62
+ }
63
+ };
64
+ const rec = { id: "frame-1", from: "w", content: "m1", sentAt: 1000, hopChain: ["h"], peerMeta: { kind: "peer_message", fromRoot: "root" } };
65
+ assert.equal(await s.append(S, "a1", rec), 1);
66
+ assert.equal(await s.append(S, "a1", { ...rec, sentAt: 5000 }), 1, "同记录再写(写入时刻不同)= 重放,回原 seq");
67
+ assert.equal(await s.peekCount(S, "a1"), 1, "重放零写");
68
+ for (const changed of [{ content: "m1'" }, { from: "x" }, { hopChain: [] }, { peerMeta: undefined }]) {
69
+ assert.equal(await codeOf(s.append(S, "a1", { ...rec, ...changed })), MAILBOX_DUPLICATE_RECORD_ID_CODE, JSON.stringify(changed));
70
+ }
71
+ for (const bad of ["", 7, null]) {
72
+ const raw = JSON.parse(JSON.stringify({ id: bad, content: "c", sentAt: 1 }));
73
+ assert.equal(await codeOf(s.append(S, "a1", raw)), MAILBOX_INVALID_RECORD_ID_CODE, String(bad));
74
+ }
75
+ assert.equal(await s.peekCount(S, "a1"), 1, "被拒的调用零副作用");
76
+ assert.equal(await s.append(S, "a1", msg("plain")), 2, "无 id = 新记录");
77
+ assert.equal(await s.append(S, "a2", rec), 1, "同 id 在别的箱 = 别的记录");
78
+ const lease = await s.claimLease(S, "a1", "w1", 60_000, 10_000);
79
+ assert.deepEqual(lease.messages.map((m) => m.id), ["frame-1", undefined], "id 往返,缺席仍缺席");
80
+ await s.ack(S, "a1", "w1", lease.maxSeq);
81
+ assert.equal(await s.append(S, "a1", rec), 3, "箱只为它持有的记录作答:ack 后同 id 是新记录");
82
+ });
53
83
  run("lease 窗内 append:后到消息在下次 claim 时可见(lease 只覆盖 claim 时刻快照)", async (make) => {
54
84
  const s = make();
55
85
  await s.append(S, "a1", msg("m1"));
@@ -20,6 +20,6 @@ import { type ContractAssertionRunner } from "./contract-harness.js";
20
20
  * exactly the divergence the two legs above exist to prevent.
21
21
  */
22
22
  export declare function toolResultStoreContract(make: () => ToolResultStore, runAssertion?: ContractAssertionRunner, onOptionalMember?: (report: {
23
- member: "deleteBySession";
23
+ member: "deleteBySession" | "listBySession";
24
24
  status: "verified" | "absent";
25
25
  }) => void): Promise<void>;
@@ -80,5 +80,42 @@ export async function toolResultStoreContract(make, runAssertion, onOptionalMemb
80
80
  assert.equal((await store.get("tr_sweep~other")).content, "OTHER-bytes");
81
81
  onOptionalMember?.({ member: "deleteBySession", status: "verified" });
82
82
  });
83
+ run("listBySession (optional): the sweep's selection, read-only; absence is REPORTED, not silently green", async () => {
84
+ const probe = make();
85
+ if (probe.listBySession === undefined) {
86
+ onOptionalMember?.({ member: "listBySession", status: "absent" });
87
+ return;
88
+ }
89
+ assert.equal(typeof probe.listBySession, "function", `listBySession is present but not callable (got ${typeof probe.listBySession}) — a garbage member is a DEFECT, not an optional-member absence`);
90
+ const store = make();
91
+ const list = async (sessionId) => Promise.resolve(store.listBySession(sessionId));
92
+ const refsOf = (l) => l.entries.map((e) => e.ref).sort();
93
+ await store.put("tr_list~a", "A-bytes", { sessionId: "sess-L", taskId: "t1" });
94
+ await store.put("tr_list~b", "B-bytes", { sessionId: "sess-L" });
95
+ await store.put("tr_list~other", "OTHER-bytes", { sessionId: "sess-M" });
96
+ await store.put("tr_list~unowned", "UNOWNED-bytes");
97
+ const first = await list("sess-L");
98
+ assert.deepEqual(refsOf(first), ["tr_list~a", "tr_list~b"], "the session's rows, and only those, are listed");
99
+ const byRef = new Map(first.entries.map((e) => [e.ref, e.provenance]));
100
+ assert.deepEqual(byRef.get("tr_list~a"), { sessionId: "sess-L", taskId: "t1" }, "the recorded owner rides the entry, taskId included");
101
+ assert.deepEqual(byRef.get("tr_list~b"), { sessionId: "sess-L" }, "a session-only owner carries no taskId");
102
+ assert.equal(first.unaddressable, 0, "every row here was written by this store: none is unaddressable (the count is for rows written before the ref was recorded, never a second kind)");
103
+ assert.equal((await store.get("tr_list~a")).content, "A-bytes");
104
+ assert.deepEqual(await store.ownerOf("tr_list~a"), byRef.get("tr_list~a"), "the listed owner is the one ownerOf answers");
105
+ assert.equal(refsOf(first).includes("tr_list~other"), false, "another session's row is not listed");
106
+ assert.equal(refsOf(first).includes("tr_list~unowned"), false, "an unowned row is never listed");
107
+ assert.equal(first.unattributable >= 1, true, "an unowned row is counted unattributable");
108
+ const none = await list("sess-nobody");
109
+ assert.deepEqual(none.entries, [], "a session with no entries lists none");
110
+ assert.deepEqual(refsOf(await list("sess-L")), refsOf(first), "listing deletes and changes nothing");
111
+ assert.equal((await store.get("tr_list~b")).content, "B-bytes", "a listing leaves the bytes where they were");
112
+ if (store.deleteBySession !== undefined) {
113
+ const swept = await Promise.resolve(store.deleteBySession("sess-L"));
114
+ assert.equal(swept.deleted, first.entries.length + first.unaddressable, "the sweep deletes exactly the listed rows and the ones the listing counted but could not name");
115
+ assert.deepEqual((await list("sess-L")).entries, [], "a swept session lists nothing");
116
+ assert.equal((await store.get("tr_list~other")).content, "OTHER-bytes", "another session's row survives the sweep");
117
+ }
118
+ onOptionalMember?.({ member: "listBySession", status: "verified" });
119
+ });
83
120
  await settle();
84
121
  }
@@ -1,4 +1,4 @@
1
- import { type ExecResult, type ExecutionEnv, ExecutionError, FileError, type FileInfo, type Result } from "../internal/harness.js";
1
+ import { type ExecResult, type ExecutionEnv, type ExecutionEnvCapabilities, ExecutionError, FileError, type FileInfo, type Result } from "../internal/harness.js";
2
2
  /**
3
3
  * A no-op ExecutionEnv for tool/MCP-only deployments (no shell, no filesystem).
4
4
  *
@@ -8,10 +8,10 @@ import { type ExecResult, type ExecutionEnv, ExecutionError, FileError, type Fil
8
8
  */
9
9
  export declare class StubExecutionEnv implements ExecutionEnv {
10
10
  cwd: string;
11
- /** design/380 O9a — declared on the class so the prepare fold can read the optional interface
12
- * member off a `ExecutionEnv | StubExecutionEnv` union; the no-I/O stub produces no target
13
- * content, so it never declares (always `undefined` — the trusted-side default). */
14
- readonly externalContentTarget?: boolean;
11
+ /** `ExecutionEnv.capabilities`: no target at all (`io: false`) — every operation refuses, so it produces no outside
12
+ * content, names no path that is not the engine host's, and keeps the byte floor by refusing every start
13
+ * (`keepsReadFloor: true`). A subclass that overrides operations with real I/O states its own block. */
14
+ readonly capabilities: ExecutionEnvCapabilities;
15
15
  /** `ExecutionEnv.cdPath`: the stub runs no shell, so no shell receives a `CDPATH`. */
16
16
  readonly cdPath: readonly string[];
17
17
  /** `ExecutionEnv.withheldEnv`: no shell child, so nothing is withheld from one. */
@@ -1,7 +1,17 @@
1
1
  import { ExecutionError, FileError, err, } from "../internal/harness.js";
2
+ const STUB_ENV_CAPABILITIES = Object.freeze({
3
+ isolation: false,
4
+ suspendable: false,
5
+ sharesProcessTable: true,
6
+ canonicalPathAuthoritative: false,
7
+ hostLocalPaths: true,
8
+ externalContentTarget: false,
9
+ io: false,
10
+ keepsReadFloor: true,
11
+ });
2
12
  export class StubExecutionEnv {
3
13
  cwd;
4
- externalContentTarget;
14
+ capabilities = STUB_ENV_CAPABILITIES;
5
15
  cdPath = [];
6
16
  withheldEnv = [];
7
17
  constructor(cwd = "/") {
@@ -1,41 +1,3 @@
1
- /**
2
- * The deployment seats a Runner may HOT-SWAP after construction — the vocabulary behind the ONE door,
3
- * `Runner.swapDeps` (runtask.ts).
4
- *
5
- * WHY ONE DOOR. Each hot-swappable seat used to be a verb of its own (`swapModels` was the first), and a
6
- * verb per seat restates the same three laws every time — validate the candidate BEFORE anything is
7
- * written, write the deps object ONCE (a swap is atomic: a refused candidate leaves the current deps
8
- * byte-identical), announce the change under a notice code — while the question "which seats may be
9
- * swapped at all" was answered by the list of verbs, i.e. by nothing a compiler could see. With one door
10
- * the laws are stated once, the swappable set is THIS closed list, and every seat carries its rows in
11
- * the tables beside it: the compiler refuses a member without its rows ({@link AssertAllKeysHandled}),
12
- * the door refuses a key outside the set at run time (never a silent ignore — a hot-config driver
13
- * handing `{ brain }` must learn that the brain is not a swappable seat, not watch nothing happen).
14
- *
15
- * WHAT A SWAP MEANS — the natural snapshot, one sentence for every ROUTING seat: a running task reads the
16
- * deps object it was handed at its prepare and holds that reference; a swap replaces the Runner's object, so
17
- * every LATER prepare reads the new seat and every in-flight leg keeps the value it prepared under.
18
- * Nothing is re-routed, re-priced or re-fenced mid-run; the divergence window is exactly the in-flight
19
- * legs' lifetime, by design (the `swapModels` precedent).
20
- *
21
- * …WITH ONE SEAT OUTSIDE IT, and the boundary is the point rather than the exception: `contextSettings` is
22
- * read LIVE by in-flight legs. The snapshot law protects the routing CARD — a request already in flight must
23
- * reach the endpoint it was priced, credentialed and fenced for, and re-reading any of that mid-run buys
24
- * nothing and breaks the request. A leg's usable WINDOW is not on that card: it is a setting about how much
25
- * conversation may accumulate before the leg summarizes, the reference implementation keeps it off the model
26
- * object for exactly this reason and re-reads it on every request (clamped to the model's physical window),
27
- * and an operator who lowers it is asking the legs running RIGHT NOW to compact sooner — which is the whole
28
- * request. So the window declarations live on their own seat (`context-settings.ts`), keyed by catalog word,
29
- * and the legs read them at every boundary, every recovery pass, the end-of-task summary and every request
30
- * build. Routing stays snapshotted; geometry follows the operator. The two are not the same question, and
31
- * one law over both could only be wrong about one of them.
32
- *
33
- * KEY PRESENCE IS THE INSTRUCTION: a key present on the candidate is REPLACED (an explicit `undefined`
34
- * CLEARS an optional seat back to its engine default — `readFace: undefined` ⇒ the deployment declares
35
- * no read face, `tiers: undefined` ⇒ no tier bindings); a key absent is KEPT. `Object.hasOwn`, never
36
- * truthiness, so the two spellings cannot be confused. An EMPTY candidate is refused: a swap that names
37
- * no seat is a caller defect, not a no-op.
38
- */
39
1
  import type { AssertAllKeysHandled } from "./ask-origin.js";
40
2
  import type { RunnerDeps } from "./runner-deps.js";
41
3
  import { type ReadDenyDeploymentSeat } from "./read-face-seats.js";
@@ -60,12 +22,13 @@ import { type ReadDenyDeploymentSeat } from "./read-face-seats.js";
60
22
  * - `contextSettings` — the per-model context-window overlay ({@link RunnerDeps.contextSettings}); screened
61
23
  * by the same value gate construction applies (`assertContextSettingsValue`). THE ONE SEAT
62
24
  * IN-FLIGHT LEGS RE-READ — see the header: it carries geometry, not route.
63
- * - `readDenyPatterns` / `readDenyBuiltinTiers` / `readDenyBuiltinExclude` — the deployment's read-deny
64
- * declaration (additions, built-in tier selection, built-in row removal); screened by the
65
- * gates a prepare applies ({@link screenReadDenySeat}). A resumed leg compiles against the
66
- * seats in force at its prepare (the checkpoint keeps additions only, stricter-wins).
25
+ * - `readDenyPatterns` / `readDenyBuiltinTiers` / `readDenyBuiltinExclude` / `readDenyFloorRequired` — the
26
+ * deployment's read-deny declaration (additions, built-in tier selection, built-in row removal,
27
+ * whether the byte floor must be kept); screened by the gates a prepare applies
28
+ * ({@link screenReadDenySeat}). A resumed leg compiles against the seats in force at its prepare
29
+ * (the checkpoint keeps additions only, stricter-wins).
67
30
  */
68
- export declare const SWAPPABLE_DEP_SEATS: readonly ["models", "tiers", "readFace", "writeFace", "contextSettings", "readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude"];
31
+ export declare const SWAPPABLE_DEP_SEATS: readonly ["models", "tiers", "readFace", "writeFace", "contextSettings", "readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude", "readDenyFloorRequired"];
69
32
  export type SwappableDepSeat = (typeof SWAPPABLE_DEP_SEATS)[number];
70
33
  /** The candidate a swap takes: the swappable seats of {@link RunnerDeps}, each optional (presence = instruction). */
71
34
  export type SwappableDeps = Pick<RunnerDeps, SwappableDepSeat>;
@@ -85,6 +48,7 @@ export declare const SWAP_SEAT_NOTICE: {
85
48
  readonly readDenyPatterns: "config.read_deny_swapped";
86
49
  readonly readDenyBuiltinTiers: "config.read_deny_swapped";
87
50
  readonly readDenyBuiltinExclude: "config.read_deny_swapped";
51
+ readonly readDenyFloorRequired: "config.read_deny_swapped";
88
52
  };
89
53
  /** The fence over the notice table: `never` while every seat has a row. */
90
54
  export type SwapNoticeTableCoversEverySeat = AssertAllKeysHandled<Exclude<SwappableDepSeat, keyof typeof SWAP_SEAT_NOTICE>>;
@@ -114,6 +78,16 @@ export interface ScreenedSwappableDeps {
114
78
  * `assertContainmentFaceValue`), so a value the door admits is a value every later prepare admits.
115
79
  */
116
80
  export declare function screenSwappableDeps(next: unknown): ScreenedSwappableDeps;
81
+ /**
82
+ * The identity of a model-catalog generation as the swap announces it: a digest of the catalog's KEY MATERIAL — the model names the
83
+ * candidate declares and the tier bindings over them (each tier word, and the catalog word it binds; a binding that is a `Model` object
84
+ * has no word, so it stands as `null`) — never the catalog's content. Names and tier words are sorted, so the digest does not depend on
85
+ * the order a driver spelled them in; it depends on nothing but those two tables, so every Runner a driver swaps to the SAME model names
86
+ * under the SAME tier bindings announces the SAME generation (each notice still mints its own `occurrenceId`), and a swap that ends on
87
+ * another model name or another tier binding announces another. Two generations with equal key material read as one; the digest names what a consumer can tell apart
88
+ * from the line, which is the keys — the line is an operator breadcrumb, not a content fingerprint.
89
+ */
90
+ export declare function catalogGenerationOf(models: Readonly<Record<string, unknown>>, tiers: Readonly<Record<string, unknown>> | undefined): string;
117
91
  /**
118
92
  * Announce a swap of the deployment's read-deny declaration, after the write: ONE `config.read_deny_swapped`
119
93
  * line however many of its three seats the swap named (the line's contract lives at the notice catalog,
@@ -1,9 +1,11 @@
1
+ import { createHash } from "node:crypto";
1
2
  import { assertContainmentFaceValue } from "../tools/fs/containment-face.js";
2
3
  import { assertContextSettingsValue } from "./context-settings.js";
3
4
  import { READ_DENY_DEPLOYMENT_SEATS, screenReadDenySeat } from "./read-face-seats.js";
4
5
  import { deliverEngineNotice } from "./engine-notice.js";
5
6
  import { uuidv7 } from "../internal/harness.js";
6
- export const SWAPPABLE_DEP_SEATS = Object.freeze(["models", "tiers", "readFace", "writeFace", "contextSettings", "readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude"]);
7
+ import { receiveOwnProperties } from "./own-property-receipt.js";
8
+ export const SWAPPABLE_DEP_SEATS = Object.freeze(["models", "tiers", "readFace", "writeFace", "contextSettings", "readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude", "readDenyFloorRequired"]);
7
9
  const SWAPPABLE_DEP_SEAT_SET = new Set(SWAPPABLE_DEP_SEATS);
8
10
  export function isSwappableDepSeat(k) {
9
11
  return SWAPPABLE_DEP_SEAT_SET.has(k);
@@ -17,6 +19,7 @@ export const SWAP_SEAT_NOTICE = {
17
19
  readDenyPatterns: "config.read_deny_swapped",
18
20
  readDenyBuiltinTiers: "config.read_deny_swapped",
19
21
  readDenyBuiltinExclude: "config.read_deny_swapped",
22
+ readDenyFloorRequired: "config.read_deny_swapped",
20
23
  };
21
24
  export function screenSwappableDeps(next) {
22
25
  if (next === null || typeof next !== "object" || Array.isArray(next)) {
@@ -40,7 +43,7 @@ export function screenSwappableDeps(next) {
40
43
  if (v === null || typeof v !== "object" || Array.isArray(v)) {
41
44
  throw new Error(`swapDeps: models must be a plain Record<string, Model> (got ${v === null ? "null" : Array.isArray(v) ? "array" : typeof v}) — the current generation stays in force`);
42
45
  }
43
- candidate.models = { ...v };
46
+ candidate.models = receiveOwnProperties(v, { subject: "swapDeps.models", unit: "entry", moment: "at swapDeps" });
44
47
  break;
45
48
  case "tiers":
46
49
  if (!present.includes("models")) {
@@ -49,7 +52,7 @@ export function screenSwappableDeps(next) {
49
52
  if (v !== undefined && (v === null || typeof v !== "object" || Array.isArray(v))) {
50
53
  throw new Error(`swapDeps: tiers must be a plain Record<string, ModelRef> or undefined (got ${v === null ? "null" : Array.isArray(v) ? "array" : typeof v}) — the current generation stays in force`);
51
54
  }
52
- candidate.tiers = v === undefined ? undefined : { ...v };
55
+ candidate.tiers = v === undefined ? undefined : receiveOwnProperties(v, { subject: "swapDeps.tiers", unit: "binding", moment: "at swapDeps" });
53
56
  break;
54
57
  case "readFace":
55
58
  candidate.readFace = assertContainmentFaceValue(v, "read", "deps");
@@ -63,6 +66,7 @@ export function screenSwappableDeps(next) {
63
66
  case "readDenyPatterns":
64
67
  case "readDenyBuiltinTiers":
65
68
  case "readDenyBuiltinExclude":
69
+ case "readDenyFloorRequired":
66
70
  candidate[seat] = screenReadDenySeat(seat, v);
67
71
  break;
68
72
  default: {
@@ -73,6 +77,11 @@ export function screenSwappableDeps(next) {
73
77
  }
74
78
  return { seats: present, candidate: candidate };
75
79
  }
80
+ export function catalogGenerationOf(models, tiers) {
81
+ const names = Object.keys(models).sort();
82
+ const bindings = tiers === undefined ? [] : Object.keys(tiers).sort().map((tier) => [tier, typeof tiers[tier] === "string" ? tiers[tier] : null]);
83
+ return `cgv1:${createHash("sha256").update(JSON.stringify([names, bindings])).digest("hex")}`;
84
+ }
76
85
  export function announceReadDenySwap(onNotice, seats, inForce) {
77
86
  const named = READ_DENY_DEPLOYMENT_SEATS.filter((s) => seats.includes(s));
78
87
  if (named.length === 0)
@@ -80,9 +89,10 @@ export function announceReadDenySwap(onNotice, seats, inForce) {
80
89
  const patterns = inForce.readDenyPatterns?.length ?? null;
81
90
  const tiers = inForce.readDenyBuiltinTiers !== undefined ? [...inForce.readDenyBuiltinTiers] : null;
82
91
  const exclude = inForce.readDenyBuiltinExclude?.length ?? null;
92
+ const floorRequired = inForce.readDenyFloorRequired ?? null;
83
93
  deliverEngineNotice(onNotice, {
84
94
  code: "config.read_deny_swapped",
85
- message: `deployment read-deny declaration swapped (${named.join(", ")}): ${patterns ?? "no"} addition(s), built-in tiers ${tiers === null ? "(default)" : `[${tiers.join(", ")}]`}, ${exclude ?? "no"} built-in row removal(s); in-flight legs keep the deny face they prepared under, new legs compile against the new declaration`,
86
- detail: { seats: named, patterns, tiers, exclude, occurrenceId: uuidv7() },
95
+ message: `deployment read-deny declaration swapped (${named.join(", ")}): ${patterns ?? "no"} addition(s), built-in tiers ${tiers === null ? "(default)" : `[${tiers.join(", ")}]`}, ${exclude ?? "no"} built-in row removal(s), byte floor ${floorRequired === true ? "required" : "not required"}; in-flight legs keep the deny face they prepared under, new legs compile against the new declaration`,
96
+ detail: { seats: named, patterns, tiers, exclude, floorRequired, occurrenceId: uuidv7() },
87
97
  });
88
98
  }
@@ -57,7 +57,7 @@
57
57
  * waiting for that layer (the layer answered, or its share of the judgment's budget is spent) or when the run's signal ends.
58
58
  * An abort means only that: the task ended, or the judge no longer waits — never "there is no approver". Every engine
59
59
  * policy factory reads the statement before reaching a seat (the approval factory answers a deny attested `no_approver`,
60
- * read here as `approval_seat`; the inherited PreToolUse constraint does the same before invoking its hook), and the
60
+ * read here as `approval_seat`; an inherited screening installation is no policy layer here, as a leg's own PreToolUse is not), and the
61
61
  * engine's own guards composed into a deployment's policy judge the probe as they judge a call — a lookup bounded by a
62
62
  * live deadline answers. A deny that carries no engine settlement is a rule's deny and stands. RESIDUALS (stated, not
63
63
  * closed): a deployment closure that ignores the statement and reaches an approver IS asked — the judge waits for it at
@@ -2,6 +2,7 @@ import { callTargetReadingOf } from "./effective-path-target.js";
2
2
  import { advertisedWritableRootsSeat, attestationOf, describeThrown, exemptRootsSeat, refuseOutOfContractDecision } from "./tool-policy.js";
3
3
  import { ownedClearanceFacts, ruleClearanceOf } from "./ask-origin.js";
4
4
  import { skillRowRefusal } from "./skill-grant.js";
5
+ import { NOT_BINDABLE } from "./skill-grant-binding.js";
5
6
  import { applyPersistedTightening } from "./persisted-rule-arms.js";
6
7
  import { readOrgRuleLane, readPersistedRuleLane } from "./rule-lane-reads.js";
7
8
  import { ORG_ADJUDICATION_TIMEOUT_MS, settleOrgVerdictWithin } from "./permission-rule-org.js";
@@ -79,7 +80,7 @@ function createProbeJudge(layers, kind) {
79
80
  return async (unstated, budget) => {
80
81
  const deadlineAt = budget?.deadlineAt ?? Date.now() + ORG_ADJUDICATION_TIMEOUT_MS;
81
82
  const left = () => Math.max(0, Math.min(ORG_ADJUDICATION_TIMEOUT_MS, deadlineAt - Date.now()));
82
- const probe = { ...unstated, approvalReach: "none" };
83
+ const probe = { ...unstated, approvalReach: "none", ...NOT_BINDABLE };
83
84
  const probedArgs = structuredClone(probe.args);
84
85
  const stamped = layers.stampCallTarget?.(probe, layers.signal);
85
86
  const req = stamped !== undefined ? await stamped : probe;