import { type TurnQueue } from "./turn-queue.js";
import type { IncomingHttpHeaders, ServerResponse } from "node:http";
import { type GitWriteDiagnostics } from "./git-write-policy.js";
import type { AgentHooks } from "./agent-hooks.js";
import { type WorktreeWorker } from "./git-worktrees.js";
import { type WorktreeRemovalLiveSession } from "./git-worktree-remove.js";
import { type ModelSwitcher } from "./model-switch.js";
import { type PermissionModeSwitcher } from "./permission-mode.js";
import type { SettingsSwitcher } from "./settings-switch.js";
import { type PromptGuards } from "./session-activity.js";
import { type Json, type Target } from "./protocol.js";
import type { CodexQuestions } from "./questions.js";
import { type SideQuestions } from "./side-questions.js";
/** Routes that act on one pane's conversation: prompts, answer keys, typed
 * secrets, uploads, diffs, git, approvals and questions. A starting pane (no
 * conversation yet) takes keys, a secret or a first prompt. */
export interface PaneRouteContext {
    turnQueue?: TurnQueue;
    gitWrites?: GitWriteDiagnostics;
    agentHooks: AgentHooks;
    modelSwitcher: ModelSwitcher;
    settingsSwitcher: SettingsSwitcher;
    permissionModeSwitcher: PermissionModeSwitcher;
    codexQuestions: CodexQuestions;
    sideQuestions: SideQuestions;
}
export declare function uploadBody(data: Json): {
    name: string;
    bytes: Buffer;
};
/** The repository a git route acts on: the pane's trusted directory, a
 * spawned child's own worktree exactly as /v1/diff resolves it, or one of the
 * pane repository's other worktrees as `/v1/git/worktrees` lists it. */
export declare function gitRepository(pane: Json, target: Target, child: unknown, worktree?: unknown): Promise<string>;
/** Agents running in this Herdr server's panes, by the folder each works in:
 * an agent launched into a new worktree from the phone is named here. Listed
 * last, so a sub-agent or fan-out manifest for the same folder wins a tie. */
export declare function herdrWorktreeWorkers(s: Json): WorktreeWorker[];
/** Every live pane on every running terminal server, including the requesting
 * one even when discovery left it out. A server that cannot be read, or any
 * discovery failure, fails the request: removal is never allowed on an
 * incomplete session check. */
export declare function allPaneSessions(requested?: string[]): Promise<WorktreeRemovalLiveSession[]>;
/** What `takesPrompt` checks before typing into a Claude pane Herdr reads working: nothing structured
 * pending there and no dialog on its screen. */
export declare function promptGuards(agentHooks: Pick<AgentHooks, "approval" | "terminalPrompt" | "servedQuestion">, target: Target): Required<PromptGuards>;
/** A Claude pane showing a subagent's view (its empty input reads "Message
 * @<agent>…") takes typed text for that subagent, so a phone message never
 * reached the turn and failed when it ended (owner, 2026-10-21). Escape returns
 * to the main view. It is pressed once, only while that view shows: in the main
 * view Escape would interrupt the turn, so a view still showing after it is left
 * as it is and logged. True when the view was left. */
export declare function leaveClaudeSubagentView(agentHooks: Pick<AgentHooks, "paneAnsi">, target: Target, waitMs?: number): Promise<boolean>;
/** A phone message the turn ended without, in a Claude pane that now shows a
 * subagent's view (opened while the message waited): leave the view and type
 * it again under the same delivery id, once. Any other outcome, a changed
 * pane, or ten minutes end the watch. */
export declare function retryAfterSubagentView(agentHooks: AgentHooks, target: Target, terminal: unknown, text: string, id: string, intervalMs?: number, limitMs?: number, escapeWaitMs?: number): void;
/** Observe while the original conversation works, then allow 30 seconds for
 * its submission acknowledgement after it finishes. A new legitimate turn
 * resets that window. No observation sends input to the terminal. */
export declare function followQueuedDelivery(agentHooks: AgentHooks, target: Target, terminal: unknown, text: string, id?: string, intervalMs?: number): void;
export declare function paneRoute(ctx: PaneRouteContext, url: URL, data: Json, response: ServerResponse, headers?: IncomingHttpHeaders): Promise<unknown>;
export declare function paneRouteOnce(ctx: PaneRouteContext, url: URL, data: Json, response: ServerResponse, typing: () => void | Promise<void>, headers?: IncomingHttpHeaders, sessionTerminal?: string): Promise<unknown>;
