/**
 * Shared constants and helpers for the persistent-terminal builtin extension.
 */
export declare const TERMINAL_BASH_TOOL = "bash";
export declare const TERMINAL_OUTPUT_TOOL = "bash_output";
export declare const TERMINAL_KILL_TOOL = "kill_bash";
export declare const TERMINAL_INPUT_TOOL = "bash_input";
export declare const TERMINAL_RESIZE_TOOL = "bash_resize";
export declare const TERMINAL_MONITOR_TOOL = "monitor";
/**
 * Companion tools kept active beside the PTY `bash`. `bash_input` and `bash_resize` are not listed:
 * they are search-exposed and activate on their first by-name call (senpi#4446).
 */
export declare const TERMINAL_COMPANION_TOOLS: readonly ["bash_output", "kill_bash", "monitor"];
export declare const DEFAULT_COLS = 120;
export declare const DEFAULT_ROWS = 40;
export declare const DEFAULT_SCROLLBACK = 10000;
export declare const DEFAULT_MAX_SESSIONS = 32;
/** Upper bound on decoded output retained per session for delta reads and `view:"log"`. */
export declare const MAX_SESSION_OUTPUT_CHARS = 1000000;
/** Grace window used to capture a background command's early output before returning its id. */
export declare const BACKGROUND_START_GRACE_MS = 250;
/**
 * Restore-context environment handed to monitor commands. `ID` and `STATE_DIR` are set on every
 * spawn of a persistent watch (ID alone for ephemeral ones); `RESTORED` and `DOWNTIME_MS` only on
 * the re-spawn after a restart, where the downtime is an upper bound, never an exact gap.
 */
export declare const MONITOR_ENV_ID = "SENPI_MONITOR_ID";
export declare const MONITOR_ENV_STATE_DIR = "SENPI_MONITOR_STATE_DIR";
export declare const MONITOR_ENV_RESTORED = "SENPI_MONITOR_RESTORED";
export declare const MONITOR_ENV_DOWNTIME_MS = "SENPI_MONITOR_DOWNTIME_MS";
/**
 * How long a re-spawned watch must stay up after a restore before it counts as restored. Long
 * enough for `git`/`gh` cold starts to fail visibly, short enough that the digest is not held.
 */
export declare const RESTORE_GRACE_MS = 2000;
/**
 * After a foreground session has been killed (abort or timeout), how long to keep
 * waiting for its exit to settle before releasing the tool anyway. A surviving
 * descendant that holds the PTY open (or a kill that never lands) must not keep
 * the agent blocked forever.
 */
export declare const KILLED_SESSION_EXIT_GRACE_MS = 5000;
/**
 * Absolute lifetime of a durable monitor, measured from its registration. It is a deadline,
 * never a sliding window: neither a restore nor a rearm extends it.
 */
export declare const DURABLE_MONITOR_EXPIRY_MS: number;
/**
 * Width of a durable command watch's rolling fire window: the persisted count of matched lines it
 * delivered inside the current window. It is a statistic only; nothing mutes on it.
 */
export declare const FIRE_BUDGET_WINDOW_MS: number;
/**
 * Wake pacing of a persistent command watch: at most this many wakes an hour on average, with a
 * burst of the same size. Lines matched between wakes are batched into the next one, never dropped.
 */
export declare const DEFAULT_MONITOR_WAKES_PER_HOUR = 12;
/** Runaway guard: a persistent command watch matching more lines than this in each minute... */
export declare const DEFAULT_MONITOR_RUNAWAY_LINES_PER_MINUTE = 120;
/** ...for this many consecutive minutes is paused with a visible notice until it is re-armed. */
export declare const DEFAULT_MONITOR_RUNAWAY_MINUTES = 5;
/** One per-monitor overflow file grows to this size before it rotates to a single `.1` copy. */
export declare const MONITOR_OVERFLOW_FILE_MAX_BYTES: number;
/**
 * Machine-consumed prefix of the runaway-guard pause summary: the monitor notifier treats a summary
 * that starts with it as a pause, not a completion, so it must not clear the session wake streak.
 */
export declare const RUNAWAY_PAUSE_SUMMARY_PREFIX = "paused: runaway output";
export declare function runawayPauseSummary(bashId: string, linesPerMinute: number, minutes: number): string;
/**
 * Non-interactive environment for foreground one-shot commands (codex-style):
 * cooperative tools (`gh`, `git`, pagers, color libs) skip spinners/colors at
 * the source instead of flooding the captured stream with redraw frames, and
 * `git` never blocks the captured foreground PTY on interactive input.
 * - `GIT_EDITOR: "true"`: git spawns `/usr/bin/true` as the editor, which exits 0
 *   immediately (git treats a zero-exit editor as accepted), so a `git commit`
 *   without `-m` aborts with "Aborting commit due to empty commit message" and a
 *   `git rebase -i` accepts the todo list instead of parking the tool inside
 *   nvim on COMMIT_EDITMSG until the timeout kills it.
 * - `GIT_TERMINAL_PROMPT: "0"`: git fails fast ("could not read Username",
 *   exit 128) instead of prompting for credentials on the captured PTY where
 *   nobody can type (same opt-out `package-manager.ts` already uses for its own
 *   git calls).
 * Background sessions keep the user's real TERM and git settings for
 * interactive apps.
 */
export declare const FOREGROUND_ENV_OVERRIDES: Readonly<Record<string, string>>;
/** Resolve a single named key to its PTY byte sequence, or null when unknown. */
export declare function resolveKeySequence(key: string): string | null;
/** Build a PTY-ready payload from a list of named keys, returning the unknown keys too. */
export declare function encodeKeys(keys: readonly string[]): {
    data: string;
    unknown: string[];
};
/** Compile a user-supplied regex, tolerating invalid patterns by returning null. */
export declare function safeRegExp(pattern: string): RegExp | null;
//# sourceMappingURL=shared.d.ts.map