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