Replaces the separate Build with Archie bar and its per-workflow channel, so every conversation belongs to the account and is listed on every device, and the command palette is the same everywhere.
18 lines
502 B
TypeScript
18 lines
502 B
TypeScript
import { randomUUID } from "@/lib/uuid";
|
|
|
|
const CHANNEL_KEY = "archie.web.chat.channel";
|
|
|
|
/**
|
|
* The browser's chat identity. The server keys a conversation on the channel
|
|
* alone (the browser has no threading), so this is persisted: a reload rejoins
|
|
* the conversation instead of starting a second one beside it.
|
|
*/
|
|
export function channelID(): string {
|
|
let id = localStorage.getItem(CHANNEL_KEY);
|
|
if (!id) {
|
|
id = randomUUID();
|
|
localStorage.setItem(CHANNEL_KEY, id);
|
|
}
|
|
return id;
|
|
}
|