Patch Changes
-
#4120
372d4f0- feat: simplifyMessagePrimitive.GroupedPartsAPI and addgroupPartByTypehelper. (@Yonom)- New
groupPartByType({ ... })helper builds agroupByfrom apart.type → group-key pathlookup. The map keys are typed againstPartState["type"](autocomplete + typo rejection), missing keys leave the part ungrouped, and the returned function carries an internal memo fingerprint so the tree survives unrelated re-renders even when reconstructed inline. - Special map key
"mcp-app"matches tool-call parts that point at an assistant-ui MCP app resource (ui://...). It takes precedence over the"tool-call"entry for those parts, so MCP apps can be routed separately (e.g. rendered outside a chain-of-thought wrapper). groupBysignature simplified from(part, index, parts) => string | string[] | null | undefinedto(part) => readonly \group-${string}`[] | null. The 2nd/3rd args were unused in practice. Arrays are required (no bare-string shorthand);nullis accepted as an alias for[]` to soften the migration.- Internal memoization now uses the helper's memo fingerprint when present, otherwise rebuilds the tree per render (O(n), cheap). The previous "pass a stable reference" advice is dropped — inline
groupByis fine. - Docs and examples updated to lead with
groupPartByType. ThegetMcpAppFromToolPartbranch inpackages/uiswitches to"mcp-app": []via the helper.
- New
-
#4107
32ae846- feat: surface AI SDK v6 tool approvals as a first-classrespondToApprovalprop on tool components. tool-call parts in theapproval-requestedstate now carrypart.approval = { id, isAutomatic? }; tool components callrespondToApproval({ approved, reason? })to ack the gate without threadingchatHelpersthrough application context. also fixes a transientrequires-actionflicker for theapproval-respondedstate and tightens the external-message converter so interrupt vs pending tool calls are distinguished by an actualinterrupt/approvalfield rather than byresult === undefined. (@okisdev) -
Updated dependencies [
d4f1db4]:- assistant-stream@0.3.17