/** Options for {@link die} — opt into machine-readable failure output. */
export interface DieOptions {
    /**
     * Emit a machine-readable `{"error", "hint"?}` object to **stdout** instead of
     * red text on stderr. Pass `isJsonMode(options)` from a `--json` command so an
     * agent parsing stdout gets a structured reason instead of an empty stream and
     * a bare nonzero exit (RUSH-1830).
     */
    json?: boolean;
    /** Optional recovery hint — the command to run instead. Included in both modes. */
    hint?: string;
}
/**
 * Render a fatal error to the right stream. Pure — no I/O, no `process.exit` — so
 * the human-vs-agent split is unit-testable. A `--json` caller gets
 * `{"error","hint"?}` on **stdout** (where a JSON consumer reads); a human gets
 * red text (plus a gray hint line) on **stderr**.
 */
export declare function formatDie(msg: string, opts?: DieOptions): {
    stream: 'stdout' | 'stderr';
    text: string;
};
/**
 * Print `msg` and exit the process with `code`. Humans get red text on stderr;
 * a `--json` caller (pass `{ json: true }`) gets `{"error","hint"?}` on stdout so
 * an agent has a parseable reason. Backward-compatible: `die(msg)` / `die(msg, code)`
 * keep the original red-stderr behavior.
 */
export declare function die(msg: string, code?: number, opts?: DieOptions): never;
/**
 * Await a command action and turn a thrown Error into a clean `die(message)`
 * instead of Node's raw stack dump — bootstrap's parseAsync catch deliberately
 * rethrows plain Errors as engineering bugs, so a command whose helpers throw
 * user-actionable errors (auth, org) wraps its `.action(...)` call site with
 * this. The helpers keep throwing so tests can assert on them. Pass `json`
 * so a `--json` caller still gets the structured `{"error"}` payload.
 */
export declare function runOrDie(fn: () => void | Promise<void>, opts?: DieOptions): Promise<void>;
/**
 * `die()` with a structured friction event attached. Use this at CLI error
 * chokepoints so the nightly routine can classify and rank recurring failures
 * without re-parsing transcripts. `surface` is the subsystem (teams, browser,
 * secrets, guard, …); `failureId` is a stable slug (e.g. 'remote-cwd-on-add').
 */
export declare function dieFriction(surface: string, failureId: string, msg: string, code?: number, opts?: DieOptions): never;
/**
 * Truncate `s` to at most `max` characters, appending a single-char ellipsis
 * (`…`) when shortened. Character-count based (not ANSI/width aware — use
 * `truncateToWidth` from `session/width.ts` for colored strings).
 */
export declare function truncate(s: string, max: number): string;
/**
 * Format an ISO timestamp as a compact relative age: "just now", "5m ago",
 * "3h ago", "2d ago". The canonical short form — the long "5 minutes ago"
 * variant that once lived in `cloud.ts` is deliberately dropped. (For the
 * session-list long form with calendar fallback, see
 * `formatRelativeTime` in `session/relative-time.ts`.)
 */
export declare function relTime(iso: string): string;
/** Format a millisecond duration as "45s", "3m", "2h 5m", "1d 3h". */
export declare function humanDuration(ms: number): string;
/**
 * Human-readable byte size. Previously copy-pasted into five files
 * (`commands/prune.ts`, `commands/share.ts`, `commands/inspect.ts`,
 * `commands/sessions.ts`, `lib/browser/sessions-list.ts`) — this is the
 * canonical home.
 */
export declare function formatBytes(n: number): string;
/**
 * True when an error came from the user cancelling a prompt (Ctrl+C).
 *
 * Lives here rather than in `commands/utils.ts` so `lib/` callers
 * (`drift-sync.ts`, `refresh.ts`) don't have to import upward out of `lib/`
 * into the command layer. `commands/utils.ts` re-exports it.
 */
export declare function isPromptCancelled(err: unknown): boolean;
/** True when stdin/stdout are attached to a real terminal. */
export declare function isInteractiveTerminal(): boolean;
/** Parse a comma-separated CLI list, trimming whitespace and dropping empties. */
export declare function parseCommaSeparatedList(value: string | undefined): string[];
/**
 * Visible column width of `s`, ignoring ANSI SGR color codes (e.g. chalk
 * wrappers). Matches the full CSI sequence including the `\x1b` escape.
 */
export declare function visibleWidth(s: string): number;
/** Pad `s` with trailing spaces to a target character width. */
export declare function padRight(s: string, width: number): string;
/** Pad `s` with trailing spaces to a target *visible* width (ANSI-aware). */
export declare function padVisible(s: string, width: number): string;
/** True when `--json` was passed. Piped stdout stays human-readable unless requested. */
export declare function isJsonMode(opts: {
    json?: boolean;
}): boolean;
/** Read all of stdin synchronously and return it UTF-8 decoded and trimmed. */
export declare function readStdinSync(): string;
/**
 * Wrap `text` in an OSC 8 hyperlink to `filePath` (as a `file://` URL) when
 * stdout is a TTY; otherwise return `text` unchanged.
 */
export declare function termLink(text: string, filePath: string): string;
