The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type { OrchestrationV2ThreadDetailSnapshot, ThreadId } from "@t3tools/contracts"; |
| 2 | import * as Context from "effect/Context"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | |
| 5 | import type { PreparedConnection } from "../connection/model.ts"; |
| 6 | |
| 7 | export type ThreadSnapshotHistoryMeta = { |
| 8 | readonly historyCursor: string | null; |
| 9 | readonly hasMoreHistory: boolean; |
| 10 | readonly latestLocalTurnOrdinal?: number | null; |
| 11 | }; |
| 12 | |
| 13 | export type ThreadSnapshotLoadResult = |
| 14 | | { |
| 15 | readonly _tag: "present"; |
| 16 | readonly snapshot: OrchestrationV2ThreadDetailSnapshot; |
| 17 | readonly history?: ThreadSnapshotHistoryMeta; |
| 18 | } |
| 19 | | { readonly _tag: "missing" } |
| 20 | | { readonly _tag: "unavailable" }; |
| 21 | |
| 22 | export class ThreadSnapshotLoader extends Context.Service< |
| 23 | ThreadSnapshotLoader, |
| 24 | { |
| 25 | readonly load: ( |
| 26 | prepared: PreparedConnection, |
| 27 | threadId: ThreadId, |
| 28 | ) => Effect.Effect<ThreadSnapshotLoadResult>; |
| 29 | } |
| 30 | >()("@t3tools/client-runtime/state/threadSnapshotHttp/ThreadSnapshotLoader") {} |