@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
@@ -3,6 +3,14 @@
3
3
  export declare const MEMORY_INDEX_FILENAME = "MEMORY.md";
4
4
  /** Default nesting depth cap under a scope dir (CC memory is flat; a small allowance for topic dirs). */
5
5
  export declare const DEFAULT_MAX_ENTRY_DEPTH = 3;
6
+ /**
7
+ * What an entry file's bytes must carry to be an entry file at all: anything but whitespace. A blank
8
+ * file holds no entry, so every reader of the plane reads it exactly as it reads an absent file — the
9
+ * harvest does not admit a blank new file as an entry, a blank file where a committed entry was
10
+ * materialized is that entry's removal (the same as the file being gone), and the backend's read
11
+ * serves nothing from it.
12
+ */
13
+ export declare function carriesEntry(text: string): boolean;
6
14
  /** One on-disk entry file the scan found. */
7
15
  export interface ScannedEntryFile {
8
16
  /** Absolute path. */
@@ -2,6 +2,9 @@ import { lstatSync, readdirSync } from "node:fs";
2
2
  import { join, relative } from "node:path";
3
3
  export const MEMORY_INDEX_FILENAME = "MEMORY.md";
4
4
  export const DEFAULT_MAX_ENTRY_DEPTH = 3;
5
+ export function carriesEntry(text) {
6
+ return text.trim() !== "";
7
+ }
5
8
  export function scanEntryFiles(dir, opts = {}) {
6
9
  const maxDepth = opts.maxDepth ?? DEFAULT_MAX_ENTRY_DEPTH;
7
10
  const out = [];
@@ -1,6 +1,6 @@
1
1
  import { scopeDirName, type TxnLockTimings, type ChallengeEvent, type MemoryPartitionIncidentSink } from "./layout.js";
2
2
  import type { MemoryBundleImportPlan, MemoryImportReport } from "./export-bundle.js";
3
- import type { HarvestRejection, MemoryBackend, MemoryEntry, MemoryEntryHeader, MemoryScopeEnumeration, NotePatch, PatchReport, ScoredMemoryEntry } from "./types.js";
3
+ import type { HarvestRejection, MemoryBackend, MemoryEntry, MemoryEntryHeader, MemoryGovernanceStore, MemoryScopeEnumeration, NotePatch, PatchReport, ScoredMemoryEntry } from "./types.js";
4
4
  export { DEFAULT_MAX_ENTRY_DEPTH, MEMORY_INDEX_FILENAME, scanEntryFiles, type ScannedEntryFile } from "./entry-scan.js";
5
5
  /** design/178 v2-b §3.3(b) — the explicit erasure selector (each form resolves to an explicit id
6
6
  * list before anything is deleted; there is no whole-store selector). */
@@ -97,8 +97,8 @@ export interface MemoryErasureAttestation {
97
97
  * can clear, and says when it cannot (`unverified`, or `evidenceBinding.remaining` — rows the
98
98
  * append-only chain keeps). */
99
99
  status: "complete" | "partial";
100
- /** `"journal"` = the File evidence path; `"none"` = the explicit `allowUnevidenced` degradation
101
- * lane (always present — a silent downgrade is the forbidden shape). */
100
+ /** `"journal"` = the backend holds an append-only evidence chain, whatever its medium; `"none"` = the
101
+ * explicit `allowUnevidenced` degradation lane (always present — a silent downgrade is the forbidden shape). */
102
102
  evidenceCapability: "journal" | "none";
103
103
  /** The evidence chain's integrity as read at assembly (v2-a custody tri-state law). `"damaged"`
104
104
  * ⇒ every notFound row carries `historyUnknown` and `erasedPreviously` is never produced ("no
@@ -216,8 +216,8 @@ export declare function captureErasureInput(input: EraseMemoryEntriesInput): Era
216
216
  * `{ id, from: {scope, slug}, to: {scope, slug} }`;
217
217
  * - `"migration-bind"`: an unbound row converging to a binding — payload `{ id, to }` (`from`
218
218
  * optional: honest absence, an unbound row has no prior coordinates);
219
- * - `"migration"`: the one-shot v1→v2 baseline summary — payload `{ boundRows, unboundRows }`
220
- * (store management history, never per-entry custody).
219
+ * - `"migration"`: the one-shot v1→v2 baseline summary an engine ≤ 7.63.0 appended — payload
220
+ * `{ boundRows, unboundRows }` (store management history, never per-entry custody; no longer minted).
221
221
  * `channel` is deliberately `string`, not a closed union: later releases append new variants to the
222
222
  * SAME chain (one custody chain, one recovery protocol — never a second evidence file), and a closed
223
223
  * union would break every consumer at the source level on each addition. CONSUMER OBLIGATION: tolerate
@@ -372,6 +372,20 @@ export interface MemoryExportSnapshot {
372
372
  quarantined: string[];
373
373
  quarantineOpaque: number;
374
374
  }
375
+ /**
376
+ * The form of the committed-rev ledger (`revs.json`) under a store's control plane, asked of the file and of nothing else — for
377
+ * a program that must know whether a store's ledger is one this engine reads before (or instead of) opening it. It reads the
378
+ * file once, through the judge the store itself opens its ledger by: it takes no lock, upgrades nothing, creates nothing and
379
+ * writes nothing. The answer is one of three words:
380
+ * - `"absent"` — there is no ledger file (a store that never committed);
381
+ * - `"v2"` — the current enveloped schema;
382
+ * - `"malformed"` — the file is there and the store would refuse it (unparseable, wrong shape, a schema version this engine
383
+ * does not read — the pre-binding v1 bare map among them, since 7.64.0 — or a row the ledger rules refuse).
384
+ * A file that cannot be read for any reason but its absence (`EISDIR`, `EACCES`, `ELOOP`, an I/O error) is no form: the read rejects
385
+ * with {@link ControlPlaneCorruptError}, as the store's own does (the message names the errno), never `"absent"` or `"malformed"` — the
386
+ * outcomes are the three words or that rejection. `controlDir` is `FileMemoryEngineBackend.controlPlaneRoot`; a non-string or empty one rejects (`TypeError`).
387
+ */
388
+ export declare function readMemoryLedgerForm(controlDir: string): Promise<"v2" | "absent" | "malformed">;
375
389
  /** Construction options for {@link FileMemoryEngineBackend}. */
376
390
  export interface FileMemoryEngineBackendOptions {
377
391
  /** ⚠️ 分家坑(service 报告 2026-07-09):不显式传时,控制平面按无参 `resolveMemoryEngineRoot()`
@@ -407,6 +421,9 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
407
421
  * NEVER under {@link directoryRoot}, always on the config-root side even for an in-repo memory dir.
408
422
  * The engine picks this up (like `directoryRoot`) so both sides share ONE control plane. */
409
423
  readonly controlPlaneRoot: string;
424
+ /** The consolidation state's store (`MemoryBackend.governance`): the File store over {@link controlPlaneRoot} —
425
+ * the same files, names and locks an engine over this backend always kept there. */
426
+ readonly governance: MemoryGovernanceStore;
410
427
  /** Injected clock (opus 1.258 LOW: match the engine's `this.now` determinism discipline). */
411
428
  private readonly now;
412
429
  /** The construction-time incident sink (partition adoption, layout adoption on the standalone faces). */
@@ -430,24 +447,12 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
430
447
  private ledger;
431
448
  /** Top-level unknown keys of the loaded v2 envelope — write-preserved (§1.1). */
432
449
  private envelopeExtras;
433
- /**
434
- * §3.1 (r3-④) — the migration retry judge: the PERSISTED schema form, set at every real disk read
435
- * of the ledger and flipped only by the locked migration. Deliberately NOT derived from the
436
- * in-memory ledger shape: the v1 compat arm (RL-1654-ledger-v1) upgrades rows in memory (§3.2), so the memory shape
437
- * reads "already v2" after the first stand-down and the retry would die. `"v1"` arms the
438
- * per-entry opportunistic retry (construction / reads / checkControlPlane / every locked
439
- * mutation); undefined = the disk form has not been observed yet.
440
- */
441
- private persistedSchemaVersion;
442
- /** §3.1 — the v1-compat window (RL-1654-ledger-v1) is loud ONCE per instance (per-row unbound noise stays suppressed;
443
- * the OVERALL state does not). */
444
- private announcedV1Compat;
445
450
  /** §3.4 — O(1) retry judge for the READ entries' unbound-convergence attempts: recomputed at
446
451
  * every disk load and every persist (both already iterate the rows), never by scanning per read.
447
452
  * Slightly stale-TRUE is harmless (one try-lock + one early-return reload); stale-FALSE cannot
448
453
  * happen (every seat that changes the rows passes through a maintaining seat). While a blocker
449
- * is genuinely stuck (a standing duplicate), each read pays one census — the same bounded cost
450
- * the v1 read retry accepts for an incomplete store, in a state the sweeps warn about loudly. */
454
+ * is genuinely stuck (a standing duplicate), each read pays one census — a bounded cost, in a
455
+ * state the sweeps warn about loudly. */
451
456
  private unboundRowsKnown;
452
457
  /** Adopting-face notice dedup (copy / undecidable-probe / ambiguous / census-incomplete): one
453
458
  * still-pending state announces once per instance; changed bytes mint a new key and re-announce
@@ -510,14 +515,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
510
515
  private shadowPath;
511
516
  private loadLedger;
512
517
  /** B3: atomic + fail-closed — a ledger that cannot be persisted throws (the commit is incomplete
513
- * and the caller must know), never a silent swallow. Always writes the v2 envelope; writing over
514
- * an unmigrated v1 disk is refused loudly (mutations migrate FIRST — §3.1's "变异必先迁" is an
515
- * invariant here, not a convention: a v2 write minus the census would strand every row unbound). */
518
+ * and the caller must know), never a silent swallow. Always writes the v2 envelope. */
516
519
  private saveLedger;
517
- /** v1-journal restore ONLY (§1.2 dual-read): the snapshot predates the upgrade and is persisted in
518
- * ITS OWN form — the migration (which runs after recovery, under the lock) owns the v1→v2 swap
519
- * together with its backup + evidence protocol. */
520
- private persistLedgerV1;
521
520
  /** Fail-open announcement convenience (S2-B queue posture — an unwritable queue never fails the
522
521
  * operation that had something to say; the fail-CLOSED evidence lane is `transfers.jsonl`). */
523
522
  private enqueueExternalItems;
@@ -555,34 +554,30 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
555
554
  * not census gaps.
556
555
  */
557
556
  private censusProjectionsLocked;
558
- /** §3.6 — capture the pre-migration v1 bytes exactly once (`wx`: the first scene is never
559
- * overwritten by a retry). */
560
- private writeV1BackupOnce;
561
- /** §3.1 — non-blocking txn-mutex acquisition for the opportunistic migration entries (the
557
+ /** §3.1 — non-blocking txn-mutex acquisition for the opportunistic convergence entries (the
562
558
  * constructor cannot await). LIVE contention stands down — wait semantics belong to the async
563
559
  * writers; every entry retries later. A STALE lock (past its deadline, owner token present) gets
564
560
  * ONE synchronous single-winner steal, same judge and same token discipline as the async
565
561
  * waiter's steal: without it, a crashed holder's leftover lock would stand down every sync entry
566
562
  * forever, and a READ-ONLY deployment — which never runs an async writer to do the stealing —
567
- * would sit in v1-compat indefinitely (the very suspension §3.1 bounds to seconds). Steal-safety
568
- * is unchanged: the caller runs journal recovery INSIDE the acquired lock before touching state. */
563
+ * would leave its unbound rows unconverged and an interrupted transaction unrecovered indefinitely.
564
+ * Steal-safety is unchanged: the caller runs journal recovery INSIDE the acquired lock before touching state. */
569
565
  private tryAcquireTxnLockSync;
570
- /** §3.1 — one opportunistic migration attempt (read entries / construction / checkControlPlane):
571
- * try-lock, recover, migrate, release. A busy lock is a clean stand-down (the mutation entries
572
- * bootstrap the migration under their own lock regardless). */
566
+ /** §3.4 — one opportunistic convergence attempt (read entries / construction / checkControlPlane):
567
+ * try-lock, recover, adopt, converge, release. A busy lock is a clean stand-down (the mutation
568
+ * entries converge under their own lock regardless). */
573
569
  private tryOpportunisticMigrate;
574
570
  /**
575
- * §3.3-§3.5 — the migration body. MUST hold the txn mutex. Reloads the DISK truth (the retry
576
- * judge is {@link persistedSchemaVersion}, set by that reload — never the in-memory shape), then:
577
- * v1 ⇒ full census-derived rebind + one-shot backup + journaled swap + one migration-summary
578
- * evidence event; v2-with-unbound ⇒ re-derive the unbound rows only (bound rows are FINAL — only
579
- * explicit transactions rewrite a binding), each new bind carrying a `migration-bind` evidence
580
- * event. An INCOMPLETE census abandons the pass with ZERO writes ("only what was visible" is not
581
- * "all that exists"; a wrong binding is worse than no binding) and retries at the next entry.
582
- * P=0 rows stay unbound (「缺失≠删除」— dropping the row would endorse an unattributed delete);
583
- * P≥2 rows stay unbound (the migration never adjudicates which projection is real — an existing
584
- * dup audit keeps ringing until a harvest or a human resolves it). Idempotent: v2 + zero unbound
585
- * is a no-op version check.
571
+ * §3.4-§3.5 — the unbound-row convergence, the part of the v1→v2 migration that outlives it: an
572
+ * engine ≤ 7.63.0 upgraded a pre-binding ledger and left the rows whose projection it could not
573
+ * derive UNBOUND. MUST hold the txn mutex. Reloads the DISK truth, then re-derives the unbound rows
574
+ * only (bound rows are FINAL — only explicit transactions rewrite a binding), each new bind
575
+ * carrying a `migration-bind` evidence event. An INCOMPLETE census abandons the pass with ZERO
576
+ * writes ("only what was visible" is not "all that exists"; a wrong binding is worse than no
577
+ * binding) and retries at the next entry. P=0 rows stay unbound (「缺失≠删除」— dropping the row
578
+ * would endorse an unattributed delete); P≥2 rows stay unbound (the convergence never adjudicates
579
+ * which projection is real — an existing dup audit keeps ringing until a harvest or a human
580
+ * resolves it). Idempotent: zero unbound is a no-op.
586
581
  */
587
582
  private migrateLockedIfNeeded;
588
583
  /** Is the durable chain-degradation marker in place? Presence is ENOENT-only-absent (a probe
@@ -669,10 +664,10 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
669
664
  /** v2-b §3-4 (round-3 #1) — a PURE, fresh read of the committed ledger rows for the retrieval
670
665
  * backstop's account check: bytes → parsed rows, installing no read cache and no schema memo — so
671
666
  * the guard's account view is as fresh as its chain digest,
672
- * never a stale instance cache paired with a fresh deletion read. A v1-form or absent ledger
673
- * answers empty (a v1 store has no delete rows to police anyway). FAULT DIRECTION, stated
674
- * truthfully (rescan corrected the original note, which claimed the opposite): a read/parse
675
- * FAULT also answers empty, and with an empty account the consuming filter WITHHOLDS every id
667
+ * never a stale instance cache paired with a fresh deletion read. An absent ledger answers
668
+ * empty. FAULT DIRECTION, stated truthfully (rescan corrected the original note, which claimed
669
+ * the opposite): a read/parse FAULT (a pre-binding v1 bare map among them) also answers empty,
670
+ * and with an empty account the consuming filter WITHHOLDS every id
676
671
  * on the delete list — conservative on purpose (a host re-add cannot be distinguished from a
677
672
  * replant over an unreadable account, and serving bytes that carry delete evidence during a
678
673
  * fault window would reopen exactly the resurrection the backstop exists to close). No erase
@@ -885,8 +880,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
885
880
  * · the reads do no healing and no quarantine, and the COMMITTED-ROWS read is cache-free; the
886
881
  * digest read installs the instance fingerprint cache (a read cache, not a store write). The
887
882
  * path's write-capable hooks (rescan r3 — do not present this list as shorter): `readScope`'s
888
- * pre-existing opportunistic v1→v2 migration retry (v1-form/unbound-row stores only, design/186
889
- * §3.1), the guard's fault-disclosure enqueue (a ledger read/parse fault mints an announcement
883
+ * pre-existing opportunistic unbound-row convergence retry (stores holding unbound rows only,
884
+ * design/186 §3.4), the guard's fault-disclosure enqueue (a ledger read/parse fault mints an announcement
890
885
  * row, once per fault code per mount), and `scopeDir`'s registry mint (listing a scope name the
891
886
  * registry has never seen writes its row — predates this view and rides every scope read).
892
887
  *
@@ -990,8 +985,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
990
985
  * single-copy move / delete-then-plant empties the bound address and rings here even though the
991
986
  * id is still "somewhere" (the v1 any-scope presence test read exactly that as fine — the
992
987
  * registered residual this schema retires); byte-carriers of the id at other addresses are named
993
- * in the same finding. UNBOUND rows (migration transitional) keep the v1 store-wide presence
994
- * test — no false alarms while their address is underivable. Non-destructive throughout: nothing
988
+ * in the same finding. UNBOUND rows (left by an engine ≤ 7.63.0's migration) keep the store-wide
989
+ * presence test — no false alarms while their address is underivable. Non-destructive throughout: nothing
995
990
  * is restored, forgotten, or adopted here.
996
991
  *
997
992
  * `opts.idlessWriteScope` is the CALLER's per-call session verdict (same posture as the mount:
@@ -1055,6 +1050,13 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
1055
1050
  * (§1.1) at the coordinates the batch ACTUALLY lands — a slug collision's `-n` suffix binds the
1056
1051
  * suffixed slug, the same one `applied[].slug` reports (v1's ledger had no landing awareness). */
1057
1052
  private planOne;
1053
+ /** Where an update / delete patch's entry stands: the plane copy carrying its id, else the committed
1054
+ * account's own seat — the ledger binding's path, with the committed shadow as the entry — when that
1055
+ * seat holds no other entry (absent, blank, or id-less bytes). The account seat is the address the
1056
+ * twins and the erasure lane already use, so an entry whose plane file lost its id line, was blanked
1057
+ * or was removed is still the entry the patch names. `onPlane` false ⇔ the committed bytes are not
1058
+ * standing at `path` (a CAS conflict puts them back there). */
1059
+ private locateForPatch;
1058
1060
  private locateById;
1059
1061
  /**
1060
1062
  * design/178 v2-b §7 — request-driven erasure with evidence (capability face; probe with
@@ -1128,9 +1130,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
1128
1130
  * not "no journal"; it throws the fail-closed corrupt error, never folds into quiescence). */
1129
1131
  private auditJournalPending;
1130
1132
  /** PURE ledger read for the audit faces: raw bytes → parsed rows, touching NOTHING on the
1131
- * instance (no cache install, no schema-version memo, no v1-compat announcement) and never the
1132
- * disk. A v1-form ledger is refused here — the migration belongs to the store's own entries
1133
- * (construction / adopting reads / locked mutations), never to an audit read. */
1133
+ * instance (no cache install) and never the disk. A ledger the store's judge refuses (the
1134
+ * pre-binding v1 bare map among them) throws its {@link ControlPlaneCorruptError}. */
1134
1135
  private auditReadLedger;
1135
1136
  /** Run `read` over a STABLE committed account: journal absent before and after, ledger bytes
1136
1137
  * identical across the read (closes both tear channels — the journal-first commit window and any
@@ -1157,7 +1158,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
1157
1158
  * `typeof backend.committedSnapshotOf === "function"`). Pure committed read under the double
1158
1159
  * fence; unknown id ⇒ `{ state: "absent" }` (never a throw, never an empty guess); unbound row ⇒
1159
1160
  * the account half answers with `binding: { state: "unbound" }` (legal transitional state);
1160
- * v1-compat store ⇒ loud refusal (migrate first); fence contention past the bound ⇒ loud refusal.
1161
+ * a ledger the store refuses (a pre-binding v1 bare map among them) ⇒ its fail-closed throw; fence
1162
+ * contention past the bound ⇒ loud refusal.
1161
1163
  */
1162
1164
  committedSnapshotOf(id: string): Promise<CommittedEntrySnapshot>;
1163
1165
  /** One row's public {@link CommittedBinding} (shared tagged form — see the type's own doc). */
@@ -1168,8 +1170,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
1168
1170
  * shadow-only rows a disk scan would miss (`listHeaders` is an ADOPTING read and enumerates the
1169
1171
  * plane; it is not an audit face). Unbound rows land in the store-level `unbound` appendix.
1170
1172
  * Fence contention past the bound ⇒ `{ complete: false }` (NO data members — nothing to misread
1171
- * as a truncated package): the caller fails closed. Corrupt control-plane bytes and the
1172
- * v1-compat refusal still THROW (they are definite states, not contention).
1173
+ * as a truncated package): the caller fails closed. Corrupt control-plane bytes (a pre-binding
1174
+ * v1 ledger among them) still THROW (a definite state, not contention).
1173
1175
  */
1174
1176
  committedSnapshotsOfScopes(scopes: readonly string[]): Promise<CommittedScopeSnapshots>;
1175
1177
  /**