Repository navigation
fix: carry AG-UI 1.0 tool result content parts (PNI-427) - #7079
Conversation
Pins every @ag-ui/* preview to the head of ag-ui-protocol/ag-ui#2727, which lets a tool result carry content parts (ToolMessage.content and TOOL_CALL_RESULT.content become string | ContentPart[]) and renames the parts, keeping the old names as aliases. Lockfile URLs and SHA-512 checksums rewritten from the published tarballs and verified with a frozen install, as for the previous bump: a fresh non-frozen install still trips blockExoticSubdeps on the URL pins. PNI-427
A tool result is now a string or a list of content parts. Where CopilotKit hands a result to a renderer or a provider that holds a string — the react-core, vue and angular tool-call renderers, react-native's tool result coercion, the OpenAI Chat Completions demo agent — the content is narrowed with contentToText() from @ag-ui/core: text parts concatenated, media left on the message, no placeholder invented. react-native treats a parts array as legitimate content rather than a malformed message to warn about. Where the result reaches the model, the runtime's AI SDK path maps parts faithfully instead of flattening: text as text, inline media as media with its bytes and media type, a URL-referenced part as the URL it carries. PNI-427
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
pkg-pr-new published commit 1084c9b8 from four workflow runs (two before the branch was renamed to mme/, two after), and each run re-uploads the tarballs for the same URL. Ten of the eleven builds were byte-identical across runs; @ag-ui/langgraph was not, so the checksum recorded from an earlier run failed CI's frozen install with ERR_PNPM_TARBALL_INTEGRITY. Recomputed against the tarballs that are live now that every run has finished, and verified with a frozen install. PNI-427
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
|
Size Change: +933 B (+0.06%) Total Size: 1.65 MB 📦 View Changed
ℹ️ View Unchanged
|
Three findings from a Codex review of the content-parts change. - runtime: a text-only parts result is one text output again, and adjacent text parts merge inside a content list, so a provider sees one response per tool call — the Google adapter emits one functionResponse per text entry, and two text parts had produced two. Inline media still rides as media; a URL-referenced part rides as its URL for now. - runtime (TanStack): a parts-shaped tool result becomes its text instead of null, which dropped the result. - react-native: only real content parts (a text part with a string, a media part with a typed source) take the parts path; any other typed array keeps the serialise-and-warn fallback it had. PNI-427
The head of ag-ui-protocol/ag-ui#2727 after its review fixes: the legacy bridge flattens replayed tool results the way it flattens live ones, and the .NET and Python changes ride along. Lockfile URLs and checksums rewritten from the published tarballs once every publish run for the commit had finished, and verified with a frozen install. PNI-427
|
Review pass (Codex, read-only, scoped to this PR's commits) found four things; three are fixed in 41b4a61 and the pins move to the fixed ag-ui head in 7e86bdc.
Pins: |
Second Codex pass on the content-parts change. - runtime: all of a tool result's text is collected into a single AI SDK text entry, placed ahead of the media, so a provider sees one response per tool call whatever the order of the parts — the Google adapter emits one functionResponse per text entry. URL references contribute the URL on a line of its own, so two references no longer run into one string. A media-only result is media alone; a placeholder text would be content the tool never returned. - react-native: a media part whose inline source lacks its mime type is not a part, and keeps the serialise-and-warn path. PNI-427
|
Second Codex pass. TanStack confirmed fixed; two partials and one new point, closed in a5000da, with the pins moving to ag-ui
Whole-workspace |
The head of ag-ui-protocol/ag-ui#2727 after its second review round: LangGraph, Claude Managed Agents and A2UI middleware previews now carry parts-shaped tool results correctly. Lockfile URLs and checksums rewritten from the published tarballs once every publish run for the commit had finished, and verified with a frozen install. PNI-427
Brings the branch up to origin/main (431 commits). Four files conflicted: the root and runtime manifests (our @Ag-ui preview URL pins vs main's registry versions - the URL pins win), the useRenderToolCall test (union of #7079's parts-shaped-result cases and main's "renders nothing" reporting suite), and the lockfile (taken from main, then re-resolved so the 11 previews re-enter at 58a2d3fa with verified sha512 checksums). packages/mcp-apps-renderer is new on main and dev-depends on @ag-ui/client, so its devDependency is pinned to the same preview URL as the other 22 manifests. The root pnpm.overrides already forced that resolution; the manifest pin only makes it explicit and leaves the lockfile unchanged.
Stacked on #6944. Validates CopilotKit against ag-ui-protocol/ag-ui#2727 (PNI-427), which lets a tool result carry content parts:
ToolMessage.contentandTOOL_CALL_RESULT.contentbecomestring | ContentPart[], and the parts are renamed (InputContent→ContentPart,TextInputContent→TextPart, …) with the old names kept as aliases.What changes
Pins. Every
@ag-ui/*preview moves from390d432ato1084c9b8(the head of ag-ui#2727), in the root overrides, every package and example manifest, and the lockfile. The lockfile was updated the way the previous bump was: URLs and SHA-512 checksums rewritten from the published tarballs, thenpnpm install --frozen-lockfile— a fresh non-frozen install still tripsblockExoticSubdepson the URL pins, as #6944 already notes.Tool results reaching a
result: stringcontract. Everywhere CopilotKit hands a tool result to a renderer or a provider that holds a string, the content is narrowed withcontentToText()from@ag-ui/core— the text parts concatenated, media left on the message, no placeholder invented:react-coreuseRenderToolCall(theresultprop of tool-call renderers)vuecopilotChatToolCallItemRenderangularrender-tool-callsreact-nativeCopilotChat'stoolResultContent, which already coerced unknown content; a parts array is now legitimate 1.0 content and is rendered as text without the "non-string content" warningdemo-agentsOpenAI Chat Completions adapter (tool messages take text there)Tool results reaching the model. The runtime's AI SDK path maps parts faithfully instead of flattening: text parts become AI SDK text, inline media becomes
mediawith its bytes and media type, and a URL-referenced part is passed as the URL it carries. A string result is unchanged.Tests.
useRenderToolCallgains tests for a parts-shaped and a string result reaching the renderer; the runtime'sfinalize-eventstest narrows the result it parses.Not changed
packages/core'snormalizeToolResultContentalready handled arrays of text parts; the runtime keeps stringifying handler results before minting tool messages. Nothing in CopilotKit produces media parts yet — this PR makes it consume them without loss.Checks run locally
pnpm install --frozen-lockfile, whole-workspacecheck-types, and the test suites of the touched packages (react-core,react-native,runtime,angular,vue,core,demo-agents), and the lefthook pre-commit run of tests, publint and attw over the 26 affected packages.