import type { ToolArgumentValidationTelemetryEvent } from "@caupulican/pi-ai"; import type { ToolFailurePhase } from "@caupulican/pi-ai/tool-repair-registry"; export declare const TOOL_RECOVERY_EVENT_LOG_FILE = "tool-recovery-events.jsonl"; export declare const TOOL_ARGUMENT_VALIDATION_LOG_KIND = "tool_argument_validation"; export declare const TOOL_EXECUTION_FAILURE_LOG_KIND = "tool_execution_failure"; export interface ToolArgumentValidationLogRecord extends ToolArgumentValidationTelemetryEvent { kind: typeof TOOL_ARGUMENT_VALIDATION_LOG_KIND; version: 1; recordId: string; ts: string; sessionId: string; } export interface ToolExecutionFailureLogRecord { kind: typeof TOOL_EXECUTION_FAILURE_LOG_KIND; version: 1; recordId: string; ts: string; sessionId: string; provider?: string; model?: string; tool: string; state: "failed" | "rejected"; phase: ToolFailurePhase; failureCode: string; diagnostic?: string; nextAction: string; } export type ToolRecoveryLogRecord = ToolArgumentValidationLogRecord | ToolExecutionFailureLogRecord; export interface ToolRecoveryLogWorkerRecord { eventLogPath: string; failureCorpusPath: string; record: ToolRecoveryLogRecord; } export declare function createToolArgumentValidationLogRecord(args: { event: ToolArgumentValidationTelemetryEvent; recordId: string; sessionId: string; ts: string; }): ToolArgumentValidationLogRecord; export declare function createToolExecutionFailureLogRecord(args: { provider?: string; model?: string; tool: string; state: "failed" | "rejected"; phase: ToolFailurePhase; failureCode: string; diagnostic?: string; nextAction: string; recordId: string; sessionId: string; ts: string; }): ToolExecutionFailureLogRecord; export declare function isToolArgumentValidationLogRecord(value: unknown): value is ToolArgumentValidationLogRecord; export declare function isToolExecutionFailureLogRecord(value: unknown): value is ToolExecutionFailureLogRecord; /** * Append + rotate under a single exclusive lock on `eventLogPath`. Without the lock, a concurrent * writer (e.g. another session's tool-recovery worker) could append between this call's read and its * rotated rewrite, and that append would be silently discarded when the rewrite lands. The shared * bounded JSONL sink also uses atomic tmp+rename rotation so readers never observe torn log files. */ export declare function writeToolRecoveryLogRecord(entry: ToolRecoveryLogWorkerRecord): void; //# sourceMappingURL=tool-recovery-log-records.d.ts.map