import z from "zod";
import { createToolFactory, ToolCategory } from "../tools2/types.js";
import { debugCache } from "./debug-cache.js";
export const clearErrorCacheToolFactory = createToolFactory("clear_error_cache", ({ clark }) => {
    return {
        category: ToolCategory.DEBUG,
        description: `
      Clear all runtime errors and build system errors from the error cache.

      This tool clears:
      - All runtime errors (React component errors, JavaScript exceptions, etc.)
      - All build system errors (TypeScript compilation errors, build failures, etc.)

      After clearing, the error cache is invalidated to ensure fresh error detection
      on subsequent debug checks.

      Use this tool to clear stale errors that are no longer relevant.
    `,
        inputSchema: z.object({}),
        execute: async () => {
            clark.updateContext((context) => ({
                ...context,
                runtimeErrors: [],
            }));
            clark.updateContext((context) => ({
                ...context,
                buildSystemErrors: [],
            }));
            // Invalidate context errors cache since errors changed
            debugCache.invalidateContextErrors();
            return {
                status: "success",
                message: "Successfully cleared all runtime errors and build system errors from the error cache.",
            };
        },
    };
});
//# sourceMappingURL=clear-error-cache.js.map