@sema-agent/core 7.72.0 → 7.74.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 (375) hide show
  1. package/CHANGELOG.md +565 -0
  2. package/dist/agents/inherited-tool-pool.d.ts +26 -1
  3. package/dist/agents/inherited-tool-pool.js +46 -2
  4. package/dist/agents/list-agents-tool.js +1 -1
  5. package/dist/agents/parked-resume-drive.d.ts +10 -0
  6. package/dist/agents/parked-resume-drive.js +9 -0
  7. package/dist/agents/retain-ledger.d.ts +3 -0
  8. package/dist/agents/retain-ledger.js +3 -3
  9. package/dist/agents/send-message-tool.js +5 -4
  10. package/dist/agents/send-user-message-tool.d.ts +12 -0
  11. package/dist/agents/send-user-message-tool.js +67 -0
  12. package/dist/agents/subagent-steps.d.ts +9 -0
  13. package/dist/agents/subagent-steps.js +38 -0
  14. package/dist/agents/subagent.d.ts +2 -0
  15. package/dist/agents/subagent.js +43 -12
  16. package/dist/agents/verify.js +23 -8
  17. package/dist/agents/yield-adoption.js +3 -1
  18. package/dist/brain/anthropic.d.ts +42 -1
  19. package/dist/brain/anthropic.js +68 -13
  20. package/dist/brain/failover.d.ts +5 -0
  21. package/dist/brain/failover.js +51 -22
  22. package/dist/brain/model-lane.d.ts +12 -3
  23. package/dist/brain/model-lane.js +5 -5
  24. package/dist/brain/open-responses.js +7 -8
  25. package/dist/brain/openai.js +31 -24
  26. package/dist/brain/route-adjudicator.d.ts +33 -4
  27. package/dist/brain/route-adjudicator.js +49 -12
  28. package/dist/brain/stream-engine.js +166 -156
  29. package/dist/brain/stream-shared.d.ts +4 -3
  30. package/dist/brain/stream-shared.js +2 -2
  31. package/dist/core/actions-digest.d.ts +43 -0
  32. package/dist/core/actions-digest.js +22 -0
  33. package/dist/core/allow-entry.js +4 -4
  34. package/dist/core/ask-class.d.ts +2 -2
  35. package/dist/core/ask-headline.d.ts +1 -1
  36. package/dist/core/ask-origin.d.ts +44 -4
  37. package/dist/core/ask-origin.js +29 -10
  38. package/dist/core/auto-mode.d.ts +7 -9
  39. package/dist/core/auto-mode.js +114 -8
  40. package/dist/core/background-agent-store.d.ts +1 -0
  41. package/dist/core/background-agent-store.js +49 -8
  42. package/dist/core/checkpoint-features.d.ts +3 -2
  43. package/dist/core/checkpoint-features.js +1 -1
  44. package/dist/core/checkpoint-rekey.d.ts +1 -1
  45. package/dist/core/checkpoint-rekey.js +6 -1
  46. package/dist/core/checkpoint-requirements.d.ts +23 -3
  47. package/dist/core/checkpoint-requirements.js +5 -1
  48. package/dist/core/checkpoint-row-verdict.d.ts +1 -1
  49. package/dist/core/checkpoint-row-verdict.js +9 -3
  50. package/dist/core/checkpoint-store.d.ts +26 -2
  51. package/dist/core/checkpoint-store.js +9 -2
  52. package/dist/core/child-clamp-seats.d.ts +15 -0
  53. package/dist/core/child-clamp-seats.js +15 -0
  54. package/dist/core/config-refusal-codes.d.ts +1 -1
  55. package/dist/core/config-refusal-codes.js +1 -0
  56. package/dist/core/cron.js +9 -1
  57. package/dist/core/delegation-frames.d.ts +1 -0
  58. package/dist/core/delegation-frames.js +1 -1
  59. package/dist/core/deployment-shape.d.ts +7 -0
  60. package/dist/core/deployment-shape.js +19 -0
  61. package/dist/core/engine-capabilities.d.ts +13 -1
  62. package/dist/core/engine-capabilities.js +1 -1
  63. package/dist/core/engine-notice.d.ts +41 -28
  64. package/dist/core/engine-version.js +1 -1
  65. package/dist/core/entries-not-applied.d.ts +19 -7
  66. package/dist/core/entries-not-applied.js +33 -1
  67. package/dist/core/gate-fold.js +5 -4
  68. package/dist/core/gate-lanes.js +8 -12
  69. package/dist/core/gate-outcome.d.ts +8 -2
  70. package/dist/core/gate-outcome.js +10 -3
  71. package/dist/core/governance-codes.d.ts +14 -2
  72. package/dist/core/governance-codes.js +22 -6
  73. package/dist/core/hook-condition.d.ts +37 -0
  74. package/dist/core/hook-condition.js +567 -0
  75. package/dist/core/hooks.d.ts +5 -0
  76. package/dist/core/hooks.js +1 -0
  77. package/dist/core/host-instance.d.ts +23 -0
  78. package/dist/core/host-instance.js +69 -0
  79. package/dist/core/instruction-preview.d.ts +63 -0
  80. package/dist/core/instruction-preview.js +406 -0
  81. package/dist/core/leg-budget.d.ts +26 -0
  82. package/dist/core/leg-budget.js +9 -0
  83. package/dist/core/leg-identity.d.ts +51 -1
  84. package/dist/core/leg-identity.js +45 -2
  85. package/dist/core/manager-launch-check.d.ts +48 -0
  86. package/dist/core/manager-launch-check.js +64 -0
  87. package/dist/core/mcp-call-meta.d.ts +2 -2
  88. package/dist/core/mcp-injection-drop.d.ts +20 -10
  89. package/dist/core/mcp-injection-drop.js +9 -3
  90. package/dist/core/mcp-server-spec.d.ts +2 -1
  91. package/dist/core/member-outcome.d.ts +3 -2
  92. package/dist/core/member-outcome.js +1 -1
  93. package/dist/core/memory-engine/deletion-record.d.ts +46 -0
  94. package/dist/core/memory-engine/deletion-record.js +96 -0
  95. package/dist/core/memory-engine/engine.js +24 -16
  96. package/dist/core/memory-engine/file-backend.js +7 -5
  97. package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
  98. package/dist/core/memory-engine/projection-ledger.js +1 -1
  99. package/dist/core/memory-engine/scope-contract.d.ts +18 -13
  100. package/dist/core/memory-engine/scope-contract.js +18 -18
  101. package/dist/core/memory-engine/sync-client.js +26 -6
  102. package/dist/core/memory-engine/sync.d.ts +20 -2
  103. package/dist/core/memory-engine/sync.js +18 -17
  104. package/dist/core/mode-policy.d.ts +25 -6
  105. package/dist/core/mode-policy.js +33 -8
  106. package/dist/core/model-seat.d.ts +8 -5
  107. package/dist/core/model-shell.d.ts +129 -0
  108. package/dist/core/model-shell.js +249 -0
  109. package/dist/core/mods/kernel/digest.d.ts +4 -0
  110. package/dist/core/mods/kernel/digest.js +5 -0
  111. package/dist/core/mods/kernel/dispatch.d.ts +3 -0
  112. package/dist/core/mods/kernel/dispatch.js +15 -6
  113. package/dist/core/mods/kernel/events.d.ts +21 -5
  114. package/dist/core/mods/kernel/events.js +19 -10
  115. package/dist/core/mods/kernel/hash-mirror.d.ts +1 -0
  116. package/dist/core/mods/kernel/hash-mirror.js +55 -0
  117. package/dist/core/mods/kernel/index.d.ts +1 -0
  118. package/dist/core/mods/kernel/index.js +1 -0
  119. package/dist/core/mods/kernel/package-reader.d.ts +48 -0
  120. package/dist/core/mods/kernel/package-reader.js +149 -0
  121. package/dist/core/mods/kernel/site-rules.d.ts +4 -0
  122. package/dist/core/mods/kernel/site-rules.js +13 -0
  123. package/dist/core/mods/package.d.ts +7 -3
  124. package/dist/core/mods/package.js +47 -80
  125. package/dist/core/own-property-receipt.js +11 -4
  126. package/dist/core/parent-spec-seat.d.ts +13 -11
  127. package/dist/core/parent-spec-seat.js +13 -9
  128. package/dist/core/peer-seat.js +3 -3
  129. package/dist/core/peer-task-store.d.ts +365 -0
  130. package/dist/core/peer-task-store.js +682 -0
  131. package/dist/core/permission-rule-consent.js +6 -11
  132. package/dist/core/permission-rule-model.d.ts +27 -0
  133. package/dist/core/permission-rule-model.js +33 -5
  134. package/dist/core/permission-rule-org.js +13 -3
  135. package/dist/core/permission-rule-provider.d.ts +35 -33
  136. package/dist/core/permission-rule-provider.js +38 -295
  137. package/dist/core/permission-rule-store.d.ts +181 -8
  138. package/dist/core/permission-rule-store.js +420 -17
  139. package/dist/core/permission-rule-sync.js +15 -1
  140. package/dist/core/permission-rules.js +4 -1
  141. package/dist/core/project-seat.d.ts +55 -0
  142. package/dist/core/project-seat.js +96 -0
  143. package/dist/core/protocol-http-auth.d.ts +3 -2
  144. package/dist/core/protocol-http-auth.js +26 -18
  145. package/dist/core/remote-env.d.ts +4 -4
  146. package/dist/core/retain-seat.d.ts +42 -0
  147. package/dist/core/retain-seat.js +76 -0
  148. package/dist/core/retired-keys.js +1 -0
  149. package/dist/core/rewind-refusal-codes.d.ts +8 -0
  150. package/dist/core/rewind-refusal-codes.js +12 -0
  151. package/dist/core/roles.d.ts +2 -2
  152. package/dist/core/roles.js +15 -1
  153. package/dist/core/rule-offer-read.d.ts +1 -1
  154. package/dist/core/rule-offer-read.js +32 -4
  155. package/dist/core/rule-store-fault.d.ts +9 -7
  156. package/dist/core/rule-store-fault.js +8 -3
  157. package/dist/core/run-ledger-seat.d.ts +66 -0
  158. package/dist/core/run-ledger-seat.js +70 -0
  159. package/dist/core/run-ledger.d.ts +332 -0
  160. package/dist/core/run-ledger.js +550 -0
  161. package/dist/core/runner/checkpoint-scope.d.ts +14 -3
  162. package/dist/core/runner/checkpoint-scope.js +16 -6
  163. package/dist/core/runner/compact-session.js +1 -1
  164. package/dist/core/runner/construction-doors.js +8 -0
  165. package/dist/core/runner/contracts.d.ts +21 -5
  166. package/dist/core/runner/cross-boundary-lane.d.ts +8 -1
  167. package/dist/core/runner/cross-boundary-lane.js +4 -0
  168. package/dist/core/runner/delegation-owner.d.ts +30 -0
  169. package/dist/core/runner/delegation-owner.js +20 -4
  170. package/dist/core/runner/finish-reason-seat.js +4 -2
  171. package/dist/core/runner/gate-exit.d.ts +7 -0
  172. package/dist/core/runner/gate-exit.js +2 -1
  173. package/dist/core/runner/leg-frame.js +3 -0
  174. package/dist/core/runner/model-lane-seat.d.ts +3 -0
  175. package/dist/core/runner/model-lane-seat.js +4 -0
  176. package/dist/core/runner/nested-memory-lane.d.ts +22 -5
  177. package/dist/core/runner/nested-memory-lane.js +91 -30
  178. package/dist/core/runner/person-path-rows.d.ts +27 -16
  179. package/dist/core/runner/person-path-rows.js +93 -15
  180. package/dist/core/runner/prepare-caps-and-workflow.js +98 -88
  181. package/dist/core/runner/prepare-config-doors.d.ts +1 -0
  182. package/dist/core/runner/prepare-config-doors.js +13 -7
  183. package/dist/core/runner/prepare-context-lane.js +1 -0
  184. package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
  185. package/dist/core/runner/prepare-delegation-surface.js +6 -0
  186. package/dist/core/runner/prepare-execution-env.d.ts +3 -3
  187. package/dist/core/runner/prepare-gate-stations.d.ts +6 -0
  188. package/dist/core/runner/prepare-gate-stations.js +3 -1
  189. package/dist/core/runner/prepare-hands-readface.d.ts +5 -2
  190. package/dist/core/runner/prepare-hands-readface.js +15 -3
  191. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
  192. package/dist/core/runner/prepare-inherited-gate.js +13 -5
  193. package/dist/core/runner/prepare-offload-wrappers.js +1 -1
  194. package/dist/core/runner/prepare-run-refs.d.ts +1 -1
  195. package/dist/core/runner/prepare-run-refs.js +3 -2
  196. package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
  197. package/dist/core/runner/prepare-suspend-saga.js +4 -2
  198. package/dist/core/runner/prepare-task.js +42 -30
  199. package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
  200. package/dist/core/runner/prepare-turn-wiring.js +2 -1
  201. package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
  202. package/dist/core/runner/prepare-wiring-manifest.js +8 -6
  203. package/dist/core/runner/resume-apply.js +11 -5
  204. package/dist/core/runner/resume-policy-outcome.js +5 -2
  205. package/dist/core/runner/resume-review-outcome.d.ts +3 -0
  206. package/dist/core/runner/resume-review-outcome.js +24 -1
  207. package/dist/core/runner/role-seat-defaulted.d.ts +3 -3
  208. package/dist/core/runner/role-seat-defaulted.js +1 -1
  209. package/dist/core/runner/rule-store-unreadable-notice.d.ts +1 -1
  210. package/dist/core/runner/rule-store-unreadable-notice.js +3 -3
  211. package/dist/core/runner/run-harness-handlers.js +4 -1
  212. package/dist/core/runner/run-identity-wiring.js +3 -2
  213. package/dist/core/runner/run-leg.js +5 -2
  214. package/dist/core/runner/run-notification-lane.js +20 -1
  215. package/dist/core/runner/run-settle-and-teardown.js +21 -12
  216. package/dist/core/runner/run-stop-and-final-verify.js +6 -0
  217. package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
  218. package/dist/core/runner/runtask.d.ts +6 -2
  219. package/dist/core/runner/runtask.js +21 -9
  220. package/dist/core/runner/shell-env-withheld.d.ts +6 -4
  221. package/dist/core/runner/shell-env-withheld.js +25 -3
  222. package/dist/core/runner/stop-tail-notice.d.ts +10 -2
  223. package/dist/core/runner/stop-tail-notice.js +9 -2
  224. package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
  225. package/dist/core/runner/stream-settle-backstop.js +1 -0
  226. package/dist/core/runner/sub-agent-deny-lists.js +9 -5
  227. package/dist/core/runner/task-start-doors.js +6 -3
  228. package/dist/core/runner/terminal-account.d.ts +6 -1
  229. package/dist/core/runner/terminal-account.js +16 -1
  230. package/dist/core/runner/tool-end-body.d.ts +1 -1
  231. package/dist/core/runner/tool-not-executed.d.ts +27 -8
  232. package/dist/core/runner/tool-not-executed.js +22 -11
  233. package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
  234. package/dist/core/runner/write-protection-station.d.ts +1 -1
  235. package/dist/core/runner/write-protection-station.js +1 -1
  236. package/dist/core/runner-deps.d.ts +17 -10
  237. package/dist/core/secret-env.d.ts +61 -37
  238. package/dist/core/secret-env.js +49 -49
  239. package/dist/core/session-checkout.d.ts +3 -0
  240. package/dist/core/session-checkout.js +1 -0
  241. package/dist/core/session-store.d.ts +12 -6
  242. package/dist/core/session-store.js +26 -6
  243. package/dist/core/session.d.ts +31 -8
  244. package/dist/core/shell-read-silence.d.ts +40 -2
  245. package/dist/core/shell-read-silence.js +23 -4
  246. package/dist/core/store-contracts/checkpoint-store-contract.js +10 -0
  247. package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
  248. package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
  249. package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
  250. package/dist/core/store-contracts/session-store-contract.js +87 -3
  251. package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
  252. package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
  253. package/dist/core/task-event.d.ts +14 -7
  254. package/dist/core/task-notification.d.ts +96 -10
  255. package/dist/core/task-notification.js +135 -6
  256. package/dist/core/task-registry-agent.d.ts +1 -0
  257. package/dist/core/task-registry-agent.js +1 -1
  258. package/dist/core/task-registry-shared.d.ts +12 -1
  259. package/dist/core/task-registry-shared.js +3 -1
  260. package/dist/core/task-registry-workflow.d.ts +1 -1
  261. package/dist/core/task-registry-workflow.js +9 -1
  262. package/dist/core/task-registry.d.ts +40 -2
  263. package/dist/core/task-registry.js +80 -15
  264. package/dist/core/task-result.d.ts +18 -3
  265. package/dist/core/task-spec-members.d.ts +3 -1
  266. package/dist/core/task-spec-members.js +19 -3
  267. package/dist/core/task-spec.d.ts +48 -22
  268. package/dist/core/tool-catalog-entries.js +2 -0
  269. package/dist/core/tool-gate-phase.d.ts +6 -3
  270. package/dist/core/tool-gate-phase.js +1 -0
  271. package/dist/core/tool-mount-facts.d.ts +8 -4
  272. package/dist/core/tool-mount-facts.js +7 -2
  273. package/dist/core/tool-mount-plan.d.ts +3 -1
  274. package/dist/core/tool-mount-plan.js +10 -3
  275. package/dist/core/tool-mount-static.d.ts +1 -1
  276. package/dist/core/tool-mount-static.js +4 -2
  277. package/dist/core/tool-result-store.d.ts +56 -3
  278. package/dist/core/tool-result-store.js +219 -25
  279. package/dist/core/tool-spec.d.ts +9 -2
  280. package/dist/core/trace.d.ts +3 -3
  281. package/dist/core/user-attachment.d.ts +5 -1
  282. package/dist/core/user-attachment.js +14 -7
  283. package/dist/core/wiring-manifest.d.ts +26 -20
  284. package/dist/core/wiring-manifest.js +7 -3
  285. package/dist/core/workflow-journal-store.d.ts +53 -10
  286. package/dist/core/workflow-journal-store.js +27 -4
  287. package/dist/core/workflow-run-store-contract.js +16 -0
  288. package/dist/core/workflow-run-store.d.ts +9 -7
  289. package/dist/core/workflow-run-store.js +4 -1
  290. package/dist/engine/execution-env/node-execution-env.d.ts +75 -1
  291. package/dist/engine/execution-env/node-execution-env.js +227 -13
  292. package/dist/engine/harness/types.d.ts +49 -1
  293. package/dist/engine/harness/types.js +10 -0
  294. package/dist/engine/llm/types.d.ts +13 -7
  295. package/dist/engine/llm/validation.d.ts +8 -1
  296. package/dist/engine/llm/validation.js +31 -2
  297. package/dist/engine/lsp/node-lsp-manager.js +2 -1
  298. package/dist/engine/session/import-validate.js +6 -1
  299. package/dist/engine/session/session.d.ts +15 -2
  300. package/dist/engine/session/session.js +34 -4
  301. package/dist/host-env.d.ts +10 -0
  302. package/dist/host-env.js +1 -0
  303. package/dist/index.d.ts +28 -9
  304. package/dist/index.js +22 -6
  305. package/dist/internal/harness-types.d.ts +1 -1
  306. package/dist/orchestration/goal.js +1 -1
  307. package/dist/orchestration/run-workflow-tool.js +40 -32
  308. package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
  309. package/dist/orchestration/workflow-park-adoption.js +47 -12
  310. package/dist/orchestration/workflow-primitives.js +10 -1
  311. package/dist/orchestration/workflow-script-runner.d.ts +2 -2
  312. package/dist/orchestration/workflow-stop.d.ts +128 -0
  313. package/dist/orchestration/workflow-stop.js +156 -0
  314. package/dist/orchestration/workflow.d.ts +31 -7
  315. package/dist/orchestration/workflow.js +119 -57
  316. package/dist/prompts/manager-recipe.d.ts +18 -0
  317. package/dist/prompts/manager-recipe.js +24 -0
  318. package/dist/shell/lex.d.ts +2 -2
  319. package/dist/shell/lex.js +1 -1
  320. package/dist/stores/file/permission-rule-store.d.ts +3 -1
  321. package/dist/stores/file/permission-rule-store.js +0 -1
  322. package/dist/stores/file/workflow-journal-store.d.ts +16 -3
  323. package/dist/stores/file/workflow-journal-store.js +93 -5
  324. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  325. package/dist/tools/fs/bash-model-shell.d.ts +23 -0
  326. package/dist/tools/fs/bash-model-shell.js +25 -0
  327. package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -0
  328. package/dist/tools/fs/bash-readonly-classifier.js +3 -0
  329. package/dist/tools/fs/file-write-check.js +9 -3
  330. package/dist/tools/fs/fs-bash.js +13 -11
  331. package/dist/tools/fs/index.d.ts +8 -7
  332. package/dist/tools/fs/index.js +4 -4
  333. package/dist/tools/fs/read-deny-home.d.ts +1 -1
  334. package/dist/tools/fs/read-deny-home.js +5 -5
  335. package/dist/tools/fs/read-deny.d.ts +33 -8
  336. package/dist/tools/fs/read-deny.js +114 -25
  337. package/dist/tools/fs/safety.d.ts +4 -1
  338. package/dist/tools/fs/safety.js +4 -2
  339. package/dist/tools/fs/shell-read-argv.js +1 -0
  340. package/dist/tools/fs/shell-read-check.d.ts +9 -2
  341. package/dist/tools/fs/shell-read-check.js +134 -22
  342. package/dist/tools/fs/shell-read-establish.d.ts +9 -0
  343. package/dist/tools/fs/shell-read-establish.js +21 -11
  344. package/dist/tools/fs/shell-read-judge.d.ts +13 -1
  345. package/dist/tools/fs/shell-read-judge.js +26 -7
  346. package/dist/tools/fs/shell-read-plan.d.ts +7 -3
  347. package/dist/tools/fs/shell-read-plan.js +8 -5
  348. package/dist/tools/fs/shell-read-word.d.ts +8 -0
  349. package/dist/tools/fs/shell-read-word.js +13 -4
  350. package/dist/tools/fs/shell-read-write-targets.js +17 -9
  351. package/dist/tools/monitor.js +12 -8
  352. package/dist/tools/scheduler-tools.d.ts +1 -0
  353. package/dist/tools/scheduler-tools.js +5 -2
  354. package/package.json +3 -2
  355. package/test/export-surface.snapshot.json +192 -3
  356. package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
  357. package/wire-changes/answers/core-stores-sql@7.74.0.json +7 -0
  358. package/wire-changes/answers/core@7.73.0.json +216 -0
  359. package/wire-changes/answers/core@7.74.0.json +68 -0
  360. package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
  361. package/wire-changes/answers/mods-kernel@7.74.0.json +21 -0
  362. package/wire-changes/answers/primitives@7.73.0.json +12 -0
  363. package/wire-changes/answers/primitives@7.74.0.json +7 -0
  364. package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
  365. package/wire-changes/answers/wiki-gate@7.74.0.json +8 -0
  366. package/wire-changes/core-stores-sql@7.73.0.json +326 -0
  367. package/wire-changes/core-stores-sql@7.74.0.json +143 -0
  368. package/wire-changes/core@7.73.0.json +6480 -0
  369. package/wire-changes/core@7.74.0.json +2210 -0
  370. package/wire-changes/mods-kernel@7.73.0.json +147 -0
  371. package/wire-changes/mods-kernel@7.74.0.json +421 -0
  372. package/wire-changes/primitives@7.73.0.json +227 -0
  373. package/wire-changes/primitives@7.74.0.json +174 -0
  374. package/wire-changes/wiki-gate@7.73.0.json +145 -0
  375. package/wire-changes/wiki-gate@7.74.0.json +145 -0
@@ -63,7 +63,7 @@ import type { AssertAllKeysHandled } from "@sema-agent/primitives";
63
63
  * lane may answer (the class `call_unreadable`). A store (or a partition of it) that could not be READ is this
64
64
  * word too — a row inside it may forbid the call and nobody can tell (the class `rule_unreadable`, which the
65
65
  * two relaxed modes answer: auto mode's classifier, the bypass release); the run then also carries one
66
- * `permission.rule_store_unavailable` notice where a mode puts such a call to a person.
66
+ * `permission.rule_store_unavailable` notice under every mode (plus `permission.rule_store_unreadable_relaxed` for the operator under relaxed modes).
67
67
  * - `hook` — a deployment's PreToolUse screening face raised or co-raised the ask; the word is
68
68
  * engine-stamped at the fold and is the deployment's own per-call adjudication.
69
69
  * - `ask_rule` — an EXPLICIT `ask` permission rule matched: a person's standing "ask me each time",
@@ -276,6 +276,8 @@ export declare function stampAskOrigin<T extends Extract<PermissionResult, {
276
276
  */
277
277
  export declare const RULE_OFFERS_ABSENCES: readonly ["mandated", "allow_outranked", "ask_rule_matched", "lane_cannot_speak"];
278
278
  export type RuleOffersAbsence = (typeof RULE_OFFERS_ABSENCES)[number];
279
+ /** Membership test for {@link RuleOffersAbsence} — screens a parked row's value before publishing it on a summary. */
280
+ export declare function isRuleOffersAbsence(v: unknown): v is RuleOffersAbsence;
279
281
  /**
280
282
  * CAN a persisted allow rule clear this ask — and, if not, which door closed? ONE derivation with TWO
281
283
  * readers, which is the whole point of the shape: the approval card's `ruleOffersAbsence` word and the
@@ -1012,6 +1014,10 @@ export type AskFace = (typeof ASK_FACES)[number];
1012
1014
  * wears does not count): the catalog's shell face for exactly the names that declare the command grammar, `other` for every
1013
1015
  * other name. */
1014
1016
  export declare function askFaceOf(toolName: string): AskFace;
1017
+ /** The classes `bypassPermissions` releases on a CONFINED Runner (`RunnerDeps.deploymentShape` declared) although their row says
1018
+ * immune — the same kind of reading as {@link RELEASED_ON_SHELL_FACE}: one column, read at the mode point only (the fold, the
1019
+ * classifier, the card and the park row read the table's rows). A read check that did not finish. */
1020
+ export declare const RELEASED_ON_CONFINED_RUNNER: readonly ["unfinished_check"];
1015
1021
  /** The classes whose own mint puts the `requiresRealApproval` bit on the ask — a bit one of them explains is not
1016
1022
  * the bare bit `policy_rra` names. The mark classes (probe / write protection / tool marks / operator forced / the
1017
1023
  * shell floor) mint no bit and explain none — except `requires_user_interaction`, whose declaration the origin stamp
@@ -1024,8 +1030,13 @@ export declare const RRA_EXPLAINERS: ReadonlySet<AskClass>;
1024
1030
  export declare function explainsRealApprovalBit(classes: Iterable<AskClass>): boolean;
1025
1031
  /** The classes a permission mode can RELEASE for a call on `face`, in {@link ASK_CLASSES} order. The same list on every face
1026
1032
  * but one class — {@link RELEASED_ON_SHELL_FACE}. A frozen list: a caller holding it cannot change the next read. A word
1027
- * outside {@link ASK_FACES} throws. */
1033
+ * outside {@link ASK_FACES} throws. A Runner that declares its shape releases more: {@link confinedReleasableAskClassesFor}. */
1028
1034
  export declare function releasableAskClassesFor(face: AskFace): readonly AskClass[];
1035
+ /** {@link releasableAskClassesFor} on a Runner that declares its shape (`RunnerDeps.deploymentShape`): the list with
1036
+ * {@link RELEASED_ON_CONFINED_RUNNER} in it — released only where no person was already required on the question, the call's own
1037
+ * destination stays on the leg's hands and what the check did not see guards nothing ({@link ConfinedCall}); a release that stood on
1038
+ * it says `confined: true`. A word outside {@link ASK_FACES} throws. */
1039
+ export declare function confinedReleasableAskClassesFor(face: AskFace): readonly AskClass[];
1029
1040
  /**
1030
1041
  * The closed set of `reason` words a mode release carries (`GateDisposition.released.reason`, the `released` arm of
1031
1042
  * {@link Arbitration}): each is a releasable class the release record names on its own — `target_unresolved`, a release
@@ -1276,7 +1287,8 @@ export declare function headlessApprovalRemedy(input: {
1276
1287
  };
1277
1288
  readonly approverSeat?: HeadlessApproverSeat;
1278
1289
  readonly ruleShape?: string;
1279
- readonly notResumableWayOut?: string;
1290
+ readonly notResumableWayOut?: string; /** a confined Runner's facts for the call: bypass is a way out exactly where the mode point would release ({@link ConfinedCall}) */
1291
+ readonly confined?: ConfinedCall;
1280
1292
  }): HeadlessApprovalRemedy;
1281
1293
  /** The reference implementation's sentence for a `cp` / `mv` the mode will not answer because it carries option
1282
1294
  * words — the approval card's message under `acceptEdits` and the head of the headless remedy. */
@@ -1299,12 +1311,36 @@ export type Arbitration = {
1299
1311
  origin?: AskOrigin;
1300
1312
  mandate?: PersistedRuleMandate;
1301
1313
  reason?: ModeReleaseReason;
1314
+ confined?: true;
1302
1315
  } | {
1303
1316
  kind: "denied_by_mode";
1304
1317
  mode: "bypassPermissions" | "dontAsk";
1305
1318
  askClass: AskClass;
1306
1319
  classes: readonly AskClass[];
1307
1320
  };
1321
+ /**
1322
+ * What a CONFINED Runner (`RunnerDeps.deploymentShape` declared) lends the mode point for one call — three facts (and, for the headless
1323
+ * way out, whether bypass would arm), each read only in the one cell that needs it (`bypassPermissions`, a class set that only {@link RELEASED_ON_CONFINED_RUNNER} keeps immune), never by the
1324
+ * other modes or the other readers of the class set:
1325
+ * - `personAlreadyRequired` — a person was already required on this question when the read check went silent (the real-approval
1326
+ * bit stood before the silence put its own there; the silence's class explains the bit, so the class set cannot say it). The gate's
1327
+ * answer is the engine's record of the silence; a question with no such record answers `true`.
1328
+ * - `destinationOnHands` — the call's own declared destination, on the arguments that run, stays on the leg's hands: a hand of the
1329
+ * environment, no egress mark, every boundary leg the call declares is the environment's.
1330
+ * - `unseenGuardsNothing` — what the check that did not finish left unseen can hold no write a deny row protects: where the read
1331
+ * station answered, no row that guards writes stands on the call's own table or on the one in force now, or the engine's read-only
1332
+ * reader proves the command read-only; where the gate put the station's fallback in its place (the station gave no answer), no deny
1333
+ * row at all stands on either table. Rows that could not be read count as rows.
1334
+ * The mode releases only when the first is `false` and the other two `true`.
1335
+ */
1336
+ export interface ConfinedCall {
1337
+ readonly personAlreadyRequired: () => boolean;
1338
+ readonly destinationOnHands: () => boolean;
1339
+ readonly unseenGuardsNothing: () => boolean;
1340
+ /** Asking for `bypassPermissions` now would run the leg under it — the leg's own mode fold over its ceiling and the deployment's
1341
+ * arming facts (`PermissionModeController.armsAs`). Read by the headless way out alone: the mode point is already in the mode. */
1342
+ readonly bypassArmed: () => boolean;
1343
+ }
1308
1344
  /** Whether `mode` answers an ask of class `c` with nobody asked — the class's row read under the mode, on the face-less reading:
1309
1345
  * `bypassPermissions` releases a class it is not immune to, auto mode's classifier judges a class it may answer; the other modes put
1310
1346
  * it to a person (`dontAsk` refuses it, which a person is still told about). For a reader that tells a person what a class costs them
@@ -1323,11 +1359,15 @@ export declare function modeAnswersUnasked(mode: PermissionMode, c: AskClass): b
1323
1359
  * (`call.fileCommand`, `accepted`); `plan`, `default` and `auto` hand every ask on (plan's own questions were raised by
1324
1360
  * its write gate; the reference implementation refuses nothing at this point under plan — auto's classifier reads the
1325
1361
  * row at its own station). Reads the class SET on the face the classification records ({@link bypassImmuneOf}) and the folded
1326
- * row's face-free `hookAskFloor` — never the row's `bypassImmune`, never the disclosed word.
1362
+ * row's face-free `hookAskFloor` — never the row's `bypassImmune`, never the disclosed word. On a CONFINED Runner (`call.confined`,
1363
+ * {@link ConfinedCall}) `bypassPermissions` also releases a set that only {@link RELEASED_ON_CONFINED_RUNNER} keeps immune — where no
1364
+ * person was already required on the question, the call's destination stays on the hands and what the check did not see guards
1365
+ * nothing — and the release says `confined: true`; every other cell reads as on any Runner.
1327
1366
  */
1328
1367
  export declare function arbitrateByMode(mode: PermissionMode, c: AskClassification, disclosure?: {
1329
1368
  origin?: AskOrigin;
1330
1369
  mandate?: PersistedRuleMandate;
1331
1370
  }, call?: {
1332
1371
  readonly fileCommand?: boolean;
1372
+ readonly confined?: ConfinedCall;
1333
1373
  }): Arbitration;
@@ -106,6 +106,10 @@ export function stampAskOrigin(decision, facts, classification) {
106
106
  return { ...kept, origin, ...classed };
107
107
  }
108
108
  export const RULE_OFFERS_ABSENCES = Object.freeze(["mandated", "allow_outranked", "ask_rule_matched", "lane_cannot_speak"]);
109
+ const RULE_OFFERS_ABSENCE_SET = new Set(RULE_OFFERS_ABSENCES);
110
+ export function isRuleOffersAbsence(v) {
111
+ return RULE_OFFERS_ABSENCE_SET.has(v);
112
+ }
109
113
  const RULE_SPEAKING_CLASSES = new Set(["ask_rule"]);
110
114
  const BOUND_GRANT_CLASSES = new Set(["a2a_inside"]);
111
115
  export function ruleClearanceOf(ask, marks) {
@@ -372,11 +376,13 @@ export function askFaceOf(toolName) {
372
376
  return isShellFaceToolName(toolName) ? "shell" : "other";
373
377
  }
374
378
  const RELEASED_ON_SHELL_FACE = new Set(["target_unresolved"]);
375
- function bypassImmuneOn(c, face) {
376
- return MODE_ARBITRATION[c].bypassImmune && !(face === "shell" && RELEASED_ON_SHELL_FACE.has(c));
379
+ export const RELEASED_ON_CONFINED_RUNNER = Object.freeze(["unfinished_check"]);
380
+ const CONFINED_RELEASE = new Set(RELEASED_ON_CONFINED_RUNNER);
381
+ function bypassImmuneOn(c, face, confined = false) {
382
+ return MODE_ARBITRATION[c].bypassImmune && !(face === "shell" && RELEASED_ON_SHELL_FACE.has(c)) && !(confined && CONFINED_RELEASE.has(c));
377
383
  }
378
- function bypassImmuneOf(c) {
379
- return [...c.classes].some((k) => bypassImmuneOn(k, c.askFace));
384
+ function bypassImmuneOf(c, confined = false) {
385
+ return [...c.classes].some((k) => bypassImmuneOn(k, c.askFace, confined));
380
386
  }
381
387
  const CLASSIFIER_WITHHELD_ON_ROOTS = new Set(["probe"]);
382
388
  function bareBit(d, classes) {
@@ -389,13 +395,20 @@ export function explainsRealApprovalBit(classes) {
389
395
  return true;
390
396
  return false;
391
397
  }
398
+ const releasableOn = (face, confined) => Object.freeze(ASK_CLASSES.filter((c) => !bypassImmuneOn(c, face, confined)));
392
399
  const RELEASABLE_BY_FACE = Object.freeze({
393
- shell: Object.freeze(ASK_CLASSES.filter((c) => !bypassImmuneOn(c, "shell"))),
394
- other: Object.freeze(ASK_CLASSES.filter((c) => !bypassImmuneOn(c, "other"))),
400
+ shell: Object.freeze({ unconfined: releasableOn("shell", false), confined: releasableOn("shell", true) }),
401
+ other: Object.freeze({ unconfined: releasableOn("other", false), confined: releasableOn("other", true) }),
395
402
  });
396
403
  export function releasableAskClassesFor(face) {
404
+ return releasableListFor(face, "releasableAskClassesFor").unconfined;
405
+ }
406
+ export function confinedReleasableAskClassesFor(face) {
407
+ return releasableListFor(face, "confinedReleasableAskClassesFor").confined;
408
+ }
409
+ function releasableListFor(face, reader) {
397
410
  if (!ASK_FACES.includes(face))
398
- throw new TypeError(`releasableAskClassesFor: "${String(face)}" is not an ask face (${ASK_FACES.join(", ")})`);
411
+ throw new TypeError(`${reader}: "${String(face)}" is not an ask face (${ASK_FACES.join(", ")})`);
399
412
  return RELEASABLE_BY_FACE[face];
400
413
  }
401
414
  export const MODE_RELEASE_REASONS = Object.freeze(["target_unresolved"]);
@@ -613,12 +626,13 @@ export function headlessApprovalRemedy(input) {
613
626
  const c = input.classification;
614
627
  if (input.mode === "acceptEdits" && input.unplacedOptions !== undefined && (c === undefined || (c.classes.size === 1 && c.classes.has("ordinary"))))
615
628
  return way(orApprover(`${fileCommandOptionsSentence(input.unplacedOptions.program)} Spell the ${input.unplacedOptions.program} without option words for the mode to answer it`));
616
- if (c !== undefined && bypassImmuneOf(c)) {
629
+ const confinedRelease = c !== undefined && bypassImmuneOf(c) && releasedOnConfinedRunner(c, input.confined) && input.confined?.bypassArmed() === true;
630
+ if (c !== undefined && bypassImmuneOf(c) && !confinedRelease) {
617
631
  const earlierYes = c.classes.has("cross_boundary") ? ` — ${CROSS_BOUNDARY_EARLIER_YES}` : "";
618
632
  return way(approver !== undefined ? `no permission mode releases this ask: ${approver}, or change the call${earlierYes}` : `no permission mode releases this ask: change the call${earlierYes}; ${NOBODY_CAN_APPROVE}`);
619
633
  }
620
634
  if (input.mode === "plan" && c?.classes.has("mode") === true)
621
- return way(orApprover(`the plan permission mode asks before every write and every call to a tool the engine does not define that is not read-only — leave plan mode (\`setPermissionMode\` to another mode${approver !== undefined ? ", or approve the plan" : ""}) to run it`));
635
+ return way(orApprover(`the plan permission mode asks before every write and every call to a tool the engine does not define that is not read-only — leave plan mode (\`setPermissionMode\` to another mode${approver !== undefined ? ", or approve the plan" : ""}) to run it`), confinedRelease);
622
636
  if (c !== undefined && boundGrantMayClear(c.classes))
623
637
  return way(orApprover(`${A2A_INSIDE_GRANT_SENTENCE} answers it`), true);
624
638
  if (c !== undefined && c.classes.size === 1 && c.classes.has("unstated"))
@@ -635,6 +649,9 @@ export function headlessApprovalRemedy(input) {
635
649
  export function fileCommandOptionsSentence(program) {
636
650
  return `${program} with flags requires manual approval to ensure path safety: the mode cannot automatically validate ${program} commands that use flags, as some flags like --target-directory=PATH can bypass path validation.`;
637
651
  }
652
+ function releasedOnConfinedRunner(c, confined) {
653
+ return confined !== undefined && bypassImmuneOf(c) && !bypassImmuneOf(c, true) && !confined.personAlreadyRequired() && confined.destinationOnHands() && confined.unseenGuardsNothing();
654
+ }
638
655
  export function modeAnswersUnasked(mode, c) {
639
656
  return mode === "bypassPermissions" ? !bypassImmuneOn(c, undefined) : mode === "auto" ? MODE_ARBITRATION[c].classifierEligible : false;
640
657
  }
@@ -647,7 +664,8 @@ export function arbitrateByMode(mode, c, disclosure, call) {
647
664
  case "bypassPermissions":
648
665
  if (has("target_unresolved") && bypassImmuneOn("target_unresolved", c.askFace))
649
666
  return { kind: "denied_by_mode", mode, askClass: c.askClass, classes };
650
- if (bypassImmuneOf(c))
667
+ const confined = releasedOnConfinedRunner(c, call?.confined);
668
+ if (bypassImmuneOf(c) && !confined)
651
669
  return { kind: "ask" };
652
670
  const reason = [...MODE_RELEASE_REASON_SET].find((r) => has(r));
653
671
  return {
@@ -658,6 +676,7 @@ export function arbitrateByMode(mode, c, disclosure, call) {
658
676
  ...(disclosure?.origin !== undefined ? { origin: disclosure.origin } : {}),
659
677
  ...(disclosure?.mandate !== undefined ? { mandate: disclosure.mandate } : {}),
660
678
  ...(reason !== undefined ? { reason } : {}),
679
+ ...(confined ? { confined: true } : {}),
661
680
  };
662
681
  case "acceptEdits":
663
682
  return call?.fileCommand === true && c.classes.size === 1 && c.classes.has("ordinary") ? { kind: "accepted", mode } : { kind: "ask" };
@@ -1,3 +1,4 @@
1
+ import type { RunnerDeps } from "./runner-deps.js";
1
2
  import { type ClassifierCategory } from "./classifier-category.js";
2
3
  import type { PermissionResult, ToolCallRequest } from "./tool-policy.js";
3
4
  /**
@@ -537,15 +538,12 @@ export interface AutoModeDenialTracker {
537
538
  };
538
539
  }
539
540
  export declare function autoModeDenialLimitOf(v: unknown): Required<AutoModeDenialLimitOptions>;
540
- /** The deployment face's four value knobs, read by their one readers — every leg's prepare runs it while
541
- * `RunnerDeps.autoMode` is present, whatever mode the leg starts in, so a bad knob refuses the run before a steer or a
542
- * parent's live ceiling can reach an arming that would have refused it. */
543
- export declare function screenAutoModeKnobs(face: {
544
- readonly timeoutMs?: unknown;
545
- readonly classifierFallback?: unknown;
546
- readonly denialLimit?: unknown;
547
- readonly rateLimitBreakAfter?: unknown;
548
- }): void;
541
+ /** The ONE door for `RunnerDeps.autoMode` at both `new Runner` and prepare: receives a plain object of the ten known
542
+ * members, refuses stray or malformed members by field name (`config.invalid_argument`, or each existing knob's own
543
+ * code), and returns an isolated frozen copy. */
544
+ export declare function receiveAutoModeFace(given: unknown, subject?: string): RunnerDeps["autoMode"];
545
+ /** Screens `RunnerDeps.autoMode` through {@link receiveAutoModeFace} (the one door at construction and prepare). */
546
+ export declare function screenAutoModeKnobs(face: unknown): void;
549
547
  /** Build the per-run tracker over {@link autoModeDenialLimitOf}'s bounds (a bad knob refuses there). */
550
548
  export declare function createAutoModeDenialTracker(opts?: AutoModeDenialLimitOptions): AutoModeDenialTracker;
551
549
  /** The fallback ask's text — CC's sentence family, single-sourced for every mint site (the main gate
@@ -3,7 +3,7 @@ import { withStatusSeat } from "../brain/status-sink.js";
3
3
  import { thrownIs } from "./thrown-value.js";
4
4
  import { describeRejectedValue } from "./tool-search-setting.js";
5
5
  import { isPlainRecord } from "./mods/kernel/receive.js";
6
- import { optionKeys, receiveMembers } from "./own-property-receipt.js";
6
+ import { optionKeys, receiptRefusal, receiveMembers, refuseProxy } from "./own-property-receipt.js";
7
7
  import { callerKey } from "./caller-text.js";
8
8
  import { foreignLine } from "./protocol-http-auth.js";
9
9
  import { classifierCategoryOf, isClassifierCategory } from "./classifier-category.js";
@@ -440,14 +440,14 @@ function countsOf(fallback) {
440
440
  return { consecutive: fallback.consecutive, total: fallback.total, limit: fallback.limit };
441
441
  }
442
442
  const DENIAL_LIMIT_KEYS = optionKeys()({ maxConsecutive: 0, maxTotal: 0, autoDenyAfterMs: 0 });
443
- export function autoModeDenialLimitOf(v) {
443
+ function readDenialLimit(v) {
444
444
  const refuse = (what) => {
445
445
  const e = new Error(`RunnerDeps.autoMode.denialLimit${what}`);
446
446
  e.code = "config.auto_mode_denial_limit_invalid";
447
447
  throw e;
448
448
  };
449
449
  if (v === undefined)
450
- return { ...AUTO_MODE_DENIAL_LIMIT_DEFAULTS, autoDenyAfterMs: AUTO_MODE_DENIAL_AUTO_DENY_DEFAULT_MS };
450
+ return { resolved: { ...AUTO_MODE_DENIAL_LIMIT_DEFAULTS, autoDenyAfterMs: AUTO_MODE_DENIAL_AUTO_DENY_DEFAULT_MS }, given: undefined };
451
451
  if (typeof v !== "object" || v === null || Array.isArray(v))
452
452
  return refuse(` must be a record of bounds (got ${describeRejectedValue(v)}) — omit it for the defaults`);
453
453
  const opts = receiveMembers(v, { subject: "RunnerDeps.autoMode.denialLimit", unit: "member", moment: "when the knob is read" }, DENIAL_LIMIT_KEYS, (_, [stray]) => refuse(` has no member ${callerKey(stray)} — its members are maxConsecutive, maxTotal and autoDenyAfterMs`));
@@ -463,13 +463,119 @@ export function autoModeDenialLimitOf(v) {
463
463
  : typeof w === "number" && Number.isInteger(w) && w >= 0 && w <= MAX_TIMER_DELAY_MS
464
464
  ? w
465
465
  : refuse(`.autoDenyAfterMs must be an integer between 0 and ${MAX_TIMER_DELAY_MS} (got ${describeRejectedValue(w)}) — 0 disarms the window; omit it for the default ${AUTO_MODE_DENIAL_AUTO_DENY_DEFAULT_MS}`);
466
- return { maxConsecutive: bound("maxConsecutive", AUTO_MODE_DENIAL_LIMIT_DEFAULTS.maxConsecutive), maxTotal: bound("maxTotal", AUTO_MODE_DENIAL_LIMIT_DEFAULTS.maxTotal), autoDenyAfterMs };
466
+ const maxConsecutive = bound("maxConsecutive", AUTO_MODE_DENIAL_LIMIT_DEFAULTS.maxConsecutive);
467
+ const maxTotal = bound("maxTotal", AUTO_MODE_DENIAL_LIMIT_DEFAULTS.maxTotal);
468
+ return {
469
+ resolved: { maxConsecutive, maxTotal, autoDenyAfterMs },
470
+ given: Object.freeze({
471
+ ...(opts["maxConsecutive"] !== undefined ? { maxConsecutive } : {}),
472
+ ...(opts["maxTotal"] !== undefined ? { maxTotal } : {}),
473
+ ...(w !== undefined ? { autoDenyAfterMs } : {}),
474
+ }),
475
+ };
476
+ }
477
+ export function autoModeDenialLimitOf(v) {
478
+ return readDenialLimit(v).resolved;
479
+ }
480
+ const AUTO_MODE_FACE_KEYS = optionKeys()({
481
+ rules: 0,
482
+ settingsDenyRules: 0,
483
+ sessionContext: 0,
484
+ window: 0,
485
+ timeoutMs: 0,
486
+ classifierFallback: 0,
487
+ rateLimitBreakAfter: 0,
488
+ denialLimit: 0,
489
+ persistArming: 0,
490
+ settingsEpoch: 0,
491
+ });
492
+ const AUTO_MODE_RULES_KEYS = optionKeys()({ allow: 0, softDeny: 0, hardDeny: 0, environment: 0 });
493
+ const AUTO_MODE_WINDOW_KEYS = optionKeys()({ maxEntries: 0, maxCharsPerEntry: 0 });
494
+ function receiveStringList(v, path) {
495
+ if (v === undefined)
496
+ return undefined;
497
+ if (typeof v === "object" && v !== null)
498
+ refuseProxy(v, { subject: path, unit: "entry", moment: "when the auto-mode face is received" });
499
+ if (!Array.isArray(v))
500
+ throw receiptRefusal(`${path} must be a list of strings (got ${describeRejectedValue(v)})`);
501
+ const out = [];
502
+ for (let i = 0; i < v.length; i++) {
503
+ const held = i in v;
504
+ const item = held ? v[i] : undefined;
505
+ if (!held || typeof item !== "string") {
506
+ throw receiptRefusal(`${path}[${i}] must be a string (got ${!held ? "an empty slot" : describeRejectedValue(item)})`);
507
+ }
508
+ out.push(item);
509
+ }
510
+ return Object.freeze(out);
511
+ }
512
+ function receiveAutoModeRules(v, path) {
513
+ if (v === undefined)
514
+ return undefined;
515
+ if (typeof v !== "object" || v === null || Array.isArray(v))
516
+ throw receiptRefusal(`${path} must be a plain object of rule lists (got ${describeRejectedValue(v)})`);
517
+ const copy = receiveMembers(v, { subject: path, unit: "section", moment: "when the auto-mode face is received" }, AUTO_MODE_RULES_KEYS);
518
+ const out = {};
519
+ for (const k of AUTO_MODE_RULES_KEYS) {
520
+ const list = receiveStringList(copy[k], `${path}.${k}`);
521
+ if (list !== undefined)
522
+ out[k] = list;
523
+ }
524
+ return Object.freeze(out);
525
+ }
526
+ function receiveAutoModeWindow(v, path) {
527
+ if (v === undefined)
528
+ return undefined;
529
+ if (typeof v !== "object" || v === null || Array.isArray(v))
530
+ throw receiptRefusal(`${path} must be a plain object of window bounds (got ${describeRejectedValue(v)})`);
531
+ const copy = receiveMembers(v, { subject: path, unit: "bound", moment: "when the auto-mode face is received" }, AUTO_MODE_WINDOW_KEYS);
532
+ const out = {};
533
+ for (const k of AUTO_MODE_WINDOW_KEYS) {
534
+ const b = copy[k];
535
+ if (b === undefined)
536
+ continue;
537
+ if (typeof b !== "number" || !Number.isInteger(b) || b < 0)
538
+ throw receiptRefusal(`${path}.${k} must be a whole number >= 0 (got ${describeRejectedValue(b)})`);
539
+ out[k] = b;
540
+ }
541
+ return Object.freeze(out);
542
+ }
543
+ export function receiveAutoModeFace(given, subject = "RunnerDeps.autoMode") {
544
+ if (given === undefined)
545
+ return undefined;
546
+ if (typeof given !== "object" || given === null || Array.isArray(given)) {
547
+ throw receiptRefusal(`${subject} must be a plain object (got ${describeRejectedValue(given)}) — omit it to leave auto mode unarmed`);
548
+ }
549
+ const copy = receiveMembers(given, { subject, unit: "member", moment: "when the auto-mode face is received" }, AUTO_MODE_FACE_KEYS);
550
+ const timeoutMs = copy.timeoutMs !== undefined ? autoModeTimeoutMsOf(copy.timeoutMs) : undefined;
551
+ const classifierFallback = copy.classifierFallback !== undefined ? autoModeClassifierFallbackOf(copy.classifierFallback) : undefined;
552
+ const rateLimitBreakAfter = copy.rateLimitBreakAfter !== undefined ? autoModeRateLimitBreakAfterOf(copy.rateLimitBreakAfter) : undefined;
553
+ const denialLimit = readDenialLimit(copy.denialLimit).given;
554
+ const rules = receiveAutoModeRules(copy.rules, `${subject}.rules`);
555
+ const settingsDenyRules = receiveStringList(copy.settingsDenyRules, `${subject}.settingsDenyRules`);
556
+ const sessionContext = receiveStringList(copy.sessionContext, `${subject}.sessionContext`);
557
+ const window = receiveAutoModeWindow(copy.window, `${subject}.window`);
558
+ if (copy.persistArming !== undefined && typeof copy.persistArming !== "boolean") {
559
+ throw receiptRefusal(`${subject}.persistArming must be a boolean (got ${describeRejectedValue(copy.persistArming)}) — omit it for false`);
560
+ }
561
+ if (copy.settingsEpoch !== undefined && typeof copy.settingsEpoch !== "string") {
562
+ throw receiptRefusal(`${subject}.settingsEpoch must be a string (got ${describeRejectedValue(copy.settingsEpoch)}) — omit it when undeclared`);
563
+ }
564
+ return Object.freeze({
565
+ ...(rules !== undefined ? { rules } : {}),
566
+ ...(settingsDenyRules !== undefined ? { settingsDenyRules } : {}),
567
+ ...(sessionContext !== undefined ? { sessionContext } : {}),
568
+ ...(window !== undefined ? { window } : {}),
569
+ ...(timeoutMs !== undefined ? { timeoutMs } : {}),
570
+ ...(classifierFallback !== undefined ? { classifierFallback } : {}),
571
+ ...(rateLimitBreakAfter !== undefined ? { rateLimitBreakAfter } : {}),
572
+ ...(denialLimit !== undefined ? { denialLimit } : {}),
573
+ ...(copy.persistArming !== undefined ? { persistArming: copy.persistArming } : {}),
574
+ ...(copy.settingsEpoch !== undefined ? { settingsEpoch: copy.settingsEpoch } : {}),
575
+ });
467
576
  }
468
577
  export function screenAutoModeKnobs(face) {
469
- autoModeTimeoutMsOf(face.timeoutMs);
470
- autoModeClassifierFallbackOf(face.classifierFallback);
471
- autoModeDenialLimitOf(face.denialLimit);
472
- autoModeRateLimitBreakAfterOf(face.rateLimitBreakAfter);
578
+ void receiveAutoModeFace(face);
473
579
  }
474
580
  export function createAutoModeDenialTracker(opts) {
475
581
  const { maxConsecutive, maxTotal, autoDenyAfterMs } = autoModeDenialLimitOf(opts);
@@ -667,6 +667,7 @@ export declare function reconcileParkedAgents(stores: {
667
667
  }): Promise<{
668
668
  failed: number;
669
669
  rolledBack: number;
670
+ unreadable: number;
670
671
  }>;
671
672
  /** A background agent row's ending as every face reads it: the row's own outcome when it is this row's (it reads, and its word
672
673
  * projects onto the row's status — {@link memberRowStatusOf}), taken in sealed; else the one derived from the row's status words
@@ -264,6 +264,32 @@ export async function parkedCardState(store, card) {
264
264
  }
265
265
  export async function reconcileParkedAgents(stores, scope, now, opts) {
266
266
  const out = { failed: 0, rolledBack: 0 };
267
+ const unreadable = new Set();
268
+ const isMalformedRowError = (e) => e?.code === BACKGROUND_AGENT_ROW_MALFORMED_CODE;
269
+ const readRow = async (handle) => {
270
+ try {
271
+ return await stores.agentStore.get(handle, scope);
272
+ }
273
+ catch (e) {
274
+ if (isMalformedRowError(e)) {
275
+ unreadable.add(handle);
276
+ return null;
277
+ }
278
+ throw e;
279
+ }
280
+ };
281
+ const updateRowIf = async (row, next, expect) => {
282
+ try {
283
+ return await stores.agentStore.updateIf(row.handle, scope, next, expect);
284
+ }
285
+ catch (e) {
286
+ if (isMalformedRowError(e)) {
287
+ unreadable.add(row.handle);
288
+ return false;
289
+ }
290
+ throw e;
291
+ }
292
+ };
267
293
  const excluded = (row) => (opts?.excludeHandles?.has(row.handle) ?? false) ||
268
294
  (opts?.excludeWriterId !== undefined && row.writerId === opts.excludeWriterId);
269
295
  const failRow = async (row, why) => {
@@ -277,13 +303,24 @@ export async function reconcileParkedAgents(stores, scope, now, opts) {
277
303
  delete next.parkedCheckpointToken;
278
304
  delete next.parkClaimId;
279
305
  delete next.parkedAt;
280
- return stores.agentStore.update(row.handle, scope, next, { rev: row.rev });
306
+ try {
307
+ return await stores.agentStore.update(row.handle, scope, next, { rev: row.rev });
308
+ }
309
+ catch (e) {
310
+ if (isMalformedRowError(e)) {
311
+ unreadable.add(row.handle);
312
+ return false;
313
+ }
314
+ throw e;
315
+ }
281
316
  };
282
317
  const checkpointState = (row, token) => parkedCardState(stores.checkpointStore, { token, handle: row.handle, scope, sessionId: row.sessionId });
283
318
  for (const summary of await stores.agentStore.listByScope(scope, { status: "parked" })) {
284
- if ("rowVerdict" in summary)
319
+ if ("rowVerdict" in summary) {
320
+ unreadable.add(summary.handle);
285
321
  continue;
286
- const row = await stores.agentStore.get(summary.handle, scope);
322
+ }
323
+ const row = await readRow(summary.handle);
287
324
  if (!row || row.status !== "parked")
288
325
  continue;
289
326
  if (excluded(row))
@@ -305,9 +342,13 @@ export async function reconcileParkedAgents(stores, scope, now, opts) {
305
342
  const staleClaims = [];
306
343
  for (const status of ["parked", "running"]) {
307
344
  for (const summary of await stores.agentStore.listByScope(scope, { status })) {
308
- if ("rowVerdict" in summary || now - summary.updatedAt <= staleMs)
345
+ if ("rowVerdict" in summary) {
346
+ unreadable.add(summary.handle);
347
+ continue;
348
+ }
349
+ if (now - summary.updatedAt <= staleMs)
309
350
  continue;
310
- const row = await stores.agentStore.get(summary.handle, scope);
351
+ const row = await readRow(summary.handle);
311
352
  if (!row || row.status !== status)
312
353
  continue;
313
354
  if (row.parkClaimId === undefined && !(status === "parked" && row.parkedCheckpointToken !== undefined))
@@ -337,7 +378,7 @@ export async function reconcileParkedAgents(stores, scope, now, opts) {
337
378
  next.writerEpoch = (row.writerEpoch ?? 0) + 1;
338
379
  next.updatedAt = now;
339
380
  delete next.parkClaimId;
340
- if (await stores.agentStore.updateIf(row.handle, scope, next, { rev: row.rev, status: "parked", parkClaimId: row.parkClaimId }))
381
+ if (await updateRowIf(row, next, { rev: row.rev, status: "parked", parkClaimId: row.parkClaimId }))
341
382
  out.rolledBack++;
342
383
  }
343
384
  else if (state === "resolved") {
@@ -352,7 +393,7 @@ export async function reconcileParkedAgents(stores, scope, now, opts) {
352
393
  next.status = "parked";
353
394
  next.updatedAt = now;
354
395
  delete next.parkClaimId;
355
- if (await stores.agentStore.updateIf(row.handle, scope, next, { rev: row.rev, status: "running", parkClaimId: row.parkClaimId }))
396
+ if (await updateRowIf(row, next, { rev: row.rev, status: "running", parkClaimId: row.parkClaimId }))
356
397
  out.rolledBack++;
357
398
  }
358
399
  else if (state === "expired" || state === "missing") {
@@ -366,7 +407,7 @@ export async function reconcileParkedAgents(stores, scope, now, opts) {
366
407
  }
367
408
  }
368
409
  }
369
- return out;
410
+ return { failed: out.failed, rolledBack: out.rolledBack, unreadable: unreadable.size };
370
411
  }
371
412
  export function agentOutcomeOf(row) {
372
413
  if (!isBackgroundAgentSettledStatus(row.status))
@@ -236,11 +236,12 @@ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "g
236
236
  * roster, its answer face, the approval seat's value, whether the posture's human is reachable) still refuses after the claim, each for a stated reason (INTEGRATION-CORE, "A resume's two doors").
237
237
  * The re-supplied config's one read (`readCallerSpec`, the read a run takes of its spec) refuses with its own two words, last in the set:
238
238
  * a member whose read throws (`config.spec_member_unreadable`) and a key the engine does not read (`config.spec_unknown_key`); its third,
239
- * a retired key, is `config.spec_retired_key` (first).
239
+ * a retired key, is `config.spec_retired_key` (first); the project seat it screens refuses as `config.invalid_argument` or, for an `id` that
240
+ * is no UUID, `config.project_id_invalid` (last).
240
241
  *
241
242
  * A SUBSET of {@link CONFIG_REFUSAL_CODES}, the family's whole refusal vocabulary: the words a resume's screen can produce, held to that set at compile time.
242
243
  */
243
- export declare const CHECKPOINT_CONFIG_REFUSAL_CODES: readonly ["config.spec_retired_key", "config.output_style_invalid", "config.language_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.run_origin_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.advisor_tool_invalid", "config.advisor_model_invalid", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.invalid_session_store", "config.skill_base_dir_invalid", "config.host_floor_invalid", "config.credential_in_declaration", "config.credential_ref_invalid", "config.peer_seat_missing", "config.interaction_posture", "config.agents.no_delegation_tool", "config.spec_member_unreadable", "config.spec_unknown_key", "config.agent_config_dir_invalid", "config.agent_home_dir_invalid"];
244
+ export declare const CHECKPOINT_CONFIG_REFUSAL_CODES: readonly ["config.spec_retired_key", "config.output_style_invalid", "config.language_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.run_origin_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.advisor_tool_invalid", "config.advisor_model_invalid", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.invalid_session_store", "config.skill_base_dir_invalid", "config.host_floor_invalid", "config.credential_in_declaration", "config.credential_ref_invalid", "config.peer_seat_missing", "config.interaction_posture", "config.agents.no_delegation_tool", "config.spec_member_unreadable", "config.spec_unknown_key", "config.agent_config_dir_invalid", "config.agent_home_dir_invalid", "config.project_id_invalid"];
244
245
  export type CheckpointConfigRefusalCode = (typeof CHECKPOINT_CONFIG_REFUSAL_CODES)[number];
245
246
  export declare const isCheckpointConfigRefusalCode: (word: unknown) => word is CheckpointConfigRefusalCode;
246
247
  /** The words of a {@link CheckpointError}'s optional `detail.field` (what each means: the `detail` member's doc). A CLOSED SET with one home, registered in
@@ -75,7 +75,7 @@ export const MAX_SUPPORTED_CHECKPOINT_VERSION = 10;
75
75
  export function checkpointVersionOf(cp) {
76
76
  return cp.version ?? 0;
77
77
  }
78
- export const CHECKPOINT_CONFIG_REFUSAL_CODES = Object.freeze(["config.spec_retired_key", "config.output_style_invalid", "config.language_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.run_origin_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.advisor_tool_invalid", "config.advisor_model_invalid", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.invalid_session_store", "config.skill_base_dir_invalid", "config.host_floor_invalid", "config.credential_in_declaration", "config.credential_ref_invalid", "config.peer_seat_missing", "config.interaction_posture", "config.agents.no_delegation_tool", "config.spec_member_unreadable", "config.spec_unknown_key", "config.agent_config_dir_invalid", "config.agent_home_dir_invalid"]);
78
+ export const CHECKPOINT_CONFIG_REFUSAL_CODES = Object.freeze(["config.spec_retired_key", "config.output_style_invalid", "config.language_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.run_origin_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.advisor_tool_invalid", "config.advisor_model_invalid", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.invalid_session_store", "config.skill_base_dir_invalid", "config.host_floor_invalid", "config.credential_in_declaration", "config.credential_ref_invalid", "config.peer_seat_missing", "config.interaction_posture", "config.agents.no_delegation_tool", "config.spec_member_unreadable", "config.spec_unknown_key", "config.agent_config_dir_invalid", "config.agent_home_dir_invalid", "config.project_id_invalid"]);
79
79
  export const isCheckpointConfigRefusalCode = (word) => CHECKPOINT_CONFIG_REFUSAL_CODES.some((w) => w === word);
80
80
  export const CHECKPOINT_ERROR_CODES = Object.freeze([
81
81
  "checkpoint.already_exists",
@@ -20,7 +20,7 @@ import { type IdentityRekeyMap } from "./identity-rekey.js";
20
20
  */
21
21
  export declare const CHECKPOINT_IDENTITY_MEMBERS: Readonly<{
22
22
  readonly principal: readonly ["principal", "state.inheritedGate.ancestorRules[].principal"];
23
- readonly scope: readonly ["scope", "state.legScope", "durableApproval.scope"];
23
+ readonly scope: readonly ["scope", "state.legScope", "durableApproval.scope", "state.legIdentity.rootSessionScope"];
24
24
  readonly partition: readonly ["isolationScope"];
25
25
  }>;
26
26
  /**
@@ -7,7 +7,7 @@ import { isPlainRecord } from "./mods/kernel/receive.js";
7
7
  import { rekeyOwnerIdentity } from "./identity-rekey.js";
8
8
  export const CHECKPOINT_IDENTITY_MEMBERS = Object.freeze({
9
9
  principal: Object.freeze(["principal", "state.inheritedGate.ancestorRules[].principal"]),
10
- scope: Object.freeze(["scope", "state.legScope", "durableApproval.scope"]),
10
+ scope: Object.freeze(["scope", "state.legScope", "durableApproval.scope", "state.legIdentity.rootSessionScope"]),
11
11
  partition: Object.freeze(["isolationScope"]),
12
12
  });
13
13
  export const CHECKPOINT_NON_IDENTITY_MEMBERS = Object.freeze({
@@ -26,6 +26,11 @@ export const CHECKPOINT_NON_IDENTITY_MEMBERS = Object.freeze({
26
26
  "state.compositionLeg": "a composition leg's own names and host session id: ids, not an identity",
27
27
  "state.placementRootSessionId": "the placement root's session id: an id, not an identity",
28
28
  "state.rowTaskId": "the task a resumed leg runs as: an id, not an identity",
29
+ "state.legIdentity.declaredTaskId": "the task id the leg's host declared: an id, not an identity",
30
+ "state.legIdentity.parentTaskId": "the task that spawned the leg: an id, not an identity",
31
+ "state.legIdentity.rootSessionId": "a session id (the delegation tree's root): an id, not an identity",
32
+ "state.legIdentity.rootSessionIncarnation": "the occupant the tree's root session held: an id, not an identity",
33
+ "state.legIdentity.spawnName": "the leg's explicit spawn name: a name the spawning model or host chose, not an identity",
29
34
  "state.workspaceHandle": "the parked workspace's sandbox, snapshot and device ids: ids, not an identity",
30
35
  "state.handsHome": "an operating-system path: renaming a person moves no path",
31
36
  "state.inheritedGate.pathRuleAnchors": "operating-system paths the path rules anchor at: renaming a person moves no path",