117 lines · 2.8 KB · TypeScript
RawDownload
import type {  OrchestrationLatestTurn,  OrchestrationProposedPlanId,  OrchestrationSessionStatus,  OrchestrationThreadActivity,  ProjectScript as ContractProjectScript,  ThreadId,  ProjectId,  TurnId,  MessageId,  CheckpointRef,  ProviderKind,  ProviderInteractionMode,  RuntimeMode,} from "@t3tools/contracts"; export type SessionPhase = "disconnected" | "connecting" | "ready" | "running";export const DEFAULT_RUNTIME_MODE: RuntimeMode = "full-access"; export const DEFAULT_INTERACTION_MODE: ProviderInteractionMode = "default";export const DEFAULT_THREAD_TERMINAL_HEIGHT = 280;export const DEFAULT_THREAD_TERMINAL_ID = "default";export const MAX_TERMINALS_PER_GROUP = 4;export type ProjectScript = ContractProjectScript; export interface ThreadTerminalGroup {  id: string;  terminalIds: string[];} export interface ChatImageAttachment {  type: "image";  id: string;  name: string;  mimeType: string;  sizeBytes: number;  previewUrl?: string;} export type ChatAttachment = ChatImageAttachment; export interface ChatMessage {  id: MessageId;  role: "user" | "assistant" | "system";  text: string;  attachments?: ChatAttachment[];  createdAt: string;  completedAt?: string | undefined;  streaming: boolean;} export interface ProposedPlan {  id: OrchestrationProposedPlanId;  turnId: TurnId | null;  planMarkdown: string;  implementedAt: string | null;  implementationThreadId: ThreadId | null;  createdAt: string;  updatedAt: string;} export interface TurnDiffFileChange {  path: string;  kind?: string | undefined;  additions?: number | undefined;  deletions?: number | undefined;} export interface TurnDiffSummary {  turnId: TurnId;  completedAt: string;  status?: string | undefined;  files: TurnDiffFileChange[];  checkpointRef?: CheckpointRef | undefined;  assistantMessageId?: MessageId | undefined;  checkpointTurnCount?: number | undefined;} export interface Project {  id: ProjectId;  name: string;  cwd: string;  model: string;  expanded: boolean;  scripts: ProjectScript[];} export interface Thread {  id: ThreadId;  codexThreadId: string | null;  projectId: ProjectId;  title: string;  model: string;  runtimeMode: RuntimeMode;  interactionMode: ProviderInteractionMode;  session: ThreadSession | null;  messages: ChatMessage[];  proposedPlans: ProposedPlan[];  error: string | null;  createdAt: string;  latestTurn: OrchestrationLatestTurn | null;  lastVisitedAt?: string | undefined;  branch: string | null;  worktreePath: string | null;  turnDiffSummaries: TurnDiffSummary[];  activities: OrchestrationThreadActivity[];} export interface ThreadSession {  provider: ProviderKind;  status: SessionPhase | "error" | "closed";  activeTurnId?: TurnId | undefined;  createdAt: string;  updatedAt: string;  lastError?: string;  orchestrationStatus: OrchestrationSessionStatus;}