mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-28 05:46:58 +02:00
fix(sdk): add AgentErrorEvent to StreamPayload type
StreamPayload.event was missing the agent_error event type, causing TypeScript errors in useGatewayChat and useLocalChat where the comparison payload.event.type === "agent_error" had no type overlap. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,7 @@ export {
|
||||
type CompactionEvent,
|
||||
type CompactionStartEvent,
|
||||
type CompactionEndEvent,
|
||||
type AgentErrorEvent,
|
||||
type ContentBlock,
|
||||
type TextContent,
|
||||
type ThinkingContent,
|
||||
|
||||
@@ -45,16 +45,22 @@ export type CompactionEndEvent = {
|
||||
/** Union of all compaction events */
|
||||
export type CompactionEvent = CompactionStartEvent | CompactionEndEvent;
|
||||
|
||||
/** Emitted when the agent encounters an error (LLM failure, quota exceeded, etc.) */
|
||||
export type AgentErrorEvent = {
|
||||
type: "agent_error";
|
||||
error: string;
|
||||
};
|
||||
|
||||
// --- Stream event types ---
|
||||
|
||||
/**
|
||||
* Hub forwards AgentEvent from pi-agent-core and CompactionEvent as-is.
|
||||
* StreamPayload wraps them with routing metadata.
|
||||
* Hub forwards AgentEvent from pi-agent-core, CompactionEvent,
|
||||
* and AgentErrorEvent as-is. StreamPayload wraps them with routing metadata.
|
||||
*/
|
||||
export interface StreamPayload {
|
||||
streamId: string;
|
||||
agentId: string;
|
||||
event: AgentEvent | CompactionEvent;
|
||||
event: AgentEvent | CompactionEvent | AgentErrorEvent;
|
||||
}
|
||||
|
||||
/** Extract thinking/reasoning content from an AgentEvent that carries a message */
|
||||
|
||||
Reference in New Issue
Block a user