@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,4 +1,5 @@
1
1
  import type { MailboxAppendMessage, MailboxStore } from "./mailbox-store.js";
2
+ import { type EngineNotice } from "./engine-notice.js";
2
3
  /** The TERMINAL words of {@link TaskNotificationStatus}: the one table every "is this frame a completion?"
3
4
  * reading asks, exported as a value so a consumer outside the package reads these words rather than its own list. */
4
5
  export declare const TASK_NOTIFICATION_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "cancelled"];
@@ -13,7 +14,7 @@ export type SystemInjectionPriority = "now" | "next" | "later";
13
14
  * · `parked` — no live lane; pended IN PROCESS on {@link PendingSessionNotifications} for the
14
15
  * session's next run in this process (a process restart loses it);
15
16
  * · `parked_durably` — no live lane; appended to the session's DURABLE box
16
- * ({@link PendingSessionNotifications.bindSessionBox}) — the next run drains it, in any process;
17
+ * ({@link PendingSessionNotifications.admit}) — the next run drains it, in any process;
17
18
  * · `dropped_duplicate` — the session already delivered this exact frame;
18
19
  * · `refused` — a live lane took it and the session's receiving station did not hand it over: an extension consumed it,
19
20
  * or a handler there failed ({@link FrameReceiver}). The model never saw it, and it is not owed again.
@@ -260,7 +261,7 @@ export interface TaskNotificationPayload {
260
261
  };
261
262
  /**
262
263
  * design/385 §4.4 / §5.2 (slice 4) — the CROSS-SESSION NOTICE carrier: a delivery receipt about one of
263
- * THIS session's own outbound messages (held / denied / expired / delivered / refused / dropped) or an
264
+ * THIS session's own outbound messages (held / held_by_policy / denied / expired / delivered / refused / dropped) or an
264
265
  * idle notice for a `notify_when_idle` ask (idle / exited / unavailable / expired), drained from this
265
266
  * session's own box as a notice-kind record. Its PRESENCE is the render discriminator: the model reads
266
267
  * the engine-rendered notice line as-is (CC injects `[Cross-session delivery notice] …` /
@@ -500,6 +501,37 @@ export declare const MAX_PENDING_SESSIONS = 100;
500
501
  * a long-lived leader's binding is not evicted by parked traffic (eviction = the park backend degrades
501
502
  * to in-process, which the receipt then says). */
502
503
  export declare const MAX_SESSION_BOX_BINDINGS = 4096;
504
+ /**
505
+ * WHERE a frame for one session goes: the session id and the occupant of its row — `SessionMetadata.incarnation`, as the
506
+ * run that names the address acquired the row (`undefined` = no token: a row written before occupants were minted, or a
507
+ * read that failed). A session id can be deleted and created again under the same spelling, by another principal or the
508
+ * same one; the new row is another occupant, and a frame addressed to the one before it is never delivered to it
509
+ * ({@link sameOccupant}). Every seat of {@link PendingSessionNotifications} — its live lanes, its durable box, its
510
+ * parked records — is held for one address.
511
+ */
512
+ export interface SessionAddress {
513
+ readonly sessionId: string;
514
+ readonly occupant: string | undefined;
515
+ /** The leg could not read its occupant (the read threw): `occupant` is then no answer, and the address is nobody's. The store
516
+ * takes the leg as no admission, drains it nothing, registers no live lane for it, and discards (announced) what is routed
517
+ * to it ({@link PendingSessionNotifications.admit}, {@link PendingSessionNotifications.discardsStale}). */
518
+ readonly unread?: true;
519
+ }
520
+ /** A run leg's own session address — the session it prepared and the occupant its acquire read (the one construction). */
521
+ export declare function sessionAddressOf(leg: {
522
+ readonly sessionId: string;
523
+ readonly sessionIncarnation?: string;
524
+ readonly sessionIncarnationUnread?: true;
525
+ }): SessionAddress;
526
+ /** Which seat a frame addressed to an earlier occupant of a session would have reached under the occupant the session
527
+ * holds now: that occupant's live run, its durable box, or its next run's turn-open drain. */
528
+ export type DiscardedDeliveryPath = "live" | "box" | "drain";
529
+ /**
530
+ * The account of a frame discarded because its address names an occupant the session no longer holds — the one mint of
531
+ * `delegation.delivery_discarded`. Counts and words only: the frame's text (a child's summary, a peer's words) never
532
+ * rides it, nor either occupant token (only whether each side had one).
533
+ */
534
+ export declare function deliveryDiscardedNotice(address: Pick<SessionAddress, "sessionId" | "occupant">, current: string | undefined, payload: TaskNotificationPayload, path: DiscardedDeliveryPath): EngineNotice;
503
535
  /**
504
536
  * A session's DURABLE box, bound to the park seat by the leg that mounts its session-box drain — one
505
537
  * mint (the drain mount judgment), two readers (the drain and {@link routeOrParkNotification}), so
@@ -597,9 +629,9 @@ export type EngineFrameDecode = {
597
629
  * writer must never have encoded is dropped rather than trusted. */
598
630
  export declare function decodeEngineFrame(content: string): EngineFrameDecode;
599
631
  /** The durable form of an engine frame: the codec text under `kind: "engine_frame"`, stamped with
600
- * the box owner as `fromRoot` (the park seat's own fact, as for a peer-words record); no hop chain —
601
- * it is not a peer message and is never admitted as one. */
602
- export declare function engineFrameRecordOf(payload: TaskNotificationPayload, priority: SystemInjectionPriority, box: Pick<SessionBoxBinding, "sessionId">): MailboxAppendMessage;
632
+ * the box owner as `fromRoot` (the park seat's own fact, as for a peer-words record) and with the occupant the frame is
633
+ * addressed to (`occupant`, when the address has one); no hop chain — it is not a peer message and is never admitted as one. */
634
+ export declare function engineFrameRecordOf(payload: TaskNotificationPayload, priority: SystemInjectionPriority, to: Pick<SessionAddress, "sessionId" | "occupant">): MailboxAppendMessage;
603
635
  /**
604
636
  * RB-375 A2 (ruled 2026-08-03) — is this frame the TERMINAL of a delegated background agent?
605
637
  *
@@ -629,7 +661,8 @@ export declare function isTerminalTaskNotification(n: Pick<TaskNotificationPaylo
629
661
  * agent, a workflow run: the run lane the call carries (`ToolExecuteContext.onTaskNotification`) when there is one, else
630
662
  * the mount's own sink. One value per launch: the producer judges "will a completion reach the model" by it, delivers
631
663
  * through it, and owes its terminal frame to it ({@link oweTerminalDelivery}) — never one sink for the judgment and
632
- * another for the delivery.
664
+ * another for the delivery. A parked agent's redemption is the cycle its park left owed: its lane is the one that park
665
+ * recorded (`TaskRegistry.parkedCompletionSink`) when the call carries none of its own.
633
666
  */
634
667
  export declare function resolveCompletionSink<C, M>(callSink: C | undefined, mountSink: M | undefined): C | M | undefined;
635
668
  /**
@@ -656,6 +689,10 @@ export declare function admitsBackgroundLaunch(sink: unknown, deploymentChannel:
656
689
  * task by the frame it delivers, so a frame of another lane carrying the same `task_id` settles nothing here. A background
657
690
  * command or a Monitor watch never enters: its lifetime is its process's (it may never end), and a one-shot ending treats
658
691
  * it by the run's teardown rules without waiting. A sink no lane bound (a host's own) owes nothing.
692
+ *
693
+ * A cycle that PARKS on an approval sends no frame: its debt stays where it was booked, and the redemption that resumes
694
+ * it is the same cycle continuing — it books nothing new, and its frame settles that debt. Where the redemption completes
695
+ * into another lane, the debt moves there when the approval is consumed ({@link moveTerminalDelivery}) — one handle, one debt.
659
696
  */
660
697
  export declare class DeliveryObligations {
661
698
  /** lane key → admitted cycles whose terminal frame has not reached the sink. */
@@ -693,6 +730,9 @@ export declare function bindDeliveryObligations(sink: object, book: DeliveryObli
693
730
  export declare function oweTerminalDelivery(sink: unknown, task: Pick<TaskNotificationPayload, "task_id" | "task_type">): void;
694
731
  /** A cycle whose terminal frame will never reach `sink` (it was voided) releases its debt there (no-op for an unbound sink). */
695
732
  export declare function retireTerminalDelivery(sink: unknown, task: Pick<TaskNotificationPayload, "task_id" | "task_type">): void;
733
+ /** A parked cycle's debt follows its redemption: released on the lane the park left it owed to (`from`, absent when this
734
+ * process holds no park of it), owed on the lane the redemption completes into (`to`) — nothing moves when they are one. */
735
+ export declare function moveTerminalDelivery(from: unknown, to: unknown, task: Pick<TaskNotificationPayload, "task_id" | "task_type">): void;
696
736
  export interface DrainedPendingNotifications {
697
737
  /** Payloads still held when the session's next run drained. design/373 §3.5: batch order is
698
738
  * PRIORITY-MAJOR (now < next < later; a record with no carried priority ranks AS later —
@@ -801,20 +841,26 @@ export declare function createLiveNotificationLane(seat: {
801
841
  * run" — and every lane is tried once, so a lane that has stopped, or that has already handed this very
802
842
  * frame away, is passed over rather than swallowing it. A lane that refused a frame therefore cannot be
803
843
  * reached by it again, which is what makes a route of any length terminate on the parked store.
844
+ *
845
+ * A lane sits under its run's {@link SessionAddress}: a frame is offered only to the lanes of the occupant it is
846
+ * addressed to ({@link sameOccupant}). A run of another occupant of the same id — the id deleted and created again,
847
+ * by another principal or the same one — is never a destination for it.
804
848
  */
805
849
  export declare class SessionLiveNotificationLanes {
806
850
  private readonly lanes;
807
- register(sessionId: string, lane: LiveNotificationLane): void;
851
+ register(address: SessionAddress, lane: LiveNotificationLane): void;
808
852
  /** Idempotent (a lane withdraws at its stop AND again at its outermost teardown). The key is dropped
809
853
  * with its last lane so an idle process holds no per-session entry. */
810
- unregister(sessionId: string, lane: LiveNotificationLane): void;
854
+ unregister(address: SessionAddress, lane: LiveNotificationLane): void;
811
855
  /**
812
- * Offer the payload to the session's live lanes, newest first. The caller's OWN lane is not
856
+ * Offer the payload to the addressed occupant's live lanes, newest first. The caller's OWN lane is not
813
857
  * special-cased: a lane that just refused this frame reports `"unavailable"` for it from then on.
814
858
  */
815
- deliver(sessionId: string, payload: TaskNotificationPayload, priority: SystemInjectionPriority, opts?: {
859
+ deliver(address: SessionAddress, payload: TaskNotificationPayload, priority: SystemInjectionPriority, opts?: {
816
860
  onDisposition?: (d: NotificationDisposition) => void;
817
861
  }): "taken" | "pending" | "duplicate" | "unavailable";
862
+ /** Does the addressed occupant hold a live lane here? */
863
+ holds(address: SessionAddress): boolean;
818
864
  /** Sessions holding at least one live lane (observability + the tests' rollback detector). */
819
865
  get size(): number;
820
866
  }
@@ -828,12 +874,26 @@ export interface SessionBoxDebt {
828
874
  readonly box: SessionBoxBinding;
829
875
  readonly record: MailboxAppendMessage;
830
876
  }
877
+ /**
878
+ * Where a notification addressed to a session goes ({@link SessionAddress}): its live lanes, its durable box, its parked
879
+ * records — every seat held for ONE occupant of the session id. The session's CURRENT occupant is the one its latest leg in
880
+ * this process acquired ({@link admit}): an acquire answers the row as it stands, a row created again under the id is
881
+ * another occupant, and an occupant once replaced never stands again. So from an admission on, whatever is addressed to,
882
+ * or kept for, another occupant of that id is discarded — announced `delegation.delivery_discarded` (operator), never
883
+ * delivered and never silent. A session no leg of which was admitted here (or whose seat aged out of the bound) has no
884
+ * current occupant on record: its frames park under their own address and are judged by the leg that drains them.
885
+ */
831
886
  export declare class PendingSessionNotifications {
832
887
  private readonly sessions;
888
+ /** Where a discard is announced: the deployment's notice sink, read when the discard happens (absent ⇒ the process default seat). */
889
+ private readonly noticeSeat;
890
+ constructor(seats?: {
891
+ readonly onNotice?: () => ((notice: EngineNotice) => void) | undefined;
892
+ });
833
893
  /**
834
894
  * The LIVE half of the same question this store answers. Together they are one seat — "where does a
835
895
  * notification addressed to session S go?" — with two answers: the session's live lane when it has
836
- * one, this parked queue when it does not. One object, one lifetime, one key (the session id).
896
+ * one, this parked queue when it does not. One object, one lifetime, one key (the session address).
837
897
  */
838
898
  readonly liveLanes: SessionLiveNotificationLanes;
839
899
  /** Whole sessions evicted by {@link MAX_PENDING_SESSIONS} (their pendings were never delivered). */
@@ -851,16 +911,35 @@ export declare class PendingSessionNotifications {
851
911
  /** Whole-session losses whose tombstone was itself evicted — the count survives, the attribution
852
912
  * does not. Surfaced on the next session-level disclosure so it is never simply forgotten. */
853
913
  private unattributedDrops;
854
- /** The durable park backend per session ({@link SessionBoxBinding}); insertion-ordered, bounded. */
855
- private readonly sessionBoxes;
914
+ /** Each session's current occupant and its durable park backend ({@link SessionBoxBinding}); insertion-ordered, bounded. */
915
+ private readonly seats;
916
+ /**
917
+ * A leg of the session has acquired its row as `address.occupant` — its current occupant from now on — and binds (or, with
918
+ * `undefined`, unbinds) the session's durable box. Written at EVERY drain mount of a session's leg, so the binding tracks the
919
+ * deployment's current seats (a mailbox swapped out unbinds at the next mount); a re-admission refreshes the entry's LRU
920
+ * position. What this store still keeps for another occupant of the id — parked frames, their tombstone, their delivered and
921
+ * durable keys — is addressed to a row that will never stand again: the frames are discarded, each announced.
922
+ * A leg that could not read its occupant (`address.unread`) is no admission: the current occupant on record and what is kept
923
+ * for it stand for the next leg that reads its own. A seat is aged out only while the store keeps no record for its session,
924
+ * so a parked record is always judged against the occupant that parked it, never against whichever frame arrives next.
925
+ */
926
+ admit(address: SessionAddress, box: SessionBoxBinding | undefined): void;
927
+ /** The addressed occupant's durable box: the one its own leg in this process bound, never another occupant's. */
928
+ sessionBoxFor(address: SessionAddress): SessionBoxBinding | undefined;
856
929
  /**
857
- * Bind (or, with `undefined`, unbind) the session's durable box. Written at EVERY drain mount of a
858
- * session's leg, so the binding tracks the deployment's current seats (a mailbox swapped out
859
- * unbinds at the next mount). A re-bind refreshes the entry's LRU position.
930
+ * Is `address` an earlier occupant of a session whose current occupant is another? Then the frame is discarded here —
931
+ * announced with the seat it would have reached under the current occupant — and the answer is `true`: nothing routes,
932
+ * parks or folds it. `false` for the current occupant, and for a session with no current occupant on record. An unread
933
+ * address (a leg that could not read its occupant) is nobody's: its frames are discarded the same way, whatever the seat.
860
934
  */
861
- bindSessionBox(sessionId: string, box: SessionBoxBinding | undefined): void;
862
- /** The session's durable box, when a leg of it mounted the drain in this process. */
863
- sessionBoxFor(sessionId: string): SessionBoxBinding | undefined;
935
+ discardsStale(address: SessionAddress, payload: TaskNotificationPayload): boolean;
936
+ /** The one place a discarded frame is announced. */
937
+ private announceDiscard;
938
+ /** Discard a record parked for an occupant the session no longer holds: every frame in it is announced; the record's own
939
+ * bookkeeping (its eviction counts, its box debts) belongs to that occupant and goes with it. */
940
+ private discardRecord;
941
+ /** The session's record when it is parked for the addressed occupant. */
942
+ private recordOf;
864
943
  /**
865
944
  * Settle what the session's pending copies owe their boxes ({@link SessionBoxDebt}): each is asked of its own box once
866
945
  * more, under its record, in pend order. A box that answers took the record — it holds it, or received it already —
@@ -871,17 +950,22 @@ export declare class PendingSessionNotifications {
871
950
  * unasked, stays owed — and a copy that owes its box is never drained ({@link drain} keeps it back) — until a later
872
951
  * leg's settlement asks.
873
952
  */
874
- settleBoxDebts(sessionId: string, signal?: AbortSignal): Promise<void> | undefined;
953
+ settleBoxDebts(address: SessionAddress, signal?: AbortSignal): Promise<void> | undefined;
875
954
  /** What a drain hands out of a parked record: everything but the copies that still owe their box — those go back
876
- * into the store as the session's record (with their keys, tiers and debts) for the leg that settles them. */
955
+ * into the store as the session's record (with their occupant, keys, tiers and debts) for the leg that settles them. */
877
956
  private keepBackOwing;
878
957
  private settleBoxDebt;
879
- pend(sessionId: string, n: TaskNotificationPayload, priority?: SystemInjectionPriority, debt?: SessionBoxDebt): void;
958
+ /** Park a frame for the addressed occupant's next run. A frame addressed to an occupant the session no longer holds is
959
+ * discarded ({@link discardsStale}); a record kept for another occupant of an id no leg of which this process admitted (a
960
+ * record-holding seat is never aged out) names one of the two only — the newer arrival's record replaces it, its frames
961
+ * announced as discarded. `true` = the frame is
962
+ * parked for the address (a repeat of a parked key folds into it); `false` = discarded. */
963
+ pend(address: SessionAddress, n: TaskNotificationPayload, priority?: SystemInjectionPriority, debt?: SessionBoxDebt): boolean;
880
964
  /** Remove and return the session's pendings (one-shot — the next run consumes them exactly once); a copy that
881
965
  * still owes its box stays parked for the leg that settles it ({@link settleBoxDebts}).
882
966
  * design/373 §3.5: the batch comes out PRIORITY-MAJOR (stable sort — pend order within a class;
883
967
  * a no-priority record ranks as later), the idle-dequeue min-value-first form. */
884
- drain(sessionId: string): DrainedPendingNotifications | undefined;
968
+ drain(address: SessionAddress): DrainedPendingNotifications | undefined;
885
969
  /**
886
970
  * Keys a live lane of this session has already put in front of a model (the delivered half of the
887
971
  * ledger below). Kept beside the parked keys because the WINDOW is the session's, not any one run's:
@@ -891,23 +975,23 @@ export declare class PendingSessionNotifications {
891
975
  */
892
976
  private readonly routed;
893
977
  /**
894
- * Does this session ALREADY own this exact frame — parked, or routed onto a live lane? Only one of
978
+ * Does this session's addressed occupant ALREADY own this exact frame — parked, or routed onto a live lane? Only one of
895
979
  * the two may hold a key: a producer retrying a frame the session has already taken must FOLD rather
896
980
  * than be handed to whichever run has since gone live, which would deliver it there and again at the
897
- * next drain. Callers ask BEFORE routing and BEFORE parking.
981
+ * next drain. Callers ask BEFORE routing and BEFORE parking. Another occupant's keys answer nothing here.
898
982
  */
899
- holdsKey(sessionId: string, dedupKey: string): boolean;
983
+ holdsKey(address: SessionAddress, dedupKey: string): boolean;
900
984
  /** Keys the session's DURABLE box took ({@link routeOrParkNotification}'s durable arm) — the third holder
901
985
  * {@link holdsKey} consults, so a retry of a frame the box already holds folds exactly as one the
902
986
  * in-process store holds. Bounded like {@link routed}; a key is released when the append faulted and
903
987
  * the frame took the in-process park instead (that store then owns it). */
904
988
  private readonly durable;
905
- noteDurablePark(sessionId: string, dedupKey: string): void;
906
- forgetDurablePark(sessionId: string, dedupKey: string): void;
907
- /** Record that this session has DELIVERED this frame — see {@link routed}. Written at ONE place, the
989
+ noteDurablePark(address: SessionAddress, dedupKey: string): void;
990
+ forgetDurablePark(address: SessionAddress, dedupKey: string): void;
991
+ /** Record that this session's addressed occupant has DELIVERED this frame — see {@link routed}. Written at ONE place, the
908
992
  * harness's consumption sink (the step where a queued frame enters the model's input), so the record
909
993
  * can never run ahead of the delivery it claims. */
910
- markDelivered(sessionId: string, dedupKey: string): void;
994
+ markDelivered(address: SessionAddress, dedupKey: string): void;
911
995
  get size(): number;
912
996
  }
913
997
  /**
@@ -938,8 +1022,11 @@ export declare class DurableAppendObligations {
938
1022
  * then, so only the lane that actually delivers writes ownership
939
1023
  * ({@link LiveNotificationLaneSeat.markDelivered});
940
1024
  * · nothing can take it ⇒ park, carrying the tier, for the session's next run.
1025
+ * The address names the session's occupant ({@link SessionAddress}): every one of the three is that occupant's — its keys,
1026
+ * its live lanes, its box, its record — and a frame addressed to an occupant the session no longer holds is discarded
1027
+ * before any of them ({@link PendingSessionNotifications.discardsStale}); its receipt says `"refused"`.
941
1028
  */
942
- export declare function routeOrParkNotification(store: PendingSessionNotifications, sessionId: string, payload: TaskNotificationPayload, priority: SystemInjectionPriority, onDisposition?: (d: NotificationDisposition) => void): void;
1029
+ export declare function routeOrParkNotification(store: PendingSessionNotifications, address: SessionAddress, payload: TaskNotificationPayload, priority: SystemInjectionPriority, onDisposition?: (d: NotificationDisposition) => void): void;
943
1030
  /**
944
1031
  * The durable form of a parked peer-words frame: the SAME `peer_message` record the cross-session lane
945
1032
  * appends (the recipient's drain renders it through the one envelope and judges it through the one
@@ -952,7 +1039,7 @@ export declare function sessionBoxRecordOf(payload: TaskNotificationPayload & {
952
1039
  from: string;
953
1040
  body: string;
954
1041
  };
955
- }, box: Pick<SessionBoxBinding, "sessionId">): MailboxAppendMessage;
1042
+ }, to: Pick<SessionAddress, "sessionId" | "occupant">): MailboxAppendMessage;
956
1043
  /**
957
1044
  * Delivery-side overflow disclosure: fold the per-task drop counts into the drained payloads. Two
958
1045
  * carrier shapes, chosen per survivor: