/** Locking, backup and atomic-write primitives shared by platform mutations. */ import type { InstallRequest, PlatformAdapter } from './types.js'; export declare function atomicWrite(path: string, content: string): void; /** * Copies `path` into a backup directory below `root` and returns the copy's * path. `runDir` lets one init run collect all of its backups in a single * directory instead of one per millisecond. */ export declare function backup(path: string, root: string, privateBackup?: boolean, runDir?: string): string | undefined; export declare function scopeStateRoot(request: Pick): string; /** * Locks are deliberately scope-local. A stale lock remains visible and fails * safe; it is never removed by a later invocation that cannot prove ownership. */ export declare function withScopeLock(request: Pick, action: () => T): T; /** A dry run is read-only, including Monomind's own lock and state roots. */ export declare function withMutationLock(request: Pick, action: () => T): T; export declare function addSurfaceOwners(request: Pick, surface: string, owners: readonly string[]): void; /** Forgets `platform` as an owner and returns the platforms still installed there. */ export declare function dropSurfaceOwner(request: Pick, surface: string, platform: string): string[]; /** * The first symbolic link on the way from `base` down to `target` (exclusive of * `base`), or `target` itself when it lies outside `base`. Resolved locations * are lexical only, so this is what stops a planted `/ → /elsewhere` * link from redirecting a write or a removal. */ export declare function symlinkedComponent(base: string, target: string): string | undefined; export interface RemovalResult { changed: string[]; skipped: string[]; diagnostics: string[]; } /** * Removes one managed skill package directory below the adapter's skill root. * Unlocked: callers hold the mutation lock. Only `marker` blocks are stripped; * a file left with nothing but frontmatter or whitespace is deleted, a file * without the marker is never touched, and directories go only when empty. * Files listed in `keep` (relative to the package) are left alone, so a new * revision can shed only the files its predecessor projected. */ export declare function removeManagedSkillPackage(adapter: PlatformAdapter, request: InstallRequest, relativeDir: string, marker: string, keep?: readonly string[]): RemovalResult; //# sourceMappingURL=mutation.d.ts.map