import type http from "node:http"; import { type LabelEntry } from "@kenkaiiii/gg-engine/internal/core/session-manager.js"; /** The longest title a rename keeps, the same cap the session lists apply. */ export declare const SESSION_TITLE_MAX = 80; /** A session open in a window right now. */ export interface LiveSessionFile { readonly path: string | undefined; /** Retitle it through the live session, so its own writes keep the name. */ readonly rename: (title: string) => Promise; } export interface SessionFileContext { /** `~/.gg`: every session store lives under it, and nothing outside is touched. */ readonly agentDir: string; readonly liveSessions: () => readonly LiveSessionFile[]; } interface Identity { readonly id: string; readonly conversationId: string; } /** * A session file the app may change: inside `~/.gg` (after resolving links), * named like a session, and starting with a session header. Anything else is * refused, so a request can never reach another file. */ export declare function checkedSessionFile(raw: unknown, agentDir: string): Promise<{ file: string; identity: Identity; } | null>; /** * Move a conversation's files (every checkpoint, its archive and its saved * images) into `~/.gg/trash/sessions/-/`, so a delete can be undone * by moving them back. Returns the folder they went to. */ export declare function trashConversation(file: string, identity: Identity, agentDir: string): Promise; /** Collapse a typed title to one trimmed line within the cap; null when empty. */ export declare function cleanTitle(raw: unknown): string | null; export declare function labelEntry(title: string): LabelEntry; /** * Daemon-level routes for a listed session's file, open or not: * `POST /sessions/rename` {path, title} and `POST /sessions/trash` {path}. * Trash refuses a conversation that is open in a window. */ export declare function handleSessionFileRoutes(req: http.IncomingMessage, res: http.ServerResponse, url: string, method: string, ctx: SessionFileContext): boolean; export {};