refactor(chat): stream agent events via stream_output and remove parity v2 flag

This commit is contained in:
CREDO23 2026-05-07 19:40:10 +02:00
parent 7e07092f67
commit 78f4747382
17 changed files with 76 additions and 1676 deletions

View file

@ -7,8 +7,8 @@ import { TextShimmerLoader } from "@/components/prompt-kit/loader";
import { cn } from "@/lib/utils";
/**
* Renders the structured `reasoning` part emitted by the backend's
* stream-parity v2 path (A1).
* Renders the structured `reasoning` part emitted by the backend stream
* (typed reasoning deltas from the chat model).
*
* Behaviour mirrors the existing `ThinkingStepsDisplay`:
* - collapsed by default;

View file

@ -48,13 +48,11 @@ import { cn } from "@/lib/utils";
* stream, post-stream reversibility flip, and explicit revert clicks.
*
* Match key (in priority order):
* 1. ``a.tool_call_id === toolCallId`` direct hit in parity_v2 when
* the model streamed ``tool_call_chunks`` so the card's synthetic
* id IS the LangChain id.
* 2. ``a.tool_call_id === langchainToolCallId`` legacy mode (or
* parity_v2 with provider-side chunk emission) where the card's
* synthetic id is ``call_<run_id>`` and the LangChain id is
* backfilled onto the part by ``tool-output-available``.
* 1. ``a.tool_call_id === toolCallId`` direct hit when the model
* streamed ``tool_call_chunks`` so the card id matches the LangChain id.
* 2. ``a.tool_call_id === langchainToolCallId`` synthetic card id is
* ``call_<run_id>`` and the LangChain id is backfilled by
* ``tool-output-available``.
* 3. ``(chat_turn_id, tool_name, position-within-turn)`` fallback
* for cards whose synthetic id is ``call_<run_id>`` AND whose
* ``langchainToolCallId`` never got backfilled (provider emitted
@ -116,7 +114,7 @@ function ToolCardRevertButton({
const action = useMemo(() => {
// Tier 1 + 2: O(1) Map-backed direct id match. Covers
// ~all parity_v2 streams and any legacy stream that backfilled
// Indexed chunk streams and any stream that backfilled
// ``langchainToolCallId`` via ``tool-output-available``.
const direct = findByToolCallId(toolCallId) ?? findByToolCallId(langchainToolCallId);
if (direct) return direct;

View file

@ -421,9 +421,8 @@ export type SSEEvent =
/**
* Live tool-call argument delta. Concatenated into
* ``argsText`` on the matching ``tool-call`` content part
* by ``appendToolInputDelta``. parity_v2 only the legacy
* code path emits ``tool-input-available`` without prior
* deltas.
* by ``appendToolInputDelta``. Some providers emit
* ``tool-input-available`` without prior deltas.
*/
type: "tool-input-delta";
toolCallId: string;