| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- // src/types/agent.ts
- export interface ToolStep {
- tool: string;
- arguments: Record<string, any>;
- call_id?: string;
- result?: any;
- is_error?: boolean;
- status: 'running' | 'completed' | 'failed';
- startedAt?: number;
- completedAt?: number;
- }
- export interface AgentToolFunction {
- name: string;
- description: string;
- parameters?: Record<string, any>;
- }
- export interface AgentToolMetadata {
- name: string;
- description: string;
- is_dangerous?: boolean;
- schema?: {
- type?: string;
- function?: AgentToolFunction;
- };
- }
- export interface AgentDangerousAction {
- tool: string;
- arguments: Record<string, any>;
- call_id?: string;
- description?: string;
- confirmed?: boolean;
- cancelled?: boolean;
- }
- export interface AgentMessage {
- id: string;
- role: 'user' | 'assistant' | 'system';
- content: string;
- timestamp: number;
- steps?: ToolStep[];
- thinking?: {
- status: 'started' | 'planning' | 'executing' | 'idle';
- step?: number;
- };
- isStreaming?: boolean;
- error?: string;
- dangerousAction?: AgentDangerousAction;
- }
- export interface AgentSession {
- id: string;
- title: string;
- createdAt: number;
- updatedAt: number;
- messageCount: number;
- lastMessageSnippet?: string;
- }
- export interface AgentChatParams {
- message: string;
- session_id?: string;
- stream?: boolean;
- max_steps?: number;
- model?: string;
- }
- export interface SSEStreamHandlers {
- onThink?: (step: number, status?: string) => void;
- onToolStart?: (tool: string, args: Record<string, any>, callId?: string) => void;
- onToolEnd?: (tool: string, result: any, isError: boolean, callId?: string) => void;
- onMessage?: (delta: string, full: string) => void;
- onFinish?: (finalAnswer: string, stepsCount: number, sessionId?: string) => void;
- onError?: (err: any) => void;
- }
|