import type { InferSchema } from "../../extensions/schema/index.js"; import { type ChatStreamEvent } from "../../chat/protocol.js"; import type { AgentRunEventTimingOptions } from "../../runtime/model-call-context.js"; /** Shared conversation run event types value. */ export declare const conversationRunEventTypes: { readonly custom: "CUSTOM"; readonly textMessageStart: "TEXT_MESSAGE_START"; readonly textMessageContent: "TEXT_MESSAGE_CONTENT"; readonly textMessageEnd: "TEXT_MESSAGE_END"; readonly reasoningMessageStart: "REASONING_MESSAGE_START"; readonly reasoningMessageContent: "REASONING_MESSAGE_CONTENT"; readonly reasoningMessageEnd: "REASONING_MESSAGE_END"; readonly stepStarted: "STEP_STARTED"; readonly stepFinished: "STEP_FINISHED"; readonly toolCallStart: "TOOL_CALL_START"; readonly toolCallArgs: "TOOL_CALL_ARGS"; readonly toolCallEnd: "TOOL_CALL_END"; readonly toolCallResult: "TOOL_CALL_RESULT"; }; export declare const getConversationRunEventSchema: () => import("../../internal-agents/schema.js").Schema<{ type: string; } & {} & Record>; /** Schema for conversation run event. * @deprecated Use getConversationRunEventSchema() */ export declare const ConversationRunEventSchema: import("../../internal-agents/schema.js").Schema<{ type: string; } & {} & Record>; /** Event emitted for conversation run. */ export type ConversationRunEvent = InferSchema> & Record; /** Serialize tool output while preserving strings that would otherwise decode as JSON. */ export declare function serializeConversationToolResultContent(value: unknown): { content: string; contentEncoding?: "text"; }; /** Implement conversation run event encoder. */ /** Options accepted by the conversation run event encoder. */ export interface ConversationRunEventEncoderOptions { /** * Monotonic time source, in milliseconds. Supply one to stamp every encoded * record with `elapsedMs`, measured from this encoder's creation. * * A persisted event otherwise carries only the time it was stored, which * tracks the writer rather than the run, so durations built from it do not * describe what the agent did. This stamp is taken at the point the event is * produced, which is the only place that observes it. Omit the clock and * nothing is stamped. */ nowMs?: () => number; epochMs?: () => number; startedMs?: number; } export declare class ConversationRunEventEncoder { private readonly streamedToolInputs; private readonly toolInputs; private activeMessageId; private activeTextContentId; private textContentIndex; private activeStepName; private stepCount; private readonly nowMs?; private readonly startedMs?; private readonly epochMs?; constructor(options?: ConversationRunEventEncoderOptions); /** Return the run timing anchor owned by this encoder, when it has one. */ getTimingAnchor(): AgentRunEventTimingOptions | undefined; private nextStepName; private finishStepName; private getToolResultMessageId; private getTextMessagePayload; private releaseToolCallState; encode(chunk: ChatStreamEvent): ConversationRunEvent[]; private stampElapsed; /** Stamp externally-created checkpoints against this encoder's run anchor. */ stamp(events: ConversationRunEvent[]): ConversationRunEvent[]; private encodeChunk; } /** Encode conversation run events helper. */ export declare function encodeConversationRunEvents(events: ChatStreamEvent[], encoder?: ConversationRunEventEncoder): ConversationRunEvent[]; /** Normalizes encoded conversation run events. */ export declare function normalizeEncodedConversationRunEvents(events: ChatStreamEvent[], encoder?: ConversationRunEventEncoder): ConversationRunEvent[]; //# sourceMappingURL=run-events.d.ts.map