[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-tanstack-ai-corecustom-backend-integration":3,"mdc-t3o7hr-key":53,"related-org-tanstack-ai-corecustom-backend-integration":7988,"related-repo-tanstack-ai-corecustom-backend-integration":8132},{"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-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},"tanstack","TanStack","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftanstack.png",[13,17,20,23],{"name":14,"slug":15,"type":16},"Backend","backend","tag",{"name":18,"slug":19,"type":16},"AI","ai",{"name":21,"slug":22,"type":16},"API Development","api-development",{"name":10,"slug":9,"type":16},2884,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Fai","2026-07-17T06:06:39.855351",null,269,[19,30,31,32,33,34,35,36,37,38,39,40,41,42,43,9,44,45,46,47],"ai-agents","ai-sdk","anthropic","chatbot","function-calling","gemini","generative-ai","llm","multimodal","openai","react","solidjs","streaming","svelte","tool-calling","typescript","typescript-sdk","vue",{"repoUrl":25,"stars":24,"forks":28,"topics":49,"description":50},[19,30,31,32,33,34,35,36,37,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\u002Fcustom-backend-integration","---\nname: ai-core\u002Fcustom-backend-integration\ndescription: >\n  Connect useChat to a non-TanStack-AI backend through custom connection\n  adapters. ConnectConnectionAdapter (single async iterable) vs\n  SubscribeConnectionAdapter (separate subscribe\u002Fsend). Customize\n  fetchServerSentEvents() and fetchHttpStream() with auth headers,\n  custom URLs, and request options. Import from framework package,\n  not @tanstack\u002Fai-client.\ntype: composition\nlibrary: tanstack-ai\nlibrary_version: '0.10.0'\nsources:\n  - 'TanStack\u002Fai:docs\u002Fchat\u002Fconnection-adapters.md'\n---\n\n# Custom Backend Integration\n\nThis skill builds on ai-core and ai-core\u002Fchat-experience. Read them first.\n\n## Setup\n\nConnect `useChat` to a custom SSE backend with auth headers:\n\n```typescript\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nfunction Chat() {\n  const { messages, sendMessage, isLoading } = useChat({\n    connection: fetchServerSentEvents('https:\u002F\u002Fmy-api.com\u002Fchat', {\n      headers: {\n        Authorization: `Bearer ${token}`,\n      },\n    }),\n  })\n\n  return (\n    \u003Cdiv>\n      {messages.map((msg) => (\n        \u003Cdiv key={msg.id}>\n          \u003Cstrong>{msg.role}:\u003C\u002Fstrong>\n          {msg.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      \u003Cbutton onClick={() => sendMessage('Hello')}>Send\u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n  )\n}\n```\n\nBoth `fetchServerSentEvents` and `fetchHttpStream` accept a static URL string\nor a function returning a string (evaluated per request), and a static options\nobject or a sync\u002Fasync function returning options (also evaluated per request).\nThis allows dynamic auth tokens and URLs without re-creating the adapter.\n\n## Core Patterns\n\n### 1. Custom SSE Backend with fetchServerSentEvents\n\nUse when your backend speaks SSE (`text\u002Fevent-stream`) with `data: {json}\\n\\n`\nframing. This is the recommended default.\n\n**Static options:**\n\n```typescript\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchServerSentEvents('https:\u002F\u002Fmy-api.com\u002Fchat', {\n    headers: {\n      Authorization: `Bearer ${token}`,\n      'X-Tenant-Id': tenantId,\n    },\n    credentials: 'include',\n  }),\n})\n```\n\n**Dynamic URL and options (evaluated per request):**\n\n```typescript\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchServerSentEvents(\n    () => `https:\u002F\u002Fmy-api.com\u002Fchat?session=${sessionId}`,\n    async () => ({\n      headers: {\n        Authorization: `Bearer ${await getAccessToken()}`,\n      },\n      body: {\n        provider: 'openai',\n        model: 'gpt-4o',\n      },\n    }),\n  ),\n})\n```\n\nThe `body` field in options is merged into the POST request body alongside\n`messages` and `data`, so the server receives `{ messages, data, provider, model }`.\n\n**Custom fetch client (for proxies, interceptors, retries):**\n\n```typescript\nimport { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat', {\n    fetchClient: myCustomFetch,\n  }),\n})\n```\n\n### 2. Custom NDJSON Backend with fetchHttpStream\n\nUse when your backend sends newline-delimited JSON (`application\u002Fx-ndjson`)\ninstead of SSE. Each line is one JSON-encoded `StreamChunk` followed by `\\n`.\n\n```typescript\nimport { useChat, fetchHttpStream } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchHttpStream('https:\u002F\u002Fmy-api.com\u002Fchat', {\n    headers: {\n      Authorization: `Bearer ${token}`,\n    },\n  }),\n})\n```\n\n`fetchHttpStream` accepts the same URL and options signatures as\n`fetchServerSentEvents` (static or dynamic, sync or async). The only difference\nis the parsing: no `data:` prefix stripping, no `[DONE]` sentinel -- just one\nJSON object per line.\n\n**Dynamic options work identically:**\n\n```typescript\nimport { useChat, fetchHttpStream } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchHttpStream(\n    () => `\u002Fapi\u002Fchat?region=${region}`,\n    async () => ({\n      headers: { Authorization: `Bearer ${await refreshToken()}` },\n    }),\n  ),\n})\n```\n\n### 3. Fully Custom Connection Adapter\n\nFor protocols that don't fit SSE or NDJSON (WebSockets, gRPC-web, custom binary,\nserver functions), implement the `ConnectionAdapter` interface directly.\n\nThere are two mutually exclusive modes:\n\n**ConnectConnectionAdapter (pull-based \u002F async iterable):**\n\nUse when the client initiates a request and consumes the response as a stream.\nThis is the simpler model and covers most HTTP-based protocols.\n\n```typescript\nimport { useChat } from '@tanstack\u002Fai-react'\nimport type { ConnectionAdapter } from '@tanstack\u002Fai-react'\nimport type { StreamChunk, UIMessage } from '@tanstack\u002Fai'\n\nconst websocketAdapter: ConnectionAdapter = {\n  async *connect(\n    messages: Array\u003CUIMessage>,\n    data?: Record\u003Cstring, any>,\n    abortSignal?: AbortSignal,\n  ): AsyncGenerator\u003CStreamChunk> {\n    const ws = new WebSocket('wss:\u002F\u002Fmy-api.com\u002Fchat')\n\n    \u002F\u002F Wait for connection\n    await new Promise\u003Cvoid>((resolve, reject) => {\n      ws.onopen = () => resolve()\n      ws.onerror = (e) => reject(e)\n    })\n\n    \u002F\u002F Send messages\n    ws.send(JSON.stringify({ messages, ...data }))\n\n    \u002F\u002F Create an async queue to bridge WebSocket events to an async iterable\n    const queue: Array\u003CStreamChunk> = []\n    let resolve: (() => void) | null = null\n    let done = false\n\n    ws.onmessage = (event) => {\n      const chunk: StreamChunk = JSON.parse(event.data)\n      queue.push(chunk)\n      resolve?.()\n    }\n\n    ws.onclose = () => {\n      done = true\n      resolve?.()\n    }\n\n    ws.onerror = () => {\n      done = true\n      resolve?.()\n    }\n\n    abortSignal?.addEventListener('abort', () => {\n      ws.close()\n    })\n\n    \u002F\u002F Yield chunks as they arrive\n    while (!done || queue.length > 0) {\n      if (queue.length > 0) {\n        yield queue.shift()!\n      } else {\n        await new Promise\u003Cvoid>((r) => {\n          resolve = r\n        })\n      }\n    }\n  },\n}\n\nfunction Chat() {\n  const { messages, sendMessage } = useChat({\n    connection: websocketAdapter,\n  })\n\n  \u002F\u002F ... render messages\n}\n```\n\n**SubscribeConnectionAdapter (push-based \u002F separate subscribe + send):**\n\nUse for push-based protocols where the server can send data at any time\n(persistent WebSocket connections, MQTT, server push). The `subscribe` method\nreturns an `AsyncIterable\u003CStreamChunk>` that stays open, and `send` dispatches\nmessages through it.\n\n```typescript\nimport type { StreamChunk, UIMessage } from '@tanstack\u002Fai'\n\n\u002F\u002F SubscribeConnectionAdapter is exported from @tanstack\u002Fai-client\n\u002F\u002F (not re-exported by framework packages -- use ConnectionAdapter\n\u002F\u002F  union type from @tanstack\u002Fai-react for typing)\nconst pushAdapter = {\n  subscribe(abortSignal?: AbortSignal): AsyncIterable\u003CStreamChunk> {\n    \u002F\u002F Return a long-lived async iterable that yields chunks\n    \u002F\u002F whenever the server pushes them\n    return createPersistentStream(abortSignal)\n  },\n\n  async send(\n    messages: Array\u003CUIMessage>,\n    data?: Record\u003Cstring, any>,\n    abortSignal?: AbortSignal,\n  ): Promise\u003Cvoid> {\n    \u002F\u002F Dispatch messages; chunks arrive through subscribe()\n    await persistentConnection.send(JSON.stringify({ messages, ...data }))\n  },\n}\n\nfunction Chat() {\n  const { messages, sendMessage } = useChat({\n    connection: pushAdapter,\n  })\n\n  \u002F\u002F ... render messages\n}\n```\n\nThe `stream()` helper function (re-exported from `@tanstack\u002Fai-react`) provides\na shorthand for creating a `ConnectConnectionAdapter` from an async generator:\n\n```typescript\nimport { useChat, stream } from '@tanstack\u002Fai-react'\nimport type { StreamChunk, UIMessage } from '@tanstack\u002Fai'\n\nconst directAdapter = stream(async function* (\n  messages: Array\u003CUIMessage>,\n  data?: Record\u003Cstring, any>,\n): AsyncGenerator\u003CStreamChunk> {\n  const response = await fetch('https:\u002F\u002Fmy-api.com\u002Fchat', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application\u002Fjson' },\n    body: JSON.stringify({ messages, ...data }),\n  })\n\n  const reader = response.body!.getReader()\n  const decoder = new TextDecoder()\n  let buffer = ''\n\n  while (true) {\n    const { done, value } = await reader.read()\n    if (done) break\n\n    buffer += decoder.decode(value, { stream: true })\n    const lines = buffer.split('\\n')\n    buffer = lines.pop() || ''\n\n    for (const line of lines) {\n      if (line.trim()) {\n        yield JSON.parse(line) as StreamChunk\n      }\n    }\n  }\n})\n\nconst { messages, sendMessage } = useChat({\n  connection: directAdapter,\n})\n```\n\n## Common Mistakes\n\n### a. HIGH: Providing both connect and subscribe+send in connection adapter\n\nThe `ConnectionAdapter` interface has two mutually exclusive modes. Providing\nboth throws at runtime.\n\n```typescript\n\u002F\u002F WRONG -- throws \"Connection adapter must provide either connect or both\n\u002F\u002F subscribe and send, not both modes\"\nconst adapter = {\n  async *connect(messages) {\n    \u002F* ... *\u002F\n  },\n  subscribe(signal) {\n    \u002F* ... *\u002F\n  },\n  async send(messages) {\n    \u002F* ... *\u002F\n  },\n}\n\n\u002F\u002F CORRECT -- pick one mode\n\u002F\u002F Option A: ConnectConnectionAdapter (pull-based)\nconst pullAdapter = {\n  async *connect(messages, data, abortSignal) {\n    \u002F\u002F ... yield StreamChunks\n  },\n}\n\n\u002F\u002F Option B: SubscribeConnectionAdapter (push-based)\nconst pushAdapter = {\n  subscribe(abortSignal) {\n    return longLivedAsyncIterable\n  },\n  async send(messages, data, abortSignal) {\n    await connection.dispatch({ messages, ...data })\n  },\n}\n```\n\nSource: `ai-client\u002Fsrc\u002Fconnection-adapters.ts` line 116\n\n### b. MEDIUM: SSE browser connection limits\n\nBrowsers limit SSE connections to 6-8 per domain (the HTTP\u002F1.1 connection\nlimit). Multiple chat sessions on the same page, or multiple tabs to the\nsame origin, can exhaust this limit. New connections queue indefinitely until\nan existing one closes.\n\nMitigations:\n\n- Use HTTP\u002F2 (multiplexes streams over a single TCP connection; no per-domain limit)\n- Use `fetchHttpStream` instead of `fetchServerSentEvents` (each request is a\n  standard POST, not a long-lived EventSource)\n- Close idle connections when not actively streaming\n- Use a single persistent WebSocket via `SubscribeConnectionAdapter` instead of\n  per-request SSE connections\n\nSource: `docs\u002Fchat\u002Fconnection-adapters.md`\n\n### c. MEDIUM: HTTP stream without implementing reconnection\n\nSSE has built-in browser auto-reconnection via the `EventSource` API. HTTP\nstream (NDJSON via `fetchHttpStream`) does not -- if the connection drops\nmid-stream, the partial response is silently lost with no automatic retry.\n\nIf your application needs resilience to transient network errors with HTTP\nstreaming, implement retry logic in your connection adapter:\n\n```typescript\nimport { useChat } from '@tanstack\u002Fai-react'\nimport type { ConnectionAdapter } from '@tanstack\u002Fai-react'\nimport type { StreamChunk, UIMessage } from '@tanstack\u002Fai'\n\nconst resilientAdapter: ConnectionAdapter = {\n  async *connect(\n    messages: Array\u003CUIMessage>,\n    data?: Record\u003Cstring, any>,\n    abortSignal?: AbortSignal,\n  ): AsyncGenerator\u003CStreamChunk> {\n    const maxRetries = 3\n    let attempt = 0\n\n    while (attempt \u003C maxRetries) {\n      try {\n        const response = await fetch('https:\u002F\u002Fmy-api.com\u002Fchat', {\n          method: 'POST',\n          headers: { 'Content-Type': 'application\u002Fjson' },\n          body: JSON.stringify({ messages, ...data }),\n          signal: abortSignal,\n        })\n\n        if (!response.ok) {\n          throw new Error(`HTTP ${response.status}`)\n        }\n\n        const reader = response.body!.getReader()\n        const decoder = new TextDecoder()\n        let buffer = ''\n\n        while (true) {\n          const { done, value } = await reader.read()\n          if (done) break\n\n          buffer += decoder.decode(value, { stream: true })\n          const lines = buffer.split('\\n')\n          buffer = lines.pop() || ''\n\n          for (const line of lines) {\n            if (line.trim()) {\n              yield JSON.parse(line) as StreamChunk\n            }\n          }\n        }\n\n        return \u002F\u002F Stream completed successfully\n      } catch (err) {\n        if (abortSignal?.aborted) throw err\n        attempt++\n        if (attempt >= maxRetries) throw err\n        \u002F\u002F Exponential backoff\n        await new Promise((r) => setTimeout(r, 1000 * 2 ** attempt))\n      }\n    }\n  },\n}\n\nconst { messages, sendMessage } = useChat({\n  connection: resilientAdapter,\n})\n```\n\nNote: `fetchServerSentEvents` in TanStack AI uses `fetch()` under the hood (not\nthe browser `EventSource` API), so it also does not auto-reconnect. The SSE\nauto-reconnection advantage only applies when using the native `EventSource` API\ndirectly.\n\nSource: `docs\u002Fprotocol\u002Fhttp-stream-protocol.md`\n\n## Cross-References\n\n- See also: **ai-core\u002Fag-ui-protocol\u002FSKILL.md** -- Understanding the AG-UI protocol helps build compatible custom servers\n- See also: **ai-core\u002Fchat-experience\u002FSKILL.md** -- Full chat setup patterns including server-side `chat()` and `toServerSentEventsResponse()`\n- See also: **ai-core\u002Fmiddleware\u002FSKILL.md** -- Use middleware for analytics and lifecycle events on the server side\n",{"data":54,"body":60},{"name":5,"description":7,"type":55,"library":56,"library_version":57,"sources":58},"composition","tanstack-ai","0.10.0",[59],"TanStack\u002Fai:docs\u002Fchat\u002Fconnection-adapters.md",{"type":61,"children":62},"root",[63,72,78,85,99,933,954,960,967,988,996,1283,1291,1661,1695,1703,1890,1896,1924,2147,2180,2188,2462,2468,2481,2486,2494,2499,4095,4103,4131,4677,4704,5743,5749,5755,5766,6241,6254,6260,6265,6270,6317,6327,6333,6353,6358,7882,7916,7926,7932,7982],{"type":64,"tag":65,"props":66,"children":68},"element","h1",{"id":67},"custom-backend-integration",[69],{"type":70,"value":71},"text","Custom Backend Integration",{"type":64,"tag":73,"props":74,"children":75},"p",{},[76],{"type":70,"value":77},"This skill builds on ai-core and ai-core\u002Fchat-experience. Read them first.",{"type":64,"tag":79,"props":80,"children":82},"h2",{"id":81},"setup",[83],{"type":70,"value":84},"Setup",{"type":64,"tag":73,"props":86,"children":87},{},[88,90,97],{"type":70,"value":89},"Connect ",{"type":64,"tag":91,"props":92,"children":94},"code",{"className":93},[],[95],{"type":70,"value":96},"useChat",{"type":70,"value":98}," to a custom SSE backend with auth headers:",{"type":64,"tag":100,"props":101,"children":105},"pre",{"className":102,"code":103,"language":45,"meta":104,"style":104},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nfunction Chat() {\n  const { messages, sendMessage, isLoading } = useChat({\n    connection: fetchServerSentEvents('https:\u002F\u002Fmy-api.com\u002Fchat', {\n      headers: {\n        Authorization: `Bearer ${token}`,\n      },\n    }),\n  })\n\n  return (\n    \u003Cdiv>\n      {messages.map((msg) => (\n        \u003Cdiv key={msg.id}>\n          \u003Cstrong>{msg.role}:\u003C\u002Fstrong>\n          {msg.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      \u003Cbutton onClick={() => sendMessage('Hello')}>Send\u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n  )\n}\n","",[106],{"type":64,"tag":91,"props":107,"children":108},{"__ignoreMap":104},[109,169,179,205,265,309,326,369,378,396,410,418,432,452,501,539,590,650,688,760,769,783,801,818,831,899,916,925],{"type":64,"tag":110,"props":111,"children":114},"span",{"class":112,"line":113},"line",1,[115,121,127,133,138,143,148,153,158,164],{"type":64,"tag":110,"props":116,"children":118},{"style":117},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[119],{"type":70,"value":120},"import",{"type":64,"tag":110,"props":122,"children":124},{"style":123},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[125],{"type":70,"value":126}," {",{"type":64,"tag":110,"props":128,"children":130},{"style":129},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[131],{"type":70,"value":132}," useChat",{"type":64,"tag":110,"props":134,"children":135},{"style":123},[136],{"type":70,"value":137},",",{"type":64,"tag":110,"props":139,"children":140},{"style":129},[141],{"type":70,"value":142}," fetchServerSentEvents",{"type":64,"tag":110,"props":144,"children":145},{"style":123},[146],{"type":70,"value":147}," }",{"type":64,"tag":110,"props":149,"children":150},{"style":117},[151],{"type":70,"value":152}," from",{"type":64,"tag":110,"props":154,"children":155},{"style":123},[156],{"type":70,"value":157}," '",{"type":64,"tag":110,"props":159,"children":161},{"style":160},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[162],{"type":70,"value":163},"@tanstack\u002Fai-react",{"type":64,"tag":110,"props":165,"children":166},{"style":123},[167],{"type":70,"value":168},"'\n",{"type":64,"tag":110,"props":170,"children":172},{"class":112,"line":171},2,[173],{"type":64,"tag":110,"props":174,"children":176},{"emptyLinePlaceholder":175},true,[177],{"type":70,"value":178},"\n",{"type":64,"tag":110,"props":180,"children":182},{"class":112,"line":181},3,[183,189,195,200],{"type":64,"tag":110,"props":184,"children":186},{"style":185},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[187],{"type":70,"value":188},"function",{"type":64,"tag":110,"props":190,"children":192},{"style":191},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[193],{"type":70,"value":194}," Chat",{"type":64,"tag":110,"props":196,"children":197},{"style":123},[198],{"type":70,"value":199},"()",{"type":64,"tag":110,"props":201,"children":202},{"style":123},[203],{"type":70,"value":204}," {\n",{"type":64,"tag":110,"props":206,"children":208},{"class":112,"line":207},4,[209,214,218,223,227,232,236,241,245,250,254,260],{"type":64,"tag":110,"props":210,"children":211},{"style":185},[212],{"type":70,"value":213},"  const",{"type":64,"tag":110,"props":215,"children":216},{"style":123},[217],{"type":70,"value":126},{"type":64,"tag":110,"props":219,"children":220},{"style":129},[221],{"type":70,"value":222}," messages",{"type":64,"tag":110,"props":224,"children":225},{"style":123},[226],{"type":70,"value":137},{"type":64,"tag":110,"props":228,"children":229},{"style":129},[230],{"type":70,"value":231}," sendMessage",{"type":64,"tag":110,"props":233,"children":234},{"style":123},[235],{"type":70,"value":137},{"type":64,"tag":110,"props":237,"children":238},{"style":129},[239],{"type":70,"value":240}," isLoading",{"type":64,"tag":110,"props":242,"children":243},{"style":123},[244],{"type":70,"value":147},{"type":64,"tag":110,"props":246,"children":247},{"style":123},[248],{"type":70,"value":249}," =",{"type":64,"tag":110,"props":251,"children":252},{"style":191},[253],{"type":70,"value":132},{"type":64,"tag":110,"props":255,"children":257},{"style":256},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[258],{"type":70,"value":259},"(",{"type":64,"tag":110,"props":261,"children":262},{"style":123},[263],{"type":70,"value":264},"{\n",{"type":64,"tag":110,"props":266,"children":268},{"class":112,"line":267},5,[269,274,279,283,287,292,297,301,305],{"type":64,"tag":110,"props":270,"children":271},{"style":256},[272],{"type":70,"value":273},"    connection",{"type":64,"tag":110,"props":275,"children":276},{"style":123},[277],{"type":70,"value":278},":",{"type":64,"tag":110,"props":280,"children":281},{"style":191},[282],{"type":70,"value":142},{"type":64,"tag":110,"props":284,"children":285},{"style":256},[286],{"type":70,"value":259},{"type":64,"tag":110,"props":288,"children":289},{"style":123},[290],{"type":70,"value":291},"'",{"type":64,"tag":110,"props":293,"children":294},{"style":160},[295],{"type":70,"value":296},"https:\u002F\u002Fmy-api.com\u002Fchat",{"type":64,"tag":110,"props":298,"children":299},{"style":123},[300],{"type":70,"value":291},{"type":64,"tag":110,"props":302,"children":303},{"style":123},[304],{"type":70,"value":137},{"type":64,"tag":110,"props":306,"children":307},{"style":123},[308],{"type":70,"value":204},{"type":64,"tag":110,"props":310,"children":312},{"class":112,"line":311},6,[313,318,322],{"type":64,"tag":110,"props":314,"children":315},{"style":256},[316],{"type":70,"value":317},"      headers",{"type":64,"tag":110,"props":319,"children":320},{"style":123},[321],{"type":70,"value":278},{"type":64,"tag":110,"props":323,"children":324},{"style":123},[325],{"type":70,"value":204},{"type":64,"tag":110,"props":327,"children":329},{"class":112,"line":328},7,[330,335,339,344,349,354,359,364],{"type":64,"tag":110,"props":331,"children":332},{"style":256},[333],{"type":70,"value":334},"        Authorization",{"type":64,"tag":110,"props":336,"children":337},{"style":123},[338],{"type":70,"value":278},{"type":64,"tag":110,"props":340,"children":341},{"style":123},[342],{"type":70,"value":343}," `",{"type":64,"tag":110,"props":345,"children":346},{"style":160},[347],{"type":70,"value":348},"Bearer ",{"type":64,"tag":110,"props":350,"children":351},{"style":123},[352],{"type":70,"value":353},"${",{"type":64,"tag":110,"props":355,"children":356},{"style":129},[357],{"type":70,"value":358},"token",{"type":64,"tag":110,"props":360,"children":361},{"style":123},[362],{"type":70,"value":363},"}`",{"type":64,"tag":110,"props":365,"children":366},{"style":123},[367],{"type":70,"value":368},",\n",{"type":64,"tag":110,"props":370,"children":372},{"class":112,"line":371},8,[373],{"type":64,"tag":110,"props":374,"children":375},{"style":123},[376],{"type":70,"value":377},"      },\n",{"type":64,"tag":110,"props":379,"children":381},{"class":112,"line":380},9,[382,387,392],{"type":64,"tag":110,"props":383,"children":384},{"style":123},[385],{"type":70,"value":386},"    }",{"type":64,"tag":110,"props":388,"children":389},{"style":256},[390],{"type":70,"value":391},")",{"type":64,"tag":110,"props":393,"children":394},{"style":123},[395],{"type":70,"value":368},{"type":64,"tag":110,"props":397,"children":399},{"class":112,"line":398},10,[400,405],{"type":64,"tag":110,"props":401,"children":402},{"style":123},[403],{"type":70,"value":404},"  }",{"type":64,"tag":110,"props":406,"children":407},{"style":256},[408],{"type":70,"value":409},")\n",{"type":64,"tag":110,"props":411,"children":413},{"class":112,"line":412},11,[414],{"type":64,"tag":110,"props":415,"children":416},{"emptyLinePlaceholder":175},[417],{"type":70,"value":178},{"type":64,"tag":110,"props":419,"children":421},{"class":112,"line":420},12,[422,427],{"type":64,"tag":110,"props":423,"children":424},{"style":117},[425],{"type":70,"value":426},"  return",{"type":64,"tag":110,"props":428,"children":429},{"style":256},[430],{"type":70,"value":431}," (\n",{"type":64,"tag":110,"props":433,"children":435},{"class":112,"line":434},13,[436,441,447],{"type":64,"tag":110,"props":437,"children":438},{"style":256},[439],{"type":70,"value":440},"    \u003C",{"type":64,"tag":110,"props":442,"children":444},{"style":443},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[445],{"type":70,"value":446},"div",{"type":64,"tag":110,"props":448,"children":449},{"style":256},[450],{"type":70,"value":451},">\n",{"type":64,"tag":110,"props":453,"children":455},{"class":112,"line":454},14,[456,461,467,472,477,482,487,492,497],{"type":64,"tag":110,"props":457,"children":458},{"style":123},[459],{"type":70,"value":460},"      {",{"type":64,"tag":110,"props":462,"children":464},{"style":463},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[465],{"type":70,"value":466},"messages",{"type":64,"tag":110,"props":468,"children":469},{"style":256},[470],{"type":70,"value":471},".",{"type":64,"tag":110,"props":473,"children":474},{"style":463},[475],{"type":70,"value":476},"map",{"type":64,"tag":110,"props":478,"children":479},{"style":256},[480],{"type":70,"value":481},"((",{"type":64,"tag":110,"props":483,"children":484},{"style":463},[485],{"type":70,"value":486},"msg",{"type":64,"tag":110,"props":488,"children":489},{"style":256},[490],{"type":70,"value":491},") ",{"type":64,"tag":110,"props":493,"children":494},{"style":123},[495],{"type":70,"value":496},"=>",{"type":64,"tag":110,"props":498,"children":499},{"style":256},[500],{"type":70,"value":431},{"type":64,"tag":110,"props":502,"children":504},{"class":112,"line":503},15,[505,510,514,519,524,529,534],{"type":64,"tag":110,"props":506,"children":507},{"style":123},[508],{"type":70,"value":509},"        \u003C",{"type":64,"tag":110,"props":511,"children":512},{"style":129},[513],{"type":70,"value":446},{"type":64,"tag":110,"props":515,"children":516},{"style":129},[517],{"type":70,"value":518}," key",{"type":64,"tag":110,"props":520,"children":521},{"style":123},[522],{"type":70,"value":523},"={",{"type":64,"tag":110,"props":525,"children":526},{"style":256},[527],{"type":70,"value":528},"msg.",{"type":64,"tag":110,"props":530,"children":531},{"style":129},[532],{"type":70,"value":533},"id",{"type":64,"tag":110,"props":535,"children":536},{"style":123},[537],{"type":70,"value":538},"}>\n",{"type":64,"tag":110,"props":540,"children":542},{"class":112,"line":541},16,[543,548,553,558,563,567,572,577,582,586],{"type":64,"tag":110,"props":544,"children":545},{"style":256},[546],{"type":70,"value":547},"          \u003C",{"type":64,"tag":110,"props":549,"children":550},{"style":443},[551],{"type":70,"value":552},"strong",{"type":64,"tag":110,"props":554,"children":555},{"style":256},[556],{"type":70,"value":557},">",{"type":64,"tag":110,"props":559,"children":560},{"style":123},[561],{"type":70,"value":562},"{",{"type":64,"tag":110,"props":564,"children":565},{"style":256},[566],{"type":70,"value":528},{"type":64,"tag":110,"props":568,"children":569},{"style":129},[570],{"type":70,"value":571},"role",{"type":64,"tag":110,"props":573,"children":574},{"style":123},[575],{"type":70,"value":576},"}:\u003C",{"type":64,"tag":110,"props":578,"children":579},{"style":256},[580],{"type":70,"value":581},"\u002F",{"type":64,"tag":110,"props":583,"children":584},{"style":443},[585],{"type":70,"value":552},{"type":64,"tag":110,"props":587,"children":588},{"style":123},[589],{"type":70,"value":451},{"type":64,"tag":110,"props":591,"children":593},{"class":112,"line":592},17,[594,599,603,607,612,616,620,624,629,633,638,642,646],{"type":64,"tag":110,"props":595,"children":596},{"style":123},[597],{"type":70,"value":598},"          {",{"type":64,"tag":110,"props":600,"children":601},{"style":463},[602],{"type":70,"value":486},{"type":64,"tag":110,"props":604,"children":605},{"style":256},[606],{"type":70,"value":471},{"type":64,"tag":110,"props":608,"children":609},{"style":463},[610],{"type":70,"value":611},"parts",{"type":64,"tag":110,"props":613,"children":614},{"style":256},[615],{"type":70,"value":471},{"type":64,"tag":110,"props":617,"children":618},{"style":463},[619],{"type":70,"value":476},{"type":64,"tag":110,"props":621,"children":622},{"style":256},[623],{"type":70,"value":481},{"type":64,"tag":110,"props":625,"children":626},{"style":463},[627],{"type":70,"value":628},"part",{"type":64,"tag":110,"props":630,"children":631},{"style":123},[632],{"type":70,"value":137},{"type":64,"tag":110,"props":634,"children":635},{"style":463},[636],{"type":70,"value":637}," i",{"type":64,"tag":110,"props":639,"children":640},{"style":256},[641],{"type":70,"value":491},{"type":64,"tag":110,"props":643,"children":644},{"style":123},[645],{"type":70,"value":496},{"type":64,"tag":110,"props":647,"children":648},{"style":123},[649],{"type":70,"value":204},{"type":64,"tag":110,"props":651,"children":653},{"class":112,"line":652},18,[654,659,663,668,672,676,680,684],{"type":64,"tag":110,"props":655,"children":656},{"style":256},[657],{"type":70,"value":658},"            if ",{"type":64,"tag":110,"props":660,"children":661},{"style":123},[662],{"type":70,"value":259},{"type":64,"tag":110,"props":664,"children":665},{"style":256},[666],{"type":70,"value":667},"part.type === ",{"type":64,"tag":110,"props":669,"children":670},{"style":123},[671],{"type":70,"value":291},{"type":64,"tag":110,"props":673,"children":674},{"style":160},[675],{"type":70,"value":70},{"type":64,"tag":110,"props":677,"children":678},{"style":123},[679],{"type":70,"value":291},{"type":64,"tag":110,"props":681,"children":682},{"style":123},[683],{"type":70,"value":391},{"type":64,"tag":110,"props":685,"children":686},{"style":123},[687],{"type":70,"value":204},{"type":64,"tag":110,"props":689,"children":691},{"class":112,"line":690},19,[692,697,702,706,710,715,719,724,729,733,737,742,747,752,756],{"type":64,"tag":110,"props":693,"children":694},{"style":117},[695],{"type":70,"value":696},"              return",{"type":64,"tag":110,"props":698,"children":699},{"style":256},[700],{"type":70,"value":701}," \u003C",{"type":64,"tag":110,"props":703,"children":704},{"style":443},[705],{"type":70,"value":73},{"type":64,"tag":110,"props":707,"children":708},{"style":443},[709],{"type":70,"value":518},{"type":64,"tag":110,"props":711,"children":712},{"style":256},[713],{"type":70,"value":714},"=",{"type":64,"tag":110,"props":716,"children":717},{"style":123},[718],{"type":70,"value":562},{"type":64,"tag":110,"props":720,"children":721},{"style":256},[722],{"type":70,"value":723},"i",{"type":64,"tag":110,"props":725,"children":726},{"style":123},[727],{"type":70,"value":728},"}",{"type":64,"tag":110,"props":730,"children":731},{"style":256},[732],{"type":70,"value":557},{"type":64,"tag":110,"props":734,"children":735},{"style":123},[736],{"type":70,"value":562},{"type":64,"tag":110,"props":738,"children":739},{"style":256},[740],{"type":70,"value":741},"part.",{"type":64,"tag":110,"props":743,"children":744},{"style":129},[745],{"type":70,"value":746},"content",{"type":64,"tag":110,"props":748,"children":749},{"style":123},[750],{"type":70,"value":751},"}\u003C\u002F",{"type":64,"tag":110,"props":753,"children":754},{"style":129},[755],{"type":70,"value":73},{"type":64,"tag":110,"props":757,"children":758},{"style":123},[759],{"type":70,"value":451},{"type":64,"tag":110,"props":761,"children":763},{"class":112,"line":762},20,[764],{"type":64,"tag":110,"props":765,"children":766},{"style":123},[767],{"type":70,"value":768},"            }\n",{"type":64,"tag":110,"props":770,"children":772},{"class":112,"line":771},21,[773,778],{"type":64,"tag":110,"props":774,"children":775},{"style":256},[776],{"type":70,"value":777},"            return ",{"type":64,"tag":110,"props":779,"children":780},{"style":129},[781],{"type":70,"value":782},"null\n",{"type":64,"tag":110,"props":784,"children":786},{"class":112,"line":785},22,[787,792,796],{"type":64,"tag":110,"props":788,"children":789},{"style":123},[790],{"type":70,"value":791},"          }",{"type":64,"tag":110,"props":793,"children":794},{"style":256},[795],{"type":70,"value":391},{"type":64,"tag":110,"props":797,"children":798},{"style":123},[799],{"type":70,"value":800},"}\n",{"type":64,"tag":110,"props":802,"children":804},{"class":112,"line":803},23,[805,810,814],{"type":64,"tag":110,"props":806,"children":807},{"style":123},[808],{"type":70,"value":809},"        \u003C\u002F",{"type":64,"tag":110,"props":811,"children":812},{"style":129},[813],{"type":70,"value":446},{"type":64,"tag":110,"props":815,"children":816},{"style":123},[817],{"type":70,"value":451},{"type":64,"tag":110,"props":819,"children":821},{"class":112,"line":820},24,[822,827],{"type":64,"tag":110,"props":823,"children":824},{"style":256},[825],{"type":70,"value":826},"      ))",{"type":64,"tag":110,"props":828,"children":829},{"style":123},[830],{"type":70,"value":800},{"type":64,"tag":110,"props":832,"children":834},{"class":112,"line":833},25,[835,840,845,850,854,859,863,867,872,876,881,886,891,895],{"type":64,"tag":110,"props":836,"children":837},{"style":123},[838],{"type":70,"value":839},"      \u003C",{"type":64,"tag":110,"props":841,"children":842},{"style":129},[843],{"type":70,"value":844},"button",{"type":64,"tag":110,"props":846,"children":847},{"style":129},[848],{"type":70,"value":849}," onClick",{"type":64,"tag":110,"props":851,"children":852},{"style":123},[853],{"type":70,"value":523},{"type":64,"tag":110,"props":855,"children":856},{"style":256},[857],{"type":70,"value":858},"() => sendMessage",{"type":64,"tag":110,"props":860,"children":861},{"style":123},[862],{"type":70,"value":259},{"type":64,"tag":110,"props":864,"children":865},{"style":123},[866],{"type":70,"value":291},{"type":64,"tag":110,"props":868,"children":869},{"style":160},[870],{"type":70,"value":871},"Hello",{"type":64,"tag":110,"props":873,"children":874},{"style":123},[875],{"type":70,"value":291},{"type":64,"tag":110,"props":877,"children":878},{"style":123},[879],{"type":70,"value":880},")}>",{"type":64,"tag":110,"props":882,"children":883},{"style":129},[884],{"type":70,"value":885},"Send",{"type":64,"tag":110,"props":887,"children":888},{"style":123},[889],{"type":70,"value":890},"\u003C\u002F",{"type":64,"tag":110,"props":892,"children":893},{"style":129},[894],{"type":70,"value":844},{"type":64,"tag":110,"props":896,"children":897},{"style":123},[898],{"type":70,"value":451},{"type":64,"tag":110,"props":900,"children":902},{"class":112,"line":901},26,[903,908,912],{"type":64,"tag":110,"props":904,"children":905},{"style":123},[906],{"type":70,"value":907},"    \u003C\u002F",{"type":64,"tag":110,"props":909,"children":910},{"style":129},[911],{"type":70,"value":446},{"type":64,"tag":110,"props":913,"children":914},{"style":123},[915],{"type":70,"value":451},{"type":64,"tag":110,"props":917,"children":919},{"class":112,"line":918},27,[920],{"type":64,"tag":110,"props":921,"children":922},{"style":256},[923],{"type":70,"value":924},"  )\n",{"type":64,"tag":110,"props":926,"children":928},{"class":112,"line":927},28,[929],{"type":64,"tag":110,"props":930,"children":931},{"style":123},[932],{"type":70,"value":800},{"type":64,"tag":73,"props":934,"children":935},{},[936,938,944,946,952],{"type":70,"value":937},"Both ",{"type":64,"tag":91,"props":939,"children":941},{"className":940},[],[942],{"type":70,"value":943},"fetchServerSentEvents",{"type":70,"value":945}," and ",{"type":64,"tag":91,"props":947,"children":949},{"className":948},[],[950],{"type":70,"value":951},"fetchHttpStream",{"type":70,"value":953}," accept a static URL string\nor a function returning a string (evaluated per request), and a static options\nobject or a sync\u002Fasync function returning options (also evaluated per request).\nThis allows dynamic auth tokens and URLs without re-creating the adapter.",{"type":64,"tag":79,"props":955,"children":957},{"id":956},"core-patterns",[958],{"type":70,"value":959},"Core Patterns",{"type":64,"tag":961,"props":962,"children":964},"h3",{"id":963},"_1-custom-sse-backend-with-fetchserversentevents",[965],{"type":70,"value":966},"1. Custom SSE Backend with fetchServerSentEvents",{"type":64,"tag":73,"props":968,"children":969},{},[970,972,978,980,986],{"type":70,"value":971},"Use when your backend speaks SSE (",{"type":64,"tag":91,"props":973,"children":975},{"className":974},[],[976],{"type":70,"value":977},"text\u002Fevent-stream",{"type":70,"value":979},") with ",{"type":64,"tag":91,"props":981,"children":983},{"className":982},[],[984],{"type":70,"value":985},"data: {json}\\n\\n",{"type":70,"value":987},"\nframing. This is the recommended default.",{"type":64,"tag":73,"props":989,"children":990},{},[991],{"type":64,"tag":552,"props":992,"children":993},{},[994],{"type":70,"value":995},"Static options:",{"type":64,"tag":100,"props":997,"children":999},{"className":102,"code":998,"language":45,"meta":104,"style":104},"import { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchServerSentEvents('https:\u002F\u002Fmy-api.com\u002Fchat', {\n    headers: {\n      Authorization: `Bearer ${token}`,\n      'X-Tenant-Id': tenantId,\n    },\n    credentials: 'include',\n  }),\n})\n",[1000],{"type":64,"tag":91,"props":1001,"children":1002},{"__ignoreMap":104},[1003,1046,1053,1098,1138,1154,1190,1220,1228,1257,1272],{"type":64,"tag":110,"props":1004,"children":1005},{"class":112,"line":113},[1006,1010,1014,1018,1022,1026,1030,1034,1038,1042],{"type":64,"tag":110,"props":1007,"children":1008},{"style":117},[1009],{"type":70,"value":120},{"type":64,"tag":110,"props":1011,"children":1012},{"style":123},[1013],{"type":70,"value":126},{"type":64,"tag":110,"props":1015,"children":1016},{"style":129},[1017],{"type":70,"value":132},{"type":64,"tag":110,"props":1019,"children":1020},{"style":123},[1021],{"type":70,"value":137},{"type":64,"tag":110,"props":1023,"children":1024},{"style":129},[1025],{"type":70,"value":142},{"type":64,"tag":110,"props":1027,"children":1028},{"style":123},[1029],{"type":70,"value":147},{"type":64,"tag":110,"props":1031,"children":1032},{"style":117},[1033],{"type":70,"value":152},{"type":64,"tag":110,"props":1035,"children":1036},{"style":123},[1037],{"type":70,"value":157},{"type":64,"tag":110,"props":1039,"children":1040},{"style":160},[1041],{"type":70,"value":163},{"type":64,"tag":110,"props":1043,"children":1044},{"style":123},[1045],{"type":70,"value":168},{"type":64,"tag":110,"props":1047,"children":1048},{"class":112,"line":171},[1049],{"type":64,"tag":110,"props":1050,"children":1051},{"emptyLinePlaceholder":175},[1052],{"type":70,"value":178},{"type":64,"tag":110,"props":1054,"children":1055},{"class":112,"line":181},[1056,1061,1065,1069,1073,1078,1082,1086,1090,1094],{"type":64,"tag":110,"props":1057,"children":1058},{"style":185},[1059],{"type":70,"value":1060},"const",{"type":64,"tag":110,"props":1062,"children":1063},{"style":123},[1064],{"type":70,"value":126},{"type":64,"tag":110,"props":1066,"children":1067},{"style":129},[1068],{"type":70,"value":222},{"type":64,"tag":110,"props":1070,"children":1071},{"style":123},[1072],{"type":70,"value":137},{"type":64,"tag":110,"props":1074,"children":1075},{"style":129},[1076],{"type":70,"value":1077}," sendMessage ",{"type":64,"tag":110,"props":1079,"children":1080},{"style":123},[1081],{"type":70,"value":728},{"type":64,"tag":110,"props":1083,"children":1084},{"style":123},[1085],{"type":70,"value":249},{"type":64,"tag":110,"props":1087,"children":1088},{"style":191},[1089],{"type":70,"value":132},{"type":64,"tag":110,"props":1091,"children":1092},{"style":129},[1093],{"type":70,"value":259},{"type":64,"tag":110,"props":1095,"children":1096},{"style":123},[1097],{"type":70,"value":264},{"type":64,"tag":110,"props":1099,"children":1100},{"class":112,"line":207},[1101,1106,1110,1114,1118,1122,1126,1130,1134],{"type":64,"tag":110,"props":1102,"children":1103},{"style":256},[1104],{"type":70,"value":1105},"  connection",{"type":64,"tag":110,"props":1107,"children":1108},{"style":123},[1109],{"type":70,"value":278},{"type":64,"tag":110,"props":1111,"children":1112},{"style":191},[1113],{"type":70,"value":142},{"type":64,"tag":110,"props":1115,"children":1116},{"style":129},[1117],{"type":70,"value":259},{"type":64,"tag":110,"props":1119,"children":1120},{"style":123},[1121],{"type":70,"value":291},{"type":64,"tag":110,"props":1123,"children":1124},{"style":160},[1125],{"type":70,"value":296},{"type":64,"tag":110,"props":1127,"children":1128},{"style":123},[1129],{"type":70,"value":291},{"type":64,"tag":110,"props":1131,"children":1132},{"style":123},[1133],{"type":70,"value":137},{"type":64,"tag":110,"props":1135,"children":1136},{"style":123},[1137],{"type":70,"value":204},{"type":64,"tag":110,"props":1139,"children":1140},{"class":112,"line":267},[1141,1146,1150],{"type":64,"tag":110,"props":1142,"children":1143},{"style":256},[1144],{"type":70,"value":1145},"    headers",{"type":64,"tag":110,"props":1147,"children":1148},{"style":123},[1149],{"type":70,"value":278},{"type":64,"tag":110,"props":1151,"children":1152},{"style":123},[1153],{"type":70,"value":204},{"type":64,"tag":110,"props":1155,"children":1156},{"class":112,"line":311},[1157,1162,1166,1170,1174,1178,1182,1186],{"type":64,"tag":110,"props":1158,"children":1159},{"style":256},[1160],{"type":70,"value":1161},"      Authorization",{"type":64,"tag":110,"props":1163,"children":1164},{"style":123},[1165],{"type":70,"value":278},{"type":64,"tag":110,"props":1167,"children":1168},{"style":123},[1169],{"type":70,"value":343},{"type":64,"tag":110,"props":1171,"children":1172},{"style":160},[1173],{"type":70,"value":348},{"type":64,"tag":110,"props":1175,"children":1176},{"style":123},[1177],{"type":70,"value":353},{"type":64,"tag":110,"props":1179,"children":1180},{"style":129},[1181],{"type":70,"value":358},{"type":64,"tag":110,"props":1183,"children":1184},{"style":123},[1185],{"type":70,"value":363},{"type":64,"tag":110,"props":1187,"children":1188},{"style":123},[1189],{"type":70,"value":368},{"type":64,"tag":110,"props":1191,"children":1192},{"class":112,"line":328},[1193,1198,1203,1207,1211,1216],{"type":64,"tag":110,"props":1194,"children":1195},{"style":123},[1196],{"type":70,"value":1197},"      '",{"type":64,"tag":110,"props":1199,"children":1200},{"style":256},[1201],{"type":70,"value":1202},"X-Tenant-Id",{"type":64,"tag":110,"props":1204,"children":1205},{"style":123},[1206],{"type":70,"value":291},{"type":64,"tag":110,"props":1208,"children":1209},{"style":123},[1210],{"type":70,"value":278},{"type":64,"tag":110,"props":1212,"children":1213},{"style":129},[1214],{"type":70,"value":1215}," tenantId",{"type":64,"tag":110,"props":1217,"children":1218},{"style":123},[1219],{"type":70,"value":368},{"type":64,"tag":110,"props":1221,"children":1222},{"class":112,"line":371},[1223],{"type":64,"tag":110,"props":1224,"children":1225},{"style":123},[1226],{"type":70,"value":1227},"    },\n",{"type":64,"tag":110,"props":1229,"children":1230},{"class":112,"line":380},[1231,1236,1240,1244,1249,1253],{"type":64,"tag":110,"props":1232,"children":1233},{"style":256},[1234],{"type":70,"value":1235},"    credentials",{"type":64,"tag":110,"props":1237,"children":1238},{"style":123},[1239],{"type":70,"value":278},{"type":64,"tag":110,"props":1241,"children":1242},{"style":123},[1243],{"type":70,"value":157},{"type":64,"tag":110,"props":1245,"children":1246},{"style":160},[1247],{"type":70,"value":1248},"include",{"type":64,"tag":110,"props":1250,"children":1251},{"style":123},[1252],{"type":70,"value":291},{"type":64,"tag":110,"props":1254,"children":1255},{"style":123},[1256],{"type":70,"value":368},{"type":64,"tag":110,"props":1258,"children":1259},{"class":112,"line":398},[1260,1264,1268],{"type":64,"tag":110,"props":1261,"children":1262},{"style":123},[1263],{"type":70,"value":404},{"type":64,"tag":110,"props":1265,"children":1266},{"style":129},[1267],{"type":70,"value":391},{"type":64,"tag":110,"props":1269,"children":1270},{"style":123},[1271],{"type":70,"value":368},{"type":64,"tag":110,"props":1273,"children":1274},{"class":112,"line":412},[1275,1279],{"type":64,"tag":110,"props":1276,"children":1277},{"style":123},[1278],{"type":70,"value":728},{"type":64,"tag":110,"props":1280,"children":1281},{"style":129},[1282],{"type":70,"value":409},{"type":64,"tag":73,"props":1284,"children":1285},{},[1286],{"type":64,"tag":552,"props":1287,"children":1288},{},[1289],{"type":70,"value":1290},"Dynamic URL and options (evaluated per request):",{"type":64,"tag":100,"props":1292,"children":1294},{"className":102,"code":1293,"language":45,"meta":104,"style":104},"import { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchServerSentEvents(\n    () => `https:\u002F\u002Fmy-api.com\u002Fchat?session=${sessionId}`,\n    async () => ({\n      headers: {\n        Authorization: `Bearer ${await getAccessToken()}`,\n      },\n      body: {\n        provider: 'openai',\n        model: 'gpt-4o',\n      },\n    }),\n  ),\n})\n",[1295],{"type":64,"tag":91,"props":1296,"children":1297},{"__ignoreMap":104},[1298,1341,1348,1391,1411,1450,1476,1491,1536,1543,1559,1587,1616,1623,1638,1650],{"type":64,"tag":110,"props":1299,"children":1300},{"class":112,"line":113},[1301,1305,1309,1313,1317,1321,1325,1329,1333,1337],{"type":64,"tag":110,"props":1302,"children":1303},{"style":117},[1304],{"type":70,"value":120},{"type":64,"tag":110,"props":1306,"children":1307},{"style":123},[1308],{"type":70,"value":126},{"type":64,"tag":110,"props":1310,"children":1311},{"style":129},[1312],{"type":70,"value":132},{"type":64,"tag":110,"props":1314,"children":1315},{"style":123},[1316],{"type":70,"value":137},{"type":64,"tag":110,"props":1318,"children":1319},{"style":129},[1320],{"type":70,"value":142},{"type":64,"tag":110,"props":1322,"children":1323},{"style":123},[1324],{"type":70,"value":147},{"type":64,"tag":110,"props":1326,"children":1327},{"style":117},[1328],{"type":70,"value":152},{"type":64,"tag":110,"props":1330,"children":1331},{"style":123},[1332],{"type":70,"value":157},{"type":64,"tag":110,"props":1334,"children":1335},{"style":160},[1336],{"type":70,"value":163},{"type":64,"tag":110,"props":1338,"children":1339},{"style":123},[1340],{"type":70,"value":168},{"type":64,"tag":110,"props":1342,"children":1343},{"class":112,"line":171},[1344],{"type":64,"tag":110,"props":1345,"children":1346},{"emptyLinePlaceholder":175},[1347],{"type":70,"value":178},{"type":64,"tag":110,"props":1349,"children":1350},{"class":112,"line":181},[1351,1355,1359,1363,1367,1371,1375,1379,1383,1387],{"type":64,"tag":110,"props":1352,"children":1353},{"style":185},[1354],{"type":70,"value":1060},{"type":64,"tag":110,"props":1356,"children":1357},{"style":123},[1358],{"type":70,"value":126},{"type":64,"tag":110,"props":1360,"children":1361},{"style":129},[1362],{"type":70,"value":222},{"type":64,"tag":110,"props":1364,"children":1365},{"style":123},[1366],{"type":70,"value":137},{"type":64,"tag":110,"props":1368,"children":1369},{"style":129},[1370],{"type":70,"value":1077},{"type":64,"tag":110,"props":1372,"children":1373},{"style":123},[1374],{"type":70,"value":728},{"type":64,"tag":110,"props":1376,"children":1377},{"style":123},[1378],{"type":70,"value":249},{"type":64,"tag":110,"props":1380,"children":1381},{"style":191},[1382],{"type":70,"value":132},{"type":64,"tag":110,"props":1384,"children":1385},{"style":129},[1386],{"type":70,"value":259},{"type":64,"tag":110,"props":1388,"children":1389},{"style":123},[1390],{"type":70,"value":264},{"type":64,"tag":110,"props":1392,"children":1393},{"class":112,"line":207},[1394,1398,1402,1406],{"type":64,"tag":110,"props":1395,"children":1396},{"style":256},[1397],{"type":70,"value":1105},{"type":64,"tag":110,"props":1399,"children":1400},{"style":123},[1401],{"type":70,"value":278},{"type":64,"tag":110,"props":1403,"children":1404},{"style":191},[1405],{"type":70,"value":142},{"type":64,"tag":110,"props":1407,"children":1408},{"style":129},[1409],{"type":70,"value":1410},"(\n",{"type":64,"tag":110,"props":1412,"children":1413},{"class":112,"line":267},[1414,1419,1424,1428,1433,1437,1442,1446],{"type":64,"tag":110,"props":1415,"children":1416},{"style":123},[1417],{"type":70,"value":1418},"    ()",{"type":64,"tag":110,"props":1420,"children":1421},{"style":185},[1422],{"type":70,"value":1423}," =>",{"type":64,"tag":110,"props":1425,"children":1426},{"style":123},[1427],{"type":70,"value":343},{"type":64,"tag":110,"props":1429,"children":1430},{"style":160},[1431],{"type":70,"value":1432},"https:\u002F\u002Fmy-api.com\u002Fchat?session=",{"type":64,"tag":110,"props":1434,"children":1435},{"style":123},[1436],{"type":70,"value":353},{"type":64,"tag":110,"props":1438,"children":1439},{"style":129},[1440],{"type":70,"value":1441},"sessionId",{"type":64,"tag":110,"props":1443,"children":1444},{"style":123},[1445],{"type":70,"value":363},{"type":64,"tag":110,"props":1447,"children":1448},{"style":123},[1449],{"type":70,"value":368},{"type":64,"tag":110,"props":1451,"children":1452},{"class":112,"line":311},[1453,1458,1463,1467,1472],{"type":64,"tag":110,"props":1454,"children":1455},{"style":185},[1456],{"type":70,"value":1457},"    async",{"type":64,"tag":110,"props":1459,"children":1460},{"style":123},[1461],{"type":70,"value":1462}," ()",{"type":64,"tag":110,"props":1464,"children":1465},{"style":185},[1466],{"type":70,"value":1423},{"type":64,"tag":110,"props":1468,"children":1469},{"style":129},[1470],{"type":70,"value":1471}," (",{"type":64,"tag":110,"props":1473,"children":1474},{"style":123},[1475],{"type":70,"value":264},{"type":64,"tag":110,"props":1477,"children":1478},{"class":112,"line":328},[1479,1483,1487],{"type":64,"tag":110,"props":1480,"children":1481},{"style":256},[1482],{"type":70,"value":317},{"type":64,"tag":110,"props":1484,"children":1485},{"style":123},[1486],{"type":70,"value":278},{"type":64,"tag":110,"props":1488,"children":1489},{"style":123},[1490],{"type":70,"value":204},{"type":64,"tag":110,"props":1492,"children":1493},{"class":112,"line":371},[1494,1498,1502,1506,1510,1514,1519,1524,1528,1532],{"type":64,"tag":110,"props":1495,"children":1496},{"style":256},[1497],{"type":70,"value":334},{"type":64,"tag":110,"props":1499,"children":1500},{"style":123},[1501],{"type":70,"value":278},{"type":64,"tag":110,"props":1503,"children":1504},{"style":123},[1505],{"type":70,"value":343},{"type":64,"tag":110,"props":1507,"children":1508},{"style":160},[1509],{"type":70,"value":348},{"type":64,"tag":110,"props":1511,"children":1512},{"style":123},[1513],{"type":70,"value":353},{"type":64,"tag":110,"props":1515,"children":1516},{"style":117},[1517],{"type":70,"value":1518},"await",{"type":64,"tag":110,"props":1520,"children":1521},{"style":191},[1522],{"type":70,"value":1523}," getAccessToken",{"type":64,"tag":110,"props":1525,"children":1526},{"style":129},[1527],{"type":70,"value":199},{"type":64,"tag":110,"props":1529,"children":1530},{"style":123},[1531],{"type":70,"value":363},{"type":64,"tag":110,"props":1533,"children":1534},{"style":123},[1535],{"type":70,"value":368},{"type":64,"tag":110,"props":1537,"children":1538},{"class":112,"line":380},[1539],{"type":64,"tag":110,"props":1540,"children":1541},{"style":123},[1542],{"type":70,"value":377},{"type":64,"tag":110,"props":1544,"children":1545},{"class":112,"line":398},[1546,1551,1555],{"type":64,"tag":110,"props":1547,"children":1548},{"style":256},[1549],{"type":70,"value":1550},"      body",{"type":64,"tag":110,"props":1552,"children":1553},{"style":123},[1554],{"type":70,"value":278},{"type":64,"tag":110,"props":1556,"children":1557},{"style":123},[1558],{"type":70,"value":204},{"type":64,"tag":110,"props":1560,"children":1561},{"class":112,"line":412},[1562,1567,1571,1575,1579,1583],{"type":64,"tag":110,"props":1563,"children":1564},{"style":256},[1565],{"type":70,"value":1566},"        provider",{"type":64,"tag":110,"props":1568,"children":1569},{"style":123},[1570],{"type":70,"value":278},{"type":64,"tag":110,"props":1572,"children":1573},{"style":123},[1574],{"type":70,"value":157},{"type":64,"tag":110,"props":1576,"children":1577},{"style":160},[1578],{"type":70,"value":39},{"type":64,"tag":110,"props":1580,"children":1581},{"style":123},[1582],{"type":70,"value":291},{"type":64,"tag":110,"props":1584,"children":1585},{"style":123},[1586],{"type":70,"value":368},{"type":64,"tag":110,"props":1588,"children":1589},{"class":112,"line":420},[1590,1595,1599,1603,1608,1612],{"type":64,"tag":110,"props":1591,"children":1592},{"style":256},[1593],{"type":70,"value":1594},"        model",{"type":64,"tag":110,"props":1596,"children":1597},{"style":123},[1598],{"type":70,"value":278},{"type":64,"tag":110,"props":1600,"children":1601},{"style":123},[1602],{"type":70,"value":157},{"type":64,"tag":110,"props":1604,"children":1605},{"style":160},[1606],{"type":70,"value":1607},"gpt-4o",{"type":64,"tag":110,"props":1609,"children":1610},{"style":123},[1611],{"type":70,"value":291},{"type":64,"tag":110,"props":1613,"children":1614},{"style":123},[1615],{"type":70,"value":368},{"type":64,"tag":110,"props":1617,"children":1618},{"class":112,"line":434},[1619],{"type":64,"tag":110,"props":1620,"children":1621},{"style":123},[1622],{"type":70,"value":377},{"type":64,"tag":110,"props":1624,"children":1625},{"class":112,"line":454},[1626,1630,1634],{"type":64,"tag":110,"props":1627,"children":1628},{"style":123},[1629],{"type":70,"value":386},{"type":64,"tag":110,"props":1631,"children":1632},{"style":129},[1633],{"type":70,"value":391},{"type":64,"tag":110,"props":1635,"children":1636},{"style":123},[1637],{"type":70,"value":368},{"type":64,"tag":110,"props":1639,"children":1640},{"class":112,"line":503},[1641,1646],{"type":64,"tag":110,"props":1642,"children":1643},{"style":129},[1644],{"type":70,"value":1645},"  )",{"type":64,"tag":110,"props":1647,"children":1648},{"style":123},[1649],{"type":70,"value":368},{"type":64,"tag":110,"props":1651,"children":1652},{"class":112,"line":541},[1653,1657],{"type":64,"tag":110,"props":1654,"children":1655},{"style":123},[1656],{"type":70,"value":728},{"type":64,"tag":110,"props":1658,"children":1659},{"style":129},[1660],{"type":70,"value":409},{"type":64,"tag":73,"props":1662,"children":1663},{},[1664,1666,1672,1674,1679,1680,1686,1688,1694],{"type":70,"value":1665},"The ",{"type":64,"tag":91,"props":1667,"children":1669},{"className":1668},[],[1670],{"type":70,"value":1671},"body",{"type":70,"value":1673}," field in options is merged into the POST request body alongside\n",{"type":64,"tag":91,"props":1675,"children":1677},{"className":1676},[],[1678],{"type":70,"value":466},{"type":70,"value":945},{"type":64,"tag":91,"props":1681,"children":1683},{"className":1682},[],[1684],{"type":70,"value":1685},"data",{"type":70,"value":1687},", so the server receives ",{"type":64,"tag":91,"props":1689,"children":1691},{"className":1690},[],[1692],{"type":70,"value":1693},"{ messages, data, provider, model }",{"type":70,"value":471},{"type":64,"tag":73,"props":1696,"children":1697},{},[1698],{"type":64,"tag":552,"props":1699,"children":1700},{},[1701],{"type":70,"value":1702},"Custom fetch client (for proxies, interceptors, retries):",{"type":64,"tag":100,"props":1704,"children":1706},{"className":102,"code":1705,"language":45,"meta":104,"style":104},"import { useChat, fetchServerSentEvents } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchServerSentEvents('\u002Fapi\u002Fchat', {\n    fetchClient: myCustomFetch,\n  }),\n})\n",[1707],{"type":64,"tag":91,"props":1708,"children":1709},{"__ignoreMap":104},[1710,1753,1760,1803,1843,1864,1879],{"type":64,"tag":110,"props":1711,"children":1712},{"class":112,"line":113},[1713,1717,1721,1725,1729,1733,1737,1741,1745,1749],{"type":64,"tag":110,"props":1714,"children":1715},{"style":117},[1716],{"type":70,"value":120},{"type":64,"tag":110,"props":1718,"children":1719},{"style":123},[1720],{"type":70,"value":126},{"type":64,"tag":110,"props":1722,"children":1723},{"style":129},[1724],{"type":70,"value":132},{"type":64,"tag":110,"props":1726,"children":1727},{"style":123},[1728],{"type":70,"value":137},{"type":64,"tag":110,"props":1730,"children":1731},{"style":129},[1732],{"type":70,"value":142},{"type":64,"tag":110,"props":1734,"children":1735},{"style":123},[1736],{"type":70,"value":147},{"type":64,"tag":110,"props":1738,"children":1739},{"style":117},[1740],{"type":70,"value":152},{"type":64,"tag":110,"props":1742,"children":1743},{"style":123},[1744],{"type":70,"value":157},{"type":64,"tag":110,"props":1746,"children":1747},{"style":160},[1748],{"type":70,"value":163},{"type":64,"tag":110,"props":1750,"children":1751},{"style":123},[1752],{"type":70,"value":168},{"type":64,"tag":110,"props":1754,"children":1755},{"class":112,"line":171},[1756],{"type":64,"tag":110,"props":1757,"children":1758},{"emptyLinePlaceholder":175},[1759],{"type":70,"value":178},{"type":64,"tag":110,"props":1761,"children":1762},{"class":112,"line":181},[1763,1767,1771,1775,1779,1783,1787,1791,1795,1799],{"type":64,"tag":110,"props":1764,"children":1765},{"style":185},[1766],{"type":70,"value":1060},{"type":64,"tag":110,"props":1768,"children":1769},{"style":123},[1770],{"type":70,"value":126},{"type":64,"tag":110,"props":1772,"children":1773},{"style":129},[1774],{"type":70,"value":222},{"type":64,"tag":110,"props":1776,"children":1777},{"style":123},[1778],{"type":70,"value":137},{"type":64,"tag":110,"props":1780,"children":1781},{"style":129},[1782],{"type":70,"value":1077},{"type":64,"tag":110,"props":1784,"children":1785},{"style":123},[1786],{"type":70,"value":728},{"type":64,"tag":110,"props":1788,"children":1789},{"style":123},[1790],{"type":70,"value":249},{"type":64,"tag":110,"props":1792,"children":1793},{"style":191},[1794],{"type":70,"value":132},{"type":64,"tag":110,"props":1796,"children":1797},{"style":129},[1798],{"type":70,"value":259},{"type":64,"tag":110,"props":1800,"children":1801},{"style":123},[1802],{"type":70,"value":264},{"type":64,"tag":110,"props":1804,"children":1805},{"class":112,"line":207},[1806,1810,1814,1818,1822,1826,1831,1835,1839],{"type":64,"tag":110,"props":1807,"children":1808},{"style":256},[1809],{"type":70,"value":1105},{"type":64,"tag":110,"props":1811,"children":1812},{"style":123},[1813],{"type":70,"value":278},{"type":64,"tag":110,"props":1815,"children":1816},{"style":191},[1817],{"type":70,"value":142},{"type":64,"tag":110,"props":1819,"children":1820},{"style":129},[1821],{"type":70,"value":259},{"type":64,"tag":110,"props":1823,"children":1824},{"style":123},[1825],{"type":70,"value":291},{"type":64,"tag":110,"props":1827,"children":1828},{"style":160},[1829],{"type":70,"value":1830},"\u002Fapi\u002Fchat",{"type":64,"tag":110,"props":1832,"children":1833},{"style":123},[1834],{"type":70,"value":291},{"type":64,"tag":110,"props":1836,"children":1837},{"style":123},[1838],{"type":70,"value":137},{"type":64,"tag":110,"props":1840,"children":1841},{"style":123},[1842],{"type":70,"value":204},{"type":64,"tag":110,"props":1844,"children":1845},{"class":112,"line":267},[1846,1851,1855,1860],{"type":64,"tag":110,"props":1847,"children":1848},{"style":256},[1849],{"type":70,"value":1850},"    fetchClient",{"type":64,"tag":110,"props":1852,"children":1853},{"style":123},[1854],{"type":70,"value":278},{"type":64,"tag":110,"props":1856,"children":1857},{"style":129},[1858],{"type":70,"value":1859}," myCustomFetch",{"type":64,"tag":110,"props":1861,"children":1862},{"style":123},[1863],{"type":70,"value":368},{"type":64,"tag":110,"props":1865,"children":1866},{"class":112,"line":311},[1867,1871,1875],{"type":64,"tag":110,"props":1868,"children":1869},{"style":123},[1870],{"type":70,"value":404},{"type":64,"tag":110,"props":1872,"children":1873},{"style":129},[1874],{"type":70,"value":391},{"type":64,"tag":110,"props":1876,"children":1877},{"style":123},[1878],{"type":70,"value":368},{"type":64,"tag":110,"props":1880,"children":1881},{"class":112,"line":328},[1882,1886],{"type":64,"tag":110,"props":1883,"children":1884},{"style":123},[1885],{"type":70,"value":728},{"type":64,"tag":110,"props":1887,"children":1888},{"style":129},[1889],{"type":70,"value":409},{"type":64,"tag":961,"props":1891,"children":1893},{"id":1892},"_2-custom-ndjson-backend-with-fetchhttpstream",[1894],{"type":70,"value":1895},"2. Custom NDJSON Backend with fetchHttpStream",{"type":64,"tag":73,"props":1897,"children":1898},{},[1899,1901,1907,1909,1915,1917,1923],{"type":70,"value":1900},"Use when your backend sends newline-delimited JSON (",{"type":64,"tag":91,"props":1902,"children":1904},{"className":1903},[],[1905],{"type":70,"value":1906},"application\u002Fx-ndjson",{"type":70,"value":1908},")\ninstead of SSE. Each line is one JSON-encoded ",{"type":64,"tag":91,"props":1910,"children":1912},{"className":1911},[],[1913],{"type":70,"value":1914},"StreamChunk",{"type":70,"value":1916}," followed by ",{"type":64,"tag":91,"props":1918,"children":1920},{"className":1919},[],[1921],{"type":70,"value":1922},"\\n",{"type":70,"value":471},{"type":64,"tag":100,"props":1925,"children":1927},{"className":102,"code":1926,"language":45,"meta":104,"style":104},"import { useChat, fetchHttpStream } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchHttpStream('https:\u002F\u002Fmy-api.com\u002Fchat', {\n    headers: {\n      Authorization: `Bearer ${token}`,\n    },\n  }),\n})\n",[1928],{"type":64,"tag":91,"props":1929,"children":1930},{"__ignoreMap":104},[1931,1975,1982,2025,2064,2079,2114,2121,2136],{"type":64,"tag":110,"props":1932,"children":1933},{"class":112,"line":113},[1934,1938,1942,1946,1950,1955,1959,1963,1967,1971],{"type":64,"tag":110,"props":1935,"children":1936},{"style":117},[1937],{"type":70,"value":120},{"type":64,"tag":110,"props":1939,"children":1940},{"style":123},[1941],{"type":70,"value":126},{"type":64,"tag":110,"props":1943,"children":1944},{"style":129},[1945],{"type":70,"value":132},{"type":64,"tag":110,"props":1947,"children":1948},{"style":123},[1949],{"type":70,"value":137},{"type":64,"tag":110,"props":1951,"children":1952},{"style":129},[1953],{"type":70,"value":1954}," fetchHttpStream",{"type":64,"tag":110,"props":1956,"children":1957},{"style":123},[1958],{"type":70,"value":147},{"type":64,"tag":110,"props":1960,"children":1961},{"style":117},[1962],{"type":70,"value":152},{"type":64,"tag":110,"props":1964,"children":1965},{"style":123},[1966],{"type":70,"value":157},{"type":64,"tag":110,"props":1968,"children":1969},{"style":160},[1970],{"type":70,"value":163},{"type":64,"tag":110,"props":1972,"children":1973},{"style":123},[1974],{"type":70,"value":168},{"type":64,"tag":110,"props":1976,"children":1977},{"class":112,"line":171},[1978],{"type":64,"tag":110,"props":1979,"children":1980},{"emptyLinePlaceholder":175},[1981],{"type":70,"value":178},{"type":64,"tag":110,"props":1983,"children":1984},{"class":112,"line":181},[1985,1989,1993,1997,2001,2005,2009,2013,2017,2021],{"type":64,"tag":110,"props":1986,"children":1987},{"style":185},[1988],{"type":70,"value":1060},{"type":64,"tag":110,"props":1990,"children":1991},{"style":123},[1992],{"type":70,"value":126},{"type":64,"tag":110,"props":1994,"children":1995},{"style":129},[1996],{"type":70,"value":222},{"type":64,"tag":110,"props":1998,"children":1999},{"style":123},[2000],{"type":70,"value":137},{"type":64,"tag":110,"props":2002,"children":2003},{"style":129},[2004],{"type":70,"value":1077},{"type":64,"tag":110,"props":2006,"children":2007},{"style":123},[2008],{"type":70,"value":728},{"type":64,"tag":110,"props":2010,"children":2011},{"style":123},[2012],{"type":70,"value":249},{"type":64,"tag":110,"props":2014,"children":2015},{"style":191},[2016],{"type":70,"value":132},{"type":64,"tag":110,"props":2018,"children":2019},{"style":129},[2020],{"type":70,"value":259},{"type":64,"tag":110,"props":2022,"children":2023},{"style":123},[2024],{"type":70,"value":264},{"type":64,"tag":110,"props":2026,"children":2027},{"class":112,"line":207},[2028,2032,2036,2040,2044,2048,2052,2056,2060],{"type":64,"tag":110,"props":2029,"children":2030},{"style":256},[2031],{"type":70,"value":1105},{"type":64,"tag":110,"props":2033,"children":2034},{"style":123},[2035],{"type":70,"value":278},{"type":64,"tag":110,"props":2037,"children":2038},{"style":191},[2039],{"type":70,"value":1954},{"type":64,"tag":110,"props":2041,"children":2042},{"style":129},[2043],{"type":70,"value":259},{"type":64,"tag":110,"props":2045,"children":2046},{"style":123},[2047],{"type":70,"value":291},{"type":64,"tag":110,"props":2049,"children":2050},{"style":160},[2051],{"type":70,"value":296},{"type":64,"tag":110,"props":2053,"children":2054},{"style":123},[2055],{"type":70,"value":291},{"type":64,"tag":110,"props":2057,"children":2058},{"style":123},[2059],{"type":70,"value":137},{"type":64,"tag":110,"props":2061,"children":2062},{"style":123},[2063],{"type":70,"value":204},{"type":64,"tag":110,"props":2065,"children":2066},{"class":112,"line":267},[2067,2071,2075],{"type":64,"tag":110,"props":2068,"children":2069},{"style":256},[2070],{"type":70,"value":1145},{"type":64,"tag":110,"props":2072,"children":2073},{"style":123},[2074],{"type":70,"value":278},{"type":64,"tag":110,"props":2076,"children":2077},{"style":123},[2078],{"type":70,"value":204},{"type":64,"tag":110,"props":2080,"children":2081},{"class":112,"line":311},[2082,2086,2090,2094,2098,2102,2106,2110],{"type":64,"tag":110,"props":2083,"children":2084},{"style":256},[2085],{"type":70,"value":1161},{"type":64,"tag":110,"props":2087,"children":2088},{"style":123},[2089],{"type":70,"value":278},{"type":64,"tag":110,"props":2091,"children":2092},{"style":123},[2093],{"type":70,"value":343},{"type":64,"tag":110,"props":2095,"children":2096},{"style":160},[2097],{"type":70,"value":348},{"type":64,"tag":110,"props":2099,"children":2100},{"style":123},[2101],{"type":70,"value":353},{"type":64,"tag":110,"props":2103,"children":2104},{"style":129},[2105],{"type":70,"value":358},{"type":64,"tag":110,"props":2107,"children":2108},{"style":123},[2109],{"type":70,"value":363},{"type":64,"tag":110,"props":2111,"children":2112},{"style":123},[2113],{"type":70,"value":368},{"type":64,"tag":110,"props":2115,"children":2116},{"class":112,"line":328},[2117],{"type":64,"tag":110,"props":2118,"children":2119},{"style":123},[2120],{"type":70,"value":1227},{"type":64,"tag":110,"props":2122,"children":2123},{"class":112,"line":371},[2124,2128,2132],{"type":64,"tag":110,"props":2125,"children":2126},{"style":123},[2127],{"type":70,"value":404},{"type":64,"tag":110,"props":2129,"children":2130},{"style":129},[2131],{"type":70,"value":391},{"type":64,"tag":110,"props":2133,"children":2134},{"style":123},[2135],{"type":70,"value":368},{"type":64,"tag":110,"props":2137,"children":2138},{"class":112,"line":380},[2139,2143],{"type":64,"tag":110,"props":2140,"children":2141},{"style":123},[2142],{"type":70,"value":728},{"type":64,"tag":110,"props":2144,"children":2145},{"style":129},[2146],{"type":70,"value":409},{"type":64,"tag":73,"props":2148,"children":2149},{},[2150,2155,2157,2162,2164,2170,2172,2178],{"type":64,"tag":91,"props":2151,"children":2153},{"className":2152},[],[2154],{"type":70,"value":951},{"type":70,"value":2156}," accepts the same URL and options signatures as\n",{"type":64,"tag":91,"props":2158,"children":2160},{"className":2159},[],[2161],{"type":70,"value":943},{"type":70,"value":2163}," (static or dynamic, sync or async). The only difference\nis the parsing: no ",{"type":64,"tag":91,"props":2165,"children":2167},{"className":2166},[],[2168],{"type":70,"value":2169},"data:",{"type":70,"value":2171}," prefix stripping, no ",{"type":64,"tag":91,"props":2173,"children":2175},{"className":2174},[],[2176],{"type":70,"value":2177},"[DONE]",{"type":70,"value":2179}," sentinel -- just one\nJSON object per line.",{"type":64,"tag":73,"props":2181,"children":2182},{},[2183],{"type":64,"tag":552,"props":2184,"children":2185},{},[2186],{"type":70,"value":2187},"Dynamic options work identically:",{"type":64,"tag":100,"props":2189,"children":2191},{"className":102,"code":2190,"language":45,"meta":104,"style":104},"import { useChat, fetchHttpStream } from '@tanstack\u002Fai-react'\n\nconst { messages, sendMessage } = useChat({\n  connection: fetchHttpStream(\n    () => `\u002Fapi\u002Fchat?region=${region}`,\n    async () => ({\n      headers: { Authorization: `Bearer ${await refreshToken()}` },\n    }),\n  ),\n})\n",[2192],{"type":64,"tag":91,"props":2193,"children":2194},{"__ignoreMap":104},[2195,2238,2245,2288,2307,2344,2367,2425,2440,2451],{"type":64,"tag":110,"props":2196,"children":2197},{"class":112,"line":113},[2198,2202,2206,2210,2214,2218,2222,2226,2230,2234],{"type":64,"tag":110,"props":2199,"children":2200},{"style":117},[2201],{"type":70,"value":120},{"type":64,"tag":110,"props":2203,"children":2204},{"style":123},[2205],{"type":70,"value":126},{"type":64,"tag":110,"props":2207,"children":2208},{"style":129},[2209],{"type":70,"value":132},{"type":64,"tag":110,"props":2211,"children":2212},{"style":123},[2213],{"type":70,"value":137},{"type":64,"tag":110,"props":2215,"children":2216},{"style":129},[2217],{"type":70,"value":1954},{"type":64,"tag":110,"props":2219,"children":2220},{"style":123},[2221],{"type":70,"value":147},{"type":64,"tag":110,"props":2223,"children":2224},{"style":117},[2225],{"type":70,"value":152},{"type":64,"tag":110,"props":2227,"children":2228},{"style":123},[2229],{"type":70,"value":157},{"type":64,"tag":110,"props":2231,"children":2232},{"style":160},[2233],{"type":70,"value":163},{"type":64,"tag":110,"props":2235,"children":2236},{"style":123},[2237],{"type":70,"value":168},{"type":64,"tag":110,"props":2239,"children":2240},{"class":112,"line":171},[2241],{"type":64,"tag":110,"props":2242,"children":2243},{"emptyLinePlaceholder":175},[2244],{"type":70,"value":178},{"type":64,"tag":110,"props":2246,"children":2247},{"class":112,"line":181},[2248,2252,2256,2260,2264,2268,2272,2276,2280,2284],{"type":64,"tag":110,"props":2249,"children":2250},{"style":185},[2251],{"type":70,"value":1060},{"type":64,"tag":110,"props":2253,"children":2254},{"style":123},[2255],{"type":70,"value":126},{"type":64,"tag":110,"props":2257,"children":2258},{"style":129},[2259],{"type":70,"value":222},{"type":64,"tag":110,"props":2261,"children":2262},{"style":123},[2263],{"type":70,"value":137},{"type":64,"tag":110,"props":2265,"children":2266},{"style":129},[2267],{"type":70,"value":1077},{"type":64,"tag":110,"props":2269,"children":2270},{"style":123},[2271],{"type":70,"value":728},{"type":64,"tag":110,"props":2273,"children":2274},{"style":123},[2275],{"type":70,"value":249},{"type":64,"tag":110,"props":2277,"children":2278},{"style":191},[2279],{"type":70,"value":132},{"type":64,"tag":110,"props":2281,"children":2282},{"style":129},[2283],{"type":70,"value":259},{"type":64,"tag":110,"props":2285,"children":2286},{"style":123},[2287],{"type":70,"value":264},{"type":64,"tag":110,"props":2289,"children":2290},{"class":112,"line":207},[2291,2295,2299,2303],{"type":64,"tag":110,"props":2292,"children":2293},{"style":256},[2294],{"type":70,"value":1105},{"type":64,"tag":110,"props":2296,"children":2297},{"style":123},[2298],{"type":70,"value":278},{"type":64,"tag":110,"props":2300,"children":2301},{"style":191},[2302],{"type":70,"value":1954},{"type":64,"tag":110,"props":2304,"children":2305},{"style":129},[2306],{"type":70,"value":1410},{"type":64,"tag":110,"props":2308,"children":2309},{"class":112,"line":267},[2310,2314,2318,2322,2327,2331,2336,2340],{"type":64,"tag":110,"props":2311,"children":2312},{"style":123},[2313],{"type":70,"value":1418},{"type":64,"tag":110,"props":2315,"children":2316},{"style":185},[2317],{"type":70,"value":1423},{"type":64,"tag":110,"props":2319,"children":2320},{"style":123},[2321],{"type":70,"value":343},{"type":64,"tag":110,"props":2323,"children":2324},{"style":160},[2325],{"type":70,"value":2326},"\u002Fapi\u002Fchat?region=",{"type":64,"tag":110,"props":2328,"children":2329},{"style":123},[2330],{"type":70,"value":353},{"type":64,"tag":110,"props":2332,"children":2333},{"style":129},[2334],{"type":70,"value":2335},"region",{"type":64,"tag":110,"props":2337,"children":2338},{"style":123},[2339],{"type":70,"value":363},{"type":64,"tag":110,"props":2341,"children":2342},{"style":123},[2343],{"type":70,"value":368},{"type":64,"tag":110,"props":2345,"children":2346},{"class":112,"line":311},[2347,2351,2355,2359,2363],{"type":64,"tag":110,"props":2348,"children":2349},{"style":185},[2350],{"type":70,"value":1457},{"type":64,"tag":110,"props":2352,"children":2353},{"style":123},[2354],{"type":70,"value":1462},{"type":64,"tag":110,"props":2356,"children":2357},{"style":185},[2358],{"type":70,"value":1423},{"type":64,"tag":110,"props":2360,"children":2361},{"style":129},[2362],{"type":70,"value":1471},{"type":64,"tag":110,"props":2364,"children":2365},{"style":123},[2366],{"type":70,"value":264},{"type":64,"tag":110,"props":2368,"children":2369},{"class":112,"line":328},[2370,2374,2378,2382,2387,2391,2395,2399,2403,2407,2412,2416,2420],{"type":64,"tag":110,"props":2371,"children":2372},{"style":256},[2373],{"type":70,"value":317},{"type":64,"tag":110,"props":2375,"children":2376},{"style":123},[2377],{"type":70,"value":278},{"type":64,"tag":110,"props":2379,"children":2380},{"style":123},[2381],{"type":70,"value":126},{"type":64,"tag":110,"props":2383,"children":2384},{"style":256},[2385],{"type":70,"value":2386}," Authorization",{"type":64,"tag":110,"props":2388,"children":2389},{"style":123},[2390],{"type":70,"value":278},{"type":64,"tag":110,"props":2392,"children":2393},{"style":123},[2394],{"type":70,"value":343},{"type":64,"tag":110,"props":2396,"children":2397},{"style":160},[2398],{"type":70,"value":348},{"type":64,"tag":110,"props":2400,"children":2401},{"style":123},[2402],{"type":70,"value":353},{"type":64,"tag":110,"props":2404,"children":2405},{"style":117},[2406],{"type":70,"value":1518},{"type":64,"tag":110,"props":2408,"children":2409},{"style":191},[2410],{"type":70,"value":2411}," refreshToken",{"type":64,"tag":110,"props":2413,"children":2414},{"style":129},[2415],{"type":70,"value":199},{"type":64,"tag":110,"props":2417,"children":2418},{"style":123},[2419],{"type":70,"value":363},{"type":64,"tag":110,"props":2421,"children":2422},{"style":123},[2423],{"type":70,"value":2424}," },\n",{"type":64,"tag":110,"props":2426,"children":2427},{"class":112,"line":371},[2428,2432,2436],{"type":64,"tag":110,"props":2429,"children":2430},{"style":123},[2431],{"type":70,"value":386},{"type":64,"tag":110,"props":2433,"children":2434},{"style":129},[2435],{"type":70,"value":391},{"type":64,"tag":110,"props":2437,"children":2438},{"style":123},[2439],{"type":70,"value":368},{"type":64,"tag":110,"props":2441,"children":2442},{"class":112,"line":380},[2443,2447],{"type":64,"tag":110,"props":2444,"children":2445},{"style":129},[2446],{"type":70,"value":1645},{"type":64,"tag":110,"props":2448,"children":2449},{"style":123},[2450],{"type":70,"value":368},{"type":64,"tag":110,"props":2452,"children":2453},{"class":112,"line":398},[2454,2458],{"type":64,"tag":110,"props":2455,"children":2456},{"style":123},[2457],{"type":70,"value":728},{"type":64,"tag":110,"props":2459,"children":2460},{"style":129},[2461],{"type":70,"value":409},{"type":64,"tag":961,"props":2463,"children":2465},{"id":2464},"_3-fully-custom-connection-adapter",[2466],{"type":70,"value":2467},"3. Fully Custom Connection Adapter",{"type":64,"tag":73,"props":2469,"children":2470},{},[2471,2473,2479],{"type":70,"value":2472},"For protocols that don't fit SSE or NDJSON (WebSockets, gRPC-web, custom binary,\nserver functions), implement the ",{"type":64,"tag":91,"props":2474,"children":2476},{"className":2475},[],[2477],{"type":70,"value":2478},"ConnectionAdapter",{"type":70,"value":2480}," interface directly.",{"type":64,"tag":73,"props":2482,"children":2483},{},[2484],{"type":70,"value":2485},"There are two mutually exclusive modes:",{"type":64,"tag":73,"props":2487,"children":2488},{},[2489],{"type":64,"tag":552,"props":2490,"children":2491},{},[2492],{"type":70,"value":2493},"ConnectConnectionAdapter (pull-based \u002F async iterable):",{"type":64,"tag":73,"props":2495,"children":2496},{},[2497],{"type":70,"value":2498},"Use when the client initiates a request and consumes the response as a stream.\nThis is the simpler model and covers most HTTP-based protocols.",{"type":64,"tag":100,"props":2500,"children":2502},{"className":102,"code":2501,"language":45,"meta":104,"style":104},"import { useChat } from '@tanstack\u002Fai-react'\nimport type { ConnectionAdapter } from '@tanstack\u002Fai-react'\nimport type { StreamChunk, UIMessage } from '@tanstack\u002Fai'\n\nconst websocketAdapter: ConnectionAdapter = {\n  async *connect(\n    messages: Array\u003CUIMessage>,\n    data?: Record\u003Cstring, any>,\n    abortSignal?: AbortSignal,\n  ): AsyncGenerator\u003CStreamChunk> {\n    const ws = new WebSocket('wss:\u002F\u002Fmy-api.com\u002Fchat')\n\n    \u002F\u002F Wait for connection\n    await new Promise\u003Cvoid>((resolve, reject) => {\n      ws.onopen = () => resolve()\n      ws.onerror = (e) => reject(e)\n    })\n\n    \u002F\u002F Send messages\n    ws.send(JSON.stringify({ messages, ...data }))\n\n    \u002F\u002F Create an async queue to bridge WebSocket events to an async iterable\n    const queue: Array\u003CStreamChunk> = []\n    let resolve: (() => void) | null = null\n    let done = false\n\n    ws.onmessage = (event) => {\n      const chunk: StreamChunk = JSON.parse(event.data)\n      queue.push(chunk)\n      resolve?.()\n    }\n\n    ws.onclose = () => {\n      done = true\n      resolve?.()\n    }\n\n    ws.onerror = () => {\n      done = true\n      resolve?.()\n    }\n\n    abortSignal?.addEventListener('abort', () => {\n      ws.close()\n    })\n\n    \u002F\u002F Yield chunks as they arrive\n    while (!done || queue.length > 0) {\n      if (queue.length > 0) {\n        yield queue.shift()!\n      } else {\n        await new Promise\u003Cvoid>((r) => {\n          resolve = r\n        })\n      }\n    }\n  },\n}\n\nfunction Chat() {\n  const { messages, sendMessage } = useChat({\n    connection: websocketAdapter,\n  })\n\n  \u002F\u002F ... render messages\n}\n",[2503],{"type":64,"tag":91,"props":2504,"children":2505},{"__ignoreMap":104},[2506,2541,2582,2632,2639,2667,2689,2721,2761,2782,2811,2859,2866,2875,2939,2978,3031,3042,3049,3057,3126,3133,3141,3182,3238,3260,3267,3308,3367,3398,3416,3425,3433,3466,3484,3500,3508,3516,3548,3564,3580,3588,3596,3646,3667,3679,3687,3696,3756,3798,3829,3847,3901,3919,3932,3941,3949,3958,3966,3974,3994,4038,4058,4070,4078,4087],{"type":64,"tag":110,"props":2507,"children":2508},{"class":112,"line":113},[2509,2513,2517,2521,2525,2529,2533,2537],{"type":64,"tag":110,"props":2510,"children":2511},{"style":117},[2512],{"type":70,"value":120},{"type":64,"tag":110,"props":2514,"children":2515},{"style":123},[2516],{"type":70,"value":126},{"type":64,"tag":110,"props":2518,"children":2519},{"style":129},[2520],{"type":70,"value":132},{"type":64,"tag":110,"props":2522,"children":2523},{"style":123},[2524],{"type":70,"value":147},{"type":64,"tag":110,"props":2526,"children":2527},{"style":117},[2528],{"type":70,"value":152},{"type":64,"tag":110,"props":2530,"children":2531},{"style":123},[2532],{"type":70,"value":157},{"type":64,"tag":110,"props":2534,"children":2535},{"style":160},[2536],{"type":70,"value":163},{"type":64,"tag":110,"props":2538,"children":2539},{"style":123},[2540],{"type":70,"value":168},{"type":64,"tag":110,"props":2542,"children":2543},{"class":112,"line":171},[2544,2548,2553,2557,2562,2566,2570,2574,2578],{"type":64,"tag":110,"props":2545,"children":2546},{"style":117},[2547],{"type":70,"value":120},{"type":64,"tag":110,"props":2549,"children":2550},{"style":117},[2551],{"type":70,"value":2552}," type",{"type":64,"tag":110,"props":2554,"children":2555},{"style":123},[2556],{"type":70,"value":126},{"type":64,"tag":110,"props":2558,"children":2559},{"style":129},[2560],{"type":70,"value":2561}," ConnectionAdapter",{"type":64,"tag":110,"props":2563,"children":2564},{"style":123},[2565],{"type":70,"value":147},{"type":64,"tag":110,"props":2567,"children":2568},{"style":117},[2569],{"type":70,"value":152},{"type":64,"tag":110,"props":2571,"children":2572},{"style":123},[2573],{"type":70,"value":157},{"type":64,"tag":110,"props":2575,"children":2576},{"style":160},[2577],{"type":70,"value":163},{"type":64,"tag":110,"props":2579,"children":2580},{"style":123},[2581],{"type":70,"value":168},{"type":64,"tag":110,"props":2583,"children":2584},{"class":112,"line":181},[2585,2589,2593,2597,2602,2606,2611,2615,2619,2623,2628],{"type":64,"tag":110,"props":2586,"children":2587},{"style":117},[2588],{"type":70,"value":120},{"type":64,"tag":110,"props":2590,"children":2591},{"style":117},[2592],{"type":70,"value":2552},{"type":64,"tag":110,"props":2594,"children":2595},{"style":123},[2596],{"type":70,"value":126},{"type":64,"tag":110,"props":2598,"children":2599},{"style":129},[2600],{"type":70,"value":2601}," StreamChunk",{"type":64,"tag":110,"props":2603,"children":2604},{"style":123},[2605],{"type":70,"value":137},{"type":64,"tag":110,"props":2607,"children":2608},{"style":129},[2609],{"type":70,"value":2610}," UIMessage",{"type":64,"tag":110,"props":2612,"children":2613},{"style":123},[2614],{"type":70,"value":147},{"type":64,"tag":110,"props":2616,"children":2617},{"style":117},[2618],{"type":70,"value":152},{"type":64,"tag":110,"props":2620,"children":2621},{"style":123},[2622],{"type":70,"value":157},{"type":64,"tag":110,"props":2624,"children":2625},{"style":160},[2626],{"type":70,"value":2627},"@tanstack\u002Fai",{"type":64,"tag":110,"props":2629,"children":2630},{"style":123},[2631],{"type":70,"value":168},{"type":64,"tag":110,"props":2633,"children":2634},{"class":112,"line":207},[2635],{"type":64,"tag":110,"props":2636,"children":2637},{"emptyLinePlaceholder":175},[2638],{"type":70,"value":178},{"type":64,"tag":110,"props":2640,"children":2641},{"class":112,"line":267},[2642,2646,2651,2655,2659,2663],{"type":64,"tag":110,"props":2643,"children":2644},{"style":185},[2645],{"type":70,"value":1060},{"type":64,"tag":110,"props":2647,"children":2648},{"style":129},[2649],{"type":70,"value":2650}," websocketAdapter",{"type":64,"tag":110,"props":2652,"children":2653},{"style":123},[2654],{"type":70,"value":278},{"type":64,"tag":110,"props":2656,"children":2657},{"style":443},[2658],{"type":70,"value":2561},{"type":64,"tag":110,"props":2660,"children":2661},{"style":123},[2662],{"type":70,"value":249},{"type":64,"tag":110,"props":2664,"children":2665},{"style":123},[2666],{"type":70,"value":204},{"type":64,"tag":110,"props":2668,"children":2669},{"class":112,"line":311},[2670,2675,2680,2685],{"type":64,"tag":110,"props":2671,"children":2672},{"style":185},[2673],{"type":70,"value":2674},"  async",{"type":64,"tag":110,"props":2676,"children":2677},{"style":123},[2678],{"type":70,"value":2679}," *",{"type":64,"tag":110,"props":2681,"children":2682},{"style":256},[2683],{"type":70,"value":2684},"connect",{"type":64,"tag":110,"props":2686,"children":2687},{"style":123},[2688],{"type":70,"value":1410},{"type":64,"tag":110,"props":2690,"children":2691},{"class":112,"line":328},[2692,2697,2701,2706,2711,2716],{"type":64,"tag":110,"props":2693,"children":2694},{"style":463},[2695],{"type":70,"value":2696},"    messages",{"type":64,"tag":110,"props":2698,"children":2699},{"style":123},[2700],{"type":70,"value":278},{"type":64,"tag":110,"props":2702,"children":2703},{"style":443},[2704],{"type":70,"value":2705}," Array",{"type":64,"tag":110,"props":2707,"children":2708},{"style":123},[2709],{"type":70,"value":2710},"\u003C",{"type":64,"tag":110,"props":2712,"children":2713},{"style":443},[2714],{"type":70,"value":2715},"UIMessage",{"type":64,"tag":110,"props":2717,"children":2718},{"style":123},[2719],{"type":70,"value":2720},">,\n",{"type":64,"tag":110,"props":2722,"children":2723},{"class":112,"line":371},[2724,2729,2734,2739,2743,2748,2752,2757],{"type":64,"tag":110,"props":2725,"children":2726},{"style":463},[2727],{"type":70,"value":2728},"    data",{"type":64,"tag":110,"props":2730,"children":2731},{"style":123},[2732],{"type":70,"value":2733},"?:",{"type":64,"tag":110,"props":2735,"children":2736},{"style":443},[2737],{"type":70,"value":2738}," Record",{"type":64,"tag":110,"props":2740,"children":2741},{"style":123},[2742],{"type":70,"value":2710},{"type":64,"tag":110,"props":2744,"children":2745},{"style":443},[2746],{"type":70,"value":2747},"string",{"type":64,"tag":110,"props":2749,"children":2750},{"style":123},[2751],{"type":70,"value":137},{"type":64,"tag":110,"props":2753,"children":2754},{"style":443},[2755],{"type":70,"value":2756}," any",{"type":64,"tag":110,"props":2758,"children":2759},{"style":123},[2760],{"type":70,"value":2720},{"type":64,"tag":110,"props":2762,"children":2763},{"class":112,"line":380},[2764,2769,2773,2778],{"type":64,"tag":110,"props":2765,"children":2766},{"style":463},[2767],{"type":70,"value":2768},"    abortSignal",{"type":64,"tag":110,"props":2770,"children":2771},{"style":123},[2772],{"type":70,"value":2733},{"type":64,"tag":110,"props":2774,"children":2775},{"style":443},[2776],{"type":70,"value":2777}," AbortSignal",{"type":64,"tag":110,"props":2779,"children":2780},{"style":123},[2781],{"type":70,"value":368},{"type":64,"tag":110,"props":2783,"children":2784},{"class":112,"line":398},[2785,2790,2795,2799,2803,2807],{"type":64,"tag":110,"props":2786,"children":2787},{"style":123},[2788],{"type":70,"value":2789},"  ):",{"type":64,"tag":110,"props":2791,"children":2792},{"style":443},[2793],{"type":70,"value":2794}," AsyncGenerator",{"type":64,"tag":110,"props":2796,"children":2797},{"style":123},[2798],{"type":70,"value":2710},{"type":64,"tag":110,"props":2800,"children":2801},{"style":443},[2802],{"type":70,"value":1914},{"type":64,"tag":110,"props":2804,"children":2805},{"style":123},[2806],{"type":70,"value":557},{"type":64,"tag":110,"props":2808,"children":2809},{"style":123},[2810],{"type":70,"value":204},{"type":64,"tag":110,"props":2812,"children":2813},{"class":112,"line":412},[2814,2819,2824,2828,2833,2838,2842,2846,2851,2855],{"type":64,"tag":110,"props":2815,"children":2816},{"style":185},[2817],{"type":70,"value":2818},"    const",{"type":64,"tag":110,"props":2820,"children":2821},{"style":129},[2822],{"type":70,"value":2823}," ws",{"type":64,"tag":110,"props":2825,"children":2826},{"style":123},[2827],{"type":70,"value":249},{"type":64,"tag":110,"props":2829,"children":2830},{"style":123},[2831],{"type":70,"value":2832}," new",{"type":64,"tag":110,"props":2834,"children":2835},{"style":191},[2836],{"type":70,"value":2837}," WebSocket",{"type":64,"tag":110,"props":2839,"children":2840},{"style":256},[2841],{"type":70,"value":259},{"type":64,"tag":110,"props":2843,"children":2844},{"style":123},[2845],{"type":70,"value":291},{"type":64,"tag":110,"props":2847,"children":2848},{"style":160},[2849],{"type":70,"value":2850},"wss:\u002F\u002Fmy-api.com\u002Fchat",{"type":64,"tag":110,"props":2852,"children":2853},{"style":123},[2854],{"type":70,"value":291},{"type":64,"tag":110,"props":2856,"children":2857},{"style":256},[2858],{"type":70,"value":409},{"type":64,"tag":110,"props":2860,"children":2861},{"class":112,"line":420},[2862],{"type":64,"tag":110,"props":2863,"children":2864},{"emptyLinePlaceholder":175},[2865],{"type":70,"value":178},{"type":64,"tag":110,"props":2867,"children":2868},{"class":112,"line":434},[2869],{"type":64,"tag":110,"props":2870,"children":2872},{"style":2871},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[2873],{"type":70,"value":2874},"    \u002F\u002F Wait for connection\n",{"type":64,"tag":110,"props":2876,"children":2877},{"class":112,"line":454},[2878,2883,2887,2892,2896,2901,2905,2909,2913,2918,2922,2927,2931,2935],{"type":64,"tag":110,"props":2879,"children":2880},{"style":117},[2881],{"type":70,"value":2882},"    await",{"type":64,"tag":110,"props":2884,"children":2885},{"style":123},[2886],{"type":70,"value":2832},{"type":64,"tag":110,"props":2888,"children":2889},{"style":443},[2890],{"type":70,"value":2891}," Promise",{"type":64,"tag":110,"props":2893,"children":2894},{"style":123},[2895],{"type":70,"value":2710},{"type":64,"tag":110,"props":2897,"children":2898},{"style":443},[2899],{"type":70,"value":2900},"void",{"type":64,"tag":110,"props":2902,"children":2903},{"style":123},[2904],{"type":70,"value":557},{"type":64,"tag":110,"props":2906,"children":2907},{"style":256},[2908],{"type":70,"value":259},{"type":64,"tag":110,"props":2910,"children":2911},{"style":123},[2912],{"type":70,"value":259},{"type":64,"tag":110,"props":2914,"children":2915},{"style":463},[2916],{"type":70,"value":2917},"resolve",{"type":64,"tag":110,"props":2919,"children":2920},{"style":123},[2921],{"type":70,"value":137},{"type":64,"tag":110,"props":2923,"children":2924},{"style":463},[2925],{"type":70,"value":2926}," reject",{"type":64,"tag":110,"props":2928,"children":2929},{"style":123},[2930],{"type":70,"value":391},{"type":64,"tag":110,"props":2932,"children":2933},{"style":185},[2934],{"type":70,"value":1423},{"type":64,"tag":110,"props":2936,"children":2937},{"style":123},[2938],{"type":70,"value":204},{"type":64,"tag":110,"props":2940,"children":2941},{"class":112,"line":503},[2942,2947,2951,2956,2960,2964,2968,2973],{"type":64,"tag":110,"props":2943,"children":2944},{"style":129},[2945],{"type":70,"value":2946},"      ws",{"type":64,"tag":110,"props":2948,"children":2949},{"style":123},[2950],{"type":70,"value":471},{"type":64,"tag":110,"props":2952,"children":2953},{"style":191},[2954],{"type":70,"value":2955},"onopen",{"type":64,"tag":110,"props":2957,"children":2958},{"style":123},[2959],{"type":70,"value":249},{"type":64,"tag":110,"props":2961,"children":2962},{"style":123},[2963],{"type":70,"value":1462},{"type":64,"tag":110,"props":2965,"children":2966},{"style":185},[2967],{"type":70,"value":1423},{"type":64,"tag":110,"props":2969,"children":2970},{"style":191},[2971],{"type":70,"value":2972}," resolve",{"type":64,"tag":110,"props":2974,"children":2975},{"style":256},[2976],{"type":70,"value":2977},"()\n",{"type":64,"tag":110,"props":2979,"children":2980},{"class":112,"line":541},[2981,2985,2989,2994,2998,3002,3007,3011,3015,3019,3023,3027],{"type":64,"tag":110,"props":2982,"children":2983},{"style":129},[2984],{"type":70,"value":2946},{"type":64,"tag":110,"props":2986,"children":2987},{"style":123},[2988],{"type":70,"value":471},{"type":64,"tag":110,"props":2990,"children":2991},{"style":191},[2992],{"type":70,"value":2993},"onerror",{"type":64,"tag":110,"props":2995,"children":2996},{"style":123},[2997],{"type":70,"value":249},{"type":64,"tag":110,"props":2999,"children":3000},{"style":123},[3001],{"type":70,"value":1471},{"type":64,"tag":110,"props":3003,"children":3004},{"style":463},[3005],{"type":70,"value":3006},"e",{"type":64,"tag":110,"props":3008,"children":3009},{"style":123},[3010],{"type":70,"value":391},{"type":64,"tag":110,"props":3012,"children":3013},{"style":185},[3014],{"type":70,"value":1423},{"type":64,"tag":110,"props":3016,"children":3017},{"style":191},[3018],{"type":70,"value":2926},{"type":64,"tag":110,"props":3020,"children":3021},{"style":256},[3022],{"type":70,"value":259},{"type":64,"tag":110,"props":3024,"children":3025},{"style":129},[3026],{"type":70,"value":3006},{"type":64,"tag":110,"props":3028,"children":3029},{"style":256},[3030],{"type":70,"value":409},{"type":64,"tag":110,"props":3032,"children":3033},{"class":112,"line":592},[3034,3038],{"type":64,"tag":110,"props":3035,"children":3036},{"style":123},[3037],{"type":70,"value":386},{"type":64,"tag":110,"props":3039,"children":3040},{"style":256},[3041],{"type":70,"value":409},{"type":64,"tag":110,"props":3043,"children":3044},{"class":112,"line":652},[3045],{"type":64,"tag":110,"props":3046,"children":3047},{"emptyLinePlaceholder":175},[3048],{"type":70,"value":178},{"type":64,"tag":110,"props":3050,"children":3051},{"class":112,"line":690},[3052],{"type":64,"tag":110,"props":3053,"children":3054},{"style":2871},[3055],{"type":70,"value":3056},"    \u002F\u002F Send messages\n",{"type":64,"tag":110,"props":3058,"children":3059},{"class":112,"line":762},[3060,3065,3069,3074,3078,3083,3087,3092,3096,3100,3104,3108,3113,3117,3121],{"type":64,"tag":110,"props":3061,"children":3062},{"style":129},[3063],{"type":70,"value":3064},"    ws",{"type":64,"tag":110,"props":3066,"children":3067},{"style":123},[3068],{"type":70,"value":471},{"type":64,"tag":110,"props":3070,"children":3071},{"style":191},[3072],{"type":70,"value":3073},"send",{"type":64,"tag":110,"props":3075,"children":3076},{"style":256},[3077],{"type":70,"value":259},{"type":64,"tag":110,"props":3079,"children":3080},{"style":129},[3081],{"type":70,"value":3082},"JSON",{"type":64,"tag":110,"props":3084,"children":3085},{"style":123},[3086],{"type":70,"value":471},{"type":64,"tag":110,"props":3088,"children":3089},{"style":191},[3090],{"type":70,"value":3091},"stringify",{"type":64,"tag":110,"props":3093,"children":3094},{"style":256},[3095],{"type":70,"value":259},{"type":64,"tag":110,"props":3097,"children":3098},{"style":123},[3099],{"type":70,"value":562},{"type":64,"tag":110,"props":3101,"children":3102},{"style":129},[3103],{"type":70,"value":222},{"type":64,"tag":110,"props":3105,"children":3106},{"style":123},[3107],{"type":70,"value":137},{"type":64,"tag":110,"props":3109,"children":3110},{"style":123},[3111],{"type":70,"value":3112}," ...",{"type":64,"tag":110,"props":3114,"children":3115},{"style":129},[3116],{"type":70,"value":1685},{"type":64,"tag":110,"props":3118,"children":3119},{"style":123},[3120],{"type":70,"value":147},{"type":64,"tag":110,"props":3122,"children":3123},{"style":256},[3124],{"type":70,"value":3125},"))\n",{"type":64,"tag":110,"props":3127,"children":3128},{"class":112,"line":771},[3129],{"type":64,"tag":110,"props":3130,"children":3131},{"emptyLinePlaceholder":175},[3132],{"type":70,"value":178},{"type":64,"tag":110,"props":3134,"children":3135},{"class":112,"line":785},[3136],{"type":64,"tag":110,"props":3137,"children":3138},{"style":2871},[3139],{"type":70,"value":3140},"    \u002F\u002F Create an async queue to bridge WebSocket events to an async iterable\n",{"type":64,"tag":110,"props":3142,"children":3143},{"class":112,"line":803},[3144,3148,3153,3157,3161,3165,3169,3173,3177],{"type":64,"tag":110,"props":3145,"children":3146},{"style":185},[3147],{"type":70,"value":2818},{"type":64,"tag":110,"props":3149,"children":3150},{"style":129},[3151],{"type":70,"value":3152}," queue",{"type":64,"tag":110,"props":3154,"children":3155},{"style":123},[3156],{"type":70,"value":278},{"type":64,"tag":110,"props":3158,"children":3159},{"style":443},[3160],{"type":70,"value":2705},{"type":64,"tag":110,"props":3162,"children":3163},{"style":123},[3164],{"type":70,"value":2710},{"type":64,"tag":110,"props":3166,"children":3167},{"style":443},[3168],{"type":70,"value":1914},{"type":64,"tag":110,"props":3170,"children":3171},{"style":123},[3172],{"type":70,"value":557},{"type":64,"tag":110,"props":3174,"children":3175},{"style":123},[3176],{"type":70,"value":249},{"type":64,"tag":110,"props":3178,"children":3179},{"style":256},[3180],{"type":70,"value":3181}," []\n",{"type":64,"tag":110,"props":3183,"children":3184},{"class":112,"line":820},[3185,3190,3194,3198,3202,3206,3210,3215,3219,3224,3229,3233],{"type":64,"tag":110,"props":3186,"children":3187},{"style":185},[3188],{"type":70,"value":3189},"    let",{"type":64,"tag":110,"props":3191,"children":3192},{"style":129},[3193],{"type":70,"value":2972},{"type":64,"tag":110,"props":3195,"children":3196},{"style":123},[3197],{"type":70,"value":278},{"type":64,"tag":110,"props":3199,"children":3200},{"style":256},[3201],{"type":70,"value":1471},{"type":64,"tag":110,"props":3203,"children":3204},{"style":123},[3205],{"type":70,"value":199},{"type":64,"tag":110,"props":3207,"children":3208},{"style":185},[3209],{"type":70,"value":1423},{"type":64,"tag":110,"props":3211,"children":3212},{"style":443},[3213],{"type":70,"value":3214}," void",{"type":64,"tag":110,"props":3216,"children":3217},{"style":256},[3218],{"type":70,"value":491},{"type":64,"tag":110,"props":3220,"children":3221},{"style":123},[3222],{"type":70,"value":3223},"|",{"type":64,"tag":110,"props":3225,"children":3226},{"style":443},[3227],{"type":70,"value":3228}," null",{"type":64,"tag":110,"props":3230,"children":3231},{"style":123},[3232],{"type":70,"value":249},{"type":64,"tag":110,"props":3234,"children":3235},{"style":123},[3236],{"type":70,"value":3237}," null\n",{"type":64,"tag":110,"props":3239,"children":3240},{"class":112,"line":833},[3241,3245,3250,3254],{"type":64,"tag":110,"props":3242,"children":3243},{"style":185},[3244],{"type":70,"value":3189},{"type":64,"tag":110,"props":3246,"children":3247},{"style":129},[3248],{"type":70,"value":3249}," done",{"type":64,"tag":110,"props":3251,"children":3252},{"style":123},[3253],{"type":70,"value":249},{"type":64,"tag":110,"props":3255,"children":3257},{"style":3256},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[3258],{"type":70,"value":3259}," false\n",{"type":64,"tag":110,"props":3261,"children":3262},{"class":112,"line":901},[3263],{"type":64,"tag":110,"props":3264,"children":3265},{"emptyLinePlaceholder":175},[3266],{"type":70,"value":178},{"type":64,"tag":110,"props":3268,"children":3269},{"class":112,"line":918},[3270,3274,3278,3283,3287,3291,3296,3300,3304],{"type":64,"tag":110,"props":3271,"children":3272},{"style":129},[3273],{"type":70,"value":3064},{"type":64,"tag":110,"props":3275,"children":3276},{"style":123},[3277],{"type":70,"value":471},{"type":64,"tag":110,"props":3279,"children":3280},{"style":191},[3281],{"type":70,"value":3282},"onmessage",{"type":64,"tag":110,"props":3284,"children":3285},{"style":123},[3286],{"type":70,"value":249},{"type":64,"tag":110,"props":3288,"children":3289},{"style":123},[3290],{"type":70,"value":1471},{"type":64,"tag":110,"props":3292,"children":3293},{"style":463},[3294],{"type":70,"value":3295},"event",{"type":64,"tag":110,"props":3297,"children":3298},{"style":123},[3299],{"type":70,"value":391},{"type":64,"tag":110,"props":3301,"children":3302},{"style":185},[3303],{"type":70,"value":1423},{"type":64,"tag":110,"props":3305,"children":3306},{"style":123},[3307],{"type":70,"value":204},{"type":64,"tag":110,"props":3309,"children":3310},{"class":112,"line":927},[3311,3316,3321,3325,3329,3333,3338,3342,3347,3351,3355,3359,3363],{"type":64,"tag":110,"props":3312,"children":3313},{"style":185},[3314],{"type":70,"value":3315},"      const",{"type":64,"tag":110,"props":3317,"children":3318},{"style":129},[3319],{"type":70,"value":3320}," chunk",{"type":64,"tag":110,"props":3322,"children":3323},{"style":123},[3324],{"type":70,"value":278},{"type":64,"tag":110,"props":3326,"children":3327},{"style":443},[3328],{"type":70,"value":2601},{"type":64,"tag":110,"props":3330,"children":3331},{"style":123},[3332],{"type":70,"value":249},{"type":64,"tag":110,"props":3334,"children":3335},{"style":129},[3336],{"type":70,"value":3337}," JSON",{"type":64,"tag":110,"props":3339,"children":3340},{"style":123},[3341],{"type":70,"value":471},{"type":64,"tag":110,"props":3343,"children":3344},{"style":191},[3345],{"type":70,"value":3346},"parse",{"type":64,"tag":110,"props":3348,"children":3349},{"style":256},[3350],{"type":70,"value":259},{"type":64,"tag":110,"props":3352,"children":3353},{"style":129},[3354],{"type":70,"value":3295},{"type":64,"tag":110,"props":3356,"children":3357},{"style":123},[3358],{"type":70,"value":471},{"type":64,"tag":110,"props":3360,"children":3361},{"style":129},[3362],{"type":70,"value":1685},{"type":64,"tag":110,"props":3364,"children":3365},{"style":256},[3366],{"type":70,"value":409},{"type":64,"tag":110,"props":3368,"children":3370},{"class":112,"line":3369},29,[3371,3376,3380,3385,3389,3394],{"type":64,"tag":110,"props":3372,"children":3373},{"style":129},[3374],{"type":70,"value":3375},"      queue",{"type":64,"tag":110,"props":3377,"children":3378},{"style":123},[3379],{"type":70,"value":471},{"type":64,"tag":110,"props":3381,"children":3382},{"style":191},[3383],{"type":70,"value":3384},"push",{"type":64,"tag":110,"props":3386,"children":3387},{"style":256},[3388],{"type":70,"value":259},{"type":64,"tag":110,"props":3390,"children":3391},{"style":129},[3392],{"type":70,"value":3393},"chunk",{"type":64,"tag":110,"props":3395,"children":3396},{"style":256},[3397],{"type":70,"value":409},{"type":64,"tag":110,"props":3399,"children":3401},{"class":112,"line":3400},30,[3402,3407,3412],{"type":64,"tag":110,"props":3403,"children":3404},{"style":191},[3405],{"type":70,"value":3406},"      resolve",{"type":64,"tag":110,"props":3408,"children":3409},{"style":123},[3410],{"type":70,"value":3411},"?.",{"type":64,"tag":110,"props":3413,"children":3414},{"style":256},[3415],{"type":70,"value":2977},{"type":64,"tag":110,"props":3417,"children":3419},{"class":112,"line":3418},31,[3420],{"type":64,"tag":110,"props":3421,"children":3422},{"style":123},[3423],{"type":70,"value":3424},"    }\n",{"type":64,"tag":110,"props":3426,"children":3428},{"class":112,"line":3427},32,[3429],{"type":64,"tag":110,"props":3430,"children":3431},{"emptyLinePlaceholder":175},[3432],{"type":70,"value":178},{"type":64,"tag":110,"props":3434,"children":3436},{"class":112,"line":3435},33,[3437,3441,3445,3450,3454,3458,3462],{"type":64,"tag":110,"props":3438,"children":3439},{"style":129},[3440],{"type":70,"value":3064},{"type":64,"tag":110,"props":3442,"children":3443},{"style":123},[3444],{"type":70,"value":471},{"type":64,"tag":110,"props":3446,"children":3447},{"style":191},[3448],{"type":70,"value":3449},"onclose",{"type":64,"tag":110,"props":3451,"children":3452},{"style":123},[3453],{"type":70,"value":249},{"type":64,"tag":110,"props":3455,"children":3456},{"style":123},[3457],{"type":70,"value":1462},{"type":64,"tag":110,"props":3459,"children":3460},{"style":185},[3461],{"type":70,"value":1423},{"type":64,"tag":110,"props":3463,"children":3464},{"style":123},[3465],{"type":70,"value":204},{"type":64,"tag":110,"props":3467,"children":3469},{"class":112,"line":3468},34,[3470,3475,3479],{"type":64,"tag":110,"props":3471,"children":3472},{"style":129},[3473],{"type":70,"value":3474},"      done",{"type":64,"tag":110,"props":3476,"children":3477},{"style":123},[3478],{"type":70,"value":249},{"type":64,"tag":110,"props":3480,"children":3481},{"style":3256},[3482],{"type":70,"value":3483}," true\n",{"type":64,"tag":110,"props":3485,"children":3487},{"class":112,"line":3486},35,[3488,3492,3496],{"type":64,"tag":110,"props":3489,"children":3490},{"style":191},[3491],{"type":70,"value":3406},{"type":64,"tag":110,"props":3493,"children":3494},{"style":123},[3495],{"type":70,"value":3411},{"type":64,"tag":110,"props":3497,"children":3498},{"style":256},[3499],{"type":70,"value":2977},{"type":64,"tag":110,"props":3501,"children":3503},{"class":112,"line":3502},36,[3504],{"type":64,"tag":110,"props":3505,"children":3506},{"style":123},[3507],{"type":70,"value":3424},{"type":64,"tag":110,"props":3509,"children":3511},{"class":112,"line":3510},37,[3512],{"type":64,"tag":110,"props":3513,"children":3514},{"emptyLinePlaceholder":175},[3515],{"type":70,"value":178},{"type":64,"tag":110,"props":3517,"children":3519},{"class":112,"line":3518},38,[3520,3524,3528,3532,3536,3540,3544],{"type":64,"tag":110,"props":3521,"children":3522},{"style":129},[3523],{"type":70,"value":3064},{"type":64,"tag":110,"props":3525,"children":3526},{"style":123},[3527],{"type":70,"value":471},{"type":64,"tag":110,"props":3529,"children":3530},{"style":191},[3531],{"type":70,"value":2993},{"type":64,"tag":110,"props":3533,"children":3534},{"style":123},[3535],{"type":70,"value":249},{"type":64,"tag":110,"props":3537,"children":3538},{"style":123},[3539],{"type":70,"value":1462},{"type":64,"tag":110,"props":3541,"children":3542},{"style":185},[3543],{"type":70,"value":1423},{"type":64,"tag":110,"props":3545,"children":3546},{"style":123},[3547],{"type":70,"value":204},{"type":64,"tag":110,"props":3549,"children":3551},{"class":112,"line":3550},39,[3552,3556,3560],{"type":64,"tag":110,"props":3553,"children":3554},{"style":129},[3555],{"type":70,"value":3474},{"type":64,"tag":110,"props":3557,"children":3558},{"style":123},[3559],{"type":70,"value":249},{"type":64,"tag":110,"props":3561,"children":3562},{"style":3256},[3563],{"type":70,"value":3483},{"type":64,"tag":110,"props":3565,"children":3567},{"class":112,"line":3566},40,[3568,3572,3576],{"type":64,"tag":110,"props":3569,"children":3570},{"style":191},[3571],{"type":70,"value":3406},{"type":64,"tag":110,"props":3573,"children":3574},{"style":123},[3575],{"type":70,"value":3411},{"type":64,"tag":110,"props":3577,"children":3578},{"style":256},[3579],{"type":70,"value":2977},{"type":64,"tag":110,"props":3581,"children":3583},{"class":112,"line":3582},41,[3584],{"type":64,"tag":110,"props":3585,"children":3586},{"style":123},[3587],{"type":70,"value":3424},{"type":64,"tag":110,"props":3589,"children":3591},{"class":112,"line":3590},42,[3592],{"type":64,"tag":110,"props":3593,"children":3594},{"emptyLinePlaceholder":175},[3595],{"type":70,"value":178},{"type":64,"tag":110,"props":3597,"children":3599},{"class":112,"line":3598},43,[3600,3604,3608,3613,3617,3621,3626,3630,3634,3638,3642],{"type":64,"tag":110,"props":3601,"children":3602},{"style":129},[3603],{"type":70,"value":2768},{"type":64,"tag":110,"props":3605,"children":3606},{"style":123},[3607],{"type":70,"value":3411},{"type":64,"tag":110,"props":3609,"children":3610},{"style":191},[3611],{"type":70,"value":3612},"addEventListener",{"type":64,"tag":110,"props":3614,"children":3615},{"style":256},[3616],{"type":70,"value":259},{"type":64,"tag":110,"props":3618,"children":3619},{"style":123},[3620],{"type":70,"value":291},{"type":64,"tag":110,"props":3622,"children":3623},{"style":160},[3624],{"type":70,"value":3625},"abort",{"type":64,"tag":110,"props":3627,"children":3628},{"style":123},[3629],{"type":70,"value":291},{"type":64,"tag":110,"props":3631,"children":3632},{"style":123},[3633],{"type":70,"value":137},{"type":64,"tag":110,"props":3635,"children":3636},{"style":123},[3637],{"type":70,"value":1462},{"type":64,"tag":110,"props":3639,"children":3640},{"style":185},[3641],{"type":70,"value":1423},{"type":64,"tag":110,"props":3643,"children":3644},{"style":123},[3645],{"type":70,"value":204},{"type":64,"tag":110,"props":3647,"children":3649},{"class":112,"line":3648},44,[3650,3654,3658,3663],{"type":64,"tag":110,"props":3651,"children":3652},{"style":129},[3653],{"type":70,"value":2946},{"type":64,"tag":110,"props":3655,"children":3656},{"style":123},[3657],{"type":70,"value":471},{"type":64,"tag":110,"props":3659,"children":3660},{"style":191},[3661],{"type":70,"value":3662},"close",{"type":64,"tag":110,"props":3664,"children":3665},{"style":256},[3666],{"type":70,"value":2977},{"type":64,"tag":110,"props":3668,"children":3670},{"class":112,"line":3669},45,[3671,3675],{"type":64,"tag":110,"props":3672,"children":3673},{"style":123},[3674],{"type":70,"value":386},{"type":64,"tag":110,"props":3676,"children":3677},{"style":256},[3678],{"type":70,"value":409},{"type":64,"tag":110,"props":3680,"children":3682},{"class":112,"line":3681},46,[3683],{"type":64,"tag":110,"props":3684,"children":3685},{"emptyLinePlaceholder":175},[3686],{"type":70,"value":178},{"type":64,"tag":110,"props":3688,"children":3690},{"class":112,"line":3689},47,[3691],{"type":64,"tag":110,"props":3692,"children":3693},{"style":2871},[3694],{"type":70,"value":3695},"    \u002F\u002F Yield chunks as they arrive\n",{"type":64,"tag":110,"props":3697,"children":3699},{"class":112,"line":3698},48,[3700,3705,3709,3714,3719,3724,3728,3732,3737,3742,3748,3752],{"type":64,"tag":110,"props":3701,"children":3702},{"style":117},[3703],{"type":70,"value":3704},"    while",{"type":64,"tag":110,"props":3706,"children":3707},{"style":256},[3708],{"type":70,"value":1471},{"type":64,"tag":110,"props":3710,"children":3711},{"style":123},[3712],{"type":70,"value":3713},"!",{"type":64,"tag":110,"props":3715,"children":3716},{"style":129},[3717],{"type":70,"value":3718},"done",{"type":64,"tag":110,"props":3720,"children":3721},{"style":123},[3722],{"type":70,"value":3723}," ||",{"type":64,"tag":110,"props":3725,"children":3726},{"style":129},[3727],{"type":70,"value":3152},{"type":64,"tag":110,"props":3729,"children":3730},{"style":123},[3731],{"type":70,"value":471},{"type":64,"tag":110,"props":3733,"children":3734},{"style":129},[3735],{"type":70,"value":3736},"length",{"type":64,"tag":110,"props":3738,"children":3739},{"style":123},[3740],{"type":70,"value":3741}," >",{"type":64,"tag":110,"props":3743,"children":3745},{"style":3744},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[3746],{"type":70,"value":3747}," 0",{"type":64,"tag":110,"props":3749,"children":3750},{"style":256},[3751],{"type":70,"value":491},{"type":64,"tag":110,"props":3753,"children":3754},{"style":123},[3755],{"type":70,"value":264},{"type":64,"tag":110,"props":3757,"children":3759},{"class":112,"line":3758},49,[3760,3765,3769,3774,3778,3782,3786,3790,3794],{"type":64,"tag":110,"props":3761,"children":3762},{"style":117},[3763],{"type":70,"value":3764},"      if",{"type":64,"tag":110,"props":3766,"children":3767},{"style":256},[3768],{"type":70,"value":1471},{"type":64,"tag":110,"props":3770,"children":3771},{"style":129},[3772],{"type":70,"value":3773},"queue",{"type":64,"tag":110,"props":3775,"children":3776},{"style":123},[3777],{"type":70,"value":471},{"type":64,"tag":110,"props":3779,"children":3780},{"style":129},[3781],{"type":70,"value":3736},{"type":64,"tag":110,"props":3783,"children":3784},{"style":123},[3785],{"type":70,"value":3741},{"type":64,"tag":110,"props":3787,"children":3788},{"style":3744},[3789],{"type":70,"value":3747},{"type":64,"tag":110,"props":3791,"children":3792},{"style":256},[3793],{"type":70,"value":491},{"type":64,"tag":110,"props":3795,"children":3796},{"style":123},[3797],{"type":70,"value":264},{"type":64,"tag":110,"props":3799,"children":3801},{"class":112,"line":3800},50,[3802,3807,3811,3815,3820,3824],{"type":64,"tag":110,"props":3803,"children":3804},{"style":117},[3805],{"type":70,"value":3806},"        yield",{"type":64,"tag":110,"props":3808,"children":3809},{"style":129},[3810],{"type":70,"value":3152},{"type":64,"tag":110,"props":3812,"children":3813},{"style":123},[3814],{"type":70,"value":471},{"type":64,"tag":110,"props":3816,"children":3817},{"style":191},[3818],{"type":70,"value":3819},"shift",{"type":64,"tag":110,"props":3821,"children":3822},{"style":256},[3823],{"type":70,"value":199},{"type":64,"tag":110,"props":3825,"children":3826},{"style":123},[3827],{"type":70,"value":3828},"!\n",{"type":64,"tag":110,"props":3830,"children":3832},{"class":112,"line":3831},51,[3833,3838,3843],{"type":64,"tag":110,"props":3834,"children":3835},{"style":123},[3836],{"type":70,"value":3837},"      }",{"type":64,"tag":110,"props":3839,"children":3840},{"style":117},[3841],{"type":70,"value":3842}," else",{"type":64,"tag":110,"props":3844,"children":3845},{"style":123},[3846],{"type":70,"value":204},{"type":64,"tag":110,"props":3848,"children":3850},{"class":112,"line":3849},52,[3851,3856,3860,3864,3868,3872,3876,3880,3884,3889,3893,3897],{"type":64,"tag":110,"props":3852,"children":3853},{"style":117},[3854],{"type":70,"value":3855},"        await",{"type":64,"tag":110,"props":3857,"children":3858},{"style":123},[3859],{"type":70,"value":2832},{"type":64,"tag":110,"props":3861,"children":3862},{"style":443},[3863],{"type":70,"value":2891},{"type":64,"tag":110,"props":3865,"children":3866},{"style":123},[3867],{"type":70,"value":2710},{"type":64,"tag":110,"props":3869,"children":3870},{"style":443},[3871],{"type":70,"value":2900},{"type":64,"tag":110,"props":3873,"children":3874},{"style":123},[3875],{"type":70,"value":557},{"type":64,"tag":110,"props":3877,"children":3878},{"style":256},[3879],{"type":70,"value":259},{"type":64,"tag":110,"props":3881,"children":3882},{"style":123},[3883],{"type":70,"value":259},{"type":64,"tag":110,"props":3885,"children":3886},{"style":463},[3887],{"type":70,"value":3888},"r",{"type":64,"tag":110,"props":3890,"children":3891},{"style":123},[3892],{"type":70,"value":391},{"type":64,"tag":110,"props":3894,"children":3895},{"style":185},[3896],{"type":70,"value":1423},{"type":64,"tag":110,"props":3898,"children":3899},{"style":123},[3900],{"type":70,"value":204},{"type":64,"tag":110,"props":3902,"children":3904},{"class":112,"line":3903},53,[3905,3910,3914],{"type":64,"tag":110,"props":3906,"children":3907},{"style":129},[3908],{"type":70,"value":3909},"          resolve",{"type":64,"tag":110,"props":3911,"children":3912},{"style":123},[3913],{"type":70,"value":249},{"type":64,"tag":110,"props":3915,"children":3916},{"style":129},[3917],{"type":70,"value":3918}," r\n",{"type":64,"tag":110,"props":3920,"children":3922},{"class":112,"line":3921},54,[3923,3928],{"type":64,"tag":110,"props":3924,"children":3925},{"style":123},[3926],{"type":70,"value":3927},"        }",{"type":64,"tag":110,"props":3929,"children":3930},{"style":256},[3931],{"type":70,"value":409},{"type":64,"tag":110,"props":3933,"children":3935},{"class":112,"line":3934},55,[3936],{"type":64,"tag":110,"props":3937,"children":3938},{"style":123},[3939],{"type":70,"value":3940},"      }\n",{"type":64,"tag":110,"props":3942,"children":3944},{"class":112,"line":3943},56,[3945],{"type":64,"tag":110,"props":3946,"children":3947},{"style":123},[3948],{"type":70,"value":3424},{"type":64,"tag":110,"props":3950,"children":3952},{"class":112,"line":3951},57,[3953],{"type":64,"tag":110,"props":3954,"children":3955},{"style":123},[3956],{"type":70,"value":3957},"  },\n",{"type":64,"tag":110,"props":3959,"children":3961},{"class":112,"line":3960},58,[3962],{"type":64,"tag":110,"props":3963,"children":3964},{"style":123},[3965],{"type":70,"value":800},{"type":64,"tag":110,"props":3967,"children":3969},{"class":112,"line":3968},59,[3970],{"type":64,"tag":110,"props":3971,"children":3972},{"emptyLinePlaceholder":175},[3973],{"type":70,"value":178},{"type":64,"tag":110,"props":3975,"children":3977},{"class":112,"line":3976},60,[3978,3982,3986,3990],{"type":64,"tag":110,"props":3979,"children":3980},{"style":185},[3981],{"type":70,"value":188},{"type":64,"tag":110,"props":3983,"children":3984},{"style":191},[3985],{"type":70,"value":194},{"type":64,"tag":110,"props":3987,"children":3988},{"style":123},[3989],{"type":70,"value":199},{"type":64,"tag":110,"props":3991,"children":3992},{"style":123},[3993],{"type":70,"value":204},{"type":64,"tag":110,"props":3995,"children":3997},{"class":112,"line":3996},61,[3998,4002,4006,4010,4014,4018,4022,4026,4030,4034],{"type":64,"tag":110,"props":3999,"children":4000},{"style":185},[4001],{"type":70,"value":213},{"type":64,"tag":110,"props":4003,"children":4004},{"style":123},[4005],{"type":70,"value":126},{"type":64,"tag":110,"props":4007,"children":4008},{"style":129},[4009],{"type":70,"value":222},{"type":64,"tag":110,"props":4011,"children":4012},{"style":123},[4013],{"type":70,"value":137},{"type":64,"tag":110,"props":4015,"children":4016},{"style":129},[4017],{"type":70,"value":231},{"type":64,"tag":110,"props":4019,"children":4020},{"style":123},[4021],{"type":70,"value":147},{"type":64,"tag":110,"props":4023,"children":4024},{"style":123},[4025],{"type":70,"value":249},{"type":64,"tag":110,"props":4027,"children":4028},{"style":191},[4029],{"type":70,"value":132},{"type":64,"tag":110,"props":4031,"children":4032},{"style":256},[4033],{"type":70,"value":259},{"type":64,"tag":110,"props":4035,"children":4036},{"style":123},[4037],{"type":70,"value":264},{"type":64,"tag":110,"props":4039,"children":4041},{"class":112,"line":4040},62,[4042,4046,4050,4054],{"type":64,"tag":110,"props":4043,"children":4044},{"style":256},[4045],{"type":70,"value":273},{"type":64,"tag":110,"props":4047,"children":4048},{"style":123},[4049],{"type":70,"value":278},{"type":64,"tag":110,"props":4051,"children":4052},{"style":129},[4053],{"type":70,"value":2650},{"type":64,"tag":110,"props":4055,"children":4056},{"style":123},[4057],{"type":70,"value":368},{"type":64,"tag":110,"props":4059,"children":4061},{"class":112,"line":4060},63,[4062,4066],{"type":64,"tag":110,"props":4063,"children":4064},{"style":123},[4065],{"type":70,"value":404},{"type":64,"tag":110,"props":4067,"children":4068},{"style":256},[4069],{"type":70,"value":409},{"type":64,"tag":110,"props":4071,"children":4073},{"class":112,"line":4072},64,[4074],{"type":64,"tag":110,"props":4075,"children":4076},{"emptyLinePlaceholder":175},[4077],{"type":70,"value":178},{"type":64,"tag":110,"props":4079,"children":4081},{"class":112,"line":4080},65,[4082],{"type":64,"tag":110,"props":4083,"children":4084},{"style":2871},[4085],{"type":70,"value":4086},"  \u002F\u002F ... render messages\n",{"type":64,"tag":110,"props":4088,"children":4090},{"class":112,"line":4089},66,[4091],{"type":64,"tag":110,"props":4092,"children":4093},{"style":123},[4094],{"type":70,"value":800},{"type":64,"tag":73,"props":4096,"children":4097},{},[4098],{"type":64,"tag":552,"props":4099,"children":4100},{},[4101],{"type":70,"value":4102},"SubscribeConnectionAdapter (push-based \u002F separate subscribe + send):",{"type":64,"tag":73,"props":4104,"children":4105},{},[4106,4108,4114,4116,4122,4124,4129],{"type":70,"value":4107},"Use for push-based protocols where the server can send data at any time\n(persistent WebSocket connections, MQTT, server push). The ",{"type":64,"tag":91,"props":4109,"children":4111},{"className":4110},[],[4112],{"type":70,"value":4113},"subscribe",{"type":70,"value":4115}," method\nreturns an ",{"type":64,"tag":91,"props":4117,"children":4119},{"className":4118},[],[4120],{"type":70,"value":4121},"AsyncIterable\u003CStreamChunk>",{"type":70,"value":4123}," that stays open, and ",{"type":64,"tag":91,"props":4125,"children":4127},{"className":4126},[],[4128],{"type":70,"value":3073},{"type":70,"value":4130}," dispatches\nmessages through it.",{"type":64,"tag":100,"props":4132,"children":4134},{"className":102,"code":4133,"language":45,"meta":104,"style":104},"import type { StreamChunk, UIMessage } from '@tanstack\u002Fai'\n\n\u002F\u002F SubscribeConnectionAdapter is exported from @tanstack\u002Fai-client\n\u002F\u002F (not re-exported by framework packages -- use ConnectionAdapter\n\u002F\u002F  union type from @tanstack\u002Fai-react for typing)\nconst pushAdapter = {\n  subscribe(abortSignal?: AbortSignal): AsyncIterable\u003CStreamChunk> {\n    \u002F\u002F Return a long-lived async iterable that yields chunks\n    \u002F\u002F whenever the server pushes them\n    return createPersistentStream(abortSignal)\n  },\n\n  async send(\n    messages: Array\u003CUIMessage>,\n    data?: Record\u003Cstring, any>,\n    abortSignal?: AbortSignal,\n  ): Promise\u003Cvoid> {\n    \u002F\u002F Dispatch messages; chunks arrive through subscribe()\n    await persistentConnection.send(JSON.stringify({ messages, ...data }))\n  },\n}\n\nfunction Chat() {\n  const { messages, sendMessage } = useChat({\n    connection: pushAdapter,\n  })\n\n  \u002F\u002F ... render messages\n}\n",[4135],{"type":64,"tag":91,"props":4136,"children":4137},{"__ignoreMap":104},[4138,4185,4192,4200,4208,4216,4236,4287,4295,4303,4328,4335,4342,4358,4385,4420,4439,4466,4474,4542,4549,4556,4563,4582,4625,4645,4656,4663,4670],{"type":64,"tag":110,"props":4139,"children":4140},{"class":112,"line":113},[4141,4145,4149,4153,4157,4161,4165,4169,4173,4177,4181],{"type":64,"tag":110,"props":4142,"children":4143},{"style":117},[4144],{"type":70,"value":120},{"type":64,"tag":110,"props":4146,"children":4147},{"style":117},[4148],{"type":70,"value":2552},{"type":64,"tag":110,"props":4150,"children":4151},{"style":123},[4152],{"type":70,"value":126},{"type":64,"tag":110,"props":4154,"children":4155},{"style":129},[4156],{"type":70,"value":2601},{"type":64,"tag":110,"props":4158,"children":4159},{"style":123},[4160],{"type":70,"value":137},{"type":64,"tag":110,"props":4162,"children":4163},{"style":129},[4164],{"type":70,"value":2610},{"type":64,"tag":110,"props":4166,"children":4167},{"style":123},[4168],{"type":70,"value":147},{"type":64,"tag":110,"props":4170,"children":4171},{"style":117},[4172],{"type":70,"value":152},{"type":64,"tag":110,"props":4174,"children":4175},{"style":123},[4176],{"type":70,"value":157},{"type":64,"tag":110,"props":4178,"children":4179},{"style":160},[4180],{"type":70,"value":2627},{"type":64,"tag":110,"props":4182,"children":4183},{"style":123},[4184],{"type":70,"value":168},{"type":64,"tag":110,"props":4186,"children":4187},{"class":112,"line":171},[4188],{"type":64,"tag":110,"props":4189,"children":4190},{"emptyLinePlaceholder":175},[4191],{"type":70,"value":178},{"type":64,"tag":110,"props":4193,"children":4194},{"class":112,"line":181},[4195],{"type":64,"tag":110,"props":4196,"children":4197},{"style":2871},[4198],{"type":70,"value":4199},"\u002F\u002F SubscribeConnectionAdapter is exported from @tanstack\u002Fai-client\n",{"type":64,"tag":110,"props":4201,"children":4202},{"class":112,"line":207},[4203],{"type":64,"tag":110,"props":4204,"children":4205},{"style":2871},[4206],{"type":70,"value":4207},"\u002F\u002F (not re-exported by framework packages -- use ConnectionAdapter\n",{"type":64,"tag":110,"props":4209,"children":4210},{"class":112,"line":267},[4211],{"type":64,"tag":110,"props":4212,"children":4213},{"style":2871},[4214],{"type":70,"value":4215},"\u002F\u002F  union type from @tanstack\u002Fai-react for typing)\n",{"type":64,"tag":110,"props":4217,"children":4218},{"class":112,"line":311},[4219,4223,4228,4232],{"type":64,"tag":110,"props":4220,"children":4221},{"style":185},[4222],{"type":70,"value":1060},{"type":64,"tag":110,"props":4224,"children":4225},{"style":129},[4226],{"type":70,"value":4227}," pushAdapter ",{"type":64,"tag":110,"props":4229,"children":4230},{"style":123},[4231],{"type":70,"value":714},{"type":64,"tag":110,"props":4233,"children":4234},{"style":123},[4235],{"type":70,"value":204},{"type":64,"tag":110,"props":4237,"children":4238},{"class":112,"line":328},[4239,4244,4248,4253,4257,4261,4266,4271,4275,4279,4283],{"type":64,"tag":110,"props":4240,"children":4241},{"style":256},[4242],{"type":70,"value":4243},"  subscribe",{"type":64,"tag":110,"props":4245,"children":4246},{"style":123},[4247],{"type":70,"value":259},{"type":64,"tag":110,"props":4249,"children":4250},{"style":463},[4251],{"type":70,"value":4252},"abortSignal",{"type":64,"tag":110,"props":4254,"children":4255},{"style":123},[4256],{"type":70,"value":2733},{"type":64,"tag":110,"props":4258,"children":4259},{"style":443},[4260],{"type":70,"value":2777},{"type":64,"tag":110,"props":4262,"children":4263},{"style":123},[4264],{"type":70,"value":4265},"):",{"type":64,"tag":110,"props":4267,"children":4268},{"style":443},[4269],{"type":70,"value":4270}," AsyncIterable",{"type":64,"tag":110,"props":4272,"children":4273},{"style":123},[4274],{"type":70,"value":2710},{"type":64,"tag":110,"props":4276,"children":4277},{"style":443},[4278],{"type":70,"value":1914},{"type":64,"tag":110,"props":4280,"children":4281},{"style":123},[4282],{"type":70,"value":557},{"type":64,"tag":110,"props":4284,"children":4285},{"style":123},[4286],{"type":70,"value":204},{"type":64,"tag":110,"props":4288,"children":4289},{"class":112,"line":371},[4290],{"type":64,"tag":110,"props":4291,"children":4292},{"style":2871},[4293],{"type":70,"value":4294},"    \u002F\u002F Return a long-lived async iterable that yields chunks\n",{"type":64,"tag":110,"props":4296,"children":4297},{"class":112,"line":380},[4298],{"type":64,"tag":110,"props":4299,"children":4300},{"style":2871},[4301],{"type":70,"value":4302},"    \u002F\u002F whenever the server pushes them\n",{"type":64,"tag":110,"props":4304,"children":4305},{"class":112,"line":398},[4306,4311,4316,4320,4324],{"type":64,"tag":110,"props":4307,"children":4308},{"style":117},[4309],{"type":70,"value":4310},"    return",{"type":64,"tag":110,"props":4312,"children":4313},{"style":191},[4314],{"type":70,"value":4315}," createPersistentStream",{"type":64,"tag":110,"props":4317,"children":4318},{"style":256},[4319],{"type":70,"value":259},{"type":64,"tag":110,"props":4321,"children":4322},{"style":129},[4323],{"type":70,"value":4252},{"type":64,"tag":110,"props":4325,"children":4326},{"style":256},[4327],{"type":70,"value":409},{"type":64,"tag":110,"props":4329,"children":4330},{"class":112,"line":412},[4331],{"type":64,"tag":110,"props":4332,"children":4333},{"style":123},[4334],{"type":70,"value":3957},{"type":64,"tag":110,"props":4336,"children":4337},{"class":112,"line":420},[4338],{"type":64,"tag":110,"props":4339,"children":4340},{"emptyLinePlaceholder":175},[4341],{"type":70,"value":178},{"type":64,"tag":110,"props":4343,"children":4344},{"class":112,"line":434},[4345,4349,4354],{"type":64,"tag":110,"props":4346,"children":4347},{"style":185},[4348],{"type":70,"value":2674},{"type":64,"tag":110,"props":4350,"children":4351},{"style":256},[4352],{"type":70,"value":4353}," send",{"type":64,"tag":110,"props":4355,"children":4356},{"style":123},[4357],{"type":70,"value":1410},{"type":64,"tag":110,"props":4359,"children":4360},{"class":112,"line":454},[4361,4365,4369,4373,4377,4381],{"type":64,"tag":110,"props":4362,"children":4363},{"style":463},[4364],{"type":70,"value":2696},{"type":64,"tag":110,"props":4366,"children":4367},{"style":123},[4368],{"type":70,"value":278},{"type":64,"tag":110,"props":4370,"children":4371},{"style":443},[4372],{"type":70,"value":2705},{"type":64,"tag":110,"props":4374,"children":4375},{"style":123},[4376],{"type":70,"value":2710},{"type":64,"tag":110,"props":4378,"children":4379},{"style":443},[4380],{"type":70,"value":2715},{"type":64,"tag":110,"props":4382,"children":4383},{"style":123},[4384],{"type":70,"value":2720},{"type":64,"tag":110,"props":4386,"children":4387},{"class":112,"line":503},[4388,4392,4396,4400,4404,4408,4412,4416],{"type":64,"tag":110,"props":4389,"children":4390},{"style":463},[4391],{"type":70,"value":2728},{"type":64,"tag":110,"props":4393,"children":4394},{"style":123},[4395],{"type":70,"value":2733},{"type":64,"tag":110,"props":4397,"children":4398},{"style":443},[4399],{"type":70,"value":2738},{"type":64,"tag":110,"props":4401,"children":4402},{"style":123},[4403],{"type":70,"value":2710},{"type":64,"tag":110,"props":4405,"children":4406},{"style":443},[4407],{"type":70,"value":2747},{"type":64,"tag":110,"props":4409,"children":4410},{"style":123},[4411],{"type":70,"value":137},{"type":64,"tag":110,"props":4413,"children":4414},{"style":443},[4415],{"type":70,"value":2756},{"type":64,"tag":110,"props":4417,"children":4418},{"style":123},[4419],{"type":70,"value":2720},{"type":64,"tag":110,"props":4421,"children":4422},{"class":112,"line":541},[4423,4427,4431,4435],{"type":64,"tag":110,"props":4424,"children":4425},{"style":463},[4426],{"type":70,"value":2768},{"type":64,"tag":110,"props":4428,"children":4429},{"style":123},[4430],{"type":70,"value":2733},{"type":64,"tag":110,"props":4432,"children":4433},{"style":443},[4434],{"type":70,"value":2777},{"type":64,"tag":110,"props":4436,"children":4437},{"style":123},[4438],{"type":70,"value":368},{"type":64,"tag":110,"props":4440,"children":4441},{"class":112,"line":592},[4442,4446,4450,4454,4458,4462],{"type":64,"tag":110,"props":4443,"children":4444},{"style":123},[4445],{"type":70,"value":2789},{"type":64,"tag":110,"props":4447,"children":4448},{"style":443},[4449],{"type":70,"value":2891},{"type":64,"tag":110,"props":4451,"children":4452},{"style":123},[4453],{"type":70,"value":2710},{"type":64,"tag":110,"props":4455,"children":4456},{"style":443},[4457],{"type":70,"value":2900},{"type":64,"tag":110,"props":4459,"children":4460},{"style":123},[4461],{"type":70,"value":557},{"type":64,"tag":110,"props":4463,"children":4464},{"style":123},[4465],{"type":70,"value":204},{"type":64,"tag":110,"props":4467,"children":4468},{"class":112,"line":652},[4469],{"type":64,"tag":110,"props":4470,"children":4471},{"style":2871},[4472],{"type":70,"value":4473},"    \u002F\u002F Dispatch messages; chunks arrive through subscribe()\n",{"type":64,"tag":110,"props":4475,"children":4476},{"class":112,"line":690},[4477,4481,4486,4490,4494,4498,4502,4506,4510,4514,4518,4522,4526,4530,4534,4538],{"type":64,"tag":110,"props":4478,"children":4479},{"style":117},[4480],{"type":70,"value":2882},{"type":64,"tag":110,"props":4482,"children":4483},{"style":129},[4484],{"type":70,"value":4485}," persistentConnection",{"type":64,"tag":110,"props":4487,"children":4488},{"style":123},[4489],{"type":70,"value":471},{"type":64,"tag":110,"props":4491,"children":4492},{"style":191},[4493],{"type":70,"value":3073},{"type":64,"tag":110,"props":4495,"children":4496},{"style":256},[4497],{"type":70,"value":259},{"type":64,"tag":110,"props":4499,"children":4500},{"style":129},[4501],{"type":70,"value":3082},{"type":64,"tag":110,"props":4503,"children":4504},{"style":123},[4505],{"type":70,"value":471},{"type":64,"tag":110,"props":4507,"children":4508},{"style":191},[4509],{"type":70,"value":3091},{"type":64,"tag":110,"props":4511,"children":4512},{"style":256},[4513],{"type":70,"value":259},{"type":64,"tag":110,"props":4515,"children":4516},{"style":123},[4517],{"type":70,"value":562},{"type":64,"tag":110,"props":4519,"children":4520},{"style":129},[4521],{"type":70,"value":222},{"type":64,"tag":110,"props":4523,"children":4524},{"style":123},[4525],{"type":70,"value":137},{"type":64,"tag":110,"props":4527,"children":4528},{"style":123},[4529],{"type":70,"value":3112},{"type":64,"tag":110,"props":4531,"children":4532},{"style":129},[4533],{"type":70,"value":1685},{"type":64,"tag":110,"props":4535,"children":4536},{"style":123},[4537],{"type":70,"value":147},{"type":64,"tag":110,"props":4539,"children":4540},{"style":256},[4541],{"type":70,"value":3125},{"type":64,"tag":110,"props":4543,"children":4544},{"class":112,"line":762},[4545],{"type":64,"tag":110,"props":4546,"children":4547},{"style":123},[4548],{"type":70,"value":3957},{"type":64,"tag":110,"props":4550,"children":4551},{"class":112,"line":771},[4552],{"type":64,"tag":110,"props":4553,"children":4554},{"style":123},[4555],{"type":70,"value":800},{"type":64,"tag":110,"props":4557,"children":4558},{"class":112,"line":785},[4559],{"type":64,"tag":110,"props":4560,"children":4561},{"emptyLinePlaceholder":175},[4562],{"type":70,"value":178},{"type":64,"tag":110,"props":4564,"children":4565},{"class":112,"line":803},[4566,4570,4574,4578],{"type":64,"tag":110,"props":4567,"children":4568},{"style":185},[4569],{"type":70,"value":188},{"type":64,"tag":110,"props":4571,"children":4572},{"style":191},[4573],{"type":70,"value":194},{"type":64,"tag":110,"props":4575,"children":4576},{"style":123},[4577],{"type":70,"value":199},{"type":64,"tag":110,"props":4579,"children":4580},{"style":123},[4581],{"type":70,"value":204},{"type":64,"tag":110,"props":4583,"children":4584},{"class":112,"line":820},[4585,4589,4593,4597,4601,4605,4609,4613,4617,4621],{"type":64,"tag":110,"props":4586,"children":4587},{"style":185},[4588],{"type":70,"value":213},{"type":64,"tag":110,"props":4590,"children":4591},{"style":123},[4592],{"type":70,"value":126},{"type":64,"tag":110,"props":4594,"children":4595},{"style":129},[4596],{"type":70,"value":222},{"type":64,"tag":110,"props":4598,"children":4599},{"style":123},[4600],{"type":70,"value":137},{"type":64,"tag":110,"props":4602,"children":4603},{"style":129},[4604],{"type":70,"value":231},{"type":64,"tag":110,"props":4606,"children":4607},{"style":123},[4608],{"type":70,"value":147},{"type":64,"tag":110,"props":4610,"children":4611},{"style":123},[4612],{"type":70,"value":249},{"type":64,"tag":110,"props":4614,"children":4615},{"style":191},[4616],{"type":70,"value":132},{"type":64,"tag":110,"props":4618,"children":4619},{"style":256},[4620],{"type":70,"value":259},{"type":64,"tag":110,"props":4622,"children":4623},{"style":123},[4624],{"type":70,"value":264},{"type":64,"tag":110,"props":4626,"children":4627},{"class":112,"line":833},[4628,4632,4636,4641],{"type":64,"tag":110,"props":4629,"children":4630},{"style":256},[4631],{"type":70,"value":273},{"type":64,"tag":110,"props":4633,"children":4634},{"style":123},[4635],{"type":70,"value":278},{"type":64,"tag":110,"props":4637,"children":4638},{"style":129},[4639],{"type":70,"value":4640}," pushAdapter",{"type":64,"tag":110,"props":4642,"children":4643},{"style":123},[4644],{"type":70,"value":368},{"type":64,"tag":110,"props":4646,"children":4647},{"class":112,"line":901},[4648,4652],{"type":64,"tag":110,"props":4649,"children":4650},{"style":123},[4651],{"type":70,"value":404},{"type":64,"tag":110,"props":4653,"children":4654},{"style":256},[4655],{"type":70,"value":409},{"type":64,"tag":110,"props":4657,"children":4658},{"class":112,"line":918},[4659],{"type":64,"tag":110,"props":4660,"children":4661},{"emptyLinePlaceholder":175},[4662],{"type":70,"value":178},{"type":64,"tag":110,"props":4664,"children":4665},{"class":112,"line":927},[4666],{"type":64,"tag":110,"props":4667,"children":4668},{"style":2871},[4669],{"type":70,"value":4086},{"type":64,"tag":110,"props":4671,"children":4672},{"class":112,"line":3369},[4673],{"type":64,"tag":110,"props":4674,"children":4675},{"style":123},[4676],{"type":70,"value":800},{"type":64,"tag":73,"props":4678,"children":4679},{},[4680,4681,4687,4689,4694,4696,4702],{"type":70,"value":1665},{"type":64,"tag":91,"props":4682,"children":4684},{"className":4683},[],[4685],{"type":70,"value":4686},"stream()",{"type":70,"value":4688}," helper function (re-exported from ",{"type":64,"tag":91,"props":4690,"children":4692},{"className":4691},[],[4693],{"type":70,"value":163},{"type":70,"value":4695},") provides\na shorthand for creating a ",{"type":64,"tag":91,"props":4697,"children":4699},{"className":4698},[],[4700],{"type":70,"value":4701},"ConnectConnectionAdapter",{"type":70,"value":4703}," from an async generator:",{"type":64,"tag":100,"props":4705,"children":4707},{"className":102,"code":4706,"language":45,"meta":104,"style":104},"import { useChat, stream } from '@tanstack\u002Fai-react'\nimport type { StreamChunk, UIMessage } from '@tanstack\u002Fai'\n\nconst directAdapter = stream(async function* (\n  messages: Array\u003CUIMessage>,\n  data?: Record\u003Cstring, any>,\n): AsyncGenerator\u003CStreamChunk> {\n  const response = await fetch('https:\u002F\u002Fmy-api.com\u002Fchat', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application\u002Fjson' },\n    body: JSON.stringify({ messages, ...data }),\n  })\n\n  const reader = response.body!.getReader()\n  const decoder = new TextDecoder()\n  let buffer = ''\n\n  while (true) {\n    const { done, value } = await reader.read()\n    if (done) break\n\n    buffer += decoder.decode(value, { stream: true })\n    const lines = buffer.split('\\n')\n    buffer = lines.pop() || ''\n\n    for (const line of lines) {\n      if (line.trim()) {\n        yield JSON.parse(line) as StreamChunk\n      }\n    }\n  }\n})\n\nconst { messages, sendMessage } = useChat({\n  connection: directAdapter,\n})\n",[4708],{"type":64,"tag":91,"props":4709,"children":4710},{"__ignoreMap":104},[4711,4755,4802,4809,4852,4880,4916,4943,4993,5022,5071,5131,5142,5149,5191,5220,5242,5249,5274,5327,5352,5359,5423,5472,5510,5517,5555,5588,5629,5636,5643,5651,5662,5669,5712,5732],{"type":64,"tag":110,"props":4712,"children":4713},{"class":112,"line":113},[4714,4718,4722,4726,4730,4735,4739,4743,4747,4751],{"type":64,"tag":110,"props":4715,"children":4716},{"style":117},[4717],{"type":70,"value":120},{"type":64,"tag":110,"props":4719,"children":4720},{"style":123},[4721],{"type":70,"value":126},{"type":64,"tag":110,"props":4723,"children":4724},{"style":129},[4725],{"type":70,"value":132},{"type":64,"tag":110,"props":4727,"children":4728},{"style":123},[4729],{"type":70,"value":137},{"type":64,"tag":110,"props":4731,"children":4732},{"style":129},[4733],{"type":70,"value":4734}," stream",{"type":64,"tag":110,"props":4736,"children":4737},{"style":123},[4738],{"type":70,"value":147},{"type":64,"tag":110,"props":4740,"children":4741},{"style":117},[4742],{"type":70,"value":152},{"type":64,"tag":110,"props":4744,"children":4745},{"style":123},[4746],{"type":70,"value":157},{"type":64,"tag":110,"props":4748,"children":4749},{"style":160},[4750],{"type":70,"value":163},{"type":64,"tag":110,"props":4752,"children":4753},{"style":123},[4754],{"type":70,"value":168},{"type":64,"tag":110,"props":4756,"children":4757},{"class":112,"line":171},[4758,4762,4766,4770,4774,4778,4782,4786,4790,4794,4798],{"type":64,"tag":110,"props":4759,"children":4760},{"style":117},[4761],{"type":70,"value":120},{"type":64,"tag":110,"props":4763,"children":4764},{"style":117},[4765],{"type":70,"value":2552},{"type":64,"tag":110,"props":4767,"children":4768},{"style":123},[4769],{"type":70,"value":126},{"type":64,"tag":110,"props":4771,"children":4772},{"style":129},[4773],{"type":70,"value":2601},{"type":64,"tag":110,"props":4775,"children":4776},{"style":123},[4777],{"type":70,"value":137},{"type":64,"tag":110,"props":4779,"children":4780},{"style":129},[4781],{"type":70,"value":2610},{"type":64,"tag":110,"props":4783,"children":4784},{"style":123},[4785],{"type":70,"value":147},{"type":64,"tag":110,"props":4787,"children":4788},{"style":117},[4789],{"type":70,"value":152},{"type":64,"tag":110,"props":4791,"children":4792},{"style":123},[4793],{"type":70,"value":157},{"type":64,"tag":110,"props":4795,"children":4796},{"style":160},[4797],{"type":70,"value":2627},{"type":64,"tag":110,"props":4799,"children":4800},{"style":123},[4801],{"type":70,"value":168},{"type":64,"tag":110,"props":4803,"children":4804},{"class":112,"line":181},[4805],{"type":64,"tag":110,"props":4806,"children":4807},{"emptyLinePlaceholder":175},[4808],{"type":70,"value":178},{"type":64,"tag":110,"props":4810,"children":4811},{"class":112,"line":207},[4812,4816,4821,4825,4829,4833,4838,4843,4848],{"type":64,"tag":110,"props":4813,"children":4814},{"style":185},[4815],{"type":70,"value":1060},{"type":64,"tag":110,"props":4817,"children":4818},{"style":129},[4819],{"type":70,"value":4820}," directAdapter ",{"type":64,"tag":110,"props":4822,"children":4823},{"style":123},[4824],{"type":70,"value":714},{"type":64,"tag":110,"props":4826,"children":4827},{"style":191},[4828],{"type":70,"value":4734},{"type":64,"tag":110,"props":4830,"children":4831},{"style":129},[4832],{"type":70,"value":259},{"type":64,"tag":110,"props":4834,"children":4835},{"style":185},[4836],{"type":70,"value":4837},"async",{"type":64,"tag":110,"props":4839,"children":4840},{"style":185},[4841],{"type":70,"value":4842}," function",{"type":64,"tag":110,"props":4844,"children":4845},{"style":123},[4846],{"type":70,"value":4847},"*",{"type":64,"tag":110,"props":4849,"children":4850},{"style":123},[4851],{"type":70,"value":431},{"type":64,"tag":110,"props":4853,"children":4854},{"class":112,"line":267},[4855,4860,4864,4868,4872,4876],{"type":64,"tag":110,"props":4856,"children":4857},{"style":463},[4858],{"type":70,"value":4859},"  messages",{"type":64,"tag":110,"props":4861,"children":4862},{"style":123},[4863],{"type":70,"value":278},{"type":64,"tag":110,"props":4865,"children":4866},{"style":443},[4867],{"type":70,"value":2705},{"type":64,"tag":110,"props":4869,"children":4870},{"style":123},[4871],{"type":70,"value":2710},{"type":64,"tag":110,"props":4873,"children":4874},{"style":443},[4875],{"type":70,"value":2715},{"type":64,"tag":110,"props":4877,"children":4878},{"style":123},[4879],{"type":70,"value":2720},{"type":64,"tag":110,"props":4881,"children":4882},{"class":112,"line":311},[4883,4888,4892,4896,4900,4904,4908,4912],{"type":64,"tag":110,"props":4884,"children":4885},{"style":463},[4886],{"type":70,"value":4887},"  data",{"type":64,"tag":110,"props":4889,"children":4890},{"style":123},[4891],{"type":70,"value":2733},{"type":64,"tag":110,"props":4893,"children":4894},{"style":443},[4895],{"type":70,"value":2738},{"type":64,"tag":110,"props":4897,"children":4898},{"style":123},[4899],{"type":70,"value":2710},{"type":64,"tag":110,"props":4901,"children":4902},{"style":443},[4903],{"type":70,"value":2747},{"type":64,"tag":110,"props":4905,"children":4906},{"style":123},[4907],{"type":70,"value":137},{"type":64,"tag":110,"props":4909,"children":4910},{"style":443},[4911],{"type":70,"value":2756},{"type":64,"tag":110,"props":4913,"children":4914},{"style":123},[4915],{"type":70,"value":2720},{"type":64,"tag":110,"props":4917,"children":4918},{"class":112,"line":328},[4919,4923,4927,4931,4935,4939],{"type":64,"tag":110,"props":4920,"children":4921},{"style":123},[4922],{"type":70,"value":4265},{"type":64,"tag":110,"props":4924,"children":4925},{"style":443},[4926],{"type":70,"value":2794},{"type":64,"tag":110,"props":4928,"children":4929},{"style":123},[4930],{"type":70,"value":2710},{"type":64,"tag":110,"props":4932,"children":4933},{"style":443},[4934],{"type":70,"value":1914},{"type":64,"tag":110,"props":4936,"children":4937},{"style":123},[4938],{"type":70,"value":557},{"type":64,"tag":110,"props":4940,"children":4941},{"style":123},[4942],{"type":70,"value":204},{"type":64,"tag":110,"props":4944,"children":4945},{"class":112,"line":371},[4946,4950,4955,4959,4964,4969,4973,4977,4981,4985,4989],{"type":64,"tag":110,"props":4947,"children":4948},{"style":185},[4949],{"type":70,"value":213},{"type":64,"tag":110,"props":4951,"children":4952},{"style":129},[4953],{"type":70,"value":4954}," response",{"type":64,"tag":110,"props":4956,"children":4957},{"style":123},[4958],{"type":70,"value":249},{"type":64,"tag":110,"props":4960,"children":4961},{"style":117},[4962],{"type":70,"value":4963}," await",{"type":64,"tag":110,"props":4965,"children":4966},{"style":191},[4967],{"type":70,"value":4968}," fetch",{"type":64,"tag":110,"props":4970,"children":4971},{"style":256},[4972],{"type":70,"value":259},{"type":64,"tag":110,"props":4974,"children":4975},{"style":123},[4976],{"type":70,"value":291},{"type":64,"tag":110,"props":4978,"children":4979},{"style":160},[4980],{"type":70,"value":296},{"type":64,"tag":110,"props":4982,"children":4983},{"style":123},[4984],{"type":70,"value":291},{"type":64,"tag":110,"props":4986,"children":4987},{"style":123},[4988],{"type":70,"value":137},{"type":64,"tag":110,"props":4990,"children":4991},{"style":123},[4992],{"type":70,"value":204},{"type":64,"tag":110,"props":4994,"children":4995},{"class":112,"line":380},[4996,5001,5005,5009,5014,5018],{"type":64,"tag":110,"props":4997,"children":4998},{"style":256},[4999],{"type":70,"value":5000},"    method",{"type":64,"tag":110,"props":5002,"children":5003},{"style":123},[5004],{"type":70,"value":278},{"type":64,"tag":110,"props":5006,"children":5007},{"style":123},[5008],{"type":70,"value":157},{"type":64,"tag":110,"props":5010,"children":5011},{"style":160},[5012],{"type":70,"value":5013},"POST",{"type":64,"tag":110,"props":5015,"children":5016},{"style":123},[5017],{"type":70,"value":291},{"type":64,"tag":110,"props":5019,"children":5020},{"style":123},[5021],{"type":70,"value":368},{"type":64,"tag":110,"props":5023,"children":5024},{"class":112,"line":398},[5025,5029,5033,5037,5041,5046,5050,5054,5058,5063,5067],{"type":64,"tag":110,"props":5026,"children":5027},{"style":256},[5028],{"type":70,"value":1145},{"type":64,"tag":110,"props":5030,"children":5031},{"style":123},[5032],{"type":70,"value":278},{"type":64,"tag":110,"props":5034,"children":5035},{"style":123},[5036],{"type":70,"value":126},{"type":64,"tag":110,"props":5038,"children":5039},{"style":123},[5040],{"type":70,"value":157},{"type":64,"tag":110,"props":5042,"children":5043},{"style":256},[5044],{"type":70,"value":5045},"Content-Type",{"type":64,"tag":110,"props":5047,"children":5048},{"style":123},[5049],{"type":70,"value":291},{"type":64,"tag":110,"props":5051,"children":5052},{"style":123},[5053],{"type":70,"value":278},{"type":64,"tag":110,"props":5055,"children":5056},{"style":123},[5057],{"type":70,"value":157},{"type":64,"tag":110,"props":5059,"children":5060},{"style":160},[5061],{"type":70,"value":5062},"application\u002Fjson",{"type":64,"tag":110,"props":5064,"children":5065},{"style":123},[5066],{"type":70,"value":291},{"type":64,"tag":110,"props":5068,"children":5069},{"style":123},[5070],{"type":70,"value":2424},{"type":64,"tag":110,"props":5072,"children":5073},{"class":112,"line":412},[5074,5079,5083,5087,5091,5095,5099,5103,5107,5111,5115,5119,5123,5127],{"type":64,"tag":110,"props":5075,"children":5076},{"style":256},[5077],{"type":70,"value":5078},"    body",{"type":64,"tag":110,"props":5080,"children":5081},{"style":123},[5082],{"type":70,"value":278},{"type":64,"tag":110,"props":5084,"children":5085},{"style":129},[5086],{"type":70,"value":3337},{"type":64,"tag":110,"props":5088,"children":5089},{"style":123},[5090],{"type":70,"value":471},{"type":64,"tag":110,"props":5092,"children":5093},{"style":191},[5094],{"type":70,"value":3091},{"type":64,"tag":110,"props":5096,"children":5097},{"style":256},[5098],{"type":70,"value":259},{"type":64,"tag":110,"props":5100,"children":5101},{"style":123},[5102],{"type":70,"value":562},{"type":64,"tag":110,"props":5104,"children":5105},{"style":129},[5106],{"type":70,"value":222},{"type":64,"tag":110,"props":5108,"children":5109},{"style":123},[5110],{"type":70,"value":137},{"type":64,"tag":110,"props":5112,"children":5113},{"style":123},[5114],{"type":70,"value":3112},{"type":64,"tag":110,"props":5116,"children":5117},{"style":129},[5118],{"type":70,"value":1685},{"type":64,"tag":110,"props":5120,"children":5121},{"style":123},[5122],{"type":70,"value":147},{"type":64,"tag":110,"props":5124,"children":5125},{"style":256},[5126],{"type":70,"value":391},{"type":64,"tag":110,"props":5128,"children":5129},{"style":123},[5130],{"type":70,"value":368},{"type":64,"tag":110,"props":5132,"children":5133},{"class":112,"line":420},[5134,5138],{"type":64,"tag":110,"props":5135,"children":5136},{"style":123},[5137],{"type":70,"value":404},{"type":64,"tag":110,"props":5139,"children":5140},{"style":256},[5141],{"type":70,"value":409},{"type":64,"tag":110,"props":5143,"children":5144},{"class":112,"line":434},[5145],{"type":64,"tag":110,"props":5146,"children":5147},{"emptyLinePlaceholder":175},[5148],{"type":70,"value":178},{"type":64,"tag":110,"props":5150,"children":5151},{"class":112,"line":454},[5152,5156,5161,5165,5169,5173,5177,5182,5187],{"type":64,"tag":110,"props":5153,"children":5154},{"style":185},[5155],{"type":70,"value":213},{"type":64,"tag":110,"props":5157,"children":5158},{"style":129},[5159],{"type":70,"value":5160}," reader",{"type":64,"tag":110,"props":5162,"children":5163},{"style":123},[5164],{"type":70,"value":249},{"type":64,"tag":110,"props":5166,"children":5167},{"style":129},[5168],{"type":70,"value":4954},{"type":64,"tag":110,"props":5170,"children":5171},{"style":123},[5172],{"type":70,"value":471},{"type":64,"tag":110,"props":5174,"children":5175},{"style":129},[5176],{"type":70,"value":1671},{"type":64,"tag":110,"props":5178,"children":5179},{"style":123},[5180],{"type":70,"value":5181},"!.",{"type":64,"tag":110,"props":5183,"children":5184},{"style":191},[5185],{"type":70,"value":5186},"getReader",{"type":64,"tag":110,"props":5188,"children":5189},{"style":256},[5190],{"type":70,"value":2977},{"type":64,"tag":110,"props":5192,"children":5193},{"class":112,"line":503},[5194,5198,5203,5207,5211,5216],{"type":64,"tag":110,"props":5195,"children":5196},{"style":185},[5197],{"type":70,"value":213},{"type":64,"tag":110,"props":5199,"children":5200},{"style":129},[5201],{"type":70,"value":5202}," decoder",{"type":64,"tag":110,"props":5204,"children":5205},{"style":123},[5206],{"type":70,"value":249},{"type":64,"tag":110,"props":5208,"children":5209},{"style":123},[5210],{"type":70,"value":2832},{"type":64,"tag":110,"props":5212,"children":5213},{"style":191},[5214],{"type":70,"value":5215}," TextDecoder",{"type":64,"tag":110,"props":5217,"children":5218},{"style":256},[5219],{"type":70,"value":2977},{"type":64,"tag":110,"props":5221,"children":5222},{"class":112,"line":541},[5223,5228,5233,5237],{"type":64,"tag":110,"props":5224,"children":5225},{"style":185},[5226],{"type":70,"value":5227},"  let",{"type":64,"tag":110,"props":5229,"children":5230},{"style":129},[5231],{"type":70,"value":5232}," buffer",{"type":64,"tag":110,"props":5234,"children":5235},{"style":123},[5236],{"type":70,"value":249},{"type":64,"tag":110,"props":5238,"children":5239},{"style":123},[5240],{"type":70,"value":5241}," ''\n",{"type":64,"tag":110,"props":5243,"children":5244},{"class":112,"line":592},[5245],{"type":64,"tag":110,"props":5246,"children":5247},{"emptyLinePlaceholder":175},[5248],{"type":70,"value":178},{"type":64,"tag":110,"props":5250,"children":5251},{"class":112,"line":652},[5252,5257,5261,5266,5270],{"type":64,"tag":110,"props":5253,"children":5254},{"style":117},[5255],{"type":70,"value":5256},"  while",{"type":64,"tag":110,"props":5258,"children":5259},{"style":256},[5260],{"type":70,"value":1471},{"type":64,"tag":110,"props":5262,"children":5263},{"style":3256},[5264],{"type":70,"value":5265},"true",{"type":64,"tag":110,"props":5267,"children":5268},{"style":256},[5269],{"type":70,"value":491},{"type":64,"tag":110,"props":5271,"children":5272},{"style":123},[5273],{"type":70,"value":264},{"type":64,"tag":110,"props":5275,"children":5276},{"class":112,"line":690},[5277,5281,5285,5289,5293,5298,5302,5306,5310,5314,5318,5323],{"type":64,"tag":110,"props":5278,"children":5279},{"style":185},[5280],{"type":70,"value":2818},{"type":64,"tag":110,"props":5282,"children":5283},{"style":123},[5284],{"type":70,"value":126},{"type":64,"tag":110,"props":5286,"children":5287},{"style":129},[5288],{"type":70,"value":3249},{"type":64,"tag":110,"props":5290,"children":5291},{"style":123},[5292],{"type":70,"value":137},{"type":64,"tag":110,"props":5294,"children":5295},{"style":129},[5296],{"type":70,"value":5297}," value",{"type":64,"tag":110,"props":5299,"children":5300},{"style":123},[5301],{"type":70,"value":147},{"type":64,"tag":110,"props":5303,"children":5304},{"style":123},[5305],{"type":70,"value":249},{"type":64,"tag":110,"props":5307,"children":5308},{"style":117},[5309],{"type":70,"value":4963},{"type":64,"tag":110,"props":5311,"children":5312},{"style":129},[5313],{"type":70,"value":5160},{"type":64,"tag":110,"props":5315,"children":5316},{"style":123},[5317],{"type":70,"value":471},{"type":64,"tag":110,"props":5319,"children":5320},{"style":191},[5321],{"type":70,"value":5322},"read",{"type":64,"tag":110,"props":5324,"children":5325},{"style":256},[5326],{"type":70,"value":2977},{"type":64,"tag":110,"props":5328,"children":5329},{"class":112,"line":762},[5330,5335,5339,5343,5347],{"type":64,"tag":110,"props":5331,"children":5332},{"style":117},[5333],{"type":70,"value":5334},"    if",{"type":64,"tag":110,"props":5336,"children":5337},{"style":256},[5338],{"type":70,"value":1471},{"type":64,"tag":110,"props":5340,"children":5341},{"style":129},[5342],{"type":70,"value":3718},{"type":64,"tag":110,"props":5344,"children":5345},{"style":256},[5346],{"type":70,"value":491},{"type":64,"tag":110,"props":5348,"children":5349},{"style":117},[5350],{"type":70,"value":5351},"break\n",{"type":64,"tag":110,"props":5353,"children":5354},{"class":112,"line":771},[5355],{"type":64,"tag":110,"props":5356,"children":5357},{"emptyLinePlaceholder":175},[5358],{"type":70,"value":178},{"type":64,"tag":110,"props":5360,"children":5361},{"class":112,"line":785},[5362,5367,5372,5376,5380,5385,5389,5394,5398,5402,5406,5410,5415,5419],{"type":64,"tag":110,"props":5363,"children":5364},{"style":129},[5365],{"type":70,"value":5366},"    buffer",{"type":64,"tag":110,"props":5368,"children":5369},{"style":123},[5370],{"type":70,"value":5371}," +=",{"type":64,"tag":110,"props":5373,"children":5374},{"style":129},[5375],{"type":70,"value":5202},{"type":64,"tag":110,"props":5377,"children":5378},{"style":123},[5379],{"type":70,"value":471},{"type":64,"tag":110,"props":5381,"children":5382},{"style":191},[5383],{"type":70,"value":5384},"decode",{"type":64,"tag":110,"props":5386,"children":5387},{"style":256},[5388],{"type":70,"value":259},{"type":64,"tag":110,"props":5390,"children":5391},{"style":129},[5392],{"type":70,"value":5393},"value",{"type":64,"tag":110,"props":5395,"children":5396},{"style":123},[5397],{"type":70,"value":137},{"type":64,"tag":110,"props":5399,"children":5400},{"style":123},[5401],{"type":70,"value":126},{"type":64,"tag":110,"props":5403,"children":5404},{"style":256},[5405],{"type":70,"value":4734},{"type":64,"tag":110,"props":5407,"children":5408},{"style":123},[5409],{"type":70,"value":278},{"type":64,"tag":110,"props":5411,"children":5412},{"style":3256},[5413],{"type":70,"value":5414}," true",{"type":64,"tag":110,"props":5416,"children":5417},{"style":123},[5418],{"type":70,"value":147},{"type":64,"tag":110,"props":5420,"children":5421},{"style":256},[5422],{"type":70,"value":409},{"type":64,"tag":110,"props":5424,"children":5425},{"class":112,"line":803},[5426,5430,5435,5439,5443,5447,5452,5456,5460,5464,5468],{"type":64,"tag":110,"props":5427,"children":5428},{"style":185},[5429],{"type":70,"value":2818},{"type":64,"tag":110,"props":5431,"children":5432},{"style":129},[5433],{"type":70,"value":5434}," lines",{"type":64,"tag":110,"props":5436,"children":5437},{"style":123},[5438],{"type":70,"value":249},{"type":64,"tag":110,"props":5440,"children":5441},{"style":129},[5442],{"type":70,"value":5232},{"type":64,"tag":110,"props":5444,"children":5445},{"style":123},[5446],{"type":70,"value":471},{"type":64,"tag":110,"props":5448,"children":5449},{"style":191},[5450],{"type":70,"value":5451},"split",{"type":64,"tag":110,"props":5453,"children":5454},{"style":256},[5455],{"type":70,"value":259},{"type":64,"tag":110,"props":5457,"children":5458},{"style":123},[5459],{"type":70,"value":291},{"type":64,"tag":110,"props":5461,"children":5462},{"style":129},[5463],{"type":70,"value":1922},{"type":64,"tag":110,"props":5465,"children":5466},{"style":123},[5467],{"type":70,"value":291},{"type":64,"tag":110,"props":5469,"children":5470},{"style":256},[5471],{"type":70,"value":409},{"type":64,"tag":110,"props":5473,"children":5474},{"class":112,"line":820},[5475,5479,5483,5487,5491,5496,5501,5506],{"type":64,"tag":110,"props":5476,"children":5477},{"style":129},[5478],{"type":70,"value":5366},{"type":64,"tag":110,"props":5480,"children":5481},{"style":123},[5482],{"type":70,"value":249},{"type":64,"tag":110,"props":5484,"children":5485},{"style":129},[5486],{"type":70,"value":5434},{"type":64,"tag":110,"props":5488,"children":5489},{"style":123},[5490],{"type":70,"value":471},{"type":64,"tag":110,"props":5492,"children":5493},{"style":191},[5494],{"type":70,"value":5495},"pop",{"type":64,"tag":110,"props":5497,"children":5498},{"style":256},[5499],{"type":70,"value":5500},"() ",{"type":64,"tag":110,"props":5502,"children":5503},{"style":123},[5504],{"type":70,"value":5505},"||",{"type":64,"tag":110,"props":5507,"children":5508},{"style":123},[5509],{"type":70,"value":5241},{"type":64,"tag":110,"props":5511,"children":5512},{"class":112,"line":833},[5513],{"type":64,"tag":110,"props":5514,"children":5515},{"emptyLinePlaceholder":175},[5516],{"type":70,"value":178},{"type":64,"tag":110,"props":5518,"children":5519},{"class":112,"line":901},[5520,5525,5529,5533,5538,5543,5547,5551],{"type":64,"tag":110,"props":5521,"children":5522},{"style":117},[5523],{"type":70,"value":5524},"    for",{"type":64,"tag":110,"props":5526,"children":5527},{"style":256},[5528],{"type":70,"value":1471},{"type":64,"tag":110,"props":5530,"children":5531},{"style":185},[5532],{"type":70,"value":1060},{"type":64,"tag":110,"props":5534,"children":5535},{"style":129},[5536],{"type":70,"value":5537}," line",{"type":64,"tag":110,"props":5539,"children":5540},{"style":123},[5541],{"type":70,"value":5542}," of",{"type":64,"tag":110,"props":5544,"children":5545},{"style":129},[5546],{"type":70,"value":5434},{"type":64,"tag":110,"props":5548,"children":5549},{"style":256},[5550],{"type":70,"value":491},{"type":64,"tag":110,"props":5552,"children":5553},{"style":123},[5554],{"type":70,"value":264},{"type":64,"tag":110,"props":5556,"children":5557},{"class":112,"line":918},[5558,5562,5566,5570,5574,5579,5584],{"type":64,"tag":110,"props":5559,"children":5560},{"style":117},[5561],{"type":70,"value":3764},{"type":64,"tag":110,"props":5563,"children":5564},{"style":256},[5565],{"type":70,"value":1471},{"type":64,"tag":110,"props":5567,"children":5568},{"style":129},[5569],{"type":70,"value":112},{"type":64,"tag":110,"props":5571,"children":5572},{"style":123},[5573],{"type":70,"value":471},{"type":64,"tag":110,"props":5575,"children":5576},{"style":191},[5577],{"type":70,"value":5578},"trim",{"type":64,"tag":110,"props":5580,"children":5581},{"style":256},[5582],{"type":70,"value":5583},"()) ",{"type":64,"tag":110,"props":5585,"children":5586},{"style":123},[5587],{"type":70,"value":264},{"type":64,"tag":110,"props":5589,"children":5590},{"class":112,"line":927},[5591,5595,5599,5603,5607,5611,5615,5619,5624],{"type":64,"tag":110,"props":5592,"children":5593},{"style":117},[5594],{"type":70,"value":3806},{"type":64,"tag":110,"props":5596,"children":5597},{"style":129},[5598],{"type":70,"value":3337},{"type":64,"tag":110,"props":5600,"children":5601},{"style":123},[5602],{"type":70,"value":471},{"type":64,"tag":110,"props":5604,"children":5605},{"style":191},[5606],{"type":70,"value":3346},{"type":64,"tag":110,"props":5608,"children":5609},{"style":256},[5610],{"type":70,"value":259},{"type":64,"tag":110,"props":5612,"children":5613},{"style":129},[5614],{"type":70,"value":112},{"type":64,"tag":110,"props":5616,"children":5617},{"style":256},[5618],{"type":70,"value":491},{"type":64,"tag":110,"props":5620,"children":5621},{"style":117},[5622],{"type":70,"value":5623},"as",{"type":64,"tag":110,"props":5625,"children":5626},{"style":443},[5627],{"type":70,"value":5628}," StreamChunk\n",{"type":64,"tag":110,"props":5630,"children":5631},{"class":112,"line":3369},[5632],{"type":64,"tag":110,"props":5633,"children":5634},{"style":123},[5635],{"type":70,"value":3940},{"type":64,"tag":110,"props":5637,"children":5638},{"class":112,"line":3400},[5639],{"type":64,"tag":110,"props":5640,"children":5641},{"style":123},[5642],{"type":70,"value":3424},{"type":64,"tag":110,"props":5644,"children":5645},{"class":112,"line":3418},[5646],{"type":64,"tag":110,"props":5647,"children":5648},{"style":123},[5649],{"type":70,"value":5650},"  }\n",{"type":64,"tag":110,"props":5652,"children":5653},{"class":112,"line":3427},[5654,5658],{"type":64,"tag":110,"props":5655,"children":5656},{"style":123},[5657],{"type":70,"value":728},{"type":64,"tag":110,"props":5659,"children":5660},{"style":129},[5661],{"type":70,"value":409},{"type":64,"tag":110,"props":5663,"children":5664},{"class":112,"line":3435},[5665],{"type":64,"tag":110,"props":5666,"children":5667},{"emptyLinePlaceholder":175},[5668],{"type":70,"value":178},{"type":64,"tag":110,"props":5670,"children":5671},{"class":112,"line":3468},[5672,5676,5680,5684,5688,5692,5696,5700,5704,5708],{"type":64,"tag":110,"props":5673,"children":5674},{"style":185},[5675],{"type":70,"value":1060},{"type":64,"tag":110,"props":5677,"children":5678},{"style":123},[5679],{"type":70,"value":126},{"type":64,"tag":110,"props":5681,"children":5682},{"style":129},[5683],{"type":70,"value":222},{"type":64,"tag":110,"props":5685,"children":5686},{"style":123},[5687],{"type":70,"value":137},{"type":64,"tag":110,"props":5689,"children":5690},{"style":129},[5691],{"type":70,"value":1077},{"type":64,"tag":110,"props":5693,"children":5694},{"style":123},[5695],{"type":70,"value":728},{"type":64,"tag":110,"props":5697,"children":5698},{"style":123},[5699],{"type":70,"value":249},{"type":64,"tag":110,"props":5701,"children":5702},{"style":191},[5703],{"type":70,"value":132},{"type":64,"tag":110,"props":5705,"children":5706},{"style":129},[5707],{"type":70,"value":259},{"type":64,"tag":110,"props":5709,"children":5710},{"style":123},[5711],{"type":70,"value":264},{"type":64,"tag":110,"props":5713,"children":5714},{"class":112,"line":3486},[5715,5719,5723,5728],{"type":64,"tag":110,"props":5716,"children":5717},{"style":256},[5718],{"type":70,"value":1105},{"type":64,"tag":110,"props":5720,"children":5721},{"style":123},[5722],{"type":70,"value":278},{"type":64,"tag":110,"props":5724,"children":5725},{"style":129},[5726],{"type":70,"value":5727}," directAdapter",{"type":64,"tag":110,"props":5729,"children":5730},{"style":123},[5731],{"type":70,"value":368},{"type":64,"tag":110,"props":5733,"children":5734},{"class":112,"line":3502},[5735,5739],{"type":64,"tag":110,"props":5736,"children":5737},{"style":123},[5738],{"type":70,"value":728},{"type":64,"tag":110,"props":5740,"children":5741},{"style":129},[5742],{"type":70,"value":409},{"type":64,"tag":79,"props":5744,"children":5746},{"id":5745},"common-mistakes",[5747],{"type":70,"value":5748},"Common Mistakes",{"type":64,"tag":961,"props":5750,"children":5752},{"id":5751},"a-high-providing-both-connect-and-subscribesend-in-connection-adapter",[5753],{"type":70,"value":5754},"a. HIGH: Providing both connect and subscribe+send in connection adapter",{"type":64,"tag":73,"props":5756,"children":5757},{},[5758,5759,5764],{"type":70,"value":1665},{"type":64,"tag":91,"props":5760,"children":5762},{"className":5761},[],[5763],{"type":70,"value":2478},{"type":70,"value":5765}," interface has two mutually exclusive modes. Providing\nboth throws at runtime.",{"type":64,"tag":100,"props":5767,"children":5769},{"className":102,"code":5768,"language":45,"meta":104,"style":104},"\u002F\u002F WRONG -- throws \"Connection adapter must provide either connect or both\n\u002F\u002F subscribe and send, not both modes\"\nconst adapter = {\n  async *connect(messages) {\n    \u002F* ... *\u002F\n  },\n  subscribe(signal) {\n    \u002F* ... *\u002F\n  },\n  async send(messages) {\n    \u002F* ... *\u002F\n  },\n}\n\n\u002F\u002F CORRECT -- pick one mode\n\u002F\u002F Option A: ConnectConnectionAdapter (pull-based)\nconst pullAdapter = {\n  async *connect(messages, data, abortSignal) {\n    \u002F\u002F ... yield StreamChunks\n  },\n}\n\n\u002F\u002F Option B: SubscribeConnectionAdapter (push-based)\nconst pushAdapter = {\n  subscribe(abortSignal) {\n    return longLivedAsyncIterable\n  },\n  async send(messages, data, abortSignal) {\n    await connection.dispatch({ messages, ...data })\n  },\n}\n",[5770],{"type":64,"tag":91,"props":5771,"children":5772},{"__ignoreMap":104},[5773,5781,5789,5809,5840,5848,5855,5879,5886,5893,5920,5927,5934,5941,5948,5956,5964,5984,6033,6041,6048,6055,6062,6070,6089,6112,6124,6131,6174,6227,6234],{"type":64,"tag":110,"props":5774,"children":5775},{"class":112,"line":113},[5776],{"type":64,"tag":110,"props":5777,"children":5778},{"style":2871},[5779],{"type":70,"value":5780},"\u002F\u002F WRONG -- throws \"Connection adapter must provide either connect or both\n",{"type":64,"tag":110,"props":5782,"children":5783},{"class":112,"line":171},[5784],{"type":64,"tag":110,"props":5785,"children":5786},{"style":2871},[5787],{"type":70,"value":5788},"\u002F\u002F subscribe and send, not both modes\"\n",{"type":64,"tag":110,"props":5790,"children":5791},{"class":112,"line":181},[5792,5796,5801,5805],{"type":64,"tag":110,"props":5793,"children":5794},{"style":185},[5795],{"type":70,"value":1060},{"type":64,"tag":110,"props":5797,"children":5798},{"style":129},[5799],{"type":70,"value":5800}," adapter ",{"type":64,"tag":110,"props":5802,"children":5803},{"style":123},[5804],{"type":70,"value":714},{"type":64,"tag":110,"props":5806,"children":5807},{"style":123},[5808],{"type":70,"value":204},{"type":64,"tag":110,"props":5810,"children":5811},{"class":112,"line":207},[5812,5816,5820,5824,5828,5832,5836],{"type":64,"tag":110,"props":5813,"children":5814},{"style":185},[5815],{"type":70,"value":2674},{"type":64,"tag":110,"props":5817,"children":5818},{"style":123},[5819],{"type":70,"value":2679},{"type":64,"tag":110,"props":5821,"children":5822},{"style":256},[5823],{"type":70,"value":2684},{"type":64,"tag":110,"props":5825,"children":5826},{"style":123},[5827],{"type":70,"value":259},{"type":64,"tag":110,"props":5829,"children":5830},{"style":463},[5831],{"type":70,"value":466},{"type":64,"tag":110,"props":5833,"children":5834},{"style":123},[5835],{"type":70,"value":391},{"type":64,"tag":110,"props":5837,"children":5838},{"style":123},[5839],{"type":70,"value":204},{"type":64,"tag":110,"props":5841,"children":5842},{"class":112,"line":267},[5843],{"type":64,"tag":110,"props":5844,"children":5845},{"style":2871},[5846],{"type":70,"value":5847},"    \u002F* ... *\u002F\n",{"type":64,"tag":110,"props":5849,"children":5850},{"class":112,"line":311},[5851],{"type":64,"tag":110,"props":5852,"children":5853},{"style":123},[5854],{"type":70,"value":3957},{"type":64,"tag":110,"props":5856,"children":5857},{"class":112,"line":328},[5858,5862,5866,5871,5875],{"type":64,"tag":110,"props":5859,"children":5860},{"style":256},[5861],{"type":70,"value":4243},{"type":64,"tag":110,"props":5863,"children":5864},{"style":123},[5865],{"type":70,"value":259},{"type":64,"tag":110,"props":5867,"children":5868},{"style":463},[5869],{"type":70,"value":5870},"signal",{"type":64,"tag":110,"props":5872,"children":5873},{"style":123},[5874],{"type":70,"value":391},{"type":64,"tag":110,"props":5876,"children":5877},{"style":123},[5878],{"type":70,"value":204},{"type":64,"tag":110,"props":5880,"children":5881},{"class":112,"line":371},[5882],{"type":64,"tag":110,"props":5883,"children":5884},{"style":2871},[5885],{"type":70,"value":5847},{"type":64,"tag":110,"props":5887,"children":5888},{"class":112,"line":380},[5889],{"type":64,"tag":110,"props":5890,"children":5891},{"style":123},[5892],{"type":70,"value":3957},{"type":64,"tag":110,"props":5894,"children":5895},{"class":112,"line":398},[5896,5900,5904,5908,5912,5916],{"type":64,"tag":110,"props":5897,"children":5898},{"style":185},[5899],{"type":70,"value":2674},{"type":64,"tag":110,"props":5901,"children":5902},{"style":256},[5903],{"type":70,"value":4353},{"type":64,"tag":110,"props":5905,"children":5906},{"style":123},[5907],{"type":70,"value":259},{"type":64,"tag":110,"props":5909,"children":5910},{"style":463},[5911],{"type":70,"value":466},{"type":64,"tag":110,"props":5913,"children":5914},{"style":123},[5915],{"type":70,"value":391},{"type":64,"tag":110,"props":5917,"children":5918},{"style":123},[5919],{"type":70,"value":204},{"type":64,"tag":110,"props":5921,"children":5922},{"class":112,"line":412},[5923],{"type":64,"tag":110,"props":5924,"children":5925},{"style":2871},[5926],{"type":70,"value":5847},{"type":64,"tag":110,"props":5928,"children":5929},{"class":112,"line":420},[5930],{"type":64,"tag":110,"props":5931,"children":5932},{"style":123},[5933],{"type":70,"value":3957},{"type":64,"tag":110,"props":5935,"children":5936},{"class":112,"line":434},[5937],{"type":64,"tag":110,"props":5938,"children":5939},{"style":123},[5940],{"type":70,"value":800},{"type":64,"tag":110,"props":5942,"children":5943},{"class":112,"line":454},[5944],{"type":64,"tag":110,"props":5945,"children":5946},{"emptyLinePlaceholder":175},[5947],{"type":70,"value":178},{"type":64,"tag":110,"props":5949,"children":5950},{"class":112,"line":503},[5951],{"type":64,"tag":110,"props":5952,"children":5953},{"style":2871},[5954],{"type":70,"value":5955},"\u002F\u002F CORRECT -- pick one mode\n",{"type":64,"tag":110,"props":5957,"children":5958},{"class":112,"line":541},[5959],{"type":64,"tag":110,"props":5960,"children":5961},{"style":2871},[5962],{"type":70,"value":5963},"\u002F\u002F Option A: ConnectConnectionAdapter (pull-based)\n",{"type":64,"tag":110,"props":5965,"children":5966},{"class":112,"line":592},[5967,5971,5976,5980],{"type":64,"tag":110,"props":5968,"children":5969},{"style":185},[5970],{"type":70,"value":1060},{"type":64,"tag":110,"props":5972,"children":5973},{"style":129},[5974],{"type":70,"value":5975}," pullAdapter ",{"type":64,"tag":110,"props":5977,"children":5978},{"style":123},[5979],{"type":70,"value":714},{"type":64,"tag":110,"props":5981,"children":5982},{"style":123},[5983],{"type":70,"value":204},{"type":64,"tag":110,"props":5985,"children":5986},{"class":112,"line":652},[5987,5991,5995,5999,6003,6007,6011,6016,6020,6025,6029],{"type":64,"tag":110,"props":5988,"children":5989},{"style":185},[5990],{"type":70,"value":2674},{"type":64,"tag":110,"props":5992,"children":5993},{"style":123},[5994],{"type":70,"value":2679},{"type":64,"tag":110,"props":5996,"children":5997},{"style":256},[5998],{"type":70,"value":2684},{"type":64,"tag":110,"props":6000,"children":6001},{"style":123},[6002],{"type":70,"value":259},{"type":64,"tag":110,"props":6004,"children":6005},{"style":463},[6006],{"type":70,"value":466},{"type":64,"tag":110,"props":6008,"children":6009},{"style":123},[6010],{"type":70,"value":137},{"type":64,"tag":110,"props":6012,"children":6013},{"style":463},[6014],{"type":70,"value":6015}," data",{"type":64,"tag":110,"props":6017,"children":6018},{"style":123},[6019],{"type":70,"value":137},{"type":64,"tag":110,"props":6021,"children":6022},{"style":463},[6023],{"type":70,"value":6024}," abortSignal",{"type":64,"tag":110,"props":6026,"children":6027},{"style":123},[6028],{"type":70,"value":391},{"type":64,"tag":110,"props":6030,"children":6031},{"style":123},[6032],{"type":70,"value":204},{"type":64,"tag":110,"props":6034,"children":6035},{"class":112,"line":690},[6036],{"type":64,"tag":110,"props":6037,"children":6038},{"style":2871},[6039],{"type":70,"value":6040},"    \u002F\u002F ... yield StreamChunks\n",{"type":64,"tag":110,"props":6042,"children":6043},{"class":112,"line":762},[6044],{"type":64,"tag":110,"props":6045,"children":6046},{"style":123},[6047],{"type":70,"value":3957},{"type":64,"tag":110,"props":6049,"children":6050},{"class":112,"line":771},[6051],{"type":64,"tag":110,"props":6052,"children":6053},{"style":123},[6054],{"type":70,"value":800},{"type":64,"tag":110,"props":6056,"children":6057},{"class":112,"line":785},[6058],{"type":64,"tag":110,"props":6059,"children":6060},{"emptyLinePlaceholder":175},[6061],{"type":70,"value":178},{"type":64,"tag":110,"props":6063,"children":6064},{"class":112,"line":803},[6065],{"type":64,"tag":110,"props":6066,"children":6067},{"style":2871},[6068],{"type":70,"value":6069},"\u002F\u002F Option B: SubscribeConnectionAdapter (push-based)\n",{"type":64,"tag":110,"props":6071,"children":6072},{"class":112,"line":820},[6073,6077,6081,6085],{"type":64,"tag":110,"props":6074,"children":6075},{"style":185},[6076],{"type":70,"value":1060},{"type":64,"tag":110,"props":6078,"children":6079},{"style":129},[6080],{"type":70,"value":4227},{"type":64,"tag":110,"props":6082,"children":6083},{"style":123},[6084],{"type":70,"value":714},{"type":64,"tag":110,"props":6086,"children":6087},{"style":123},[6088],{"type":70,"value":204},{"type":64,"tag":110,"props":6090,"children":6091},{"class":112,"line":833},[6092,6096,6100,6104,6108],{"type":64,"tag":110,"props":6093,"children":6094},{"style":256},[6095],{"type":70,"value":4243},{"type":64,"tag":110,"props":6097,"children":6098},{"style":123},[6099],{"type":70,"value":259},{"type":64,"tag":110,"props":6101,"children":6102},{"style":463},[6103],{"type":70,"value":4252},{"type":64,"tag":110,"props":6105,"children":6106},{"style":123},[6107],{"type":70,"value":391},{"type":64,"tag":110,"props":6109,"children":6110},{"style":123},[6111],{"type":70,"value":204},{"type":64,"tag":110,"props":6113,"children":6114},{"class":112,"line":901},[6115,6119],{"type":64,"tag":110,"props":6116,"children":6117},{"style":117},[6118],{"type":70,"value":4310},{"type":64,"tag":110,"props":6120,"children":6121},{"style":129},[6122],{"type":70,"value":6123}," longLivedAsyncIterable\n",{"type":64,"tag":110,"props":6125,"children":6126},{"class":112,"line":918},[6127],{"type":64,"tag":110,"props":6128,"children":6129},{"style":123},[6130],{"type":70,"value":3957},{"type":64,"tag":110,"props":6132,"children":6133},{"class":112,"line":927},[6134,6138,6142,6146,6150,6154,6158,6162,6166,6170],{"type":64,"tag":110,"props":6135,"children":6136},{"style":185},[6137],{"type":70,"value":2674},{"type":64,"tag":110,"props":6139,"children":6140},{"style":256},[6141],{"type":70,"value":4353},{"type":64,"tag":110,"props":6143,"children":6144},{"style":123},[6145],{"type":70,"value":259},{"type":64,"tag":110,"props":6147,"children":6148},{"style":463},[6149],{"type":70,"value":466},{"type":64,"tag":110,"props":6151,"children":6152},{"style":123},[6153],{"type":70,"value":137},{"type":64,"tag":110,"props":6155,"children":6156},{"style":463},[6157],{"type":70,"value":6015},{"type":64,"tag":110,"props":6159,"children":6160},{"style":123},[6161],{"type":70,"value":137},{"type":64,"tag":110,"props":6163,"children":6164},{"style":463},[6165],{"type":70,"value":6024},{"type":64,"tag":110,"props":6167,"children":6168},{"style":123},[6169],{"type":70,"value":391},{"type":64,"tag":110,"props":6171,"children":6172},{"style":123},[6173],{"type":70,"value":204},{"type":64,"tag":110,"props":6175,"children":6176},{"class":112,"line":3369},[6177,6181,6186,6190,6195,6199,6203,6207,6211,6215,6219,6223],{"type":64,"tag":110,"props":6178,"children":6179},{"style":117},[6180],{"type":70,"value":2882},{"type":64,"tag":110,"props":6182,"children":6183},{"style":129},[6184],{"type":70,"value":6185}," connection",{"type":64,"tag":110,"props":6187,"children":6188},{"style":123},[6189],{"type":70,"value":471},{"type":64,"tag":110,"props":6191,"children":6192},{"style":191},[6193],{"type":70,"value":6194},"dispatch",{"type":64,"tag":110,"props":6196,"children":6197},{"style":256},[6198],{"type":70,"value":259},{"type":64,"tag":110,"props":6200,"children":6201},{"style":123},[6202],{"type":70,"value":562},{"type":64,"tag":110,"props":6204,"children":6205},{"style":129},[6206],{"type":70,"value":222},{"type":64,"tag":110,"props":6208,"children":6209},{"style":123},[6210],{"type":70,"value":137},{"type":64,"tag":110,"props":6212,"children":6213},{"style":123},[6214],{"type":70,"value":3112},{"type":64,"tag":110,"props":6216,"children":6217},{"style":129},[6218],{"type":70,"value":1685},{"type":64,"tag":110,"props":6220,"children":6221},{"style":123},[6222],{"type":70,"value":147},{"type":64,"tag":110,"props":6224,"children":6225},{"style":256},[6226],{"type":70,"value":409},{"type":64,"tag":110,"props":6228,"children":6229},{"class":112,"line":3400},[6230],{"type":64,"tag":110,"props":6231,"children":6232},{"style":123},[6233],{"type":70,"value":3957},{"type":64,"tag":110,"props":6235,"children":6236},{"class":112,"line":3418},[6237],{"type":64,"tag":110,"props":6238,"children":6239},{"style":123},[6240],{"type":70,"value":800},{"type":64,"tag":73,"props":6242,"children":6243},{},[6244,6246,6252],{"type":70,"value":6245},"Source: ",{"type":64,"tag":91,"props":6247,"children":6249},{"className":6248},[],[6250],{"type":70,"value":6251},"ai-client\u002Fsrc\u002Fconnection-adapters.ts",{"type":70,"value":6253}," line 116",{"type":64,"tag":961,"props":6255,"children":6257},{"id":6256},"b-medium-sse-browser-connection-limits",[6258],{"type":70,"value":6259},"b. MEDIUM: SSE browser connection limits",{"type":64,"tag":73,"props":6261,"children":6262},{},[6263],{"type":70,"value":6264},"Browsers limit SSE connections to 6-8 per domain (the HTTP\u002F1.1 connection\nlimit). Multiple chat sessions on the same page, or multiple tabs to the\nsame origin, can exhaust this limit. New connections queue indefinitely until\nan existing one closes.",{"type":64,"tag":73,"props":6266,"children":6267},{},[6268],{"type":70,"value":6269},"Mitigations:",{"type":64,"tag":6271,"props":6272,"children":6273},"ul",{},[6274,6280,6299,6304],{"type":64,"tag":6275,"props":6276,"children":6277},"li",{},[6278],{"type":70,"value":6279},"Use HTTP\u002F2 (multiplexes streams over a single TCP connection; no per-domain limit)",{"type":64,"tag":6275,"props":6281,"children":6282},{},[6283,6285,6290,6292,6297],{"type":70,"value":6284},"Use ",{"type":64,"tag":91,"props":6286,"children":6288},{"className":6287},[],[6289],{"type":70,"value":951},{"type":70,"value":6291}," instead of ",{"type":64,"tag":91,"props":6293,"children":6295},{"className":6294},[],[6296],{"type":70,"value":943},{"type":70,"value":6298}," (each request is a\nstandard POST, not a long-lived EventSource)",{"type":64,"tag":6275,"props":6300,"children":6301},{},[6302],{"type":70,"value":6303},"Close idle connections when not actively streaming",{"type":64,"tag":6275,"props":6305,"children":6306},{},[6307,6309,6315],{"type":70,"value":6308},"Use a single persistent WebSocket via ",{"type":64,"tag":91,"props":6310,"children":6312},{"className":6311},[],[6313],{"type":70,"value":6314},"SubscribeConnectionAdapter",{"type":70,"value":6316}," instead of\nper-request SSE connections",{"type":64,"tag":73,"props":6318,"children":6319},{},[6320,6321],{"type":70,"value":6245},{"type":64,"tag":91,"props":6322,"children":6324},{"className":6323},[],[6325],{"type":70,"value":6326},"docs\u002Fchat\u002Fconnection-adapters.md",{"type":64,"tag":961,"props":6328,"children":6330},{"id":6329},"c-medium-http-stream-without-implementing-reconnection",[6331],{"type":70,"value":6332},"c. MEDIUM: HTTP stream without implementing reconnection",{"type":64,"tag":73,"props":6334,"children":6335},{},[6336,6338,6344,6346,6351],{"type":70,"value":6337},"SSE has built-in browser auto-reconnection via the ",{"type":64,"tag":91,"props":6339,"children":6341},{"className":6340},[],[6342],{"type":70,"value":6343},"EventSource",{"type":70,"value":6345}," API. HTTP\nstream (NDJSON via ",{"type":64,"tag":91,"props":6347,"children":6349},{"className":6348},[],[6350],{"type":70,"value":951},{"type":70,"value":6352},") does not -- if the connection drops\nmid-stream, the partial response is silently lost with no automatic retry.",{"type":64,"tag":73,"props":6354,"children":6355},{},[6356],{"type":70,"value":6357},"If your application needs resilience to transient network errors with HTTP\nstreaming, implement retry logic in your connection adapter:",{"type":64,"tag":100,"props":6359,"children":6361},{"className":102,"code":6360,"language":45,"meta":104,"style":104},"import { useChat } from '@tanstack\u002Fai-react'\nimport type { ConnectionAdapter } from '@tanstack\u002Fai-react'\nimport type { StreamChunk, UIMessage } from '@tanstack\u002Fai'\n\nconst resilientAdapter: ConnectionAdapter = {\n  async *connect(\n    messages: Array\u003CUIMessage>,\n    data?: Record\u003Cstring, any>,\n    abortSignal?: AbortSignal,\n  ): AsyncGenerator\u003CStreamChunk> {\n    const maxRetries = 3\n    let attempt = 0\n\n    while (attempt \u003C maxRetries) {\n      try {\n        const response = await fetch('https:\u002F\u002Fmy-api.com\u002Fchat', {\n          method: 'POST',\n          headers: { 'Content-Type': 'application\u002Fjson' },\n          body: JSON.stringify({ messages, ...data }),\n          signal: abortSignal,\n        })\n\n        if (!response.ok) {\n          throw new Error(`HTTP ${response.status}`)\n        }\n\n        const reader = response.body!.getReader()\n        const decoder = new TextDecoder()\n        let buffer = ''\n\n        while (true) {\n          const { done, value } = await reader.read()\n          if (done) break\n\n          buffer += decoder.decode(value, { stream: true })\n          const lines = buffer.split('\\n')\n          buffer = lines.pop() || ''\n\n          for (const line of lines) {\n            if (line.trim()) {\n              yield JSON.parse(line) as StreamChunk\n            }\n          }\n        }\n\n        return \u002F\u002F Stream completed successfully\n      } catch (err) {\n        if (abortSignal?.aborted) throw err\n        attempt++\n        if (attempt >= maxRetries) throw err\n        \u002F\u002F Exponential backoff\n        await new Promise((r) => setTimeout(r, 1000 * 2 ** attempt))\n      }\n    }\n  },\n}\n\nconst { messages, sendMessage } = useChat({\n  connection: resilientAdapter,\n})\n",[6362],{"type":64,"tag":91,"props":6363,"children":6364},{"__ignoreMap":104},[6365,6400,6439,6486,6493,6521,6540,6567,6602,6621,6648,6669,6690,6697,6729,6741,6789,6817,6865,6925,6945,6956,6963,7001,7057,7065,7072,7111,7138,7158,7165,7189,7241,7265,7272,7332,7379,7414,7421,7457,7489,7529,7536,7544,7551,7558,7571,7600,7638,7651,7687,7695,7774,7781,7788,7795,7802,7809,7852,7871],{"type":64,"tag":110,"props":6366,"children":6367},{"class":112,"line":113},[6368,6372,6376,6380,6384,6388,6392,6396],{"type":64,"tag":110,"props":6369,"children":6370},{"style":117},[6371],{"type":70,"value":120},{"type":64,"tag":110,"props":6373,"children":6374},{"style":123},[6375],{"type":70,"value":126},{"type":64,"tag":110,"props":6377,"children":6378},{"style":129},[6379],{"type":70,"value":132},{"type":64,"tag":110,"props":6381,"children":6382},{"style":123},[6383],{"type":70,"value":147},{"type":64,"tag":110,"props":6385,"children":6386},{"style":117},[6387],{"type":70,"value":152},{"type":64,"tag":110,"props":6389,"children":6390},{"style":123},[6391],{"type":70,"value":157},{"type":64,"tag":110,"props":6393,"children":6394},{"style":160},[6395],{"type":70,"value":163},{"type":64,"tag":110,"props":6397,"children":6398},{"style":123},[6399],{"type":70,"value":168},{"type":64,"tag":110,"props":6401,"children":6402},{"class":112,"line":171},[6403,6407,6411,6415,6419,6423,6427,6431,6435],{"type":64,"tag":110,"props":6404,"children":6405},{"style":117},[6406],{"type":70,"value":120},{"type":64,"tag":110,"props":6408,"children":6409},{"style":117},[6410],{"type":70,"value":2552},{"type":64,"tag":110,"props":6412,"children":6413},{"style":123},[6414],{"type":70,"value":126},{"type":64,"tag":110,"props":6416,"children":6417},{"style":129},[6418],{"type":70,"value":2561},{"type":64,"tag":110,"props":6420,"children":6421},{"style":123},[6422],{"type":70,"value":147},{"type":64,"tag":110,"props":6424,"children":6425},{"style":117},[6426],{"type":70,"value":152},{"type":64,"tag":110,"props":6428,"children":6429},{"style":123},[6430],{"type":70,"value":157},{"type":64,"tag":110,"props":6432,"children":6433},{"style":160},[6434],{"type":70,"value":163},{"type":64,"tag":110,"props":6436,"children":6437},{"style":123},[6438],{"type":70,"value":168},{"type":64,"tag":110,"props":6440,"children":6441},{"class":112,"line":181},[6442,6446,6450,6454,6458,6462,6466,6470,6474,6478,6482],{"type":64,"tag":110,"props":6443,"children":6444},{"style":117},[6445],{"type":70,"value":120},{"type":64,"tag":110,"props":6447,"children":6448},{"style":117},[6449],{"type":70,"value":2552},{"type":64,"tag":110,"props":6451,"children":6452},{"style":123},[6453],{"type":70,"value":126},{"type":64,"tag":110,"props":6455,"children":6456},{"style":129},[6457],{"type":70,"value":2601},{"type":64,"tag":110,"props":6459,"children":6460},{"style":123},[6461],{"type":70,"value":137},{"type":64,"tag":110,"props":6463,"children":6464},{"style":129},[6465],{"type":70,"value":2610},{"type":64,"tag":110,"props":6467,"children":6468},{"style":123},[6469],{"type":70,"value":147},{"type":64,"tag":110,"props":6471,"children":6472},{"style":117},[6473],{"type":70,"value":152},{"type":64,"tag":110,"props":6475,"children":6476},{"style":123},[6477],{"type":70,"value":157},{"type":64,"tag":110,"props":6479,"children":6480},{"style":160},[6481],{"type":70,"value":2627},{"type":64,"tag":110,"props":6483,"children":6484},{"style":123},[6485],{"type":70,"value":168},{"type":64,"tag":110,"props":6487,"children":6488},{"class":112,"line":207},[6489],{"type":64,"tag":110,"props":6490,"children":6491},{"emptyLinePlaceholder":175},[6492],{"type":70,"value":178},{"type":64,"tag":110,"props":6494,"children":6495},{"class":112,"line":267},[6496,6500,6505,6509,6513,6517],{"type":64,"tag":110,"props":6497,"children":6498},{"style":185},[6499],{"type":70,"value":1060},{"type":64,"tag":110,"props":6501,"children":6502},{"style":129},[6503],{"type":70,"value":6504}," resilientAdapter",{"type":64,"tag":110,"props":6506,"children":6507},{"style":123},[6508],{"type":70,"value":278},{"type":64,"tag":110,"props":6510,"children":6511},{"style":443},[6512],{"type":70,"value":2561},{"type":64,"tag":110,"props":6514,"children":6515},{"style":123},[6516],{"type":70,"value":249},{"type":64,"tag":110,"props":6518,"children":6519},{"style":123},[6520],{"type":70,"value":204},{"type":64,"tag":110,"props":6522,"children":6523},{"class":112,"line":311},[6524,6528,6532,6536],{"type":64,"tag":110,"props":6525,"children":6526},{"style":185},[6527],{"type":70,"value":2674},{"type":64,"tag":110,"props":6529,"children":6530},{"style":123},[6531],{"type":70,"value":2679},{"type":64,"tag":110,"props":6533,"children":6534},{"style":256},[6535],{"type":70,"value":2684},{"type":64,"tag":110,"props":6537,"children":6538},{"style":123},[6539],{"type":70,"value":1410},{"type":64,"tag":110,"props":6541,"children":6542},{"class":112,"line":328},[6543,6547,6551,6555,6559,6563],{"type":64,"tag":110,"props":6544,"children":6545},{"style":463},[6546],{"type":70,"value":2696},{"type":64,"tag":110,"props":6548,"children":6549},{"style":123},[6550],{"type":70,"value":278},{"type":64,"tag":110,"props":6552,"children":6553},{"style":443},[6554],{"type":70,"value":2705},{"type":64,"tag":110,"props":6556,"children":6557},{"style":123},[6558],{"type":70,"value":2710},{"type":64,"tag":110,"props":6560,"children":6561},{"style":443},[6562],{"type":70,"value":2715},{"type":64,"tag":110,"props":6564,"children":6565},{"style":123},[6566],{"type":70,"value":2720},{"type":64,"tag":110,"props":6568,"children":6569},{"class":112,"line":371},[6570,6574,6578,6582,6586,6590,6594,6598],{"type":64,"tag":110,"props":6571,"children":6572},{"style":463},[6573],{"type":70,"value":2728},{"type":64,"tag":110,"props":6575,"children":6576},{"style":123},[6577],{"type":70,"value":2733},{"type":64,"tag":110,"props":6579,"children":6580},{"style":443},[6581],{"type":70,"value":2738},{"type":64,"tag":110,"props":6583,"children":6584},{"style":123},[6585],{"type":70,"value":2710},{"type":64,"tag":110,"props":6587,"children":6588},{"style":443},[6589],{"type":70,"value":2747},{"type":64,"tag":110,"props":6591,"children":6592},{"style":123},[6593],{"type":70,"value":137},{"type":64,"tag":110,"props":6595,"children":6596},{"style":443},[6597],{"type":70,"value":2756},{"type":64,"tag":110,"props":6599,"children":6600},{"style":123},[6601],{"type":70,"value":2720},{"type":64,"tag":110,"props":6603,"children":6604},{"class":112,"line":380},[6605,6609,6613,6617],{"type":64,"tag":110,"props":6606,"children":6607},{"style":463},[6608],{"type":70,"value":2768},{"type":64,"tag":110,"props":6610,"children":6611},{"style":123},[6612],{"type":70,"value":2733},{"type":64,"tag":110,"props":6614,"children":6615},{"style":443},[6616],{"type":70,"value":2777},{"type":64,"tag":110,"props":6618,"children":6619},{"style":123},[6620],{"type":70,"value":368},{"type":64,"tag":110,"props":6622,"children":6623},{"class":112,"line":398},[6624,6628,6632,6636,6640,6644],{"type":64,"tag":110,"props":6625,"children":6626},{"style":123},[6627],{"type":70,"value":2789},{"type":64,"tag":110,"props":6629,"children":6630},{"style":443},[6631],{"type":70,"value":2794},{"type":64,"tag":110,"props":6633,"children":6634},{"style":123},[6635],{"type":70,"value":2710},{"type":64,"tag":110,"props":6637,"children":6638},{"style":443},[6639],{"type":70,"value":1914},{"type":64,"tag":110,"props":6641,"children":6642},{"style":123},[6643],{"type":70,"value":557},{"type":64,"tag":110,"props":6645,"children":6646},{"style":123},[6647],{"type":70,"value":204},{"type":64,"tag":110,"props":6649,"children":6650},{"class":112,"line":412},[6651,6655,6660,6664],{"type":64,"tag":110,"props":6652,"children":6653},{"style":185},[6654],{"type":70,"value":2818},{"type":64,"tag":110,"props":6656,"children":6657},{"style":129},[6658],{"type":70,"value":6659}," maxRetries",{"type":64,"tag":110,"props":6661,"children":6662},{"style":123},[6663],{"type":70,"value":249},{"type":64,"tag":110,"props":6665,"children":6666},{"style":3744},[6667],{"type":70,"value":6668}," 3\n",{"type":64,"tag":110,"props":6670,"children":6671},{"class":112,"line":420},[6672,6676,6681,6685],{"type":64,"tag":110,"props":6673,"children":6674},{"style":185},[6675],{"type":70,"value":3189},{"type":64,"tag":110,"props":6677,"children":6678},{"style":129},[6679],{"type":70,"value":6680}," attempt",{"type":64,"tag":110,"props":6682,"children":6683},{"style":123},[6684],{"type":70,"value":249},{"type":64,"tag":110,"props":6686,"children":6687},{"style":3744},[6688],{"type":70,"value":6689}," 0\n",{"type":64,"tag":110,"props":6691,"children":6692},{"class":112,"line":434},[6693],{"type":64,"tag":110,"props":6694,"children":6695},{"emptyLinePlaceholder":175},[6696],{"type":70,"value":178},{"type":64,"tag":110,"props":6698,"children":6699},{"class":112,"line":454},[6700,6704,6708,6713,6717,6721,6725],{"type":64,"tag":110,"props":6701,"children":6702},{"style":117},[6703],{"type":70,"value":3704},{"type":64,"tag":110,"props":6705,"children":6706},{"style":256},[6707],{"type":70,"value":1471},{"type":64,"tag":110,"props":6709,"children":6710},{"style":129},[6711],{"type":70,"value":6712},"attempt",{"type":64,"tag":110,"props":6714,"children":6715},{"style":123},[6716],{"type":70,"value":701},{"type":64,"tag":110,"props":6718,"children":6719},{"style":129},[6720],{"type":70,"value":6659},{"type":64,"tag":110,"props":6722,"children":6723},{"style":256},[6724],{"type":70,"value":491},{"type":64,"tag":110,"props":6726,"children":6727},{"style":123},[6728],{"type":70,"value":264},{"type":64,"tag":110,"props":6730,"children":6731},{"class":112,"line":503},[6732,6737],{"type":64,"tag":110,"props":6733,"children":6734},{"style":117},[6735],{"type":70,"value":6736},"      try",{"type":64,"tag":110,"props":6738,"children":6739},{"style":123},[6740],{"type":70,"value":204},{"type":64,"tag":110,"props":6742,"children":6743},{"class":112,"line":541},[6744,6749,6753,6757,6761,6765,6769,6773,6777,6781,6785],{"type":64,"tag":110,"props":6745,"children":6746},{"style":185},[6747],{"type":70,"value":6748},"        const",{"type":64,"tag":110,"props":6750,"children":6751},{"style":129},[6752],{"type":70,"value":4954},{"type":64,"tag":110,"props":6754,"children":6755},{"style":123},[6756],{"type":70,"value":249},{"type":64,"tag":110,"props":6758,"children":6759},{"style":117},[6760],{"type":70,"value":4963},{"type":64,"tag":110,"props":6762,"children":6763},{"style":191},[6764],{"type":70,"value":4968},{"type":64,"tag":110,"props":6766,"children":6767},{"style":256},[6768],{"type":70,"value":259},{"type":64,"tag":110,"props":6770,"children":6771},{"style":123},[6772],{"type":70,"value":291},{"type":64,"tag":110,"props":6774,"children":6775},{"style":160},[6776],{"type":70,"value":296},{"type":64,"tag":110,"props":6778,"children":6779},{"style":123},[6780],{"type":70,"value":291},{"type":64,"tag":110,"props":6782,"children":6783},{"style":123},[6784],{"type":70,"value":137},{"type":64,"tag":110,"props":6786,"children":6787},{"style":123},[6788],{"type":70,"value":204},{"type":64,"tag":110,"props":6790,"children":6791},{"class":112,"line":592},[6792,6797,6801,6805,6809,6813],{"type":64,"tag":110,"props":6793,"children":6794},{"style":256},[6795],{"type":70,"value":6796},"          method",{"type":64,"tag":110,"props":6798,"children":6799},{"style":123},[6800],{"type":70,"value":278},{"type":64,"tag":110,"props":6802,"children":6803},{"style":123},[6804],{"type":70,"value":157},{"type":64,"tag":110,"props":6806,"children":6807},{"style":160},[6808],{"type":70,"value":5013},{"type":64,"tag":110,"props":6810,"children":6811},{"style":123},[6812],{"type":70,"value":291},{"type":64,"tag":110,"props":6814,"children":6815},{"style":123},[6816],{"type":70,"value":368},{"type":64,"tag":110,"props":6818,"children":6819},{"class":112,"line":652},[6820,6825,6829,6833,6837,6841,6845,6849,6853,6857,6861],{"type":64,"tag":110,"props":6821,"children":6822},{"style":256},[6823],{"type":70,"value":6824},"          headers",{"type":64,"tag":110,"props":6826,"children":6827},{"style":123},[6828],{"type":70,"value":278},{"type":64,"tag":110,"props":6830,"children":6831},{"style":123},[6832],{"type":70,"value":126},{"type":64,"tag":110,"props":6834,"children":6835},{"style":123},[6836],{"type":70,"value":157},{"type":64,"tag":110,"props":6838,"children":6839},{"style":256},[6840],{"type":70,"value":5045},{"type":64,"tag":110,"props":6842,"children":6843},{"style":123},[6844],{"type":70,"value":291},{"type":64,"tag":110,"props":6846,"children":6847},{"style":123},[6848],{"type":70,"value":278},{"type":64,"tag":110,"props":6850,"children":6851},{"style":123},[6852],{"type":70,"value":157},{"type":64,"tag":110,"props":6854,"children":6855},{"style":160},[6856],{"type":70,"value":5062},{"type":64,"tag":110,"props":6858,"children":6859},{"style":123},[6860],{"type":70,"value":291},{"type":64,"tag":110,"props":6862,"children":6863},{"style":123},[6864],{"type":70,"value":2424},{"type":64,"tag":110,"props":6866,"children":6867},{"class":112,"line":690},[6868,6873,6877,6881,6885,6889,6893,6897,6901,6905,6909,6913,6917,6921],{"type":64,"tag":110,"props":6869,"children":6870},{"style":256},[6871],{"type":70,"value":6872},"          body",{"type":64,"tag":110,"props":6874,"children":6875},{"style":123},[6876],{"type":70,"value":278},{"type":64,"tag":110,"props":6878,"children":6879},{"style":129},[6880],{"type":70,"value":3337},{"type":64,"tag":110,"props":6882,"children":6883},{"style":123},[6884],{"type":70,"value":471},{"type":64,"tag":110,"props":6886,"children":6887},{"style":191},[6888],{"type":70,"value":3091},{"type":64,"tag":110,"props":6890,"children":6891},{"style":256},[6892],{"type":70,"value":259},{"type":64,"tag":110,"props":6894,"children":6895},{"style":123},[6896],{"type":70,"value":562},{"type":64,"tag":110,"props":6898,"children":6899},{"style":129},[6900],{"type":70,"value":222},{"type":64,"tag":110,"props":6902,"children":6903},{"style":123},[6904],{"type":70,"value":137},{"type":64,"tag":110,"props":6906,"children":6907},{"style":123},[6908],{"type":70,"value":3112},{"type":64,"tag":110,"props":6910,"children":6911},{"style":129},[6912],{"type":70,"value":1685},{"type":64,"tag":110,"props":6914,"children":6915},{"style":123},[6916],{"type":70,"value":147},{"type":64,"tag":110,"props":6918,"children":6919},{"style":256},[6920],{"type":70,"value":391},{"type":64,"tag":110,"props":6922,"children":6923},{"style":123},[6924],{"type":70,"value":368},{"type":64,"tag":110,"props":6926,"children":6927},{"class":112,"line":762},[6928,6933,6937,6941],{"type":64,"tag":110,"props":6929,"children":6930},{"style":256},[6931],{"type":70,"value":6932},"          signal",{"type":64,"tag":110,"props":6934,"children":6935},{"style":123},[6936],{"type":70,"value":278},{"type":64,"tag":110,"props":6938,"children":6939},{"style":129},[6940],{"type":70,"value":6024},{"type":64,"tag":110,"props":6942,"children":6943},{"style":123},[6944],{"type":70,"value":368},{"type":64,"tag":110,"props":6946,"children":6947},{"class":112,"line":771},[6948,6952],{"type":64,"tag":110,"props":6949,"children":6950},{"style":123},[6951],{"type":70,"value":3927},{"type":64,"tag":110,"props":6953,"children":6954},{"style":256},[6955],{"type":70,"value":409},{"type":64,"tag":110,"props":6957,"children":6958},{"class":112,"line":785},[6959],{"type":64,"tag":110,"props":6960,"children":6961},{"emptyLinePlaceholder":175},[6962],{"type":70,"value":178},{"type":64,"tag":110,"props":6964,"children":6965},{"class":112,"line":803},[6966,6971,6975,6979,6984,6988,6993,6997],{"type":64,"tag":110,"props":6967,"children":6968},{"style":117},[6969],{"type":70,"value":6970},"        if",{"type":64,"tag":110,"props":6972,"children":6973},{"style":256},[6974],{"type":70,"value":1471},{"type":64,"tag":110,"props":6976,"children":6977},{"style":123},[6978],{"type":70,"value":3713},{"type":64,"tag":110,"props":6980,"children":6981},{"style":129},[6982],{"type":70,"value":6983},"response",{"type":64,"tag":110,"props":6985,"children":6986},{"style":123},[6987],{"type":70,"value":471},{"type":64,"tag":110,"props":6989,"children":6990},{"style":129},[6991],{"type":70,"value":6992},"ok",{"type":64,"tag":110,"props":6994,"children":6995},{"style":256},[6996],{"type":70,"value":491},{"type":64,"tag":110,"props":6998,"children":6999},{"style":123},[7000],{"type":70,"value":264},{"type":64,"tag":110,"props":7002,"children":7003},{"class":112,"line":820},[7004,7009,7013,7018,7022,7027,7032,7036,7040,7044,7049,7053],{"type":64,"tag":110,"props":7005,"children":7006},{"style":117},[7007],{"type":70,"value":7008},"          throw",{"type":64,"tag":110,"props":7010,"children":7011},{"style":123},[7012],{"type":70,"value":2832},{"type":64,"tag":110,"props":7014,"children":7015},{"style":191},[7016],{"type":70,"value":7017}," Error",{"type":64,"tag":110,"props":7019,"children":7020},{"style":256},[7021],{"type":70,"value":259},{"type":64,"tag":110,"props":7023,"children":7024},{"style":123},[7025],{"type":70,"value":7026},"`",{"type":64,"tag":110,"props":7028,"children":7029},{"style":160},[7030],{"type":70,"value":7031},"HTTP ",{"type":64,"tag":110,"props":7033,"children":7034},{"style":123},[7035],{"type":70,"value":353},{"type":64,"tag":110,"props":7037,"children":7038},{"style":129},[7039],{"type":70,"value":6983},{"type":64,"tag":110,"props":7041,"children":7042},{"style":123},[7043],{"type":70,"value":471},{"type":64,"tag":110,"props":7045,"children":7046},{"style":129},[7047],{"type":70,"value":7048},"status",{"type":64,"tag":110,"props":7050,"children":7051},{"style":123},[7052],{"type":70,"value":363},{"type":64,"tag":110,"props":7054,"children":7055},{"style":256},[7056],{"type":70,"value":409},{"type":64,"tag":110,"props":7058,"children":7059},{"class":112,"line":833},[7060],{"type":64,"tag":110,"props":7061,"children":7062},{"style":123},[7063],{"type":70,"value":7064},"        }\n",{"type":64,"tag":110,"props":7066,"children":7067},{"class":112,"line":901},[7068],{"type":64,"tag":110,"props":7069,"children":7070},{"emptyLinePlaceholder":175},[7071],{"type":70,"value":178},{"type":64,"tag":110,"props":7073,"children":7074},{"class":112,"line":918},[7075,7079,7083,7087,7091,7095,7099,7103,7107],{"type":64,"tag":110,"props":7076,"children":7077},{"style":185},[7078],{"type":70,"value":6748},{"type":64,"tag":110,"props":7080,"children":7081},{"style":129},[7082],{"type":70,"value":5160},{"type":64,"tag":110,"props":7084,"children":7085},{"style":123},[7086],{"type":70,"value":249},{"type":64,"tag":110,"props":7088,"children":7089},{"style":129},[7090],{"type":70,"value":4954},{"type":64,"tag":110,"props":7092,"children":7093},{"style":123},[7094],{"type":70,"value":471},{"type":64,"tag":110,"props":7096,"children":7097},{"style":129},[7098],{"type":70,"value":1671},{"type":64,"tag":110,"props":7100,"children":7101},{"style":123},[7102],{"type":70,"value":5181},{"type":64,"tag":110,"props":7104,"children":7105},{"style":191},[7106],{"type":70,"value":5186},{"type":64,"tag":110,"props":7108,"children":7109},{"style":256},[7110],{"type":70,"value":2977},{"type":64,"tag":110,"props":7112,"children":7113},{"class":112,"line":927},[7114,7118,7122,7126,7130,7134],{"type":64,"tag":110,"props":7115,"children":7116},{"style":185},[7117],{"type":70,"value":6748},{"type":64,"tag":110,"props":7119,"children":7120},{"style":129},[7121],{"type":70,"value":5202},{"type":64,"tag":110,"props":7123,"children":7124},{"style":123},[7125],{"type":70,"value":249},{"type":64,"tag":110,"props":7127,"children":7128},{"style":123},[7129],{"type":70,"value":2832},{"type":64,"tag":110,"props":7131,"children":7132},{"style":191},[7133],{"type":70,"value":5215},{"type":64,"tag":110,"props":7135,"children":7136},{"style":256},[7137],{"type":70,"value":2977},{"type":64,"tag":110,"props":7139,"children":7140},{"class":112,"line":3369},[7141,7146,7150,7154],{"type":64,"tag":110,"props":7142,"children":7143},{"style":185},[7144],{"type":70,"value":7145},"        let",{"type":64,"tag":110,"props":7147,"children":7148},{"style":129},[7149],{"type":70,"value":5232},{"type":64,"tag":110,"props":7151,"children":7152},{"style":123},[7153],{"type":70,"value":249},{"type":64,"tag":110,"props":7155,"children":7156},{"style":123},[7157],{"type":70,"value":5241},{"type":64,"tag":110,"props":7159,"children":7160},{"class":112,"line":3400},[7161],{"type":64,"tag":110,"props":7162,"children":7163},{"emptyLinePlaceholder":175},[7164],{"type":70,"value":178},{"type":64,"tag":110,"props":7166,"children":7167},{"class":112,"line":3418},[7168,7173,7177,7181,7185],{"type":64,"tag":110,"props":7169,"children":7170},{"style":117},[7171],{"type":70,"value":7172},"        while",{"type":64,"tag":110,"props":7174,"children":7175},{"style":256},[7176],{"type":70,"value":1471},{"type":64,"tag":110,"props":7178,"children":7179},{"style":3256},[7180],{"type":70,"value":5265},{"type":64,"tag":110,"props":7182,"children":7183},{"style":256},[7184],{"type":70,"value":491},{"type":64,"tag":110,"props":7186,"children":7187},{"style":123},[7188],{"type":70,"value":264},{"type":64,"tag":110,"props":7190,"children":7191},{"class":112,"line":3427},[7192,7197,7201,7205,7209,7213,7217,7221,7225,7229,7233,7237],{"type":64,"tag":110,"props":7193,"children":7194},{"style":185},[7195],{"type":70,"value":7196},"          const",{"type":64,"tag":110,"props":7198,"children":7199},{"style":123},[7200],{"type":70,"value":126},{"type":64,"tag":110,"props":7202,"children":7203},{"style":129},[7204],{"type":70,"value":3249},{"type":64,"tag":110,"props":7206,"children":7207},{"style":123},[7208],{"type":70,"value":137},{"type":64,"tag":110,"props":7210,"children":7211},{"style":129},[7212],{"type":70,"value":5297},{"type":64,"tag":110,"props":7214,"children":7215},{"style":123},[7216],{"type":70,"value":147},{"type":64,"tag":110,"props":7218,"children":7219},{"style":123},[7220],{"type":70,"value":249},{"type":64,"tag":110,"props":7222,"children":7223},{"style":117},[7224],{"type":70,"value":4963},{"type":64,"tag":110,"props":7226,"children":7227},{"style":129},[7228],{"type":70,"value":5160},{"type":64,"tag":110,"props":7230,"children":7231},{"style":123},[7232],{"type":70,"value":471},{"type":64,"tag":110,"props":7234,"children":7235},{"style":191},[7236],{"type":70,"value":5322},{"type":64,"tag":110,"props":7238,"children":7239},{"style":256},[7240],{"type":70,"value":2977},{"type":64,"tag":110,"props":7242,"children":7243},{"class":112,"line":3435},[7244,7249,7253,7257,7261],{"type":64,"tag":110,"props":7245,"children":7246},{"style":117},[7247],{"type":70,"value":7248},"          if",{"type":64,"tag":110,"props":7250,"children":7251},{"style":256},[7252],{"type":70,"value":1471},{"type":64,"tag":110,"props":7254,"children":7255},{"style":129},[7256],{"type":70,"value":3718},{"type":64,"tag":110,"props":7258,"children":7259},{"style":256},[7260],{"type":70,"value":491},{"type":64,"tag":110,"props":7262,"children":7263},{"style":117},[7264],{"type":70,"value":5351},{"type":64,"tag":110,"props":7266,"children":7267},{"class":112,"line":3468},[7268],{"type":64,"tag":110,"props":7269,"children":7270},{"emptyLinePlaceholder":175},[7271],{"type":70,"value":178},{"type":64,"tag":110,"props":7273,"children":7274},{"class":112,"line":3486},[7275,7280,7284,7288,7292,7296,7300,7304,7308,7312,7316,7320,7324,7328],{"type":64,"tag":110,"props":7276,"children":7277},{"style":129},[7278],{"type":70,"value":7279},"          buffer",{"type":64,"tag":110,"props":7281,"children":7282},{"style":123},[7283],{"type":70,"value":5371},{"type":64,"tag":110,"props":7285,"children":7286},{"style":129},[7287],{"type":70,"value":5202},{"type":64,"tag":110,"props":7289,"children":7290},{"style":123},[7291],{"type":70,"value":471},{"type":64,"tag":110,"props":7293,"children":7294},{"style":191},[7295],{"type":70,"value":5384},{"type":64,"tag":110,"props":7297,"children":7298},{"style":256},[7299],{"type":70,"value":259},{"type":64,"tag":110,"props":7301,"children":7302},{"style":129},[7303],{"type":70,"value":5393},{"type":64,"tag":110,"props":7305,"children":7306},{"style":123},[7307],{"type":70,"value":137},{"type":64,"tag":110,"props":7309,"children":7310},{"style":123},[7311],{"type":70,"value":126},{"type":64,"tag":110,"props":7313,"children":7314},{"style":256},[7315],{"type":70,"value":4734},{"type":64,"tag":110,"props":7317,"children":7318},{"style":123},[7319],{"type":70,"value":278},{"type":64,"tag":110,"props":7321,"children":7322},{"style":3256},[7323],{"type":70,"value":5414},{"type":64,"tag":110,"props":7325,"children":7326},{"style":123},[7327],{"type":70,"value":147},{"type":64,"tag":110,"props":7329,"children":7330},{"style":256},[7331],{"type":70,"value":409},{"type":64,"tag":110,"props":7333,"children":7334},{"class":112,"line":3502},[7335,7339,7343,7347,7351,7355,7359,7363,7367,7371,7375],{"type":64,"tag":110,"props":7336,"children":7337},{"style":185},[7338],{"type":70,"value":7196},{"type":64,"tag":110,"props":7340,"children":7341},{"style":129},[7342],{"type":70,"value":5434},{"type":64,"tag":110,"props":7344,"children":7345},{"style":123},[7346],{"type":70,"value":249},{"type":64,"tag":110,"props":7348,"children":7349},{"style":129},[7350],{"type":70,"value":5232},{"type":64,"tag":110,"props":7352,"children":7353},{"style":123},[7354],{"type":70,"value":471},{"type":64,"tag":110,"props":7356,"children":7357},{"style":191},[7358],{"type":70,"value":5451},{"type":64,"tag":110,"props":7360,"children":7361},{"style":256},[7362],{"type":70,"value":259},{"type":64,"tag":110,"props":7364,"children":7365},{"style":123},[7366],{"type":70,"value":291},{"type":64,"tag":110,"props":7368,"children":7369},{"style":129},[7370],{"type":70,"value":1922},{"type":64,"tag":110,"props":7372,"children":7373},{"style":123},[7374],{"type":70,"value":291},{"type":64,"tag":110,"props":7376,"children":7377},{"style":256},[7378],{"type":70,"value":409},{"type":64,"tag":110,"props":7380,"children":7381},{"class":112,"line":3510},[7382,7386,7390,7394,7398,7402,7406,7410],{"type":64,"tag":110,"props":7383,"children":7384},{"style":129},[7385],{"type":70,"value":7279},{"type":64,"tag":110,"props":7387,"children":7388},{"style":123},[7389],{"type":70,"value":249},{"type":64,"tag":110,"props":7391,"children":7392},{"style":129},[7393],{"type":70,"value":5434},{"type":64,"tag":110,"props":7395,"children":7396},{"style":123},[7397],{"type":70,"value":471},{"type":64,"tag":110,"props":7399,"children":7400},{"style":191},[7401],{"type":70,"value":5495},{"type":64,"tag":110,"props":7403,"children":7404},{"style":256},[7405],{"type":70,"value":5500},{"type":64,"tag":110,"props":7407,"children":7408},{"style":123},[7409],{"type":70,"value":5505},{"type":64,"tag":110,"props":7411,"children":7412},{"style":123},[7413],{"type":70,"value":5241},{"type":64,"tag":110,"props":7415,"children":7416},{"class":112,"line":3518},[7417],{"type":64,"tag":110,"props":7418,"children":7419},{"emptyLinePlaceholder":175},[7420],{"type":70,"value":178},{"type":64,"tag":110,"props":7422,"children":7423},{"class":112,"line":3550},[7424,7429,7433,7437,7441,7445,7449,7453],{"type":64,"tag":110,"props":7425,"children":7426},{"style":117},[7427],{"type":70,"value":7428},"          for",{"type":64,"tag":110,"props":7430,"children":7431},{"style":256},[7432],{"type":70,"value":1471},{"type":64,"tag":110,"props":7434,"children":7435},{"style":185},[7436],{"type":70,"value":1060},{"type":64,"tag":110,"props":7438,"children":7439},{"style":129},[7440],{"type":70,"value":5537},{"type":64,"tag":110,"props":7442,"children":7443},{"style":123},[7444],{"type":70,"value":5542},{"type":64,"tag":110,"props":7446,"children":7447},{"style":129},[7448],{"type":70,"value":5434},{"type":64,"tag":110,"props":7450,"children":7451},{"style":256},[7452],{"type":70,"value":491},{"type":64,"tag":110,"props":7454,"children":7455},{"style":123},[7456],{"type":70,"value":264},{"type":64,"tag":110,"props":7458,"children":7459},{"class":112,"line":3566},[7460,7465,7469,7473,7477,7481,7485],{"type":64,"tag":110,"props":7461,"children":7462},{"style":117},[7463],{"type":70,"value":7464},"            if",{"type":64,"tag":110,"props":7466,"children":7467},{"style":256},[7468],{"type":70,"value":1471},{"type":64,"tag":110,"props":7470,"children":7471},{"style":129},[7472],{"type":70,"value":112},{"type":64,"tag":110,"props":7474,"children":7475},{"style":123},[7476],{"type":70,"value":471},{"type":64,"tag":110,"props":7478,"children":7479},{"style":191},[7480],{"type":70,"value":5578},{"type":64,"tag":110,"props":7482,"children":7483},{"style":256},[7484],{"type":70,"value":5583},{"type":64,"tag":110,"props":7486,"children":7487},{"style":123},[7488],{"type":70,"value":264},{"type":64,"tag":110,"props":7490,"children":7491},{"class":112,"line":3582},[7492,7497,7501,7505,7509,7513,7517,7521,7525],{"type":64,"tag":110,"props":7493,"children":7494},{"style":117},[7495],{"type":70,"value":7496},"              yield",{"type":64,"tag":110,"props":7498,"children":7499},{"style":129},[7500],{"type":70,"value":3337},{"type":64,"tag":110,"props":7502,"children":7503},{"style":123},[7504],{"type":70,"value":471},{"type":64,"tag":110,"props":7506,"children":7507},{"style":191},[7508],{"type":70,"value":3346},{"type":64,"tag":110,"props":7510,"children":7511},{"style":256},[7512],{"type":70,"value":259},{"type":64,"tag":110,"props":7514,"children":7515},{"style":129},[7516],{"type":70,"value":112},{"type":64,"tag":110,"props":7518,"children":7519},{"style":256},[7520],{"type":70,"value":491},{"type":64,"tag":110,"props":7522,"children":7523},{"style":117},[7524],{"type":70,"value":5623},{"type":64,"tag":110,"props":7526,"children":7527},{"style":443},[7528],{"type":70,"value":5628},{"type":64,"tag":110,"props":7530,"children":7531},{"class":112,"line":3590},[7532],{"type":64,"tag":110,"props":7533,"children":7534},{"style":123},[7535],{"type":70,"value":768},{"type":64,"tag":110,"props":7537,"children":7538},{"class":112,"line":3598},[7539],{"type":64,"tag":110,"props":7540,"children":7541},{"style":123},[7542],{"type":70,"value":7543},"          }\n",{"type":64,"tag":110,"props":7545,"children":7546},{"class":112,"line":3648},[7547],{"type":64,"tag":110,"props":7548,"children":7549},{"style":123},[7550],{"type":70,"value":7064},{"type":64,"tag":110,"props":7552,"children":7553},{"class":112,"line":3669},[7554],{"type":64,"tag":110,"props":7555,"children":7556},{"emptyLinePlaceholder":175},[7557],{"type":70,"value":178},{"type":64,"tag":110,"props":7559,"children":7560},{"class":112,"line":3681},[7561,7566],{"type":64,"tag":110,"props":7562,"children":7563},{"style":117},[7564],{"type":70,"value":7565},"        return",{"type":64,"tag":110,"props":7567,"children":7568},{"style":2871},[7569],{"type":70,"value":7570}," \u002F\u002F Stream completed successfully\n",{"type":64,"tag":110,"props":7572,"children":7573},{"class":112,"line":3689},[7574,7578,7583,7587,7592,7596],{"type":64,"tag":110,"props":7575,"children":7576},{"style":123},[7577],{"type":70,"value":3837},{"type":64,"tag":110,"props":7579,"children":7580},{"style":117},[7581],{"type":70,"value":7582}," catch",{"type":64,"tag":110,"props":7584,"children":7585},{"style":256},[7586],{"type":70,"value":1471},{"type":64,"tag":110,"props":7588,"children":7589},{"style":129},[7590],{"type":70,"value":7591},"err",{"type":64,"tag":110,"props":7593,"children":7594},{"style":256},[7595],{"type":70,"value":491},{"type":64,"tag":110,"props":7597,"children":7598},{"style":123},[7599],{"type":70,"value":264},{"type":64,"tag":110,"props":7601,"children":7602},{"class":112,"line":3698},[7603,7607,7611,7615,7619,7624,7628,7633],{"type":64,"tag":110,"props":7604,"children":7605},{"style":117},[7606],{"type":70,"value":6970},{"type":64,"tag":110,"props":7608,"children":7609},{"style":256},[7610],{"type":70,"value":1471},{"type":64,"tag":110,"props":7612,"children":7613},{"style":129},[7614],{"type":70,"value":4252},{"type":64,"tag":110,"props":7616,"children":7617},{"style":123},[7618],{"type":70,"value":3411},{"type":64,"tag":110,"props":7620,"children":7621},{"style":129},[7622],{"type":70,"value":7623},"aborted",{"type":64,"tag":110,"props":7625,"children":7626},{"style":256},[7627],{"type":70,"value":491},{"type":64,"tag":110,"props":7629,"children":7630},{"style":117},[7631],{"type":70,"value":7632},"throw",{"type":64,"tag":110,"props":7634,"children":7635},{"style":129},[7636],{"type":70,"value":7637}," err\n",{"type":64,"tag":110,"props":7639,"children":7640},{"class":112,"line":3758},[7641,7646],{"type":64,"tag":110,"props":7642,"children":7643},{"style":129},[7644],{"type":70,"value":7645},"        attempt",{"type":64,"tag":110,"props":7647,"children":7648},{"style":123},[7649],{"type":70,"value":7650},"++\n",{"type":64,"tag":110,"props":7652,"children":7653},{"class":112,"line":3800},[7654,7658,7662,7666,7671,7675,7679,7683],{"type":64,"tag":110,"props":7655,"children":7656},{"style":117},[7657],{"type":70,"value":6970},{"type":64,"tag":110,"props":7659,"children":7660},{"style":256},[7661],{"type":70,"value":1471},{"type":64,"tag":110,"props":7663,"children":7664},{"style":129},[7665],{"type":70,"value":6712},{"type":64,"tag":110,"props":7667,"children":7668},{"style":123},[7669],{"type":70,"value":7670}," >=",{"type":64,"tag":110,"props":7672,"children":7673},{"style":129},[7674],{"type":70,"value":6659},{"type":64,"tag":110,"props":7676,"children":7677},{"style":256},[7678],{"type":70,"value":491},{"type":64,"tag":110,"props":7680,"children":7681},{"style":117},[7682],{"type":70,"value":7632},{"type":64,"tag":110,"props":7684,"children":7685},{"style":129},[7686],{"type":70,"value":7637},{"type":64,"tag":110,"props":7688,"children":7689},{"class":112,"line":3831},[7690],{"type":64,"tag":110,"props":7691,"children":7692},{"style":2871},[7693],{"type":70,"value":7694},"        \u002F\u002F Exponential backoff\n",{"type":64,"tag":110,"props":7696,"children":7697},{"class":112,"line":3849},[7698,7702,7706,7710,7714,7718,7722,7726,7730,7735,7739,7743,7747,7752,7756,7761,7766,7770],{"type":64,"tag":110,"props":7699,"children":7700},{"style":117},[7701],{"type":70,"value":3855},{"type":64,"tag":110,"props":7703,"children":7704},{"style":123},[7705],{"type":70,"value":2832},{"type":64,"tag":110,"props":7707,"children":7708},{"style":443},[7709],{"type":70,"value":2891},{"type":64,"tag":110,"props":7711,"children":7712},{"style":256},[7713],{"type":70,"value":259},{"type":64,"tag":110,"props":7715,"children":7716},{"style":123},[7717],{"type":70,"value":259},{"type":64,"tag":110,"props":7719,"children":7720},{"style":463},[7721],{"type":70,"value":3888},{"type":64,"tag":110,"props":7723,"children":7724},{"style":123},[7725],{"type":70,"value":391},{"type":64,"tag":110,"props":7727,"children":7728},{"style":185},[7729],{"type":70,"value":1423},{"type":64,"tag":110,"props":7731,"children":7732},{"style":191},[7733],{"type":70,"value":7734}," setTimeout",{"type":64,"tag":110,"props":7736,"children":7737},{"style":256},[7738],{"type":70,"value":259},{"type":64,"tag":110,"props":7740,"children":7741},{"style":129},[7742],{"type":70,"value":3888},{"type":64,"tag":110,"props":7744,"children":7745},{"style":123},[7746],{"type":70,"value":137},{"type":64,"tag":110,"props":7748,"children":7749},{"style":3744},[7750],{"type":70,"value":7751}," 1000",{"type":64,"tag":110,"props":7753,"children":7754},{"style":123},[7755],{"type":70,"value":2679},{"type":64,"tag":110,"props":7757,"children":7758},{"style":3744},[7759],{"type":70,"value":7760}," 2",{"type":64,"tag":110,"props":7762,"children":7763},{"style":123},[7764],{"type":70,"value":7765}," **",{"type":64,"tag":110,"props":7767,"children":7768},{"style":129},[7769],{"type":70,"value":6680},{"type":64,"tag":110,"props":7771,"children":7772},{"style":256},[7773],{"type":70,"value":3125},{"type":64,"tag":110,"props":7775,"children":7776},{"class":112,"line":3903},[7777],{"type":64,"tag":110,"props":7778,"children":7779},{"style":123},[7780],{"type":70,"value":3940},{"type":64,"tag":110,"props":7782,"children":7783},{"class":112,"line":3921},[7784],{"type":64,"tag":110,"props":7785,"children":7786},{"style":123},[7787],{"type":70,"value":3424},{"type":64,"tag":110,"props":7789,"children":7790},{"class":112,"line":3934},[7791],{"type":64,"tag":110,"props":7792,"children":7793},{"style":123},[7794],{"type":70,"value":3957},{"type":64,"tag":110,"props":7796,"children":7797},{"class":112,"line":3943},[7798],{"type":64,"tag":110,"props":7799,"children":7800},{"style":123},[7801],{"type":70,"value":800},{"type":64,"tag":110,"props":7803,"children":7804},{"class":112,"line":3951},[7805],{"type":64,"tag":110,"props":7806,"children":7807},{"emptyLinePlaceholder":175},[7808],{"type":70,"value":178},{"type":64,"tag":110,"props":7810,"children":7811},{"class":112,"line":3960},[7812,7816,7820,7824,7828,7832,7836,7840,7844,7848],{"type":64,"tag":110,"props":7813,"children":7814},{"style":185},[7815],{"type":70,"value":1060},{"type":64,"tag":110,"props":7817,"children":7818},{"style":123},[7819],{"type":70,"value":126},{"type":64,"tag":110,"props":7821,"children":7822},{"style":129},[7823],{"type":70,"value":222},{"type":64,"tag":110,"props":7825,"children":7826},{"style":123},[7827],{"type":70,"value":137},{"type":64,"tag":110,"props":7829,"children":7830},{"style":129},[7831],{"type":70,"value":1077},{"type":64,"tag":110,"props":7833,"children":7834},{"style":123},[7835],{"type":70,"value":728},{"type":64,"tag":110,"props":7837,"children":7838},{"style":123},[7839],{"type":70,"value":249},{"type":64,"tag":110,"props":7841,"children":7842},{"style":191},[7843],{"type":70,"value":132},{"type":64,"tag":110,"props":7845,"children":7846},{"style":129},[7847],{"type":70,"value":259},{"type":64,"tag":110,"props":7849,"children":7850},{"style":123},[7851],{"type":70,"value":264},{"type":64,"tag":110,"props":7853,"children":7854},{"class":112,"line":3968},[7855,7859,7863,7867],{"type":64,"tag":110,"props":7856,"children":7857},{"style":256},[7858],{"type":70,"value":1105},{"type":64,"tag":110,"props":7860,"children":7861},{"style":123},[7862],{"type":70,"value":278},{"type":64,"tag":110,"props":7864,"children":7865},{"style":129},[7866],{"type":70,"value":6504},{"type":64,"tag":110,"props":7868,"children":7869},{"style":123},[7870],{"type":70,"value":368},{"type":64,"tag":110,"props":7872,"children":7873},{"class":112,"line":3976},[7874,7878],{"type":64,"tag":110,"props":7875,"children":7876},{"style":123},[7877],{"type":70,"value":728},{"type":64,"tag":110,"props":7879,"children":7880},{"style":129},[7881],{"type":70,"value":409},{"type":64,"tag":73,"props":7883,"children":7884},{},[7885,7887,7892,7894,7900,7902,7907,7909,7914],{"type":70,"value":7886},"Note: ",{"type":64,"tag":91,"props":7888,"children":7890},{"className":7889},[],[7891],{"type":70,"value":943},{"type":70,"value":7893}," in TanStack AI uses ",{"type":64,"tag":91,"props":7895,"children":7897},{"className":7896},[],[7898],{"type":70,"value":7899},"fetch()",{"type":70,"value":7901}," under the hood (not\nthe browser ",{"type":64,"tag":91,"props":7903,"children":7905},{"className":7904},[],[7906],{"type":70,"value":6343},{"type":70,"value":7908}," API), so it also does not auto-reconnect. The SSE\nauto-reconnection advantage only applies when using the native ",{"type":64,"tag":91,"props":7910,"children":7912},{"className":7911},[],[7913],{"type":70,"value":6343},{"type":70,"value":7915}," API\ndirectly.",{"type":64,"tag":73,"props":7917,"children":7918},{},[7919,7920],{"type":70,"value":6245},{"type":64,"tag":91,"props":7921,"children":7923},{"className":7922},[],[7924],{"type":70,"value":7925},"docs\u002Fprotocol\u002Fhttp-stream-protocol.md",{"type":64,"tag":79,"props":7927,"children":7929},{"id":7928},"cross-references",[7930],{"type":70,"value":7931},"Cross-References",{"type":64,"tag":6271,"props":7933,"children":7934},{},[7935,7947,7971],{"type":64,"tag":6275,"props":7936,"children":7937},{},[7938,7940,7945],{"type":70,"value":7939},"See also: ",{"type":64,"tag":552,"props":7941,"children":7942},{},[7943],{"type":70,"value":7944},"ai-core\u002Fag-ui-protocol\u002FSKILL.md",{"type":70,"value":7946}," -- Understanding the AG-UI protocol helps build compatible custom servers",{"type":64,"tag":6275,"props":7948,"children":7949},{},[7950,7951,7956,7958,7964,7965],{"type":70,"value":7939},{"type":64,"tag":552,"props":7952,"children":7953},{},[7954],{"type":70,"value":7955},"ai-core\u002Fchat-experience\u002FSKILL.md",{"type":70,"value":7957}," -- Full chat setup patterns including server-side ",{"type":64,"tag":91,"props":7959,"children":7961},{"className":7960},[],[7962],{"type":70,"value":7963},"chat()",{"type":70,"value":945},{"type":64,"tag":91,"props":7966,"children":7968},{"className":7967},[],[7969],{"type":70,"value":7970},"toServerSentEventsResponse()",{"type":64,"tag":6275,"props":7972,"children":7973},{},[7974,7975,7980],{"type":70,"value":7939},{"type":64,"tag":552,"props":7976,"children":7977},{},[7978],{"type":70,"value":7979},"ai-core\u002Fmiddleware\u002FSKILL.md",{"type":70,"value":7981}," -- Use middleware for analytics and lifecycle events on the server side",{"type":64,"tag":7983,"props":7984,"children":7985},"style",{},[7986],{"type":70,"value":7987},"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":7989,"total":8131},[7990,8006,8018,8030,8045,8057,8067,8077,8090,8100,8111,8121],{"slug":7991,"name":7991,"fn":7992,"description":7993,"org":7994,"tags":7995,"stars":8003,"repoUrl":8004,"updatedAt":8005},"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},[7996,7999,8002],{"name":7997,"slug":7998,"type":16},"Data Analysis","data-analysis",{"name":8000,"slug":8001,"type":16},"Frontend","frontend",{"name":10,"slug":9,"type":16},28175,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Ftable","2026-07-30T05:25:59.429787",{"slug":8007,"name":8007,"fn":8008,"description":8009,"org":8010,"tags":8011,"stars":8003,"repoUrl":8004,"updatedAt":8017},"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},[8012,8015,8016],{"name":8013,"slug":8014,"type":16},"Debugging","debugging",{"name":8000,"slug":8001,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:26:05.418735",{"slug":8019,"name":8019,"fn":8020,"description":8021,"org":8022,"tags":8023,"stars":8003,"repoUrl":8004,"updatedAt":8029},"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},[8024,8025,8026],{"name":7997,"slug":7998,"type":16},{"name":10,"slug":9,"type":16},{"name":8027,"slug":8028,"type":16},"UI Components","ui-components","2026-07-30T05:25:38.403427",{"slug":8031,"name":8031,"fn":8032,"description":8033,"org":8034,"tags":8035,"stars":8003,"repoUrl":8004,"updatedAt":8044},"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},[8036,8039,8040,8043],{"name":8037,"slug":8038,"type":16},"Data Pipeline","data-pipeline",{"name":8000,"slug":8001,"type":16},{"name":8041,"slug":8042,"type":16},"Performance","performance",{"name":10,"slug":9,"type":16},"2026-07-30T05:25:45.400104",{"slug":8046,"name":8046,"fn":8047,"description":8048,"org":8049,"tags":8050,"stars":8003,"repoUrl":8004,"updatedAt":8056},"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},[8051,8054,8055],{"name":8052,"slug":8053,"type":16},"Data Visualization","data-visualization",{"name":8000,"slug":8001,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:25:41.397257",{"slug":8058,"name":8058,"fn":8059,"description":8060,"org":8061,"tags":8062,"stars":8003,"repoUrl":8004,"updatedAt":8066},"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},[8063,8064,8065],{"name":7997,"slug":7998,"type":16},{"name":8000,"slug":8001,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:25:53.391632",{"slug":8068,"name":8068,"fn":8069,"description":8070,"org":8071,"tags":8072,"stars":8003,"repoUrl":8004,"updatedAt":8076},"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},[8073,8074,8075],{"name":8000,"slug":8001,"type":16},{"name":10,"slug":9,"type":16},{"name":8027,"slug":8028,"type":16},"2026-07-30T05:26:03.37801",{"slug":8078,"name":8078,"fn":8079,"description":8080,"org":8081,"tags":8082,"stars":8003,"repoUrl":8004,"updatedAt":8089},"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},[8083,8086,8087,8088],{"name":8084,"slug":8085,"type":16},"CSS","css",{"name":8000,"slug":8001,"type":16},{"name":10,"slug":9,"type":16},{"name":8027,"slug":8028,"type":16},"2026-07-30T05:25:55.377366",{"slug":8091,"name":8091,"fn":8092,"description":8093,"org":8094,"tags":8095,"stars":8003,"repoUrl":8004,"updatedAt":8099},"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},[8096,8097,8098],{"name":8000,"slug":8001,"type":16},{"name":10,"slug":9,"type":16},{"name":8027,"slug":8028,"type":16},"2026-07-30T05:25:51.400011",{"slug":8101,"name":8101,"fn":8102,"description":8103,"org":8104,"tags":8105,"stars":8003,"repoUrl":8004,"updatedAt":8110},"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},[8106,8107,8108,8109],{"name":8084,"slug":8085,"type":16},{"name":8000,"slug":8001,"type":16},{"name":10,"slug":9,"type":16},{"name":8027,"slug":8028,"type":16},"2026-07-30T05:25:48.703799",{"slug":8112,"name":8112,"fn":8113,"description":8114,"org":8115,"tags":8116,"stars":8003,"repoUrl":8004,"updatedAt":8120},"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},[8117,8118,8119],{"name":8000,"slug":8001,"type":16},{"name":10,"slug":9,"type":16},{"name":8027,"slug":8028,"type":16},"2026-07-30T05:25:47.367943",{"slug":8122,"name":8122,"fn":8123,"description":8124,"org":8125,"tags":8126,"stars":8003,"repoUrl":8004,"updatedAt":8130},"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},[8127,8128,8129],{"name":7997,"slug":7998,"type":16},{"name":8000,"slug":8001,"type":16},{"name":8027,"slug":8028,"type":16},"2026-07-30T05:25:52.366295",125,{"items":8133,"total":918},[8134,8152,8166,8181,8192,8204,8218],{"slug":8135,"name":8135,"fn":8136,"description":8137,"org":8138,"tags":8139,"stars":24,"repoUrl":25,"updatedAt":8151},"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},[8140,8142,8145,8148,8149],{"name":8141,"slug":31,"type":16},"AI SDK",{"name":8143,"slug":8144,"type":16},"Code Execution","code-execution",{"name":8146,"slug":8147,"type":16},"Sandboxing","sandboxing",{"name":10,"slug":9,"type":16},{"name":8150,"slug":45,"type":16},"TypeScript","2026-07-16T06:04:13.597905",{"slug":8153,"name":8153,"fn":8154,"description":8155,"org":8156,"tags":8157,"stars":24,"repoUrl":25,"updatedAt":8165},"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},[8158,8161,8162],{"name":8159,"slug":8160,"type":16},"Agents","agents",{"name":18,"slug":19,"type":16},{"name":8163,"slug":8164,"type":16},"Middleware","middleware","2026-07-30T05:26:10.404565",{"slug":8167,"name":8168,"fn":8169,"description":8170,"org":8171,"tags":8172,"stars":24,"repoUrl":25,"updatedAt":8180},"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},[8173,8174,8177,8179],{"name":8141,"slug":31,"type":16},{"name":8175,"slug":8176,"type":16},"Configuration","configuration",{"name":8178,"slug":37,"type":16},"LLM",{"name":10,"slug":9,"type":16},"2026-07-16T06:04:17.82075",{"slug":8182,"name":8183,"fn":8184,"description":8185,"org":8186,"tags":8187,"stars":24,"repoUrl":25,"updatedAt":8191},"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},[8188,8189,8190],{"name":21,"slug":22,"type":16},{"name":8178,"slug":37,"type":16},{"name":10,"slug":9,"type":16},"2026-07-16T06:04:10.093367",{"slug":8193,"name":8194,"fn":8195,"description":8196,"org":8197,"tags":8198,"stars":24,"repoUrl":25,"updatedAt":8203},"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},[8199,8200,8201,8202],{"name":21,"slug":22,"type":16},{"name":8000,"slug":8001,"type":16},{"name":8178,"slug":37,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:26:11.505241",{"slug":8205,"name":8206,"fn":8207,"description":8208,"org":8209,"tags":8210,"stars":24,"repoUrl":25,"updatedAt":8217},"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},[8211,8212,8213,8216],{"name":18,"slug":19,"type":16},{"name":8000,"slug":8001,"type":16},{"name":8214,"slug":8215,"type":16},"Persistence","persistence",{"name":10,"slug":9,"type":16},"2026-07-30T05:53:35.503176",{"slug":4,"name":5,"fn":6,"description":7,"org":8219,"tags":8220,"stars":24,"repoUrl":25,"updatedAt":26},{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[8221,8222,8223,8224],{"name":18,"slug":19,"type":16},{"name":21,"slug":22,"type":16},{"name":14,"slug":15,"type":16},{"name":10,"slug":9,"type":16}]