export interface FileSnapshot { path: string; content: string; content_hash: string; } export interface AgentSessionCreateResponse { session_id: string; rag_session_id: string; index_job_id: string; status: string; created_at: string; } export interface AgentSessionResult { sessionId: string; ragSessionId: string; indexedFiles: number; failedFiles: number; cacheHitFiles: number; cacheMissFiles: number; } export interface TaskQueuedResponse { request_id: string; session_id: string; status: string; stream_url: string; } export interface PatchHunk { type?: "append_end" | "replace_between" | "replace_line_equals"; new_text?: string; start_anchor?: string; end_anchor?: string; old_line?: string; } export interface ChangeItem { op?: "create" | "update" | "delete"; path?: string; base_hash?: string | null; proposed_content?: string | null; reason?: string; hunks?: PatchHunk[]; } export interface TaskResultResponse { request_id: string; session_id: string; status: string; process_version: string; answer?: string | null; changeset?: ChangeItem[]; apply_changeset?: boolean; error?: { desc?: string; message?: string } | null; } export interface TaskArtifact { artifact_type: string; title: string; content?: string; format?: string; template_id?: string | null; source_refs?: string[]; } export interface TaskEvent { kind: "queued" | "progress" | "thinking" | "status" | "result" | "error"; task_id: string; status?: string; stage?: string; message?: string; progress?: unknown; meta?: Record; heartbeat?: boolean; result_type?: string; answer?: string; artifacts?: TaskArtifact[]; } export interface SendChatPayload { sessionId: string; message: string; processVersion: string; } export interface SendChatResult { taskId: string; resultType: string; answer: string; artifacts: TaskArtifact[]; changeset: ChangeItem[]; applyChangeset: boolean; } export interface RagJobResponse { rag_session_id: string; index_job_id: string; status: string; indexed_files: number; failed_files: number; cache_hit_files: number; cache_miss_files: number; error?: { desc?: string; message?: string } | null; } export interface RagProgressEvent { status: "progress" | "done" | "error"; message: string; done: number | null; total: number | null; failed: number | null; cacheHitFiles: number | null; cacheMissFiles: number | null; currentFilePath?: string; currentFileName?: string; }