import fs from "node:fs"; import type { IncomingMessage } from "node:http"; import type { Socket } from "node:net"; import { Router } from "express"; import * as pty from "node-pty"; import WebSocket from "ws"; export type PtySessionStatus = "running" | "exited"; export interface PtySessionSummary { id: string; title: string; workspacePath: string; shell: string; cols: number; rows: number; status: PtySessionStatus; createdAt: string; lastActiveAt: string; exitCode?: number; signal?: number; attachedClients: number; ownerUserId?: string; tenantId?: string; projectId?: string; } interface PtySessionEntry extends PtySessionSummary { ptyProcess: pty.IPty; sockets: Set; outputBuffer: string; idleTimer: NodeJS.Timeout | null; persistent: boolean; } export declare const ptySessions: Map; export declare function resolvePtyIdleTtlMs(env?: NodeJS.ProcessEnv): number; export declare function resolveDefaultShell(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv, existsSync?: (path: fs.PathLike) => boolean): { shell: string; args: string[]; }; export declare function resolveRequestedShell(requestedShell: unknown, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): { shell: string; args: string[]; }; export declare function isPathInsideRoot(candidatePath: string, rootPath: string): boolean; export declare function resolvePtyWorkspacePath(workspacePath: unknown, env?: NodeJS.ProcessEnv): string; export declare function createPtySession(input: { workspacePath: unknown; title?: unknown; shell?: unknown; cols?: unknown; rows?: unknown; persistent?: unknown; preCommand?: unknown; ownerUserId?: unknown; tenantId?: unknown; projectId?: unknown; }): PtySessionSummary; export declare function resolvePtyExitedTtlMs(env?: NodeJS.ProcessEnv): number; export declare function resolveMaxPtySessions(env?: NodeJS.ProcessEnv): number; export declare function listPtySessions(): PtySessionSummary[]; export declare function getPtySessionSummary(id: string): PtySessionSummary | undefined; export declare function createPtyConnectToken(sessionId: string): { token: string; expiresAt: string; } | undefined; export declare function closePtySession(id: string, reason?: string): boolean; export declare function closeAllPtySessions(reason?: string): void; export declare const ptyRouter: Router; export declare function attachPtyWebSocketServer(server: { on: (event: "upgrade", listener: (request: IncomingMessage, socket: Socket, head: Buffer) => void) => unknown; }): void; export {};