[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-tanstack-ai-corechat-experience":3,"mdc-hnpkno-key":53,"related-repo-tanstack-ai-corechat-experience":12818,"related-org-tanstack-ai-corechat-experience":12911},{"slug":4,"name":5,"fn":6,"description":7,"org":8,"tags":12,"stars":24,"repoUrl":25,"updatedAt":26,"license":27,"forks":28,"topics":29,"repo":48,"sourceUrl":51,"mdContent":52},"ai-corechat-experience","ai-core\u002Fchat-experience","implement chat experiences with TanStack AI","End-to-end chat implementation: server endpoint with chat() and toServerSentEventsResponse(), client-side useChat hook with fetchServerSentEvents(), message rendering with UIMessage parts, multimodal content, thinking\u002Freasoning display. Covers streaming states, connection adapters, and message format conversions. NOT Vercel AI SDK — uses chat() not streamText().\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},"tanstack","TanStack","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftanstack.png",[13,17,20,21],{"name":14,"slug":15,"type":16},"LLM","llm","tag",{"name":18,"slug":19,"type":16},"API Development","api-development",{"name":10,"slug":9,"type":16},{"name":22,"slug":23,"type":16},"Frontend","frontend",2884,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Fai","2026-07-30T05:26:11.505241",null,269,[30,31,32,33,34,35,36,37,15,38,39,40,41,42,43,9,44,45,46,47],"ai","ai-agents","ai-sdk","anthropic","chatbot","function-calling","gemini","generative-ai","multimodal","openai","react","solidjs","streaming","svelte","tool-calling","typescript","typescript-sdk","vue",{"repoUrl":25,"stars":24,"forks":28,"topics":49,"description":50},[30,31,32,33,34,35,36,37,15,38,39,40,41,42,43,9,44,45,46,47],"🤖 Type-safe, provider-agnostic TypeScript AI SDK for streaming chat, tool calling, agents, and multimodal apps across OpenAI, Anthropic, Gemini, React, Vue, Svelte, and Solid.","https:\u002F\u002Fgithub.com\u002FTanStack\u002Fai\u002Ftree\u002FHEAD\u002Fpackages\u002Fai\u002Fskills\u002Fai-core\u002Fchat-experience","---\nname: ai-core\u002Fchat-experience\ndescription: >\n  End-to-end chat implementation: server endpoint with chat() and\n  toServerSentEventsResponse(), client-side useChat hook with\n  fetchServerSentEvents(), message rendering with UIMessage parts,\n  multimodal content, thinking\u002Freasoning display. Covers streaming\n  states, connection adapters, and message format conversions.\n  NOT Vercel AI SDK — uses chat() not streamText().\ntype: sub-skill\nlibrary: tanstack-ai\nlibrary_version: '0.10.0'\nsources:\n  - 'TanStack\u002Fai:docs\u002Fgetting-started\u002Fquick-start.md'\n  - 'TanStack\u002Fai:docs\u002Fchat\u002Fstreaming.md'\n  - 'TanStack\u002Fai:docs\u002Fchat\u002Fconnection-adapters.md'\n  - 'TanStack\u002Fai:docs\u002Fchat\u002Fthinking-content.md'\n  - 'TanStack\u002Fai:docs\u002Fadvanced\u002Fmultimodal-content.md'\n  - 'TanStack\u002Fai:docs\u002Fresumable-streams\u002Foverview.md'\n  - 'TanStack\u002Fai:docs\u002Fpersistence\u002Fclient-persistence.md'\n---\n\n# Chat Experience\n\nThis skill builds on ai-core. Read it first for critical rules.\n\n## Setup — Minimal Chat App\n\n### Server: API Route (TanStack Start)\n\n```typescript\n\u002F\u002F src\u002Froutes\u002Fapi.chat.ts\nimport { createFileRoute } from '@tanstack\u002Freact-router'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fchat')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const abortController = new AbortController()\n        const body = await request.json()\n        const { messages } = body\n\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          systemPrompts: ['You are a helpful assistant.'],\n          abortController,\n        })\n\n        return toServerSentEventsResponse(stream, { abortController })\n      },\n    },\n  },\n})\n```\n\n### Client: React Component\n\n```typescript\n\u002F\u002F src\u002Froutes\u002Findex.tsx\nimport { useState } from 'react'\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\nimport type { UIMessage } from '@tanstack\u002Fai-react'\n\nfunction ChatPage() {\n  const [input, setInput] = useState('')\n\n  const { messages, sendMessage, isLoading, error, stop } = useChat({\n    connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n  })\n\n  const handleSubmit = () => {\n    if (!input.trim()) return\n    sendMessage(input.trim())\n    setInput('')\n  }\n\n  return (\n    \u003Cdiv>\n      \u003Cdiv>\n        {messages.map((message: UIMessage) => (\n          \u003Cdiv key={message.id}>\n            \u003Cstrong>{message.role}:\u003C\u002Fstrong>\n            {message.parts.map((part, i) => {\n              if (part.type === 'text') {\n                return \u003Cp key={i}>{part.content}\u003C\u002Fp>\n              }\n              return null\n            })}\n          \u003C\u002Fdiv>\n        ))}\n      \u003C\u002Fdiv>\n\n      {error && \u003Cdiv>Error: {error.message}\u003C\u002Fdiv>}\n\n      \u003Cdiv>\n        \u003Cinput\n          value={input}\n          onChange={(e) => setInput(e.target.value)}\n          onKeyDown={(e) => {\n            if (e.key === 'Enter' && !e.shiftKey) {\n              e.preventDefault()\n              handleSubmit()\n            }\n          }}\n          disabled={isLoading}\n          placeholder=\"Type a message...\"\n        \u002F>\n        {isLoading ? (\n          \u003Cbutton onClick={stop}>Stop\u003C\u002Fbutton>\n        ) : (\n          \u003Cbutton onClick={handleSubmit} disabled={!input.trim()}>\n            Send\n          \u003C\u002Fbutton>\n        )}\n      \u003C\u002Fdiv>\n    \u003C\u002Fdiv>\n  )\n}\n```\n\nVue\u002FSolid\u002FSvelte\u002FPreact have identical patterns with different hook imports\n(e.g., `import { useChat } from '@tanstack\u002Fai-solid'`).\n\n## Core Patterns\n\n### 1. Streaming Chat with SSE\n\nServer returns a streaming SSE Response; client parses it automatically.\n\n**Server:**\n\n```typescript\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { anthropicText } from '@tanstack\u002Fai-anthropic'\n\nconst stream = chat({\n  adapter: anthropicText('claude-sonnet-4-5'),\n  messages,\n  modelOptions: {\n    temperature: 0.7,\n    max_tokens: 2000, \u002F\u002F Anthropic-native key\n  },\n  systemPrompts: ['You are a helpful assistant.'],\n  abortController,\n})\n\nreturn toServerSentEventsResponse(stream, { abortController })\n```\n\nTo make the SSE response resumable (reconnect after a drop\u002Frefresh without\nre-running the provider), pass a delivery-durability adapter:\n`toServerSentEventsResponse(stream, { durability: { adapter: memoryStream(request) } })`\n(`memoryStream` from `@tanstack\u002Fai` is process-local, for dev\u002Ftests) or\n`durableStream(request, { server })` from `@tanstack\u002Fai-durable-stream`\n(Durable Streams protocol, production). Each SSE event gets an opaque\nadapter-owned `id:`; `fetchServerSentEvents` auto-reconnects with\n`Last-Event-ID` and exposes `joinRun(runId)` to replay a run from the start.\nSee `docs\u002Fresumable-streams\u002Foverview.md`.\n\n**Client:**\n\n```typescript\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage, isLoading, error, stop, status } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n  body: { provider: 'anthropic', model: 'claude-sonnet-4-5' },\n  onFinish: (message) => {\n    console.log('Response complete:', message.id)\n  },\n  onError: (err) => {\n    console.error('Stream error:', err)\n  },\n})\n```\n\nThe `body` field is merged into the POST request body alongside `messages`,\nletting the server read `data.provider`, `data.model`, etc.\n\nThe `status` field tracks the chat lifecycle: `'ready'` | `'submitted'` | `'streaming'` | `'error'`.\n\n### 2. Rendering Thinking\u002FReasoning Content\n\nModels with extended thinking (Claude, Gemini) emit `ThinkingPart` in the message parts array.\n\n```typescript\nimport type { UIMessage } from '@tanstack\u002Fai-react'\n\nfunction MessageRenderer({ message }: { message: UIMessage }) {\n  return (\n    \u003Cdiv>\n      {message.parts.map((part, i) => {\n        if (part.type === 'thinking') {\n          const isComplete = message.parts\n            .slice(i + 1)\n            .some((p) => p.type === 'text')\n          return (\n            \u003Cdetails key={i} open={!isComplete}>\n              \u003Csummary>{isComplete ? 'Thought process' : 'Thinking...'}\u003C\u002Fsummary>\n              \u003Cpre>{part.content}\u003C\u002Fpre>\n            \u003C\u002Fdetails>\n          )\n        }\n\n        if (part.type === 'text' && part.content) {\n          return \u003Cp key={i}>{part.content}\u003C\u002Fp>\n        }\n\n        if (part.type === 'tool-call') {\n          return (\n            \u003Cdiv key={part.id}>\n              Tool call: {part.name} ({part.state})\n            \u003C\u002Fdiv>\n          )\n        }\n\n        return null\n      })}\n    \u003C\u002Fdiv>\n  )\n}\n```\n\nServer-side, enable thinking via `modelOptions` on the adapter:\n\n```typescript\nimport { geminiText } from '@tanstack\u002Fai-gemini'\n\nconst stream = chat({\n  adapter: geminiText('gemini-2.5-flash'),\n  messages,\n  modelOptions: {\n    thinkingConfig: {\n      includeThoughts: true,\n      thinkingBudget: 100,\n    },\n  },\n})\n```\n\n### 3. Sending Multimodal Content (Images)\n\nUse `sendMessage` with a `MultimodalContent` object instead of a plain string.\n\n```typescript\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\nimport type { ContentPart } from '@tanstack\u002Fai'\n\nconst { sendMessage } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n})\n\nfunction sendImageMessage(text: string, imageBase64: string, mimeType: string) {\n  const contentParts: Array\u003CContentPart> = [\n    { type: 'text', content: text },\n    {\n      type: 'image',\n      source: { type: 'data', value: imageBase64, mimeType },\n    },\n  ]\n\n  sendMessage({ content: contentParts })\n}\n\nfunction sendImageUrl(text: string, imageUrl: string) {\n  const contentParts: Array\u003CContentPart> = [\n    { type: 'text', content: text },\n    {\n      type: 'image',\n      source: { type: 'url', value: imageUrl },\n    },\n  ]\n\n  sendMessage({ content: contentParts })\n}\n```\n\nRender image parts in received messages:\n\n```typescript\nif (part.type === 'image') {\n  const src =\n    part.source.type === 'url'\n      ? part.source.value\n      : `data:${part.source.mimeType};base64,${part.source.value}`\n  return \u003Cimg key={i} src={src} alt=\"Attached image\" \u002F>\n}\n```\n\n### 4. Sending Audio Messages (Browser Recording)\n\nUse `useAudioRecorder` from `@tanstack\u002Fai-react` (or `createAudioRecorder` in Svelte) to capture audio in the browser. The resolved `AudioRecording` includes a ready-to-use `part` that slots directly into `sendMessage`.\n\n```typescript\nimport {\n  useAudioRecorder,\n  useChat,\n  fetchServerSentEvents,\n} from '@tanstack\u002Fai-react'\n\nconst { isRecording, isSupported, start, stop } = useAudioRecorder()\nconst { sendMessage } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n})\n\nasync function toggle() {\n  if (!isRecording) {\n    await start()\n    return\n  }\n  const recording = await stop()\n  await sendMessage({ content: [recording.part] })\n}\n```\n\n`recording.part` is `{ type: 'audio', source: { type: 'data', value: base64, mimeType } }`. Returns the recorder's native format (`audio\u002Fwebm` or `audio\u002Fmp4`) with no transcoding.\n\n### 5. HTTP Stream Format (Alternative to SSE)\n\nUse `toHttpResponse` + `fetchHttpStream` for newline-delimited JSON instead of SSE.\n\n**Server:**\n\n```typescript\nimport { chat, toHttpResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  abortController,\n})\n\nreturn toHttpResponse(stream, { abortController })\n```\n\n**Client:**\n\n```typescript\nimport { useChat, fetchHttpStream } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchHttpStream('\u002Fapi\u002Fchat'),\n})\n```\n\nThe only difference is swapping `toServerSentEventsResponse` \u002F `fetchServerSentEvents`\nfor `toHttpResponse` \u002F `fetchHttpStream`. Everything else stays identical.\n\nThis includes resumability: pass the same `durability` adapter to\n`toHttpResponse(stream, { durability: { adapter: memoryStream(request) } })` and\neach NDJSON line becomes an `{ id, chunk }` envelope. `fetchHttpStream`\nauto-reconnects with `Last-Event-ID`, de-dupes the replayed prefix, and exposes\n`joinRun(runId)` — the same guarantees as resumable SSE. The XHR adapters\n(`xhrServerSentEvents` \u002F `xhrHttpStream`) are resumable too.\n\n### 6. MCP Tool Discovery via `chat({ mcp })`\n\nPass `mcp` to let `chat()` own discovery **and** lifecycle for one or more MCP\nclients. Useful when you want minimal boilerplate and don't need to reuse the\nclients across calls.\n\n```typescript\n\u002F\u002F Prop shape:\n\u002F\u002F chat({\n\u002F\u002F   ...,\n\u002F\u002F   mcp: {\n\u002F\u002F     clients: Array\u003CMCPClient | MCPClients>,\n\u002F\u002F     connection?: 'close' | 'keep-alive',  \u002F\u002F default: 'close'\n\u002F\u002F     lazyTools?: boolean,\n\u002F\u002F     onDiscoveryError?: (error: unknown, source) => void,\n\u002F\u002F   }\n\u002F\u002F })\n```\n\n- **`clients`** — one or more `MCPClient` \u002F `MCPClients` instances.\n- **`connection`** — `'close'` (default) closes each client when the run ends\n  (after the agent loop completes and the stream is drained); with\n  `'keep-alive'`, `chat()` never closes the clients — the caller owns their\n  lifecycle (keep connections warm across requests).\n- **`lazyTools`** — forwarded to `tools({ lazy: true })` so tool schemas are\n  sent to the LLM on demand.\n- **`onDiscoveryError`** — throw (or re-throw) to fail the entire call fast;\n  return normally to skip that source and continue. Omit to rethrow (fail-fast).\n\n**When to use `mcp` vs. the tools spread:**\n\n| Approach                                                | Use when                                                                                        |\n| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |\n| `chat({ mcp: { clients: [...] } })`                     | You want discovery + lifecycle managed for you, and don't need fully-typed input\u002Foutput schemas |\n| `tools: [...await client.tools([toolDefinition(...)])]` | You want fully-typed MCP tools with Zod input\u002Foutput validation                                 |\n\n**Server-side example:**\n\n```typescript\nimport { createFileRoute } from '@tanstack\u002Freact-router'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fchat')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const { messages } = await request.json()\n\n        const mcpClient = await createMCPClient({\n          transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n        })\n\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          mcp: {\n            clients: [mcpClient],\n            connection: 'keep-alive', \u002F\u002F chat() won't close it — reuse across requests\n          },\n        })\n\n        return toServerSentEventsResponse(stream)\n        \u002F\u002F connection: 'keep-alive' — chat() never closes mcpClient; it stays open for reuse across runs.\n      },\n    },\n  },\n})\n```\n\n### 7. Queueing Messages Sent While Streaming\n\nBy default, a `sendMessage` call that arrives while a stream is in flight is\n**queued** and sent automatically once the run settles **successfully** —\nthis is a behavior change: such sends used to be silently dropped. Configure\nit with the `queue` option on `useChat`:\n\n```typescript\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, queue, sendMessage, cancelQueued, isLoading } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n  queue: { whenBusy: 'queue', drain: 'fifo', maxSize: 5, onOverflow: 'reject' },\n})\n```\n\n- **`whenBusy`** — `'queue'` (default) holds the message until a successful\n  settle; `'drop'` ignores the send (never appears in `queue`\u002F`messages`);\n  `'interrupt'` aborts the current stream and sends immediately (unlike\n  `stop()`, does **not** flush already-queued items — they drain after the\n  interrupting send **succeeds**).\n- **`drain`** — `'fifo'` (default) sends queued items one at a time in\n  order; `'batch'` merges everything queued into a single send once the\n  run settles successfully.\n- **`maxSize`** \u002F **`onOverflow`** — cap the queue length; `'reject'`\n  (default) silently ignores overflow sends (does not throw),\n  `'drop-oldest'` evicts the oldest queued item to make room.\n\nThe top-level `queue` option also accepts a plain `WhenBusy` string\nshorthand (e.g. `queue: 'interrupt'`) or a `QueueStrategy` function for\nper-send action control. Strategy form always drains FIFO; actions are\n`'queue' | 'drop' | 'interrupt'`.\n\n**Drain vs flush:** queued messages auto-send only after a **successful**\nsettle. They are **discarded** on stream error\u002Fabort of the active\ngeneration, `stop()`, `clear()`, `unsubscribe()`, and `reload()`.\n`interrupt` does not flush.\n\n`queue: Array\u003CQueuedMessage>` (`{ id, content, createdAt }`) is separate\nfrom `messages` — render pending sends distinctly and cancel with\n`cancelQueued(id)`:\n\n```typescript\n{queue.map((q) => (\n  \u003Cdiv key={q.id}>\n    {typeof q.content === 'string' ? q.content : '[attachment]'}\n    \u003Cbutton onClick={() => cancelQueued(q.id)}>Cancel\u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n))}\n```\n\nOverride the configured policy for a single send with the second argument\nto `sendMessage`:\n\n```typescript\nsendMessage('Never mind, do this instead', { whenBusy: 'interrupt' })\n```\n\n### 8. Browser-Refresh Durability (client persistence)\n\nBy default a `ChatClient` \u002F `useChat` keeps messages in memory only, so a full\npage reload loses the conversation. The optional `persistence` option (a\n`ChatClientPersistence` adapter) fixes this from the client side: it stores one\ncombined record — `{ messages, resume? }` (`ChatPersistedState`) — per chat `id`,\nso a reload restores the transcript **and** rehydrates any pending interrupt \u002F\nrejoins a run that was still streaming. No manual `initialMessages` + `onFinish`\nboilerplate.\n\nThree storage adapters ship from `@tanstack\u002Fai-client`:\n`localStoragePersistence` (survives reloads and browser restarts),\n`sessionStoragePersistence` (scoped to the tab), and `indexedDBPersistence`\n(async, structured-clone storage — no codec needed for `Date`\u002F`Map`\u002Fetc.).\nGive the chat a stable `threadId` so the reload finds the same record.\nPersistence keys on `threadId`; the storage adapters are re-exported from each\nframework package, so a single import works:\n\n```typescript\nimport {\n  useChat,\n  fetchServerSentEvents,\n  localStoragePersistence,\n} from '@tanstack\u002Fai-react'\n\n\u002F\u002F Defaults to the ChatPersistedState shape and a JSON codec, so no type\n\u002F\u002F argument or serialize\u002Fdeserialize is needed. indexedDBPersistence stores via\n\u002F\u002F structured clone (a Date round-trips exactly).\nconst persistence = localStoragePersistence()\n\nfunction Chat() {\n  const { messages, sendMessage } = useChat({\n    threadId: 'support-chat',\n    connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n    persistence,\n  })\n  \u002F\u002F ...render messages, call sendMessage(text)\n}\n```\n\n**Keep large transcripts off the client.** `persistence` also accepts `true`\n(server-authoritative): the client caches nothing, and on mount it hydrates the\nthread from the server by `threadId` (transcript plus a cursor to any run still\ngenerating). An adapter is client-authoritative; `true` leaves history on the\nserver and needs a connection with a `hydrate` handler plus a server GET\nendpoint (`reconstructChat`), since the delivery log only holds one run.\n\n**Mid-stream reload rejoin.** If the run was still streaming when the page\nreloaded, the client re-attaches instead of showing a frozen half-reply — but\nonly when the connection is **resumable**: a delivery-durability-backed route\nthat records the stream and exposes a GET replay handler (see\n`docs\u002Fresumable-streams\u002Foverview.md` and Pattern 1's `durability` adapter). Given\nthat, `useChat` finds the persisted in-flight run on load and auto-rejoins it via\n`joinRun`, replaying from the server's log so the reply finishes where it left\noff. No extra client code beyond the resumable connection.\n\n**Every framework, no extra code.** Durability rides the existing `persistence`\noption, so it works identically in `@tanstack\u002Fai-react`, `-solid`, `-vue`,\n`-svelte`, `-angular`, and `-preact` — pass `persistence` (and a stable\n`threadId`, which is the chat's identity) to the framework's `useChat` \u002F\n`createChat` \u002F `injectChat`; nothing is framework-specific.\n\n> **Client vs. server durability.** This is the client (per-browser) half.\n> The authoritative, multi-user, server-side copy is the `withPersistence`\n> middleware — see ai-core\u002Fmiddleware\u002FSKILL.md. The two are independent; use\n> both for instant reload restore plus a durable record of record.\n\n## Common Mistakes\n\n### a. CRITICAL: Using Vercel AI SDK patterns (streamText, generateText)\n\n```typescript\n\u002F\u002F WRONG\nimport { streamText } from 'ai'\nimport { openai } from '@ai-sdk\u002Fopenai'\nconst result = streamText({ model: openai('gpt-5.5'), messages })\n\n\u002F\u002F CORRECT\nimport { chat } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nconst stream = chat({ adapter: openaiText('gpt-5.5'), messages })\n```\n\n### b. CRITICAL: Using Vercel createOpenAI() provider pattern\n\n```typescript\n\u002F\u002F WRONG\nimport { createOpenAI } from '@ai-sdk\u002Fopenai'\nconst openai = createOpenAI({ apiKey })\nstreamText({ model: openai('gpt-5.5'), messages })\n\n\u002F\u002F CORRECT\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { chat } from '@tanstack\u002Fai'\nchat({ adapter: openaiText('gpt-5.5'), messages })\n```\n\n### c. CRITICAL: Using monolithic openai() instead of openaiText()\n\n```typescript\n\u002F\u002F WRONG\nimport { openai } from '@tanstack\u002Fai-openai'\nchat({ adapter: openai(), model: 'gpt-5.5', messages })\n\n\u002F\u002F CORRECT\nimport { openaiText } from '@tanstack\u002Fai-openai'\nchat({ adapter: openaiText('gpt-5.5'), messages })\n```\n\nThe monolithic `openai()` adapter is deprecated. Use tree-shakeable adapters:\n`openaiText()`, `openaiImage()`, `openaiSpeech()`, etc.\n\n### d. HIGH: Using toResponseStream instead of toServerSentEventsResponse\n\n```typescript\n\u002F\u002F WRONG\nimport { toResponseStream } from '@tanstack\u002Fai'\nreturn toResponseStream(stream, { abortController })\n\n\u002F\u002F CORRECT\nimport { toServerSentEventsResponse } from '@tanstack\u002Fai'\nreturn toServerSentEventsResponse(stream, { abortController })\n```\n\n### e. HIGH: Passing model as separate parameter to chat()\n\n```typescript\n\u002F\u002F WRONG\nchat({ adapter: openaiText(), model: 'gpt-5.5', messages })\n\n\u002F\u002F CORRECT\nchat({ adapter: openaiText('gpt-5.5'), messages })\n```\n\nThe model is passed to the adapter factory, not to `chat()`.\n\n### f. HIGH: Passing sampling options at the root of chat()\n\nSampling options (`temperature`, token limits, `top_p`\u002F`topP`) are **not**\ntop-level fields on `chat()`. They live inside `modelOptions` using the\nprovider's native key.\n\n```typescript\n\u002F\u002F WRONG — temperature\u002FmaxTokens are not root options\nchat({ adapter, messages, temperature: 0.7, maxTokens: 1000 })\n\n\u002F\u002F WRONG — there is no `options` field either\nchat({ adapter, messages, options: { temperature: 0.7, maxTokens: 1000 } })\n\n\u002F\u002F CORRECT — inside modelOptions, provider-native keys (OpenAI shown)\nchat({\n  adapter,\n  messages,\n  modelOptions: { temperature: 0.7, max_output_tokens: 1000 },\n})\n```\n\n`temperature` is universal across providers; token limits use provider-native\nkeys (`max_output_tokens` for OpenAI, `max_tokens` for Anthropic\u002FGrok,\n`maxOutputTokens` for Gemini, `max_completion_tokens` for Groq,\n`maxCompletionTokens` for OpenRouter, and `num_predict` nested under\n`modelOptions.options` for Ollama). See ai-core\u002Fadapter-configuration\u002FSKILL.md.\n\n### g. HIGH: Using providerOptions instead of modelOptions\n\n```typescript\n\u002F\u002F WRONG\nchat({\n  adapter,\n  messages,\n  providerOptions: { responseFormat: { type: 'json_object' } },\n})\n\n\u002F\u002F CORRECT\nchat({\n  adapter,\n  messages,\n  modelOptions: { responseFormat: { type: 'json_object' } },\n})\n```\n\n### h. HIGH: Implementing custom SSE stream instead of using toServerSentEventsResponse\n\n```typescript\n\u002F\u002F WRONG\nconst readable = new ReadableStream({\n  async start(controller) {\n    const encoder = new TextEncoder()\n    for await (const chunk of stream) {\n      controller.enqueue(encoder.encode(`data: ${JSON.stringify(chunk)}\\n\\n`))\n    }\n    controller.enqueue(encoder.encode('data: [DONE]\\n\\n'))\n    controller.close()\n  },\n})\nreturn new Response(readable, {\n  headers: { 'Content-Type': 'text\u002Fevent-stream' },\n})\n\n\u002F\u002F CORRECT\nimport { toServerSentEventsResponse } from '@tanstack\u002Fai'\nreturn toServerSentEventsResponse(stream, { abortController })\n```\n\n`toServerSentEventsResponse` handles SSE formatting, abort signals,\nerror events (RUN_ERROR), and correct headers automatically.\n\n### i. HIGH: Implementing custom onEnd\u002FonFinish callbacks instead of middleware\n\n```typescript\n\u002F\u002F WRONG\nchat({\n  adapter,\n  messages,\n  onEnd: (result) => {\n    trackAnalytics(result)\n  },\n})\n\n\u002F\u002F CORRECT\nimport type { ChatMiddleware } from '@tanstack\u002Fai'\n\nconst analytics: ChatMiddleware = {\n  name: 'analytics',\n  onFinish(ctx, info) {\n    trackAnalytics({ reason: info.finishReason, iterations: ctx.iteration })\n  },\n  onUsage(ctx, usage) {\n    trackTokens(usage.totalTokens)\n  },\n}\n\nchat({ adapter, messages, middleware: [analytics] })\n```\n\n`chat()` has no `onEnd`\u002F`onFinish` option. Use `middleware` for lifecycle events.\nSee also: ai-core\u002Fmiddleware\u002FSKILL.md.\n\n### j. HIGH: Importing from @tanstack\u002Fai-client instead of framework package\n\n```typescript\n\u002F\u002F WRONG\nimport { fetchServerSentEvents } from '@tanstack\u002Fai-client'\nimport { useChat } from '@tanstack\u002Fai-react'\n\n\u002F\u002F CORRECT\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n```\n\nFramework packages re-export everything needed from `@tanstack\u002Fai-client`.\nImport from `@tanstack\u002Fai-client` only in vanilla JS (no framework).\n\n### k. MEDIUM: Not handling RUN_ERROR events in streaming context\n\nStreaming errors arrive as `RUN_ERROR` events in the stream, not as thrown\nexceptions. The `useChat` hook surfaces these via the `error` state and\n`onError` callback. If you consume the stream manually (without `useChat`),\ncheck for `RUN_ERROR` chunks:\n\n```typescript\nfor await (const chunk of stream) {\n  if (chunk.type === 'RUN_ERROR') {\n    console.error('Stream error:', chunk.error.message)\n    break\n  }\n  if (chunk.type === 'TEXT_MESSAGE_CONTENT') {\n    process.stdout.write(chunk.delta)\n  }\n}\n```\n\nIf not handled, the UI appears to hang with no feedback.\n\n## Cross-References\n\n- See also: **ai-core\u002Ftool-calling\u002FSKILL.md** -- Most chats include tools\n- See also: **ai-core\u002Fadapter-configuration\u002FSKILL.md** -- Adapter choice affects available features\n- See also: **ai-core\u002Fmiddleware\u002FSKILL.md** -- Use middleware for analytics and lifecycle events\n- See also: **`@tanstack\u002Fai-persistence` skills** (`skills\u002Fai-persistence\u002FSKILL.md` in that package) -- Server + client state persistence, store contracts, adapter recipes (deeper than Pattern 8)\n",{"data":54,"body":66},{"name":5,"description":7,"type":55,"library":56,"library_version":57,"sources":58},"sub-skill","tanstack-ai","0.10.0",[59,60,61,62,63,64,65],"TanStack\u002Fai:docs\u002Fgetting-started\u002Fquick-start.md","TanStack\u002Fai:docs\u002Fchat\u002Fstreaming.md","TanStack\u002Fai:docs\u002Fchat\u002Fconnection-adapters.md","TanStack\u002Fai:docs\u002Fchat\u002Fthinking-content.md","TanStack\u002Fai:docs\u002Fadvanced\u002Fmultimodal-content.md","TanStack\u002Fai:docs\u002Fresumable-streams\u002Foverview.md","TanStack\u002Fai:docs\u002Fpersistence\u002Fclient-persistence.md",{"type":67,"children":68},"root",[69,78,84,91,98,759,765,2283,2296,2302,2308,2313,2321,2672,2754,2762,3192,3228,3269,3275,3288,4204,4217,4445,4451,4472,5294,5299,5611,5617,5664,6079,6114,6120,6140,6147,6381,6388,6539,6572,6637,6649,6677,6769,6875,6890,6952,6960,7648,7654,7695,7983,8126,8169,8230,8262,8499,8510,8577,8583,8661,8728,9035,9090,9136,9231,9253,9259,9265,9591,9597,9900,9906,10138,10172,10178,10347,10353,10515,10526,10532,10580,10875,10941,10947,11184,11190,11705,11715,11721,12210,12242,12248,12389,12408,12414,12463,12740,12745,12751,12812],{"type":70,"tag":71,"props":72,"children":74},"element","h1",{"id":73},"chat-experience",[75],{"type":76,"value":77},"text","Chat Experience",{"type":70,"tag":79,"props":80,"children":81},"p",{},[82],{"type":76,"value":83},"This skill builds on ai-core. Read it first for critical rules.",{"type":70,"tag":85,"props":86,"children":88},"h2",{"id":87},"setup-minimal-chat-app",[89],{"type":76,"value":90},"Setup — Minimal Chat App",{"type":70,"tag":92,"props":93,"children":95},"h3",{"id":94},"server-api-route-tanstack-start",[96],{"type":76,"value":97},"Server: API Route (TanStack Start)",{"type":70,"tag":99,"props":100,"children":104},"pre",{"className":101,"code":102,"language":45,"meta":103,"style":103},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F src\u002Froutes\u002Fapi.chat.ts\nimport { createFileRoute } from '@tanstack\u002Freact-router'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fchat')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const abortController = new AbortController()\n        const body = await request.json()\n        const { messages } = body\n\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          systemPrompts: ['You are a helpful assistant.'],\n          abortController,\n        })\n\n        return toServerSentEventsResponse(stream, { abortController })\n      },\n    },\n  },\n})\n","",[105],{"type":70,"tag":106,"props":107,"children":108},"code",{"__ignoreMap":103},[109,121,169,217,255,265,324,344,361,404,438,478,508,516,545,589,602,642,655,669,677,719,728,737,746],{"type":70,"tag":110,"props":111,"children":114},"span",{"class":112,"line":113},"line",1,[115],{"type":70,"tag":110,"props":116,"children":118},{"style":117},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[119],{"type":76,"value":120},"\u002F\u002F src\u002Froutes\u002Fapi.chat.ts\n",{"type":70,"tag":110,"props":122,"children":124},{"class":112,"line":123},2,[125,131,137,143,148,153,158,164],{"type":70,"tag":110,"props":126,"children":128},{"style":127},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[129],{"type":76,"value":130},"import",{"type":70,"tag":110,"props":132,"children":134},{"style":133},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[135],{"type":76,"value":136}," {",{"type":70,"tag":110,"props":138,"children":140},{"style":139},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[141],{"type":76,"value":142}," createFileRoute",{"type":70,"tag":110,"props":144,"children":145},{"style":133},[146],{"type":76,"value":147}," }",{"type":70,"tag":110,"props":149,"children":150},{"style":127},[151],{"type":76,"value":152}," from",{"type":70,"tag":110,"props":154,"children":155},{"style":133},[156],{"type":76,"value":157}," '",{"type":70,"tag":110,"props":159,"children":161},{"style":160},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[162],{"type":76,"value":163},"@tanstack\u002Freact-router",{"type":70,"tag":110,"props":165,"children":166},{"style":133},[167],{"type":76,"value":168},"'\n",{"type":70,"tag":110,"props":170,"children":172},{"class":112,"line":171},3,[173,177,181,186,191,196,200,204,208,213],{"type":70,"tag":110,"props":174,"children":175},{"style":127},[176],{"type":76,"value":130},{"type":70,"tag":110,"props":178,"children":179},{"style":133},[180],{"type":76,"value":136},{"type":70,"tag":110,"props":182,"children":183},{"style":139},[184],{"type":76,"value":185}," chat",{"type":70,"tag":110,"props":187,"children":188},{"style":133},[189],{"type":76,"value":190},",",{"type":70,"tag":110,"props":192,"children":193},{"style":139},[194],{"type":76,"value":195}," toServerSentEventsResponse",{"type":70,"tag":110,"props":197,"children":198},{"style":133},[199],{"type":76,"value":147},{"type":70,"tag":110,"props":201,"children":202},{"style":127},[203],{"type":76,"value":152},{"type":70,"tag":110,"props":205,"children":206},{"style":133},[207],{"type":76,"value":157},{"type":70,"tag":110,"props":209,"children":210},{"style":160},[211],{"type":76,"value":212},"@tanstack\u002Fai",{"type":70,"tag":110,"props":214,"children":215},{"style":133},[216],{"type":76,"value":168},{"type":70,"tag":110,"props":218,"children":220},{"class":112,"line":219},4,[221,225,229,234,238,242,246,251],{"type":70,"tag":110,"props":222,"children":223},{"style":127},[224],{"type":76,"value":130},{"type":70,"tag":110,"props":226,"children":227},{"style":133},[228],{"type":76,"value":136},{"type":70,"tag":110,"props":230,"children":231},{"style":139},[232],{"type":76,"value":233}," openaiText",{"type":70,"tag":110,"props":235,"children":236},{"style":133},[237],{"type":76,"value":147},{"type":70,"tag":110,"props":239,"children":240},{"style":127},[241],{"type":76,"value":152},{"type":70,"tag":110,"props":243,"children":244},{"style":133},[245],{"type":76,"value":157},{"type":70,"tag":110,"props":247,"children":248},{"style":160},[249],{"type":76,"value":250},"@tanstack\u002Fai-openai",{"type":70,"tag":110,"props":252,"children":253},{"style":133},[254],{"type":76,"value":168},{"type":70,"tag":110,"props":256,"children":258},{"class":112,"line":257},5,[259],{"type":70,"tag":110,"props":260,"children":262},{"emptyLinePlaceholder":261},true,[263],{"type":76,"value":264},"\n",{"type":70,"tag":110,"props":266,"children":268},{"class":112,"line":267},6,[269,274,280,285,290,295,300,305,310,314,319],{"type":70,"tag":110,"props":270,"children":271},{"style":127},[272],{"type":76,"value":273},"export",{"type":70,"tag":110,"props":275,"children":277},{"style":276},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[278],{"type":76,"value":279}," const",{"type":70,"tag":110,"props":281,"children":282},{"style":139},[283],{"type":76,"value":284}," Route ",{"type":70,"tag":110,"props":286,"children":287},{"style":133},[288],{"type":76,"value":289},"=",{"type":70,"tag":110,"props":291,"children":293},{"style":292},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[294],{"type":76,"value":142},{"type":70,"tag":110,"props":296,"children":297},{"style":139},[298],{"type":76,"value":299},"(",{"type":70,"tag":110,"props":301,"children":302},{"style":133},[303],{"type":76,"value":304},"'",{"type":70,"tag":110,"props":306,"children":307},{"style":160},[308],{"type":76,"value":309},"\u002Fapi\u002Fchat",{"type":70,"tag":110,"props":311,"children":312},{"style":133},[313],{"type":76,"value":304},{"type":70,"tag":110,"props":315,"children":316},{"style":139},[317],{"type":76,"value":318},")(",{"type":70,"tag":110,"props":320,"children":321},{"style":133},[322],{"type":76,"value":323},"{\n",{"type":70,"tag":110,"props":325,"children":327},{"class":112,"line":326},7,[328,334,339],{"type":70,"tag":110,"props":329,"children":331},{"style":330},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[332],{"type":76,"value":333},"  server",{"type":70,"tag":110,"props":335,"children":336},{"style":133},[337],{"type":76,"value":338},":",{"type":70,"tag":110,"props":340,"children":341},{"style":133},[342],{"type":76,"value":343}," {\n",{"type":70,"tag":110,"props":345,"children":347},{"class":112,"line":346},8,[348,353,357],{"type":70,"tag":110,"props":349,"children":350},{"style":330},[351],{"type":76,"value":352},"    handlers",{"type":70,"tag":110,"props":354,"children":355},{"style":133},[356],{"type":76,"value":338},{"type":70,"tag":110,"props":358,"children":359},{"style":133},[360],{"type":76,"value":343},{"type":70,"tag":110,"props":362,"children":364},{"class":112,"line":363},9,[365,370,374,379,384,390,395,400],{"type":70,"tag":110,"props":366,"children":367},{"style":292},[368],{"type":76,"value":369},"      POST",{"type":70,"tag":110,"props":371,"children":372},{"style":133},[373],{"type":76,"value":338},{"type":70,"tag":110,"props":375,"children":376},{"style":276},[377],{"type":76,"value":378}," async",{"type":70,"tag":110,"props":380,"children":381},{"style":133},[382],{"type":76,"value":383}," ({",{"type":70,"tag":110,"props":385,"children":387},{"style":386},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[388],{"type":76,"value":389}," request",{"type":70,"tag":110,"props":391,"children":392},{"style":133},[393],{"type":76,"value":394}," })",{"type":70,"tag":110,"props":396,"children":397},{"style":276},[398],{"type":76,"value":399}," =>",{"type":70,"tag":110,"props":401,"children":402},{"style":133},[403],{"type":76,"value":343},{"type":70,"tag":110,"props":405,"children":407},{"class":112,"line":406},10,[408,413,418,423,428,433],{"type":70,"tag":110,"props":409,"children":410},{"style":276},[411],{"type":76,"value":412},"        const",{"type":70,"tag":110,"props":414,"children":415},{"style":139},[416],{"type":76,"value":417}," abortController",{"type":70,"tag":110,"props":419,"children":420},{"style":133},[421],{"type":76,"value":422}," =",{"type":70,"tag":110,"props":424,"children":425},{"style":133},[426],{"type":76,"value":427}," new",{"type":70,"tag":110,"props":429,"children":430},{"style":292},[431],{"type":76,"value":432}," AbortController",{"type":70,"tag":110,"props":434,"children":435},{"style":330},[436],{"type":76,"value":437},"()\n",{"type":70,"tag":110,"props":439,"children":441},{"class":112,"line":440},11,[442,446,451,455,460,464,469,474],{"type":70,"tag":110,"props":443,"children":444},{"style":276},[445],{"type":76,"value":412},{"type":70,"tag":110,"props":447,"children":448},{"style":139},[449],{"type":76,"value":450}," body",{"type":70,"tag":110,"props":452,"children":453},{"style":133},[454],{"type":76,"value":422},{"type":70,"tag":110,"props":456,"children":457},{"style":127},[458],{"type":76,"value":459}," await",{"type":70,"tag":110,"props":461,"children":462},{"style":139},[463],{"type":76,"value":389},{"type":70,"tag":110,"props":465,"children":466},{"style":133},[467],{"type":76,"value":468},".",{"type":70,"tag":110,"props":470,"children":471},{"style":292},[472],{"type":76,"value":473},"json",{"type":70,"tag":110,"props":475,"children":476},{"style":330},[477],{"type":76,"value":437},{"type":70,"tag":110,"props":479,"children":481},{"class":112,"line":480},12,[482,486,490,495,499,503],{"type":70,"tag":110,"props":483,"children":484},{"style":276},[485],{"type":76,"value":412},{"type":70,"tag":110,"props":487,"children":488},{"style":133},[489],{"type":76,"value":136},{"type":70,"tag":110,"props":491,"children":492},{"style":139},[493],{"type":76,"value":494}," messages",{"type":70,"tag":110,"props":496,"children":497},{"style":133},[498],{"type":76,"value":147},{"type":70,"tag":110,"props":500,"children":501},{"style":133},[502],{"type":76,"value":422},{"type":70,"tag":110,"props":504,"children":505},{"style":139},[506],{"type":76,"value":507}," body\n",{"type":70,"tag":110,"props":509,"children":511},{"class":112,"line":510},13,[512],{"type":70,"tag":110,"props":513,"children":514},{"emptyLinePlaceholder":261},[515],{"type":76,"value":264},{"type":70,"tag":110,"props":517,"children":519},{"class":112,"line":518},14,[520,524,529,533,537,541],{"type":70,"tag":110,"props":521,"children":522},{"style":276},[523],{"type":76,"value":412},{"type":70,"tag":110,"props":525,"children":526},{"style":139},[527],{"type":76,"value":528}," stream",{"type":70,"tag":110,"props":530,"children":531},{"style":133},[532],{"type":76,"value":422},{"type":70,"tag":110,"props":534,"children":535},{"style":292},[536],{"type":76,"value":185},{"type":70,"tag":110,"props":538,"children":539},{"style":330},[540],{"type":76,"value":299},{"type":70,"tag":110,"props":542,"children":543},{"style":133},[544],{"type":76,"value":323},{"type":70,"tag":110,"props":546,"children":548},{"class":112,"line":547},15,[549,554,558,562,566,570,575,579,584],{"type":70,"tag":110,"props":550,"children":551},{"style":330},[552],{"type":76,"value":553},"          adapter",{"type":70,"tag":110,"props":555,"children":556},{"style":133},[557],{"type":76,"value":338},{"type":70,"tag":110,"props":559,"children":560},{"style":292},[561],{"type":76,"value":233},{"type":70,"tag":110,"props":563,"children":564},{"style":330},[565],{"type":76,"value":299},{"type":70,"tag":110,"props":567,"children":568},{"style":133},[569],{"type":76,"value":304},{"type":70,"tag":110,"props":571,"children":572},{"style":160},[573],{"type":76,"value":574},"gpt-5.5",{"type":70,"tag":110,"props":576,"children":577},{"style":133},[578],{"type":76,"value":304},{"type":70,"tag":110,"props":580,"children":581},{"style":330},[582],{"type":76,"value":583},")",{"type":70,"tag":110,"props":585,"children":586},{"style":133},[587],{"type":76,"value":588},",\n",{"type":70,"tag":110,"props":590,"children":592},{"class":112,"line":591},16,[593,598],{"type":70,"tag":110,"props":594,"children":595},{"style":139},[596],{"type":76,"value":597},"          messages",{"type":70,"tag":110,"props":599,"children":600},{"style":133},[601],{"type":76,"value":588},{"type":70,"tag":110,"props":603,"children":605},{"class":112,"line":604},17,[606,611,615,620,624,629,633,638],{"type":70,"tag":110,"props":607,"children":608},{"style":330},[609],{"type":76,"value":610},"          systemPrompts",{"type":70,"tag":110,"props":612,"children":613},{"style":133},[614],{"type":76,"value":338},{"type":70,"tag":110,"props":616,"children":617},{"style":330},[618],{"type":76,"value":619}," [",{"type":70,"tag":110,"props":621,"children":622},{"style":133},[623],{"type":76,"value":304},{"type":70,"tag":110,"props":625,"children":626},{"style":160},[627],{"type":76,"value":628},"You are a helpful assistant.",{"type":70,"tag":110,"props":630,"children":631},{"style":133},[632],{"type":76,"value":304},{"type":70,"tag":110,"props":634,"children":635},{"style":330},[636],{"type":76,"value":637},"]",{"type":70,"tag":110,"props":639,"children":640},{"style":133},[641],{"type":76,"value":588},{"type":70,"tag":110,"props":643,"children":645},{"class":112,"line":644},18,[646,651],{"type":70,"tag":110,"props":647,"children":648},{"style":139},[649],{"type":76,"value":650},"          abortController",{"type":70,"tag":110,"props":652,"children":653},{"style":133},[654],{"type":76,"value":588},{"type":70,"tag":110,"props":656,"children":658},{"class":112,"line":657},19,[659,664],{"type":70,"tag":110,"props":660,"children":661},{"style":133},[662],{"type":76,"value":663},"        }",{"type":70,"tag":110,"props":665,"children":666},{"style":330},[667],{"type":76,"value":668},")\n",{"type":70,"tag":110,"props":670,"children":672},{"class":112,"line":671},20,[673],{"type":70,"tag":110,"props":674,"children":675},{"emptyLinePlaceholder":261},[676],{"type":76,"value":264},{"type":70,"tag":110,"props":678,"children":680},{"class":112,"line":679},21,[681,686,690,694,699,703,707,711,715],{"type":70,"tag":110,"props":682,"children":683},{"style":127},[684],{"type":76,"value":685},"        return",{"type":70,"tag":110,"props":687,"children":688},{"style":292},[689],{"type":76,"value":195},{"type":70,"tag":110,"props":691,"children":692},{"style":330},[693],{"type":76,"value":299},{"type":70,"tag":110,"props":695,"children":696},{"style":139},[697],{"type":76,"value":698},"stream",{"type":70,"tag":110,"props":700,"children":701},{"style":133},[702],{"type":76,"value":190},{"type":70,"tag":110,"props":704,"children":705},{"style":133},[706],{"type":76,"value":136},{"type":70,"tag":110,"props":708,"children":709},{"style":139},[710],{"type":76,"value":417},{"type":70,"tag":110,"props":712,"children":713},{"style":133},[714],{"type":76,"value":147},{"type":70,"tag":110,"props":716,"children":717},{"style":330},[718],{"type":76,"value":668},{"type":70,"tag":110,"props":720,"children":722},{"class":112,"line":721},22,[723],{"type":70,"tag":110,"props":724,"children":725},{"style":133},[726],{"type":76,"value":727},"      },\n",{"type":70,"tag":110,"props":729,"children":731},{"class":112,"line":730},23,[732],{"type":70,"tag":110,"props":733,"children":734},{"style":133},[735],{"type":76,"value":736},"    },\n",{"type":70,"tag":110,"props":738,"children":740},{"class":112,"line":739},24,[741],{"type":70,"tag":110,"props":742,"children":743},{"style":133},[744],{"type":76,"value":745},"  },\n",{"type":70,"tag":110,"props":747,"children":749},{"class":112,"line":748},25,[750,755],{"type":70,"tag":110,"props":751,"children":752},{"style":133},[753],{"type":76,"value":754},"}",{"type":70,"tag":110,"props":756,"children":757},{"style":139},[758],{"type":76,"value":668},{"type":70,"tag":92,"props":760,"children":762},{"id":761},"client-react-component",[763],{"type":76,"value":764},"Client: React Component",{"type":70,"tag":99,"props":766,"children":768},{"className":101,"code":767,"language":45,"meta":103,"style":103},"\u002F\u002F src\u002Froutes\u002Findex.tsx\nimport { useState } from 'react'\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\nimport type { UIMessage } from '@tanstack\u002Fai-react'\n\nfunction ChatPage() {\n  const [input, setInput] = useState('')\n\n  const { messages, sendMessage, isLoading, error, stop } = useChat({\n    connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n  })\n\n  const handleSubmit = () => {\n    if (!input.trim()) return\n    sendMessage(input.trim())\n    setInput('')\n  }\n\n  return (\n    \u003Cdiv>\n      \u003Cdiv>\n        {messages.map((message: UIMessage) => (\n          \u003Cdiv key={message.id}>\n            \u003Cstrong>{message.role}:\u003C\u002Fstrong>\n            {message.parts.map((part, i) => {\n              if (part.type === 'text') {\n                return \u003Cp key={i}>{part.content}\u003C\u002Fp>\n              }\n              return null\n            })}\n          \u003C\u002Fdiv>\n        ))}\n      \u003C\u002Fdiv>\n\n      {error && \u003Cdiv>Error: {error.message}\u003C\u002Fdiv>}\n\n      \u003Cdiv>\n        \u003Cinput\n          value={input}\n          onChange={(e) => setInput(e.target.value)}\n          onKeyDown={(e) => {\n            if (e.key === 'Enter' && !e.shiftKey) {\n              e.preventDefault()\n              handleSubmit()\n            }\n          }}\n          disabled={isLoading}\n          placeholder=\"Type a message...\"\n        \u002F>\n        {isLoading ? (\n          \u003Cbutton onClick={stop}>Stop\u003C\u002Fbutton>\n        ) : (\n          \u003Cbutton onClick={handleSubmit} disabled={!input.trim()}>\n            Send\n          \u003C\u002Fbutton>\n        )}\n      \u003C\u002Fdiv>\n    \u003C\u002Fdiv>\n  )\n}\n",[769],{"type":70,"tag":106,"props":770,"children":771},{"__ignoreMap":103},[772,780,816,862,903,910,932,983,990,1061,1101,1113,1120,1149,1190,1219,1239,1247,1254,1267,1286,1302,1351,1388,1438,1499,1537,1607,1616,1630,1648,1665,1678,1695,1703,1772,1780,1796,1810,1831,1863,1885,1961,1983,1996,2005,2014,2036,2064,2073,2090,2139,2148,2195,2204,2220,2233,2249,2266,2275],{"type":70,"tag":110,"props":773,"children":774},{"class":112,"line":113},[775],{"type":70,"tag":110,"props":776,"children":777},{"style":117},[778],{"type":76,"value":779},"\u002F\u002F src\u002Froutes\u002Findex.tsx\n",{"type":70,"tag":110,"props":781,"children":782},{"class":112,"line":123},[783,787,791,796,800,804,808,812],{"type":70,"tag":110,"props":784,"children":785},{"style":127},[786],{"type":76,"value":130},{"type":70,"tag":110,"props":788,"children":789},{"style":133},[790],{"type":76,"value":136},{"type":70,"tag":110,"props":792,"children":793},{"style":139},[794],{"type":76,"value":795}," useState",{"type":70,"tag":110,"props":797,"children":798},{"style":133},[799],{"type":76,"value":147},{"type":70,"tag":110,"props":801,"children":802},{"style":127},[803],{"type":76,"value":152},{"type":70,"tag":110,"props":805,"children":806},{"style":133},[807],{"type":76,"value":157},{"type":70,"tag":110,"props":809,"children":810},{"style":160},[811],{"type":76,"value":40},{"type":70,"tag":110,"props":813,"children":814},{"style":133},[815],{"type":76,"value":168},{"type":70,"tag":110,"props":817,"children":818},{"class":112,"line":171},[819,823,827,832,836,841,845,849,853,858],{"type":70,"tag":110,"props":820,"children":821},{"style":127},[822],{"type":76,"value":130},{"type":70,"tag":110,"props":824,"children":825},{"style":133},[826],{"type":76,"value":136},{"type":70,"tag":110,"props":828,"children":829},{"style":139},[830],{"type":76,"value":831}," useChat",{"type":70,"tag":110,"props":833,"children":834},{"style":133},[835],{"type":76,"value":190},{"type":70,"tag":110,"props":837,"children":838},{"style":139},[839],{"type":76,"value":840}," fetchServerSentEvents",{"type":70,"tag":110,"props":842,"children":843},{"style":133},[844],{"type":76,"value":147},{"type":70,"tag":110,"props":846,"children":847},{"style":127},[848],{"type":76,"value":152},{"type":70,"tag":110,"props":850,"children":851},{"style":133},[852],{"type":76,"value":157},{"type":70,"tag":110,"props":854,"children":855},{"style":160},[856],{"type":76,"value":857},"@tanstack\u002Fai-react",{"type":70,"tag":110,"props":859,"children":860},{"style":133},[861],{"type":76,"value":168},{"type":70,"tag":110,"props":863,"children":864},{"class":112,"line":219},[865,869,874,878,883,887,891,895,899],{"type":70,"tag":110,"props":866,"children":867},{"style":127},[868],{"type":76,"value":130},{"type":70,"tag":110,"props":870,"children":871},{"style":127},[872],{"type":76,"value":873}," type",{"type":70,"tag":110,"props":875,"children":876},{"style":133},[877],{"type":76,"value":136},{"type":70,"tag":110,"props":879,"children":880},{"style":139},[881],{"type":76,"value":882}," UIMessage",{"type":70,"tag":110,"props":884,"children":885},{"style":133},[886],{"type":76,"value":147},{"type":70,"tag":110,"props":888,"children":889},{"style":127},[890],{"type":76,"value":152},{"type":70,"tag":110,"props":892,"children":893},{"style":133},[894],{"type":76,"value":157},{"type":70,"tag":110,"props":896,"children":897},{"style":160},[898],{"type":76,"value":857},{"type":70,"tag":110,"props":900,"children":901},{"style":133},[902],{"type":76,"value":168},{"type":70,"tag":110,"props":904,"children":905},{"class":112,"line":257},[906],{"type":70,"tag":110,"props":907,"children":908},{"emptyLinePlaceholder":261},[909],{"type":76,"value":264},{"type":70,"tag":110,"props":911,"children":912},{"class":112,"line":267},[913,918,923,928],{"type":70,"tag":110,"props":914,"children":915},{"style":276},[916],{"type":76,"value":917},"function",{"type":70,"tag":110,"props":919,"children":920},{"style":292},[921],{"type":76,"value":922}," ChatPage",{"type":70,"tag":110,"props":924,"children":925},{"style":133},[926],{"type":76,"value":927},"()",{"type":70,"tag":110,"props":929,"children":930},{"style":133},[931],{"type":76,"value":343},{"type":70,"tag":110,"props":933,"children":934},{"class":112,"line":326},[935,940,944,949,953,958,962,966,970,974,979],{"type":70,"tag":110,"props":936,"children":937},{"style":276},[938],{"type":76,"value":939},"  const",{"type":70,"tag":110,"props":941,"children":942},{"style":133},[943],{"type":76,"value":619},{"type":70,"tag":110,"props":945,"children":946},{"style":139},[947],{"type":76,"value":948},"input",{"type":70,"tag":110,"props":950,"children":951},{"style":133},[952],{"type":76,"value":190},{"type":70,"tag":110,"props":954,"children":955},{"style":139},[956],{"type":76,"value":957}," setInput",{"type":70,"tag":110,"props":959,"children":960},{"style":133},[961],{"type":76,"value":637},{"type":70,"tag":110,"props":963,"children":964},{"style":133},[965],{"type":76,"value":422},{"type":70,"tag":110,"props":967,"children":968},{"style":292},[969],{"type":76,"value":795},{"type":70,"tag":110,"props":971,"children":972},{"style":330},[973],{"type":76,"value":299},{"type":70,"tag":110,"props":975,"children":976},{"style":133},[977],{"type":76,"value":978},"''",{"type":70,"tag":110,"props":980,"children":981},{"style":330},[982],{"type":76,"value":668},{"type":70,"tag":110,"props":984,"children":985},{"class":112,"line":346},[986],{"type":70,"tag":110,"props":987,"children":988},{"emptyLinePlaceholder":261},[989],{"type":76,"value":264},{"type":70,"tag":110,"props":991,"children":992},{"class":112,"line":363},[993,997,1001,1005,1009,1014,1018,1023,1027,1032,1036,1041,1045,1049,1053,1057],{"type":70,"tag":110,"props":994,"children":995},{"style":276},[996],{"type":76,"value":939},{"type":70,"tag":110,"props":998,"children":999},{"style":133},[1000],{"type":76,"value":136},{"type":70,"tag":110,"props":1002,"children":1003},{"style":139},[1004],{"type":76,"value":494},{"type":70,"tag":110,"props":1006,"children":1007},{"style":133},[1008],{"type":76,"value":190},{"type":70,"tag":110,"props":1010,"children":1011},{"style":139},[1012],{"type":76,"value":1013}," sendMessage",{"type":70,"tag":110,"props":1015,"children":1016},{"style":133},[1017],{"type":76,"value":190},{"type":70,"tag":110,"props":1019,"children":1020},{"style":139},[1021],{"type":76,"value":1022}," isLoading",{"type":70,"tag":110,"props":1024,"children":1025},{"style":133},[1026],{"type":76,"value":190},{"type":70,"tag":110,"props":1028,"children":1029},{"style":139},[1030],{"type":76,"value":1031}," error",{"type":70,"tag":110,"props":1033,"children":1034},{"style":133},[1035],{"type":76,"value":190},{"type":70,"tag":110,"props":1037,"children":1038},{"style":139},[1039],{"type":76,"value":1040}," stop",{"type":70,"tag":110,"props":1042,"children":1043},{"style":133},[1044],{"type":76,"value":147},{"type":70,"tag":110,"props":1046,"children":1047},{"style":133},[1048],{"type":76,"value":422},{"type":70,"tag":110,"props":1050,"children":1051},{"style":292},[1052],{"type":76,"value":831},{"type":70,"tag":110,"props":1054,"children":1055},{"style":330},[1056],{"type":76,"value":299},{"type":70,"tag":110,"props":1058,"children":1059},{"style":133},[1060],{"type":76,"value":323},{"type":70,"tag":110,"props":1062,"children":1063},{"class":112,"line":406},[1064,1069,1073,1077,1081,1085,1089,1093,1097],{"type":70,"tag":110,"props":1065,"children":1066},{"style":330},[1067],{"type":76,"value":1068},"    connection",{"type":70,"tag":110,"props":1070,"children":1071},{"style":133},[1072],{"type":76,"value":338},{"type":70,"tag":110,"props":1074,"children":1075},{"style":292},[1076],{"type":76,"value":840},{"type":70,"tag":110,"props":1078,"children":1079},{"style":330},[1080],{"type":76,"value":299},{"type":70,"tag":110,"props":1082,"children":1083},{"style":133},[1084],{"type":76,"value":304},{"type":70,"tag":110,"props":1086,"children":1087},{"style":160},[1088],{"type":76,"value":309},{"type":70,"tag":110,"props":1090,"children":1091},{"style":133},[1092],{"type":76,"value":304},{"type":70,"tag":110,"props":1094,"children":1095},{"style":330},[1096],{"type":76,"value":583},{"type":70,"tag":110,"props":1098,"children":1099},{"style":133},[1100],{"type":76,"value":588},{"type":70,"tag":110,"props":1102,"children":1103},{"class":112,"line":440},[1104,1109],{"type":70,"tag":110,"props":1105,"children":1106},{"style":133},[1107],{"type":76,"value":1108},"  }",{"type":70,"tag":110,"props":1110,"children":1111},{"style":330},[1112],{"type":76,"value":668},{"type":70,"tag":110,"props":1114,"children":1115},{"class":112,"line":480},[1116],{"type":70,"tag":110,"props":1117,"children":1118},{"emptyLinePlaceholder":261},[1119],{"type":76,"value":264},{"type":70,"tag":110,"props":1121,"children":1122},{"class":112,"line":510},[1123,1127,1132,1136,1141,1145],{"type":70,"tag":110,"props":1124,"children":1125},{"style":276},[1126],{"type":76,"value":939},{"type":70,"tag":110,"props":1128,"children":1129},{"style":139},[1130],{"type":76,"value":1131}," handleSubmit",{"type":70,"tag":110,"props":1133,"children":1134},{"style":133},[1135],{"type":76,"value":422},{"type":70,"tag":110,"props":1137,"children":1138},{"style":133},[1139],{"type":76,"value":1140}," ()",{"type":70,"tag":110,"props":1142,"children":1143},{"style":276},[1144],{"type":76,"value":399},{"type":70,"tag":110,"props":1146,"children":1147},{"style":133},[1148],{"type":76,"value":343},{"type":70,"tag":110,"props":1150,"children":1151},{"class":112,"line":518},[1152,1157,1162,1167,1171,1175,1180,1185],{"type":70,"tag":110,"props":1153,"children":1154},{"style":127},[1155],{"type":76,"value":1156},"    if",{"type":70,"tag":110,"props":1158,"children":1159},{"style":330},[1160],{"type":76,"value":1161}," (",{"type":70,"tag":110,"props":1163,"children":1164},{"style":133},[1165],{"type":76,"value":1166},"!",{"type":70,"tag":110,"props":1168,"children":1169},{"style":139},[1170],{"type":76,"value":948},{"type":70,"tag":110,"props":1172,"children":1173},{"style":133},[1174],{"type":76,"value":468},{"type":70,"tag":110,"props":1176,"children":1177},{"style":292},[1178],{"type":76,"value":1179},"trim",{"type":70,"tag":110,"props":1181,"children":1182},{"style":330},[1183],{"type":76,"value":1184},"()) ",{"type":70,"tag":110,"props":1186,"children":1187},{"style":127},[1188],{"type":76,"value":1189},"return\n",{"type":70,"tag":110,"props":1191,"children":1192},{"class":112,"line":547},[1193,1198,1202,1206,1210,1214],{"type":70,"tag":110,"props":1194,"children":1195},{"style":292},[1196],{"type":76,"value":1197},"    sendMessage",{"type":70,"tag":110,"props":1199,"children":1200},{"style":330},[1201],{"type":76,"value":299},{"type":70,"tag":110,"props":1203,"children":1204},{"style":139},[1205],{"type":76,"value":948},{"type":70,"tag":110,"props":1207,"children":1208},{"style":133},[1209],{"type":76,"value":468},{"type":70,"tag":110,"props":1211,"children":1212},{"style":292},[1213],{"type":76,"value":1179},{"type":70,"tag":110,"props":1215,"children":1216},{"style":330},[1217],{"type":76,"value":1218},"())\n",{"type":70,"tag":110,"props":1220,"children":1221},{"class":112,"line":591},[1222,1227,1231,1235],{"type":70,"tag":110,"props":1223,"children":1224},{"style":292},[1225],{"type":76,"value":1226},"    setInput",{"type":70,"tag":110,"props":1228,"children":1229},{"style":330},[1230],{"type":76,"value":299},{"type":70,"tag":110,"props":1232,"children":1233},{"style":133},[1234],{"type":76,"value":978},{"type":70,"tag":110,"props":1236,"children":1237},{"style":330},[1238],{"type":76,"value":668},{"type":70,"tag":110,"props":1240,"children":1241},{"class":112,"line":604},[1242],{"type":70,"tag":110,"props":1243,"children":1244},{"style":133},[1245],{"type":76,"value":1246},"  }\n",{"type":70,"tag":110,"props":1248,"children":1249},{"class":112,"line":644},[1250],{"type":70,"tag":110,"props":1251,"children":1252},{"emptyLinePlaceholder":261},[1253],{"type":76,"value":264},{"type":70,"tag":110,"props":1255,"children":1256},{"class":112,"line":657},[1257,1262],{"type":70,"tag":110,"props":1258,"children":1259},{"style":127},[1260],{"type":76,"value":1261},"  return",{"type":70,"tag":110,"props":1263,"children":1264},{"style":330},[1265],{"type":76,"value":1266}," (\n",{"type":70,"tag":110,"props":1268,"children":1269},{"class":112,"line":671},[1270,1275,1281],{"type":70,"tag":110,"props":1271,"children":1272},{"style":330},[1273],{"type":76,"value":1274},"    \u003C",{"type":70,"tag":110,"props":1276,"children":1278},{"style":1277},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[1279],{"type":76,"value":1280},"div",{"type":70,"tag":110,"props":1282,"children":1283},{"style":330},[1284],{"type":76,"value":1285},">\n",{"type":70,"tag":110,"props":1287,"children":1288},{"class":112,"line":679},[1289,1294,1298],{"type":70,"tag":110,"props":1290,"children":1291},{"style":330},[1292],{"type":76,"value":1293},"      \u003C",{"type":70,"tag":110,"props":1295,"children":1296},{"style":1277},[1297],{"type":76,"value":1280},{"type":70,"tag":110,"props":1299,"children":1300},{"style":330},[1301],{"type":76,"value":1285},{"type":70,"tag":110,"props":1303,"children":1304},{"class":112,"line":721},[1305,1310,1315,1319,1324,1329,1333,1337,1342,1347],{"type":70,"tag":110,"props":1306,"children":1307},{"style":133},[1308],{"type":76,"value":1309},"        {",{"type":70,"tag":110,"props":1311,"children":1312},{"style":386},[1313],{"type":76,"value":1314},"messages",{"type":70,"tag":110,"props":1316,"children":1317},{"style":330},[1318],{"type":76,"value":468},{"type":70,"tag":110,"props":1320,"children":1321},{"style":386},[1322],{"type":76,"value":1323},"map",{"type":70,"tag":110,"props":1325,"children":1326},{"style":330},[1327],{"type":76,"value":1328},"((message",{"type":70,"tag":110,"props":1330,"children":1331},{"style":133},[1332],{"type":76,"value":338},{"type":70,"tag":110,"props":1334,"children":1335},{"style":386},[1336],{"type":76,"value":882},{"type":70,"tag":110,"props":1338,"children":1339},{"style":330},[1340],{"type":76,"value":1341},") ",{"type":70,"tag":110,"props":1343,"children":1344},{"style":133},[1345],{"type":76,"value":1346},"=>",{"type":70,"tag":110,"props":1348,"children":1349},{"style":330},[1350],{"type":76,"value":1266},{"type":70,"tag":110,"props":1352,"children":1353},{"class":112,"line":730},[1354,1359,1363,1368,1373,1378,1383],{"type":70,"tag":110,"props":1355,"children":1356},{"style":133},[1357],{"type":76,"value":1358},"          \u003C",{"type":70,"tag":110,"props":1360,"children":1361},{"style":139},[1362],{"type":76,"value":1280},{"type":70,"tag":110,"props":1364,"children":1365},{"style":139},[1366],{"type":76,"value":1367}," key",{"type":70,"tag":110,"props":1369,"children":1370},{"style":133},[1371],{"type":76,"value":1372},"={",{"type":70,"tag":110,"props":1374,"children":1375},{"style":330},[1376],{"type":76,"value":1377},"message.",{"type":70,"tag":110,"props":1379,"children":1380},{"style":139},[1381],{"type":76,"value":1382},"id",{"type":70,"tag":110,"props":1384,"children":1385},{"style":133},[1386],{"type":76,"value":1387},"}>\n",{"type":70,"tag":110,"props":1389,"children":1390},{"class":112,"line":739},[1391,1396,1401,1406,1411,1415,1420,1425,1430,1434],{"type":70,"tag":110,"props":1392,"children":1393},{"style":330},[1394],{"type":76,"value":1395},"            \u003C",{"type":70,"tag":110,"props":1397,"children":1398},{"style":1277},[1399],{"type":76,"value":1400},"strong",{"type":70,"tag":110,"props":1402,"children":1403},{"style":330},[1404],{"type":76,"value":1405},">",{"type":70,"tag":110,"props":1407,"children":1408},{"style":133},[1409],{"type":76,"value":1410},"{",{"type":70,"tag":110,"props":1412,"children":1413},{"style":330},[1414],{"type":76,"value":1377},{"type":70,"tag":110,"props":1416,"children":1417},{"style":139},[1418],{"type":76,"value":1419},"role",{"type":70,"tag":110,"props":1421,"children":1422},{"style":133},[1423],{"type":76,"value":1424},"}:\u003C",{"type":70,"tag":110,"props":1426,"children":1427},{"style":330},[1428],{"type":76,"value":1429},"\u002F",{"type":70,"tag":110,"props":1431,"children":1432},{"style":1277},[1433],{"type":76,"value":1400},{"type":70,"tag":110,"props":1435,"children":1436},{"style":133},[1437],{"type":76,"value":1285},{"type":70,"tag":110,"props":1439,"children":1440},{"class":112,"line":748},[1441,1446,1451,1455,1460,1464,1468,1473,1478,1482,1487,1491,1495],{"type":70,"tag":110,"props":1442,"children":1443},{"style":133},[1444],{"type":76,"value":1445},"            {",{"type":70,"tag":110,"props":1447,"children":1448},{"style":386},[1449],{"type":76,"value":1450},"message",{"type":70,"tag":110,"props":1452,"children":1453},{"style":330},[1454],{"type":76,"value":468},{"type":70,"tag":110,"props":1456,"children":1457},{"style":386},[1458],{"type":76,"value":1459},"parts",{"type":70,"tag":110,"props":1461,"children":1462},{"style":330},[1463],{"type":76,"value":468},{"type":70,"tag":110,"props":1465,"children":1466},{"style":386},[1467],{"type":76,"value":1323},{"type":70,"tag":110,"props":1469,"children":1470},{"style":330},[1471],{"type":76,"value":1472},"((",{"type":70,"tag":110,"props":1474,"children":1475},{"style":386},[1476],{"type":76,"value":1477},"part",{"type":70,"tag":110,"props":1479,"children":1480},{"style":133},[1481],{"type":76,"value":190},{"type":70,"tag":110,"props":1483,"children":1484},{"style":386},[1485],{"type":76,"value":1486}," i",{"type":70,"tag":110,"props":1488,"children":1489},{"style":330},[1490],{"type":76,"value":1341},{"type":70,"tag":110,"props":1492,"children":1493},{"style":133},[1494],{"type":76,"value":1346},{"type":70,"tag":110,"props":1496,"children":1497},{"style":133},[1498],{"type":76,"value":343},{"type":70,"tag":110,"props":1500,"children":1502},{"class":112,"line":1501},26,[1503,1508,1512,1517,1521,1525,1529,1533],{"type":70,"tag":110,"props":1504,"children":1505},{"style":330},[1506],{"type":76,"value":1507},"              if ",{"type":70,"tag":110,"props":1509,"children":1510},{"style":133},[1511],{"type":76,"value":299},{"type":70,"tag":110,"props":1513,"children":1514},{"style":330},[1515],{"type":76,"value":1516},"part.type === ",{"type":70,"tag":110,"props":1518,"children":1519},{"style":133},[1520],{"type":76,"value":304},{"type":70,"tag":110,"props":1522,"children":1523},{"style":160},[1524],{"type":76,"value":76},{"type":70,"tag":110,"props":1526,"children":1527},{"style":133},[1528],{"type":76,"value":304},{"type":70,"tag":110,"props":1530,"children":1531},{"style":133},[1532],{"type":76,"value":583},{"type":70,"tag":110,"props":1534,"children":1535},{"style":133},[1536],{"type":76,"value":343},{"type":70,"tag":110,"props":1538,"children":1540},{"class":112,"line":1539},27,[1541,1546,1551,1555,1559,1563,1567,1572,1576,1580,1584,1589,1594,1599,1603],{"type":70,"tag":110,"props":1542,"children":1543},{"style":127},[1544],{"type":76,"value":1545},"                return",{"type":70,"tag":110,"props":1547,"children":1548},{"style":330},[1549],{"type":76,"value":1550}," \u003C",{"type":70,"tag":110,"props":1552,"children":1553},{"style":1277},[1554],{"type":76,"value":79},{"type":70,"tag":110,"props":1556,"children":1557},{"style":1277},[1558],{"type":76,"value":1367},{"type":70,"tag":110,"props":1560,"children":1561},{"style":330},[1562],{"type":76,"value":289},{"type":70,"tag":110,"props":1564,"children":1565},{"style":133},[1566],{"type":76,"value":1410},{"type":70,"tag":110,"props":1568,"children":1569},{"style":330},[1570],{"type":76,"value":1571},"i",{"type":70,"tag":110,"props":1573,"children":1574},{"style":133},[1575],{"type":76,"value":754},{"type":70,"tag":110,"props":1577,"children":1578},{"style":330},[1579],{"type":76,"value":1405},{"type":70,"tag":110,"props":1581,"children":1582},{"style":133},[1583],{"type":76,"value":1410},{"type":70,"tag":110,"props":1585,"children":1586},{"style":330},[1587],{"type":76,"value":1588},"part.",{"type":70,"tag":110,"props":1590,"children":1591},{"style":139},[1592],{"type":76,"value":1593},"content",{"type":70,"tag":110,"props":1595,"children":1596},{"style":133},[1597],{"type":76,"value":1598},"}\u003C\u002F",{"type":70,"tag":110,"props":1600,"children":1601},{"style":139},[1602],{"type":76,"value":79},{"type":70,"tag":110,"props":1604,"children":1605},{"style":133},[1606],{"type":76,"value":1285},{"type":70,"tag":110,"props":1608,"children":1610},{"class":112,"line":1609},28,[1611],{"type":70,"tag":110,"props":1612,"children":1613},{"style":133},[1614],{"type":76,"value":1615},"              }\n",{"type":70,"tag":110,"props":1617,"children":1619},{"class":112,"line":1618},29,[1620,1625],{"type":70,"tag":110,"props":1621,"children":1622},{"style":330},[1623],{"type":76,"value":1624},"              return ",{"type":70,"tag":110,"props":1626,"children":1627},{"style":139},[1628],{"type":76,"value":1629},"null\n",{"type":70,"tag":110,"props":1631,"children":1633},{"class":112,"line":1632},30,[1634,1639,1643],{"type":70,"tag":110,"props":1635,"children":1636},{"style":133},[1637],{"type":76,"value":1638},"            }",{"type":70,"tag":110,"props":1640,"children":1641},{"style":330},[1642],{"type":76,"value":583},{"type":70,"tag":110,"props":1644,"children":1645},{"style":133},[1646],{"type":76,"value":1647},"}\n",{"type":70,"tag":110,"props":1649,"children":1651},{"class":112,"line":1650},31,[1652,1657,1661],{"type":70,"tag":110,"props":1653,"children":1654},{"style":133},[1655],{"type":76,"value":1656},"          \u003C\u002F",{"type":70,"tag":110,"props":1658,"children":1659},{"style":139},[1660],{"type":76,"value":1280},{"type":70,"tag":110,"props":1662,"children":1663},{"style":133},[1664],{"type":76,"value":1285},{"type":70,"tag":110,"props":1666,"children":1668},{"class":112,"line":1667},32,[1669,1674],{"type":70,"tag":110,"props":1670,"children":1671},{"style":330},[1672],{"type":76,"value":1673},"        ))",{"type":70,"tag":110,"props":1675,"children":1676},{"style":133},[1677],{"type":76,"value":1647},{"type":70,"tag":110,"props":1679,"children":1681},{"class":112,"line":1680},33,[1682,1687,1691],{"type":70,"tag":110,"props":1683,"children":1684},{"style":133},[1685],{"type":76,"value":1686},"      \u003C\u002F",{"type":70,"tag":110,"props":1688,"children":1689},{"style":139},[1690],{"type":76,"value":1280},{"type":70,"tag":110,"props":1692,"children":1693},{"style":133},[1694],{"type":76,"value":1285},{"type":70,"tag":110,"props":1696,"children":1698},{"class":112,"line":1697},34,[1699],{"type":70,"tag":110,"props":1700,"children":1701},{"emptyLinePlaceholder":261},[1702],{"type":76,"value":264},{"type":70,"tag":110,"props":1704,"children":1706},{"class":112,"line":1705},35,[1707,1712,1717,1722,1726,1731,1735,1739,1743,1747,1751,1755,1760,1764,1768],{"type":70,"tag":110,"props":1708,"children":1709},{"style":133},[1710],{"type":76,"value":1711},"      {",{"type":70,"tag":110,"props":1713,"children":1714},{"style":386},[1715],{"type":76,"value":1716},"error",{"type":70,"tag":110,"props":1718,"children":1719},{"style":330},[1720],{"type":76,"value":1721}," && \u003C",{"type":70,"tag":110,"props":1723,"children":1724},{"style":386},[1725],{"type":76,"value":1280},{"type":70,"tag":110,"props":1727,"children":1728},{"style":330},[1729],{"type":76,"value":1730},">Error",{"type":70,"tag":110,"props":1732,"children":1733},{"style":133},[1734],{"type":76,"value":338},{"type":70,"tag":110,"props":1736,"children":1737},{"style":133},[1738],{"type":76,"value":136},{"type":70,"tag":110,"props":1740,"children":1741},{"style":386},[1742],{"type":76,"value":1716},{"type":70,"tag":110,"props":1744,"children":1745},{"style":330},[1746],{"type":76,"value":468},{"type":70,"tag":110,"props":1748,"children":1749},{"style":386},[1750],{"type":76,"value":1450},{"type":70,"tag":110,"props":1752,"children":1753},{"style":133},[1754],{"type":76,"value":754},{"type":70,"tag":110,"props":1756,"children":1757},{"style":330},[1758],{"type":76,"value":1759},"\u003C\u002F",{"type":70,"tag":110,"props":1761,"children":1762},{"style":386},[1763],{"type":76,"value":1280},{"type":70,"tag":110,"props":1765,"children":1766},{"style":330},[1767],{"type":76,"value":1405},{"type":70,"tag":110,"props":1769,"children":1770},{"style":133},[1771],{"type":76,"value":1647},{"type":70,"tag":110,"props":1773,"children":1775},{"class":112,"line":1774},36,[1776],{"type":70,"tag":110,"props":1777,"children":1778},{"emptyLinePlaceholder":261},[1779],{"type":76,"value":264},{"type":70,"tag":110,"props":1781,"children":1783},{"class":112,"line":1782},37,[1784,1788,1792],{"type":70,"tag":110,"props":1785,"children":1786},{"style":330},[1787],{"type":76,"value":1293},{"type":70,"tag":110,"props":1789,"children":1790},{"style":1277},[1791],{"type":76,"value":1280},{"type":70,"tag":110,"props":1793,"children":1794},{"style":330},[1795],{"type":76,"value":1285},{"type":70,"tag":110,"props":1797,"children":1799},{"class":112,"line":1798},38,[1800,1805],{"type":70,"tag":110,"props":1801,"children":1802},{"style":133},[1803],{"type":76,"value":1804},"        \u003C",{"type":70,"tag":110,"props":1806,"children":1807},{"style":386},[1808],{"type":76,"value":1809},"input\n",{"type":70,"tag":110,"props":1811,"children":1813},{"class":112,"line":1812},39,[1814,1819,1823,1827],{"type":70,"tag":110,"props":1815,"children":1816},{"style":139},[1817],{"type":76,"value":1818},"          value",{"type":70,"tag":110,"props":1820,"children":1821},{"style":133},[1822],{"type":76,"value":1372},{"type":70,"tag":110,"props":1824,"children":1825},{"style":139},[1826],{"type":76,"value":948},{"type":70,"tag":110,"props":1828,"children":1829},{"style":133},[1830],{"type":76,"value":1647},{"type":70,"tag":110,"props":1832,"children":1834},{"class":112,"line":1833},40,[1835,1840,1844,1849,1853,1858],{"type":70,"tag":110,"props":1836,"children":1837},{"style":139},[1838],{"type":76,"value":1839},"          onChange",{"type":70,"tag":110,"props":1841,"children":1842},{"style":133},[1843],{"type":76,"value":1372},{"type":70,"tag":110,"props":1845,"children":1846},{"style":330},[1847],{"type":76,"value":1848},"(e) => setInput",{"type":70,"tag":110,"props":1850,"children":1851},{"style":133},[1852],{"type":76,"value":299},{"type":70,"tag":110,"props":1854,"children":1855},{"style":330},[1856],{"type":76,"value":1857},"e.target.value",{"type":70,"tag":110,"props":1859,"children":1860},{"style":133},[1861],{"type":76,"value":1862},")}\n",{"type":70,"tag":110,"props":1864,"children":1866},{"class":112,"line":1865},41,[1867,1872,1876,1881],{"type":70,"tag":110,"props":1868,"children":1869},{"style":139},[1870],{"type":76,"value":1871},"          onKeyDown",{"type":70,"tag":110,"props":1873,"children":1874},{"style":133},[1875],{"type":76,"value":1372},{"type":70,"tag":110,"props":1877,"children":1878},{"style":330},[1879],{"type":76,"value":1880},"(e) => ",{"type":70,"tag":110,"props":1882,"children":1883},{"style":133},[1884],{"type":76,"value":323},{"type":70,"tag":110,"props":1886,"children":1888},{"class":112,"line":1887},42,[1889,1894,1898,1903,1907,1912,1917,1921,1926,1930,1935,1940,1944,1948,1953,1957],{"type":70,"tag":110,"props":1890,"children":1891},{"style":127},[1892],{"type":76,"value":1893},"            if",{"type":70,"tag":110,"props":1895,"children":1896},{"style":330},[1897],{"type":76,"value":1161},{"type":70,"tag":110,"props":1899,"children":1900},{"style":139},[1901],{"type":76,"value":1902},"e",{"type":70,"tag":110,"props":1904,"children":1905},{"style":133},[1906],{"type":76,"value":468},{"type":70,"tag":110,"props":1908,"children":1909},{"style":139},[1910],{"type":76,"value":1911},"key",{"type":70,"tag":110,"props":1913,"children":1914},{"style":133},[1915],{"type":76,"value":1916}," ===",{"type":70,"tag":110,"props":1918,"children":1919},{"style":133},[1920],{"type":76,"value":157},{"type":70,"tag":110,"props":1922,"children":1923},{"style":160},[1924],{"type":76,"value":1925},"Enter",{"type":70,"tag":110,"props":1927,"children":1928},{"style":133},[1929],{"type":76,"value":304},{"type":70,"tag":110,"props":1931,"children":1932},{"style":133},[1933],{"type":76,"value":1934}," &&",{"type":70,"tag":110,"props":1936,"children":1937},{"style":133},[1938],{"type":76,"value":1939}," !",{"type":70,"tag":110,"props":1941,"children":1942},{"style":139},[1943],{"type":76,"value":1902},{"type":70,"tag":110,"props":1945,"children":1946},{"style":133},[1947],{"type":76,"value":468},{"type":70,"tag":110,"props":1949,"children":1950},{"style":139},[1951],{"type":76,"value":1952},"shiftKey",{"type":70,"tag":110,"props":1954,"children":1955},{"style":330},[1956],{"type":76,"value":1341},{"type":70,"tag":110,"props":1958,"children":1959},{"style":133},[1960],{"type":76,"value":323},{"type":70,"tag":110,"props":1962,"children":1964},{"class":112,"line":1963},43,[1965,1970,1974,1979],{"type":70,"tag":110,"props":1966,"children":1967},{"style":139},[1968],{"type":76,"value":1969},"              e",{"type":70,"tag":110,"props":1971,"children":1972},{"style":133},[1973],{"type":76,"value":468},{"type":70,"tag":110,"props":1975,"children":1976},{"style":292},[1977],{"type":76,"value":1978},"preventDefault",{"type":70,"tag":110,"props":1980,"children":1981},{"style":330},[1982],{"type":76,"value":437},{"type":70,"tag":110,"props":1984,"children":1986},{"class":112,"line":1985},44,[1987,1992],{"type":70,"tag":110,"props":1988,"children":1989},{"style":292},[1990],{"type":76,"value":1991},"              handleSubmit",{"type":70,"tag":110,"props":1993,"children":1994},{"style":330},[1995],{"type":76,"value":437},{"type":70,"tag":110,"props":1997,"children":1999},{"class":112,"line":1998},45,[2000],{"type":70,"tag":110,"props":2001,"children":2002},{"style":133},[2003],{"type":76,"value":2004},"            }\n",{"type":70,"tag":110,"props":2006,"children":2008},{"class":112,"line":2007},46,[2009],{"type":70,"tag":110,"props":2010,"children":2011},{"style":133},[2012],{"type":76,"value":2013},"          }}\n",{"type":70,"tag":110,"props":2015,"children":2017},{"class":112,"line":2016},47,[2018,2023,2027,2032],{"type":70,"tag":110,"props":2019,"children":2020},{"style":139},[2021],{"type":76,"value":2022},"          disabled",{"type":70,"tag":110,"props":2024,"children":2025},{"style":133},[2026],{"type":76,"value":1372},{"type":70,"tag":110,"props":2028,"children":2029},{"style":139},[2030],{"type":76,"value":2031},"isLoading",{"type":70,"tag":110,"props":2033,"children":2034},{"style":133},[2035],{"type":76,"value":1647},{"type":70,"tag":110,"props":2037,"children":2039},{"class":112,"line":2038},48,[2040,2045,2049,2054,2059],{"type":70,"tag":110,"props":2041,"children":2042},{"style":139},[2043],{"type":76,"value":2044},"          placeholder",{"type":70,"tag":110,"props":2046,"children":2047},{"style":133},[2048],{"type":76,"value":289},{"type":70,"tag":110,"props":2050,"children":2051},{"style":133},[2052],{"type":76,"value":2053},"\"",{"type":70,"tag":110,"props":2055,"children":2056},{"style":160},[2057],{"type":76,"value":2058},"Type a message...",{"type":70,"tag":110,"props":2060,"children":2061},{"style":133},[2062],{"type":76,"value":2063},"\"\n",{"type":70,"tag":110,"props":2065,"children":2067},{"class":112,"line":2066},49,[2068],{"type":70,"tag":110,"props":2069,"children":2070},{"style":133},[2071],{"type":76,"value":2072},"        \u002F>\n",{"type":70,"tag":110,"props":2074,"children":2076},{"class":112,"line":2075},50,[2077,2081,2085],{"type":70,"tag":110,"props":2078,"children":2079},{"style":133},[2080],{"type":76,"value":1309},{"type":70,"tag":110,"props":2082,"children":2083},{"style":386},[2084],{"type":76,"value":2031},{"type":70,"tag":110,"props":2086,"children":2087},{"style":330},[2088],{"type":76,"value":2089}," ? (\n",{"type":70,"tag":110,"props":2091,"children":2093},{"class":112,"line":2092},51,[2094,2098,2103,2108,2112,2117,2122,2127,2131,2135],{"type":70,"tag":110,"props":2095,"children":2096},{"style":330},[2097],{"type":76,"value":1358},{"type":70,"tag":110,"props":2099,"children":2100},{"style":386},[2101],{"type":76,"value":2102},"button",{"type":70,"tag":110,"props":2104,"children":2105},{"style":386},[2106],{"type":76,"value":2107}," onClick",{"type":70,"tag":110,"props":2109,"children":2110},{"style":133},[2111],{"type":76,"value":1372},{"type":70,"tag":110,"props":2113,"children":2114},{"style":139},[2115],{"type":76,"value":2116},"stop",{"type":70,"tag":110,"props":2118,"children":2119},{"style":133},[2120],{"type":76,"value":2121},"}>",{"type":70,"tag":110,"props":2123,"children":2124},{"style":139},[2125],{"type":76,"value":2126},"Stop",{"type":70,"tag":110,"props":2128,"children":2129},{"style":133},[2130],{"type":76,"value":1759},{"type":70,"tag":110,"props":2132,"children":2133},{"style":139},[2134],{"type":76,"value":2102},{"type":70,"tag":110,"props":2136,"children":2137},{"style":133},[2138],{"type":76,"value":1285},{"type":70,"tag":110,"props":2140,"children":2142},{"class":112,"line":2141},52,[2143],{"type":70,"tag":110,"props":2144,"children":2145},{"style":330},[2146],{"type":76,"value":2147},"        ) : (\n",{"type":70,"tag":110,"props":2149,"children":2151},{"class":112,"line":2150},53,[2152,2156,2160,2164,2168,2173,2177,2182,2186,2191],{"type":70,"tag":110,"props":2153,"children":2154},{"style":330},[2155],{"type":76,"value":1358},{"type":70,"tag":110,"props":2157,"children":2158},{"style":386},[2159],{"type":76,"value":2102},{"type":70,"tag":110,"props":2161,"children":2162},{"style":386},[2163],{"type":76,"value":2107},{"type":70,"tag":110,"props":2165,"children":2166},{"style":133},[2167],{"type":76,"value":1372},{"type":70,"tag":110,"props":2169,"children":2170},{"style":139},[2171],{"type":76,"value":2172},"handleSubmit",{"type":70,"tag":110,"props":2174,"children":2175},{"style":133},[2176],{"type":76,"value":754},{"type":70,"tag":110,"props":2178,"children":2179},{"style":139},[2180],{"type":76,"value":2181}," disabled",{"type":70,"tag":110,"props":2183,"children":2184},{"style":133},[2185],{"type":76,"value":1372},{"type":70,"tag":110,"props":2187,"children":2188},{"style":330},[2189],{"type":76,"value":2190},"!input.trim()",{"type":70,"tag":110,"props":2192,"children":2193},{"style":133},[2194],{"type":76,"value":1387},{"type":70,"tag":110,"props":2196,"children":2198},{"class":112,"line":2197},54,[2199],{"type":70,"tag":110,"props":2200,"children":2201},{"style":386},[2202],{"type":76,"value":2203},"            Send\n",{"type":70,"tag":110,"props":2205,"children":2207},{"class":112,"line":2206},55,[2208,2212,2216],{"type":70,"tag":110,"props":2209,"children":2210},{"style":330},[2211],{"type":76,"value":1656},{"type":70,"tag":110,"props":2213,"children":2214},{"style":386},[2215],{"type":76,"value":2102},{"type":70,"tag":110,"props":2217,"children":2218},{"style":330},[2219],{"type":76,"value":1285},{"type":70,"tag":110,"props":2221,"children":2223},{"class":112,"line":2222},56,[2224,2229],{"type":70,"tag":110,"props":2225,"children":2226},{"style":330},[2227],{"type":76,"value":2228},"        )",{"type":70,"tag":110,"props":2230,"children":2231},{"style":133},[2232],{"type":76,"value":1647},{"type":70,"tag":110,"props":2234,"children":2236},{"class":112,"line":2235},57,[2237,2241,2245],{"type":70,"tag":110,"props":2238,"children":2239},{"style":133},[2240],{"type":76,"value":1686},{"type":70,"tag":110,"props":2242,"children":2243},{"style":139},[2244],{"type":76,"value":1280},{"type":70,"tag":110,"props":2246,"children":2247},{"style":133},[2248],{"type":76,"value":1285},{"type":70,"tag":110,"props":2250,"children":2252},{"class":112,"line":2251},58,[2253,2258,2262],{"type":70,"tag":110,"props":2254,"children":2255},{"style":133},[2256],{"type":76,"value":2257},"    \u003C\u002F",{"type":70,"tag":110,"props":2259,"children":2260},{"style":139},[2261],{"type":76,"value":1280},{"type":70,"tag":110,"props":2263,"children":2264},{"style":133},[2265],{"type":76,"value":1285},{"type":70,"tag":110,"props":2267,"children":2269},{"class":112,"line":2268},59,[2270],{"type":70,"tag":110,"props":2271,"children":2272},{"style":330},[2273],{"type":76,"value":2274},"  )\n",{"type":70,"tag":110,"props":2276,"children":2278},{"class":112,"line":2277},60,[2279],{"type":70,"tag":110,"props":2280,"children":2281},{"style":133},[2282],{"type":76,"value":1647},{"type":70,"tag":79,"props":2284,"children":2285},{},[2286,2288,2294],{"type":76,"value":2287},"Vue\u002FSolid\u002FSvelte\u002FPreact have identical patterns with different hook imports\n(e.g., ",{"type":70,"tag":106,"props":2289,"children":2291},{"className":2290},[],[2292],{"type":76,"value":2293},"import { useChat } from '@tanstack\u002Fai-solid'",{"type":76,"value":2295},").",{"type":70,"tag":85,"props":2297,"children":2299},{"id":2298},"core-patterns",[2300],{"type":76,"value":2301},"Core Patterns",{"type":70,"tag":92,"props":2303,"children":2305},{"id":2304},"_1-streaming-chat-with-sse",[2306],{"type":76,"value":2307},"1. Streaming Chat with SSE",{"type":70,"tag":79,"props":2309,"children":2310},{},[2311],{"type":76,"value":2312},"Server returns a streaming SSE Response; client parses it automatically.",{"type":70,"tag":79,"props":2314,"children":2315},{},[2316],{"type":70,"tag":1400,"props":2317,"children":2318},{},[2319],{"type":76,"value":2320},"Server:",{"type":70,"tag":99,"props":2322,"children":2324},{"className":101,"code":2323,"language":45,"meta":103,"style":103},"import { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { anthropicText } from '@tanstack\u002Fai-anthropic'\n\nconst stream = chat({\n  adapter: anthropicText('claude-sonnet-4-5'),\n  messages,\n  modelOptions: {\n    temperature: 0.7,\n    max_tokens: 2000, \u002F\u002F Anthropic-native key\n  },\n  systemPrompts: ['You are a helpful assistant.'],\n  abortController,\n})\n\nreturn toServerSentEventsResponse(stream, { abortController })\n",[2325],{"type":70,"tag":106,"props":2326,"children":2327},{"__ignoreMap":103},[2328,2371,2408,2415,2444,2485,2497,2513,2535,2561,2568,2604,2616,2627,2634],{"type":70,"tag":110,"props":2329,"children":2330},{"class":112,"line":113},[2331,2335,2339,2343,2347,2351,2355,2359,2363,2367],{"type":70,"tag":110,"props":2332,"children":2333},{"style":127},[2334],{"type":76,"value":130},{"type":70,"tag":110,"props":2336,"children":2337},{"style":133},[2338],{"type":76,"value":136},{"type":70,"tag":110,"props":2340,"children":2341},{"style":139},[2342],{"type":76,"value":185},{"type":70,"tag":110,"props":2344,"children":2345},{"style":133},[2346],{"type":76,"value":190},{"type":70,"tag":110,"props":2348,"children":2349},{"style":139},[2350],{"type":76,"value":195},{"type":70,"tag":110,"props":2352,"children":2353},{"style":133},[2354],{"type":76,"value":147},{"type":70,"tag":110,"props":2356,"children":2357},{"style":127},[2358],{"type":76,"value":152},{"type":70,"tag":110,"props":2360,"children":2361},{"style":133},[2362],{"type":76,"value":157},{"type":70,"tag":110,"props":2364,"children":2365},{"style":160},[2366],{"type":76,"value":212},{"type":70,"tag":110,"props":2368,"children":2369},{"style":133},[2370],{"type":76,"value":168},{"type":70,"tag":110,"props":2372,"children":2373},{"class":112,"line":123},[2374,2378,2382,2387,2391,2395,2399,2404],{"type":70,"tag":110,"props":2375,"children":2376},{"style":127},[2377],{"type":76,"value":130},{"type":70,"tag":110,"props":2379,"children":2380},{"style":133},[2381],{"type":76,"value":136},{"type":70,"tag":110,"props":2383,"children":2384},{"style":139},[2385],{"type":76,"value":2386}," anthropicText",{"type":70,"tag":110,"props":2388,"children":2389},{"style":133},[2390],{"type":76,"value":147},{"type":70,"tag":110,"props":2392,"children":2393},{"style":127},[2394],{"type":76,"value":152},{"type":70,"tag":110,"props":2396,"children":2397},{"style":133},[2398],{"type":76,"value":157},{"type":70,"tag":110,"props":2400,"children":2401},{"style":160},[2402],{"type":76,"value":2403},"@tanstack\u002Fai-anthropic",{"type":70,"tag":110,"props":2405,"children":2406},{"style":133},[2407],{"type":76,"value":168},{"type":70,"tag":110,"props":2409,"children":2410},{"class":112,"line":171},[2411],{"type":70,"tag":110,"props":2412,"children":2413},{"emptyLinePlaceholder":261},[2414],{"type":76,"value":264},{"type":70,"tag":110,"props":2416,"children":2417},{"class":112,"line":219},[2418,2423,2428,2432,2436,2440],{"type":70,"tag":110,"props":2419,"children":2420},{"style":276},[2421],{"type":76,"value":2422},"const",{"type":70,"tag":110,"props":2424,"children":2425},{"style":139},[2426],{"type":76,"value":2427}," stream ",{"type":70,"tag":110,"props":2429,"children":2430},{"style":133},[2431],{"type":76,"value":289},{"type":70,"tag":110,"props":2433,"children":2434},{"style":292},[2435],{"type":76,"value":185},{"type":70,"tag":110,"props":2437,"children":2438},{"style":139},[2439],{"type":76,"value":299},{"type":70,"tag":110,"props":2441,"children":2442},{"style":133},[2443],{"type":76,"value":323},{"type":70,"tag":110,"props":2445,"children":2446},{"class":112,"line":257},[2447,2452,2456,2460,2464,2468,2473,2477,2481],{"type":70,"tag":110,"props":2448,"children":2449},{"style":330},[2450],{"type":76,"value":2451},"  adapter",{"type":70,"tag":110,"props":2453,"children":2454},{"style":133},[2455],{"type":76,"value":338},{"type":70,"tag":110,"props":2457,"children":2458},{"style":292},[2459],{"type":76,"value":2386},{"type":70,"tag":110,"props":2461,"children":2462},{"style":139},[2463],{"type":76,"value":299},{"type":70,"tag":110,"props":2465,"children":2466},{"style":133},[2467],{"type":76,"value":304},{"type":70,"tag":110,"props":2469,"children":2470},{"style":160},[2471],{"type":76,"value":2472},"claude-sonnet-4-5",{"type":70,"tag":110,"props":2474,"children":2475},{"style":133},[2476],{"type":76,"value":304},{"type":70,"tag":110,"props":2478,"children":2479},{"style":139},[2480],{"type":76,"value":583},{"type":70,"tag":110,"props":2482,"children":2483},{"style":133},[2484],{"type":76,"value":588},{"type":70,"tag":110,"props":2486,"children":2487},{"class":112,"line":267},[2488,2493],{"type":70,"tag":110,"props":2489,"children":2490},{"style":139},[2491],{"type":76,"value":2492},"  messages",{"type":70,"tag":110,"props":2494,"children":2495},{"style":133},[2496],{"type":76,"value":588},{"type":70,"tag":110,"props":2498,"children":2499},{"class":112,"line":326},[2500,2505,2509],{"type":70,"tag":110,"props":2501,"children":2502},{"style":330},[2503],{"type":76,"value":2504},"  modelOptions",{"type":70,"tag":110,"props":2506,"children":2507},{"style":133},[2508],{"type":76,"value":338},{"type":70,"tag":110,"props":2510,"children":2511},{"style":133},[2512],{"type":76,"value":343},{"type":70,"tag":110,"props":2514,"children":2515},{"class":112,"line":346},[2516,2521,2525,2531],{"type":70,"tag":110,"props":2517,"children":2518},{"style":330},[2519],{"type":76,"value":2520},"    temperature",{"type":70,"tag":110,"props":2522,"children":2523},{"style":133},[2524],{"type":76,"value":338},{"type":70,"tag":110,"props":2526,"children":2528},{"style":2527},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[2529],{"type":76,"value":2530}," 0.7",{"type":70,"tag":110,"props":2532,"children":2533},{"style":133},[2534],{"type":76,"value":588},{"type":70,"tag":110,"props":2536,"children":2537},{"class":112,"line":363},[2538,2543,2547,2552,2556],{"type":70,"tag":110,"props":2539,"children":2540},{"style":330},[2541],{"type":76,"value":2542},"    max_tokens",{"type":70,"tag":110,"props":2544,"children":2545},{"style":133},[2546],{"type":76,"value":338},{"type":70,"tag":110,"props":2548,"children":2549},{"style":2527},[2550],{"type":76,"value":2551}," 2000",{"type":70,"tag":110,"props":2553,"children":2554},{"style":133},[2555],{"type":76,"value":190},{"type":70,"tag":110,"props":2557,"children":2558},{"style":117},[2559],{"type":76,"value":2560}," \u002F\u002F Anthropic-native key\n",{"type":70,"tag":110,"props":2562,"children":2563},{"class":112,"line":406},[2564],{"type":70,"tag":110,"props":2565,"children":2566},{"style":133},[2567],{"type":76,"value":745},{"type":70,"tag":110,"props":2569,"children":2570},{"class":112,"line":440},[2571,2576,2580,2584,2588,2592,2596,2600],{"type":70,"tag":110,"props":2572,"children":2573},{"style":330},[2574],{"type":76,"value":2575},"  systemPrompts",{"type":70,"tag":110,"props":2577,"children":2578},{"style":133},[2579],{"type":76,"value":338},{"type":70,"tag":110,"props":2581,"children":2582},{"style":139},[2583],{"type":76,"value":619},{"type":70,"tag":110,"props":2585,"children":2586},{"style":133},[2587],{"type":76,"value":304},{"type":70,"tag":110,"props":2589,"children":2590},{"style":160},[2591],{"type":76,"value":628},{"type":70,"tag":110,"props":2593,"children":2594},{"style":133},[2595],{"type":76,"value":304},{"type":70,"tag":110,"props":2597,"children":2598},{"style":139},[2599],{"type":76,"value":637},{"type":70,"tag":110,"props":2601,"children":2602},{"style":133},[2603],{"type":76,"value":588},{"type":70,"tag":110,"props":2605,"children":2606},{"class":112,"line":480},[2607,2612],{"type":70,"tag":110,"props":2608,"children":2609},{"style":139},[2610],{"type":76,"value":2611},"  abortController",{"type":70,"tag":110,"props":2613,"children":2614},{"style":133},[2615],{"type":76,"value":588},{"type":70,"tag":110,"props":2617,"children":2618},{"class":112,"line":510},[2619,2623],{"type":70,"tag":110,"props":2620,"children":2621},{"style":133},[2622],{"type":76,"value":754},{"type":70,"tag":110,"props":2624,"children":2625},{"style":139},[2626],{"type":76,"value":668},{"type":70,"tag":110,"props":2628,"children":2629},{"class":112,"line":518},[2630],{"type":70,"tag":110,"props":2631,"children":2632},{"emptyLinePlaceholder":261},[2633],{"type":76,"value":264},{"type":70,"tag":110,"props":2635,"children":2636},{"class":112,"line":547},[2637,2642,2646,2651,2655,2659,2664,2668],{"type":70,"tag":110,"props":2638,"children":2639},{"style":127},[2640],{"type":76,"value":2641},"return",{"type":70,"tag":110,"props":2643,"children":2644},{"style":292},[2645],{"type":76,"value":195},{"type":70,"tag":110,"props":2647,"children":2648},{"style":139},[2649],{"type":76,"value":2650},"(stream",{"type":70,"tag":110,"props":2652,"children":2653},{"style":133},[2654],{"type":76,"value":190},{"type":70,"tag":110,"props":2656,"children":2657},{"style":133},[2658],{"type":76,"value":136},{"type":70,"tag":110,"props":2660,"children":2661},{"style":139},[2662],{"type":76,"value":2663}," abortController ",{"type":70,"tag":110,"props":2665,"children":2666},{"style":133},[2667],{"type":76,"value":754},{"type":70,"tag":110,"props":2669,"children":2670},{"style":139},[2671],{"type":76,"value":668},{"type":70,"tag":79,"props":2673,"children":2674},{},[2675,2677,2683,2685,2691,2693,2698,2700,2706,2707,2713,2715,2721,2723,2729,2731,2737,2739,2745,2747,2753],{"type":76,"value":2676},"To make the SSE response resumable (reconnect after a drop\u002Frefresh without\nre-running the provider), pass a delivery-durability adapter:\n",{"type":70,"tag":106,"props":2678,"children":2680},{"className":2679},[],[2681],{"type":76,"value":2682},"toServerSentEventsResponse(stream, { durability: { adapter: memoryStream(request) } })",{"type":76,"value":2684},"\n(",{"type":70,"tag":106,"props":2686,"children":2688},{"className":2687},[],[2689],{"type":76,"value":2690},"memoryStream",{"type":76,"value":2692}," from ",{"type":70,"tag":106,"props":2694,"children":2696},{"className":2695},[],[2697],{"type":76,"value":212},{"type":76,"value":2699}," is process-local, for dev\u002Ftests) or\n",{"type":70,"tag":106,"props":2701,"children":2703},{"className":2702},[],[2704],{"type":76,"value":2705},"durableStream(request, { server })",{"type":76,"value":2692},{"type":70,"tag":106,"props":2708,"children":2710},{"className":2709},[],[2711],{"type":76,"value":2712},"@tanstack\u002Fai-durable-stream",{"type":76,"value":2714},"\n(Durable Streams protocol, production). Each SSE event gets an opaque\nadapter-owned ",{"type":70,"tag":106,"props":2716,"children":2718},{"className":2717},[],[2719],{"type":76,"value":2720},"id:",{"type":76,"value":2722},"; ",{"type":70,"tag":106,"props":2724,"children":2726},{"className":2725},[],[2727],{"type":76,"value":2728},"fetchServerSentEvents",{"type":76,"value":2730}," auto-reconnects with\n",{"type":70,"tag":106,"props":2732,"children":2734},{"className":2733},[],[2735],{"type":76,"value":2736},"Last-Event-ID",{"type":76,"value":2738}," and exposes ",{"type":70,"tag":106,"props":2740,"children":2742},{"className":2741},[],[2743],{"type":76,"value":2744},"joinRun(runId)",{"type":76,"value":2746}," to replay a run from the start.\nSee ",{"type":70,"tag":106,"props":2748,"children":2750},{"className":2749},[],[2751],{"type":76,"value":2752},"docs\u002Fresumable-streams\u002Foverview.md",{"type":76,"value":468},{"type":70,"tag":79,"props":2755,"children":2756},{},[2757],{"type":70,"tag":1400,"props":2758,"children":2759},{},[2760],{"type":76,"value":2761},"Client:",{"type":70,"tag":99,"props":2763,"children":2765},{"className":101,"code":2764,"language":45,"meta":103,"style":103},"import { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage, isLoading, error, stop, status } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n  body: { provider: 'anthropic', model: 'claude-sonnet-4-5' },\n  onFinish: (message) => {\n    console.log('Response complete:', message.id)\n  },\n  onError: (err) => {\n    console.error('Stream error:', err)\n  },\n})\n",[2766],{"type":70,"tag":106,"props":2767,"children":2768},{"__ignoreMap":103},[2769,2812,2819,2895,2935,3002,3034,3089,3096,3129,3174,3181],{"type":70,"tag":110,"props":2770,"children":2771},{"class":112,"line":113},[2772,2776,2780,2784,2788,2792,2796,2800,2804,2808],{"type":70,"tag":110,"props":2773,"children":2774},{"style":127},[2775],{"type":76,"value":130},{"type":70,"tag":110,"props":2777,"children":2778},{"style":133},[2779],{"type":76,"value":136},{"type":70,"tag":110,"props":2781,"children":2782},{"style":139},[2783],{"type":76,"value":831},{"type":70,"tag":110,"props":2785,"children":2786},{"style":133},[2787],{"type":76,"value":190},{"type":70,"tag":110,"props":2789,"children":2790},{"style":139},[2791],{"type":76,"value":840},{"type":70,"tag":110,"props":2793,"children":2794},{"style":133},[2795],{"type":76,"value":147},{"type":70,"tag":110,"props":2797,"children":2798},{"style":127},[2799],{"type":76,"value":152},{"type":70,"tag":110,"props":2801,"children":2802},{"style":133},[2803],{"type":76,"value":157},{"type":70,"tag":110,"props":2805,"children":2806},{"style":160},[2807],{"type":76,"value":857},{"type":70,"tag":110,"props":2809,"children":2810},{"style":133},[2811],{"type":76,"value":168},{"type":70,"tag":110,"props":2813,"children":2814},{"class":112,"line":123},[2815],{"type":70,"tag":110,"props":2816,"children":2817},{"emptyLinePlaceholder":261},[2818],{"type":76,"value":264},{"type":70,"tag":110,"props":2820,"children":2821},{"class":112,"line":171},[2822,2826,2830,2834,2838,2842,2846,2850,2854,2858,2862,2866,2870,2875,2879,2883,2887,2891],{"type":70,"tag":110,"props":2823,"children":2824},{"style":276},[2825],{"type":76,"value":2422},{"type":70,"tag":110,"props":2827,"children":2828},{"style":133},[2829],{"type":76,"value":136},{"type":70,"tag":110,"props":2831,"children":2832},{"style":139},[2833],{"type":76,"value":494},{"type":70,"tag":110,"props":2835,"children":2836},{"style":133},[2837],{"type":76,"value":190},{"type":70,"tag":110,"props":2839,"children":2840},{"style":139},[2841],{"type":76,"value":1013},{"type":70,"tag":110,"props":2843,"children":2844},{"style":133},[2845],{"type":76,"value":190},{"type":70,"tag":110,"props":2847,"children":2848},{"style":139},[2849],{"type":76,"value":1022},{"type":70,"tag":110,"props":2851,"children":2852},{"style":133},[2853],{"type":76,"value":190},{"type":70,"tag":110,"props":2855,"children":2856},{"style":139},[2857],{"type":76,"value":1031},{"type":70,"tag":110,"props":2859,"children":2860},{"style":133},[2861],{"type":76,"value":190},{"type":70,"tag":110,"props":2863,"children":2864},{"style":139},[2865],{"type":76,"value":1040},{"type":70,"tag":110,"props":2867,"children":2868},{"style":133},[2869],{"type":76,"value":190},{"type":70,"tag":110,"props":2871,"children":2872},{"style":139},[2873],{"type":76,"value":2874}," status ",{"type":70,"tag":110,"props":2876,"children":2877},{"style":133},[2878],{"type":76,"value":754},{"type":70,"tag":110,"props":2880,"children":2881},{"style":133},[2882],{"type":76,"value":422},{"type":70,"tag":110,"props":2884,"children":2885},{"style":292},[2886],{"type":76,"value":831},{"type":70,"tag":110,"props":2888,"children":2889},{"style":139},[2890],{"type":76,"value":299},{"type":70,"tag":110,"props":2892,"children":2893},{"style":133},[2894],{"type":76,"value":323},{"type":70,"tag":110,"props":2896,"children":2897},{"class":112,"line":219},[2898,2903,2907,2911,2915,2919,2923,2927,2931],{"type":70,"tag":110,"props":2899,"children":2900},{"style":330},[2901],{"type":76,"value":2902},"  connection",{"type":70,"tag":110,"props":2904,"children":2905},{"style":133},[2906],{"type":76,"value":338},{"type":70,"tag":110,"props":2908,"children":2909},{"style":292},[2910],{"type":76,"value":840},{"type":70,"tag":110,"props":2912,"children":2913},{"style":139},[2914],{"type":76,"value":299},{"type":70,"tag":110,"props":2916,"children":2917},{"style":133},[2918],{"type":76,"value":304},{"type":70,"tag":110,"props":2920,"children":2921},{"style":160},[2922],{"type":76,"value":309},{"type":70,"tag":110,"props":2924,"children":2925},{"style":133},[2926],{"type":76,"value":304},{"type":70,"tag":110,"props":2928,"children":2929},{"style":139},[2930],{"type":76,"value":583},{"type":70,"tag":110,"props":2932,"children":2933},{"style":133},[2934],{"type":76,"value":588},{"type":70,"tag":110,"props":2936,"children":2937},{"class":112,"line":257},[2938,2943,2947,2951,2956,2960,2964,2968,2972,2976,2981,2985,2989,2993,2997],{"type":70,"tag":110,"props":2939,"children":2940},{"style":330},[2941],{"type":76,"value":2942},"  body",{"type":70,"tag":110,"props":2944,"children":2945},{"style":133},[2946],{"type":76,"value":338},{"type":70,"tag":110,"props":2948,"children":2949},{"style":133},[2950],{"type":76,"value":136},{"type":70,"tag":110,"props":2952,"children":2953},{"style":330},[2954],{"type":76,"value":2955}," provider",{"type":70,"tag":110,"props":2957,"children":2958},{"style":133},[2959],{"type":76,"value":338},{"type":70,"tag":110,"props":2961,"children":2962},{"style":133},[2963],{"type":76,"value":157},{"type":70,"tag":110,"props":2965,"children":2966},{"style":160},[2967],{"type":76,"value":33},{"type":70,"tag":110,"props":2969,"children":2970},{"style":133},[2971],{"type":76,"value":304},{"type":70,"tag":110,"props":2973,"children":2974},{"style":133},[2975],{"type":76,"value":190},{"type":70,"tag":110,"props":2977,"children":2978},{"style":330},[2979],{"type":76,"value":2980}," model",{"type":70,"tag":110,"props":2982,"children":2983},{"style":133},[2984],{"type":76,"value":338},{"type":70,"tag":110,"props":2986,"children":2987},{"style":133},[2988],{"type":76,"value":157},{"type":70,"tag":110,"props":2990,"children":2991},{"style":160},[2992],{"type":76,"value":2472},{"type":70,"tag":110,"props":2994,"children":2995},{"style":133},[2996],{"type":76,"value":304},{"type":70,"tag":110,"props":2998,"children":2999},{"style":133},[3000],{"type":76,"value":3001}," },\n",{"type":70,"tag":110,"props":3003,"children":3004},{"class":112,"line":267},[3005,3010,3014,3018,3022,3026,3030],{"type":70,"tag":110,"props":3006,"children":3007},{"style":292},[3008],{"type":76,"value":3009},"  onFinish",{"type":70,"tag":110,"props":3011,"children":3012},{"style":133},[3013],{"type":76,"value":338},{"type":70,"tag":110,"props":3015,"children":3016},{"style":133},[3017],{"type":76,"value":1161},{"type":70,"tag":110,"props":3019,"children":3020},{"style":386},[3021],{"type":76,"value":1450},{"type":70,"tag":110,"props":3023,"children":3024},{"style":133},[3025],{"type":76,"value":583},{"type":70,"tag":110,"props":3027,"children":3028},{"style":276},[3029],{"type":76,"value":399},{"type":70,"tag":110,"props":3031,"children":3032},{"style":133},[3033],{"type":76,"value":343},{"type":70,"tag":110,"props":3035,"children":3036},{"class":112,"line":326},[3037,3042,3046,3051,3055,3059,3064,3068,3072,3077,3081,3085],{"type":70,"tag":110,"props":3038,"children":3039},{"style":139},[3040],{"type":76,"value":3041},"    console",{"type":70,"tag":110,"props":3043,"children":3044},{"style":133},[3045],{"type":76,"value":468},{"type":70,"tag":110,"props":3047,"children":3048},{"style":292},[3049],{"type":76,"value":3050},"log",{"type":70,"tag":110,"props":3052,"children":3053},{"style":330},[3054],{"type":76,"value":299},{"type":70,"tag":110,"props":3056,"children":3057},{"style":133},[3058],{"type":76,"value":304},{"type":70,"tag":110,"props":3060,"children":3061},{"style":160},[3062],{"type":76,"value":3063},"Response complete:",{"type":70,"tag":110,"props":3065,"children":3066},{"style":133},[3067],{"type":76,"value":304},{"type":70,"tag":110,"props":3069,"children":3070},{"style":133},[3071],{"type":76,"value":190},{"type":70,"tag":110,"props":3073,"children":3074},{"style":139},[3075],{"type":76,"value":3076}," message",{"type":70,"tag":110,"props":3078,"children":3079},{"style":133},[3080],{"type":76,"value":468},{"type":70,"tag":110,"props":3082,"children":3083},{"style":139},[3084],{"type":76,"value":1382},{"type":70,"tag":110,"props":3086,"children":3087},{"style":330},[3088],{"type":76,"value":668},{"type":70,"tag":110,"props":3090,"children":3091},{"class":112,"line":346},[3092],{"type":70,"tag":110,"props":3093,"children":3094},{"style":133},[3095],{"type":76,"value":745},{"type":70,"tag":110,"props":3097,"children":3098},{"class":112,"line":363},[3099,3104,3108,3112,3117,3121,3125],{"type":70,"tag":110,"props":3100,"children":3101},{"style":292},[3102],{"type":76,"value":3103},"  onError",{"type":70,"tag":110,"props":3105,"children":3106},{"style":133},[3107],{"type":76,"value":338},{"type":70,"tag":110,"props":3109,"children":3110},{"style":133},[3111],{"type":76,"value":1161},{"type":70,"tag":110,"props":3113,"children":3114},{"style":386},[3115],{"type":76,"value":3116},"err",{"type":70,"tag":110,"props":3118,"children":3119},{"style":133},[3120],{"type":76,"value":583},{"type":70,"tag":110,"props":3122,"children":3123},{"style":276},[3124],{"type":76,"value":399},{"type":70,"tag":110,"props":3126,"children":3127},{"style":133},[3128],{"type":76,"value":343},{"type":70,"tag":110,"props":3130,"children":3131},{"class":112,"line":406},[3132,3136,3140,3144,3148,3152,3157,3161,3165,3170],{"type":70,"tag":110,"props":3133,"children":3134},{"style":139},[3135],{"type":76,"value":3041},{"type":70,"tag":110,"props":3137,"children":3138},{"style":133},[3139],{"type":76,"value":468},{"type":70,"tag":110,"props":3141,"children":3142},{"style":292},[3143],{"type":76,"value":1716},{"type":70,"tag":110,"props":3145,"children":3146},{"style":330},[3147],{"type":76,"value":299},{"type":70,"tag":110,"props":3149,"children":3150},{"style":133},[3151],{"type":76,"value":304},{"type":70,"tag":110,"props":3153,"children":3154},{"style":160},[3155],{"type":76,"value":3156},"Stream error:",{"type":70,"tag":110,"props":3158,"children":3159},{"style":133},[3160],{"type":76,"value":304},{"type":70,"tag":110,"props":3162,"children":3163},{"style":133},[3164],{"type":76,"value":190},{"type":70,"tag":110,"props":3166,"children":3167},{"style":139},[3168],{"type":76,"value":3169}," err",{"type":70,"tag":110,"props":3171,"children":3172},{"style":330},[3173],{"type":76,"value":668},{"type":70,"tag":110,"props":3175,"children":3176},{"class":112,"line":440},[3177],{"type":70,"tag":110,"props":3178,"children":3179},{"style":133},[3180],{"type":76,"value":745},{"type":70,"tag":110,"props":3182,"children":3183},{"class":112,"line":480},[3184,3188],{"type":70,"tag":110,"props":3185,"children":3186},{"style":133},[3187],{"type":76,"value":754},{"type":70,"tag":110,"props":3189,"children":3190},{"style":139},[3191],{"type":76,"value":668},{"type":70,"tag":79,"props":3193,"children":3194},{},[3195,3197,3203,3205,3210,3212,3218,3220,3226],{"type":76,"value":3196},"The ",{"type":70,"tag":106,"props":3198,"children":3200},{"className":3199},[],[3201],{"type":76,"value":3202},"body",{"type":76,"value":3204}," field is merged into the POST request body alongside ",{"type":70,"tag":106,"props":3206,"children":3208},{"className":3207},[],[3209],{"type":76,"value":1314},{"type":76,"value":3211},",\nletting the server read ",{"type":70,"tag":106,"props":3213,"children":3215},{"className":3214},[],[3216],{"type":76,"value":3217},"data.provider",{"type":76,"value":3219},", ",{"type":70,"tag":106,"props":3221,"children":3223},{"className":3222},[],[3224],{"type":76,"value":3225},"data.model",{"type":76,"value":3227},", etc.",{"type":70,"tag":79,"props":3229,"children":3230},{},[3231,3232,3238,3240,3246,3248,3254,3255,3261,3262,3268],{"type":76,"value":3196},{"type":70,"tag":106,"props":3233,"children":3235},{"className":3234},[],[3236],{"type":76,"value":3237},"status",{"type":76,"value":3239}," field tracks the chat lifecycle: ",{"type":70,"tag":106,"props":3241,"children":3243},{"className":3242},[],[3244],{"type":76,"value":3245},"'ready'",{"type":76,"value":3247}," | ",{"type":70,"tag":106,"props":3249,"children":3251},{"className":3250},[],[3252],{"type":76,"value":3253},"'submitted'",{"type":76,"value":3247},{"type":70,"tag":106,"props":3256,"children":3258},{"className":3257},[],[3259],{"type":76,"value":3260},"'streaming'",{"type":76,"value":3247},{"type":70,"tag":106,"props":3263,"children":3265},{"className":3264},[],[3266],{"type":76,"value":3267},"'error'",{"type":76,"value":468},{"type":70,"tag":92,"props":3270,"children":3272},{"id":3271},"_2-rendering-thinkingreasoning-content",[3273],{"type":76,"value":3274},"2. Rendering Thinking\u002FReasoning Content",{"type":70,"tag":79,"props":3276,"children":3277},{},[3278,3280,3286],{"type":76,"value":3279},"Models with extended thinking (Claude, Gemini) emit ",{"type":70,"tag":106,"props":3281,"children":3283},{"className":3282},[],[3284],{"type":76,"value":3285},"ThinkingPart",{"type":76,"value":3287}," in the message parts array.",{"type":70,"tag":99,"props":3289,"children":3291},{"className":101,"code":3290,"language":45,"meta":103,"style":103},"import type { UIMessage } from '@tanstack\u002Fai-react'\n\nfunction MessageRenderer({ message }: { message: UIMessage }) {\n  return (\n    \u003Cdiv>\n      {message.parts.map((part, i) => {\n        if (part.type === 'thinking') {\n          const isComplete = message.parts\n            .slice(i + 1)\n            .some((p) => p.type === 'text')\n          return (\n            \u003Cdetails key={i} open={!isComplete}>\n              \u003Csummary>{isComplete ? 'Thought process' : 'Thinking...'}\u003C\u002Fsummary>\n              \u003Cpre>{part.content}\u003C\u002Fpre>\n            \u003C\u002Fdetails>\n          )\n        }\n\n        if (part.type === 'text' && part.content) {\n          return \u003Cp key={i}>{part.content}\u003C\u002Fp>\n        }\n\n        if (part.type === 'tool-call') {\n          return (\n            \u003Cdiv key={part.id}>\n              Tool call: {part.name} ({part.state})\n            \u003C\u002Fdiv>\n          )\n        }\n\n        return null\n      })}\n    \u003C\u002Fdiv>\n  )\n}\n",[3292],{"type":70,"tag":106,"props":3293,"children":3294},{"__ignoreMap":103},[3295,3334,3341,3391,3402,3417,3472,3509,3539,3574,3640,3652,3702,3771,3810,3826,3834,3842,3849,3889,3952,3959,3966,4002,4013,4044,4111,4126,4133,4140,4147,4159,4175,4190,4197],{"type":70,"tag":110,"props":3296,"children":3297},{"class":112,"line":113},[3298,3302,3306,3310,3314,3318,3322,3326,3330],{"type":70,"tag":110,"props":3299,"children":3300},{"style":127},[3301],{"type":76,"value":130},{"type":70,"tag":110,"props":3303,"children":3304},{"style":127},[3305],{"type":76,"value":873},{"type":70,"tag":110,"props":3307,"children":3308},{"style":133},[3309],{"type":76,"value":136},{"type":70,"tag":110,"props":3311,"children":3312},{"style":139},[3313],{"type":76,"value":882},{"type":70,"tag":110,"props":3315,"children":3316},{"style":133},[3317],{"type":76,"value":147},{"type":70,"tag":110,"props":3319,"children":3320},{"style":127},[3321],{"type":76,"value":152},{"type":70,"tag":110,"props":3323,"children":3324},{"style":133},[3325],{"type":76,"value":157},{"type":70,"tag":110,"props":3327,"children":3328},{"style":160},[3329],{"type":76,"value":857},{"type":70,"tag":110,"props":3331,"children":3332},{"style":133},[3333],{"type":76,"value":168},{"type":70,"tag":110,"props":3335,"children":3336},{"class":112,"line":123},[3337],{"type":70,"tag":110,"props":3338,"children":3339},{"emptyLinePlaceholder":261},[3340],{"type":76,"value":264},{"type":70,"tag":110,"props":3342,"children":3343},{"class":112,"line":171},[3344,3348,3353,3358,3362,3367,3371,3375,3379,3383,3387],{"type":70,"tag":110,"props":3345,"children":3346},{"style":276},[3347],{"type":76,"value":917},{"type":70,"tag":110,"props":3349,"children":3350},{"style":292},[3351],{"type":76,"value":3352}," MessageRenderer",{"type":70,"tag":110,"props":3354,"children":3355},{"style":133},[3356],{"type":76,"value":3357},"({",{"type":70,"tag":110,"props":3359,"children":3360},{"style":386},[3361],{"type":76,"value":3076},{"type":70,"tag":110,"props":3363,"children":3364},{"style":133},[3365],{"type":76,"value":3366}," }:",{"type":70,"tag":110,"props":3368,"children":3369},{"style":133},[3370],{"type":76,"value":136},{"type":70,"tag":110,"props":3372,"children":3373},{"style":330},[3374],{"type":76,"value":3076},{"type":70,"tag":110,"props":3376,"children":3377},{"style":133},[3378],{"type":76,"value":338},{"type":70,"tag":110,"props":3380,"children":3381},{"style":1277},[3382],{"type":76,"value":882},{"type":70,"tag":110,"props":3384,"children":3385},{"style":133},[3386],{"type":76,"value":394},{"type":70,"tag":110,"props":3388,"children":3389},{"style":133},[3390],{"type":76,"value":343},{"type":70,"tag":110,"props":3392,"children":3393},{"class":112,"line":219},[3394,3398],{"type":70,"tag":110,"props":3395,"children":3396},{"style":127},[3397],{"type":76,"value":1261},{"type":70,"tag":110,"props":3399,"children":3400},{"style":330},[3401],{"type":76,"value":1266},{"type":70,"tag":110,"props":3403,"children":3404},{"class":112,"line":257},[3405,3409,3413],{"type":70,"tag":110,"props":3406,"children":3407},{"style":330},[3408],{"type":76,"value":1274},{"type":70,"tag":110,"props":3410,"children":3411},{"style":1277},[3412],{"type":76,"value":1280},{"type":70,"tag":110,"props":3414,"children":3415},{"style":330},[3416],{"type":76,"value":1285},{"type":70,"tag":110,"props":3418,"children":3419},{"class":112,"line":267},[3420,3424,3428,3432,3436,3440,3444,3448,3452,3456,3460,3464,3468],{"type":70,"tag":110,"props":3421,"children":3422},{"style":133},[3423],{"type":76,"value":1711},{"type":70,"tag":110,"props":3425,"children":3426},{"style":386},[3427],{"type":76,"value":1450},{"type":70,"tag":110,"props":3429,"children":3430},{"style":330},[3431],{"type":76,"value":468},{"type":70,"tag":110,"props":3433,"children":3434},{"style":386},[3435],{"type":76,"value":1459},{"type":70,"tag":110,"props":3437,"children":3438},{"style":330},[3439],{"type":76,"value":468},{"type":70,"tag":110,"props":3441,"children":3442},{"style":386},[3443],{"type":76,"value":1323},{"type":70,"tag":110,"props":3445,"children":3446},{"style":330},[3447],{"type":76,"value":1472},{"type":70,"tag":110,"props":3449,"children":3450},{"style":386},[3451],{"type":76,"value":1477},{"type":70,"tag":110,"props":3453,"children":3454},{"style":133},[3455],{"type":76,"value":190},{"type":70,"tag":110,"props":3457,"children":3458},{"style":386},[3459],{"type":76,"value":1486},{"type":70,"tag":110,"props":3461,"children":3462},{"style":330},[3463],{"type":76,"value":1341},{"type":70,"tag":110,"props":3465,"children":3466},{"style":133},[3467],{"type":76,"value":1346},{"type":70,"tag":110,"props":3469,"children":3470},{"style":133},[3471],{"type":76,"value":343},{"type":70,"tag":110,"props":3473,"children":3474},{"class":112,"line":326},[3475,3480,3484,3488,3492,3497,3501,3505],{"type":70,"tag":110,"props":3476,"children":3477},{"style":330},[3478],{"type":76,"value":3479},"        if ",{"type":70,"tag":110,"props":3481,"children":3482},{"style":133},[3483],{"type":76,"value":299},{"type":70,"tag":110,"props":3485,"children":3486},{"style":330},[3487],{"type":76,"value":1516},{"type":70,"tag":110,"props":3489,"children":3490},{"style":133},[3491],{"type":76,"value":304},{"type":70,"tag":110,"props":3493,"children":3494},{"style":160},[3495],{"type":76,"value":3496},"thinking",{"type":70,"tag":110,"props":3498,"children":3499},{"style":133},[3500],{"type":76,"value":304},{"type":70,"tag":110,"props":3502,"children":3503},{"style":133},[3504],{"type":76,"value":583},{"type":70,"tag":110,"props":3506,"children":3507},{"style":133},[3508],{"type":76,"value":343},{"type":70,"tag":110,"props":3510,"children":3511},{"class":112,"line":346},[3512,3517,3522,3526,3530,3534],{"type":70,"tag":110,"props":3513,"children":3514},{"style":276},[3515],{"type":76,"value":3516},"          const",{"type":70,"tag":110,"props":3518,"children":3519},{"style":139},[3520],{"type":76,"value":3521}," isComplete",{"type":70,"tag":110,"props":3523,"children":3524},{"style":133},[3525],{"type":76,"value":422},{"type":70,"tag":110,"props":3527,"children":3528},{"style":139},[3529],{"type":76,"value":3076},{"type":70,"tag":110,"props":3531,"children":3532},{"style":133},[3533],{"type":76,"value":468},{"type":70,"tag":110,"props":3535,"children":3536},{"style":139},[3537],{"type":76,"value":3538},"parts\n",{"type":70,"tag":110,"props":3540,"children":3541},{"class":112,"line":363},[3542,3547,3552,3556,3560,3565,3570],{"type":70,"tag":110,"props":3543,"children":3544},{"style":133},[3545],{"type":76,"value":3546},"            .",{"type":70,"tag":110,"props":3548,"children":3549},{"style":292},[3550],{"type":76,"value":3551},"slice",{"type":70,"tag":110,"props":3553,"children":3554},{"style":330},[3555],{"type":76,"value":299},{"type":70,"tag":110,"props":3557,"children":3558},{"style":139},[3559],{"type":76,"value":1571},{"type":70,"tag":110,"props":3561,"children":3562},{"style":133},[3563],{"type":76,"value":3564}," +",{"type":70,"tag":110,"props":3566,"children":3567},{"style":2527},[3568],{"type":76,"value":3569}," 1",{"type":70,"tag":110,"props":3571,"children":3572},{"style":330},[3573],{"type":76,"value":668},{"type":70,"tag":110,"props":3575,"children":3576},{"class":112,"line":406},[3577,3581,3586,3590,3594,3598,3602,3606,3611,3615,3620,3624,3628,3632,3636],{"type":70,"tag":110,"props":3578,"children":3579},{"style":133},[3580],{"type":76,"value":3546},{"type":70,"tag":110,"props":3582,"children":3583},{"style":292},[3584],{"type":76,"value":3585},"some",{"type":70,"tag":110,"props":3587,"children":3588},{"style":330},[3589],{"type":76,"value":299},{"type":70,"tag":110,"props":3591,"children":3592},{"style":133},[3593],{"type":76,"value":299},{"type":70,"tag":110,"props":3595,"children":3596},{"style":386},[3597],{"type":76,"value":79},{"type":70,"tag":110,"props":3599,"children":3600},{"style":133},[3601],{"type":76,"value":583},{"type":70,"tag":110,"props":3603,"children":3604},{"style":276},[3605],{"type":76,"value":399},{"type":70,"tag":110,"props":3607,"children":3608},{"style":139},[3609],{"type":76,"value":3610}," p",{"type":70,"tag":110,"props":3612,"children":3613},{"style":133},[3614],{"type":76,"value":468},{"type":70,"tag":110,"props":3616,"children":3617},{"style":139},[3618],{"type":76,"value":3619},"type",{"type":70,"tag":110,"props":3621,"children":3622},{"style":133},[3623],{"type":76,"value":1916},{"type":70,"tag":110,"props":3625,"children":3626},{"style":133},[3627],{"type":76,"value":157},{"type":70,"tag":110,"props":3629,"children":3630},{"style":160},[3631],{"type":76,"value":76},{"type":70,"tag":110,"props":3633,"children":3634},{"style":133},[3635],{"type":76,"value":304},{"type":70,"tag":110,"props":3637,"children":3638},{"style":330},[3639],{"type":76,"value":668},{"type":70,"tag":110,"props":3641,"children":3642},{"class":112,"line":440},[3643,3648],{"type":70,"tag":110,"props":3644,"children":3645},{"style":127},[3646],{"type":76,"value":3647},"          return",{"type":70,"tag":110,"props":3649,"children":3650},{"style":330},[3651],{"type":76,"value":1266},{"type":70,"tag":110,"props":3653,"children":3654},{"class":112,"line":480},[3655,3659,3664,3668,3672,3676,3680,3685,3689,3693,3698],{"type":70,"tag":110,"props":3656,"children":3657},{"style":133},[3658],{"type":76,"value":1395},{"type":70,"tag":110,"props":3660,"children":3661},{"style":139},[3662],{"type":76,"value":3663},"details",{"type":70,"tag":110,"props":3665,"children":3666},{"style":139},[3667],{"type":76,"value":1367},{"type":70,"tag":110,"props":3669,"children":3670},{"style":133},[3671],{"type":76,"value":1372},{"type":70,"tag":110,"props":3673,"children":3674},{"style":139},[3675],{"type":76,"value":1571},{"type":70,"tag":110,"props":3677,"children":3678},{"style":133},[3679],{"type":76,"value":754},{"type":70,"tag":110,"props":3681,"children":3682},{"style":139},[3683],{"type":76,"value":3684}," open",{"type":70,"tag":110,"props":3686,"children":3687},{"style":133},[3688],{"type":76,"value":1372},{"type":70,"tag":110,"props":3690,"children":3691},{"style":330},[3692],{"type":76,"value":1166},{"type":70,"tag":110,"props":3694,"children":3695},{"style":139},[3696],{"type":76,"value":3697},"isComplete",{"type":70,"tag":110,"props":3699,"children":3700},{"style":133},[3701],{"type":76,"value":1387},{"type":70,"tag":110,"props":3703,"children":3704},{"class":112,"line":510},[3705,3710,3715,3719,3723,3728,3732,3737,3741,3746,3750,3755,3759,3763,3767],{"type":70,"tag":110,"props":3706,"children":3707},{"style":330},[3708],{"type":76,"value":3709},"              \u003C",{"type":70,"tag":110,"props":3711,"children":3712},{"style":1277},[3713],{"type":76,"value":3714},"summary",{"type":70,"tag":110,"props":3716,"children":3717},{"style":330},[3718],{"type":76,"value":1405},{"type":70,"tag":110,"props":3720,"children":3721},{"style":133},[3722],{"type":76,"value":1410},{"type":70,"tag":110,"props":3724,"children":3725},{"style":330},[3726],{"type":76,"value":3727},"isComplete ? ",{"type":70,"tag":110,"props":3729,"children":3730},{"style":133},[3731],{"type":76,"value":304},{"type":70,"tag":110,"props":3733,"children":3734},{"style":330},[3735],{"type":76,"value":3736},"Thought process",{"type":70,"tag":110,"props":3738,"children":3739},{"style":133},[3740],{"type":76,"value":304},{"type":70,"tag":110,"props":3742,"children":3743},{"style":133},[3744],{"type":76,"value":3745}," :",{"type":70,"tag":110,"props":3747,"children":3748},{"style":133},[3749],{"type":76,"value":157},{"type":70,"tag":110,"props":3751,"children":3752},{"style":160},[3753],{"type":76,"value":3754},"Thinking...",{"type":70,"tag":110,"props":3756,"children":3757},{"style":133},[3758],{"type":76,"value":304},{"type":70,"tag":110,"props":3760,"children":3761},{"style":133},[3762],{"type":76,"value":1598},{"type":70,"tag":110,"props":3764,"children":3765},{"style":139},[3766],{"type":76,"value":3714},{"type":70,"tag":110,"props":3768,"children":3769},{"style":133},[3770],{"type":76,"value":1285},{"type":70,"tag":110,"props":3772,"children":3773},{"class":112,"line":518},[3774,3778,3782,3786,3790,3794,3798,3802,3806],{"type":70,"tag":110,"props":3775,"children":3776},{"style":330},[3777],{"type":76,"value":3709},{"type":70,"tag":110,"props":3779,"children":3780},{"style":1277},[3781],{"type":76,"value":99},{"type":70,"tag":110,"props":3783,"children":3784},{"style":330},[3785],{"type":76,"value":1405},{"type":70,"tag":110,"props":3787,"children":3788},{"style":133},[3789],{"type":76,"value":1410},{"type":70,"tag":110,"props":3791,"children":3792},{"style":330},[3793],{"type":76,"value":1588},{"type":70,"tag":110,"props":3795,"children":3796},{"style":139},[3797],{"type":76,"value":1593},{"type":70,"tag":110,"props":3799,"children":3800},{"style":133},[3801],{"type":76,"value":1598},{"type":70,"tag":110,"props":3803,"children":3804},{"style":139},[3805],{"type":76,"value":99},{"type":70,"tag":110,"props":3807,"children":3808},{"style":133},[3809],{"type":76,"value":1285},{"type":70,"tag":110,"props":3811,"children":3812},{"class":112,"line":547},[3813,3818,3822],{"type":70,"tag":110,"props":3814,"children":3815},{"style":133},[3816],{"type":76,"value":3817},"            \u003C\u002F",{"type":70,"tag":110,"props":3819,"children":3820},{"style":139},[3821],{"type":76,"value":3663},{"type":70,"tag":110,"props":3823,"children":3824},{"style":133},[3825],{"type":76,"value":1285},{"type":70,"tag":110,"props":3827,"children":3828},{"class":112,"line":591},[3829],{"type":70,"tag":110,"props":3830,"children":3831},{"style":330},[3832],{"type":76,"value":3833},"          )\n",{"type":70,"tag":110,"props":3835,"children":3836},{"class":112,"line":604},[3837],{"type":70,"tag":110,"props":3838,"children":3839},{"style":133},[3840],{"type":76,"value":3841},"        }\n",{"type":70,"tag":110,"props":3843,"children":3844},{"class":112,"line":644},[3845],{"type":70,"tag":110,"props":3846,"children":3847},{"emptyLinePlaceholder":261},[3848],{"type":76,"value":264},{"type":70,"tag":110,"props":3850,"children":3851},{"class":112,"line":657},[3852,3856,3860,3864,3868,3872,3876,3881,3885],{"type":70,"tag":110,"props":3853,"children":3854},{"style":330},[3855],{"type":76,"value":3479},{"type":70,"tag":110,"props":3857,"children":3858},{"style":133},[3859],{"type":76,"value":299},{"type":70,"tag":110,"props":3861,"children":3862},{"style":330},[3863],{"type":76,"value":1516},{"type":70,"tag":110,"props":3865,"children":3866},{"style":133},[3867],{"type":76,"value":304},{"type":70,"tag":110,"props":3869,"children":3870},{"style":160},[3871],{"type":76,"value":76},{"type":70,"tag":110,"props":3873,"children":3874},{"style":133},[3875],{"type":76,"value":304},{"type":70,"tag":110,"props":3877,"children":3878},{"style":330},[3879],{"type":76,"value":3880}," && part.content",{"type":70,"tag":110,"props":3882,"children":3883},{"style":133},[3884],{"type":76,"value":583},{"type":70,"tag":110,"props":3886,"children":3887},{"style":133},[3888],{"type":76,"value":343},{"type":70,"tag":110,"props":3890,"children":3891},{"class":112,"line":671},[3892,3896,3900,3904,3908,3912,3916,3920,3924,3928,3932,3936,3940,3944,3948],{"type":70,"tag":110,"props":3893,"children":3894},{"style":127},[3895],{"type":76,"value":3647},{"type":70,"tag":110,"props":3897,"children":3898},{"style":330},[3899],{"type":76,"value":1550},{"type":70,"tag":110,"props":3901,"children":3902},{"style":1277},[3903],{"type":76,"value":79},{"type":70,"tag":110,"props":3905,"children":3906},{"style":1277},[3907],{"type":76,"value":1367},{"type":70,"tag":110,"props":3909,"children":3910},{"style":330},[3911],{"type":76,"value":289},{"type":70,"tag":110,"props":3913,"children":3914},{"style":133},[3915],{"type":76,"value":1410},{"type":70,"tag":110,"props":3917,"children":3918},{"style":330},[3919],{"type":76,"value":1571},{"type":70,"tag":110,"props":3921,"children":3922},{"style":133},[3923],{"type":76,"value":754},{"type":70,"tag":110,"props":3925,"children":3926},{"style":330},[3927],{"type":76,"value":1405},{"type":70,"tag":110,"props":3929,"children":3930},{"style":133},[3931],{"type":76,"value":1410},{"type":70,"tag":110,"props":3933,"children":3934},{"style":330},[3935],{"type":76,"value":1588},{"type":70,"tag":110,"props":3937,"children":3938},{"style":139},[3939],{"type":76,"value":1593},{"type":70,"tag":110,"props":3941,"children":3942},{"style":133},[3943],{"type":76,"value":1598},{"type":70,"tag":110,"props":3945,"children":3946},{"style":139},[3947],{"type":76,"value":79},{"type":70,"tag":110,"props":3949,"children":3950},{"style":133},[3951],{"type":76,"value":1285},{"type":70,"tag":110,"props":3953,"children":3954},{"class":112,"line":679},[3955],{"type":70,"tag":110,"props":3956,"children":3957},{"style":133},[3958],{"type":76,"value":3841},{"type":70,"tag":110,"props":3960,"children":3961},{"class":112,"line":721},[3962],{"type":70,"tag":110,"props":3963,"children":3964},{"emptyLinePlaceholder":261},[3965],{"type":76,"value":264},{"type":70,"tag":110,"props":3967,"children":3968},{"class":112,"line":730},[3969,3973,3977,3981,3985,3990,3994,3998],{"type":70,"tag":110,"props":3970,"children":3971},{"style":330},[3972],{"type":76,"value":3479},{"type":70,"tag":110,"props":3974,"children":3975},{"style":133},[3976],{"type":76,"value":299},{"type":70,"tag":110,"props":3978,"children":3979},{"style":330},[3980],{"type":76,"value":1516},{"type":70,"tag":110,"props":3982,"children":3983},{"style":133},[3984],{"type":76,"value":304},{"type":70,"tag":110,"props":3986,"children":3987},{"style":160},[3988],{"type":76,"value":3989},"tool-call",{"type":70,"tag":110,"props":3991,"children":3992},{"style":133},[3993],{"type":76,"value":304},{"type":70,"tag":110,"props":3995,"children":3996},{"style":133},[3997],{"type":76,"value":583},{"type":70,"tag":110,"props":3999,"children":4000},{"style":133},[4001],{"type":76,"value":343},{"type":70,"tag":110,"props":4003,"children":4004},{"class":112,"line":739},[4005,4009],{"type":70,"tag":110,"props":4006,"children":4007},{"style":127},[4008],{"type":76,"value":3647},{"type":70,"tag":110,"props":4010,"children":4011},{"style":330},[4012],{"type":76,"value":1266},{"type":70,"tag":110,"props":4014,"children":4015},{"class":112,"line":748},[4016,4020,4024,4028,4032,4036,4040],{"type":70,"tag":110,"props":4017,"children":4018},{"style":133},[4019],{"type":76,"value":1395},{"type":70,"tag":110,"props":4021,"children":4022},{"style":139},[4023],{"type":76,"value":1280},{"type":70,"tag":110,"props":4025,"children":4026},{"style":139},[4027],{"type":76,"value":1367},{"type":70,"tag":110,"props":4029,"children":4030},{"style":133},[4031],{"type":76,"value":1372},{"type":70,"tag":110,"props":4033,"children":4034},{"style":330},[4035],{"type":76,"value":1588},{"type":70,"tag":110,"props":4037,"children":4038},{"style":139},[4039],{"type":76,"value":1382},{"type":70,"tag":110,"props":4041,"children":4042},{"style":133},[4043],{"type":76,"value":1387},{"type":70,"tag":110,"props":4045,"children":4046},{"class":112,"line":1501},[4047,4052,4057,4061,4065,4069,4073,4078,4082,4086,4090,4094,4098,4103,4107],{"type":70,"tag":110,"props":4048,"children":4049},{"style":139},[4050],{"type":76,"value":4051},"              Tool",{"type":70,"tag":110,"props":4053,"children":4054},{"style":386},[4055],{"type":76,"value":4056}," call",{"type":70,"tag":110,"props":4058,"children":4059},{"style":133},[4060],{"type":76,"value":338},{"type":70,"tag":110,"props":4062,"children":4063},{"style":133},[4064],{"type":76,"value":136},{"type":70,"tag":110,"props":4066,"children":4067},{"style":1277},[4068],{"type":76,"value":1477},{"type":70,"tag":110,"props":4070,"children":4071},{"style":133},[4072],{"type":76,"value":468},{"type":70,"tag":110,"props":4074,"children":4075},{"style":330},[4076],{"type":76,"value":4077},"name",{"type":70,"tag":110,"props":4079,"children":4080},{"style":133},[4081],{"type":76,"value":754},{"type":70,"tag":110,"props":4083,"children":4084},{"style":330},[4085],{"type":76,"value":1161},{"type":70,"tag":110,"props":4087,"children":4088},{"style":133},[4089],{"type":76,"value":1410},{"type":70,"tag":110,"props":4091,"children":4092},{"style":1277},[4093],{"type":76,"value":1477},{"type":70,"tag":110,"props":4095,"children":4096},{"style":133},[4097],{"type":76,"value":468},{"type":70,"tag":110,"props":4099,"children":4100},{"style":330},[4101],{"type":76,"value":4102},"state",{"type":70,"tag":110,"props":4104,"children":4105},{"style":133},[4106],{"type":76,"value":754},{"type":70,"tag":110,"props":4108,"children":4109},{"style":330},[4110],{"type":76,"value":668},{"type":70,"tag":110,"props":4112,"children":4113},{"class":112,"line":1539},[4114,4118,4122],{"type":70,"tag":110,"props":4115,"children":4116},{"style":133},[4117],{"type":76,"value":3817},{"type":70,"tag":110,"props":4119,"children":4120},{"style":139},[4121],{"type":76,"value":1280},{"type":70,"tag":110,"props":4123,"children":4124},{"style":133},[4125],{"type":76,"value":1285},{"type":70,"tag":110,"props":4127,"children":4128},{"class":112,"line":1609},[4129],{"type":70,"tag":110,"props":4130,"children":4131},{"style":330},[4132],{"type":76,"value":3833},{"type":70,"tag":110,"props":4134,"children":4135},{"class":112,"line":1618},[4136],{"type":70,"tag":110,"props":4137,"children":4138},{"style":133},[4139],{"type":76,"value":3841},{"type":70,"tag":110,"props":4141,"children":4142},{"class":112,"line":1632},[4143],{"type":70,"tag":110,"props":4144,"children":4145},{"emptyLinePlaceholder":261},[4146],{"type":76,"value":264},{"type":70,"tag":110,"props":4148,"children":4149},{"class":112,"line":1650},[4150,4155],{"type":70,"tag":110,"props":4151,"children":4152},{"style":330},[4153],{"type":76,"value":4154},"        return ",{"type":70,"tag":110,"props":4156,"children":4157},{"style":139},[4158],{"type":76,"value":1629},{"type":70,"tag":110,"props":4160,"children":4161},{"class":112,"line":1667},[4162,4167,4171],{"type":70,"tag":110,"props":4163,"children":4164},{"style":133},[4165],{"type":76,"value":4166},"      }",{"type":70,"tag":110,"props":4168,"children":4169},{"style":330},[4170],{"type":76,"value":583},{"type":70,"tag":110,"props":4172,"children":4173},{"style":133},[4174],{"type":76,"value":1647},{"type":70,"tag":110,"props":4176,"children":4177},{"class":112,"line":1680},[4178,4182,4186],{"type":70,"tag":110,"props":4179,"children":4180},{"style":133},[4181],{"type":76,"value":2257},{"type":70,"tag":110,"props":4183,"children":4184},{"style":139},[4185],{"type":76,"value":1280},{"type":70,"tag":110,"props":4187,"children":4188},{"style":133},[4189],{"type":76,"value":1285},{"type":70,"tag":110,"props":4191,"children":4192},{"class":112,"line":1697},[4193],{"type":70,"tag":110,"props":4194,"children":4195},{"style":330},[4196],{"type":76,"value":2274},{"type":70,"tag":110,"props":4198,"children":4199},{"class":112,"line":1705},[4200],{"type":70,"tag":110,"props":4201,"children":4202},{"style":133},[4203],{"type":76,"value":1647},{"type":70,"tag":79,"props":4205,"children":4206},{},[4207,4209,4215],{"type":76,"value":4208},"Server-side, enable thinking via ",{"type":70,"tag":106,"props":4210,"children":4212},{"className":4211},[],[4213],{"type":76,"value":4214},"modelOptions",{"type":76,"value":4216}," on the adapter:",{"type":70,"tag":99,"props":4218,"children":4220},{"className":101,"code":4219,"language":45,"meta":103,"style":103},"import { geminiText } from '@tanstack\u002Fai-gemini'\n\nconst stream = chat({\n  adapter: geminiText('gemini-2.5-flash'),\n  messages,\n  modelOptions: {\n    thinkingConfig: {\n      includeThoughts: true,\n      thinkingBudget: 100,\n    },\n  },\n})\n",[4221],{"type":70,"tag":106,"props":4222,"children":4223},{"__ignoreMap":103},[4224,4261,4268,4295,4335,4346,4361,4377,4399,4420,4427,4434],{"type":70,"tag":110,"props":4225,"children":4226},{"class":112,"line":113},[4227,4231,4235,4240,4244,4248,4252,4257],{"type":70,"tag":110,"props":4228,"children":4229},{"style":127},[4230],{"type":76,"value":130},{"type":70,"tag":110,"props":4232,"children":4233},{"style":133},[4234],{"type":76,"value":136},{"type":70,"tag":110,"props":4236,"children":4237},{"style":139},[4238],{"type":76,"value":4239}," geminiText",{"type":70,"tag":110,"props":4241,"children":4242},{"style":133},[4243],{"type":76,"value":147},{"type":70,"tag":110,"props":4245,"children":4246},{"style":127},[4247],{"type":76,"value":152},{"type":70,"tag":110,"props":4249,"children":4250},{"style":133},[4251],{"type":76,"value":157},{"type":70,"tag":110,"props":4253,"children":4254},{"style":160},[4255],{"type":76,"value":4256},"@tanstack\u002Fai-gemini",{"type":70,"tag":110,"props":4258,"children":4259},{"style":133},[4260],{"type":76,"value":168},{"type":70,"tag":110,"props":4262,"children":4263},{"class":112,"line":123},[4264],{"type":70,"tag":110,"props":4265,"children":4266},{"emptyLinePlaceholder":261},[4267],{"type":76,"value":264},{"type":70,"tag":110,"props":4269,"children":4270},{"class":112,"line":171},[4271,4275,4279,4283,4287,4291],{"type":70,"tag":110,"props":4272,"children":4273},{"style":276},[4274],{"type":76,"value":2422},{"type":70,"tag":110,"props":4276,"children":4277},{"style":139},[4278],{"type":76,"value":2427},{"type":70,"tag":110,"props":4280,"children":4281},{"style":133},[4282],{"type":76,"value":289},{"type":70,"tag":110,"props":4284,"children":4285},{"style":292},[4286],{"type":76,"value":185},{"type":70,"tag":110,"props":4288,"children":4289},{"style":139},[4290],{"type":76,"value":299},{"type":70,"tag":110,"props":4292,"children":4293},{"style":133},[4294],{"type":76,"value":323},{"type":70,"tag":110,"props":4296,"children":4297},{"class":112,"line":219},[4298,4302,4306,4310,4314,4318,4323,4327,4331],{"type":70,"tag":110,"props":4299,"children":4300},{"style":330},[4301],{"type":76,"value":2451},{"type":70,"tag":110,"props":4303,"children":4304},{"style":133},[4305],{"type":76,"value":338},{"type":70,"tag":110,"props":4307,"children":4308},{"style":292},[4309],{"type":76,"value":4239},{"type":70,"tag":110,"props":4311,"children":4312},{"style":139},[4313],{"type":76,"value":299},{"type":70,"tag":110,"props":4315,"children":4316},{"style":133},[4317],{"type":76,"value":304},{"type":70,"tag":110,"props":4319,"children":4320},{"style":160},[4321],{"type":76,"value":4322},"gemini-2.5-flash",{"type":70,"tag":110,"props":4324,"children":4325},{"style":133},[4326],{"type":76,"value":304},{"type":70,"tag":110,"props":4328,"children":4329},{"style":139},[4330],{"type":76,"value":583},{"type":70,"tag":110,"props":4332,"children":4333},{"style":133},[4334],{"type":76,"value":588},{"type":70,"tag":110,"props":4336,"children":4337},{"class":112,"line":257},[4338,4342],{"type":70,"tag":110,"props":4339,"children":4340},{"style":139},[4341],{"type":76,"value":2492},{"type":70,"tag":110,"props":4343,"children":4344},{"style":133},[4345],{"type":76,"value":588},{"type":70,"tag":110,"props":4347,"children":4348},{"class":112,"line":267},[4349,4353,4357],{"type":70,"tag":110,"props":4350,"children":4351},{"style":330},[4352],{"type":76,"value":2504},{"type":70,"tag":110,"props":4354,"children":4355},{"style":133},[4356],{"type":76,"value":338},{"type":70,"tag":110,"props":4358,"children":4359},{"style":133},[4360],{"type":76,"value":343},{"type":70,"tag":110,"props":4362,"children":4363},{"class":112,"line":326},[4364,4369,4373],{"type":70,"tag":110,"props":4365,"children":4366},{"style":330},[4367],{"type":76,"value":4368},"    thinkingConfig",{"type":70,"tag":110,"props":4370,"children":4371},{"style":133},[4372],{"type":76,"value":338},{"type":70,"tag":110,"props":4374,"children":4375},{"style":133},[4376],{"type":76,"value":343},{"type":70,"tag":110,"props":4378,"children":4379},{"class":112,"line":346},[4380,4385,4389,4395],{"type":70,"tag":110,"props":4381,"children":4382},{"style":330},[4383],{"type":76,"value":4384},"      includeThoughts",{"type":70,"tag":110,"props":4386,"children":4387},{"style":133},[4388],{"type":76,"value":338},{"type":70,"tag":110,"props":4390,"children":4392},{"style":4391},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[4393],{"type":76,"value":4394}," true",{"type":70,"tag":110,"props":4396,"children":4397},{"style":133},[4398],{"type":76,"value":588},{"type":70,"tag":110,"props":4400,"children":4401},{"class":112,"line":363},[4402,4407,4411,4416],{"type":70,"tag":110,"props":4403,"children":4404},{"style":330},[4405],{"type":76,"value":4406},"      thinkingBudget",{"type":70,"tag":110,"props":4408,"children":4409},{"style":133},[4410],{"type":76,"value":338},{"type":70,"tag":110,"props":4412,"children":4413},{"style":2527},[4414],{"type":76,"value":4415}," 100",{"type":70,"tag":110,"props":4417,"children":4418},{"style":133},[4419],{"type":76,"value":588},{"type":70,"tag":110,"props":4421,"children":4422},{"class":112,"line":406},[4423],{"type":70,"tag":110,"props":4424,"children":4425},{"style":133},[4426],{"type":76,"value":736},{"type":70,"tag":110,"props":4428,"children":4429},{"class":112,"line":440},[4430],{"type":70,"tag":110,"props":4431,"children":4432},{"style":133},[4433],{"type":76,"value":745},{"type":70,"tag":110,"props":4435,"children":4436},{"class":112,"line":480},[4437,4441],{"type":70,"tag":110,"props":4438,"children":4439},{"style":133},[4440],{"type":76,"value":754},{"type":70,"tag":110,"props":4442,"children":4443},{"style":139},[4444],{"type":76,"value":668},{"type":70,"tag":92,"props":4446,"children":4448},{"id":4447},"_3-sending-multimodal-content-images",[4449],{"type":76,"value":4450},"3. Sending Multimodal Content (Images)",{"type":70,"tag":79,"props":4452,"children":4453},{},[4454,4456,4462,4464,4470],{"type":76,"value":4455},"Use ",{"type":70,"tag":106,"props":4457,"children":4459},{"className":4458},[],[4460],{"type":76,"value":4461},"sendMessage",{"type":76,"value":4463}," with a ",{"type":70,"tag":106,"props":4465,"children":4467},{"className":4466},[],[4468],{"type":76,"value":4469},"MultimodalContent",{"type":76,"value":4471}," object instead of a plain string.",{"type":70,"tag":99,"props":4473,"children":4475},{"className":101,"code":4474,"language":45,"meta":103,"style":103},"import { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\nimport type { ContentPart } from '@tanstack\u002Fai'\n\nconst { sendMessage } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n})\n\nfunction sendImageMessage(text: string, imageBase64: string, mimeType: string) {\n  const contentParts: Array\u003CContentPart> = [\n    { type: 'text', content: text },\n    {\n      type: 'image',\n      source: { type: 'data', value: imageBase64, mimeType },\n    },\n  ]\n\n  sendMessage({ content: contentParts })\n}\n\nfunction sendImageUrl(text: string, imageUrl: string) {\n  const contentParts: Array\u003CContentPart> = [\n    { type: 'text', content: text },\n    {\n      type: 'image',\n      source: { type: 'url', value: imageUrl },\n    },\n  ]\n\n  sendMessage({ content: contentParts })\n}\n",[4476],{"type":70,"tag":106,"props":4477,"children":4478},{"__ignoreMap":103},[4479,4522,4562,4569,4605,4644,4655,4662,4733,4777,4827,4835,4864,4930,4937,4945,4952,4988,4995,5002,5055,5094,5141,5148,5175,5231,5238,5245,5252,5287],{"type":70,"tag":110,"props":4480,"children":4481},{"class":112,"line":113},[4482,4486,4490,4494,4498,4502,4506,4510,4514,4518],{"type":70,"tag":110,"props":4483,"children":4484},{"style":127},[4485],{"type":76,"value":130},{"type":70,"tag":110,"props":4487,"children":4488},{"style":133},[4489],{"type":76,"value":136},{"type":70,"tag":110,"props":4491,"children":4492},{"style":139},[4493],{"type":76,"value":831},{"type":70,"tag":110,"props":4495,"children":4496},{"style":133},[4497],{"type":76,"value":190},{"type":70,"tag":110,"props":4499,"children":4500},{"style":139},[4501],{"type":76,"value":840},{"type":70,"tag":110,"props":4503,"children":4504},{"style":133},[4505],{"type":76,"value":147},{"type":70,"tag":110,"props":4507,"children":4508},{"style":127},[4509],{"type":76,"value":152},{"type":70,"tag":110,"props":4511,"children":4512},{"style":133},[4513],{"type":76,"value":157},{"type":70,"tag":110,"props":4515,"children":4516},{"style":160},[4517],{"type":76,"value":857},{"type":70,"tag":110,"props":4519,"children":4520},{"style":133},[4521],{"type":76,"value":168},{"type":70,"tag":110,"props":4523,"children":4524},{"class":112,"line":123},[4525,4529,4533,4537,4542,4546,4550,4554,4558],{"type":70,"tag":110,"props":4526,"children":4527},{"style":127},[4528],{"type":76,"value":130},{"type":70,"tag":110,"props":4530,"children":4531},{"style":127},[4532],{"type":76,"value":873},{"type":70,"tag":110,"props":4534,"children":4535},{"style":133},[4536],{"type":76,"value":136},{"type":70,"tag":110,"props":4538,"children":4539},{"style":139},[4540],{"type":76,"value":4541}," ContentPart",{"type":70,"tag":110,"props":4543,"children":4544},{"style":133},[4545],{"type":76,"value":147},{"type":70,"tag":110,"props":4547,"children":4548},{"style":127},[4549],{"type":76,"value":152},{"type":70,"tag":110,"props":4551,"children":4552},{"style":133},[4553],{"type":76,"value":157},{"type":70,"tag":110,"props":4555,"children":4556},{"style":160},[4557],{"type":76,"value":212},{"type":70,"tag":110,"props":4559,"children":4560},{"style":133},[4561],{"type":76,"value":168},{"type":70,"tag":110,"props":4563,"children":4564},{"class":112,"line":171},[4565],{"type":70,"tag":110,"props":4566,"children":4567},{"emptyLinePlaceholder":261},[4568],{"type":76,"value":264},{"type":70,"tag":110,"props":4570,"children":4571},{"class":112,"line":219},[4572,4576,4580,4585,4589,4593,4597,4601],{"type":70,"tag":110,"props":4573,"children":4574},{"style":276},[4575],{"type":76,"value":2422},{"type":70,"tag":110,"props":4577,"children":4578},{"style":133},[4579],{"type":76,"value":136},{"type":70,"tag":110,"props":4581,"children":4582},{"style":139},[4583],{"type":76,"value":4584}," sendMessage ",{"type":70,"tag":110,"props":4586,"children":4587},{"style":133},[4588],{"type":76,"value":754},{"type":70,"tag":110,"props":4590,"children":4591},{"style":133},[4592],{"type":76,"value":422},{"type":70,"tag":110,"props":4594,"children":4595},{"style":292},[4596],{"type":76,"value":831},{"type":70,"tag":110,"props":4598,"children":4599},{"style":139},[4600],{"type":76,"value":299},{"type":70,"tag":110,"props":4602,"children":4603},{"style":133},[4604],{"type":76,"value":323},{"type":70,"tag":110,"props":4606,"children":4607},{"class":112,"line":257},[4608,4612,4616,4620,4624,4628,4632,4636,4640],{"type":70,"tag":110,"props":4609,"children":4610},{"style":330},[4611],{"type":76,"value":2902},{"type":70,"tag":110,"props":4613,"children":4614},{"style":133},[4615],{"type":76,"value":338},{"type":70,"tag":110,"props":4617,"children":4618},{"style":292},[4619],{"type":76,"value":840},{"type":70,"tag":110,"props":4621,"children":4622},{"style":139},[4623],{"type":76,"value":299},{"type":70,"tag":110,"props":4625,"children":4626},{"style":133},[4627],{"type":76,"value":304},{"type":70,"tag":110,"props":4629,"children":4630},{"style":160},[4631],{"type":76,"value":309},{"type":70,"tag":110,"props":4633,"children":4634},{"style":133},[4635],{"type":76,"value":304},{"type":70,"tag":110,"props":4637,"children":4638},{"style":139},[4639],{"type":76,"value":583},{"type":70,"tag":110,"props":4641,"children":4642},{"style":133},[4643],{"type":76,"value":588},{"type":70,"tag":110,"props":4645,"children":4646},{"class":112,"line":267},[4647,4651],{"type":70,"tag":110,"props":4648,"children":4649},{"style":133},[4650],{"type":76,"value":754},{"type":70,"tag":110,"props":4652,"children":4653},{"style":139},[4654],{"type":76,"value":668},{"type":70,"tag":110,"props":4656,"children":4657},{"class":112,"line":326},[4658],{"type":70,"tag":110,"props":4659,"children":4660},{"emptyLinePlaceholder":261},[4661],{"type":76,"value":264},{"type":70,"tag":110,"props":4663,"children":4664},{"class":112,"line":346},[4665,4669,4674,4678,4682,4686,4691,4695,4700,4704,4708,4712,4717,4721,4725,4729],{"type":70,"tag":110,"props":4666,"children":4667},{"style":276},[4668],{"type":76,"value":917},{"type":70,"tag":110,"props":4670,"children":4671},{"style":292},[4672],{"type":76,"value":4673}," sendImageMessage",{"type":70,"tag":110,"props":4675,"children":4676},{"style":133},[4677],{"type":76,"value":299},{"type":70,"tag":110,"props":4679,"children":4680},{"style":386},[4681],{"type":76,"value":76},{"type":70,"tag":110,"props":4683,"children":4684},{"style":133},[4685],{"type":76,"value":338},{"type":70,"tag":110,"props":4687,"children":4688},{"style":1277},[4689],{"type":76,"value":4690}," string",{"type":70,"tag":110,"props":4692,"children":4693},{"style":133},[4694],{"type":76,"value":190},{"type":70,"tag":110,"props":4696,"children":4697},{"style":386},[4698],{"type":76,"value":4699}," imageBase64",{"type":70,"tag":110,"props":4701,"children":4702},{"style":133},[4703],{"type":76,"value":338},{"type":70,"tag":110,"props":4705,"children":4706},{"style":1277},[4707],{"type":76,"value":4690},{"type":70,"tag":110,"props":4709,"children":4710},{"style":133},[4711],{"type":76,"value":190},{"type":70,"tag":110,"props":4713,"children":4714},{"style":386},[4715],{"type":76,"value":4716}," mimeType",{"type":70,"tag":110,"props":4718,"children":4719},{"style":133},[4720],{"type":76,"value":338},{"type":70,"tag":110,"props":4722,"children":4723},{"style":1277},[4724],{"type":76,"value":4690},{"type":70,"tag":110,"props":4726,"children":4727},{"style":133},[4728],{"type":76,"value":583},{"type":70,"tag":110,"props":4730,"children":4731},{"style":133},[4732],{"type":76,"value":343},{"type":70,"tag":110,"props":4734,"children":4735},{"class":112,"line":363},[4736,4740,4745,4749,4754,4759,4764,4768,4772],{"type":70,"tag":110,"props":4737,"children":4738},{"style":276},[4739],{"type":76,"value":939},{"type":70,"tag":110,"props":4741,"children":4742},{"style":139},[4743],{"type":76,"value":4744}," contentParts",{"type":70,"tag":110,"props":4746,"children":4747},{"style":133},[4748],{"type":76,"value":338},{"type":70,"tag":110,"props":4750,"children":4751},{"style":1277},[4752],{"type":76,"value":4753}," Array",{"type":70,"tag":110,"props":4755,"children":4756},{"style":133},[4757],{"type":76,"value":4758},"\u003C",{"type":70,"tag":110,"props":4760,"children":4761},{"style":1277},[4762],{"type":76,"value":4763},"ContentPart",{"type":70,"tag":110,"props":4765,"children":4766},{"style":133},[4767],{"type":76,"value":1405},{"type":70,"tag":110,"props":4769,"children":4770},{"style":133},[4771],{"type":76,"value":422},{"type":70,"tag":110,"props":4773,"children":4774},{"style":330},[4775],{"type":76,"value":4776}," [\n",{"type":70,"tag":110,"props":4778,"children":4779},{"class":112,"line":406},[4780,4785,4789,4793,4797,4801,4805,4809,4814,4818,4823],{"type":70,"tag":110,"props":4781,"children":4782},{"style":133},[4783],{"type":76,"value":4784},"    {",{"type":70,"tag":110,"props":4786,"children":4787},{"style":330},[4788],{"type":76,"value":873},{"type":70,"tag":110,"props":4790,"children":4791},{"style":133},[4792],{"type":76,"value":338},{"type":70,"tag":110,"props":4794,"children":4795},{"style":133},[4796],{"type":76,"value":157},{"type":70,"tag":110,"props":4798,"children":4799},{"style":160},[4800],{"type":76,"value":76},{"type":70,"tag":110,"props":4802,"children":4803},{"style":133},[4804],{"type":76,"value":304},{"type":70,"tag":110,"props":4806,"children":4807},{"style":133},[4808],{"type":76,"value":190},{"type":70,"tag":110,"props":4810,"children":4811},{"style":330},[4812],{"type":76,"value":4813}," content",{"type":70,"tag":110,"props":4815,"children":4816},{"style":133},[4817],{"type":76,"value":338},{"type":70,"tag":110,"props":4819,"children":4820},{"style":139},[4821],{"type":76,"value":4822}," text",{"type":70,"tag":110,"props":4824,"children":4825},{"style":133},[4826],{"type":76,"value":3001},{"type":70,"tag":110,"props":4828,"children":4829},{"class":112,"line":440},[4830],{"type":70,"tag":110,"props":4831,"children":4832},{"style":133},[4833],{"type":76,"value":4834},"    {\n",{"type":70,"tag":110,"props":4836,"children":4837},{"class":112,"line":480},[4838,4843,4847,4851,4856,4860],{"type":70,"tag":110,"props":4839,"children":4840},{"style":330},[4841],{"type":76,"value":4842},"      type",{"type":70,"tag":110,"props":4844,"children":4845},{"style":133},[4846],{"type":76,"value":338},{"type":70,"tag":110,"props":4848,"children":4849},{"style":133},[4850],{"type":76,"value":157},{"type":70,"tag":110,"props":4852,"children":4853},{"style":160},[4854],{"type":76,"value":4855},"image",{"type":70,"tag":110,"props":4857,"children":4858},{"style":133},[4859],{"type":76,"value":304},{"type":70,"tag":110,"props":4861,"children":4862},{"style":133},[4863],{"type":76,"value":588},{"type":70,"tag":110,"props":4865,"children":4866},{"class":112,"line":510},[4867,4872,4876,4880,4884,4888,4892,4897,4901,4905,4910,4914,4918,4922,4926],{"type":70,"tag":110,"props":4868,"children":4869},{"style":330},[4870],{"type":76,"value":4871},"      source",{"type":70,"tag":110,"props":4873,"children":4874},{"style":133},[4875],{"type":76,"value":338},{"type":70,"tag":110,"props":4877,"children":4878},{"style":133},[4879],{"type":76,"value":136},{"type":70,"tag":110,"props":4881,"children":4882},{"style":330},[4883],{"type":76,"value":873},{"type":70,"tag":110,"props":4885,"children":4886},{"style":133},[4887],{"type":76,"value":338},{"type":70,"tag":110,"props":4889,"children":4890},{"style":133},[4891],{"type":76,"value":157},{"type":70,"tag":110,"props":4893,"children":4894},{"style":160},[4895],{"type":76,"value":4896},"data",{"type":70,"tag":110,"props":4898,"children":4899},{"style":133},[4900],{"type":76,"value":304},{"type":70,"tag":110,"props":4902,"children":4903},{"style":133},[4904],{"type":76,"value":190},{"type":70,"tag":110,"props":4906,"children":4907},{"style":330},[4908],{"type":76,"value":4909}," value",{"type":70,"tag":110,"props":4911,"children":4912},{"style":133},[4913],{"type":76,"value":338},{"type":70,"tag":110,"props":4915,"children":4916},{"style":139},[4917],{"type":76,"value":4699},{"type":70,"tag":110,"props":4919,"children":4920},{"style":133},[4921],{"type":76,"value":190},{"type":70,"tag":110,"props":4923,"children":4924},{"style":139},[4925],{"type":76,"value":4716},{"type":70,"tag":110,"props":4927,"children":4928},{"style":133},[4929],{"type":76,"value":3001},{"type":70,"tag":110,"props":4931,"children":4932},{"class":112,"line":518},[4933],{"type":70,"tag":110,"props":4934,"children":4935},{"style":133},[4936],{"type":76,"value":736},{"type":70,"tag":110,"props":4938,"children":4939},{"class":112,"line":547},[4940],{"type":70,"tag":110,"props":4941,"children":4942},{"style":330},[4943],{"type":76,"value":4944},"  ]\n",{"type":70,"tag":110,"props":4946,"children":4947},{"class":112,"line":591},[4948],{"type":70,"tag":110,"props":4949,"children":4950},{"emptyLinePlaceholder":261},[4951],{"type":76,"value":264},{"type":70,"tag":110,"props":4953,"children":4954},{"class":112,"line":604},[4955,4960,4964,4968,4972,4976,4980,4984],{"type":70,"tag":110,"props":4956,"children":4957},{"style":292},[4958],{"type":76,"value":4959},"  sendMessage",{"type":70,"tag":110,"props":4961,"children":4962},{"style":330},[4963],{"type":76,"value":299},{"type":70,"tag":110,"props":4965,"children":4966},{"style":133},[4967],{"type":76,"value":1410},{"type":70,"tag":110,"props":4969,"children":4970},{"style":330},[4971],{"type":76,"value":4813},{"type":70,"tag":110,"props":4973,"children":4974},{"style":133},[4975],{"type":76,"value":338},{"type":70,"tag":110,"props":4977,"children":4978},{"style":139},[4979],{"type":76,"value":4744},{"type":70,"tag":110,"props":4981,"children":4982},{"style":133},[4983],{"type":76,"value":147},{"type":70,"tag":110,"props":4985,"children":4986},{"style":330},[4987],{"type":76,"value":668},{"type":70,"tag":110,"props":4989,"children":4990},{"class":112,"line":644},[4991],{"type":70,"tag":110,"props":4992,"children":4993},{"style":133},[4994],{"type":76,"value":1647},{"type":70,"tag":110,"props":4996,"children":4997},{"class":112,"line":657},[4998],{"type":70,"tag":110,"props":4999,"children":5000},{"emptyLinePlaceholder":261},[5001],{"type":76,"value":264},{"type":70,"tag":110,"props":5003,"children":5004},{"class":112,"line":671},[5005,5009,5014,5018,5022,5026,5030,5034,5039,5043,5047,5051],{"type":70,"tag":110,"props":5006,"children":5007},{"style":276},[5008],{"type":76,"value":917},{"type":70,"tag":110,"props":5010,"children":5011},{"style":292},[5012],{"type":76,"value":5013}," sendImageUrl",{"type":70,"tag":110,"props":5015,"children":5016},{"style":133},[5017],{"type":76,"value":299},{"type":70,"tag":110,"props":5019,"children":5020},{"style":386},[5021],{"type":76,"value":76},{"type":70,"tag":110,"props":5023,"children":5024},{"style":133},[5025],{"type":76,"value":338},{"type":70,"tag":110,"props":5027,"children":5028},{"style":1277},[5029],{"type":76,"value":4690},{"type":70,"tag":110,"props":5031,"children":5032},{"style":133},[5033],{"type":76,"value":190},{"type":70,"tag":110,"props":5035,"children":5036},{"style":386},[5037],{"type":76,"value":5038}," imageUrl",{"type":70,"tag":110,"props":5040,"children":5041},{"style":133},[5042],{"type":76,"value":338},{"type":70,"tag":110,"props":5044,"children":5045},{"style":1277},[5046],{"type":76,"value":4690},{"type":70,"tag":110,"props":5048,"children":5049},{"style":133},[5050],{"type":76,"value":583},{"type":70,"tag":110,"props":5052,"children":5053},{"style":133},[5054],{"type":76,"value":343},{"type":70,"tag":110,"props":5056,"children":5057},{"class":112,"line":679},[5058,5062,5066,5070,5074,5078,5082,5086,5090],{"type":70,"tag":110,"props":5059,"children":5060},{"style":276},[5061],{"type":76,"value":939},{"type":70,"tag":110,"props":5063,"children":5064},{"style":139},[5065],{"type":76,"value":4744},{"type":70,"tag":110,"props":5067,"children":5068},{"style":133},[5069],{"type":76,"value":338},{"type":70,"tag":110,"props":5071,"children":5072},{"style":1277},[5073],{"type":76,"value":4753},{"type":70,"tag":110,"props":5075,"children":5076},{"style":133},[5077],{"type":76,"value":4758},{"type":70,"tag":110,"props":5079,"children":5080},{"style":1277},[5081],{"type":76,"value":4763},{"type":70,"tag":110,"props":5083,"children":5084},{"style":133},[5085],{"type":76,"value":1405},{"type":70,"tag":110,"props":5087,"children":5088},{"style":133},[5089],{"type":76,"value":422},{"type":70,"tag":110,"props":5091,"children":5092},{"style":330},[5093],{"type":76,"value":4776},{"type":70,"tag":110,"props":5095,"children":5096},{"class":112,"line":721},[5097,5101,5105,5109,5113,5117,5121,5125,5129,5133,5137],{"type":70,"tag":110,"props":5098,"children":5099},{"style":133},[5100],{"type":76,"value":4784},{"type":70,"tag":110,"props":5102,"children":5103},{"style":330},[5104],{"type":76,"value":873},{"type":70,"tag":110,"props":5106,"children":5107},{"style":133},[5108],{"type":76,"value":338},{"type":70,"tag":110,"props":5110,"children":5111},{"style":133},[5112],{"type":76,"value":157},{"type":70,"tag":110,"props":5114,"children":5115},{"style":160},[5116],{"type":76,"value":76},{"type":70,"tag":110,"props":5118,"children":5119},{"style":133},[5120],{"type":76,"value":304},{"type":70,"tag":110,"props":5122,"children":5123},{"style":133},[5124],{"type":76,"value":190},{"type":70,"tag":110,"props":5126,"children":5127},{"style":330},[5128],{"type":76,"value":4813},{"type":70,"tag":110,"props":5130,"children":5131},{"style":133},[5132],{"type":76,"value":338},{"type":70,"tag":110,"props":5134,"children":5135},{"style":139},[5136],{"type":76,"value":4822},{"type":70,"tag":110,"props":5138,"children":5139},{"style":133},[5140],{"type":76,"value":3001},{"type":70,"tag":110,"props":5142,"children":5143},{"class":112,"line":730},[5144],{"type":70,"tag":110,"props":5145,"children":5146},{"style":133},[5147],{"type":76,"value":4834},{"type":70,"tag":110,"props":5149,"children":5150},{"class":112,"line":739},[5151,5155,5159,5163,5167,5171],{"type":70,"tag":110,"props":5152,"children":5153},{"style":330},[5154],{"type":76,"value":4842},{"type":70,"tag":110,"props":5156,"children":5157},{"style":133},[5158],{"type":76,"value":338},{"type":70,"tag":110,"props":5160,"children":5161},{"style":133},[5162],{"type":76,"value":157},{"type":70,"tag":110,"props":5164,"children":5165},{"style":160},[5166],{"type":76,"value":4855},{"type":70,"tag":110,"props":5168,"children":5169},{"style":133},[5170],{"type":76,"value":304},{"type":70,"tag":110,"props":5172,"children":5173},{"style":133},[5174],{"type":76,"value":588},{"type":70,"tag":110,"props":5176,"children":5177},{"class":112,"line":748},[5178,5182,5186,5190,5194,5198,5202,5207,5211,5215,5219,5223,5227],{"type":70,"tag":110,"props":5179,"children":5180},{"style":330},[5181],{"type":76,"value":4871},{"type":70,"tag":110,"props":5183,"children":5184},{"style":133},[5185],{"type":76,"value":338},{"type":70,"tag":110,"props":5187,"children":5188},{"style":133},[5189],{"type":76,"value":136},{"type":70,"tag":110,"props":5191,"children":5192},{"style":330},[5193],{"type":76,"value":873},{"type":70,"tag":110,"props":5195,"children":5196},{"style":133},[5197],{"type":76,"value":338},{"type":70,"tag":110,"props":5199,"children":5200},{"style":133},[5201],{"type":76,"value":157},{"type":70,"tag":110,"props":5203,"children":5204},{"style":160},[5205],{"type":76,"value":5206},"url",{"type":70,"tag":110,"props":5208,"children":5209},{"style":133},[5210],{"type":76,"value":304},{"type":70,"tag":110,"props":5212,"children":5213},{"style":133},[5214],{"type":76,"value":190},{"type":70,"tag":110,"props":5216,"children":5217},{"style":330},[5218],{"type":76,"value":4909},{"type":70,"tag":110,"props":5220,"children":5221},{"style":133},[5222],{"type":76,"value":338},{"type":70,"tag":110,"props":5224,"children":5225},{"style":139},[5226],{"type":76,"value":5038},{"type":70,"tag":110,"props":5228,"children":5229},{"style":133},[5230],{"type":76,"value":3001},{"type":70,"tag":110,"props":5232,"children":5233},{"class":112,"line":1501},[5234],{"type":70,"tag":110,"props":5235,"children":5236},{"style":133},[5237],{"type":76,"value":736},{"type":70,"tag":110,"props":5239,"children":5240},{"class":112,"line":1539},[5241],{"type":70,"tag":110,"props":5242,"children":5243},{"style":330},[5244],{"type":76,"value":4944},{"type":70,"tag":110,"props":5246,"children":5247},{"class":112,"line":1609},[5248],{"type":70,"tag":110,"props":5249,"children":5250},{"emptyLinePlaceholder":261},[5251],{"type":76,"value":264},{"type":70,"tag":110,"props":5253,"children":5254},{"class":112,"line":1618},[5255,5259,5263,5267,5271,5275,5279,5283],{"type":70,"tag":110,"props":5256,"children":5257},{"style":292},[5258],{"type":76,"value":4959},{"type":70,"tag":110,"props":5260,"children":5261},{"style":330},[5262],{"type":76,"value":299},{"type":70,"tag":110,"props":5264,"children":5265},{"style":133},[5266],{"type":76,"value":1410},{"type":70,"tag":110,"props":5268,"children":5269},{"style":330},[5270],{"type":76,"value":4813},{"type":70,"tag":110,"props":5272,"children":5273},{"style":133},[5274],{"type":76,"value":338},{"type":70,"tag":110,"props":5276,"children":5277},{"style":139},[5278],{"type":76,"value":4744},{"type":70,"tag":110,"props":5280,"children":5281},{"style":133},[5282],{"type":76,"value":147},{"type":70,"tag":110,"props":5284,"children":5285},{"style":330},[5286],{"type":76,"value":668},{"type":70,"tag":110,"props":5288,"children":5289},{"class":112,"line":1632},[5290],{"type":70,"tag":110,"props":5291,"children":5292},{"style":133},[5293],{"type":76,"value":1647},{"type":70,"tag":79,"props":5295,"children":5296},{},[5297],{"type":76,"value":5298},"Render image parts in received messages:",{"type":70,"tag":99,"props":5300,"children":5302},{"className":101,"code":5301,"language":45,"meta":103,"style":103},"if (part.type === 'image') {\n  const src =\n    part.source.type === 'url'\n      ? part.source.value\n      : `data:${part.source.mimeType};base64,${part.source.value}`\n  return \u003Cimg key={i} src={src} alt=\"Attached image\" \u002F>\n}\n",[5303],{"type":70,"tag":106,"props":5304,"children":5305},{"__ignoreMap":103},[5306,5353,5370,5411,5441,5524,5604],{"type":70,"tag":110,"props":5307,"children":5308},{"class":112,"line":113},[5309,5314,5319,5323,5328,5333,5337,5341,5345,5349],{"type":70,"tag":110,"props":5310,"children":5311},{"style":127},[5312],{"type":76,"value":5313},"if",{"type":70,"tag":110,"props":5315,"children":5316},{"style":139},[5317],{"type":76,"value":5318}," (part",{"type":70,"tag":110,"props":5320,"children":5321},{"style":133},[5322],{"type":76,"value":468},{"type":70,"tag":110,"props":5324,"children":5325},{"style":139},[5326],{"type":76,"value":5327},"type ",{"type":70,"tag":110,"props":5329,"children":5330},{"style":133},[5331],{"type":76,"value":5332},"===",{"type":70,"tag":110,"props":5334,"children":5335},{"style":133},[5336],{"type":76,"value":157},{"type":70,"tag":110,"props":5338,"children":5339},{"style":160},[5340],{"type":76,"value":4855},{"type":70,"tag":110,"props":5342,"children":5343},{"style":133},[5344],{"type":76,"value":304},{"type":70,"tag":110,"props":5346,"children":5347},{"style":139},[5348],{"type":76,"value":1341},{"type":70,"tag":110,"props":5350,"children":5351},{"style":133},[5352],{"type":76,"value":323},{"type":70,"tag":110,"props":5354,"children":5355},{"class":112,"line":123},[5356,5360,5365],{"type":70,"tag":110,"props":5357,"children":5358},{"style":276},[5359],{"type":76,"value":939},{"type":70,"tag":110,"props":5361,"children":5362},{"style":139},[5363],{"type":76,"value":5364}," src",{"type":70,"tag":110,"props":5366,"children":5367},{"style":133},[5368],{"type":76,"value":5369}," =\n",{"type":70,"tag":110,"props":5371,"children":5372},{"class":112,"line":171},[5373,5378,5382,5387,5391,5395,5399,5403,5407],{"type":70,"tag":110,"props":5374,"children":5375},{"style":139},[5376],{"type":76,"value":5377},"    part",{"type":70,"tag":110,"props":5379,"children":5380},{"style":133},[5381],{"type":76,"value":468},{"type":70,"tag":110,"props":5383,"children":5384},{"style":139},[5385],{"type":76,"value":5386},"source",{"type":70,"tag":110,"props":5388,"children":5389},{"style":133},[5390],{"type":76,"value":468},{"type":70,"tag":110,"props":5392,"children":5393},{"style":139},[5394],{"type":76,"value":3619},{"type":70,"tag":110,"props":5396,"children":5397},{"style":133},[5398],{"type":76,"value":1916},{"type":70,"tag":110,"props":5400,"children":5401},{"style":133},[5402],{"type":76,"value":157},{"type":70,"tag":110,"props":5404,"children":5405},{"style":160},[5406],{"type":76,"value":5206},{"type":70,"tag":110,"props":5408,"children":5409},{"style":133},[5410],{"type":76,"value":168},{"type":70,"tag":110,"props":5412,"children":5413},{"class":112,"line":219},[5414,5419,5424,5428,5432,5436],{"type":70,"tag":110,"props":5415,"children":5416},{"style":133},[5417],{"type":76,"value":5418},"      ?",{"type":70,"tag":110,"props":5420,"children":5421},{"style":139},[5422],{"type":76,"value":5423}," part",{"type":70,"tag":110,"props":5425,"children":5426},{"style":133},[5427],{"type":76,"value":468},{"type":70,"tag":110,"props":5429,"children":5430},{"style":139},[5431],{"type":76,"value":5386},{"type":70,"tag":110,"props":5433,"children":5434},{"style":133},[5435],{"type":76,"value":468},{"type":70,"tag":110,"props":5437,"children":5438},{"style":139},[5439],{"type":76,"value":5440},"value\n",{"type":70,"tag":110,"props":5442,"children":5443},{"class":112,"line":257},[5444,5449,5454,5459,5464,5468,5472,5476,5480,5485,5489,5494,5498,5502,5506,5510,5514,5519],{"type":70,"tag":110,"props":5445,"children":5446},{"style":133},[5447],{"type":76,"value":5448},"      :",{"type":70,"tag":110,"props":5450,"children":5451},{"style":133},[5452],{"type":76,"value":5453}," `",{"type":70,"tag":110,"props":5455,"children":5456},{"style":160},[5457],{"type":76,"value":5458},"data:",{"type":70,"tag":110,"props":5460,"children":5461},{"style":133},[5462],{"type":76,"value":5463},"${",{"type":70,"tag":110,"props":5465,"children":5466},{"style":139},[5467],{"type":76,"value":1477},{"type":70,"tag":110,"props":5469,"children":5470},{"style":133},[5471],{"type":76,"value":468},{"type":70,"tag":110,"props":5473,"children":5474},{"style":139},[5475],{"type":76,"value":5386},{"type":70,"tag":110,"props":5477,"children":5478},{"style":133},[5479],{"type":76,"value":468},{"type":70,"tag":110,"props":5481,"children":5482},{"style":139},[5483],{"type":76,"value":5484},"mimeType",{"type":70,"tag":110,"props":5486,"children":5487},{"style":133},[5488],{"type":76,"value":754},{"type":70,"tag":110,"props":5490,"children":5491},{"style":160},[5492],{"type":76,"value":5493},";base64,",{"type":70,"tag":110,"props":5495,"children":5496},{"style":133},[5497],{"type":76,"value":5463},{"type":70,"tag":110,"props":5499,"children":5500},{"style":139},[5501],{"type":76,"value":1477},{"type":70,"tag":110,"props":5503,"children":5504},{"style":133},[5505],{"type":76,"value":468},{"type":70,"tag":110,"props":5507,"children":5508},{"style":139},[5509],{"type":76,"value":5386},{"type":70,"tag":110,"props":5511,"children":5512},{"style":133},[5513],{"type":76,"value":468},{"type":70,"tag":110,"props":5515,"children":5516},{"style":139},[5517],{"type":76,"value":5518},"value",{"type":70,"tag":110,"props":5520,"children":5521},{"style":133},[5522],{"type":76,"value":5523},"}`\n",{"type":70,"tag":110,"props":5525,"children":5526},{"class":112,"line":267},[5527,5531,5535,5540,5544,5548,5552,5556,5560,5564,5569,5573,5578,5582,5586,5591,5595,5600],{"type":70,"tag":110,"props":5528,"children":5529},{"style":127},[5530],{"type":76,"value":1261},{"type":70,"tag":110,"props":5532,"children":5533},{"style":133},[5534],{"type":76,"value":1550},{"type":70,"tag":110,"props":5536,"children":5537},{"style":1277},[5538],{"type":76,"value":5539},"img",{"type":70,"tag":110,"props":5541,"children":5542},{"style":1277},[5543],{"type":76,"value":1367},{"type":70,"tag":110,"props":5545,"children":5546},{"style":133},[5547],{"type":76,"value":1372},{"type":70,"tag":110,"props":5549,"children":5550},{"style":330},[5551],{"type":76,"value":1571},{"type":70,"tag":110,"props":5553,"children":5554},{"style":133},[5555],{"type":76,"value":754},{"type":70,"tag":110,"props":5557,"children":5558},{"style":1277},[5559],{"type":76,"value":5364},{"type":70,"tag":110,"props":5561,"children":5562},{"style":133},[5563],{"type":76,"value":1372},{"type":70,"tag":110,"props":5565,"children":5566},{"style":330},[5567],{"type":76,"value":5568},"src",{"type":70,"tag":110,"props":5570,"children":5571},{"style":133},[5572],{"type":76,"value":754},{"type":70,"tag":110,"props":5574,"children":5575},{"style":1277},[5576],{"type":76,"value":5577}," alt",{"type":70,"tag":110,"props":5579,"children":5580},{"style":133},[5581],{"type":76,"value":289},{"type":70,"tag":110,"props":5583,"children":5584},{"style":133},[5585],{"type":76,"value":2053},{"type":70,"tag":110,"props":5587,"children":5588},{"style":160},[5589],{"type":76,"value":5590},"Attached image",{"type":70,"tag":110,"props":5592,"children":5593},{"style":133},[5594],{"type":76,"value":2053},{"type":70,"tag":110,"props":5596,"children":5597},{"style":330},[5598],{"type":76,"value":5599}," \u002F",{"type":70,"tag":110,"props":5601,"children":5602},{"style":133},[5603],{"type":76,"value":1285},{"type":70,"tag":110,"props":5605,"children":5606},{"class":112,"line":326},[5607],{"type":70,"tag":110,"props":5608,"children":5609},{"style":330},[5610],{"type":76,"value":1647},{"type":70,"tag":92,"props":5612,"children":5614},{"id":5613},"_4-sending-audio-messages-browser-recording",[5615],{"type":76,"value":5616},"4. Sending Audio Messages (Browser Recording)",{"type":70,"tag":79,"props":5618,"children":5619},{},[5620,5621,5627,5628,5633,5635,5641,5643,5649,5651,5656,5658,5663],{"type":76,"value":4455},{"type":70,"tag":106,"props":5622,"children":5624},{"className":5623},[],[5625],{"type":76,"value":5626},"useAudioRecorder",{"type":76,"value":2692},{"type":70,"tag":106,"props":5629,"children":5631},{"className":5630},[],[5632],{"type":76,"value":857},{"type":76,"value":5634}," (or ",{"type":70,"tag":106,"props":5636,"children":5638},{"className":5637},[],[5639],{"type":76,"value":5640},"createAudioRecorder",{"type":76,"value":5642}," in Svelte) to capture audio in the browser. The resolved ",{"type":70,"tag":106,"props":5644,"children":5646},{"className":5645},[],[5647],{"type":76,"value":5648},"AudioRecording",{"type":76,"value":5650}," includes a ready-to-use ",{"type":70,"tag":106,"props":5652,"children":5654},{"className":5653},[],[5655],{"type":76,"value":1477},{"type":76,"value":5657}," that slots directly into ",{"type":70,"tag":106,"props":5659,"children":5661},{"className":5660},[],[5662],{"type":76,"value":4461},{"type":76,"value":468},{"type":70,"tag":99,"props":5665,"children":5667},{"className":101,"code":5666,"language":45,"meta":103,"style":103},"import {\n  useAudioRecorder,\n  useChat,\n  fetchServerSentEvents,\n} from '@tanstack\u002Fai-react'\n\nconst { isRecording, isSupported, start, stop } = useAudioRecorder()\nconst { sendMessage } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n})\n\nasync function toggle() {\n  if (!isRecording) {\n    await start()\n    return\n  }\n  const recording = await stop()\n  await sendMessage({ content: [recording.part] })\n}\n",[5668],{"type":70,"tag":106,"props":5669,"children":5670},{"__ignoreMap":103},[5671,5682,5694,5706,5718,5741,5748,5808,5843,5882,5893,5900,5926,5955,5971,5979,5986,6014,6072],{"type":70,"tag":110,"props":5672,"children":5673},{"class":112,"line":113},[5674,5678],{"type":70,"tag":110,"props":5675,"children":5676},{"style":127},[5677],{"type":76,"value":130},{"type":70,"tag":110,"props":5679,"children":5680},{"style":133},[5681],{"type":76,"value":343},{"type":70,"tag":110,"props":5683,"children":5684},{"class":112,"line":123},[5685,5690],{"type":70,"tag":110,"props":5686,"children":5687},{"style":139},[5688],{"type":76,"value":5689},"  useAudioRecorder",{"type":70,"tag":110,"props":5691,"children":5692},{"style":133},[5693],{"type":76,"value":588},{"type":70,"tag":110,"props":5695,"children":5696},{"class":112,"line":171},[5697,5702],{"type":70,"tag":110,"props":5698,"children":5699},{"style":139},[5700],{"type":76,"value":5701},"  useChat",{"type":70,"tag":110,"props":5703,"children":5704},{"style":133},[5705],{"type":76,"value":588},{"type":70,"tag":110,"props":5707,"children":5708},{"class":112,"line":219},[5709,5714],{"type":70,"tag":110,"props":5710,"children":5711},{"style":139},[5712],{"type":76,"value":5713},"  fetchServerSentEvents",{"type":70,"tag":110,"props":5715,"children":5716},{"style":133},[5717],{"type":76,"value":588},{"type":70,"tag":110,"props":5719,"children":5720},{"class":112,"line":257},[5721,5725,5729,5733,5737],{"type":70,"tag":110,"props":5722,"children":5723},{"style":133},[5724],{"type":76,"value":754},{"type":70,"tag":110,"props":5726,"children":5727},{"style":127},[5728],{"type":76,"value":152},{"type":70,"tag":110,"props":5730,"children":5731},{"style":133},[5732],{"type":76,"value":157},{"type":70,"tag":110,"props":5734,"children":5735},{"style":160},[5736],{"type":76,"value":857},{"type":70,"tag":110,"props":5738,"children":5739},{"style":133},[5740],{"type":76,"value":168},{"type":70,"tag":110,"props":5742,"children":5743},{"class":112,"line":267},[5744],{"type":70,"tag":110,"props":5745,"children":5746},{"emptyLinePlaceholder":261},[5747],{"type":76,"value":264},{"type":70,"tag":110,"props":5749,"children":5750},{"class":112,"line":326},[5751,5755,5759,5764,5768,5773,5777,5782,5786,5791,5795,5799,5804],{"type":70,"tag":110,"props":5752,"children":5753},{"style":276},[5754],{"type":76,"value":2422},{"type":70,"tag":110,"props":5756,"children":5757},{"style":133},[5758],{"type":76,"value":136},{"type":70,"tag":110,"props":5760,"children":5761},{"style":139},[5762],{"type":76,"value":5763}," isRecording",{"type":70,"tag":110,"props":5765,"children":5766},{"style":133},[5767],{"type":76,"value":190},{"type":70,"tag":110,"props":5769,"children":5770},{"style":139},[5771],{"type":76,"value":5772}," isSupported",{"type":70,"tag":110,"props":5774,"children":5775},{"style":133},[5776],{"type":76,"value":190},{"type":70,"tag":110,"props":5778,"children":5779},{"style":139},[5780],{"type":76,"value":5781}," start",{"type":70,"tag":110,"props":5783,"children":5784},{"style":133},[5785],{"type":76,"value":190},{"type":70,"tag":110,"props":5787,"children":5788},{"style":139},[5789],{"type":76,"value":5790}," stop ",{"type":70,"tag":110,"props":5792,"children":5793},{"style":133},[5794],{"type":76,"value":754},{"type":70,"tag":110,"props":5796,"children":5797},{"style":133},[5798],{"type":76,"value":422},{"type":70,"tag":110,"props":5800,"children":5801},{"style":292},[5802],{"type":76,"value":5803}," useAudioRecorder",{"type":70,"tag":110,"props":5805,"children":5806},{"style":139},[5807],{"type":76,"value":437},{"type":70,"tag":110,"props":5809,"children":5810},{"class":112,"line":346},[5811,5815,5819,5823,5827,5831,5835,5839],{"type":70,"tag":110,"props":5812,"children":5813},{"style":276},[5814],{"type":76,"value":2422},{"type":70,"tag":110,"props":5816,"children":5817},{"style":133},[5818],{"type":76,"value":136},{"type":70,"tag":110,"props":5820,"children":5821},{"style":139},[5822],{"type":76,"value":4584},{"type":70,"tag":110,"props":5824,"children":5825},{"style":133},[5826],{"type":76,"value":754},{"type":70,"tag":110,"props":5828,"children":5829},{"style":133},[5830],{"type":76,"value":422},{"type":70,"tag":110,"props":5832,"children":5833},{"style":292},[5834],{"type":76,"value":831},{"type":70,"tag":110,"props":5836,"children":5837},{"style":139},[5838],{"type":76,"value":299},{"type":70,"tag":110,"props":5840,"children":5841},{"style":133},[5842],{"type":76,"value":323},{"type":70,"tag":110,"props":5844,"children":5845},{"class":112,"line":363},[5846,5850,5854,5858,5862,5866,5870,5874,5878],{"type":70,"tag":110,"props":5847,"children":5848},{"style":330},[5849],{"type":76,"value":2902},{"type":70,"tag":110,"props":5851,"children":5852},{"style":133},[5853],{"type":76,"value":338},{"type":70,"tag":110,"props":5855,"children":5856},{"style":292},[5857],{"type":76,"value":840},{"type":70,"tag":110,"props":5859,"children":5860},{"style":139},[5861],{"type":76,"value":299},{"type":70,"tag":110,"props":5863,"children":5864},{"style":133},[5865],{"type":76,"value":304},{"type":70,"tag":110,"props":5867,"children":5868},{"style":160},[5869],{"type":76,"value":309},{"type":70,"tag":110,"props":5871,"children":5872},{"style":133},[5873],{"type":76,"value":304},{"type":70,"tag":110,"props":5875,"children":5876},{"style":139},[5877],{"type":76,"value":583},{"type":70,"tag":110,"props":5879,"children":5880},{"style":133},[5881],{"type":76,"value":588},{"type":70,"tag":110,"props":5883,"children":5884},{"class":112,"line":406},[5885,5889],{"type":70,"tag":110,"props":5886,"children":5887},{"style":133},[5888],{"type":76,"value":754},{"type":70,"tag":110,"props":5890,"children":5891},{"style":139},[5892],{"type":76,"value":668},{"type":70,"tag":110,"props":5894,"children":5895},{"class":112,"line":440},[5896],{"type":70,"tag":110,"props":5897,"children":5898},{"emptyLinePlaceholder":261},[5899],{"type":76,"value":264},{"type":70,"tag":110,"props":5901,"children":5902},{"class":112,"line":480},[5903,5908,5913,5918,5922],{"type":70,"tag":110,"props":5904,"children":5905},{"style":276},[5906],{"type":76,"value":5907},"async",{"type":70,"tag":110,"props":5909,"children":5910},{"style":276},[5911],{"type":76,"value":5912}," function",{"type":70,"tag":110,"props":5914,"children":5915},{"style":292},[5916],{"type":76,"value":5917}," toggle",{"type":70,"tag":110,"props":5919,"children":5920},{"style":133},[5921],{"type":76,"value":927},{"type":70,"tag":110,"props":5923,"children":5924},{"style":133},[5925],{"type":76,"value":343},{"type":70,"tag":110,"props":5927,"children":5928},{"class":112,"line":510},[5929,5934,5938,5942,5947,5951],{"type":70,"tag":110,"props":5930,"children":5931},{"style":127},[5932],{"type":76,"value":5933},"  if",{"type":70,"tag":110,"props":5935,"children":5936},{"style":330},[5937],{"type":76,"value":1161},{"type":70,"tag":110,"props":5939,"children":5940},{"style":133},[5941],{"type":76,"value":1166},{"type":70,"tag":110,"props":5943,"children":5944},{"style":139},[5945],{"type":76,"value":5946},"isRecording",{"type":70,"tag":110,"props":5948,"children":5949},{"style":330},[5950],{"type":76,"value":1341},{"type":70,"tag":110,"props":5952,"children":5953},{"style":133},[5954],{"type":76,"value":323},{"type":70,"tag":110,"props":5956,"children":5957},{"class":112,"line":518},[5958,5963,5967],{"type":70,"tag":110,"props":5959,"children":5960},{"style":127},[5961],{"type":76,"value":5962},"    await",{"type":70,"tag":110,"props":5964,"children":5965},{"style":292},[5966],{"type":76,"value":5781},{"type":70,"tag":110,"props":5968,"children":5969},{"style":330},[5970],{"type":76,"value":437},{"type":70,"tag":110,"props":5972,"children":5973},{"class":112,"line":547},[5974],{"type":70,"tag":110,"props":5975,"children":5976},{"style":127},[5977],{"type":76,"value":5978},"    return\n",{"type":70,"tag":110,"props":5980,"children":5981},{"class":112,"line":591},[5982],{"type":70,"tag":110,"props":5983,"children":5984},{"style":133},[5985],{"type":76,"value":1246},{"type":70,"tag":110,"props":5987,"children":5988},{"class":112,"line":604},[5989,5993,5998,6002,6006,6010],{"type":70,"tag":110,"props":5990,"children":5991},{"style":276},[5992],{"type":76,"value":939},{"type":70,"tag":110,"props":5994,"children":5995},{"style":139},[5996],{"type":76,"value":5997}," recording",{"type":70,"tag":110,"props":5999,"children":6000},{"style":133},[6001],{"type":76,"value":422},{"type":70,"tag":110,"props":6003,"children":6004},{"style":127},[6005],{"type":76,"value":459},{"type":70,"tag":110,"props":6007,"children":6008},{"style":292},[6009],{"type":76,"value":1040},{"type":70,"tag":110,"props":6011,"children":6012},{"style":330},[6013],{"type":76,"value":437},{"type":70,"tag":110,"props":6015,"children":6016},{"class":112,"line":644},[6017,6022,6026,6030,6034,6038,6042,6046,6051,6055,6059,6064,6068],{"type":70,"tag":110,"props":6018,"children":6019},{"style":127},[6020],{"type":76,"value":6021},"  await",{"type":70,"tag":110,"props":6023,"children":6024},{"style":292},[6025],{"type":76,"value":1013},{"type":70,"tag":110,"props":6027,"children":6028},{"style":330},[6029],{"type":76,"value":299},{"type":70,"tag":110,"props":6031,"children":6032},{"style":133},[6033],{"type":76,"value":1410},{"type":70,"tag":110,"props":6035,"children":6036},{"style":330},[6037],{"type":76,"value":4813},{"type":70,"tag":110,"props":6039,"children":6040},{"style":133},[6041],{"type":76,"value":338},{"type":70,"tag":110,"props":6043,"children":6044},{"style":330},[6045],{"type":76,"value":619},{"type":70,"tag":110,"props":6047,"children":6048},{"style":139},[6049],{"type":76,"value":6050},"recording",{"type":70,"tag":110,"props":6052,"children":6053},{"style":133},[6054],{"type":76,"value":468},{"type":70,"tag":110,"props":6056,"children":6057},{"style":139},[6058],{"type":76,"value":1477},{"type":70,"tag":110,"props":6060,"children":6061},{"style":330},[6062],{"type":76,"value":6063},"] ",{"type":70,"tag":110,"props":6065,"children":6066},{"style":133},[6067],{"type":76,"value":754},{"type":70,"tag":110,"props":6069,"children":6070},{"style":330},[6071],{"type":76,"value":668},{"type":70,"tag":110,"props":6073,"children":6074},{"class":112,"line":657},[6075],{"type":70,"tag":110,"props":6076,"children":6077},{"style":133},[6078],{"type":76,"value":1647},{"type":70,"tag":79,"props":6080,"children":6081},{},[6082,6088,6090,6096,6098,6104,6106,6112],{"type":70,"tag":106,"props":6083,"children":6085},{"className":6084},[],[6086],{"type":76,"value":6087},"recording.part",{"type":76,"value":6089}," is ",{"type":70,"tag":106,"props":6091,"children":6093},{"className":6092},[],[6094],{"type":76,"value":6095},"{ type: 'audio', source: { type: 'data', value: base64, mimeType } }",{"type":76,"value":6097},". Returns the recorder's native format (",{"type":70,"tag":106,"props":6099,"children":6101},{"className":6100},[],[6102],{"type":76,"value":6103},"audio\u002Fwebm",{"type":76,"value":6105}," or ",{"type":70,"tag":106,"props":6107,"children":6109},{"className":6108},[],[6110],{"type":76,"value":6111},"audio\u002Fmp4",{"type":76,"value":6113},") with no transcoding.",{"type":70,"tag":92,"props":6115,"children":6117},{"id":6116},"_5-http-stream-format-alternative-to-sse",[6118],{"type":76,"value":6119},"5. HTTP Stream Format (Alternative to SSE)",{"type":70,"tag":79,"props":6121,"children":6122},{},[6123,6124,6130,6132,6138],{"type":76,"value":4455},{"type":70,"tag":106,"props":6125,"children":6127},{"className":6126},[],[6128],{"type":76,"value":6129},"toHttpResponse",{"type":76,"value":6131}," + ",{"type":70,"tag":106,"props":6133,"children":6135},{"className":6134},[],[6136],{"type":76,"value":6137},"fetchHttpStream",{"type":76,"value":6139}," for newline-delimited JSON instead of SSE.",{"type":70,"tag":79,"props":6141,"children":6142},{},[6143],{"type":70,"tag":1400,"props":6144,"children":6145},{},[6146],{"type":76,"value":2320},{"type":70,"tag":99,"props":6148,"children":6150},{"className":101,"code":6149,"language":45,"meta":103,"style":103},"import { chat, toHttpResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  abortController,\n})\n\nreturn toHttpResponse(stream, { abortController })\n",[6151],{"type":70,"tag":106,"props":6152,"children":6153},{"__ignoreMap":103},[6154,6198,6233,6240,6267,6306,6317,6328,6339,6346],{"type":70,"tag":110,"props":6155,"children":6156},{"class":112,"line":113},[6157,6161,6165,6169,6173,6178,6182,6186,6190,6194],{"type":70,"tag":110,"props":6158,"children":6159},{"style":127},[6160],{"type":76,"value":130},{"type":70,"tag":110,"props":6162,"children":6163},{"style":133},[6164],{"type":76,"value":136},{"type":70,"tag":110,"props":6166,"children":6167},{"style":139},[6168],{"type":76,"value":185},{"type":70,"tag":110,"props":6170,"children":6171},{"style":133},[6172],{"type":76,"value":190},{"type":70,"tag":110,"props":6174,"children":6175},{"style":139},[6176],{"type":76,"value":6177}," toHttpResponse",{"type":70,"tag":110,"props":6179,"children":6180},{"style":133},[6181],{"type":76,"value":147},{"type":70,"tag":110,"props":6183,"children":6184},{"style":127},[6185],{"type":76,"value":152},{"type":70,"tag":110,"props":6187,"children":6188},{"style":133},[6189],{"type":76,"value":157},{"type":70,"tag":110,"props":6191,"children":6192},{"style":160},[6193],{"type":76,"value":212},{"type":70,"tag":110,"props":6195,"children":6196},{"style":133},[6197],{"type":76,"value":168},{"type":70,"tag":110,"props":6199,"children":6200},{"class":112,"line":123},[6201,6205,6209,6213,6217,6221,6225,6229],{"type":70,"tag":110,"props":6202,"children":6203},{"style":127},[6204],{"type":76,"value":130},{"type":70,"tag":110,"props":6206,"children":6207},{"style":133},[6208],{"type":76,"value":136},{"type":70,"tag":110,"props":6210,"children":6211},{"style":139},[6212],{"type":76,"value":233},{"type":70,"tag":110,"props":6214,"children":6215},{"style":133},[6216],{"type":76,"value":147},{"type":70,"tag":110,"props":6218,"children":6219},{"style":127},[6220],{"type":76,"value":152},{"type":70,"tag":110,"props":6222,"children":6223},{"style":133},[6224],{"type":76,"value":157},{"type":70,"tag":110,"props":6226,"children":6227},{"style":160},[6228],{"type":76,"value":250},{"type":70,"tag":110,"props":6230,"children":6231},{"style":133},[6232],{"type":76,"value":168},{"type":70,"tag":110,"props":6234,"children":6235},{"class":112,"line":171},[6236],{"type":70,"tag":110,"props":6237,"children":6238},{"emptyLinePlaceholder":261},[6239],{"type":76,"value":264},{"type":70,"tag":110,"props":6241,"children":6242},{"class":112,"line":219},[6243,6247,6251,6255,6259,6263],{"type":70,"tag":110,"props":6244,"children":6245},{"style":276},[6246],{"type":76,"value":2422},{"type":70,"tag":110,"props":6248,"children":6249},{"style":139},[6250],{"type":76,"value":2427},{"type":70,"tag":110,"props":6252,"children":6253},{"style":133},[6254],{"type":76,"value":289},{"type":70,"tag":110,"props":6256,"children":6257},{"style":292},[6258],{"type":76,"value":185},{"type":70,"tag":110,"props":6260,"children":6261},{"style":139},[6262],{"type":76,"value":299},{"type":70,"tag":110,"props":6264,"children":6265},{"style":133},[6266],{"type":76,"value":323},{"type":70,"tag":110,"props":6268,"children":6269},{"class":112,"line":257},[6270,6274,6278,6282,6286,6290,6294,6298,6302],{"type":70,"tag":110,"props":6271,"children":6272},{"style":330},[6273],{"type":76,"value":2451},{"type":70,"tag":110,"props":6275,"children":6276},{"style":133},[6277],{"type":76,"value":338},{"type":70,"tag":110,"props":6279,"children":6280},{"style":292},[6281],{"type":76,"value":233},{"type":70,"tag":110,"props":6283,"children":6284},{"style":139},[6285],{"type":76,"value":299},{"type":70,"tag":110,"props":6287,"children":6288},{"style":133},[6289],{"type":76,"value":304},{"type":70,"tag":110,"props":6291,"children":6292},{"style":160},[6293],{"type":76,"value":574},{"type":70,"tag":110,"props":6295,"children":6296},{"style":133},[6297],{"type":76,"value":304},{"type":70,"tag":110,"props":6299,"children":6300},{"style":139},[6301],{"type":76,"value":583},{"type":70,"tag":110,"props":6303,"children":6304},{"style":133},[6305],{"type":76,"value":588},{"type":70,"tag":110,"props":6307,"children":6308},{"class":112,"line":267},[6309,6313],{"type":70,"tag":110,"props":6310,"children":6311},{"style":139},[6312],{"type":76,"value":2492},{"type":70,"tag":110,"props":6314,"children":6315},{"style":133},[6316],{"type":76,"value":588},{"type":70,"tag":110,"props":6318,"children":6319},{"class":112,"line":326},[6320,6324],{"type":70,"tag":110,"props":6321,"children":6322},{"style":139},[6323],{"type":76,"value":2611},{"type":70,"tag":110,"props":6325,"children":6326},{"style":133},[6327],{"type":76,"value":588},{"type":70,"tag":110,"props":6329,"children":6330},{"class":112,"line":346},[6331,6335],{"type":70,"tag":110,"props":6332,"children":6333},{"style":133},[6334],{"type":76,"value":754},{"type":70,"tag":110,"props":6336,"children":6337},{"style":139},[6338],{"type":76,"value":668},{"type":70,"tag":110,"props":6340,"children":6341},{"class":112,"line":363},[6342],{"type":70,"tag":110,"props":6343,"children":6344},{"emptyLinePlaceholder":261},[6345],{"type":76,"value":264},{"type":70,"tag":110,"props":6347,"children":6348},{"class":112,"line":406},[6349,6353,6357,6361,6365,6369,6373,6377],{"type":70,"tag":110,"props":6350,"children":6351},{"style":127},[6352],{"type":76,"value":2641},{"type":70,"tag":110,"props":6354,"children":6355},{"style":292},[6356],{"type":76,"value":6177},{"type":70,"tag":110,"props":6358,"children":6359},{"style":139},[6360],{"type":76,"value":2650},{"type":70,"tag":110,"props":6362,"children":6363},{"style":133},[6364],{"type":76,"value":190},{"type":70,"tag":110,"props":6366,"children":6367},{"style":133},[6368],{"type":76,"value":136},{"type":70,"tag":110,"props":6370,"children":6371},{"style":139},[6372],{"type":76,"value":2663},{"type":70,"tag":110,"props":6374,"children":6375},{"style":133},[6376],{"type":76,"value":754},{"type":70,"tag":110,"props":6378,"children":6379},{"style":139},[6380],{"type":76,"value":668},{"type":70,"tag":79,"props":6382,"children":6383},{},[6384],{"type":70,"tag":1400,"props":6385,"children":6386},{},[6387],{"type":76,"value":2761},{"type":70,"tag":99,"props":6389,"children":6391},{"className":101,"code":6390,"language":45,"meta":103,"style":103},"import { useChat, fetchHttpStream } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchHttpStream('\u002Fapi\u002Fchat'),\n})\n",[6392],{"type":70,"tag":106,"props":6393,"children":6394},{"__ignoreMap":103},[6395,6439,6446,6489,6528],{"type":70,"tag":110,"props":6396,"children":6397},{"class":112,"line":113},[6398,6402,6406,6410,6414,6419,6423,6427,6431,6435],{"type":70,"tag":110,"props":6399,"children":6400},{"style":127},[6401],{"type":76,"value":130},{"type":70,"tag":110,"props":6403,"children":6404},{"style":133},[6405],{"type":76,"value":136},{"type":70,"tag":110,"props":6407,"children":6408},{"style":139},[6409],{"type":76,"value":831},{"type":70,"tag":110,"props":6411,"children":6412},{"style":133},[6413],{"type":76,"value":190},{"type":70,"tag":110,"props":6415,"children":6416},{"style":139},[6417],{"type":76,"value":6418}," fetchHttpStream",{"type":70,"tag":110,"props":6420,"children":6421},{"style":133},[6422],{"type":76,"value":147},{"type":70,"tag":110,"props":6424,"children":6425},{"style":127},[6426],{"type":76,"value":152},{"type":70,"tag":110,"props":6428,"children":6429},{"style":133},[6430],{"type":76,"value":157},{"type":70,"tag":110,"props":6432,"children":6433},{"style":160},[6434],{"type":76,"value":857},{"type":70,"tag":110,"props":6436,"children":6437},{"style":133},[6438],{"type":76,"value":168},{"type":70,"tag":110,"props":6440,"children":6441},{"class":112,"line":123},[6442],{"type":70,"tag":110,"props":6443,"children":6444},{"emptyLinePlaceholder":261},[6445],{"type":76,"value":264},{"type":70,"tag":110,"props":6447,"children":6448},{"class":112,"line":171},[6449,6453,6457,6461,6465,6469,6473,6477,6481,6485],{"type":70,"tag":110,"props":6450,"children":6451},{"style":276},[6452],{"type":76,"value":2422},{"type":70,"tag":110,"props":6454,"children":6455},{"style":133},[6456],{"type":76,"value":136},{"type":70,"tag":110,"props":6458,"children":6459},{"style":139},[6460],{"type":76,"value":494},{"type":70,"tag":110,"props":6462,"children":6463},{"style":133},[6464],{"type":76,"value":190},{"type":70,"tag":110,"props":6466,"children":6467},{"style":139},[6468],{"type":76,"value":4584},{"type":70,"tag":110,"props":6470,"children":6471},{"style":133},[6472],{"type":76,"value":754},{"type":70,"tag":110,"props":6474,"children":6475},{"style":133},[6476],{"type":76,"value":422},{"type":70,"tag":110,"props":6478,"children":6479},{"style":292},[6480],{"type":76,"value":831},{"type":70,"tag":110,"props":6482,"children":6483},{"style":139},[6484],{"type":76,"value":299},{"type":70,"tag":110,"props":6486,"children":6487},{"style":133},[6488],{"type":76,"value":323},{"type":70,"tag":110,"props":6490,"children":6491},{"class":112,"line":219},[6492,6496,6500,6504,6508,6512,6516,6520,6524],{"type":70,"tag":110,"props":6493,"children":6494},{"style":330},[6495],{"type":76,"value":2902},{"type":70,"tag":110,"props":6497,"children":6498},{"style":133},[6499],{"type":76,"value":338},{"type":70,"tag":110,"props":6501,"children":6502},{"style":292},[6503],{"type":76,"value":6418},{"type":70,"tag":110,"props":6505,"children":6506},{"style":139},[6507],{"type":76,"value":299},{"type":70,"tag":110,"props":6509,"children":6510},{"style":133},[6511],{"type":76,"value":304},{"type":70,"tag":110,"props":6513,"children":6514},{"style":160},[6515],{"type":76,"value":309},{"type":70,"tag":110,"props":6517,"children":6518},{"style":133},[6519],{"type":76,"value":304},{"type":70,"tag":110,"props":6521,"children":6522},{"style":139},[6523],{"type":76,"value":583},{"type":70,"tag":110,"props":6525,"children":6526},{"style":133},[6527],{"type":76,"value":588},{"type":70,"tag":110,"props":6529,"children":6530},{"class":112,"line":257},[6531,6535],{"type":70,"tag":110,"props":6532,"children":6533},{"style":133},[6534],{"type":76,"value":754},{"type":70,"tag":110,"props":6536,"children":6537},{"style":139},[6538],{"type":76,"value":668},{"type":70,"tag":79,"props":6540,"children":6541},{},[6542,6544,6550,6552,6557,6559,6564,6565,6570],{"type":76,"value":6543},"The only difference is swapping ",{"type":70,"tag":106,"props":6545,"children":6547},{"className":6546},[],[6548],{"type":76,"value":6549},"toServerSentEventsResponse",{"type":76,"value":6551}," \u002F ",{"type":70,"tag":106,"props":6553,"children":6555},{"className":6554},[],[6556],{"type":76,"value":2728},{"type":76,"value":6558},"\nfor ",{"type":70,"tag":106,"props":6560,"children":6562},{"className":6561},[],[6563],{"type":76,"value":6129},{"type":76,"value":6551},{"type":70,"tag":106,"props":6566,"children":6568},{"className":6567},[],[6569],{"type":76,"value":6137},{"type":76,"value":6571},". Everything else stays identical.",{"type":70,"tag":79,"props":6573,"children":6574},{},[6575,6577,6583,6585,6591,6593,6599,6601,6606,6608,6613,6615,6620,6622,6628,6629,6635],{"type":76,"value":6576},"This includes resumability: pass the same ",{"type":70,"tag":106,"props":6578,"children":6580},{"className":6579},[],[6581],{"type":76,"value":6582},"durability",{"type":76,"value":6584}," adapter to\n",{"type":70,"tag":106,"props":6586,"children":6588},{"className":6587},[],[6589],{"type":76,"value":6590},"toHttpResponse(stream, { durability: { adapter: memoryStream(request) } })",{"type":76,"value":6592}," and\neach NDJSON line becomes an ",{"type":70,"tag":106,"props":6594,"children":6596},{"className":6595},[],[6597],{"type":76,"value":6598},"{ id, chunk }",{"type":76,"value":6600}," envelope. ",{"type":70,"tag":106,"props":6602,"children":6604},{"className":6603},[],[6605],{"type":76,"value":6137},{"type":76,"value":6607},"\nauto-reconnects with ",{"type":70,"tag":106,"props":6609,"children":6611},{"className":6610},[],[6612],{"type":76,"value":2736},{"type":76,"value":6614},", de-dupes the replayed prefix, and exposes\n",{"type":70,"tag":106,"props":6616,"children":6618},{"className":6617},[],[6619],{"type":76,"value":2744},{"type":76,"value":6621}," — the same guarantees as resumable SSE. The XHR adapters\n(",{"type":70,"tag":106,"props":6623,"children":6625},{"className":6624},[],[6626],{"type":76,"value":6627},"xhrServerSentEvents",{"type":76,"value":6551},{"type":70,"tag":106,"props":6630,"children":6632},{"className":6631},[],[6633],{"type":76,"value":6634},"xhrHttpStream",{"type":76,"value":6636},") are resumable too.",{"type":70,"tag":92,"props":6638,"children":6640},{"id":6639},"_6-mcp-tool-discovery-via-chat-mcp",[6641,6643],{"type":76,"value":6642},"6. MCP Tool Discovery via ",{"type":70,"tag":106,"props":6644,"children":6646},{"className":6645},[],[6647],{"type":76,"value":6648},"chat({ mcp })",{"type":70,"tag":79,"props":6650,"children":6651},{},[6652,6654,6660,6662,6668,6670,6675],{"type":76,"value":6653},"Pass ",{"type":70,"tag":106,"props":6655,"children":6657},{"className":6656},[],[6658],{"type":76,"value":6659},"mcp",{"type":76,"value":6661}," to let ",{"type":70,"tag":106,"props":6663,"children":6665},{"className":6664},[],[6666],{"type":76,"value":6667},"chat()",{"type":76,"value":6669}," own discovery ",{"type":70,"tag":1400,"props":6671,"children":6672},{},[6673],{"type":76,"value":6674},"and",{"type":76,"value":6676}," lifecycle for one or more MCP\nclients. Useful when you want minimal boilerplate and don't need to reuse the\nclients across calls.",{"type":70,"tag":99,"props":6678,"children":6680},{"className":101,"code":6679,"language":45,"meta":103,"style":103},"\u002F\u002F Prop shape:\n\u002F\u002F chat({\n\u002F\u002F   ...,\n\u002F\u002F   mcp: {\n\u002F\u002F     clients: Array\u003CMCPClient | MCPClients>,\n\u002F\u002F     connection?: 'close' | 'keep-alive',  \u002F\u002F default: 'close'\n\u002F\u002F     lazyTools?: boolean,\n\u002F\u002F     onDiscoveryError?: (error: unknown, source) => void,\n\u002F\u002F   }\n\u002F\u002F })\n",[6681],{"type":70,"tag":106,"props":6682,"children":6683},{"__ignoreMap":103},[6684,6692,6700,6708,6716,6724,6737,6745,6753,6761],{"type":70,"tag":110,"props":6685,"children":6686},{"class":112,"line":113},[6687],{"type":70,"tag":110,"props":6688,"children":6689},{"style":117},[6690],{"type":76,"value":6691},"\u002F\u002F Prop shape:\n",{"type":70,"tag":110,"props":6693,"children":6694},{"class":112,"line":123},[6695],{"type":70,"tag":110,"props":6696,"children":6697},{"style":117},[6698],{"type":76,"value":6699},"\u002F\u002F chat({\n",{"type":70,"tag":110,"props":6701,"children":6702},{"class":112,"line":171},[6703],{"type":70,"tag":110,"props":6704,"children":6705},{"style":117},[6706],{"type":76,"value":6707},"\u002F\u002F   ...,\n",{"type":70,"tag":110,"props":6709,"children":6710},{"class":112,"line":219},[6711],{"type":70,"tag":110,"props":6712,"children":6713},{"style":117},[6714],{"type":76,"value":6715},"\u002F\u002F   mcp: {\n",{"type":70,"tag":110,"props":6717,"children":6718},{"class":112,"line":257},[6719],{"type":70,"tag":110,"props":6720,"children":6721},{"style":117},[6722],{"type":76,"value":6723},"\u002F\u002F     clients: Array\u003CMCPClient | MCPClients>,\n",{"type":70,"tag":110,"props":6725,"children":6726},{"class":112,"line":267},[6727,6732],{"type":70,"tag":110,"props":6728,"children":6729},{"style":117},[6730],{"type":76,"value":6731},"\u002F\u002F     connection?: 'close' | 'keep-alive',",{"type":70,"tag":110,"props":6733,"children":6734},{"style":117},[6735],{"type":76,"value":6736},"  \u002F\u002F default: 'close'\n",{"type":70,"tag":110,"props":6738,"children":6739},{"class":112,"line":326},[6740],{"type":70,"tag":110,"props":6741,"children":6742},{"style":117},[6743],{"type":76,"value":6744},"\u002F\u002F     lazyTools?: boolean,\n",{"type":70,"tag":110,"props":6746,"children":6747},{"class":112,"line":346},[6748],{"type":70,"tag":110,"props":6749,"children":6750},{"style":117},[6751],{"type":76,"value":6752},"\u002F\u002F     onDiscoveryError?: (error: unknown, source) => void,\n",{"type":70,"tag":110,"props":6754,"children":6755},{"class":112,"line":363},[6756],{"type":70,"tag":110,"props":6757,"children":6758},{"style":117},[6759],{"type":76,"value":6760},"\u002F\u002F   }\n",{"type":70,"tag":110,"props":6762,"children":6763},{"class":112,"line":406},[6764],{"type":70,"tag":110,"props":6765,"children":6766},{"style":117},[6767],{"type":76,"value":6768},"\u002F\u002F })\n",{"type":70,"tag":6770,"props":6771,"children":6772},"ul",{},[6773,6803,6839,6861],{"type":70,"tag":6774,"props":6775,"children":6776},"li",{},[6777,6786,6788,6794,6795,6801],{"type":70,"tag":1400,"props":6778,"children":6779},{},[6780],{"type":70,"tag":106,"props":6781,"children":6783},{"className":6782},[],[6784],{"type":76,"value":6785},"clients",{"type":76,"value":6787}," — one or more ",{"type":70,"tag":106,"props":6789,"children":6791},{"className":6790},[],[6792],{"type":76,"value":6793},"MCPClient",{"type":76,"value":6551},{"type":70,"tag":106,"props":6796,"children":6798},{"className":6797},[],[6799],{"type":76,"value":6800},"MCPClients",{"type":76,"value":6802}," instances.",{"type":70,"tag":6774,"props":6804,"children":6805},{},[6806,6815,6817,6823,6825,6831,6832,6837],{"type":70,"tag":1400,"props":6807,"children":6808},{},[6809],{"type":70,"tag":106,"props":6810,"children":6812},{"className":6811},[],[6813],{"type":76,"value":6814},"connection",{"type":76,"value":6816}," — ",{"type":70,"tag":106,"props":6818,"children":6820},{"className":6819},[],[6821],{"type":76,"value":6822},"'close'",{"type":76,"value":6824}," (default) closes each client when the run ends\n(after the agent loop completes and the stream is drained); with\n",{"type":70,"tag":106,"props":6826,"children":6828},{"className":6827},[],[6829],{"type":76,"value":6830},"'keep-alive'",{"type":76,"value":3219},{"type":70,"tag":106,"props":6833,"children":6835},{"className":6834},[],[6836],{"type":76,"value":6667},{"type":76,"value":6838}," never closes the clients — the caller owns their\nlifecycle (keep connections warm across requests).",{"type":70,"tag":6774,"props":6840,"children":6841},{},[6842,6851,6853,6859],{"type":70,"tag":1400,"props":6843,"children":6844},{},[6845],{"type":70,"tag":106,"props":6846,"children":6848},{"className":6847},[],[6849],{"type":76,"value":6850},"lazyTools",{"type":76,"value":6852}," — forwarded to ",{"type":70,"tag":106,"props":6854,"children":6856},{"className":6855},[],[6857],{"type":76,"value":6858},"tools({ lazy: true })",{"type":76,"value":6860}," so tool schemas are\nsent to the LLM on demand.",{"type":70,"tag":6774,"props":6862,"children":6863},{},[6864,6873],{"type":70,"tag":1400,"props":6865,"children":6866},{},[6867],{"type":70,"tag":106,"props":6868,"children":6870},{"className":6869},[],[6871],{"type":76,"value":6872},"onDiscoveryError",{"type":76,"value":6874}," — throw (or re-throw) to fail the entire call fast;\nreturn normally to skip that source and continue. Omit to rethrow (fail-fast).",{"type":70,"tag":79,"props":6876,"children":6877},{},[6878],{"type":70,"tag":1400,"props":6879,"children":6880},{},[6881,6883,6888],{"type":76,"value":6882},"When to use ",{"type":70,"tag":106,"props":6884,"children":6886},{"className":6885},[],[6887],{"type":76,"value":6659},{"type":76,"value":6889}," vs. the tools spread:",{"type":70,"tag":6891,"props":6892,"children":6893},"table",{},[6894,6913],{"type":70,"tag":6895,"props":6896,"children":6897},"thead",{},[6898],{"type":70,"tag":6899,"props":6900,"children":6901},"tr",{},[6902,6908],{"type":70,"tag":6903,"props":6904,"children":6905},"th",{},[6906],{"type":76,"value":6907},"Approach",{"type":70,"tag":6903,"props":6909,"children":6910},{},[6911],{"type":76,"value":6912},"Use when",{"type":70,"tag":6914,"props":6915,"children":6916},"tbody",{},[6917,6935],{"type":70,"tag":6899,"props":6918,"children":6919},{},[6920,6930],{"type":70,"tag":6921,"props":6922,"children":6923},"td",{},[6924],{"type":70,"tag":106,"props":6925,"children":6927},{"className":6926},[],[6928],{"type":76,"value":6929},"chat({ mcp: { clients: [...] } })",{"type":70,"tag":6921,"props":6931,"children":6932},{},[6933],{"type":76,"value":6934},"You want discovery + lifecycle managed for you, and don't need fully-typed input\u002Foutput schemas",{"type":70,"tag":6899,"props":6936,"children":6937},{},[6938,6947],{"type":70,"tag":6921,"props":6939,"children":6940},{},[6941],{"type":70,"tag":106,"props":6942,"children":6944},{"className":6943},[],[6945],{"type":76,"value":6946},"tools: [...await client.tools([toolDefinition(...)])]",{"type":70,"tag":6921,"props":6948,"children":6949},{},[6950],{"type":76,"value":6951},"You want fully-typed MCP tools with Zod input\u002Foutput validation",{"type":70,"tag":79,"props":6953,"children":6954},{},[6955],{"type":70,"tag":1400,"props":6956,"children":6957},{},[6958],{"type":76,"value":6959},"Server-side example:",{"type":70,"tag":99,"props":6961,"children":6963},{"className":101,"code":6962,"language":45,"meta":103,"style":103},"import { createFileRoute } from '@tanstack\u002Freact-router'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fchat')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const { messages } = await request.json()\n\n        const mcpClient = await createMCPClient({\n          transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n        })\n\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          mcp: {\n            clients: [mcpClient],\n            connection: 'keep-alive', \u002F\u002F chat() won't close it — reuse across requests\n          },\n        })\n\n        return toServerSentEventsResponse(stream)\n        \u002F\u002F connection: 'keep-alive' — chat() never closes mcpClient; it stays open for reuse across runs.\n      },\n    },\n  },\n})\n",[6964],{"type":70,"tag":106,"props":6965,"children":6966},{"__ignoreMap":103},[6967,7002,7045,7080,7117,7124,7171,7186,7201,7236,7279,7286,7318,7385,7396,7403,7430,7469,7480,7496,7525,7559,7567,7578,7585,7608,7616,7623,7630,7637],{"type":70,"tag":110,"props":6968,"children":6969},{"class":112,"line":113},[6970,6974,6978,6982,6986,6990,6994,6998],{"type":70,"tag":110,"props":6971,"children":6972},{"style":127},[6973],{"type":76,"value":130},{"type":70,"tag":110,"props":6975,"children":6976},{"style":133},[6977],{"type":76,"value":136},{"type":70,"tag":110,"props":6979,"children":6980},{"style":139},[6981],{"type":76,"value":142},{"type":70,"tag":110,"props":6983,"children":6984},{"style":133},[6985],{"type":76,"value":147},{"type":70,"tag":110,"props":6987,"children":6988},{"style":127},[6989],{"type":76,"value":152},{"type":70,"tag":110,"props":6991,"children":6992},{"style":133},[6993],{"type":76,"value":157},{"type":70,"tag":110,"props":6995,"children":6996},{"style":160},[6997],{"type":76,"value":163},{"type":70,"tag":110,"props":6999,"children":7000},{"style":133},[7001],{"type":76,"value":168},{"type":70,"tag":110,"props":7003,"children":7004},{"class":112,"line":123},[7005,7009,7013,7017,7021,7025,7029,7033,7037,7041],{"type":70,"tag":110,"props":7006,"children":7007},{"style":127},[7008],{"type":76,"value":130},{"type":70,"tag":110,"props":7010,"children":7011},{"style":133},[7012],{"type":76,"value":136},{"type":70,"tag":110,"props":7014,"children":7015},{"style":139},[7016],{"type":76,"value":185},{"type":70,"tag":110,"props":7018,"children":7019},{"style":133},[7020],{"type":76,"value":190},{"type":70,"tag":110,"props":7022,"children":7023},{"style":139},[7024],{"type":76,"value":195},{"type":70,"tag":110,"props":7026,"children":7027},{"style":133},[7028],{"type":76,"value":147},{"type":70,"tag":110,"props":7030,"children":7031},{"style":127},[7032],{"type":76,"value":152},{"type":70,"tag":110,"props":7034,"children":7035},{"style":133},[7036],{"type":76,"value":157},{"type":70,"tag":110,"props":7038,"children":7039},{"style":160},[7040],{"type":76,"value":212},{"type":70,"tag":110,"props":7042,"children":7043},{"style":133},[7044],{"type":76,"value":168},{"type":70,"tag":110,"props":7046,"children":7047},{"class":112,"line":171},[7048,7052,7056,7060,7064,7068,7072,7076],{"type":70,"tag":110,"props":7049,"children":7050},{"style":127},[7051],{"type":76,"value":130},{"type":70,"tag":110,"props":7053,"children":7054},{"style":133},[7055],{"type":76,"value":136},{"type":70,"tag":110,"props":7057,"children":7058},{"style":139},[7059],{"type":76,"value":233},{"type":70,"tag":110,"props":7061,"children":7062},{"style":133},[7063],{"type":76,"value":147},{"type":70,"tag":110,"props":7065,"children":7066},{"style":127},[7067],{"type":76,"value":152},{"type":70,"tag":110,"props":7069,"children":7070},{"style":133},[7071],{"type":76,"value":157},{"type":70,"tag":110,"props":7073,"children":7074},{"style":160},[7075],{"type":76,"value":250},{"type":70,"tag":110,"props":7077,"children":7078},{"style":133},[7079],{"type":76,"value":168},{"type":70,"tag":110,"props":7081,"children":7082},{"class":112,"line":219},[7083,7087,7091,7096,7100,7104,7108,7113],{"type":70,"tag":110,"props":7084,"children":7085},{"style":127},[7086],{"type":76,"value":130},{"type":70,"tag":110,"props":7088,"children":7089},{"style":133},[7090],{"type":76,"value":136},{"type":70,"tag":110,"props":7092,"children":7093},{"style":139},[7094],{"type":76,"value":7095}," createMCPClient",{"type":70,"tag":110,"props":7097,"children":7098},{"style":133},[7099],{"type":76,"value":147},{"type":70,"tag":110,"props":7101,"children":7102},{"style":127},[7103],{"type":76,"value":152},{"type":70,"tag":110,"props":7105,"children":7106},{"style":133},[7107],{"type":76,"value":157},{"type":70,"tag":110,"props":7109,"children":7110},{"style":160},[7111],{"type":76,"value":7112},"@tanstack\u002Fai-mcp",{"type":70,"tag":110,"props":7114,"children":7115},{"style":133},[7116],{"type":76,"value":168},{"type":70,"tag":110,"props":7118,"children":7119},{"class":112,"line":257},[7120],{"type":70,"tag":110,"props":7121,"children":7122},{"emptyLinePlaceholder":261},[7123],{"type":76,"value":264},{"type":70,"tag":110,"props":7125,"children":7126},{"class":112,"line":267},[7127,7131,7135,7139,7143,7147,7151,7155,7159,7163,7167],{"type":70,"tag":110,"props":7128,"children":7129},{"style":127},[7130],{"type":76,"value":273},{"type":70,"tag":110,"props":7132,"children":7133},{"style":276},[7134],{"type":76,"value":279},{"type":70,"tag":110,"props":7136,"children":7137},{"style":139},[7138],{"type":76,"value":284},{"type":70,"tag":110,"props":7140,"children":7141},{"style":133},[7142],{"type":76,"value":289},{"type":70,"tag":110,"props":7144,"children":7145},{"style":292},[7146],{"type":76,"value":142},{"type":70,"tag":110,"props":7148,"children":7149},{"style":139},[7150],{"type":76,"value":299},{"type":70,"tag":110,"props":7152,"children":7153},{"style":133},[7154],{"type":76,"value":304},{"type":70,"tag":110,"props":7156,"children":7157},{"style":160},[7158],{"type":76,"value":309},{"type":70,"tag":110,"props":7160,"children":7161},{"style":133},[7162],{"type":76,"value":304},{"type":70,"tag":110,"props":7164,"children":7165},{"style":139},[7166],{"type":76,"value":318},{"type":70,"tag":110,"props":7168,"children":7169},{"style":133},[7170],{"type":76,"value":323},{"type":70,"tag":110,"props":7172,"children":7173},{"class":112,"line":326},[7174,7178,7182],{"type":70,"tag":110,"props":7175,"children":7176},{"style":330},[7177],{"type":76,"value":333},{"type":70,"tag":110,"props":7179,"children":7180},{"style":133},[7181],{"type":76,"value":338},{"type":70,"tag":110,"props":7183,"children":7184},{"style":133},[7185],{"type":76,"value":343},{"type":70,"tag":110,"props":7187,"children":7188},{"class":112,"line":346},[7189,7193,7197],{"type":70,"tag":110,"props":7190,"children":7191},{"style":330},[7192],{"type":76,"value":352},{"type":70,"tag":110,"props":7194,"children":7195},{"style":133},[7196],{"type":76,"value":338},{"type":70,"tag":110,"props":7198,"children":7199},{"style":133},[7200],{"type":76,"value":343},{"type":70,"tag":110,"props":7202,"children":7203},{"class":112,"line":363},[7204,7208,7212,7216,7220,7224,7228,7232],{"type":70,"tag":110,"props":7205,"children":7206},{"style":292},[7207],{"type":76,"value":369},{"type":70,"tag":110,"props":7209,"children":7210},{"style":133},[7211],{"type":76,"value":338},{"type":70,"tag":110,"props":7213,"children":7214},{"style":276},[7215],{"type":76,"value":378},{"type":70,"tag":110,"props":7217,"children":7218},{"style":133},[7219],{"type":76,"value":383},{"type":70,"tag":110,"props":7221,"children":7222},{"style":386},[7223],{"type":76,"value":389},{"type":70,"tag":110,"props":7225,"children":7226},{"style":133},[7227],{"type":76,"value":394},{"type":70,"tag":110,"props":7229,"children":7230},{"style":276},[7231],{"type":76,"value":399},{"type":70,"tag":110,"props":7233,"children":7234},{"style":133},[7235],{"type":76,"value":343},{"type":70,"tag":110,"props":7237,"children":7238},{"class":112,"line":406},[7239,7243,7247,7251,7255,7259,7263,7267,7271,7275],{"type":70,"tag":110,"props":7240,"children":7241},{"style":276},[7242],{"type":76,"value":412},{"type":70,"tag":110,"props":7244,"children":7245},{"style":133},[7246],{"type":76,"value":136},{"type":70,"tag":110,"props":7248,"children":7249},{"style":139},[7250],{"type":76,"value":494},{"type":70,"tag":110,"props":7252,"children":7253},{"style":133},[7254],{"type":76,"value":147},{"type":70,"tag":110,"props":7256,"children":7257},{"style":133},[7258],{"type":76,"value":422},{"type":70,"tag":110,"props":7260,"children":7261},{"style":127},[7262],{"type":76,"value":459},{"type":70,"tag":110,"props":7264,"children":7265},{"style":139},[7266],{"type":76,"value":389},{"type":70,"tag":110,"props":7268,"children":7269},{"style":133},[7270],{"type":76,"value":468},{"type":70,"tag":110,"props":7272,"children":7273},{"style":292},[7274],{"type":76,"value":473},{"type":70,"tag":110,"props":7276,"children":7277},{"style":330},[7278],{"type":76,"value":437},{"type":70,"tag":110,"props":7280,"children":7281},{"class":112,"line":440},[7282],{"type":70,"tag":110,"props":7283,"children":7284},{"emptyLinePlaceholder":261},[7285],{"type":76,"value":264},{"type":70,"tag":110,"props":7287,"children":7288},{"class":112,"line":480},[7289,7293,7298,7302,7306,7310,7314],{"type":70,"tag":110,"props":7290,"children":7291},{"style":276},[7292],{"type":76,"value":412},{"type":70,"tag":110,"props":7294,"children":7295},{"style":139},[7296],{"type":76,"value":7297}," mcpClient",{"type":70,"tag":110,"props":7299,"children":7300},{"style":133},[7301],{"type":76,"value":422},{"type":70,"tag":110,"props":7303,"children":7304},{"style":127},[7305],{"type":76,"value":459},{"type":70,"tag":110,"props":7307,"children":7308},{"style":292},[7309],{"type":76,"value":7095},{"type":70,"tag":110,"props":7311,"children":7312},{"style":330},[7313],{"type":76,"value":299},{"type":70,"tag":110,"props":7315,"children":7316},{"style":133},[7317],{"type":76,"value":323},{"type":70,"tag":110,"props":7319,"children":7320},{"class":112,"line":510},[7321,7326,7330,7334,7338,7342,7346,7351,7355,7359,7364,7368,7372,7377,7381],{"type":70,"tag":110,"props":7322,"children":7323},{"style":330},[7324],{"type":76,"value":7325},"          transport",{"type":70,"tag":110,"props":7327,"children":7328},{"style":133},[7329],{"type":76,"value":338},{"type":70,"tag":110,"props":7331,"children":7332},{"style":133},[7333],{"type":76,"value":136},{"type":70,"tag":110,"props":7335,"children":7336},{"style":330},[7337],{"type":76,"value":873},{"type":70,"tag":110,"props":7339,"children":7340},{"style":133},[7341],{"type":76,"value":338},{"type":70,"tag":110,"props":7343,"children":7344},{"style":133},[7345],{"type":76,"value":157},{"type":70,"tag":110,"props":7347,"children":7348},{"style":160},[7349],{"type":76,"value":7350},"http",{"type":70,"tag":110,"props":7352,"children":7353},{"style":133},[7354],{"type":76,"value":304},{"type":70,"tag":110,"props":7356,"children":7357},{"style":133},[7358],{"type":76,"value":190},{"type":70,"tag":110,"props":7360,"children":7361},{"style":330},[7362],{"type":76,"value":7363}," url",{"type":70,"tag":110,"props":7365,"children":7366},{"style":133},[7367],{"type":76,"value":338},{"type":70,"tag":110,"props":7369,"children":7370},{"style":133},[7371],{"type":76,"value":157},{"type":70,"tag":110,"props":7373,"children":7374},{"style":160},[7375],{"type":76,"value":7376},"https:\u002F\u002Fmcp.example.com\u002Fmcp",{"type":70,"tag":110,"props":7378,"children":7379},{"style":133},[7380],{"type":76,"value":304},{"type":70,"tag":110,"props":7382,"children":7383},{"style":133},[7384],{"type":76,"value":3001},{"type":70,"tag":110,"props":7386,"children":7387},{"class":112,"line":518},[7388,7392],{"type":70,"tag":110,"props":7389,"children":7390},{"style":133},[7391],{"type":76,"value":663},{"type":70,"tag":110,"props":7393,"children":7394},{"style":330},[7395],{"type":76,"value":668},{"type":70,"tag":110,"props":7397,"children":7398},{"class":112,"line":547},[7399],{"type":70,"tag":110,"props":7400,"children":7401},{"emptyLinePlaceholder":261},[7402],{"type":76,"value":264},{"type":70,"tag":110,"props":7404,"children":7405},{"class":112,"line":591},[7406,7410,7414,7418,7422,7426],{"type":70,"tag":110,"props":7407,"children":7408},{"style":276},[7409],{"type":76,"value":412},{"type":70,"tag":110,"props":7411,"children":7412},{"style":139},[7413],{"type":76,"value":528},{"type":70,"tag":110,"props":7415,"children":7416},{"style":133},[7417],{"type":76,"value":422},{"type":70,"tag":110,"props":7419,"children":7420},{"style":292},[7421],{"type":76,"value":185},{"type":70,"tag":110,"props":7423,"children":7424},{"style":330},[7425],{"type":76,"value":299},{"type":70,"tag":110,"props":7427,"children":7428},{"style":133},[7429],{"type":76,"value":323},{"type":70,"tag":110,"props":7431,"children":7432},{"class":112,"line":604},[7433,7437,7441,7445,7449,7453,7457,7461,7465],{"type":70,"tag":110,"props":7434,"children":7435},{"style":330},[7436],{"type":76,"value":553},{"type":70,"tag":110,"props":7438,"children":7439},{"style":133},[7440],{"type":76,"value":338},{"type":70,"tag":110,"props":7442,"children":7443},{"style":292},[7444],{"type":76,"value":233},{"type":70,"tag":110,"props":7446,"children":7447},{"style":330},[7448],{"type":76,"value":299},{"type":70,"tag":110,"props":7450,"children":7451},{"style":133},[7452],{"type":76,"value":304},{"type":70,"tag":110,"props":7454,"children":7455},{"style":160},[7456],{"type":76,"value":574},{"type":70,"tag":110,"props":7458,"children":7459},{"style":133},[7460],{"type":76,"value":304},{"type":70,"tag":110,"props":7462,"children":7463},{"style":330},[7464],{"type":76,"value":583},{"type":70,"tag":110,"props":7466,"children":7467},{"style":133},[7468],{"type":76,"value":588},{"type":70,"tag":110,"props":7470,"children":7471},{"class":112,"line":644},[7472,7476],{"type":70,"tag":110,"props":7473,"children":7474},{"style":139},[7475],{"type":76,"value":597},{"type":70,"tag":110,"props":7477,"children":7478},{"style":133},[7479],{"type":76,"value":588},{"type":70,"tag":110,"props":7481,"children":7482},{"class":112,"line":657},[7483,7488,7492],{"type":70,"tag":110,"props":7484,"children":7485},{"style":330},[7486],{"type":76,"value":7487},"          mcp",{"type":70,"tag":110,"props":7489,"children":7490},{"style":133},[7491],{"type":76,"value":338},{"type":70,"tag":110,"props":7493,"children":7494},{"style":133},[7495],{"type":76,"value":343},{"type":70,"tag":110,"props":7497,"children":7498},{"class":112,"line":671},[7499,7504,7508,7512,7517,7521],{"type":70,"tag":110,"props":7500,"children":7501},{"style":330},[7502],{"type":76,"value":7503},"            clients",{"type":70,"tag":110,"props":7505,"children":7506},{"style":133},[7507],{"type":76,"value":338},{"type":70,"tag":110,"props":7509,"children":7510},{"style":330},[7511],{"type":76,"value":619},{"type":70,"tag":110,"props":7513,"children":7514},{"style":139},[7515],{"type":76,"value":7516},"mcpClient",{"type":70,"tag":110,"props":7518,"children":7519},{"style":330},[7520],{"type":76,"value":637},{"type":70,"tag":110,"props":7522,"children":7523},{"style":133},[7524],{"type":76,"value":588},{"type":70,"tag":110,"props":7526,"children":7527},{"class":112,"line":679},[7528,7533,7537,7541,7546,7550,7554],{"type":70,"tag":110,"props":7529,"children":7530},{"style":330},[7531],{"type":76,"value":7532},"            connection",{"type":70,"tag":110,"props":7534,"children":7535},{"style":133},[7536],{"type":76,"value":338},{"type":70,"tag":110,"props":7538,"children":7539},{"style":133},[7540],{"type":76,"value":157},{"type":70,"tag":110,"props":7542,"children":7543},{"style":160},[7544],{"type":76,"value":7545},"keep-alive",{"type":70,"tag":110,"props":7547,"children":7548},{"style":133},[7549],{"type":76,"value":304},{"type":70,"tag":110,"props":7551,"children":7552},{"style":133},[7553],{"type":76,"value":190},{"type":70,"tag":110,"props":7555,"children":7556},{"style":117},[7557],{"type":76,"value":7558}," \u002F\u002F chat() won't close it — reuse across requests\n",{"type":70,"tag":110,"props":7560,"children":7561},{"class":112,"line":721},[7562],{"type":70,"tag":110,"props":7563,"children":7564},{"style":133},[7565],{"type":76,"value":7566},"          },\n",{"type":70,"tag":110,"props":7568,"children":7569},{"class":112,"line":730},[7570,7574],{"type":70,"tag":110,"props":7571,"children":7572},{"style":133},[7573],{"type":76,"value":663},{"type":70,"tag":110,"props":7575,"children":7576},{"style":330},[7577],{"type":76,"value":668},{"type":70,"tag":110,"props":7579,"children":7580},{"class":112,"line":739},[7581],{"type":70,"tag":110,"props":7582,"children":7583},{"emptyLinePlaceholder":261},[7584],{"type":76,"value":264},{"type":70,"tag":110,"props":7586,"children":7587},{"class":112,"line":748},[7588,7592,7596,7600,7604],{"type":70,"tag":110,"props":7589,"children":7590},{"style":127},[7591],{"type":76,"value":685},{"type":70,"tag":110,"props":7593,"children":7594},{"style":292},[7595],{"type":76,"value":195},{"type":70,"tag":110,"props":7597,"children":7598},{"style":330},[7599],{"type":76,"value":299},{"type":70,"tag":110,"props":7601,"children":7602},{"style":139},[7603],{"type":76,"value":698},{"type":70,"tag":110,"props":7605,"children":7606},{"style":330},[7607],{"type":76,"value":668},{"type":70,"tag":110,"props":7609,"children":7610},{"class":112,"line":1501},[7611],{"type":70,"tag":110,"props":7612,"children":7613},{"style":117},[7614],{"type":76,"value":7615},"        \u002F\u002F connection: 'keep-alive' — chat() never closes mcpClient; it stays open for reuse across runs.\n",{"type":70,"tag":110,"props":7617,"children":7618},{"class":112,"line":1539},[7619],{"type":70,"tag":110,"props":7620,"children":7621},{"style":133},[7622],{"type":76,"value":727},{"type":70,"tag":110,"props":7624,"children":7625},{"class":112,"line":1609},[7626],{"type":70,"tag":110,"props":7627,"children":7628},{"style":133},[7629],{"type":76,"value":736},{"type":70,"tag":110,"props":7631,"children":7632},{"class":112,"line":1618},[7633],{"type":70,"tag":110,"props":7634,"children":7635},{"style":133},[7636],{"type":76,"value":745},{"type":70,"tag":110,"props":7638,"children":7639},{"class":112,"line":1632},[7640,7644],{"type":70,"tag":110,"props":7641,"children":7642},{"style":133},[7643],{"type":76,"value":754},{"type":70,"tag":110,"props":7645,"children":7646},{"style":139},[7647],{"type":76,"value":668},{"type":70,"tag":92,"props":7649,"children":7651},{"id":7650},"_7-queueing-messages-sent-while-streaming",[7652],{"type":76,"value":7653},"7. Queueing Messages Sent While Streaming",{"type":70,"tag":79,"props":7655,"children":7656},{},[7657,7659,7664,7666,7671,7673,7678,7680,7686,7688,7694],{"type":76,"value":7658},"By default, a ",{"type":70,"tag":106,"props":7660,"children":7662},{"className":7661},[],[7663],{"type":76,"value":4461},{"type":76,"value":7665}," call that arrives while a stream is in flight is\n",{"type":70,"tag":1400,"props":7667,"children":7668},{},[7669],{"type":76,"value":7670},"queued",{"type":76,"value":7672}," and sent automatically once the run settles ",{"type":70,"tag":1400,"props":7674,"children":7675},{},[7676],{"type":76,"value":7677},"successfully",{"type":76,"value":7679}," —\nthis is a behavior change: such sends used to be silently dropped. Configure\nit with the ",{"type":70,"tag":106,"props":7681,"children":7683},{"className":7682},[],[7684],{"type":76,"value":7685},"queue",{"type":76,"value":7687}," option on ",{"type":70,"tag":106,"props":7689,"children":7691},{"className":7690},[],[7692],{"type":76,"value":7693},"useChat",{"type":76,"value":338},{"type":70,"tag":99,"props":7696,"children":7698},{"className":101,"code":7697,"language":45,"meta":103,"style":103},"import { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, queue, sendMessage, cancelQueued, isLoading } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n  queue: { whenBusy: 'queue', drain: 'fifo', maxSize: 5, onOverflow: 'reject' },\n})\n",[7699],{"type":70,"tag":106,"props":7700,"children":7701},{"__ignoreMap":103},[7702,7745,7752,7822,7861,7972],{"type":70,"tag":110,"props":7703,"children":7704},{"class":112,"line":113},[7705,7709,7713,7717,7721,7725,7729,7733,7737,7741],{"type":70,"tag":110,"props":7706,"children":7707},{"style":127},[7708],{"type":76,"value":130},{"type":70,"tag":110,"props":7710,"children":7711},{"style":133},[7712],{"type":76,"value":136},{"type":70,"tag":110,"props":7714,"children":7715},{"style":139},[7716],{"type":76,"value":831},{"type":70,"tag":110,"props":7718,"children":7719},{"style":133},[7720],{"type":76,"value":190},{"type":70,"tag":110,"props":7722,"children":7723},{"style":139},[7724],{"type":76,"value":840},{"type":70,"tag":110,"props":7726,"children":7727},{"style":133},[7728],{"type":76,"value":147},{"type":70,"tag":110,"props":7730,"children":7731},{"style":127},[7732],{"type":76,"value":152},{"type":70,"tag":110,"props":7734,"children":7735},{"style":133},[7736],{"type":76,"value":157},{"type":70,"tag":110,"props":7738,"children":7739},{"style":160},[7740],{"type":76,"value":857},{"type":70,"tag":110,"props":7742,"children":7743},{"style":133},[7744],{"type":76,"value":168},{"type":70,"tag":110,"props":7746,"children":7747},{"class":112,"line":123},[7748],{"type":70,"tag":110,"props":7749,"children":7750},{"emptyLinePlaceholder":261},[7751],{"type":76,"value":264},{"type":70,"tag":110,"props":7753,"children":7754},{"class":112,"line":171},[7755,7759,7763,7767,7771,7776,7780,7784,7788,7793,7797,7802,7806,7810,7814,7818],{"type":70,"tag":110,"props":7756,"children":7757},{"style":276},[7758],{"type":76,"value":2422},{"type":70,"tag":110,"props":7760,"children":7761},{"style":133},[7762],{"type":76,"value":136},{"type":70,"tag":110,"props":7764,"children":7765},{"style":139},[7766],{"type":76,"value":494},{"type":70,"tag":110,"props":7768,"children":7769},{"style":133},[7770],{"type":76,"value":190},{"type":70,"tag":110,"props":7772,"children":7773},{"style":139},[7774],{"type":76,"value":7775}," queue",{"type":70,"tag":110,"props":7777,"children":7778},{"style":133},[7779],{"type":76,"value":190},{"type":70,"tag":110,"props":7781,"children":7782},{"style":139},[7783],{"type":76,"value":1013},{"type":70,"tag":110,"props":7785,"children":7786},{"style":133},[7787],{"type":76,"value":190},{"type":70,"tag":110,"props":7789,"children":7790},{"style":139},[7791],{"type":76,"value":7792}," cancelQueued",{"type":70,"tag":110,"props":7794,"children":7795},{"style":133},[7796],{"type":76,"value":190},{"type":70,"tag":110,"props":7798,"children":7799},{"style":139},[7800],{"type":76,"value":7801}," isLoading ",{"type":70,"tag":110,"props":7803,"children":7804},{"style":133},[7805],{"type":76,"value":754},{"type":70,"tag":110,"props":7807,"children":7808},{"style":133},[7809],{"type":76,"value":422},{"type":70,"tag":110,"props":7811,"children":7812},{"style":292},[7813],{"type":76,"value":831},{"type":70,"tag":110,"props":7815,"children":7816},{"style":139},[7817],{"type":76,"value":299},{"type":70,"tag":110,"props":7819,"children":7820},{"style":133},[7821],{"type":76,"value":323},{"type":70,"tag":110,"props":7823,"children":7824},{"class":112,"line":219},[7825,7829,7833,7837,7841,7845,7849,7853,7857],{"type":70,"tag":110,"props":7826,"children":7827},{"style":330},[7828],{"type":76,"value":2902},{"type":70,"tag":110,"props":7830,"children":7831},{"style":133},[7832],{"type":76,"value":338},{"type":70,"tag":110,"props":7834,"children":7835},{"style":292},[7836],{"type":76,"value":840},{"type":70,"tag":110,"props":7838,"children":7839},{"style":139},[7840],{"type":76,"value":299},{"type":70,"tag":110,"props":7842,"children":7843},{"style":133},[7844],{"type":76,"value":304},{"type":70,"tag":110,"props":7846,"children":7847},{"style":160},[7848],{"type":76,"value":309},{"type":70,"tag":110,"props":7850,"children":7851},{"style":133},[7852],{"type":76,"value":304},{"type":70,"tag":110,"props":7854,"children":7855},{"style":139},[7856],{"type":76,"value":583},{"type":70,"tag":110,"props":7858,"children":7859},{"style":133},[7860],{"type":76,"value":588},{"type":70,"tag":110,"props":7862,"children":7863},{"class":112,"line":257},[7864,7869,7873,7877,7882,7886,7890,7894,7898,7902,7907,7911,7915,7920,7924,7928,7933,7937,7942,7946,7951,7955,7959,7964,7968],{"type":70,"tag":110,"props":7865,"children":7866},{"style":330},[7867],{"type":76,"value":7868},"  queue",{"type":70,"tag":110,"props":7870,"children":7871},{"style":133},[7872],{"type":76,"value":338},{"type":70,"tag":110,"props":7874,"children":7875},{"style":133},[7876],{"type":76,"value":136},{"type":70,"tag":110,"props":7878,"children":7879},{"style":330},[7880],{"type":76,"value":7881}," whenBusy",{"type":70,"tag":110,"props":7883,"children":7884},{"style":133},[7885],{"type":76,"value":338},{"type":70,"tag":110,"props":7887,"children":7888},{"style":133},[7889],{"type":76,"value":157},{"type":70,"tag":110,"props":7891,"children":7892},{"style":160},[7893],{"type":76,"value":7685},{"type":70,"tag":110,"props":7895,"children":7896},{"style":133},[7897],{"type":76,"value":304},{"type":70,"tag":110,"props":7899,"children":7900},{"style":133},[7901],{"type":76,"value":190},{"type":70,"tag":110,"props":7903,"children":7904},{"style":330},[7905],{"type":76,"value":7906}," drain",{"type":70,"tag":110,"props":7908,"children":7909},{"style":133},[7910],{"type":76,"value":338},{"type":70,"tag":110,"props":7912,"children":7913},{"style":133},[7914],{"type":76,"value":157},{"type":70,"tag":110,"props":7916,"children":7917},{"style":160},[7918],{"type":76,"value":7919},"fifo",{"type":70,"tag":110,"props":7921,"children":7922},{"style":133},[7923],{"type":76,"value":304},{"type":70,"tag":110,"props":7925,"children":7926},{"style":133},[7927],{"type":76,"value":190},{"type":70,"tag":110,"props":7929,"children":7930},{"style":330},[7931],{"type":76,"value":7932}," maxSize",{"type":70,"tag":110,"props":7934,"children":7935},{"style":133},[7936],{"type":76,"value":338},{"type":70,"tag":110,"props":7938,"children":7939},{"style":2527},[7940],{"type":76,"value":7941}," 5",{"type":70,"tag":110,"props":7943,"children":7944},{"style":133},[7945],{"type":76,"value":190},{"type":70,"tag":110,"props":7947,"children":7948},{"style":330},[7949],{"type":76,"value":7950}," onOverflow",{"type":70,"tag":110,"props":7952,"children":7953},{"style":133},[7954],{"type":76,"value":338},{"type":70,"tag":110,"props":7956,"children":7957},{"style":133},[7958],{"type":76,"value":157},{"type":70,"tag":110,"props":7960,"children":7961},{"style":160},[7962],{"type":76,"value":7963},"reject",{"type":70,"tag":110,"props":7965,"children":7966},{"style":133},[7967],{"type":76,"value":304},{"type":70,"tag":110,"props":7969,"children":7970},{"style":133},[7971],{"type":76,"value":3001},{"type":70,"tag":110,"props":7973,"children":7974},{"class":112,"line":267},[7975,7979],{"type":70,"tag":110,"props":7976,"children":7977},{"style":133},[7978],{"type":76,"value":754},{"type":70,"tag":110,"props":7980,"children":7981},{"style":139},[7982],{"type":76,"value":668},{"type":70,"tag":6770,"props":7984,"children":7985},{},[7986,8057,8086],{"type":70,"tag":6774,"props":7987,"children":7988},{},[7989,7998,7999,8005,8007,8013,8015,8020,8021,8026,8028,8034,8036,8042,8044,8049,8051,8056],{"type":70,"tag":1400,"props":7990,"children":7991},{},[7992],{"type":70,"tag":106,"props":7993,"children":7995},{"className":7994},[],[7996],{"type":76,"value":7997},"whenBusy",{"type":76,"value":6816},{"type":70,"tag":106,"props":8000,"children":8002},{"className":8001},[],[8003],{"type":76,"value":8004},"'queue'",{"type":76,"value":8006}," (default) holds the message until a successful\nsettle; ",{"type":70,"tag":106,"props":8008,"children":8010},{"className":8009},[],[8011],{"type":76,"value":8012},"'drop'",{"type":76,"value":8014}," ignores the send (never appears in ",{"type":70,"tag":106,"props":8016,"children":8018},{"className":8017},[],[8019],{"type":76,"value":7685},{"type":76,"value":1429},{"type":70,"tag":106,"props":8022,"children":8024},{"className":8023},[],[8025],{"type":76,"value":1314},{"type":76,"value":8027},");\n",{"type":70,"tag":106,"props":8029,"children":8031},{"className":8030},[],[8032],{"type":76,"value":8033},"'interrupt'",{"type":76,"value":8035}," aborts the current stream and sends immediately (unlike\n",{"type":70,"tag":106,"props":8037,"children":8039},{"className":8038},[],[8040],{"type":76,"value":8041},"stop()",{"type":76,"value":8043},", does ",{"type":70,"tag":1400,"props":8045,"children":8046},{},[8047],{"type":76,"value":8048},"not",{"type":76,"value":8050}," flush already-queued items — they drain after the\ninterrupting send ",{"type":70,"tag":1400,"props":8052,"children":8053},{},[8054],{"type":76,"value":8055},"succeeds",{"type":76,"value":2295},{"type":70,"tag":6774,"props":8058,"children":8059},{},[8060,8069,8070,8076,8078,8084],{"type":70,"tag":1400,"props":8061,"children":8062},{},[8063],{"type":70,"tag":106,"props":8064,"children":8066},{"className":8065},[],[8067],{"type":76,"value":8068},"drain",{"type":76,"value":6816},{"type":70,"tag":106,"props":8071,"children":8073},{"className":8072},[],[8074],{"type":76,"value":8075},"'fifo'",{"type":76,"value":8077}," (default) sends queued items one at a time in\norder; ",{"type":70,"tag":106,"props":8079,"children":8081},{"className":8080},[],[8082],{"type":76,"value":8083},"'batch'",{"type":76,"value":8085}," merges everything queued into a single send once the\nrun settles successfully.",{"type":70,"tag":6774,"props":8087,"children":8088},{},[8089,8098,8099,8108,8110,8116,8118,8124],{"type":70,"tag":1400,"props":8090,"children":8091},{},[8092],{"type":70,"tag":106,"props":8093,"children":8095},{"className":8094},[],[8096],{"type":76,"value":8097},"maxSize",{"type":76,"value":6551},{"type":70,"tag":1400,"props":8100,"children":8101},{},[8102],{"type":70,"tag":106,"props":8103,"children":8105},{"className":8104},[],[8106],{"type":76,"value":8107},"onOverflow",{"type":76,"value":8109}," — cap the queue length; ",{"type":70,"tag":106,"props":8111,"children":8113},{"className":8112},[],[8114],{"type":76,"value":8115},"'reject'",{"type":76,"value":8117},"\n(default) silently ignores overflow sends (does not throw),\n",{"type":70,"tag":106,"props":8119,"children":8121},{"className":8120},[],[8122],{"type":76,"value":8123},"'drop-oldest'",{"type":76,"value":8125}," evicts the oldest queued item to make room.",{"type":70,"tag":79,"props":8127,"children":8128},{},[8129,8131,8136,8138,8144,8146,8152,8154,8160,8162,8168],{"type":76,"value":8130},"The top-level ",{"type":70,"tag":106,"props":8132,"children":8134},{"className":8133},[],[8135],{"type":76,"value":7685},{"type":76,"value":8137}," option also accepts a plain ",{"type":70,"tag":106,"props":8139,"children":8141},{"className":8140},[],[8142],{"type":76,"value":8143},"WhenBusy",{"type":76,"value":8145}," string\nshorthand (e.g. ",{"type":70,"tag":106,"props":8147,"children":8149},{"className":8148},[],[8150],{"type":76,"value":8151},"queue: 'interrupt'",{"type":76,"value":8153},") or a ",{"type":70,"tag":106,"props":8155,"children":8157},{"className":8156},[],[8158],{"type":76,"value":8159},"QueueStrategy",{"type":76,"value":8161}," function for\nper-send action control. Strategy form always drains FIFO; actions are\n",{"type":70,"tag":106,"props":8163,"children":8165},{"className":8164},[],[8166],{"type":76,"value":8167},"'queue' | 'drop' | 'interrupt'",{"type":76,"value":468},{"type":70,"tag":79,"props":8170,"children":8171},{},[8172,8177,8179,8184,8186,8191,8193,8198,8199,8205,8206,8212,8214,8220,8222,8228],{"type":70,"tag":1400,"props":8173,"children":8174},{},[8175],{"type":76,"value":8176},"Drain vs flush:",{"type":76,"value":8178}," queued messages auto-send only after a ",{"type":70,"tag":1400,"props":8180,"children":8181},{},[8182],{"type":76,"value":8183},"successful",{"type":76,"value":8185},"\nsettle. They are ",{"type":70,"tag":1400,"props":8187,"children":8188},{},[8189],{"type":76,"value":8190},"discarded",{"type":76,"value":8192}," on stream error\u002Fabort of the active\ngeneration, ",{"type":70,"tag":106,"props":8194,"children":8196},{"className":8195},[],[8197],{"type":76,"value":8041},{"type":76,"value":3219},{"type":70,"tag":106,"props":8200,"children":8202},{"className":8201},[],[8203],{"type":76,"value":8204},"clear()",{"type":76,"value":3219},{"type":70,"tag":106,"props":8207,"children":8209},{"className":8208},[],[8210],{"type":76,"value":8211},"unsubscribe()",{"type":76,"value":8213},", and ",{"type":70,"tag":106,"props":8215,"children":8217},{"className":8216},[],[8218],{"type":76,"value":8219},"reload()",{"type":76,"value":8221},".\n",{"type":70,"tag":106,"props":8223,"children":8225},{"className":8224},[],[8226],{"type":76,"value":8227},"interrupt",{"type":76,"value":8229}," does not flush.",{"type":70,"tag":79,"props":8231,"children":8232},{},[8233,8239,8240,8246,8248,8253,8255,8261],{"type":70,"tag":106,"props":8234,"children":8236},{"className":8235},[],[8237],{"type":76,"value":8238},"queue: Array\u003CQueuedMessage>",{"type":76,"value":1161},{"type":70,"tag":106,"props":8241,"children":8243},{"className":8242},[],[8244],{"type":76,"value":8245},"{ id, content, createdAt }",{"type":76,"value":8247},") is separate\nfrom ",{"type":70,"tag":106,"props":8249,"children":8251},{"className":8250},[],[8252],{"type":76,"value":1314},{"type":76,"value":8254}," — render pending sends distinctly and cancel with\n",{"type":70,"tag":106,"props":8256,"children":8258},{"className":8257},[],[8259],{"type":76,"value":8260},"cancelQueued(id)",{"type":76,"value":338},{"type":70,"tag":99,"props":8263,"children":8265},{"className":101,"code":8264,"language":45,"meta":103,"style":103},"{queue.map((q) => (\n  \u003Cdiv key={q.id}>\n    {typeof q.content === 'string' ? q.content : '[attachment]'}\n    \u003Cbutton onClick={() => cancelQueued(q.id)}>Cancel\u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n))}\n",[8266],{"type":70,"tag":106,"props":8267,"children":8268},{"__ignoreMap":103},[8269,8313,8346,8416,8471,8487],{"type":70,"tag":110,"props":8270,"children":8271},{"class":112,"line":113},[8272,8276,8280,8284,8288,8292,8296,8301,8305,8309],{"type":70,"tag":110,"props":8273,"children":8274},{"style":133},[8275],{"type":76,"value":1410},{"type":70,"tag":110,"props":8277,"children":8278},{"style":139},[8279],{"type":76,"value":7685},{"type":70,"tag":110,"props":8281,"children":8282},{"style":133},[8283],{"type":76,"value":468},{"type":70,"tag":110,"props":8285,"children":8286},{"style":292},[8287],{"type":76,"value":1323},{"type":70,"tag":110,"props":8289,"children":8290},{"style":330},[8291],{"type":76,"value":299},{"type":70,"tag":110,"props":8293,"children":8294},{"style":133},[8295],{"type":76,"value":299},{"type":70,"tag":110,"props":8297,"children":8298},{"style":386},[8299],{"type":76,"value":8300},"q",{"type":70,"tag":110,"props":8302,"children":8303},{"style":133},[8304],{"type":76,"value":583},{"type":70,"tag":110,"props":8306,"children":8307},{"style":276},[8308],{"type":76,"value":399},{"type":70,"tag":110,"props":8310,"children":8311},{"style":330},[8312],{"type":76,"value":1266},{"type":70,"tag":110,"props":8314,"children":8315},{"class":112,"line":123},[8316,8321,8325,8329,8333,8338,8342],{"type":70,"tag":110,"props":8317,"children":8318},{"style":133},[8319],{"type":76,"value":8320},"  \u003C",{"type":70,"tag":110,"props":8322,"children":8323},{"style":139},[8324],{"type":76,"value":1280},{"type":70,"tag":110,"props":8326,"children":8327},{"style":139},[8328],{"type":76,"value":1367},{"type":70,"tag":110,"props":8330,"children":8331},{"style":133},[8332],{"type":76,"value":1372},{"type":70,"tag":110,"props":8334,"children":8335},{"style":330},[8336],{"type":76,"value":8337},"q.",{"type":70,"tag":110,"props":8339,"children":8340},{"style":139},[8341],{"type":76,"value":1382},{"type":70,"tag":110,"props":8343,"children":8344},{"style":133},[8345],{"type":76,"value":1387},{"type":70,"tag":110,"props":8347,"children":8348},{"class":112,"line":171},[8349,8353,8358,8363,8367,8371,8376,8381,8386,8390,8395,8399,8403,8408,8412],{"type":70,"tag":110,"props":8350,"children":8351},{"style":133},[8352],{"type":76,"value":4784},{"type":70,"tag":110,"props":8354,"children":8355},{"style":386},[8356],{"type":76,"value":8357},"typeof",{"type":70,"tag":110,"props":8359,"children":8360},{"style":386},[8361],{"type":76,"value":8362}," q",{"type":70,"tag":110,"props":8364,"children":8365},{"style":330},[8366],{"type":76,"value":468},{"type":70,"tag":110,"props":8368,"children":8369},{"style":386},[8370],{"type":76,"value":1593},{"type":70,"tag":110,"props":8372,"children":8373},{"style":330},[8374],{"type":76,"value":8375}," === '",{"type":70,"tag":110,"props":8377,"children":8378},{"style":386},[8379],{"type":76,"value":8380},"string",{"type":70,"tag":110,"props":8382,"children":8383},{"style":330},[8384],{"type":76,"value":8385},"' ? ",{"type":70,"tag":110,"props":8387,"children":8388},{"style":386},[8389],{"type":76,"value":8300},{"type":70,"tag":110,"props":8391,"children":8392},{"style":330},[8393],{"type":76,"value":8394},".content ",{"type":70,"tag":110,"props":8396,"children":8397},{"style":133},[8398],{"type":76,"value":338},{"type":70,"tag":110,"props":8400,"children":8401},{"style":133},[8402],{"type":76,"value":157},{"type":70,"tag":110,"props":8404,"children":8405},{"style":160},[8406],{"type":76,"value":8407},"[attachment]",{"type":70,"tag":110,"props":8409,"children":8410},{"style":133},[8411],{"type":76,"value":304},{"type":70,"tag":110,"props":8413,"children":8414},{"style":133},[8415],{"type":76,"value":1647},{"type":70,"tag":110,"props":8417,"children":8418},{"class":112,"line":219},[8419,8423,8427,8431,8435,8440,8444,8449,8454,8459,8463,8467],{"type":70,"tag":110,"props":8420,"children":8421},{"style":133},[8422],{"type":76,"value":1274},{"type":70,"tag":110,"props":8424,"children":8425},{"style":139},[8426],{"type":76,"value":2102},{"type":70,"tag":110,"props":8428,"children":8429},{"style":139},[8430],{"type":76,"value":2107},{"type":70,"tag":110,"props":8432,"children":8433},{"style":133},[8434],{"type":76,"value":1372},{"type":70,"tag":110,"props":8436,"children":8437},{"style":330},[8438],{"type":76,"value":8439},"() => cancelQueued",{"type":70,"tag":110,"props":8441,"children":8442},{"style":133},[8443],{"type":76,"value":299},{"type":70,"tag":110,"props":8445,"children":8446},{"style":330},[8447],{"type":76,"value":8448},"q.id",{"type":70,"tag":110,"props":8450,"children":8451},{"style":133},[8452],{"type":76,"value":8453},")}>",{"type":70,"tag":110,"props":8455,"children":8456},{"style":139},[8457],{"type":76,"value":8458},"Cancel",{"type":70,"tag":110,"props":8460,"children":8461},{"style":133},[8462],{"type":76,"value":1759},{"type":70,"tag":110,"props":8464,"children":8465},{"style":139},[8466],{"type":76,"value":2102},{"type":70,"tag":110,"props":8468,"children":8469},{"style":133},[8470],{"type":76,"value":1285},{"type":70,"tag":110,"props":8472,"children":8473},{"class":112,"line":257},[8474,8479,8483],{"type":70,"tag":110,"props":8475,"children":8476},{"style":133},[8477],{"type":76,"value":8478},"  \u003C\u002F",{"type":70,"tag":110,"props":8480,"children":8481},{"style":139},[8482],{"type":76,"value":1280},{"type":70,"tag":110,"props":8484,"children":8485},{"style":133},[8486],{"type":76,"value":1285},{"type":70,"tag":110,"props":8488,"children":8489},{"class":112,"line":267},[8490,8495],{"type":70,"tag":110,"props":8491,"children":8492},{"style":330},[8493],{"type":76,"value":8494},"))",{"type":70,"tag":110,"props":8496,"children":8497},{"style":133},[8498],{"type":76,"value":1647},{"type":70,"tag":79,"props":8500,"children":8501},{},[8502,8504,8509],{"type":76,"value":8503},"Override the configured policy for a single send with the second argument\nto ",{"type":70,"tag":106,"props":8505,"children":8507},{"className":8506},[],[8508],{"type":76,"value":4461},{"type":76,"value":338},{"type":70,"tag":99,"props":8511,"children":8513},{"className":101,"code":8512,"language":45,"meta":103,"style":103},"sendMessage('Never mind, do this instead', { whenBusy: 'interrupt' })\n",[8514],{"type":70,"tag":106,"props":8515,"children":8516},{"__ignoreMap":103},[8517],{"type":70,"tag":110,"props":8518,"children":8519},{"class":112,"line":113},[8520,8524,8528,8532,8537,8541,8545,8549,8553,8557,8561,8565,8569,8573],{"type":70,"tag":110,"props":8521,"children":8522},{"style":292},[8523],{"type":76,"value":4461},{"type":70,"tag":110,"props":8525,"children":8526},{"style":139},[8527],{"type":76,"value":299},{"type":70,"tag":110,"props":8529,"children":8530},{"style":133},[8531],{"type":76,"value":304},{"type":70,"tag":110,"props":8533,"children":8534},{"style":160},[8535],{"type":76,"value":8536},"Never mind, do this instead",{"type":70,"tag":110,"props":8538,"children":8539},{"style":133},[8540],{"type":76,"value":304},{"type":70,"tag":110,"props":8542,"children":8543},{"style":133},[8544],{"type":76,"value":190},{"type":70,"tag":110,"props":8546,"children":8547},{"style":133},[8548],{"type":76,"value":136},{"type":70,"tag":110,"props":8550,"children":8551},{"style":330},[8552],{"type":76,"value":7881},{"type":70,"tag":110,"props":8554,"children":8555},{"style":133},[8556],{"type":76,"value":338},{"type":70,"tag":110,"props":8558,"children":8559},{"style":133},[8560],{"type":76,"value":157},{"type":70,"tag":110,"props":8562,"children":8563},{"style":160},[8564],{"type":76,"value":8227},{"type":70,"tag":110,"props":8566,"children":8567},{"style":133},[8568],{"type":76,"value":304},{"type":70,"tag":110,"props":8570,"children":8571},{"style":133},[8572],{"type":76,"value":147},{"type":70,"tag":110,"props":8574,"children":8575},{"style":139},[8576],{"type":76,"value":668},{"type":70,"tag":92,"props":8578,"children":8580},{"id":8579},"_8-browser-refresh-durability-client-persistence",[8581],{"type":76,"value":8582},"8. Browser-Refresh Durability (client persistence)",{"type":70,"tag":79,"props":8584,"children":8585},{},[8586,8588,8594,8595,8600,8602,8608,8610,8616,8618,8624,8625,8631,8633,8638,8640,8644,8646,8652,8653,8659],{"type":76,"value":8587},"By default a ",{"type":70,"tag":106,"props":8589,"children":8591},{"className":8590},[],[8592],{"type":76,"value":8593},"ChatClient",{"type":76,"value":6551},{"type":70,"tag":106,"props":8596,"children":8598},{"className":8597},[],[8599],{"type":76,"value":7693},{"type":76,"value":8601}," keeps messages in memory only, so a full\npage reload loses the conversation. The optional ",{"type":70,"tag":106,"props":8603,"children":8605},{"className":8604},[],[8606],{"type":76,"value":8607},"persistence",{"type":76,"value":8609}," option (a\n",{"type":70,"tag":106,"props":8611,"children":8613},{"className":8612},[],[8614],{"type":76,"value":8615},"ChatClientPersistence",{"type":76,"value":8617}," adapter) fixes this from the client side: it stores one\ncombined record — ",{"type":70,"tag":106,"props":8619,"children":8621},{"className":8620},[],[8622],{"type":76,"value":8623},"{ messages, resume? }",{"type":76,"value":1161},{"type":70,"tag":106,"props":8626,"children":8628},{"className":8627},[],[8629],{"type":76,"value":8630},"ChatPersistedState",{"type":76,"value":8632},") — per chat ",{"type":70,"tag":106,"props":8634,"children":8636},{"className":8635},[],[8637],{"type":76,"value":1382},{"type":76,"value":8639},",\nso a reload restores the transcript ",{"type":70,"tag":1400,"props":8641,"children":8642},{},[8643],{"type":76,"value":6674},{"type":76,"value":8645}," rehydrates any pending interrupt \u002F\nrejoins a run that was still streaming. No manual ",{"type":70,"tag":106,"props":8647,"children":8649},{"className":8648},[],[8650],{"type":76,"value":8651},"initialMessages",{"type":76,"value":6131},{"type":70,"tag":106,"props":8654,"children":8656},{"className":8655},[],[8657],{"type":76,"value":8658},"onFinish",{"type":76,"value":8660},"\nboilerplate.",{"type":70,"tag":79,"props":8662,"children":8663},{},[8664,8666,8672,8674,8680,8682,8688,8690,8696,8698,8704,8705,8711,8713,8719,8721,8726],{"type":76,"value":8665},"Three storage adapters ship from ",{"type":70,"tag":106,"props":8667,"children":8669},{"className":8668},[],[8670],{"type":76,"value":8671},"@tanstack\u002Fai-client",{"type":76,"value":8673},":\n",{"type":70,"tag":106,"props":8675,"children":8677},{"className":8676},[],[8678],{"type":76,"value":8679},"localStoragePersistence",{"type":76,"value":8681}," (survives reloads and browser restarts),\n",{"type":70,"tag":106,"props":8683,"children":8685},{"className":8684},[],[8686],{"type":76,"value":8687},"sessionStoragePersistence",{"type":76,"value":8689}," (scoped to the tab), and ",{"type":70,"tag":106,"props":8691,"children":8693},{"className":8692},[],[8694],{"type":76,"value":8695},"indexedDBPersistence",{"type":76,"value":8697},"\n(async, structured-clone storage — no codec needed for ",{"type":70,"tag":106,"props":8699,"children":8701},{"className":8700},[],[8702],{"type":76,"value":8703},"Date",{"type":76,"value":1429},{"type":70,"tag":106,"props":8706,"children":8708},{"className":8707},[],[8709],{"type":76,"value":8710},"Map",{"type":76,"value":8712},"\u002Fetc.).\nGive the chat a stable ",{"type":70,"tag":106,"props":8714,"children":8716},{"className":8715},[],[8717],{"type":76,"value":8718},"threadId",{"type":76,"value":8720}," so the reload finds the same record.\nPersistence keys on ",{"type":70,"tag":106,"props":8722,"children":8724},{"className":8723},[],[8725],{"type":76,"value":8718},{"type":76,"value":8727},"; the storage adapters are re-exported from each\nframework package, so a single import works:",{"type":70,"tag":99,"props":8729,"children":8731},{"className":101,"code":8730,"language":45,"meta":103,"style":103},"import {\n  useChat,\n  fetchServerSentEvents,\n  localStoragePersistence,\n} from '@tanstack\u002Fai-react'\n\n\u002F\u002F Defaults to the ChatPersistedState shape and a JSON codec, so no type\n\u002F\u002F argument or serialize\u002Fdeserialize is needed. indexedDBPersistence stores via\n\u002F\u002F structured clone (a Date round-trips exactly).\nconst persistence = localStoragePersistence()\n\nfunction Chat() {\n  const { messages, sendMessage } = useChat({\n    threadId: 'support-chat',\n    connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n    persistence,\n  })\n  \u002F\u002F ...render messages, call sendMessage(text)\n}\n",[8732],{"type":70,"tag":106,"props":8733,"children":8734},{"__ignoreMap":103},[8735,8746,8757,8768,8780,8803,8810,8818,8826,8834,8859,8866,8886,8929,8958,8997,9009,9020,9028],{"type":70,"tag":110,"props":8736,"children":8737},{"class":112,"line":113},[8738,8742],{"type":70,"tag":110,"props":8739,"children":8740},{"style":127},[8741],{"type":76,"value":130},{"type":70,"tag":110,"props":8743,"children":8744},{"style":133},[8745],{"type":76,"value":343},{"type":70,"tag":110,"props":8747,"children":8748},{"class":112,"line":123},[8749,8753],{"type":70,"tag":110,"props":8750,"children":8751},{"style":139},[8752],{"type":76,"value":5701},{"type":70,"tag":110,"props":8754,"children":8755},{"style":133},[8756],{"type":76,"value":588},{"type":70,"tag":110,"props":8758,"children":8759},{"class":112,"line":171},[8760,8764],{"type":70,"tag":110,"props":8761,"children":8762},{"style":139},[8763],{"type":76,"value":5713},{"type":70,"tag":110,"props":8765,"children":8766},{"style":133},[8767],{"type":76,"value":588},{"type":70,"tag":110,"props":8769,"children":8770},{"class":112,"line":219},[8771,8776],{"type":70,"tag":110,"props":8772,"children":8773},{"style":139},[8774],{"type":76,"value":8775},"  localStoragePersistence",{"type":70,"tag":110,"props":8777,"children":8778},{"style":133},[8779],{"type":76,"value":588},{"type":70,"tag":110,"props":8781,"children":8782},{"class":112,"line":257},[8783,8787,8791,8795,8799],{"type":70,"tag":110,"props":8784,"children":8785},{"style":133},[8786],{"type":76,"value":754},{"type":70,"tag":110,"props":8788,"children":8789},{"style":127},[8790],{"type":76,"value":152},{"type":70,"tag":110,"props":8792,"children":8793},{"style":133},[8794],{"type":76,"value":157},{"type":70,"tag":110,"props":8796,"children":8797},{"style":160},[8798],{"type":76,"value":857},{"type":70,"tag":110,"props":8800,"children":8801},{"style":133},[8802],{"type":76,"value":168},{"type":70,"tag":110,"props":8804,"children":8805},{"class":112,"line":267},[8806],{"type":70,"tag":110,"props":8807,"children":8808},{"emptyLinePlaceholder":261},[8809],{"type":76,"value":264},{"type":70,"tag":110,"props":8811,"children":8812},{"class":112,"line":326},[8813],{"type":70,"tag":110,"props":8814,"children":8815},{"style":117},[8816],{"type":76,"value":8817},"\u002F\u002F Defaults to the ChatPersistedState shape and a JSON codec, so no type\n",{"type":70,"tag":110,"props":8819,"children":8820},{"class":112,"line":346},[8821],{"type":70,"tag":110,"props":8822,"children":8823},{"style":117},[8824],{"type":76,"value":8825},"\u002F\u002F argument or serialize\u002Fdeserialize is needed. indexedDBPersistence stores via\n",{"type":70,"tag":110,"props":8827,"children":8828},{"class":112,"line":363},[8829],{"type":70,"tag":110,"props":8830,"children":8831},{"style":117},[8832],{"type":76,"value":8833},"\u002F\u002F structured clone (a Date round-trips exactly).\n",{"type":70,"tag":110,"props":8835,"children":8836},{"class":112,"line":406},[8837,8841,8846,8850,8855],{"type":70,"tag":110,"props":8838,"children":8839},{"style":276},[8840],{"type":76,"value":2422},{"type":70,"tag":110,"props":8842,"children":8843},{"style":139},[8844],{"type":76,"value":8845}," persistence ",{"type":70,"tag":110,"props":8847,"children":8848},{"style":133},[8849],{"type":76,"value":289},{"type":70,"tag":110,"props":8851,"children":8852},{"style":292},[8853],{"type":76,"value":8854}," localStoragePersistence",{"type":70,"tag":110,"props":8856,"children":8857},{"style":139},[8858],{"type":76,"value":437},{"type":70,"tag":110,"props":8860,"children":8861},{"class":112,"line":440},[8862],{"type":70,"tag":110,"props":8863,"children":8864},{"emptyLinePlaceholder":261},[8865],{"type":76,"value":264},{"type":70,"tag":110,"props":8867,"children":8868},{"class":112,"line":480},[8869,8873,8878,8882],{"type":70,"tag":110,"props":8870,"children":8871},{"style":276},[8872],{"type":76,"value":917},{"type":70,"tag":110,"props":8874,"children":8875},{"style":292},[8876],{"type":76,"value":8877}," Chat",{"type":70,"tag":110,"props":8879,"children":8880},{"style":133},[8881],{"type":76,"value":927},{"type":70,"tag":110,"props":8883,"children":8884},{"style":133},[8885],{"type":76,"value":343},{"type":70,"tag":110,"props":8887,"children":8888},{"class":112,"line":510},[8889,8893,8897,8901,8905,8909,8913,8917,8921,8925],{"type":70,"tag":110,"props":8890,"children":8891},{"style":276},[8892],{"type":76,"value":939},{"type":70,"tag":110,"props":8894,"children":8895},{"style":133},[8896],{"type":76,"value":136},{"type":70,"tag":110,"props":8898,"children":8899},{"style":139},[8900],{"type":76,"value":494},{"type":70,"tag":110,"props":8902,"children":8903},{"style":133},[8904],{"type":76,"value":190},{"type":70,"tag":110,"props":8906,"children":8907},{"style":139},[8908],{"type":76,"value":1013},{"type":70,"tag":110,"props":8910,"children":8911},{"style":133},[8912],{"type":76,"value":147},{"type":70,"tag":110,"props":8914,"children":8915},{"style":133},[8916],{"type":76,"value":422},{"type":70,"tag":110,"props":8918,"children":8919},{"style":292},[8920],{"type":76,"value":831},{"type":70,"tag":110,"props":8922,"children":8923},{"style":330},[8924],{"type":76,"value":299},{"type":70,"tag":110,"props":8926,"children":8927},{"style":133},[8928],{"type":76,"value":323},{"type":70,"tag":110,"props":8930,"children":8931},{"class":112,"line":518},[8932,8937,8941,8945,8950,8954],{"type":70,"tag":110,"props":8933,"children":8934},{"style":330},[8935],{"type":76,"value":8936},"    threadId",{"type":70,"tag":110,"props":8938,"children":8939},{"style":133},[8940],{"type":76,"value":338},{"type":70,"tag":110,"props":8942,"children":8943},{"style":133},[8944],{"type":76,"value":157},{"type":70,"tag":110,"props":8946,"children":8947},{"style":160},[8948],{"type":76,"value":8949},"support-chat",{"type":70,"tag":110,"props":8951,"children":8952},{"style":133},[8953],{"type":76,"value":304},{"type":70,"tag":110,"props":8955,"children":8956},{"style":133},[8957],{"type":76,"value":588},{"type":70,"tag":110,"props":8959,"children":8960},{"class":112,"line":547},[8961,8965,8969,8973,8977,8981,8985,8989,8993],{"type":70,"tag":110,"props":8962,"children":8963},{"style":330},[8964],{"type":76,"value":1068},{"type":70,"tag":110,"props":8966,"children":8967},{"style":133},[8968],{"type":76,"value":338},{"type":70,"tag":110,"props":8970,"children":8971},{"style":292},[8972],{"type":76,"value":840},{"type":70,"tag":110,"props":8974,"children":8975},{"style":330},[8976],{"type":76,"value":299},{"type":70,"tag":110,"props":8978,"children":8979},{"style":133},[8980],{"type":76,"value":304},{"type":70,"tag":110,"props":8982,"children":8983},{"style":160},[8984],{"type":76,"value":309},{"type":70,"tag":110,"props":8986,"children":8987},{"style":133},[8988],{"type":76,"value":304},{"type":70,"tag":110,"props":8990,"children":8991},{"style":330},[8992],{"type":76,"value":583},{"type":70,"tag":110,"props":8994,"children":8995},{"style":133},[8996],{"type":76,"value":588},{"type":70,"tag":110,"props":8998,"children":8999},{"class":112,"line":591},[9000,9005],{"type":70,"tag":110,"props":9001,"children":9002},{"style":139},[9003],{"type":76,"value":9004},"    persistence",{"type":70,"tag":110,"props":9006,"children":9007},{"style":133},[9008],{"type":76,"value":588},{"type":70,"tag":110,"props":9010,"children":9011},{"class":112,"line":604},[9012,9016],{"type":70,"tag":110,"props":9013,"children":9014},{"style":133},[9015],{"type":76,"value":1108},{"type":70,"tag":110,"props":9017,"children":9018},{"style":330},[9019],{"type":76,"value":668},{"type":70,"tag":110,"props":9021,"children":9022},{"class":112,"line":644},[9023],{"type":70,"tag":110,"props":9024,"children":9025},{"style":117},[9026],{"type":76,"value":9027},"  \u002F\u002F ...render messages, call sendMessage(text)\n",{"type":70,"tag":110,"props":9029,"children":9030},{"class":112,"line":657},[9031],{"type":70,"tag":110,"props":9032,"children":9033},{"style":133},[9034],{"type":76,"value":1647},{"type":70,"tag":79,"props":9036,"children":9037},{},[9038,9043,9045,9050,9052,9058,9060,9065,9067,9072,9074,9080,9082,9088],{"type":70,"tag":1400,"props":9039,"children":9040},{},[9041],{"type":76,"value":9042},"Keep large transcripts off the client.",{"type":76,"value":9044}," ",{"type":70,"tag":106,"props":9046,"children":9048},{"className":9047},[],[9049],{"type":76,"value":8607},{"type":76,"value":9051}," also accepts ",{"type":70,"tag":106,"props":9053,"children":9055},{"className":9054},[],[9056],{"type":76,"value":9057},"true",{"type":76,"value":9059},"\n(server-authoritative): the client caches nothing, and on mount it hydrates the\nthread from the server by ",{"type":70,"tag":106,"props":9061,"children":9063},{"className":9062},[],[9064],{"type":76,"value":8718},{"type":76,"value":9066}," (transcript plus a cursor to any run still\ngenerating). An adapter is client-authoritative; ",{"type":70,"tag":106,"props":9068,"children":9070},{"className":9069},[],[9071],{"type":76,"value":9057},{"type":76,"value":9073}," leaves history on the\nserver and needs a connection with a ",{"type":70,"tag":106,"props":9075,"children":9077},{"className":9076},[],[9078],{"type":76,"value":9079},"hydrate",{"type":76,"value":9081}," handler plus a server GET\nendpoint (",{"type":70,"tag":106,"props":9083,"children":9085},{"className":9084},[],[9086],{"type":76,"value":9087},"reconstructChat",{"type":76,"value":9089},"), since the delivery log only holds one run.",{"type":70,"tag":79,"props":9091,"children":9092},{},[9093,9098,9100,9105,9107,9112,9114,9119,9121,9126,9128,9134],{"type":70,"tag":1400,"props":9094,"children":9095},{},[9096],{"type":76,"value":9097},"Mid-stream reload rejoin.",{"type":76,"value":9099}," If the run was still streaming when the page\nreloaded, the client re-attaches instead of showing a frozen half-reply — but\nonly when the connection is ",{"type":70,"tag":1400,"props":9101,"children":9102},{},[9103],{"type":76,"value":9104},"resumable",{"type":76,"value":9106},": a delivery-durability-backed route\nthat records the stream and exposes a GET replay handler (see\n",{"type":70,"tag":106,"props":9108,"children":9110},{"className":9109},[],[9111],{"type":76,"value":2752},{"type":76,"value":9113}," and Pattern 1's ",{"type":70,"tag":106,"props":9115,"children":9117},{"className":9116},[],[9118],{"type":76,"value":6582},{"type":76,"value":9120}," adapter). Given\nthat, ",{"type":70,"tag":106,"props":9122,"children":9124},{"className":9123},[],[9125],{"type":76,"value":7693},{"type":76,"value":9127}," finds the persisted in-flight run on load and auto-rejoins it via\n",{"type":70,"tag":106,"props":9129,"children":9131},{"className":9130},[],[9132],{"type":76,"value":9133},"joinRun",{"type":76,"value":9135},", replaying from the server's log so the reply finishes where it left\noff. No extra client code beyond the resumable connection.",{"type":70,"tag":79,"props":9137,"children":9138},{},[9139,9144,9146,9151,9153,9158,9159,9165,9166,9172,9173,9179,9180,9186,9187,9193,9195,9200,9202,9207,9209,9214,9216,9222,9223,9229],{"type":70,"tag":1400,"props":9140,"children":9141},{},[9142],{"type":76,"value":9143},"Every framework, no extra code.",{"type":76,"value":9145}," Durability rides the existing ",{"type":70,"tag":106,"props":9147,"children":9149},{"className":9148},[],[9150],{"type":76,"value":8607},{"type":76,"value":9152},"\noption, so it works identically in ",{"type":70,"tag":106,"props":9154,"children":9156},{"className":9155},[],[9157],{"type":76,"value":857},{"type":76,"value":3219},{"type":70,"tag":106,"props":9160,"children":9162},{"className":9161},[],[9163],{"type":76,"value":9164},"-solid",{"type":76,"value":3219},{"type":70,"tag":106,"props":9167,"children":9169},{"className":9168},[],[9170],{"type":76,"value":9171},"-vue",{"type":76,"value":588},{"type":70,"tag":106,"props":9174,"children":9176},{"className":9175},[],[9177],{"type":76,"value":9178},"-svelte",{"type":76,"value":3219},{"type":70,"tag":106,"props":9181,"children":9183},{"className":9182},[],[9184],{"type":76,"value":9185},"-angular",{"type":76,"value":8213},{"type":70,"tag":106,"props":9188,"children":9190},{"className":9189},[],[9191],{"type":76,"value":9192},"-preact",{"type":76,"value":9194}," — pass ",{"type":70,"tag":106,"props":9196,"children":9198},{"className":9197},[],[9199],{"type":76,"value":8607},{"type":76,"value":9201}," (and a stable\n",{"type":70,"tag":106,"props":9203,"children":9205},{"className":9204},[],[9206],{"type":76,"value":8718},{"type":76,"value":9208},", which is the chat's identity) to the framework's ",{"type":70,"tag":106,"props":9210,"children":9212},{"className":9211},[],[9213],{"type":76,"value":7693},{"type":76,"value":9215}," \u002F\n",{"type":70,"tag":106,"props":9217,"children":9219},{"className":9218},[],[9220],{"type":76,"value":9221},"createChat",{"type":76,"value":6551},{"type":70,"tag":106,"props":9224,"children":9226},{"className":9225},[],[9227],{"type":76,"value":9228},"injectChat",{"type":76,"value":9230},"; nothing is framework-specific.",{"type":70,"tag":9232,"props":9233,"children":9234},"blockquote",{},[9235],{"type":70,"tag":79,"props":9236,"children":9237},{},[9238,9243,9245,9251],{"type":70,"tag":1400,"props":9239,"children":9240},{},[9241],{"type":76,"value":9242},"Client vs. server durability.",{"type":76,"value":9244}," This is the client (per-browser) half.\nThe authoritative, multi-user, server-side copy is the ",{"type":70,"tag":106,"props":9246,"children":9248},{"className":9247},[],[9249],{"type":76,"value":9250},"withPersistence",{"type":76,"value":9252},"\nmiddleware — see ai-core\u002Fmiddleware\u002FSKILL.md. The two are independent; use\nboth for instant reload restore plus a durable record of record.",{"type":70,"tag":85,"props":9254,"children":9256},{"id":9255},"common-mistakes",[9257],{"type":76,"value":9258},"Common Mistakes",{"type":70,"tag":92,"props":9260,"children":9262},{"id":9261},"a-critical-using-vercel-ai-sdk-patterns-streamtext-generatetext",[9263],{"type":76,"value":9264},"a. CRITICAL: Using Vercel AI SDK patterns (streamText, generateText)",{"type":70,"tag":99,"props":9266,"children":9268},{"className":101,"code":9267,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG\nimport { streamText } from 'ai'\nimport { openai } from '@ai-sdk\u002Fopenai'\nconst result = streamText({ model: openai('gpt-5.5'), messages })\n\n\u002F\u002F CORRECT\nimport { chat } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nconst stream = chat({ adapter: openaiText('gpt-5.5'), messages })\n",[9269],{"type":70,"tag":106,"props":9270,"children":9271},{"__ignoreMap":103},[9272,9280,9316,9353,9430,9437,9445,9480,9515],{"type":70,"tag":110,"props":9273,"children":9274},{"class":112,"line":113},[9275],{"type":70,"tag":110,"props":9276,"children":9277},{"style":117},[9278],{"type":76,"value":9279},"\u002F\u002F WRONG\n",{"type":70,"tag":110,"props":9281,"children":9282},{"class":112,"line":123},[9283,9287,9291,9296,9300,9304,9308,9312],{"type":70,"tag":110,"props":9284,"children":9285},{"style":127},[9286],{"type":76,"value":130},{"type":70,"tag":110,"props":9288,"children":9289},{"style":133},[9290],{"type":76,"value":136},{"type":70,"tag":110,"props":9292,"children":9293},{"style":139},[9294],{"type":76,"value":9295}," streamText",{"type":70,"tag":110,"props":9297,"children":9298},{"style":133},[9299],{"type":76,"value":147},{"type":70,"tag":110,"props":9301,"children":9302},{"style":127},[9303],{"type":76,"value":152},{"type":70,"tag":110,"props":9305,"children":9306},{"style":133},[9307],{"type":76,"value":157},{"type":70,"tag":110,"props":9309,"children":9310},{"style":160},[9311],{"type":76,"value":30},{"type":70,"tag":110,"props":9313,"children":9314},{"style":133},[9315],{"type":76,"value":168},{"type":70,"tag":110,"props":9317,"children":9318},{"class":112,"line":171},[9319,9323,9327,9332,9336,9340,9344,9349],{"type":70,"tag":110,"props":9320,"children":9321},{"style":127},[9322],{"type":76,"value":130},{"type":70,"tag":110,"props":9324,"children":9325},{"style":133},[9326],{"type":76,"value":136},{"type":70,"tag":110,"props":9328,"children":9329},{"style":139},[9330],{"type":76,"value":9331}," openai",{"type":70,"tag":110,"props":9333,"children":9334},{"style":133},[9335],{"type":76,"value":147},{"type":70,"tag":110,"props":9337,"children":9338},{"style":127},[9339],{"type":76,"value":152},{"type":70,"tag":110,"props":9341,"children":9342},{"style":133},[9343],{"type":76,"value":157},{"type":70,"tag":110,"props":9345,"children":9346},{"style":160},[9347],{"type":76,"value":9348},"@ai-sdk\u002Fopenai",{"type":70,"tag":110,"props":9350,"children":9351},{"style":133},[9352],{"type":76,"value":168},{"type":70,"tag":110,"props":9354,"children":9355},{"class":112,"line":219},[9356,9360,9365,9369,9373,9377,9381,9385,9389,9393,9397,9401,9405,9409,9413,9417,9422,9426],{"type":70,"tag":110,"props":9357,"children":9358},{"style":276},[9359],{"type":76,"value":2422},{"type":70,"tag":110,"props":9361,"children":9362},{"style":139},[9363],{"type":76,"value":9364}," result ",{"type":70,"tag":110,"props":9366,"children":9367},{"style":133},[9368],{"type":76,"value":289},{"type":70,"tag":110,"props":9370,"children":9371},{"style":292},[9372],{"type":76,"value":9295},{"type":70,"tag":110,"props":9374,"children":9375},{"style":139},[9376],{"type":76,"value":299},{"type":70,"tag":110,"props":9378,"children":9379},{"style":133},[9380],{"type":76,"value":1410},{"type":70,"tag":110,"props":9382,"children":9383},{"style":330},[9384],{"type":76,"value":2980},{"type":70,"tag":110,"props":9386,"children":9387},{"style":133},[9388],{"type":76,"value":338},{"type":70,"tag":110,"props":9390,"children":9391},{"style":292},[9392],{"type":76,"value":9331},{"type":70,"tag":110,"props":9394,"children":9395},{"style":139},[9396],{"type":76,"value":299},{"type":70,"tag":110,"props":9398,"children":9399},{"style":133},[9400],{"type":76,"value":304},{"type":70,"tag":110,"props":9402,"children":9403},{"style":160},[9404],{"type":76,"value":574},{"type":70,"tag":110,"props":9406,"children":9407},{"style":133},[9408],{"type":76,"value":304},{"type":70,"tag":110,"props":9410,"children":9411},{"style":139},[9412],{"type":76,"value":583},{"type":70,"tag":110,"props":9414,"children":9415},{"style":133},[9416],{"type":76,"value":190},{"type":70,"tag":110,"props":9418,"children":9419},{"style":139},[9420],{"type":76,"value":9421}," messages ",{"type":70,"tag":110,"props":9423,"children":9424},{"style":133},[9425],{"type":76,"value":754},{"type":70,"tag":110,"props":9427,"children":9428},{"style":139},[9429],{"type":76,"value":668},{"type":70,"tag":110,"props":9431,"children":9432},{"class":112,"line":257},[9433],{"type":70,"tag":110,"props":9434,"children":9435},{"emptyLinePlaceholder":261},[9436],{"type":76,"value":264},{"type":70,"tag":110,"props":9438,"children":9439},{"class":112,"line":267},[9440],{"type":70,"tag":110,"props":9441,"children":9442},{"style":117},[9443],{"type":76,"value":9444},"\u002F\u002F CORRECT\n",{"type":70,"tag":110,"props":9446,"children":9447},{"class":112,"line":326},[9448,9452,9456,9460,9464,9468,9472,9476],{"type":70,"tag":110,"props":9449,"children":9450},{"style":127},[9451],{"type":76,"value":130},{"type":70,"tag":110,"props":9453,"children":9454},{"style":133},[9455],{"type":76,"value":136},{"type":70,"tag":110,"props":9457,"children":9458},{"style":139},[9459],{"type":76,"value":185},{"type":70,"tag":110,"props":9461,"children":9462},{"style":133},[9463],{"type":76,"value":147},{"type":70,"tag":110,"props":9465,"children":9466},{"style":127},[9467],{"type":76,"value":152},{"type":70,"tag":110,"props":9469,"children":9470},{"style":133},[9471],{"type":76,"value":157},{"type":70,"tag":110,"props":9473,"children":9474},{"style":160},[9475],{"type":76,"value":212},{"type":70,"tag":110,"props":9477,"children":9478},{"style":133},[9479],{"type":76,"value":168},{"type":70,"tag":110,"props":9481,"children":9482},{"class":112,"line":346},[9483,9487,9491,9495,9499,9503,9507,9511],{"type":70,"tag":110,"props":9484,"children":9485},{"style":127},[9486],{"type":76,"value":130},{"type":70,"tag":110,"props":9488,"children":9489},{"style":133},[9490],{"type":76,"value":136},{"type":70,"tag":110,"props":9492,"children":9493},{"style":139},[9494],{"type":76,"value":233},{"type":70,"tag":110,"props":9496,"children":9497},{"style":133},[9498],{"type":76,"value":147},{"type":70,"tag":110,"props":9500,"children":9501},{"style":127},[9502],{"type":76,"value":152},{"type":70,"tag":110,"props":9504,"children":9505},{"style":133},[9506],{"type":76,"value":157},{"type":70,"tag":110,"props":9508,"children":9509},{"style":160},[9510],{"type":76,"value":250},{"type":70,"tag":110,"props":9512,"children":9513},{"style":133},[9514],{"type":76,"value":168},{"type":70,"tag":110,"props":9516,"children":9517},{"class":112,"line":363},[9518,9522,9526,9530,9534,9538,9542,9547,9551,9555,9559,9563,9567,9571,9575,9579,9583,9587],{"type":70,"tag":110,"props":9519,"children":9520},{"style":276},[9521],{"type":76,"value":2422},{"type":70,"tag":110,"props":9523,"children":9524},{"style":139},[9525],{"type":76,"value":2427},{"type":70,"tag":110,"props":9527,"children":9528},{"style":133},[9529],{"type":76,"value":289},{"type":70,"tag":110,"props":9531,"children":9532},{"style":292},[9533],{"type":76,"value":185},{"type":70,"tag":110,"props":9535,"children":9536},{"style":139},[9537],{"type":76,"value":299},{"type":70,"tag":110,"props":9539,"children":9540},{"style":133},[9541],{"type":76,"value":1410},{"type":70,"tag":110,"props":9543,"children":9544},{"style":330},[9545],{"type":76,"value":9546}," adapter",{"type":70,"tag":110,"props":9548,"children":9549},{"style":133},[9550],{"type":76,"value":338},{"type":70,"tag":110,"props":9552,"children":9553},{"style":292},[9554],{"type":76,"value":233},{"type":70,"tag":110,"props":9556,"children":9557},{"style":139},[9558],{"type":76,"value":299},{"type":70,"tag":110,"props":9560,"children":9561},{"style":133},[9562],{"type":76,"value":304},{"type":70,"tag":110,"props":9564,"children":9565},{"style":160},[9566],{"type":76,"value":574},{"type":70,"tag":110,"props":9568,"children":9569},{"style":133},[9570],{"type":76,"value":304},{"type":70,"tag":110,"props":9572,"children":9573},{"style":139},[9574],{"type":76,"value":583},{"type":70,"tag":110,"props":9576,"children":9577},{"style":133},[9578],{"type":76,"value":190},{"type":70,"tag":110,"props":9580,"children":9581},{"style":139},[9582],{"type":76,"value":9421},{"type":70,"tag":110,"props":9584,"children":9585},{"style":133},[9586],{"type":76,"value":754},{"type":70,"tag":110,"props":9588,"children":9589},{"style":139},[9590],{"type":76,"value":668},{"type":70,"tag":92,"props":9592,"children":9594},{"id":9593},"b-critical-using-vercel-createopenai-provider-pattern",[9595],{"type":76,"value":9596},"b. CRITICAL: Using Vercel createOpenAI() provider pattern",{"type":70,"tag":99,"props":9598,"children":9600},{"className":101,"code":9599,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG\nimport { createOpenAI } from '@ai-sdk\u002Fopenai'\nconst openai = createOpenAI({ apiKey })\nstreamText({ model: openai('gpt-5.5'), messages })\n\n\u002F\u002F CORRECT\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { chat } from '@tanstack\u002Fai'\nchat({ adapter: openaiText('gpt-5.5'), messages })\n",[9601],{"type":70,"tag":106,"props":9602,"children":9603},{"__ignoreMap":103},[9604,9611,9647,9688,9752,9759,9766,9801,9836],{"type":70,"tag":110,"props":9605,"children":9606},{"class":112,"line":113},[9607],{"type":70,"tag":110,"props":9608,"children":9609},{"style":117},[9610],{"type":76,"value":9279},{"type":70,"tag":110,"props":9612,"children":9613},{"class":112,"line":123},[9614,9618,9622,9627,9631,9635,9639,9643],{"type":70,"tag":110,"props":9615,"children":9616},{"style":127},[9617],{"type":76,"value":130},{"type":70,"tag":110,"props":9619,"children":9620},{"style":133},[9621],{"type":76,"value":136},{"type":70,"tag":110,"props":9623,"children":9624},{"style":139},[9625],{"type":76,"value":9626}," createOpenAI",{"type":70,"tag":110,"props":9628,"children":9629},{"style":133},[9630],{"type":76,"value":147},{"type":70,"tag":110,"props":9632,"children":9633},{"style":127},[9634],{"type":76,"value":152},{"type":70,"tag":110,"props":9636,"children":9637},{"style":133},[9638],{"type":76,"value":157},{"type":70,"tag":110,"props":9640,"children":9641},{"style":160},[9642],{"type":76,"value":9348},{"type":70,"tag":110,"props":9644,"children":9645},{"style":133},[9646],{"type":76,"value":168},{"type":70,"tag":110,"props":9648,"children":9649},{"class":112,"line":171},[9650,9654,9659,9663,9667,9671,9675,9680,9684],{"type":70,"tag":110,"props":9651,"children":9652},{"style":276},[9653],{"type":76,"value":2422},{"type":70,"tag":110,"props":9655,"children":9656},{"style":139},[9657],{"type":76,"value":9658}," openai ",{"type":70,"tag":110,"props":9660,"children":9661},{"style":133},[9662],{"type":76,"value":289},{"type":70,"tag":110,"props":9664,"children":9665},{"style":292},[9666],{"type":76,"value":9626},{"type":70,"tag":110,"props":9668,"children":9669},{"style":139},[9670],{"type":76,"value":299},{"type":70,"tag":110,"props":9672,"children":9673},{"style":133},[9674],{"type":76,"value":1410},{"type":70,"tag":110,"props":9676,"children":9677},{"style":139},[9678],{"type":76,"value":9679}," apiKey ",{"type":70,"tag":110,"props":9681,"children":9682},{"style":133},[9683],{"type":76,"value":754},{"type":70,"tag":110,"props":9685,"children":9686},{"style":139},[9687],{"type":76,"value":668},{"type":70,"tag":110,"props":9689,"children":9690},{"class":112,"line":219},[9691,9696,9700,9704,9708,9712,9716,9720,9724,9728,9732,9736,9740,9744,9748],{"type":70,"tag":110,"props":9692,"children":9693},{"style":292},[9694],{"type":76,"value":9695},"streamText",{"type":70,"tag":110,"props":9697,"children":9698},{"style":139},[9699],{"type":76,"value":299},{"type":70,"tag":110,"props":9701,"children":9702},{"style":133},[9703],{"type":76,"value":1410},{"type":70,"tag":110,"props":9705,"children":9706},{"style":330},[9707],{"type":76,"value":2980},{"type":70,"tag":110,"props":9709,"children":9710},{"style":133},[9711],{"type":76,"value":338},{"type":70,"tag":110,"props":9713,"children":9714},{"style":292},[9715],{"type":76,"value":9331},{"type":70,"tag":110,"props":9717,"children":9718},{"style":139},[9719],{"type":76,"value":299},{"type":70,"tag":110,"props":9721,"children":9722},{"style":133},[9723],{"type":76,"value":304},{"type":70,"tag":110,"props":9725,"children":9726},{"style":160},[9727],{"type":76,"value":574},{"type":70,"tag":110,"props":9729,"children":9730},{"style":133},[9731],{"type":76,"value":304},{"type":70,"tag":110,"props":9733,"children":9734},{"style":139},[9735],{"type":76,"value":583},{"type":70,"tag":110,"props":9737,"children":9738},{"style":133},[9739],{"type":76,"value":190},{"type":70,"tag":110,"props":9741,"children":9742},{"style":139},[9743],{"type":76,"value":9421},{"type":70,"tag":110,"props":9745,"children":9746},{"style":133},[9747],{"type":76,"value":754},{"type":70,"tag":110,"props":9749,"children":9750},{"style":139},[9751],{"type":76,"value":668},{"type":70,"tag":110,"props":9753,"children":9754},{"class":112,"line":257},[9755],{"type":70,"tag":110,"props":9756,"children":9757},{"emptyLinePlaceholder":261},[9758],{"type":76,"value":264},{"type":70,"tag":110,"props":9760,"children":9761},{"class":112,"line":267},[9762],{"type":70,"tag":110,"props":9763,"children":9764},{"style":117},[9765],{"type":76,"value":9444},{"type":70,"tag":110,"props":9767,"children":9768},{"class":112,"line":326},[9769,9773,9777,9781,9785,9789,9793,9797],{"type":70,"tag":110,"props":9770,"children":9771},{"style":127},[9772],{"type":76,"value":130},{"type":70,"tag":110,"props":9774,"children":9775},{"style":133},[9776],{"type":76,"value":136},{"type":70,"tag":110,"props":9778,"children":9779},{"style":139},[9780],{"type":76,"value":233},{"type":70,"tag":110,"props":9782,"children":9783},{"style":133},[9784],{"type":76,"value":147},{"type":70,"tag":110,"props":9786,"children":9787},{"style":127},[9788],{"type":76,"value":152},{"type":70,"tag":110,"props":9790,"children":9791},{"style":133},[9792],{"type":76,"value":157},{"type":70,"tag":110,"props":9794,"children":9795},{"style":160},[9796],{"type":76,"value":250},{"type":70,"tag":110,"props":9798,"children":9799},{"style":133},[9800],{"type":76,"value":168},{"type":70,"tag":110,"props":9802,"children":9803},{"class":112,"line":346},[9804,9808,9812,9816,9820,9824,9828,9832],{"type":70,"tag":110,"props":9805,"children":9806},{"style":127},[9807],{"type":76,"value":130},{"type":70,"tag":110,"props":9809,"children":9810},{"style":133},[9811],{"type":76,"value":136},{"type":70,"tag":110,"props":9813,"children":9814},{"style":139},[9815],{"type":76,"value":185},{"type":70,"tag":110,"props":9817,"children":9818},{"style":133},[9819],{"type":76,"value":147},{"type":70,"tag":110,"props":9821,"children":9822},{"style":127},[9823],{"type":76,"value":152},{"type":70,"tag":110,"props":9825,"children":9826},{"style":133},[9827],{"type":76,"value":157},{"type":70,"tag":110,"props":9829,"children":9830},{"style":160},[9831],{"type":76,"value":212},{"type":70,"tag":110,"props":9833,"children":9834},{"style":133},[9835],{"type":76,"value":168},{"type":70,"tag":110,"props":9837,"children":9838},{"class":112,"line":363},[9839,9844,9848,9852,9856,9860,9864,9868,9872,9876,9880,9884,9888,9892,9896],{"type":70,"tag":110,"props":9840,"children":9841},{"style":292},[9842],{"type":76,"value":9843},"chat",{"type":70,"tag":110,"props":9845,"children":9846},{"style":139},[9847],{"type":76,"value":299},{"type":70,"tag":110,"props":9849,"children":9850},{"style":133},[9851],{"type":76,"value":1410},{"type":70,"tag":110,"props":9853,"children":9854},{"style":330},[9855],{"type":76,"value":9546},{"type":70,"tag":110,"props":9857,"children":9858},{"style":133},[9859],{"type":76,"value":338},{"type":70,"tag":110,"props":9861,"children":9862},{"style":292},[9863],{"type":76,"value":233},{"type":70,"tag":110,"props":9865,"children":9866},{"style":139},[9867],{"type":76,"value":299},{"type":70,"tag":110,"props":9869,"children":9870},{"style":133},[9871],{"type":76,"value":304},{"type":70,"tag":110,"props":9873,"children":9874},{"style":160},[9875],{"type":76,"value":574},{"type":70,"tag":110,"props":9877,"children":9878},{"style":133},[9879],{"type":76,"value":304},{"type":70,"tag":110,"props":9881,"children":9882},{"style":139},[9883],{"type":76,"value":583},{"type":70,"tag":110,"props":9885,"children":9886},{"style":133},[9887],{"type":76,"value":190},{"type":70,"tag":110,"props":9889,"children":9890},{"style":139},[9891],{"type":76,"value":9421},{"type":70,"tag":110,"props":9893,"children":9894},{"style":133},[9895],{"type":76,"value":754},{"type":70,"tag":110,"props":9897,"children":9898},{"style":139},[9899],{"type":76,"value":668},{"type":70,"tag":92,"props":9901,"children":9903},{"id":9902},"c-critical-using-monolithic-openai-instead-of-openaitext",[9904],{"type":76,"value":9905},"c. CRITICAL: Using monolithic openai() instead of openaiText()",{"type":70,"tag":99,"props":9907,"children":9909},{"className":101,"code":9908,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG\nimport { openai } from '@tanstack\u002Fai-openai'\nchat({ adapter: openai(), model: 'gpt-5.5', messages })\n\n\u002F\u002F CORRECT\nimport { openaiText } from '@tanstack\u002Fai-openai'\nchat({ adapter: openaiText('gpt-5.5'), messages })\n",[9910],{"type":70,"tag":106,"props":9911,"children":9912},{"__ignoreMap":103},[9913,9920,9955,10026,10033,10040,10075],{"type":70,"tag":110,"props":9914,"children":9915},{"class":112,"line":113},[9916],{"type":70,"tag":110,"props":9917,"children":9918},{"style":117},[9919],{"type":76,"value":9279},{"type":70,"tag":110,"props":9921,"children":9922},{"class":112,"line":123},[9923,9927,9931,9935,9939,9943,9947,9951],{"type":70,"tag":110,"props":9924,"children":9925},{"style":127},[9926],{"type":76,"value":130},{"type":70,"tag":110,"props":9928,"children":9929},{"style":133},[9930],{"type":76,"value":136},{"type":70,"tag":110,"props":9932,"children":9933},{"style":139},[9934],{"type":76,"value":9331},{"type":70,"tag":110,"props":9936,"children":9937},{"style":133},[9938],{"type":76,"value":147},{"type":70,"tag":110,"props":9940,"children":9941},{"style":127},[9942],{"type":76,"value":152},{"type":70,"tag":110,"props":9944,"children":9945},{"style":133},[9946],{"type":76,"value":157},{"type":70,"tag":110,"props":9948,"children":9949},{"style":160},[9950],{"type":76,"value":250},{"type":70,"tag":110,"props":9952,"children":9953},{"style":133},[9954],{"type":76,"value":168},{"type":70,"tag":110,"props":9956,"children":9957},{"class":112,"line":171},[9958,9962,9966,9970,9974,9978,9982,9986,9990,9994,9998,10002,10006,10010,10014,10018,10022],{"type":70,"tag":110,"props":9959,"children":9960},{"style":292},[9961],{"type":76,"value":9843},{"type":70,"tag":110,"props":9963,"children":9964},{"style":139},[9965],{"type":76,"value":299},{"type":70,"tag":110,"props":9967,"children":9968},{"style":133},[9969],{"type":76,"value":1410},{"type":70,"tag":110,"props":9971,"children":9972},{"style":330},[9973],{"type":76,"value":9546},{"type":70,"tag":110,"props":9975,"children":9976},{"style":133},[9977],{"type":76,"value":338},{"type":70,"tag":110,"props":9979,"children":9980},{"style":292},[9981],{"type":76,"value":9331},{"type":70,"tag":110,"props":9983,"children":9984},{"style":139},[9985],{"type":76,"value":927},{"type":70,"tag":110,"props":9987,"children":9988},{"style":133},[9989],{"type":76,"value":190},{"type":70,"tag":110,"props":9991,"children":9992},{"style":330},[9993],{"type":76,"value":2980},{"type":70,"tag":110,"props":9995,"children":9996},{"style":133},[9997],{"type":76,"value":338},{"type":70,"tag":110,"props":9999,"children":10000},{"style":133},[10001],{"type":76,"value":157},{"type":70,"tag":110,"props":10003,"children":10004},{"style":160},[10005],{"type":76,"value":574},{"type":70,"tag":110,"props":10007,"children":10008},{"style":133},[10009],{"type":76,"value":304},{"type":70,"tag":110,"props":10011,"children":10012},{"style":133},[10013],{"type":76,"value":190},{"type":70,"tag":110,"props":10015,"children":10016},{"style":139},[10017],{"type":76,"value":9421},{"type":70,"tag":110,"props":10019,"children":10020},{"style":133},[10021],{"type":76,"value":754},{"type":70,"tag":110,"props":10023,"children":10024},{"style":139},[10025],{"type":76,"value":668},{"type":70,"tag":110,"props":10027,"children":10028},{"class":112,"line":219},[10029],{"type":70,"tag":110,"props":10030,"children":10031},{"emptyLinePlaceholder":261},[10032],{"type":76,"value":264},{"type":70,"tag":110,"props":10034,"children":10035},{"class":112,"line":257},[10036],{"type":70,"tag":110,"props":10037,"children":10038},{"style":117},[10039],{"type":76,"value":9444},{"type":70,"tag":110,"props":10041,"children":10042},{"class":112,"line":267},[10043,10047,10051,10055,10059,10063,10067,10071],{"type":70,"tag":110,"props":10044,"children":10045},{"style":127},[10046],{"type":76,"value":130},{"type":70,"tag":110,"props":10048,"children":10049},{"style":133},[10050],{"type":76,"value":136},{"type":70,"tag":110,"props":10052,"children":10053},{"style":139},[10054],{"type":76,"value":233},{"type":70,"tag":110,"props":10056,"children":10057},{"style":133},[10058],{"type":76,"value":147},{"type":70,"tag":110,"props":10060,"children":10061},{"style":127},[10062],{"type":76,"value":152},{"type":70,"tag":110,"props":10064,"children":10065},{"style":133},[10066],{"type":76,"value":157},{"type":70,"tag":110,"props":10068,"children":10069},{"style":160},[10070],{"type":76,"value":250},{"type":70,"tag":110,"props":10072,"children":10073},{"style":133},[10074],{"type":76,"value":168},{"type":70,"tag":110,"props":10076,"children":10077},{"class":112,"line":326},[10078,10082,10086,10090,10094,10098,10102,10106,10110,10114,10118,10122,10126,10130,10134],{"type":70,"tag":110,"props":10079,"children":10080},{"style":292},[10081],{"type":76,"value":9843},{"type":70,"tag":110,"props":10083,"children":10084},{"style":139},[10085],{"type":76,"value":299},{"type":70,"tag":110,"props":10087,"children":10088},{"style":133},[10089],{"type":76,"value":1410},{"type":70,"tag":110,"props":10091,"children":10092},{"style":330},[10093],{"type":76,"value":9546},{"type":70,"tag":110,"props":10095,"children":10096},{"style":133},[10097],{"type":76,"value":338},{"type":70,"tag":110,"props":10099,"children":10100},{"style":292},[10101],{"type":76,"value":233},{"type":70,"tag":110,"props":10103,"children":10104},{"style":139},[10105],{"type":76,"value":299},{"type":70,"tag":110,"props":10107,"children":10108},{"style":133},[10109],{"type":76,"value":304},{"type":70,"tag":110,"props":10111,"children":10112},{"style":160},[10113],{"type":76,"value":574},{"type":70,"tag":110,"props":10115,"children":10116},{"style":133},[10117],{"type":76,"value":304},{"type":70,"tag":110,"props":10119,"children":10120},{"style":139},[10121],{"type":76,"value":583},{"type":70,"tag":110,"props":10123,"children":10124},{"style":133},[10125],{"type":76,"value":190},{"type":70,"tag":110,"props":10127,"children":10128},{"style":139},[10129],{"type":76,"value":9421},{"type":70,"tag":110,"props":10131,"children":10132},{"style":133},[10133],{"type":76,"value":754},{"type":70,"tag":110,"props":10135,"children":10136},{"style":139},[10137],{"type":76,"value":668},{"type":70,"tag":79,"props":10139,"children":10140},{},[10141,10143,10149,10151,10157,10158,10164,10165,10171],{"type":76,"value":10142},"The monolithic ",{"type":70,"tag":106,"props":10144,"children":10146},{"className":10145},[],[10147],{"type":76,"value":10148},"openai()",{"type":76,"value":10150}," adapter is deprecated. Use tree-shakeable adapters:\n",{"type":70,"tag":106,"props":10152,"children":10154},{"className":10153},[],[10155],{"type":76,"value":10156},"openaiText()",{"type":76,"value":3219},{"type":70,"tag":106,"props":10159,"children":10161},{"className":10160},[],[10162],{"type":76,"value":10163},"openaiImage()",{"type":76,"value":3219},{"type":70,"tag":106,"props":10166,"children":10168},{"className":10167},[],[10169],{"type":76,"value":10170},"openaiSpeech()",{"type":76,"value":3227},{"type":70,"tag":92,"props":10173,"children":10175},{"id":10174},"d-high-using-toresponsestream-instead-of-toserversenteventsresponse",[10176],{"type":76,"value":10177},"d. HIGH: Using toResponseStream instead of toServerSentEventsResponse",{"type":70,"tag":99,"props":10179,"children":10181},{"className":101,"code":10180,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG\nimport { toResponseStream } from '@tanstack\u002Fai'\nreturn toResponseStream(stream, { abortController })\n\n\u002F\u002F CORRECT\nimport { toServerSentEventsResponse } from '@tanstack\u002Fai'\nreturn toServerSentEventsResponse(stream, { abortController })\n",[10182],{"type":70,"tag":106,"props":10183,"children":10184},{"__ignoreMap":103},[10185,10192,10228,10263,10270,10277,10312],{"type":70,"tag":110,"props":10186,"children":10187},{"class":112,"line":113},[10188],{"type":70,"tag":110,"props":10189,"children":10190},{"style":117},[10191],{"type":76,"value":9279},{"type":70,"tag":110,"props":10193,"children":10194},{"class":112,"line":123},[10195,10199,10203,10208,10212,10216,10220,10224],{"type":70,"tag":110,"props":10196,"children":10197},{"style":127},[10198],{"type":76,"value":130},{"type":70,"tag":110,"props":10200,"children":10201},{"style":133},[10202],{"type":76,"value":136},{"type":70,"tag":110,"props":10204,"children":10205},{"style":139},[10206],{"type":76,"value":10207}," toResponseStream",{"type":70,"tag":110,"props":10209,"children":10210},{"style":133},[10211],{"type":76,"value":147},{"type":70,"tag":110,"props":10213,"children":10214},{"style":127},[10215],{"type":76,"value":152},{"type":70,"tag":110,"props":10217,"children":10218},{"style":133},[10219],{"type":76,"value":157},{"type":70,"tag":110,"props":10221,"children":10222},{"style":160},[10223],{"type":76,"value":212},{"type":70,"tag":110,"props":10225,"children":10226},{"style":133},[10227],{"type":76,"value":168},{"type":70,"tag":110,"props":10229,"children":10230},{"class":112,"line":171},[10231,10235,10239,10243,10247,10251,10255,10259],{"type":70,"tag":110,"props":10232,"children":10233},{"style":127},[10234],{"type":76,"value":2641},{"type":70,"tag":110,"props":10236,"children":10237},{"style":292},[10238],{"type":76,"value":10207},{"type":70,"tag":110,"props":10240,"children":10241},{"style":139},[10242],{"type":76,"value":2650},{"type":70,"tag":110,"props":10244,"children":10245},{"style":133},[10246],{"type":76,"value":190},{"type":70,"tag":110,"props":10248,"children":10249},{"style":133},[10250],{"type":76,"value":136},{"type":70,"tag":110,"props":10252,"children":10253},{"style":139},[10254],{"type":76,"value":2663},{"type":70,"tag":110,"props":10256,"children":10257},{"style":133},[10258],{"type":76,"value":754},{"type":70,"tag":110,"props":10260,"children":10261},{"style":139},[10262],{"type":76,"value":668},{"type":70,"tag":110,"props":10264,"children":10265},{"class":112,"line":219},[10266],{"type":70,"tag":110,"props":10267,"children":10268},{"emptyLinePlaceholder":261},[10269],{"type":76,"value":264},{"type":70,"tag":110,"props":10271,"children":10272},{"class":112,"line":257},[10273],{"type":70,"tag":110,"props":10274,"children":10275},{"style":117},[10276],{"type":76,"value":9444},{"type":70,"tag":110,"props":10278,"children":10279},{"class":112,"line":267},[10280,10284,10288,10292,10296,10300,10304,10308],{"type":70,"tag":110,"props":10281,"children":10282},{"style":127},[10283],{"type":76,"value":130},{"type":70,"tag":110,"props":10285,"children":10286},{"style":133},[10287],{"type":76,"value":136},{"type":70,"tag":110,"props":10289,"children":10290},{"style":139},[10291],{"type":76,"value":195},{"type":70,"tag":110,"props":10293,"children":10294},{"style":133},[10295],{"type":76,"value":147},{"type":70,"tag":110,"props":10297,"children":10298},{"style":127},[10299],{"type":76,"value":152},{"type":70,"tag":110,"props":10301,"children":10302},{"style":133},[10303],{"type":76,"value":157},{"type":70,"tag":110,"props":10305,"children":10306},{"style":160},[10307],{"type":76,"value":212},{"type":70,"tag":110,"props":10309,"children":10310},{"style":133},[10311],{"type":76,"value":168},{"type":70,"tag":110,"props":10313,"children":10314},{"class":112,"line":326},[10315,10319,10323,10327,10331,10335,10339,10343],{"type":70,"tag":110,"props":10316,"children":10317},{"style":127},[10318],{"type":76,"value":2641},{"type":70,"tag":110,"props":10320,"children":10321},{"style":292},[10322],{"type":76,"value":195},{"type":70,"tag":110,"props":10324,"children":10325},{"style":139},[10326],{"type":76,"value":2650},{"type":70,"tag":110,"props":10328,"children":10329},{"style":133},[10330],{"type":76,"value":190},{"type":70,"tag":110,"props":10332,"children":10333},{"style":133},[10334],{"type":76,"value":136},{"type":70,"tag":110,"props":10336,"children":10337},{"style":139},[10338],{"type":76,"value":2663},{"type":70,"tag":110,"props":10340,"children":10341},{"style":133},[10342],{"type":76,"value":754},{"type":70,"tag":110,"props":10344,"children":10345},{"style":139},[10346],{"type":76,"value":668},{"type":70,"tag":92,"props":10348,"children":10350},{"id":10349},"e-high-passing-model-as-separate-parameter-to-chat",[10351],{"type":76,"value":10352},"e. HIGH: Passing model as separate parameter to chat()",{"type":70,"tag":99,"props":10354,"children":10356},{"className":101,"code":10355,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG\nchat({ adapter: openaiText(), model: 'gpt-5.5', messages })\n\n\u002F\u002F CORRECT\nchat({ adapter: openaiText('gpt-5.5'), messages })\n",[10357],{"type":70,"tag":106,"props":10358,"children":10359},{"__ignoreMap":103},[10360,10367,10438,10445,10452],{"type":70,"tag":110,"props":10361,"children":10362},{"class":112,"line":113},[10363],{"type":70,"tag":110,"props":10364,"children":10365},{"style":117},[10366],{"type":76,"value":9279},{"type":70,"tag":110,"props":10368,"children":10369},{"class":112,"line":123},[10370,10374,10378,10382,10386,10390,10394,10398,10402,10406,10410,10414,10418,10422,10426,10430,10434],{"type":70,"tag":110,"props":10371,"children":10372},{"style":292},[10373],{"type":76,"value":9843},{"type":70,"tag":110,"props":10375,"children":10376},{"style":139},[10377],{"type":76,"value":299},{"type":70,"tag":110,"props":10379,"children":10380},{"style":133},[10381],{"type":76,"value":1410},{"type":70,"tag":110,"props":10383,"children":10384},{"style":330},[10385],{"type":76,"value":9546},{"type":70,"tag":110,"props":10387,"children":10388},{"style":133},[10389],{"type":76,"value":338},{"type":70,"tag":110,"props":10391,"children":10392},{"style":292},[10393],{"type":76,"value":233},{"type":70,"tag":110,"props":10395,"children":10396},{"style":139},[10397],{"type":76,"value":927},{"type":70,"tag":110,"props":10399,"children":10400},{"style":133},[10401],{"type":76,"value":190},{"type":70,"tag":110,"props":10403,"children":10404},{"style":330},[10405],{"type":76,"value":2980},{"type":70,"tag":110,"props":10407,"children":10408},{"style":133},[10409],{"type":76,"value":338},{"type":70,"tag":110,"props":10411,"children":10412},{"style":133},[10413],{"type":76,"value":157},{"type":70,"tag":110,"props":10415,"children":10416},{"style":160},[10417],{"type":76,"value":574},{"type":70,"tag":110,"props":10419,"children":10420},{"style":133},[10421],{"type":76,"value":304},{"type":70,"tag":110,"props":10423,"children":10424},{"style":133},[10425],{"type":76,"value":190},{"type":70,"tag":110,"props":10427,"children":10428},{"style":139},[10429],{"type":76,"value":9421},{"type":70,"tag":110,"props":10431,"children":10432},{"style":133},[10433],{"type":76,"value":754},{"type":70,"tag":110,"props":10435,"children":10436},{"style":139},[10437],{"type":76,"value":668},{"type":70,"tag":110,"props":10439,"children":10440},{"class":112,"line":171},[10441],{"type":70,"tag":110,"props":10442,"children":10443},{"emptyLinePlaceholder":261},[10444],{"type":76,"value":264},{"type":70,"tag":110,"props":10446,"children":10447},{"class":112,"line":219},[10448],{"type":70,"tag":110,"props":10449,"children":10450},{"style":117},[10451],{"type":76,"value":9444},{"type":70,"tag":110,"props":10453,"children":10454},{"class":112,"line":257},[10455,10459,10463,10467,10471,10475,10479,10483,10487,10491,10495,10499,10503,10507,10511],{"type":70,"tag":110,"props":10456,"children":10457},{"style":292},[10458],{"type":76,"value":9843},{"type":70,"tag":110,"props":10460,"children":10461},{"style":139},[10462],{"type":76,"value":299},{"type":70,"tag":110,"props":10464,"children":10465},{"style":133},[10466],{"type":76,"value":1410},{"type":70,"tag":110,"props":10468,"children":10469},{"style":330},[10470],{"type":76,"value":9546},{"type":70,"tag":110,"props":10472,"children":10473},{"style":133},[10474],{"type":76,"value":338},{"type":70,"tag":110,"props":10476,"children":10477},{"style":292},[10478],{"type":76,"value":233},{"type":70,"tag":110,"props":10480,"children":10481},{"style":139},[10482],{"type":76,"value":299},{"type":70,"tag":110,"props":10484,"children":10485},{"style":133},[10486],{"type":76,"value":304},{"type":70,"tag":110,"props":10488,"children":10489},{"style":160},[10490],{"type":76,"value":574},{"type":70,"tag":110,"props":10492,"children":10493},{"style":133},[10494],{"type":76,"value":304},{"type":70,"tag":110,"props":10496,"children":10497},{"style":139},[10498],{"type":76,"value":583},{"type":70,"tag":110,"props":10500,"children":10501},{"style":133},[10502],{"type":76,"value":190},{"type":70,"tag":110,"props":10504,"children":10505},{"style":139},[10506],{"type":76,"value":9421},{"type":70,"tag":110,"props":10508,"children":10509},{"style":133},[10510],{"type":76,"value":754},{"type":70,"tag":110,"props":10512,"children":10513},{"style":139},[10514],{"type":76,"value":668},{"type":70,"tag":79,"props":10516,"children":10517},{},[10518,10520,10525],{"type":76,"value":10519},"The model is passed to the adapter factory, not to ",{"type":70,"tag":106,"props":10521,"children":10523},{"className":10522},[],[10524],{"type":76,"value":6667},{"type":76,"value":468},{"type":70,"tag":92,"props":10527,"children":10529},{"id":10528},"f-high-passing-sampling-options-at-the-root-of-chat",[10530],{"type":76,"value":10531},"f. HIGH: Passing sampling options at the root of chat()",{"type":70,"tag":79,"props":10533,"children":10534},{},[10535,10537,10543,10545,10551,10552,10558,10560,10564,10566,10571,10573,10578],{"type":76,"value":10536},"Sampling options (",{"type":70,"tag":106,"props":10538,"children":10540},{"className":10539},[],[10541],{"type":76,"value":10542},"temperature",{"type":76,"value":10544},", token limits, ",{"type":70,"tag":106,"props":10546,"children":10548},{"className":10547},[],[10549],{"type":76,"value":10550},"top_p",{"type":76,"value":1429},{"type":70,"tag":106,"props":10553,"children":10555},{"className":10554},[],[10556],{"type":76,"value":10557},"topP",{"type":76,"value":10559},") are ",{"type":70,"tag":1400,"props":10561,"children":10562},{},[10563],{"type":76,"value":8048},{"type":76,"value":10565},"\ntop-level fields on ",{"type":70,"tag":106,"props":10567,"children":10569},{"className":10568},[],[10570],{"type":76,"value":6667},{"type":76,"value":10572},". They live inside ",{"type":70,"tag":106,"props":10574,"children":10576},{"className":10575},[],[10577],{"type":76,"value":4214},{"type":76,"value":10579}," using the\nprovider's native key.",{"type":70,"tag":99,"props":10581,"children":10583},{"className":101,"code":10582,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG — temperature\u002FmaxTokens are not root options\nchat({ adapter, messages, temperature: 0.7, maxTokens: 1000 })\n\n\u002F\u002F WRONG — there is no `options` field either\nchat({ adapter, messages, options: { temperature: 0.7, maxTokens: 1000 } })\n\n\u002F\u002F CORRECT — inside modelOptions, provider-native keys (OpenAI shown)\nchat({\n  adapter,\n  messages,\n  modelOptions: { temperature: 0.7, max_output_tokens: 1000 },\n})\n",[10584],{"type":70,"tag":106,"props":10585,"children":10586},{"__ignoreMap":103},[10587,10595,10665,10672,10680,10764,10771,10779,10794,10805,10816,10864],{"type":70,"tag":110,"props":10588,"children":10589},{"class":112,"line":113},[10590],{"type":70,"tag":110,"props":10591,"children":10592},{"style":117},[10593],{"type":76,"value":10594},"\u002F\u002F WRONG — temperature\u002FmaxTokens are not root options\n",{"type":70,"tag":110,"props":10596,"children":10597},{"class":112,"line":123},[10598,10602,10606,10610,10614,10618,10622,10626,10631,10635,10639,10643,10648,10652,10657,10661],{"type":70,"tag":110,"props":10599,"children":10600},{"style":292},[10601],{"type":76,"value":9843},{"type":70,"tag":110,"props":10603,"children":10604},{"style":139},[10605],{"type":76,"value":299},{"type":70,"tag":110,"props":10607,"children":10608},{"style":133},[10609],{"type":76,"value":1410},{"type":70,"tag":110,"props":10611,"children":10612},{"style":139},[10613],{"type":76,"value":9546},{"type":70,"tag":110,"props":10615,"children":10616},{"style":133},[10617],{"type":76,"value":190},{"type":70,"tag":110,"props":10619,"children":10620},{"style":139},[10621],{"type":76,"value":494},{"type":70,"tag":110,"props":10623,"children":10624},{"style":133},[10625],{"type":76,"value":190},{"type":70,"tag":110,"props":10627,"children":10628},{"style":330},[10629],{"type":76,"value":10630}," temperature",{"type":70,"tag":110,"props":10632,"children":10633},{"style":133},[10634],{"type":76,"value":338},{"type":70,"tag":110,"props":10636,"children":10637},{"style":2527},[10638],{"type":76,"value":2530},{"type":70,"tag":110,"props":10640,"children":10641},{"style":133},[10642],{"type":76,"value":190},{"type":70,"tag":110,"props":10644,"children":10645},{"style":330},[10646],{"type":76,"value":10647}," maxTokens",{"type":70,"tag":110,"props":10649,"children":10650},{"style":133},[10651],{"type":76,"value":338},{"type":70,"tag":110,"props":10653,"children":10654},{"style":2527},[10655],{"type":76,"value":10656}," 1000",{"type":70,"tag":110,"props":10658,"children":10659},{"style":133},[10660],{"type":76,"value":147},{"type":70,"tag":110,"props":10662,"children":10663},{"style":139},[10664],{"type":76,"value":668},{"type":70,"tag":110,"props":10666,"children":10667},{"class":112,"line":171},[10668],{"type":70,"tag":110,"props":10669,"children":10670},{"emptyLinePlaceholder":261},[10671],{"type":76,"value":264},{"type":70,"tag":110,"props":10673,"children":10674},{"class":112,"line":219},[10675],{"type":70,"tag":110,"props":10676,"children":10677},{"style":117},[10678],{"type":76,"value":10679},"\u002F\u002F WRONG — there is no `options` field either\n",{"type":70,"tag":110,"props":10681,"children":10682},{"class":112,"line":257},[10683,10687,10691,10695,10699,10703,10707,10711,10716,10720,10724,10728,10732,10736,10740,10744,10748,10752,10756,10760],{"type":70,"tag":110,"props":10684,"children":10685},{"style":292},[10686],{"type":76,"value":9843},{"type":70,"tag":110,"props":10688,"children":10689},{"style":139},[10690],{"type":76,"value":299},{"type":70,"tag":110,"props":10692,"children":10693},{"style":133},[10694],{"type":76,"value":1410},{"type":70,"tag":110,"props":10696,"children":10697},{"style":139},[10698],{"type":76,"value":9546},{"type":70,"tag":110,"props":10700,"children":10701},{"style":133},[10702],{"type":76,"value":190},{"type":70,"tag":110,"props":10704,"children":10705},{"style":139},[10706],{"type":76,"value":494},{"type":70,"tag":110,"props":10708,"children":10709},{"style":133},[10710],{"type":76,"value":190},{"type":70,"tag":110,"props":10712,"children":10713},{"style":330},[10714],{"type":76,"value":10715}," options",{"type":70,"tag":110,"props":10717,"children":10718},{"style":133},[10719],{"type":76,"value":338},{"type":70,"tag":110,"props":10721,"children":10722},{"style":133},[10723],{"type":76,"value":136},{"type":70,"tag":110,"props":10725,"children":10726},{"style":330},[10727],{"type":76,"value":10630},{"type":70,"tag":110,"props":10729,"children":10730},{"style":133},[10731],{"type":76,"value":338},{"type":70,"tag":110,"props":10733,"children":10734},{"style":2527},[10735],{"type":76,"value":2530},{"type":70,"tag":110,"props":10737,"children":10738},{"style":133},[10739],{"type":76,"value":190},{"type":70,"tag":110,"props":10741,"children":10742},{"style":330},[10743],{"type":76,"value":10647},{"type":70,"tag":110,"props":10745,"children":10746},{"style":133},[10747],{"type":76,"value":338},{"type":70,"tag":110,"props":10749,"children":10750},{"style":2527},[10751],{"type":76,"value":10656},{"type":70,"tag":110,"props":10753,"children":10754},{"style":133},[10755],{"type":76,"value":147},{"type":70,"tag":110,"props":10757,"children":10758},{"style":133},[10759],{"type":76,"value":147},{"type":70,"tag":110,"props":10761,"children":10762},{"style":139},[10763],{"type":76,"value":668},{"type":70,"tag":110,"props":10765,"children":10766},{"class":112,"line":267},[10767],{"type":70,"tag":110,"props":10768,"children":10769},{"emptyLinePlaceholder":261},[10770],{"type":76,"value":264},{"type":70,"tag":110,"props":10772,"children":10773},{"class":112,"line":326},[10774],{"type":70,"tag":110,"props":10775,"children":10776},{"style":117},[10777],{"type":76,"value":10778},"\u002F\u002F CORRECT — inside modelOptions, provider-native keys (OpenAI shown)\n",{"type":70,"tag":110,"props":10780,"children":10781},{"class":112,"line":346},[10782,10786,10790],{"type":70,"tag":110,"props":10783,"children":10784},{"style":292},[10785],{"type":76,"value":9843},{"type":70,"tag":110,"props":10787,"children":10788},{"style":139},[10789],{"type":76,"value":299},{"type":70,"tag":110,"props":10791,"children":10792},{"style":133},[10793],{"type":76,"value":323},{"type":70,"tag":110,"props":10795,"children":10796},{"class":112,"line":363},[10797,10801],{"type":70,"tag":110,"props":10798,"children":10799},{"style":139},[10800],{"type":76,"value":2451},{"type":70,"tag":110,"props":10802,"children":10803},{"style":133},[10804],{"type":76,"value":588},{"type":70,"tag":110,"props":10806,"children":10807},{"class":112,"line":406},[10808,10812],{"type":70,"tag":110,"props":10809,"children":10810},{"style":139},[10811],{"type":76,"value":2492},{"type":70,"tag":110,"props":10813,"children":10814},{"style":133},[10815],{"type":76,"value":588},{"type":70,"tag":110,"props":10817,"children":10818},{"class":112,"line":440},[10819,10823,10827,10831,10835,10839,10843,10847,10852,10856,10860],{"type":70,"tag":110,"props":10820,"children":10821},{"style":330},[10822],{"type":76,"value":2504},{"type":70,"tag":110,"props":10824,"children":10825},{"style":133},[10826],{"type":76,"value":338},{"type":70,"tag":110,"props":10828,"children":10829},{"style":133},[10830],{"type":76,"value":136},{"type":70,"tag":110,"props":10832,"children":10833},{"style":330},[10834],{"type":76,"value":10630},{"type":70,"tag":110,"props":10836,"children":10837},{"style":133},[10838],{"type":76,"value":338},{"type":70,"tag":110,"props":10840,"children":10841},{"style":2527},[10842],{"type":76,"value":2530},{"type":70,"tag":110,"props":10844,"children":10845},{"style":133},[10846],{"type":76,"value":190},{"type":70,"tag":110,"props":10848,"children":10849},{"style":330},[10850],{"type":76,"value":10851}," max_output_tokens",{"type":70,"tag":110,"props":10853,"children":10854},{"style":133},[10855],{"type":76,"value":338},{"type":70,"tag":110,"props":10857,"children":10858},{"style":2527},[10859],{"type":76,"value":10656},{"type":70,"tag":110,"props":10861,"children":10862},{"style":133},[10863],{"type":76,"value":3001},{"type":70,"tag":110,"props":10865,"children":10866},{"class":112,"line":480},[10867,10871],{"type":70,"tag":110,"props":10868,"children":10869},{"style":133},[10870],{"type":76,"value":754},{"type":70,"tag":110,"props":10872,"children":10873},{"style":139},[10874],{"type":76,"value":668},{"type":70,"tag":79,"props":10876,"children":10877},{},[10878,10883,10885,10891,10893,10899,10901,10907,10909,10915,10917,10923,10925,10931,10933,10939],{"type":70,"tag":106,"props":10879,"children":10881},{"className":10880},[],[10882],{"type":76,"value":10542},{"type":76,"value":10884}," is universal across providers; token limits use provider-native\nkeys (",{"type":70,"tag":106,"props":10886,"children":10888},{"className":10887},[],[10889],{"type":76,"value":10890},"max_output_tokens",{"type":76,"value":10892}," for OpenAI, ",{"type":70,"tag":106,"props":10894,"children":10896},{"className":10895},[],[10897],{"type":76,"value":10898},"max_tokens",{"type":76,"value":10900}," for Anthropic\u002FGrok,\n",{"type":70,"tag":106,"props":10902,"children":10904},{"className":10903},[],[10905],{"type":76,"value":10906},"maxOutputTokens",{"type":76,"value":10908}," for Gemini, ",{"type":70,"tag":106,"props":10910,"children":10912},{"className":10911},[],[10913],{"type":76,"value":10914},"max_completion_tokens",{"type":76,"value":10916}," for Groq,\n",{"type":70,"tag":106,"props":10918,"children":10920},{"className":10919},[],[10921],{"type":76,"value":10922},"maxCompletionTokens",{"type":76,"value":10924}," for OpenRouter, and ",{"type":70,"tag":106,"props":10926,"children":10928},{"className":10927},[],[10929],{"type":76,"value":10930},"num_predict",{"type":76,"value":10932}," nested under\n",{"type":70,"tag":106,"props":10934,"children":10936},{"className":10935},[],[10937],{"type":76,"value":10938},"modelOptions.options",{"type":76,"value":10940}," for Ollama). See ai-core\u002Fadapter-configuration\u002FSKILL.md.",{"type":70,"tag":92,"props":10942,"children":10944},{"id":10943},"g-high-using-provideroptions-instead-of-modeloptions",[10945],{"type":76,"value":10946},"g. HIGH: Using providerOptions instead of modelOptions",{"type":70,"tag":99,"props":10948,"children":10950},{"className":101,"code":10949,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG\nchat({\n  adapter,\n  messages,\n  providerOptions: { responseFormat: { type: 'json_object' } },\n})\n\n\u002F\u002F CORRECT\nchat({\n  adapter,\n  messages,\n  modelOptions: { responseFormat: { type: 'json_object' } },\n})\n",[10951],{"type":70,"tag":106,"props":10952,"children":10953},{"__ignoreMap":103},[10954,10961,10976,10987,10998,11056,11067,11074,11081,11096,11107,11118,11173],{"type":70,"tag":110,"props":10955,"children":10956},{"class":112,"line":113},[10957],{"type":70,"tag":110,"props":10958,"children":10959},{"style":117},[10960],{"type":76,"value":9279},{"type":70,"tag":110,"props":10962,"children":10963},{"class":112,"line":123},[10964,10968,10972],{"type":70,"tag":110,"props":10965,"children":10966},{"style":292},[10967],{"type":76,"value":9843},{"type":70,"tag":110,"props":10969,"children":10970},{"style":139},[10971],{"type":76,"value":299},{"type":70,"tag":110,"props":10973,"children":10974},{"style":133},[10975],{"type":76,"value":323},{"type":70,"tag":110,"props":10977,"children":10978},{"class":112,"line":171},[10979,10983],{"type":70,"tag":110,"props":10980,"children":10981},{"style":139},[10982],{"type":76,"value":2451},{"type":70,"tag":110,"props":10984,"children":10985},{"style":133},[10986],{"type":76,"value":588},{"type":70,"tag":110,"props":10988,"children":10989},{"class":112,"line":219},[10990,10994],{"type":70,"tag":110,"props":10991,"children":10992},{"style":139},[10993],{"type":76,"value":2492},{"type":70,"tag":110,"props":10995,"children":10996},{"style":133},[10997],{"type":76,"value":588},{"type":70,"tag":110,"props":10999,"children":11000},{"class":112,"line":257},[11001,11006,11010,11014,11019,11023,11027,11031,11035,11039,11044,11048,11052],{"type":70,"tag":110,"props":11002,"children":11003},{"style":330},[11004],{"type":76,"value":11005},"  providerOptions",{"type":70,"tag":110,"props":11007,"children":11008},{"style":133},[11009],{"type":76,"value":338},{"type":70,"tag":110,"props":11011,"children":11012},{"style":133},[11013],{"type":76,"value":136},{"type":70,"tag":110,"props":11015,"children":11016},{"style":330},[11017],{"type":76,"value":11018}," responseFormat",{"type":70,"tag":110,"props":11020,"children":11021},{"style":133},[11022],{"type":76,"value":338},{"type":70,"tag":110,"props":11024,"children":11025},{"style":133},[11026],{"type":76,"value":136},{"type":70,"tag":110,"props":11028,"children":11029},{"style":330},[11030],{"type":76,"value":873},{"type":70,"tag":110,"props":11032,"children":11033},{"style":133},[11034],{"type":76,"value":338},{"type":70,"tag":110,"props":11036,"children":11037},{"style":133},[11038],{"type":76,"value":157},{"type":70,"tag":110,"props":11040,"children":11041},{"style":160},[11042],{"type":76,"value":11043},"json_object",{"type":70,"tag":110,"props":11045,"children":11046},{"style":133},[11047],{"type":76,"value":304},{"type":70,"tag":110,"props":11049,"children":11050},{"style":133},[11051],{"type":76,"value":147},{"type":70,"tag":110,"props":11053,"children":11054},{"style":133},[11055],{"type":76,"value":3001},{"type":70,"tag":110,"props":11057,"children":11058},{"class":112,"line":267},[11059,11063],{"type":70,"tag":110,"props":11060,"children":11061},{"style":133},[11062],{"type":76,"value":754},{"type":70,"tag":110,"props":11064,"children":11065},{"style":139},[11066],{"type":76,"value":668},{"type":70,"tag":110,"props":11068,"children":11069},{"class":112,"line":326},[11070],{"type":70,"tag":110,"props":11071,"children":11072},{"emptyLinePlaceholder":261},[11073],{"type":76,"value":264},{"type":70,"tag":110,"props":11075,"children":11076},{"class":112,"line":346},[11077],{"type":70,"tag":110,"props":11078,"children":11079},{"style":117},[11080],{"type":76,"value":9444},{"type":70,"tag":110,"props":11082,"children":11083},{"class":112,"line":363},[11084,11088,11092],{"type":70,"tag":110,"props":11085,"children":11086},{"style":292},[11087],{"type":76,"value":9843},{"type":70,"tag":110,"props":11089,"children":11090},{"style":139},[11091],{"type":76,"value":299},{"type":70,"tag":110,"props":11093,"children":11094},{"style":133},[11095],{"type":76,"value":323},{"type":70,"tag":110,"props":11097,"children":11098},{"class":112,"line":406},[11099,11103],{"type":70,"tag":110,"props":11100,"children":11101},{"style":139},[11102],{"type":76,"value":2451},{"type":70,"tag":110,"props":11104,"children":11105},{"style":133},[11106],{"type":76,"value":588},{"type":70,"tag":110,"props":11108,"children":11109},{"class":112,"line":440},[11110,11114],{"type":70,"tag":110,"props":11111,"children":11112},{"style":139},[11113],{"type":76,"value":2492},{"type":70,"tag":110,"props":11115,"children":11116},{"style":133},[11117],{"type":76,"value":588},{"type":70,"tag":110,"props":11119,"children":11120},{"class":112,"line":480},[11121,11125,11129,11133,11137,11141,11145,11149,11153,11157,11161,11165,11169],{"type":70,"tag":110,"props":11122,"children":11123},{"style":330},[11124],{"type":76,"value":2504},{"type":70,"tag":110,"props":11126,"children":11127},{"style":133},[11128],{"type":76,"value":338},{"type":70,"tag":110,"props":11130,"children":11131},{"style":133},[11132],{"type":76,"value":136},{"type":70,"tag":110,"props":11134,"children":11135},{"style":330},[11136],{"type":76,"value":11018},{"type":70,"tag":110,"props":11138,"children":11139},{"style":133},[11140],{"type":76,"value":338},{"type":70,"tag":110,"props":11142,"children":11143},{"style":133},[11144],{"type":76,"value":136},{"type":70,"tag":110,"props":11146,"children":11147},{"style":330},[11148],{"type":76,"value":873},{"type":70,"tag":110,"props":11150,"children":11151},{"style":133},[11152],{"type":76,"value":338},{"type":70,"tag":110,"props":11154,"children":11155},{"style":133},[11156],{"type":76,"value":157},{"type":70,"tag":110,"props":11158,"children":11159},{"style":160},[11160],{"type":76,"value":11043},{"type":70,"tag":110,"props":11162,"children":11163},{"style":133},[11164],{"type":76,"value":304},{"type":70,"tag":110,"props":11166,"children":11167},{"style":133},[11168],{"type":76,"value":147},{"type":70,"tag":110,"props":11170,"children":11171},{"style":133},[11172],{"type":76,"value":3001},{"type":70,"tag":110,"props":11174,"children":11175},{"class":112,"line":510},[11176,11180],{"type":70,"tag":110,"props":11177,"children":11178},{"style":133},[11179],{"type":76,"value":754},{"type":70,"tag":110,"props":11181,"children":11182},{"style":139},[11183],{"type":76,"value":668},{"type":70,"tag":92,"props":11185,"children":11187},{"id":11186},"h-high-implementing-custom-sse-stream-instead-of-using-toserversenteventsresponse",[11188],{"type":76,"value":11189},"h. HIGH: Implementing custom SSE stream instead of using toServerSentEventsResponse",{"type":70,"tag":99,"props":11191,"children":11193},{"className":101,"code":11192,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG\nconst readable = new ReadableStream({\n  async start(controller) {\n    const encoder = new TextEncoder()\n    for await (const chunk of stream) {\n      controller.enqueue(encoder.encode(`data: ${JSON.stringify(chunk)}\\n\\n`))\n    }\n    controller.enqueue(encoder.encode('data: [DONE]\\n\\n'))\n    controller.close()\n  },\n})\nreturn new Response(readable, {\n  headers: { 'Content-Type': 'text\u002Fevent-stream' },\n})\n\n\u002F\u002F CORRECT\nimport { toServerSentEventsResponse } from '@tanstack\u002Fai'\nreturn toServerSentEventsResponse(stream, { abortController })\n",[11194],{"type":70,"tag":106,"props":11195,"children":11196},{"__ignoreMap":103},[11197,11204,11237,11266,11296,11338,11428,11436,11493,11513,11520,11531,11560,11610,11621,11628,11635,11670],{"type":70,"tag":110,"props":11198,"children":11199},{"class":112,"line":113},[11200],{"type":70,"tag":110,"props":11201,"children":11202},{"style":117},[11203],{"type":76,"value":9279},{"type":70,"tag":110,"props":11205,"children":11206},{"class":112,"line":123},[11207,11211,11216,11220,11224,11229,11233],{"type":70,"tag":110,"props":11208,"children":11209},{"style":276},[11210],{"type":76,"value":2422},{"type":70,"tag":110,"props":11212,"children":11213},{"style":139},[11214],{"type":76,"value":11215}," readable ",{"type":70,"tag":110,"props":11217,"children":11218},{"style":133},[11219],{"type":76,"value":289},{"type":70,"tag":110,"props":11221,"children":11222},{"style":133},[11223],{"type":76,"value":427},{"type":70,"tag":110,"props":11225,"children":11226},{"style":292},[11227],{"type":76,"value":11228}," ReadableStream",{"type":70,"tag":110,"props":11230,"children":11231},{"style":139},[11232],{"type":76,"value":299},{"type":70,"tag":110,"props":11234,"children":11235},{"style":133},[11236],{"type":76,"value":323},{"type":70,"tag":110,"props":11238,"children":11239},{"class":112,"line":171},[11240,11245,11249,11253,11258,11262],{"type":70,"tag":110,"props":11241,"children":11242},{"style":276},[11243],{"type":76,"value":11244},"  async",{"type":70,"tag":110,"props":11246,"children":11247},{"style":330},[11248],{"type":76,"value":5781},{"type":70,"tag":110,"props":11250,"children":11251},{"style":133},[11252],{"type":76,"value":299},{"type":70,"tag":110,"props":11254,"children":11255},{"style":386},[11256],{"type":76,"value":11257},"controller",{"type":70,"tag":110,"props":11259,"children":11260},{"style":133},[11261],{"type":76,"value":583},{"type":70,"tag":110,"props":11263,"children":11264},{"style":133},[11265],{"type":76,"value":343},{"type":70,"tag":110,"props":11267,"children":11268},{"class":112,"line":219},[11269,11274,11279,11283,11287,11292],{"type":70,"tag":110,"props":11270,"children":11271},{"style":276},[11272],{"type":76,"value":11273},"    const",{"type":70,"tag":110,"props":11275,"children":11276},{"style":139},[11277],{"type":76,"value":11278}," encoder",{"type":70,"tag":110,"props":11280,"children":11281},{"style":133},[11282],{"type":76,"value":422},{"type":70,"tag":110,"props":11284,"children":11285},{"style":133},[11286],{"type":76,"value":427},{"type":70,"tag":110,"props":11288,"children":11289},{"style":292},[11290],{"type":76,"value":11291}," TextEncoder",{"type":70,"tag":110,"props":11293,"children":11294},{"style":330},[11295],{"type":76,"value":437},{"type":70,"tag":110,"props":11297,"children":11298},{"class":112,"line":257},[11299,11304,11308,11312,11316,11321,11326,11330,11334],{"type":70,"tag":110,"props":11300,"children":11301},{"style":127},[11302],{"type":76,"value":11303},"    for",{"type":70,"tag":110,"props":11305,"children":11306},{"style":127},[11307],{"type":76,"value":459},{"type":70,"tag":110,"props":11309,"children":11310},{"style":330},[11311],{"type":76,"value":1161},{"type":70,"tag":110,"props":11313,"children":11314},{"style":276},[11315],{"type":76,"value":2422},{"type":70,"tag":110,"props":11317,"children":11318},{"style":139},[11319],{"type":76,"value":11320}," chunk",{"type":70,"tag":110,"props":11322,"children":11323},{"style":133},[11324],{"type":76,"value":11325}," of",{"type":70,"tag":110,"props":11327,"children":11328},{"style":139},[11329],{"type":76,"value":528},{"type":70,"tag":110,"props":11331,"children":11332},{"style":330},[11333],{"type":76,"value":1341},{"type":70,"tag":110,"props":11335,"children":11336},{"style":133},[11337],{"type":76,"value":323},{"type":70,"tag":110,"props":11339,"children":11340},{"class":112,"line":267},[11341,11346,11350,11355,11359,11364,11368,11373,11377,11382,11387,11391,11396,11400,11405,11410,11414,11419,11423],{"type":70,"tag":110,"props":11342,"children":11343},{"style":139},[11344],{"type":76,"value":11345},"      controller",{"type":70,"tag":110,"props":11347,"children":11348},{"style":133},[11349],{"type":76,"value":468},{"type":70,"tag":110,"props":11351,"children":11352},{"style":292},[11353],{"type":76,"value":11354},"enqueue",{"type":70,"tag":110,"props":11356,"children":11357},{"style":330},[11358],{"type":76,"value":299},{"type":70,"tag":110,"props":11360,"children":11361},{"style":139},[11362],{"type":76,"value":11363},"encoder",{"type":70,"tag":110,"props":11365,"children":11366},{"style":133},[11367],{"type":76,"value":468},{"type":70,"tag":110,"props":11369,"children":11370},{"style":292},[11371],{"type":76,"value":11372},"encode",{"type":70,"tag":110,"props":11374,"children":11375},{"style":330},[11376],{"type":76,"value":299},{"type":70,"tag":110,"props":11378,"children":11379},{"style":133},[11380],{"type":76,"value":11381},"`",{"type":70,"tag":110,"props":11383,"children":11384},{"style":160},[11385],{"type":76,"value":11386},"data: ",{"type":70,"tag":110,"props":11388,"children":11389},{"style":133},[11390],{"type":76,"value":5463},{"type":70,"tag":110,"props":11392,"children":11393},{"style":139},[11394],{"type":76,"value":11395},"JSON",{"type":70,"tag":110,"props":11397,"children":11398},{"style":133},[11399],{"type":76,"value":468},{"type":70,"tag":110,"props":11401,"children":11402},{"style":292},[11403],{"type":76,"value":11404},"stringify",{"type":70,"tag":110,"props":11406,"children":11407},{"style":139},[11408],{"type":76,"value":11409},"(chunk)",{"type":70,"tag":110,"props":11411,"children":11412},{"style":133},[11413],{"type":76,"value":754},{"type":70,"tag":110,"props":11415,"children":11416},{"style":139},[11417],{"type":76,"value":11418},"\\n\\n",{"type":70,"tag":110,"props":11420,"children":11421},{"style":133},[11422],{"type":76,"value":11381},{"type":70,"tag":110,"props":11424,"children":11425},{"style":330},[11426],{"type":76,"value":11427},"))\n",{"type":70,"tag":110,"props":11429,"children":11430},{"class":112,"line":326},[11431],{"type":70,"tag":110,"props":11432,"children":11433},{"style":133},[11434],{"type":76,"value":11435},"    }\n",{"type":70,"tag":110,"props":11437,"children":11438},{"class":112,"line":346},[11439,11444,11448,11452,11456,11460,11464,11468,11472,11476,11481,11485,11489],{"type":70,"tag":110,"props":11440,"children":11441},{"style":139},[11442],{"type":76,"value":11443},"    controller",{"type":70,"tag":110,"props":11445,"children":11446},{"style":133},[11447],{"type":76,"value":468},{"type":70,"tag":110,"props":11449,"children":11450},{"style":292},[11451],{"type":76,"value":11354},{"type":70,"tag":110,"props":11453,"children":11454},{"style":330},[11455],{"type":76,"value":299},{"type":70,"tag":110,"props":11457,"children":11458},{"style":139},[11459],{"type":76,"value":11363},{"type":70,"tag":110,"props":11461,"children":11462},{"style":133},[11463],{"type":76,"value":468},{"type":70,"tag":110,"props":11465,"children":11466},{"style":292},[11467],{"type":76,"value":11372},{"type":70,"tag":110,"props":11469,"children":11470},{"style":330},[11471],{"type":76,"value":299},{"type":70,"tag":110,"props":11473,"children":11474},{"style":133},[11475],{"type":76,"value":304},{"type":70,"tag":110,"props":11477,"children":11478},{"style":160},[11479],{"type":76,"value":11480},"data: [DONE]",{"type":70,"tag":110,"props":11482,"children":11483},{"style":139},[11484],{"type":76,"value":11418},{"type":70,"tag":110,"props":11486,"children":11487},{"style":133},[11488],{"type":76,"value":304},{"type":70,"tag":110,"props":11490,"children":11491},{"style":330},[11492],{"type":76,"value":11427},{"type":70,"tag":110,"props":11494,"children":11495},{"class":112,"line":363},[11496,11500,11504,11509],{"type":70,"tag":110,"props":11497,"children":11498},{"style":139},[11499],{"type":76,"value":11443},{"type":70,"tag":110,"props":11501,"children":11502},{"style":133},[11503],{"type":76,"value":468},{"type":70,"tag":110,"props":11505,"children":11506},{"style":292},[11507],{"type":76,"value":11508},"close",{"type":70,"tag":110,"props":11510,"children":11511},{"style":330},[11512],{"type":76,"value":437},{"type":70,"tag":110,"props":11514,"children":11515},{"class":112,"line":406},[11516],{"type":70,"tag":110,"props":11517,"children":11518},{"style":133},[11519],{"type":76,"value":745},{"type":70,"tag":110,"props":11521,"children":11522},{"class":112,"line":440},[11523,11527],{"type":70,"tag":110,"props":11524,"children":11525},{"style":133},[11526],{"type":76,"value":754},{"type":70,"tag":110,"props":11528,"children":11529},{"style":139},[11530],{"type":76,"value":668},{"type":70,"tag":110,"props":11532,"children":11533},{"class":112,"line":480},[11534,11538,11542,11547,11552,11556],{"type":70,"tag":110,"props":11535,"children":11536},{"style":127},[11537],{"type":76,"value":2641},{"type":70,"tag":110,"props":11539,"children":11540},{"style":133},[11541],{"type":76,"value":427},{"type":70,"tag":110,"props":11543,"children":11544},{"style":292},[11545],{"type":76,"value":11546}," Response",{"type":70,"tag":110,"props":11548,"children":11549},{"style":139},[11550],{"type":76,"value":11551},"(readable",{"type":70,"tag":110,"props":11553,"children":11554},{"style":133},[11555],{"type":76,"value":190},{"type":70,"tag":110,"props":11557,"children":11558},{"style":133},[11559],{"type":76,"value":343},{"type":70,"tag":110,"props":11561,"children":11562},{"class":112,"line":510},[11563,11568,11572,11576,11580,11585,11589,11593,11597,11602,11606],{"type":70,"tag":110,"props":11564,"children":11565},{"style":330},[11566],{"type":76,"value":11567},"  headers",{"type":70,"tag":110,"props":11569,"children":11570},{"style":133},[11571],{"type":76,"value":338},{"type":70,"tag":110,"props":11573,"children":11574},{"style":133},[11575],{"type":76,"value":136},{"type":70,"tag":110,"props":11577,"children":11578},{"style":133},[11579],{"type":76,"value":157},{"type":70,"tag":110,"props":11581,"children":11582},{"style":330},[11583],{"type":76,"value":11584},"Content-Type",{"type":70,"tag":110,"props":11586,"children":11587},{"style":133},[11588],{"type":76,"value":304},{"type":70,"tag":110,"props":11590,"children":11591},{"style":133},[11592],{"type":76,"value":338},{"type":70,"tag":110,"props":11594,"children":11595},{"style":133},[11596],{"type":76,"value":157},{"type":70,"tag":110,"props":11598,"children":11599},{"style":160},[11600],{"type":76,"value":11601},"text\u002Fevent-stream",{"type":70,"tag":110,"props":11603,"children":11604},{"style":133},[11605],{"type":76,"value":304},{"type":70,"tag":110,"props":11607,"children":11608},{"style":133},[11609],{"type":76,"value":3001},{"type":70,"tag":110,"props":11611,"children":11612},{"class":112,"line":518},[11613,11617],{"type":70,"tag":110,"props":11614,"children":11615},{"style":133},[11616],{"type":76,"value":754},{"type":70,"tag":110,"props":11618,"children":11619},{"style":139},[11620],{"type":76,"value":668},{"type":70,"tag":110,"props":11622,"children":11623},{"class":112,"line":547},[11624],{"type":70,"tag":110,"props":11625,"children":11626},{"emptyLinePlaceholder":261},[11627],{"type":76,"value":264},{"type":70,"tag":110,"props":11629,"children":11630},{"class":112,"line":591},[11631],{"type":70,"tag":110,"props":11632,"children":11633},{"style":117},[11634],{"type":76,"value":9444},{"type":70,"tag":110,"props":11636,"children":11637},{"class":112,"line":604},[11638,11642,11646,11650,11654,11658,11662,11666],{"type":70,"tag":110,"props":11639,"children":11640},{"style":127},[11641],{"type":76,"value":130},{"type":70,"tag":110,"props":11643,"children":11644},{"style":133},[11645],{"type":76,"value":136},{"type":70,"tag":110,"props":11647,"children":11648},{"style":139},[11649],{"type":76,"value":195},{"type":70,"tag":110,"props":11651,"children":11652},{"style":133},[11653],{"type":76,"value":147},{"type":70,"tag":110,"props":11655,"children":11656},{"style":127},[11657],{"type":76,"value":152},{"type":70,"tag":110,"props":11659,"children":11660},{"style":133},[11661],{"type":76,"value":157},{"type":70,"tag":110,"props":11663,"children":11664},{"style":160},[11665],{"type":76,"value":212},{"type":70,"tag":110,"props":11667,"children":11668},{"style":133},[11669],{"type":76,"value":168},{"type":70,"tag":110,"props":11671,"children":11672},{"class":112,"line":644},[11673,11677,11681,11685,11689,11693,11697,11701],{"type":70,"tag":110,"props":11674,"children":11675},{"style":127},[11676],{"type":76,"value":2641},{"type":70,"tag":110,"props":11678,"children":11679},{"style":292},[11680],{"type":76,"value":195},{"type":70,"tag":110,"props":11682,"children":11683},{"style":139},[11684],{"type":76,"value":2650},{"type":70,"tag":110,"props":11686,"children":11687},{"style":133},[11688],{"type":76,"value":190},{"type":70,"tag":110,"props":11690,"children":11691},{"style":133},[11692],{"type":76,"value":136},{"type":70,"tag":110,"props":11694,"children":11695},{"style":139},[11696],{"type":76,"value":2663},{"type":70,"tag":110,"props":11698,"children":11699},{"style":133},[11700],{"type":76,"value":754},{"type":70,"tag":110,"props":11702,"children":11703},{"style":139},[11704],{"type":76,"value":668},{"type":70,"tag":79,"props":11706,"children":11707},{},[11708,11713],{"type":70,"tag":106,"props":11709,"children":11711},{"className":11710},[],[11712],{"type":76,"value":6549},{"type":76,"value":11714}," handles SSE formatting, abort signals,\nerror events (RUN_ERROR), and correct headers automatically.",{"type":70,"tag":92,"props":11716,"children":11718},{"id":11717},"i-high-implementing-custom-onendonfinish-callbacks-instead-of-middleware",[11719],{"type":76,"value":11720},"i. HIGH: Implementing custom onEnd\u002FonFinish callbacks instead of middleware",{"type":70,"tag":99,"props":11722,"children":11724},{"className":101,"code":11723,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG\nchat({\n  adapter,\n  messages,\n  onEnd: (result) => {\n    trackAnalytics(result)\n  },\n})\n\n\u002F\u002F CORRECT\nimport type { ChatMiddleware } from '@tanstack\u002Fai'\n\nconst analytics: ChatMiddleware = {\n  name: 'analytics',\n  onFinish(ctx, info) {\n    trackAnalytics({ reason: info.finishReason, iterations: ctx.iteration })\n  },\n  onUsage(ctx, usage) {\n    trackTokens(usage.totalTokens)\n  },\n}\n\nchat({ adapter, messages, middleware: [analytics] })\n",[11725],{"type":70,"tag":106,"props":11726,"children":11727},{"__ignoreMap":103},[11728,11735,11750,11761,11772,11805,11825,11832,11843,11850,11857,11897,11904,11932,11961,11994,12066,12073,12106,12136,12143,12150,12157],{"type":70,"tag":110,"props":11729,"children":11730},{"class":112,"line":113},[11731],{"type":70,"tag":110,"props":11732,"children":11733},{"style":117},[11734],{"type":76,"value":9279},{"type":70,"tag":110,"props":11736,"children":11737},{"class":112,"line":123},[11738,11742,11746],{"type":70,"tag":110,"props":11739,"children":11740},{"style":292},[11741],{"type":76,"value":9843},{"type":70,"tag":110,"props":11743,"children":11744},{"style":139},[11745],{"type":76,"value":299},{"type":70,"tag":110,"props":11747,"children":11748},{"style":133},[11749],{"type":76,"value":323},{"type":70,"tag":110,"props":11751,"children":11752},{"class":112,"line":171},[11753,11757],{"type":70,"tag":110,"props":11754,"children":11755},{"style":139},[11756],{"type":76,"value":2451},{"type":70,"tag":110,"props":11758,"children":11759},{"style":133},[11760],{"type":76,"value":588},{"type":70,"tag":110,"props":11762,"children":11763},{"class":112,"line":219},[11764,11768],{"type":70,"tag":110,"props":11765,"children":11766},{"style":139},[11767],{"type":76,"value":2492},{"type":70,"tag":110,"props":11769,"children":11770},{"style":133},[11771],{"type":76,"value":588},{"type":70,"tag":110,"props":11773,"children":11774},{"class":112,"line":257},[11775,11780,11784,11788,11793,11797,11801],{"type":70,"tag":110,"props":11776,"children":11777},{"style":292},[11778],{"type":76,"value":11779},"  onEnd",{"type":70,"tag":110,"props":11781,"children":11782},{"style":133},[11783],{"type":76,"value":338},{"type":70,"tag":110,"props":11785,"children":11786},{"style":133},[11787],{"type":76,"value":1161},{"type":70,"tag":110,"props":11789,"children":11790},{"style":386},[11791],{"type":76,"value":11792},"result",{"type":70,"tag":110,"props":11794,"children":11795},{"style":133},[11796],{"type":76,"value":583},{"type":70,"tag":110,"props":11798,"children":11799},{"style":276},[11800],{"type":76,"value":399},{"type":70,"tag":110,"props":11802,"children":11803},{"style":133},[11804],{"type":76,"value":343},{"type":70,"tag":110,"props":11806,"children":11807},{"class":112,"line":267},[11808,11813,11817,11821],{"type":70,"tag":110,"props":11809,"children":11810},{"style":292},[11811],{"type":76,"value":11812},"    trackAnalytics",{"type":70,"tag":110,"props":11814,"children":11815},{"style":330},[11816],{"type":76,"value":299},{"type":70,"tag":110,"props":11818,"children":11819},{"style":139},[11820],{"type":76,"value":11792},{"type":70,"tag":110,"props":11822,"children":11823},{"style":330},[11824],{"type":76,"value":668},{"type":70,"tag":110,"props":11826,"children":11827},{"class":112,"line":326},[11828],{"type":70,"tag":110,"props":11829,"children":11830},{"style":133},[11831],{"type":76,"value":745},{"type":70,"tag":110,"props":11833,"children":11834},{"class":112,"line":346},[11835,11839],{"type":70,"tag":110,"props":11836,"children":11837},{"style":133},[11838],{"type":76,"value":754},{"type":70,"tag":110,"props":11840,"children":11841},{"style":139},[11842],{"type":76,"value":668},{"type":70,"tag":110,"props":11844,"children":11845},{"class":112,"line":363},[11846],{"type":70,"tag":110,"props":11847,"children":11848},{"emptyLinePlaceholder":261},[11849],{"type":76,"value":264},{"type":70,"tag":110,"props":11851,"children":11852},{"class":112,"line":406},[11853],{"type":70,"tag":110,"props":11854,"children":11855},{"style":117},[11856],{"type":76,"value":9444},{"type":70,"tag":110,"props":11858,"children":11859},{"class":112,"line":440},[11860,11864,11868,11872,11877,11881,11885,11889,11893],{"type":70,"tag":110,"props":11861,"children":11862},{"style":127},[11863],{"type":76,"value":130},{"type":70,"tag":110,"props":11865,"children":11866},{"style":127},[11867],{"type":76,"value":873},{"type":70,"tag":110,"props":11869,"children":11870},{"style":133},[11871],{"type":76,"value":136},{"type":70,"tag":110,"props":11873,"children":11874},{"style":139},[11875],{"type":76,"value":11876}," ChatMiddleware",{"type":70,"tag":110,"props":11878,"children":11879},{"style":133},[11880],{"type":76,"value":147},{"type":70,"tag":110,"props":11882,"children":11883},{"style":127},[11884],{"type":76,"value":152},{"type":70,"tag":110,"props":11886,"children":11887},{"style":133},[11888],{"type":76,"value":157},{"type":70,"tag":110,"props":11890,"children":11891},{"style":160},[11892],{"type":76,"value":212},{"type":70,"tag":110,"props":11894,"children":11895},{"style":133},[11896],{"type":76,"value":168},{"type":70,"tag":110,"props":11898,"children":11899},{"class":112,"line":480},[11900],{"type":70,"tag":110,"props":11901,"children":11902},{"emptyLinePlaceholder":261},[11903],{"type":76,"value":264},{"type":70,"tag":110,"props":11905,"children":11906},{"class":112,"line":510},[11907,11911,11916,11920,11924,11928],{"type":70,"tag":110,"props":11908,"children":11909},{"style":276},[11910],{"type":76,"value":2422},{"type":70,"tag":110,"props":11912,"children":11913},{"style":139},[11914],{"type":76,"value":11915}," analytics",{"type":70,"tag":110,"props":11917,"children":11918},{"style":133},[11919],{"type":76,"value":338},{"type":70,"tag":110,"props":11921,"children":11922},{"style":1277},[11923],{"type":76,"value":11876},{"type":70,"tag":110,"props":11925,"children":11926},{"style":133},[11927],{"type":76,"value":422},{"type":70,"tag":110,"props":11929,"children":11930},{"style":133},[11931],{"type":76,"value":343},{"type":70,"tag":110,"props":11933,"children":11934},{"class":112,"line":518},[11935,11940,11944,11948,11953,11957],{"type":70,"tag":110,"props":11936,"children":11937},{"style":330},[11938],{"type":76,"value":11939},"  name",{"type":70,"tag":110,"props":11941,"children":11942},{"style":133},[11943],{"type":76,"value":338},{"type":70,"tag":110,"props":11945,"children":11946},{"style":133},[11947],{"type":76,"value":157},{"type":70,"tag":110,"props":11949,"children":11950},{"style":160},[11951],{"type":76,"value":11952},"analytics",{"type":70,"tag":110,"props":11954,"children":11955},{"style":133},[11956],{"type":76,"value":304},{"type":70,"tag":110,"props":11958,"children":11959},{"style":133},[11960],{"type":76,"value":588},{"type":70,"tag":110,"props":11962,"children":11963},{"class":112,"line":547},[11964,11968,11972,11977,11981,11986,11990],{"type":70,"tag":110,"props":11965,"children":11966},{"style":330},[11967],{"type":76,"value":3009},{"type":70,"tag":110,"props":11969,"children":11970},{"style":133},[11971],{"type":76,"value":299},{"type":70,"tag":110,"props":11973,"children":11974},{"style":386},[11975],{"type":76,"value":11976},"ctx",{"type":70,"tag":110,"props":11978,"children":11979},{"style":133},[11980],{"type":76,"value":190},{"type":70,"tag":110,"props":11982,"children":11983},{"style":386},[11984],{"type":76,"value":11985}," info",{"type":70,"tag":110,"props":11987,"children":11988},{"style":133},[11989],{"type":76,"value":583},{"type":70,"tag":110,"props":11991,"children":11992},{"style":133},[11993],{"type":76,"value":343},{"type":70,"tag":110,"props":11995,"children":11996},{"class":112,"line":591},[11997,12001,12005,12009,12014,12018,12022,12026,12031,12035,12040,12044,12049,12053,12058,12062],{"type":70,"tag":110,"props":11998,"children":11999},{"style":292},[12000],{"type":76,"value":11812},{"type":70,"tag":110,"props":12002,"children":12003},{"style":330},[12004],{"type":76,"value":299},{"type":70,"tag":110,"props":12006,"children":12007},{"style":133},[12008],{"type":76,"value":1410},{"type":70,"tag":110,"props":12010,"children":12011},{"style":330},[12012],{"type":76,"value":12013}," reason",{"type":70,"tag":110,"props":12015,"children":12016},{"style":133},[12017],{"type":76,"value":338},{"type":70,"tag":110,"props":12019,"children":12020},{"style":139},[12021],{"type":76,"value":11985},{"type":70,"tag":110,"props":12023,"children":12024},{"style":133},[12025],{"type":76,"value":468},{"type":70,"tag":110,"props":12027,"children":12028},{"style":139},[12029],{"type":76,"value":12030},"finishReason",{"type":70,"tag":110,"props":12032,"children":12033},{"style":133},[12034],{"type":76,"value":190},{"type":70,"tag":110,"props":12036,"children":12037},{"style":330},[12038],{"type":76,"value":12039}," iterations",{"type":70,"tag":110,"props":12041,"children":12042},{"style":133},[12043],{"type":76,"value":338},{"type":70,"tag":110,"props":12045,"children":12046},{"style":139},[12047],{"type":76,"value":12048}," ctx",{"type":70,"tag":110,"props":12050,"children":12051},{"style":133},[12052],{"type":76,"value":468},{"type":70,"tag":110,"props":12054,"children":12055},{"style":139},[12056],{"type":76,"value":12057},"iteration",{"type":70,"tag":110,"props":12059,"children":12060},{"style":133},[12061],{"type":76,"value":147},{"type":70,"tag":110,"props":12063,"children":12064},{"style":330},[12065],{"type":76,"value":668},{"type":70,"tag":110,"props":12067,"children":12068},{"class":112,"line":604},[12069],{"type":70,"tag":110,"props":12070,"children":12071},{"style":133},[12072],{"type":76,"value":745},{"type":70,"tag":110,"props":12074,"children":12075},{"class":112,"line":644},[12076,12081,12085,12089,12093,12098,12102],{"type":70,"tag":110,"props":12077,"children":12078},{"style":330},[12079],{"type":76,"value":12080},"  onUsage",{"type":70,"tag":110,"props":12082,"children":12083},{"style":133},[12084],{"type":76,"value":299},{"type":70,"tag":110,"props":12086,"children":12087},{"style":386},[12088],{"type":76,"value":11976},{"type":70,"tag":110,"props":12090,"children":12091},{"style":133},[12092],{"type":76,"value":190},{"type":70,"tag":110,"props":12094,"children":12095},{"style":386},[12096],{"type":76,"value":12097}," usage",{"type":70,"tag":110,"props":12099,"children":12100},{"style":133},[12101],{"type":76,"value":583},{"type":70,"tag":110,"props":12103,"children":12104},{"style":133},[12105],{"type":76,"value":343},{"type":70,"tag":110,"props":12107,"children":12108},{"class":112,"line":657},[12109,12114,12118,12123,12127,12132],{"type":70,"tag":110,"props":12110,"children":12111},{"style":292},[12112],{"type":76,"value":12113},"    trackTokens",{"type":70,"tag":110,"props":12115,"children":12116},{"style":330},[12117],{"type":76,"value":299},{"type":70,"tag":110,"props":12119,"children":12120},{"style":139},[12121],{"type":76,"value":12122},"usage",{"type":70,"tag":110,"props":12124,"children":12125},{"style":133},[12126],{"type":76,"value":468},{"type":70,"tag":110,"props":12128,"children":12129},{"style":139},[12130],{"type":76,"value":12131},"totalTokens",{"type":70,"tag":110,"props":12133,"children":12134},{"style":330},[12135],{"type":76,"value":668},{"type":70,"tag":110,"props":12137,"children":12138},{"class":112,"line":671},[12139],{"type":70,"tag":110,"props":12140,"children":12141},{"style":133},[12142],{"type":76,"value":745},{"type":70,"tag":110,"props":12144,"children":12145},{"class":112,"line":679},[12146],{"type":70,"tag":110,"props":12147,"children":12148},{"style":133},[12149],{"type":76,"value":1647},{"type":70,"tag":110,"props":12151,"children":12152},{"class":112,"line":721},[12153],{"type":70,"tag":110,"props":12154,"children":12155},{"emptyLinePlaceholder":261},[12156],{"type":76,"value":264},{"type":70,"tag":110,"props":12158,"children":12159},{"class":112,"line":730},[12160,12164,12168,12172,12176,12180,12184,12188,12193,12197,12202,12206],{"type":70,"tag":110,"props":12161,"children":12162},{"style":292},[12163],{"type":76,"value":9843},{"type":70,"tag":110,"props":12165,"children":12166},{"style":139},[12167],{"type":76,"value":299},{"type":70,"tag":110,"props":12169,"children":12170},{"style":133},[12171],{"type":76,"value":1410},{"type":70,"tag":110,"props":12173,"children":12174},{"style":139},[12175],{"type":76,"value":9546},{"type":70,"tag":110,"props":12177,"children":12178},{"style":133},[12179],{"type":76,"value":190},{"type":70,"tag":110,"props":12181,"children":12182},{"style":139},[12183],{"type":76,"value":494},{"type":70,"tag":110,"props":12185,"children":12186},{"style":133},[12187],{"type":76,"value":190},{"type":70,"tag":110,"props":12189,"children":12190},{"style":330},[12191],{"type":76,"value":12192}," middleware",{"type":70,"tag":110,"props":12194,"children":12195},{"style":133},[12196],{"type":76,"value":338},{"type":70,"tag":110,"props":12198,"children":12199},{"style":139},[12200],{"type":76,"value":12201}," [analytics] ",{"type":70,"tag":110,"props":12203,"children":12204},{"style":133},[12205],{"type":76,"value":754},{"type":70,"tag":110,"props":12207,"children":12208},{"style":139},[12209],{"type":76,"value":668},{"type":70,"tag":79,"props":12211,"children":12212},{},[12213,12218,12220,12226,12227,12232,12234,12240],{"type":70,"tag":106,"props":12214,"children":12216},{"className":12215},[],[12217],{"type":76,"value":6667},{"type":76,"value":12219}," has no ",{"type":70,"tag":106,"props":12221,"children":12223},{"className":12222},[],[12224],{"type":76,"value":12225},"onEnd",{"type":76,"value":1429},{"type":70,"tag":106,"props":12228,"children":12230},{"className":12229},[],[12231],{"type":76,"value":8658},{"type":76,"value":12233}," option. Use ",{"type":70,"tag":106,"props":12235,"children":12237},{"className":12236},[],[12238],{"type":76,"value":12239},"middleware",{"type":76,"value":12241}," for lifecycle events.\nSee also: ai-core\u002Fmiddleware\u002FSKILL.md.",{"type":70,"tag":92,"props":12243,"children":12245},{"id":12244},"j-high-importing-from-tanstackai-client-instead-of-framework-package",[12246],{"type":76,"value":12247},"j. HIGH: Importing from @tanstack\u002Fai-client instead of framework package",{"type":70,"tag":99,"props":12249,"children":12251},{"className":101,"code":12250,"language":45,"meta":103,"style":103},"\u002F\u002F WRONG\nimport { fetchServerSentEvents } from '@tanstack\u002Fai-client'\nimport { useChat } from '@tanstack\u002Fai-react'\n\n\u002F\u002F CORRECT\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n",[12252],{"type":70,"tag":106,"props":12253,"children":12254},{"__ignoreMap":103},[12255,12262,12297,12332,12339,12346],{"type":70,"tag":110,"props":12256,"children":12257},{"class":112,"line":113},[12258],{"type":70,"tag":110,"props":12259,"children":12260},{"style":117},[12261],{"type":76,"value":9279},{"type":70,"tag":110,"props":12263,"children":12264},{"class":112,"line":123},[12265,12269,12273,12277,12281,12285,12289,12293],{"type":70,"tag":110,"props":12266,"children":12267},{"style":127},[12268],{"type":76,"value":130},{"type":70,"tag":110,"props":12270,"children":12271},{"style":133},[12272],{"type":76,"value":136},{"type":70,"tag":110,"props":12274,"children":12275},{"style":139},[12276],{"type":76,"value":840},{"type":70,"tag":110,"props":12278,"children":12279},{"style":133},[12280],{"type":76,"value":147},{"type":70,"tag":110,"props":12282,"children":12283},{"style":127},[12284],{"type":76,"value":152},{"type":70,"tag":110,"props":12286,"children":12287},{"style":133},[12288],{"type":76,"value":157},{"type":70,"tag":110,"props":12290,"children":12291},{"style":160},[12292],{"type":76,"value":8671},{"type":70,"tag":110,"props":12294,"children":12295},{"style":133},[12296],{"type":76,"value":168},{"type":70,"tag":110,"props":12298,"children":12299},{"class":112,"line":171},[12300,12304,12308,12312,12316,12320,12324,12328],{"type":70,"tag":110,"props":12301,"children":12302},{"style":127},[12303],{"type":76,"value":130},{"type":70,"tag":110,"props":12305,"children":12306},{"style":133},[12307],{"type":76,"value":136},{"type":70,"tag":110,"props":12309,"children":12310},{"style":139},[12311],{"type":76,"value":831},{"type":70,"tag":110,"props":12313,"children":12314},{"style":133},[12315],{"type":76,"value":147},{"type":70,"tag":110,"props":12317,"children":12318},{"style":127},[12319],{"type":76,"value":152},{"type":70,"tag":110,"props":12321,"children":12322},{"style":133},[12323],{"type":76,"value":157},{"type":70,"tag":110,"props":12325,"children":12326},{"style":160},[12327],{"type":76,"value":857},{"type":70,"tag":110,"props":12329,"children":12330},{"style":133},[12331],{"type":76,"value":168},{"type":70,"tag":110,"props":12333,"children":12334},{"class":112,"line":219},[12335],{"type":70,"tag":110,"props":12336,"children":12337},{"emptyLinePlaceholder":261},[12338],{"type":76,"value":264},{"type":70,"tag":110,"props":12340,"children":12341},{"class":112,"line":257},[12342],{"type":70,"tag":110,"props":12343,"children":12344},{"style":117},[12345],{"type":76,"value":9444},{"type":70,"tag":110,"props":12347,"children":12348},{"class":112,"line":267},[12349,12353,12357,12361,12365,12369,12373,12377,12381,12385],{"type":70,"tag":110,"props":12350,"children":12351},{"style":127},[12352],{"type":76,"value":130},{"type":70,"tag":110,"props":12354,"children":12355},{"style":133},[12356],{"type":76,"value":136},{"type":70,"tag":110,"props":12358,"children":12359},{"style":139},[12360],{"type":76,"value":831},{"type":70,"tag":110,"props":12362,"children":12363},{"style":133},[12364],{"type":76,"value":190},{"type":70,"tag":110,"props":12366,"children":12367},{"style":139},[12368],{"type":76,"value":840},{"type":70,"tag":110,"props":12370,"children":12371},{"style":133},[12372],{"type":76,"value":147},{"type":70,"tag":110,"props":12374,"children":12375},{"style":127},[12376],{"type":76,"value":152},{"type":70,"tag":110,"props":12378,"children":12379},{"style":133},[12380],{"type":76,"value":157},{"type":70,"tag":110,"props":12382,"children":12383},{"style":160},[12384],{"type":76,"value":857},{"type":70,"tag":110,"props":12386,"children":12387},{"style":133},[12388],{"type":76,"value":168},{"type":70,"tag":79,"props":12390,"children":12391},{},[12392,12394,12399,12401,12406],{"type":76,"value":12393},"Framework packages re-export everything needed from ",{"type":70,"tag":106,"props":12395,"children":12397},{"className":12396},[],[12398],{"type":76,"value":8671},{"type":76,"value":12400},".\nImport from ",{"type":70,"tag":106,"props":12402,"children":12404},{"className":12403},[],[12405],{"type":76,"value":8671},{"type":76,"value":12407}," only in vanilla JS (no framework).",{"type":70,"tag":92,"props":12409,"children":12411},{"id":12410},"k-medium-not-handling-run_error-events-in-streaming-context",[12412],{"type":76,"value":12413},"k. MEDIUM: Not handling RUN_ERROR events in streaming context",{"type":70,"tag":79,"props":12415,"children":12416},{},[12417,12419,12425,12427,12432,12434,12439,12441,12447,12449,12454,12456,12461],{"type":76,"value":12418},"Streaming errors arrive as ",{"type":70,"tag":106,"props":12420,"children":12422},{"className":12421},[],[12423],{"type":76,"value":12424},"RUN_ERROR",{"type":76,"value":12426}," events in the stream, not as thrown\nexceptions. The ",{"type":70,"tag":106,"props":12428,"children":12430},{"className":12429},[],[12431],{"type":76,"value":7693},{"type":76,"value":12433}," hook surfaces these via the ",{"type":70,"tag":106,"props":12435,"children":12437},{"className":12436},[],[12438],{"type":76,"value":1716},{"type":76,"value":12440}," state and\n",{"type":70,"tag":106,"props":12442,"children":12444},{"className":12443},[],[12445],{"type":76,"value":12446},"onError",{"type":76,"value":12448}," callback. If you consume the stream manually (without ",{"type":70,"tag":106,"props":12450,"children":12452},{"className":12451},[],[12453],{"type":76,"value":7693},{"type":76,"value":12455},"),\ncheck for ",{"type":70,"tag":106,"props":12457,"children":12459},{"className":12458},[],[12460],{"type":76,"value":12424},{"type":76,"value":12462}," chunks:",{"type":70,"tag":99,"props":12464,"children":12466},{"className":101,"code":12465,"language":45,"meta":103,"style":103},"for await (const chunk of stream) {\n  if (chunk.type === 'RUN_ERROR') {\n    console.error('Stream error:', chunk.error.message)\n    break\n  }\n  if (chunk.type === 'TEXT_MESSAGE_CONTENT') {\n    process.stdout.write(chunk.delta)\n  }\n}\n",[12467],{"type":70,"tag":106,"props":12468,"children":12469},{"__ignoreMap":103},[12470,12509,12557,12616,12624,12631,12679,12726,12733],{"type":70,"tag":110,"props":12471,"children":12472},{"class":112,"line":113},[12473,12478,12482,12486,12490,12495,12500,12505],{"type":70,"tag":110,"props":12474,"children":12475},{"style":127},[12476],{"type":76,"value":12477},"for",{"type":70,"tag":110,"props":12479,"children":12480},{"style":127},[12481],{"type":76,"value":459},{"type":70,"tag":110,"props":12483,"children":12484},{"style":139},[12485],{"type":76,"value":1161},{"type":70,"tag":110,"props":12487,"children":12488},{"style":276},[12489],{"type":76,"value":2422},{"type":70,"tag":110,"props":12491,"children":12492},{"style":139},[12493],{"type":76,"value":12494}," chunk ",{"type":70,"tag":110,"props":12496,"children":12497},{"style":133},[12498],{"type":76,"value":12499},"of",{"type":70,"tag":110,"props":12501,"children":12502},{"style":139},[12503],{"type":76,"value":12504}," stream) ",{"type":70,"tag":110,"props":12506,"children":12507},{"style":133},[12508],{"type":76,"value":323},{"type":70,"tag":110,"props":12510,"children":12511},{"class":112,"line":123},[12512,12516,12520,12525,12529,12533,12537,12541,12545,12549,12553],{"type":70,"tag":110,"props":12513,"children":12514},{"style":127},[12515],{"type":76,"value":5933},{"type":70,"tag":110,"props":12517,"children":12518},{"style":330},[12519],{"type":76,"value":1161},{"type":70,"tag":110,"props":12521,"children":12522},{"style":139},[12523],{"type":76,"value":12524},"chunk",{"type":70,"tag":110,"props":12526,"children":12527},{"style":133},[12528],{"type":76,"value":468},{"type":70,"tag":110,"props":12530,"children":12531},{"style":139},[12532],{"type":76,"value":3619},{"type":70,"tag":110,"props":12534,"children":12535},{"style":133},[12536],{"type":76,"value":1916},{"type":70,"tag":110,"props":12538,"children":12539},{"style":133},[12540],{"type":76,"value":157},{"type":70,"tag":110,"props":12542,"children":12543},{"style":160},[12544],{"type":76,"value":12424},{"type":70,"tag":110,"props":12546,"children":12547},{"style":133},[12548],{"type":76,"value":304},{"type":70,"tag":110,"props":12550,"children":12551},{"style":330},[12552],{"type":76,"value":1341},{"type":70,"tag":110,"props":12554,"children":12555},{"style":133},[12556],{"type":76,"value":323},{"type":70,"tag":110,"props":12558,"children":12559},{"class":112,"line":171},[12560,12564,12568,12572,12576,12580,12584,12588,12592,12596,12600,12604,12608,12612],{"type":70,"tag":110,"props":12561,"children":12562},{"style":139},[12563],{"type":76,"value":3041},{"type":70,"tag":110,"props":12565,"children":12566},{"style":133},[12567],{"type":76,"value":468},{"type":70,"tag":110,"props":12569,"children":12570},{"style":292},[12571],{"type":76,"value":1716},{"type":70,"tag":110,"props":12573,"children":12574},{"style":330},[12575],{"type":76,"value":299},{"type":70,"tag":110,"props":12577,"children":12578},{"style":133},[12579],{"type":76,"value":304},{"type":70,"tag":110,"props":12581,"children":12582},{"style":160},[12583],{"type":76,"value":3156},{"type":70,"tag":110,"props":12585,"children":12586},{"style":133},[12587],{"type":76,"value":304},{"type":70,"tag":110,"props":12589,"children":12590},{"style":133},[12591],{"type":76,"value":190},{"type":70,"tag":110,"props":12593,"children":12594},{"style":139},[12595],{"type":76,"value":11320},{"type":70,"tag":110,"props":12597,"children":12598},{"style":133},[12599],{"type":76,"value":468},{"type":70,"tag":110,"props":12601,"children":12602},{"style":139},[12603],{"type":76,"value":1716},{"type":70,"tag":110,"props":12605,"children":12606},{"style":133},[12607],{"type":76,"value":468},{"type":70,"tag":110,"props":12609,"children":12610},{"style":139},[12611],{"type":76,"value":1450},{"type":70,"tag":110,"props":12613,"children":12614},{"style":330},[12615],{"type":76,"value":668},{"type":70,"tag":110,"props":12617,"children":12618},{"class":112,"line":219},[12619],{"type":70,"tag":110,"props":12620,"children":12621},{"style":127},[12622],{"type":76,"value":12623},"    break\n",{"type":70,"tag":110,"props":12625,"children":12626},{"class":112,"line":257},[12627],{"type":70,"tag":110,"props":12628,"children":12629},{"style":133},[12630],{"type":76,"value":1246},{"type":70,"tag":110,"props":12632,"children":12633},{"class":112,"line":267},[12634,12638,12642,12646,12650,12654,12658,12662,12667,12671,12675],{"type":70,"tag":110,"props":12635,"children":12636},{"style":127},[12637],{"type":76,"value":5933},{"type":70,"tag":110,"props":12639,"children":12640},{"style":330},[12641],{"type":76,"value":1161},{"type":70,"tag":110,"props":12643,"children":12644},{"style":139},[12645],{"type":76,"value":12524},{"type":70,"tag":110,"props":12647,"children":12648},{"style":133},[12649],{"type":76,"value":468},{"type":70,"tag":110,"props":12651,"children":12652},{"style":139},[12653],{"type":76,"value":3619},{"type":70,"tag":110,"props":12655,"children":12656},{"style":133},[12657],{"type":76,"value":1916},{"type":70,"tag":110,"props":12659,"children":12660},{"style":133},[12661],{"type":76,"value":157},{"type":70,"tag":110,"props":12663,"children":12664},{"style":160},[12665],{"type":76,"value":12666},"TEXT_MESSAGE_CONTENT",{"type":70,"tag":110,"props":12668,"children":12669},{"style":133},[12670],{"type":76,"value":304},{"type":70,"tag":110,"props":12672,"children":12673},{"style":330},[12674],{"type":76,"value":1341},{"type":70,"tag":110,"props":12676,"children":12677},{"style":133},[12678],{"type":76,"value":323},{"type":70,"tag":110,"props":12680,"children":12681},{"class":112,"line":326},[12682,12687,12691,12696,12700,12705,12709,12713,12717,12722],{"type":70,"tag":110,"props":12683,"children":12684},{"style":139},[12685],{"type":76,"value":12686},"    process",{"type":70,"tag":110,"props":12688,"children":12689},{"style":133},[12690],{"type":76,"value":468},{"type":70,"tag":110,"props":12692,"children":12693},{"style":139},[12694],{"type":76,"value":12695},"stdout",{"type":70,"tag":110,"props":12697,"children":12698},{"style":133},[12699],{"type":76,"value":468},{"type":70,"tag":110,"props":12701,"children":12702},{"style":292},[12703],{"type":76,"value":12704},"write",{"type":70,"tag":110,"props":12706,"children":12707},{"style":330},[12708],{"type":76,"value":299},{"type":70,"tag":110,"props":12710,"children":12711},{"style":139},[12712],{"type":76,"value":12524},{"type":70,"tag":110,"props":12714,"children":12715},{"style":133},[12716],{"type":76,"value":468},{"type":70,"tag":110,"props":12718,"children":12719},{"style":139},[12720],{"type":76,"value":12721},"delta",{"type":70,"tag":110,"props":12723,"children":12724},{"style":330},[12725],{"type":76,"value":668},{"type":70,"tag":110,"props":12727,"children":12728},{"class":112,"line":346},[12729],{"type":70,"tag":110,"props":12730,"children":12731},{"style":133},[12732],{"type":76,"value":1246},{"type":70,"tag":110,"props":12734,"children":12735},{"class":112,"line":363},[12736],{"type":70,"tag":110,"props":12737,"children":12738},{"style":133},[12739],{"type":76,"value":1647},{"type":70,"tag":79,"props":12741,"children":12742},{},[12743],{"type":76,"value":12744},"If not handled, the UI appears to hang with no feedback.",{"type":70,"tag":85,"props":12746,"children":12748},{"id":12747},"cross-references",[12749],{"type":76,"value":12750},"Cross-References",{"type":70,"tag":6770,"props":12752,"children":12753},{},[12754,12766,12777,12788],{"type":70,"tag":6774,"props":12755,"children":12756},{},[12757,12759,12764],{"type":76,"value":12758},"See also: ",{"type":70,"tag":1400,"props":12760,"children":12761},{},[12762],{"type":76,"value":12763},"ai-core\u002Ftool-calling\u002FSKILL.md",{"type":76,"value":12765}," -- Most chats include tools",{"type":70,"tag":6774,"props":12767,"children":12768},{},[12769,12770,12775],{"type":76,"value":12758},{"type":70,"tag":1400,"props":12771,"children":12772},{},[12773],{"type":76,"value":12774},"ai-core\u002Fadapter-configuration\u002FSKILL.md",{"type":76,"value":12776}," -- Adapter choice affects available features",{"type":70,"tag":6774,"props":12778,"children":12779},{},[12780,12781,12786],{"type":76,"value":12758},{"type":70,"tag":1400,"props":12782,"children":12783},{},[12784],{"type":76,"value":12785},"ai-core\u002Fmiddleware\u002FSKILL.md",{"type":76,"value":12787}," -- Use middleware for analytics and lifecycle events",{"type":70,"tag":6774,"props":12789,"children":12790},{},[12791,12792,12803,12804,12810],{"type":76,"value":12758},{"type":70,"tag":1400,"props":12793,"children":12794},{},[12795,12801],{"type":70,"tag":106,"props":12796,"children":12798},{"className":12797},[],[12799],{"type":76,"value":12800},"@tanstack\u002Fai-persistence",{"type":76,"value":12802}," skills",{"type":76,"value":1161},{"type":70,"tag":106,"props":12805,"children":12807},{"className":12806},[],[12808],{"type":76,"value":12809},"skills\u002Fai-persistence\u002FSKILL.md",{"type":76,"value":12811}," in that package) -- Server + client state persistence, store contracts, adapter recipes (deeper than Pattern 8)",{"type":70,"tag":12813,"props":12814,"children":12815},"style",{},[12816],{"type":76,"value":12817},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":12819,"total":1539},[12820,12838,12852,12866,12877,12884,12897],{"slug":12821,"name":12821,"fn":12822,"description":12823,"org":12824,"tags":12825,"stars":24,"repoUrl":25,"updatedAt":12837},"ai-code-mode","execute sandboxed TypeScript code with LLMs","LLM-generated TypeScript execution in sandboxed environments: createCodeModeTool() with isolate drivers (createNodeIsolateDriver, createQuickJSIsolateDriver, createCloudflareIsolateDriver), codeModeWithSkills() for persistent skill libraries, trust strategies, skill storage (FileSystem, LocalStorage, InMemory, Mongo), client-side execution progress via code_mode:* custom events in useChat.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12826,12828,12831,12834,12835],{"name":12827,"slug":32,"type":16},"AI SDK",{"name":12829,"slug":12830,"type":16},"Code Execution","code-execution",{"name":12832,"slug":12833,"type":16},"Sandboxing","sandboxing",{"name":10,"slug":9,"type":16},{"name":12836,"slug":45,"type":16},"TypeScript","2026-07-16T06:04:13.597905",{"slug":12839,"name":12839,"fn":12840,"description":12841,"org":12842,"tags":12843,"stars":24,"repoUrl":25,"updatedAt":12851},"ai-core","configure TanStack AI agent features","Entry point for TanStack AI skills. Routes to chat-experience, tool-calling, media-generation, structured-outputs, adapter-configuration, ag-ui-protocol, middleware, locks, custom-backend-integration, and debug-logging, plus the skills shipped by companion packages (@tanstack\u002Fai-persistence, @tanstack\u002Fai-code-mode). Use chat() not streamText(), openaiText() not createOpenAI(), toServerSentEventsResponse() not manual SSE, middleware hooks not onEnd callbacks.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12844,12847,12849],{"name":12845,"slug":12846,"type":16},"Agents","agents",{"name":12848,"slug":30,"type":16},"AI",{"name":12850,"slug":12239,"type":16},"Middleware","2026-07-30T05:26:10.404565",{"slug":12853,"name":12854,"fn":12855,"description":12856,"org":12857,"tags":12858,"stars":24,"repoUrl":25,"updatedAt":12865},"ai-coreadapter-configuration","ai-core\u002Fadapter-configuration","configure AI provider adapters","Provider adapter selection and configuration: openaiText, anthropicText, geminiText, ollamaText, grokText, groqText, openRouterText, bedrockText, openaiCompatible. Per-model type safety with modelOptions, reasoning\u002Fthinking configuration, runtime adapter switching, extendAdapter() for custom models, createModel(). Generic OpenAI-compatible providers (DeepSeek, Together, Fireworks, etc.) via openaiCompatible({ baseURL, apiKey, models }) from @tanstack\u002Fai-openai\u002Fcompatible. API key env vars: OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY\u002FGEMINI_API_KEY, XAI_API_KEY, GROQ_API_KEY, OPENROUTER_API_KEY, OLLAMA_HOST, BEDROCK_API_KEY (or AWS_BEARER_TOKEN_BEDROCK).\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12859,12860,12863,12864],{"name":12827,"slug":32,"type":16},{"name":12861,"slug":12862,"type":16},"Configuration","configuration",{"name":14,"slug":15,"type":16},{"name":10,"slug":9,"type":16},"2026-07-16T06:04:17.82075",{"slug":12867,"name":12868,"fn":12869,"description":12870,"org":12871,"tags":12872,"stars":24,"repoUrl":25,"updatedAt":12876},"ai-coreag-ui-protocol","ai-core\u002Fag-ui-protocol","implement TanStack AI streaming protocol","Server-side AG-UI streaming protocol implementation: StreamChunk event types (RUN_STARTED, TEXT_MESSAGE_START\u002FCONTENT\u002FEND, TOOL_CALL_START\u002FARGS\u002FEND, RUN_FINISHED, RUN_ERROR, STEP_STARTED\u002FSTEP_FINISHED, STATE_SNAPSHOT\u002FDELTA, CUSTOM), toServerSentEventsStream() for SSE format, toHttpStream() for NDJSON format. For backends serving AG-UI events without client packages.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12873,12874,12875],{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},{"name":10,"slug":9,"type":16},"2026-07-16T06:04:10.093367",{"slug":4,"name":5,"fn":6,"description":7,"org":12878,"tags":12879,"stars":24,"repoUrl":25,"updatedAt":26},{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12880,12881,12882,12883],{"name":18,"slug":19,"type":16},{"name":22,"slug":23,"type":16},{"name":14,"slug":15,"type":16},{"name":10,"slug":9,"type":16},{"slug":12885,"name":12886,"fn":12887,"description":12888,"org":12889,"tags":12890,"stars":24,"repoUrl":25,"updatedAt":12896},"ai-coreclient-persistence","ai-core\u002Fclient-persistence","implement browser chat persistence for TanStack AI","Browser chat persistence on useChat \u002F ChatClient: localStoragePersistence, sessionStoragePersistence, indexedDBPersistence. Client-authoritative (adapter, full transcript) vs server-authoritative (persistence: true, no client cache). Reload restore, pending interrupts, mid-stream rejoin with delivery durability. Use for SPA reload durability — NOT server history alone. No extra package: the adapters ship in the framework packages.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12891,12892,12893,12895],{"name":12848,"slug":30,"type":16},{"name":22,"slug":23,"type":16},{"name":12894,"slug":8607,"type":16},"Persistence",{"name":10,"slug":9,"type":16},"2026-07-30T05:53:35.503176",{"slug":12898,"name":12899,"fn":12900,"description":12901,"org":12902,"tags":12903,"stars":24,"repoUrl":25,"updatedAt":12910},"ai-corecustom-backend-integration","ai-core\u002Fcustom-backend-integration","integrate custom backends with TanStack AI","Connect useChat to a non-TanStack-AI backend through custom connection adapters. ConnectConnectionAdapter (single async iterable) vs SubscribeConnectionAdapter (separate subscribe\u002Fsend). Customize fetchServerSentEvents() and fetchHttpStream() with auth headers, custom URLs, and request options. Import from framework package, not @tanstack\u002Fai-client.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12904,12905,12906,12909],{"name":12848,"slug":30,"type":16},{"name":18,"slug":19,"type":16},{"name":12907,"slug":12908,"type":16},"Backend","backend",{"name":10,"slug":9,"type":16},"2026-07-17T06:06:39.855351",{"items":12912,"total":13052},[12913,12927,12939,12951,12966,12978,12988,12998,13011,13021,13032,13042],{"slug":12914,"name":12914,"fn":12915,"description":12916,"org":12917,"tags":12918,"stars":12924,"repoUrl":12925,"updatedAt":12926},"aggregation","perform data aggregation in TanStack Table","Aggregate TanStack Table columns independently of grouping, including grand totals, caller-selected row totals, multiple keyed aggregations, custom context-based definitions, grouped merges, manual values, and worker constraints.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12919,12922,12923],{"name":12920,"slug":12921,"type":16},"Data Analysis","data-analysis",{"name":22,"slug":23,"type":16},{"name":10,"slug":9,"type":16},28175,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Ftable","2026-07-30T05:25:59.429787",{"slug":12928,"name":12928,"fn":12929,"description":12930,"org":12931,"tags":12932,"stars":12924,"repoUrl":12925,"updatedAt":12938},"api-not-found","diagnose TanStack Table API errors","Diagnose missing TanStack Table v9 exports, options, state slices, and instance methods. Load before inventing an API when code sees a type error, undefined feature method, absent object key, adapter mismatch, or v8-shaped example.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12933,12936,12937],{"name":12934,"slug":12935,"type":16},"Debugging","debugging",{"name":22,"slug":23,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:26:05.418735",{"slug":12940,"name":12940,"fn":12941,"description":12942,"org":12943,"tags":12944,"stars":12924,"repoUrl":12925,"updatedAt":12950},"cell-selection","select rectangular cell ranges in tables","Select rectangular cell ranges with cellSelectionFeature: two-corner range state keyed by row and column id, mousedown\u002Fmouseenter handlers, selection edges, render-order resolution under pinning, and autoResetCellSelection. Load when ranges widen unexpectedly after sorting or column reordering, when a drag re-renders the whole table, or when building copy-to-clipboard from a selection.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12945,12946,12947],{"name":12920,"slug":12921,"type":16},{"name":10,"slug":9,"type":16},{"name":12948,"slug":12949,"type":16},"UI Components","ui-components","2026-07-30T05:25:38.403427",{"slug":12952,"name":12952,"fn":12953,"description":12954,"org":12955,"tags":12956,"stars":12924,"repoUrl":12925,"updatedAt":12965},"client-vs-server","manage TanStack Table data pipelines","Choose client or server ownership for filtering, grouping, sorting, expanding, and pagination in TanStack Table v9. Load for manual* flags, mixed pipelines, server counts, or deciding which dataset each row-model stage receives.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12957,12960,12961,12964],{"name":12958,"slug":12959,"type":16},"Data Pipeline","data-pipeline",{"name":22,"slug":23,"type":16},{"name":12962,"slug":12963,"type":16},"Performance","performance",{"name":10,"slug":9,"type":16},"2026-07-30T05:25:45.400104",{"slug":12967,"name":12967,"fn":12968,"description":12969,"org":12970,"tags":12971,"stars":12924,"repoUrl":12925,"updatedAt":12977},"column-faceting","build faceted filter UIs","Build faceted filter UIs with columnFacetingFeature, facetedRowModel, facetedUniqueValues, and facetedMinMaxValues. Load for facet counts, numeric ranges, own-filter exclusion, or server-page facet completeness.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12972,12975,12976],{"name":12973,"slug":12974,"type":16},"Data Visualization","data-visualization",{"name":22,"slug":23,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:25:41.397257",{"slug":12979,"name":12979,"fn":12980,"description":12981,"org":12982,"tags":12983,"stars":12924,"repoUrl":12925,"updatedAt":12987},"column-filtering","implement column filtering in TanStack Table","Filter columns with columnFilteringFeature, filteredRowModel, filterFns, filterMeta, nested-row direction, and manualFiltering. Load for accessor compatibility, controlled filter updaters, fuzzy metadata, or client\u002Fserver ownership.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12984,12985,12986],{"name":12920,"slug":12921,"type":16},{"name":22,"slug":23,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:25:53.391632",{"slug":12989,"name":12989,"fn":12990,"description":12991,"org":12992,"tags":12993,"stars":12924,"repoUrl":12925,"updatedAt":12997},"column-ordering","manage TanStack Table column ordering","Control TanStack Table v9 leaf columnOrder with stable IDs while accounting for pinning regions, visibility, and groupedColumnMode precedence. Load for drag-and-drop columns or rendered order that differs from state.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[12994,12995,12996],{"name":22,"slug":23,"type":16},{"name":10,"slug":9,"type":16},{"name":12948,"slug":12949,"type":16},"2026-07-30T05:26:03.37801",{"slug":12999,"name":12999,"fn":13000,"description":13001,"org":13002,"tags":13003,"stars":12924,"repoUrl":12925,"updatedAt":13010},"column-pinning","configure column pinning in TanStack Table","Pin columns into logical start, center, and end regions with columnPinningFeature and renderer-owned sticky CSS. Load for RTL offsets, z-index, backgrounds, overflow, widths, gaps, or overlaps.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[13004,13007,13008,13009],{"name":13005,"slug":13006,"type":16},"CSS","css",{"name":22,"slug":23,"type":16},{"name":10,"slug":9,"type":16},{"name":12948,"slug":12949,"type":16},"2026-07-30T05:25:55.377366",{"slug":13012,"name":13012,"fn":13013,"description":13014,"org":13015,"tags":13016,"stars":12924,"repoUrl":12925,"updatedAt":13020},"column-resizing","implement column resizing in TanStack Table","Wire columnResizingFeature, header.getResizeHandler, resize mode and direction, pointer or touch events, and performant CSS-variable updates. Load when resize state changes but widths do not, or large tables resize slowly.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[13017,13018,13019],{"name":22,"slug":23,"type":16},{"name":10,"slug":9,"type":16},{"name":12948,"slug":12949,"type":16},"2026-07-30T05:25:51.400011",{"slug":13022,"name":13022,"fn":13023,"description":13024,"org":13025,"tags":13026,"stars":12924,"repoUrl":12925,"updatedAt":13031},"column-sizing","configure column sizing in TanStack Table","Use columnSizingFeature numeric size, minSize, maxSize, getSize, getStart, getAfter, and total-size APIs in table, grid, or flex CSS. Load for auto or percentage misconceptions and sizing\u002Fpinning layout mismatch.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[13027,13028,13029,13030],{"name":13005,"slug":13006,"type":16},{"name":22,"slug":23,"type":16},{"name":10,"slug":9,"type":16},{"name":12948,"slug":12949,"type":16},"2026-07-30T05:25:48.703799",{"slug":13033,"name":13033,"fn":13034,"description":13035,"org":13036,"tags":13037,"stars":12924,"repoUrl":12925,"updatedAt":13041},"column-visibility","manage column visibility in TanStack Table","Hide columns with columnVisibilityFeature while rendering visibility-aware header, column, and cell collections. Load when hidden columns remain in the DOM, false-versus-absent state is confused, or enableHiding is misunderstood.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[13038,13039,13040],{"name":22,"slug":23,"type":16},{"name":10,"slug":9,"type":16},{"name":12948,"slug":12949,"type":16},"2026-07-30T05:25:47.367943",{"slug":13043,"name":13043,"fn":13044,"description":13045,"org":13046,"tags":13047,"stars":12924,"repoUrl":12925,"updatedAt":13051},"core","build data grids with TanStack Table","Use TanStack Table v9 as a headless data-grid state and row-processing engine. Load for first-table architecture, stable data and columns, row numbering with getDisplayIndex, semantic rendering, framework adapter choice, or deciding what Table owns versus the renderer.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[13048,13049,13050],{"name":12920,"slug":12921,"type":16},{"name":22,"slug":23,"type":16},{"name":12948,"slug":12949,"type":16},"2026-07-30T05:25:52.366295",125]