/** * Persistent Windows Python shell-engine sessions. * * One coordinator process is keyed to each agent session. Requests are serialized as JSON lines; * Node remains the sole owner of cwd/environment state and derives each request only after the * preceding terminal frame has been applied. Command bytes stream on stdout, followed by a * request-specific output barrier. A correlated control frame arrives on stderr. Requiring both * channels before settlement prevents cross-pipe tail loss and stale-frame reuse. * * Timeout, abort, protocol failure, or coordinator death resets the whole process tree. The next * request starts a clean coordinator from the last state Node actually acknowledged. */ import type { ChildProcess, SpawnOptions } from "node:child_process"; import { type PythonRuntimeOutcome } from "../python-runtime.ts"; import type { BashOperations } from "./bash.ts"; import { type WindowsShellState } from "./windows-shell-state.ts"; /** State/result fields returned for every completed engine command. */ export interface WindowsShellEngineFrame { exitCode: number; cwd: string; envDelta: Record; unsupported: { code: "unsupported"; construct: string; message: string; } | null; } export declare class WindowsShellEngineFailure extends Error { readonly capturedOutput: string; constructor(message: string, capturedOutput: string); } export interface WindowsShellEngineOptions { /** Override for tests: resolves the Python runtime outcome. Default: `ensurePythonRuntime`. */ resolveRuntime?: () => Promise; /** Override for tests: absolute path to the engine's `main.py`. Default: the bundled runtime. */ engineScriptPath?: string; /** Override for tests: the per-session state store lookup. Default: the shared module store. */ getState?: (sessionKey: string) => WindowsShellState; /** Override for tests: spawns the persistent coordinator. Default: `spawnProcess`. */ spawn?: (command: string, args: string[], options: SpawnOptions) => ChildProcess; /** Override for tests: selected PowerShell host used to adapt `.ps1` external commands. */ resolvePowerShellPath?: () => string; } /** Kill and forget a Python coordinator. The next call for this key starts a clean process. */ export declare function disposeWindowsShellEngineSession(key: string): Promise; /** Create the Python-engine tier for one bash-tool session. */ export declare function createWindowsShellEngineOperations(sessionKey: string, options?: WindowsShellEngineOptions): BashOperations; //# sourceMappingURL=windows-shell-engine.d.ts.map