@sema-agent/core 7.62.0 → 7.63.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 +528 -0
- package/dist/agents/subagent-transcript-placement.d.ts +23 -0
- package/dist/agents/subagent-transcript-placement.js +14 -0
- package/dist/agents/subagent.js +82 -51
- package/dist/brain/route-adjudicator.js +9 -4
- package/dist/core/approval-object.js +1 -1
- package/dist/core/arg-summary.js +1 -1
- package/dist/core/ask-question.d.ts +2 -2
- package/dist/core/canonical-json.d.ts +23 -13
- package/dist/core/canonical-json.js +4 -4
- package/dist/core/checkpoint-queries.d.ts +47 -4
- package/dist/core/checkpoint-queries.js +36 -16
- 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 +23 -10
- 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/engine-attestation.d.ts +1 -1
- package/dist/core/engine-notice.d.ts +19 -4
- 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 +7 -3
- package/dist/core/governance-codes.js +13 -3
- 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 +73 -10
- package/dist/core/memory-engine/consolidation.js +167 -11
- 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 +37 -35
- package/dist/core/memory-engine/delegation-settlement.js +53 -59
- package/dist/core/memory-engine/dual-root.d.ts +12 -6
- package/dist/core/memory-engine/dual-root.js +9 -5
- package/dist/core/memory-engine/engine.d.ts +98 -35
- package/dist/core/memory-engine/engine.js +477 -380
- 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 +29 -3
- package/dist/core/memory-engine/file-backend.js +66 -35
- package/dist/core/memory-engine/index.d.ts +7 -7
- package/dist/core/memory-engine/index.js +6 -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 +121 -45
- package/dist/core/memory-engine/layout.js +252 -102
- package/dist/core/memory-engine/memory-backend-contract.d.ts +19 -1
- package/dist/core/memory-engine/memory-backend-contract.js +320 -0
- package/dist/core/memory-engine/memory-deployment.d.ts +31 -8
- package/dist/core/memory-engine/memory-deployment.js +26 -12
- 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 +3 -1
- package/dist/core/memory-engine/session-write-home.js +1 -1
- 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 +118 -19
- package/dist/core/memory-engine/types.js +1 -0
- package/dist/core/memory.js +15 -6
- package/dist/core/mods/stations.d.ts +20 -1
- package/dist/core/mods/stations.js +21 -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/permission-rule-consent.d.ts +10 -3
- package/dist/core/permission-rule-consent.js +37 -24
- package/dist/core/permission-rule-store.d.ts +35 -1
- package/dist/core/permission-rule-store.js +27 -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/remote-env.d.ts +12 -1
- package/dist/core/remote-env.js +3 -0
- package/dist/core/runner/child-tree.d.ts +29 -3
- package/dist/core/runner/child-tree.js +39 -16
- package/dist/core/runner/contracts.d.ts +18 -9
- package/dist/core/runner/gate-exit.js +2 -2
- package/dist/core/runner/inherited-ask-grants.js +1 -1
- package/dist/core/runner/memory-consolidation-driver.d.ts +6 -3
- package/dist/core/runner/memory-consolidation-driver.js +4 -4
- 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 +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -1
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -2
- package/dist/core/runner/prepare-execution-env.js +17 -6
- package/dist/core/runner/prepare-hands-readface.d.ts +2 -1
- package/dist/core/runner/prepare-hands-readface.js +4 -3
- package/dist/core/runner/prepare-inherited-gate.d.ts +10 -8
- package/dist/core/runner/prepare-inherited-gate.js +8 -4
- 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 +3 -2
- package/dist/core/runner/prepare-memory.js +28 -20
- package/dist/core/runner/prepare-park-ask.js +4 -3
- package/dist/core/runner/prepare-task.js +15 -12
- package/dist/core/runner/prepare-workspace-restore.js +3 -6
- package/dist/core/runner/run-leg.js +1 -1
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/terminal-account.js +1 -1
- package/dist/core/runner-deps.d.ts +6 -2
- package/dist/core/secret-env.d.ts +1 -1
- package/dist/core/secret-env.js +4 -4
- package/dist/core/session-checkout.d.ts +108 -0
- package/dist/core/session-checkout.js +485 -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/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/session-store-contract.js +39 -0
- package/dist/core/task-event.d.ts +21 -0
- package/dist/core/task-notification.d.ts +9 -1
- package/dist/core/task-notification.js +6 -0
- package/dist/core/task-registry-agent.d.ts +14 -2
- package/dist/core/task-registry-agent.js +45 -19
- package/dist/core/task-registry-shared.d.ts +26 -11
- package/dist/core/task-registry.d.ts +15 -9
- package/dist/core/task-registry.js +9 -10
- package/dist/core/task-spec-members.js +1 -1
- package/dist/core/task-spec.d.ts +20 -0
- package/dist/core/tool-policy.d.ts +14 -12
- package/dist/core/tool-policy.js +11 -10
- package/dist/core/tool-spec.d.ts +38 -19
- 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/workspace-snapshot.d.ts +3 -1
- package/dist/core/workspace-snapshot.js +1 -0
- package/dist/engine/harness/types.d.ts +66 -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 +24 -1
- package/dist/engine/session/session.js +45 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +7 -4
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +4 -1
- package/dist/orchestration/run-workflow-tool.js +1 -0
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +3 -1
- package/dist/stores/file/session-store.js +2 -1
- 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 +13 -1
- package/dist/tools/fs/read-deny.js +10 -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.js +10 -8
- 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 +73 -11
- package/wire-changes/core-stores-sql@7.63.0.json +30 -0
- package/wire-changes/core@7.63.0.json +3523 -0
- package/wire-changes/mods-kernel@7.63.0.json +30 -0
- package/wire-changes/primitives@7.63.0.json +445 -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
|
@@ -6,7 +6,8 @@ import { type CommittedBinding, type EraseMemoryEntriesInput, type MemoryErasure
|
|
|
6
6
|
import { type MemoryExportBundle, type MemoryImportReport } from "./export-bundle.js";
|
|
7
7
|
import { type ChallengeAssignment, type ChallengeEvent, type ControlPlaneRebuildReceipt, type StrictControlPlaneLedger, type ChallengedHistoryRow, type LineagePendingTxn, type LineagePromotion, type MemoryPartitionIncidentSink, type RetrievedAccountRow, type SessionPollutionMarkOutcome, type SessionPollutionRecord, type SessionCaptureOptOutMarkOutcome, type SessionCaptureOptOutRecord, type SessionCaptureRecordStore } from "./layout.js";
|
|
8
8
|
import { type SessionIncarnationResolver } from "./session-incarnation.js";
|
|
9
|
-
import type {
|
|
9
|
+
import type { ConsolidationDriverRunRow } from "./consolidation-driver.js";
|
|
10
|
+
import type { HarvestReport, MemoryAnnouncement, MemoryBackend, MemoryEntry, MemoryEntryHeader, MemoryEntryOrigin, MemoryGovernanceStore, MemoryScopeEnumeration, MemorySessionHandle, PatchReport, ScanFinding, SessionCaptureResidueSweep } from "./types.js";
|
|
10
11
|
/**
|
|
11
12
|
* The RECALL-FRAMING sentence shared by every arm of the `# Memory` prompt section — the one
|
|
12
13
|
* sentence that tells the model what a recalled memory IS (background context, not an instruction)
|
|
@@ -123,7 +124,7 @@ export declare function entryFileHeadCarriesOrigin(absPath: string, maxBytes?: n
|
|
|
123
124
|
export declare const MEMORY_PREFERENCE_DISCIPLINE = "When the user confirms a stored preference or fact still holds, refresh that entry's `last-confirmed: <YYYY-MM-DD>` frontmatter line (add it when absent). When you save a preference, add an `applies-when: <context>` frontmatter line naming when it applies. Both are plain frontmatter lines \u2014 write them yourself; nothing fills them in for you.";
|
|
124
125
|
/**
|
|
125
126
|
* Corrections for announcement segments that carry store-mutation guidance ("record a fresh entry …
|
|
126
|
-
*
|
|
127
|
+
* delete the old entry", minted in an earlier writable session) a session cannot act on. The queue
|
|
127
128
|
* items are opaque strings (rewriting them would be text surgery over minted-at-enqueue wording),
|
|
128
129
|
* so the correction is a trailing coda, not a rewrite — in two scopes, because the two mounting
|
|
129
130
|
* seats speak about different things (an unqualified "the memory store is not writable" beside
|
|
@@ -223,12 +224,13 @@ export declare const DEFAULT_HARVEST_FILE_BUDGET = 2000;
|
|
|
223
224
|
* on background-child lifetimes; the cost of the window is that a held instruction entry is
|
|
224
225
|
* delayed at most this long, never lost. */
|
|
225
226
|
export declare const DEFAULT_HOLD_SETTLE_TIMEOUT_MS: number;
|
|
226
|
-
/** design/138 §2.4 删除防线 — the mass-deletion fuse
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
227
|
+
/** design/138 §2.4 删除防线 — the mass-deletion fuse ratio: the ratio leg of the deletion fuse
|
|
228
|
+
* ({@link deletionFuseCeiling} — max(floor, ⌊ratio × N⌋) over the materialized writable files). A
|
|
229
|
+
* session's removal of a file it was served on its write face is its delete of that entry (the
|
|
230
|
+
* removal IS the write); more removals than the ceiling in one harvest is judged an incident and
|
|
231
|
+
* the whole harvest refused — NOTHING is deleted or restored, the incident waits for a human (for
|
|
232
|
+
* an in-repo git-tracked scope git history is the natural recycle bin). Renames (same id
|
|
233
|
+
* re-appearing elsewhere) never count toward it (验收 M1). */
|
|
232
234
|
export declare const MASS_DELETION_FUSE_RATIO = 0.5;
|
|
233
235
|
export interface MemoryEngineOptions {
|
|
234
236
|
backend: MemoryBackend;
|
|
@@ -329,7 +331,7 @@ export interface MemoryEngineOptions {
|
|
|
329
331
|
* byte-identical to a pre-339 deployment (G1). PRESENT = enabled; every knob screens at
|
|
330
332
|
* construction (#123 bad-value loudness — see {@link import("./consolidation.js").screenConsolidationOptions}),
|
|
331
333
|
* `provenance: "off"` beside it refuses at construction (D-12a: the fold law must be able to
|
|
332
|
-
* mint), and `multiNode: true` without an injected lease
|
|
334
|
+
* mint), and `multiNode: true` without an injected lease (D-13a) or over a replica-local backend refuses. Note the READ-side
|
|
333
335
|
* active-set treatment (index rows / search filter / get disclosure) is NOT behind this switch —
|
|
334
336
|
* supersession edges are store-level data facts and take effect wherever they exist (D-4a).
|
|
335
337
|
*/
|
|
@@ -597,6 +599,35 @@ export declare function pollutionContainmentCounts(report: HarvestReport): {
|
|
|
597
599
|
moved: number;
|
|
598
600
|
escalated: number;
|
|
599
601
|
};
|
|
602
|
+
/**
|
|
603
|
+
* One harvest conflict, said by what the backend reported rather than by one fixed word: a per-id CAS
|
|
604
|
+
* miss — the row carries BOTH the patch's base rev and the store's current rev, as every backend's
|
|
605
|
+
* CAS refusal does — is another writer's newer commit; any other conflict is the store's own refusal
|
|
606
|
+
* of the patch, named as a refusal and never as concurrency. The store's reason text is not quoted:
|
|
607
|
+
* it can name another scope's coordinates, and both faces reading this sentence (the next session's
|
|
608
|
+
* announcement, the user-tier `memory.harvest_conflict` notice) carry write-scope facts only — the
|
|
609
|
+
* harvest report holds the reason for the host. Only the CAS reading knows the entry is still stored
|
|
610
|
+
* (the store answered its current rev), so only it says a conflicted deletion left the entry in place.
|
|
611
|
+
* The outcome is said first and short: an announcement line is capped at 160 characters.
|
|
612
|
+
*/
|
|
613
|
+
export declare function harvestConflictSentence(c: PatchReport["conflicts"][number]): string;
|
|
614
|
+
/**
|
|
615
|
+
* `memory.harvest_refused` (audience `user`) — the boundary harvest was refused wholesale (an incident:
|
|
616
|
+
* the deletion fuse, a vanished write root, a control plane that could not be read or written), so
|
|
617
|
+
* what this session did to memory did not take effect. The person is the one who was told "remembered"
|
|
618
|
+
* or "forgotten" during the session; this is where they learn it did not hold. One notice per refused
|
|
619
|
+
* harvest; `detail: { kind, committed, reportId?, sessionId? }` — `committed` is the report's applied
|
|
620
|
+
* patch count (0 for a refused single-plane harvest; a dual-root merge can carry the other plane's).
|
|
621
|
+
*/
|
|
622
|
+
export declare function memoryHarvestRefusedNotice(report: HarvestReport, sessionId?: string): EngineNotice | undefined;
|
|
623
|
+
/**
|
|
624
|
+
* `memory.harvest_conflict` (audience `user`) — the harvest committed, but the store refused some of
|
|
625
|
+
* this session's changes ({@link harvestConflictSentence} per change: a newer commit by another
|
|
626
|
+
* writer, or the store's own refusal); those changes did not take effect. One notice per harvest
|
|
627
|
+
* with at least one conflict; `detail:
|
|
628
|
+
* { count, conflicts: [{ op, id, concurrent }] (first 20), reportId?, sessionId? }`.
|
|
629
|
+
*/
|
|
630
|
+
export declare function memoryHarvestConflictNotice(report: HarvestReport, sessionId?: string): EngineNotice | undefined;
|
|
600
631
|
export declare function memoryHarvestQuarantinedNotice(input: {
|
|
601
632
|
count: number;
|
|
602
633
|
moved: number;
|
|
@@ -833,6 +864,7 @@ export declare class MemoryEngine {
|
|
|
833
864
|
private readonly backend;
|
|
834
865
|
private readonly memoryDir;
|
|
835
866
|
private readonly controlDir;
|
|
867
|
+
private readonly governanceStore;
|
|
836
868
|
private readonly now;
|
|
837
869
|
private readonly perScopeBudgetBytes;
|
|
838
870
|
private readonly perFileBytes;
|
|
@@ -872,7 +904,7 @@ export declare class MemoryEngine {
|
|
|
872
904
|
* re-opened the row, and the later leg is still live). A record that cannot be written leaves the
|
|
873
905
|
* row reading live (restores of its layer withheld) and is disclosed, never silent.
|
|
874
906
|
*/
|
|
875
|
-
endSessionLeg(handle: MemorySessionHandle, sessionId: string): SessionAccountWrite | undefined
|
|
907
|
+
endSessionLeg(handle: MemorySessionHandle, sessionId: string): Promise<SessionAccountWrite | undefined>;
|
|
876
908
|
private endLeg;
|
|
877
909
|
/** design/336 §3.6 (slice 2) — the session-account incident channel (`memory.session_account_failed`):
|
|
878
910
|
* a degraded residue classification is DISCLOSED, never quiet (the behavioral fail-closed half —
|
|
@@ -948,6 +980,13 @@ export declare class MemoryEngine {
|
|
|
948
980
|
* undefined when the account has no row, `"undecidable"` when the account cannot be read whole
|
|
949
981
|
* (a pending journal, a fault, no audit face) — never a guess from a copy that carries no seat. */
|
|
950
982
|
private committedRowOf;
|
|
983
|
+
/** Where the store holds the entry a write-face removal names: `absent` (no longer held), `held`
|
|
984
|
+
* with its committed scope (and, from a copy-out backend, the committed frontmatter that read
|
|
985
|
+
* returned), or `unknown` (the read failed, or the account holds the row without a seat). A
|
|
986
|
+
* directory-pinned store answers from its audit face ({@link committedRowOf}, side-effect-free —
|
|
987
|
+
* the plane there is the session's working copy, never the committed seat); a copy-out backend
|
|
988
|
+
* answers from `getByIds`. */
|
|
989
|
+
private committedPlacementOf;
|
|
951
990
|
/** A caught memory-write failure as a report / incident line: its text, plus the remedy when the
|
|
952
991
|
* file system refused it on permissions ({@link withPermissionRemedy} — the one spelling every
|
|
953
992
|
* write seat surfaces, so no seat renders a permission refusal as a bare errno). */
|
|
@@ -968,7 +1007,11 @@ export declare class MemoryEngine {
|
|
|
968
1007
|
* The one router of a model-face memory notice: a line is filed under the scope it reports on, so
|
|
969
1008
|
* only a session mounting that scope ever reads it (`MemoryAnnouncement.scope`). A line that names
|
|
970
1009
|
* no single scope — `scope` absent — reaches no model face: it goes to the host's incident sink
|
|
971
|
-
* (`memory.announcement_withheld`), and nowhere else. Fail-open like every enqueue site
|
|
1010
|
+
* (`memory.announcement_withheld`), and nowhere else. Fail-open like every enqueue site: the answer
|
|
1011
|
+
* never rejects — a queue that refuses is said ({@link discloseAnnounceFailure}). The line goes to
|
|
1012
|
+
* the engine's governance store (its `announcements` document), so the notices follow the backend
|
|
1013
|
+
* that keeps the other governance documents; every caller awaits it, so a line a flow announced is
|
|
1014
|
+
* in the queue before that flow's next step (a session's first injection drains it).
|
|
972
1015
|
*/
|
|
973
1016
|
private announce;
|
|
974
1017
|
/** The operator half of {@link announce}: a notice no single scope owns, said to the host only. */
|
|
@@ -988,8 +1031,10 @@ export declare class MemoryEngine {
|
|
|
988
1031
|
* scope's. */
|
|
989
1032
|
private scopeOfPlaneRel;
|
|
990
1033
|
/** Model-face notices whose scope is resolved after the call that raised them (the challenge lanes:
|
|
991
|
-
* their
|
|
992
|
-
* {@link settleAnnouncementWork} bounds how long a mount waits for it.
|
|
1034
|
+
* their callers hold an entry id, and only the store knows its scope). One chain, in order;
|
|
1035
|
+
* {@link settleAnnouncementWork} bounds how long a mount waits for it. It orders that attribution
|
|
1036
|
+
* work only: every other notice is awaited by the flow that raised it ({@link announce}), and the
|
|
1037
|
+
* queue's own read-modify-write is serialized by the store (`updateDoc`). */
|
|
993
1038
|
private announcementWork;
|
|
994
1039
|
/** The warnings of a report that are NOT about the write home, each with the scope it is about
|
|
995
1040
|
* (`undefined` for a sentence about several scopes or the whole store — the host's). Every other
|
|
@@ -1013,6 +1058,10 @@ export declare class MemoryEngine {
|
|
|
1013
1058
|
/** In-process half of the one-way marker: a session marked in THIS process stays polluted here
|
|
1014
1059
|
* even when the durable write failed (the disk half is best-effort WITH disclosure). */
|
|
1015
1060
|
private readonly pollutedSessions;
|
|
1061
|
+
/** The retroactive challenge sweeps a pollution mark has started and not finished. A caller that does not await the
|
|
1062
|
+
* mark (a tool lane's synchronous mark seat) still gets them: {@link readChallengeExclusions} waits for every sweep
|
|
1063
|
+
* already started, so no exclusion read after a mark answers without that mark's challenges. A sweep never rejects. */
|
|
1064
|
+
private readonly pendingPollutionSweeps;
|
|
1016
1065
|
/**
|
|
1017
1066
|
* Mark `sessionId`'s memory POLLUTED (the session invoked an external-content-class tool).
|
|
1018
1067
|
* One-way by construction: there is no unmark API at any layer, a repeat mark keeps the FIRST
|
|
@@ -1026,7 +1075,7 @@ export declare class MemoryEngine {
|
|
|
1026
1075
|
* markers of one session would both read clean and both announce). Callers that do not disclose
|
|
1027
1076
|
* ignore it exactly as before.
|
|
1028
1077
|
*/
|
|
1029
|
-
markSessionPolluted(sessionId: string, reason: string, cause?: import("./types.js").MemoryOriginCause): SessionPollutionMarkOutcome
|
|
1078
|
+
markSessionPolluted(sessionId: string, reason: string, cause?: import("./types.js").MemoryOriginCause): Promise<SessionPollutionMarkOutcome>;
|
|
1030
1079
|
/** The session's pollution record (in-process mark first, then the durable marker) — undefined =
|
|
1031
1080
|
* clean. Reads are side-effect-free. */
|
|
1032
1081
|
sessionPollution(sessionId: string): SessionPollutionRecord | undefined;
|
|
@@ -1070,6 +1119,8 @@ export declare class MemoryEngine {
|
|
|
1070
1119
|
* refuses to imply — the deliberate divergence from the pollution marker's best-effort arm.
|
|
1071
1120
|
*/
|
|
1072
1121
|
markSessionCaptureOptOut(sessionId: string, reason: string): SessionCaptureOptOutMarkOutcome | Promise<SessionCaptureOptOutMarkOutcome>;
|
|
1122
|
+
/** The mark half of {@link markSessionCaptureOptOut}, after the in-flight guard. */
|
|
1123
|
+
private markCaptureRecord;
|
|
1073
1124
|
/** The session's capture opt-out record (in-process first, then the durable store) — undefined =
|
|
1074
1125
|
* capture is on. Side-effect-free OBSERVER face; a THROWING store read degrades to the
|
|
1075
1126
|
* in-process answer here. Every consumer whose answer decides whether bytes COMMIT must use
|
|
@@ -1140,17 +1191,17 @@ export declare class MemoryEngine {
|
|
|
1140
1191
|
* unknowable — consumers must refuse service loudly (corrupt ≠ clean), the same law the pollution
|
|
1141
1192
|
* marker already follows.
|
|
1142
1193
|
*/
|
|
1143
|
-
readChallengeExclusions(): Map<string, {
|
|
1194
|
+
readChallengeExclusions(): Promise<Map<string, {
|
|
1144
1195
|
code: "challenged" | "lineage_pending";
|
|
1145
1196
|
generation?: number;
|
|
1146
1197
|
at?: number;
|
|
1147
|
-
}
|
|
1198
|
+
}>>;
|
|
1148
1199
|
/** The shared challenge writer: append events idempotently, then announce OPAQUELY (id + code +
|
|
1149
1200
|
* generation only — the announcement is a model-visible face, so no name/description/free reason
|
|
1150
1201
|
* rides it; content stays on the host audit face). Failures are disclosed, never thrown past. */
|
|
1151
1202
|
private challengeAndAnnounce;
|
|
1152
1203
|
/** The challenge notices, filed under each entry's own scope. The ledger append above is the fact and
|
|
1153
|
-
*
|
|
1204
|
+
* is awaited before this runs; the scope comes from the committed store (side-effect-free read), so the filing
|
|
1154
1205
|
* is chained work a mount waits for ({@link settleAnnouncementWork}). An id the store no longer
|
|
1155
1206
|
* holds has no scope to file under — said to the host only. A failed attribution is disclosed, never
|
|
1156
1207
|
* swallowed. */
|
|
@@ -1181,7 +1232,7 @@ export declare class MemoryEngine {
|
|
|
1181
1232
|
* `reason` is required and recorded in the announcement's shape (not its text — the announcement is a
|
|
1182
1233
|
* model-visible face and stays opaque); it is the operator's own note on the host error face.
|
|
1183
1234
|
*/
|
|
1184
|
-
rebuildCorruptControlPlaneLedger(ledger: StrictControlPlaneLedger, reason: string): ControlPlaneRebuildReceipt
|
|
1235
|
+
rebuildCorruptControlPlaneLedger(ledger: StrictControlPlaneLedger, reason: string): Promise<ControlPlaneRebuildReceipt>;
|
|
1185
1236
|
/**
|
|
1186
1237
|
* Host API (advisory, control-plane trust level — the same plane that can mark pollution):
|
|
1187
1238
|
* challenge entries by id. `requestId` is REQUIRED (the generation ledger's idempotency identity;
|
|
@@ -1189,7 +1240,7 @@ export declare class MemoryEngine {
|
|
|
1189
1240
|
* ack cannot open a second generation). Each entry's eventId derives as `<requestId>:<entryId>`,
|
|
1190
1241
|
* so one batched request stays per-entry attributable.
|
|
1191
1242
|
*/
|
|
1192
|
-
challengeEntries(ids: readonly string[], reason: string, requestId: string): ChallengeAssignment[]
|
|
1243
|
+
challengeEntries(ids: readonly string[], reason: string, requestId: string): Promise<ChallengeAssignment[]>;
|
|
1193
1244
|
/**
|
|
1194
1245
|
* design/178 v2-b §3.3(b) — the HOST erasure API: explicit, named, evidenced, loud. This is a
|
|
1195
1246
|
* host-plane DECLARED deletion, not a second deletion throat: it executes through the same
|
|
@@ -1312,20 +1363,20 @@ export declare class MemoryEngine {
|
|
|
1312
1363
|
/** Host API: challenge every entry the lineage ledger attributes to `sessionId` (post-hoc source
|
|
1313
1364
|
* falsification — trustedTools misconfigured, a tool re-classified, late delegation evidence).
|
|
1314
1365
|
* Same requestId contract as {@link challengeEntries}. */
|
|
1315
|
-
challengeSession(sessionId: string, reason: string, requestId: string): ChallengeAssignment[]
|
|
1366
|
+
challengeSession(sessionId: string, reason: string, requestId: string): Promise<ChallengeAssignment[]>;
|
|
1316
1367
|
/** Host API: the TRUSTED resolve — closes exactly the named generation (a later challenge stays
|
|
1317
1368
|
* open; a resolve never blanket-clears, and there is no model-face path to this call). Returns
|
|
1318
1369
|
* false ⇔ no such generation was ever opened. */
|
|
1319
|
-
resolveChallenge(entryId: string, generation: number, reason: string, requestId?: string): boolean
|
|
1370
|
+
resolveChallenge(entryId: string, generation: number, reason: string, requestId?: string): Promise<boolean>;
|
|
1320
1371
|
/** Host API: adjudicate one UNDECIDABLE pending lineage transaction (the applyPatches-success →
|
|
1321
1372
|
* credential-write crash window; design/180 r5 — never auto-discarded). The host, holding its own
|
|
1322
1373
|
* deployment facts, states whether the commit landed. */
|
|
1323
|
-
adjudicatePendingLineage(txnId: string, action: "promote" | "discard"): LineagePromotion[]
|
|
1374
|
+
adjudicatePendingLineage(txnId: string, action: "promote" | "discard"): Promise<LineagePromotion[]>;
|
|
1324
1375
|
/** Host observability: the staged lineage transactions still awaiting settlement (their entry ids
|
|
1325
1376
|
* are latched — see {@link readChallengeExclusions}). Throws on a corrupt ledger. */
|
|
1326
|
-
listPendingLineage(): Record<string, LineagePendingTxn
|
|
1377
|
+
listPendingLineage(): Promise<Record<string, LineagePendingTxn>>;
|
|
1327
1378
|
/** Host audit reads (throw on corruption — audit must not read a laundered ledger as clean). */
|
|
1328
|
-
readChallengeLedger(): ChallengeEvent[]
|
|
1379
|
+
readChallengeLedger(): Promise<ChallengeEvent[]>;
|
|
1329
1380
|
/** Observability/tests — the collect-only challenged-history account (B-3; zero engine consumers). */
|
|
1330
1381
|
readChallengedHistoryAccount(): Record<string, ChallengedHistoryRow>;
|
|
1331
1382
|
/** Promotion settlement (shared by harvest step ⑤, reconciliation and host adjudication): a
|
|
@@ -1344,10 +1395,12 @@ export declare class MemoryEngine {
|
|
|
1344
1395
|
shadowNames?: ReadonlyMap<string, string>;
|
|
1345
1396
|
}): Promise<MemorySessionHandle>;
|
|
1346
1397
|
private materializeCore;
|
|
1398
|
+
/** Async because its one destructive read — the drain of the session's notice queues — goes through the
|
|
1399
|
+
* governance store (the `announcements` document), which may answer asynchronously. */
|
|
1347
1400
|
inject(handle: MemorySessionHandle, opts?: {
|
|
1348
1401
|
writeToolMounted?: boolean;
|
|
1349
1402
|
reminderMark?: string;
|
|
1350
|
-
}): MemoryInjection
|
|
1403
|
+
}): Promise<MemoryInjection>;
|
|
1351
1404
|
/**
|
|
1352
1405
|
* design/138 S2-C — gate ONE tool write (Write/Edit/NotebookEdit) against the memory domain.
|
|
1353
1406
|
* `canonicalPath` is the tool band's already-canonical containment key; a path outside the
|
|
@@ -1415,7 +1468,7 @@ export declare class MemoryEngine {
|
|
|
1415
1468
|
/** §3.3 — the settlement valve: an audited host ruling over one delegation's outcome. `"clean"`
|
|
1416
1469
|
* releases the post-expiry gates (effective only — the history bit never flips, and a LATER
|
|
1417
1470
|
* observed `external` overrides the ruling); `"external"` convicts. Advisory trust plane. */
|
|
1418
|
-
resolveSettlement(settleId: string, to: "clean" | "external", requestId: string): void
|
|
1471
|
+
resolveSettlement(settleId: string, to: "clean" | "external", requestId: string): Promise<void>;
|
|
1419
1472
|
/** §4.2③ — the hold valve: `"release"` commits the held entry at the next harvest WITH a
|
|
1420
1473
|
* `"static"`-cause marker (a valve release is not a cleanliness proof); `"discard"` disposes it
|
|
1421
1474
|
* to quarantine. Audited (requestId required). */
|
|
@@ -1424,20 +1477,20 @@ export declare class MemoryEngine {
|
|
|
1424
1477
|
* residue arm keeps firing until the next full-domain harvest closes normally — a valve close
|
|
1425
1478
|
* must not launder the window it covers). It also ends the session's leg (no live writer of its
|
|
1426
1479
|
* layer any more). Audited (requestId required). */
|
|
1427
|
-
resolveSessionAccount(sessionId: string, requestId: string): void
|
|
1480
|
+
resolveSessionAccount(sessionId: string, requestId: string): Promise<void>;
|
|
1428
1481
|
/** The engine's control-plane directory (the sidecar home: pollution markers, lineage/challenge
|
|
1429
1482
|
* ledgers, and the design/336 settlement/hold/session accounts). Exposed so a host (and the
|
|
1430
1483
|
* runner's settlement handle) can address the SAME plane the engine writes — a second derivation
|
|
1431
1484
|
* would be a drift seam. */
|
|
1432
1485
|
get controlPlaneDir(): string;
|
|
1433
1486
|
/** Read face: every delegation settlement row with its folded effective status (host audit). */
|
|
1434
|
-
readDelegationSettlements(): EffectiveSettlement[]
|
|
1487
|
+
readDelegationSettlements(): Promise<EffectiveSettlement[]>;
|
|
1435
1488
|
/** Read face: every instruction-hold row (host audit; custody bytes are addressable through
|
|
1436
1489
|
* `captureName`/`disposition.quarantineName` under the control plane). */
|
|
1437
1490
|
readInstructionHolds(): HoldRow[];
|
|
1438
1491
|
/** Read face: the dangling foreign session-account rows a given session would classify residue
|
|
1439
1492
|
* against (host audit for the §3.6 valve). */
|
|
1440
|
-
readDanglingSessionAccounts(selfSessionId: string): ReturnType<typeof foreignDanglingSessionAccounts
|
|
1493
|
+
readDanglingSessionAccounts(selfSessionId: string): Promise<Awaited<ReturnType<typeof foreignDanglingSessionAccounts>>>;
|
|
1441
1494
|
/** The coded off-switch refusal every verb answers first (G1). */
|
|
1442
1495
|
private requireConsolidation;
|
|
1443
1496
|
/** Gate-store read with the strict fail-closed translation (F5: corrupt ⇒ verbs refuse coded;
|
|
@@ -1535,9 +1588,12 @@ export declare class MemoryEngine {
|
|
|
1535
1588
|
/** Take the application of `plan`: the last claimer holds it, an earlier holder is stale from now on and stops at its next owned write.
|
|
1536
1589
|
* The gate store's lock serves as the mutex (no gate row is touched). A plan that is gone or already terminal is nobody's to apply. */
|
|
1537
1590
|
private claimPlanForApply;
|
|
1538
|
-
/** A write of the plan's book by its holder: refused when another applier took over or the book was settled meanwhile (stale holders write nothing).
|
|
1591
|
+
/** A write of the plan's book by its holder: refused when another applier took over or the book was settled meanwhile (stale holders write nothing).
|
|
1592
|
+
* The owner read and the write are one transaction of the consolidation store — nobody's takeover lands between them. */
|
|
1539
1593
|
private writePlanOwned;
|
|
1540
|
-
/**
|
|
1594
|
+
/** An unfenced plan write (the plan's first durable write at freeze; the host valve's override). */
|
|
1595
|
+
private writePlan;
|
|
1596
|
+
/** Throws unless `plan` is still held by this applier: same token in the store (`cur`, as read), and the book is not settled into a state other than the one being written. */
|
|
1541
1597
|
private assertPlanOwner;
|
|
1542
1598
|
private throwPlanNotHeld;
|
|
1543
1599
|
/** Terminal settlement: per-item terminals → the plan terminal, the credential write (§1.5-3:
|
|
@@ -1597,7 +1653,7 @@ export declare class MemoryEngine {
|
|
|
1597
1653
|
* is where the conflict notice tells a host to look. */
|
|
1598
1654
|
private reconstructIntentsForRetry;
|
|
1599
1655
|
/** §6.2 — host read face: every plan's summary (audit enumeration, zero model surface). */
|
|
1600
|
-
listConsolidationPlans(): ConsolidationPlanSummary[]
|
|
1656
|
+
listConsolidationPlans(): Promise<ConsolidationPlanSummary[]>;
|
|
1601
1657
|
/**
|
|
1602
1658
|
* design/376 slice ③ (#436) — host read face: one plan's MEMBER-LEVEL fold evidence (which ids
|
|
1603
1659
|
* its APPLIED products supersede). This is the conservation wall's terminal witness: the
|
|
@@ -1621,12 +1677,12 @@ export declare class MemoryEngine {
|
|
|
1621
1677
|
* mint re-judges the live world. A LIVE-standing re-derivation here would instead false-red the
|
|
1622
1678
|
* honestly converged re-covered case, and the ruled evidence form is the per-plan applied edge.
|
|
1623
1679
|
*/
|
|
1624
|
-
readConsolidationPlanFoldEvidence(planId: string): ConsolidationPlanFoldEvidence
|
|
1680
|
+
readConsolidationPlanFoldEvidence(planId: string): Promise<ConsolidationPlanFoldEvidence>;
|
|
1625
1681
|
/** §6.2 — host read face: one scope's gate row (undefined when the store has no row — reading
|
|
1626
1682
|
* never creates the file, so the OFF deployment stays byte-identical, G1). A corrupt store
|
|
1627
1683
|
* ALSO answers undefined here — this face cannot distinguish the two; a consumer that needs
|
|
1628
1684
|
* the difference reads {@link readConsolidationGateState} (#437②). */
|
|
1629
|
-
readConsolidationGate(scope: string): ConsolidationGateRow | undefined
|
|
1685
|
+
readConsolidationGate(scope: string): Promise<ConsolidationGateRow | undefined>;
|
|
1630
1686
|
/**
|
|
1631
1687
|
* design/376 slice ③ (#437②) — host read face: one scope's gate row as a DISCRIMINATED answer.
|
|
1632
1688
|
* The undiscriminated face above folds a corrupt store into `undefined`, so a healthy never-run
|
|
@@ -1635,7 +1691,7 @@ export declare class MemoryEngine {
|
|
|
1635
1691
|
* creates the file — the OFF deployment stays byte-identical, G1); `corrupt` carries the
|
|
1636
1692
|
* refusal detail. Additive; the undiscriminated face is unchanged.
|
|
1637
1693
|
*/
|
|
1638
|
-
readConsolidationGateState(scope: string): ConsolidationGateRead
|
|
1694
|
+
readConsolidationGateState(scope: string): Promise<ConsolidationGateRead>;
|
|
1639
1695
|
/**
|
|
1640
1696
|
* design/376 片② — host read face: one scope's committed FOLD STATE, in the freeze's own
|
|
1641
1697
|
* accounting (`active` counts entries neither superseded nor excluded — byte-for-byte the
|
|
@@ -1658,6 +1714,13 @@ export declare class MemoryEngine {
|
|
|
1658
1714
|
* (design/376 §1.6-4); path knowledge is not authority — nothing here bypasses a verb.
|
|
1659
1715
|
*/
|
|
1660
1716
|
get controlPlaneRoot(): string;
|
|
1717
|
+
/** The store this engine keeps its consolidation state in: the backend's own (`MemoryBackend.governance`) when it
|
|
1718
|
+
* carries one, else the File store over this engine's control plane. Whether that state survives the replica is
|
|
1719
|
+
* `memoryGovernanceDurability`'s answer, not this member's presence. */
|
|
1720
|
+
get governance(): MemoryGovernanceStore;
|
|
1721
|
+
/** Host read face: the scope's latest consolidation driver run row (pending = resumable; settled = audit), read
|
|
1722
|
+
* through {@link governance}; a malformed account throws `ControlPlaneCorruptError`. */
|
|
1723
|
+
readConsolidationDriverRun(scope: string): Promise<ConsolidationDriverRunRow | undefined>;
|
|
1661
1724
|
/**
|
|
1662
1725
|
* design/376 slice ③ (#437③) — host read face: the store's scope enumeration, capability-probed
|
|
1663
1726
|
* on the backend (`listScopes`, the audit-face probe family). A backend WITHOUT the face
|