/**
 * M23 PatchService — thin wrapper over the third `PagesService` instance
 * mounted on `patchesDir`. Patches are markdown files with mandatory YAML
 * frontmatter (`type: patch`, `brief`, `patch_kind`, `created_at`,
 * `created_by`, `status`). They are authored by coding agents in *other*
 * terminals during brief implementation — claude4spec only reads them, lets
 * the spec author flip `status`, and spins up a chat thread to fold the
 * patch's findings back into the spec.
 *
 * Design notes (parallel to BriefService):
 *   - **Zero new tables**. Listing comes from PagesFrontmatterIndexer.
 *   - **Optimistic concurrency** by sha256 hash of full content.
 *   - **Immutable frontmatter** keys protected (PATCH_IMMUTABLE_FRONTMATTER_KEYS);
 *     only `status` is mutable from the claude4spec side.
 *   - A patch links to a brief via the `brief` frontmatter field, or — when
 *     absent — by filename prefix. Unresolvable ⇒ orphan (`briefPath: null`).
 */
import type { BriefThreadSummary, PatchListItem, PatchResponse, PatchStatus } from '../../shared/entities.js';
import type { PagesService } from './pages.js';
import type { PagesWatcher } from '../fs/watcher.js';
import type { PageVersionService } from './page-version.js';
import type { PageSerializer } from './page-serializer.js';
import type { ChatService } from './chat.js';
import type { PagesFrontmatterIndexer } from './pages-frontmatter-indexer.js';
export interface PatchServiceDeps {
    patchesPages: PagesService;
    patchesWatcher: PagesWatcher;
    patchesSerializer: PageSerializer;
    pageVersions: PageVersionService;
    chatService: ChatService;
    frontmatterIndexer: PagesFrontmatterIndexer;
}
export interface PatchListOpts {
    /** Filter to a single brief (its briefsDir-relative path). */
    brief?: string;
    status?: PatchStatus;
}
export interface PatchUpdateContentOpts {
    path: string;
    content: string;
    expectedHash?: string;
}
export interface PatchUpdateFrontmatterOpts {
    path: string;
    status: PatchStatus;
}
export declare class PatchService {
    private deps;
    constructor(deps: PatchServiceDeps);
    getPatch(relPath: string): Promise<PatchResponse>;
    listPatches(opts?: PatchListOpts): PatchListItem[];
    listThreadsForPatch(relPath: string): BriefThreadSummary[];
    updateContent(opts: PatchUpdateContentOpts): Promise<PatchResponse>;
    updateFrontmatter(opts: PatchUpdateFrontmatterOpts): Promise<PatchResponse>;
    createThreadForPatch(relPath: string, name?: string | null): Promise<{
        threadId: string;
    }>;
    private absPath;
    private knownBriefPaths;
    /**
     * Resolve the brief a patch belongs to: the `brief` frontmatter field if it
     * names an existing brief, else the brief whose filename stem is the longest
     * prefix of the patch filename stem, else `null` (orphan).
     */
    private resolveBriefPath;
}
