Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .changeset/fix-anthropic-multi-turn-tool-calls.md

This file was deleted.

25 changes: 0 additions & 25 deletions .changeset/tighten-adapter-contract.md

This file was deleted.

13 changes: 13 additions & 0 deletions examples/ts-svelte-chat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# ts-svelte-chat

## 0.1.11

### Patch Changes

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd), [`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai@0.5.0
- @tanstack/ai-client@0.4.4
- @tanstack/ai-anthropic@0.5.0
- @tanstack/ai-gemini@0.5.0
- @tanstack/ai-ollama@0.5.0
- @tanstack/ai-openai@0.5.0
- @tanstack/ai-svelte@0.5.0

## 0.1.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/ts-svelte-chat/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ts-svelte-chat",
"private": true,
"version": "0.1.10",
"version": "0.1.11",
"type": "module",
"scripts": {
"dev": "vite dev --port 3000",
Expand Down
14 changes: 14 additions & 0 deletions examples/ts-vue-chat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# ts-vue-chat

## 0.1.11

### Patch Changes

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd), [`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai@0.5.0
- @tanstack/ai-client@0.4.4
- @tanstack/ai-anthropic@0.5.0
- @tanstack/ai-gemini@0.5.0
- @tanstack/ai-ollama@0.5.0
- @tanstack/ai-openai@0.5.0
- @tanstack/ai-vue@0.5.0
- @tanstack/ai-vue-ui@0.1.9

## 0.1.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/ts-vue-chat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-vue-chat",
"version": "0.1.10",
"version": "0.1.11",
"private": true,
"type": "module",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions examples/vanilla-chat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# vanilla-chat

## 0.0.13

### Patch Changes

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai-client@0.4.4

## 0.0.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/vanilla-chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vanilla-chat",
"private": true,
"type": "module",
"version": "0.0.12",
"version": "0.0.13",
"scripts": {
"start": "vite --port 3001",
"dev": "vite --port 3001",
Expand Down
51 changes: 51 additions & 0 deletions packages/typescript/ai-anthropic/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# @tanstack/ai-anthropic

## 0.5.0

### Minor Changes

- Tighten the AG-UI adapter contract and simplify the core stream processor. ([#275](https://github.com/TanStack/ai/pull/275))

**Breaking type changes:**
- `TextMessageContentEvent.delta` is now required (was optional)
- `StepFinishedEvent.delta` is now required (was optional)

All first-party adapters already sent `delta` on every event, so this is a type-level enforcement of existing behavior. Community adapters that follow the reference implementations will not need code changes.

**Core processor simplifications:**
- `TEXT_MESSAGE_START` now resets text segment state, replacing heuristic overlap detection
- `TOOL_CALL_END` is now the authoritative signal for tool call input completion
- Removed delta/content fallback logic, whitespace-only message cleanup, and finish-reason conflict arbitration from the processor

**Adapter fixes:**
- Gemini: filter whitespace-only text parts, fix STEP_FINISHED content accumulation, emit fresh TEXT_MESSAGE_START after tool calls
- Anthropic: emit fresh TEXT_MESSAGE_START after tool_use blocks for proper text segmentation

### Patch Changes

- fix(ai, ai-client, ai-anthropic, ai-gemini): fix multi-turn conversations failing after tool calls ([#275](https://github.com/TanStack/ai/pull/275))

**Core (@tanstack/ai):**
- Lazy assistant message creation: `StreamProcessor` now defers creating the assistant message until the first content-bearing chunk arrives (text, tool call, thinking, or error), eliminating empty `parts: []` messages from appearing during auto-continuation when the model returns no content
- Add `prepareAssistantMessage()` (lazy) alongside deprecated `startAssistantMessage()` (eager, backwards-compatible)
- Add `getCurrentAssistantMessageId()` to check if a message was created
- **Rewrite `uiMessageToModelMessages()` to preserve part ordering**: the function now walks parts sequentially instead of separating by type, producing correctly interleaved assistant/tool messages (text1 + toolCall1 → toolResult1 → text2 + toolCall2 → toolResult2) instead of concatenating all text and batching all tool calls. This fixes multi-round tool flows where the model would see garbled conversation history and re-call tools unnecessarily.
- Deduplicate tool result messages: when a client tool has both a `tool-result` part and a `tool-call` part with `output`, only one `role: 'tool'` message is emitted per tool call ID

**Client (@tanstack/ai-client):**
- Update `ChatClient.processStream()` to use lazy assistant message creation, preventing UI flicker from empty messages being created then removed

**Anthropic:**
- Fix consecutive user-role messages violating Anthropic's alternating role requirement by merging them in `formatMessages`
- Deduplicate `tool_result` blocks with the same `tool_use_id`
- Filter out empty assistant messages from conversation history
- Suppress duplicate `RUN_FINISHED` event from `message_stop` when `message_delta` already emitted one
- Fix `TEXT_MESSAGE_END` incorrectly emitting for `tool_use` content blocks
- Add Claude Opus 4.6 model support with adaptive thinking and effort parameter

**Gemini:**
- Fix consecutive user-role messages violating Gemini's alternating role requirement by merging them in `formatMessages`
- Deduplicate `functionResponse` parts with the same name (tool call ID)
- Filter out empty model messages from conversation history

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd), [`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai@0.5.0

## 0.4.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/ai-anthropic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-anthropic",
"version": "0.4.2",
"version": "0.5.0",
"description": "Anthropic Claude adapter for TanStack AI",
"author": "",
"license": "MIT",
Expand Down
32 changes: 32 additions & 0 deletions packages/typescript/ai-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# @tanstack/ai-client

## 0.4.4

### Patch Changes

- fix(ai, ai-client, ai-anthropic, ai-gemini): fix multi-turn conversations failing after tool calls ([#275](https://github.com/TanStack/ai/pull/275))

**Core (@tanstack/ai):**
- Lazy assistant message creation: `StreamProcessor` now defers creating the assistant message until the first content-bearing chunk arrives (text, tool call, thinking, or error), eliminating empty `parts: []` messages from appearing during auto-continuation when the model returns no content
- Add `prepareAssistantMessage()` (lazy) alongside deprecated `startAssistantMessage()` (eager, backwards-compatible)
- Add `getCurrentAssistantMessageId()` to check if a message was created
- **Rewrite `uiMessageToModelMessages()` to preserve part ordering**: the function now walks parts sequentially instead of separating by type, producing correctly interleaved assistant/tool messages (text1 + toolCall1 → toolResult1 → text2 + toolCall2 → toolResult2) instead of concatenating all text and batching all tool calls. This fixes multi-round tool flows where the model would see garbled conversation history and re-call tools unnecessarily.
- Deduplicate tool result messages: when a client tool has both a `tool-result` part and a `tool-call` part with `output`, only one `role: 'tool'` message is emitted per tool call ID

**Client (@tanstack/ai-client):**
- Update `ChatClient.processStream()` to use lazy assistant message creation, preventing UI flicker from empty messages being created then removed

**Anthropic:**
- Fix consecutive user-role messages violating Anthropic's alternating role requirement by merging them in `formatMessages`
- Deduplicate `tool_result` blocks with the same `tool_use_id`
- Filter out empty assistant messages from conversation history
- Suppress duplicate `RUN_FINISHED` event from `message_stop` when `message_delta` already emitted one
- Fix `TEXT_MESSAGE_END` incorrectly emitting for `tool_use` content blocks
- Add Claude Opus 4.6 model support with adaptive thinking and effort parameter

**Gemini:**
- Fix consecutive user-role messages violating Gemini's alternating role requirement by merging them in `formatMessages`
- Deduplicate `functionResponse` parts with the same name (tool call ID)
- Filter out empty model messages from conversation history

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd), [`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai@0.5.0

## 0.4.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/ai-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-client",
"version": "0.4.3",
"version": "0.4.4",
"description": "Framework-agnostic headless client for TanStack AI",
"author": "",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/typescript/ai-devtools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/ai-devtools-core

## 0.3.3

### Patch Changes

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd), [`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai@0.5.0

## 0.3.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/ai-devtools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-devtools-core",
"version": "0.3.2",
"version": "0.3.3",
"description": "Core TanStack AI Devtools",
"author": "",
"license": "MIT",
Expand Down
51 changes: 51 additions & 0 deletions packages/typescript/ai-gemini/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# @tanstack/ai-gemini

## 0.5.0

### Minor Changes

- Tighten the AG-UI adapter contract and simplify the core stream processor. ([#275](https://github.com/TanStack/ai/pull/275))

**Breaking type changes:**
- `TextMessageContentEvent.delta` is now required (was optional)
- `StepFinishedEvent.delta` is now required (was optional)

All first-party adapters already sent `delta` on every event, so this is a type-level enforcement of existing behavior. Community adapters that follow the reference implementations will not need code changes.

**Core processor simplifications:**
- `TEXT_MESSAGE_START` now resets text segment state, replacing heuristic overlap detection
- `TOOL_CALL_END` is now the authoritative signal for tool call input completion
- Removed delta/content fallback logic, whitespace-only message cleanup, and finish-reason conflict arbitration from the processor

**Adapter fixes:**
- Gemini: filter whitespace-only text parts, fix STEP_FINISHED content accumulation, emit fresh TEXT_MESSAGE_START after tool calls
- Anthropic: emit fresh TEXT_MESSAGE_START after tool_use blocks for proper text segmentation

### Patch Changes

- fix(ai, ai-client, ai-anthropic, ai-gemini): fix multi-turn conversations failing after tool calls ([#275](https://github.com/TanStack/ai/pull/275))

**Core (@tanstack/ai):**
- Lazy assistant message creation: `StreamProcessor` now defers creating the assistant message until the first content-bearing chunk arrives (text, tool call, thinking, or error), eliminating empty `parts: []` messages from appearing during auto-continuation when the model returns no content
- Add `prepareAssistantMessage()` (lazy) alongside deprecated `startAssistantMessage()` (eager, backwards-compatible)
- Add `getCurrentAssistantMessageId()` to check if a message was created
- **Rewrite `uiMessageToModelMessages()` to preserve part ordering**: the function now walks parts sequentially instead of separating by type, producing correctly interleaved assistant/tool messages (text1 + toolCall1 → toolResult1 → text2 + toolCall2 → toolResult2) instead of concatenating all text and batching all tool calls. This fixes multi-round tool flows where the model would see garbled conversation history and re-call tools unnecessarily.
- Deduplicate tool result messages: when a client tool has both a `tool-result` part and a `tool-call` part with `output`, only one `role: 'tool'` message is emitted per tool call ID

**Client (@tanstack/ai-client):**
- Update `ChatClient.processStream()` to use lazy assistant message creation, preventing UI flicker from empty messages being created then removed

**Anthropic:**
- Fix consecutive user-role messages violating Anthropic's alternating role requirement by merging them in `formatMessages`
- Deduplicate `tool_result` blocks with the same `tool_use_id`
- Filter out empty assistant messages from conversation history
- Suppress duplicate `RUN_FINISHED` event from `message_stop` when `message_delta` already emitted one
- Fix `TEXT_MESSAGE_END` incorrectly emitting for `tool_use` content blocks
- Add Claude Opus 4.6 model support with adaptive thinking and effort parameter

**Gemini:**
- Fix consecutive user-role messages violating Gemini's alternating role requirement by merging them in `formatMessages`
- Deduplicate `functionResponse` parts with the same name (tool call ID)
- Filter out empty model messages from conversation history

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd), [`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai@0.5.0

## 0.4.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/ai-gemini/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-gemini",
"version": "0.4.1",
"version": "0.5.0",
"description": "Google Gemini adapter for TanStack AI",
"author": "",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/typescript/ai-grok/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/ai-grok

## 0.5.0

### Patch Changes

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd), [`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai@0.5.0

## 0.4.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/ai-grok/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-grok",
"version": "0.4.1",
"version": "0.5.0",
"description": "Grok (xAI) adapter for TanStack AI",
"author": "",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/typescript/ai-ollama/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/ai-ollama

## 0.5.0

### Patch Changes

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd), [`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai@0.5.0

## 0.4.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/ai-ollama/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-ollama",
"version": "0.4.0",
"version": "0.5.0",
"description": "Ollama adapter for TanStack AI",
"author": "",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/typescript/ai-openai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/ai-openai

## 0.5.0

### Patch Changes

- Updated dependencies [[`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd), [`5d98472`](https://github.com/TanStack/ai/commit/5d984722e1f84725e3cfda834fbda3d0341ecedd)]:
- @tanstack/ai@0.5.0

## 0.4.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/ai-openai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-openai",
"version": "0.4.0",
"version": "0.5.0",
"description": "OpenAI adapter for TanStack AI",
"author": "",
"license": "MIT",
Expand Down
Loading
Loading