The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { StoredOrchestrationShellSnapshot } from "@t3tools/client-runtime/platform"; |
| 2 | import { deferPullRequests, detachPullRequests } from "@t3tools/client-runtime/state/shell"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import * as Predicate from "effect/Predicate"; |
| 5 | import * as Schema from "effect/Schema"; |
| 6 | |
| 7 | const decodeJson = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown)); |
| 8 | const decodeStoredShell = Schema.decodeUnknownEffect(StoredOrchestrationShellSnapshot); |
| 9 | |
| 10 | /** Defer pull request decoding until after the thread list can paint. */ |
| 11 | export const decodeStoredShellSnapshot = Effect.fnUntraced(function* (raw: string) { |
| 12 | const parsed = yield* decodeJson(raw); |
| 13 | const rawLinks = Predicate.isObject(parsed) ? detachPullRequests(parsed.snapshot) : []; |
| 14 | const stored = yield* decodeStoredShell(parsed); |
| 15 | return { ...stored, snapshot: deferPullRequests(stored.snapshot, rawLinks) }; |
| 16 | }); |