import type { OrchestrationLatestTurn, OrchestrationSessionStatus, OrchestrationThreadActivity, ProjectScript as ContractProjectScript, ThreadId, ProjectId, TurnId, MessageId, CheckpointRef, ProviderThreadId, ProviderSessionId, ProviderKind,} from "@t3tools/contracts"; export type SessionPhase = "disconnected" | "connecting" | "ready" | "running";export type RuntimeMode = "approval-required" | "full-access";export const DEFAULT_RUNTIME_MODE: RuntimeMode = "full-access";export const DEFAULT_THREAD_TERMINAL_HEIGHT = 280;export const DEFAULT_THREAD_TERMINAL_ID = "default";export const MAX_THREAD_TERMINAL_COUNT = 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 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: ProviderThreadId | null; projectId: ProjectId; title: string; model: string; session: ThreadSession | null; messages: ChatMessage[]; error: string | null; createdAt: string; latestTurn: OrchestrationLatestTurn | null; lastVisitedAt?: string | undefined; branch: string | null; worktreePath: string | null; turnDiffSummaries: TurnDiffSummary[]; activities: OrchestrationThreadActivity[];} export interface ThreadSession { sessionId: ProviderSessionId; provider: ProviderKind; status: SessionPhase | "error" | "closed"; threadId: ProviderThreadId | null; activeTurnId?: TurnId | undefined; createdAt: string; updatedAt: string; lastError?: string; orchestrationStatus: OrchestrationSessionStatus;}
import type {
OrchestrationLatestTurn,
OrchestrationSessionStatus,
OrchestrationThreadActivity,
ProjectScript as ContractProjectScript,
ThreadId,
ProjectId,
TurnId,
MessageId,
CheckpointRef,
ProviderThreadId,
ProviderSessionId,
ProviderKind,
} from "@t3tools/contracts";
export type SessionPhase = "disconnected" | "connecting" | "ready" | "running";
export type RuntimeMode = "approval-required" | "full-access";
export const DEFAULT_RUNTIME_MODE: RuntimeMode = "full-access";
export const DEFAULT_THREAD_TERMINAL_HEIGHT = 280;
export const DEFAULT_THREAD_TERMINAL_ID = "default";
export const MAX_THREAD_TERMINAL_COUNT = 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 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: ProviderThreadId | null;
projectId: ProjectId;
title: string;
model: string;
session: ThreadSession | null;
messages: ChatMessage[];
error: string | null;
createdAt: string;
latestTurn: OrchestrationLatestTurn | null;
lastVisitedAt?: string | undefined;
branch: string | null;
worktreePath: string | null;
turnDiffSummaries: TurnDiffSummary[];
activities: OrchestrationThreadActivity[];
}
export interface ThreadSession {
sessionId: ProviderSessionId;
provider: ProviderKind;
status: SessionPhase | "error" | "closed";
threadId: ProviderThreadId | null;
activeTurnId?: TurnId | undefined;
createdAt: string;
updatedAt: string;
lastError?: string;
orchestrationStatus: OrchestrationSessionStatus;
}