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
15 changes: 0 additions & 15 deletions .changeset/multimodal-tool-results.md

This file was deleted.

30 changes: 0 additions & 30 deletions .changeset/runerror-raw-event.md

This file was deleted.

52 changes: 0 additions & 52 deletions .changeset/typed-runtime-context.md

This file was deleted.

39 changes: 39 additions & 0 deletions packages/ai-anthropic/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# @tanstack/ai-anthropic

## 0.12.0

### Minor Changes

- [#666](https://github.com/TanStack/ai/pull/666) [`c1ae8b9`](https://github.com/TanStack/ai/commit/c1ae8b94c83d70508975568eb4fc9b45f1af540b) - feat: support multimodal (image) tool results

Tools may now return an `Array<ContentPart>` (e.g. a text part plus an image part) and have it transmitted to the model as structured multimodal tool output instead of a `JSON.stringify`'d blob. This unblocks use cases like returning a screenshot from a tool so the model can see it (issue [#363](https://github.com/TanStack/ai/issues/363)).
- Detection is structural and opt-in by shape: a tool that returns a non-empty array whose every element is a valid `ContentPart` is passed through unchanged; strings and all other return values are serialized exactly as before, so there are no breaking changes.
- The OpenAI Responses, Anthropic, and Google Gemini adapters convert the content parts into their native multimodal tool-output formats (`function_call_output.output`, `tool_result` content blocks, and `functionResponse.parts` respectively). Providers on the Chat Completions path (Groq, Ollama, Grok, OpenRouter chat) fall back to stringifying, which their APIs require.
- AG-UI stream events (`TOOL_CALL_RESULT.content`, `TOOL_CALL_END.result`) remain string-only per the spec; the multimodal array travels on the tool message itself.

- [#673](https://github.com/TanStack/ai/pull/673) [`a452ae8`](https://github.com/TanStack/ai/commit/a452ae8bcda8abfdc6309983976ed0fbf6df1915) - Populate AG-UI `rawEvent` on `RUN_ERROR` events with the provider's structured error body.

Previously, when a streaming chat call failed the `RUN_ERROR` event carried only an
opaque `{ message, code }` headline (e.g. `"Provider returned error"`), and no adapter
populated AG-UI's purpose-built `rawEvent` field — so the upstream provider detail was
unrecoverable.

Adapters now forward the provider's **structured error body** (e.g. an SDK `APIError`'s
parsed `.error` response body, or OpenRouter's mid-stream `chunk.error`) as `rawEvent`
on the `RUN_ERROR` event. The new `toRunErrorRawEvent` helper extracts only known
provider-body fields — never the raw SDK exception object, which can carry request
metadata such as auth headers. The `{ message, code }` contract of `toRunErrorPayload`
is unchanged.

The error surfaced to consumers via the `ChatClient` / `useChat` `error` (and the
`onError` callback) now also carries `code` and `rawEvent` when present, so the upstream
cause is recoverable in application code.

> Note: the OpenRouter SDK parses each in-band stream chunk's `error` through a strict
> schema (`{ code, message }`), so provider `metadata` survives only on pre-stream HTTP
> errors (rate-limit / overload / BYOK rejection), whose typed error class exposes the
> full body via `.error`.

### Patch Changes

- Updated dependencies [[`c1ae8b9`](https://github.com/TanStack/ai/commit/c1ae8b94c83d70508975568eb4fc9b45f1af540b), [`a452ae8`](https://github.com/TanStack/ai/commit/a452ae8bcda8abfdc6309983976ed0fbf6df1915), [`8036b50`](https://github.com/TanStack/ai/commit/8036b5054330a180023c6e3225b8d2735a43a919)]:
- @tanstack/ai@0.24.0

## 0.11.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-anthropic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-anthropic",
"version": "0.11.2",
"version": "0.12.0",
"description": "Anthropic Claude adapter for TanStack AI chat, tool calling, thinking, and structured outputs.",
"author": "",
"license": "MIT",
Expand Down
58 changes: 58 additions & 0 deletions packages/ai-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# @tanstack/ai-client

## 0.15.0

### Minor Changes

- [#666](https://github.com/TanStack/ai/pull/666) [`c1ae8b9`](https://github.com/TanStack/ai/commit/c1ae8b94c83d70508975568eb4fc9b45f1af540b) - feat: support multimodal (image) tool results

Tools may now return an `Array<ContentPart>` (e.g. a text part plus an image part) and have it transmitted to the model as structured multimodal tool output instead of a `JSON.stringify`'d blob. This unblocks use cases like returning a screenshot from a tool so the model can see it (issue [#363](https://github.com/TanStack/ai/issues/363)).
- Detection is structural and opt-in by shape: a tool that returns a non-empty array whose every element is a valid `ContentPart` is passed through unchanged; strings and all other return values are serialized exactly as before, so there are no breaking changes.
- The OpenAI Responses, Anthropic, and Google Gemini adapters convert the content parts into their native multimodal tool-output formats (`function_call_output.output`, `tool_result` content blocks, and `functionResponse.parts` respectively). Providers on the Chat Completions path (Groq, Ollama, Grok, OpenRouter chat) fall back to stringifying, which their APIs require.
- AG-UI stream events (`TOOL_CALL_RESULT.content`, `TOOL_CALL_END.result`) remain string-only per the spec; the multimodal array travels on the tool message itself.

- [#628](https://github.com/TanStack/ai/pull/628) [`8036b50`](https://github.com/TanStack/ai/commit/8036b5054330a180023c6e3225b8d2735a43a919) - Add typed runtime context for tools and middleware.

Tools and middleware can now declare the runtime context shape they require, and
`chat()`, `ChatClient`, and the framework `useChat` / `createChat` hooks infer
the merged requirement and type-check the `context` option you pass against it.

```typescript
type AppContext = { userId: string; db: Db }

const listNotes = toolDefinition({
name: 'list_notes' /* ... */,
}).server<AppContext>((_input, ctx) =>
ctx.context.db.notes.findMany({ userId: ctx.context.userId }),
)

chat({
adapter,
messages,
tools: [listNotes],
context: { userId, db }, // required and type-checked because listNotes declares AppContext
})
```

Runtime context is request-local application state for tool and middleware
implementations (authenticated users, database clients, tenancy, feature flags,
loggers, browser services). It is never sent to the model and is distinct from
the AG-UI `RunAgentInput.context` protocol field.

Untyped tools and middleware continue to receive `unknown` context and do not
force a `context` option. Client tools receive client-local context via
`ChatClient` / `useChat`; use `forwardedProps` to hand serializable client data
to the server and map it into server context explicitly. See the new Runtime
Context guide for details.

Behavior change: tool output validation now also runs when a tool returns
`undefined` or `null`. Previously these values bypassed `outputSchema`
validation entirely; now the schema decides whether they are valid, so a tool
whose schema forbids `undefined`/`null` surfaces a validation error
(`output-error`) instead of silently passing. Tools whose schema permits
`null`/`undefined` (e.g. nullable or void outputs) are unaffected.

### Patch Changes

- Updated dependencies [[`c1ae8b9`](https://github.com/TanStack/ai/commit/c1ae8b94c83d70508975568eb4fc9b45f1af540b), [`a452ae8`](https://github.com/TanStack/ai/commit/a452ae8bcda8abfdc6309983976ed0fbf6df1915), [`8036b50`](https://github.com/TanStack/ai/commit/8036b5054330a180023c6e3225b8d2735a43a919)]:
- @tanstack/ai@0.24.0
- @tanstack/ai-event-client@0.4.3

## 0.14.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-client",
"version": "0.14.1",
"version": "0.15.0",
"description": "Framework-agnostic headless client for TanStack AI chat, realtime sessions, streaming transports, and media generations.",
"author": "",
"license": "MIT",
Expand Down
51 changes: 51 additions & 0 deletions packages/ai-code-mode-skills/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# @tanstack/ai-code-mode-skills

## 0.2.0

### Minor Changes

- [#628](https://github.com/TanStack/ai/pull/628) [`8036b50`](https://github.com/TanStack/ai/commit/8036b5054330a180023c6e3225b8d2735a43a919) - Add typed runtime context for tools and middleware.

Tools and middleware can now declare the runtime context shape they require, and
`chat()`, `ChatClient`, and the framework `useChat` / `createChat` hooks infer
the merged requirement and type-check the `context` option you pass against it.

```typescript
type AppContext = { userId: string; db: Db }

const listNotes = toolDefinition({
name: 'list_notes' /* ... */,
}).server<AppContext>((_input, ctx) =>
ctx.context.db.notes.findMany({ userId: ctx.context.userId }),
)

chat({
adapter,
messages,
tools: [listNotes],
context: { userId, db }, // required and type-checked because listNotes declares AppContext
})
```

Runtime context is request-local application state for tool and middleware
implementations (authenticated users, database clients, tenancy, feature flags,
loggers, browser services). It is never sent to the model and is distinct from
the AG-UI `RunAgentInput.context` protocol field.

Untyped tools and middleware continue to receive `unknown` context and do not
force a `context` option. Client tools receive client-local context via
`ChatClient` / `useChat`; use `forwardedProps` to hand serializable client data
to the server and map it into server context explicitly. See the new Runtime
Context guide for details.

Behavior change: tool output validation now also runs when a tool returns
`undefined` or `null`. Previously these values bypassed `outputSchema`
validation entirely; now the schema decides whether they are valid, so a tool
whose schema forbids `undefined`/`null` surfaces a validation error
(`output-error`) instead of silently passing. Tools whose schema permits
`null`/`undefined` (e.g. nullable or void outputs) are unaffected.

### Patch Changes

- Updated dependencies [[`c1ae8b9`](https://github.com/TanStack/ai/commit/c1ae8b94c83d70508975568eb4fc9b45f1af540b), [`a452ae8`](https://github.com/TanStack/ai/commit/a452ae8bcda8abfdc6309983976ed0fbf6df1915), [`8036b50`](https://github.com/TanStack/ai/commit/8036b5054330a180023c6e3225b8d2735a43a919)]:
- @tanstack/ai@0.24.0
- @tanstack/ai-code-mode@0.2.0

## 0.1.24

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-code-mode-skills/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-code-mode-skills",
"version": "0.1.24",
"version": "0.2.0",
"description": "Persistent runtime skill library for TanStack AI Code Mode agents and sandboxed tool orchestration.",
"author": "",
"license": "MIT",
Expand Down
50 changes: 50 additions & 0 deletions packages/ai-code-mode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
# @tanstack/ai-code-mode

## 0.2.0

### Minor Changes

- [#628](https://github.com/TanStack/ai/pull/628) [`8036b50`](https://github.com/TanStack/ai/commit/8036b5054330a180023c6e3225b8d2735a43a919) - Add typed runtime context for tools and middleware.

Tools and middleware can now declare the runtime context shape they require, and
`chat()`, `ChatClient`, and the framework `useChat` / `createChat` hooks infer
the merged requirement and type-check the `context` option you pass against it.

```typescript
type AppContext = { userId: string; db: Db }

const listNotes = toolDefinition({
name: 'list_notes' /* ... */,
}).server<AppContext>((_input, ctx) =>
ctx.context.db.notes.findMany({ userId: ctx.context.userId }),
)

chat({
adapter,
messages,
tools: [listNotes],
context: { userId, db }, // required and type-checked because listNotes declares AppContext
})
```

Runtime context is request-local application state for tool and middleware
implementations (authenticated users, database clients, tenancy, feature flags,
loggers, browser services). It is never sent to the model and is distinct from
the AG-UI `RunAgentInput.context` protocol field.

Untyped tools and middleware continue to receive `unknown` context and do not
force a `context` option. Client tools receive client-local context via
`ChatClient` / `useChat`; use `forwardedProps` to hand serializable client data
to the server and map it into server context explicitly. See the new Runtime
Context guide for details.

Behavior change: tool output validation now also runs when a tool returns
`undefined` or `null`. Previously these values bypassed `outputSchema`
validation entirely; now the schema decides whether they are valid, so a tool
whose schema forbids `undefined`/`null` surfaces a validation error
(`output-error`) instead of silently passing. Tools whose schema permits
`null`/`undefined` (e.g. nullable or void outputs) are unaffected.

### Patch Changes

- Updated dependencies [[`c1ae8b9`](https://github.com/TanStack/ai/commit/c1ae8b94c83d70508975568eb4fc9b45f1af540b), [`a452ae8`](https://github.com/TanStack/ai/commit/a452ae8bcda8abfdc6309983976ed0fbf6df1915), [`8036b50`](https://github.com/TanStack/ai/commit/8036b5054330a180023c6e3225b8d2735a43a919)]:
- @tanstack/ai@0.24.0

## 0.1.24

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-code-mode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-code-mode",
"version": "0.1.24",
"version": "0.2.0",
"description": "Secure TypeScript Code Mode for TanStack AI agents to execute sandboxed tool orchestration programs.",
"author": "",
"license": "MIT",
Expand Down
8 changes: 8 additions & 0 deletions packages/ai-devtools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @tanstack/ai-devtools-core

## 0.4.3

### Patch Changes

- Updated dependencies [[`c1ae8b9`](https://github.com/TanStack/ai/commit/c1ae8b94c83d70508975568eb4fc9b45f1af540b), [`a452ae8`](https://github.com/TanStack/ai/commit/a452ae8bcda8abfdc6309983976ed0fbf6df1915), [`8036b50`](https://github.com/TanStack/ai/commit/8036b5054330a180023c6e3225b8d2735a43a919)]:
- @tanstack/ai@0.24.0
- @tanstack/ai-event-client@0.4.3

## 0.4.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/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.4.2",
"version": "0.4.3",
"description": "Core TanStack AI Devtools plugin for inspecting chat messages, tool calls, streams, and errors.",
"author": "",
"license": "MIT",
Expand Down
8 changes: 8 additions & 0 deletions packages/ai-elevenlabs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @tanstack/ai-elevenlabs

## 0.2.15

### Patch Changes

- Updated dependencies [[`c1ae8b9`](https://github.com/TanStack/ai/commit/c1ae8b94c83d70508975568eb4fc9b45f1af540b), [`a452ae8`](https://github.com/TanStack/ai/commit/a452ae8bcda8abfdc6309983976ed0fbf6df1915), [`8036b50`](https://github.com/TanStack/ai/commit/8036b5054330a180023c6e3225b8d2735a43a919)]:
- @tanstack/ai@0.24.0
- @tanstack/ai-client@0.15.0

## 0.2.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-elevenlabs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/ai-elevenlabs",
"version": "0.2.14",
"version": "0.2.15",
"description": "ElevenLabs adapter for TanStack AI realtime voice, text-to-speech, transcription, music, and sound effects.",
"author": "",
"license": "MIT",
Expand Down
Loading