import type { ToolExecutor } from "../types.js"; /** * Detects "the tool ran successfully but shipped garbage" — the class of bug * where an object is coerced into markdown as `[object Object]`, or a leaked * `undefined`/`NaN` lands in rendered prose. (Real example: People Also Ask * entries rendered as `[object Object]` to every user, found only via a * customer report.) * * In tests/CI a dirty render throws (pre-merge gate). In real traffic it never * throws — it emits a structured warning and returns the result unchanged. */ export interface RenderIssue { /** The offending token, e.g. "[object Object]", "undefined", "empty-table". */ pattern: string; /** A short slice of surrounding text, for the warning/error message. */ snippet: string; } export interface AssertCleanRenderOpts { /** * Set for `success: false` results — only the `[object …]` check runs, since * error messages may legitimately mention "undefined"/"NaN". */ errorResult?: boolean; } export declare class CleanRenderError extends Error { readonly toolName: string; readonly issues: RenderIssue[]; constructor(toolName: string, issues: RenderIssue[]); } /** * Returns the render defects found in `markdown` (empty array = clean). Pure; * conservative by design — tuned to catch the real bug class with near-zero * false positives on legitimate empty-state output. */ export declare function assertCleanRender(markdown: string, opts?: AssertCleanRenderOpts): RenderIssue[]; /** * Wraps a tool executor so its rendered markdown is validated on every call. * Applied at the `TOOL_EXECUTORS` chokepoint, so it covers every tool on both * the stdio and in-app HTTP surfaces. Never alters the result. */ export declare function withCleanRender(toolName: string, executor: ToolExecutor): ToolExecutor; //# sourceMappingURL=clean-render.d.ts.map