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
RunDriverOptions
Defined in: packages/ai/src/stream-to-response.ts:1166
Everything the resume helpers need to take a run over as a side effect of serving its log.
claim and pipe are injected, not imported. The two mechanisms a takeover needs (withRunClaim and pipeToRunLog) live in @tanstack/ai-sandbox, and @tanstack/ai must not depend on that package — that layering inversion is exactly what moving LockStore into core was meant to prevent, and it would make core depend on the sandbox package to serve a plain chat run. Injecting them keeps only the shape of a takeover in core (parse the run id, read the record, skip if terminal, claim, drive) and lets a background-worker-driven run supply its own pair. @tanstack/ai-sandbox's sandboxRunDriver fills both in.
Properties#
claim#
claim: <T>(input, fn) => Promise<T>;Defined in: packages/ai/src/stream-to-response.ts:1178
Run fn under exclusive ownership of the run, or reject if refused.
Type Parameters#
T#
T
Parameters#
input#
locks#
LockStore
runId#
string
runs#
fn#
(claim) => Promise<T>
Returns#
Promise<T>
drive#
drive: (input) => AsyncIterable<AGUIEvent>;Defined in: packages/ai/src/stream-to-response.ts:1172
Produce the run's remaining events. Called only once the claim is held.
Parameters#
input#
runId#
string
signal#
AbortSignal
threadId#
string
Returns#
AsyncIterable<AGUIEvent>
locks#
locks: LockStore;Defined in: packages/ai/src/stream-to-response.ts:1170
logger?#
optional logger?: InternalLogger;Defined in: packages/ai/src/stream-to-response.ts:1193
pipe#
pipe: (stream, input) => Promise<unknown>;Defined in: packages/ai/src/stream-to-response.ts:1187
Persist the driven stream to the run's producer-side durability log.
Parameters#
stream#
AsyncIterable<AGUIEvent>
input#
runId#
string
signal#
AbortSignal
threadId#
string
Returns#
Promise<unknown>
request#
request: Request;Defined in: packages/ai/src/stream-to-response.ts:1168
The attach request; its run id is read with resolveResumeRunId.
runs#
runs: RunStore;Defined in: packages/ai/src/stream-to-response.ts:1169
waitUntil?#
optional waitUntil?: (promise) => void;Defined in: packages/ai/src/stream-to-response.ts:1192
Platform keep-alive (e.g. ctx.waitUntil) for the background drive.
Parameters#
promise#
Promise<unknown>
Returns#
void