import type { BridgeConnectionConfig, KernelToHostMessage, } from "../../bridge/protocol.ts"; import type { KernelSpawnProcess } from "./process.ts"; import type { PythonTransportResult } from "./transport.ts"; export interface PythonKernelStartOptions { readonly connection: BridgeConnectionConfig; readonly cwd: string; readonly env?: NodeJS.ProcessEnv; readonly interpreterPath: string; readonly onMessage?: (message: KernelToHostMessage) => void; readonly sessionId: string; readonly spawnProcess?: KernelSpawnProcess; readonly startupTimeoutMs?: number; } export interface PythonKernelRunOptions { readonly cellId: string; readonly code: string; readonly strings?: Readonly>; readonly timeoutMs?: number; } export type ResultMessage = PythonTransportResult; export interface PendingRun { escalationTimer?: NodeJS.Timeout; readonly input: PythonKernelRunOptions; interruptReason?: string; readonly reject: (error: unknown) => void; readonly resolve: (result: ResultMessage) => void; /** Set while an interrupt outcome is pending; resolved once the kernel knows whether state survived. */ resolveStateRetained?: (retained: boolean) => void; startedAt: number | null; timeoutTimer: NodeJS.Timeout | null; }