@copilotkit/shared
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
56 lines (54 loc) • 1.45 kB
TypeScript
interface CopilotErrorEvent {
type: "error" | "request" | "response" | "agent_state" | "action" | "message" | "performance";
timestamp: number;
context: CopilotRequestContext;
error?: any;
}
interface CopilotRequestContext {
threadId?: string;
runId?: string;
source: "runtime" | "ui" | "agent" | "network";
request?: {
operation: string;
method?: string;
url?: string;
path?: string;
headers?: Record<string, string>;
body?: any;
startTime: number;
};
response?: {
status?: number;
statusText?: string;
headers?: Record<string, string>;
body?: any;
endTime: number;
latency: number;
};
agent?: {
name?: string;
nodeName?: string;
state?: any;
};
messages?: {
input?: any[];
output?: any[];
messageCount?: number;
};
technical?: {
userAgent?: string;
host?: string;
environment?: string;
version?: string;
stackTrace?: string;
};
performance?: {
requestDuration?: number;
streamingDuration?: number;
actionExecutionTime?: number;
memoryUsage?: number;
};
metadata?: Record<string, any>;
}
type CopilotErrorHandler = (errorEvent: CopilotErrorEvent) => void | Promise<void>;
export { CopilotErrorEvent, CopilotErrorHandler, CopilotRequestContext };