返回 ViMax
types.ts
根目录 / web / src / types.ts
1 export type SessionSummary = {
2 sessionId: string;
3 projectName: string;
4 workingDir: string;
5 stage: string;
6 summary: string;
7 idea: string;
8 updatedAt: string;
9 createdAt: string;
10 compactionTurns: number;
11 };
12
13 export type ConfigSection = {
14 model_provider?: string;
15 model: string;
16 base_url: string;
17 api_key: string;
18 has_api_key: boolean;
19 };
20
21 export type AgentConfig = {
22 sections: Record<'llm' | 'image' | 'video' | 'embedding' | 'reranker', ConfigSection>;
23 };
24
25 export type Artifact = {
26 path: string;
27 name: string;
28 kind: 'image' | 'video' | 'document';
29 size: number;
30 updatedAt: string;
31 url: string;
32 };
33
34 export type WorkspaceUpload = {
35 name: string;
36 path: string;
37 size: number;
38 };
39
40 export type JsonPrimitive = string | number | boolean | null;
41
42 export type JsonValue = JsonPrimitive | JsonValue[] | {[key: string]: JsonValue};
43
44 export type Message = {
45 id: string;
46 role: 'user' | 'assistant' | 'activity' | 'error';
47 text: string;
48 createdAt?: string;
49 tool?: string;
50 status?: 'running' | 'done' | 'error';
51 stage?: string;
52 };
53
54 export type AgentEvent = {
55 type?: string;
56 turn_id?: string;
57 delta?: string;
58 message?: string;
59 phase?: string;
60 status?: string;
61 stream?: string;
62 line?: string;
63 assistant?: string;
64 activeSessionId?: string;
65 sessions?: SessionSummary[];
66 tool?: {id?: string; name?: string; requested_name?: string};
67 progress?: {stage?: string; message?: string; metadata?: Record<string, unknown>};
68 tool_result?: {name?: string; ok?: boolean; content?: string; metadata?: Record<string, unknown>};
69 session?: {
70 active_session_id?: string;
71 session?: {
72 session_id?: string;
73 working_dir?: string;
74 stage?: string;
75 summary?: string;
76 } | null;
77 };
78 prompt_trace?: {
79 total_estimated_tokens?: number;
80 totals?: {total_tokens?: number; total_estimated_tokens?: number};
81 };
82 };
83
84 export type ChatState = {
85 messages: Message[];
86 busy: boolean;
87 turnId: string;
88 promptTokens: number;
89 };
90
90 lines TYPESCRIPT