export interface StreamEvent { type: | "text_delta" | "tool_use" | "tool_result" | "done" | "error" // ---- v2 events ---- | "kb_lookup" // best-practice retrieval, with timing | "plan" // structured plan with tool chips per step | "trace" // execution trace entry | "artifact" // file produced by the agent | "citation" // inline source citation chip for the previous text run | "step_status"; // live status pulse for a plan step (Biomni-style todo) text?: string; tool?: string; input?: Record; result?: unknown; response?: string; error?: string; // ---- v2 fields ---- kb?: { name: string; ms: number }; plan?: PlanProposal; trace?: TraceEntry; artifact?: Artifact; citation?: Citation; step?: { index: number; status: StepStatus }; } export interface ChatMessage { id: string; role: "user" | "assistant"; content: string; toolCalls?: ToolCall[]; kbLookups?: KBLookup[]; trace?: TraceEntry[]; plan?: PlanProposal; artifacts?: Artifact[]; citations?: Citation[]; /** Per-step live status, parallel-indexed with `plan.steps`. */ stepStatus?: StepStatus[]; isStreaming?: boolean; } export interface ToolCall { tool: string; input: Record; result?: unknown; status: "running" | "completed" | "error"; } // ---- v2 types ---- export interface KBLookup { name: string; ms: number; } export interface PlanStepProto { label: string; tools: string[]; } export interface PlanProposal { title: string; steps: PlanStepProto[]; } export interface TraceEntry { ts: number; // ms epoch kind: "thought" | "tool_call" | "tool_result" | "text"; label: string; // short human-readable summary detail?: string; // optional verbose body } export interface Artifact { id: string; // stable id name: string; // user-visible filename bytes: number; // size in bytes mime: string; // MIME type url: string; // download URL (relative) createdAt: number; // ms epoch hubOutputData?: Record; // Hub job output_data (scores, PDB, sequences, etc.) } export interface Citation { label: string; // chip text e.g. "clinicaltrials.gov/data-api" url?: string; // optional href } // ---- Task persistence ---- export interface TaskRecord { id: string; // sess_xxxxxxxx projectId: string; // proj_xxxxxxxx title: string; createdAt: number; updatedAt: number; messages: ChatMessage[]; artifacts: Artifact[]; } export interface ProjectRecord { id: string; // proj_xxxxxxxx name: string; createdAt: number; } export interface Benchmark { source: string; paper_title: string; paper_url: string; paper_date: string; avg_hit_rate_vhh: number | null; avg_hit_rate_mab: number | null; target_coverage: number | null; best_affinity_pM: number | null; total_designs_tested: number; code_available: boolean; weights_available: boolean; developability: { overall_pass_rate: number | null } | null; targets: { name: string; target_class: string }[]; binding_results: { target: string; antibody_format: string; hit_rate: number | null; best_affinity_nM: number | null; assay: string; notes: string; }[]; notes: string; } export interface Skill { id: string; name: string; description: string; version: string; author: string; inputs: Record; outputs: Record; // ---- Optional fields populated from the Hub registry passthrough ---- category?: string; tier?: string; gpu?: boolean; gpuType?: string; minRamGb?: number; typicalRuntimeSeconds?: number; } // ---- Dataset connector types ---- export interface DatasetSearchResult { id: string; source: "sabdab" | "oas" | "imgt" | "fc"; title: string; summary: string; organism?: string; data_type: "structure" | "sequence" | "gene"; } export interface DatasetSearchResponse { results: Record; errors: Record; query: Record; } export interface SyncStatusEntry { source: string; last_synced: string | null; entry_count: number; size_bytes: number; status: "synced" | "syncing" | "error" | "not_synced" | "not_configured"; } export type ResourceKind = "target" | "benchmark" | "model" | "skill" | "sabdab" | "imgt" | "oas"; export interface ResourceRef { type: ResourceKind; id: string; label: string; sublabel?: string; } export interface ModelEntry { name: string; version: string; source: string; capabilities: string[]; repo_url: string | null; license: string | null; gpu_required: boolean; min_vram_gb: number; antibody_formats: string[]; notes: string; } export type StepStatus = "pending" | "running" | "done" | "error";