Longbridge OpenAPI SDK
    Preparing search index...

    Interface ConversationStreamEvent

    One event observed while streaming AgentContext.conversationStreamed or AgentContext.continueConversationStreamed.

    Design note: the Rust core models this as an enum with a per-variant payload (longbridge::agent::ConversationStreamEvent), but napi-rs has no ergonomic equivalent of a Rust/Serde "enum with data" for a plain #[napi(object)] value, and there's no existing precedent for reifying one as a single JS value in this codebase (the closest analogue, trade::PushEvent, is dispatched to separate per-variant JS callbacks instead). We instead mirror the common "discriminant + optional per-kind fields" shape used for tagged unions in plain JS/JSON: kind is one of "chat_started" | "workflow_started" | "message" | "ping" | "thinking_started" | "thinking_finished" | "node_tool_use_started" | "node_tool_use_finished" | "subagent_started" | "subagent_progress" | "subagent_finished" | "agent_tool_started" | "agent_tool_progress" | "agent_tool_finished" | "human_interaction_required" | "query_masked" | "plan_changed" | "context_compress_started" | "context_compress_finished" | "chat_finished" | "workflow_finished" | "chat_title_updated" | "other", and exactly one of chatStarted / workflowStarted / message / thinkingStarted / thinkingFinished / nodeToolUseStarted / nodeToolUseFinished / subagentStarted / subagentProgress / subagentFinished / agentToolStarted / agentToolProgress / agentToolFinished / humanInteractionRequired / queryMasked / planChanged / contextCompressStarted / contextCompressFinished / chatFinished / workflowFinished / chatTitleUpdated / other is set, matching kind — except "ping", a heartbeat with no payload, for which every payload field is None. When kind is "other", otherEvent additionally carries the SSE envelope's event field (the event type name).

    Index
    kind: string

    Discriminant: one of "chat_started", "workflow_started", "message", "ping", "thinking_started", "thinking_finished", "node_tool_use_started", "node_tool_use_finished", "subagent_started", "subagent_progress", "subagent_finished", "agent_tool_started", "agent_tool_progress", "agent_tool_finished", "human_interaction_required", "query_masked", "plan_changed", "context_compress_started", "context_compress_finished", "chat_finished", "workflow_finished", "chat_title_updated", or "other"

    chatStarted?: ChatStartedPayload

    Set when kind is "chat_started"

    workflowStarted?: WorkflowStartedPayload

    Set when kind is "workflow_started"

    message?: MessagePayload

    Set when kind is "message"

    thinkingStarted?: ThinkingStartedPayload

    Set when kind is "thinking_started"

    thinkingFinished?: ThinkingFinishedPayload

    Set when kind is "thinking_finished"

    nodeToolUseStarted?: NodeToolUseStartedPayload

    Set when kind is "node_tool_use_started"

    nodeToolUseFinished?: NodeToolUseFinishedPayload

    Set when kind is "node_tool_use_finished"

    subagentStarted?: SubagentStartedPayload

    Set when kind is "subagent_started"

    subagentProgress?: SubagentProgressPayload

    Set when kind is "subagent_progress"

    subagentFinished?: SubagentFinishedPayload

    Set when kind is "subagent_finished"

    agentToolStarted?: AgentToolStartedPayload

    Set when kind is "agent_tool_started"

    agentToolProgress?: AgentToolProgressPayload

    Set when kind is "agent_tool_progress"

    agentToolFinished?: AgentToolFinishedPayload

    Set when kind is "agent_tool_finished"

    humanInteractionRequired?: ConversationResponse

    Set when kind is "human_interaction_required", carrying the run's outcome for an interrupted run — the same ConversationResponse shape workflowFinished carries for the other outcomes. Unlike workflowFinished, this is set instead of (never alongside) workflowFinished for the same run.

    queryMasked?: QueryMaskedPayload

    Set when kind is "query_masked"

    planChanged?: PlanChangedPayload

    Set when kind is "plan_changed"

    contextCompressStarted?: ContextCompressStartedPayload

    Set when kind is "context_compress_started"

    contextCompressFinished?: ContextCompressFinishedPayload

    Set when kind is "context_compress_finished"

    chatFinished?: ChatFinishedPayload

    Set when kind is "chat_finished"

    workflowFinished?: ConversationResponse

    Set when kind is "workflow_finished", carrying the run's outcome — not necessarily the last event of the stream, since the server may still emit a few more housekeeping events (kind "other") before actually closing the connection

    chatTitleUpdated?: ChatTitleUpdatedPayload

    Set when kind is "chat_title_updated"

    otherEvent?: string

    Set when kind is "other" — the SSE envelope's event field (the event type name)

    other?: any

    Set when kind is "other" — raw JSON of an event type not recognized by this SDK version