import { z } from "zod";
import { type Json } from "./protocol.js";
/**
 * Which pane is this computer's conductor, as the Hook keeps it
 * (docs/conductor-sets.md). The role follows the pane: server, pane id and
 * terminal id. When the agent in that pane restarts or logs in again, the
 * role stays and the new session is recorded. The Herdr agent name or tmux
 * `@phren_agent` is only a label, read once to migrate a conductor that
 * predates this file.
 */
declare const recordSchema: z.ZodObject<{
    server: z.ZodString;
    pane: z.ZodString;
    terminal: z.ZodOptional<z.ZodString>;
    workspace: z.ZodOptional<z.ZodString>;
    tab: z.ZodOptional<z.ZodString>;
    source: z.ZodOptional<z.ZodEnum<{
        claude: "claude";
        codex: "codex";
        copilot: "copilot";
        opencode: "opencode";
        phren: "phren";
    }>>;
    session: z.ZodOptional<z.ZodString>;
    since: z.ZodString;
    by: z.ZodEnum<{
        launch: "launch";
        migrated: "migrated";
        owner: "owner";
    }>;
}, z.core.$strip>;
export type ConductorRecord = z.infer<typeof recordSchema>;
/** A cleared name keeps its time (`name: null`), so an older name arriving later does not return. */
declare const setNameSchema: z.ZodObject<{
    name: z.ZodNullable<z.ZodString>;
    namedAt: z.ZodString;
}, z.core.$strip>;
export type SetName = z.infer<typeof setNameSchema>;
/** `conductor` absent is legacy mode: nothing has decided the role yet, so a
 * conductor is still recognized by its mux name. `null` is no conductor. */
declare const stateSchema: z.ZodObject<{
    version: z.ZodLiteral<1>;
    conductor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
        server: z.ZodString;
        pane: z.ZodString;
        terminal: z.ZodOptional<z.ZodString>;
        workspace: z.ZodOptional<z.ZodString>;
        tab: z.ZodOptional<z.ZodString>;
        source: z.ZodOptional<z.ZodEnum<{
            claude: "claude";
            codex: "codex";
            copilot: "copilot";
            opencode: "opencode";
            phren: "phren";
        }>>;
        session: z.ZodOptional<z.ZodString>;
        since: z.ZodString;
        by: z.ZodEnum<{
            launch: "launch";
            migrated: "migrated";
            owner: "owner";
        }>;
    }, z.core.$strip>>>;
    set: z.ZodOptional<z.ZodObject<{
        name: z.ZodNullable<z.ZodString>;
        namedAt: z.ZodString;
    }, z.core.$strip>>;
}, z.core.$strip>;
export type RoleState = z.infer<typeof stateSchema>;
/** The saved state; undefined before the file exists. */
export declare function readRoleState(): Promise<RoleState | undefined>;
/** For tests: forget the cached state. */
export declare function resetRoleState(): void;
/** A pane running an agent the Hook can talk to. */
export declare const runsAgent: (pane: Json | undefined) => pane is Json;
/**
 * The conductor's pane on `server`, from a snapshot of it, whether or not an
 * agent runs there right now. A recorded pane gone from the snapshot ends the
 * role. In legacy mode a live pane with a conductor name is adopted and saved.
 */
export declare function conductorPane(server: string, s: Json): Promise<Json | undefined>;
/** The recorded conductor, whatever its server; undefined in legacy mode or with none. */
export declare function recordedConductor(): Promise<ConductorRecord | undefined>;
/** Makes `pane` on `server` this computer's conductor, replacing any record. */
export declare function recordConductor(server: string, pane: Json, by: ConductorRecord["by"], session?: string): Promise<ConductorRecord>;
/** The session now running in the conductor's pane: a restart or new login reattaches here. */
export declare function noteConductorSession(server: string, pane: string, session: string): Promise<void>;
/** Ends the role. With `pane`, only when that pane holds it. Returns what was stopped. */
export declare function clearConductor(pane?: string): Promise<ConductorRecord | undefined>;
/** The set name this Hook holds. */
export declare function readSetName(): Promise<SetName | undefined>;
/** Keeps `name` when it is newer than the one held; `null` clears. Returns whether it changed. */
export declare function saveSetName(name: string | null, namedAt: string): Promise<boolean>;
export {};
