import { type JsonValue, type ToolResultMessage } from "@earendil-works/pi-ai"; import type { PiIntegrationTestResult, TraceEvent } from "../scenario/types.js"; /** Minimal result fields accepted by the public assertion helpers. */ export type PiIntegrationTestInspection = Pick; /** Final `tool_execution_end` data selected from the ordered harness trace. */ export interface ToolExecutionTrace { /** Whether Pi finalized the execution as an error. */ readonly isError?: boolean; /** Real tool result recorded by Pi. */ readonly result?: unknown; /** Stable tool-call identifier. */ readonly toolCallId: string; /** Registered tool name, when present in the event. */ readonly toolName?: string; /** Additional event fields added by compatible Pi versions. */ readonly [key: string]: unknown; } /** Return tool names in the order Pi emitted `tool_call` events. */ export declare function getToolCallNames(result: PiIntegrationTestInspection): readonly string[]; /** Return the latest real tool-result message, optionally restricted to one call ID. */ export declare function getToolResultMessage(result: PiIntegrationTestInspection, toolCallId?: string): ToolResultMessage; /** Flatten text content from the latest matching real tool-result message. */ export declare function getToolResultText(result: PiIntegrationTestInspection, toolCallId?: string): string; /** * Return the final effective Pi system prompt captured when the agent started. * * Saved runs from older versions fall back to the first scripted provider request. */ export declare function getSystemPrompt(result: PiIntegrationTestInspection): string; /** Return the system prompt captured before the selected real provider request. */ export declare function getProviderSystemPrompt(result: PiIntegrationTestInspection, requestIndex?: number): string; /** Return every finalized tool execution in trace order. */ export declare function getToolExecutions(result: PiIntegrationTestInspection): readonly ToolExecutionTrace[]; /** Return one finalized tool execution or throw when Pi did not emit it. */ export declare function getToolExecution(result: PiIntegrationTestInspection, toolCallId: string): ToolExecutionTrace; /** Return the real result attached to one finalized tool execution. */ export declare function getToolExecutionResult(result: PiIntegrationTestInspection, toolCallId: string): unknown; /** Return `result.details` from a finalized execution when the result is an object. */ export declare function getToolExecutionDetails(execution: ToolExecutionTrace): unknown; /** Flatten text from the last message sent with a recorded provider request. */ export declare function getProviderRequestLastMessageText(request: TraceEvent): string;