@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 12 lines 582 Bytes
Raw
1 import type { ThreadId, WorktreeSetupSnapshot } from "@t3tools/contracts";
2
3 /** A subscription can close or replay an older value during the setup handoff. */
4 export function resolveWorktreeSetupSnapshot(
5 threadId: ThreadId | null,
6 latest: WorktreeSetupSnapshot | null | undefined,
7 held: WorktreeSetupSnapshot | null,
8 ): WorktreeSetupSnapshot | null {
9 const current = latest?.threadId === threadId ? latest : null;
10 const previous = held?.threadId === threadId ? held : null;
11 return current && (!previous || current.sequence >= previous.sequence) ? current : previous;
12 }