feat(ui): surface LLM stream errors in chat

Add a stream error event type to the shared schema and wire runtime handling to
convert provider payloads into a concise string format. When a stream error is
seen, emit a Run error event, preserve partial output, and stop the turn to
avoid additional tool execution.

In the renderer, display errors inline as assistant messages with destructive
styling and trigger a toast for immediate visibility. Include error events when
loading run history so prior failures are visible.
This commit is contained in:
Ramnique Singh 2026-02-16 08:34:51 +05:30
parent 11245660fb
commit e1d50c62da
4 changed files with 111 additions and 4 deletions

View file

@ -51,6 +51,11 @@ export const LlmStepStreamFinishStepEvent = z.object({
providerOptions: ProviderOptions.optional(),
});
export const LlmStepStreamErrorEvent = BaseEvent.extend({
type: z.literal("error"),
error: z.string(),
});
export const LlmStepStreamEvent = z.union([
LlmStepStreamReasoningStartEvent,
LlmStepStreamReasoningDeltaEvent,
@ -60,4 +65,5 @@ export const LlmStepStreamEvent = z.union([
LlmStepStreamTextEndEvent,
LlmStepStreamToolCallEvent,
LlmStepStreamFinishStepEvent,
]);
LlmStepStreamErrorEvent,
]);