import type{AgentStatus,ChatMessage,ChatMessageRole,MessagePart,ToolInvocation}from'./types.js';export type JsonPatchOperation={op:'add'|'replace';path:string;value:unknown;}|{op:'remove';path:string;};interface StreamEventBase{ /** Monotonic run/session generation. A newer generation atomically retires older events. */ generation:number; /** Strictly increasing cursor within `generation`; cursors at or below the applied cursor are replay. */ sequence:number; /** Optional transport correlation id. Idempotence is defined by generation and sequence. */ eventId?:string;}export type AgentStreamEvent=(StreamEventBase&{type:'reset';})|(StreamEventBase&{type:'run-start';runId:string;})|(StreamEventBase&{type:'run-status';runId?:string;status:AgentStatus;})|(StreamEventBase&{type:'messages-snapshot';messages:ChatMessage[];})|(StreamEventBase&{type:'message-start';message:ChatMessage;})|(StreamEventBase&{type:'message-part-upsert';messageId:string;role?:ChatMessageRole;part:MessagePart;})|(StreamEventBase&{type:'message-part-delta';messageId:string;role?:ChatMessageRole;partId:string;partType:'text'|'reasoning';delta:string;})|(StreamEventBase&{type:'message-complete';messageId:string;})|(StreamEventBase&{type:'tool-upsert';invocation:ToolInvocation;})|(StreamEventBase&{type:'state-snapshot';snapshot:unknown;})|(StreamEventBase&{type:'state-delta';patch:JsonPatchOperation[];})|(StreamEventBase&{type:'error';message:string;code?:string;});export interface AgentStreamLimits{maxMessages:number;maxPartsPerMessage:number;maxTools:number;maxDeltaCharacters:number;maxTextCharactersPerPart:number;maxIdentifierCharacters:number;maxStatusMessageCharacters:number;maxPatchOperations:number;maxSnapshotDepth:number;maxSnapshotNodes:number;maxSnapshotBytes:number;maxRetainedBytes:number;}export declare const DEFAULT_AGENT_STREAM_LIMITS:Readonly;export interface AgentStreamState{ /** Current run/session generation. */ generation:number; /** Greatest applied sequence in the current generation. */ cursor:number;limits:Readonly;runId?:string;status:AgentStatus;messages:ChatMessage[];tools:ToolInvocation[];sharedState:unknown;error?:{message:string;code?:string;};}export declare function createAgentStreamState(limits?:Partial):AgentStreamState; /** Strictly validates and owns an RFC 6902 add/replace/remove patch. */ export declare function parseJsonPatch(value:unknown,limits?:Partial):JsonPatchOperation[]|null;export declare function applySharedStatePatch(value:unknown,patch:readonly JsonPatchOperation[]):unknown; /** * Immutable provider-neutral reducer. Replay is bounded by a generation plus monotonic cursor, * not by a finite opaque-id cache: an event at or below the applied cursor is always ignored. */ export declare function reduceAgentStream(state:AgentStreamState,event:AgentStreamEvent):AgentStreamState;export declare function reduceAgentStreamEvents(state:AgentStreamState,events:readonly AgentStreamEvent[]):AgentStreamState;export{};