/** Sanitized, whitespace-collapsed, length-capped tail of command output. */ export declare function tailOf(value: string | undefined): string; /** * Coerce an unknown thrown value to its message string. Prefer this over the * inline `error instanceof Error ? error.message : String(error)` so error * stringification stays uniform. Note: this does NOT redact -- sites that emit * to public-bound artifacts must run the result through `redactText` first. */ export declare function toErrorMessage(error: unknown): string; /** * True when `error` is (structurally) the @e2b/desktop CommandExitError: a * non-zero substrate command exit that the real Sandbox surfaces as a THROW. * Matches either the SDK class name (`name === "CommandExitError"`) or any object * carrying a numeric `exitCode` (the same field `commandFailureInfo` reads, so a * structural fake is covered without importing the SDK class). * * Deliberately conservative — it is the RECOVERABILITY predicate the CUA loop uses * to skip a single failed desktop action instead of ending the whole run: it must * NOT match a deadline/abort control-flow signal (those subclass Error without a * name override or an exitCode) or a generic Error with no exit signal, so only a * genuine substrate-command failure is treated as recoverable. */ export declare function isCommandExitError(error: unknown): boolean; /** * Recover the exit code + a sanitized stderr/stdout tail from a command failure. * The real @e2b/desktop CommandExitError exposes exitCode/stderr/stdout/error; * these are read structurally so the caller does not depend on the SDK class. */ export declare function commandFailureInfo(error: unknown): { exitCode?: number; stderrTail: string; }; /** * Run a desktop command; if the substrate THROWS on a non-zero exit (the real * @e2b/desktop behavior), convert the throw into the caller's intended error via * `onFailure` (which returns the value to throw -- a new Error, or the original * error to preserve raw propagation). A non-throwing runner that RETURNS a * non-zero exitCode is left to the caller's own post-call check. */ export declare function runDesktopCommandOrThrow(run: () => Promise, onFailure: (info: { exitCode?: number; stderrTail: string; }, error: unknown) => unknown): Promise;