| |
|
|
| export interface TextContent { |
| type: 'text'; |
| text: string; |
| } |
| export interface ThinkingContent { |
| type: 'thinking'; |
| thinking: string; |
| } |
| export interface ToolCall { |
| type: 'toolCall'; |
| id: string; |
| name: string; |
| arguments: Record<string, unknown>; |
| } |
| export type AssistantContent = TextContent | ThinkingContent | ToolCall; |
|
|
| export interface Usage { |
| input: number; |
| output: number; |
| totalTokens: number; |
| } |
|
|
| export interface UserMessage { |
| role: 'user'; |
| content: string; |
| timestamp: number; |
| } |
|
|
| export type StopReason = 'stop' | 'length' | 'toolUse' | 'error' | 'aborted'; |
|
|
| export interface AssistantMessage { |
| role: 'assistant'; |
| content: AssistantContent[]; |
| stopReason?: StopReason; |
| errorMessage?: string; |
| usage: Usage; |
| timestamp: number; |
| } |
|
|
| export interface ToolResultMessage { |
| role: 'toolResult'; |
| toolCallId: string; |
| toolName: string; |
| content: TextContent[]; |
| details: { exitCode?: number; path?: string }; |
| isError: boolean; |
| timestamp: number; |
| } |
|
|
| export type AgentMessage = UserMessage | AssistantMessage | ToolResultMessage; |
|
|
| |
| export interface ToolSchema { |
| type: 'object'; |
| properties: Record<string, { type: 'string' | 'number' | 'boolean' | 'object' | 'array'; description?: string }>; |
| required: string[]; |
| } |
|
|
| export interface ToolDef { |
| name: string; |
| label: string; |
| description: string; |
| parameters: ToolSchema; |
| } |
|
|
| |
| export type SerializedEntry = |
| | { type: 'file'; base64: string; mode: number } |
| | { type: 'directory'; mode: number } |
| | { type: 'symlink'; target: string }; |
|
|
| export interface WorkspaceState { |
| version: 1; |
| files: Record<string, string>; |
| entries: Array<[string, SerializedEntry]>; |
| messages: AgentMessage[]; |
| } |
|
|
| export interface DeviceInfo { |
| vendor?: string; |
| architecture?: string; |
| maxStorageBufferBindingSize?: number; |
| features?: string[]; |
| } |
|
|
| export interface ShellResult { |
| stdout: string; |
| stderr: string; |
| exitCode: number; |
| } |
|
|