export interface TeamConfig { instruction: string; template?: string; leadPrompt?: string; agents?: AgentsDefMap; } export interface AgentRole { id: string; name: string; color: string; } export interface TaskItem { id: string; title: string; description: string; status: 'pending' | 'active' | 'done' | 'failed'; assignee: string | null; toolUseId: string | null; agentTaskId: string | null; dependencies: string[]; createdAt: number; updatedAt: number; } export interface TeamState { teamId: string; title: string; config: TeamConfig; workDir: string; conversationId: string; claudeSessionId: string | null; agents: Map; tasks: TaskItem[]; feed: TeamFeedEntry[]; status: 'planning' | 'running' | 'summarizing' | 'completed' | 'failed'; leadStatus: string; leadMessages: TeamAgentMessage[]; summary: string | null; totalCost: number; durationMs: number; createdAt: number; } export interface AgentTeammate { role: AgentRole; toolUseId: string | null; agentTaskId: string | null; status: 'starting' | 'working' | 'done' | 'error'; currentTaskId: string | null; messages: TeamAgentMessage[]; } export interface TeamAgentMessage { id: number; role: 'assistant' | 'tool' | 'user'; content?: string; toolId?: string; toolName?: string; toolInput?: string; toolOutput?: string; hasResult?: boolean; timestamp: number; } export interface TeamFeedEntry { timestamp: number; agentId: string; type: 'task_started' | 'task_completed' | 'task_failed' | 'tool_call' | 'status_change' | 'lead_activity'; content: string; } export interface TeamStateSerialized { teamId: string; title: string; config: TeamConfig; workDir?: string; conversationId: string; claudeSessionId: string | null; agents: Array<{ id: string; name: string; color: string; toolUseId: string | null; agentTaskId: string | null; status: string; currentTaskId: string | null; messages?: TeamAgentMessage[]; }>; tasks: TaskItem[]; feed: TeamFeedEntry[]; status: string; leadStatus: string; leadMessages?: TeamAgentMessage[]; summary: string | null; totalCost: number; durationMs: number; createdAt: number; } export interface TeamSummaryInfo { teamId: string; title: string; status: string; template: string | undefined; agentCount: number; taskCount: number; totalCost: number; workDir?: string; createdAt: number; } export type SendFn = (msg: Record) => void; export type HandleChatFn = (conversationId: string | undefined, prompt: string, workDir: string, options?: { resumeSessionId?: string; extraArgs?: string[]; }) => void; export type CancelExecutionFn = (conversationId?: string) => void; export type AddOutputObserverFn = (fn: (conversationId: string, msg: Record) => boolean | void) => void; export type RemoveOutputObserverFn = (fn: (conversationId: string, msg: Record) => boolean | void) => void; export type AddCloseObserverFn = (fn: (conversationId: string, exitCode: number | null, resultReceived: boolean) => void) => void; export type RemoveCloseObserverFn = (fn: (conversationId: string, exitCode: number | null, resultReceived: boolean) => void) => void; /** @deprecated Use AddOutputObserverFn instead. */ export type SetOutputObserverFn = AddOutputObserverFn; /** @deprecated Use RemoveOutputObserverFn instead. */ export type ClearOutputObserverFn = () => void; /** @deprecated Use AddCloseObserverFn instead. */ export type SetCloseObserverFn = AddCloseObserverFn; /** @deprecated Use RemoveCloseObserverFn instead. */ export type ClearCloseObserverFn = () => void; export interface AgentDef { description: string; prompt: string; tools: string[]; } export type AgentsDefMap = Record;