automagik-cli
Version:
Automagik CLI - A powerful command-line interface for interacting with Automagik Hive multi-agent AI systems
24 lines (23 loc) • 948 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { createContext, useContext, useState } from 'react';
import { StreamingState } from '../types.js';
const StreamingContext = createContext(undefined);
export const useStreamingContext = () => {
const context = useContext(StreamingContext);
if (!context) {
throw new Error('useStreamingContext must be used within a StreamingProvider');
}
return context;
};
export const StreamingProvider = ({ children }) => {
const [streamingState, setStreamingState] = useState(StreamingState.Idle);
const isStreaming = streamingState === StreamingState.Responding ||
streamingState === StreamingState.Waiting ||
streamingState === StreamingState.Connecting;
const contextValue = {
streamingState,
setStreamingState,
isStreaming,
};
return (_jsx(StreamingContext.Provider, { value: contextValue, children: children }));
};