@sema-agent/core 7.70.0 → 7.71.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 (434) hide show
  1. package/CHANGELOG.md +728 -0
  2. package/dist/agents/agent-transcript-tool.js +43 -19
  3. package/dist/agents/inherited-tool-pool.d.ts +5 -1
  4. package/dist/agents/inherited-tool-pool.js +6 -0
  5. package/dist/agents/retain-ledger.js +2 -0
  6. package/dist/agents/send-message-tool.d.ts +12 -1
  7. package/dist/agents/send-message-tool.js +47 -9
  8. package/dist/agents/subagent.js +31 -10
  9. package/dist/agents/tool-filter.js +1 -2
  10. package/dist/agents/verify.js +13 -2
  11. package/dist/agents/yield-adoption.js +11 -1
  12. package/dist/brain/claude-model-id.d.ts +11 -0
  13. package/dist/brain/claude-model-id.js +3 -1
  14. package/dist/config/catalog.js +10 -1
  15. package/dist/config/defaults.d.ts +3 -0
  16. package/dist/config/defaults.js +1 -0
  17. package/dist/core/allow-entry.js +1 -2
  18. package/dist/core/ask-origin.d.ts +55 -21
  19. package/dist/core/ask-origin.js +19 -11
  20. package/dist/core/ask-question.d.ts +4 -7
  21. package/dist/core/ask-question.js +2 -4
  22. package/dist/core/ask-unresolvable-notice.d.ts +17 -3
  23. package/dist/core/ask-unresolvable-notice.js +18 -4
  24. package/dist/core/attachment-source.d.ts +1 -1
  25. package/dist/core/attachment-source.js +2 -0
  26. package/dist/core/auto-compaction.d.ts +14 -4
  27. package/dist/core/auto-compaction.js +3 -2
  28. package/dist/core/auto-strip.js +2 -0
  29. package/dist/core/caller-text.d.ts +2 -33
  30. package/dist/core/caller-text.js +2 -23
  31. package/dist/core/caller-tool-name.js +1 -2
  32. package/dist/core/canonical-json.d.ts +9 -0
  33. package/dist/core/canonical-json.js +6 -0
  34. package/dist/core/checkpoint-features.d.ts +43 -80
  35. package/dist/core/checkpoint-features.js +10 -20
  36. package/dist/core/checkpoint-generation.d.ts +89 -19
  37. package/dist/core/checkpoint-generation.js +89 -14
  38. package/dist/core/checkpoint-queries.d.ts +95 -15
  39. package/dist/core/checkpoint-queries.js +108 -7
  40. package/dist/core/checkpoint-rekey.d.ts +2 -1
  41. package/dist/core/checkpoint-rekey.js +2 -2
  42. package/dist/core/checkpoint-requirements.d.ts +7 -6
  43. package/dist/core/checkpoint-requirements.js +2 -5
  44. package/dist/core/checkpoint-row-verdict.d.ts +3 -4
  45. package/dist/core/checkpoint-row-verdict.js +20 -41
  46. package/dist/core/checkpoint-store.d.ts +65 -41
  47. package/dist/core/checkpoint-store.js +28 -14
  48. package/dist/core/command-sandbox.d.ts +5 -3
  49. package/dist/core/command-sandbox.js +17 -9
  50. package/dist/core/config-refusal-codes.d.ts +1 -1
  51. package/dist/core/config-refusal-codes.js +1 -0
  52. package/dist/core/declaration-words.d.ts +2 -1
  53. package/dist/core/declaration-words.js +13 -2
  54. package/dist/core/effective-path-target.d.ts +23 -0
  55. package/dist/core/effective-path-target.js +15 -1
  56. package/dist/core/engine-attestation.d.ts +5 -1
  57. package/dist/core/engine-attestation.js +1 -0
  58. package/dist/core/engine-capabilities.d.ts +14 -9
  59. package/dist/core/engine-capabilities.js +1 -1
  60. package/dist/core/engine-notice.d.ts +62 -32
  61. package/dist/core/engine-version.js +1 -1
  62. package/dist/core/entries-not-applied.d.ts +1 -1
  63. package/dist/core/entries-not-applied.js +1 -0
  64. package/dist/core/file-history-store.d.ts +95 -11
  65. package/dist/core/file-history-store.js +117 -19
  66. package/dist/core/gate-fold.js +13 -7
  67. package/dist/core/gate-lanes.js +9 -9
  68. package/dist/core/governance-codes.d.ts +56 -7
  69. package/dist/core/governance-codes.js +105 -7
  70. package/dist/core/grant-holder.d.ts +53 -0
  71. package/dist/core/grant-holder.js +80 -0
  72. package/dist/core/hooks.d.ts +7 -3
  73. package/dist/core/hooks.js +2 -2
  74. package/dist/core/locked-config.d.ts +7 -1
  75. package/dist/core/locked-config.js +9 -2
  76. package/dist/core/mcp-call-meta.d.ts +52 -7
  77. package/dist/core/mcp-call-meta.js +21 -2
  78. package/dist/core/mcp-host-read.d.ts +1 -1
  79. package/dist/core/mcp-server-spec.d.ts +18 -0
  80. package/dist/core/mcp-server-spec.js +1 -0
  81. package/dist/core/mcp.js +2 -2
  82. package/dist/core/member-outcome.d.ts +22 -1
  83. package/dist/core/member-outcome.js +18 -6
  84. package/dist/core/memory-engine/delegation-settlement.js +5 -5
  85. package/dist/core/memory-engine/engine.js +19 -19
  86. package/dist/core/memory-engine/file-backend.d.ts +7 -2
  87. package/dist/core/memory-engine/file-backend.js +14 -12
  88. package/dist/core/memory-engine/frontmatter.js +1 -1
  89. package/dist/core/memory-engine/index.d.ts +1 -0
  90. package/dist/core/memory-engine/index.js +1 -0
  91. package/dist/core/memory-engine/layout.d.ts +34 -9
  92. package/dist/core/memory-engine/layout.js +36 -19
  93. package/dist/core/memory-engine/memory-deployment.js +8 -8
  94. package/dist/core/memory-engine/mount-failed-notice.d.ts +8 -5
  95. package/dist/core/memory-engine/mount-failed-notice.js +5 -2
  96. package/dist/core/mode-policy.d.ts +5 -0
  97. package/dist/core/mode-policy.js +6 -0
  98. package/dist/core/mods/host.d.ts +2 -1
  99. package/dist/core/mods/host.js +7 -6
  100. package/dist/core/mods/kernel/index.d.ts +1 -1
  101. package/dist/core/mods/kernel/index.js +1 -1
  102. package/dist/core/mods/kernel/registration.d.ts +5 -2
  103. package/dist/core/mods/kernel/registration.js +19 -3
  104. package/dist/core/mods/package.d.ts +12 -1
  105. package/dist/core/mods/package.js +36 -9
  106. package/dist/core/mods/stations.d.ts +7 -1
  107. package/dist/core/mods/stations.js +17 -3
  108. package/dist/core/mods/teammate-stations.d.ts +4 -1
  109. package/dist/core/mods/teammate-stations.js +1 -1
  110. package/dist/core/native-signal.d.ts +13 -0
  111. package/dist/core/native-signal.js +18 -0
  112. package/dist/core/park-resumability.d.ts +16 -14
  113. package/dist/core/park-resumability.js +9 -4
  114. package/dist/core/path-rule-binding.js +1 -1
  115. package/dist/core/permission-rule-model.d.ts +11 -5
  116. package/dist/core/permission-rule-model.js +5 -3
  117. package/dist/core/permission-rule-org.js +1 -1
  118. package/dist/core/permission-rule-provider.d.ts +5 -1
  119. package/dist/core/permission-rule-provider.js +6 -1
  120. package/dist/core/permission-rule-session.d.ts +35 -5
  121. package/dist/core/permission-rule-session.js +32 -1
  122. package/dist/core/permission-rule-store.d.ts +5 -1
  123. package/dist/core/permission-rule-store.js +28 -5
  124. package/dist/core/permission-rules.d.ts +2 -2
  125. package/dist/core/permission-rules.js +2 -3
  126. package/dist/core/principal-name.d.ts +12 -0
  127. package/dist/core/principal-name.js +6 -2
  128. package/dist/core/read-root-grant-screen.d.ts +7 -6
  129. package/dist/core/read-root-grant-screen.js +7 -8
  130. package/dist/core/remote-env.d.ts +42 -8
  131. package/dist/core/resume-config-judge.js +1 -1
  132. package/dist/core/resume-startup-cause.d.ts +19 -4
  133. package/dist/core/resume-startup-cause.js +25 -6
  134. package/dist/core/rewind-conversation.d.ts +4 -0
  135. package/dist/core/rewrite-rejudge.d.ts +9 -1
  136. package/dist/core/rewrite-rejudge.js +11 -1
  137. package/dist/core/rule-offer-read.js +3 -2
  138. package/dist/core/runner/assemble-result.d.ts +21 -11
  139. package/dist/core/runner/assemble-result.js +24 -4
  140. package/dist/core/runner/boundary-reminders.d.ts +104 -0
  141. package/dist/core/runner/boundary-reminders.js +108 -0
  142. package/dist/core/runner/branch-writeback.d.ts +21 -7
  143. package/dist/core/runner/branch-writeback.js +44 -6
  144. package/dist/core/runner/command-sandbox-frame.js +2 -1
  145. package/dist/core/runner/compact-session.js +11 -4
  146. package/dist/core/runner/constraint-layers.d.ts +24 -5
  147. package/dist/core/runner/constraint-layers.js +21 -2
  148. package/dist/core/runner/continuation-gate.js +3 -1
  149. package/dist/core/runner/contracts.d.ts +83 -13
  150. package/dist/core/runner/cross-boundary-lane.js +2 -1
  151. package/dist/core/runner/delegation-owner.d.ts +246 -45
  152. package/dist/core/runner/delegation-owner.js +237 -63
  153. package/dist/core/runner/expire-settle.d.ts +17 -0
  154. package/dist/core/runner/expire-settle.js +8 -2
  155. package/dist/core/runner/file-history-request.d.ts +4 -3
  156. package/dist/core/runner/file-history-request.js +4 -1
  157. package/dist/core/runner/file-history-restore.d.ts +11 -3
  158. package/dist/core/runner/file-history-restore.js +11 -3
  159. package/dist/core/runner/gate-exit.d.ts +22 -1
  160. package/dist/core/runner/gate-exit.js +12 -14
  161. package/dist/core/runner/nested-memory-content.js +1 -1
  162. package/dist/core/runner/nested-memory-lane.d.ts +10 -2
  163. package/dist/core/runner/nested-memory-lane.js +29 -8
  164. package/dist/core/runner/own-model-money-door.d.ts +13 -0
  165. package/dist/core/runner/own-model-money-door.js +17 -0
  166. package/dist/core/runner/park-commit.d.ts +4 -2
  167. package/dist/core/runner/park-commit.js +2 -1
  168. package/dist/core/runner/permission-rule-lanes.d.ts +4 -0
  169. package/dist/core/runner/permission-rule-lanes.js +7 -0
  170. package/dist/core/runner/person-path-rows.js +1 -1
  171. package/dist/core/runner/placement-fence.d.ts +8 -2
  172. package/dist/core/runner/placement-fence.js +8 -3
  173. package/dist/core/runner/policy-throw.d.ts +3 -2
  174. package/dist/core/runner/policy-throw.js +2 -2
  175. package/dist/core/runner/prepare-acquire-reconcile.d.ts +23 -14
  176. package/dist/core/runner/prepare-acquire-reconcile.js +33 -15
  177. package/dist/core/runner/prepare-artifact.d.ts +14 -1
  178. package/dist/core/runner/prepare-artifact.js +7 -2
  179. package/dist/core/runner/prepare-ask-lane.d.ts +8 -0
  180. package/dist/core/runner/prepare-ask-lane.js +14 -5
  181. package/dist/core/runner/prepare-boundary-parks.js +5 -4
  182. package/dist/core/runner/prepare-config-doors.d.ts +9 -4
  183. package/dist/core/runner/prepare-config-doors.js +25 -8
  184. package/dist/core/runner/prepare-defer-classify.d.ts +8 -4
  185. package/dist/core/runner/prepare-defer-classify.js +6 -6
  186. package/dist/core/runner/prepare-execution-env.d.ts +4 -1
  187. package/dist/core/runner/prepare-execution-env.js +8 -3
  188. package/dist/core/runner/prepare-file-history.d.ts +26 -0
  189. package/dist/core/runner/prepare-file-history.js +15 -1
  190. package/dist/core/runner/prepare-inherited-gate.d.ts +8 -3
  191. package/dist/core/runner/prepare-inherited-gate.js +9 -2
  192. package/dist/core/runner/prepare-leg-adoption.d.ts +2 -2
  193. package/dist/core/runner/prepare-park-ask.js +8 -5
  194. package/dist/core/runner/prepare-policy-chain.d.ts +5 -0
  195. package/dist/core/runner/prepare-policy-chain.js +18 -7
  196. package/dist/core/runner/prepare-prompt-assembly.d.ts +3 -0
  197. package/dist/core/runner/prepare-prompt-assembly.js +4 -3
  198. package/dist/core/runner/prepare-suspend-saga.d.ts +4 -1
  199. package/dist/core/runner/prepare-suspend-saga.js +19 -5
  200. package/dist/core/runner/prepare-task.d.ts +2 -5
  201. package/dist/core/runner/prepare-task.js +71 -26
  202. package/dist/core/runner/prepare-turn-wiring.js +7 -5
  203. package/dist/core/runner/prepare-workspace-restore.js +59 -28
  204. package/dist/core/runner/read-root-grant.d.ts +1 -0
  205. package/dist/core/runner/read-root-grant.js +1 -2
  206. package/dist/core/runner/resume-admission.d.ts +3 -0
  207. package/dist/core/runner/resume-admission.js +6 -4
  208. package/dist/core/runner/resume-apply.js +7 -5
  209. package/dist/core/runner/resume-claim.d.ts +2 -2
  210. package/dist/core/runner/resume-claim.js +4 -4
  211. package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
  212. package/dist/core/runner/resume-policy-outcome.js +6 -4
  213. package/dist/core/runner/resume-preflight.d.ts +3 -0
  214. package/dist/core/runner/resume-preflight.js +10 -3
  215. package/dist/core/runner/rewind-conversation.js +11 -4
  216. package/dist/core/runner/rewind-files.js +29 -14
  217. package/dist/core/runner/rewind-outcome.d.ts +27 -0
  218. package/dist/core/runner/rewind-outcome.js +14 -0
  219. package/dist/core/runner/run-attachment-seats.js +2 -1
  220. package/dist/core/runner/run-clock-and-content.js +2 -0
  221. package/dist/core/runner/run-identity-wiring.js +2 -0
  222. package/dist/core/runner/run-leg.js +11 -1
  223. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  224. package/dist/core/runner/run-notification-lane.js +2 -2
  225. package/dist/core/runner/run-settle-and-teardown.d.ts +4 -2
  226. package/dist/core/runner/run-settle-and-teardown.js +52 -40
  227. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  228. package/dist/core/runner/run-stop-and-final-verify.js +5 -4
  229. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  230. package/dist/core/runner/run-terminal-adoption.js +3 -3
  231. package/dist/core/runner/run-turn-boundary.js +7 -0
  232. package/dist/core/runner/runtask.d.ts +7 -4
  233. package/dist/core/runner/runtask.js +18 -9
  234. package/dist/core/runner/session-call-grant-station.d.ts +64 -0
  235. package/dist/core/runner/session-call-grant-station.js +119 -0
  236. package/dist/core/runner/session-file-state-replay.js +2 -2
  237. package/dist/core/runner/session-prompt-seats.d.ts +95 -0
  238. package/dist/core/runner/session-prompt-seats.js +62 -0
  239. package/dist/core/runner/session-rule-policy.js +1 -1
  240. package/dist/core/runner/session-write-ledger.d.ts +8 -0
  241. package/dist/core/runner/session-write-ledger.js +16 -0
  242. package/dist/core/runner/side-call-account.js +5 -1
  243. package/dist/core/runner/stop-tail-notice.d.ts +7 -0
  244. package/dist/core/runner/stop-tail-notice.js +23 -8
  245. package/dist/core/runner/stream-reap.js +4 -2
  246. package/dist/core/runner/stream-settle-backstop.d.ts +1 -1
  247. package/dist/core/runner/stream-settle-backstop.js +17 -18
  248. package/dist/core/runner/terminal-account.js +17 -8
  249. package/dist/core/runner/terminal-projection.d.ts +3 -2
  250. package/dist/core/runner/terminal-projection.js +1 -1
  251. package/dist/core/runner/tool-turn-repair-seat.d.ts +2 -2
  252. package/dist/core/runner/tool-turn-repair-seat.js +12 -7
  253. package/dist/core/runner/turn-attachments.d.ts +22 -1
  254. package/dist/core/runner/turn-attachments.js +20 -3
  255. package/dist/core/runner-deps.d.ts +6 -2
  256. package/dist/core/secret-env.d.ts +26 -6
  257. package/dist/core/secret-env.js +6 -6
  258. package/dist/core/session-call-grant-screen.d.ts +58 -0
  259. package/dist/core/session-call-grant-screen.js +18 -0
  260. package/dist/core/session-call-grant.d.ts +93 -0
  261. package/dist/core/session-call-grant.js +524 -0
  262. package/dist/core/session-checkout.d.ts +3 -0
  263. package/dist/core/session-checkout.js +8 -3
  264. package/dist/core/session-policy-store.d.ts +14 -0
  265. package/dist/core/session-policy-store.js +16 -2
  266. package/dist/core/session-store.d.ts +18 -1
  267. package/dist/core/session-store.js +20 -4
  268. package/dist/core/session.d.ts +36 -4
  269. package/dist/core/shared-artifact-reads.d.ts +93 -0
  270. package/dist/core/shared-artifact-reads.js +94 -0
  271. package/dist/core/skill-grant.js +1 -1
  272. package/dist/core/skills-directory.d.ts +9 -45
  273. package/dist/core/skills-directory.js +9 -722
  274. package/dist/core/spend-account.js +3 -0
  275. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +22 -4
  276. package/dist/core/store-contracts/checkpoint-store-contract.js +363 -29
  277. package/dist/core/store-contracts/file-history-store-contract.d.ts +11 -3
  278. package/dist/core/store-contracts/file-history-store-contract.js +62 -2
  279. package/dist/core/store-contracts/grant-fixture.d.ts +52 -0
  280. package/dist/core/store-contracts/grant-fixture.js +84 -0
  281. package/dist/core/store-contracts/session-repo-contract.js +18 -0
  282. package/dist/core/store-contracts/session-store-contract.d.ts +15 -1
  283. package/dist/core/store-contracts/session-store-contract.js +211 -2
  284. package/dist/core/store-contracts/workflow-journal-store-contract.js +47 -8
  285. package/dist/core/suspend-lane-reasons.d.ts +13 -0
  286. package/dist/core/suspend-lane-reasons.js +5 -0
  287. package/dist/core/synthetic-read-verdict.d.ts +5 -3
  288. package/dist/core/synthetic-read-verdict.js +1 -1
  289. package/dist/core/task-limits.d.ts +15 -0
  290. package/dist/core/task-notification.d.ts +33 -7
  291. package/dist/core/task-notification.js +34 -9
  292. package/dist/core/task-registry-agent.d.ts +1 -1
  293. package/dist/core/task-registry-agent.js +18 -7
  294. package/dist/core/task-registry-shared.d.ts +29 -4
  295. package/dist/core/task-registry-shared.js +7 -0
  296. package/dist/core/task-registry.d.ts +21 -1
  297. package/dist/core/task-registry.js +36 -9
  298. package/dist/core/task-result.d.ts +55 -1
  299. package/dist/core/task-spec.d.ts +17 -3
  300. package/dist/core/terminal-cause.d.ts +68 -5
  301. package/dist/core/tool-catalog-entries.js +1 -1
  302. package/dist/core/tool-check-reading.js +2 -1
  303. package/dist/core/tool-errors.js +1 -0
  304. package/dist/core/tool-list-grammar.d.ts +0 -47
  305. package/dist/core/tool-list-grammar.js +1 -75
  306. package/dist/core/tool-model-gate.d.ts +7 -11
  307. package/dist/core/tool-model-gate.js +5 -8
  308. package/dist/core/tool-name-aliases.js +2 -3
  309. package/dist/core/tool-name-readings.d.ts +4 -0
  310. package/dist/core/tool-name-readings.js +1 -0
  311. package/dist/core/tool-policy.d.ts +46 -4
  312. package/dist/core/tool-policy.js +47 -18
  313. package/dist/core/tool-result-store.d.ts +0 -24
  314. package/dist/core/tool-result-store.js +1 -36
  315. package/dist/core/tool-spec.d.ts +8 -4
  316. package/dist/core/untrusted-egress.js +2 -2
  317. package/dist/core/untrusted-text.d.ts +8 -0
  318. package/dist/core/untrusted-text.js +14 -0
  319. package/dist/core/user-attachment.d.ts +16 -1
  320. package/dist/core/user-attachment.js +42 -18
  321. package/dist/core/wiring-manifest.d.ts +4 -9
  322. package/dist/core/wiring-manifest.js +1 -1
  323. package/dist/core/workflow-journal-store.d.ts +55 -8
  324. package/dist/core/workflow-journal-store.js +34 -10
  325. package/dist/core/workflow-run-store-contract.js +56 -1
  326. package/dist/core/workflow-run-store.d.ts +43 -19
  327. package/dist/core/workflow-run-store.js +17 -2
  328. package/dist/engine/execution-env/node-execution-env.d.ts +3 -0
  329. package/dist/engine/execution-env/node-execution-env.js +4 -0
  330. package/dist/engine/harness/agent-harness.d.ts +10 -5
  331. package/dist/engine/harness/agent-harness.js +12 -4
  332. package/dist/engine/harness/types.d.ts +18 -0
  333. package/dist/engine/llm/tool-turns.d.ts +1 -1
  334. package/dist/engine/llm/types.d.ts +5 -4
  335. package/dist/engine/session/memory-repo.d.ts +15 -3
  336. package/dist/engine/session/memory-repo.js +21 -3
  337. package/dist/engine/session/memory-storage.d.ts +5 -0
  338. package/dist/engine/session/memory-storage.js +8 -3
  339. package/dist/engine/session/repo-utils.d.ts +9 -0
  340. package/dist/engine/session/repo-utils.js +14 -0
  341. package/dist/engine/session/storage-base.d.ts +20 -7
  342. package/dist/engine/session/storage-base.js +13 -1
  343. package/dist/index.d.ts +37 -19
  344. package/dist/index.js +30 -15
  345. package/dist/internal/harness.d.ts +1 -1
  346. package/dist/internal/harness.js +1 -1
  347. package/dist/orchestration/run-workflow-tool.d.ts +13 -1
  348. package/dist/orchestration/run-workflow-tool.js +101 -32
  349. package/dist/orchestration/workflow-park-adoption.d.ts +309 -92
  350. package/dist/orchestration/workflow-park-adoption.js +588 -323
  351. package/dist/orchestration/workflow-tree-id.d.ts +66 -0
  352. package/dist/orchestration/workflow-tree-id.js +66 -0
  353. package/dist/orchestration/workflow-types.d.ts +90 -11
  354. package/dist/orchestration/workflow-types.js +10 -1
  355. package/dist/orchestration/workflow.d.ts +30 -4
  356. package/dist/orchestration/workflow.js +424 -114
  357. package/dist/prompt-assembly/catalog/constitution.js +5 -1
  358. package/dist/prompt-assembly/catalog/core-behavior.d.ts +3 -4
  359. package/dist/prompt-assembly/catalog/core-behavior.js +61 -22
  360. package/dist/prompt-assembly/catalog/environment.js +2 -2
  361. package/dist/prompt-assembly/catalog/events.d.ts +16 -0
  362. package/dist/prompt-assembly/catalog/events.js +2 -0
  363. package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +72 -44
  364. package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.js +2 -2
  365. package/dist/prompt-assembly/catalog/locales/zh-Hans/events.js +2 -0
  366. package/dist/prompt-assembly/catalog/schema.d.ts +5 -1
  367. package/dist/prompt-assembly/catalog/schema.js +2 -0
  368. package/dist/prompt-assembly/catalog/sections.js +3 -14
  369. package/dist/prompt-assembly/event-registry.js +2 -0
  370. package/dist/prompt-assembly/select.js +1 -0
  371. package/dist/prompt-assembly/tool-catalog.d.ts +10 -7
  372. package/dist/prompt-assembly/tool-catalog.js +21 -7
  373. package/dist/prompt-assembly/types.d.ts +3 -0
  374. package/dist/prompts/default.d.ts +4 -1
  375. package/dist/prompts/default.js +6 -0
  376. package/dist/stores/file/checkpoint-store.d.ts +11 -10
  377. package/dist/stores/file/checkpoint-store.js +36 -10
  378. package/dist/stores/file/file-history-store.d.ts +6 -0
  379. package/dist/stores/file/file-history-store.js +21 -4
  380. package/dist/stores/file/fs-atomic.d.ts +1 -1
  381. package/dist/stores/file/index.d.ts +14 -4
  382. package/dist/stores/file/index.js +21 -5
  383. package/dist/stores/file/process-anchor.d.ts +9 -1
  384. package/dist/stores/file/session-policy-store.js +2 -17
  385. package/dist/stores/file/session-store.d.ts +27 -0
  386. package/dist/stores/file/session-store.js +81 -9
  387. package/dist/stores/file/workflow-journal-store.d.ts +14 -4
  388. package/dist/stores/file/workflow-journal-store.js +32 -24
  389. package/dist/stores/file/workflow-run-store.d.ts +15 -4
  390. package/dist/stores/file/workflow-run-store.js +76 -0
  391. package/dist/tools/artifact/artifact-tool.d.ts +10 -3
  392. package/dist/tools/artifact/artifact-tool.js +16 -1
  393. package/dist/tools/fs/bash-program-position.d.ts +10 -4
  394. package/dist/tools/fs/bash-program-position.js +11 -8
  395. package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -1
  396. package/dist/tools/fs/bash-readonly-classifier.js +9 -2
  397. package/dist/tools/fs/find-actions.d.ts +30 -16
  398. package/dist/tools/fs/find-actions.js +272 -19
  399. package/dist/tools/fs/fs-bash.js +8 -5
  400. package/dist/tools/fs/fs-shared.d.ts +0 -29
  401. package/dist/tools/fs/fs-shared.js +0 -5
  402. package/dist/tools/fs/fs-write.js +2 -1
  403. package/dist/tools/fs/read-deny.d.ts +6 -1
  404. package/dist/tools/fs/read-deny.js +6 -1
  405. package/dist/tools/fs/read-floor.d.ts +6 -0
  406. package/dist/tools/fs/read-floor.js +5 -1
  407. package/dist/tools/fs/removal-actions.d.ts +43 -0
  408. package/dist/tools/fs/removal-actions.js +25 -0
  409. package/dist/tools/fs/removal-targets.d.ts +2 -21
  410. package/dist/tools/fs/removal-targets.js +2 -3
  411. package/dist/tools/fs/safety.d.ts +37 -1
  412. package/dist/tools/fs/safety.js +52 -0
  413. package/dist/tools/fs/shell-climb.d.ts +46 -0
  414. package/dist/tools/fs/shell-climb.js +79 -0
  415. package/dist/tools/fs/shell-read-check.js +47 -19
  416. package/dist/tools/fs/shell-read-establish.js +36 -22
  417. package/dist/tools/fs/shell-read-judge.d.ts +10 -2
  418. package/dist/tools/fs/shell-read-judge.js +4 -4
  419. package/dist/tools/fs/shell-read-plan.d.ts +3 -0
  420. package/dist/tools/fs/shell-read-plan.js +1 -1
  421. package/dist/tools/fs/shell-read-workdir.js +3 -2
  422. package/dist/tools/fs/shell-read-write-targets.d.ts +4 -3
  423. package/dist/tools/fs/shell-read-write-targets.js +3 -0
  424. package/package.json +2 -2
  425. package/test/export-surface.snapshot.json +169 -15
  426. package/wire-changes/core-stores-sql@7.71.0.json +40 -0
  427. package/wire-changes/core@7.71.0.json +5827 -0
  428. package/wire-changes/mods-kernel@7.71.0.json +52 -0
  429. package/wire-changes/primitives@7.71.0.json +473 -0
  430. package/wire-changes/wiki-gate@7.71.0.json +40 -0
  431. package/dist/core/frontmatter-fence.d.ts +0 -10
  432. package/dist/core/frontmatter-fence.js +0 -6
  433. package/dist/core/permission-rule-syntax.d.ts +0 -46
  434. package/dist/core/permission-rule-syntax.js +0 -52
@@ -39,13 +39,56 @@ export type SessionMetaKeyReading = {
39
39
  * key is the declaration's own text, shown in the one caller's-text shape (`callerText`: the redaction mark and its length).
40
40
  */
41
41
  export declare function judgeSessionMetaKey(value: unknown): SessionMetaKeyReading;
42
+ /** The `_meta` key carrying the calling leg's identity ({@link McpCaller}) to a server that declares `callerMeta: true`. */
43
+ export declare const MCP_CALLER_META_KEY = "sema/caller";
44
+ /**
45
+ * Who is calling: the identity facts of the leg a request is sent for, every one a value the engine already mints for the leg's own
46
+ * frames (none is minted for this record). Frozen, no prototype.
47
+ * - `taskId` — the leg's task id, minted once at prepare (`legTaskIdOf`): the value `TaskResult.taskId` and `task_progress.taskId` carry,
48
+ * whatever that reading answers on this run (the leg's registry row id, else the host's task id, else the leg's session id).
49
+ * - `runId` — this invocation of the engine (`Prepared.runId`): new on every run, a resume included.
50
+ * - `rootSessionId` — the delegation tree's root session (`rootAnchorOf`): the leg's own session on a top-level leg.
51
+ * - `parentTaskId` — the spawning leg's task id (`RunInternals.parentTaskId`, the value `task_progress.parentTaskId` carries); absent on a
52
+ * leg nobody spawned under a known task.
53
+ * Built once per leg and run, at prepare: every call and fetch of that run carries the same record. No principal, path, model or display
54
+ * name rides it. Session ids do: `taskId` is the leg's own session id wherever that is its task id (a foreground child, a workflow member
55
+ * or a top-level leg handed no task id), and `rootSessionId` is the tree root's session — independent of `sessionMetaKey`.
56
+ */
57
+ export type McpCaller = Readonly<{
58
+ taskId: string;
59
+ runId: string;
60
+ rootSessionId: string;
61
+ parentTaskId?: string;
62
+ }>;
63
+ /** The one construction of a leg's {@link McpCaller}: the frozen record, `parentTaskId` only when it is a non-empty string. */
64
+ export declare function mcpCaller(facts: {
65
+ readonly taskId: string;
66
+ readonly runId: string;
67
+ readonly rootSessionId: string;
68
+ readonly parentTaskId?: string | undefined;
69
+ }): McpCaller;
70
+ /** A judged `callerMeta` declaration: whether the caller rides, or why the value cannot be read. */
71
+ export type CallerMetaReading = {
72
+ readonly send: boolean;
73
+ } | {
74
+ readonly problem: string;
75
+ };
76
+ /**
77
+ * The one judge of a declared `callerMeta` ({@link import("./mcp-server-spec.js").McpServerSpec.callerMeta}): `true` sends the caller,
78
+ * `false` and absent send nothing; any other value (a string such as `"true"`, a number such as `1`, `null`, an object) is not read as
79
+ * either — it is refused, so a deployment never believes a server is told who calls while it is not, or the reverse.
80
+ */
81
+ export declare function judgeCallerMeta(value: unknown): CallerMetaReading;
42
82
  /**
43
83
  * The `_meta` of one request the engine sends a server — a `tools/call` (the executing call's id, when it has one, and the request meta,
44
- * when there is one: the judge answers none for a record with no member, so whatever it hands here rides) or a `resources/read` (neither) —
45
- * and, when the server declared a session key, the leg's own session id under it. THE one mint: the key was judged where the declaration
46
- * was ({@link judgeSessionMetaKey}), so it never lands on another member; no session id (a dial with no leg) rides nothing.
84
+ * when there is one: the judge answers none for a record with no member, so whatever it hands here rides) or a fetch (`resources/read`,
85
+ * `prompts/get`: neither) —
86
+ * and, when the server declared a session key, the leg's own session id under it; when the server declared `callerMeta: true`, the leg's
87
+ * caller ({@link McpCaller}) under {@link MCP_CALLER_META_KEY} (the caller is passed here only then). THE one mint: the key was judged where
88
+ * the declaration was ({@link judgeSessionMetaKey}), so it never lands on another member — nor on the caller's, which is under `sema/`; no
89
+ * session id or caller (a dial with no leg) rides nothing.
47
90
  */
48
- export declare function mcpCallMeta(toolUseId: string | undefined, requestMeta: McpRequestMeta | undefined, sessionMetaKey?: string, sessionId?: string): Record<string, unknown> | undefined;
91
+ export declare function mcpCallMeta(toolUseId: string | undefined, requestMeta: McpRequestMeta | undefined, sessionMetaKey?: string, sessionId?: string, caller?: McpCaller): Record<string, unknown> | undefined;
49
92
  /**
50
93
  * The carrier from a call's `tool.call` chain bottom to the MCP tool's `execute`, one per leg. A tool's `execute` takes the call id
51
94
  * and no per-call context, so the request meta rides the body's own async chain: {@link McpRequestMetaSeat.of} answers it only to
@@ -60,7 +103,9 @@ export interface McpRequestMetaSeat {
60
103
  of(toolCallId: string): McpRequestMeta | undefined;
61
104
  /** The leg's own session id: what a server that declared a session key is sent ({@link mcpCallMeta}). Absent for a seat made without one. */
62
105
  readonly sessionId?: string;
106
+ /** The leg's caller: what a server that declared `callerMeta: true` is sent ({@link mcpCallMeta}). Absent for a seat made without one. */
107
+ readonly caller?: McpCaller;
63
108
  }
64
- /** What the MCP materialization reads of its leg's seat: the request meta standing for a call, and the leg's session id. */
65
- export type McpLegMetaReader = Pick<McpRequestMetaSeat, "of" | "sessionId">;
66
- export declare function createMcpRequestMetaSeat(sessionId?: string): McpRequestMetaSeat;
109
+ /** What the MCP materialization reads of its leg's seat: the request meta standing for a call, the leg's session id and its caller. */
110
+ export type McpLegMetaReader = Pick<McpRequestMetaSeat, "of" | "sessionId" | "caller">;
111
+ export declare function createMcpRequestMetaSeat(sessionId?: string, caller?: McpCaller): McpRequestMetaSeat;
@@ -72,19 +72,38 @@ export function judgeSessionMetaKey(value) {
72
72
  return { problem: `sessionMetaKey ${callerText(value)} is under a prefix MCP reserves (second label "${second}")` };
73
73
  return { key: value };
74
74
  }
75
- export function mcpCallMeta(toolUseId, requestMeta, sessionMetaKey, sessionId) {
75
+ export const MCP_CALLER_META_KEY = "sema/caller";
76
+ export function mcpCaller(facts) {
77
+ const caller = Object.create(null);
78
+ caller["taskId"] = facts.taskId;
79
+ caller["runId"] = facts.runId;
80
+ caller["rootSessionId"] = facts.rootSessionId;
81
+ if (typeof facts.parentTaskId === "string" && facts.parentTaskId !== "")
82
+ caller["parentTaskId"] = facts.parentTaskId;
83
+ return Object.freeze(caller);
84
+ }
85
+ export function judgeCallerMeta(value) {
86
+ if (value === undefined || value === false)
87
+ return { send: false };
88
+ if (value === true)
89
+ return { send: true };
90
+ return { problem: `callerMeta is ${dataKind(value)}; it takes true or false` };
91
+ }
92
+ export function mcpCallMeta(toolUseId, requestMeta, sessionMetaKey, sessionId, caller) {
76
93
  const meta = {
77
94
  ...(typeof toolUseId === "string" && toolUseId !== "" ? { [MCP_TOOL_USE_ID_META_KEY]: toolUseId } : {}),
78
95
  ...(requestMeta !== undefined ? { [MCP_REQUEST_META_KEY]: requestMeta } : {}),
96
+ ...(caller !== undefined ? { [MCP_CALLER_META_KEY]: caller } : {}),
79
97
  ...(sessionMetaKey !== undefined && typeof sessionId === "string" && sessionId !== "" ? { [sessionMetaKey]: sessionId } : {}),
80
98
  };
81
99
  return Object.keys(meta).length === 0 ? undefined : meta;
82
100
  }
83
101
  const store = new AsyncLocalStorage();
84
- export function createMcpRequestMetaSeat(sessionId) {
102
+ export function createMcpRequestMetaSeat(sessionId, caller) {
85
103
  const seat = {};
86
104
  return {
87
105
  sessionId,
106
+ ...(caller !== undefined ? { caller } : {}),
88
107
  async hold(toolCallId, meta, body) {
89
108
  const held = { seat, toolCallId, meta, live: true };
90
109
  try {
@@ -174,7 +174,7 @@ export interface McpReadRoute {
174
174
  readonly transportKind: "stdio" | "http";
175
175
  /** The header values this server's requests carry: its failure texts are read without them. */
176
176
  readonly declared: readonly string[];
177
- /** The `_meta` a fetch (`resources/read`, `prompts/get`) carries — the one mint's: the leg's session id under the declared key, or none. */
177
+ /** The `_meta` a fetch (`resources/read`, `prompts/get`) carries — the one mint's: the leg's session id under the declared key and the leg's caller where the server declared `callerMeta`, or none. */
178
178
  readonly meta: () => Record<string, unknown> | undefined;
179
179
  /** How this connection's account of itself is read: without its credentials, a site that held one announced. */
180
180
  readonly echo: CredentialEcho;
@@ -208,6 +208,24 @@ export interface McpServerSpec {
208
208
  * has no session, so nothing rides.
209
209
  */
210
210
  sessionMetaKey?: string;
211
+ /**
212
+ * Opt in to WHO IS CALLING on this server's requests: with `true`, every `tools/call`, `resources/read` and `prompts/get` the engine
213
+ * sends this server for a leg carries `params._meta["sema/caller"]` = `{ taskId, runId, rootSessionId, parentTaskId? }`
214
+ * ({@link import("./mcp-call-meta.js").McpCaller}) — the leg's task id (the value `TaskResult.taskId` and `task_progress.taskId` carry
215
+ * on that run), this run's id (new on every run), the delegation tree's root session (the leg's own on a top-level leg) and, on a leg
216
+ * spawned under a known task, the spawner's task id (`task_progress.parentTaskId`). One record per leg and run, built at its prepare, so
217
+ * every call and fetch of the run — every attempt of one call included — carries the same; two legs on one pooled connection each send
218
+ * their own. No principal, path or model rides it. Session ids do, with or without {@link sessionMetaKey}: `taskId` is the leg's own
219
+ * session id wherever that is its task id (a foreground child, a workflow member or a top-level leg handed no `taskId`), and
220
+ * `rootSessionId` is the tree root's session (a top-level leg's own) — a deployment that must not let a server learn any session id does
221
+ * not declare this for it. Absent or `false` ⇒ nothing is sent.
222
+ *
223
+ * Judged once by {@link import("./mcp-call-meta.js").judgeCallerMeta} where the declaration is judged (the preparation door and
224
+ * `materializeMcpTools`): any value other than `true` / `false` (a string, a number, `null`, an object) refuses the entry with
225
+ * `config.invalid_argument` — never read as either. A dial with no leg (the library entrance, the no-run probe) has no caller, so
226
+ * nothing rides there.
227
+ */
228
+ callerMeta?: boolean;
211
229
  }
212
230
  /** The transport kinds a declaration names, one list: the dial reads a kind against it, so a word outside it is no kind at all. */
213
231
  export declare const MCP_TRANSPORT_KINDS: readonly ["stdio", "http", "host"];
@@ -72,6 +72,7 @@ const DECLARATION_ENTRY_MEMBERS = {
72
72
  fingerprint: true,
73
73
  startupTimeoutMs: true,
74
74
  sessionMetaKey: true,
75
+ callerMeta: true,
75
76
  kind: true,
76
77
  command: true,
77
78
  args: true,
package/dist/core/mcp.js CHANGED
@@ -1783,7 +1783,7 @@ async function connectServer(spec, principal, onElicit, binarySeat, reminderDisc
1783
1783
  const { serverTools, serverAxes, gates, definitions, dropped, advisories } = intakeListedTools({ tools: [...answered.view], unproven: answered.unproven }, spec, dialOpts.link, declared, outputSchemaValidatorOf(client), binarySeat, reminderDisclosure, through, transportKind, seat, echo, onSubtreeActivity);
1784
1784
  const caps = client.getServerCapabilities();
1785
1785
  const resourceInfo = caps?.resources ? { listAllowed: faceAllowed(spec.allowTools, MCP_RESOURCE_LIST_ALLOW), readAllowed: faceAllowed(spec.allowTools, MCP_RESOURCE_READ_ALLOW) } : undefined;
1786
- const route = { server: spec.name, client, through, health, transportKind: idleKindOf(transportKind), declared, meta: () => mcpCallMeta(undefined, undefined, spec.sessionMetaKey, seat?.sessionId), echo };
1786
+ const route = { server: spec.name, client, through, health, transportKind: idleKindOf(transportKind), declared, meta: () => mcpCallMeta(undefined, undefined, spec.sessionMetaKey, seat?.sessionId, spec.callerMeta === true ? seat?.caller : undefined), echo };
1787
1787
  const rawInstructions = erasedEcho(client.getInstructions(), echo, "instructions");
1788
1788
  const sanitized = rawInstructions && rawInstructions.trim() ? sanitizeUntrustedText(rawInstructions.trim()) : undefined;
1789
1789
  const disposed = sanitized === undefined ? undefined : await disposeSectionEntry(dialOpts?.sections, { section: "core/discovery.mcp-instructions", server: spec.name, text: sanitized, mountedTools: serverTools.map((t) => t.name) });
@@ -1926,7 +1926,7 @@ function intakeListedTools(listed, spec, link, declared, validator, binarySeat,
1926
1926
  }
1927
1927
  const timeoutMs = mcpToolTimeoutMs();
1928
1928
  const idleMs = mcpIdleTimeoutMs(idleKindOf(transportKind));
1929
- const callMeta = mcpCallMeta(toolCallId, seat?.of(toolCallId), spec.sessionMetaKey, seat?.sessionId);
1929
+ const callMeta = mcpCallMeta(toolCallId, seat?.of(toolCallId), spec.sessionMetaKey, seat?.sessionId, spec.callerMeta === true ? seat?.caller : undefined);
1930
1930
  let answeredWith = declared;
1931
1931
  const attempt = async (conn, resent, last) => {
1932
1932
  const definition = conn.definitions().get(namespacedName);
@@ -46,6 +46,18 @@ export declare function isMemberOutcomeWord(v: unknown): v is MemberOutcomeWord;
46
46
  /** What kind of member a row is. Grows by a word when a new holder mints rows (a peer task, a nested workflow). */
47
47
  export declare const MEMBER_KINDS: readonly ["workflow_member", "subagent", "background_agent"];
48
48
  export type MemberKind = (typeof MEMBER_KINDS)[number];
49
+ /**
50
+ * What ended the run whose end stopped a member (the closed set of {@link MemberOutcome.runEnd}`.cause`). The five stop words are the
51
+ * axes `task.interrupt_unconsumed` names in its `origin` — one vocabulary for "what stopped the run", read by one function:
52
+ * - `turn_end` — the run ended on its own (its last turn ended; its terminal says how it went), no stop or ceiling ended it;
53
+ * - `one_shot_ceiling` — a one-shot ending stopped waiting at its ceiling (`task.wait_ceiling_reached`);
54
+ * - `interrupt` — a person's stop (the interrupt verb, or a halt the run consumed — the one `haltedByUser` signs); `walltime` — the run's walltime window; `turns` — its turn cap; `budget` — its budget gate;
55
+ * `signal` — every other run-level abort (the task's own `signal`, a parent's cancel, a `destroy()`).
56
+ */
57
+ export declare const RUN_END_CAUSES: readonly ["turn_end", "one_shot_ceiling", "interrupt", "walltime", "turns", "budget", "signal"];
58
+ export type RunEndCause = (typeof RUN_END_CAUSES)[number];
59
+ /** Membership test for {@link RunEndCause}. */
60
+ export declare function isRunEndCause(v: unknown): v is RunEndCause;
49
61
  /** The run-level reading over its rows ({@link memberCoverageOf}). */
50
62
  export declare const MEMBER_COVERAGES: readonly ["complete", "partial", "incomplete"];
51
63
  export type MemberCoverage = (typeof MEMBER_COVERAGES)[number];
@@ -93,6 +105,13 @@ export interface MemberOutcome {
93
105
  readonly code?: string;
94
106
  /** `killed` only, when the holder knows who stopped the member (the task registry's stop source). */
95
107
  readonly stoppedBy?: string;
108
+ /** `killed` only, when the member was stopped by the END of the run that holds it (the run-end sweep of that run's task-scoped
109
+ * background agents): what ended that run. Absent on every other ending — a member stopped by anyone else, one that ended on its own,
110
+ * and one a parking leg's yield stopped before its teardown (a park is not the run's end). Being on an ending, it is always the
111
+ * "stopped with the run" fate. */
112
+ readonly runEnd?: {
113
+ readonly cause: RunEndCause;
114
+ };
96
115
  /** Where the member's ending came from: this run (`live`), or a journal a resume served it from (`replayed`). An origin, not an
97
116
  * ending — a replayed member carries the ending it was recorded with. */
98
117
  readonly provenance: "live" | "replayed";
@@ -182,6 +201,7 @@ export type MemberFacts = {
182
201
  readonly status: BackgroundAgentSettledStatus;
183
202
  readonly code?: string;
184
203
  readonly stoppedBy?: string;
204
+ readonly runEnd?: MemberOutcome["runEnd"];
185
205
  };
186
206
  readonly parked?: boolean;
187
207
  } | {
@@ -192,6 +212,7 @@ export type MemberFacts = {
192
212
  readonly status: "failed" | "killed" | "cancelled" | "completed" | "parked";
193
213
  readonly code?: string;
194
214
  readonly stoppedBy?: string;
215
+ readonly runEnd?: MemberOutcome["runEnd"];
195
216
  readonly refused?: MemberRefusals;
196
217
  };
197
218
  /** The ONE mint of a member's outcome. `kind` / `provenance` are the holder's. The outcome comes back sealed ({@link sealMemberOutcome}). */
@@ -201,7 +222,7 @@ export declare function memberOutcomeOf(kind: MemberKind, provenance: "live" | "
201
222
  * status and code, the row's stop attribution, and the leg's result when the settle brought one. A frame whose row is gone (or a
202
223
  * settle that won nothing of its own) mints the same way over the status it speaks — the one function, never a second reading.
203
224
  */
204
- export declare function backgroundAgentOutcomeOf(status: BackgroundAgentSettledStatus, errorCode: string | undefined, stoppedBy: string | undefined, leg: TaskResult | undefined): MemberOutcome;
225
+ export declare function backgroundAgentOutcomeOf(status: BackgroundAgentSettledStatus, errorCode: string | undefined, stoppedBy: string | undefined, leg: TaskResult | undefined, runEnd?: MemberOutcome["runEnd"]): MemberOutcome;
205
226
  /** The report-card lines a member's refusals read as (a foreground child's card, a fork's card): `refused_asks:` (the asks nobody
206
227
  * could answer — the line that always carried them) and `refused:` (everything else); none when nothing was refused. */
207
228
  export declare function memberRefusalLines(o: Pick<MemberOutcome, "refused"> | undefined): string[];
@@ -1,4 +1,5 @@
1
1
  import { ASK_UNRESOLVABLE_CAUSE_WORDS, isAskUnresolvableCause } from "./ask-unresolvable-notice.js";
2
+ import { isSuspendLaneReason } from "./suspend-lane-reasons.js";
2
3
  import { inlineUntrusted } from "./untrusted-text.js";
3
4
  export const MEMBER_OUTCOMES = Object.freeze(["completed", "failed", "schema_unmet", "budget_refused", "parked", "blocked", "killed", "cancelled"]);
4
5
  const MEMBER_OUTCOME_SET = new Set(MEMBER_OUTCOMES);
@@ -6,6 +7,11 @@ export function isMemberOutcomeWord(v) {
6
7
  return MEMBER_OUTCOME_SET.has(v);
7
8
  }
8
9
  export const MEMBER_KINDS = Object.freeze(["workflow_member", "subagent", "background_agent"]);
10
+ export const RUN_END_CAUSES = Object.freeze(["turn_end", "one_shot_ceiling", "interrupt", "walltime", "turns", "budget", "signal"]);
11
+ const RUN_END_CAUSE_SET = new Set(RUN_END_CAUSES);
12
+ export function isRunEndCause(v) {
13
+ return RUN_END_CAUSE_SET.has(v);
14
+ }
9
15
  export const MEMBER_COVERAGES = Object.freeze(["complete", "partial", "incomplete"]);
10
16
  const MEMBER_COVERAGE_SET = new Set(MEMBER_COVERAGES);
11
17
  export function isMemberCoverage(v) {
@@ -19,6 +25,9 @@ export function isMemberOutcome(v) {
19
25
  return false;
20
26
  if (!isOptionalString(v["code"]) || !isOptionalString(v["stoppedBy"]))
21
27
  return false;
28
+ const runEnd = v["runEnd"];
29
+ if (runEnd !== undefined && !(v["outcome"] === "killed" && isPlainRecord(runEnd) && isRunEndCause(runEnd["cause"])))
30
+ return false;
22
31
  const r = v["refused"];
23
32
  if (r === undefined)
24
33
  return true;
@@ -51,7 +60,7 @@ function isRefusedCallEntry(e) {
51
60
  return isPlainRecord(e) && typeof e["toolName"] === "string" && typeof e["toolCallId"] === "string";
52
61
  }
53
62
  export function isRefusedAsk(e) {
54
- return isRefusedCallEntry(e) && isPlainRecord(e) && isAskUnresolvableCause(e["cause"]) && isOptionalString(e["remedy"]) && isOptionalString(e["modelRemedy"]);
63
+ return isRefusedCallEntry(e) && isPlainRecord(e) && isAskUnresolvableCause(e["cause"]) && isOptionalString(e["remedy"]) && isOptionalString(e["modelRemedy"]) && (e["parkFailed"] === undefined || (typeof e["parkFailed"] === "string" && e["parkFailed"].length > 0)) && (e["parkFailedReason"] === undefined || (typeof e["parkFailed"] === "string" && e["parkFailed"].length > 0 && isSuspendLaneReason(e["parkFailedReason"])));
55
64
  }
56
65
  export function isRefusedAskList(v) {
57
66
  return Array.isArray(v) && v.length > 0 && v.every(isRefusedAsk);
@@ -122,6 +131,7 @@ function mintMemberOutcome(kind, provenance, facts) {
122
131
  outcome: facts.status,
123
132
  ...(facts.status === "failed" && facts.code !== undefined ? { code: facts.code } : {}),
124
133
  ...(facts.status === "killed" && facts.stoppedBy !== undefined ? { stoppedBy: facts.stoppedBy } : {}),
134
+ ...(facts.status === "killed" && facts.runEnd !== undefined ? { runEnd: facts.runEnd } : {}),
125
135
  ...(facts.refused !== undefined ? { refused: facts.refused } : {}),
126
136
  };
127
137
  }
@@ -129,7 +139,7 @@ function mintMemberOutcome(kind, provenance, facts) {
129
139
  const refused = memberRefusalsOf(result);
130
140
  const withRefused = refused !== undefined ? { refused } : {};
131
141
  if (settled?.status === "killed")
132
- return { ...base, outcome: "killed", ...(settled.stoppedBy !== undefined ? { stoppedBy: settled.stoppedBy } : {}), ...withRefused };
142
+ return { ...base, outcome: "killed", ...(settled.stoppedBy !== undefined ? { stoppedBy: settled.stoppedBy } : {}), ...(settled.runEnd !== undefined ? { runEnd: settled.runEnd } : {}), ...withRefused };
133
143
  const t = result.terminal;
134
144
  switch (t.kind) {
135
145
  case "completed":
@@ -148,10 +158,11 @@ function mintMemberOutcome(kind, provenance, facts) {
148
158
  return { ...base, outcome: "parked", ...withRefused };
149
159
  }
150
160
  }
151
- export function backgroundAgentOutcomeOf(status, errorCode, stoppedBy, leg) {
161
+ export function backgroundAgentOutcomeOf(status, errorCode, stoppedBy, leg, runEnd) {
162
+ const stop = { ...(stoppedBy !== undefined ? { stoppedBy } : {}), ...(runEnd !== undefined ? { runEnd } : {}) };
152
163
  return memberOutcomeOf("background_agent", "live", leg !== undefined
153
- ? { from: "result", result: leg, settled: { status, ...(errorCode !== undefined ? { code: errorCode } : {}), ...(stoppedBy !== undefined ? { stoppedBy } : {}) }, parked: false }
154
- : { from: "ended", status, ...(errorCode !== undefined ? { code: errorCode } : {}), ...(stoppedBy !== undefined ? { stoppedBy } : {}) });
164
+ ? { from: "result", result: leg, settled: { status, ...(errorCode !== undefined ? { code: errorCode } : {}), ...stop }, parked: false }
165
+ : { from: "ended", status, ...(errorCode !== undefined ? { code: errorCode } : {}), ...stop });
155
166
  }
156
167
  export function memberRefusalLines(o) {
157
168
  const faces = memberRefusalFaces(o);
@@ -227,7 +238,8 @@ export function refusedAsksText(refused, unlisted = 0) {
227
238
  const one = total === 1;
228
239
  const items = refused.length === 0 ? "" : ` — ${refused.map((r) => `${inlineUntrusted(r.toolName, 80)} (${ASK_UNRESOLVABLE_CAUSE_WORDS[r.cause]})`).join(", ")}${unlisted > 0 ? `, and ${unlisted} more` : ""}`;
229
240
  const remedies = [...new Set(refused.flatMap((r) => { const w = r.modelRemedy ?? r.remedy; return w !== undefined ? [w] : []; }))];
230
- return `${total}${items}: nobody could answer ${one ? "it" : "them"}, so ${one ? "it was" : "they were"} refused and did not run${remedies.length > 0 ? `; to go on: ${remedies.join(" / ")}` : ""}`;
241
+ const why = refused.length === 0 ? `nobody could answer ${one ? "it" : "them"}, so ` : "";
242
+ return `${total}${items}: ${why}${one ? "it was" : "they were"} refused and did not run${remedies.length > 0 ? `; to go on: ${remedies.join(" / ")}` : ""}`;
231
243
  }
232
244
  export function memberRefusalFaces(o) {
233
245
  const r = o?.refused;
@@ -91,7 +91,7 @@ export async function resolveSettlementRecord(docs, input) {
91
91
  const eventId = `admin:${input.requestId}:${input.settleId}:${input.to}`;
92
92
  await docs.updateDoc("settlements", coerceSettlement, (rec) => {
93
93
  if (!rec.rows.some((r) => r.settleId === input.settleId)) {
94
- const e = new Error(`resolveSettlement: unknown settleId ${JSON.stringify(input.settleId)}`);
94
+ const e = new Error(`This settlement resolution is refused: unknown settleId ${JSON.stringify(input.settleId)}`);
95
95
  e.code = "memory.settlement_resolve_unknown";
96
96
  throw e;
97
97
  }
@@ -559,7 +559,7 @@ export async function resolveSessionAccountRecord(docs, input) {
559
559
  const rec = sessionAccountsV2(read);
560
560
  const row = rec.rows.find((r) => r.sessionId === input.sessionId);
561
561
  if (row === undefined) {
562
- const e = new Error(`resolveSessionAccount: unknown sessionId ${JSON.stringify(input.sessionId)}`);
562
+ const e = new Error(`This session account resolution is refused: unknown sessionId ${JSON.stringify(input.sessionId)}`);
563
563
  e.code = "memory.session_account_resolve_unknown";
564
564
  throw e;
565
565
  }
@@ -1163,19 +1163,19 @@ export async function resolveHoldRecord(docs, input) {
1163
1163
  await docs.updateDoc("holds", coerceHolds, (rec) => {
1164
1164
  const r = rec.rows.find((x) => x.holdId === input.holdId);
1165
1165
  if (r === undefined) {
1166
- const e = new Error(`resolveHold: unknown holdId ${JSON.stringify(input.holdId)}`);
1166
+ const e = new Error(`This hold resolution is refused: unknown holdId ${JSON.stringify(input.holdId)}`);
1167
1167
  e.code = "memory.hold_resolve_unknown";
1168
1168
  throw e;
1169
1169
  }
1170
1170
  if (r.status !== "held" && !(r.status === "disposed" && r.disposition?.terminal === "expired" && input.action === "release")) {
1171
- const e = new Error(`resolveHold: hold ${JSON.stringify(input.holdId)} is ${r.status}${r.disposition !== undefined ? ` (${r.disposition.terminal})` : ""} — only a held row, or an expired disposition (release), can be resolved`);
1171
+ const e = new Error(`This hold resolution is refused: hold ${JSON.stringify(input.holdId)} is ${r.status}${r.disposition !== undefined ? ` (${r.disposition.terminal})` : ""} — only a held row, or an expired disposition (release), can be resolved`);
1172
1172
  e.code = "memory.hold_resolve_invalid_state";
1173
1173
  throw e;
1174
1174
  }
1175
1175
  r.resolved = input.action;
1176
1176
  const nextGeneration = Math.max(input.now(), 0, (r.resolvedAt ?? 0) + 1);
1177
1177
  if (!Number.isSafeInteger(nextGeneration) || nextGeneration < 0 || nextGeneration >= 2 ** 50) {
1178
- const e = new Error(`resolveHold: hold ${JSON.stringify(input.holdId)} cannot mint a fresh verdict generation (${String(nextGeneration)} — an exhausted window, a deranged clock, or a corrupt ledger row) — refused, never written.`);
1178
+ const e = new Error(`This hold resolution is refused: hold ${JSON.stringify(input.holdId)} cannot mint a fresh verdict generation (${String(nextGeneration)} — an exhausted window, a deranged clock, or a corrupt ledger row) — refused, never written.`);
1179
1179
  e.code = "memory.hold_resolve_invalid_state";
1180
1180
  throw e;
1181
1181
  }
@@ -25,7 +25,7 @@ import { sessionWriteHomeOf } from "./session-write-home.js";
25
25
  import { landedUndecided, layerDigest, layerObservationLookup, readOnlyLayerCandidates, readOnlyLayerCensus, recordLayerObservations, retireLayerObservations, settleUndecidedLayerObservations, observationBacked, sameObservation, undecidedLayerObservations } from "./layer-observations.js";
26
26
  import { clearanceCustodyErased, eraseOriginClearanceCustody, markOriginClearanceTombstoned, openOriginClearance, readClearanceErasureCount, readOriginClearances, settleOriginClearance } from "./origin-clearance.js";
27
27
  import { carriesEntry, standsAsLink } from "./entry-scan.js";
28
- import { DEFAULT_MAX_ENTRY_DEPTH, MEMORY_INDEX_FILENAME, captureErasureInput, erasureRequestInvalid, erasureScopeRefusal, erasureSelectHash, erasureStatusOf, sweepUnderErasureRecord, scanEntryFiles, } from "./file-backend.js";
28
+ import { DEFAULT_MAX_ENTRY_DEPTH, MEMORY_INDEX_FILENAME, captureErasureInput, ERASURE_REFUSED, MEMORY_IMPORT_REFUSED, erasureRequestInvalid, erasureScopeRefusal, erasureSelectHash, erasureStatusOf, sweepUnderErasureRecord, scanEntryFiles, } from "./file-backend.js";
29
29
  import { assembleMemoryExportBundle, canonicalExpectedScopes, computeMemoryBundleHash, expectedScopesInvalid, firstOutsideExpectedScopes, memoryBundleInvalid, } from "./export-bundle.js";
30
30
  import { SCAN_FUSE_THRESHOLD, captureIntoQuarantine, clearContainedPath, eraseQuarantineCopies, keepCopiesBeforeOverwrite, quarantineObjectNameOf, restoreContainedBaseline, mintStagingName, indexLineIsStale, indexLineHoldsText, readIndexRevs, writeIndexRevs, bumpScanFuse, scanFuseKey, canonicalize, anchorStoreRoot, landingPathOf, landsOutsideStore, storeActRefusal, storeRootReanchoredRefusal, adoptRootScopeLayout, clearScanFuse, effectiveControlRootOf, directoryPinOf, captureRecordsExpectingStore, refuseAbsentStore, storeAbsence, sayAnnounceFailure, drainMemoryAnnouncements, enqueueMemoryAnnouncement, ensureControlPlaneDir, ensureDirExists, markSessionPolluted, readSessionPollution, recordRetrievedAccount, writeFileNoFollow, writeFileNoReplace, putBackOverNothingOrBlank, withPermissionRemedy, permissionRemedyOf, readRetrievedAccount, registerScope, registeredScopes, scopeDirFor, appendChallengeEvents, appendLineageAudit, rebuildStrictControlPlaneLedger, isStrictControlPlaneLedgerCorrupt, ControlPlaneCorruptError, CHALLENGE_LEDGER_MAX_EVENTS, adjudicateLineagePending, challengedEntryIds, clearLineageForEntries, discardLineagePending, lineageAccountOfEntry, lineageContributionsOfSession, lineageLatchedIds, promoteLineagePending, readChallengeEvents, readChallengedHistory, readLineageRecord, recordChallengedHistory, recordLineageCredential, reconcileLineage, readProjectionDebts, resolveChallengeEvent, settleProjectionDebts, readProjectionLedger, updateProjectionLedger, stageLineagePending, stageProjectionDebts, sessionRecordBindsIncarnation, usableSessionIncarnation, controlPlaneStraysRefusal, } from "./layout.js";
31
31
  import { createSessionIncarnationSeat, recalledForAnyIdentity, recalledForIdentity, rememberForIdentity } from "./session-incarnation.js";
@@ -1324,13 +1324,13 @@ export class MemoryEngine {
1324
1324
  }
1325
1325
  async rebuildCorruptControlPlaneLedger(ledger, reason) {
1326
1326
  if (typeof reason !== "string" || reason.trim() === "") {
1327
- const e = new Error("rebuildCorruptControlPlaneLedger: a non-empty reason is required (this call drops taint evidence — it is recorded, never implicit)");
1327
+ const e = new Error("This ledger rebuild is refused: a non-empty reason is required (this call drops taint evidence — it is recorded, never implicit)");
1328
1328
  e.code = "config.memory_rebuild_reason";
1329
1329
  throw e;
1330
1330
  }
1331
1331
  const ledgerDir = fileGovernanceStoreDir(this.governanceStore);
1332
1332
  if (ledgerDir === undefined) {
1333
- const e = new Error("rebuildCorruptControlPlaneLedger: this engine's governance documents are kept by its backend's store, not as control-plane files — the rebuild (which quarantines the corrupt file's bytes beside it) is the File store's recovery; recover the document through the store that keeps it.");
1333
+ const e = new Error("This ledger rebuild is refused: this engine's governance documents are kept by its backend's store, not as control-plane files — the rebuild (which quarantines the corrupt file's bytes beside it) is the File store's recovery; recover the document through the store that keeps it.");
1334
1334
  e.code = "memory.control_plane_rebuild_unsupported";
1335
1335
  throw e;
1336
1336
  }
@@ -1375,7 +1375,7 @@ export class MemoryEngine {
1375
1375
  }
1376
1376
  async challengeEntries(ids, reason, requestId) {
1377
1377
  if (typeof requestId !== "string" || requestId === "") {
1378
- const e = new Error("challengeEntries: requestId is required (idempotency identity — retries must reuse it; the engine does not mint one)");
1378
+ const e = new Error("This challenge request is refused: requestId is required (idempotency identity — retries must reuse it; the engine does not mint one)");
1379
1379
  e.code = "config.memory_challenge_request";
1380
1380
  throw e;
1381
1381
  }
@@ -1396,7 +1396,7 @@ export class MemoryEngine {
1396
1396
  const captured = captureErasureInput(input);
1397
1397
  const bad = erasureRequestInvalid(captured);
1398
1398
  if (bad !== undefined) {
1399
- const e = new Error(`eraseMemoryEntries: ${bad}`);
1399
+ const e = new Error(`${ERASURE_REFUSED} ${bad}`);
1400
1400
  e.code = "config.memory_erasure_request";
1401
1401
  throw e;
1402
1402
  }
@@ -1404,7 +1404,7 @@ export class MemoryEngine {
1404
1404
  const face = this.backend.eraseWithEvidence;
1405
1405
  if (typeof face === "function") {
1406
1406
  if (captured.expectedScopes !== undefined && this.backend.judgesErasureScopes !== true) {
1407
- const e = new Error("eraseMemoryEntries: this backend's erasure-evidence face does not declare judgesErasureScopes — a grant-bearing erasure (expectedScopes) is refused rather than handed to a face that may ignore the set; nothing was deleted");
1407
+ const e = new Error(`${ERASURE_REFUSED} this backend's erasure-evidence face does not declare judgesErasureScopes — a grant-bearing erasure (expectedScopes) is refused rather than handed to a face that may ignore the set; nothing was deleted`);
1408
1408
  e.code = "config.memory_erasure_scope";
1409
1409
  throw e;
1410
1410
  }
@@ -1412,7 +1412,7 @@ export class MemoryEngine {
1412
1412
  return this.answerIndexCopies(await this.sweepErasedIndexLines(att, requestId, (recorded) => ({ paths: recorded, homes: att.erased.flatMap((row) => (row.binding.state === "bound" ? [scopeDirFor(this.memoryDir, this.controlDir, row.binding.scope)] : [])) })), counted);
1413
1413
  }
1414
1414
  if (captured.allowUnevidenced !== true) {
1415
- const e = new Error("eraseMemoryEntries: this backend has no erasure-evidence capability (eraseWithEvidence) — an unevidenced erasure is refused by default. " +
1415
+ const e = new Error(`${ERASURE_REFUSED} this backend has no erasure-evidence capability (eraseWithEvidence) — an unevidenced erasure is refused by default. ` +
1416
1416
  "Pass allowUnevidenced: true to run the documented degraded lane (no replay convergence, no selector-reuse detection, no erasure history, best-effort resolution).");
1417
1417
  e.code = "memory.erasure_evidence_unavailable";
1418
1418
  throw e;
@@ -1421,7 +1421,7 @@ export class MemoryEngine {
1421
1421
  const select = captured.select;
1422
1422
  const grant = captured.expectedScopes !== undefined ? canonicalExpectedScopes(captured.expectedScopes) : undefined;
1423
1423
  if (grant !== undefined && "scope" in select && firstOutsideExpectedScopes(grant, [select.scope]) >= 0)
1424
- throw erasureScopeRefusal("eraseMemoryEntries");
1424
+ throw erasureScopeRefusal();
1425
1425
  let resolvedIds;
1426
1426
  if ("ids" in select) {
1427
1427
  resolvedIds = [...select.ids];
@@ -1440,7 +1440,7 @@ export class MemoryEngine {
1440
1440
  const present = (await this.backend.getByIds(resolvedIds)).filter((e) => requested.has(e.id));
1441
1441
  const byId = new Map(present.map((e) => [e.id, e]));
1442
1442
  if (grant !== undefined && firstOutsideExpectedScopes(grant, resolvedIds.map((id) => byId.get(id)?.scope)) >= 0)
1443
- throw erasureScopeRefusal("eraseMemoryEntries");
1443
+ throw erasureScopeRefusal();
1444
1444
  const patches = [...byId.values()].map((e) => ({ op: "delete", id: e.id, baseRev: e.rev }));
1445
1445
  const report = patches.length > 0 ? await this.backend.applyPatches(patches) : { applied: [], conflicts: [] };
1446
1446
  const appliedDeletes = new Set(report.applied.filter((a) => a.op === "delete").map((a) => a.id));
@@ -1752,14 +1752,14 @@ export class MemoryEngine {
1752
1752
  }
1753
1753
  async exportMemoryScopes(scopes) {
1754
1754
  if (!Array.isArray(scopes) || scopes.length === 0 || scopes.some((s) => typeof s !== "string" || s.length === 0) || new Set(scopes).size !== scopes.length) {
1755
- const e = new Error("exportMemoryScopes: scopes must be a non-empty array of unique non-empty scope names");
1755
+ const e = new Error("This memory export is refused: scopes must be a non-empty array of unique non-empty scope names");
1756
1756
  e.code = "config.memory_export_request";
1757
1757
  throw e;
1758
1758
  }
1759
1759
  const requested = [...scopes];
1760
1760
  const face = this.backend.exportSnapshotOf;
1761
1761
  if (typeof face !== "function") {
1762
- const e = new Error("exportMemoryScopes: this backend has no export-snapshot capability (exportSnapshotOf) — a governance-complete bundle cannot be assembled from the generic read faces (they cannot fence the five store faces into one epoch), and a governance-less export is the laundering shape this API refuses by design.");
1762
+ const e = new Error("This memory export is refused: this backend has no export-snapshot capability (exportSnapshotOf) — a governance-complete bundle cannot be assembled from the generic read faces (they cannot fence the five store faces into one epoch), and a governance-less export is the laundering shape this API refuses by design.");
1763
1763
  e.code = "memory.export_incomplete";
1764
1764
  throw e;
1765
1765
  }
@@ -1812,7 +1812,7 @@ export class MemoryEngine {
1812
1812
  inert = JSON.parse(JSON.stringify(bundle));
1813
1813
  }
1814
1814
  catch (err) {
1815
- const e = new Error(`importMemoryBundle: the bundle is not JSON-serializable (${thrownText(err)})`);
1815
+ const e = new Error(`${MEMORY_IMPORT_REFUSED} the bundle is not JSON-serializable (${thrownText(err)})`);
1816
1816
  e.code = "config.memory_import_request";
1817
1817
  throw e;
1818
1818
  }
@@ -1820,20 +1820,20 @@ export class MemoryEngine {
1820
1820
  const grant = Array.isArray(rawGrant) ? [...rawGrant] : rawGrant;
1821
1821
  const grantBad = grant !== undefined ? expectedScopesInvalid(grant) : undefined;
1822
1822
  if (grantBad !== undefined) {
1823
- const e = new Error(`importMemoryBundle: ${grantBad} — nothing was imported`);
1823
+ const e = new Error(`${MEMORY_IMPORT_REFUSED} ${grantBad} — nothing was imported`);
1824
1824
  e.code = "config.memory_import_request";
1825
1825
  throw e;
1826
1826
  }
1827
1827
  const bad = memoryBundleInvalid(inert, grant !== undefined ? { expectedScopes: grant } : {});
1828
1828
  if (bad !== undefined) {
1829
- const e = new Error(`importMemoryBundle: ${bad} — the whole package is refused, nothing landed`);
1829
+ const e = new Error(`${MEMORY_IMPORT_REFUSED} ${bad} — the whole package is refused, nothing landed`);
1830
1830
  e.code = "memory.import_rejected";
1831
1831
  throw e;
1832
1832
  }
1833
1833
  const b = inert;
1834
1834
  const face = this.backend.importBundleCommit;
1835
1835
  if (typeof face !== "function") {
1836
- const e = new Error("importMemoryBundle: this backend has no bundle-import capability (importBundleCommit) — the import latch/receipt transaction requires it, and an unlatched import would serve entries before their governance lands; nothing was imported.");
1836
+ const e = new Error(`${MEMORY_IMPORT_REFUSED} this backend has no bundle-import capability (importBundleCommit) — the import latch/receipt transaction requires it, and an unlatched import would serve entries before their governance lands; nothing was imported.`);
1837
1837
  e.code = "memory.import_rejected";
1838
1838
  throw e;
1839
1839
  }
@@ -1859,7 +1859,7 @@ export class MemoryEngine {
1859
1859
  }
1860
1860
  async challengeSession(sessionId, reason, requestId) {
1861
1861
  if (typeof requestId !== "string" || requestId === "") {
1862
- const e = new Error("challengeSession: requestId is required (idempotency identity — retries must reuse it; the engine does not mint one)");
1862
+ const e = new Error("This challenge request is refused: requestId is required (idempotency identity — retries must reuse it; the engine does not mint one)");
1863
1863
  e.code = "config.memory_challenge_request";
1864
1864
  throw e;
1865
1865
  }
@@ -5414,16 +5414,16 @@ export class MemoryEngine {
5414
5414
  const face = this.committedAuditFace();
5415
5415
  const [committed] = await face.getByIds([entryId]);
5416
5416
  if (committed === undefined || committed.frontmatter.deleted === true) {
5417
- MemoryEngine.originClearRefusal("memory.origin_clear_unknown", `clearEntryOrigin: no committed memory entry ${JSON.stringify(entryId.slice(0, 80))}.`);
5417
+ MemoryEngine.originClearRefusal("memory.origin_clear_unknown", `Clearing this entry's origin is refused: no committed memory entry ${JSON.stringify(entryId.slice(0, 80))}.`);
5418
5418
  }
5419
5419
  const origin = committedOriginOf(committed.frontmatter);
5420
5420
  if (origin === undefined) {
5421
5421
  const lastClearance = MemoryEngine.lastCompletedClearance(clearances, entryId);
5422
- MemoryEngine.originClearRefusal("memory.origin_clear_not_marked", `clearEntryOrigin: entry ${JSON.stringify(entryId.slice(0, 80))} carries no external-origin marker — nothing to clear.` +
5422
+ MemoryEngine.originClearRefusal("memory.origin_clear_not_marked", `Clearing this entry's origin is refused: entry ${JSON.stringify(entryId.slice(0, 80))} carries no external-origin marker — nothing to clear.` +
5423
5423
  (lastClearance !== undefined ? ` A clearance for this entry already settled at ${MemoryEngine.spellSettledAt(lastClearance.settledAt)} (requestId ${JSON.stringify(lastClearance.requestId)}) — this reads as a re-send of it.` : ""), lastClearance !== undefined ? { lastClearance } : undefined);
5424
5424
  }
5425
5425
  if ((await this.readChallengeExclusions()).has(entryId)) {
5426
- MemoryEngine.originClearRefusal("memory.origin_clear_challenged", `clearEntryOrigin: entry ${JSON.stringify(entryId.slice(0, 80))} is challenged/latched — adjudicate the challenge first (the clear valve is not a challenge exit).`);
5426
+ MemoryEngine.originClearRefusal("memory.origin_clear_challenged", `Clearing this entry's origin is refused: entry ${JSON.stringify(entryId.slice(0, 80))} is challenged/latched — adjudicate the challenge first (the clear valve is not a challenge exit).`);
5427
5427
  }
5428
5428
  const fm = { ...committed.frontmatter, ...(committed.frontmatter.extra !== undefined ? { extra: [...committed.frontmatter.extra] } : {}) };
5429
5429
  stripModelWrittenOrigin(fm);
@@ -219,9 +219,14 @@ export declare function erasureSelectHash(select: ErasureSelect): string;
219
219
  * set — the selector the anchor row echoes verbatim must pass the anchor's own validator, so the
220
220
  * entry check and the chain check are the same predicate). Returns the violation, or undefined. */
221
221
  export declare function erasureRequestInvalid(input: EraseMemoryEntriesInput): string | undefined;
222
- /** The authorization refusal, one text for both lanes; it names no count, id or scope (saying which
222
+ /** How every refusal of an erasure request opens, whichever lane refused it (the engine's verb, a deployment's, a store's
223
+ * evidence face): the step in words — the person who asked to forget something reads it — never the function that refused. */
224
+ export declare const ERASURE_REFUSED = "This erasure request is refused:";
225
+ /** The same opener for a memory bundle import, whichever lane refused it (the engine's verb, a store's import faces). */
226
+ export declare const MEMORY_IMPORT_REFUSED = "This memory import is refused:";
227
+ /** The authorization refusal, one text for every lane; it names no count, id or scope (saying which
223
228
  * id sits where would answer the very question the seat withholds). */
224
- export declare function erasureScopeRefusal(where: string): Error & {
229
+ export declare function erasureScopeRefusal(): Error & {
225
230
  code: string;
226
231
  };
227
232
  /**