/** * Plan types for workspace operations. * * Uses a readiness-based model where each step carries its own `run` effect * (for ready/warn steps) or an error message (for error steps). A plan retains * the environment required by its executable steps so callers can compose * dependencies once at the command boundary. * * This module is the stable kernel home for the plan-pipeline primitives. It * is imported by the CLI, the lint module, and any shared-kernel consumer that * composes workspace Operations. The registry Worker SHALL NOT import it — * publish never applies fixes, so the plan pipeline tree-shakes out of the * Worker bundle. * * @experimental This API is unstable and may change without notice. * @packageDocumentation */ import type * as Effect from "effect/Effect"; import type * as Option from "effect/Option"; import * as Schema from "effect/Schema"; import { type AppError } from "../app-error/index.js"; import { type ExtensionType } from "../extensions/common.js"; import type { DeprecationView, ReleaseAgeOperationEvidence } from "../registry/index.js"; import type { SuggestedAction } from "../cli-runtime/suggested-action.js"; export declare const PlanPolicyIds: readonly ["ignore-version-constraints", "accept-warnings"]; export declare const PlanPolicyIdSchema: Schema.Literals; export type PlanPolicyId = typeof PlanPolicyIdSchema.Type; /** * Bounded blocking reason classes. Prose never carries a blocking reason on * its own; every blocked unit or operation names one of these classes. */ export declare const BlockingClassSchema: Schema.Literals; export type BlockingClass = typeof BlockingClassSchema.Type; /** Typed blocking carried by a unit result that did not proceed. */ export interface UnitBlocking { readonly class: BlockingClass; /** Machine-readable reference to the blocking unit or condition. */ readonly reference?: string; } export declare const PlanRiskConditionSchema: Schema.Union; readonly id: Schema.String; readonly detail: Schema.String; }>, Schema.Struct<{ readonly level: Schema.Literal<"override-required">; readonly id: Schema.String; readonly policy: Schema.Literals; readonly requiredFlag: Schema.String; readonly detail: Schema.String; }>, Schema.Struct<{ readonly level: Schema.Literal<"blocked">; readonly id: Schema.String; readonly detail: Schema.String; readonly errorCode: Schema.Literals; }>]>; export type PlanRiskCondition = typeof PlanRiskConditionSchema.Type; /** * Generic operation type used by all extension operation handlers. * Each operation is identified by a string name and carries typed args. */ export interface Operation { readonly name: TName; readonly args: TArgs; } export declare const ArtifactChangeSchema: Schema.Literals; export type ArtifactChange = typeof ArtifactChangeSchema.Type; export declare const ArtifactMechanismSchema: Schema.Literals; export type ArtifactMechanism = typeof ArtifactMechanismSchema.Type; export declare const ConfiguredAgentOutcomeSchema: Schema.Struct<{ readonly extensionType: Schema.Literals; readonly name: Schema.String; readonly agentId: Schema.String; readonly outcome: Schema.Literals; readonly reasonCode: Schema.String; readonly reason: Schema.String; readonly mechanism: Schema.optional; readonly path: Schema.optional; }>; export type ConfiguredAgentOutcome = typeof ConfiguredAgentOutcomeSchema.Type; export interface JobStepArtifact { readonly path: string; readonly scope: "project" | "user"; readonly agents?: ReadonlyArray; readonly version?: string; readonly change: ArtifactChange; readonly mechanism?: ArtifactMechanism; readonly previousVersion?: string; readonly fileCount?: number; readonly targets?: ReadonlyArray; readonly agentOutcomes?: ReadonlyArray; readonly source?: JobStepArtifactSource; readonly managedRegions?: ReadonlyArray; /** Registry lifecycle evidence captured when the candidate was resolved. */ readonly registryLifecycle?: { readonly deprecation: DeprecationView; }; } export interface JobStepManagedRegion { readonly unitId: string; readonly path: string; readonly owner: string; } export interface JobStepArtifactTarget { readonly path: string; readonly change: ArtifactChange; readonly agentIds?: ReadonlyArray; } export interface JobStepArtifactSource { readonly type: string; readonly origin: string; readonly ref?: string; readonly directory?: string; readonly gitTreeHash?: string; } export interface RegistryLifecycleEvidence { readonly deprecation: DeprecationView; } export type JobStepResult = { readonly result: "success"; readonly message: string; /** `skipped`: deliberately not attempted per policy; `unchanged`: evaluated, nothing to do. */ readonly disposition?: "skipped" | "unchanged"; readonly warnings?: ReadonlyArray; readonly links?: { readonly html: string; }; readonly artifact?: JobStepArtifact; readonly output?: Output; } | { readonly result: "error"; readonly message: string; readonly error: AppError; /** Present when the unit was prevented rather than failing on its own. */ readonly blocking?: UnitBlocking; }; export interface ReadyJobStep { readonly key?: string; readonly dependsOn?: ReadonlyArray; readonly readiness: "ready"; readonly label: string; readonly message?: string; readonly artifact?: JobStepArtifact; readonly agentOutcomes?: ReadonlyArray; readonly registryLifecycle?: RegistryLifecycleEvidence; readonly run: Effect.Effect, AppError, Requirements>; } export interface WarnJobStep { readonly key?: string; readonly dependsOn?: ReadonlyArray; readonly readiness: "warn"; readonly warnMessage: string; readonly label: string; readonly artifact?: JobStepArtifact; readonly agentOutcomes?: ReadonlyArray; readonly registryLifecycle?: RegistryLifecycleEvidence; readonly run: Effect.Effect, AppError, Requirements>; } export interface ErrorJobStep { readonly key?: string; readonly dependsOn?: ReadonlyArray; readonly readiness: "error"; readonly errorMessage: string; readonly label: string; readonly artifact?: JobStepArtifact; readonly agentOutcomes?: ReadonlyArray; readonly registryLifecycle?: RegistryLifecycleEvidence; /** Semantic blockers already represented in Plan.riskConditions. */ readonly blockingConditionIds?: ReadonlyArray; } export type PlannedJobStep = ReadyJobStep | WarnJobStep | ErrorJobStep; export interface CompletedJobStep { readonly key?: string; readonly label: string; readonly blockedBy?: ReadonlyArray; readonly registryLifecycle?: RegistryLifecycleEvidence; readonly agentOutcomes?: ReadonlyArray; readonly result: JobStepResult; } export type JobExecutionPolicy = "fail-fast" | "best-effort"; export interface Job { readonly steps: ReadonlyArray>; readonly concurrency: "unbounded" | number; /** * Defaults to ordered fail-fast execution. Use `best-effort` only when every * sibling step is independent; a failure still blocks subsequent jobs. */ readonly executionPolicy?: JobExecutionPolicy; } /** * Typed render vocabulary a planner declares for its operation; replaces * verb and subject inference from plan names. */ export interface OperationPresentation { readonly verb: { /** e.g. "update" */ readonly imperative: string; /** e.g. "Updated" */ readonly past: string; /** e.g. "Updating" */ readonly gerund: string; }; readonly subject: { readonly singular: string; readonly plural: string; }; } /** Presentation for an operation on one extension type (or extensions generally). */ export declare const operationPresentation: (verb: OperationPresentation["verb"], type?: ExtensionType) => OperationPresentation; export declare const OperationPreconditionSchema: Schema.Struct<{ readonly id: Schema.String; readonly label: Schema.String; readonly status: Schema.Literals; readonly detail: Schema.optional; readonly blockedOn: Schema.optional>; readonly command: Schema.optional; }>; export type OperationPrecondition = typeof OperationPreconditionSchema.Type; export interface Plan { readonly _tag: "Plan"; readonly name: string; readonly description: Option.Option; readonly jobs: ReadonlyArray>; readonly releaseAge?: ReleaseAgeOperationEvidence; readonly preconditions?: ReadonlyArray; /** Typed render vocabulary for this operation's human output. */ readonly presentation?: OperationPresentation; /** Semantic conditions evaluated by the shared execution-policy boundary. */ readonly riskConditions?: ReadonlyArray; /** Recovery specific to an operation that cannot currently be applied. */ readonly failureSuggestions?: ReadonlyArray; /** Persisted inputs outside workspace state that materially determine this plan. */ readonly materialPaths?: ReadonlyArray; /** Local plans roll back candidate-wide; remote effects report truthful partial outcomes. */ readonly executionCapabilities?: { readonly rollback: "local-atomic" | "non-rollbackable"; }; } export interface ExecutedJob { readonly steps: ReadonlyArray>; readonly concurrency: "unbounded" | number; readonly executionPolicy?: JobExecutionPolicy; } export interface ExecutedPlan { readonly _tag: "ExecutedPlan"; readonly name: string; readonly description: Option.Option; readonly jobs: ReadonlyArray>; readonly releaseAge?: ReleaseAgeOperationEvidence; readonly preconditions?: ReadonlyArray; readonly riskConditions?: ReadonlyArray; readonly candidateId?: string; } //# sourceMappingURL=plan.d.ts.map