import type { WebSocket } from 'ws'; import type { CheckpointInfo } from './services/git-manager.js'; /** * Mutable WebSocket reference holder to support reconnection during agent processing */ export declare class WebSocketRef { current: WebSocket; constructor(current: WebSocket); } export interface Agent { name: string; model: string; start(): Promise; stop(): Promise; createSession(wsRef: WebSocketRef, projectDir: string, resumeSessionId?: string): Promise; formatPrompt(data: BatchData, projectDir: string): string; extractImages(data: BatchData): ImageContent[]; } export interface ImageContent { base64: string; mediaType: string; label?: string; } export interface AgentSession { send(msg: { prompt: string; images?: ImageContent[]; }): Promise; destroy(): Promise; getSessionId?(): string | null; } /** * Canonical definition of a Marker. * Keep in sync with: client/src/types/index.ts (Marker) */ export interface Marker { id: string; selector: string; identifier: string; html: string; notes: string; status?: 'pending' | 'processing' | 'completed'; selectedText?: string; parentContext?: string; textContent?: string; siblingContext?: string; parentHtml?: string; screenshot?: string; } /** * Canonical definition of BatchData. * Keep in sync with: client/src/types/index.ts (BatchData) */ export interface BatchData { pageUrl: string; pageTitle: string; markers: Marker[]; projectDir?: string; } export type WSIncomingType = 'batch' | 'message' | 'reset' | 'stop' | 'get_agents' | 'select_agent' | 'get_history' | 'undo' | 'revert_to' | 'clear_history'; export interface WSIncomingMessage { type: WSIncomingType; data?: BatchData; content?: string; pageUrl?: string; agent?: string; checkpointId?: string; } export type WSOutgoingType = 'connected' | 'processing' | 'response' | 'delta' | 'diagnostic' | 'tool_start' | 'tool_end' | 'idle' | 'error' | 'reset_complete' | 'agents' | 'agent_selected' | 'agent_error' | 'checkpoint_created' | 'history' | 'undo_complete' | 'revert_complete' | 'history_cleared'; export interface AgentInfoMessage { name: string; displayName: string; available: boolean; version?: string; reason?: string; installCommand: string; } export interface WSOutgoingMessage { type: WSOutgoingType; content?: string; replace?: boolean; level?: 'info' | 'warning' | 'error'; message?: string; tool?: string; agent?: string; model?: string; projectDir?: string; agents?: AgentInfoMessage[]; checkpoint?: CheckpointInfo; checkpoints?: CheckpointInfo[]; checkpointId?: string; filesReverted?: string[]; }