import type { Session } from "../types.js"; import type { RailSession } from "./session-list-entry.js"; import { resolveRenameSubmission, SESSION_TITLE_MAX_LENGTH, sessionDisplayTitle } from "../../session-list-model.js"; /** * The title shown for a session: durable agent/user metadata once available, * otherwise a bounded opening-prompt preview while automatic naming is still * pending. Mirrors the rail list and the header so every surface reads * identically. */ export { sessionDisplayTitle }; /** * The value the editor seeds from when entering edit mode; see the shared * sessionRenameSeed. Rail entries carry a precomputed seed. */ export declare function renameSeedValue(session: RailSession): string; export { resolveRenameSubmission, SESSION_TITLE_MAX_LENGTH }; type RenameFn = (workspaceId: string, sessionId: string, title: string) => Promise; /** * Persist a submitted rename draft for a session. Resolves the draft against the * current display title and, only when it is a real change, calls `onRename` * with the session's workspace/id and the trimmed title. Returns the resulting * session, or `null` when the submission was an empty/unchanged no-op (so the * caller simply cancels without a network call). This is the exact effect the * `useInlineRename` commit runs; extracted so the three rename surfaces share — * and tests can assert — the persist semantics without a DOM. */ export declare function performRename(session: RailSession, draft: string, onRename: RenameFn): Promise; export interface InlineRename { /** Whether the inline editor is currently open. */ editing: boolean; /** The current draft value (controlled input value). */ draft: string; /** Whether a save is in flight (commit is a no-op while saving). */ saving: boolean; /** Set the draft from the input's onChange. */ setDraft: (value: string) => void; /** Ref to attach to the input so it focuses + selects on open. */ inputRef: React.RefObject; /** Open the editor, seeding from the session's current title. */ startEditing: () => void; /** Persist the draft (or cancel if it is an empty/unchanged no-op). */ commit: () => Promise; /** Close the editor and discard the draft. */ cancel: () => void; } /** * The shared inline-rename interaction. Owns the editing/draft/saving state and * the commit/cancel logic; the host renders the input (and whatever trigger * opens it) and wires the handlers. Used by the header editor and the rail row. */ export declare function useInlineRename(session: RailSession, onRename: RenameFn): InlineRename;