Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
import type { ScopedThreadRef } from "@akeru/contracts";
/**
* The server only guarantees preview tab ids are unique within one process.
* Desktop resources live across every connected environment, so they need a
* stronger identity that also changes when a server process restarts.
*/
export function previewRuntimeTabId(
threadRef: ScopedThreadRef,
serverEpoch: string | null,
tabId: string,
): string {
return JSON.stringify([threadRef.environmentId, threadRef.threadId, serverEpoch, tabId]);
}
export function isCurrentPreviewRuntimeTab(
threadRef: ScopedThreadRef,
serverEpoch: string | null,
tabId: string,
runtimeTabId: string,
): boolean {
return previewRuntimeTabId(threadRef, serverEpoch, tabId) === runtimeTabId;
}