// GENERATED CODE! DO NOT MODIFY BY HAND!

// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AbsolutePathBuf } from "../AbsolutePathBuf";
import type { GitInfo } from "./GitInfo";
import type { SessionSource } from "./SessionSource";
import type { ThreadExtra } from "./ThreadExtra";
import type { ThreadHistoryMode } from "./ThreadHistoryMode";
import type { ThreadSource } from "./ThreadSource";
import type { ThreadStatus } from "./ThreadStatus";
import type { Turn } from "./Turn";

export type Thread = {
/**
 * Identifier for this thread. Codex-generated thread IDs are UUIDv7.
 */
id: string,
/**
 * Optional implementation-specific thread data.
 */
extra: ThreadExtra | null,
/**
 * Session id shared by threads that belong to the same session tree.
 */
sessionId: string,
/**
 * Source thread id when this thread was created by forking another thread.
 */
forkedFromId: string | null,
/**
 * The ID of the parent thread. This will only be set if this thread is a subagent.
 */
parentThreadId: string | null,
/**
 * Usually the first user message in the thread, if available.
 */
preview: string,
/**
 * Whether the thread is ephemeral and should not be materialized on disk.
 */
ephemeral: boolean,
/**
 * Persisted thread history contract selected when this thread was created.
 */
historyMode: ThreadHistoryMode,
/**
 * Model provider used for this thread (for example, 'openai').
 */
modelProvider: string,
/**
 * Unix timestamp (in seconds) when the thread was created.
 */
createdAt: number,
/**
 * Unix timestamp (in seconds) when the thread was last updated.
 */
updatedAt: number,
/**
 * Unix timestamp (in seconds) used for thread recency ordering.
 */
recencyAt: number | null,
/**
 * Current runtime status for the thread.
 */
status: ThreadStatus,
/**
 * [UNSTABLE] Path to the thread on disk.
 */
path: string | null,
/**
 * Working directory captured for the thread.
 */
cwd: AbsolutePathBuf,
/**
 * Version of the CLI that created the thread.
 */
cliVersion: string,
/**
 * Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).
 */
source: SessionSource,
/**
 * Optional analytics source classification for this thread.
 */
threadSource: ThreadSource | null,
/**
 * Optional random unique nickname assigned to an AgentControl-spawned sub-agent.
 */
agentNickname: string | null,
/**
 * Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.
 */
agentRole: string | null,
/**
 * Optional Git metadata captured when the thread was created.
 */
gitInfo: GitInfo | null,
/**
 * Optional user-facing thread title.
 */
name: string | null,
/**
 * Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read`
 * (when `includeTurns` is true) responses.
 * For all other responses and notifications returning a Thread,
 * the turns field will be an empty list.
 */
turns: Array<Turn>, };
