/** * Shared construction and application of projection plans. * * A render input is branded with a module-private symbol. Callers can define * adapters that consume the input, but only this module can construct one. * Aggregate construction first proves the desired-state graph complete. Plan * application serializes units that share a target file while retaining * concurrency across independent targets. * * @experimental This API is unstable and may change without notice. */ import * as Effect from "effect/Effect"; import type { AppError } from "../app-error/index.js"; import type { DesiredStateGraph } from "../workspace/desired-state-graph.js"; import type { ProjectionUnitObservation } from "./invariant-facts.js"; import type { AggregateOwnershipUnitId, OwnershipUnitId, SingletonOwnershipUnitId } from "./units.js"; declare const ProjectionRenderInputTypeId: unique symbol; declare const ProjectionPlanTypeId: unique symbol; /** Shared semantic decision made before a desired-state-dependent plan is exposed. */ export type DesiredStateGraphPlanningDecision = { readonly readiness: "ready"; readonly graph: DesiredStateGraph; } | { readonly readiness: "blocked"; readonly problems: DesiredStateGraph["problems"]; }; /** * Classify whether the desired-state graph can safely supply a complete plan. * Preview and apply consumers retain this exact decision; apply only checks * that the candidate's authoritative inputs have not changed. */ export declare const planDesiredStateGraph: (graph: DesiredStateGraph) => DesiredStateGraphPlanningDecision; /** Complete contributor input. Its module-private brand prevents construction by adapters. */ export interface ProjectionRenderInput { readonly contributors: ReadonlyArray; readonly [ProjectionRenderInputTypeId]: typeof ProjectionRenderInputTypeId; } export interface ProjectionAdapter { readonly observe: (input: ProjectionRenderInput) => Effect.Effect; readonly apply: (input: ProjectionRenderInput) => Effect.Effect; } /** Opaque executable plan for one ownership unit and one target file. */ export interface ProjectionPlan { readonly unitId: OwnershipUnitId; readonly targetFile: string; readonly [ProjectionPlanTypeId]: { readonly observe: Effect.Effect; readonly apply: Effect.Effect; }; } /** Construct one aggregate-unit plan only after graph completeness is proven. */ export declare const planAggregateProjection: (args: { readonly unitId: AggregateOwnershipUnitId; readonly targetFile: string; readonly graph: DesiredStateGraph; readonly select: (graph: DesiredStateGraph) => Effect.Effect, AppError>; readonly adapter: ProjectionAdapter; }) => Effect.Effect, AppError>; /** Construct a single-contributor plan through the same opaque input contract. */ export declare const planSingletonProjection: (args: { readonly unitId: SingletonOwnershipUnitId; readonly targetFile: string; readonly contributor: Contributor; readonly adapter: ProjectionAdapter; }) => ProjectionPlan; /** Observe planned units without applying their writes. */ export declare const observeProjectionPlans: (plans: ReadonlyArray) => Effect.Effect, AppError>; /** * Apply plans concurrently across target files and sequentially within each * target. This is the only function that can reach a plan's write effect. */ export declare const applyProjectionPlans: (plans: ReadonlyArray) => Effect.Effect; /** Apply same-result plans with target serialization and preserve input order. */ export declare const applyProjectionPlansWithResults: (plans: ReadonlyArray>) => Effect.Effect, AppError>; /** Build and apply the plans exposed by a projection-planning participant. */ export declare const applyPlannedProjections: (participant: { readonly projectionPlans: () => Effect.Effect, AppError>; }) => Effect.Effect; export {}; //# sourceMappingURL=planning.d.ts.map