@sema-agent/core 7.64.0 → 7.65.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 +317 -0
- package/dist/agents/peer-held-queue.js +1 -1
- package/dist/agents/peer-idle.js +1 -1
- package/dist/agents/peer-session-drain.js +3 -3
- package/dist/agents/subagent.js +5 -2
- 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 +4 -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 +10 -4
- package/dist/core/memory-engine/consolidation.js +11 -1
- 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 +5 -2
- package/dist/core/memory-engine/control-plane-adoption.js +5 -3
- package/dist/core/memory-engine/delegation-settlement.d.ts +59 -42
- package/dist/core/memory-engine/delegation-settlement.js +175 -202
- 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 +16 -10
- package/dist/core/memory-engine/engine.js +138 -145
- package/dist/core/memory-engine/file-backend.d.ts +17 -11
- package/dist/core/memory-engine/file-backend.js +53 -103
- package/dist/core/memory-engine/layout.d.ts +129 -49
- package/dist/core/memory-engine/layout.js +202 -82
- 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 +5 -4
- package/dist/core/memory-engine/memory-deployment.d.ts +1 -1
- package/dist/core/memory-engine/origin-clearance.js +1 -5
- 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/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/runner/classifier-ladder.d.ts +3 -1
- package/dist/core/runner/classifier-ladder.js +2 -2
- 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/prepare-gate-stations.d.ts +8 -5
- package/dist/core/runner/prepare-gate-stations.js +13 -5
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.js +9 -9
- package/dist/core/runner/prepare-policy-chain.js +11 -3
- package/dist/core/runner/prepare-task.d.ts +5 -1
- package/dist/core/runner/prepare-task.js +3 -3
- package/dist/core/runner/run-notification-lane.js +1 -1
- package/dist/core/runner/sub-agent-deny-lists.d.ts +19 -0
- package/dist/core/runner/sub-agent-deny-lists.js +25 -0
- 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/store-contracts/background-agent-store-contract.js +13 -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-spec.d.ts +7 -7
- package/dist/core/write-protect.d.ts +16 -0
- package/dist/core/write-protect.js +10 -0
- package/dist/engine/session/repo-utils.d.ts +14 -4
- package/dist/engine/session/repo-utils.js +5 -4
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/prompts/default.d.ts +1 -2
- package/dist/scenarios/full-body.d.ts +1 -1
- 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/package.json +2 -2
- package/test/export-surface.snapshot.json +9 -73
- package/wire-changes/core-stores-sql@7.65.0.json +30 -0
- package/wire-changes/core@7.65.0.json +1650 -0
- package/wire-changes/mods-kernel@7.65.0.json +30 -0
- package/wire-changes/primitives@7.65.0.json +337 -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
|
@@ -278,14 +278,18 @@ export declare function adoptRootScopeLayout(rootPath: string, controlDir: strin
|
|
|
278
278
|
export declare const canonicalize: typeof physicalPathOfExisting;
|
|
279
279
|
/** True iff `child` (canonicalized) is `root` or inside it. */
|
|
280
280
|
export declare function isContainedIn(root: string, child: string): boolean;
|
|
281
|
-
/** The codes the store's physical form refuses an act with — the whole family, one closed set: {@link TARGET_OUTSIDE_STORE}
|
|
282
|
-
* {@link SCOPE_HOME_NOT_DIRECTORY}. Each is a plain `Error` carrying `code` and a
|
|
283
|
-
|
|
281
|
+
/** The codes the store's physical form refuses an act with — the whole family, one closed set: {@link TARGET_OUTSIDE_STORE},
|
|
282
|
+
* {@link SCOPE_HOME_NOT_DIRECTORY} and {@link CONTROL_PLANE_LINKS_UNSUPPORTED}. Each is a plain `Error` carrying `code` and a
|
|
283
|
+
* `detail` ({@link StoreFormRefusalDetail}). */
|
|
284
|
+
export declare const STORE_FORM_REFUSAL_CODES: readonly ["memory.target_outside_store", "memory.scope_home_not_directory", "memory.control_plane_links_unsupported"];
|
|
284
285
|
export type StoreFormRefusalCode = (typeof STORE_FORM_REFUSAL_CODES)[number];
|
|
285
286
|
/** The code an act on a store path is refused with when it would land outside the store ({@link landsOutsideStore}). */
|
|
286
287
|
export declare const TARGET_OUTSIDE_STORE = "memory.target_outside_store";
|
|
287
288
|
/** The code a scope home that is not a real directory is refused with ({@link assertHomePhysicalForm}). */
|
|
288
289
|
export declare const SCOPE_HOME_NOT_DIRECTORY = "memory.scope_home_not_directory";
|
|
290
|
+
/** The code a File governance store's open is refused with when its control plane's file system cannot make a hard link
|
|
291
|
+
* (`probeControlPlaneLinks`, `control-objects.ts`; #3512). */
|
|
292
|
+
export declare const CONTROL_PLANE_LINKS_UNSUPPORTED = "memory.control_plane_links_unsupported";
|
|
289
293
|
/** What a scope home can be besides a real directory (an `lstat` verdict). */
|
|
290
294
|
export declare const SCOPE_HOME_FORMS: readonly ["symlink", "file", "other"];
|
|
291
295
|
export type ScopeHomeForm = (typeof SCOPE_HOME_FORMS)[number];
|
|
@@ -296,7 +300,8 @@ declare const SCOPE_HOME_FORM_PHRASE: {
|
|
|
296
300
|
readonly other: "a special file";
|
|
297
301
|
};
|
|
298
302
|
export type HomeFormPhraseCoversEveryForm = AssertAllKeysHandled<Exclude<ScopeHomeForm, keyof typeof SCOPE_HOME_FORM_PHRASE>>;
|
|
299
|
-
/** What a store-form refusal carries beside its sentence. Host paths live here and never in the sentence
|
|
303
|
+
/** What a store-form refusal carries beside its sentence. Host paths live here and never in the sentence (on
|
|
304
|
+
* {@link CONTROL_PLANE_LINKS_UNSUPPORTED}, `path` is the control plane);
|
|
300
305
|
* `form` is present on {@link SCOPE_HOME_NOT_DIRECTORY} only; `controlDir`, `recorded` and `now` are present
|
|
301
306
|
* together on a moved store root only ({@link storeRootMovedRefusal}): the control plane whose root anchor
|
|
302
307
|
* refused (the `controlDir` to hand {@link reanchorMemoryStoreRoot}), the physical root the anchor records,
|
|
@@ -336,6 +341,9 @@ export declare function storeRootAbsentRefusal(path: string, anchor: {
|
|
|
336
341
|
}): StoreFormRefusal;
|
|
337
342
|
/** Seat 3 — a scope home that is not a real directory. */
|
|
338
343
|
export declare function scopeHomeRefusal(form: ScopeHomeForm, path: string): StoreFormRefusal;
|
|
344
|
+
/** Seat 4 — the control plane at `path` is on a file system that refused a hard link (`fault`: the error code `link`
|
|
345
|
+
* answered, when it named one). The store publishes every control object with `link`, so it is not opened there. */
|
|
346
|
+
export declare function controlPlaneLinksRefusal(path: string, fault: string | undefined): StoreFormRefusal;
|
|
339
347
|
/** Where an act at `p` lands: the physical path of its normalized spelling (the spelling a child path
|
|
340
348
|
* joined under it carries), a MISSING tail rejoined under the deepest existing directory (what the act
|
|
341
349
|
* creates) — a dangling link on that tail followed to where it points (what the act would create through
|
|
@@ -501,10 +509,10 @@ export declare function withPermissionRemedy<T>(err: T, memoryDir: string): T;
|
|
|
501
509
|
* (engine harvest, engine derived-index rung, backend inbound gate): they write the same directory,
|
|
502
510
|
* so its name and its permissions must not depend on which of them ran first. */
|
|
503
511
|
export declare const QUARANTINE_DIR = "quarantine";
|
|
504
|
-
/** REF-A9 — what {@link
|
|
512
|
+
/** REF-A9 — what {@link clearContainedPath} reports back; both hosts escalate `detail` into
|
|
505
513
|
* their report channel (harvest `quarantineFailures` / inbound `quarantine_failed` findings). */
|
|
506
514
|
export interface QuarantineOutcome {
|
|
507
|
-
/** The captured copy
|
|
515
|
+
/** The captured copy: its name among the governance store's `quarantine` objects. Absent ⇔ the capture itself failed. */
|
|
508
516
|
dest?: string;
|
|
509
517
|
/** True ⇔ the model-visible file no longer holds the suspect content (deleted, or tombstoned). */
|
|
510
518
|
removed: boolean;
|
|
@@ -512,27 +520,12 @@ export interface QuarantineOutcome {
|
|
|
512
520
|
* may overwrite (see {@link restoreContainedBaseline}). ABSENT ⇔ the path was freed. Present ⇔ either
|
|
513
521
|
* this engine's own tombstone (the clear-in-place rung) or the suspect bytes themselves (neither rung
|
|
514
522
|
* worked) — in both cases replacing it takes nobody else's work, and in neither case may anything the
|
|
515
|
-
* restore did not put there be destroyed.
|
|
523
|
+
* restore did not put there be destroyed. A path found rewritten after it was read reports the bytes that
|
|
524
|
+
* were read: the newer bytes there are not them, so a following restore keeps its hands off. */
|
|
516
525
|
leftOnPlane?: string;
|
|
517
526
|
/** Set on ANY deviation from the clean capture+delete path — never a silent best-effort downgrade. */
|
|
518
527
|
detail?: string;
|
|
519
528
|
}
|
|
520
|
-
/**
|
|
521
|
-
* B2/L4 + C-F9 (S2-0) — capture a gate-rejected file into control-plane quarantine FROM THE
|
|
522
|
-
* ALREADY-READ `content` (never re-reading `path`: the disk bytes may have been swapped since the
|
|
523
|
-
* gate scanned them — TOCTOU), then remove the suspect from the model-visible plane: delete, and if
|
|
524
|
-
* that fails overwrite in place with {@link DELETED_TOMBSTONE}.
|
|
525
|
-
*
|
|
526
|
-
* REF-A9: ONE implementation for the engine's harvest rung and the backend's inbound-gate rung.
|
|
527
|
-
* They were line-for-line twins carrying the same historical fix ("mirrors the engine-side fix",
|
|
528
|
-
* opus review 1.257.2) and had already drifted twice — the backend minted its quarantine filename
|
|
529
|
-
* off `Date.now()` instead of its own injected clock, and the two created the SHARED quarantine dir
|
|
530
|
-
* with different permissions (whoever ran first decided how readable the captured secrets were).
|
|
531
|
-
*
|
|
532
|
-
* NOT to be reused for the derived-index rung (`MemoryEngine.gateDerivedIndex`): that one CLEARS the
|
|
533
|
-
* file (the index is derived and is rebuilt from entry frontmatter), which is the opposite of a
|
|
534
|
-
* tombstone — folding them would launder that distinction away.
|
|
535
|
-
*/
|
|
536
529
|
/**
|
|
537
530
|
* Write `content` to `path`, refusing to follow a symlink at the FINAL component (`O_NOFOLLOW`).
|
|
538
531
|
*
|
|
@@ -616,7 +609,7 @@ export declare function dropStagingSecondNames(seat: string, opened: {
|
|
|
616
609
|
readonly ino: number;
|
|
617
610
|
}): number;
|
|
618
611
|
/**
|
|
619
|
-
* The ONE way a committed baseline goes back after {@link
|
|
612
|
+
* The ONE way a committed baseline goes back after {@link clearContainedPath} emptied its seat —
|
|
620
613
|
* the inverse half of that function, beside it so the removal word and its readers stay in one module.
|
|
621
614
|
* Both containment arms (the capture-residue sweep and the polluted-harvest record loop) call it, and
|
|
622
615
|
* the rule is ONE sentence: THE RESTORE MAY ONLY OVERWRITE WHAT THE CONTAINMENT ITSELF LEFT AT THE PATH.
|
|
@@ -633,10 +626,90 @@ export declare function dropStagingSecondNames(seat: string, opened: {
|
|
|
633
626
|
* which took them off the plane as surely as the removal would have.
|
|
634
627
|
*/
|
|
635
628
|
export declare function restoreContainedBaseline(path: string, committed: string, leftOnPlane: string | undefined): "written" | "kept" | "failed";
|
|
636
|
-
|
|
629
|
+
/** What keeping one suspect file's copy came to: the name its copy is kept under among the governance store's
|
|
630
|
+
* `quarantine` objects, or why no copy could be kept. */
|
|
631
|
+
export type QuarantineCapture = {
|
|
632
|
+
readonly name: string;
|
|
633
|
+
} | {
|
|
634
|
+
readonly failed: string;
|
|
635
|
+
};
|
|
636
|
+
/** The governance store's quarantine objects, as a capture writes them. */
|
|
637
|
+
export type QuarantineObjects = Pick<import("./types.js").MemoryGovernanceObjects, "putObject" | "getObject">;
|
|
638
|
+
/** Write `(kind, name)` once for a writer whose record is the FIRST one under that name (a capture name, a pollution
|
|
639
|
+
* slot, an imported record): `"created"` ⇔ this call wrote `bytes`; `"existed"` ⇔ an object stands under the name and
|
|
640
|
+
* reads back — the same bytes (the put answered so), or other bytes the put refused to overwrite: the record that
|
|
641
|
+
* stands is the first one, and the writer moves on (the next capture name; the standing record's reading). A refusal
|
|
642
|
+
* no readable object explains (a store that fails, an entry that is no object, a name the store refuses) is the put's
|
|
643
|
+
* own and is thrown. The File store's synchronous paths take its twin, `putFileControlObjectOnce` (`control-objects.ts`). */
|
|
644
|
+
export declare function putControlObjectOnce(objects: Pick<import("./types.js").MemoryGovernanceObjects, "putObject" | "getObject">, kind: import("./types.js").MemoryControlObjectKind, name: string, bytes: Uint8Array): Promise<"created" | "existed">;
|
|
645
|
+
/** The name the copy of the suspect file at `path` is tried under on `attempt` (0…10). codex batch-2 review F2: the
|
|
646
|
+
* key is timestamp+basename, and two rejected files can legally share BOTH (same basename under different parents,
|
|
647
|
+
* one clock tick — or a test's frozen injected clock), so a capture is written ONCE (a standing name is never
|
|
648
|
+
* replaced) and suffixed on collision; bounded — after the numbered tries, one last name keyed by pid+counter (unique
|
|
649
|
+
* within this process) either lands or the capture fails. A `\` (legal in a POSIX file name, never in an object name)
|
|
650
|
+
* is spelled `%5C`. */
|
|
651
|
+
export declare function quarantineCaptureName(base: string, attempt: number): string;
|
|
652
|
+
/** The base of every capture name for the suspect file at `path`: `<now>-<basename>` ({@link quarantineCaptureName}). */
|
|
653
|
+
export declare function quarantineCaptureBase(path: string, now: () => number): string;
|
|
654
|
+
/** Keep the copy of the suspect file at `path` (its already-read `content`) as a `quarantine` object of the
|
|
655
|
+
* governance store, under the first of its capture names ({@link quarantineCaptureName}) that does not stand yet. */
|
|
656
|
+
export declare function captureIntoQuarantine(objects: QuarantineObjects, path: string, content: string, now: () => number): Promise<QuarantineCapture>;
|
|
657
|
+
/** The governance store's quarantine objects, as an erasure finds and removes them. A reader that must see damage hands
|
|
658
|
+
* in the store's damage-visible view (`standingControlObjectsOf`, `consolidation.ts`): for the File store its listing
|
|
659
|
+
* names every entry standing in the kind's directory; any other store's listing is its own (KL-3466-c). */
|
|
660
|
+
export type QuarantineErasureObjects = Pick<import("./types.js").MemoryGovernanceObjects, "listObjects" | "getObject" | "deleteObject">;
|
|
661
|
+
/** What one erasure did to the quarantine objects. `removed` — the copies of an erased entry this call deleted;
|
|
662
|
+
* `remaining` — the copies it could not delete AND the objects it could not read to tell (an object that stands unread
|
|
663
|
+
* is never read as none of the request's: fail-closed, it keeps the request partial); `unreadable` — how many of
|
|
664
|
+
* `remaining` are those unread objects; `unattributed` — the objects read whose bytes name no entry id (a fragment, an
|
|
665
|
+
* index copy), counted and left. */
|
|
666
|
+
export interface QuarantineErasure {
|
|
667
|
+
removed: number;
|
|
668
|
+
remaining: number;
|
|
669
|
+
unreadable: number;
|
|
670
|
+
unattributed: number;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Delete every `quarantine` object whose bytes are a copy of an erased entry — the frontmatter `id` they carry is in `ids`
|
|
674
|
+
* — through the store's object verbs: one law for every carrier, the File store's directory and a database store alike.
|
|
675
|
+
* Only the `quarantine` kind is read and only a name its listing gave is deleted; a pollution marker, an import receipt
|
|
676
|
+
* or a hold's capture is never touched, whatever its bytes say. An object the store answers as gone between the listing
|
|
677
|
+
* and the read or the delete is not counted. A listing that fails (or answers anything but a list of names) throws
|
|
678
|
+
* `ControlPlaneCorruptError` — an enumeration that fails is never an empty kind; the lane that called decides what its
|
|
679
|
+
* attestation says about that (the File face refuses and a replay converges; the degraded lane answers `unverified`).
|
|
680
|
+
*/
|
|
681
|
+
export declare function eraseQuarantineCopies(objects: QuarantineErasureObjects, ids: ReadonlySet<string>): Promise<QuarantineErasure>;
|
|
682
|
+
/**
|
|
683
|
+
* Take the suspect file at `path` off the model-visible plane once its copy is kept (`capture`): unlink it, else
|
|
684
|
+
* clear it to a tombstone in place. `content` is the bytes the caller read and captured; a path that now reads back
|
|
685
|
+
* DIFFERENT bytes is left alone — they were written after the capture was read, so they are not the suspect copy,
|
|
686
|
+
* and removing them would destroy bytes no copy holds (a read that cannot run removes as before: only a successful
|
|
687
|
+
* read of other bytes stops the removal).
|
|
688
|
+
*
|
|
689
|
+
* ONE implementation for the engine's harvest rungs and the backend's inbound gate (REF-A9: two line-for-line twins
|
|
690
|
+
* had drifted twice). The derived-index rung clears its file instead of tombstoning it — the index is rebuilt from
|
|
691
|
+
* entry frontmatter — so it does not come through here.
|
|
692
|
+
*/
|
|
693
|
+
export declare function clearContainedPath(path: string, content: string, capture: QuarantineCapture): QuarantineOutcome;
|
|
694
|
+
/** Keep the copies of a derived file (its already-read `text`) before a containment overwrites it — the index's
|
|
695
|
+
* clear and its restore, which take whatever stands (the index is derived: its prose has no entry a later judgment
|
|
696
|
+
* could hang on, so the containment wins over the copy, as a capture that fails never stopped it). The copy is a
|
|
697
|
+
* store write (`keep`, which awaits), so the file is read again after it (`reread`: the caller's act-gated read that
|
|
698
|
+
* never follows a link, so a path re-pointed in that window is refused, not copied) and bytes rewritten in that
|
|
699
|
+
* window are kept too — at most three copies; a file still moving after that has its last version uncopied, and
|
|
700
|
+
* says so. `landed` ⇔ every version that stood was copied; `failed` says why each that was not. */
|
|
701
|
+
export declare function keepCopiesBeforeOverwrite(text: string, keep: (bytes: string) => Promise<true | string>, reread: () => string | undefined): Promise<{
|
|
702
|
+
landed: boolean;
|
|
703
|
+
failed: string[];
|
|
704
|
+
}>;
|
|
637
705
|
/** The name prefix of {@link atomicWriteFileSync}'s temporary file, created beside its target and renamed onto it.
|
|
638
706
|
* One spelling for the writer and for {@link STORE_OPEN_ARTIFACTS}. */
|
|
639
707
|
export declare const ATOMIC_WRITE_TMP_PREFIX = ".tmp-";
|
|
708
|
+
/** The name prefix of the two files a File governance store's open makes at its control plane's top level to try one
|
|
709
|
+
* hard link, and removes before the open answers (`probeControlPlaneLinks`, `control-objects.ts`; #3512). One
|
|
710
|
+
* spelling for the probe and for {@link STORE_OPEN_ARTIFACTS}: a probe cut short between its two steps leaves an
|
|
711
|
+
* inert file, never a record. */
|
|
712
|
+
export declare const LINK_PROBE_PREFIX = ".link-probe-";
|
|
640
713
|
/** The infix of a stolen lock's tombstone, `<lock directory><infix><unique>`: both mkdir mutexes (the sidecar lock
|
|
641
714
|
* and the store's transaction lock) rename a crashed holder's lock to it before removing it. One spelling for both
|
|
642
715
|
* steals and for {@link STORE_OPEN_ARTIFACTS}. */
|
|
@@ -644,7 +717,8 @@ export declare const LOCK_TOMB_INFIX = ".stale-";
|
|
|
644
717
|
/**
|
|
645
718
|
* The named artifacts of a File store's mount — the files an OPEN or a READ of the store may leave there, by place
|
|
646
719
|
* and exact name (or fixed prefix); the list the contract `memory.deployment.store_set` names. Opening anchors the
|
|
647
|
-
* root (the anchor, written through a temporary file under its lock)
|
|
720
|
+
* root (the anchor, written through a temporary file under its lock) and tries one hard link between two dot-files at
|
|
721
|
+
* the control plane's top level, removed before the open answers (#3512); a read registers the scope it reads (the
|
|
648
722
|
* registry and its commit journal, under the registry's lock); a refused request or a recovery takes the store's
|
|
649
723
|
* transaction lock; a lock found stale is stolen through a tombstone; a registration of two labels that differ only
|
|
650
724
|
* in letter case probes the volume with a dot-file at the memory directory's top level — on any volume, folding or not,
|
|
@@ -850,11 +924,14 @@ export interface SessionPollutionRecord {
|
|
|
850
924
|
* absent (no resolver wired, or written before the axis) ⇒ it binds every occupant. */
|
|
851
925
|
incarnation?: string;
|
|
852
926
|
}
|
|
927
|
+
/** The part of a governance store the session pollution markers are kept through: its control objects of kind
|
|
928
|
+
* `pollution`, one per record slot ({@link sessionRecordName}). */
|
|
929
|
+
export type SessionPollutionObjects = Pick<import("./types.js").MemoryGovernanceObjects, "putObject" | "getObject" | "listObjects">;
|
|
853
930
|
/**
|
|
854
|
-
* Mark `sessionId` polluted (idempotent; the FIRST record wins —
|
|
931
|
+
* Mark `sessionId` polluted (idempotent; the FIRST record wins — the object is written once, never replaced).
|
|
855
932
|
*
|
|
856
933
|
* The outcome distinguishes the two ways a durable marker can exist after the call, because the
|
|
857
|
-
*
|
|
934
|
+
* write-once create is the only ATOMIC answer to "who made this transition" available anywhere in the
|
|
858
935
|
* stack (#324a, adversarial-review round 5): a check-then-act pre-read lets two concurrent markers
|
|
859
936
|
* of one session both believe they were first, and a once-per-session disclosure keyed on that would
|
|
860
937
|
* announce twice. `"created"` ⇔ THIS call minted the marker; `"existed"` ⇔ it was already there (a
|
|
@@ -863,32 +940,32 @@ export interface SessionPollutionRecord {
|
|
|
863
940
|
* stays polluted for this process either way).
|
|
864
941
|
*/
|
|
865
942
|
export type SessionPollutionMarkOutcome = "created" | "existed" | "unpersisted";
|
|
866
|
-
export declare function markSessionPolluted(
|
|
943
|
+
export declare function markSessionPolluted(objects: SessionPollutionObjects, sessionId: string, reason: string, now: () => number, cause?: import("./types.js").MemoryOriginCause, incarnation?: string): Promise<SessionPollutionMarkOutcome>;
|
|
867
944
|
/** Read the durable pollution record for `sessionId` (undefined = no marker).
|
|
868
945
|
* A marker that EXISTS still reads as polluted whether or not its bytes can be read or parsed
|
|
869
|
-
* (fail-closed: neither corruption nor an unreadable
|
|
870
|
-
* record stands in. Only ABSENCE is clean
|
|
871
|
-
* clean
|
|
872
|
-
export declare function readSessionPollution(
|
|
946
|
+
* (fail-closed: neither corruption nor an unreadable object may launder the state) — a synthesized
|
|
947
|
+
* record stands in. Only ABSENCE is clean: a store that cannot answer whether a slot stands reads as
|
|
948
|
+
* polluted, never as clean (the store's law — a fault is never an absence). */
|
|
949
|
+
export declare function readSessionPollution(objects: SessionPollutionObjects, sessionId: string, identity?: SessionIdentityRead): Promise<SessionPollutionRecord | undefined>;
|
|
873
950
|
/**
|
|
874
951
|
* design/178 v2-c §3-3 — enumerate EVERY durable pollution marker (the export snapshot's pollution
|
|
875
952
|
* face; `readSessionPollution` stays the per-session read). Same fail-closed record posture as the
|
|
876
|
-
* per-session read: a marker
|
|
877
|
-
* record, never a silent omission (corruption must not launder the state out of an export).
|
|
878
|
-
*
|
|
879
|
-
*
|
|
953
|
+
* per-session read: a marker that stands but cannot be read or parsed answers a synthesized
|
|
954
|
+
* record, never a silent omission (corruption must not launder the state out of an export). A kind
|
|
955
|
+
* with no objects is the genuine empty state; an enumeration failure THROWS (the store's law) — a
|
|
956
|
+
* listing that silently dropped markers would export a package that launders pollution.
|
|
880
957
|
*/
|
|
881
|
-
export declare function listSessionPollution(
|
|
958
|
+
export declare function listSessionPollution(objects: SessionPollutionObjects): Promise<Record<string, SessionPollutionRecord>>;
|
|
882
959
|
/**
|
|
883
960
|
* design/178 v2-c §5.3 — the STRICT durable pollution import. Deliberately NOT
|
|
884
961
|
* `markSessionPolluted`: that leg is best-effort-with-disclosure and mints its own `at`, so a
|
|
885
962
|
* bundle's source record (the governance fact being carried) could neither land verbatim nor prove
|
|
886
|
-
* durability. This leg writes the SOURCE record verbatim (
|
|
887
|
-
* record back and COMPARES — equal = converged no-op, different = the
|
|
888
|
-
* record stands and the divergence is REPORTED (`"divergent"`), never
|
|
889
|
-
* write failure THROWS (the import aborts with its latch standing — §1-2⑤).
|
|
963
|
+
* durability. This leg writes the SOURCE record verbatim (written once); when the slot already stands
|
|
964
|
+
* it reads the standing record back and COMPARES — equal = converged no-op, different = the
|
|
965
|
+
* destination's first-mark-wins record stands and the divergence is REPORTED (`"divergent"`), never
|
|
966
|
+
* silently absorbed. A write failure THROWS (the import aborts with its latch standing — §1-2⑤).
|
|
890
967
|
*/
|
|
891
|
-
export declare function importSessionPollution(
|
|
968
|
+
export declare function importSessionPollution(objects: SessionPollutionObjects, sessionId: string, record: SessionPollutionRecord): Promise<"written" | "already" | "divergent">;
|
|
892
969
|
/** Directory (under the control plane) holding one record file per capture-opted-out session. */
|
|
893
970
|
export declare const SESSION_CAPTURE_OPTOUT_DIR = "session-capture-optout";
|
|
894
971
|
/** The durable capture opt-out record. `reason` is host/engine-authored (the declaring channel),
|
|
@@ -1124,6 +1201,9 @@ export declare const IMPORT_RECEIPTS_DIR = "import-receipts";
|
|
|
1124
1201
|
/** The lineage txn id of a bundle import's synthetic latch (ONE latch per bundle — a re-import of
|
|
1125
1202
|
* the same bundle re-stages the same txn id, which is what makes the latch idempotent). */
|
|
1126
1203
|
export declare function importLatchTxnId(bundleHash: string): string;
|
|
1204
|
+
/** The name a bundle's completion receipt is kept under: the store's control object of kind `import-receipt`
|
|
1205
|
+
* `<bundleHash>.json`. */
|
|
1206
|
+
export declare function importReceiptName(bundleHash: string): string;
|
|
1127
1207
|
/**
|
|
1128
1208
|
* design/178 v2-c §1-1 — stage the bundle import's SYNTHETIC LATCH: one pending lineage txn
|
|
1129
1209
|
* (txnId = {@link importLatchTxnId}) whose rows name every bundle entry id, every row and the txn
|
|
@@ -1139,13 +1219,13 @@ export declare function stageImportLatch(docs: MemoryGovernanceDocs, bundleHash:
|
|
|
1139
1219
|
}>, now: () => number): Promise<string>;
|
|
1140
1220
|
/**
|
|
1141
1221
|
* design/178 v2-c §1-2⑥ — the ONE latch release channel. Hard precondition: the durable completion
|
|
1142
|
-
* receipt for the bundle is IN PLACE (`import-
|
|
1143
|
-
* governance legs all landed) — absent receipt ⇒ loud refusal, the latch stands, and
|
|
1144
|
-
* re-running the same bundle import.
|
|
1145
|
-
*
|
|
1146
|
-
* a NON-latch txn under the id is refused (this is never a generic discard).
|
|
1222
|
+
* receipt for the bundle is IN PLACE (the store's `import-receipt` object `<bundleHash>.json`, minted
|
|
1223
|
+
* after the governance legs all landed) — absent receipt ⇒ loud refusal, the latch stands, and
|
|
1224
|
+
* convergence is re-running the same bundle import. A receipt the store cannot answer for is refused
|
|
1225
|
+
* like a missing one, never read as absent (fail-closed). Idempotent: an already-released (absent)
|
|
1226
|
+
* txn is a no-op; a NON-latch txn under the id is refused (this is never a generic discard).
|
|
1147
1227
|
*/
|
|
1148
|
-
export declare function releaseImportLatch(
|
|
1228
|
+
export declare function releaseImportLatch(store: MemoryGovernanceDocs & Pick<import("./types.js").MemoryGovernanceObjects, "getObject">, txnId: string): Promise<void>;
|
|
1149
1229
|
/** The DIRTY-LATCH set: every entry id named by ANY pending row (credentialed or not). While an id
|
|
1150
1230
|
* is latched, its model-visible read faces (index mechanical rows / memory_search / memory_get)
|
|
1151
1231
|
* refuse — "the account is not settled, the content does not go on the table". Throws on a
|