/** * Shared extension operation workflows — install and uninstall operation builders. * * @experimental This API is unstable and may change without notice. * @packageDocumentation */ import * as Effect from "effect/Effect"; import * as Option from "effect/Option"; import { type AppError } from "../app-error/index.js"; import type { JobStepArtifact, PlannedJobStep } from "../plan/plan.js"; import type { ExtensionRef } from "./refs.js"; import type { PackageUrlParts } from "../packaging/package-url.js"; import type { ExtensionManager, ExtensionTarget, ExtensionTargetFor } from "../workspace/service-interface.js"; /** * Derive an ExtensionTarget from an ExtensionRef. * * Pack targets include owner; leaf-extension targets are name-only. */ export declare const targetFromRef: (ref: ExtensionRef) => ExtensionTarget; export declare const extensionRefLifecycleWarnings: (ref: ExtensionRef) => ReadonlyArray; export declare const extensionRefRegistryLifecycle: (ref: ExtensionRef) => { deprecation: { readonly message: string; readonly deprecatedAt: import("effect/DateTime").Utc; readonly replacement?: { readonly status: "available"; readonly fqn: string; } | { readonly status: "unavailable"; readonly fqn?: string | undefined; } | undefined; } | { readonly replacement: { readonly status: "available"; readonly fqn: string; } | { readonly status: "unavailable"; readonly fqn?: string | undefined; }; readonly deprecatedAt: import("effect/DateTime").Utc; readonly message?: string | undefined; }; } | undefined; /** * Produce a display label from an ExtensionTarget. * * Pack targets render as `owner/name`; others render as `name`. */ export declare const toLabel: (target: ExtensionTarget) => string; /** * Produce a stable step identity key from an ExtensionTarget. * * This is internal plan identity, not display text. */ export declare const toStepKey: (target: ExtensionTarget) => string; /** * Format a single PackageUrlParts as a compact display string. * * Examples: `pkg:npm/react`, `pkg:npm/@angular/core@18.0.0` */ export declare const formatPackageUrlParts: (parts: PackageUrlParts) => string; /** * Build a display label with optional packages suffix. * * When packages is non-empty, appends them parenthesized: * `code-review (pkg:npm/react, pkg:npm/typescript)` */ export declare const toLabelWithCompanions: (target: ExtensionTarget, packages: ReadonlyArray) => string; /** * Cross-cutting uninstall dependency-retention policy. * * Captured from workspace service at plan-build time and passed to * runUninstallOperation. All methods have `R = never`. */ export interface UninstallRetentionPolicy { readonly isRequiredByInstalledPack: (args: { readonly target: ExtensionTarget; }) => Effect.Effect; } export interface InstallOperationArgs { readonly ref: TRef; readonly versionRange: Option.Option; /** When true, re-materialize unconditionally (repair path for forced reinstalls). */ readonly force?: boolean; /** When true, skip writing to settings (e.g. pack dependency installs). */ readonly skipSettings?: boolean; /** * When true, skip the trailing shared-projection reconcile (e.g. pack * dependency steps, whose closure runs one projection write at the end). */ readonly skipProjections?: boolean; /** * Defer the manager-wide observable check to an enclosing semantic closure. * Pack member transitions use this while other configured Packs are still * incomplete; the enclosing Pack graph validates every accepted canonical * package and its scoped desired-state postcondition before committing. */ readonly deferObservableValidation?: boolean; /** Optional pre-install state probe for artifact change labels. */ readonly installedBefore?: Effect.Effect; /** Optional presenter metadata computed after materialization/settings writes. */ readonly buildArtifact?: (args: { readonly installedBefore: boolean; }) => Effect.Effect; /** Optional outcome message for type-specific install presenters. */ readonly message?: string; /** Explicit destructive source-authority transition used only by demotion. */ readonly allowWorkspaceReplacement?: boolean; } export interface NewExtensionOperationArgs extends Omit, "force" | "allowWorkspaceReplacement"> { readonly target: ExtensionTargetFor; /** Read-only artifact forecast rendered by preview before any mutation occurs. */ readonly plannedArtifact?: JobStepArtifact; /** Collision checks repeated under the workspace transaction lock before the first write. */ readonly preflight?: Effect.Effect; readonly scaffold: Effect.Effect; readonly markAuthored: Effect.Effect; readonly message: string; readonly label?: string; } export interface AuthoredExtensionOperationArgs extends Omit, "ref"> { /** Canonical workspace package path protected by the transaction snapshot. */ readonly location: string; /** Additional files that the authored transition may update transactionally. */ readonly transactionTargets?: ReadonlyArray; /** Whether the new authored extension should remain materialized after creation. */ readonly enabled?: boolean; /** Commit the caller's final desired-state shape after canonical resolution. */ readonly finalizeAuthored?: Effect.Effect; /** Type-specific projection path for authored packages with specialized installers. */ readonly materializeInstall?: (ref: TRef) => Effect.Effect; /** * Project and then deactivate a disabled target when adopting a native * configuration requires the projection writer to perform the transition. */ readonly materializeWhenDisabled?: boolean; /** * Skip the global materializability preflight when replacing an explicitly * selected native/configured source with a new workspace-authored package. */ readonly allowConfiguredSourceTransition?: boolean; } /** * Build a PlannedJobStep for an install operation. * * The step captures the manager and args in its `run` closure so execution * requires no runtime service resolution (`R = never`). */ export declare const buildInstallOperation: (manager: ExtensionManager, args: InstallOperationArgs) => PlannedJobStep; /** * Build a PlannedJobStep for `new` commands. * * A read-only preflight runs first. The transaction then snapshots the source * path, scaffolds it, seeds desired state, resolves the canonical package, and * materializes projections before validating the authored postcondition. */ export declare const buildAuthoredExtensionStep: (manager: ExtensionManager, args: AuthoredExtensionOperationArgs) => PlannedJobStep; /** * Build a PlannedJobStep for existing `new` commands. * * New commands remain enabled by default while sharing the authored-package * transaction used by fork and native import. */ export declare const buildNewExtensionStep: (manager: ExtensionManager, args: NewExtensionOperationArgs) => PlannedJobStep; export interface MaterializeOperationArgs { readonly ref: TRef; /** Optional transition-rich label used by reconciliation previews. */ readonly label?: string; /** Explicitly permit a workspace-authored relocation during reconciliation. */ readonly allowWorkspaceSourceTransition?: boolean; /** Reacquire canonical content before projecting it. */ readonly force?: boolean; readonly buildArtifact?: () => Effect.Effect; readonly message?: string; } export declare const buildMaterializeOperation: (manager: ExtensionManager, args: MaterializeOperationArgs) => PlannedJobStep; export interface UninstallOperationArgs { readonly target: ExtensionTargetFor; /** * When true, skip the trailing shared-projection reconcile (e.g. pack * dependency steps, whose closure runs one projection write at the end). */ readonly skipProjections?: boolean; } /** * Build a PlannedJobStep for an uninstall operation. * * The step captures the manager, retention policy, and target in its `run` * closure so execution requires no runtime service resolution (`R = never`). */ export declare const buildUninstallOperation: (manager: ExtensionManager, retentionPolicy: UninstallRetentionPolicy, args: UninstallOperationArgs) => PlannedJobStep; //# sourceMappingURL=operations.d.ts.map