import type { TurnEndEvent, TurnEndEventResult } from "@earendil-works/pi-coding-agent"; /** Name of the user-level config file inside the agent config directory. */ export declare const AUTO_CHECK_CONFIG_FILE = "pi-lsp.json"; /** User-level config file shape. */ export interface LspConfig { /** Opt-in: absent/false keeps auto-check off, true enables it. */ autoCheckBeforeReply?: boolean; } /** * Auto-check before reply: when Pi wraps up a turn having modified code * without a diagnostics check since, nudge it to call lsp_checks. Disabled * by default; enable via ~/.pi/agent/pi-lsp.json ("autoCheckBeforeReply": * true) or the PI_LSP_AUTO_CHECK environment variable, which overrides the * file. */ export declare function autoCheckEnabled(envValue: string): boolean; /** * Read autoCheckBeforeReply from the user-level config file. Missing file, * missing field, or unreadable/broken file all mean "use the default" * (disabled) — a broken config must not silently enable the feature or * break event handlers. */ export declare function readAutoCheckConfig(agentDir?: string): boolean; /** * Combined setting: the PI_LSP_AUTO_CHECK environment variable (explicit * values only) overrides the config file; otherwise the config file decides; * otherwise disabled. */ export declare function resolveAutoCheckEnabled(options?: { agentDir?: string; envValue?: string; }): boolean; export declare const EDIT_TOOL_NAMES: ReadonlySet; export declare const CHECK_TOOL_NAMES: ReadonlySet; /** Stop nudging after this many consecutive un-heeded reminders. */ export declare const MAX_CONSECUTIVE_AUTO_CHECKS = 3; export declare const AUTO_CHECK_CUSTOM_TYPE = "lsp-auto-check"; export declare const MAX_LISTED_FILES = 5; /** * Best-effort extraction of the file paths a tool call is about to modify, * from the tool's input. For renames both the old and the new path are * returned (the new path also needs a check). Returns [] when nothing * recognizable is present. */ export declare function editedPathsFromInput(toolName: string, input: unknown): string[]; /** * Normalized comparison key for a path: absolute, forward slashes, and * (on Windows) case-folded. Relative inputs resolve against cwd. */ export declare function normalizePathKey(filePath: string, cwd: string): string; interface ToolCallShape { toolCallId: string; toolName: string; input?: unknown; } interface ToolExecutionEndShape { toolCallId: string; toolName: string; isError: boolean; } /** * Per-session state for the edit-follow-up check. Edits arm on tool_call * (where input is available), commit on successful tool_execution_end, and * are settled by a successful check tool or consumed by a wrap-up-turn * reminder. */ export declare class AutoCheckTracker { /** toolCallId -> edit paths, awaiting the tool's execution outcome. */ private armedEdits; /** toolCallId -> check scope snapshot, awaiting the tool's outcome. */ private armedChecks; /** Normalized key -> display path, changed since the last settling check. */ private pending; /** Reminders issued since the last settling check or the last user input. */ private consecutive; /** * File extensions the current check routes can actually examine (LSP * adapters + CLI runners). When set, files outside the set are not * tracked — editing a README must not trigger a code check that can * never say anything about it. Undefined means "track everything". */ private supportedExtensions?; setSupportedExtensions(extensions: ReadonlySet): void; onToolCall(event: ToolCallShape, cwd: string): void; onToolExecutionEnd(event: ToolExecutionEndShape, cwd: string): void; private isTrackable; /** * Settle only what the check actually covered: the intersection of its * call-time snapshot and (when given) its requested paths. The reminder * streak resets too — a successful check means the agent is listening. */ private settleCheck; /** * A new user message starts a fresh tolerance window for reminders. * Pending edits stay due — they still have not been checked. */ onUserInput(): void; /** * Nudge on a completed wrap-up turn (no tool results — the assistant * answered without calling tools) that leaves un-checked edits behind. * Returns the turn_end handler result, or undefined to stay silent. */ onTurnEnd(event: TurnEndEvent): TurnEndEventResult | undefined; /** Drop all state (session start/shutdown). */ reset(): void; } export {}; //# sourceMappingURL=auto-check.d.ts.map