From d6c07ce66d2e64c58e67edf8868207bc09b591d9 Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Wed, 16 Sep 2026 13:02:35 +0200 Subject: [PATCH] fix(chat-sdk): read a tool's call and a model's thinking off the row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A conversation row carries three things the SDK did not declare and so never read: what a tool was called with, what it returned, and the thinking behind an answer. For a tool that runs inside the agent's job the row is the only copy of the first two, and for a failed tool the result is what it failed with — so a conversation read back through the SDK showed a tool call with nothing to expand and a failure with no reason. The AI SDK adapter already preferred a tool's result over the row's text when reporting an error, so it needed only the data. Co-Authored-By: Claude Opus 5 (1M context) --- chat-sdk/src/ai-sdk.ts | 28 ++++++++++++++++++++++------ chat-sdk/src/api.ts | 5 +++++ chat-sdk/src/chat.ts | 13 ++++++++++++- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/chat-sdk/src/ai-sdk.ts b/chat-sdk/src/ai-sdk.ts index ba500446a3..527ece1e5c 100644 --- a/chat-sdk/src/ai-sdk.ts +++ b/chat-sdk/src/ai-sdk.ts @@ -1,5 +1,10 @@ import type { ChatTransport, UIMessage, UIMessageChunk, UIMessagePart } from 'ai' -import { WindmillApiError, WindmillChatApi, type WindmillChatApiOptions } from './api' +import { + WindmillApiError, + WindmillChatApi, + type FlowConversationMessage, + type WindmillChatApiOptions +} from './api' import { followJob } from './follow' import type { AgentStreamEvent } from './stream' import type { ChatMessage, Conversation } from './types' @@ -101,7 +106,8 @@ export function createWindmillChatTransport