@sema-agent/core 7.47.0 → 7.49.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 (431) hide show
  1. package/CHANGELOG.md +472 -0
  2. package/README.md +2 -2
  3. package/dist/agents/cascade.d.ts +2 -5
  4. package/dist/agents/child-failure.d.ts +20 -0
  5. package/dist/agents/child-failure.js +28 -0
  6. package/dist/agents/cross-session-ref.d.ts +11 -3
  7. package/dist/agents/cross-session-ref.js +6 -0
  8. package/dist/agents/cumulative-stats.d.ts +12 -15
  9. package/dist/agents/cumulative-stats.js +1 -1
  10. package/dist/agents/extra-tool-names.js +1 -1
  11. package/dist/agents/inherited-tool-pool.d.ts +17 -13
  12. package/dist/agents/inherited-tool-pool.js +4 -3
  13. package/dist/agents/peer-session-drain.d.ts +3 -2
  14. package/dist/agents/peer-session-drain.js +5 -4
  15. package/dist/agents/send-message-tool.js +2 -9
  16. package/dist/agents/subagent.d.ts +10 -29
  17. package/dist/agents/subagent.js +65 -53
  18. package/dist/agents/suspend-guard.d.ts +1 -1
  19. package/dist/agents/tool-filter.d.ts +76 -65
  20. package/dist/agents/tool-filter.js +122 -92
  21. package/dist/agents/verify.d.ts +4 -7
  22. package/dist/agents/verify.js +6 -7
  23. package/dist/bench/metrics.d.ts +1 -2
  24. package/dist/brain/anthropic.js +133 -79
  25. package/dist/brain/errors.d.ts +53 -6
  26. package/dist/brain/errors.js +22 -2
  27. package/dist/brain/input-too-long.d.ts +40 -19
  28. package/dist/brain/input-too-long.js +3 -16
  29. package/dist/brain/open-responses.js +19 -10
  30. package/dist/brain/openai.js +123 -32
  31. package/dist/brain/provider-dialect.d.ts +214 -0
  32. package/dist/brain/provider-dialect.js +186 -0
  33. package/dist/brain/request-params.d.ts +27 -8
  34. package/dist/brain/request-params.js +7 -12
  35. package/dist/brain/request-route.d.ts +84 -0
  36. package/dist/brain/request-route.js +41 -0
  37. package/dist/brain/retry.d.ts +8 -0
  38. package/dist/brain/retry.js +10 -4
  39. package/dist/brain/route-adjudicator.d.ts +7 -0
  40. package/dist/brain/route-adjudicator.js +5 -1
  41. package/dist/brain/status-sink.d.ts +20 -0
  42. package/dist/brain/status-sink.js +11 -0
  43. package/dist/brain/stream-engine.d.ts +52 -1
  44. package/dist/brain/stream-engine.js +81 -24
  45. package/dist/brain/stream-shared.d.ts +57 -11
  46. package/dist/brain/stream-shared.js +28 -2
  47. package/dist/core/a2a.d.ts +1 -0
  48. package/dist/core/agent-config-dir.js +3 -2
  49. package/dist/core/allow-entry.d.ts +21 -12
  50. package/dist/core/allow-entry.js +39 -32
  51. package/dist/core/arg-summary.d.ts +17 -24
  52. package/dist/core/arg-summary.js +169 -68
  53. package/dist/core/ask-origin.d.ts +42 -24
  54. package/dist/core/ask-origin.js +18 -13
  55. package/dist/core/auto-mode-prompt-assets.d.ts +2 -2
  56. package/dist/core/auto-mode-prompt-assets.js +1 -1
  57. package/dist/core/auto-mode-prompt.d.ts +11 -1
  58. package/dist/core/auto-mode-prompt.js +13 -10
  59. package/dist/core/auto-mode-rebuild.d.ts +7 -0
  60. package/dist/core/auto-mode-rebuild.js +4 -1
  61. package/dist/core/canonical-json.d.ts +3 -0
  62. package/dist/core/canonical-json.js +2 -1
  63. package/dist/core/checkpoint-requirements.d.ts +892 -0
  64. package/dist/core/checkpoint-requirements.js +333 -0
  65. package/dist/core/checkpoint-store.d.ts +95 -66
  66. package/dist/core/checkpoint-store.js +14 -26
  67. package/dist/core/child-clamp-seats.d.ts +228 -69
  68. package/dist/core/child-clamp-seats.js +211 -17
  69. package/dist/core/classifier-unavailable-arm.d.ts +5 -1
  70. package/dist/core/classifier-unavailable-arm.js +3 -3
  71. package/dist/core/compliance.d.ts +3 -0
  72. package/dist/core/compliance.js +9 -4
  73. package/dist/core/credential-vocabulary.d.ts +140 -0
  74. package/dist/core/credential-vocabulary.js +131 -0
  75. package/dist/core/decision-receipt.js +1 -1
  76. package/dist/core/effective-path-target.d.ts +73 -16
  77. package/dist/core/effective-path-target.js +63 -33
  78. package/dist/core/engine-notice.d.ts +32 -7
  79. package/dist/core/file-history-store.js +2 -2
  80. package/dist/core/fs-write-gate-policy.d.ts +4 -0
  81. package/dist/core/fs-write-gate-policy.js +22 -5
  82. package/dist/core/gate-bounded-await.d.ts +28 -13
  83. package/dist/core/gate-bounded-await.js +41 -4
  84. package/dist/core/gate-fold.d.ts +1 -1
  85. package/dist/core/gate-fold.js +24 -25
  86. package/dist/core/gate-lanes.js +16 -15
  87. package/dist/core/gate-outcome.d.ts +20 -5
  88. package/dist/core/gate-outcome.js +5 -0
  89. package/dist/core/governance-codes.d.ts +11 -4
  90. package/dist/core/governance-codes.js +14 -3
  91. package/dist/core/hooks.d.ts +4 -0
  92. package/dist/core/locked-config.d.ts +8 -0
  93. package/dist/core/locked-config.js +14 -2
  94. package/dist/core/lsp.js +3 -5
  95. package/dist/core/mailbox-store.d.ts +3 -4
  96. package/dist/core/mcp-connection-pool.d.ts +75 -0
  97. package/dist/core/mcp-connection-pool.js +128 -0
  98. package/dist/core/mcp-failure.d.ts +2 -1
  99. package/dist/core/mcp-failure.js +13 -2
  100. package/dist/core/mcp-server-spec.d.ts +1 -1
  101. package/dist/core/mcp.d.ts +4 -0
  102. package/dist/core/mcp.js +70 -43
  103. package/dist/core/memory-engine/content-origin.js +2 -14
  104. package/dist/core/memory-engine/engine.d.ts +32 -22
  105. package/dist/core/memory-engine/engine.js +103 -55
  106. package/dist/core/memory-engine/file-backend.d.ts +13 -30
  107. package/dist/core/memory-engine/file-backend.js +37 -252
  108. package/dist/core/memory-engine/index.d.ts +1 -1
  109. package/dist/core/memory-engine/index.js +1 -1
  110. package/dist/core/memory-engine/layout.d.ts +139 -9
  111. package/dist/core/memory-engine/layout.js +350 -7
  112. package/dist/core/memory-engine/scope-contract.d.ts +10 -0
  113. package/dist/core/memory-engine/scope-contract.js +8 -0
  114. package/dist/core/memory-engine/session-incarnation.d.ts +14 -4
  115. package/dist/core/memory-engine/session-incarnation.js +5 -2
  116. package/dist/core/memory-engine/types.d.ts +10 -1
  117. package/dist/core/memory.js +5 -17
  118. package/dist/core/model-seat.d.ts +4 -4
  119. package/dist/core/model-seat.js +1 -1
  120. package/dist/core/mounted-mcp.d.ts +57 -0
  121. package/dist/core/mounted-mcp.js +19 -0
  122. package/dist/core/namespaced-rule-name.d.ts +29 -0
  123. package/dist/core/namespaced-rule-name.js +52 -0
  124. package/dist/core/park-selfcheck.d.ts +1 -1
  125. package/dist/core/park-selfcheck.js +16 -6
  126. package/dist/core/path-guard-rows.d.ts +99 -0
  127. package/dist/core/path-guard-rows.js +45 -0
  128. package/dist/core/path-identity.d.ts +22 -16
  129. package/dist/core/path-identity.js +10 -10
  130. package/dist/core/path-rule-binding.d.ts +2 -1
  131. package/dist/core/path-rule-binding.js +3 -1
  132. package/dist/core/pause-registry.d.ts +16 -2
  133. package/dist/core/pause-registry.js +6 -0
  134. package/dist/core/permission-rule-consent.js +0 -7
  135. package/dist/core/permission-rule-model.d.ts +68 -24
  136. package/dist/core/permission-rule-model.js +105 -24
  137. package/dist/core/permission-rule-store.js +2 -2
  138. package/dist/core/permission-rules.d.ts +3 -30
  139. package/dist/core/permission-rules.js +4 -54
  140. package/dist/core/read-root-candidate.d.ts +1 -3
  141. package/dist/core/read-root-candidate.js +4 -15
  142. package/dist/core/real-approval.d.ts +4 -3
  143. package/dist/core/retired-keys.d.ts +13 -0
  144. package/dist/core/retired-keys.js +14 -0
  145. package/dist/core/roles.d.ts +2 -3
  146. package/dist/core/roles.js +15 -6
  147. package/dist/core/runner/assemble-result.d.ts +0 -7
  148. package/dist/core/runner/assemble-result.js +19 -31
  149. package/dist/core/runner/caller-roster.d.ts +78 -0
  150. package/dist/core/runner/caller-roster.js +219 -0
  151. package/dist/core/runner/checkpoint-scope.d.ts +16 -16
  152. package/dist/core/runner/checkpoint-scope.js +2 -2
  153. package/dist/core/runner/child-tree.js +2 -2
  154. package/dist/core/runner/contracts.d.ts +68 -35
  155. package/dist/core/runner/decide-continuation.d.ts +51 -3
  156. package/dist/core/runner/decide-continuation.js +76 -21
  157. package/dist/core/runner/denial-limit-arms.d.ts +17 -5
  158. package/dist/core/runner/denial-limit-arms.js +11 -9
  159. package/dist/core/runner/extra-body-dropped-seat.d.ts +8 -0
  160. package/dist/core/runner/extra-body-dropped-seat.js +22 -0
  161. package/dist/core/runner/finish-reason-seat.d.ts +9 -0
  162. package/dist/core/runner/finish-reason-seat.js +40 -0
  163. package/dist/core/runner/gate-exit.d.ts +44 -32
  164. package/dist/core/runner/gate-exit.js +112 -25
  165. package/dist/core/runner/inherited-ask-grants.js +6 -4
  166. package/dist/core/runner/mcp-redial.d.ts +3 -3
  167. package/dist/core/runner/mcp-redial.js +3 -4
  168. package/dist/core/runner/park-commit.d.ts +1 -1
  169. package/dist/core/runner/permission-rule-lanes.d.ts +1 -2
  170. package/dist/core/runner/permission-rule-lanes.js +5 -4
  171. package/dist/core/runner/prepare-artifact.d.ts +4 -0
  172. package/dist/core/runner/prepare-artifact.js +2 -1
  173. package/dist/core/runner/prepare-ask-lane.d.ts +2 -0
  174. package/dist/core/runner/prepare-ask-lane.js +12 -6
  175. package/dist/core/runner/prepare-boundary-parks.d.ts +5 -8
  176. package/dist/core/runner/prepare-boundary-parks.js +4 -7
  177. package/dist/core/runner/prepare-caps-and-workflow.d.ts +11 -15
  178. package/dist/core/runner/prepare-caps-and-workflow.js +19 -27
  179. package/dist/core/runner/prepare-config-doors.d.ts +9 -9
  180. package/dist/core/runner/prepare-config-doors.js +10 -5
  181. package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
  182. package/dist/core/runner/prepare-defer-classify.js +5 -3
  183. package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
  184. package/dist/core/runner/prepare-delegation-surface.js +3 -3
  185. package/dist/core/runner/prepare-gate-stations.d.ts +4 -4
  186. package/dist/core/runner/prepare-gate-stations.js +9 -7
  187. package/dist/core/runner/prepare-hands-readface.d.ts +7 -7
  188. package/dist/core/runner/prepare-hands-readface.js +7 -7
  189. package/dist/core/runner/prepare-inherited-gate.d.ts +7 -6
  190. package/dist/core/runner/prepare-inherited-gate.js +14 -15
  191. package/dist/core/runner/prepare-listings.d.ts +7 -24
  192. package/dist/core/runner/prepare-listings.js +4 -5
  193. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -0
  194. package/dist/core/runner/prepare-memory-engine-session.js +4 -3
  195. package/dist/core/runner/prepare-memory.d.ts +6 -0
  196. package/dist/core/runner/prepare-memory.js +13 -13
  197. package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -0
  198. package/dist/core/runner/prepare-offload-wrappers.js +3 -3
  199. package/dist/core/runner/prepare-park-ask.d.ts +7 -8
  200. package/dist/core/runner/prepare-park-ask.js +17 -10
  201. package/dist/core/runner/prepare-policy-chain.js +24 -44
  202. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  203. package/dist/core/runner/prepare-project-context.js +3 -4
  204. package/dist/core/runner/prepare-protocol-tools.d.ts +9 -3
  205. package/dist/core/runner/prepare-protocol-tools.js +3 -4
  206. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  207. package/dist/core/runner/prepare-run-refs.js +2 -1
  208. package/dist/core/runner/prepare-safety-scan.d.ts +4 -8
  209. package/dist/core/runner/prepare-safety-scan.js +1 -2
  210. package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
  211. package/dist/core/runner/prepare-suspend-saga.js +28 -12
  212. package/dist/core/runner/prepare-task.d.ts +1 -1
  213. package/dist/core/runner/prepare-task.js +67 -56
  214. package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -10
  215. package/dist/core/runner/prepare-wiring-manifest.js +5 -8
  216. package/dist/core/runner/resume-apply.js +7 -14
  217. package/dist/core/runner/resume-checkpoint-screen.js +11 -4
  218. package/dist/core/runner/resume-internals-and-config.js +2 -2
  219. package/dist/core/runner/resume-policy-outcome.js +5 -32
  220. package/dist/core/runner/resume-review-outcome.js +4 -1
  221. package/dist/core/runner/retired-runner-deps.d.ts +6 -0
  222. package/dist/core/runner/retired-runner-deps.js +10 -1
  223. package/dist/core/runner/run-brain-sinks.d.ts +4 -0
  224. package/dist/core/runner/run-brain-sinks.js +5 -2
  225. package/dist/core/runner/run-harness-handlers.js +27 -34
  226. package/dist/core/runner/run-leg.d.ts +0 -2
  227. package/dist/core/runner/run-leg.js +32 -33
  228. package/dist/core/runner/run-terminal-adoption.js +4 -3
  229. package/dist/core/runner/runtask.js +8 -8
  230. package/dist/core/runner/session-rule-policy.js +5 -5
  231. package/dist/core/runner/stream-settle-backstop.js +7 -4
  232. package/dist/core/runner/sub-agent-deny-lists.d.ts +51 -12
  233. package/dist/core/runner/sub-agent-deny-lists.js +111 -80
  234. package/dist/core/runner/terminal-account.d.ts +48 -0
  235. package/dist/core/runner/terminal-account.js +186 -0
  236. package/dist/core/runner/tool-end-body.d.ts +54 -17
  237. package/dist/core/runner/tool-end-body.js +27 -2
  238. package/dist/core/runner/tool-face-overlay.d.ts +3 -1
  239. package/dist/core/runner/tool-face-overlay.js +6 -4
  240. package/dist/core/runner/tool-occurrence.d.ts +106 -0
  241. package/dist/core/runner/tool-occurrence.js +123 -0
  242. package/dist/core/runner/tool-progress-lane.d.ts +16 -8
  243. package/dist/core/runner/tool-progress-lane.js +25 -34
  244. package/dist/core/runner/turn-attachments.d.ts +1 -1
  245. package/dist/core/runner/write-protection-station.d.ts +21 -9
  246. package/dist/core/runner/write-protection-station.js +20 -17
  247. package/dist/core/runner-deps.d.ts +12 -22
  248. package/dist/core/safety-axis-vocab.d.ts +1 -1
  249. package/dist/core/safety-merge-corpus.d.ts +1 -1
  250. package/dist/core/secret-env.d.ts +16 -5
  251. package/dist/core/secret-env.js +23 -63
  252. package/dist/core/sensitive-path-policy.d.ts +19 -18
  253. package/dist/core/sensitive-path-policy.js +73 -49
  254. package/dist/core/session-policy-store.d.ts +6 -3
  255. package/dist/core/session-policy-store.js +28 -10
  256. package/dist/core/session-reconcile.d.ts +3 -0
  257. package/dist/core/session-reconcile.js +5 -4
  258. package/dist/core/session-store.d.ts +5 -0
  259. package/dist/core/session-store.js +12 -0
  260. package/dist/core/session.d.ts +13 -0
  261. package/dist/core/shared-memory/normalize.d.ts +17 -4
  262. package/dist/core/shared-memory/normalize.js +7 -7
  263. package/dist/core/shell-lexer.js +5 -4
  264. package/dist/core/shell-wrapper-table.d.ts +2 -2
  265. package/dist/core/shell-wrapper-table.js +1 -1
  266. package/dist/core/skill-grant.js +1 -1
  267. package/dist/core/store-contracts/checkpoint-store-contract.js +13 -0
  268. package/dist/core/store-contracts/mailbox-store-contract.d.ts +7 -14
  269. package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +27 -0
  270. package/dist/core/store-contracts/session-store-incarnation-contract.js +92 -0
  271. package/dist/core/stub-env.d.ts +2 -0
  272. package/dist/core/stub-env.js +1 -0
  273. package/dist/core/synthetic-read-verdict.js +2 -2
  274. package/dist/core/task-event.d.ts +59 -5
  275. package/dist/core/task-result.d.ts +1 -1
  276. package/dist/core/task-spec.d.ts +42 -9
  277. package/dist/core/terminal-cause.d.ts +94 -11
  278. package/dist/core/tighten-task-spec.d.ts +5 -4
  279. package/dist/core/tighten-task-spec.js +20 -25
  280. package/dist/core/tool-catalog-entries.d.ts +5 -7
  281. package/dist/core/tool-catalog-entries.js +14 -15
  282. package/dist/core/tool-face.d.ts +47 -0
  283. package/dist/core/tool-face.js +5 -0
  284. package/dist/core/tool-model-gate.d.ts +5 -5
  285. package/dist/core/tool-name-aliases.d.ts +35 -10
  286. package/dist/core/tool-name-aliases.js +15 -0
  287. package/dist/core/tool-name-list.d.ts +30 -0
  288. package/dist/core/tool-name-list.js +55 -0
  289. package/dist/core/tool-name-readings.d.ts +1 -9
  290. package/dist/core/tool-name-readings.js +1 -3
  291. package/dist/core/tool-policy.d.ts +195 -85
  292. package/dist/core/tool-policy.js +165 -381
  293. package/dist/core/tool-registry.d.ts +44 -1
  294. package/dist/core/tool-registry.js +26 -0
  295. package/dist/core/tool-roster.d.ts +19 -1
  296. package/dist/core/tool-roster.js +21 -2
  297. package/dist/core/tool-spec-members.d.ts +45 -0
  298. package/dist/core/tool-spec-members.js +169 -0
  299. package/dist/core/tool-spec.d.ts +46 -8
  300. package/dist/core/tools.d.ts +6 -2
  301. package/dist/core/tools.js +8 -4
  302. package/dist/core/untrusted-egress.js +29 -26
  303. package/dist/core/untrusted-text.d.ts +13 -10
  304. package/dist/core/untrusted-text.js +6 -44
  305. package/dist/core/workflow-journal-store.d.ts +4 -1
  306. package/dist/core/write-protect.d.ts +65 -29
  307. package/dist/core/write-protect.js +235 -177
  308. package/dist/engine/compaction/compaction.d.ts +2 -2
  309. package/dist/engine/execution-env/node-execution-env.d.ts +5 -23
  310. package/dist/engine/execution-env/node-execution-env.js +16 -38
  311. package/dist/engine/execution-env/symlink-chain.d.ts +23 -0
  312. package/dist/engine/execution-env/symlink-chain.js +32 -0
  313. package/dist/engine/harness/types.d.ts +7 -0
  314. package/dist/engine/llm/tool-turns.d.ts +3 -0
  315. package/dist/engine/llm/tool-turns.js +1 -0
  316. package/dist/engine/llm/types.d.ts +59 -23
  317. package/dist/engine/loop/agent-loop.js +16 -2
  318. package/dist/engine/session/memory-repo.js +11 -3
  319. package/dist/engine/session/repo-utils.d.ts +8 -0
  320. package/dist/engine/session/repo-utils.js +13 -0
  321. package/dist/index.d.ts +20 -23
  322. package/dist/index.js +17 -20
  323. package/dist/internal/harness.d.ts +1 -1
  324. package/dist/internal/harness.js +1 -1
  325. package/dist/internal/llm.d.ts +2 -2
  326. package/dist/internal/llm.js +1 -1
  327. package/dist/orchestration/governance-baseline-validity.js +1 -1
  328. package/dist/orchestration/run-spec.js +3 -3
  329. package/dist/orchestration/run-workflow-tool.d.ts +16 -35
  330. package/dist/orchestration/run-workflow-tool.js +38 -78
  331. package/dist/orchestration/workflow-governance.d.ts +21 -25
  332. package/dist/orchestration/workflow-governance.js +38 -78
  333. package/dist/orchestration/workflow-primitives.d.ts +7 -22
  334. package/dist/orchestration/workflow-primitives.js +5 -12
  335. package/dist/orchestration/workflow-types.d.ts +1 -1
  336. package/dist/orchestration/workflow.d.ts +61 -11
  337. package/dist/orchestration/workflow.js +191 -119
  338. package/dist/prompt-assembly/types.d.ts +1 -1
  339. package/dist/scenarios/full-body.d.ts +1 -1
  340. package/dist/shell/lex.d.ts +0 -21
  341. package/dist/shell/lex.js +278 -70
  342. package/dist/shell/shell-words.d.ts +35 -0
  343. package/dist/shell/shell-words.js +65 -0
  344. package/dist/stores/file/checkpoint-store.d.ts +5 -5
  345. package/dist/stores/file/checkpoint-store.js +5 -2
  346. package/dist/stores/file/index.d.ts +0 -8
  347. package/dist/stores/file/index.js +0 -12
  348. package/dist/stores/file/session-store.d.ts +3 -0
  349. package/dist/stores/file/session-store.js +44 -19
  350. package/dist/tools/artifact/artifact-tool.js +2 -0
  351. package/dist/tools/fs/bash-program-position.d.ts +17 -3
  352. package/dist/tools/fs/bash-program-position.js +25 -10
  353. package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
  354. package/dist/tools/fs/bash-readonly-classifier.js +8 -7
  355. package/dist/tools/fs/containment-face.d.ts +4 -0
  356. package/dist/tools/fs/containment-face.js +3 -0
  357. package/dist/tools/fs/fs-shared.d.ts +10 -0
  358. package/dist/tools/fs/fs-shared.js +18 -0
  359. package/dist/tools/fs/fs-write.js +4 -2
  360. package/dist/tools/fs/index.d.ts +3 -2
  361. package/dist/tools/fs/index.js +2 -2
  362. package/dist/tools/fs/program-read-model.d.ts +99 -23
  363. package/dist/tools/fs/program-read-model.js +129 -55
  364. package/dist/tools/fs/program-read-model.rows.d.ts +0 -14
  365. package/dist/tools/fs/program-read-model.rows.js +18 -10
  366. package/dist/tools/fs/read-deny-home.d.ts +35 -30
  367. package/dist/tools/fs/read-deny-home.js +45 -38
  368. package/dist/tools/fs/read-deny.d.ts +35 -27
  369. package/dist/tools/fs/read-deny.js +126 -92
  370. package/dist/tools/fs/removal-targets.d.ts +56 -23
  371. package/dist/tools/fs/removal-targets.js +74 -87
  372. package/dist/tools/fs/safety.d.ts +29 -22
  373. package/dist/tools/fs/safety.js +17 -11
  374. package/dist/tools/fs/search.js +10 -8
  375. package/dist/tools/fs/shell-read-argv.d.ts +4 -7
  376. package/dist/tools/fs/shell-read-argv.js +6 -8
  377. package/dist/tools/fs/shell-read-bindings.d.ts +203 -46
  378. package/dist/tools/fs/shell-read-bindings.js +488 -144
  379. package/dist/tools/fs/shell-read-builtins.d.ts +35 -0
  380. package/dist/tools/fs/shell-read-builtins.js +43 -0
  381. package/dist/tools/fs/shell-read-check.d.ts +15 -1
  382. package/dist/tools/fs/shell-read-check.js +51 -42
  383. package/dist/tools/fs/shell-read-establish.js +9 -10
  384. package/dist/tools/fs/shell-read-functions.d.ts +22 -0
  385. package/dist/tools/fs/shell-read-functions.js +29 -0
  386. package/dist/tools/fs/shell-read-judge.d.ts +48 -18
  387. package/dist/tools/fs/shell-read-judge.js +33 -4
  388. package/dist/tools/fs/shell-read-plan.d.ts +13 -20
  389. package/dist/tools/fs/shell-read-plan.js +200 -194
  390. package/dist/tools/fs/shell-read-start.d.ts +80 -0
  391. package/dist/tools/fs/shell-read-start.js +99 -0
  392. package/dist/tools/fs/shell-read-word.d.ts +35 -6
  393. package/dist/tools/fs/shell-read-word.js +89 -9
  394. package/dist/tools/fs/shell-read-workdir.d.ts +156 -0
  395. package/dist/tools/fs/shell-read-workdir.js +281 -0
  396. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -2
  397. package/dist/tools/fs/shell-read-write-targets.js +14 -5
  398. package/dist/tools/fs/shell-reentry-text.d.ts +26 -26
  399. package/dist/tools/fs/shell-reentry-text.js +31 -34
  400. package/dist/tools/task-list.d.ts +1 -2
  401. package/dist/tools/web.js +1 -1
  402. package/package.json +4 -1
  403. package/test/export-surface.snapshot.json +107 -143
  404. package/wire-changes/core@7.48.0.json +252 -0
  405. package/wire-changes/core@7.49.0.json +4765 -0
  406. package/dist/agents/teacher.d.ts +0 -159
  407. package/dist/agents/teacher.js +0 -577
  408. package/dist/agents/team.d.ts +0 -226
  409. package/dist/agents/team.js +0 -257
  410. package/dist/core/strategy-store.d.ts +0 -238
  411. package/dist/core/strategy-store.js +0 -253
  412. package/dist/orchestration/builtin-workflows.d.ts +0 -133
  413. package/dist/orchestration/builtin-workflows.js +0 -159
  414. package/dist/scenarios/env.d.ts +0 -40
  415. package/dist/scenarios/env.js +0 -39
  416. package/dist/scenarios/scenario-registry.d.ts +0 -110
  417. package/dist/scenarios/scenario-registry.js +0 -140
  418. package/dist/scenarios/teacher-quickstart.d.ts +0 -40
  419. package/dist/scenarios/teacher-quickstart.js +0 -12
  420. package/dist/stores/cc/lockfile.d.ts +0 -10
  421. package/dist/stores/cc/lockfile.js +0 -98
  422. package/dist/stores/cc/mailbox-store.d.ts +0 -20
  423. package/dist/stores/cc/mailbox-store.js +0 -255
  424. package/dist/stores/cc/roster-adapter.d.ts +0 -12
  425. package/dist/stores/cc/roster-adapter.js +0 -117
  426. package/dist/stores/cc/sidecar-transcript.d.ts +0 -97
  427. package/dist/stores/cc/sidecar-transcript.js +0 -264
  428. package/dist/stores/cc/task-list-store.d.ts +0 -2
  429. package/dist/stores/cc/task-list-store.js +0 -125
  430. package/dist/stores/file/strategy-store.d.ts +0 -97
  431. package/dist/stores/file/strategy-store.js +0 -341
@@ -19,6 +19,11 @@ export interface ToolCallFace {
19
19
  contractId: string;
20
20
  shapeDigest: string;
21
21
  implementationRevision: string;
22
+ /** Which approval card this call renders under (the closed set `TOOL_APPROVAL_CARDS`; `generic` when the tool
23
+ * declares none). Minted with the face — a reserved card only for the engine tool that owns it — and copied onto the
24
+ * ask, the parked gate and the pending row, so no reader recovers the card from a name. Absent on a face rebuilt
25
+ * from a park row (a re-judgment reads no card). */
26
+ approvalCard?: import("./tool-face.js").ToolApprovalCard;
22
27
  }
23
28
  export interface ToolCallRequest {
24
29
  /** The tool's wire name — the Runner's gate resolves a call made under an alias to the wire name of the tool it
@@ -114,6 +119,17 @@ export interface ToolCallRequest {
114
119
  * directory by writing one back.
115
120
  */
116
121
  advertisedWritableRoots?: readonly string[];
122
+ /**
123
+ * The engine data root's spellings — the ONE exempt root every exemptible path row is judged under (the data-root
124
+ * exemption, path-guard-rows.ts): resolved once per leg from `RunnerDeps.memoryEngineDir` (absent ⇒ the resolver's own
125
+ * chain, `$AGENT_DATA_DIR ?? ~/.ai-agent`) and stamped by the Runner on every policy adjudication of the leg. A path guard
126
+ * that judges a write under the exemption reads it here, so the guard and the engine's own write judgment speak about
127
+ * the same directory instead of a second copy the deployment keeps by hand.
128
+ *
129
+ * ABSENT outside a Runner (a policy driven directly by a host): the guard then reads the resolver's own chain, the root
130
+ * a Runner with no `memoryEngineDir` would stamp. Read-only, frozen.
131
+ */
132
+ exemptRoots?: readonly string[];
117
133
  /**
118
134
  * design/80 D-E-core: read-only per-run budget snapshot so a STATELESS policy can self-limit against
119
135
  * state that survives suspend/resume (a fresh in-memory counter would reset every leg — the supervisor
@@ -177,68 +193,87 @@ export declare function advertisedWritableRootsSeat(seat: {
177
193
  } | undefined): {
178
194
  advertisedWritableRoots?: readonly string[];
179
195
  };
196
+ /** Stamp {@link ToolCallRequest.exemptRoots} from the leg's one resolution of the data root — the ONE place that value
197
+ * becomes a request field, beside {@link advertisedWritableRootsSeat} at every adjudication station. */
198
+ export declare function exemptRootsSeat(exemptRoots: readonly string[]): {
199
+ exemptRoots: readonly string[];
200
+ };
180
201
  /** Declared beside the receipt's list (decision-receipt.ts) — a new member added to either side is a compile error rather
181
202
  * than a silent drift between the type and the screen; re-exported here, the module every consumer of the decision reads. */
182
203
  export type { DecisionReason };
183
- /** The `task_aborted`-attested deny an engine policy answers on an aborted signal instead of reaching a seat. */
184
- export declare function abortedSeatDeny(req: {
185
- toolCallId: string;
186
- toolName: string;
187
- }, message: string, origin: AskOrigin): PermissionResult;
188
- /** Carry every engine attestation from a decision onto a reconstruction of it — the
189
- * seam for the engine's OWN clone sites outside this module (the inherited chain's final-form re-check carries the
190
- * post-rewrite args on a spread of an ancestor's deny). Returns the reconstruction. Not re-exported from `src/index.ts`. */
191
- export declare function carryEngineAttestations<T extends object>(from: object, to: T): T;
192
- /** Carry a PRECEDING decision's settlement onto a later deny that has none of its own — the veto record (a person's
193
- * yes on the settlement, the refusing layer on the disposition; invariant I3) for the engine's own clone sites,
194
- * where the deny is minted over a decision that already carried an attested approval. A deny that carries its own
195
- * settlement keeps it (the latest resolution wins). Not re-exported from `src/index.ts`. */
196
- export declare function carryPrecedingSettlement(preceding: object, to: object): void;
197
- /** Attest that `d` is a deny a classifier station minted for `call` out of a round of the named FORM. */
198
- export declare function attestClassifierDenyCause<T extends object>(d: T, cause: import("./gate-outcome.js").ClassifierDenyCause, call: {
199
- toolCallId: string;
200
- toolName: string;
201
- }): T;
202
- /** Read the attested classifier cause off a deny FOR the named call (the gate's fold and exit are the
203
- * consumers): a binding to a different call is a replayed object and answers absence. An internal seam
204
- * between engine modules — deliberately NOT re-exported from `src/index.ts`. */
205
- export declare function classifierDenyCauseOf(d: unknown, call: {
206
- toolCallId: string;
207
- toolName: string;
208
- }): import("./gate-outcome.js").ClassifierDenyCause | undefined;
209
- /** Attest that `d` is a decision a classifier station minted for `call` out of the named classification. */
210
- export declare function attestClassifierRound<T extends object>(d: T, round: import("./auto-mode.js").AutoModeClassifierRound, call: {
204
+ /**
205
+ * The engine's ATTESTATION record — the one carrier of what an engine station knows about a decision and a policy cannot
206
+ * state: WHO settled the call's wait and WHICH question that answered (the settlement, the ask's origin word and class set,
207
+ * the digest of the arguments the answer licenses), and the facts the classifier stations, the in-fold unresolvable arms
208
+ * and the policy fold record. It rides the decision as its `attestation` member and is read through {@link attestationOf}
209
+ * alone; the decision object's identity carries nothing.
210
+ *
211
+ * Minted only by {@link mintAttestation} and combined only by {@link mergeAttestation}: both freeze the record and enter it
212
+ * in a module-private brand set, so a value a caller composed — a literal, a copy, a structured clone — is not a record, and
213
+ * the receipt refuses a decision carrying one. A record is bound to the call it was minted for (`toolCallId` + `toolName`):
214
+ * handed back for another call it reads as absent. A spread of a decision keeps its record, and the record still says only
215
+ * what the engine minted — a refusal record on an allow is a contradiction the gate's exit refuses, and a resolution's
216
+ * answer binds the arguments it licensed (`inputDigest`).
217
+ */
218
+ export interface EngineAttestation {
219
+ readonly toolCallId: string;
220
+ readonly toolName: string;
221
+ /** What ended the call's wait. The answer group — `settlement`, `origin`, `classes`, `inputDigest` — travels as one. */
222
+ readonly settlement?: Settlement;
223
+ /** The settled ask's origin word. */
224
+ readonly origin?: AskOrigin;
225
+ /** The settled ask's class set (`ASK_CLASSES` order), when the minting station held one. */
226
+ readonly classes?: readonly import("./ask-origin.js").AskClass[];
227
+ /** `boundInputHashOf` of the arguments the settlement licenses: an approver's edit, the snapshot shown, or the asked args. */
228
+ readonly inputDigest?: string;
229
+ /** The FORM of a classifier round that did not rule (a classifier deny's cause). */
230
+ readonly classifierCause?: import("./gate-outcome.js").ClassifierDenyCause;
231
+ /** WHICH model answered a classification, on either arm. */
232
+ readonly classifierRound?: import("./auto-mode.js").AutoModeClassifierRound;
233
+ /** Why an in-fold deny refused an ask nobody could resolve. */
234
+ readonly unresolvableCause?: import("./ask-unresolvable-notice.js").AskUnresolvableCause;
235
+ /** The classes of the asks a policy fold collapsed — the proof behind a decision's `foldedAskClasses`. */
236
+ readonly foldedClasses?: readonly import("./ask-origin.js").AskClass[];
237
+ }
238
+ /** The members a station attests — everything but the call binding. */
239
+ export type AttestationMembers = Omit<EngineAttestation, "toolCallId" | "toolName">;
240
+ /** Mint a record for `call`. Engine stations only: not re-exported from `src/index.ts`. The values are DETACHED snapshots, so a
241
+ * caller that later mutates the settlement object it was handed cannot rewrite what the engine attests. */
242
+ export declare function mintAttestation(call: {
211
243
  toolCallId: string;
212
244
  toolName: string;
213
- }): T;
214
- /** Read the attested classification off a decision FOR the named call (the gate's fold is the consumer): a
215
- * binding to a different call is a replayed object and answers absence. Internal seam — not re-exported. */
216
- export declare function classifierRoundOf(d: unknown, call: {
245
+ }, members: AttestationMembers): EngineAttestation;
246
+ /** Is `v` a record the engine minted (the brand alone — no binding)? The receipt's test. */
247
+ export declare function isEngineAttestation(v: unknown): v is EngineAttestation;
248
+ /** THE read: the record `d` carries FOR `call` — a branded record bound to that call, else `undefined` (a record bound to
249
+ * another call is a replayed one and reads as absent). Read off the own data member, never through an accessor. */
250
+ export declare function attestationOf(d: unknown, call: {
217
251
  toolCallId: string;
218
252
  toolName: string;
219
- }): import("./auto-mode.js").AutoModeClassifierRound | undefined;
220
- /** Attest that `d` is an in-fold deny of an ask nobody could resolve, for `call`, for the named cause. */
221
- export declare function attestAskUnresolvableCause<T extends object>(d: T, cause: import("./ask-unresolvable-notice.js").AskUnresolvableCause, call: {
253
+ }): EngineAttestation | undefined;
254
+ /**
255
+ * Combine two records for `call`, member GROUP by group: the later record's group stands where it has one, the earlier's
256
+ * fills a group the later lacks. A record not bound to `call` contributes nothing. `answer` scope is the veto's merge: the
257
+ * earlier record contributes ONLY its answer, and only when the later carries none — a person's yes rides a later layer's
258
+ * deny (invariant I3) while the refusing station's own facts stay its own.
259
+ */
260
+ export declare function mergeAttestation(call: {
222
261
  toolCallId: string;
223
262
  toolName: string;
224
- }): T;
225
- /** Read the attested unresolvable cause off a deny FOR the named call (the gate's exit is the consumer); a
226
- * binding to a different call is a replayed object and answers absence. Internal seam — not re-exported. */
227
- export declare function askUnresolvableCauseOf(d: unknown, call: {
263
+ }, earlier: EngineAttestation | undefined, later: EngineAttestation | undefined, scope?: "all" | "answer"): EngineAttestation | undefined;
264
+ /** `d` with `members` attested for `call`, merged over the record it already carries for that call (the new members' groups
265
+ * win). Always a fresh object — the receipt hands out frozen ones. */
266
+ export declare function attest<T extends object>(d: T, call: {
228
267
  toolCallId: string;
229
268
  toolName: string;
230
- }): import("./ask-unresolvable-notice.js").AskUnresolvableCause | undefined;
231
- /** Read the engine-attested settlement off a funneled decision FOR the named call (the gate's exit is the
232
- * one consumer): an attestation bound to a different call is a replayed object and answers absence.
233
- * Exported for the gate module only — deliberately NOT re-exported from `src/index.ts` (an internal seam
234
- * between engine modules, not a facility deployments call). */
235
- export declare function engineSettlementOf(d: unknown, call: {
269
+ }, members: AttestationMembers): T;
270
+ /** `d` carrying `record` (a fresh object), or `d` itself when there is no record to put on it. */
271
+ export declare function withAttestation<T extends object>(d: T, record: EngineAttestation | undefined): T;
272
+ /** The `task_aborted`-attested deny an engine policy answers on an aborted signal instead of reaching a seat. */
273
+ export declare function abortedSeatDeny(req: {
236
274
  toolCallId: string;
237
275
  toolName: string;
238
- }): {
239
- settlement: Settlement;
240
- origin: AskOrigin;
241
- } | undefined;
276
+ }, message: string, origin: AskOrigin): PermissionResult;
242
277
  /**
243
278
  * design/252 G-7 — how long an approver-attribution identifier may be.
244
279
  *
@@ -288,9 +323,9 @@ export declare function screenApproverAttribution(v: unknown): {
288
323
  * - `deny` blocks the call.
289
324
  * Human-readable text is `message`; read it via {@link decisionText}.
290
325
  *
291
- * NO arm carries a settlement: what ended a wait is not a policy's to state. The engine's own settlement
292
- * sites attest it through a module-private seat ({@link engineSettlementOf}) and the gate's exit mints the
293
- * one settlement record ({@link import("./gate-outcome.js").GateOutcome}); a policy that puts a `settledBy`
326
+ * What ended a wait is not a policy's to state: it rides only the `attestation` member, an engine-minted
327
+ * record ({@link EngineAttestation}) the receipt refuses in any other form, and the gate's exit mints the one
328
+ * settlement record ({@link import("./gate-outcome.js").GateOutcome}) from it; a policy that puts a `settledBy`
294
329
  * or `approver` member on its verdict is putting an unread property on it.
295
330
  * RB-479-B① (ruled 2026-08-02): the legacy `reason` field is REMOVED — one name for one thing.
296
331
  *
@@ -303,6 +338,7 @@ export type PermissionResult = {
303
338
  updatedInput?: unknown;
304
339
  message?: string;
305
340
  decisionReason?: DecisionReason;
341
+ attestation?: EngineAttestation;
306
342
  } | {
307
343
  action: "ask";
308
344
  updatedInput?: unknown;
@@ -418,12 +454,12 @@ export type PermissionResult = {
418
454
  /** The ask's whole class set, in {@link import("./ask-origin.js").ASK_CLASSES} order (see
419
455
  * {@link AskRequest.classes}). Stamped beside {@link askClass}, under the same rule. */
420
456
  classes?: readonly import("./ask-origin.js").AskClass[];
421
- /** WHICH integrity guard minted this ask — a removal of a protected location, an unverifiable recursive delete
422
- * or the session-transcript write. ENGINE-STAMPED by the guard policies; a fold-internal fact the class
457
+ /** WHICH integrity guard minted this ask — a removal of a protected location, an unverifiable recursive delete,
458
+ * shell text the engine cannot read or the session-transcript write. ENGINE-STAMPED by the guard policies; a fold-internal fact the class
423
459
  * derivation reads ({@link import("./ask-origin.js").classifyAsk}) so the guards, which mint the same
424
460
  * `requiresRealApproval` ask, are told apart by a fact and not by their prose. Never copied onto the
425
461
  * approval request or the park row. */
426
- guard?: "dangerous_delete" | "unverifiable_delete" | "transcript_write" | "artifact_shared_read";
462
+ guard?: "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "artifact_shared_read";
427
463
  /** The call could not be READ against a rule that may reach it — a content-form deny row, a content-form
428
464
  * ask row, or a persisted-rule row (the lexer's word). ENGINE-STAMPED at the three unreadable mint sites;
429
465
  * the class derivation reads it as `rule_unreadable` (a mode may release it, a person may clear it, no
@@ -439,14 +475,17 @@ export type PermissionResult = {
439
475
  /** The classes of the OTHER asks a policy fold collapsed into this one
440
476
  * ({@link import("./ask-origin.js").decisionAskClassesOf} per contributing ask, unioned), so a member the
441
477
  * fold does not copy — a guard mark, an unreadable-rule fact, a bare real-approval bit — is not lost behind
442
- * the ask that won the slot. ENGINE-WRITTEN by {@link combinePolicies}, which attests the object it returns; the receipt
443
- * refuses the member on any other object (a policy's own, a copy, an edited list). Fold-internal, never on the request. */
478
+ * the ask that won the slot. ENGINE-WRITTEN by {@link combinePolicies}, which attests the list it wrote
479
+ * ({@link EngineAttestation.foldedClasses}); the receipt refuses the member unless the decision's record carries that very
480
+ * list (a policy's own, an edited list are refused). Fold-internal, never on the request. */
444
481
  foldedAskClasses?: readonly import("./ask-origin.js").AskClass[];
482
+ attestation?: EngineAttestation;
445
483
  } | {
446
484
  action: "deny";
447
485
  updatedInput?: unknown;
448
486
  message?: string;
449
487
  decisionReason?: DecisionReason;
488
+ attestation?: EngineAttestation;
450
489
  };
451
490
  /**
452
491
  * design/252 G-2 — WHY a piece of rule-provenance evidence is not on an ask.
@@ -556,12 +595,18 @@ export interface ToolPolicy {
556
595
  * through {@link combinePolicies}; read with {@link toolPolicyPathRules}. Its presence also tells the Runner to read
557
596
  * each call's target ({@link ToolCallRequest.targetReading}). */
558
597
  readonly pathRules?: (anchors: import("./permission-rule-model.js").PathRuleBases) => readonly import("./path-rule-binding.js").BoundPathRule[];
559
- /** Does this policy guard a write to this ABSOLUTE target — would it refuse the write if a write tool made it? The
560
- * policy's answer for a writer it cannot see as a call (the shell's file commands), read by the shell station's
561
- * `writesPlaced` fact alone: a guarded target is not placed, so no permission mode answers the command and its ask
562
- * reaches a person — it is not refused. A PURE judgment: no side effect, no audit record, no hook, no approver; `true`
563
- * on a target it cannot judge. Carried through {@link combinePolicies} (any member's `true` is the answer). */
564
- readonly writeTargetGuard?: (target: string, signal?: AbortSignal) => Promise<boolean>;
598
+ /** The guarded WRITE rows this policy refuses — rows of the one path table (path-guard-rows.ts), stated as data. The
599
+ * engine judges them for a writer the policy cannot see as a call (the shell's file commands) by its ONE write judgment:
600
+ * the leg's views of the target (spelling, real target, symlink chain) under the leg's one exempt root
601
+ * ({@link ToolCallRequest.exemptRoots}) beside the always-on write-protection table. A target one of them covers is not
602
+ * placed, so no permission mode answers the command and its ask reaches a person — it is not refused. The rows of ONE
603
+ * judgment: a row placed below a declared root is placed where that root resolves in `env` (resolved per call). A PURE
604
+ * statement: no side effect, no verdict; a call that throws leaves the target unplaced. Carried through
605
+ * {@link combinePolicies} (the members' rows, in order); read with {@link toolPolicyWriteGuardRows}. */
606
+ readonly writeGuardRows?: (at: {
607
+ readonly env?: import("../internal/harness-types.js").ExecutionEnv;
608
+ readonly signal?: AbortSignal;
609
+ }) => Promise<readonly import("./path-guard-rows.js").PathGuardRow[]>;
565
610
  /** The raw tool-name lists a name-keyed policy was built from — the prepare-time policy-name audit's feed (a retired
566
611
  * name refuses the run, an unmounted one is advised). Carried through {@link combinePolicies} (the union of the
567
612
  * members' groups); read with {@link toolPolicyNameSets}. */
@@ -572,10 +617,11 @@ export interface ToolPolicy {
572
617
  * each by name off the wrapped policy, {@link combinePolicies} folds each. The fence makes a new {@link ToolPolicy} member
573
618
  * a compile error until the table names it.
574
619
  */
575
- declare const TOOL_POLICY_CARRIED_MEMBERS: readonly ["projection", "pathRules", "writeTargetGuard", "nameSets"];
620
+ declare const TOOL_POLICY_CARRIED_MEMBERS: readonly ["projection", "pathRules", "writeGuardRows", "nameSets"];
576
621
  type ToolPolicyCarriedMember = (typeof TOOL_POLICY_CARRIED_MEMBERS)[number];
577
622
  export type ToolPolicyCarriesEveryMember = AssertAllKeysHandled<Exclude<Exclude<keyof ToolPolicy, "check">, ToolPolicyCarriedMember>>;
578
- /** The carried members that are set on `p`, each read by name — an accessor or a non-enumerable member included. */
623
+ /** The carried members that are set on `p`, each read by name — an accessor or a non-enumerable member included. A
624
+ * retired member `p` still holds would not be carried: it is refused by name instead (`config.deps_retired_key`). */
579
625
  export declare function carriedMembersOf(p: {
580
626
  readonly [K in ToolPolicyCarriedMember]?: ToolPolicy[K];
581
627
  }): {
@@ -583,7 +629,7 @@ export declare function carriedMembersOf(p: {
583
629
  };
584
630
  /**
585
631
  * The ONE way to wrap a policy: the wrapper decides through `check`; every member {@link ToolPolicy} declares beside it
586
- * (projection, name sets, path deny rows, write-target guard — the carried-member table) rides as `inner` holds it, read
632
+ * (projection, name sets, path deny rows, guarded write rows — the carried-member table) rides as `inner` holds it, read
587
633
  * by name, so a class instance's accessor or a non-enumerable member rides too — a `{ check }` literal drops them, and
588
634
  * engine stations the wrapper never sees read each one. The carried members describe what `inner` refuses, so the wrapper
589
635
  * must refuse at least that (an observer, a tightener); one that releases what `inner` refuses is a policy of its own.
@@ -594,9 +640,10 @@ export declare function wrapToolPolicy<P extends ToolPolicy>(inner: P, check: To
594
640
  * the leg the policies are installed on (a policy already installed answers with its own installation's rows). The deny
595
641
  * tables take the rows that guard a face (`faces` non-empty) of a deny rule. */
596
642
  export declare function toolPolicyPathRules(policies: readonly (ToolPolicy | undefined)[], anchors: import("./permission-rule-model.js").PathRuleBases): readonly import("./path-rule-binding.js").BoundPathRule[];
597
- /** The one write-target guard the given policies carry together (combined policies included): `true` when any member
598
- * guards the target, a member that throws counting as guarding it. `undefined` when none carries one. */
599
- export declare function toolPolicyWriteTargetGuard(policies: readonly (ToolPolicy | undefined)[]): ToolPolicy["writeTargetGuard"];
643
+ /** The guarded write rows the given policies carry together (combined policies included): every member's rows of one
644
+ * judgment, in member order (a member that throws throws here — the judgment leaves the target unplaced). `undefined`
645
+ * when none carries any. */
646
+ export declare function toolPolicyWriteGuardRows(policies: readonly (ToolPolicy | undefined)[]): ToolPolicy["writeGuardRows"];
600
647
  /**
601
648
  * One deterministic DENY component of a {@link ToolPolicyProjection} (F-012 L1). All fields are plain
602
649
  * serializable data — a component round-trips JSON/`structuredClone` unchanged, which is what lets a
@@ -813,7 +860,7 @@ export declare const DECISION_MEMBERS: readonly DecisionMember[];
813
860
  * allow; a `canUseTool` result outside its set is a failure in CC) and `decisionReason` in {@link DECISION_REASONS} when
814
861
  * present (absence stays legal); (5) the DETACH —
815
862
  * the contract members' values structured-cloned ({@link tryCloneArgs}; one that cannot be, a function inside a rewrite,
816
- * is refused), the engine's identity-keyed records carried across ({@link carryEngineAttestations}), the copy frozen and
863
+ * is refused), the engine's `attestation` record re-attached by reference after its brand check, the copy frozen and
817
864
  * marked as this module's. A refusal is a deny in the screen's words, one code for every arm (`decisionReason: "rule"`),
818
865
  * carrying no `updatedInput` from the refused object (a rewrite from an EARLIER, contract-shaped layer still rides out of
819
866
  * {@link combinePolicies}' deny path). `null` / `undefined` carry nothing and take the carrier's refusal (the caller's own
@@ -1037,12 +1084,12 @@ export declare function createCoarseCommandNamePolicy(opts: {
1037
1084
  /** Override the shell tool names this gate parses (default {@link COARSE_SHELL_TOOLS}, the shell face). */
1038
1085
  tools?: string[];
1039
1086
  }): ToolPolicy;
1040
- export declare function findUnverifiableRecursiveDelete(command: string, safeVars?: ReadonlySet<string>): string | undefined;
1041
1087
  /**
1042
1088
  * CC 220 "Unverifiable Deletion Target" parity (auto-mode rule): ASK on a recursive+forced delete whose
1043
1089
  * target is a variable / substitution that cannot be resolved from the command itself — fail-closed in the
1044
1090
  * sense that with no live classifier/approver the ask degrades to deny (see {@link PermissionResult}'s
1045
- * `ask` doc), never to allow. See {@link findUnverifiableRecursiveDelete} for exact firing conditions. The
1091
+ * `ask` doc), never to allow. The guard reads ONE plan, the read station's (`removalReadingOf`,
1092
+ * removal-targets.ts): its firing conditions are `removalFindingsOf`'s there. The
1046
1093
  * message carries the CC-sanctioned remediation (re-run with the resolved LITERAL path written into the
1047
1094
  * command, or assign the variable in the same command) — it doubles as the `askMessage` a classifier sees.
1048
1095
  *
@@ -1108,10 +1155,10 @@ export declare function findUnverifiableRecursiveDelete(command: string, safeVar
1108
1155
  * grows one.
1109
1156
  */
1110
1157
  export declare function createUnverifiableDeletePolicy(opts?: {
1111
- /** Extra variable names treated as well-known-safe roots, ADDED to the default set
1112
- * `TMPDIR`/`HOME`/`PWD` ({@link UNVERIFIABLE_DELETE_SAFE_VARS} — RB-396-a: this doc used to claim
1113
- * the default was `TMPDIR` alone, reading STRICTER than the gate really is; `HOME`/`PWD` are a
1114
- * registered sema divergence from CC's temp-only carve-out, see the RB-340 note there). */
1158
+ /** Extra variable names treated as well-known-safe roots, ADDED to the default set `TMPDIR`/`HOME`
1159
+ * (`KNOWN_SAFE_ROOTS`, removal-targets.ts — `HOME` is a registered sema divergence from CC's temp-only carve-out).
1160
+ * Each must be a shell identifier; `PWD` / `OLDPWD` are refused — their value is where the command stands, read off
1161
+ * the working-directory thread, not a root the shell provides. A bad entry throws here. */
1115
1162
  safeVars?: readonly string[];
1116
1163
  /** Override the shell tool names this gate parses (default {@link COARSE_SHELL_TOOLS}, the shell face). */
1117
1164
  tools?: string[];
@@ -1476,6 +1523,12 @@ export interface AskRequest {
1476
1523
  readonly irreversible?: boolean;
1477
1524
  readonly egress?: boolean;
1478
1525
  };
1526
+ /** Which approval card this ask renders under — the closed set `TOOL_APPROVAL_CARDS`, `generic` when the tool declares
1527
+ * none; the same word the parked gate and the pending row carry for the same call. Display routing only: the card is
1528
+ * untrusted-for-display input (a tool may declare any non-reserved card), so a specialised card validates the call's
1529
+ * arguments itself. A word outside the set reads as `generic`. ABSENT: an ask the host built itself, or an engine
1530
+ * older than this member. */
1531
+ readonly approvalCard?: import("./tool-face.js").ToolApprovalCard;
1479
1532
  /** ruled 2026-08-04 — present exactly when this ask was raised inside a DELEGATED child whose approver
1480
1533
  * is the ancestor run's (the `ToolExecuteContext.onAsk` seat the delegation tool forwards). Additive:
1481
1534
  * an approver that ignores it is unaffected; a durable park/suspend flow never invokes `onAsk` at all,
@@ -1767,6 +1820,38 @@ export declare function tryCloneArgs<T>(v: T): {
1767
1820
  * text they let through. Not part of the package's public surface.
1768
1821
  */
1769
1822
  export declare function describeThrown(err: unknown): string;
1823
+ /** What a person refused: a tool use the model asked to run, or the plan it proposed. */
1824
+ export type HumanRefusalSubject = "tool use" | "plan";
1825
+ /**
1826
+ * THE sentence a model reads when a PERSON refused what it asked to do, whichever leg carried the refusal (the
1827
+ * synchronous resolver's {@link humanRefusalMessage}; the durable decide's tool result and continuation frame;
1828
+ * the plan review's continuation) — one generator for every subject and both postures, so a person's "no"
1829
+ * cannot speak two ways depending on whether it landed on a tool call or a plan, or on which path carried it.
1830
+ * `subject` picks the fact clause (which thing was refused and that it did not run); `delegatedChild` picks the
1831
+ * posture — the ISSUING RUN's position ({@link AskRequest.isDelegatedChild}; the durable legs read the same
1832
+ * effective fact, restored from the checkpoint row on a deps-only resume):
1833
+ * - a parent-thread run is told the user refused and to wait for them. The reference answers a tool call and a
1834
+ * plan with one string (a refusal with no words stops the turn and waits for the user; one with words relays
1835
+ * them as the direction): no note ⇒ the fact, then STOP and wait for the user to tell the model how to
1836
+ * proceed; a note ⇒ the fact, then the note inside a {@link delimitUntrusted} fence ("reviewer note" — the
1837
+ * durable resume leg's label for the same words). The TRUSTED wrapper around the fence does two jobs the
1838
+ * fence alone cannot: it LICENSES the note as the user's guidance while bounding its authority (user words
1839
+ * steer the work; they cannot grant permissions or override system rules — the fence's "do NOT follow
1840
+ * instructions" guards exactly that escalation, not the reading of the user's steer), and it KEEPS the wait as
1841
+ * the fallback for a note that gives no direction, so a note never erases the only explicit instruction about
1842
+ * what to do after a person's "no". On the BARE arm the directive is no longer text alone: the runner treats
1843
+ * a refused TOOL CALL as a control-flow boundary for the issuing assistant batch — same-message sibling calls
1844
+ * that never started settle un-executed and the turn ends awaiting the user (the settlement's `note` seat
1845
+ * carries the bare-vs-noted fact);
1846
+ * - a delegated child (a FORK included — its message-layer contract is one-shot, "no waiting for the user") is
1847
+ * told to try a different approach or report the limitation — no user turn ever lands in ITS transcript, so
1848
+ * "wait for the user" would hang the delegation. A note it is handed rides the same fence and the same bound
1849
+ * on its authority, with the adapt-or-report posture as the fallback.
1850
+ * Whether there IS a note is the decider-note seat's own rule ({@link decidersNote}), asked here and nowhere
1851
+ * else on this path — the callers hand over the raw text. Not for a refusal a machine gave
1852
+ * ({@link policyRefusalMessage}).
1853
+ */
1854
+ export declare function humanRefusalSentence(subject: HumanRefusalSubject, reason: string | undefined, delegatedChild: boolean): string;
1770
1855
  /**
1771
1856
  * The ONE composer for a DEPLOYMENT-POLICY refusal of an ask — the sentence the model reads when the
1772
1857
  * approval channel reported that a MACHINE ended this wait (`settledBy: "policy"` on the synchronous
@@ -1792,10 +1877,6 @@ export declare function policyRefusalMessage(toolName: string, askMessage: strin
1792
1877
  export type ResolvedAsk = (Extract<PermissionResult, {
1793
1878
  action: "allow";
1794
1879
  }> & {
1795
- /** Present exactly when a DECIDER approved (`human_allowed` / `policy_allowed`, with the channel's
1796
- * attribution when it reported one); absent on the posture allows (a blanket `"allow"`) — nobody was
1797
- * asked, so nothing was settled. */
1798
- settlement?: Settlement;
1799
1880
  /** The EXACT data snapshot the approver was shown (the `structuredClone` of the presented args). On
1800
1881
  * a plain approval (no edit) the gate EXECUTES this snapshot, not the original object: a stateful
1801
1882
  * getter or an external alias must not be able to make the executed action differ from the
@@ -1808,14 +1889,40 @@ export type ResolvedAsk = (Extract<PermissionResult, {
1808
1889
  }) | (Extract<PermissionResult, {
1809
1890
  action: "deny";
1810
1891
  }> & {
1811
- /** What ended the wait — composed at the arm that ended it, one of the refusal kinds. A deny this
1812
- * resolver composes ALWAYS names its settlement: there is no unclassified refusal. */
1813
- settlement: Settlement;
1814
1892
  presentedInput?: unknown;
1815
1893
  approverUnavailable?: true;
1816
1894
  /** A grant riding a refusal: always `rejected` (`on_refusal`). */
1817
1895
  readRootGrant?: ReadRootGrantScreen;
1818
1896
  });
1897
+ /** What one resolver ARM composes: the resolution plus the settlement it ended the wait with — composed at the arm, every deny
1898
+ * naming one (there is no unclassified refusal), an allow only when a DECIDER approved (a blanket `"allow"` asked nobody). The
1899
+ * exported {@link resolveAsk} turns the settlement into the resolution's `attestation`. Not re-exported from `src/index.ts`. */
1900
+ export type ResolverArmResult = (Extract<ResolvedAsk, {
1901
+ action: "allow";
1902
+ }> & {
1903
+ settlement?: Settlement;
1904
+ }) | (Extract<ResolvedAsk, {
1905
+ action: "deny";
1906
+ }> & {
1907
+ settlement: Settlement;
1908
+ });
1909
+ /**
1910
+ * The DIRECTIONAL format controls, as a closed set (see {@link AskRequest.hasBidiControls}):
1911
+ * ALM (U+061C), LRM/RLM (U+200E/U+200F), the embeddings and overrides (U+202A–U+202E) and the
1912
+ * isolates (U+2066–U+2069). These reorder what a reader SEES without changing a byte of what runs.
1913
+ *
1914
+ * Why the whole directional family and not only the four the reordering demos use: the bit is a
1915
+ * WARNING, and for a warning the safe direction is to fire on a member a reader would have to
1916
+ * enumerate correctly to be safe from. ALM is in for that reason, though it is the least-abused one.
1917
+ *
1918
+ * Deliberately NARROWER than `permission-rule-model`'s `CONTROL_CHARS_RE` and than
1919
+ * {@link APPROVER_REFUSED_CHARS_RE}: those are REFUSAL/ESCAPE classes covering every control and
1920
+ * zero-width character (a rule text or an identifier has no use for any of them). This one answers a
1921
+ * different question — "can this display as something other than what it is" — and a zero-width joiner
1922
+ * or a soft hyphen does not reorder anything, so folding them in would make the bit fire on ordinary
1923
+ * text and mean nothing where it matters.
1924
+ */
1925
+ export declare const BIDI_CONTROL_CHARS = "\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069";
1819
1926
  /**
1820
1927
  * Does any string reachable in `value` carry a {@link BIDI_CONTROL_RE} member? Bounded, cycle-safe,
1821
1928
  * and never throwing — every caller is on an approval/projection path, where a scan that failed must
@@ -1834,8 +1941,11 @@ export type ResolvedAsk = (Extract<PermissionResult, {
1834
1941
  * row's work is bounded regardless of the row's provenance. Both members are required when the
1835
1942
  * object is given — a half-specified tier would silently mix two tiers in one scan.
1836
1943
  *
1837
- * Not a public export: the contract is the {@link AskRequest.hasBidiControls} bit, and a second
1838
- * spelling of "does this carry bidi" on the public surface would be one more thing to keep in step.
1944
+ * Exported as the ONE judge of the question: a host that renders or sanitizes text next to an approval
1945
+ * card answers "does this carry a directional control" with this function, and composes a wider class
1946
+ * (control characters, line separators) from {@link BIDI_CONTROL_CHARS} rather than restating the members.
1947
+ * The allowances above are part of the answer, not an implementation detail: a payload past them reads
1948
+ * "not detected", exactly as the bit on the card does.
1839
1949
  */
1840
1950
  export declare function carriesBidiControls(value: unknown, limits?: {
1841
1951
  maxNodes: number;