Open History to see the last commit
1import type { OrchestrationV2ThreadProjection } from "@t3tools/contracts";
2import * as Option from "effect/Option";
3
4import { EMPTY_THREAD_HISTORY_META, type ThreadHistoryMeta } from "./threadHistoryMerge.ts";
5
6export type EnvironmentThreadStatus = "empty" | "cached" | "synchronizing" | "live" | "deleted";
7
8export interface EnvironmentThreadState {
9 readonly data: Option.Option<OrchestrationV2ThreadProjection>;
10 readonly status: EnvironmentThreadStatus;
11 readonly error: Option.Option<string>;
12 /**
13 * Errors here are thread/history-local and must not be promoted into the environment
14 * disconnect path.
15 */
16 readonly history: ThreadHistoryMeta;
17}
18
19export const EMPTY_ENVIRONMENT_THREAD_STATE: EnvironmentThreadState = {
20 data: Option.none(),
21 status: "empty",
22 error: Option.none(),
23 history: EMPTY_THREAD_HISTORY_META,
24};