import { Readable, Writable } from 'node:stream'; /* tslint:disable */ /* eslint-disable */ /* auto-generated by NAPI-RS */ declare const enum Operation { Modify = 'Modify', Delete = 'Delete', } /** * Sandboxing rules. Deleting / modifying a path with any of the prefixes is forbidden and will * cause process termination. */ interface SandboxRule { /** The forbidden operation. */ operation: Operation; /** The list of prefixes that are matched by this rule. */ prefixes: Array; /** The list of prefixes that are excluded from this rule. */ excludePrefixes?: Array; /** The message to be shown if this rule triggers. */ message: string; } /** Options for the sandbox. */ interface SandboxOptions { rules: Array; } /** The options that can be passed to the constructor of Pty. */ interface PtyOptions { command: string; args?: Array; envs?: Record; dir?: string; size?: Size; cgroupPath?: string; newCgroupNamespace?: boolean; apparmorProfile?: string; interactive?: boolean; sandbox?: SandboxOptions; onExit: (err: null | Error, exitCode: number) => void; } /** A size struct to pass to resize. */ interface Size { cols: number; rows: number; } /** * Set the close-on-exec flag on a file descriptor. This is `fcntl(fd, F_SETFD, FD_CLOEXEC)` under * the covers. */ declare function setCloseOnExec$1(fd: number, closeOnExec: boolean): void; /** * Get the close-on-exec flag on a file descriptor. This is `fcntl(fd, F_GETFD) & FD_CLOEXEC == *_CLOEXEC` under the covers. */ declare function getCloseOnExec$1(fd: number): boolean; /** * A very thin wrapper around PTYs and processes. * * @example * const { Pty } = require('@replit/ruspty'); * * const pty = new Pty({ * command: '/bin/sh', * args: [], * envs: ENV, * dir: CWD, * size: { rows: 24, cols: 80 }, * onExit: (...result) => { * // TODO: Handle process exit. * }, * }); * * const read = pty.read; * const write = pty.write; * * read.on('data', (chunk) => { * // TODO: Handle data. * }); * write.write('echo hello\n'); */ declare class Pty { #private; read: Readable; write: Writable; constructor(options: PtyOptions); private dropUserFd; close(): void; resize(size: Size): void; get pid(): number; } /** * Set the close-on-exec flag on a file descriptor. This is `fcntl(fd, F_SETFD, FD_CLOEXEC)` under * the covers. */ declare const setCloseOnExec: typeof setCloseOnExec$1; /** * Get the close-on-exec flag on a file descriptor. This is `fcntl(fd, F_GETFD) & FD_CLOEXEC == * FD_CLOEXEC` under the covers. */ declare const getCloseOnExec: typeof getCloseOnExec$1; export { Operation, Pty, type PtyOptions, type SandboxOptions, type SandboxRule, getCloseOnExec, setCloseOnExec };