import type { ChatMessage, CodeAgentAvailability, ConversationRecord, LiveSurface, ProviderProfile, SessionTab, WorkspaceRecord } from "../types/domain";

export type ChatStatus = "source" | "sent" | "running" | "completed" | "failed" | "blocked" | "timeout" | "canceled";

export interface WorkbenchState {
  workspace: WorkspaceRecord | null;
  conversations: ConversationRecord[];
  messages: ChatMessage[];
  providerProfile: ProviderProfile;
  codeAgentTimeoutMs: number;
  gatewayShellTimeoutMs: number;
  live: LiveSurface | null;
  codeAgentAvailability: CodeAgentAvailability | null;
  loading: boolean;
  chatPending: boolean;
  currentRequest: { traceId: string; conversationId: string; sessionId: string | null; threadId: string | null; status?: "running" | "completed" } | null;
  error: string | null;
}

export interface ComposerState {
  disabled: boolean;
  disabledReason: string | null;
  submitMode: "turn" | "steer";
  route: "/v1/agent/chat" | "/v1/agent/chat/steer";
  targetTraceId: string | null;
  conversationId: string | null;
  sessionId: string | null;
  threadId: string | null;
}

export interface WorkbenchRuntimeContext {
  activeConversationId: string | null;
  composer: ComposerState;
}
