2026-02-28 19:12:45 +01:00
|
|
|
/**
|
|
|
|
|
* @fileoverview Session port — capabilities for session lifecycle management.
|
|
|
|
|
* Route modules that manage sessions depend on this port.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import type { Session } from '../../session.js';
|
2026-09-16 11:44:37 +02:00
|
|
|
import type { SessionState } from '../../types.js';
|
2026-02-28 19:12:45 +01:00
|
|
|
|
|
|
|
|
export interface SessionPort {
|
|
|
|
|
readonly sessions: ReadonlyMap<string, Session>;
|
2026-08-23 14:40:13 -04:00
|
|
|
addSession(session: Session): Promise<void>;
|
2026-02-28 19:12:45 +01:00
|
|
|
cleanupSession(sessionId: string, killMux?: boolean, reason?: string): Promise<void>;
|
|
|
|
|
setupSessionListeners(session: Session): Promise<void>;
|
|
|
|
|
persistSessionState(session: Session): void;
|
|
|
|
|
persistSessionStateNow(session: Session): void;
|
2026-09-16 11:44:37 +02:00
|
|
|
/**
|
|
|
|
|
* Re-apply the persisted state a freshly CONSTRUCTED session does not carry:
|
|
|
|
|
* the pin, token and cost totals, auto-compact, auto-clear, auto-resume, nice
|
|
|
|
|
* priority, the flicker filter and the custom-model selection.
|
|
|
|
|
*
|
|
|
|
|
* A `Session` built from a record holds only what its constructor takes, so
|
|
|
|
|
* persisting it would otherwise REPLACE the fuller record with the reduced one.
|
|
|
|
|
* Call this before the first persist, and before `startInteractive()`, because
|
|
|
|
|
* the custom-model selection has to reach the pane's environment.
|
|
|
|
|
*/
|
|
|
|
|
reapplyPersistedSessionState(session: Session, saved: SessionState): Promise<void>;
|
2026-02-28 19:12:45 +01:00
|
|
|
getSessionStateWithRespawn(session: Session): unknown;
|
|
|
|
|
}
|