@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.
- package/CHANGELOG.md +571 -0
- package/dist/agents/delegation-registry-seat.d.ts +15 -0
- package/dist/agents/delegation-registry-seat.js +13 -0
- package/dist/agents/org-delivery-gate.d.ts +8 -1
- package/dist/agents/org-delivery-gate.js +9 -3
- package/dist/agents/peer-held-queue.js +1 -1
- package/dist/agents/peer-idle.js +1 -1
- package/dist/agents/peer-session-drain.d.ts +51 -12
- package/dist/agents/peer-session-drain.js +47 -34
- package/dist/agents/read-inbox-tool.d.ts +6 -2
- package/dist/agents/read-inbox-tool.js +18 -5
- package/dist/agents/subagent.d.ts +3 -1
- package/dist/agents/subagent.js +84 -77
- package/dist/brain/reasoning.d.ts +2 -0
- package/dist/brain/reasoning.js +1 -0
- package/dist/core/allow-entry.d.ts +9 -0
- package/dist/core/allow-entry.js +7 -1
- package/dist/core/ask-origin.d.ts +23 -3
- package/dist/core/ask-origin.js +11 -1
- package/dist/core/auto-promote.d.ts +3 -2
- package/dist/core/background-agent-store.d.ts +7 -0
- package/dist/core/checkpoint-store.d.ts +2 -3
- package/dist/core/context-settings.d.ts +1 -2
- package/dist/core/context-settings.js +1 -1
- package/dist/core/engine-attestation.d.ts +2 -2
- package/dist/core/engine-notice.d.ts +13 -1
- package/dist/core/engine-notice.js +3 -1
- package/dist/core/file-history-store.d.ts +2 -2
- package/dist/core/file-history-store.js +0 -4
- package/dist/core/gate-fold.js +3 -1
- package/dist/core/governance-codes.d.ts +6 -4
- package/dist/core/governance-codes.js +5 -3
- package/dist/core/human-input-projection.d.ts +9 -0
- package/dist/core/human-input-projection.js +13 -0
- package/dist/core/input-author.d.ts +66 -6
- package/dist/core/input-author.js +21 -3
- package/dist/core/leg-identity.d.ts +18 -2
- package/dist/core/leg-identity.js +5 -7
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.d.ts +30 -10
- package/dist/core/memory-engine/consolidation.js +41 -6
- package/dist/core/memory-engine/control-objects.d.ts +36 -3
- package/dist/core/memory-engine/control-objects.js +134 -12
- package/dist/core/memory-engine/control-plane-adoption.d.ts +13 -9
- package/dist/core/memory-engine/control-plane-adoption.js +58 -31
- package/dist/core/memory-engine/delegation-settlement.d.ts +75 -52
- package/dist/core/memory-engine/delegation-settlement.js +211 -228
- package/dist/core/memory-engine/dual-root.d.ts +3 -2
- package/dist/core/memory-engine/dual-root.js +5 -1
- package/dist/core/memory-engine/engine.d.ts +33 -16
- package/dist/core/memory-engine/engine.js +213 -177
- package/dist/core/memory-engine/file-backend.d.ts +21 -12
- package/dist/core/memory-engine/file-backend.js +58 -104
- package/dist/core/memory-engine/index.d.ts +2 -2
- package/dist/core/memory-engine/index.js +2 -2
- package/dist/core/memory-engine/layout.d.ts +184 -83
- package/dist/core/memory-engine/layout.js +267 -172
- package/dist/core/memory-engine/memory-age.d.ts +12 -0
- package/dist/core/memory-engine/memory-age.js +17 -0
- package/dist/core/memory-engine/memory-backend-contract.js +12 -11
- package/dist/core/memory-engine/memory-deployment.d.ts +4 -3
- package/dist/core/memory-engine/memory-deployment.js +6 -3
- package/dist/core/memory-engine/origin-clearance.d.ts +43 -15
- package/dist/core/memory-engine/origin-clearance.js +142 -58
- package/dist/core/memory-engine/tools.d.ts +2 -2
- package/dist/core/memory-engine/tools.js +7 -7
- package/dist/core/memory-engine/types.d.ts +16 -10
- package/dist/core/memory-vector.d.ts +6 -14
- package/dist/core/memory.d.ts +0 -462
- package/dist/core/memory.js +0 -333
- package/dist/core/model-receipt.d.ts +2 -1
- package/dist/core/model-receipt.js +5 -0
- package/dist/core/mods/dollar.d.ts +12 -0
- package/dist/core/mods/kernel/dispatch.d.ts +3 -1
- package/dist/core/mods/kernel/dispatch.js +5 -2
- package/dist/core/mods/kernel/events.d.ts +3 -1
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/prompt-submit.d.ts +4 -0
- package/dist/core/mods/prompt-submit.js +24 -0
- package/dist/core/mods/stations.d.ts +23 -4
- package/dist/core/mods/stations.js +14 -7
- package/dist/core/permission-rule-consent.d.ts +49 -18
- package/dist/core/permission-rule-consent.js +59 -38
- package/dist/core/permission-rule-store.d.ts +24 -14
- package/dist/core/retention.d.ts +2 -7
- package/dist/core/retention.js +0 -1
- package/dist/core/retired-host-table-account.d.ts +19 -0
- package/dist/core/retired-host-table-account.js +28 -0
- package/dist/core/retired-tool-name-account.d.ts +60 -0
- package/dist/core/retired-tool-name-account.js +32 -0
- package/dist/core/roles.d.ts +3 -1
- package/dist/core/roles.js +5 -2
- package/dist/core/runner/classifier-ladder.d.ts +3 -1
- package/dist/core/runner/classifier-ladder.js +2 -2
- package/dist/core/runner/compact-session.js +2 -1
- package/dist/core/runner/contracts.d.ts +9 -9
- package/dist/core/runner/delegation-owner.d.ts +0 -8
- package/dist/core/runner/delegation-owner.js +1 -3
- package/dist/core/runner/gate-exit.js +9 -2
- package/dist/core/runner/memory-consolidation-driver.js +2 -2
- package/dist/core/runner/prepare-config-doors.js +1 -1
- package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
- package/dist/core/runner/prepare-delegation-surface.js +5 -3
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -5
- package/dist/core/runner/prepare-gate-stations.js +13 -5
- package/dist/core/runner/prepare-inherited-gate.js +2 -0
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.js +35 -14
- package/dist/core/runner/prepare-policy-chain.js +12 -3
- package/dist/core/runner/prepare-project-context.js +2 -2
- package/dist/core/runner/prepare-task.d.ts +9 -1
- package/dist/core/runner/prepare-task.js +6 -5
- package/dist/core/runner/prepare-wiring-manifest.js +5 -4
- package/dist/core/runner/prompt-suggestions.js +1 -1
- package/dist/core/runner/run-identity-wiring.js +2 -2
- package/dist/core/runner/run-leg.js +3 -3
- package/dist/core/runner/run-notification-lane.d.ts +3 -0
- package/dist/core/runner/run-notification-lane.js +2 -2
- package/dist/core/runner/runtask.js +6 -3
- package/dist/core/runner/steer-admission.d.ts +11 -2
- package/dist/core/runner/stream-steer-verb.d.ts +5 -2
- package/dist/core/runner/stream-steer-verb.js +67 -14
- package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -8
- package/dist/core/runner/sub-agent-deny-lists.js +22 -8
- package/dist/core/runner-deps.d.ts +4 -4
- package/dist/core/secret-env.d.ts +2 -2
- package/dist/core/secret-env.js +6 -20
- package/dist/core/session-store.d.ts +6 -6
- package/dist/core/session-store.js +3 -3
- package/dist/core/shell-run-candidates.js +3 -3
- package/dist/core/side-query.js +1 -1
- package/dist/core/skill-grant.d.ts +7 -0
- package/dist/core/skill-grant.js +14 -5
- package/dist/core/store-contracts/background-agent-store-contract.js +13 -0
- package/dist/core/task-event.d.ts +14 -0
- package/dist/core/task-notification.d.ts +35 -8
- package/dist/core/task-notification.js +31 -13
- package/dist/core/task-registry-agent.js +1 -0
- package/dist/core/task-registry-shared.d.ts +4 -0
- package/dist/core/tool-errors.d.ts +3 -3
- package/dist/core/tool-policy.js +2 -3
- package/dist/core/tool-spec.d.ts +20 -10
- package/dist/core/user-attachment.d.ts +5 -1
- package/dist/core/user-attachment.js +11 -5
- package/dist/core/write-protect.d.ts +16 -0
- package/dist/core/write-protect.js +10 -0
- package/dist/engine/harness/agent-harness.d.ts +19 -11
- package/dist/engine/harness/agent-harness.js +7 -4
- package/dist/engine/llm/types.d.ts +22 -10
- package/dist/engine/session/repo-utils.d.ts +14 -4
- package/dist/engine/session/repo-utils.js +5 -4
- package/dist/index.d.ts +10 -8
- package/dist/index.js +9 -7
- package/dist/prompts/default.d.ts +1 -2
- package/dist/scenarios/full-body.d.ts +1 -1
- package/dist/shell/lex.d.ts +50 -15
- package/dist/shell/lex.js +43 -9
- package/dist/stores/file/adoption/adopt.d.ts +1 -1
- package/dist/stores/file/index.d.ts +1 -15
- package/dist/stores/file/index.js +1 -15
- package/dist/stores/file/permission-rule-store.d.ts +12 -1
- package/dist/stores/file/permission-rule-store.js +31 -4
- package/dist/stores/file/session-store.js +1 -1
- package/dist/tools/fs/fs-bash.js +3 -3
- package/dist/tools/fs/removal-targets.d.ts +8 -2
- package/dist/tools/fs/removal-targets.js +31 -4
- package/dist/tools/fs/shell-read-argv.js +7 -1
- package/dist/tools/fs/shell-read-bindings.d.ts +21 -5
- package/dist/tools/fs/shell-read-bindings.js +130 -44
- package/dist/tools/fs/shell-read-plan.js +95 -29
- package/dist/tools/fs/shell-read-sourced.d.ts +25 -0
- package/dist/tools/fs/shell-read-sourced.js +119 -0
- package/dist/tools/fs/shell-read-word.d.ts +2 -2
- package/dist/tools/fs/shell-read-word.js +4 -5
- package/dist/tools/fs/shell-read-workdir.d.ts +19 -3
- package/dist/tools/fs/shell-read-workdir.js +60 -15
- package/dist/tools/fs/shell-reentry-text.d.ts +10 -2
- package/dist/tools/fs/shell-reentry-text.js +11 -4
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +21 -79
- package/wire-changes/core-stores-sql@7.65.0.json +30 -0
- package/wire-changes/core-stores-sql@7.66.0.json +30 -0
- package/wire-changes/core@7.65.0.json +1650 -0
- package/wire-changes/core@7.66.0.json +1218 -0
- package/wire-changes/mods-kernel@7.65.0.json +30 -0
- package/wire-changes/mods-kernel@7.66.0.json +65 -0
- package/wire-changes/primitives@7.65.0.json +337 -0
- package/wire-changes/primitives@7.66.0.json +30 -0
- package/dist/core/memory-recall.d.ts +0 -208
- package/dist/core/memory-recall.js +0 -136
- package/dist/stores/file/memory-store.d.ts +0 -124
- 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
|
|
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
|
|
186
|
-
*
|
|
187
|
-
*
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
209
|
-
*
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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(
|
|
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
|
|
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
|
|
325
|
-
* bytes ended up. Withheld bytes belong in the control plane, never on the model-visible plane — but
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
|
|
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
|
|
345
|
-
* ③
|
|
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(
|
|
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
|
|
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(
|
|
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
|
-
|
|
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
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
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(
|
|
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
|
|
422
|
-
export declare function markHoldReleased(
|
|
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(
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
487
|
+
export declare function sessionBlocksCleanRelease(docs: MemoryGovernanceDocs & SessionPollutionObjects, sessionId: string): Promise<boolean>;
|
|
488
|
+
export {};
|