import type { ExtensionContext } from "@earendil-works/pi-coding-agent"; import type { FabricCompactionOwnerMessageV1 } from "../protocol.js"; import { type FabricConfig } from "../config.js"; import { type ActiveCompactionOwner } from "./claim.js"; export type FabricCompactionOwnerReadResultV1 = { ok: true; message: FabricCompactionOwnerMessageV1; } | { ok: false; error: string; reply?: (result: { ok: false; error: string; }) => void; }; /** * Validates a compaction-owner message and returns a fresh copy built from * named fields only; the caller's object never reaches stored state. */ export declare const readFabricCompactionOwnerMessageV1: (value: unknown) => FabricCompactionOwnerReadResultV1; export interface CompactionOwnerHostOptions { /** The live session context, once Fabric knows it; undefined before. */ context: () => ExtensionContext | undefined; targetContextRatio: () => number | undefined; /** Called each time a held claim ends. */ onRelease: () => void; } /** What Fabric's extension shares with the claim code; the code fills `host` on the first message. */ export interface CompactionOwnerSlot { host?: CompactionOwnerHost; /** Set at session_shutdown: no claim is granted from then on. */ closed: boolean; /** * A deliberate yield the compaction hook noted for the ownership observer. * One noted while the owner held compaction, and never consumed, is * cleared when the claim ends so it cannot hide the next foreign compaction. */ yielded: boolean; } /** The part of Fabric's state the claim code reads. */ export interface CompactionOwnerConfigSource { readonly cwd: string | undefined; readonly config: FabricConfig; } /** Answers one message once the claim code has loaded; messages arrive in emit order. */ export declare const handleCompactionOwnerMessage: (slot: CompactionOwnerSlot, value: unknown, source: CompactionOwnerConfigSource, context: () => ExtensionContext | undefined) => void; /** * The registry plus the reader. Nothing here throws to the emitter: a message * that cannot be answered, or a reply that throws, becomes a warning (a * granted claim whose reply throws is withdrawn first). */ export declare class CompactionOwnerHost { #private; constructor(options: CompactionOwnerHostOptions); get active(): ActiveCompactionOwner | undefined; clear(): void; handle(value: unknown): void; /** Answers with a refusal; no claim is granted and none is held. */ refuse(value: unknown, reason: string): void; } //# sourceMappingURL=claim-events.d.ts.map