import { type DestinationExpectation, type DestinationRead } from "./materialization-fs.js"; import { type EccMaterializationReceipt, type EccMaterializedComponent, type EccOwnedFile } from "./materialization-receipt.js"; import type { EccMaterializationAdvisory, EccMaterializationFilePlan, EccMaterializationRequest, PlannedOperation, PlannedStep, ResolvedRequest } from "./materialization-types.js"; export declare function jsonText(value: unknown): string; /** * Render a whole document, or refuse. `JSON.parse` accepts values far deeper * than `JSON.stringify` survives, so a deep value under an OPERATOR key opens * the parse gate and detonates the render gate — with the owned digest still * matching, so subtraction is already authorised. Removal paths turn undefined * into an advisory; write paths refuse by name. */ export declare function renderJsonDocument(value: unknown): string | undefined; export declare function parseJsonObject(text: string): Record | undefined; /** * The owned keys of a document, on a null-prototype object: a `__proto__` key * assigned onto a normal object routes to the prototype setter, which would * both drop the key from the digest input and mutate the fragment's prototype. */ export declare function ownedFragment(document: Record, keys: readonly string[]): Record; /** The owned-fragment digest, or undefined when the value cannot be hashed at all. */ export declare function ownedFragmentDigest(document: Record, keys: readonly string[]): string | undefined; /** * The destination state a plan evolves. Every read goes through here, so a step * planned after another step on the same path sees what that step will leave, * not what is on disk right now. */ export declare class DestinationState { private readonly root; /** * Keyed by the FOLDED identity, the same key every ownership guard uses: on a * case-insensitive volume a step planned against one spelling must be visible * to a later step that reads another. */ private readonly planned; constructor(root: string); inspect(path: string): DestinationRead; /** The write-path read: an unreadable destination refuses rather than degrading. */ read(path: string): Buffer | undefined; expectation(path: string): { expect: DestinationExpectation; prior?: Buffer; priorMode?: number; }; set(path: string, bytes: Buffer | undefined, mode?: number): void; } export declare function resolveRequest(request: EccMaterializationRequest): ResolvedRequest; export declare function currentReceipt(root: string): EccMaterializationReceipt | undefined; interface SubtractionOutcome { steps: PlannedStep[]; plans: EccMaterializationFilePlan[]; advisories: EccMaterializationAdvisory[]; /** Entries that could NOT be subtracted and therefore keep their ownership record. */ retained: Map; } /** * The removal path: subtract only bytes that still match the receipt. A drifted * or unreadable file keeps its ownership record and is reported by component * and path — never deleted, never replayed. A file that is already gone is * reported too, but has nothing left to own. */ export declare function planSubtraction(state: DestinationState, components: readonly EccMaterializedComponent[]): SubtractionOutcome; export declare function plannedWrite(state: DestinationState, plan: EccMaterializationFilePlan, contents: Buffer): PlannedStep; export declare function readBoundedKiroAgentPaths(root: string, maxEntries?: number): string[]; /** * Plan an apply. Subtraction is planned first and materialization second * against the state subtraction leaves, so the two halves can never contradict * each other. */ export declare function planEccMaterialization(request: EccMaterializationRequest): PlannedOperation; /** Plan a full uninstall: subtract every owned component, record last. */ export declare function planEccUninstall(root: string): PlannedOperation; /** * Plan subtraction for an exact subset already named by the live receipt. No * source bytes are accepted or reconstructed; unrelated receipt ownership is * preserved and drifted selected content remains recorded. */ export declare function planEccComponentSubtraction(root: string, componentIds: readonly string[]): PlannedOperation; export {};