tanstack-ai-vue-skilld
Installation
SKILL.md
@tanstack/ai-vue
Vue 3 composables for TanStack AI streaming chat, structured outputs, and media generation. Wraps the headless @tanstack/ai-client classes (ChatClient, GenerationClient, VideoGenerationClient) in reactive state.
- Version documented:
0.24.3(source:package.json:3) - Peer deps:
vue >=3.5.0,@tanstack/ai ^0.58.0; runtime deps:@tanstack/ai-client ^0.33.2,@tanstack/markdown ^0.0.13(source:package.json:55-62) - Entry points:
.(main),./ui(headless chat UI factory),./byok(bring-your-own-key) (source:package.json:23-36) - Official docs: https://tanstack.com/ai/latest/docs/api/ai-vue and https://tanstack.com/ai/latest/docs/getting-started/quick-start-vue
- Install:
pnpm add @tanstack/ai @tanstack/ai-vue @tanstack/ai-openai(plus a provider adapter; server-side chat comes from@tanstack/ai)
Core rules
- Every composable must run inside a component setup or effect scope. Cleanup is automatic via
onScopeDispose; the scope owns the connection (source:src/use-chat.ts:259-269). - All reactive state is
DeepReadonly<ShallowRef<T>>. Read with.valuein script AND template. Never reassign; use the returned methods (setMessages,clear,reset) (source:src/use-chat.ts:425-457). - Pass a
connectionadapter (for examplefetchServerSentEvents('/api/chat'), re-exported from this package) or afetcher. Generation hooks throwuseGeneration requires either a connection or fetcher optionwithout one (source:src/use-generation.ts:272-274). useChatbuilds oneChatClientper call. Changingconnection(or other transport identity) requires a remount or a changedkeyprop;body,forwardedProps,context, andqueueare watched and synced live (source:src/types.ts:77-79,src/use-chat.ts:212-230).- Callback options (
onChunk,onFinish,onError, ...) are read through the options object at call time, so reactive or mutated options propagate without recreating the client (source:src/use-chat.ts:85-91). - Prefer
forwardedPropsoverbody;bodyis deprecated but still merged into the same wire payload (source:src/use-chat.ts:207-209).