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
| 1 | import { useAtomValue } from "@effect/atom-react"; |
| 2 | import { parseScopedThreadKey } from "@t3tools/client-runtime/environment"; |
| 3 | import { resolveListedAncestorThreadRef } from "@t3tools/client-runtime/state/threads"; |
| 4 | |
| 5 | import { scopedThreadKey } from "../../lib/scopedEntities"; |
| 6 | import { environmentThreadShells } from "../../state/threads"; |
| 7 | |
| 8 | /** An open subagent, side chat or delegated task has no row; its listed ancestor's row is selected. */ |
| 9 | export function useSidebarRowThreadKey(openThreadKey: string | null): string | null { |
| 10 | const threads = useAtomValue(environmentThreadShells.quietThreadShellsAtom); |
| 11 | const openThreadRef = openThreadKey === null ? null : parseScopedThreadKey(openThreadKey); |
| 12 | if (openThreadRef === null) return openThreadKey; |
| 13 | const rowRef = resolveListedAncestorThreadRef(openThreadRef, threads); |
| 14 | return scopedThreadKey(rowRef.environmentId, rowRef.threadId); |
| 15 | } |