@sema-agent/core 7.62.0 → 7.64.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 (320) hide show
  1. package/CHANGELOG.md +936 -0
  2. package/dist/agents/cc-peer-directory.js +1 -0
  3. package/dist/agents/cc-peer-wire.d.ts +4 -0
  4. package/dist/agents/cc-peer-wire.js +1 -0
  5. package/dist/agents/cc-uds-peer-channel.js +5 -0
  6. package/dist/agents/cross-session-judge.d.ts +3 -1
  7. package/dist/agents/cross-session-judge.js +4 -1
  8. package/dist/agents/peer-directory.d.ts +8 -0
  9. package/dist/agents/peer-directory.js +4 -0
  10. package/dist/agents/peer-held-queue.d.ts +9 -3
  11. package/dist/agents/peer-held-queue.js +12 -9
  12. package/dist/agents/peer-idle.d.ts +20 -1
  13. package/dist/agents/peer-idle.js +23 -12
  14. package/dist/agents/peer-notice-route.d.ts +16 -5
  15. package/dist/agents/peer-notice-route.js +11 -9
  16. package/dist/agents/peer-notices.d.ts +25 -8
  17. package/dist/agents/peer-notices.js +6 -1
  18. package/dist/agents/peer-session-drain.d.ts +32 -6
  19. package/dist/agents/peer-session-drain.js +100 -26
  20. package/dist/agents/send-message-tool.d.ts +7 -0
  21. package/dist/agents/send-message-tool.js +18 -6
  22. package/dist/agents/subagent-transcript-placement.d.ts +23 -0
  23. package/dist/agents/subagent-transcript-placement.js +14 -0
  24. package/dist/agents/subagent.js +102 -54
  25. package/dist/brain/route-adjudicator.js +9 -4
  26. package/dist/core/allow-entry.d.ts +4 -0
  27. package/dist/core/approval-object.js +1 -1
  28. package/dist/core/arg-summary.js +1 -1
  29. package/dist/core/ask-origin.d.ts +1 -1
  30. package/dist/core/ask-origin.js +2 -2
  31. package/dist/core/ask-question.d.ts +2 -2
  32. package/dist/core/ask-unresolvable-notice.d.ts +13 -4
  33. package/dist/core/ask-unresolvable-notice.js +10 -3
  34. package/dist/core/auto-compaction.d.ts +7 -5
  35. package/dist/core/background-agent-store.d.ts +7 -0
  36. package/dist/core/background-agent-store.js +3 -0
  37. package/dist/core/canonical-json.d.ts +23 -13
  38. package/dist/core/canonical-json.js +4 -4
  39. package/dist/core/checkpoint-queries.d.ts +50 -4
  40. package/dist/core/checkpoint-queries.js +42 -17
  41. package/dist/core/checkpoint-requirements.d.ts +3 -3
  42. package/dist/core/checkpoint-requirements.js +2 -1
  43. package/dist/core/checkpoint-row-verdict.d.ts +15 -4
  44. package/dist/core/checkpoint-row-verdict.js +22 -2
  45. package/dist/core/checkpoint-store.d.ts +28 -11
  46. package/dist/core/checkpoint-store.js +45 -4
  47. package/dist/core/compliance.d.ts +6 -2
  48. package/dist/core/compliance.js +3 -3
  49. package/dist/core/context-settings.d.ts +40 -9
  50. package/dist/core/context-settings.js +32 -10
  51. package/dist/core/engine-attestation.d.ts +27 -7
  52. package/dist/core/engine-attestation.js +5 -1
  53. package/dist/core/engine-notice.d.ts +43 -5
  54. package/dist/core/extension-requester.d.ts +9 -0
  55. package/dist/core/extension-requester.js +7 -0
  56. package/dist/core/file-history-store.d.ts +28 -0
  57. package/dist/core/file-history-store.js +48 -5
  58. package/dist/core/fs-write-gate-policy.js +1 -1
  59. package/dist/core/gate-fold.js +2 -0
  60. package/dist/core/gate-lanes.js +2 -0
  61. package/dist/core/gate-outcome.d.ts +39 -2
  62. package/dist/core/gate-outcome.js +20 -1
  63. package/dist/core/git-worktree-env.d.ts +62 -3
  64. package/dist/core/git-worktree-env.js +91 -30
  65. package/dist/core/governance-codes.d.ts +9 -3
  66. package/dist/core/governance-codes.js +17 -3
  67. package/dist/core/leg-identity.d.ts +19 -1
  68. package/dist/core/leg-identity.js +12 -0
  69. package/dist/core/mailbox-store.d.ts +39 -4
  70. package/dist/core/mailbox-store.js +14 -2
  71. package/dist/core/memory-engine/consolidation-driver.d.ts +32 -17
  72. package/dist/core/memory-engine/consolidation-driver.js +99 -98
  73. package/dist/core/memory-engine/consolidation.d.ts +74 -10
  74. package/dist/core/memory-engine/consolidation.js +183 -11
  75. package/dist/core/memory-engine/control-objects.d.ts +25 -0
  76. package/dist/core/memory-engine/control-objects.js +151 -0
  77. package/dist/core/memory-engine/control-plane-adoption.d.ts +48 -0
  78. package/dist/core/memory-engine/control-plane-adoption.js +159 -0
  79. package/dist/core/memory-engine/data-plane.d.ts +8 -4
  80. package/dist/core/memory-engine/data-plane.js +11 -6
  81. package/dist/core/memory-engine/delegation-settlement.d.ts +58 -40
  82. package/dist/core/memory-engine/delegation-settlement.js +270 -85
  83. package/dist/core/memory-engine/dual-root.d.ts +12 -6
  84. package/dist/core/memory-engine/dual-root.js +11 -7
  85. package/dist/core/memory-engine/engine.d.ts +136 -58
  86. package/dist/core/memory-engine/engine.js +491 -394
  87. package/dist/core/memory-engine/entry-scan.d.ts +8 -0
  88. package/dist/core/memory-engine/entry-scan.js +3 -0
  89. package/dist/core/memory-engine/file-backend.d.ts +62 -60
  90. package/dist/core/memory-engine/file-backend.js +122 -198
  91. package/dist/core/memory-engine/index.d.ts +8 -7
  92. package/dist/core/memory-engine/index.js +7 -6
  93. package/dist/core/memory-engine/landing-admission.d.ts +5 -3
  94. package/dist/core/memory-engine/landing-admission.js +3 -3
  95. package/dist/core/memory-engine/layout.d.ts +127 -46
  96. package/dist/core/memory-engine/layout.js +264 -109
  97. package/dist/core/memory-engine/memory-backend-contract.d.ts +26 -1
  98. package/dist/core/memory-engine/memory-backend-contract.js +476 -0
  99. package/dist/core/memory-engine/memory-deployment.d.ts +42 -11
  100. package/dist/core/memory-engine/memory-deployment.js +54 -15
  101. package/dist/core/memory-engine/origin-clearance.d.ts +12 -3
  102. package/dist/core/memory-engine/origin-clearance.js +68 -9
  103. package/dist/core/memory-engine/scope-contract.d.ts +52 -11
  104. package/dist/core/memory-engine/scope-contract.js +68 -19
  105. package/dist/core/memory-engine/session-write-home.d.ts +37 -2
  106. package/dist/core/memory-engine/session-write-home.js +38 -11
  107. package/dist/core/memory-engine/sync-client.d.ts +3 -1
  108. package/dist/core/memory-engine/sync-client.js +7 -0
  109. package/dist/core/memory-engine/sync-report.d.ts +3 -2
  110. package/dist/core/memory-engine/sync-report.js +6 -2
  111. package/dist/core/memory-engine/tools.d.ts +2 -2
  112. package/dist/core/memory-engine/tools.js +10 -10
  113. package/dist/core/memory-engine/types.d.ts +155 -19
  114. package/dist/core/memory-engine/types.js +2 -0
  115. package/dist/core/memory.js +15 -6
  116. package/dist/core/mode-policy.js +3 -3
  117. package/dist/core/mods/agent-stations.d.ts +18 -0
  118. package/dist/core/mods/agent-stations.js +8 -6
  119. package/dist/core/mods/extension-call.d.ts +4 -0
  120. package/dist/core/mods/extension-call.js +8 -0
  121. package/dist/core/mods/stations.d.ts +20 -1
  122. package/dist/core/mods/stations.js +21 -2
  123. package/dist/core/mods/tool-call.js +3 -4
  124. package/dist/core/parent-spec-seat.d.ts +2 -2
  125. package/dist/core/park-selfcheck.js +2 -2
  126. package/dist/core/pause-registry.d.ts +2 -0
  127. package/dist/core/pause-registry.js +3 -0
  128. package/dist/core/peer-channel.d.ts +5 -0
  129. package/dist/core/permission-rule-consent.d.ts +26 -8
  130. package/dist/core/permission-rule-consent.js +76 -36
  131. package/dist/core/permission-rule-store.d.ts +72 -13
  132. package/dist/core/permission-rule-store.js +29 -8
  133. package/dist/core/read-only-shell.js +3 -2
  134. package/dist/core/redaction-marks.d.ts +8 -0
  135. package/dist/core/redaction-marks.js +6 -0
  136. package/dist/core/refusal-echo.d.ts +20 -0
  137. package/dist/core/refusal-echo.js +33 -0
  138. package/dist/core/remote-env.d.ts +12 -1
  139. package/dist/core/remote-env.js +3 -0
  140. package/dist/core/retention.d.ts +180 -10
  141. package/dist/core/retention.js +45 -0
  142. package/dist/core/retired-keys.d.ts +5 -0
  143. package/dist/core/retired-keys.js +3 -0
  144. package/dist/core/rule-offer-read.d.ts +0 -4
  145. package/dist/core/rule-offer-read.js +2 -18
  146. package/dist/core/runner/child-tree.d.ts +29 -3
  147. package/dist/core/runner/child-tree.js +39 -16
  148. package/dist/core/runner/classifier-ladder.d.ts +7 -1
  149. package/dist/core/runner/classifier-ladder.js +4 -2
  150. package/dist/core/runner/compact-session.js +10 -7
  151. package/dist/core/runner/compaction-call-options.d.ts +7 -7
  152. package/dist/core/runner/compaction-call-options.js +3 -2
  153. package/dist/core/runner/contracts.d.ts +39 -11
  154. package/dist/core/runner/delegation-owner.d.ts +10 -3
  155. package/dist/core/runner/delegation-owner.js +4 -1
  156. package/dist/core/runner/gate-exit.d.ts +6 -0
  157. package/dist/core/runner/gate-exit.js +13 -4
  158. package/dist/core/runner/inherited-ask-grants.js +1 -1
  159. package/dist/core/runner/memory-consolidation-driver.d.ts +10 -5
  160. package/dist/core/runner/memory-consolidation-driver.js +12 -9
  161. package/dist/core/runner/memory-consolidation-write-judge.d.ts +2 -1
  162. package/dist/core/runner/memory-consolidation-write-judge.js +3 -2
  163. package/dist/core/runner/person-path-rows.d.ts +8 -3
  164. package/dist/core/runner/person-path-rows.js +5 -1
  165. package/dist/core/runner/placement-fence.d.ts +12 -0
  166. package/dist/core/runner/placement-fence.js +20 -6
  167. package/dist/core/runner/prepare-ask-lane.js +5 -5
  168. package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -2
  169. package/dist/core/runner/prepare-caps-and-workflow.js +7 -4
  170. package/dist/core/runner/prepare-config-doors.js +4 -0
  171. package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
  172. package/dist/core/runner/prepare-delegation-surface.js +2 -2
  173. package/dist/core/runner/prepare-execution-env.js +17 -6
  174. package/dist/core/runner/prepare-gate-stations.d.ts +5 -0
  175. package/dist/core/runner/prepare-gate-stations.js +5 -5
  176. package/dist/core/runner/prepare-hands-readface.d.ts +2 -1
  177. package/dist/core/runner/prepare-hands-readface.js +5 -4
  178. package/dist/core/runner/prepare-inherited-gate.d.ts +13 -9
  179. package/dist/core/runner/prepare-inherited-gate.js +12 -6
  180. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -4
  181. package/dist/core/runner/prepare-memory-engine-session.js +4 -4
  182. package/dist/core/runner/prepare-memory.d.ts +7 -2
  183. package/dist/core/runner/prepare-memory.js +41 -39
  184. package/dist/core/runner/prepare-park-ask.js +4 -3
  185. package/dist/core/runner/prepare-policy-chain.js +7 -7
  186. package/dist/core/runner/prepare-prompt-inputs.js +1 -1
  187. package/dist/core/runner/prepare-task.js +26 -18
  188. package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
  189. package/dist/core/runner/prepare-wiring-manifest.js +3 -2
  190. package/dist/core/runner/prepare-workspace-restore.js +3 -6
  191. package/dist/core/runner/resume-admission.d.ts +2 -2
  192. package/dist/core/runner/resume-admission.js +2 -23
  193. package/dist/core/runner/role-resolution-table.d.ts +98 -0
  194. package/dist/core/runner/role-resolution-table.js +62 -0
  195. package/dist/core/runner/run-compaction-machinery.js +2 -2
  196. package/dist/core/runner/run-identity-wiring.js +12 -9
  197. package/dist/core/runner/run-leg.js +9 -5
  198. package/dist/core/runner/run-notification-lane.js +22 -22
  199. package/dist/core/runner/run-recovery-lanes.js +3 -3
  200. package/dist/core/runner/run-settle-and-teardown.js +3 -2
  201. package/dist/core/runner/run-terminal-adoption.js +1 -1
  202. package/dist/core/runner/run-turn-boundary.js +14 -15
  203. package/dist/core/runner/runtask.js +1 -1
  204. package/dist/core/runner/terminal-account.js +1 -1
  205. package/dist/core/runner/tool-occurrence.d.ts +4 -2
  206. package/dist/core/runner/tool-occurrence.js +2 -2
  207. package/dist/core/runner-deps.d.ts +7 -3
  208. package/dist/core/secret-env.d.ts +1 -1
  209. package/dist/core/secret-env.js +4 -4
  210. package/dist/core/session-checkout.d.ts +168 -0
  211. package/dist/core/session-checkout.js +579 -0
  212. package/dist/core/session-store.d.ts +12 -4
  213. package/dist/core/session-store.js +23 -3
  214. package/dist/core/session.d.ts +16 -2
  215. package/dist/core/session.js +3 -0
  216. package/dist/core/shell-read-silence.js +8 -0
  217. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +0 -12
  218. package/dist/core/store-contracts/checkpoint-store-contract.js +6 -7
  219. package/dist/core/store-contracts/peer-directory-contract.js +8 -1
  220. package/dist/core/store-contracts/session-store-contract.js +39 -0
  221. package/dist/core/task-event.d.ts +30 -5
  222. package/dist/core/task-notification.d.ts +119 -32
  223. package/dist/core/task-notification.js +186 -100
  224. package/dist/core/task-registry-agent.d.ts +25 -2
  225. package/dist/core/task-registry-agent.js +56 -22
  226. package/dist/core/task-registry-shared.d.ts +33 -11
  227. package/dist/core/task-registry.d.ts +33 -9
  228. package/dist/core/task-registry.js +36 -18
  229. package/dist/core/task-spec-members.js +1 -1
  230. package/dist/core/task-spec.d.ts +27 -2
  231. package/dist/core/tool-errors.d.ts +14 -6
  232. package/dist/core/tool-errors.js +1 -1
  233. package/dist/core/tool-policy.d.ts +32 -13
  234. package/dist/core/tool-policy.js +27 -17
  235. package/dist/core/tool-result-store.d.ts +20 -0
  236. package/dist/core/tool-spec.d.ts +42 -19
  237. package/dist/core/trace.d.ts +3 -2
  238. package/dist/core/types.d.ts +1 -1
  239. package/dist/core/untrusted-egress.d.ts +15 -4
  240. package/dist/core/untrusted-egress.js +23 -22
  241. package/dist/core/workflow-journal-store.d.ts +11 -0
  242. package/dist/core/workflow-journal-store.js +7 -0
  243. package/dist/core/workflow-run-store.d.ts +9 -0
  244. package/dist/core/workflow-run-store.js +6 -0
  245. package/dist/core/workspace-snapshot.d.ts +3 -1
  246. package/dist/core/workspace-snapshot.js +1 -0
  247. package/dist/engine/compaction/compaction.d.ts +2 -1
  248. package/dist/engine/harness/types.d.ts +67 -1
  249. package/dist/engine/harness/types.js +108 -0
  250. package/dist/engine/session/import-validate.js +6 -1
  251. package/dist/engine/session/session.d.ts +30 -1
  252. package/dist/engine/session/session.js +48 -1
  253. package/dist/index.d.ts +12 -7
  254. package/dist/index.js +12 -7
  255. package/dist/internal/harness-types.d.ts +1 -1
  256. package/dist/orchestration/run-workflow-tool.d.ts +8 -1
  257. package/dist/orchestration/run-workflow-tool.js +8 -0
  258. package/dist/orchestration/workflow-types.d.ts +2 -1
  259. package/dist/orchestration/workflow.d.ts +6 -0
  260. package/dist/orchestration/workflow.js +5 -2
  261. package/dist/stores/file/checkpoint-store.d.ts +6 -0
  262. package/dist/stores/file/checkpoint-store.js +4 -1
  263. package/dist/stores/file/file-history-store.d.ts +13 -0
  264. package/dist/stores/file/file-history-store.js +75 -13
  265. package/dist/stores/file/index.d.ts +11 -1
  266. package/dist/stores/file/index.js +7 -11
  267. package/dist/stores/file/permission-rule-store.d.ts +23 -0
  268. package/dist/stores/file/permission-rule-store.js +75 -7
  269. package/dist/stores/file/session-store.js +2 -1
  270. package/dist/stores/file/tool-result-store.d.ts +14 -0
  271. package/dist/stores/file/tool-result-store.js +39 -2
  272. package/dist/stores/file/workflow-journal-store.d.ts +4 -0
  273. package/dist/stores/file/workflow-journal-store.js +17 -0
  274. package/dist/stores/file/workflow-run-store.d.ts +3 -0
  275. package/dist/stores/file/workflow-run-store.js +15 -0
  276. package/dist/tools/fs/bash-program-position.js +3 -3
  277. package/dist/tools/fs/program-read-model.d.ts +34 -10
  278. package/dist/tools/fs/program-read-model.js +37 -7
  279. package/dist/tools/fs/program-read-model.rows.js +13 -2
  280. package/dist/tools/fs/read-deny.d.ts +28 -3
  281. package/dist/tools/fs/read-deny.js +18 -2
  282. package/dist/tools/fs/removal-targets.js +3 -3
  283. package/dist/tools/fs/safety.d.ts +2 -0
  284. package/dist/tools/fs/safety.js +1 -1
  285. package/dist/tools/fs/shell-read-argv.d.ts +8 -1
  286. package/dist/tools/fs/shell-read-argv.js +34 -29
  287. package/dist/tools/fs/shell-read-bindings.d.ts +2 -0
  288. package/dist/tools/fs/shell-read-bindings.js +5 -1
  289. package/dist/tools/fs/shell-read-brace.d.ts +18 -0
  290. package/dist/tools/fs/shell-read-brace.js +79 -0
  291. package/dist/tools/fs/shell-read-check.d.ts +8 -2
  292. package/dist/tools/fs/shell-read-check.js +16 -14
  293. package/dist/tools/fs/shell-read-establish.js +23 -16
  294. package/dist/tools/fs/shell-read-judge.d.ts +11 -0
  295. package/dist/tools/fs/shell-read-judge.js +3 -3
  296. package/dist/tools/fs/shell-read-plan.d.ts +10 -0
  297. package/dist/tools/fs/shell-read-plan.js +189 -93
  298. package/dist/tools/fs/shell-read-start.d.ts +19 -9
  299. package/dist/tools/fs/shell-read-start.js +20 -12
  300. package/dist/tools/fs/shell-read-word.d.ts +10 -0
  301. package/dist/tools/fs/shell-read-word.js +9 -5
  302. package/dist/tools/fs/shell-read-workdir.d.ts +26 -7
  303. package/dist/tools/fs/shell-read-workdir.js +73 -12
  304. package/dist/tools/fs/shell-read-write-targets.js +13 -8
  305. package/dist/tools/worktree.d.ts +3 -2
  306. package/dist/tools/worktree.js +7 -35
  307. package/package.json +3 -2
  308. package/test/export-surface.snapshot.json +135 -11
  309. package/wire-changes/core-stores-sql@7.63.0.json +30 -0
  310. package/wire-changes/core-stores-sql@7.64.0.json +30 -0
  311. package/wire-changes/core@7.63.0.json +3523 -0
  312. package/wire-changes/core@7.64.0.json +2653 -0
  313. package/wire-changes/mods-kernel@7.63.0.json +30 -0
  314. package/wire-changes/mods-kernel@7.64.0.json +30 -0
  315. package/wire-changes/primitives@7.63.0.json +445 -0
  316. package/wire-changes/primitives@7.64.0.json +30 -0
  317. package/dist/core/credential-vocabulary.d.ts +0 -176
  318. package/dist/core/credential-vocabulary.js +0 -190
  319. package/dist/core/redaction-passes.d.ts +0 -82
  320. package/dist/core/redaction-passes.js +0 -377
@@ -1,8 +1,9 @@
1
- import { screenGateOutcome, SETTLEMENT_IS_REFUSAL } from "../gate-outcome.js";
1
+ import { DENIED_BY_MAY_ECHO, screenGateOutcome, SETTLEMENT_IS_REFUSAL } from "../gate-outcome.js";
2
2
  import { askFaceOf, classifyAsk, headlessApprovalRemedy } from "../ask-origin.js";
3
3
  import { wireOf } from "../tool-name-readings.js";
4
4
  import { isProtectedWrite } from "../tool-registry.js";
5
5
  import { attestationOf, decisionText, foldHookAsk, licenseCovers } from "../tool-policy.js";
6
+ import { engineSentenceOf } from "../engine-attestation.js";
6
7
  import { pathDenialCardOf } from "../../tools/fs/safety.js";
7
8
  import { argsAsTheToolReads } from "../effective-path-target.js";
8
9
  import { rewriteRecordOf } from "../rewrite-rejudge.js";
@@ -24,6 +25,7 @@ export function mintGateOutcome(facts) {
24
25
  deniedBy: facts.deniedBy,
25
26
  ...(facts.cause !== undefined ? { cause: facts.cause } : {}),
26
27
  ...(extension !== undefined ? { extension } : {}),
28
+ ...(facts.echoed !== undefined ? { echoed: Object.freeze(facts.echoed.map((e) => Object.freeze({ ...e }))) } : {}),
27
29
  ...(attribution !== undefined ? { classifier: attribution } : {}),
28
30
  ...(facts.modeRefusal !== undefined ? { mode: facts.modeRefusal.mode, askClass: facts.modeRefusal.askClass, classes: Object.freeze([...facts.modeRefusal.classes]) } : {}),
29
31
  }
@@ -93,7 +95,7 @@ export function createSettlementLedger(call) {
93
95
  `(\`attestation\`), never a resolver's member; denied fail-closed rather than recording a settlement nobody can attribute`, contractRefusal(origin));
94
96
  }
95
97
  const edited = resolved.action === "allow" && resolved.updatedInput !== undefined;
96
- const licensed = () => edited ? licenseCovers(record.inputDigest, resolved.updatedInput) : licenseCovers(record.inputDigest, req.args) && (resolved.presentedInput === undefined || licenseCovers(record.inputDigest, resolved.presentedInput));
98
+ const licensed = () => edited ? licenseCovers(record.inputDigest, call.toolName, resolved.updatedInput) : licenseCovers(record.inputDigest, call.toolName, req.args) && (resolved.presentedInput === undefined || licenseCovers(record.inputDigest, call.toolName, resolved.presentedInput));
97
99
  const bound = record?.settlement !== undefined && record.origin === origin && sameClasses(record.classes, asked.classes) ? record.settlement : undefined;
98
100
  const refusal = bound !== undefined && SETTLEMENT_IS_REFUSAL[bound.kind] ? bound : undefined;
99
101
  if (resolved.action === "allow") {
@@ -134,7 +136,7 @@ export function createSettlementLedger(call) {
134
136
  return { decision, deniedBy: refusal ? "ask_resolution" : "policy" };
135
137
  },
136
138
  keepForBytes(runs) {
137
- if (settled !== undefined && !licenseCovers(settled.licensed, runs))
139
+ if (settled !== undefined && !licenseCovers(settled.licensed, call.toolName, runs))
138
140
  settled = undefined;
139
141
  },
140
142
  causeOf(decision) {
@@ -277,6 +279,12 @@ function unresolvableCauseOfSettlement(gate) {
277
279
  return "no_approver_wired";
278
280
  return undefined;
279
281
  }
282
+ function refusalEchoOf(pass, call) {
283
+ const by = pass.deniedBy;
284
+ if (by === undefined || !DENIED_BY_MAY_ECHO[by])
285
+ return undefined;
286
+ return by === "read_boundary" ? pass.denyEchoed : by === "ask_resolution" ? engineSentenceOf(pass.decision, call)?.echoed : undefined;
287
+ }
280
288
  export async function exitGate(pass) {
281
289
  const { input, toolName, toolCallId, ledger, notifyPermissionDenied } = pass;
282
290
  if (pass.decision.action === "deny") {
@@ -291,7 +299,8 @@ export async function exitGate(pass) {
291
299
  pass.deniedBy = "mode";
292
300
  ledger.supersede();
293
301
  }
294
- const gate = mintGateOutcome({ deniedBy: pass.deniedBy, ...(pass.deniedBy === "hook" && pass.deniedExtension !== undefined ? { extension: pass.deniedExtension } : {}), ...(pass.denyCause !== undefined ? { cause: pass.denyCause } : {}), ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(modeRefusal !== undefined ? { modeRefusal: { mode: modeRefusal.mode, askClass: modeRefusal.askClass, classes: modeRefusal.classes } } : {}) });
302
+ const echoed = refusalEchoOf(pass, { toolCallId, toolName });
303
+ const gate = mintGateOutcome({ deniedBy: pass.deniedBy, ...(pass.deniedBy === "hook" && pass.deniedExtension !== undefined ? { extension: pass.deniedExtension } : {}), ...(echoed !== undefined ? { echoed } : {}), ...(pass.denyCause !== undefined ? { cause: pass.denyCause } : {}), ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(modeRefusal !== undefined ? { modeRefusal: { mode: modeRefusal.mode, askClass: modeRefusal.askClass, classes: modeRefusal.classes } } : {}) });
295
304
  const foldCause = attestationOf(pass.decision, { toolCallId, toolName })?.unresolvableCause;
296
305
  const unresolvable = foldCause ?? unresolvableCauseOfSettlement(gate);
297
306
  const tableSeat = unresolvable !== undefined ? askUnresolvableRemedySeat(unresolvable) : undefined;
@@ -34,5 +34,5 @@ export function consumeInheritedAskGrant(grants, onAsk, humanReviewRef, decision
34
34
  const settlement = attestationOf(grant.settled, req)?.settlement;
35
35
  if (settlement === undefined || decision.action !== "ask")
36
36
  return reused;
37
- return attest(reused, req, { settlement, ...(decision.origin !== undefined ? { origin: decision.origin } : {}), ...(decision.classes !== undefined ? { classes: decision.classes } : {}), inputDigest: exactBoundInputHashOf(grant.presented) });
37
+ return attest(reused, req, { settlement, ...(decision.origin !== undefined ? { origin: decision.origin } : {}), ...(decision.classes !== undefined ? { classes: decision.classes } : {}), inputDigest: exactBoundInputHashOf(req.toolName, grant.presented) });
38
38
  }
@@ -15,7 +15,7 @@
15
15
  import type { Model } from "../../internal/llm.js";
16
16
  import type { Brain, ModelRoles, ModelRef, TaskSpec } from "../types.js";
17
17
  import { type DistillerChatFn } from "../memory-engine/distiller.js";
18
- import { type RunMemoryConsolidationOptions, type ConsolidationDriverEngine, type ConsolidationWriteJudge } from "../memory-engine/consolidation-driver.js";
18
+ import { type RunMemoryConsolidationOptions, type ConsolidationCompliance, type ConsolidationDriverEngine, type ConsolidationWriteJudge } from "../memory-engine/consolidation-driver.js";
19
19
  import { type MemoryConsolidationOptions } from "../memory-engine/consolidation.js";
20
20
  import type { LlmDistillerContract } from "../memory-engine/distiller.js";
21
21
  import type { EngineNotice } from "../engine-notice.js";
@@ -40,6 +40,8 @@ export interface MemoryConsolidationDriverDeps {
40
40
  /** Optional per-model auth hook (the TaskSpec-shaped seat) for the role-resolved path. */
41
41
  getApiKeyAndHeaders?: TaskSpec["getApiKeyAndHeaders"];
42
42
  }
43
+ /** What the seat's reading takes of the deployment: the model catalog, tier bindings and role map — no brain. */
44
+ export type ConsolidationSeatDeps = Omit<MemoryConsolidationDriverDeps, "brain">;
43
45
  /**
44
46
  * Resolve a deployment's driver options: `{ chat, model }` from the explicit seat or the role
45
47
  * chain, plus the deployment knobs (contract / maxCycles / mintRepairBudget) and the protocol
@@ -56,7 +58,7 @@ export declare function resolveMemoryConsolidationDriver(deps: MemoryConsolidati
56
58
  * DIFFERENT bad value, caught loudly by the driver's own screen when it runs). False ⇔ the resolve
57
59
  * verb would throw its "no model seat" refusal. Pinned against that resolve for drift.
58
60
  */
59
- export declare function consolidationSeatResolvable(deps: MemoryConsolidationDriverDeps): boolean;
61
+ export declare function consolidationSeatResolvable(deps: ConsolidationSeatDeps): boolean;
60
62
  /**
61
63
  * The advisory-to-execution bridge: fire ONE host consolidation run for the
62
64
  * recommended `scope`, fire-and-forget. Called from the post-task settle tail (NOT the harvest tail)
@@ -65,7 +67,8 @@ export declare function consolidationSeatResolvable(deps: MemoryConsolidationDri
65
67
  * failure table settles the run (zero-write on mint failure, `_incomplete` on non-convergence), this
66
68
  * bridge only relays the run's advisory notices to `onNotice` and routes a seat/engine fault to
67
69
  * `onError(phase:"memory")`. Adds no failure semantics of its own — the trigger is the only new thing.
68
- * The write judge is the LEG's; its refusal is a person's standing rule at work, so it is a refusal NOTICE, never a fault.
70
+ * The write judge is the LEG's; its refusal is a person's standing rule at work, so it is a refusal NOTICE, never a fault —
71
+ * as is the compliance posture's denial; a posture seat that faulted reaches `onError`.
69
72
  */
70
73
  export declare function autoRunConsolidationFromRecommendation(args: {
71
74
  deps: MemoryConsolidationDriverDeps;
@@ -73,6 +76,8 @@ export declare function autoRunConsolidationFromRecommendation(args: {
73
76
  scope: string;
74
77
  sessionId: string;
75
78
  writeJudge: ConsolidationWriteJudge;
79
+ /** The run's compliance veto: the deployment's posture seat, the leg's scope contract and its own denies. */
80
+ compliance: ConsolidationCompliance;
76
81
  onNotice?: (notice: EngineNotice) => void;
77
82
  onError?: (err: unknown, ctx: {
78
83
  phase: "memory";
@@ -111,7 +116,7 @@ export declare function autoRunOnRecommendationEffective(deps: MemoryConsolidati
111
116
  * a scope forever: the edge sat disarmed, nothing advanced `lastRunAt`.) A gate the engine cannot read
112
117
  * answers `false` — the verbs would refuse loudly on it anyway.
113
118
  */
114
- export declare function scopeHasUnconsumedRecommendation(engine: Pick<ConsolidationDriverEngine, "readConsolidationGate">, scope: string): boolean;
119
+ export declare function scopeHasUnconsumedRecommendation(engine: Pick<ConsolidationDriverEngine, "readConsolidationGate">, scope: string): Promise<boolean>;
115
120
  /**
116
121
  * The auto-consolidation ARMING door (bad-value loudness, three states), called from
117
122
  * the prepare config doors at construction on every leg. A garbage value refuses; a CONTRADICTION
@@ -119,6 +124,6 @@ export declare function scopeHasUnconsumedRecommendation(engine: Pick<Consolidat
119
124
  * invisible-failure family) cannot ship: a deployment learns at boot, not one silently dropped
120
125
  * recommendation later. Lives beside {@link consolidationSeatResolvable}, the one question it asks.
121
126
  */
122
- export declare function assertAutoConsolidationWirable(deps: MemoryConsolidationDriverDeps & {
127
+ export declare function assertAutoConsolidationWirable(deps: ConsolidationSeatDeps & {
123
128
  autoRunOnRecommendation?: unknown;
124
129
  }): void;
@@ -5,6 +5,10 @@ import { runMemoryConsolidationDriver } from "../memory-engine/consolidation-dri
5
5
  import { recommendationUnconsumed } from "../memory-engine/consolidation.js";
6
6
  import { deliverWriteRefusal } from "./memory-consolidation-write-judge.js";
7
7
  import { asThrownError } from "../thrown-value.js";
8
+ const CONSOLIDATION_CHAIN = ["consolidate", "summarize"];
9
+ function consolidationRoleModel(models, roles) {
10
+ return roleModelIfSet(CONSOLIDATION_CHAIN[0], {}, { models, roles }) ?? roleModelIfSet(CONSOLIDATION_CHAIN[1], {}, { models, roles });
11
+ }
8
12
  function seatRefusal(message) {
9
13
  const e = new Error(message);
10
14
  e.code = "config.memory_consolidation_driver";
@@ -27,9 +31,9 @@ export function resolveMemoryConsolidationDriver(deps) {
27
31
  }
28
32
  else {
29
33
  const models = catalogOfDeps(deps);
30
- const resolved = roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles });
34
+ const resolved = consolidationRoleModel(models, deps.roles);
31
35
  if (resolved === undefined) {
32
- throw unheldChainRefusal(["consolidate", "summarize"], models, deps.roles) ?? seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
36
+ throw unheldChainRefusal(CONSOLIDATION_CHAIN, models, deps.roles) ?? seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
33
37
  }
34
38
  if (isAliasModelId(resolved.id)) {
35
39
  throw seatRefusal(`the resolved consolidation model id ${JSON.stringify(resolved.id)} is an alias spelling — an alias can be re-pointed upstream and would move the run with no trace in the archive; bind an explicit id.`);
@@ -65,14 +69,13 @@ export function resolveMemoryConsolidationDriver(deps) {
65
69
  export function consolidationSeatResolvable(deps) {
66
70
  if (deps.memoryConsolidationDriver?.chat !== undefined)
67
71
  return true;
68
- const models = catalogOfDeps(deps);
69
- return (roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles })) !== undefined;
72
+ return consolidationRoleModel(catalogOfDeps(deps), deps.roles) !== undefined;
70
73
  }
71
74
  export function autoRunConsolidationFromRecommendation(args) {
72
- const { deps, engine, scope, sessionId, writeJudge, onNotice, onError } = args;
75
+ const { deps, engine, scope, sessionId, writeJudge, compliance, onNotice, onError } = args;
73
76
  return (async () => {
74
77
  try {
75
- await runMemoryConsolidationDriver(engine, scope, { ...resolveMemoryConsolidationDriver(deps), writeJudge, onNotice });
78
+ await runMemoryConsolidationDriver(engine, scope, { ...resolveMemoryConsolidationDriver(deps), writeJudge, compliance, onNotice });
76
79
  }
77
80
  catch (err) {
78
81
  if (deliverWriteRefusal(err, scope, onNotice))
@@ -94,8 +97,8 @@ export function autoRunOnRecommendationEffective(deps) {
94
97
  return false;
95
98
  return AUTO_RUN_ON_RECOMMENDATION_DEFAULT && deps.memoryConsolidation !== undefined && consolidationSeatResolvable(deps);
96
99
  }
97
- export function scopeHasUnconsumedRecommendation(engine, scope) {
98
- const row = engine.readConsolidationGate(scope);
100
+ export async function scopeHasUnconsumedRecommendation(engine, scope) {
101
+ const row = await engine.readConsolidationGate(scope);
99
102
  return row !== undefined && recommendationUnconsumed(row);
100
103
  }
101
104
  function autoRunRefusal(message) {
@@ -116,6 +119,6 @@ export function assertAutoConsolidationWirable(deps) {
116
119
  throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but RunnerDeps.memoryConsolidation is absent — the recommendation that would trigger a run is never minted (consolidation is OFF) and the engine's verbs refuse coded, so the trigger can never fire. An armed-but-unrunnable trigger is refused, never folded to off: wire memoryConsolidation, or leave autoRunOnRecommendation unset.");
117
120
  }
118
121
  if (!consolidationSeatResolvable(deps)) {
119
- throw unheldChainRefusal(["consolidate", "summarize"], catalogOfDeps(deps), deps.roles) ?? autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
122
+ throw unheldChainRefusal(CONSOLIDATION_CHAIN, catalogOfDeps(deps), deps.roles) ?? autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
120
123
  }
121
124
  }
@@ -57,5 +57,6 @@ export interface ConsolidationWriteJudgeLeg {
57
57
  * engine's leg passes the same `input` and its `leg`, so the same rows give the same answer on both.
58
58
  */
59
59
  export declare function createConsolidationWriteJudge(input: ConsolidationWriteJudgeInput, leg?: ConsolidationWriteJudgeLeg): ConsolidationWriteJudge;
60
- /** Deliver a write-judge refusal as the verb's refusal notice; false (nothing delivered) for any other error. */
60
+ /** Deliver a standing judgment's refusal of a consolidation run — the write judge's or the compliance posture's — as the
61
+ * verb's refusal notice; false (nothing delivered) for any other error. */
61
62
  export declare function deliverWriteRefusal(err: unknown, scope: string, onNotice: ((notice: EngineNotice) => void) | undefined): boolean;
@@ -44,9 +44,10 @@ function hostLeg(input, owner) {
44
44
  facts: () => ({ face: engineWriteFace(), ...(root !== undefined ? { root, cwd: root } : {}) }),
45
45
  };
46
46
  }
47
+ const STANDING_REFUSAL_CODES = [CONSOLIDATION_WRITE_REFUSED_CODE, "config.compliance_denied"];
47
48
  export function deliverWriteRefusal(err, scope, onNotice) {
48
- if (!(err instanceof ConsolidationRefusedError) || err.code !== CONSOLIDATION_WRITE_REFUSED_CODE)
49
+ if (!(err instanceof ConsolidationRefusedError) || !STANDING_REFUSAL_CODES.includes(err.code))
49
50
  return false;
50
- deliverEngineNotice(onNotice, memoryConsolidationRefusedNotice({ code: CONSOLIDATION_WRITE_REFUSED_CODE, scope, reason: err.message, occurrenceId: err.occurrenceId }));
51
+ deliverEngineNotice(onNotice, memoryConsolidationRefusedNotice({ code: err.code, scope, reason: err.message, occurrenceId: err.occurrenceId }));
51
52
  return true;
52
53
  }
@@ -199,11 +199,15 @@ export declare function readRootsOver(seats: {
199
199
  readonly store: () => string | undefined;
200
200
  readonly onHeld: (dir: string, store: string) => void;
201
201
  }): ReadRootsSeat;
202
+ /** The deny seats a shell read boundary carries for one compiled table pair, through the ONE adapter every face mounting a
203
+ * deny table uses (`readDenySeat`: zero entries is no judge), resolved once per table. */
204
+ type WriteDenySeat = {
205
+ readonly writeDenyMatch?: (p: string) => string | null;
206
+ readonly writeDenyGuardsReads?: (pattern: string) => boolean;
207
+ };
202
208
  export declare function denySeatsOf(t: PathTables): {
203
209
  readonly read: ReadDenySeat;
204
- readonly write: {
205
- readonly writeDenyMatch?: (p: string) => string | null;
206
- };
210
+ readonly write: WriteDenySeat;
207
211
  };
208
212
  /**
209
213
  * The leg's read stations as ONE gate input, each judgment on its call's pinned read of the person's rules: a station is
@@ -263,3 +267,4 @@ export declare function ruleRowsDroppedNotice(onNotice: RunnerDeps["onNotice"],
263
267
  readonly sessionId: string;
264
268
  readonly runId: string;
265
269
  }): (rows: EffectivePermissionRules["droppedRows"]) => void;
270
+ export {};
@@ -303,6 +303,7 @@ export function createPersonPathRows(cfg) {
303
303
  },
304
304
  matchPath: (path) => judging().writeDeny.matchPath(path),
305
305
  matchTarget: (canonicalKey, lexicalView, opts) => judging().writeDeny.matchTarget(canonicalKey, lexicalView, opts),
306
+ guardsReads: (pattern) => judging().writeDeny.guardsReads?.(pattern) === true,
306
307
  homeViews: readDeny.homeViews,
307
308
  forCall: (id) => tablesFor(id).writeDeny,
308
309
  };
@@ -335,7 +336,10 @@ const SEATS = new WeakMap();
335
336
  export function denySeatsOf(t) {
336
337
  let seats = SEATS.get(t);
337
338
  if (seats === undefined) {
338
- seats = { read: readDenySeat(t.readDeny), write: t.writeDeny.ruleRows.length > 0 ? { writeDenyMatch: (p) => t.writeDeny.matchPath(p)?.pattern ?? null } : {} };
339
+ seats = {
340
+ read: readDenySeat(t.readDeny),
341
+ write: t.writeDeny.ruleRows.length > 0 ? { writeDenyMatch: (p) => t.writeDeny.matchPath(p)?.pattern ?? null, writeDenyGuardsReads: (pattern) => t.writeDeny.guardsReads?.(pattern) === true } : {},
342
+ };
339
343
  SEATS.set(t, seats);
340
344
  }
341
345
  return seats;
@@ -24,3 +24,15 @@ export declare function mintPlacementFence(row: WorkspaceHandle | undefined, han
24
24
  * any other leg `config.placement_not_honored`.
25
25
  */
26
26
  export declare function settleOwnTarget(env: ExecutionEnv | undefined, fence: PlacementTarget | undefined, restoredCheckpoint: boolean): PlacementTarget | undefined;
27
+ /** The codes a device move is refused with: a fresh fenced leg, and a leg that restores or resumes a checkpointed workspace. */
28
+ export type DeviceMoveRefusalCode = "config.placement_not_honored" | "resume.env_failed";
29
+ /**
30
+ * THE refusal every device receipt throws — the settle point's two arms and the resume restore's identity check — so the
31
+ * three speak one sentence. A delegating model reads it as the child's `error:` line, which the report bounds at 300
32
+ * characters and which sits beside no code line of its own: the code, the two devices (each held to a budget, so an id of
33
+ * any length leaves room) and the way on come first, the host's part of the contract last, where a cut costs the least.
34
+ * The way on is the model's to act on: bring the workspace back to the fenced device, or start the work in a new workspace.
35
+ */
36
+ export declare function deviceMoveRefusal(code: DeviceMoveRefusalCode, fenceDevice: string | undefined, reportedDevice: string | undefined): Error & {
37
+ code: string;
38
+ };
@@ -1,4 +1,6 @@
1
1
  import { placementHonored, placementTargetOf, reportedPlacementTarget } from "../remote-env.js";
2
+ import { sliceHeadSafe, sliceTailSafe } from "../surrogate-safe-slice.js";
3
+ import { inlineUntrusted } from "../untrusted-text.js";
2
4
  export function mintPlacementFence(row, handedValue) {
3
5
  const fromRow = row !== undefined ? placementTargetOf(row) : undefined;
4
6
  const handed = handedFence(handedValue);
@@ -20,14 +22,26 @@ function handedFence(value) {
20
22
  }
21
23
  export function settleOwnTarget(env, fence, restoredCheckpoint) {
22
24
  const own = reportedPlacementTarget(env);
23
- if (!placementHonored(fence, own)) {
24
- const reported = own?.deviceId !== undefined ? `reports device "${own.deviceId}"` : "reports no device";
25
- throw restoredCheckpoint
26
- ? refusal("resume.env_failed", `resume workspace identity mismatch: the placement fence names deviceId "${fence?.deviceId}" but the restored execution environment ${reported} once its workspace settled — refusing to continue on a different physical device`)
27
- : refusal("config.placement_not_honored", `this agent's placement fence names device "${fence?.deviceId}" but its execution environment ${reported} — refusing to run it on another target than the one it was handed (the factory must mint on the fenced device or throw)`);
28
- }
25
+ if (!placementHonored(fence, own))
26
+ throw deviceMoveRefusal(restoredCheckpoint ? "resume.env_failed" : "config.placement_not_honored", fence?.deviceId, own?.deviceId);
29
27
  return own;
30
28
  }
29
+ export function deviceMoveRefusal(code, fenceDevice, reportedDevice) {
30
+ const fenced = fenceDevice !== undefined ? `device "${renderDeviceId(fenceDevice)}"` : "no device";
31
+ const reports = reportedDevice !== undefined ? `device "${renderDeviceId(reportedDevice)}"` : "no device";
32
+ return refusal(code, `${code}: refused before it ran — fenced to ${fenced}, but the environment reports ${reports}. Bring the workspace back to that device or open a new workspace for this work. (The factory must mint on the fenced device or throw.)`);
33
+ }
34
+ const DEVICE_ID_RENDER_MAX = 48;
35
+ const DEVICE_ID_FOLD_WINDOW = 4 * DEVICE_ID_RENDER_MAX;
36
+ const foldDeviceId = (s) => inlineUntrusted(s, 4 * s.length + 8);
37
+ function renderDeviceId(id) {
38
+ const folded = id.length <= 2 * DEVICE_ID_FOLD_WINDOW ? foldDeviceId(id) : `${foldDeviceId(sliceHeadSafe(id, DEVICE_ID_FOLD_WINDOW))}…${foldDeviceId(sliceTailSafe(id, DEVICE_ID_FOLD_WINDOW))}`;
39
+ if (folded.length <= DEVICE_ID_RENDER_MAX)
40
+ return folded;
41
+ const keep = DEVICE_ID_RENDER_MAX - 1;
42
+ const head = Math.ceil(keep / 2);
43
+ return `${sliceHeadSafe(folded, head)}…${sliceTailSafe(folded, keep - head)}`;
44
+ }
31
45
  function placementNotHonored(message) {
32
46
  return refusal("config.placement_not_honored", message);
33
47
  }
@@ -1,7 +1,7 @@
1
1
  import { cardDisclosureOf } from "../allow-entry.js";
2
2
  import { primaryActivityArg } from "../arg-summary.js";
3
3
  import { classicEventBase, observeClassic } from "../mods/stations.js";
4
- import { advertisedWritableRootsSeat, exemptRootsSeat, attest, attestationOf, isLiveApproverSeat, resolveAsk } from "../tool-policy.js";
4
+ import { advertisedWritableRootsSeat, exemptRootsSeat, attest, attestationOf, isLiveApproverSeat, resolveAskFor } from "../tool-policy.js";
5
5
  import { exactBoundInputHashOf } from "../canonical-json.js";
6
6
  import { composeCallSignal, raceSettlementAgainstSignal } from "./abort-race.js";
7
7
  import { failedJudgmentDeny, policyCheckAbortedDeny } from "./policy-throw.js";
@@ -88,14 +88,14 @@ export function prepareAskLane(input) {
88
88
  };
89
89
  const settlement = { kind: "approver_unavailable", who: { party: "none" }, when: now() };
90
90
  return decision.action === "ask"
91
- ? attest(intercepted, req, { settlement, ...(decision.origin !== undefined ? { origin: decision.origin } : {}), ...(decision.classes !== undefined ? { classes: decision.classes } : {}), inputDigest: exactBoundInputHashOf(req.args) })
92
- : attest(intercepted, req, { settlement, inputDigest: exactBoundInputHashOf(req.args) });
91
+ ? attest(intercepted, req, { settlement, ...(decision.origin !== undefined ? { origin: decision.origin } : {}), ...(decision.classes !== undefined ? { classes: decision.classes } : {}), inputDigest: exactBoundInputHashOf(req.toolName, req.args) })
92
+ : attest(intercepted, req, { settlement, inputDigest: exactBoundInputHashOf(req.toolName, req.args) });
93
93
  }
94
94
  const grantReuse = consumeInheritedAskGrant(inheritedAskGrants, onAsk, humanReviewRef, decision, req);
95
95
  if (grantReuse !== undefined)
96
96
  return grantReuse;
97
97
  const t0 = now();
98
- const resolved = await resolveAsk({
98
+ const resolved = await resolveAskFor({
99
99
  toolName: req.toolName,
100
100
  toolCallId: req.toolCallId,
101
101
  args: req.args,
@@ -117,7 +117,7 @@ export function prepareAskLane(input) {
117
117
  ...(decision.action === "ask" && decision.probeCause !== undefined ? { probeCause: decision.probeCause } : {}),
118
118
  ...(decision.action === "ask" && decision.probeReadRootCandidate !== undefined ? { readRootCandidate: decision.probeReadRootCandidate } : {}),
119
119
  ...(decision.action === "ask" && decision.ruleEvidence !== undefined ? { ruleEvidence: decision.ruleEvidence } : {}),
120
- }, onAsk, composedCallSignal(callSignal), lateAskSettlementObserver({ toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }));
120
+ }, onAsk, composedCallSignal(callSignal), lateAskSettlementObserver({ toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), decision);
121
121
  const waitMs = Math.max(0, now() - t0);
122
122
  const granting = settleReadRootGrant(resolved.readRootGrant, grantReadRoot, { toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, signal: composedCallSignal(callSignal) });
123
123
  if (granting !== undefined)
@@ -57,7 +57,7 @@ export interface PrepareCapsAndWorkflowInput {
57
57
  /** borrowed-readonly — the trusted spawn-side channel; the Workflow mount forwards `rootSessionId`, `placementRoot`,
58
58
  * `onTaskNotification`, `workflowDepth`, the capture-floor getter reads `memoryCaptureAncestors`, and the arming reads
59
59
  * the chain's auto-mode face (`inheritedGate.autoModeFace`). */
60
- internals: Pick<RunInternals, "rootSessionId" | "placementRoot" | "onTaskNotification" | "workflowDepth" | "memoryCaptureAncestors" | "workflowParkedResume" | "holder" | "questionFaceStripped" | "inheritedGate"> | undefined;
60
+ internals: Pick<RunInternals, "rootSessionId" | "rootSessionIncarnation" | "placementRoot" | "onTaskNotification" | "workflowDepth" | "memoryCaptureAncestors" | "workflowParkedResume" | "holder" | "questionFaceStripped" | "inheritedGate"> | undefined;
61
61
  /** borrowed-readonly — the tree's cross-boundary token (inherited or minted), which the Workflow mount hands to its children. */ crossBoundaryTree: import("../cross-boundary-taint.js").CrossBoundaryTreeToken;
62
62
  /** borrowed-readonly — the tree's owner seat, which the Workflow mount hands to its children (by reference). */ delegationOwner: import("./delegation-owner.js").DelegationOwnerSeat;
63
63
  /** borrowed-readonly — the acquired session; the classifier leg rebuilds its transcript window from `buildContext`. */
@@ -70,8 +70,11 @@ export interface PrepareCapsAndWorkflowInput {
70
70
  hostTaskId: string;
71
71
  /** borrowed-readonly — the registry scope the Workflow mount registers in. */
72
72
  taskScope: string;
73
- /** borrowed-readonly — the SETTLED task root the Workflow mount hands its children as `parentCwd`. */
73
+ /** borrowed-readonly — the SETTLED task root the Workflow mount hands its children as `callerRoot`. */
74
74
  taskRootFinal: string;
75
+ /** borrowed-readonly — where a delegated child is asked to work (the leg's write location, else the task root as spelled),
76
+ * read at the spawn: the Workflow mount hands it to its children as `parentCwd`. */
77
+ delegationCwd: () => string;
75
78
  /** borrowed-readonly — this leg's own target (absent: none), the fence the Workflow mount hands every agent it spawns. */
76
79
  ownTarget: import("../remote-env.js").PlacementTarget | undefined;
77
80
  /** borrowed-readonly — the run's resolved model: the classifier leg's fallback and the route pre-flight's primary. */
@@ -144,6 +147,8 @@ export interface PrepareCapsAndWorkflowInput {
144
147
  runnerSelf: RunnerSelfSeat | undefined;
145
148
  /** borrowed-readonly — LATE-BOUND: the memory-engine session; the Workflow mount's capture-floor getter reads it at ITS call time. */
146
149
  memoryEngineSession: () => Prepared["memoryEngineSession"];
150
+ /** borrowed-readonly — LATE-BOUND: this leg's occupant (the lineage read assigns it); the Workflow mount's root-occupant seat reads it at ITS call time. */
151
+ sessionIncarnation: () => string | undefined;
147
152
  /** borrowed-readonly — LATE-BOUND: the adopted center artifact; the Workflow mount's two center getters read it at THEIR call time. */
148
153
  centerAdoption: () => {
149
154
  artifact: PromptArtifact;
@@ -117,7 +117,7 @@ function autoModeArmReasonOf(intent, facePresent, caps, capsFaulted) {
117
117
  return { armed: true, reason: "armed" };
118
118
  }
119
119
  export async function prepareCapsAndWorkflow(input) {
120
- const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptLean, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, taskArtifacts, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated, sideCallBookRef } = input;
120
+ const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, delegationCwd, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptLean, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, taskArtifacts, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated, sideCallBookRef } = input;
121
121
  const roster = new RosterBuilder(toolEffects);
122
122
  for (const t of spec.tools ?? []) {
123
123
  const mounted = mountCallerTool(t);
@@ -331,7 +331,7 @@ export async function prepareCapsAndWorkflow(input) {
331
331
  scope: taskScope,
332
332
  notifier: deps.workflowCompletionNotifier,
333
333
  originatingSessionId: sessionId,
334
- rootSessionId: internals?.rootSessionId ?? sessionId, ...(internals?.placementRoot !== undefined ? { placementRoot: internals.placementRoot } : {}), crossBoundaryTree: input.crossBoundaryTree, delegationOwner: input.delegationOwner,
334
+ rootSessionId: internals?.rootSessionId ?? sessionId, rootSessionIncarnation: () => (internals?.rootSessionId !== undefined ? internals.rootSessionIncarnation : input.sessionIncarnation()), ...(internals?.placementRoot !== undefined ? { placementRoot: internals.placementRoot } : {}), crossBoundaryTree: input.crossBoundaryTree, delegationOwner: input.delegationOwner,
335
335
  taskRegistry: defaultTaskRegistry,
336
336
  taskNotification: internals?.onTaskNotification, ...(taskArtifacts !== undefined ? { taskArtifacts } : {}),
337
337
  taskOwner: hostTaskId,
@@ -359,14 +359,17 @@ export async function prepareCapsAndWorkflow(input) {
359
359
  ...(resolvedInteractionPosture !== undefined ? { parentInteractionPosture: resolvedInteractionPosture } : {}),
360
360
  parentMemoryCaptureState: () => {
361
361
  const memoryEngineSession = input.memoryEngineSession();
362
- const ctl = memoryEngineSession?.engine.controlPlaneDir;
362
+ const ctl = memoryEngineSession?.engine.controlPlaneRoot;
363
363
  const co = memoryEngineSession?.captureOptOut;
364
364
  return assembleParentCaptureState(co?.optedOut() ?? false, co?.indeterminate() ?? false, ctl, [...(internals?.memoryCaptureAncestors ?? []), { sessionId, ...(ctl !== undefined ? { controlDir: ctl } : {}) }]);
365
365
  },
366
366
  autoModeReview: () => (autoModeDeciderRef.current !== undefined ? { decider: autoModeDeciderRef.current } : undefined),
367
367
  agentStations: input.agentStations,
368
368
  workflowDepth: internals?.workflowDepth,
369
- parentCwd: taskRootFinal,
369
+ get parentCwd() {
370
+ return delegationCwd();
371
+ },
372
+ callerRoot: taskRootFinal,
370
373
  ...(input.ownTarget !== undefined ? { placementTarget: input.ownTarget } : {}),
371
374
  parentThinking: () => childThinkingSeat(undefined, deploymentSubagentThinking(runnerSelf.agentCatalog?.roles), harnessRef.current?.getThinkingLevel() ?? thinking).thinking,
372
375
  parentClamps: runClampSource,
@@ -21,6 +21,7 @@ import { assertRetentionWords } from "../retention.js";
21
21
  import { resolveModel, resolveTaskModel, roleModelIfSet, screenRoleMap } from "../roles.js";
22
22
  import { resolveSkillListingBudget } from "../skill-listing-budget.js";
23
23
  import { describeRejectedValue } from "../tool-search-setting.js";
24
+ import { compactionSeatsDefect } from "../context-settings.js";
24
25
  import { assertAdvisorModelShape } from "../advisor-verdict.js";
25
26
  import { applyToolModelGate, assertRestoreGatedToolsValue } from "../tool-model-gate.js";
26
27
  import { resolveUsageWindows } from "../usage-window-store.js";
@@ -286,6 +287,9 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
286
287
  });
287
288
  if (spec.classifyAllShell !== undefined && typeof spec.classifyAllShell !== "boolean")
288
289
  enter("taskConfig", () => { throw limitConfigError("config.invalid_argument", `TaskSpec.classifyAllShell must be a boolean when present (got ${describeRejectedValue(spec.classifyAllShell)}) — true lets no shell allow entry clear a call in auto mode; omit the key for the default.`); });
290
+ const compactionSeats = typeof spec.compaction === "object" && spec.compaction !== null ? compactionSeatsDefect(spec.compaction, "TaskSpec.compaction") : undefined;
291
+ if (compactionSeats !== undefined)
292
+ enter("taskConfig", () => { throw limitConfigError(compactionSeats.kind === "retired" ? "config.spec_retired_key" : "config.invalid_argument", compactionSeats.sentence); });
289
293
  if (spec.toolMaterializeStrategy === "static" && spec.deferSelfResolve === false)
290
294
  enter("taskConfig", () => {
291
295
  const e = new Error(`toolMaterializeStrategy "static" cannot be combined with deferSelfResolve: false — with the direct-call ` +
@@ -43,6 +43,9 @@ export interface PrepareDelegationSurfaceInput {
43
43
  resume: Pick<PrepareResume, "seed"> | undefined;
44
44
  /** borrowed-readonly — the acquired session id (the mounts' session axis). */
45
45
  sessionId: string;
46
+ /** borrowed-readonly — the leg's own session address (`sessionAddressOf`: the id and the occupant its acquire read): the peer seats
47
+ * name it as the sender's own, so what comes back is for this occupant. */
48
+ sessionAddress: import("../task-notification.js").SessionAddress;
46
49
  /** borrowed-readonly — the per-task identity (the mounts' owner axis). */
47
50
  hostTaskId: string;
48
51
  /** borrowed-readonly — the registry scope the mounts register in. */
@@ -13,7 +13,7 @@ import { deliverEngineNotice } from "../types.js";
13
13
  import { RosterBuilder } from "../tool-roster.js";
14
14
  import { sendMessageContinuationSeats } from "./send-message-continuation.js";
15
15
  export function prepareDelegationSurface(input) {
16
- const { spec, deps, internals, resume, sessionId, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, taskArtifacts, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat } = input;
16
+ const { spec, deps, internals, resume, sessionId, sessionAddress, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, taskArtifacts, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat } = input;
17
17
  let worktreeSessionRef;
18
18
  const delegationSurfaceActive = backgroundTaskToolsActive || workflowToolsActive;
19
19
  const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
@@ -55,7 +55,7 @@ export function prepareDelegationSurface(input) {
55
55
  ...(deps.backgroundAgentStore !== undefined ? { agentStore: deps.backgroundAgentStore } : {}),
56
56
  ...(deps.mailboxStore !== undefined ? { mailbox: deps.mailboxStore } : {}),
57
57
  ...(reviveSpawn !== undefined ? { reviveSpawn } : {}),
58
- ...(peerLaneActive ? peerLaneSendMessageSeats({ peerDirectory: deps.peerDirectory, ...(deps.peerChannel !== undefined ? { peerChannel: deps.peerChannel } : {}), sessionId, scope: taskScope, ...(internals?.explicitAgentName !== undefined ? { name: internals.explicitAgentName } : {}), refs: peerLaneRefs, listingMounted: listAgentsMountable({ leaves, specTools: spec.tools ?? [] }) }) : {}),
58
+ ...(peerLaneActive ? peerLaneSendMessageSeats({ peerDirectory: deps.peerDirectory, ...(deps.peerChannel !== undefined ? { peerChannel: deps.peerChannel } : {}), address: sessionAddress, scope: taskScope, ...(internals?.explicitAgentName !== undefined ? { name: internals.explicitAgentName } : {}), refs: peerLaneRefs, listingMounted: listAgentsMountable({ leaves, specTools: spec.tools ?? [] }) }) : {}),
59
59
  onNotifyError: (f) => emitTrace(deps.tracer, () => ({ kind: "observer.notify_failed", version: 1, taskId: hostTaskId, site: f.site, message: f.error.message, ts: Date.now() })),
60
60
  onTranscriptIntegrityGap: (handle, scope) => deliverEngineNotice(deps.onNotice, {
61
61
  code: "delegation.transcript_integrity",
@@ -2,7 +2,7 @@ import { StubExecutionEnv } from "../stub-env.js";
2
2
  import { hasDestroy } from "../remote-env.js";
3
3
  import { mintPlacementFence } from "./placement-fence.js";
4
4
  import { announceMalformedCapabilities } from "./env-capability-census.js";
5
- import { childPlacementOnLeg, deploymentCanRerootChild, worktreeNotHonored } from "./child-tree.js";
5
+ import { callerTreeMissed, canonicalOrSelf, childPlacementOnLeg, deploymentCanRerootChild, factoryIgnoredHint, worktreeNotHonored } from "./child-tree.js";
6
6
  import { settleTeardownLeg } from "./teardown-bounded.js";
7
7
  export async function prepareExecutionEnv(input) {
8
8
  const { deps, spec, internals, resume, placementRootResolved, sessionId, forgetOnThrow, rollback } = input;
@@ -73,13 +73,24 @@ export async function prepareExecutionEnv(input) {
73
73
  }
74
74
  }
75
75
  const handsEnabled = ownedEnv !== undefined || deps.executionEnv !== undefined;
76
- const taskRootInitial = internals?.isolation === "worktree" || internals?.requestedCwd !== undefined || internals?.worktreeOffered === true || !deps.rootPath ? executionEnv.cwd : deps.rootPath;
76
+ const parentCwd = internals?.worktreeOffered !== true ? internals?.parentCwd : undefined;
77
+ const childAtCaller = parentCwd !== undefined && (ownedEnv === undefined || (await canonicalOrSelf(executionEnv, executionEnv.cwd)) === (await canonicalOrSelf(executionEnv, parentCwd)));
78
+ const taskRootInitial = childAtCaller && parentCwd !== undefined
79
+ ? parentCwd
80
+ : internals?.isolation === "worktree" || internals?.requestedCwd !== undefined || internals?.worktreeOffered === true || !deps.rootPath ? executionEnv.cwd : deps.rootPath;
77
81
  const placement = internals?.callerRoot === undefined ? undefined : await childPlacementOnLeg(executionEnv, { ...internals, callerRoot: internals.callerRoot }, taskRootInitial);
78
- if (internals?.worktreeOffered === true && placement === "caller_tree") {
79
- await settleTeardownLeg(() => forgetOnThrow(), "forgetOnThrow (worktree-not-honored leg)", (err) => deps.onError?.(err, { phase: "config", sessionId }));
80
- await settleTeardownLeg(() => (ownedEnv && hasDestroy(ownedEnv) ? ownedEnv.destroy() : undefined), "ownedEnv.destroy (worktree-not-honored leg)", (err) => deps.onError?.(err, { phase: "config", sessionId }));
82
+ const refuseChild = async (leg, refusal) => {
83
+ await settleTeardownLeg(() => forgetOnThrow(), `forgetOnThrow (${leg} leg)`, (err) => deps.onError?.(err, { phase: "config", sessionId }));
84
+ await settleTeardownLeg(() => (ownedEnv && ownedEnv !== deps.executionEnv && hasDestroy(ownedEnv) ? ownedEnv.destroy() : undefined), `ownedEnv.destroy (${leg} leg)`, (err) => deps.onError?.(err, { phase: "config", sessionId }));
81
85
  ownedEnvSeat.current = undefined;
82
- throw worktreeNotHonored(executionEnv.cwd);
86
+ throw refusal;
87
+ };
88
+ if (placement !== undefined && internals?.callerRoot !== undefined) {
89
+ if (internals.worktreeOffered === true && placement === "caller_tree")
90
+ await refuseChild("worktree-not-honored", worktreeNotHonored(executionEnv.cwd));
91
+ const missedTree = await callerTreeMissed(executionEnv, placement, internals.callerRoot, taskRootInitial);
92
+ if (missedTree !== undefined)
93
+ await refuseChild("caller-tree-missed", factoryIgnoredHint(taskRootInitial, executionEnv.cwd, missedTree));
83
94
  }
84
95
  return { executionEnv, ownedEnvSeat, ownedEnvObservedAt, handsEnabled, taskRootInitial, placement, placementFence };
85
96
  }
@@ -35,6 +35,7 @@ import { type HookEnvCapabilities, type HookInvocationIdentity } from "../hooks.
35
35
  import type { ToolPolicy } from "../tool-policy.js";
36
36
  import { type GateOutcome } from "../gate-outcome.js";
37
37
  import type { RunnerDeps, TaskSpec } from "../types.js";
38
+ import type { NoticeAddress } from "../leg-identity.js";
38
39
  import { type WiringManifest } from "../wiring-manifest.js";
39
40
  import type { WriteProtectionCheck } from "../write-protect.js";
40
41
  import type { ShellReadCheck } from "../../tools/fs/shell-read-check.js";
@@ -152,6 +153,10 @@ export interface PrepareGateStationsInput {
152
153
  hostTaskId: string;
153
154
  /** borrowed-readonly — the acquired session id (the settlement defects' error tag). */
154
155
  sessionId: string;
156
+ /** borrowed-readonly — where this station's user-face notices are addressed (`noticeAddressOf`, minted once per leg beside the
157
+ * ask source): the leg's own session on a top-level leg; the delegation tree's root, naming this leg, on a delegated one —
158
+ * every notice below spreads it in place of the bare session id. */
159
+ noticeAddress: NoticeAddress;
155
160
  /** borrowed-readonly — the hand's live tracked cwd, or undefined; `current` is read per screening / per post seat. Not
156
161
  * written here. */
157
162
  handsCwdRef: CwdRef | undefined;
@@ -50,7 +50,7 @@ export function maybeHumanRejectionHalt(input) {
50
50
  };
51
51
  }
52
52
  export function prepareGateStations(input) {
53
- const { askLane, parkAsk, tools, toolRosterDeltas, deps, toolCallGateArmedRef, effectivePolicy, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, toolOccurrences, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, handsCwdRef, stampCallTarget, hookEnvFace, writeProtectionCheck, shellReadCheck, crossBoundaryCheck, readFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider, autoModeDenialTracking, askRoute, permissionMode, toolMarkSources, a2aIsolatePeers, ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, frameSettlement, seatInputsFor, modBus, inheritedInstallations } = input;
53
+ const { askLane, parkAsk, tools, toolRosterDeltas, deps, toolCallGateArmedRef, effectivePolicy, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, toolOccurrences, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, noticeAddress, handsCwdRef, stampCallTarget, hookEnvFace, writeProtectionCheck, shellReadCheck, crossBoundaryCheck, readFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider, autoModeDenialTracking, askRoute, permissionMode, toolMarkSources, a2aIsolatePeers, ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, frameSettlement, seatInputsFor, modBus, inheritedInstallations } = input;
54
54
  const releasesAnnounced = new Map();
55
55
  const onModeReleased = (info) => {
56
56
  const table = info.readUnestablished === true ? input.readDenyInForce(info.toolCallId) : undefined;
@@ -59,7 +59,7 @@ export function prepareGateStations(input) {
59
59
  deliverEngineNotice(deps.onNotice, {
60
60
  code: "permission.read_deny_unapplied",
61
61
  message: `the ${info.release.mode} permission mode released "${info.toolName}" although a read-deny table is in force (${named}): the read boundary could not establish what this command reads, so no row of the table was applied to it`,
62
- detail: { mode: info.release.mode, toolCallId: info.toolCallId, tiers: [...table.tiers], rows: table.rows.slice(0, 8), rowCount: table.rows.length, sessionId, runId },
62
+ detail: { mode: info.release.mode, toolCallId: info.toolCallId, tiers: [...table.tiers], rows: table.rows.slice(0, 8), rowCount: table.rows.length, ...noticeAddress, runId },
63
63
  });
64
64
  }
65
65
  const key = `${info.release.mode}\u0000${info.release.askClass}`;
@@ -70,7 +70,7 @@ export function prepareGateStations(input) {
70
70
  deliverEngineNotice(deps.onNotice, {
71
71
  code: "permission.ask_released_by_mode",
72
72
  message: `the ${info.release.mode} permission mode released a ${info.release.askClass} ask on "${info.toolName}" without putting it to anyone (further releases of this pair in this run ride each call's tool_end.gate.disposition.released)`,
73
- detail: { mode: info.release.mode, askClass: info.release.askClass, ...(info.release.origin !== undefined ? { origin: info.release.origin } : {}), ...(info.release.mandate !== undefined ? { mandate: info.release.mandate } : {}), count, firstToolCallId: info.toolCallId, sessionId, runId },
73
+ detail: { mode: info.release.mode, askClass: info.release.askClass, ...(info.release.origin !== undefined ? { origin: info.release.origin } : {}), ...(info.release.mandate !== undefined ? { mandate: info.release.mandate } : {}), count, firstToolCallId: info.toolCallId, ...noticeAddress, runId },
74
74
  });
75
75
  };
76
76
  if (askLane !== undefined && parkAsk !== undefined) {
@@ -140,7 +140,7 @@ export function prepareGateStations(input) {
140
140
  abortSignal: abortController.signal,
141
141
  onHookError: notifyHookError,
142
142
  shellGated: tierSeat?.shellGated(shellGatedTools, toolMarkSources) === true,
143
- ...(autoModeDecider.current !== undefined ? { autoMode: { decider: autoModeDecider.current, ...(autoModeDenialTracking.current !== undefined ? { denialTracking: autoModeDenialTracking.current } : {}), unavailable: classifierUnavailableSeat({ station: "leg", ...(autoModeDecider.current.timeoutMs !== undefined ? { budgetMs: autoModeDecider.current.timeoutMs } : {}), route: approvalRouteOf(askRoute), onNotice: deps.onNotice, sessionId, runId }) } } : {}),
143
+ ...(autoModeDecider.current !== undefined ? { autoMode: { decider: autoModeDecider.current, ...(autoModeDenialTracking.current !== undefined ? { denialTracking: autoModeDenialTracking.current } : {}), unavailable: classifierUnavailableSeat({ station: "leg", ...(autoModeDecider.current.timeoutMs !== undefined ? { budgetMs: autoModeDecider.current.timeoutMs } : {}), route: approvalRouteOf(askRoute), onNotice: deps.onNotice, ...noticeAddress, runId }) } } : {}),
144
144
  permissionMode: () => permissionMode.current, askSeatForm: askRoute.form,
145
145
  ...(markSources.size > 0 ? { toolMarkSources: markSources } : {}),
146
146
  ...seatInputsFor(e.toolName, wireOf("gate.skillActivationSeat", call)),
@@ -149,7 +149,7 @@ export function prepareGateStations(input) {
149
149
  onModeReleased,
150
150
  ancestorArbitrationOf: (toolCallId) => ancestorArbitrations.get(toolCallId),
151
151
  onHeadlessDenialLimit: stopForDenialLimit,
152
- onAskUnresolvable: (info) => deliverEngineNotice(deps.onNotice, askUnresolvableNotice({ sessionId, ...info })),
152
+ onAskUnresolvable: (info) => deliverEngineNotice(deps.onNotice, askUnresolvableNotice({ ...noticeAddress, ...info })),
153
153
  ...(permissionRuleLane
154
154
  ? {
155
155
  persistedRules: {
@@ -39,7 +39,8 @@ export interface PrepareHandsReadFaceInput {
39
39
  taskRootCanonical: string;
40
40
  /** borrowed-readonly — the leg's ONE write-location reader (prepare-task's `currentCheckoutOf` over the worktree seat): the
41
41
  * primary WRITE root of the structured write tools and of the shell's write targets, read per call — it is the task root
42
- * until EnterWorktree switches it, and moves back on ExitWorktree. The READ roots never read it. */
42
+ * until EnterWorktree switches it, and moves back on ExitWorktree. The READ roots read it too, and only when it left the task
43
+ * root: a managed tree hangs at the REPOSITORY root (#2738), so for a task rooted below that root the tree lies outside it. */
43
44
  writeLocation: () => string;
44
45
  /** borrowed-readonly — B-4's checkpoint-path rebaser (T7): identity unless a divergent restore
45
46
  * armed it; applied to the readFileState seed keys and the handsCwd seed. */