Repository navigation
@tanstack/ai-persistence@0.9.0
·
60 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Minor Changes
- #1715
fac0555- New hooks for hosts that runchat()for a long session.@tanstack/aiexportsrunAgentStream(runs adefineAgentagent outside a parent chat turn),createSubagentId,createSubagentSink,CapabilityRegistry, and theSubagentsBagandSubagentSinktypes. Pass the sink to keep interrupt objects and token usage. The finished event hasinterruptIdsonly.MetadataStorehas optionalgetVersionedandsetIffor compare-and-set writes. The memory store of@tanstack/ai-persistencehas both, and the conformance testkit checks them.toolDefinition({ replay: 'safe' | 'never' })tells a host if it can run the tool again after a crash.- The tool context has an optional
detachfield. A host sets it when it can move the call to the background. A tool passes its work todetachand races the two promises. - A tool that throws the MCP input-required shape can set the interrupt
reason. The default is'mcp_input'. The interrupt id staysmcp_input_<toolCallId>.
Patch Changes
-
#1697
cef1911- A message store now keeps the mid-conversation change record of an assistant message when a client sends the same message again without it. WithuseChat, the prompt cache then holds across turns on models that get tool and prompt changes inside the conversation. -
#1698
1bfcee3- Keep a conversation valid when the next request goes to a different model.- Each assistant message records
metadata.tanstack.source({ provider, api, model }), andresponseIdand the resolvedmodelwhen the provider sends them. A failed or aborted answer getsstopReason: 'error'or'aborted'.RUN_FINISHEDhas a newresponseIdfield.TextAdapterhas new optionalproviderandapifields. - When the next request goes to a different source, the adapter removes signatures and redacted thinking, turns readable thinking into text, and rewrites tool call IDs to the shape the target API accepts. Each call stays paired with its result.
- Every request drops failed and aborted assistant batches and adds a
No result providedresult for an unanswered tool call. The saved history does not change. RUN_FINISHEDandRUN_ERRORmetadata now merge onto the assistant messages of that model call inStreamProcessor.- Anthropic: the new
allowEmptySignatureoption (defaultfalse) replays unsigned thinking from the same source, for gateways. The newprovideroption names a gateway. - Azure OpenAI reports the
azure-openai-responsesAPI. - Gemini, Mistral, and Bedrock Converse send same-source thinking back to the model, in block order.
withPersistencewrites the source and the stop reason onto streaming snapshot rows.- Adapter authors get
transformMessagesForReplay()andhashToolCallId()from@tanstack/ai/adapter-internals.
- Each assistant message records
-
Updated dependencies [
1bfcee3,412b0fe,a0150c2,b881627,fac0555,6774e80,5bd27f2,c20f7b0,cef1911,51f72fb,6f1e559,eb4eea0,cef1911,7532b2b,1bfcee3,78edeb2,44e3a0a,7532b2b,7a5c0d6,b881627]:- @tanstack/ai@0.69.0
- @tanstack/ai-utils@0.4.2