import type { RenderedToolScaffold, ToolScaffold, ToolScaffoldIdentity } from '../shared.js'; import type { RuntimePromotionAuthoredMode, RuntimePromotionLanguage } from './runtime-promotion-journal-types.js'; import type { AgentGuidanceResult, PreExistingFile } from '@opensip-cli/contracts'; export declare const AUTHORED_REPLAY_MANIFEST_KIND: "opensip-init-authored-replay"; export declare const AUTHORED_REPLAY_MANIFEST_VERSION: 1; export declare const INIT_AUTHORED_OPAQUE_DIRECTORY_NAMES: readonly ["node_modules", "dist", "coverage", ".turbo"]; export declare const INIT_AUTHORED_PLAN_CAPS: Readonly<{ maxMutations: 4096; maxManifestBytes: number; maxPathBytes: 4096; maxBlobNameBytes: 128; maxFileBytes: number; maxAggregateBlobBytes: number; maxTraversalEntries: 4096; maxTraversalDepth: 64; maxIdentityBytes: 256; }>; export type InitAuthoredMode = RuntimePromotionAuthoredMode; export type InitAuthoredWorkingDirState = 'pristine' | 'fully-initialized' | 'partial-config-only' | 'partial-dir-only'; export type InitAuthoredMutationAction = 'create' | 'replace' | 'delete' | 'preserve'; export type InitAuthoredTargetType = 'file' | 'directory'; export interface InitAuthoredPathState { readonly exists: boolean; readonly type: InitAuthoredTargetType | null; readonly mode: number | null; readonly digest: string | null; } export interface InitAuthoredMutation { readonly sequence: number; readonly action: InitAuthoredMutationAction; readonly path: string; readonly targetType: InitAuthoredTargetType; readonly targetMode: number; readonly preimage: InitAuthoredPathState; readonly desired: InitAuthoredPathState; readonly desiredBlob: string | null; readonly preimageBlob: string | null; } export interface InitAuthoredNormalizedInputs { readonly languages: readonly RuntimePromotionLanguage[]; readonly mode: InitAuthoredMode; /** Tool order is intentionally significant for a newly rendered plan. */ readonly tools: readonly ToolScaffoldIdentity[]; } export interface AuthoredReplayManifest { readonly kind: typeof AUTHORED_REPLAY_MANIFEST_KIND; readonly version: typeof AUTHORED_REPLAY_MANIFEST_VERSION; readonly inputs: InitAuthoredNormalizedInputs; /** Canonical UTF-8 project-relative path order. */ readonly mutations: readonly InitAuthoredMutation[]; } export type InitAuthoredSnapshotRecord = { readonly path: string; readonly exists: false; readonly type: null; readonly mode: null; readonly digest: null; readonly contentBase64: null; } | { readonly path: string; readonly exists: true; readonly type: 'directory'; readonly mode: number; readonly digest: string; readonly contentBase64: null; } | { readonly path: string; readonly exists: true; readonly type: 'file'; readonly mode: number; readonly digest: string; readonly contentBase64: string; }; export interface InitAuthoredSnapshot { /** Existing tree entries plus explicit present/missing target observations. */ readonly records: readonly InitAuthoredSnapshotRecord[]; /** Generated/dependency roots preserved opaquely without following or snapshotting them. */ readonly opaquePaths: readonly string[]; /** Classification derived from these exact snapshot observations. */ readonly workingDirState: InitAuthoredWorkingDirState; } export interface RenderedInitToolScaffold extends RenderedToolScaffold { /** * The live descriptor supplied a scaffoldExamples hook. Existing Init creates * that Tool's declared user directories even when the hook renders no files. */ readonly createsExampleDirectories: boolean; } export interface BuildInitAuthoredPlanInput { readonly languages: readonly RuntimePromotionLanguage[]; readonly mode: InitAuthoredMode; readonly toolScaffolds: readonly RenderedInitToolScaffold[]; readonly snapshot: InitAuthoredSnapshot; } /** * Exact blobs are retained as canonical base64 strings rather than mutable * Buffers. They are deliberately absent from the replay manifest. */ export interface InitAuthoredPlanBlobs { readonly desired: Readonly>; readonly preimage: Readonly>; } export interface InitAuthoredPlan { readonly inputs: InitAuthoredNormalizedInputs; readonly mutations: readonly InitAuthoredMutation[]; readonly replayManifest: AuthoredReplayManifest; readonly replayManifestBytes: string; readonly replayManifestDigest: string; readonly digest: string; readonly aggregateBlobBytes: number; readonly blobs: InitAuthoredPlanBlobs; /** * Attempt-local compatibility projection for the Init presenter. It is never * serialized into the replay manifest and is intentionally absent when a * later process reconstructs a plan from durable recovery artifacts. */ readonly presentation?: { readonly preExistingFiles: readonly PreExistingFile[]; readonly agentGuidance: AgentGuidanceResult; readonly workingDirState: InitAuthoredWorkingDirState; }; } export interface InitAuthoredSnapshotHooks { /** Fault-injection seam called after bytes are read but before revalidation. */ readonly afterFileRead?: (projectRelativePath: string) => void; /** Fault-injection seam called after a directory listing but before revalidation. */ readonly afterDirectoryRead?: (projectRelativePath: string) => void; } export interface ReadInitAuthoredSnapshotInput { readonly projectRoot: string; /** Every non-tree path whose present/absent preimage must be proven. */ readonly targetPaths: readonly string[]; readonly hooks?: InitAuthoredSnapshotHooks; } export interface CreateInitAuthoredPlanInput { readonly projectRoot: string; readonly languages: readonly RuntimePromotionLanguage[]; readonly mode: InitAuthoredMode; readonly toolScaffolds: readonly ToolScaffold[]; readonly hooks?: InitAuthoredSnapshotHooks; } /** @throws {Error} Always; the authored plan violates a required invariant. */ export declare function authoredPlanFailure(message: string): never; export declare function sha256Bytes(value: string | Uint8Array): string; /** Hash bounded byte segments without allocating one aggregate Buffer. */ export declare function sha256Parts(values: readonly (string | Uint8Array)[]): string; export declare function compareUtf8(left: string, right: string): number; export declare function pathDepth(value: string): number; export declare function isRuntimeAuthoredPath(value: string): boolean; export declare function normalizeProjectRelativePath(value: string): string; export declare function caseFoldPath(value: string): string; export declare function normalizeLanguages(languages: readonly RuntimePromotionLanguage[], options?: { readonly allowEmpty?: boolean; }): readonly RuntimePromotionLanguage[]; export declare function validateMode(value: string): asserts value is InitAuthoredMode; export declare function validateAuthoredToolIdentity(identity: ToolScaffoldIdentity, field: string): void; export declare function normalizeToolIdentities(scaffolds: readonly RenderedInitToolScaffold[]): readonly ToolScaffoldIdentity[]; export declare function directoryDigest(mode: number): string; export declare function absentPathState(): InitAuthoredPathState; export declare function sameAuthoredPathState(left: InitAuthoredPathState, right: InitAuthoredPathState): boolean; export declare function stateFromSnapshot(record: InitAuthoredSnapshotRecord): InitAuthoredPathState; //# sourceMappingURL=init-authored-plan-types.d.ts.map