/** * Agent mode — makes the stack CLI scriptable and AI-friendly. * * Three orthogonal modes, set from global flags (stripped in bin/stack) or env: * * --json / STACK_JSON=1 * stdout carries ONLY a single final JSON result line; every human/log * line (console.log/info) is redirected to stderr so stdout stays pure. * * --non-interactive / STACK_NONINTERACTIVE=1 (also auto-on when stdin is not a TTY) * never prompt. When a value is genuinely required, the prompt throws a * typed NEEDS_INPUT StackError naming what to supply — instead of hanging. * * --quiet / STACK_QUIET=1 * suppress progress logs (warnings/errors still surface on stderr). * * Importing this module has no side effects; call initAgentMode() once at * startup. It deliberately does NOT import the prompt or command code, so it is * safe to import from anywhere (no cycles). */ export interface AgentMode { json: boolean; nonInteractive: boolean; quiet: boolean; } /** * Initialize agent mode from parsed global flags + environment. Idempotent. * Call once, as early as possible (before any command action runs). */ export declare function initAgentMode(opts?: { json?: boolean; nonInteractive?: boolean; quiet?: boolean; }): AgentMode; export declare function getAgentMode(): AgentMode; export declare const isJson: () => boolean; export declare const isNonInteractive: () => boolean; export declare const isQuiet: () => boolean; /** * Emit the final machine-readable result for a command. No-op unless --json. * `ok` plus the command's own structured result is serialized to stdout. */ export declare function emitResult(command: string, ok: boolean, result: unknown): void; /** * Top-level error handler for bin/stack. Maps any error to a stable exit code, * and in --json mode emits a structured error envelope on stdout. Never returns. */ export declare function handleTopLevelError(command: string, err: unknown): never; //# sourceMappingURL=agent-mode.d.ts.map