ai-streaming
/ai-streaming
Strumieniuje odpowiedzi czatu Vercel AI SDK przez kanały Hibira, żeby przetrwały przeładowania i zerwane połączenia oraz trafiały do wszystkich kart.
- Autor
- hibira-io ↗
- Repozytorium
- agent-plugin ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 13.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 13.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Strumieniuje odpowiedzi czatu Vercel AI SDK przez kanały Hibira, żeby przetrwały przeładowania i zerwane połączenia oraz trafiały do wszystkich kart.
Oryginalny opis (EN)
Stream Vercel AI SDK chat answers over Hibira channels with @hibira-io/ai-sdk so they survive reloads and dropped connections and reach every tab. Use when building a useChat UI, resumable AI chat, background generation, or streaming an agent's progress to a page.
Jak działa
- Client
- Server
- Rules
Podgląd SKILL.md
---
name: ai-streaming
description: Stream Vercel AI SDK chat answers over Hibira channels with @hibira-io/ai-sdk so they survive reloads and dropped connections and reach every tab. Use when building a useChat UI, resumable AI chat, background generation, or streaming an agent's progress to a page.
---
# Streaming AI answers over Hibira
`@hibira-io/ai-sdk` is a `ChatTransport` for the Vercel AI SDK (versions 5, 6 and 7; v7 needs Node 22+). The API route answers at once, generation runs in the background, and chunks travel over a private Hibira channel. Any `useChat` works (React, Vue, Svelte, Angular).
What it gives: answers survive dropped connections, `useChat({ resume: true })` picks up an answer still being written after a reload (no Redis or stream store), and every tab subscribed to the chat sees it. Resume needs **channel history**, on Hobby plans and up, turned on in the app's settings.
```sh
npm install @hibira-io/ai-sdk pusher-js pusher
```
## Client
```tsx
'use client';
import { useChat } from '@ai-sdk/react';
import Pusher from 'pusher-js';
import { HibiraChatTransport } from '@hibira-io/ai-sdk';
const pusher = new Pusher(process.env.NEXT_PUBLIC_HIBIRA_KEY!, {
cluster: 'hkg',
wsHost: 'ws.hibira.io',
forceTLS: true,
channelAuthorization: { endpoint: '/api/hibira/auth', transport: 'ajax' },
});
const transport = new HibiraChatTransport({ pusher, api: '/api/chat' });
const { messages, sendMessage, status } = useChat({ id, messages: initialMessages, transport, resume: true });
```
The transport subscribes to `private-ai-chat-{chatId}` (override with `channel: (chatId) => ...`). Laravel Echo users pass `echo.connector.pusher`.
## Server
In the chat route, start `streamText` and hand its UI message stream to `publishUIMessageStream` from `@hibira-io/ai-sdk/server` with a server-side `pusher` client; in Next.js wrap the work in `after()` so the route returns at once. Read the package README for the exact signature of the installed version rather than guessing.
## Rules
- Add an auth route (`/api/hibira/auth`) that checks the user owns the chat before signing `private-ai-chat-{chatId}`; otherwise anyone could read another user's answers.
- The app secret stays on the server.
- For plain agent progress (not `useChat`), publish small events with the server SDK or the MCP tool `publish_event`; keep each event small (the payload limit is 4 KB on Free and 10 KB or more on paid plans).
- For tool calls that need a person's OK, see the `agent-approvals` skill.
Wersje
W bazie nie ma innych skilli o nazwie ai-streaming.
Migawka bazy z 13.11.2026 · wersja paczki d22333b6758f (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100vercel-ai-sdk
Pomaga budować interfejsy czatu ze streamingiem w Vercel AI SDK: hook useChat, wywołania narzędzi, strumieniowanie odpowiedzi i UI czatu. - 100chat-api
Dodaje do aplikacji czat z historią rozmów przez Hibira Chat API w wersji beta, z potwierdzeniami odczytu i powiadomieniami. - 100realtime-integration
Dodaje kanały czasu rzeczywistego Hibira do strony, aplikacji mobilnej lub backendu: aktualizacje, czat, obecność i powiadomienia. - 98vercel-ai-sdk-streaming
Pomaga budować z Vercel AI SDK 5: streamText, generateObject, hook useChat, strukturalne wyjścia z Zod, wywoływanie narzędzi, agenci wieloetapowi, abstrakcja providerów i wzorce RAG. - 100ai-sdk
Buduje aplikacje z Vercel AI SDK v5 w TypeScript i React: strumieniowanie tekstu i interfejsu, wywoływanie narzędzi, wieloetapowe wykonanie i ustrukturyzowane wyniki. - 98ai-sdk
Wspiera Vercel AI SDK dla TypeScript: generowanie tekstu, streaming, strukturalne wyniki z Zod, wywoływanie narzędzi, agenty ToolLoopAgent i interfejsy czatu useChat w Node.js, Next.js, Nuxt i SvelteKit.