import type { AgentMessageStream, AgentReplyPart, AgentResponseMetadata, AgentStreamEvent } from "./index.js"; /** Shared producer and wire bound for additive rich reply parts in one run. */ export declare const MAX_AGENT_REPLY_PARTS = 20; /** * Newline-delimited JSON frames that carry one AgentMessageStream callback each * across a process boundary. Channel-neutral by design: any transport that can * stream lines (chunked HTTP, unix socket, …) can replay a turn's callbacks on * the far side with full fidelity — including every AgentStreamEvent variant. * * Forward compatibility is deliberate in BOTH directions: unknown frame kinds * and unknown event types parse successfully (the payload is preserved as-is) * so a newer agent can talk to an older client and vice versa. Consumers * dispatch by `kind`/`event.type` and ignore what they do not understand. */ export type AgentStreamWireFrame = { readonly kind: "status"; readonly text: string; } | { readonly kind: "append"; readonly delta: string; } | { readonly kind: "replace"; readonly text: string; } | { readonly kind: "event"; readonly event: AgentStreamEvent; } | { readonly kind: "finish"; readonly finalText?: string; readonly metadata?: AgentResponseMetadata; readonly parts?: readonly AgentReplyPart[]; } | { readonly kind: "error"; readonly message: string; readonly code?: string; readonly cancelled?: boolean; }; export declare function serializeAgentStreamFrame(frame: AgentStreamWireFrame): string; /** * Parse one NDJSON line into a wire frame. Throws CodedError("invalid_frame") * only on lines that cannot possibly be a frame (bad JSON, no string `kind`, * missing the fields the known kind requires). Unknown kinds pass through so * version-skewed peers keep talking. */ export declare function parseAgentStreamFrame(line: string): AgentStreamWireFrame; /** * Client-side dispatcher: replays parsed frames onto a local AgentMessageStream. * "finish"/"error" frames are terminal transport concerns (return value / * thrown error) and are NOT dispatched here — callers handle them in their * read loop. Unknown frame kinds are ignored. */ export declare function frameFeedingMessageStream(stream: AgentMessageStream): (frame: AgentStreamWireFrame) => Promise; //# sourceMappingURL=stream-wire.d.ts.map