@sema-agent/core 7.64.0 → 7.66.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 (192) hide show
  1. package/CHANGELOG.md +571 -0
  2. package/dist/agents/delegation-registry-seat.d.ts +15 -0
  3. package/dist/agents/delegation-registry-seat.js +13 -0
  4. package/dist/agents/org-delivery-gate.d.ts +8 -1
  5. package/dist/agents/org-delivery-gate.js +9 -3
  6. package/dist/agents/peer-held-queue.js +1 -1
  7. package/dist/agents/peer-idle.js +1 -1
  8. package/dist/agents/peer-session-drain.d.ts +51 -12
  9. package/dist/agents/peer-session-drain.js +47 -34
  10. package/dist/agents/read-inbox-tool.d.ts +6 -2
  11. package/dist/agents/read-inbox-tool.js +18 -5
  12. package/dist/agents/subagent.d.ts +3 -1
  13. package/dist/agents/subagent.js +84 -77
  14. package/dist/brain/reasoning.d.ts +2 -0
  15. package/dist/brain/reasoning.js +1 -0
  16. package/dist/core/allow-entry.d.ts +9 -0
  17. package/dist/core/allow-entry.js +7 -1
  18. package/dist/core/ask-origin.d.ts +23 -3
  19. package/dist/core/ask-origin.js +11 -1
  20. package/dist/core/auto-promote.d.ts +3 -2
  21. package/dist/core/background-agent-store.d.ts +7 -0
  22. package/dist/core/checkpoint-store.d.ts +2 -3
  23. package/dist/core/context-settings.d.ts +1 -2
  24. package/dist/core/context-settings.js +1 -1
  25. package/dist/core/engine-attestation.d.ts +2 -2
  26. package/dist/core/engine-notice.d.ts +13 -1
  27. package/dist/core/engine-notice.js +3 -1
  28. package/dist/core/file-history-store.d.ts +2 -2
  29. package/dist/core/file-history-store.js +0 -4
  30. package/dist/core/gate-fold.js +3 -1
  31. package/dist/core/governance-codes.d.ts +6 -4
  32. package/dist/core/governance-codes.js +5 -3
  33. package/dist/core/human-input-projection.d.ts +9 -0
  34. package/dist/core/human-input-projection.js +13 -0
  35. package/dist/core/input-author.d.ts +66 -6
  36. package/dist/core/input-author.js +21 -3
  37. package/dist/core/leg-identity.d.ts +18 -2
  38. package/dist/core/leg-identity.js +5 -7
  39. package/dist/core/mailbox-store.d.ts +1 -1
  40. package/dist/core/memory-engine/consolidation.d.ts +30 -10
  41. package/dist/core/memory-engine/consolidation.js +41 -6
  42. package/dist/core/memory-engine/control-objects.d.ts +36 -3
  43. package/dist/core/memory-engine/control-objects.js +134 -12
  44. package/dist/core/memory-engine/control-plane-adoption.d.ts +13 -9
  45. package/dist/core/memory-engine/control-plane-adoption.js +58 -31
  46. package/dist/core/memory-engine/delegation-settlement.d.ts +75 -52
  47. package/dist/core/memory-engine/delegation-settlement.js +211 -228
  48. package/dist/core/memory-engine/dual-root.d.ts +3 -2
  49. package/dist/core/memory-engine/dual-root.js +5 -1
  50. package/dist/core/memory-engine/engine.d.ts +33 -16
  51. package/dist/core/memory-engine/engine.js +213 -177
  52. package/dist/core/memory-engine/file-backend.d.ts +21 -12
  53. package/dist/core/memory-engine/file-backend.js +58 -104
  54. package/dist/core/memory-engine/index.d.ts +2 -2
  55. package/dist/core/memory-engine/index.js +2 -2
  56. package/dist/core/memory-engine/layout.d.ts +184 -83
  57. package/dist/core/memory-engine/layout.js +267 -172
  58. package/dist/core/memory-engine/memory-age.d.ts +12 -0
  59. package/dist/core/memory-engine/memory-age.js +17 -0
  60. package/dist/core/memory-engine/memory-backend-contract.js +12 -11
  61. package/dist/core/memory-engine/memory-deployment.d.ts +4 -3
  62. package/dist/core/memory-engine/memory-deployment.js +6 -3
  63. package/dist/core/memory-engine/origin-clearance.d.ts +43 -15
  64. package/dist/core/memory-engine/origin-clearance.js +142 -58
  65. package/dist/core/memory-engine/tools.d.ts +2 -2
  66. package/dist/core/memory-engine/tools.js +7 -7
  67. package/dist/core/memory-engine/types.d.ts +16 -10
  68. package/dist/core/memory-vector.d.ts +6 -14
  69. package/dist/core/memory.d.ts +0 -462
  70. package/dist/core/memory.js +0 -333
  71. package/dist/core/model-receipt.d.ts +2 -1
  72. package/dist/core/model-receipt.js +5 -0
  73. package/dist/core/mods/dollar.d.ts +12 -0
  74. package/dist/core/mods/kernel/dispatch.d.ts +3 -1
  75. package/dist/core/mods/kernel/dispatch.js +5 -2
  76. package/dist/core/mods/kernel/events.d.ts +3 -1
  77. package/dist/core/mods/kernel/events.js +2 -2
  78. package/dist/core/mods/prompt-submit.d.ts +4 -0
  79. package/dist/core/mods/prompt-submit.js +24 -0
  80. package/dist/core/mods/stations.d.ts +23 -4
  81. package/dist/core/mods/stations.js +14 -7
  82. package/dist/core/permission-rule-consent.d.ts +49 -18
  83. package/dist/core/permission-rule-consent.js +59 -38
  84. package/dist/core/permission-rule-store.d.ts +24 -14
  85. package/dist/core/retention.d.ts +2 -7
  86. package/dist/core/retention.js +0 -1
  87. package/dist/core/retired-host-table-account.d.ts +19 -0
  88. package/dist/core/retired-host-table-account.js +28 -0
  89. package/dist/core/retired-tool-name-account.d.ts +60 -0
  90. package/dist/core/retired-tool-name-account.js +32 -0
  91. package/dist/core/roles.d.ts +3 -1
  92. package/dist/core/roles.js +5 -2
  93. package/dist/core/runner/classifier-ladder.d.ts +3 -1
  94. package/dist/core/runner/classifier-ladder.js +2 -2
  95. package/dist/core/runner/compact-session.js +2 -1
  96. package/dist/core/runner/contracts.d.ts +9 -9
  97. package/dist/core/runner/delegation-owner.d.ts +0 -8
  98. package/dist/core/runner/delegation-owner.js +1 -3
  99. package/dist/core/runner/gate-exit.js +9 -2
  100. package/dist/core/runner/memory-consolidation-driver.js +2 -2
  101. package/dist/core/runner/prepare-config-doors.js +1 -1
  102. package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
  103. package/dist/core/runner/prepare-delegation-surface.js +5 -3
  104. package/dist/core/runner/prepare-gate-stations.d.ts +8 -5
  105. package/dist/core/runner/prepare-gate-stations.js +13 -5
  106. package/dist/core/runner/prepare-inherited-gate.js +2 -0
  107. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  108. package/dist/core/runner/prepare-memory.js +35 -14
  109. package/dist/core/runner/prepare-policy-chain.js +12 -3
  110. package/dist/core/runner/prepare-project-context.js +2 -2
  111. package/dist/core/runner/prepare-task.d.ts +9 -1
  112. package/dist/core/runner/prepare-task.js +6 -5
  113. package/dist/core/runner/prepare-wiring-manifest.js +5 -4
  114. package/dist/core/runner/prompt-suggestions.js +1 -1
  115. package/dist/core/runner/run-identity-wiring.js +2 -2
  116. package/dist/core/runner/run-leg.js +3 -3
  117. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  118. package/dist/core/runner/run-notification-lane.js +2 -2
  119. package/dist/core/runner/runtask.js +6 -3
  120. package/dist/core/runner/steer-admission.d.ts +11 -2
  121. package/dist/core/runner/stream-steer-verb.d.ts +5 -2
  122. package/dist/core/runner/stream-steer-verb.js +67 -14
  123. package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -8
  124. package/dist/core/runner/sub-agent-deny-lists.js +22 -8
  125. package/dist/core/runner-deps.d.ts +4 -4
  126. package/dist/core/secret-env.d.ts +2 -2
  127. package/dist/core/secret-env.js +6 -20
  128. package/dist/core/session-store.d.ts +6 -6
  129. package/dist/core/session-store.js +3 -3
  130. package/dist/core/shell-run-candidates.js +3 -3
  131. package/dist/core/side-query.js +1 -1
  132. package/dist/core/skill-grant.d.ts +7 -0
  133. package/dist/core/skill-grant.js +14 -5
  134. package/dist/core/store-contracts/background-agent-store-contract.js +13 -0
  135. package/dist/core/task-event.d.ts +14 -0
  136. package/dist/core/task-notification.d.ts +35 -8
  137. package/dist/core/task-notification.js +31 -13
  138. package/dist/core/task-registry-agent.js +1 -0
  139. package/dist/core/task-registry-shared.d.ts +4 -0
  140. package/dist/core/tool-errors.d.ts +3 -3
  141. package/dist/core/tool-policy.js +2 -3
  142. package/dist/core/tool-spec.d.ts +20 -10
  143. package/dist/core/user-attachment.d.ts +5 -1
  144. package/dist/core/user-attachment.js +11 -5
  145. package/dist/core/write-protect.d.ts +16 -0
  146. package/dist/core/write-protect.js +10 -0
  147. package/dist/engine/harness/agent-harness.d.ts +19 -11
  148. package/dist/engine/harness/agent-harness.js +7 -4
  149. package/dist/engine/llm/types.d.ts +22 -10
  150. package/dist/engine/session/repo-utils.d.ts +14 -4
  151. package/dist/engine/session/repo-utils.js +5 -4
  152. package/dist/index.d.ts +10 -8
  153. package/dist/index.js +9 -7
  154. package/dist/prompts/default.d.ts +1 -2
  155. package/dist/scenarios/full-body.d.ts +1 -1
  156. package/dist/shell/lex.d.ts +50 -15
  157. package/dist/shell/lex.js +43 -9
  158. package/dist/stores/file/adoption/adopt.d.ts +1 -1
  159. package/dist/stores/file/index.d.ts +1 -15
  160. package/dist/stores/file/index.js +1 -15
  161. package/dist/stores/file/permission-rule-store.d.ts +12 -1
  162. package/dist/stores/file/permission-rule-store.js +31 -4
  163. package/dist/stores/file/session-store.js +1 -1
  164. package/dist/tools/fs/fs-bash.js +3 -3
  165. package/dist/tools/fs/removal-targets.d.ts +8 -2
  166. package/dist/tools/fs/removal-targets.js +31 -4
  167. package/dist/tools/fs/shell-read-argv.js +7 -1
  168. package/dist/tools/fs/shell-read-bindings.d.ts +21 -5
  169. package/dist/tools/fs/shell-read-bindings.js +130 -44
  170. package/dist/tools/fs/shell-read-plan.js +95 -29
  171. package/dist/tools/fs/shell-read-sourced.d.ts +25 -0
  172. package/dist/tools/fs/shell-read-sourced.js +119 -0
  173. package/dist/tools/fs/shell-read-word.d.ts +2 -2
  174. package/dist/tools/fs/shell-read-word.js +4 -5
  175. package/dist/tools/fs/shell-read-workdir.d.ts +19 -3
  176. package/dist/tools/fs/shell-read-workdir.js +60 -15
  177. package/dist/tools/fs/shell-reentry-text.d.ts +10 -2
  178. package/dist/tools/fs/shell-reentry-text.js +11 -4
  179. package/package.json +2 -2
  180. package/test/export-surface.snapshot.json +21 -79
  181. package/wire-changes/core-stores-sql@7.65.0.json +30 -0
  182. package/wire-changes/core-stores-sql@7.66.0.json +30 -0
  183. package/wire-changes/core@7.65.0.json +1650 -0
  184. package/wire-changes/core@7.66.0.json +1218 -0
  185. package/wire-changes/mods-kernel@7.65.0.json +30 -0
  186. package/wire-changes/mods-kernel@7.66.0.json +65 -0
  187. package/wire-changes/primitives@7.65.0.json +337 -0
  188. package/wire-changes/primitives@7.66.0.json +30 -0
  189. package/dist/core/memory-recall.d.ts +0 -208
  190. package/dist/core/memory-recall.js +0 -136
  191. package/dist/stores/file/memory-store.d.ts +0 -124
  192. package/dist/stores/file/memory-store.js +0 -353
@@ -1,4 +1,5 @@
1
- import type { MemoryGovernanceDocs, MemoryOriginCause } from "./types.js";
1
+ import type { MemoryControlObjectKind, MemoryGovernanceDocs, MemoryGovernanceObjects, MemoryOriginCause } from "./types.js";
2
+ import { type SessionPollutionObjects } from "./layout.js";
2
3
  /** A row's FIRST-WRITE status. Rows are immutable after their first write — every later transition
3
4
  * is an append-only event ({@link SettlementEvent}); the effective status is the fold. */
4
5
  export type SettlementRowStatus = "pending" | "unattestable";
@@ -135,7 +136,7 @@ export declare function expireOverdueSettlements(docs: MemoryGovernanceDocs, inp
135
136
  * `carry` scopes the sweep domain exactly like the engine's own sweeps (marked rows carry their
136
137
  * account under "carry"; the "off" width challenges everything).
137
138
  */
138
- export declare function replayExternalSettlementEffects(docs: MemoryGovernanceDocs, controlDir: string, input: {
139
+ export declare function replayExternalSettlementEffects(docs: MemoryGovernanceDocs & SessionPollutionObjects, input: {
139
140
  carry: boolean;
140
141
  now: () => number;
141
142
  }): Promise<Array<{
@@ -182,13 +183,19 @@ export interface SessionAccountRow {
182
183
  /** The one-time v1 key-form conversions of the three engine sidecars, in one call (each in its own
183
184
  * lock, each idempotent). The layout adoption runs this before any later scope registration can
184
185
  * change what a v1 key's first segment names. A step of the File layout's own upgrade: it converts
185
- * the hold ledger (a control-plane file, beside its custody) and the session-account document the File
186
- * store keeps under `controlDir`, in place (a store that keeps documents elsewhere never held the v1
187
- * form); the reads below convert the same way on first touch. */
186
+ * the hold ledger and the session-account document the File store keeps under `controlDir`, in place
187
+ * (a store that keeps documents elsewhere never held the v1 form), and the control-plane adoption runs
188
+ * it on a replica before handing these documents to another store. It is the one converter: the
189
+ * readers below refuse the v1 form ({@link sessionAccountsV2}). */
188
190
  export declare function convertV1SidecarKeys(controlDir: string): void;
191
+ /** The session-account document of `controlDir` converted in place when it stands in the v1 key form (in its lock);
192
+ * any other form — v2, absent, or one its readers refuse as corrupt — is left exactly as it stands. The control-plane
193
+ * adoption runs this before handing the document to another store (#3484): that store's readers refuse the v1 form,
194
+ * and nothing there converts it. The conversion is the File layout's own ({@link convertSessionAccounts}). */
195
+ export declare function convertV1SessionAccountsAt(controlDir: string): void;
189
196
  /** The dangling-trigger read: open rows (and unadjudicated closes) belonging to OTHER sessions.
190
197
  * These are what arm the unattributed residue classification at a session's materialize. */
191
- export declare function foreignDanglingSessionAccounts(docs: MemoryGovernanceDocs, controlDir: string, selfSessionId: string): Promise<SessionAccountRow[]>;
198
+ export declare function foreignDanglingSessionAccounts(docs: MemoryGovernanceDocs, selfSessionId: string): Promise<SessionAccountRow[]>;
192
199
  /** The live writers of the store's layers, as the account knows them: every row other than the one
193
200
  * held by `selfLeg` (the asking mount's own leg — another leg of the same session is another
194
201
  * writer) whose session's leg has not ended (no `terminatedAt` — running, or ended without
@@ -197,16 +204,16 @@ export declare function foreignDanglingSessionAccounts(docs: MemoryGovernanceDoc
197
204
  * whether the leg ended) reads as before: live while never closed, counted in `unscoped` — a
198
205
  * writer of an unknown layer. Sessions that open no row (no session id, provenance "off", an
199
206
  * adoption-restricted mount) are not visible here. */
200
- export declare function openLayerWriters(docs: MemoryGovernanceDocs, controlDir: string, selfLeg: string | undefined): Promise<{
207
+ export declare function openLayerWriters(docs: MemoryGovernanceDocs, selfLeg: string | undefined): Promise<{
201
208
  scopes: Set<string>;
202
209
  unscoped: number;
203
210
  }>;
204
211
  /** The leg that holds `sessionId`'s account row (undefined ⇔ no row, or a row without one). */
205
- export declare function sessionAccountLeg(docs: MemoryGovernanceDocs, controlDir: string, sessionId: string): Promise<string | undefined>;
212
+ export declare function sessionAccountLeg(docs: MemoryGovernanceDocs, sessionId: string): Promise<string | undefined>;
206
213
  /** The write scope `sessionId`'s account row records — the scope its newest account-opening mount wrote
207
214
  * under (the value that mount's handle carries as `writeScope`), whether that leg is still live or has
208
- * ended. Undefined ⇔ no row, a row written before the field, or a v1 ledger (whose rows predate it —
209
- * answered without the conversion, so this read writes nothing). Throws on a corrupt ledger. */
215
+ * ended. Undefined ⇔ no row, or a row written before the field. Throws on a corrupt ledger, and on one still in the v1
216
+ * key form (refused like every reader of it, {@link sessionAccountsV2}). */
210
217
  export declare function sessionAccountWriteHome(docs: MemoryGovernanceDocs, sessionId: string): Promise<{
211
218
  writeScope: string;
212
219
  openedAt: number;
@@ -221,7 +228,7 @@ export interface SessionUnattributedSet {
221
228
  export declare function emptyUnattributedSet(): SessionUnattributedSet;
222
229
  /** Open (or re-open, on a same-session resume) the session's account row, persisting the sticky
223
230
  * unattributed classification frozen at THIS materialize. */
224
- export declare function openSessionAccount(docs: MemoryGovernanceDocs, controlDir: string, input: {
231
+ export declare function openSessionAccount(docs: MemoryGovernanceDocs, input: {
225
232
  sessionId: string;
226
233
  now: () => number;
227
234
  unattributed: readonly UnattributedMember[];
@@ -229,7 +236,7 @@ export declare function openSessionAccount(docs: MemoryGovernanceDocs, controlDi
229
236
  leg?: string;
230
237
  }): Promise<void>;
231
238
  /** The current session's sticky unattributed set (the harvest's residue-arm input). */
232
- export declare function sessionUnattributedSet(docs: MemoryGovernanceDocs, controlDir: string, sessionId: string): Promise<SessionUnattributedSet>;
239
+ export declare function sessionUnattributedSet(docs: MemoryGovernanceDocs, sessionId: string): Promise<SessionUnattributedSet>;
233
240
  /** Close the session's account row — called ONLY after a FULL-domain harvest (zero BUDGET-deferred
234
241
  * files, i.e. `HarvestReport.degraded` absent): a partial harvest's close would launder the deferred
235
242
  * residue window (§3.6 序则②). A normal full close also clears every standing `unadjudicated` flag
@@ -244,7 +251,7 @@ export declare function sessionUnattributedSet(docs: MemoryGovernanceDocs, contr
244
251
  * Returns what happened ({@link SessionAccountWrite}): `"absent"` (a session that never opened an
245
252
  * account — e.g. an adoption-restricted materialize — has no close, and the caller's disclosure
246
253
  * must not claim one), or `"stale"` when `leg` names a mount that no longer holds the row. */
247
- export declare function closeSessionAccount(docs: MemoryGovernanceDocs, controlDir: string, input: {
254
+ export declare function closeSessionAccount(docs: MemoryGovernanceDocs, input: {
248
255
  sessionId: string;
249
256
  now: () => number;
250
257
  leg?: string;
@@ -255,7 +262,7 @@ export type SessionAccountWrite = "written" | "absent" | "stale";
255
262
  /** Record that the session's leg ended ({@link SessionAccountRow.terminatedAt}). Touches nothing
256
263
  * else — `closedAt` stays whatever the harvests made it. `leg` (the caller's mount) must hold the
257
264
  * row: a leg that is over does not end the one that re-opened it. */
258
- export declare function terminateSessionAccount(docs: MemoryGovernanceDocs, controlDir: string, input: {
265
+ export declare function terminateSessionAccount(docs: MemoryGovernanceDocs, input: {
259
266
  sessionId: string;
260
267
  now: () => number;
261
268
  leg?: string;
@@ -263,15 +270,19 @@ export declare function terminateSessionAccount(docs: MemoryGovernanceDocs, cont
263
270
  /** The host valve for a dangling row (advisory; §3.6 — dangling rows never auto-expire). The
264
271
  * close is `closed-unadjudicated` (r7-3): it stops the row dangling but the residue arm keeps
265
272
  * firing until a full-domain harvest closes normally. `requestId` required (audit, #123). */
266
- export declare function resolveSessionAccountRecord(docs: MemoryGovernanceDocs, controlDir: string, input: {
273
+ export declare function resolveSessionAccountRecord(docs: MemoryGovernanceDocs, input: {
267
274
  sessionId: string;
268
275
  requestId: string;
269
276
  now: () => number;
270
277
  }): Promise<void>;
271
- /** The hold ledger's file: the File store's coordinate of the governance document `holds`. */
278
+ /** The hold ledger's file: the File store's coordinate of the governance document `holds` (read here only by the
279
+ * File layout's own key-form upgrade, {@link convertV1SidecarKeys}). */
272
280
  export declare const HOLDS_FILE: string;
273
281
  /** The hold custody directory: the File store's directory of the control-object kind `hold`. */
274
282
  export declare const HOLD_DIR: string;
283
+ /** What a hold is kept through: the governance store's ledger document `holds`, its `hold` custody objects and the
284
+ * `quarantine` objects a disposal moves them to. */
285
+ type HoldStore = MemoryGovernanceDocs & MemoryGovernanceObjects;
275
286
  export type HoldStatus = "capturing" | "held" | "released" | "disposed";
276
287
  export type HoldTerminal = "dirty" | "expired" | "conflict" | "discarded" | "capture_lost";
277
288
  export interface HoldRow {
@@ -313,24 +324,26 @@ export interface HoldRow {
313
324
  * rows resolved before the member existed (a generation-less clear matches those). */
314
325
  resolvedAt?: number;
315
326
  }
316
- export declare function readHolds(controlDir: string): HoldRow[];
327
+ export declare function readHolds(docs: MemoryGovernanceDocs): Promise<HoldRow[]>;
317
328
  /** Where a plane file is staged while it is displaced: a SIBLING in the file's OWN directory.
318
329
  * `rename` is atomic only WITHIN one filesystem, and the control plane is routinely a different mount
319
330
  * from the memory dir — staging there surrenders the atomicity the rename-first law exists for, and a
320
331
  * cross-device refusal is the ordinary shape of a two-volume deployment, not an exotic failure. A
321
332
  * sibling is on the file's filesystem by construction, so one path serves both layouts. The staged
322
- * name is never `.md`-suffixed; custody stays in the control plane ({@link retireStagingToCustody}). */
333
+ * name is never `.md`-suffixed; custody stays in the control plane ({@link retireStagingToObject}). */
323
334
  export declare function stagingPathBeside(absPath: string, stagingName: string): string;
324
- /** Move whatever still sits at a staged generation into control-plane custody and report WHERE the
325
- * bytes ended up. Withheld bytes belong in the control plane, never on the model-visible plane — but
326
- * a copy that cannot be made there must leave the only copy where it is and SAY so, so the coordinate
327
- * is the host's recovery address either way and `settled` answers one question: in custody, with
328
- * nothing left beside the seat? Takes an ALREADY-CLAIMED path (read, decision and removal address
329
- * one inode) and removes it only after {@link writeCustodyVerified} has proven the copy. */
330
- export declare function retireStagingToCustody(claimedPath: string, custodyDir: string, stagingName: string): {
335
+ /** Move whatever still sits at a staged generation into the governance store's control objects and report WHERE the
336
+ * bytes ended up. Withheld bytes belong in the control plane, never on the model-visible plane — but a copy that
337
+ * cannot be made there leaves the only copy where it is and SAYS so, so the coordinate is the host's recovery address
338
+ * either way and `settled` answers one question: in the store, with nothing left beside the seat? Takes an
339
+ * ALREADY-CLAIMED path (read, decision and removal address one inode): the staged bytes become the `kind` object
340
+ * `name`, read back through the store before the staged copy is removed. The removal is an act on the memory plane
341
+ * after this function's awaits, so `refusedAt` (the caller's anchor read) runs immediately before it — a refusal
342
+ * leaves the staged copy where it is and reports it, exactly as an unremovable copy does. */
343
+ export declare function retireStagingToObject(objects: Pick<MemoryGovernanceObjects, "putObject" | "getObject">, claimedPath: string, kind: MemoryControlObjectKind, name: string, refusedAt: () => string | undefined): Promise<{
331
344
  settled: boolean;
332
345
  at: string;
333
- };
346
+ }>;
334
347
  /** ATOMIC no-replace restore of a staged file onto a plane path (adversarial round 2: an
335
348
  * existsSync-then-rename pair is a TOCTOU — POSIX rename REPLACES a destination created between
336
349
  * the check and the call, clobbering a third writer's newer bytes). `link` refuses EEXIST
@@ -341,8 +354,9 @@ export declare function noReplaceRestore(stagingPath: string, destPath: string):
341
354
  * §4.2 — open one hold over an instruction-form file: the two-stage journal.
342
355
  * ① append row `status:"capturing"` (deterministic captureName + contentDigest minted from the
343
356
  * one read buffer) — the account exists before any byte moves;
344
- * ② write the custody file FROM THE SAME BUFFER, read it back, verify the digest;
345
- * ③ remove the plane file RENAME-FIRST (atomic move to a staged sibling in the file's OWN
357
+ * ② write the custody object FROM THE SAME BUFFER, read it back through the store, verify the digest;
358
+ * ③ the anchor read at the act (`actRefused` — ① and ② awaited the store), then remove the plane
359
+ * file RENAME-FIRST (atomic move to a staged sibling in the file's OWN
346
360
  * directory — {@link stagingPathBeside}), then hash what actually moved: equal ⇒ the staged
347
361
  * duplicate is dropped (custody already holds verified bytes); unequal ⇒ a third writer replaced
348
362
  * the file between read and rename — NO-CLOBBER rollback (the newer bytes go back ONLY if the
@@ -355,7 +369,7 @@ export declare function noReplaceRestore(stagingPath: string, destPath: string):
355
369
  * plane, revoked permission) is one such refusal: the file would stay on the plane, the one outcome
356
370
  * a hold may not produce.
357
371
  */
358
- export declare function openInstructionHold(controlDir: string, input: {
372
+ export declare function openInstructionHold(store: HoldStore, input: {
359
373
  sessionId: string;
360
374
  /** The seat in the ledger form (relative to the write scope's home). */
361
375
  rel: string;
@@ -368,7 +382,10 @@ export declare function openInstructionHold(controlDir: string, input: {
368
382
  scope: string;
369
383
  settleIds: readonly string[];
370
384
  now: () => number;
371
- }): {
385
+ /** The caller's act gate on the memory plane (the engine's anchor read), asked immediately before each act this
386
+ * function performs there: the refusal's text, or `undefined` when the act may proceed. */
387
+ actRefused: (path: string, act: string) => string | undefined;
388
+ }): Promise<{
372
389
  ok: true;
373
390
  holdId: string;
374
391
  thirdWriterStrandedAt?: string;
@@ -376,7 +393,7 @@ export declare function openInstructionHold(controlDir: string, input: {
376
393
  ok: false;
377
394
  holdId?: string;
378
395
  reason: string;
379
- };
396
+ }>;
380
397
  /**
381
398
  * §4.2 reconciliation — converge half-way holds (a crash between the journal stages):
382
399
  * - `capturing` + custody file present & digest-equal ⇒ flip held (the crash was after ②);
@@ -387,14 +404,17 @@ export declare function openInstructionHold(controlDir: string, input: {
387
404
  * - `capturing` + custody absent + plane file gone ⇒ `capture_lost` (nothing to hold).
388
405
  * - `held` + plane file REAPPEARED at the seat ⇒ left alone (a fresh write is a fresh file —
389
406
  * the next harvest judges it on its own; the hold's custody bytes stay the hold's).
390
- * - `disposed` + the row names its quarantine seat + the custody file is still at the custody seat
407
+ * - `disposed` + the row names its quarantine seat + the custody object still stands
391
408
  * ⇒ the disposal's move finishes (the row is written before the bytes move).
409
+ * The walk awaits the store between its acts on the memory plane, so the caller's anchor read
410
+ * (`actRefused`) is asked immediately before each of them.
392
411
  */
393
- export declare function reconcileHolds(controlDir: string, input: {
412
+ export declare function reconcileHolds(store: HoldStore, input: {
394
413
  homeOf: (scope: string) => string;
395
414
  now: () => number;
396
415
  onStranded: (scope: string, line: string) => void;
397
- }): void;
416
+ actRefused: (path: string, act: string) => string | undefined;
417
+ }): Promise<void>;
398
418
  /** The quarantine seat of a hold's custody bytes: a function of the ROW, never of a clock. The same
399
419
  * row names the same seat on every call, in every process, after any crash — the old
400
420
  * `<ms>-hold-<captureName>` shape with the row's own content digest where the wall clock was. */
@@ -404,35 +424,37 @@ export declare function holdQuarantineNameOf(row: Pick<HoldRow, "captureName" |
404
424
  * from-row-to-bytes addressing survives every terminal). Row first, bytes second: a crash between
405
425
  * the two leaves a row whose bytes are at the custody seat or the quarantine seat — both of which
406
426
  * {@link readHoldCustody} tries — and {@link reconcileHolds} finishes the move; the reverse order
407
- * would leave bytes in quarantine under a name no row recorded. Whether the row names a seat is read
408
- * INSIDE the ledger lock, from what stands at the custody seat and the quarantine seat at that
409
- * moment: a row with no custody bytes anywhere records the terminal with no name (nothing to move).
410
- * The verdict always lands: a quarantine seat held by something that is not the hold's bytes records
411
- * the terminal with no name, leaves the custody bytes where they are and replaces nothing — and then
427
+ * would leave bytes in quarantine under a name no row recorded. Whether the row names a seat is
428
+ * decided inside the ledger's update, on the fresh row, from what stands at the custody seat and the
429
+ * quarantine seat as read just before it (the update's callback runs synchronously and reads no
430
+ * object; a mover between that read and the update is the compound-decision window, KL-3308-c): a
431
+ * row with no custody bytes anywhere records the terminal with no name (nothing to move). The
432
+ * verdict always lands: a quarantine seat held by something that is not the hold's bytes records the
433
+ * terminal with no name, leaves the custody bytes where they are and replaces nothing — and then
412
434
  * refuses loudly (the caller hears it; a refused intake is terminal all the same). */
413
- export declare function disposeHold(controlDir: string, input: {
435
+ export declare function disposeHold(store: HoldStore, input: {
414
436
  holdId: string;
415
437
  terminal: HoldTerminal;
416
- }): {
438
+ }): Promise<{
417
439
  ok: boolean;
418
440
  quarantineName?: string;
419
- };
441
+ }>;
420
442
  /** Flip one row to released (the caller — the harvest release leg — has already committed the
421
- * custody bytes through the full gate set; the custody file is dropped after the flip). */
422
- export declare function markHoldReleased(controlDir: string, input: {
443
+ * custody bytes through the full gate set; the custody object is deleted after the flip). */
444
+ export declare function markHoldReleased(store: HoldStore, input: {
423
445
  holdId: string;
424
446
  now: () => number;
425
- }): void;
447
+ }): Promise<void>;
426
448
  /** The host valve — `resolveHold(holdId, "release"|"discard", requestId)`: records the verdict on
427
449
  * the row; the NEXT harvest reconciliation executes it ("release" re-walks the full gates and
428
450
  * commits WITH cause "static" — a timeout release is not proof of cleanliness; "discard"
429
451
  * disposes to quarantine). requestId required (audit, #123). */
430
- export declare function resolveHoldRecord(controlDir: string, input: {
452
+ export declare function resolveHoldRecord(docs: MemoryGovernanceDocs, input: {
431
453
  holdId: string;
432
454
  action: "release" | "discard";
433
455
  requestId: string;
434
456
  now: () => number;
435
- }): void;
457
+ }): Promise<void>;
436
458
  /**
437
459
  * Consume a standing valve verdict WITHOUT any other transition — the settle leg's exit for a
438
460
  * valve release that FAILED on an already-disposed row (an expired hold whose release hit a
@@ -451,15 +473,16 @@ export declare function resolveHoldRecord(controlDir: string, input: {
451
473
  * on purpose (refusing it would revive the forever-re-firing valve loop for every verdict minted
452
474
  * before the upgrade). Idempotent; unknown/verdict-less/other-generation rows are a no-op.
453
475
  */
454
- export declare function clearHoldResolution(controlDir: string, input: {
476
+ export declare function clearHoldResolution(docs: MemoryGovernanceDocs, input: {
455
477
  holdId: string;
456
478
  ifResolvedAt: number | undefined;
457
- }): void;
479
+ }): Promise<void>;
458
480
  /** Read one hold's custody bytes (release leg + expired-release valve). Returns undefined when
459
- * the custody file is gone or fails its digest — the caller records capture_lost, never commits
481
+ * the custody object is gone or fails its digest — the caller records capture_lost, never commits
460
482
  * unverified bytes. For an expired-released row the bytes may already sit in quarantine
461
483
  * (disposition.quarantineName) — both seats are tried, digest-verified either way. */
462
- export declare function readHoldCustody(controlDir: string, row: HoldRow): string | undefined;
484
+ export declare function readHoldCustody(objects: Pick<MemoryGovernanceObjects, "getObject">, row: HoldRow): Promise<string | undefined>;
463
485
  /** True ⇔ the session's pollution marker or any non-clean settlement row blocks a clean release
464
486
  * (§4.2-1: any non-clean row in the session's account keeps the hold held/disposed). */
465
- export declare function sessionBlocksCleanRelease(docs: MemoryGovernanceDocs, controlDir: string, sessionId: string): Promise<boolean>;
487
+ export declare function sessionBlocksCleanRelease(docs: MemoryGovernanceDocs & SessionPollutionObjects, sessionId: string): Promise<boolean>;
488
+ export {};