/** * Interactive-session configuration: documented defaults, validated ranges, and * a runtime kill switch. Every value is validated before a slot is reserved or a * process is launched so an out-of-range setting can never produce a live child. */ import { type SessionOperation, type TerminalDimensions } from "./types.js"; export interface InteractiveSessionConfig { enabled: boolean; liveSessionLimit: number; quietIntervalMs: number; startDeadlineMs: number; sendDeadlineMs: number; closeDeadlineMs: number; gracefulCloseMs: number; pageBytes: number; memoryWindowBytes: number; queuedInputBytes: number; artifactCaptureBytes: number; artifactChunkBytes: number; persistenceQueueBytes: number; /** Undefined disables the timeout. */ idleTimeoutMs: number | undefined; lifetimeTimeoutMs: number | undefined; /** Behavior when artifact capture reaches its limit. */ onOutputLimit: "terminate" | "continue"; /** Max bytes retained for cross-chunk secret matching. */ redactionOverlapBytes: number; } interface Range { readonly min: number; readonly max: number; } export declare const INTERACTIVE_SESSION_RANGES: { readonly liveSessionLimit: { readonly min: 1; readonly max: 32; }; readonly quietIntervalMs: { readonly min: 25; readonly max: 5000; }; readonly startDeadlineMs: { readonly min: 100; readonly max: 120000; }; readonly sendDeadlineMs: { readonly min: 100; readonly max: 120000; }; readonly closeDeadlineMs: { readonly min: 100; readonly max: 120000; }; readonly gracefulCloseMs: { readonly min: 0; readonly max: 30000; }; readonly pageBytes: { readonly min: 1024; readonly max: 1048576; }; readonly memoryWindowBytes: { readonly min: 65536; readonly max: 16777216; }; readonly queuedInputBytes: { readonly min: 1024; readonly max: 1048576; }; readonly artifactCaptureBytes: { readonly min: 1048576; readonly max: 1073741824; }; readonly artifactChunkBytes: { readonly min: 65536; readonly max: 16777216; }; readonly persistenceQueueBytes: { readonly min: 65536; readonly max: 16777216; }; readonly idleTimeoutMs: { readonly min: 1000; readonly max: 86400000; }; readonly lifetimeTimeoutMs: { readonly min: 1000; readonly max: 604800000; }; readonly redactionOverlapBytes: { readonly min: 256; readonly max: 65536; }; }; export type RangedConfigField = keyof typeof INTERACTIVE_SESSION_RANGES; export declare const DIMENSION_RANGE: Range; export declare const DEFAULT_DIMENSIONS: TerminalDimensions; /** Hard cap for a blocking read wait, independent of send deadlines. */ export declare const MAX_READ_WAIT_MS = 30000; export declare const MAX_LIST_SUMMARIES = 50; export declare const INTERACTIVE_SESSION_DEFAULTS: InteractiveSessionConfig; /** Env kill switch. Disables only the seven interactive tools. */ export declare const KILL_SWITCH_ENV = "CLAI_DISABLE_INTERACTIVE_SESSIONS"; export type InteractiveSessionOverrides = Partial; /** * Resolve the effective configuration. Throws `INVALID_CONFIGURATION` for any * out-of-range value so callers fail before allocating resources. */ export declare function resolveInteractiveSessionConfig(overrides?: InteractiveSessionOverrides, operation?: SessionOperation): InteractiveSessionConfig; export declare function isInteractiveSessionsEnabled(config?: InteractiveSessionConfig): boolean; /** Per-operation timeout override, validated against the same bounds. */ export declare function resolveDeadline(field: "startDeadlineMs" | "sendDeadlineMs" | "closeDeadlineMs", override: number | undefined, config: InteractiveSessionConfig, operation: SessionOperation): number; export declare function resolveQuietInterval(override: number | undefined, config: InteractiveSessionConfig, operation: SessionOperation): number; export declare function resolveOptionalTimeout(field: "idleTimeoutMs" | "lifetimeTimeoutMs", override: number | undefined, config: InteractiveSessionConfig, operation: SessionOperation): number | undefined; /** Validate requested dimensions before any lookup or process mutation. */ export declare function resolveDimensions(columns: number | undefined, rows: number | undefined, operation: SessionOperation): TerminalDimensions; export declare function clampReadWait(waitMs: number | undefined): number; export {};