/** * A live pseudo-terminal session for one setup-token login command. A sandbox * provider opens it. The session allocates a real pseudo-terminal, streams the * raw terminal output, accepts delayed input, and stops the child. The session * forwards the raw terminal bytes; it runs no ANSI or OSC 8 handling. */ export interface LoginPtySession { /** * Registers the one output listener. The session streams each raw terminal * output chunk to `listener`, in order, as the pseudo-terminal emits it. */ onData(listener: (chunk: string) => void): void; /** * Writes raw input bytes to the pseudo-terminal. The runner writes the browser * code plus the Enter byte here, after the command starts. The session * forwards the bytes unchanged, so the code reaches the pseudo-terminal first * and the Enter byte reaches it last. */ write(data: string): void; /** Resolves with the child exit code when the command ends. */ wait(): Promise<{ exitCode: number | null; }>; /** * Stops the child process with a direct child stop. The characterization * showed that the child needs `SIGKILL`. The method must be safe to call more * than one time. */ kill(): void; /** Releases the session resources. The method must be safe to call more than one time. */ close(): Promise; } /** * Opens a pseudo-terminal session for `command`. A provider binds this to its * sandbox. The transport calls it one time, on start. */ export type LoginPtySessionOpener = (command: string) => Promise; /** * The child side of the setup-token run, in the shape the login runner needs. * The transport starts the command on a pseudo-terminal, streams the terminal * output, delivers delayed input, and stops the child for a terminal state. * * The shape matches the runner `SetupTokenPtyDriver` interface, so the runner * accepts the transport with no adapter. The transport never imports the runner, * so the runner package keeps its one-way dependency on this package. */ export interface LoginPtyTransport { /** * Opens the pseudo-terminal session for `command` and streams the terminal * output to `onData` in order. Resolves with the child exit code when the * command ends. The transport calls this one time. */ start(command: string, onData: (chunk: string) => void): Promise<{ exitCode: number | null; }>; /** * Writes `input` to the pseudo-terminal. The runner writes the browser code * plus the Enter byte one time, after it matches the prompt. An input that * arrives before the session opens waits in a small buffer, and the transport * flushes it in order when the session opens. */ write(input: string): void; /** * Stops the child with a direct child stop. The method is safe to call before * start and safe to call more than one time. A stop before the session opens * marks the run, and the transport kills the child as soon as the session * opens. */ stop(): void; /** Releases the transport resources. The method is safe to call more than one time. */ dispose(): Promise; } /** * Creates a {@link LoginPtyTransport} over `open`. The transport adapts a * pseudo-terminal session into the runner driver shape. It buffers an early * input write, it honors an early stop, and it forwards the raw terminal bytes * with no ANSI or OSC 8 handling. */ export declare function createLoginPtyTransport(open: LoginPtySessionOpener): LoginPtyTransport; //# sourceMappingURL=login-pty-transport.d.ts.map