@tanstack/ai 0.54.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -16
- package/dist/esm/activities/chat/index.js +17 -1
- package/dist/esm/activities/chat/index.js.map +1 -1
- package/dist/esm/activities/chat/messages.d.ts +21 -1
- package/dist/esm/activities/chat/messages.js +50 -1
- package/dist/esm/activities/chat/messages.js.map +1 -1
- package/dist/esm/activities/chat/stream/processor.d.ts +17 -0
- package/dist/esm/activities/chat/stream/processor.js +27 -0
- package/dist/esm/activities/chat/stream/processor.js.map +1 -1
- package/dist/esm/activities/chat/tools/tool-calls.js +1 -0
- package/dist/esm/activities/chat/tools/tool-calls.js.map +1 -1
- package/dist/esm/activities/evaluate/adapter.d.ts +160 -0
- package/dist/esm/activities/evaluate/adapter.js +23 -0
- package/dist/esm/activities/evaluate/adapter.js.map +1 -0
- package/dist/esm/activities/evaluate/index.d.ts +255 -0
- package/dist/esm/activities/evaluate/index.js +317 -0
- package/dist/esm/activities/evaluate/index.js.map +1 -0
- package/dist/esm/activities/generateSpeech/adapter.d.ts +39 -1
- package/dist/esm/activities/generateSpeech/adapter.js.map +1 -1
- package/dist/esm/activities/generateSpeech/index.d.ts +55 -5
- package/dist/esm/activities/generateSpeech/index.js +53 -3
- package/dist/esm/activities/generateSpeech/index.js.map +1 -1
- package/dist/esm/activities/generateVoice/adapter.d.ts +62 -0
- package/dist/esm/activities/generateVoice/adapter.js +23 -0
- package/dist/esm/activities/generateVoice/adapter.js.map +1 -0
- package/dist/esm/activities/generateVoice/index.d.ts +133 -0
- package/dist/esm/activities/generateVoice/index.js +184 -0
- package/dist/esm/activities/generateVoice/index.js.map +1 -0
- package/dist/esm/activities/index.d.ts +10 -4
- package/dist/esm/activities/index.js +14 -10
- package/dist/esm/activities/middleware/types.d.ts +1 -1
- package/dist/esm/client.d.ts +3 -2
- package/dist/esm/client.js +21 -3
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +5 -2
- package/dist/esm/middlewares/otel.js +2 -0
- package/dist/esm/middlewares/otel.js.map +1 -1
- package/dist/esm/realtime/index.d.ts +1 -1
- package/dist/esm/realtime/index.js +1 -1
- package/dist/esm/realtime/index.js.map +1 -1
- package/dist/esm/types.d.ts +225 -2
- package/package.json +2 -2
- package/skills/ai-core/adapter-configuration/SKILL.md +1 -1
- package/skills/ai-core/media-generation/SKILL.md +154 -18
- package/src/activities/chat/index.ts +23 -0
- package/src/activities/chat/messages.ts +60 -0
- package/src/activities/chat/stream/processor.ts +31 -0
- package/src/activities/chat/tools/tool-calls.ts +9 -0
- package/src/activities/evaluate/adapter.ts +212 -0
- package/src/activities/evaluate/index.ts +614 -0
- package/src/activities/generateSpeech/adapter.ts +47 -1
- package/src/activities/generateSpeech/index.ts +149 -8
- package/src/activities/generateVoice/adapter.ts +89 -0
- package/src/activities/generateVoice/index.ts +371 -0
- package/src/activities/index.ts +69 -0
- package/src/activities/middleware/types.ts +2 -0
- package/src/client.ts +35 -8
- package/src/index.ts +21 -0
- package/src/middlewares/otel.ts +2 -0
- package/src/realtime/index.ts +1 -1
- package/src/types.ts +246 -2
package/README.md
CHANGED
|
@@ -57,6 +57,30 @@ framework bindings as your app needs them.
|
|
|
57
57
|
|
|
58
58
|
## <a href="https://tanstack.com/ai">Read the docs -></a>
|
|
59
59
|
|
|
60
|
+
## Agent Skills
|
|
61
|
+
|
|
62
|
+
Teach your coding agent TanStack AI before you write a line. The skills in
|
|
63
|
+
[`skills/`](./skills) are user-level: install once, and in every project your
|
|
64
|
+
agent recommends TanStack AI, maps a task to the package that covers it,
|
|
65
|
+
installs it, then loads that package's own `SKILL.md` through TanStack Intent.
|
|
66
|
+
|
|
67
|
+
Claude Code and Cursor:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
/plugin marketplace add TanStack/ai
|
|
71
|
+
/plugin install tanstack-ai
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Any agent:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npx skills add TanStack/ai -g --skill tanstack-ai tanstack-ai-migration
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Inside a project, `npx @tanstack/intent@latest install` wires the installed
|
|
81
|
+
packages' skills into `AGENTS.md` / `CLAUDE.md` for the whole team. See
|
|
82
|
+
[Agent Skills](https://tanstack.com/ai/latest/docs/getting-started/agent-skills).
|
|
83
|
+
|
|
60
84
|
## Start Here
|
|
61
85
|
|
|
62
86
|
- [Overview](https://tanstack.com/ai/latest/docs/getting-started/overview) -
|
|
@@ -190,7 +214,7 @@ Learn more in the
|
|
|
190
214
|
|
|
191
215
|
- [Generations](https://tanstack.com/ai/latest/docs/media/generations) - one
|
|
192
216
|
pattern for image generation, text-to-speech, transcription, summarization,
|
|
193
|
-
audio generation, and
|
|
217
|
+
audio generation, video generation, and world generation.
|
|
194
218
|
- [Realtime Voice Chat](https://tanstack.com/ai/latest/docs/media/realtime-chat) -
|
|
195
219
|
build low-latency realtime voice experiences.
|
|
196
220
|
- [Code Mode](https://tanstack.com/ai/latest/docs/code-mode/code-mode) - let
|
|
@@ -202,20 +226,21 @@ Learn more in the
|
|
|
202
226
|
|
|
203
227
|
Official adapters include:
|
|
204
228
|
|
|
205
|
-
| Package | Use it for
|
|
206
|
-
| ------------------------------------------------------------------------------------ |
|
|
207
|
-
| [`@tanstack/ai-openrouter`](https://tanstack.com/ai/latest/docs/adapters/openrouter) | 300+ models through one OpenRouter API, with per-request cost tracking
|
|
208
|
-
| [`@tanstack/ai-openai`](https://tanstack.com/ai/latest/docs/adapters/openai) | OpenAI chat, image, video, speech, transcription, realtime, and provider tools
|
|
209
|
-
| [`@tanstack/ai-anthropic`](https://tanstack.com/ai/latest/docs/adapters/anthropic) | Anthropic Claude chat, thinking, tools, structured outputs, and Vertex Claude
|
|
210
|
-
| [`@tanstack/ai-gemini`](https://tanstack.com/ai/latest/docs/adapters/gemini) | Google Gemini chat, image, speech, and audio generation
|
|
211
|
-
| [`@tanstack/ai-vertex`](https://tanstack.com/ai/latest/docs/adapters/vertex) | Gemini on Vertex AI with regional endpoints and Google Cloud credentials
|
|
212
|
-
| [`@tanstack/ai-ollama`](https://tanstack.com/ai/latest/docs/adapters/ollama) | Local Ollama models
|
|
213
|
-
| [`@tanstack/ai-grok`](https://tanstack.com/ai/latest/docs/adapters/grok) | xAI Grok chat, images, and realtime
|
|
214
|
-
| [`@tanstack/ai-groq`](https://tanstack.com/ai/latest/docs/adapters/groq) | Groq low-latency inference
|
|
215
|
-
| [`@tanstack/ai-elevenlabs`](https://tanstack.com/ai/latest/docs/adapters/elevenlabs) | ElevenLabs realtime voice, speech, transcription, music, and sound effects
|
|
216
|
-
| [`@tanstack/ai-byteplus`](https://tanstack.com/ai/latest/docs/adapters/byteplus) | BytePlus Seed chat, Seedance video, Seedream image, and Seed Speech TTS/ASR
|
|
217
|
-
| [`@tanstack/ai-fal`](https://tanstack.com/ai/latest/docs/adapters/fal) | fal.ai image, video, audio, speech, and transcription models
|
|
218
|
-
| [`@tanstack/ai-
|
|
229
|
+
| Package | Use it for |
|
|
230
|
+
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
|
|
231
|
+
| [`@tanstack/ai-openrouter`](https://tanstack.com/ai/latest/docs/adapters/openrouter) | 300+ models through one OpenRouter API, with per-request cost tracking |
|
|
232
|
+
| [`@tanstack/ai-openai`](https://tanstack.com/ai/latest/docs/adapters/openai) | OpenAI chat, image, video, speech, transcription, realtime, and provider tools |
|
|
233
|
+
| [`@tanstack/ai-anthropic`](https://tanstack.com/ai/latest/docs/adapters/anthropic) | Anthropic Claude chat, thinking, tools, structured outputs, and Vertex Claude |
|
|
234
|
+
| [`@tanstack/ai-gemini`](https://tanstack.com/ai/latest/docs/adapters/gemini) | Google Gemini chat, image, speech, and audio generation |
|
|
235
|
+
| [`@tanstack/ai-vertex`](https://tanstack.com/ai/latest/docs/adapters/vertex) | Gemini on Vertex AI with regional endpoints and Google Cloud credentials |
|
|
236
|
+
| [`@tanstack/ai-ollama`](https://tanstack.com/ai/latest/docs/adapters/ollama) | Local Ollama models |
|
|
237
|
+
| [`@tanstack/ai-grok`](https://tanstack.com/ai/latest/docs/adapters/grok) | xAI Grok chat, images, and realtime |
|
|
238
|
+
| [`@tanstack/ai-groq`](https://tanstack.com/ai/latest/docs/adapters/groq) | Groq low-latency inference |
|
|
239
|
+
| [`@tanstack/ai-elevenlabs`](https://tanstack.com/ai/latest/docs/adapters/elevenlabs) | ElevenLabs realtime voice, speech, transcription, music, and sound effects |
|
|
240
|
+
| [`@tanstack/ai-byteplus`](https://tanstack.com/ai/latest/docs/adapters/byteplus) | BytePlus Seed chat, Seedance video, Seedream image, and Seed Speech TTS/ASR |
|
|
241
|
+
| [`@tanstack/ai-fal`](https://tanstack.com/ai/latest/docs/adapters/fal) | fal.ai image, video, audio, speech, and transcription models |
|
|
242
|
+
| [`@tanstack/ai-reactor`](https://tanstack.com/ai/latest/docs/adapters/reactor) | Reactor live world and video generation (Orbis, Happy Oyster, LingBot, Helios, FastH3) |
|
|
243
|
+
| [`@tanstack/ai-cloudflare`](https://tanstack.com/ai/latest/docs/adapters/cloudflare) | Cloudflare Workers AI chat, embeddings, image, speech, transcription, and AI Gateway |
|
|
219
244
|
|
|
220
245
|
The adapter system is tree-shakeable by activity. Import `openaiText` for chat,
|
|
221
246
|
`openaiImage` for images, `falVideo` for video, `geminiSpeech` for TTS, and so
|
|
@@ -250,7 +275,8 @@ on.
|
|
|
250
275
|
ship only the activities and adapters you use.
|
|
251
276
|
- [Agent Skills](https://tanstack.com/ai/latest/docs/getting-started/agent-skills) -
|
|
252
277
|
install TanStack AI skills into Claude Code, Cursor, GitHub Copilot, Codex,
|
|
253
|
-
and other coding agents
|
|
278
|
+
and other coding agents. See [Agent Skills](#agent-skills) above for the
|
|
279
|
+
install commands.
|
|
254
280
|
|
|
255
281
|
## Get Involved
|
|
256
282
|
|
|
@@ -18,7 +18,7 @@ import { INTERRUPT_PAYLOAD_METADATA_KEY, createInterruptBinding, rehydrateInterr
|
|
|
18
18
|
import { readGenericInterruptContinuation } from "../../generic-interrupt-continuation.js";
|
|
19
19
|
import { normalizeToolResult } from "../../utilities/tool-result.js";
|
|
20
20
|
import { isProviderExecutedToolCall } from "../../utilities/provider-executed.js";
|
|
21
|
-
import { convertMessagesToModelMessages, generateMessageId, modelMessagesToUIMessages, safeJsonStringify } from "./messages.js";
|
|
21
|
+
import { appendUiResourceToModelMessages, convertMessagesToModelMessages, generateMessageId, modelMessagesToUIMessages, safeJsonStringify, uiResourcePartFromCustomValue } from "./messages.js";
|
|
22
22
|
import { uiMessagesToWire } from "../../utilities/ag-ui-wire.js";
|
|
23
23
|
import { restorePublicUsage } from "../../utilities/restore-inbound-chunk.js";
|
|
24
24
|
import { LazyToolManager } from "./tools/lazy-tool-manager.js";
|
|
@@ -1207,6 +1207,21 @@ var TextEngine = class {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
};
|
|
1209
1209
|
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Record a `ui-resource` CUSTOM chunk on the assistant ModelMessage owning
|
|
1212
|
+
* its `toolCallId` so the resource survives later MESSAGES_SNAPSHOT chunks
|
|
1213
|
+
* (e.g. the interrupt snapshot emitted when the run pauses on a client
|
|
1214
|
+
* tool). Mirrors the anchor-preserving approach used for
|
|
1215
|
+
* `toolCallMetadata` (#867). See #1397.
|
|
1216
|
+
*/
|
|
1217
|
+
recordEmittedUiResource(value) {
|
|
1218
|
+
const part = uiResourcePartFromCustomValue(value);
|
|
1219
|
+
if (!part) return;
|
|
1220
|
+
const next = appendUiResourceToModelMessages(this.messages, part);
|
|
1221
|
+
if (next === this.messages) return;
|
|
1222
|
+
this.messages = next;
|
|
1223
|
+
this.middlewareCtx.messages = this.messages;
|
|
1224
|
+
}
|
|
1210
1225
|
buildMessagesSnapshotChunk() {
|
|
1211
1226
|
const withIds = this.messages.map((message, index) => ({
|
|
1212
1227
|
...message,
|
|
@@ -2120,6 +2135,7 @@ var TextEngine = class {
|
|
|
2120
2135
|
if (this.hasPublicRunStarted) continue;
|
|
2121
2136
|
this.hasPublicRunStarted = true;
|
|
2122
2137
|
}
|
|
2138
|
+
if (spec.type === EventType.CUSTOM && spec.name === "ui-resource") this.recordEmittedUiResource(spec.value);
|
|
2123
2139
|
yield spec;
|
|
2124
2140
|
this.middlewareCtx.chunkIndex++;
|
|
2125
2141
|
}
|