/** * child-pi-constants.ts — Shared timing and capture constants for child-pi runtime. * * Extracted from child-pi.ts (H-7 decomposition, step 3). Zero behavior change. * * These constants are shared between runChildPi (in child-pi.ts) and the kill * helpers (in child-pi-kill.ts). Centralizing them here avoids circular imports * and makes the timing budget configurable from one place. */ import { DEFAULT_CHILD_PI } from "../../config/defaults.ts"; /** Post-exit window during which stdio is guarded against late writes. */ export const POST_EXIT_STDIO_GUARD_MS = DEFAULT_CHILD_PI.postExitStdioGuardMs; /** Maximum time to wait for a final assistant event after the last stdout byte. */ export const FINAL_DRAIN_MS = DEFAULT_CHILD_PI.finalDrainMs; /** Time after SIGTERM to escalate to SIGKILL. */ export const HARD_KILL_MS = DEFAULT_CHILD_PI.hardKillMs; /** Maximum time with no output before the child is considered unresponsive. */ export const RESPONSE_TIMEOUT_MS = DEFAULT_CHILD_PI.responseTimeoutMs; /** * Maximum size (bytes) for the ChildPiLineObserver's line accumulation buffer. * When exceeded, the buffer is force-flushed to prevent unbounded memory growth * from chatty child processes that produce output without newlines. */ export const MAX_LINE_BUFFER_BYTES = 1024 * 1024; // 1 MB /** Maximum characters for assistant text fragments in compacted events. */ export const MAX_ASSISTANT_TEXT_CHARS = DEFAULT_CHILD_PI.maxAssistantTextChars; /** * Maximum characters for reasoning (`thinking`) fragments in compacted events, * and the size cap for the thinking parts in the agent view pane / view * session. Reasoning is display-only (never folded into results or artifacts), * so it gets a tighter cap than full assistant text. */ export const MAX_THINKING_CHARS = 8 * 1024; /** Maximum characters for tool-result fragments in compacted events. */ export const MAX_TOOL_RESULT_CHARS = DEFAULT_CHILD_PI.maxToolResultChars; /** Maximum characters for tool-input fragments in compacted events. */ export const MAX_TOOL_INPUT_CHARS = DEFAULT_CHILD_PI.maxToolInputChars; /** Maximum characters for general compactable content (used by TruncationStage). */ export const MAX_COMPACT_CONTENT_CHARS = DEFAULT_CHILD_PI.maxCompactContentChars;