import { type ByteSource, IOResult } from '../../../io/types.ts';
import { type Limit } from '../../../types.ts';
import type { Context } from '../../config.ts';
/** The start of the notice a command's capped output ends its stderr with. */
export declare const TRUNCATION_NOTICE = "output truncated at limit";
/**
 * Wait for `promise` until its deadline, then throw a timeout error. The call
 * itself runs on, and a stream it answers after the deadline is closed, since
 * no one reads it and it may hold the backend open (an SSH follow's remote
 * `tail`). `start` is when the budget began (`performance.now()`), when work
 * before this call already spent part of it. Mirrors Python's
 * `run_with_timeout`, whose deadline cancels the call itself.
 */
export declare function runWithTimeout<T>(promise: Promise<T>, seconds: number | null, name: string, start?: number): Promise<T>;
export declare function truncateStream(src: ByteSource, io: IOResult, limit: Limit): AsyncIterable<Uint8Array>;
/** Attach a terminal cap; its consuming statement settles status and notices. */
export declare function guardIO(stdout: ByteSource | null, io: IOResult, limit: Limit | null, command?: string): ByteSource | null;
/**
 * Apply output caps at a boundary and merge the outcome.
 *
 * The one boundary rule, shared by the command tree and the
 * whole-line runtimes: cap stdout, append the truncation notice to
 * stderr, and let an ERROR-mode guard override the exit code.
 */
export declare function guardOutput(stdout: ByteSource | null, stderr: ByteSource | null, exitCode: number, limit: Limit | null): Promise<[ByteSource | null, ByteSource | null, number]>;
/** An invocation's input under its abort; `split` as in chunks. */
export declare function guardInput(source: ByteSource, ctx: Pick<Context, 'signal'>, split?: boolean): AsyncIterable<Uint8Array>;
//# sourceMappingURL=limit.d.ts.map