Skip to content

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.

Use Effect UUID generator as randomUUID fallback

Julius Marminge767de271e972
diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts
index 9c2311ba8..08a5de91e 100644
--- a/apps/web/src/lib/utils.ts
+++ b/apps/web/src/lib/utils.ts
@@ -1,6 +1,8 @@
import { CommandId, MessageId, ProjectId, ThreadId } from "@t3tools/contracts";
import { type CxOptions, cx } from "class-variance-authority";
import { twMerge } from "tailwind-merge";
+import * as Random from "effect/Random";
+import * as Effect from "effect/Effect";
export function cn(...inputs: CxOptions) {
return twMerge(cx(inputs));
@@ -18,13 +20,7 @@ export function randomUUID(): string {
if (typeof crypto.randomUUID === "function") {
return crypto.randomUUID();
}
- // Fallback for non-secure contexts (plain HTTP on non-localhost)
- const bytes = new Uint8Array(16);
- crypto.getRandomValues(bytes);
- bytes[6] = (bytes[6] & 0x0f) | 0x40;
- bytes[8] = (bytes[8] & 0x3f) | 0x80;
- const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
+ return Effect.runSync(Random.nextUUIDv4);
}
export const newCommandId = (): CommandId => CommandId.makeUnsafe(randomUUID());