ag-ui-protocol / ag-ui-protocol/ag-ui

[Feature]: @ag-ui/mastra: option to surface reasoning-delta as assistant text when the model answers through reasoning

未關閉
#2,666 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
15.9k
分支
1.4k
平均合併
1 天 17 小時
30 天內合併 PR
163

描述

### Problem or Motivation

`createChunkProcessor` maps every `reasoning-delta` chunk to `REASONING_MESSAGE_CONTENT`. Some models stream their visible answer as `reasoning-delta` and never emit a `text-delta` for it (seen with `openai/gpt-5.6-luna` through Mastra's model router). The answer then only exists inside `REASONING_MESSAGE_*` events and the client shows no assistant message for that turn.

### Proposed Solution

An opt-in on `MastraAgentConfig`, for example `reasoningAsText: boolean | ((chunk) => boolean)`, that emits `TEXT_MESSAGE_*` for `reasoning-delta` instead of `REASONING_MESSAGE_*`. A narrower variant: promote the buffered reasoning text to assistant text only when the step finishes without any `text-delta`.

### Alternatives Considered

Handling it on the client (render the reasoning block as the answer when no text arrives) works, but pushes a provider quirk into every frontend.

### Additional Context

Environment: @ag-ui/mastra 1.1.2, @mastra/core 1.63.2, Node 24. Found while moving a CopilotKit Angular app from a custom bridge to the stock adapter (related fixes: #2661, #2662, #2663, #2664). Happy to send a PR once the direction is clear.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。