Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
/**
* React keys for a transcript's rows. A sent message is keyed by its sendId, which its optimistic stand-in and the
* server's copy share, so the copy replaces the stand-in in place: one row from Enter to the echo, its entrance played
* once. A sendId more than one row carries keys none of them, and those rows keep their ids.
*/
export function transcriptRowKeys(messages: readonly { id: string; sendId?: string }[]): ReadonlyMap<string, string> {
const owners = new Map<string, string | null>();
for (const message of messages) {
if (!message.sendId) continue;
owners.set(message.sendId, owners.has(message.sendId) ? null : message.id);
}
const keys = new Map<string, string>();
for (const [sendId, id] of owners) if (id !== null) keys.set(id, `send:${sendId}`);
return keys;
}