export type AgentType = 'claude-code' | 'openclaw'; export interface AgentConfig { agentId: string; agentToken: string; apiUrl: string; wsUrl: string; name: string; connectedAt: string; agentType: AgentType; agentConfig?: { openclawGatewayUrl?: string; }; extensionCodes?: string[]; mem0SshHost?: string; mem0SshPort?: string; mem0HttpBase?: string; } export interface AgentCapabilities { supports_teams: boolean; supports_orchestrate: boolean; max_concurrent_sessions: number; } export interface SystemInfo { hostname: string; platform: string; os: string; cliTools: string[]; capabilities: AgentCapabilities; } export interface ChatAttachment { file_key: string; cdn_url: string; file_type: string; file_name: string; } export interface InputResponse { text: string; attachments?: ChatAttachment[]; } export interface TaskAssignment { id: string; description: string; repoPath: string; mode: 'tuna' | 'agent_team'; confirmBeforeEdit?: boolean; attachments?: ChatAttachment[]; source?: 'manual' | 'skill' | 'scheduled' | 'workflow' | 'api'; agentId?: string; enableReflection?: boolean; } export interface ConnectResponse { machine_id: string; machine_token: string; name: string; } export interface ProgressEvent { taskId: string; event: string; data: Record; } export type SubtaskRole = string; export type SubtaskStatus = 'pending' | 'running' | 'waiting_input' | 'done' | 'failed'; export type SessionStatus = 'running' | 'waiting_input' | 'done' | 'failed'; export interface ApiContract { method: string; path: string; description?: string; headers?: Record; body?: Record; response?: Record; } export interface Subtask { id: string; role: SubtaskRole; description: string; cwd: string; dependencies: string[]; status: SubtaskStatus; } export interface TaskPlan { summary: string; contracts?: ApiContract[]; subtasks: Subtask[]; questions?: Array<{ question: string; options?: string[]; context?: string; }>; } export interface PlanResult { plan: TaskPlan; pmSessionId?: string; /** PM responded conversationally instead of creating a plan */ conversationalResponse?: string; } export interface SessionInfo { sessionId?: string; subtaskId: string; status: SessionStatus; logs: LogEntry[]; result?: string; costUsd?: number; durationMs?: number; pendingQuestion?: SubtaskQuestion; } export interface LogEntry { timestamp: Date; type: 'tool_start' | 'tool_end' | 'thinking' | 'result' | 'error'; message: string; } export interface SubtaskQuestion { subtaskId: string; question: string; options?: string[]; context?: string; } export interface ExecutionCallbacks { onSubtaskStart?: (subtaskId: string) => Promise; onSubtaskLog?: (subtaskId: string, log: { type: string; message: string; }) => Promise; onSubtaskDone?: (subtaskId: string, session: Record) => Promise; onSubtaskNeedsInput?: (subtaskId: string, question: SubtaskQuestion) => Promise; onLayerStart?: (layerIndex: number, totalLayers: number, subtaskIds: string[]) => Promise; /** Called when Claude Code requests permission for a tool action. Return true to approve, false to deny. */ onPermissionRequest?: (subtaskId: string, tool: string, detail: string) => Promise; } export type ProgressCallback = (event: string, data: Record) => void;