[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71V5EN6YDC7Y7C6FMDHYX92":3,"skill-same:01M71V5EN6YDC7Y7C6FMDHYX92":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":30,"linkOnly":31,"markdownContent":32,"markdownBody":33,"frontMatter":34,"refName":36,"commitSha":37,"skillDirectory":38,"forksCount":39,"repositoryHtmlUrl":40,"repositoryHomepageUrl":41,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M71V5EN6YDC7Y7C6FMDHYX92","streaming",null,"Guide for assistant-stream package and streaming protocols. Use when implementing streaming backends, custom protocols, or debugging stream issues.","AkaraChen\u002Fangel-engine","AkaraChen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F85140972?v=4","01M6E197RY34TPAFK03227R387","01M71V2QPZM89DQ8R1AB7021P4",19,"MIT","https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.agents\u002Fskills\u002Fstreaming\u002FSKILL.md",[],[5,18,19,20,21,22,23,24,25,26,27,28,29],"assistant","debugging","issues","package","protocols","guide","use","implementing","for","stream","custom","when","2026-11-10 13:02:02",false,"---\nname: streaming\ndescription: Guide for assistant-stream package and streaming protocols. Use when implementing streaming backends, custom protocols, or debugging stream issues.\nversion: 0.0.1\nlicense: MIT\n---\n\n# assistant-ui Streaming\n\n**Always consult [assistant-ui.com\u002Fllms.txt](https:\u002F\u002Fassistant-ui.com\u002Fllms.txt) for latest API.**\n\nThe `assistant-stream` package handles streaming from AI backends.\n\n## References\n\n- [.\u002Freferences\u002Fdata-stream.md](.\u002Freferences\u002Fdata-stream.md) -- AI SDK data stream format\n- [.\u002Freferences\u002Fassistant-transport.md](.\u002Freferences\u002Fassistant-transport.md) -- Native assistant-ui format\n- [.\u002Freferences\u002Fencoders.md](.\u002Freferences\u002Fencoders.md) -- Encoders and decoders\n\n## When to Use\n\n```\nUsing Vercel AI SDK?\n├─ Yes → toUIMessageStreamResponse() (no assistant-stream needed)\n└─ No → assistant-stream for custom backends\n```\n\n## Installation\n\n```bash\nnpm install assistant-stream\n```\n\n## Custom Streaming Response\n\n```ts\nimport { createAssistantStreamResponse } from \"assistant-stream\";\n\nexport async function POST(req: Request) {\n  return createAssistantStreamResponse(async (stream) => {\n    stream.appendText(\"Hello \");\n    stream.appendText(\"world!\");\n\n    \u002F\u002F Tool call example\n    const tool = stream.addToolCallPart({ toolCallId: \"1\", toolName: \"get_weather\" });\n    tool.argsText.append('{\"city\":\"NYC\"}');\n    tool.argsText.close();\n    tool.setResponse({ result: { temperature: 22 } });\n\n    stream.close();\n  });\n}\n```\n\n## With useLocalRuntime\n\n`useLocalRuntime` expects `ChatModelRunResult` chunks. Yield content parts for streaming:\n\n```tsx\nimport { useLocalRuntime } from \"@assistant-ui\u002Freact\";\n\nconst runtime = useLocalRuntime({\n  model: {\n    async *run({ messages, abortSignal }) {\n      const response = await fetch(\"\u002Fapi\u002Fchat\", {\n        method: \"POST\",\n        body: JSON.stringify({ messages }),\n        signal: abortSignal,\n      });\n\n      const reader = response.body?.getReader();\n      const decoder = new TextDecoder();\n      let buffer = \"\";\n\n      while (reader) {\n        const { done, value } = await reader.read();\n        if (done) break;\n\n        buffer += decoder.decode(value, { stream: true });\n        const parts = buffer.split(\"\\n\");\n        buffer = parts.pop() ?? \"\";\n\n        for (const chunk of parts.filter(Boolean)) {\n          yield { content: [{ type: \"text\", text: chunk }] };\n        }\n      }\n    },\n  },\n});\n```\n\n## Debugging Streams\n\n```ts\nimport { AssistantStream, DataStreamDecoder } from \"assistant-stream\";\n\nconst stream = AssistantStream.fromResponse(response, new DataStreamDecoder());\nfor await (const event of stream) {\n  console.log(\"Event:\", JSON.stringify(event, null, 2));\n}\n```\n\n## Stream Event Types\n\n- `part-start` with `part.type` = `\"text\" | \"reasoning\" | \"tool-call\" | \"source\" | \"file\"`\n- `text-delta` with streamed text\n- `result` with tool results\n- `step-start`, `step-finish`, `message-finish`\n- `error` strings\n\n## Common Gotchas\n\n**Stream not updating UI**\n- Check Content-Type is `text\u002Fevent-stream`\n- Check for CORS errors\n\n**Tool calls not rendering**\n- `addToolCallPart` needs both `toolCallId` and `toolName`\n- Register tool UI with `makeAssistantToolUI`\n\n**Partial text not showing**\n- Use `text-delta` events for streaming\n","# assistant-ui Streaming\n\n**Always consult [assistant-ui.com\u002Fllms.txt](https:\u002F\u002Fassistant-ui.com\u002Fllms.txt) for latest API.**\n\nThe `assistant-stream` package handles streaming from AI backends.\n\n## References\n\n- [.\u002Freferences\u002Fdata-stream.md](.\u002Freferences\u002Fdata-stream.md) -- AI SDK data stream format\n- [.\u002Freferences\u002Fassistant-transport.md](.\u002Freferences\u002Fassistant-transport.md) -- Native assistant-ui format\n- [.\u002Freferences\u002Fencoders.md](.\u002Freferences\u002Fencoders.md) -- Encoders and decoders\n\n## When to Use\n\n```\nUsing Vercel AI SDK?\n├─ Yes → toUIMessageStreamResponse() (no assistant-stream needed)\n└─ No → assistant-stream for custom backends\n```\n\n## Installation\n\n```bash\nnpm install assistant-stream\n```\n\n## Custom Streaming Response\n\n```ts\nimport { createAssistantStreamResponse } from \"assistant-stream\";\n\nexport async function POST(req: Request) {\n  return createAssistantStreamResponse(async (stream) => {\n    stream.appendText(\"Hello \");\n    stream.appendText(\"world!\");\n\n    \u002F\u002F Tool call example\n    const tool = stream.addToolCallPart({ toolCallId: \"1\", toolName: \"get_weather\" });\n    tool.argsText.append('{\"city\":\"NYC\"}');\n    tool.argsText.close();\n    tool.setResponse({ result: { temperature: 22 } });\n\n    stream.close();\n  });\n}\n```\n\n## With useLocalRuntime\n\n`useLocalRuntime` expects `ChatModelRunResult` chunks. Yield content parts for streaming:\n\n```tsx\nimport { useLocalRuntime } from \"@assistant-ui\u002Freact\";\n\nconst runtime = useLocalRuntime({\n  model: {\n    async *run({ messages, abortSignal }) {\n      const response = await fetch(\"\u002Fapi\u002Fchat\", {\n        method: \"POST\",\n        body: JSON.stringify({ messages }),\n        signal: abortSignal,\n      });\n\n      const reader = response.body?.getReader();\n      const decoder = new TextDecoder();\n      let buffer = \"\";\n\n      while (reader) {\n        const { done, value } = await reader.read();\n        if (done) break;\n\n        buffer += decoder.decode(value, { stream: true });\n        const parts = buffer.split(\"\\n\");\n        buffer = parts.pop() ?? \"\";\n\n        for (const chunk of parts.filter(Boolean)) {\n          yield { content: [{ type: \"text\", text: chunk }] };\n        }\n      }\n    },\n  },\n});\n```\n\n## Debugging Streams\n\n```ts\nimport { AssistantStream, DataStreamDecoder } from \"assistant-stream\";\n\nconst stream = AssistantStream.fromResponse(response, new DataStreamDecoder());\nfor await (const event of stream) {\n  console.log(\"Event:\", JSON.stringify(event, null, 2));\n}\n```\n\n## Stream Event Types\n\n- `part-start` with `part.type` = `\"text\" | \"reasoning\" | \"tool-call\" | \"source\" | \"file\"`\n- `text-delta` with streamed text\n- `result` with tool results\n- `step-start`, `step-finish`, `message-finish`\n- `error` strings\n\n## Common Gotchas\n\n**Stream not updating UI**\n- Check Content-Type is `text\u002Fevent-stream`\n- Check for CORS errors\n\n**Tool calls not rendering**\n- `addToolCallPart` needs both `toolCallId` and `toolName`\n- Register tool UI with `makeAssistantToolUI`\n\n**Partial text not showing**\n- Use `text-delta` events for streaming\n",{"name":5,"license":14,"version":35,"description":7},"0.0.1","master","48a57981043dbb2c534a27f410715a205f50bcfb",".agents\u002Fskills\u002Fstreaming",2,"https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine","https:\u002F\u002Fangel-engine.vercel.app\u002F","https:\u002F\u002Fgithub.com\u002FAkaraChen","https:\u002F\u002Fakr.moe","button painter, string concatenator, log alchemist.\r\n\r\nNo slop, no lag.","2026-09-09 08:58:26",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add AkaraChen\u002Fangel-engine --skill streaming",{"tool":52,"command":53},"bunx","bunx skills add AkaraChen\u002Fangel-engine --skill streaming",{"tool":55,"command":56},"pnpm","pnpm dlx skills add AkaraChen\u002Fangel-engine --skill streaming","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.agents\u002Fskills\u002Fstreaming\u002FSKILL.md",true,[60,66,70],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"references\u002Fassistant-transport.md","REFERENCE","参考文档",3974,"https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.agents\u002Fskills\u002Fstreaming\u002Freferences\u002Fassistant-transport.md",{"path":67,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002Fdata-stream.md",4155,"https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.agents\u002Fskills\u002Fstreaming\u002Freferences\u002Fdata-stream.md",{"path":71,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fencoders.md",3278,"https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.agents\u002Fskills\u002Fstreaming\u002Freferences\u002Fencoders.md",[75,88,110,126,131,147],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":30},"01M71V8NX6JM9719CJM1R07JNF","update","Update assistant-ui and AI SDK to latest versions. Detects current versions, identifies breaking changes, and executes migrations.","https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fupdate\u002FSKILL.md",[],[77,82,83,84,85,86,87,18],"changes","latest","migrations","ai sdk","ui","sdk",{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":99,"publishedAt":30},"01M71V8GA53EWDYMKDCE95JN9M","tools","Guide for tool registration and tool UI in assistant-ui. Use when implementing LLM tools, tool call rendering, or human-in-the-loop patterns.","https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Ftools\u002FSKILL.md",[94],{"categoryNo":95,"categoryName":96,"taxonomyType":97,"taxonomyTypeDesc":98},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[100,101,86,18,102,25,29,26,103,104,105,106,107,108,109,24,23],"Tools","human-in-the-loop","tool","loop","rendering","human","llm tools","call","patterns","registration",{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":30},"01M71V8EK5HG1TY1JSJA9ZG6RA","thread-list","Guide for multi-thread management in assistant-ui. Use when implementing thread lists, switching threads, or managing conversation history.","https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fthread-list\u002FSKILL.md",[],[117,118,119,120,29,26,25,121,122,123,24,23,124,125,86,18],"list","thread list","thread","multi","threads","switching","conversation","management","history",{"skillNo":127,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":30},"01M71V8CQ30TTQP2KHPYCGCR3R","https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fstreaming\u002FSKILL.md",[],[5,28,20,29,27,26,25,24,23,22,21,19,18],{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":30},"01M71V86CFGGT33XS5FCVAYPVG","setup","Setup and configure assistant-ui in a project. Use when installing packages, configuring runtimes, setting up chat UI, or troubleshooting setup issues.","https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fsetup\u002FSKILL.md",[],[133,138,139,86,20,140,18,24,141,29,142,143,144,145,146],"troubleshooting","configure","packages","setting","chat ui","runtimes","project","chat","up",{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":153,"publishedAt":30},"01M71V84DGS3SN4VJ829MHNBB8","runtime","Guide for assistant-ui runtime system and state management. Use when working with runtimes, accessing state, or managing thread\u002Fmessage data.","https:\u002F\u002Fgithub.com\u002FAkaraChen\u002Fangel-engine\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fruntime\u002FSKILL.md",[],[149,143,29,119,26,154,155,24,23,124,156,157,86,158,159,18],"with","message","system","data","state","state management"]