Class References
Function References
- text
- textOptions
- combineStrategies
- convertMessagesToModelMessages
- convertZodToJsonSchema
- createReplayStream
- embedding
- generateMessageId
- maxIterations
- messages
- modelMessageToUIMessage
- modelMessagesToUIMessages
- normalizeToUIMessage
- parsePartialJSON
- summarize
- toServerSentEventsStream
- toServerSentEventsResponse
- toolDefinition
- uiMessageToModelMessages
- realtimeToken
- untilFinishReason
Interface References
- AIAdapter
- AIAdapterConfig
- AgentLoopState
- AudioPart
- AudioVisualization
- BaseStreamChunk
- TextCompletionChunk
- TextOptions
- ChunkRecording
- ChunkStrategy
- ClientTool
- ContentPartSource
- ContentStreamChunk
- DefaultMessageMetadataByModality
- DocumentPart
- DoneStreamChunk
- EmbeddingOptions
- EmbeddingResult
- ErrorStreamChunk
- ImagePart
- InternalToolCallState
- JSONParser
- ModelMessage
- ProcessorResult
- ProcessorState
- RealtimeAdapter
- RealtimeClientOptions
- RealtimeConnection
- RealtimeMessage
- RealtimeSessionConfig
- RealtimeToken
- RealtimeTokenAdapter
- RealtimeTokenOptions
- ResponseFormat
- ServerTool
- StreamProcessorEvents
- StreamProcessorHandlers
- StreamProcessorOptions
- SummarizationOptions
- SummarizationResult
- TextPart
- ThinkingPart
- ThinkingStreamChunk
- Tool
- ToolCall
- ToolCallPart
- ToolCallStreamChunk
- ToolConfig
- ToolDefinition
- ToolDefinitionConfig
- ToolDefinitionInstance
- ToolInputAvailableStreamChunk
- ToolResultPart
- ToolResultStreamChunk
- UIMessage
- VideoPart
Type Alias References
- AgentLoopStrategy
- AnyClientTool
- TextStreamOptionsForModel
- TextStreamOptionsUnion
- ConstrainedContent
- ConstrainedModelMessage
- ContentPart
- ContentPartForModalities
- ExtractModalitiesForModel
- ExtractModelsFromAdapter
- InferToolInput
- InferToolName
- InferToolOutput
- MessagePart
- RealtimeEvent
- RealtimeMessagePart
- RealtimeMode
- RealtimeStatus
- ModalitiesArrayToUnion
- Modality
- StreamChunk
- ToolCallState
- ToolResultState
Variable References
replayRunStream
function replayRunStream<TOffset>(
durability,
offset?,
signal?): AsyncGenerator<AGUIEvent>;Defined in: packages/ai/src/stream-durability.ts:588
Replay a run's delivery-durability log as a bare stream of chunks, for callers that serve a joinRun handler without an HTTP Response — e.g. a TanStack Start server function returning an async iterable:
async function* joinImageRun({ data: runId }: { data: string }) {
yield* replayRunStream(memoryStream({ runId }))
}
// Serve it from a server function whose handler is the generator above
// (`createServerFn({ method: 'GET' }).inputValidator(...)`).NOTE: the example deliberately declares the generator separately instead of inlining it into the server-fn builder chain. TanStack Start's server-fn Vite plugin decides whether a module needs compiling by regex-matching the SOURCE for a dotted handler( call, and JSDoc survives into dist — an inlined chain here would make every Start app treat this package as a server-fn module and try to resolve its framework's @tanstack/*-start package, failing the build wherever that framework is not the one installed.
Reads from offset (default '-1' — from the start) and tails until the producer closes the log or signal aborts, exactly like the HTTP resumeServerSentEventsResponse path.
Type Parameters#
TOffset#
TOffset extends string
Parameters#
durability#
StreamDurability<TOffset>
offset?#
TOffset
signal?#
AbortSignal
Returns#
AsyncGenerator<AGUIEvent>