/** * Detects API error messages from Claude CLI output. * Pattern: "API Error: " at the beginning of the text. */ const API_ERROR_RE = /^API Error:\s*\d{3}/; /** * Returns true if the message text starts with "API Error: ". */ export function isApiErrorMessage(text: string): boolean { return API_ERROR_RE.test(text); }