import type { SessionOrigin } from '../../store/session-registry-repo.js'; export declare const SESSION_BACKENDS: readonly ["claude", "pi"]; export interface SessionRegistryWriter { generateSessionName(): Promise; registerSession(name: string, opts: { sessionId: string; channel: string; backend: string; kind: 'local' | 'scheduled'; origin?: SessionOrigin; projectId: string; label?: string | null; profileName?: string | null; }): Promise; } export interface RegisterNamedSessionOpts { sessionId: string; channel: string; backend: string; projectId: string; kind?: 'local' | 'scheduled'; /** How the session was initiated. Defaults to 'direct' — the only caller path here * (inbound direct message + TUI fresh session) is user-initiated. */ origin?: SessionOrigin; label?: string | null; profileName?: string | null; } /** Generate a fresh session name and register a registry record for sessionId. Returns the name. * Centralizes the generateSessionName + registerSession pairing used by inbound-message session * creation (agent-runner) and TUI fresh-session creation. */ export declare function registerNamedSession(store: SessionRegistryWriter, opts: RegisterNamedSessionOpts): Promise; export interface CreateDirectSessionDeps { sessionStore: SessionRegistryWriter; /** Point the channel's sessions.json entry at the new session (so a later send resumes it). */ setChannelSession(channel: string, sessionId: string, backend: string): Promise; /** Initialize the conversation ledger for the new channel/session. */ initConversation(channel: string, opts: { sessionId: string; sessionName: string; backend: string; }): Promise; /** Resolve the backend the send path will use for the channel (agent-runner reads the same). */ resolveBackend(channel: string): string; } /** Create a fresh, live user-initiated (origin='direct') session for a web/UI conversation: mint a * sessionId, derive its own `web:` conduit channel, register the named session, bind the * channel→session mapping and conversation ledger. Returns the sessionId + generated name + channel. * * When `profileName` is provided, the backend is resolved directly from the profile config (not * from the channel's profile state) so the session is bound to the correct backend even before any * channel profile is set. The channel profile is then set so subsequent sends resolve correctly. * * Because the channel is bound with the same backend the send path resolves, a subsequent send * resumes THIS session rather than spawning a new one. */ export declare function createDirectSession(deps: CreateDirectSessionDeps, opts: { projectId: string; sessionId?: string; profileName?: string | null; }): Promise<{ sessionId: string; sessionName: string; channel: string; }>; export interface AttachExistingSessionOpts { sessionId: string; sessionName: string; backend: string; profileName?: string | null; } /** Attach a channel to an existing session: restore its profile (if any), point sessions.json at it, * and switch the conversation ledger. Mirrors the !resume switch sequence. */ export declare function attachExistingSession(channel: string, opts: AttachExistingSessionOpts): Promise; export interface AdoptScheduledSessionStore { getById(sessionId: string): Promise<{ name: string; channel: string; backend: string; origin: SessionOrigin; profileName: string | null; } | null>; /** Re-point the registry record: channel → the adopted channel, kind → local, origin → direct. */ convertToDirect(sessionId: string, opts: { channel: string; }): Promise; } /** Convert a scheduled run's session into a normal direct web session (design 27b: replying adopts * the run). Attaches a dedicated `web:` conduit to the existing session — the same * switch sequence as !resume, so a later send resumes the run's transcript — then re-points the * registry record. `scheduleId` is intentionally KEPT on the record (provenance for the trigger * card / schedule grouping). Idempotent: a non-scheduled record just returns its current channel; * an unknown id returns null. */ export declare function adoptScheduledSession(store: AdoptScheduledSessionStore, sessionId: string): Promise<{ channel: string; } | null>; /** Clear a channel's session state: drop sessions.json keys for every backend, clean session * backups, and clear the conversation ledger. Mirrors the store-level half of !new. */ export declare function resetChannelSession(channel: string): Promise;