/** * Notes about an incomplete response * * The transport collects command output into a buffer of limited size and * honestly reports when the output didn't fit. A human needs to see this * next: a piece of a file or a listing looks no different from the whole, * and a silently truncated scrap reads as a trustworthy answer. */ /** How much command output fits into the transport buffer; anything past this gets truncated */ export declare const OUTPUT_LIMIT_BYTES: number; /** Human-readable size label: 10485760 → "10 MiB" */ export declare function byteLimitLabel(bytes: number): string; export declare const TRUNCATED_OUTPUT_NOTE: string; /** Append a note if the output is incomplete */ export declare function withTruncationNote(text: string, truncated: boolean): string; /** * Why the file read failed and what to do instead. * * A note doesn't help for a file: the content moves on as data — it gets * written back, parsed, compared. A truncated file is more dangerous than a * failure in that chain, so this is a failure with a ready workaround. */ export declare function truncatedReadMessage(path: string): string; /** * Bytes that don't form text arrive as a replacement character — the file is * already damaged, and writing it back would produce a different file. So * this is also a failure with a workaround, not a note on top of the content. */ export declare function binaryReadMessage(path: string): string; export declare const PARTIAL_OUTPUT_NOTE = "\u26A0\uFE0F The command was stopped before it finished \u2014 this is only what it printed until then."; /** * Output the command accumulated before it was stopped, under an * incomplete-output note. * * Empty string when there's nothing to print: the command may have been * killed before its first byte, and an empty section would read as "there * was no output", though there's no way to tell. */ export declare function partialOutputSection(stdout: string, stderr: string): string; /** * How many log search matches fit into a single response. * * Without a limit, the only boundary is the transport buffer, which sits far * above a reasonable response size — so an unbounded search would flood the * caller with the whole log instead of just the matches. */ export declare const DEFAULT_MAX_MATCHES = 200; /** Note that the output was truncated by match count, not by buffer size */ export declare function matchLimitNote(max: number): string; /** * Keep no more than `max` matches. * * A match differs from a context line by the character after the number: * `12:` for a found line and `12-` for a neighboring one, so only the * former is counted. */ export declare function limitMatches(text: string, max: number, /** Which end to keep: the oldest lines of the file, or the newest */ from?: 'start' | 'end'): { text: string; limited: boolean; }; /** Whether the text read back contains a replacement character — a trace of lost bytes */ export declare function looksDamagedAsText(text: string): boolean; /** Whether the code is the guard's report that it killed the command, not the command's own answer */ export declare function killedByTimeoutGuard(exitCode: number): boolean; /** * What to do about it, in place of sudo's own advice. * * Sudo names the mechanism — «use the -S option», «configure an askpass * helper» — and neither is reachable from the other side of a tool call. */ export declare const SUDO_HAS_NOTHING_TO_ANSWER_WITH: string; /** Whether sudo stopped on a password it could not ask for */ export declare function sudoAskedForAPassword(stderr: string): boolean; /** Hint for the exit code, when the bare number alone would mislead */ export declare function exitCodeHint(exitCode: number): string; /** * The path a tool complained about, taken out of its own words: * "grep: /var/log/secure: Permission denied". * * Read by whoever asked, because a complaint silenced or left as raw text * turns "could not look" into "nothing there". */ export declare function unreadablePath(line: string): string;