mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
b038115174
## What does this PR do? - Preserve non-tool `AIMessage` fields when frontend tool calls are intercepted in `afterModel` and restored in `afterAgent`, including `additional_kwargs`, `response_metadata`, `usage_metadata`, `invalid_tool_calls`, `id`, and `name`. - Use a shared rebuild helper with `tool_calls` as the source of truth. For LangChain v1 content blocks, remove stale `tool_call` and `tool_call_chunk` blocks before reconstructing the message. - Add regression coverage for the `reasoning + backend/frontend tool calls -> afterModel -> afterAgent` flow, including metadata preservation and v1 content block synchronization. ## Related PRs and Issues - Closes #6087 - Related to #4759 and #5308 ## Checklist - [x] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] Documentation is not required because this is an internal middleware bug fix with no public API changes - [x] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone)
CopilotKit - SDK JS
✨ Why CopilotKit?
- Minutes to integrate - Get started quickly with our CLI
- Framework agnostic - Works with React, Next.js, AGUI and more
- Production-ready UI - Use customizable components or build with headless UI
- Built-in security - Prompt injection protection
- Open source - Full transparency and community-driven
🧑💻 Real life use cases
Deploy deeply-integrated AI assistants & agents that work alongside your users inside your applications.
🏆 Featured Examples
Documentation
To get started with CopilotKit, please check out the documentation.