Releases: TanStack/ai
Release list
@tanstack/solid-ai-devtools@0.2.66
Patch Changes
- Updated dependencies []:
- @tanstack/ai-devtools-core@0.4.23
@tanstack/react-ai-devtools@0.2.66
Patch Changes
- Updated dependencies []:
- @tanstack/ai-devtools-core@0.4.23
@tanstack/preact-ai-devtools@0.1.66
Patch Changes
- Updated dependencies []:
- @tanstack/ai-devtools-core@0.4.23
@tanstack/openai-base@0.9.8
@tanstack/ai@0.41.0
Minor Changes
-
#918
f830d9e- Gate the tool-call part'sapprovalfield on the tool'sneedsApprovalflag.
Previouslyapproval?was declared on every typed tool-call part regardless of
whether the tool could ever request approval. Now the flag is captured as a
literal type (toolDefinition({ needsApproval: true })→true) and threaded
throughClientTool/ToolDefinitionInstance/ToolDefinition, and
ToolCallPartForToolonly includesapprovalfor tools defined with
needsApproval: true:const { messages } = useChat({ tools: [getGuitars, addToCart] }) // addToCart: needsApproval: true for (const part of message.parts) { if (part.type !== 'tool-call') continue if (part.name === 'addToCart') part.approval?.id // ✅ typed if (part.name === 'getGuitars') part.approval // ✅ compile error — no such field }
⚠️ Breaking change (types only)This is the primary migration surface for this release. When you pass a typed
toolsarray touseChat/createChat/injectChat, readingpart.approval
on a mixed tool-call union without first narrowing bypart.nameno longer
compiles. Code that previously didpart.approval?.idin a generic handler over
all tool-call parts must be updated:// ❌ No longer compiles on a typed mixed union part.approval?.id // ✅ Narrow to an approval-required tool first if (part.name === 'deleteAccount') part.approval?.id // ✅ Or guard with `in` if ('approval' in part) part.approval?.id // ✅ Or type the handler against the base (untyped) ToolCallPart function handleApproval(part: ToolCallPart) { return part.approval?.id }
Untyped
useChat()(no inferredtoolsgeneric) and the baseToolCallPart
type are unaffected:approvalstays available on every tool-call part there.
Runtime behavior is unchanged — only TypeScript narrowing is stricter.Adds a
TNeedsApproval extends booleantype parameter (defaulting tofalse)
to the client tool types; existing explicit type arguments keep working via the
default. Literal capture requirestoolDefinition({ needsApproval: true })at
the call site — a dynamicneedsApproval: booleanvariable will not gate the
type. -
#918
f830d9e- Populate the parsedinputon tool-call message parts.ToolCallPartalready
declared a typedinput?field, but it was never written at runtime — only the
rawargumentsstring (andoutput) were set, sopart.inputwas always
undefinedand consumers had to fall back topart.input ?? JSON.parse(part.arguments).inputis now set from the parsed arguments once they are complete
(state: 'input-complete'and later, includingapproval-requested), in the
streaming processor, theTOOL_CALL_END-with-parsed-input path, and when
hydrating history viamodelMessagesToUIMessages. While arguments are still
streaming,inputstaysundefinedand the rawargumentsstring remains the
live source. A tool call that terminates in an error state may also keepinput
unset.argumentsis unchanged, always present, and not deprecated.With typed tools (
useChat({ tools })),part.inputis fully typed per tool
via thepart.namediscriminant — matchingpart.output.
Patch Changes
-
#924
5fcaf90- fix: resolve directory-barrel imports in published.d.tsfiles. Bare imports ofutils/tools/middlewarebarrels were emitted as../utils.js(etc.), which do not resolve under bundler/node16/nodenext (no/indexfallback for explicit.js). With consumerskipLibCheck: truethose symbols silently becameany. Imports now target concrete modules (e.g.utils/client,middleware/types) or explicit/indexpaths so public types resolve correctly. -
#922
e0bbbdd- fix: resolve dangling relative imports in published declaration filesSwitch directory-barrel imports (
../utils,../tools,../middleware) to
concrete module paths so emitted.d.tsspecifiers resolve under
bundler/node16/nodenextresolution. Adds atest:dtsscanner guardrail.Fixes #920
-
#886
de5fbb5- FixgenerateVideo/getVideoJobStatusrejecting video adapters that declare a narrowed per-model duration union (e.g. Gemini's4 | 6 | 8for Veo or10for Omni Flash) at the type level. The activity'sTAdapter extends VideoAdapter<string, any, any, any>constraints left the input-modality and duration generics at their defaults, soduration?: numberfailed contravariance against the adapter's literal union. All video-activity constraints and helper conditionals now span all sixVideoAdaptergenerics.
@tanstack/ai-vue@0.14.4
Patch Changes
- #918
f830d9e- Add theconstmodifier to theTToolstype parameter ofuseChat
(createChatin Svelte,injectChatin Angular) so a plain inlinetoolsarray
now yields full type-safe message chunks. Previously the array widened to
Array<Union>and lost the literal toolnames that drive the
discriminatedtool-callpart union, so callers had to wrap their tools in
clientTools(...)(or addas const) to get narrowing. That wrapper is now
optional —tools: [toolA, toolB]narrowspart.name,part.input, and
part.outputon its own.clientTools(...)still works and remains useful
for defining a shared tuple outside the hook call. - Updated dependencies [
5fcaf90,2665085,e0bbbdd,f830d9e,f830d9e,de5fbb5]:- @tanstack/ai@0.41.0
- @tanstack/ai-client@0.21.0
@tanstack/ai-vue-ui@0.2.32
Patch Changes
- Updated dependencies [
f830d9e]:- @tanstack/ai-vue@0.14.4
@tanstack/ai-svelte@0.14.4
Patch Changes
- #918
f830d9e- Add theconstmodifier to theTToolstype parameter ofuseChat
(createChatin Svelte,injectChatin Angular) so a plain inlinetoolsarray
now yields full type-safe message chunks. Previously the array widened to
Array<Union>and lost the literal toolnames that drive the
discriminatedtool-callpart union, so callers had to wrap their tools in
clientTools(...)(or addas const) to get narrowing. That wrapper is now
optional —tools: [toolA, toolB]narrowspart.name,part.input, and
part.outputon its own.clientTools(...)still works and remains useful
for defining a shared tuple outside the hook call. - Updated dependencies [
5fcaf90,2665085,e0bbbdd,f830d9e,f830d9e,de5fbb5]:- @tanstack/ai@0.41.0
- @tanstack/ai-client@0.21.0
@tanstack/ai-solid@0.14.4
Patch Changes
- #918
f830d9e- Add theconstmodifier to theTToolstype parameter ofuseChat
(createChatin Svelte,injectChatin Angular) so a plain inlinetoolsarray
now yields full type-safe message chunks. Previously the array widened to
Array<Union>and lost the literal toolnames that drive the
discriminatedtool-callpart union, so callers had to wrap their tools in
clientTools(...)(or addas const) to get narrowing. That wrapper is now
optional —tools: [toolA, toolB]narrowspart.name,part.input, and
part.outputon its own.clientTools(...)still works and remains useful
for defining a shared tuple outside the hook call. - Updated dependencies [
5fcaf90,2665085,e0bbbdd,f830d9e,f830d9e,de5fbb5]:- @tanstack/ai@0.41.0
- @tanstack/ai-client@0.21.0