Files
t3code/packages/client-runtime/src/state/threadState.ts
T
Julius Marminge 402fde73dd feat(orchestration): bound thread history and resume payloads
- Add paginated thread history with bounded snapshots and replay limits
- Trim oversized wire payloads and support progressive mobile history loading
2026-08-14 11:23:51 +02:00

26 lines
938 B
TypeScript

import type { OrchestrationV2ThreadProjection } from "@t3tools/contracts";
import * as Option from "effect/Option";
import { EMPTY_THREAD_HISTORY_META, type ThreadHistoryMeta } from "./threadHistoryMerge.ts";
export type EnvironmentThreadStatus = "empty" | "cached" | "synchronizing" | "live" | "deleted";
export interface EnvironmentThreadState {
readonly data: Option.Option<OrchestrationV2ThreadProjection>;
readonly status: EnvironmentThreadStatus;
readonly error: Option.Option<string>;
/**
* Progressive history cursor for bounded hydration. Absent/cleared on full
* snapshot paths. Errors here are thread/history-local and must not be
* promoted into the environment disconnect path.
*/
readonly history: ThreadHistoryMeta;
}
export const EMPTY_ENVIRONMENT_THREAD_STATE: EnvironmentThreadState = {
data: Option.none(),
status: "empty",
error: Option.none(),
history: EMPTY_THREAD_HISTORY_META,
};