/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ /** Unix 128 + SIGINT. What a shell reports for Ctrl-C, and what Abort sends. */ export declare const SIGINT_EXIT_CODE = 130; /** Unix 128 + SIGTERM. */ export declare const SIGTERM_EXIT_CODE = 143; export interface RunSignalAbortOptions { readonly abort: () => void; /** Injected so tests can observe a second-signal force-exit. */ readonly exit?: (code: number) => void; } /** * First SIGINT/SIGTERM cooperatively aborts the in-flight run. A second of * either insists, because adding a listener removes Node/Bun's default * "die immediately" action for that signal — without a force-exit, a hung * abort would leave the process unkillable except by SIGKILL. * * Does not exit on the first signal: the run still has to reject so the CLI * can report `run_end` aborted, and callers such as agent chat can swallow a * cancelled turn without ending the session. */ export declare function installRunSignalAbort(options: RunSignalAbortOptions): () => void; /** * Runs `execute` with SIGINT/SIGTERM mapped onto `abort`, then detaches. */ export declare function runWithProcessSignalAbort(abort: () => void, execute: () => Promise): Promise; export declare function isAbortError(error: unknown): boolean; export declare function runFailureExitCode(error: unknown): number;