Replace all crypto.randomUUID() calls with a uuid() utility that falls back to Math.random-based generation when the Web Crypto API is unavailable (plain HTTP contexts). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { GameState, EventState, ActiveEvent, EventDefinition, EventCondition } from '@ai-tycoon/shared';
|
||||
import { uuid } from '@ai-tycoon/shared';
|
||||
|
||||
export interface EventTickResult {
|
||||
events: EventState;
|
||||
@@ -73,7 +74,7 @@ export function processEvents(
|
||||
|
||||
const activeEvent: ActiveEvent = {
|
||||
eventId: chosen.id,
|
||||
instanceId: crypto.randomUUID(),
|
||||
instanceId: uuid(),
|
||||
triggeredAtTick: tick,
|
||||
expiresAtTick: tick + chosen.expiryTicks,
|
||||
title: chosen.title,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { GameState, ModelsState, TrainedModel, ModelCapabilities } from '@ai-tycoon/shared';
|
||||
import { uuid } from '@ai-tycoon/shared';
|
||||
|
||||
export interface ModelTickResult {
|
||||
modelsState: ModelsState;
|
||||
@@ -79,7 +80,7 @@ function createTrainedModel(
|
||||
const parameterCount = Math.pow(10, generation) * (0.5 + Math.random());
|
||||
|
||||
return {
|
||||
id: crypto.randomUUID(),
|
||||
id: uuid(),
|
||||
name,
|
||||
generation,
|
||||
parameterCount,
|
||||
|
||||
Reference in New Issue
Block a user