import type { JsonObject, JsonValue } from "@bastani/pi-ai"; import type { AgentSessionEvent } from "./agent-session-types.js"; /** Assistant prose. */ export interface TranscriptTextPart { type: "text"; text: string; } /** Visible assistant reasoning. Redacted thinking blocks are never reported. */ export interface TranscriptThinkingPart { type: "thinking"; thinking: string; } /** The latest result reported for a tool call. */ export interface TranscriptToolResult { /** Text content of the result, joined with newlines. Set when the tool reports `"content"`. */ content?: string; /** * The result's `details`, or `null` when it had none. Set when the tool reports `"details"`. * A failed call without details also carries its error text in `content`. */ details?: JsonValue; isError: boolean; /** True while the result comes from `tool_execution_update` and the tool is still running. */ isPartial: boolean; } /** A tool call from assistant content, joined by id with its execution result. */ export interface TranscriptToolCallPart { type: "toolCall"; id: string; name: string; arguments: JsonObject; /** Absent until the tool reports an update or finishes. */ result?: TranscriptToolResult; } export type TranscriptPart = TranscriptTextPart | TranscriptThinkingPart | TranscriptToolCallPart; /** Which field of a tool result to report: its text content (the default) or its `details`. */ export type TranscriptToolResultFormat = "content" | "details"; export interface TranscriptOptions { /** Choose per tool whether `result.content` or `result.details` is reported. Defaults to `"content"`. */ toolResult?: (toolName: string) => TranscriptToolResultFormat; } export interface Transcript { /** Feed one session event. Events from nested tool calls (`parentToolCallId`) are ignored. */ apply(event: AgentSessionEvent): void; /** Ordered parts of every assistant message seen so far, including the one still streaming. */ parts(): TranscriptPart[]; } /** * Reduce session events into the assistant's output as plain JSON parts. * * ```ts * const transcript = createTranscript(); * session.subscribe((event) => transcript.apply(event)); * transcript.parts(); * ``` */ export declare function createTranscript(options?: TranscriptOptions): Transcript; //# sourceMappingURL=transcript.d.ts.map