import { type ArtifactReceipt } from "../../artifacts/detect.js"; import { type ToolCallJournal } from "../tool-call-journal.js"; import type { AgentChatEvent } from "../types.js"; export interface PriorTurnToolCallSummary { name: string; input: unknown; } export type PriorTurnToolCallSequenceEntry = ({ event: "start"; } & PriorTurnToolCallSummary) | { event: "done"; name: string; input: unknown; result: string; isError: boolean; completedSideEffect?: boolean; replayed?: true; matchedStart: boolean; }; export interface PriorTurnToolResultSummary { name: string; input?: unknown; content: string; isError: boolean; artifacts?: ArtifactReceipt[]; } export type PriorTurnToolCallJournalRead = { status: "read"; events: AgentChatEvent[]; toolCallJournal: ToolCallJournal | null; priorToolCalls: PriorTurnToolCallSummary[]; priorToolResults: PriorTurnToolResultSummary[]; priorToolCallSequence: PriorTurnToolCallSequenceEntry[]; } | { status: "unreadable"; error: string; }; export interface PriorTurnToolCallJournalOptions { /** Recover outcomes committed before a reaper successor could persist tool_done. */ recoverCompletedExecutionSteps?: boolean; } export declare function overlayCompletedExecutionStepOutcomes(threadId: string, turnId: string, events: AgentChatEvent[]): Promise; export declare function loadPriorTurnToolCallJournal(threadId: string | undefined, turnId?: string, options?: PriorTurnToolCallJournalOptions): Promise; export declare const JOURNALED_TOOL_REPLAY_PREFIX = "(Already completed in an earlier interrupted attempt - not re-run to avoid a duplicate side effect.)\n\n"; export declare const RECOVERED_TOOL_REPLAY_PREFIX = "(Recovered from prior interrupted chunk \u2014 action already completed.)\n\n"; export declare function loadedSkillPagesContext(results: readonly PriorTurnToolResultSummary[], threadPages: ReadonlyMap, currentSkillBodies: ReadonlyMap, isInHistory?: (slug: string, page: string) => boolean): string; export declare function seedRepeatedToolCallCountsFromJournal(calls: readonly PriorTurnToolCallSequenceEntry[], keyForCall: (name: string, input: unknown) => string, isResurfacedReadOnlyDuplicate: (name: string, result: string) => boolean): Map; export declare function seedRepeatedToolErrorCountsFromJournal(calls: readonly PriorTurnToolCallSequenceEntry[], keyForCall: (name: string, input: unknown) => string, normalizeError: (error: string) => string): { sameArguments: Map; sameTool: Map; };