import { z } from "zod";
import type { PaneClient } from "./opencode-pane-server.js";
import { type Json, type Target } from "./protocol.js";
import { type TerminalProvider } from "./terminal.js";
/** Renaming a session from the phone: the pane's and tab's terminal labels,
 * then the harness's own rename where one can be driven remotely. */
/** What the phone may send as a session name: 1 to 80 characters, no control characters. */
export declare const renameLabel: z.ZodString;
export declare const renameRequest: z.ZodObject<{
    workspaceId: z.ZodString;
    tabId: z.ZodString;
    paneId: z.ZodOptional<z.ZodString>;
    label: z.ZodString;
}, z.core.$strip>;
export type NativeMechanism = "slash-command" | "app-server" | "opencode-api" | "none";
export interface NativeResult {
    harness: string;
    mechanism: NativeMechanism;
    applied: boolean;
    reason?: string;
}
/** Everything the rename touches outside this file; tests pass their own. */
export interface RenameDeps {
    snapshot(server: string): Promise<Json>;
    identity(server: string, pane: Json): Promise<string | undefined>;
    terminal(): TerminalProvider;
    codexRename(target: Target, label: string): Promise<boolean | undefined>;
    opencodeClient(server: string, pane: string): PaneClient | undefined;
    /** The name Claude's transcript for `target` last carries as its `custom-title`. */
    claudeTitle(target: Target): Promise<string | undefined>;
    /** The name Codex's `session_index.jsonl` last holds for a thread. */
    codexIndexTitle(thread: string): Promise<string | undefined>;
    sleep(ms: number): Promise<void>;
    /** How long a typed rename may take to show in the harness's own records. */
    verifyMs: number;
}
/** The last `custom-title` in the tail of a Claude transcript. */
export declare function lastCustomTitle(text: string): string | undefined;
/** The last `thread_name` written for `thread` in a Codex `session_index.jsonl`. */
export declare function lastIndexedName(text: string, thread: string): string | undefined;
export declare const defaultRenameDeps: RenameDeps;
/** The agent pane a rename addresses: the named pane, else the tab's only agent pane, else its only pane. */
export declare function renamePane(panes: Json[], paneId: string | undefined): {
    pane: Json;
    renameTab: boolean;
};
/** `POST /v1/sessions/rename`: terminal labels first, then the harness's own name. */
export declare function renameSession(server: string, data: Json, deps?: RenameDeps): Promise<Json>;
