@sema-agent/core 7.69.0 → 7.69.1

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 (309) hide show
  1. package/CHANGELOG.md +583 -0
  2. package/dist/agents/repair-loop.js +6 -14
  3. package/dist/agents/subagent.js +2 -1
  4. package/dist/agents/verify.d.ts +1 -1
  5. package/dist/agents/verify.js +7 -1
  6. package/dist/brain/reasoning-request.d.ts +7 -0
  7. package/dist/brain/reasoning-request.js +6 -0
  8. package/dist/core/agent-config-dir.d.ts +39 -3
  9. package/dist/core/agent-config-dir.js +67 -11
  10. package/dist/core/allow-entry.d.ts +5 -5
  11. package/dist/core/allow-entry.js +12 -6
  12. package/dist/core/ask-headline.d.ts +2 -2
  13. package/dist/core/ask-origin.d.ts +31 -31
  14. package/dist/core/ask-origin.js +20 -13
  15. package/dist/core/attachment-source.d.ts +1 -1
  16. package/dist/core/attachment-source.js +1 -0
  17. package/dist/core/auto-compaction.d.ts +44 -62
  18. package/dist/core/auto-compaction.js +44 -103
  19. package/dist/core/cache-break-detector.d.ts +23 -11
  20. package/dist/core/cache-break-detector.js +11 -5
  21. package/dist/core/checkpoint-features.d.ts +1 -1
  22. package/dist/core/checkpoint-features.js +1 -1
  23. package/dist/core/checkpoint-requirements.d.ts +19 -1
  24. package/dist/core/checkpoint-requirements.js +6 -0
  25. package/dist/core/checkpoint-row-verdict.js +3 -0
  26. package/dist/core/checkpoint-store.d.ts +13 -2
  27. package/dist/core/child-clamp-seats.d.ts +30 -3
  28. package/dist/core/child-clamp-seats.js +24 -0
  29. package/dist/core/compaction-retired-members.d.ts +12 -0
  30. package/dist/core/compaction-retired-members.js +22 -0
  31. package/dist/core/config-refusal-codes.d.ts +1 -1
  32. package/dist/core/config-refusal-codes.js +2 -0
  33. package/dist/core/context-edit.d.ts +32 -17
  34. package/dist/core/context-edit.js +28 -0
  35. package/dist/core/cron.d.ts +68 -0
  36. package/dist/core/cron.js +259 -0
  37. package/dist/core/engine-attestation.d.ts +16 -0
  38. package/dist/core/engine-attestation.js +2 -0
  39. package/dist/core/engine-capabilities.d.ts +14 -1
  40. package/dist/core/engine-capabilities.js +1 -1
  41. package/dist/core/engine-notice.d.ts +18 -7
  42. package/dist/core/engine-version.js +1 -1
  43. package/dist/core/gate-outcome.d.ts +29 -2
  44. package/dist/core/gate-outcome.js +6 -0
  45. package/dist/core/git-read-only.d.ts +10 -0
  46. package/dist/core/git-read-only.js +1 -0
  47. package/dist/core/git-worktree-env.js +9 -8
  48. package/dist/core/governance-codes.d.ts +9 -2
  49. package/dist/core/governance-codes.js +9 -0
  50. package/dist/core/locked-config.js +7 -3
  51. package/dist/core/lsp.d.ts +3 -0
  52. package/dist/core/lsp.js +3 -2
  53. package/dist/core/memory-engine/engine.d.ts +48 -12
  54. package/dist/core/memory-engine/engine.js +108 -46
  55. package/dist/core/memory-engine/file-backend.d.ts +2 -1
  56. package/dist/core/memory-engine/index-copies.d.ts +47 -0
  57. package/dist/core/memory-engine/index-copies.js +88 -0
  58. package/dist/core/memory-engine/layout.d.ts +20 -3
  59. package/dist/core/memory-engine/layout.js +39 -3
  60. package/dist/core/memory-engine/origin-clearance.d.ts +9 -7
  61. package/dist/core/memory-engine/origin-clearance.js +2 -4
  62. package/dist/core/memory-engine/types.d.ts +16 -3
  63. package/dist/core/mode-policy.d.ts +7 -1
  64. package/dist/core/mode-policy.js +9 -0
  65. package/dist/core/mods/session-compact.js +3 -3
  66. package/dist/core/mods/stations.d.ts +2 -0
  67. package/dist/core/mods/stations.js +2 -1
  68. package/dist/core/path-guard-rows.d.ts +8 -3
  69. package/dist/core/path-guard-rows.js +18 -5
  70. package/dist/core/peer-seat.d.ts +3 -0
  71. package/dist/core/peer-seat.js +3 -0
  72. package/dist/core/permission-rule-model.js +3 -2
  73. package/dist/core/process-identity.d.ts +11 -3
  74. package/dist/core/process-identity.js +26 -16
  75. package/dist/core/runner/assemble-result.d.ts +5 -0
  76. package/dist/core/runner/assemble-result.js +1 -1
  77. package/dist/core/runner/cleared-results-record.d.ts +33 -0
  78. package/dist/core/runner/cleared-results-record.js +56 -0
  79. package/dist/core/runner/compact-session.js +14 -9
  80. package/dist/core/runner/compaction-knobs.d.ts +1 -1
  81. package/dist/core/runner/continuation-gate.js +2 -1
  82. package/dist/core/runner/continues-from.d.ts +1 -1
  83. package/dist/core/runner/continues-from.js +1 -1
  84. package/dist/core/runner/contracts.d.ts +83 -31
  85. package/dist/core/runner/conversation-segment.d.ts +19 -12
  86. package/dist/core/runner/conversation-segment.js +27 -7
  87. package/dist/core/runner/derived-route-fallback.d.ts +2 -12
  88. package/dist/core/runner/derived-route-fallback.js +0 -6
  89. package/dist/core/runner/gate-exit.d.ts +2 -1
  90. package/dist/core/runner/gate-exit.js +4 -2
  91. package/dist/core/runner/git-status-frame.d.ts +2 -2
  92. package/dist/core/runner/git-status-frame.js +2 -1
  93. package/dist/core/runner/initial-run-state.js +1 -1
  94. package/dist/core/runner/leg-caller-places.d.ts +39 -0
  95. package/dist/core/runner/leg-caller-places.js +23 -0
  96. package/dist/core/runner/leg-frame.d.ts +8 -2
  97. package/dist/core/runner/leg-receipt.d.ts +29 -2
  98. package/dist/core/runner/leg-receipt.js +37 -6
  99. package/dist/core/runner/media-removed-seat.d.ts +10 -6
  100. package/dist/core/runner/media-removed-seat.js +6 -3
  101. package/dist/core/runner/messages-omitted-seat.d.ts +2 -1
  102. package/dist/core/runner/messages-omitted-seat.js +15 -5
  103. package/dist/core/runner/person-path-rows.d.ts +25 -7
  104. package/dist/core/runner/person-path-rows.js +16 -2
  105. package/dist/core/runner/prefix-ledger.d.ts +120 -0
  106. package/dist/core/runner/prefix-ledger.js +176 -0
  107. package/dist/core/runner/prepare-advisor.d.ts +2 -0
  108. package/dist/core/runner/prepare-advisor.js +2 -1
  109. package/dist/core/runner/prepare-artifact.d.ts +3 -0
  110. package/dist/core/runner/prepare-artifact.js +2 -2
  111. package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
  112. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  113. package/dist/core/runner/prepare-config-doors.d.ts +9 -8
  114. package/dist/core/runner/prepare-config-doors.js +15 -12
  115. package/dist/core/runner/prepare-context-lane.d.ts +25 -6
  116. package/dist/core/runner/prepare-context-lane.js +82 -27
  117. package/dist/core/runner/prepare-gate-stations.d.ts +1 -2
  118. package/dist/core/runner/prepare-gate-stations.js +2 -4
  119. package/dist/core/runner/prepare-hands-readface.d.ts +18 -5
  120. package/dist/core/runner/prepare-hands-readface.js +41 -22
  121. package/dist/core/runner/prepare-inherited-gate.d.ts +5 -0
  122. package/dist/core/runner/prepare-inherited-gate.js +2 -0
  123. package/dist/core/runner/prepare-memory.d.ts +10 -2
  124. package/dist/core/runner/prepare-memory.js +51 -5
  125. package/dist/core/runner/prepare-policy-chain.d.ts +3 -0
  126. package/dist/core/runner/prepare-policy-chain.js +13 -2
  127. package/dist/core/runner/prepare-prompt-assembly.d.ts +12 -4
  128. package/dist/core/runner/prepare-prompt-assembly.js +10 -4
  129. package/dist/core/runner/prepare-prompt-inputs.d.ts +3 -7
  130. package/dist/core/runner/prepare-prompt-inputs.js +6 -7
  131. package/dist/core/runner/prepare-safety-scan.js +7 -0
  132. package/dist/core/runner/prepare-suspend-saga.d.ts +4 -0
  133. package/dist/core/runner/prepare-suspend-saga.js +3 -2
  134. package/dist/core/runner/prepare-task.js +59 -53
  135. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +5 -11
  136. package/dist/core/runner/prepare-tool-disclosure-mount.js +7 -8
  137. package/dist/core/runner/prepare-turn-wiring.d.ts +16 -25
  138. package/dist/core/runner/prepare-turn-wiring.js +8 -18
  139. package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
  140. package/dist/core/runner/prepare-wiring-manifest.js +3 -2
  141. package/dist/core/runner/prompt-suggestions.d.ts +3 -1
  142. package/dist/core/runner/prompt-suggestions.js +1 -1
  143. package/dist/core/runner/read-block-judge.d.ts +47 -0
  144. package/dist/core/runner/read-block-judge.js +33 -0
  145. package/dist/core/runner/role-resolution-table.d.ts +15 -10
  146. package/dist/core/runner/role-resolution-table.js +4 -5
  147. package/dist/core/runner/rule-store-unreadable-notice.d.ts +7 -4
  148. package/dist/core/runner/rule-store-unreadable-notice.js +4 -3
  149. package/dist/core/runner/run-compaction-machinery.d.ts +0 -10
  150. package/dist/core/runner/run-compaction-machinery.js +3 -39
  151. package/dist/core/runner/run-harness-handlers.js +4 -17
  152. package/dist/core/runner/run-identity-wiring.js +4 -1
  153. package/dist/core/runner/run-leg.js +11 -1
  154. package/dist/core/runner/run-recovery-lanes.d.ts +0 -4
  155. package/dist/core/runner/run-recovery-lanes.js +34 -18
  156. package/dist/core/runner/run-settle-and-teardown.d.ts +1 -3
  157. package/dist/core/runner/run-settle-and-teardown.js +14 -22
  158. package/dist/core/runner/run-telemetry-and-budget-seats.js +0 -1
  159. package/dist/core/runner/run-terminal-adoption.d.ts +11 -30
  160. package/dist/core/runner/run-terminal-adoption.js +5 -88
  161. package/dist/core/runner/run-tool-mount-facts.js +1 -5
  162. package/dist/core/runner/run-turn-boundary.js +56 -26
  163. package/dist/core/runner/runtask.js +7 -7
  164. package/dist/core/runner/session-hash-salt.d.ts +18 -0
  165. package/dist/core/runner/session-hash-salt.js +36 -0
  166. package/dist/core/runner/shell-env-withheld.d.ts +8 -5
  167. package/dist/core/runner/shell-env-withheld.js +3 -3
  168. package/dist/core/runner/side-call-account.d.ts +9 -1
  169. package/dist/core/runner/side-call-account.js +15 -4
  170. package/dist/core/runner/skill-mention.d.ts +12 -0
  171. package/dist/core/runner/skill-mention.js +50 -0
  172. package/dist/core/runner/stream-settle-backstop.js +1 -0
  173. package/dist/core/runner/synthetic-tools.js +2 -2
  174. package/dist/core/runner/tool-table-view.d.ts +5 -9
  175. package/dist/core/runner/tool-table-view.js +23 -21
  176. package/dist/core/runner/write-protection-station.d.ts +5 -2
  177. package/dist/core/runner/write-protection-station.js +1 -1
  178. package/dist/core/runner-deps.d.ts +25 -27
  179. package/dist/core/scheduler.d.ts +13 -3
  180. package/dist/core/scheduler.js +0 -12
  181. package/dist/core/secret-env.d.ts +47 -11
  182. package/dist/core/secret-env.js +65 -4
  183. package/dist/core/sensitive-path-policy.js +4 -0
  184. package/dist/core/session-checkout.js +10 -9
  185. package/dist/core/shell-read-silence.d.ts +2 -1
  186. package/dist/core/shell-run-candidates.d.ts +1 -1
  187. package/dist/core/shell-run-candidates.js +11 -3
  188. package/dist/core/task-event.d.ts +32 -10
  189. package/dist/core/task-intake.d.ts +5 -3
  190. package/dist/core/task-intake.js +6 -2
  191. package/dist/core/task-result.d.ts +39 -0
  192. package/dist/core/task-spec-members.d.ts +3 -0
  193. package/dist/core/task-spec-members.js +2 -2
  194. package/dist/core/task-spec.d.ts +37 -20
  195. package/dist/core/tool-policy.d.ts +30 -18
  196. package/dist/core/tool-policy.js +44 -32
  197. package/dist/core/tool-roster.d.ts +21 -7
  198. package/dist/core/tool-roster.js +34 -6
  199. package/dist/core/tool-spec-members.js +1 -1
  200. package/dist/core/tool-spec.d.ts +27 -0
  201. package/dist/core/tools.js +1 -0
  202. package/dist/core/trace.d.ts +42 -19
  203. package/dist/core/unc-spelling.d.ts +31 -0
  204. package/dist/core/unc-spelling.js +51 -0
  205. package/dist/core/wiring-manifest.d.ts +30 -3
  206. package/dist/core/wiring-manifest.js +10 -0
  207. package/dist/core/workflow-run-store-contract.js +22 -0
  208. package/dist/core/workflow-run-store.d.ts +17 -13
  209. package/dist/core/workflow-run-store.js +1 -1
  210. package/dist/core/write-protect.d.ts +4 -0
  211. package/dist/core/write-protect.js +17 -15
  212. package/dist/engine/compaction/compaction.d.ts +48 -98
  213. package/dist/engine/compaction/compaction.js +136 -216
  214. package/dist/engine/compaction/utils.d.ts +2 -11
  215. package/dist/engine/compaction/utils.js +4 -13
  216. package/dist/engine/execution-env/node-execution-env.js +17 -6
  217. package/dist/engine/harness/agent-harness.d.ts +19 -5
  218. package/dist/engine/harness/agent-harness.js +18 -7
  219. package/dist/engine/harness/types.d.ts +5 -7
  220. package/dist/engine/loop/agent-loop.d.ts +14 -1
  221. package/dist/engine/loop/agent-loop.js +31 -11
  222. package/dist/engine/loop/types.d.ts +8 -2
  223. package/dist/index.d.ts +9 -6
  224. package/dist/index.js +8 -6
  225. package/dist/internal/harness-types.d.ts +1 -1
  226. package/dist/internal/harness.d.ts +1 -1
  227. package/dist/internal/harness.js +1 -1
  228. package/dist/orchestration/run-spec.js +7 -2
  229. package/dist/orchestration/run-workflow-tool.js +5 -3
  230. package/dist/orchestration/workflow-park-adoption.d.ts +66 -8
  231. package/dist/orchestration/workflow-park-adoption.js +195 -45
  232. package/dist/orchestration/workflow-types.d.ts +20 -0
  233. package/dist/orchestration/workflow-types.js +1 -0
  234. package/dist/orchestration/workflow.d.ts +3 -2
  235. package/dist/orchestration/workflow.js +10 -4
  236. package/dist/prompt-assembly/catalog/core-behavior.js +6 -0
  237. package/dist/prompt-assembly/catalog/events.d.ts +8 -0
  238. package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +6 -0
  239. package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +1 -0
  240. package/dist/prompt-assembly/catalog/mechanism.d.ts +8 -0
  241. package/dist/prompt-assembly/catalog/mechanism.js +1 -0
  242. package/dist/prompt-assembly/catalog/schema.d.ts +1 -1
  243. package/dist/prompt-assembly/catalog/schema.js +1 -0
  244. package/dist/prompt-assembly/catalog/sections.js +8 -0
  245. package/dist/prompt-assembly/event-registry.js +1 -0
  246. package/dist/prompt-assembly/select.js +1 -0
  247. package/dist/prompt-assembly/turn-snapshot.d.ts +14 -27
  248. package/dist/prompt-assembly/turn-snapshot.js +6 -18
  249. package/dist/prompt-assembly/types.d.ts +3 -0
  250. package/dist/prompts/default.d.ts +9 -0
  251. package/dist/prompts/default.js +4 -0
  252. package/dist/shell/lex.d.ts +75 -11
  253. package/dist/shell/lex.js +340 -76
  254. package/dist/tools/fs/bash-program-position.js +2 -6
  255. package/dist/tools/fs/bash-readonly-classifier.d.ts +18 -3
  256. package/dist/tools/fs/bash-readonly-classifier.js +19 -9
  257. package/dist/tools/fs/containment-face.d.ts +12 -3
  258. package/dist/tools/fs/containment-face.js +16 -7
  259. package/dist/tools/fs/file-read-check.d.ts +26 -1
  260. package/dist/tools/fs/file-read-check.js +20 -2
  261. package/dist/tools/fs/fs-bash.js +4 -4
  262. package/dist/tools/fs/fs-read.d.ts +3 -0
  263. package/dist/tools/fs/fs-read.js +2 -2
  264. package/dist/tools/fs/fs-search-tools.d.ts +2 -2
  265. package/dist/tools/fs/fs-search-tools.js +4 -4
  266. package/dist/tools/fs/index.js +5 -3
  267. package/dist/tools/fs/pdf.js +12 -4
  268. package/dist/tools/fs/read-deny-home.d.ts +13 -2
  269. package/dist/tools/fs/read-deny-home.js +26 -22
  270. package/dist/tools/fs/read-deny.js +15 -6
  271. package/dist/tools/fs/removal-targets.d.ts +33 -17
  272. package/dist/tools/fs/removal-targets.js +160 -61
  273. package/dist/tools/fs/repo-map.d.ts +1 -1
  274. package/dist/tools/fs/repo-map.js +2 -2
  275. package/dist/tools/fs/safety.d.ts +28 -5
  276. package/dist/tools/fs/safety.js +72 -8
  277. package/dist/tools/fs/shell-read-bindings.d.ts +8 -2
  278. package/dist/tools/fs/shell-read-bindings.js +25 -6
  279. package/dist/tools/fs/shell-read-check.d.ts +3 -0
  280. package/dist/tools/fs/shell-read-check.js +22 -4
  281. package/dist/tools/fs/shell-read-establish.js +73 -43
  282. package/dist/tools/fs/shell-read-judge.d.ts +32 -14
  283. package/dist/tools/fs/shell-read-judge.js +13 -5
  284. package/dist/tools/fs/shell-read-object-path.d.ts +5 -1
  285. package/dist/tools/fs/shell-read-object-path.js +17 -4
  286. package/dist/tools/fs/shell-read-plan.d.ts +8 -2
  287. package/dist/tools/fs/shell-read-plan.js +36 -22
  288. package/dist/tools/fs/shell-read-sourced.js +12 -4
  289. package/dist/tools/fs/shell-read-start.d.ts +4 -2
  290. package/dist/tools/fs/shell-read-start.js +3 -3
  291. package/dist/tools/fs/shell-read-workdir.d.ts +14 -6
  292. package/dist/tools/fs/shell-read-workdir.js +35 -17
  293. package/dist/tools/scheduler-tools.d.ts +7 -17
  294. package/dist/tools/scheduler-tools.js +9 -85
  295. package/dist/tools/worktree.js +5 -4
  296. package/package.json +3 -2
  297. package/test/export-surface.snapshot.json +47 -1
  298. package/wire-changes/core-stores-sql@7.68.6.json +39 -0
  299. package/wire-changes/core-stores-sql@7.69.1.json +39 -0
  300. package/wire-changes/core@7.68.6.json +125 -0
  301. package/wire-changes/core@7.69.1.json +2561 -0
  302. package/wire-changes/mods-kernel@7.68.6.json +39 -0
  303. package/wire-changes/mods-kernel@7.69.1.json +39 -0
  304. package/wire-changes/primitives@7.68.6.json +39 -0
  305. package/wire-changes/primitives@7.69.1.json +39 -0
  306. package/wire-changes/wiki-gate@7.68.6.json +39 -0
  307. package/wire-changes/wiki-gate@7.69.1.json +39 -0
  308. package/dist/core/runner/prompt-hash-salt.d.ts +0 -1
  309. package/dist/core/runner/prompt-hash-salt.js +0 -2
@@ -8,7 +8,8 @@
8
8
  * {@link foldIntake} is the one projection a composition (verification gate, cascade, repair loop) applies to the legs
9
9
  * it dispatched — never a second read of the store, never `stats.turns`. {@link foldContinuesFrom} is its twin for where
10
10
  * the composition leaves the session it hands back (`TaskResult.continuesFrom`), and {@link closeComposition} is the one closing
11
- * every composition's returned result passes: both accounts are the composition's own fold, never the last leg's by spread.
11
+ * every composition's returned result passes: both accounts, and the byte floor's record (`TaskResult.readDenyFloor`), are the
12
+ * composition's own fold over its legs, never the last leg's by spread.
12
13
  */
13
14
  import type { TaskResult } from "./task-result.js";
14
15
  export type TaskIntake = NonNullable<TaskResult["intake"]>;
@@ -35,8 +36,9 @@ export declare function foldIntake(legs: ReadonlyArray<unknown>): TaskIntake | u
35
36
  export declare function foldContinuesFrom(legs: ReadonlyArray<unknown>, hostSessionId: string | undefined): ContinuesFrom | undefined;
36
37
  /**
37
38
  * A composition's returned result: `result` (the leg it hands back) with the composition's own accounts of the legs it
38
- * dispatched in place of that leg's — its intake ({@link foldIntake}) and where it leaves the session that leg ran in,
39
- * `result.sessionId` ({@link foldContinuesFrom}); an unknown fold drops the member. The one closing every composition's return passes.
39
+ * dispatched in place of that leg's — its intake ({@link foldIntake}), where it leaves the session that leg ran in,
40
+ * `result.sessionId` ({@link foldContinuesFrom}), and whether any of them ran with an unkept byte floor ({@link foldFloorUnkept},
41
+ * over the legs and the returned leg itself); an unknown fold drops the member. The one closing every composition's return passes.
40
42
  */
41
43
  export declare function closeComposition<R extends TaskResult>(result: R, legs: ReadonlyArray<TaskResult>): R;
42
44
  export {};
@@ -49,9 +49,13 @@ export function foldContinuesFrom(legs, hostSessionId) {
49
49
  }
50
50
  return { none: "nothing_taken_in" };
51
51
  }
52
+ function foldFloorUnkept(legs) {
53
+ return legs.some((leg) => readMember(readMember(leg, "readDenyFloor"), "kept") === false);
54
+ }
52
55
  export function closeComposition(result, legs) {
53
- const { intake: _intake, continuesFrom: _landing, ...rest } = result;
56
+ const { intake: _intake, continuesFrom: _landing, readDenyFloor: _floor, ...rest } = result;
54
57
  const intake = foldIntake(legs.map((leg) => readMember(leg, "intake")));
55
58
  const continuesFrom = foldContinuesFrom(legs, result.sessionId);
56
- return { ...rest, ...(intake !== undefined ? { intake } : {}), ...(continuesFrom !== undefined ? { continuesFrom } : {}) };
59
+ const floorUnkept = foldFloorUnkept([result, ...legs]);
60
+ return { ...rest, ...(intake !== undefined ? { intake } : {}), ...(continuesFrom !== undefined ? { continuesFrom } : {}), ...(floorUnkept ? { readDenyFloor: { kept: false } } : {}) };
57
61
  }
@@ -881,6 +881,45 @@ export interface TaskResult {
881
881
  * governing the WORK, never the contents of any checkpoint row.
882
882
  */
883
883
  effectiveReadDenyPatterns?: readonly import("../tools/fs/read-deny.js").NormalizedReadDenyEntry[];
884
+ /**
885
+ * The leg's RECORD, over its whole life, that its byte floor was not kept: PRESENT IFF a read-deny table this leg compiled —
886
+ * the one at prepare, or any one compiled after it because the person's persisted rules changed while the leg ran — held rows,
887
+ * and the leg's execution environment does not declare it keeps the floor (`capabilities.keepsReadFloor`), on a deployment
888
+ * that does not require the floor (one that does refuses the leg at prepare, or the calls that judge with the later table).
889
+ * There, a recursive read under a root reads the files below it, deny rows included, and their bytes reach the conversation.
890
+ * Always `{ kept: false }` when present; ABSENT = no table the leg compiled held a row its environment did not keep, or the
891
+ * leg never compiled one (no hands, or prepare did not complete), or an engine older than this member assembled the result.
892
+ *
893
+ * One latch, judged where each table is compiled and read twice, never re-derived: the wiring manifest's
894
+ * {@link import("./wiring-manifest.js").WiringManifest.readDenyFloor} read it as the manifest was derived (the leg's wiring as
895
+ * it started), and this member reads it as the result is assembled — so this member holds wherever the manifest's cell does,
896
+ * and also for a table that gained rows after the manifest went out. To ask "did this leg run with a floor that was not
897
+ * kept", read this member. The person's notice (`config.read_deny_floor_unkept`) is told once per session and is not this
898
+ * record. A table is judged before it can be used, so every table anything in the leg judged with is on it; a table whose
899
+ * compile is still running when the result is assembled (a request's read landed new rows and the model then answered
900
+ * without another call) is one nothing in the leg judged with, and is not. On every terminal of a leg whose prepare
901
+ * completed, the stream layer's failure backstop included. A composition entry's result (the verify gate's, a cascade's, a
902
+ * repair loop's) carries the fold over the legs it closes over, not only its returned leg's record: present iff any of them
903
+ * carries it — the implementation leg and every fix round, every rung, every attempt; a later leg never takes an earlier
904
+ * leg's record back. Not among them, so with no record that reaches the host: the verify gate's verifier legs, and a child a
905
+ * leg delegated work to (the child's own result carries its record; the parent's result does not).
906
+ */
907
+ readDenyFloor?: {
908
+ kept: false;
909
+ };
910
+ /**
911
+ * The configuration roots a TASK layer declared for this leg — {@link import("./task-spec.js").TaskSpec.agentConfigDirs}, its own
912
+ * and the ones a resumed row recorded (the leg mint's carried part, `src/core/runner/leg-caller-places.ts`; the deployment's
913
+ * own `RunnerDeps.agentConfigDir` is not listed: every leg of the deployment declares it again) — as an engine-filled
914
+ * OBSERVATION. Same purpose as {@link effectiveReadDenyPatterns}: a root only the parked row knew never appears in the
915
+ * resume-side config, so a POST-COMPLETION follow-on leg (the verify gate's verifier and fix legs) unions these into its
916
+ * own `agentConfigDirs`, and the rows stay placed below the root on every leg that continues the work. Present iff
917
+ * non-empty; rides any terminal of a leg that ran.
918
+ */
919
+ effectiveAgentConfigDirs?: readonly string[];
920
+ /** The caller homes a TASK layer declared for this leg ({@link import("./task-spec.js").TaskSpec.agentHomeDirs}, its own and a
921
+ * resumed row's) — {@link effectiveAgentConfigDirs}'s twin for the home-anchored rows, same purpose, same presence. */
922
+ effectiveAgentHomeDirs?: readonly string[];
884
923
  /**
885
924
  * design/178 v2 §2.3 (件①) — the memory VISIBILITY face this leg actually ran under, as an
886
925
  * engine-filled OBSERVATION (never a knob: writing it on a spec does nothing). This is the
@@ -107,6 +107,8 @@ declare const SPEC_MEMBER_TABLE: {
107
107
  additionalReadDirectories: 0;
108
108
  readDenyPatterns: 0;
109
109
  writeProtectedAdditions: 0;
110
+ agentConfigDirs: 0;
111
+ agentHomeDirs: 0;
110
112
  complianceAdditionalDenies: 0;
111
113
  readFace: 0;
112
114
  writeFace: 0;
@@ -117,6 +119,7 @@ declare const SPEC_MEMBER_TABLE: {
117
119
  shellGate: 0;
118
120
  permissionMode: 0;
119
121
  classifyAllShell: 0;
122
+ blockReadsOutsideRoots: 0;
120
123
  mcp: 0;
121
124
  a2a: 0;
122
125
  skills: 0;
@@ -13,8 +13,8 @@ const SPEC_MEMBER_TABLE = {
13
13
  deferTools: 0, toolMaterializeStrategy: 0, alwaysLoadTools: 0, restoreGatedTools: 0, deferSelfResolve: 0, promptLean: 0, agents: 0, toolPolicy: 0,
14
14
  basePolicyForResumeEdit: 0, onAsk: 0, onQuestion: 0, lspManager: 0, lspDiagnostics: 0, mods: 0, peerPresence: 0, durableApproval: 0,
15
15
  resourceSuspend: 0, preemptSignal: 0, resilience: 0, finalVerification: 0, maxSuspends: 0, checkpointStore: 0, handsReadOnly: 0, memoryPersistenceCapable: 0,
16
- additionalDirectories: 0, additionalReadDirectories: 0, readDenyPatterns: 0, writeProtectedAdditions: 0, complianceAdditionalDenies: 0, readFace: 0, writeFace: 0, enablePlanMode: 0,
17
- planFile: 0, interactiveTools: 0, enableFork: 0, shellGate: 0, permissionMode: 0, classifyAllShell: 0, mcp: 0, a2a: 0,
16
+ additionalDirectories: 0, additionalReadDirectories: 0, readDenyPatterns: 0, writeProtectedAdditions: 0, agentConfigDirs: 0, agentHomeDirs: 0, complianceAdditionalDenies: 0, readFace: 0, writeFace: 0, enablePlanMode: 0,
17
+ planFile: 0, interactiveTools: 0, enableFork: 0, shellGate: 0, permissionMode: 0, classifyAllShell: 0, blockReadsOutsideRoots: 0, mcp: 0, a2a: 0,
18
18
  skills: 0, userInvokedSkills: 0, allowedTools: 0, skillListingBudgetFraction: 0, skillListingMaxDescChars: 0, backgroundScope: 0, sandbox: 0, envFacts: 0, limits: 0,
19
19
  configOverrides: 0, forwardSubagentEvents: 0, retainSubagentSessions: 0, retainBackgroundProcesses: 0, outputSchema: 0, outputRetries: 0, tracer: 0,
20
20
  toolResultThresholdChars: 0, compaction: 0, attachments: 0, enableBlockedReport: 0, selfOrchestration: 0, getApiKeyAndHeaders: 0, signal: 0,
@@ -422,14 +422,9 @@ export interface TaskSpec {
422
422
  modelRole?: ModelRole;
423
423
  /** Per-task/scenario role→model overrides (merged over `RunnerDeps.roles`, task wins). */
424
424
  roles?: ModelRoles;
425
- /** Optional cheaper model for compaction/summarization. Falls back to the `summarize` role if set.
426
- * design/145 §1 semantics: used only while WINDOW-SAFE and budget/walltime allow — when its
427
- * window would clamp-truncate the conversation past `compaction.clampTolerance`, the summary
428
- * call falls back to the MAIN model (CC's unconditional posture; the independent compaction
429
- * model is sema's superset) and the `compacted` event says so (`modelFallback`). Subagent
430
- * declaration (design/145 §5): delegated children never inherit this field — a child always
431
- * self-compacts on its own main model, so the window-safety judgment is structurally never
432
- * triggered in a subagent (guard-tested). */
425
+ /** @deprecated Received and ignored: a compaction summary always runs on the task's own model and reuses the main
426
+ * request (same system prompt, tools and messages, one instruction appended); neither this field nor the `summarize`
427
+ * role is read for it. Announced once per process (`config.compaction_member_ignored`); refused by name from 7.70.0. */
433
428
  compactionModel?: ModelRef;
434
429
  /** The ADVISOR model (CC's `advisorModel` setting): any ref {@link model} takes. Present ⇒ prepare judges it against this leg's own model (`advisorAttachVerdict`) and, when it attaches, mounts the no-argument `advisor` tool; a value that is neither a string nor a Model refuses prepare (`config.advisor_model_invalid`) unless `RunnerDeps.advisorTool` is `"disabled"`, which ignores it unread. Rides the parent spec seat — unlike {@link compactionModel}, a child inherits it and judges it against its own model. */
435
430
  advisorModel?: ModelRef;
@@ -1118,6 +1113,13 @@ export interface TaskSpec {
1118
1113
  * (`config.invalid_argument`); rides every engine-built child spec add-only.
1119
1114
  */
1120
1115
  writeProtectedAdditions?: readonly import("./write-protect.js").WriteProtectedEntry[];
1116
+ /** The CALLER's configuration roots, for a host on an engine it did not start (absolute existing directories; absent ⇒ the
1117
+ * deployment's root alone): add-only beside {@link RunnerDeps.agentConfigDir}, the `~/.sema/…` read deny rows and the write
1118
+ * table's `.sema` rows are placed below each. Bad ⇒ `config.agent_config_dir_invalid`. Rides children and parked rows. */
1119
+ agentConfigDirs?: readonly string[];
1120
+ /** The CALLER's homes, for an engine running under another home (absolute existing directories): the home-anchored read
1121
+ * deny rows are also placed below each, add-only; nothing else reads the list. Bad ⇒ `config.agent_home_dir_invalid`. */
1122
+ agentHomeDirs?: readonly string[];
1121
1123
  /**
1122
1124
  * TASK-layer denies ADDED to the compliance posture ({@link readDenyPatterns}' law): the run's deny set is the deployment's
1123
1125
  * ({@link RunnerDeps.compliancePostureResolver}) UNION these; `[]` ≡ absent; nothing here removes a deployment deny. A hit
@@ -1254,6 +1256,24 @@ export interface TaskSpec {
1254
1256
  * present non-boolean refuses the run (`config.invalid_argument`).
1255
1257
  */
1256
1258
  classifyAllShell?: boolean;
1259
+ /**
1260
+ * Refuse reads outside this task's directories, in every permission mode, without asking (the reference's
1261
+ * `permissions.blockReadsOutsideWorkingDirectories`). `true` ⇒ the file read tools (Read, Grep, Glob, RepoMap, LSP — images,
1262
+ * PDFs and notebooks through Read) and the Artifact tool's local read refuse a target outside the task's directories at the
1263
+ * gate, before any question (`tool_end.gate.disposition.deniedBy: "read_boundary"`, card `path_not_in_root`); so do they every
1264
+ * read the tool would refuse itself (a deny row, a target it cannot resolve). The directories are the DECLARED ones — the
1265
+ * leg's own read roots (the task root, the write location, `additionalDirectories`, `additionalReadDirectories`, the
1266
+ * directories the host advertises as writable) — never a person's `Read(//dir/**)` allow rows (either partition), and no
1267
+ * directory is granted mid-run (no card offers one). A shell read outside them stays the question it is
1268
+ * (the read-only shell's refusal included), against the same directories. Absent / `false` ⇒ today's behaviour, byte for
1269
+ * byte. A task-layer `readFace: "open"` beside it refuses the run (`config.read_face_read_block_conflict`); a deployment
1270
+ * `readFace: "open"` is clamped to "roots" on such a leg, announced once per notice sink
1271
+ * (`config.read_face_deployment_clamped`, `detail.cause: "read_block"`). Which settings planes may set it is the host's
1272
+ * reading (the reference: any settings source that says `true` wins); the engine never persists it beyond the run's own park
1273
+ * row (`CheckpointState.readBlock`, which a resume keeps). Tighten-only: `tightenTaskSpec` keeps a baseline's `true`, every
1274
+ * child the engine builds inherits it. A present non-boolean refuses the run (`config.invalid_argument`).
1275
+ */
1276
+ blockReadsOutsideRoots?: boolean;
1257
1277
  /** Task-scoped MCP servers, materialized into tools then disposed. */
1258
1278
  mcp?: McpServerSpec[];
1259
1279
  /** Task-scoped A2A peers (remote agents), whose advertised skills mount as `a2a__<peer>__<skill>`
@@ -1500,8 +1520,8 @@ export interface TaskSpec {
1500
1520
  toolResultThresholdChars?: number;
1501
1521
  /**
1502
1522
  * Override auto-compaction thresholds for this task's session. Compaction (LLM summary, persisted
1503
- * to the session) runs in two places sharing these settings: at every within-task turn boundary
1504
- * (design/64 §25 (A) — the long-single-task case) and once at task end (the between-task case).
1523
+ * to the session) is judged before a request, in two places sharing these settings: before each request that follows a
1524
+ * turn boundary (design/64 §25 (A) — the long-single-task case) and before a run's first request (the between-task case).
1505
1525
  * Defaults: both seats on (`autoCompact` / `manualCompact` below), reserveTokens 16384 (else `contextSettings[word].reserveTokens`; a value stated here is the author), keepRecentTokens 0 (design/169-C; 20000 was the
1506
1526
  * pre-169 default). A zero budget is NOT "no verbatim tail": the cut-point search has a
1507
1527
  * structural floor under the budget, so the default already leaves the last exchange verbatim
@@ -1520,10 +1540,11 @@ export interface TaskSpec {
1520
1540
  * per-call override and a preCompact hook's additions): break-out tags (`</system-reminder>`) and
1521
1541
  * fence sentinels are defused, and the text is capped at 2048 code points; clean text under the
1522
1542
  * cap passes through byte-identical.
1523
- * Scope caveat (design/141 examples 批实测): `instructions` rides the WHOLE-TURN summarization
1524
- * request only; a split-turn cut point (mid-turn prefix summarization) uses the engine-owned
1525
- * turn-prefix prompt and does not carry it (same A2 boundary as `RunnerDeps.summaryProvider`).
1526
- * `withinTask: false` keeps end-of-task compaction but disables the ROUTINE within-task
1543
+ * `instructions` rides every summarization request a pass sends (one per pass: the kept tail starts
1544
+ * at a group's opening, so no turn is split and no separate turn-prefix request exists).
1545
+ * The automatic pass is judged before a request, never after one: before a run's first request, and before each request
1546
+ * that follows a turn boundary — a run past its answer is not compacted, the session's next run compacts at its start.
1547
+ * `withinTask: false` keeps the run-start judgment but disables the ROUTINE within-task
1527
1548
  * (turn-boundary) trigger — the escape hatch for the §25 (A) control-flow change; the system
1528
1549
  * prompt then stops claiming ROUTINE mid-task summarization (§6.3 honesty). It does NOT silence
1529
1550
  * the recovery-class forced lanes (design/374 slice 3): a prompt-too-long recovery or the guard
@@ -1573,12 +1594,8 @@ export interface TaskSpec {
1573
1594
  * loudly at prepare (`code: "config.stale_tool_result_offload_invalid"`, no silent re-default).
1574
1595
  */
1575
1596
  staleToolResultOffload?: StaleToolResultOffloadOptions;
1576
- /** design/145 §1 — window-safety tolerance for an independent `compactionModel`: when the
1577
- * summary input would be clamp-truncated by MORE than this ratio to fit the compaction
1578
- * model's window, the call falls back to the main model (subject to the budget/walltime
1579
- * gates). 0 = any truncation triggers the fallback candidacy; 1 = never fall back (the
1580
- * pre-145 clamp-only escape hatch). Default 0.10 — the honest read: head+tail clamping keeps
1581
- * ≤10% mid-section loss BOUNDED AND DISCLOSED (`compaction.clamp_disclosure`), not lossless. */
1597
+ /** @deprecated Received and ignored: there is no separate summary model whose window could clip the summary input.
1598
+ * Announced once per process (`config.compaction_member_ignored`); refused by name from 7.70.0. */
1582
1599
  clampTolerance?: number;
1583
1600
  };
1584
1601
  /**
@@ -1004,10 +1004,11 @@ export type ApprovalSeatOutcome = boolean | (Extract<AskOutcome, {
1004
1004
  *
1005
1005
  * WHAT `approve` MAY RETURN: a boolean, as always, or the `{allow, …}` OUTCOME OBJECT the `onAsk` seat takes, read by the SAME screen
1006
1006
  * ({@link readApproverOutcomeObject}) and narrowed to what this seat has a lane for ({@link ApprovalSeatOutcome}) — so a deployment
1007
- * here can report WHO ended the wait (`settledBy:"policy"` for its own policy's yes or no, `"timeout"` for its own elapsed window),
1008
- * attach the decider's `reason` and name the `approver`. A bare `true` / `false` is unchanged: a person's approval or refusal, the
1009
- * refusal with this factory's own terse sentence. Before the object arm a bare boolean was the only spelling there was, so a machine's
1010
- * decision filed a PERSON's record. A person's yes answers this factory's own question about the call, never the `cross_boundary` one
1007
+ * here can report WHO ended the wait (`settledBy:"policy"` for its own policy's yes or no, `"timeout"` for its own elapsed window,
1008
+ * `"withdrawn"` for a question its system closed before anyone answered it),
1009
+ * attach the decider's `reason` and name the `approver`. A bare `true` / `false` is a person's approval or refusal, the refusal with
1010
+ * this factory's own terse sentence — but a refusal naming no word from an `approve` declared a policy ({@link asPolicyApprover}) is
1011
+ * the policy's, as at the run's seat. A person's yes answers this factory's own question about the call, never the `cross_boundary` one
1011
1012
  * the station raises after the policy (`gate-fold.ts`): that goes to the ask seat, and a run with none refuses the call headless.
1012
1013
  */
1013
1014
  export declare function createApprovalPolicy(opts: {
@@ -1193,7 +1194,7 @@ export declare function createCoarseCommandNamePolicy(opts: {
1193
1194
  * surface to attach to: it suppresses the "always allow / don't ask again" affordance in the CC permission
1194
1195
  * dialog (908517 / 909563) and re-attaches a matching user `ask` rule on the auto-mode surface (461507).
1195
1196
  * Core has neither a persisted always-allow surface nor rule re-attachment — noted for whichever UI layer
1196
- * grows one.
1197
+ * grows one. The bit rides only the protected-location question: a target or shell text the guard could not read or verify is an ordinary question (`MODE_ARBITRATION`).
1197
1198
  */
1198
1199
  export declare function createUnverifiableDeletePolicy(opts?: {
1199
1200
  /** Extra variable names treated as well-known-safe roots, ADDED to the default set `TMPDIR`/`HOME`
@@ -1758,14 +1759,17 @@ export type OnAsk = "deny" | "allow" | ((req: AskRequest, signal?: AbortSignal)
1758
1759
  * applied as the resolved decision's own rewrite: the gate re-validates it against the tool
1759
1760
  * schema exactly like a hook/policy rewrite.
1760
1761
  *
1761
- * #114② (2026-08-09) — `settledBy` on the object arm is the SYNCHRONOUS leg's only channel for saying
1762
- * what ended the wait. This leg's window belongs to the HOST (`onAsk` is a callback the deployment
1762
+ * #114② (2026-08-09) — `settledBy` on the object arm is the SYNCHRONOUS leg's channel for saying what ended
1763
+ * the wait (a seat's declaration, {@link asPolicyApprover}, is the other). This leg's window belongs to the HOST (`onAsk` is a callback the deployment
1763
1764
  * owns; the engine starts no timer for it — with the ONE #548 exception below), so a host that timed
1764
1765
  * its own approval card out could
1765
1766
  * previously only report a plain `false`, which the engine correctly recorded as `"human"` — a person
1766
- * refusing. The three words the host may self-report:
1767
- * - `"human"` — a person answered (identical to omitting the field);
1767
+ * refusing. The words the host may self-report ({@link APPROVER_SETTLED_BY}):
1768
+ * - `"human"` — a person answered (what an omitted field reads as, except below);
1768
1769
  * - `"timeout"` — the host's own approval window elapsed with no answer;
1770
+ * - `"withdrawn"` — the host's approval system closed this question before anyone answered it while the run goes on
1771
+ * (`approval_withdrawn`, `who.party: "host"`): nobody refused, the model may ask again ({@link withdrawnAskMessage}),
1772
+ * `reason` is fenced as the host's note, and it never ends the issuing batch;
1769
1773
  * - `"policy"` — the deployment's OWN policy answered, either way: a machine decided, not a person (an
1770
1774
  * unattended lane answering by class, a headless lane whose approver seat exists but can show nobody a
1771
1775
  * prompt). Its allow settles `policy_allowed`, its refusal `policy_refused`. Spelled `true` / `false`, such
@@ -1776,9 +1780,9 @@ export type OnAsk = "deny" | "allow" | ((req: AskRequest, signal?: AbortSignal)
1776
1780
  * gate treat it alike — and only the record names a different party, with ONE exception that is about the
1777
1781
  * party itself: an ask carrying {@link AskRequest.requiresRealApproval} demands a person, and a policy's
1778
1782
  * allow is refused there exactly as the blanket `"allow"` seat is (`blanket_allow_refused`). OMITTING the
1779
- * field still reads as `"human"`, so an unrevised host is unchanged.
1780
- * `"timeout"` is legal ONLY with `allow: false` — an elapsed window is a wait nobody answered, and it cannot be
1781
- * what APPROVED an action — so `{allow: true, settledBy: "timeout"}` is refused fail-closed.
1783
+ * field still reads as `"human"` — save a refusal from a seat declared a policy ({@link asPolicyApprover}), which is `"policy"`.
1784
+ * `"timeout"` and `"withdrawn"` are legal ONLY with `allow: false` — each names a wait nobody answered, and it cannot be
1785
+ * what APPROVED an action — so `{allow: true, settledBy: "timeout"}` (or `"withdrawn"`) is refused fail-closed.
1782
1786
  * `"aborted"` is deliberately NOT accepted here — that word names the engine's OWN fail-closed ends
1783
1787
  * (abort, throw, unavailable, out-of-contract value), each already stamped at its own arm, and a
1784
1788
  * self-reported one would let a host relabel its refusal as an engine failure.
@@ -1854,13 +1858,19 @@ export type OnAsk = "deny" | "allow" | ((req: AskRequest, signal?: AbortSignal)
1854
1858
  export type AskOutcome = boolean | "unavailable" | {
1855
1859
  allow: boolean;
1856
1860
  updatedInput?: unknown;
1857
- settledBy?: "human" | "timeout" | "policy";
1861
+ settledBy?: "human" | "timeout" | "policy" | "withdrawn";
1858
1862
  reason?: string;
1859
1863
  approver?: string;
1860
1864
  decidedVia?: DecidedVia;
1861
1865
  readRootGrant?: string;
1862
1866
  feedback?: string;
1863
1867
  };
1868
+ /** A word a synchronous approver may report on `settledBy` — read off {@link AskOutcome}, the one place it is spelled as a type. */
1869
+ type ApproverSettledBy = NonNullable<Exclude<AskOutcome, boolean | "unavailable">["settledBy"]>;
1870
+ /** The closed set of {@link ApproverSettledBy}, as a value — what the seam's screen and its refusal sentence read (omitted: see the screen's fold). */
1871
+ declare const APPROVER_SETTLED_BY: readonly ["human", "timeout", "policy", "withdrawn"];
1872
+ /** Compile-time fence: `never` while the value lists every word the type allows. */
1873
+ export type ApproverSettledByListsEveryWord = AssertAllKeysHandled<Exclude<ApproverSettledBy, (typeof APPROVER_SETTLED_BY)[number]>>;
1864
1874
  /** An approver callback — the function arm of {@link OnAsk}. */
1865
1875
  type ApproverFn = Extract<OnAsk, (...args: never[]) => unknown>;
1866
1876
  /**
@@ -1891,10 +1901,12 @@ export declare function withDelegationProvenance(onAsk: OnAsk, delegation: AskDe
1891
1901
  * a channel. Returns the same function. The run then reads its seat as `policy_callback`
1892
1902
  * ({@link import("./wiring-manifest.js").AskSeamForm}): `approvalReach: "none"` keeps it (the declaration sets aside the
1893
1903
  * one seat that could be a person), the manifest reports `policy_reachable`, the posture door refuses it beside
1894
- * `interactionPosture: "interactive"`, and an allow it gives on an ask carrying `requiresRealApproval` is refused.
1904
+ * `interactionPosture: "interactive"`, and an allow it gives on an ask carrying `requiresRealApproval` is refused. A refusal it
1905
+ * gives naming no word (a bare `false`, an object without `settledBy`) is the policy's: `policy_refused`, in the policy's
1906
+ * sentence — here and as a {@link createApprovalPolicy} `approve`; its unworded yes still relays a person's.
1895
1907
  *
1896
- * Mark the value that is actually installed as `onAsk` — the outermost one: a host closure put in front of a marked
1897
- * approver is a new function, and an unmarked function reads as a person (today's reading — a lost mark never widens
1908
+ * Mark the value that is actually installed (`onAsk`, or the factory's `approve`) — the outermost one: a host closure put
1909
+ * in front of a marked approver is a new function, and an unmarked function reads as a person (a lost mark never widens
1898
1910
  * anything). Marking a wrapper the engine made marks the approver behind it. A policy that would answer every ask with
1899
1911
  * a new allow is the blanket `onAsk: "allow"`, not a marked approver; a blanket is not a callback and cannot be marked.
1900
1912
  * A non-function is refused (`TypeError`); marking twice is the same as marking once.
@@ -1919,7 +1931,7 @@ export declare function isPolicyApprover(v: unknown): boolean;
1919
1931
  * and its call reaches the same answer.
1920
1932
  *
1921
1933
  * Only the classes a standing rule may clear can be declared — the column `ruleMayClear` of
1922
- * {@link import("./ask-origin.js").MODE_ARBITRATION} (today `ordinary` and `unstated`): a table is a deployment's answer
1934
+ * {@link import("./ask-origin.js").MODE_ARBITRATION} (today `unverifiable_delete`, `unverifiable_shell_text`, `sandbox_override`, `sandbox_network`, `unstated` and `ordinary`): a table is a deployment's answer
1923
1935
  * to the questions the allow layer itself may answer, by class instead of by tool. A question the engine mints demanding a
1924
1936
  * person ({@link AskRequest.requiresRealApproval}) always carries a class outside that column, so no table covers it; a
1925
1937
  * hand-built request carrying the bit beside a covered set is answered by the table and refused by the real-approval arm,
@@ -2297,7 +2309,7 @@ export declare function cardCarriesBidiControls(card: {
2297
2309
  *
2298
2310
  * Every arm that ENDED A WAIT composes the {@link import("./gate-outcome.js").Settlement} for it, at the
2299
2311
  * arm: the approver's own verdicts settle as a person's unless the outcome names another word on
2300
- * {@link AskOutcome.settledBy} (its own window, its own policy), and the fail-closed ends around them
2312
+ * {@link AskOutcome.settledBy} (its own window, its own policy) or a seat declared a policy refuses naming none, and the fail-closed ends around them
2301
2313
  * (abort, a throw, an "unavailable" report, an unclonable presentation, an out-of-contract value) settle
2302
2314
  * as the engine's own nobody-ended family; a policy's allow on a `requiresRealApproval` ask is refused as the
2303
2315
  * blanket seat's is ({@link unjudgedAllowRefused}). The three POSTURE arms at the top — blanket `"allow"`, its
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
3
3
  import { argsReadFrom, carryArgsReadFrom, withArgsReading } from "./effective-path-target.js";
4
4
  import { editRewrittenSentence, readRejudge, rewriteChasedSentence } from "./rewrite-rejudge.js";
5
5
  import { brandPolicyAskClass } from "./ask-class.js";
6
- import { ASK_CLASSES, decisionAskClassesOf, headlessDenialMessage, joinAskReasons, MODE_ARBITRATION, unresolvedAskDenialMessage } from "./ask-origin.js";
6
+ import { ASK_CLASSES, decisionAskClassesOf, explainsRealApprovalBit, headlessDenialMessage, joinAskReasons, MODE_ARBITRATION, unresolvedAskDenialMessage } from "./ask-origin.js";
7
7
  import { attest, attestationOf, engineSentenceOf, isEngineAttestation, mergeAttestation, mintAttestation, withAttestation } from "./engine-attestation.js";
8
8
  import { ownReadRootCandidate, readRootGrantSeat } from "./read-root-grant-screen.js";
9
9
  import { liveWordsOf } from "./approval-words.js";
@@ -541,8 +541,8 @@ export function createApprovalPolicy(opts) {
541
541
  }
542
542
  if (signal?.aborted)
543
543
  return abortedSeatDeny(req, `approval aborted for "${req.toolName}" (run or turn interrupted)`, "policy");
544
- if (typeof ok === "object" && ok !== null) {
545
- const reading = readApproverOutcomeObject(ok, req.toolName, { editLane: "none", takesWords: false, isPolicy: false });
544
+ if (ok === false || (typeof ok === "object" && ok !== null)) {
545
+ const reading = readApproverOutcomeObject(ok, req.toolName, { editLane: "none", takesWords: false, isPolicy: isPolicyApprover(opts.approve) });
546
546
  if (reading.kind === "refused")
547
547
  return attest({ action: "deny", message: reading.message }, reading.settlement);
548
548
  if (reading.kind === "deny") {
@@ -552,7 +552,9 @@ export function createApprovalPolicy(opts) {
552
552
  ? policyRefusalMessage(req.toolName, undefined, reading.note, reading.via)
553
553
  : reading.word === "timeout"
554
554
  ? `no one answered the approval request for "${req.toolName}" — the approver reported its own window elapsed with no answer; denied fail-closed${reading.note !== undefined ? `\nReviewer note:\n${delimitUntrusted("reviewer note", reading.note, REVIEWER_NOTE_MAX_BODY)}` : ""}`
555
- : `approval denied for "${req.toolName}"${reading.note !== undefined ? `\nReviewer note:\n${delimitUntrusted("reviewer note", reading.note, REVIEWER_NOTE_MAX_BODY)}` : ""}`,
555
+ : reading.word === "withdrawn"
556
+ ? withdrawnAskMessage(req.toolName, undefined, reading.note)
557
+ : `approval denied for "${req.toolName}"${reading.note !== undefined ? `\nReviewer note:\n${delimitUntrusted("reviewer note", reading.note, REVIEWER_NOTE_MAX_BODY)}` : ""}`,
556
558
  }, reading.settlement);
557
559
  }
558
560
  if (!heldWhileWaiting())
@@ -562,14 +564,11 @@ export function createApprovalPolicy(opts) {
562
564
  const okRaw = ok;
563
565
  if (okRaw === true)
564
566
  return heldWhileWaiting() ? attest({ action: "allow", decisionReason: "mode" }, settledByDecider("person", "allowed", undefined)) : changedWhilePending();
565
- if (okRaw !== false) {
566
- return attest({
567
- action: "deny",
568
- message: `approval callback for "${req.toolName}" returned an out-of-contract value (${typeof ok}) — denied fail-closed ` +
569
- `(this policy's \`approve\` returns true, false, or the {allow, settledBy?, reason?, approver?} outcome object)`,
570
- }, settledByNobody("approver_contract"));
571
- }
572
- return attest({ action: "deny", message: `approval denied for "${req.toolName}"` }, settledByDecider("person", "refused", undefined));
567
+ return attest({
568
+ action: "deny",
569
+ message: `approval callback for "${req.toolName}" returned an out-of-contract value (${typeof ok}) — denied fail-closed ` +
570
+ `(this policy's \`approve\` returns true, false, or the {allow, settledBy?, reason?, approver?} outcome object)`,
571
+ }, settledByNobody("approver_contract"));
573
572
  }
574
573
  if (nameListHolds(auto, req) || coveringRuleHit(autoCovering, req))
575
574
  return ALLOW;
@@ -801,7 +800,7 @@ export function createUnverifiableDeletePolicy(opts) {
801
800
  }, "external_authority");
802
801
  }
803
802
  function removalAsk(req, verdict) {
804
- return attest({ action: "ask", decisionReason: "safety", requiresRealApproval: true, message: verdict.text }, req, { guards: [verdict.guard], sentence: { text: verdict.text, guard: verdict.guard } });
803
+ return attest({ action: "ask", decisionReason: "safety", ...(explainsRealApprovalBit([verdict.guard]) ? { requiresRealApproval: true } : {}), message: verdict.text }, req, { guards: [verdict.guard], sentence: { text: verdict.text, guard: verdict.guard } });
805
804
  }
806
805
  function pathSegments(p) {
807
806
  return p.split(/[\\/]/).filter(Boolean);
@@ -903,6 +902,11 @@ export function createTranscriptIntegrityPolicy(opts) {
903
902
  },
904
903
  }, "external_authority");
905
904
  }
905
+ const APPROVER_SETTLED_BY = Object.freeze(["human", "timeout", "policy", "withdrawn"]);
906
+ const isApproverSettledBy = (v) => APPROVER_SETTLED_BY.some((w) => w === v);
907
+ const HOST_END_OF_WORD = Object.freeze({ timeout: "approval_window_expired", withdrawn: "approval_withdrawn" });
908
+ const namesNoDecider = (word) => Object.hasOwn(HOST_END_OF_WORD, word);
909
+ const hostEndOf = (word) => ({ kind: HOST_END_OF_WORD[word], who: { party: "host" }, when: Date.now() });
906
910
  const delegatedApproverRoot = new WeakMap();
907
911
  export function wrapApprover(onAsk, wrap) {
908
912
  if (typeof onAsk !== "function")
@@ -1128,6 +1132,12 @@ export function policyRefusalMessage(toolName, askMessage, note, decidedVia) {
1128
1132
  `was blocked and why you needed it, then continue with the parts of the task that do not require approval.`;
1129
1133
  return note === undefined ? body : `${body}\nPolicy note:\n${delimitUntrusted("policy note", note, REVIEWER_NOTE_MAX_BODY)}`;
1130
1134
  }
1135
+ function withdrawnAskMessage(toolName, askMessage, note) {
1136
+ const body = `approval for "${toolName}" was withdrawn before anyone answered it${askMessage !== undefined ? `: ${askMessage}` : ""}\n` +
1137
+ `The approval system closed this request without an answer, so the call did NOT run. Nobody refused it, so this is not ` +
1138
+ `the user's decision; ask again if it is still needed.`;
1139
+ return note === undefined ? body : `${body}\nHost note:\n${delimitUntrusted("host note", note, REVIEWER_NOTE_MAX_BODY)}`;
1140
+ }
1131
1141
  const quotingQuestion = Object.freeze({ quotesQuestion: true });
1132
1142
  export const BIDI_CONTROL_CHARS = "\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069";
1133
1143
  const BIDI_CONTROL_RE = new RegExp(`[${BIDI_CONTROL_CHARS}]`, "u");
@@ -1269,7 +1279,8 @@ function detachLateAskWait(wait, onLate) {
1269
1279
  })
1270
1280
  .catch(() => undefined);
1271
1281
  }
1272
- function readApproverOutcomeObject(ok, toolName, seat) {
1282
+ function readApproverOutcomeObject(answer, toolName, seat) {
1283
+ const ok = answer === false ? Object.assign(Object.create(null), { allow: false }) : answer;
1273
1284
  const refused = (message, settlement) => ({ kind: "refused", message, settlement });
1274
1285
  let supplied;
1275
1286
  let allowed;
@@ -1294,11 +1305,12 @@ function readApproverOutcomeObject(ok, toolName, seat) {
1294
1305
  return refused(`the approver for "${toolName}" returned an object whose allow is not a boolean ` +
1295
1306
  `(got ${allowed === null ? "null" : typeof allowed}) — a verdict is exactly true or false; denied fail-closed`, settledByNobody("approver_contract"));
1296
1307
  }
1297
- if (supplied !== undefined && supplied !== "human" && supplied !== "timeout" && supplied !== "policy") {
1308
+ if (supplied !== undefined && !isApproverSettledBy(supplied)) {
1309
+ const words = APPROVER_SETTLED_BY.map((w) => `"${w}"`);
1298
1310
  return refused(`the approver for "${toolName}" reported settledBy "${typeof supplied === "string" ? containThrownText(supplied) : supplied === null ? "null" : typeof supplied}", which is outside what a synchronous ` +
1299
- `approver may self-report — it is exactly "human", "timeout" or "policy" (or omitted); denied fail-closed`, settledByNobody("approver_contract"));
1311
+ `approver may self-report — it is exactly ${words.slice(0, -1).join(", ")} or ${words[words.length - 1]} (or omitted); denied fail-closed`, settledByNobody("approver_contract"));
1300
1312
  }
1301
- const settledWord = supplied === "timeout" ? "timeout" : supplied === "policy" ? "policy" : "human";
1313
+ const settledWord = supplied ?? (seat.isPolicy && allowed === false ? "policy" : "human");
1302
1314
  const attribution = screenApproverAttribution(suppliedApprover);
1303
1315
  if (attribution.defect !== undefined) {
1304
1316
  return refused(`the approver for "${toolName}" reported an attribution this seam refuses: ${attribution.defect}; denied fail-closed`, settledByNobody("approver_contract"));
@@ -1310,7 +1322,8 @@ function readApproverOutcomeObject(ok, toolName, seat) {
1310
1322
  if (seat.editLane === "none" && grant !== undefined) {
1311
1323
  return refused(`the approver for "${toolName}" attached a readRootGrant on a seat that offers no directory — denied fail-closed (a grant answers an approval card's readRootCandidate)`, settledByNobody("approver_contract"));
1312
1324
  }
1313
- const decider = settledWord === "policy" ? "policy" : settledWord === "human" ? "person" : undefined;
1325
+ const deciderParty = settledWord === "policy" ? "policy" : "person";
1326
+ const decider = namesNoDecider(settledWord) ? undefined : deciderParty;
1314
1327
  const live = liveWordsOf(feedback, { toolName, allowed, byPerson: decider === "person" && !seat.isPolicy, hasCarrier: seat.takesWords });
1315
1328
  if (live.kind === "refused")
1316
1329
  return refused(live.message, settledByNobody("approver_contract"));
@@ -1335,7 +1348,7 @@ function readApproverOutcomeObject(ok, toolName, seat) {
1335
1348
  note,
1336
1349
  via: via.decidedVia,
1337
1350
  grant,
1338
- settlement: decider === undefined ? { kind: "approval_window_expired", who: { party: "host" }, when: Date.now() } : settledByDecider(decider, "refused", attribution.approver, note),
1351
+ settlement: namesNoDecider(settledWord) ? hostEndOf(settledWord) : settledByDecider(deciderParty, "refused", attribution.approver, note),
1339
1352
  };
1340
1353
  }
1341
1354
  if (decider === undefined) {
@@ -1439,7 +1452,7 @@ async function resolveAskArms(req, onAsk, signal, onLateSettlement, takesWords =
1439
1452
  };
1440
1453
  }
1441
1454
  const allowWithoutAPerson = (party) => req.requiresRealApproval === true && (party === "policy" || isPolicyApprover(onAsk));
1442
- if (typeof ok === "object" && ok !== null) {
1455
+ if (ok === false || (typeof ok === "object" && ok !== null)) {
1443
1456
  const reading = readApproverOutcomeObject(ok, req.toolName, { editLane: "readjudicated", takesWords, isPolicy: isPolicyApprover(onAsk) });
1444
1457
  if (reading.kind === "refused")
1445
1458
  return { action: "deny", message: reading.message, decisionReason: "mode", settlement: reading.settlement, ...(reading.binding === true ? { bindingRefusal: reading.message } : {}) };
@@ -1452,9 +1465,11 @@ async function resolveAskArms(req, onAsk, signal, onLateSettlement, takesWords =
1452
1465
  action: "deny",
1453
1466
  message: reading.word === "timeout"
1454
1467
  ? `approval for "${req.toolName}" was not answered before the approver's own window elapsed: ${req.message}${reading.note !== undefined ? `\nReviewer note:\n${delimitUntrusted("reviewer note", reading.note, REVIEWER_NOTE_MAX_BODY)}` : ""}`
1455
- : reading.word === "policy"
1456
- ? policyRefusalMessage(req.toolName, req.message, reading.note, reading.via)
1457
- : humanRefusalMessage(req, reading.note),
1468
+ : reading.word === "withdrawn"
1469
+ ? withdrawnAskMessage(req.toolName, req.message, reading.note)
1470
+ : reading.word === "policy"
1471
+ ? policyRefusalMessage(req.toolName, req.message, reading.note, reading.via)
1472
+ : humanRefusalMessage(req, reading.note),
1458
1473
  decisionReason: "mode",
1459
1474
  settlement: reading.settlement,
1460
1475
  ...quotingQuestion,
@@ -1472,13 +1487,10 @@ async function resolveAskArms(req, onAsk, signal, onLateSettlement, takesWords =
1472
1487
  return { ...unjudgedAllowRefused(req, "policy"), ...quotingQuestion };
1473
1488
  return { action: "allow", decisionReason: "mode", presentedInput: presented.value, settlement: settledByDecider("person", "allowed", undefined) };
1474
1489
  }
1475
- if (okRaw !== false) {
1476
- return {
1477
- action: "deny",
1478
- message: `the approver for "${req.toolName}" returned an out-of-contract value (${typeof ok}) — denied fail-closed (return true, false, "unavailable", or the {allow} object)`,
1479
- decisionReason: "mode",
1480
- settlement: settledByNobody("approver_contract"),
1481
- };
1482
- }
1483
- return { action: "deny", message: humanRefusalMessage(req), decisionReason: "mode", settlement: settledByDecider("person", "refused", undefined), ...quotingQuestion };
1490
+ return {
1491
+ action: "deny",
1492
+ message: `the approver for "${req.toolName}" returned an out-of-contract value (${typeof ok}) — denied fail-closed (return true, false, "unavailable", or the {allow} object)`,
1493
+ decisionReason: "mode",
1494
+ settlement: settledByNobody("approver_contract"),
1495
+ };
1484
1496
  }
@@ -110,7 +110,8 @@ export declare const ToolRoster: Type.TObject<{
110
110
  schemaVersion: Type.TLiteral<1>;
111
111
  /** Run-time asserted equal to `entries.length`. */
112
112
  count: Type.TInteger;
113
- /** Declaration order = the model's `tools[]` order; names unique (run-time asserted); at most
113
+ /** The model's `tools[]` order: the order the leg mounted its tools in, except that every caller tool declaring
114
+ * `ToolSpec.perTurn` comes after all the others, by name; names unique (run-time asserted); at most
114
115
  * {@link TOOL_ROSTER_MAX_ENTRIES} rows (run-time asserted where the roster forms). */
115
116
  entries: Type.TArray<Type.TObject<{
116
117
  name: Type.TString;
@@ -210,7 +211,8 @@ export declare const ToolRosterDelta: Type.TObject<{
210
211
  schemaVersion: Type.TLiteral<1>;
211
212
  /** Run-time asserted equal to `entries.length`. */
212
213
  count: Type.TInteger;
213
- /** Declaration order = the model's `tools[]` order; names unique (run-time asserted); at most
214
+ /** The model's `tools[]` order: the order the leg mounted its tools in, except that every caller tool declaring
215
+ * `ToolSpec.perTurn` comes after all the others, by name; names unique (run-time asserted); at most
214
216
  * {@link TOOL_ROSTER_MAX_ENTRIES} rows (run-time asserted where the roster forms). */
215
217
  entries: Type.TArray<Type.TObject<{
216
218
  name: Type.TString;
@@ -604,6 +606,8 @@ export interface RosterMountMeta {
604
606
  peer: string;
605
607
  declaredBy?: "center" | "file" | "request";
606
608
  };
609
+ /** The caller's tool declares `ToolSpec.perTurn`: the mount takes the per-turn segment ({@link RosterBuilder.perTurnStart}). */
610
+ perTurn?: true;
607
611
  }
608
612
  /** The face a mounted instance carries (forwarded by `defineTool`; read here by the same untyped-carry convention
609
613
  * every other axis reader in the runner uses). */
@@ -660,19 +664,28 @@ export declare class RosterBuilder {
660
664
  * carrying the leg's reading of whether it needs an execution environment as it was made before the environment started.
661
665
  * Runs once, after the last mount and before the snapshot. */
662
666
  settleMountPlan(executionEnv: ToolMountPlanExecutionEnv): ToolMountPlan;
663
- /** The mount array as a READ face. The order is the wire order. */
667
+ /** The mount array as a READ face. The order is the wire order; the engine lane enters it at {@link perTurnStart}. */
664
668
  get tools(): readonly AgentTool[];
669
+ /**
670
+ * Where the per-turn segment of the mount array starts — its length when it has none. The segment is every instance mounted
671
+ * with {@link RosterMountMeta.perTurn}; the builder keeps it after every other instance, by name, so it is a suffix. The one
672
+ * reading of the boundary: the builder's own placement, the snapshot, and the wire list and prompt manifest (which put the
673
+ * engine lane — ToolSearch — here) all ask it.
674
+ */
675
+ get perTurnStart(): number;
665
676
  get length(): number;
666
677
  metaOf(tool: AgentTool): RosterMountMeta | undefined;
667
678
  /** The catalog row a tool on this roster is, when one of the engine's own mount sites mounted it ({@link engineMountedRow}) — the
668
679
  * identity a caller's product cannot take, whatever name, schema or contract descriptor it carries; `undefined` for any other tool. */
669
680
  engineDefinitionOf(tool: object): ToolCatalogEntry | undefined;
670
- /** Mount one instance at the tail; the leg's effect map then follows the mounted set (`#settleEffects`). The later mount under
671
- * a name is the one the harness dispatches to (`snapshot`'s yield rule). */
681
+ /** Mount one instance at the end of its segment — the per-turn segment for a per-turn mount, the place just before it for any
682
+ * other; the leg's effect map then follows the mounted set (`#settleEffects`). The later mount under a name is the one the
683
+ * harness dispatches to (`snapshot`'s yield rule). */
672
684
  mount(tool: AgentTool, meta: RosterMountMeta): void;
673
685
  /** An ENGINE-INJECTED instance the harness list carries outside the mount array (the ToolSearch lane): a roster
674
686
  * row — the model can call it — never a mount-array element (the disclosure lane owns that list and appends the
675
- * instance itself). Its row follows the mount array's rows in the snapshot; the same admission rules apply. */
687
+ * instance itself). Its row follows the mount array's rows in the snapshot, ahead of the per-turn segment's
688
+ * ({@link perTurnStart}); the same admission rules apply. */
676
689
  mountEngineLane(tool: AgentTool, meta: RosterMountMeta): void;
677
690
  mountAll(tools: readonly AgentTool[], meta: RosterMountMeta): void;
678
691
  /** Remove every instance the predicate selects; returns them in mount order. */
@@ -683,7 +696,8 @@ export declare class RosterBuilder {
683
696
  /**
684
697
  * Re-insert a NAME-PREFIX domain in place (the RefreshMcpTools seam): every instance whose name starts with
685
698
  * `prefix` is removed and `fresh` is spliced in at the domain's lowest former index (the wire prefix a
686
- * provider cache reads stays put); a domain that was not mounted appends at the tail.
699
+ * provider cache reads stays put); a domain that was not mounted enters where any other mount does — just before the per-turn
700
+ * segment.
687
701
  *
688
702
  * The swap is judged before it touches anything: a domain whose fresh tools would put the roster over
689
703
  * {@link TOOL_ROSTER_MAX_ENTRIES} rows throws `config.tool_roster_bound` and leaves the builder as it was (the