@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 16 lines 723 Bytes
Raw
1 /**
2 * The machine triage runs on: the one on screen, else the primary if it
3 * supports triage, else the first connected machine that does. Without No
4 * project threads the action still shows and explains the terminal fallback,
5 * so this does not check for them.
6 */
7 export function pickTriageEnvironment<Id extends string>(input: {
8 readonly onScreen: Id | null;
9 readonly primary: Id | null;
10 readonly connected: ReadonlyArray<Id>;
11 readonly supportsTriage: (environmentId: Id) => boolean;
12 }): Id | null {
13 if (input.onScreen !== null) return input.onScreen;
14 if (input.primary !== null && input.supportsTriage(input.primary)) return input.primary;
15 return input.connected.find(input.supportsTriage) ?? null;
16 }