import type { SourceFilePlan } from './dist-lib/types/host/sourceFilePlan.js'; import type { InspectPreviewResult } from './dist-lib/types/editor/host.js'; export interface SourceFilePlanOptions { sourceRevision: string; allowedFiles: readonly string[]; excludedSourcePrefixes?: readonly string[]; signal?: AbortSignal; /** Server policy, rechecked under the file lock and around publication; failure rolls back owned writes. */ assertCurrent?(): void | Promise; } /** Capture and validate a serializable plan without reading or changing source files. */ export declare function captureSourceFilePlan(plan: SourceFilePlan, options: SourceFilePlanOptions): SourceFilePlan; export declare function previewSourceFilePlan(root: string, plan: SourceFilePlan, options: SourceFilePlanOptions): Promise>; export declare function applySourceFilePlan(root: string, plan: SourceFilePlan, options: SourceFilePlanOptions): Promise<{ applied: number; changed: number; files: string[] }>; export interface TokenSourceReferenceEdit { start: number; end: number; before: string; after: string } export interface TokenSourceReferenceDiagnostic { code: string; message: string; file: string; start?: number; name?: string } /** Diagnostics block the complete rewrite; offsets address UTF-16 source positions. */ export declare function rewriteTokenSourceReferences(input: { file: string; source: string; renames: readonly { from: string; to: string | null }[]; }): { source: string; edits: TokenSourceReferenceEdit[]; diagnostics: TokenSourceReferenceDiagnostic[]; references: { name: string; start: number; end: number; kind: 'static' | 'finite' }[]; }; /** * Build/validation workers must settle before the callback returns and its archive is removed. * Cancellation waits for callback settlement and cleanup, then rejects even if the callback returned. */ /** * Writes a reviewed plan in a temporary worktree at the remote base branch's * tip, commits it on a new branch and pushes that branch. Every proof must * still match the base tip; an existing branch is never replaced. */ export interface PublishedSourceFilePlan { branch: string; baseBranch: string; baseCommit: string; commit: string; files: string[]; } export interface PublishedSourceLocation { projectRoot: string; appDirectory?: string; remote?: string; baseBranch: string; git?(args: string[], context: { cwd: string; signal?: AbortSignal; timeout?: number }): Promise; } /** Reads remote refs and Git objects; never pushes or changes the serving checkout. Both the branch and base must remain exact. */ export declare function verifyPublishedSourceFilePlan(options: PublishedSourceLocation & { published: PublishedSourceFilePlan; plan: SourceFilePlan; signal?: AbortSignal; }): Promise; export declare function publishSourceFilePlan(options: { proposalValidation?: import('./source-validation.js').SourceProposalValidation; target?: import('./dist-lib/types/workspace/contracts.js').WorkspaceTarget; request?: import('./draft-preview.js').WorkspaceDraftSourceRequest; projectRoot: string; appDirectory?: string; remote?: string; baseBranch: string; branch: string; plan: SourceFilePlan; commitMessage: string; allowedFiles?: readonly string[]; /** Readies the temporary worktree for the repository's hooks after the plan is written. */ prepare?(context: { root: string; appRoot: string; signal?: AbortSignal }): Promise; /** Milliseconds allowed for the commit and push, which run the repository's hooks. Default 20 minutes. */ hookTimeout?: number; /** Await the durable publisher's boundary before pushing. Preparation failures remain safe to retry. */ beforeRemoteWrite?(): Promise; signal?: AbortSignal; temporaryRoot?: string; git?(args: string[], context: { cwd: string; signal?: AbortSignal }): Promise; }): Promise; export declare function withSourceArchive(options: { projectRoot: string; sourceRevision: string; appDirectory?: string; signal?: AbortSignal; }, operation: (context: Readonly<{ appRoot: string; sourceRevision: string; signal: AbortSignal }>) => Promise): Promise;