/** * Regex-safety worker thread body (mmnto-ai/totem#1641). * * Receives an `EvaluateRequest` from the main thread, compiles the pattern * once, iterates every input line, and posts back an `EvaluateResponse` * with matched line indices. If the pattern fails to compile (invalid * regex syntax), the response carries an `error` variant; the main thread * keeps the worker alive because syntax errors are cheap and per-batch. * * The main-thread `RegexEvaluator` wraps each request in a timeout; if * evaluation of a single line catastrophic-backtracks, the worker thread * hangs (JavaScript cannot interrupt a running regex). The main thread * then calls `worker.terminate()` and respawns. This file never sees the * termination path — it only handles the normal-return paths. */ export type EvaluateRequest = { id: string; pattern: string; flags: string; lines: readonly string[]; }; export type EvaluateResponse = { id: string; kind: 'ok'; matchedIndices: number[]; } | { id: string; kind: 'error'; message: string; }; //# sourceMappingURL=worker.d.ts.map