/** * On-disk audit log for compensating-op rollbacks during `scai provision recipe push`. * * When an apply phase aborts (op error, mid-flight cancel) the executor * unwinds applied actions LIFO. Each step's outcome is appended to * `.jsonl` under `~/.sitecoreai/rollback/` so operators can: * * - tell at a glance whether rollback completed cleanly, * - find the specific items that rollback failed on (zombie state on * the tenant — the part of "best-effort" the in-memory event count * alone obscures), * - replay the rollback manually with the captured itemIds if needed. * * The log is lazy: nothing is written if no rollback runs. Successful * pushes leave no file. Write failures (full disk, permissions) are * swallowed and surfaced through `consola.debug` — never re-thrown, * because the caller is already inside a failure path that has its own * reason for aborting. * * Override the directory via `SITECOREAI_ROLLBACK_LOG_DIR`. Matches the * pattern established by `src/shared/history.ts`. */ export declare const ROLLBACK_LOG_SCHEMA_VERSION = 1; export interface RollbackStepLog { index: number; label: string; status: "success" | "failed" | "skip"; inverse?: "deleteItem" | "updateItem" | "restoreItems"; itemId?: string; /** * Count of items the rollback step restored — populated only when * `inverse === "restoreItems"`. Operators auditing a half-rolled-back * push see how many of the previously-pruned items came back (the * difference from the original prune count flags partial restoration). */ restoredCount?: number; reason?: string; error?: string; } export interface RollbackSummaryLog { trigger: "apply-error" | "plan-error" | "cancelled"; rolledBack: number; errorCount: number; forwardError?: string; } export interface RollbackLogger { readonly runId: string; readonly logPath: string; /** True once at least one line has been appended to the file. */ readonly wasUsed: boolean; recordStep(recipe: string, entry: RollbackStepLog): Promise; recordSummary(recipe: string, entry: RollbackSummaryLog): Promise; } export declare const resolveRollbackLogDir: () => string; export interface CreateRollbackLoggerOptions { /** Override the log directory. Falls back to `resolveRollbackLogDir()`. */ dir?: string; } export declare const createRollbackLogger: (runId: string, options?: CreateRollbackLoggerOptions) => RollbackLogger;