fix(ai-client): send the thinking text to devtools #2164
main fromfix/devtools-thinking-text·merged by AlemTuzlak View on GitHubDevtools shows the reasoning step id where it must show the thinking text. The onThinkingUpdate handler in ChatClient took 2 parameters, but StreamProcessor calls it with 3. This PR gives the handler the 3 parameters, so devtools gets the thinking text.
🎯 Changes#
ChatClienthandler:onThinkingUpdatenow takes(messageId, stepId, content), which matchesStreamProcessorEvents. It sendscontenttotext:chunk:thinking.- Test: the devtools test for
text:chunk:thinkingnow checks the content of the event, not only that the event exists. - Changeset: patch for
@tanstack/ai-client. - Docs: none. The devtools event payload is not documented, and the documented behavior does not change.
Root cause#
- Issue. In devtools, the thinking text of a message shows an id such as
reasoning-msg-1. - Cause.
StreamProcessorcallsonThinkingUpdate(messageId, stepId, content). The handler inchat-client.tswas(messageId, content) => ..., so itscontentparameter got the step id. - Fix. The handler takes the 3 parameters and uses the third one.
Possible alternatives#
None.
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested code changes locally with
pnpm run test:pr, or these tests do not apply to this pull request. - I fully understand the code in this pull request, including any code generated with AI assistance.
- Docs: I updated
docs/for this change, or this change is not user-facing. - Changeset: I added a changeset (
pnpm changeset), or this PR does not change a published package.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Testing#
Commands run#
vitest run tests/chat-client.test.tsinpackages/ai-client: 135 tests pass.@tanstack/aiwas built frommainfirst.tscandpnpm test:oxlintforpackages/ai-client: pass.- Not run locally:
pnpm test:pr, the E2E suite, and coverage. CI runs them.
Repro: the devtools test on main source and on this branch#
With packages/ai-client/src/chat-client.ts from main (1888233dd):
× should emit text:chunk:thinking events for thinking content
- "content": "Let me think...",
+ "content": "reasoning-msg-1",
Tests 1 failed | 134 skipped (135)
With this branch:
Tests 1 passed | 134 skipped (135)
Manual test#
- On
main, open a chat with devtools, and send a message to a model that streams thinking. - In devtools, look at the thinking of the message: it shows an id such as
reasoning-msg-1. - On this branch, do the same: devtools shows the thinking text.
How this PR makes testing easy#
The test should emit text:chunk:thinking events for thinking content in packages/ai-client/tests/chat-client.test.ts now checks the text.
Risk / rollback#
Low risk: the change is one handler signature in ChatClient. To roll back, revert this PR.
Summary by CodeRabbit#
- Bug Fixes
- AI Devtools now displays the thinking text in thinking updates instead of showing a reasoning-step identifier. The update content is now checked against the expected text, helping ensure the displayed content matches the generated response.
- 1
- 2
AlemTuzlak pushed9e47a1f
@tanstack/ai
npm i https://pkg.pr.new/@tanstack/ai@2164@tanstack/ai-acp
npm i https://pkg.pr.new/@tanstack/ai-acp@2164@tanstack/ai-angular
npm i https://pkg.pr.new/@tanstack/ai-angular@2164@tanstack/ai-anthropic
npm i https://pkg.pr.new/@tanstack/ai-anthropic@2164@tanstack/ai-bedrock
npm i https://pkg.pr.new/@tanstack/ai-bedrock@2164@tanstack/ai-byteplus
npm i https://pkg.pr.new/@tanstack/ai-byteplus@2164@tanstack/ai-claude-code
npm i https://pkg.pr.new/@tanstack/ai-claude-code@2164@tanstack/ai-client
npm i https://pkg.pr.new/@tanstack/ai-client@2164@tanstack/ai-cloudflare
npm i https://pkg.pr.new/@tanstack/ai-cloudflare@2164@tanstack/ai-code-mode
npm i https://pkg.pr.new/@tanstack/ai-code-mode@2164@tanstack/ai-code-mode-snippets
npm i https://pkg.pr.new/@tanstack/ai-code-mode-snippets@2164@tanstack/ai-codex
npm i https://pkg.pr.new/@tanstack/ai-codex@2164@tanstack/ai-cohere
npm i https://pkg.pr.new/@tanstack/ai-cohere@2164@tanstack/ai-compaction
npm i https://pkg.pr.new/@tanstack/ai-compaction@2164@tanstack/ai-computer-local
npm i https://pkg.pr.new/@tanstack/ai-computer-local@2164@tanstack/ai-computer-playwright
npm i https://pkg.pr.new/@tanstack/ai-computer-playwright@2164@tanstack/ai-computer-sandbox
npm i https://pkg.pr.new/@tanstack/ai-computer-sandbox@2164@tanstack/ai-computer-use
npm i https://pkg.pr.new/@tanstack/ai-computer-use@2164@tanstack/ai-devtools-core
npm i https://pkg.pr.new/@tanstack/ai-devtools-core@2164@tanstack/ai-durable-stream
npm i https://pkg.pr.new/@tanstack/ai-durable-stream@2164@tanstack/ai-effect
npm i https://pkg.pr.new/@tanstack/ai-effect@2164@tanstack/ai-elevenlabs
npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@2164@tanstack/ai-event-client
npm i https://pkg.pr.new/@tanstack/ai-event-client@2164@tanstack/ai-fal
npm i https://pkg.pr.new/@tanstack/ai-fal@2164@tanstack/ai-gemini
npm i https://pkg.pr.new/@tanstack/ai-gemini@2164@tanstack/ai-grok
npm i https://pkg.pr.new/@tanstack/ai-grok@2164@tanstack/ai-grok-build
npm i https://pkg.pr.new/@tanstack/ai-grok-build@2164@tanstack/ai-groq
npm i https://pkg.pr.new/@tanstack/ai-groq@2164@tanstack/ai-harness
npm i https://pkg.pr.new/@tanstack/ai-harness@2164@tanstack/ai-harness-cli
npm i https://pkg.pr.new/@tanstack/ai-harness-cli@2164@tanstack/ai-isolate-cloudflare
npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@2164@tanstack/ai-isolate-daytona
npm i https://pkg.pr.new/@tanstack/ai-isolate-daytona@2164@tanstack/ai-isolate-e2b
npm i https://pkg.pr.new/@tanstack/ai-isolate-e2b@2164@tanstack/ai-isolate-node
npm i https://pkg.pr.new/@tanstack/ai-isolate-node@2164@tanstack/ai-isolate-quickjs
npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@2164@tanstack/ai-isolate-quickjs-bun
npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs-bun@2164@tanstack/ai-llmgateway
npm i https://pkg.pr.new/@tanstack/ai-llmgateway@2164@tanstack/ai-lovable
npm i https://pkg.pr.new/@tanstack/ai-lovable@2164@tanstack/ai-mcp
npm i https://pkg.pr.new/@tanstack/ai-mcp@2164@tanstack/ai-memory
npm i https://pkg.pr.new/@tanstack/ai-memory@2164@tanstack/ai-mistral
npm i https://pkg.pr.new/@tanstack/ai-mistral@2164@tanstack/ai-muse
npm i https://pkg.pr.new/@tanstack/ai-muse@2164@tanstack/ai-neon
npm i https://pkg.pr.new/@tanstack/ai-neon@2164@tanstack/ai-octane
npm i https://pkg.pr.new/@tanstack/ai-octane@2164@tanstack/ai-ollama
npm i https://pkg.pr.new/@tanstack/ai-ollama@2164@tanstack/ai-ollaya
npm i https://pkg.pr.new/@tanstack/ai-ollaya@2164@tanstack/ai-openai
npm i https://pkg.pr.new/@tanstack/ai-openai@2164@tanstack/ai-opencode
npm i https://pkg.pr.new/@tanstack/ai-opencode@2164@tanstack/ai-openrouter
npm i https://pkg.pr.new/@tanstack/ai-openrouter@2164@tanstack/ai-perplexity
npm i https://pkg.pr.new/@tanstack/ai-perplexity@2164@tanstack/ai-persistence
npm i https://pkg.pr.new/@tanstack/ai-persistence@2164@tanstack/ai-preact
npm i https://pkg.pr.new/@tanstack/ai-preact@2164@tanstack/ai-react
npm i https://pkg.pr.new/@tanstack/ai-react@2164@tanstack/ai-reactor
npm i https://pkg.pr.new/@tanstack/ai-reactor@2164@tanstack/ai-remix
npm i https://pkg.pr.new/@tanstack/ai-remix@2164@tanstack/ai-sandbox
npm i https://pkg.pr.new/@tanstack/ai-sandbox@2164@tanstack/ai-sandbox-blaxel
npm i https://pkg.pr.new/@tanstack/ai-sandbox-blaxel@2164@tanstack/ai-sandbox-boxd
npm i https://pkg.pr.new/@tanstack/ai-sandbox-boxd@2164@tanstack/ai-sandbox-cloudflare
npm i https://pkg.pr.new/@tanstack/ai-sandbox-cloudflare@2164@tanstack/ai-sandbox-daytona
npm i https://pkg.pr.new/@tanstack/ai-sandbox-daytona@2164@tanstack/ai-sandbox-docker
npm i https://pkg.pr.new/@tanstack/ai-sandbox-docker@2164@tanstack/ai-sandbox-e2b
npm i https://pkg.pr.new/@tanstack/ai-sandbox-e2b@2164@tanstack/ai-sandbox-local-process
npm i https://pkg.pr.new/@tanstack/ai-sandbox-local-process@2164@tanstack/ai-sandbox-railway
npm i https://pkg.pr.new/@tanstack/ai-sandbox-railway@2164@tanstack/ai-sandbox-sprites
npm i https://pkg.pr.new/@tanstack/ai-sandbox-sprites@2164@tanstack/ai-sandbox-upstash-box
npm i https://pkg.pr.new/@tanstack/ai-sandbox-upstash-box@2164@tanstack/ai-sandbox-vercel
npm i https://pkg.pr.new/@tanstack/ai-sandbox-vercel@2164@tanstack/ai-skills
npm i https://pkg.pr.new/@tanstack/ai-skills@2164@tanstack/ai-solid
npm i https://pkg.pr.new/@tanstack/ai-solid@2164@tanstack/ai-svelte
npm i https://pkg.pr.new/@tanstack/ai-svelte@2164@tanstack/ai-typesafe
npm i https://pkg.pr.new/@tanstack/ai-typesafe@2164@tanstack/ai-utils
npm i https://pkg.pr.new/@tanstack/ai-utils@2164@tanstack/ai-vercel-gateway
npm i https://pkg.pr.new/@tanstack/ai-vercel-gateway@2164@tanstack/ai-vertex
npm i https://pkg.pr.new/@tanstack/ai-vertex@2164@tanstack/ai-vue
npm i https://pkg.pr.new/@tanstack/ai-vue@2164@tanstack/ai-worldlabs
npm i https://pkg.pr.new/@tanstack/ai-worldlabs@2164@tanstack/openai-base
npm i https://pkg.pr.new/@tanstack/openai-base@2164@tanstack/preact-ai-devtools
npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@2164@tanstack/react-ai-devtools
npm i https://pkg.pr.new/@tanstack/react-ai-devtools@2164@tanstack/solid-ai-devtools
npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@2164@tanstack/svelte-ai-devtools
npm i https://pkg.pr.new/@tanstack/svelte-ai-devtools@2164commit:
9e47a1fCoverage#
✅ Coverage held across 9 compared package(s).
Each package is measured twice in this job — on this PR and on its merge-base with
main— and compared. A metric fails only when it is at or above 60% on the merge-base and under 60% on this PR. Other drops are listed but do not fail. Packages your PR doesn't affect are not measured and not listed.package statements branches functions lines ai-angular 73.83% (0.00) 60.89% (0.00) 61.83% (0.00) 75.40% (0.00) ok ai-client 88.21% (0.00) 80.30% (0.00) 87.46% (0.00) 90.47% (0.00) ok ai-octane 91.19% (0.00) 68.26% (0.00) 87.44% (0.00) 91.47% (0.00) ok ai-preact 86.50% (0.00) 71.00% (0.00) 87.50% (0.00) 87.98% (0.00) ok ai-react 82.20% (0.00) 66.01% (0.00) 80.82% (0.00) 82.91% (0.00) ok ai-remix 43.02% (0.00) 30.35% (0.00) 39.02% (0.00) 46.23% (0.00) ok ai-solid 75.81% (0.00) 57.63% (0.00) 71.28% (0.00) 78.11% (0.00) ok ai-svelte 74.09% (0.00) 50.67% (0.00) 69.54% (0.00) 76.20% (0.00) ok ai-vue 73.33% (0.00) 48.73% (0.00) 73.28% (0.00) 74.66% (0.00) ok github-actions[bot](GitHub profile, opens in a new tab) assignedjherr
github-actions[bot](GitHub profile, opens in a new tab) added labelswaiting-on: maintainer
AlemTuzlak merged this0fb44da
AlemTuzlak merged this0fb44da
AlemTuzlak closed this
Sign in to join this conversation.
View your CI Pipeline Execution ↗ for commit 9e47a1f5aeec63cc578cfc7b6c600f51293c3e22
nx run-many --targets=build --exclude=examples/...💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗
☁️ Nx Cloud last updated this comment at
2026-11-16 11:35:22UTC