@sema-agent/core 7.63.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 +725 -0
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/cc-peer-wire.d.ts +4 -0
- package/dist/agents/cc-peer-wire.js +1 -0
- package/dist/agents/cc-uds-peer-channel.js +5 -0
- package/dist/agents/cross-session-judge.d.ts +3 -1
- package/dist/agents/cross-session-judge.js +4 -1
- package/dist/agents/peer-directory.d.ts +8 -0
- package/dist/agents/peer-directory.js +4 -0
- package/dist/agents/peer-held-queue.d.ts +9 -3
- package/dist/agents/peer-held-queue.js +12 -9
- package/dist/agents/peer-idle.d.ts +20 -1
- package/dist/agents/peer-idle.js +23 -12
- package/dist/agents/peer-notice-route.d.ts +16 -5
- package/dist/agents/peer-notice-route.js +11 -9
- package/dist/agents/peer-notices.d.ts +25 -8
- package/dist/agents/peer-notices.js +6 -1
- package/dist/agents/peer-session-drain.d.ts +32 -6
- package/dist/agents/peer-session-drain.js +100 -26
- package/dist/agents/send-message-tool.d.ts +7 -0
- package/dist/agents/send-message-tool.js +18 -6
- package/dist/agents/subagent.js +25 -5
- package/dist/core/allow-entry.d.ts +4 -0
- package/dist/core/ask-origin.d.ts +1 -1
- package/dist/core/ask-origin.js +2 -2
- package/dist/core/ask-unresolvable-notice.d.ts +13 -4
- package/dist/core/ask-unresolvable-notice.js +10 -3
- package/dist/core/auto-compaction.d.ts +7 -5
- package/dist/core/auto-promote.d.ts +3 -2
- package/dist/core/background-agent-store.d.ts +14 -0
- package/dist/core/background-agent-store.js +3 -0
- package/dist/core/checkpoint-queries.d.ts +9 -6
- package/dist/core/checkpoint-queries.js +8 -3
- package/dist/core/checkpoint-store.d.ts +7 -4
- package/dist/core/context-settings.d.ts +39 -9
- package/dist/core/context-settings.js +32 -10
- package/dist/core/engine-attestation.d.ts +26 -6
- package/dist/core/engine-attestation.js +5 -1
- package/dist/core/engine-notice.d.ts +37 -2
- package/dist/core/engine-notice.js +3 -1
- package/dist/core/extension-requester.d.ts +9 -0
- package/dist/core/extension-requester.js +7 -0
- package/dist/core/file-history-store.d.ts +30 -2
- package/dist/core/file-history-store.js +48 -9
- package/dist/core/fs-write-gate-policy.js +1 -1
- package/dist/core/gate-fold.js +5 -1
- package/dist/core/gate-lanes.js +2 -0
- package/dist/core/gate-outcome.d.ts +39 -2
- package/dist/core/gate-outcome.js +20 -1
- package/dist/core/governance-codes.d.ts +8 -4
- package/dist/core/governance-codes.js +8 -3
- package/dist/core/leg-identity.d.ts +35 -1
- package/dist/core/leg-identity.js +10 -0
- package/dist/core/mailbox-store.d.ts +39 -4
- package/dist/core/mailbox-store.js +14 -2
- package/dist/core/memory-engine/consolidation.d.ts +13 -6
- package/dist/core/memory-engine/consolidation.js +26 -0
- package/dist/core/memory-engine/control-objects.d.ts +58 -0
- package/dist/core/memory-engine/control-objects.js +273 -0
- package/dist/core/memory-engine/control-plane-adoption.d.ts +51 -0
- package/dist/core/memory-engine/control-plane-adoption.js +161 -0
- package/dist/core/memory-engine/delegation-settlement.d.ts +73 -40
- package/dist/core/memory-engine/delegation-settlement.js +271 -107
- package/dist/core/memory-engine/dual-root.d.ts +3 -2
- package/dist/core/memory-engine/dual-root.js +7 -3
- package/dist/core/memory-engine/engine.d.ts +54 -33
- package/dist/core/memory-engine/engine.js +150 -157
- package/dist/core/memory-engine/file-backend.d.ts +58 -76
- package/dist/core/memory-engine/file-backend.js +111 -268
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +135 -50
- package/dist/core/memory-engine/layout.js +214 -89
- 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.d.ts +10 -3
- package/dist/core/memory-engine/memory-backend-contract.js +159 -2
- package/dist/core/memory-engine/memory-deployment.d.ts +12 -4
- package/dist/core/memory-engine/memory-deployment.js +31 -6
- package/dist/core/memory-engine/origin-clearance.d.ts +12 -3
- package/dist/core/memory-engine/origin-clearance.js +64 -9
- package/dist/core/memory-engine/session-write-home.d.ts +34 -1
- package/dist/core/memory-engine/session-write-home.js +37 -10
- 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 +55 -12
- package/dist/core/memory-engine/types.js +2 -1
- 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/mode-policy.js +3 -3
- package/dist/core/mods/agent-stations.d.ts +18 -0
- package/dist/core/mods/agent-stations.js +8 -6
- package/dist/core/mods/extension-call.d.ts +4 -0
- package/dist/core/mods/extension-call.js +8 -0
- package/dist/core/mods/tool-call.js +3 -4
- package/dist/core/parent-spec-seat.d.ts +2 -2
- package/dist/core/peer-channel.d.ts +5 -0
- package/dist/core/permission-rule-consent.d.ts +64 -22
- package/dist/core/permission-rule-consent.js +106 -58
- package/dist/core/permission-rule-store.d.ts +56 -21
- package/dist/core/permission-rule-store.js +2 -0
- package/dist/core/refusal-echo.d.ts +20 -0
- package/dist/core/refusal-echo.js +33 -0
- package/dist/core/retention.d.ts +175 -10
- package/dist/core/retention.js +44 -0
- package/dist/core/retired-keys.d.ts +5 -0
- package/dist/core/retired-keys.js +3 -0
- package/dist/core/rule-offer-read.d.ts +0 -4
- package/dist/core/rule-offer-read.js +2 -18
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +4 -2
- package/dist/core/runner/compact-session.js +10 -7
- package/dist/core/runner/compaction-call-options.d.ts +7 -7
- package/dist/core/runner/compaction-call-options.js +3 -2
- package/dist/core/runner/contracts.d.ts +28 -9
- package/dist/core/runner/delegation-owner.d.ts +2 -3
- package/dist/core/runner/delegation-owner.js +2 -1
- package/dist/core/runner/gate-exit.d.ts +6 -0
- package/dist/core/runner/gate-exit.js +11 -2
- package/dist/core/runner/memory-consolidation-driver.d.ts +4 -2
- package/dist/core/runner/memory-consolidation-driver.js +8 -5
- package/dist/core/runner/prepare-ask-lane.js +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -1
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -2
- package/dist/core/runner/prepare-config-doors.js +4 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +2 -2
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -0
- package/dist/core/runner/prepare-gate-stations.js +15 -7
- package/dist/core/runner/prepare-hands-readface.js +1 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +3 -1
- package/dist/core/runner/prepare-inherited-gate.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +4 -0
- package/dist/core/runner/prepare-memory.js +22 -28
- package/dist/core/runner/prepare-policy-chain.js +18 -10
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-task.d.ts +5 -1
- package/dist/core/runner/prepare-task.js +16 -11
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/resume-admission.d.ts +2 -2
- package/dist/core/runner/resume-admission.js +2 -23
- package/dist/core/runner/role-resolution-table.d.ts +98 -0
- package/dist/core/runner/role-resolution-table.js +62 -0
- package/dist/core/runner/run-compaction-machinery.js +2 -2
- package/dist/core/runner/run-identity-wiring.js +12 -9
- package/dist/core/runner/run-leg.js +8 -4
- package/dist/core/runner/run-notification-lane.js +23 -23
- package/dist/core/runner/run-recovery-lanes.js +3 -3
- package/dist/core/runner/run-terminal-adoption.js +1 -1
- package/dist/core/runner/run-turn-boundary.js +14 -15
- package/dist/core/runner/runtask.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/runner/tool-occurrence.d.ts +4 -2
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner-deps.d.ts +1 -1
- package/dist/core/secret-env.d.ts +2 -2
- package/dist/core/secret-env.js +6 -20
- package/dist/core/session-checkout.d.ts +63 -3
- package/dist/core/session-checkout.js +152 -58
- package/dist/core/session-store.d.ts +6 -6
- package/dist/core/session-store.js +3 -3
- package/dist/core/shell-read-silence.js +8 -0
- package/dist/core/store-contracts/background-agent-store-contract.js +13 -0
- package/dist/core/store-contracts/peer-directory-contract.js +8 -1
- package/dist/core/task-event.d.ts +9 -5
- package/dist/core/task-notification.d.ts +137 -31
- package/dist/core/task-notification.js +198 -100
- package/dist/core/task-registry-agent.d.ts +11 -0
- package/dist/core/task-registry-agent.js +12 -3
- package/dist/core/task-registry-shared.d.ts +11 -0
- package/dist/core/task-registry.d.ts +18 -0
- package/dist/core/task-registry.js +27 -8
- package/dist/core/task-spec.d.ts +7 -2
- package/dist/core/tool-errors.d.ts +17 -9
- package/dist/core/tool-errors.js +1 -1
- package/dist/core/tool-policy.d.ts +18 -1
- package/dist/core/tool-policy.js +16 -7
- package/dist/core/tool-result-store.d.ts +20 -0
- package/dist/core/tool-spec.d.ts +10 -6
- package/dist/core/trace.d.ts +3 -2
- package/dist/core/workflow-journal-store.d.ts +11 -0
- package/dist/core/workflow-journal-store.js +7 -0
- package/dist/core/workflow-run-store.d.ts +9 -0
- package/dist/core/workflow-run-store.js +6 -0
- package/dist/core/write-protect.d.ts +16 -0
- package/dist/core/write-protect.js +10 -0
- package/dist/engine/compaction/compaction.d.ts +2 -1
- package/dist/engine/harness/types.d.ts +1 -0
- package/dist/engine/session/repo-utils.d.ts +14 -4
- package/dist/engine/session/repo-utils.js +5 -4
- package/dist/engine/session/session.d.ts +7 -1
- package/dist/engine/session/session.js +5 -2
- package/dist/index.d.ts +13 -11
- package/dist/index.js +13 -11
- package/dist/orchestration/run-workflow-tool.d.ts +4 -0
- package/dist/orchestration/run-workflow-tool.js +7 -0
- package/dist/orchestration/workflow-types.d.ts +2 -1
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +2 -1
- 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/checkpoint-store.d.ts +6 -0
- package/dist/stores/file/checkpoint-store.js +4 -1
- package/dist/stores/file/file-history-store.d.ts +13 -0
- package/dist/stores/file/file-history-store.js +75 -13
- package/dist/stores/file/index.d.ts +12 -16
- package/dist/stores/file/index.js +7 -25
- package/dist/stores/file/permission-rule-store.d.ts +34 -0
- package/dist/stores/file/permission-rule-store.js +104 -9
- package/dist/stores/file/session-store.js +1 -1
- package/dist/stores/file/tool-result-store.d.ts +14 -0
- package/dist/stores/file/tool-result-store.js +39 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -0
- package/dist/stores/file/workflow-journal-store.js +17 -0
- package/dist/stores/file/workflow-run-store.d.ts +3 -0
- package/dist/stores/file/workflow-run-store.js +15 -0
- package/dist/tools/fs/read-deny.d.ts +15 -2
- package/dist/tools/fs/read-deny.js +10 -2
- package/dist/tools/fs/shell-read-check.d.ts +8 -2
- package/dist/tools/fs/shell-read-check.js +7 -7
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +71 -73
- package/wire-changes/core-stores-sql@7.64.0.json +30 -0
- package/wire-changes/core-stores-sql@7.65.0.json +30 -0
- package/wire-changes/core@7.64.0.json +2653 -0
- package/wire-changes/core@7.65.0.json +1650 -0
- package/wire-changes/mods-kernel@7.64.0.json +30 -0
- package/wire-changes/mods-kernel@7.65.0.json +30 -0
- package/wire-changes/primitives@7.64.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
|
@@ -25,7 +25,8 @@ export type ErasedBinding = {
|
|
|
25
25
|
* - `projection` — the entry's files under its scope home (bound path + every census copy);
|
|
26
26
|
* - `shadow` — the control plane's committed copy;
|
|
27
27
|
* - `indexLine` — MEMORY.md pointer lines (name + description) naming a deleted projection path;
|
|
28
|
-
* - `quarantineCopy` — quarantine
|
|
28
|
+
* - `quarantineCopy` — the governance store's `quarantine` objects whose frontmatter id is the erased id (an object the
|
|
29
|
+
* lane could not read to tell is counted as remaining and named by `unreadable`);
|
|
29
30
|
* - `planArchive` / `planWorkbook` — the consolidation plane's mint archive and plan workbook;
|
|
30
31
|
* - `evidenceBinding` — evidence-chain rows that still spell the entry's slug;
|
|
31
32
|
* - `backendDerived` — anything a backend derives privately (vectors, summaries).
|
|
@@ -33,10 +34,14 @@ export type ErasedBinding = {
|
|
|
33
34
|
export declare const ERASURE_CARRIER_CLASSES: readonly ["projection", "shadow", "indexLine", "quarantineCopy", "planArchive", "planWorkbook", "evidenceBinding", "backendDerived"];
|
|
34
35
|
export type ErasureCarrierClass = (typeof ERASURE_CARRIER_CLASSES)[number];
|
|
35
36
|
/** One carrier class's answer: what this call removed and what is known to remain, or `unverified`
|
|
36
|
-
* when the answering lane cannot read that class (which never reads as clean).
|
|
37
|
+
* when the answering lane cannot read that class (which never reads as clean). `unreadable`, when a
|
|
38
|
+
* class answers it, is how many of `remaining` are carriers the lane could not read to tell whether
|
|
39
|
+
* they hold an erased entry — counted as remaining, never as clean (the `quarantineCopy` class answers
|
|
40
|
+
* it on both lanes). */
|
|
37
41
|
export type ErasureCarrierAnswer = {
|
|
38
42
|
removed: number;
|
|
39
43
|
remaining: number;
|
|
44
|
+
unreadable?: number;
|
|
40
45
|
} | {
|
|
41
46
|
unverified: true;
|
|
42
47
|
};
|
|
@@ -156,8 +161,10 @@ export interface MemoryErasureAttestation {
|
|
|
156
161
|
* delete rows, and move / migration-bind rows) — the append-only chain keeps them, so they keep
|
|
157
162
|
* the request `partial` and a replay cannot clear them. */
|
|
158
163
|
carriers: Record<ErasureCarrierClass, ErasureCarrierAnswer>;
|
|
159
|
-
/** Quarantine
|
|
160
|
-
* the quarantine read; a store-level count that does not decide `status`.
|
|
164
|
+
/** Quarantine objects read whose bytes name no entry id (fragments / non-entry shapes) — the honest
|
|
165
|
+
* bound of the quarantine read; a store-level count that does not decide `status`. An object that
|
|
166
|
+
* could not be read at all is not counted here: it is `carriers.quarantineCopy.remaining`
|
|
167
|
+
* (named by its `unreadable`). */
|
|
161
168
|
quarantineUnattributed: ErasureCountAnswer;
|
|
162
169
|
/** Committed entries outside the selection whose consolidation lineage names an erased id (they
|
|
163
170
|
* may restate it) — counted, not erased; their closure is the caller's to compute. */
|
|
@@ -216,8 +223,8 @@ export declare function captureErasureInput(input: EraseMemoryEntriesInput): Era
|
|
|
216
223
|
* `{ id, from: {scope, slug}, to: {scope, slug} }`;
|
|
217
224
|
* - `"migration-bind"`: an unbound row converging to a binding — payload `{ id, to }` (`from`
|
|
218
225
|
* optional: honest absence, an unbound row has no prior coordinates);
|
|
219
|
-
* - `"migration"`: the one-shot v1→v2 baseline summary
|
|
220
|
-
* (store management history, never per-entry custody).
|
|
226
|
+
* - `"migration"`: the one-shot v1→v2 baseline summary an engine ≤ 7.63.0 appended — payload
|
|
227
|
+
* `{ boundRows, unboundRows }` (store management history, never per-entry custody; no longer minted).
|
|
221
228
|
* `channel` is deliberately `string`, not a closed union: later releases append new variants to the
|
|
222
229
|
* SAME chain (one custody chain, one recovery protocol — never a second evidence file), and a closed
|
|
223
230
|
* union would break every consumer at the source level on each addition. CONSUMER OBLIGATION: tolerate
|
|
@@ -374,20 +381,18 @@ export interface MemoryExportSnapshot {
|
|
|
374
381
|
}
|
|
375
382
|
/**
|
|
376
383
|
* The form of the committed-rev ledger (`revs.json`) under a store's control plane, asked of the file and of nothing else — for
|
|
377
|
-
* a program that must know whether a store
|
|
378
|
-
*
|
|
379
|
-
*
|
|
384
|
+
* a program that must know whether a store's ledger is one this engine reads before (or instead of) opening it. It reads the
|
|
385
|
+
* file once, through the judge the store itself opens its ledger by: it takes no lock, upgrades nothing, creates nothing and
|
|
386
|
+
* writes nothing. The answer is one of three words:
|
|
380
387
|
* - `"absent"` — there is no ledger file (a store that never committed);
|
|
381
388
|
* - `"v2"` — the current enveloped schema;
|
|
382
|
-
* - `"v1"` — a bare id → rev map, the pre-binding form the store upgrades in place at its next uncontended entry
|
|
383
|
-
* (RL-1654-ledger-v1; once that arm retires the answer set is `"v2"`, `"absent"` and `"malformed"`);
|
|
384
389
|
* - `"malformed"` — the file is there and the store would refuse it (unparseable, wrong shape, a schema version this engine
|
|
385
|
-
* does not read, or a row the ledger rules refuse).
|
|
390
|
+
* does not read — the pre-binding v1 bare map among them, since 7.64.0 — or a row the ledger rules refuse).
|
|
386
391
|
* A file that cannot be read for any reason but its absence (`EISDIR`, `EACCES`, `ELOOP`, an I/O error) is no form: the read rejects
|
|
387
392
|
* with {@link ControlPlaneCorruptError}, as the store's own does (the message names the errno), never `"absent"` or `"malformed"` — the
|
|
388
|
-
* outcomes are the
|
|
393
|
+
* outcomes are the three words or that rejection. `controlDir` is `FileMemoryEngineBackend.controlPlaneRoot`; a non-string or empty one rejects (`TypeError`).
|
|
389
394
|
*/
|
|
390
|
-
export declare function readMemoryLedgerForm(controlDir: string): Promise<"
|
|
395
|
+
export declare function readMemoryLedgerForm(controlDir: string): Promise<"v2" | "absent" | "malformed">;
|
|
391
396
|
/** Construction options for {@link FileMemoryEngineBackend}. */
|
|
392
397
|
export interface FileMemoryEngineBackendOptions {
|
|
393
398
|
/** ⚠️ 分家坑(service 报告 2026-07-09):不显式传时,控制平面按无参 `resolveMemoryEngineRoot()`
|
|
@@ -449,24 +454,12 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
449
454
|
private ledger;
|
|
450
455
|
/** Top-level unknown keys of the loaded v2 envelope — write-preserved (§1.1). */
|
|
451
456
|
private envelopeExtras;
|
|
452
|
-
/**
|
|
453
|
-
* §3.1 (r3-④) — the migration retry judge: the PERSISTED schema form, set at every real disk read
|
|
454
|
-
* of the ledger and flipped only by the locked migration. Deliberately NOT derived from the
|
|
455
|
-
* in-memory ledger shape: the v1 compat arm (RL-1654-ledger-v1) upgrades rows in memory (§3.2), so the memory shape
|
|
456
|
-
* reads "already v2" after the first stand-down and the retry would die. `"v1"` arms the
|
|
457
|
-
* per-entry opportunistic retry (construction / reads / checkControlPlane / every locked
|
|
458
|
-
* mutation); undefined = the disk form has not been observed yet.
|
|
459
|
-
*/
|
|
460
|
-
private persistedSchemaVersion;
|
|
461
|
-
/** §3.1 — the v1-compat window (RL-1654-ledger-v1) is loud ONCE per instance (per-row unbound noise stays suppressed;
|
|
462
|
-
* the OVERALL state does not). */
|
|
463
|
-
private announcedV1Compat;
|
|
464
457
|
/** §3.4 — O(1) retry judge for the READ entries' unbound-convergence attempts: recomputed at
|
|
465
458
|
* every disk load and every persist (both already iterate the rows), never by scanning per read.
|
|
466
459
|
* Slightly stale-TRUE is harmless (one try-lock + one early-return reload); stale-FALSE cannot
|
|
467
460
|
* happen (every seat that changes the rows passes through a maintaining seat). While a blocker
|
|
468
|
-
* is genuinely stuck (a standing duplicate), each read pays one census —
|
|
469
|
-
*
|
|
461
|
+
* is genuinely stuck (a standing duplicate), each read pays one census — a bounded cost, in a
|
|
462
|
+
* state the sweeps warn about loudly. */
|
|
470
463
|
private unboundRowsKnown;
|
|
471
464
|
/** Adopting-face notice dedup (copy / undecidable-probe / ambiguous / census-incomplete): one
|
|
472
465
|
* still-pending state announces once per instance; changed bytes mint a new key and re-announce
|
|
@@ -529,14 +522,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
529
522
|
private shadowPath;
|
|
530
523
|
private loadLedger;
|
|
531
524
|
/** B3: atomic + fail-closed — a ledger that cannot be persisted throws (the commit is incomplete
|
|
532
|
-
* and the caller must know), never a silent swallow. Always writes the v2 envelope
|
|
533
|
-
* an unmigrated v1 disk is refused loudly (mutations migrate FIRST — §3.1's "变异必先迁" is an
|
|
534
|
-
* invariant here, not a convention: a v2 write minus the census would strand every row unbound). */
|
|
525
|
+
* and the caller must know), never a silent swallow. Always writes the v2 envelope. */
|
|
535
526
|
private saveLedger;
|
|
536
|
-
/** v1-journal restore ONLY (§1.2 dual-read): the snapshot predates the upgrade and is persisted in
|
|
537
|
-
* ITS OWN form — the migration (which runs after recovery, under the lock) owns the v1→v2 swap
|
|
538
|
-
* together with its backup + evidence protocol. */
|
|
539
|
-
private persistLedgerV1;
|
|
540
527
|
/** Fail-open announcement convenience (S2-B queue posture — an unwritable queue never fails the
|
|
541
528
|
* operation that had something to say; the fail-CLOSED evidence lane is `transfers.jsonl`). */
|
|
542
529
|
private enqueueExternalItems;
|
|
@@ -574,34 +561,30 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
574
561
|
* not census gaps.
|
|
575
562
|
*/
|
|
576
563
|
private censusProjectionsLocked;
|
|
577
|
-
/** §3.
|
|
578
|
-
* overwritten by a retry). */
|
|
579
|
-
private writeV1BackupOnce;
|
|
580
|
-
/** §3.1 — non-blocking txn-mutex acquisition for the opportunistic migration entries (the
|
|
564
|
+
/** §3.1 — non-blocking txn-mutex acquisition for the opportunistic convergence entries (the
|
|
581
565
|
* constructor cannot await). LIVE contention stands down — wait semantics belong to the async
|
|
582
566
|
* writers; every entry retries later. A STALE lock (past its deadline, owner token present) gets
|
|
583
567
|
* ONE synchronous single-winner steal, same judge and same token discipline as the async
|
|
584
568
|
* waiter's steal: without it, a crashed holder's leftover lock would stand down every sync entry
|
|
585
569
|
* forever, and a READ-ONLY deployment — which never runs an async writer to do the stealing —
|
|
586
|
-
* would
|
|
587
|
-
* is unchanged: the caller runs journal recovery INSIDE the acquired lock before touching state. */
|
|
570
|
+
* would leave its unbound rows unconverged and an interrupted transaction unrecovered indefinitely.
|
|
571
|
+
* Steal-safety is unchanged: the caller runs journal recovery INSIDE the acquired lock before touching state. */
|
|
588
572
|
private tryAcquireTxnLockSync;
|
|
589
|
-
/** §3.
|
|
590
|
-
* try-lock, recover,
|
|
591
|
-
*
|
|
573
|
+
/** §3.4 — one opportunistic convergence attempt (read entries / construction / checkControlPlane):
|
|
574
|
+
* try-lock, recover, adopt, converge, release. A busy lock is a clean stand-down (the mutation
|
|
575
|
+
* entries converge under their own lock regardless). */
|
|
592
576
|
private tryOpportunisticMigrate;
|
|
593
577
|
/**
|
|
594
|
-
* §3.
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
*
|
|
600
|
-
*
|
|
601
|
-
* P
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
* is a no-op version check.
|
|
578
|
+
* §3.4-§3.5 — the unbound-row convergence, the part of the v1→v2 migration that outlives it: an
|
|
579
|
+
* engine ≤ 7.63.0 upgraded a pre-binding ledger and left the rows whose projection it could not
|
|
580
|
+
* derive UNBOUND. MUST hold the txn mutex. Reloads the DISK truth, then re-derives the unbound rows
|
|
581
|
+
* only (bound rows are FINAL — only explicit transactions rewrite a binding), each new bind
|
|
582
|
+
* carrying a `migration-bind` evidence event. An INCOMPLETE census abandons the pass with ZERO
|
|
583
|
+
* writes ("only what was visible" is not "all that exists"; a wrong binding is worse than no
|
|
584
|
+
* binding) and retries at the next entry. P=0 rows stay unbound (「缺失≠删除」— dropping the row
|
|
585
|
+
* would endorse an unattributed delete); P≥2 rows stay unbound (the convergence never adjudicates
|
|
586
|
+
* which projection is real — an existing dup audit keeps ringing until a harvest or a human
|
|
587
|
+
* resolves it). Idempotent: zero unbound is a no-op.
|
|
605
588
|
*/
|
|
606
589
|
private migrateLockedIfNeeded;
|
|
607
590
|
/** Is the durable chain-degradation marker in place? Presence is ENOENT-only-absent (a probe
|
|
@@ -611,7 +594,7 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
611
594
|
* read-back verification). Idempotent on an existing marker. Throws when the marker cannot be
|
|
612
595
|
* proven on disk — the caller (the heal) must then ABORT with the chain untouched: truncating
|
|
613
596
|
* first would reopen the exact window this marker closes ("chain reads complete, no marker"
|
|
614
|
-
* after an out-of-band tear). */
|
|
597
|
+
* after an out-of-band tear). `fragmentName` is the `quarantine` object the torn fragment was kept as. */
|
|
615
598
|
private mintChainDegradedMarker;
|
|
616
599
|
/** backlog #270 — make a just-created control-plane directory ENTRY power-loss durable: open the
|
|
617
600
|
* control-plane root and fsync it. Fail-closed on failure: the one caller (the marker mint) must
|
|
@@ -688,10 +671,10 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
688
671
|
/** v2-b §3-4 (round-3 #1) — a PURE, fresh read of the committed ledger rows for the retrieval
|
|
689
672
|
* backstop's account check: bytes → parsed rows, installing no read cache and no schema memo — so
|
|
690
673
|
* the guard's account view is as fresh as its chain digest,
|
|
691
|
-
* never a stale instance cache paired with a fresh deletion read.
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
674
|
+
* never a stale instance cache paired with a fresh deletion read. An absent ledger answers
|
|
675
|
+
* empty. FAULT DIRECTION, stated truthfully (rescan corrected the original note, which claimed
|
|
676
|
+
* the opposite): a read/parse FAULT (a pre-binding v1 bare map among them) also answers empty,
|
|
677
|
+
* and with an empty account the consuming filter WITHHOLDS every id
|
|
695
678
|
* on the delete list — conservative on purpose (a host re-add cannot be distinguished from a
|
|
696
679
|
* replant over an unreadable account, and serving bytes that carry delete evidence during a
|
|
697
680
|
* fault window would reopen exactly the resurrection the backstop exists to close). No erase
|
|
@@ -904,8 +887,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
904
887
|
* · the reads do no healing and no quarantine, and the COMMITTED-ROWS read is cache-free; the
|
|
905
888
|
* digest read installs the instance fingerprint cache (a read cache, not a store write). The
|
|
906
889
|
* path's write-capable hooks (rescan r3 — do not present this list as shorter): `readScope`'s
|
|
907
|
-
* pre-existing opportunistic
|
|
908
|
-
* §3.
|
|
890
|
+
* pre-existing opportunistic unbound-row convergence retry (stores holding unbound rows only,
|
|
891
|
+
* design/186 §3.4), the guard's fault-disclosure enqueue (a ledger read/parse fault mints an announcement
|
|
909
892
|
* row, once per fault code per mount), and `scopeDir`'s registry mint (listing a scope name the
|
|
910
893
|
* registry has never seen writes its row — predates this view and rides every scope read).
|
|
911
894
|
*
|
|
@@ -1009,8 +992,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
1009
992
|
* single-copy move / delete-then-plant empties the bound address and rings here even though the
|
|
1010
993
|
* id is still "somewhere" (the v1 any-scope presence test read exactly that as fine — the
|
|
1011
994
|
* registered residual this schema retires); byte-carriers of the id at other addresses are named
|
|
1012
|
-
* in the same finding. UNBOUND rows (migration
|
|
1013
|
-
* test — no false alarms while their address is underivable. Non-destructive throughout: nothing
|
|
995
|
+
* in the same finding. UNBOUND rows (left by an engine ≤ 7.63.0's migration) keep the store-wide
|
|
996
|
+
* presence test — no false alarms while their address is underivable. Non-destructive throughout: nothing
|
|
1014
997
|
* is restored, forgotten, or adopted here.
|
|
1015
998
|
*
|
|
1016
999
|
* `opts.idlessWriteScope` is the CALLER's per-call session verdict (same posture as the mount:
|
|
@@ -1121,12 +1104,6 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
1121
1104
|
private journalSweepRow;
|
|
1122
1105
|
/** Write the journal's sweep-record row ({@link journalSweepRow}; idempotent — a union). */
|
|
1123
1106
|
private recordJournalSweep;
|
|
1124
|
-
/** Delete every quarantine file whose frontmatter id is in `ids` (a quarantined copy is a copy of the
|
|
1125
|
-
* entry). Runs under the erasure's lock after its commit; a file that cannot be removed stays
|
|
1126
|
-
* counted as `remaining` and a replay retries it. Files no id can be read from are counted, not
|
|
1127
|
-
* touched. An unreadable quarantine directory refuses the attestation (the deletions themselves
|
|
1128
|
-
* are committed; a replay converges). */
|
|
1129
|
-
private eraseQuarantineCopiesLocked;
|
|
1130
1107
|
/** Does the control-plane directory `name` hold any entry? ENOENT ⇒ no; any other read failure ⇒
|
|
1131
1108
|
* yes (an unreadable directory may hold anything). */
|
|
1132
1109
|
private controlDirHoldsAnything;
|
|
@@ -1154,9 +1131,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
1154
1131
|
* not "no journal"; it throws the fail-closed corrupt error, never folds into quiescence). */
|
|
1155
1132
|
private auditJournalPending;
|
|
1156
1133
|
/** PURE ledger read for the audit faces: raw bytes → parsed rows, touching NOTHING on the
|
|
1157
|
-
* instance (no cache install
|
|
1158
|
-
*
|
|
1159
|
-
* (construction / adopting reads / locked mutations), never to an audit read. */
|
|
1134
|
+
* instance (no cache install) and never the disk. A ledger the store's judge refuses (the
|
|
1135
|
+
* pre-binding v1 bare map among them) throws its {@link ControlPlaneCorruptError}. */
|
|
1160
1136
|
private auditReadLedger;
|
|
1161
1137
|
/** Run `read` over a STABLE committed account: journal absent before and after, ledger bytes
|
|
1162
1138
|
* identical across the read (closes both tear channels — the journal-first commit window and any
|
|
@@ -1183,7 +1159,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
1183
1159
|
* `typeof backend.committedSnapshotOf === "function"`). Pure committed read under the double
|
|
1184
1160
|
* fence; unknown id ⇒ `{ state: "absent" }` (never a throw, never an empty guess); unbound row ⇒
|
|
1185
1161
|
* the account half answers with `binding: { state: "unbound" }` (legal transitional state);
|
|
1186
|
-
*
|
|
1162
|
+
* a ledger the store refuses (a pre-binding v1 bare map among them) ⇒ its fail-closed throw; fence
|
|
1163
|
+
* contention past the bound ⇒ loud refusal.
|
|
1187
1164
|
*/
|
|
1188
1165
|
committedSnapshotOf(id: string): Promise<CommittedEntrySnapshot>;
|
|
1189
1166
|
/** One row's public {@link CommittedBinding} (shared tagged form — see the type's own doc). */
|
|
@@ -1194,8 +1171,8 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
1194
1171
|
* shadow-only rows a disk scan would miss (`listHeaders` is an ADOPTING read and enumerates the
|
|
1195
1172
|
* plane; it is not an audit face). Unbound rows land in the store-level `unbound` appendix.
|
|
1196
1173
|
* Fence contention past the bound ⇒ `{ complete: false }` (NO data members — nothing to misread
|
|
1197
|
-
* as a truncated package): the caller fails closed. Corrupt control-plane bytes
|
|
1198
|
-
* v1
|
|
1174
|
+
* as a truncated package): the caller fails closed. Corrupt control-plane bytes (a pre-binding
|
|
1175
|
+
* v1 ledger among them) still THROW (a definite state, not contention).
|
|
1199
1176
|
*/
|
|
1200
1177
|
committedSnapshotsOfScopes(scopes: readonly string[]): Promise<CommittedScopeSnapshots>;
|
|
1201
1178
|
/**
|
|
@@ -1221,6 +1198,11 @@ export declare class FileMemoryEngineBackend implements MemoryBackend {
|
|
|
1221
1198
|
* held by every caller, so the exclusive create cannot race in-process; a cross-process EEXIST
|
|
1222
1199
|
* loser adopts the winner's identity. Corrupt/unreadable identity is fail-closed. */
|
|
1223
1200
|
private storeIdentityLocked;
|
|
1201
|
+
/** The pollution objects as the export's roster reads them: this store's own (`this.governance` is the File store over
|
|
1202
|
+
* `controlPlaneRoot`), through its damage-visible view ({@link standingControlObjectsOf}, the erasure's count reads the
|
|
1203
|
+
* same view) — a marker slot that stands as no object (a directory, a dangling link) is on the roster as its
|
|
1204
|
+
* fail-closed record, never dropped from a bundle (the reading adoption and the strays reader take). */
|
|
1205
|
+
private pollutionRosterObjects;
|
|
1224
1206
|
/** One consistency fingerprint over the three ENGINE governance faces (challenge ledger, lineage
|
|
1225
1207
|
* ledger, pollution markers) — raw bytes, journal included. The two strict sidecars' JOURNAL
|
|
1226
1208
|
* reads are wrapped FAIL-CLOSED here (§4-6): the shared strict reader folds a journal read
|