Prometheus Entity Management API
    Preparing search index...

    Interface UseChatSessionOptions

    use-chat-session.ts — Core React hook that manages a chat session.

    Responsibilities:

    • Maintains local message list (React state, not the entity graph)
    • Processes incoming StreamEvents: appends / updates messages in place
    • Ingests STATE_SNAPSHOT / STATE_DELTA events into entity-graph-core via applyAgUiSnapshot / applyAgUiDelta
    • Invokes the optional EntityToolProvider when the agent emits tool calls

    This hook is the shared foundation for EntityChat and EntityCopilot.

    Hook→Store layering: this hook calls applyAgUiSnapshot / applyAgUiDelta (store writes). It never calls useGraphStore directly — that boundary is maintained in the agent/ module of entity-graph-core.

    interface UseChatSessionOptions {
        mappings?: AgUiStateMapping[];
        onError?: (error: Error) => void;
        onMessage?: (message: ChatMessage) => void;
        sessionId?: string;
        streamFactory: (
            messages: ChatMessage[],
        ) => AsyncIterable<StreamEvent, any, any> | ReadableStream<StreamEvent>;
        toolProvider?: EntityToolProvider;
    }
    Index
    mappings?: AgUiStateMapping[]

    AG-UI state mappings: project agent state onto entity-graph entities.

    onError?: (error: Error) => void

    Called on stream error.

    onMessage?: (message: ChatMessage) => void

    Called when a full assistant message has been received.

    sessionId?: string

    Unique session id; defaults to a generated id.

    streamFactory: (
        messages: ChatMessage[],
    ) => AsyncIterable<StreamEvent, any, any> | ReadableStream<StreamEvent>

    Factory that returns an async-iterable (or ReadableStream) of StreamEvents given the current messages. The library calls this on every sendMessage().

    toolProvider?: EntityToolProvider

    Optional tool provider for function-calling / MCP.