/** * Output formatting for Scoutline. * * This Module exposes the pure, invocation-local output contract from * DESIGN.md §3: OUTPUT_MODES, OutputMode, isOutputMode, * formatSuccessOutput, and formatErrorOutput. The pure `success` and * `error` response builders are retained as utility constructors. * * P1-10 removed the mutable output surface: there is no module-level output * mode, no mode setter/getter, no side-effecting success/error writers, no * output-mode environment mutation, and no console writes or process * termination here. Command presentation and process writes flow through * `invokeCommand` and the Node Adapter. */ export declare const OUTPUT_MODES: readonly ["data", "json", "pretty", "compact", "markdown", "refs", "tty"]; export type OutputMode = (typeof OUTPUT_MODES)[number]; export interface SuccessResponse { success: true; data: T; timestamp: number; } export interface ErrorResponse { success: false; error: string; code?: string; help?: string; } export type Response = SuccessResponse | ErrorResponse; export declare function isOutputMode(value: unknown): value is OutputMode; /** * Pure success formatter. * * - `data` mode emits the raw JSON-encoded data (no success envelope). * - `json` / `pretty` modes emit the success envelope with the timestamp * taken from the injected `now` (defaults to `Date.now`). `pretty` uses * 2-space indentation. * - Text-oriented modes (`compact`, `markdown`, `refs`, `tty`) return the * explicitly selected command presentation override when `data` carries * one (i.e. `data.presentations[mode]` is a string). Otherwise they * fall back to the JSON-encoded data. * * The function performs no I/O and mutates no shared state. */ export declare function formatSuccessOutput(data: T, mode: OutputMode, now?: () => number): string; /** * Pure error formatter. Inspects the value through duck typing so this * Module does not have to import from `./errors.js` (avoids a circular * dependency with the error hierarchy). * * Recognises a ScoutlineError-shaped object (one carrying `message` and * `code`) and surfaces `help` and `statusCode` when present. Plain * `Error` instances and unknown values fall through to `UNKNOWN_ERROR`. * `pretty` mode indents; all other modes emit compact JSON. * * The public envelope contains only the documented fields — `success`, * `error`, `code`, optional `help`, optional `statusCode` — so stack, * cause, raw response body, and any non-envelope property of the input * are never serialised. Credential-shaped substrings inside `help` and * `error` are redacted. * * The optional `secrets` argument lets a caller thread the credentials * resolved from an injected environment (e.g. `MainDependencies.env`) * into redaction, so a secret that exists only in the injected env — * and not in ambient `process.env` — is still redacted (Fixup B — B3). * When omitted, configured secrets are read from `process.env`. */ export declare function formatErrorOutput(value: unknown, mode: OutputMode, secrets?: string[]): string; export declare function success(data: T): SuccessResponse; export declare function error(message: string, code?: string, help?: string): ErrorResponse; //# sourceMappingURL=output.d.ts.map