summaryrefslogtreecommitdiffhomepage
path: root/packages/frontend/src/lib/types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/lib/types.ts')
-rw-r--r--packages/frontend/src/lib/types.ts57
1 files changed, 57 insertions, 0 deletions
diff --git a/packages/frontend/src/lib/types.ts b/packages/frontend/src/lib/types.ts
new file mode 100644
index 0000000..6edb550
--- /dev/null
+++ b/packages/frontend/src/lib/types.ts
@@ -0,0 +1,57 @@
+export interface ToolCallDisplay {
+ id: string;
+ name: string;
+ arguments: Record<string, unknown>;
+ result?: string;
+ isError?: boolean;
+ isExpanded: boolean;
+}
+
+export interface DebugInfo {
+ timestamp: string;
+ error?: string;
+ model?: string;
+ apiBase?: string;
+ connectionStatus?: string;
+ agentStatus?: string;
+ rawEvent?: unknown;
+ httpStatus?: number;
+ httpBody?: string;
+}
+
+export interface ChatMessage {
+ id: string;
+ role: "user" | "assistant";
+ content: string;
+ toolCalls?: ToolCallDisplay[];
+ isStreaming?: boolean;
+ debugInfo?: DebugInfo;
+}
+
+export type ConnectionStatus = "connecting" | "connected" | "disconnected";
+
+export type AgentEvent =
+ | { type: "status"; status: "idle" | "running" | "error" }
+ | { type: "text-delta"; delta: string }
+ | {
+ type: "tool-call";
+ toolCall: {
+ id: string;
+ name: string;
+ arguments: Record<string, unknown>;
+ };
+ }
+ | {
+ type: "tool-result";
+ toolResult: { toolCallId: string; result: string; isError: boolean };
+ }
+ | { type: "error"; error: string }
+ | {
+ type: "done";
+ message: {
+ role: string;
+ content: string;
+ toolCalls?: unknown[];
+ toolResults?: unknown[];
+ };
+ };