/** * Compile check — after ollama_draft produces code, run a cheap checker * and report {compiles, checker, stderr_tail} on the envelope. * * The stderr tail is the real value: a boolean tells you something broke, * the tail tells you *what* so review is useful instead of just binary. * * Never throws — compile failure is data, not an error. The tool handler * still returns the draft; the reviewer decides what to do. */ export type SupportedLanguage = "typescript" | "javascript" | "python" | "rust" | "go"; export interface CompileCheckResult { compiles: boolean; checker: string; stderr_tail: string; skipped?: boolean; skip_reason?: string; } export declare function compileCheck(code: string, language: string | undefined): Promise; /** * Detail payload for an operator-facing structured event emitted after * the compile guardrail runs. Stage B audited compileCheck as emitting * NO event today — handlers got the result back as data and either * folded it into the envelope or ignored it. This helper closes that * gap so an operator reading log_tail can answer "did this draft * compile?" without inspecting the per-call envelope. * * Phase 7 / FT-001: `op` + `rule` stamped so jq filters uniformly with * `jq 'select(.op=="guardrail" and .detail.rule=="compile_check")'`. * `error_count` is a coarse signal — the full diagnostic still lives on * the envelope (`compile_check.stderr_tail`), the event just carries * enough for triage. The NDJSON logger auto-merges `run_id` from the * active AsyncLocalStorage `CorrelationContext` at write time * (see observability.withCorrelation). * * Pattern (wired by tools agent in src/tools/draft.ts): * * const result = await compileCheck(draft, language); * const detail = buildCompileCheckEvent({ result, file: snippet, * language }); * await ctx.logger.log({ kind: 'guardrail', ts: ..., * tool: 'ollama_draft', rule: detail.rule, action: detail.decision, * detail }); */ export interface CompileCheckEventDetail { /** Closed-enum op tag from observability.CorrelationOp. Always 'guardrail' here. */ op: "guardrail"; /** Stable rule identifier — greppable. */ rule: "compile_check"; /** Pass or fail — closed enum. */ decision: "pass" | "fail"; /** File path or snippet identifier the check ran against (caller-supplied). */ file: string; /** * Language passed to compileCheck. May be undefined when the caller * didn't specify (in which case the check is skipped and decision * defaults to 'fail' with skipped:true on the underlying result). */ language?: string; /** * Coarse count of compiler errors. Heuristic — derived from the * stderr_tail by counting lines containing "error" (case-insensitive) * or, if no such lines, by 1-when-failed / 0-when-passed. The full * diagnostic still lives on the envelope; this is for triage filters. */ error_count: number; /** True when compileCheck skipped (no language, unsupported, or checker unavailable). */ skipped?: boolean; /** Reason for skip when applicable. */ skip_reason?: string; /** Identifier of the checker that ran (e.g. "tsc", "node --check"). */ checker: string; } /** * Build the structured-event detail for an operator log entry after the * compile-check guardrail ran. Always returns a detail (pass or fail) * so log_tail consumers can build a histogram of compile success rate * across drafts without scanning envelopes. * * Skipped checks are still emitted (with skipped:true) so an operator * can spot "this draft never got checked" and not confuse it with "this * draft compiled cleanly". */ export declare function buildCompileCheckEvent(args: { result: CompileCheckResult; file: string; language?: string; }): CompileCheckEventDetail; //# sourceMappingURL=compileCheck.d.ts.map