
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
ai.matey.react.stream
Advanced tools
React streaming utilities for AI Matey - StreamProvider, StreamContext
React components and utilities for streaming AI responses.
Part of the ai.matey monorepo.
npm install ai.matey.react.stream
import { StreamProvider, useStreamContext, StreamText } from 'ai.matey.react.stream';
// Wrap your app with StreamProvider
function App() {
return (
<StreamProvider maxStreams={10}>
<ChatComponent />
</StreamProvider>
);
}
// Use streaming in components
function ChatComponent() {
const { startStream, appendToStream, completeStream, getStream } = useStreamContext();
const [streamId, setStreamId] = useState<string | null>(null);
const handleSend = async () => {
const id = `msg-${Date.now()}`;
setStreamId(id);
startStream(id);
const response = await fetch('/api/chat', { method: 'POST' });
const reader = response.body?.getReader();
const decoder = new TextDecoder();
while (reader) {
const { done, value } = await reader.read();
if (done) break;
appendToStream(id, decoder.decode(value));
}
completeStream(id);
};
const stream = streamId ? getStream(streamId) : null;
return (
<div>
{stream && (
<StreamText
text={stream.text}
isStreaming={stream.isStreaming}
showCursor={true}
/>
)}
<button onClick={handleSend}>Send</button>
</div>
);
}
StreamProvider - Context provider for stream state managementStreamText - Display streaming text with cursorTypeWriter - Typewriter effect for static textuseStreamContext - Access stream management functionsuseStreamState - Get state for a specific streamcreateTextStream - Create controlled text stream from fetch responseparseSSEStream - Parse Server-Sent EventstransformStream - Transform stream datamergeStreams - Merge multiple streamsfromAsyncIterable - Convert async iterable to streamtoAsyncIterable - Convert stream to async iterableStreamState, StreamContextValue, StreamProviderPropsStreamTextProps, TypeWriterPropsCreateTextStreamOptions, SSEEventContext provider for managing multiple concurrent streams.
<StreamProvider maxStreams={100}>
{children}
</StreamProvider>
Props:
maxStreams - Maximum streams to keep (default: 100, oldest completed removed when exceeded)Access stream management functions.
const {
streams, // Map<string, StreamState> - All streams
getStream, // (id: string) => StreamState | undefined
startStream, // (id: string, metadata?: object) => void
updateStream, // (id: string, text: string) => void - Replace text
appendToStream, // (id: string, chunk: string) => void - Append text
completeStream, // (id: string) => void - Mark complete
setStreamError, // (id: string, error: Error) => void
removeStream, // (id: string) => void
clearAllStreams, // () => void
} = useStreamContext();
Get state for a specific stream by ID.
const stream = useStreamState('message-1');
// stream: { id, text, isStreaming, error, metadata } | undefined
Display streaming text with optional blinking cursor.
<StreamText
text="Hello world"
isStreaming={true}
showCursor={true} // Show cursor while streaming
cursor="▋" // Cursor character
cursorBlinkInterval={500} // Blink speed in ms
className="my-class"
renderText={(text) => <Markdown>{text}</Markdown>}
/>
Simulate typing effect for non-streaming text.
<TypeWriter
text="Welcome to AI Matey!"
speed={30} // ms per character
delay={500} // ms before starting
showCursor={true}
cursor="▋"
onComplete={() => console.log('Done!')}
/>
import {
createTextStream,
parseSSEStream,
fromAsyncIterable,
} from 'ai.matey.react.stream';
// Create text stream from fetch response
const text = await createTextStream(response, {
onChunk: (chunk) => console.log(chunk),
onComplete: (fullText) => console.log('Done:', fullText),
signal: abortController.signal,
});
// Parse SSE events
for await (const event of parseSSEStream(response)) {
console.log(event.data); // { type: 'data' | 'event', data: string }
}
MIT - see LICENSE for details.
FAQs
React streaming utilities for AI Matey - StreamProvider, StreamContext
We found that ai.matey.react.stream demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.