diff --git a/bun.lock b/bun.lock index 719082aa..3549fdf9 100644 --- a/bun.lock +++ b/bun.lock @@ -248,6 +248,7 @@ "sonner": "2.0.7", "tailwind-merge": "2.6.1", "tailwindcss-animate": "1.0.7", + "ulid": "3.0.2", "use-image": "1.1.4", "vaul": "1.1.2", "video.js": "8.23.7", @@ -280,6 +281,7 @@ "@temporalio/client": "1.17.2", "@temporalio/worker": "1.17.2", "@temporalio/workflow": "1.17.2", + "ulid": "3.0.2", }, }, }, diff --git a/packages/webui/components/fields-manager.tsx b/packages/webui/components/fields-manager.tsx index b73e7117..acded80d 100644 --- a/packages/webui/components/fields-manager.tsx +++ b/packages/webui/components/fields-manager.tsx @@ -4,6 +4,7 @@ import { type FieldInfo as MetadataFieldInfo, type SelectOption, } from '@shumai/dtos' +import { ulid } from 'ulid' import { client } from '@/ui/api/client' import { useFieldStore } from '@/ui/stores/fields' import { DragDropProvider, KeyboardSensor, PointerSensor, type DragEndEvent } from '@dnd-kit/react' @@ -328,7 +329,7 @@ export function FieldsManager({ projectId, onManageFields, onSave }: FieldsManag className="h-8 px-2" onClick={() => { const newOption: SelectOption = { - id: crypto.randomUUID(), + id: ulid(), displayName: 'New Option', color: '#808080', } diff --git a/packages/webui/components/file-browser/file-browser.tsx b/packages/webui/components/file-browser/file-browser.tsx index d64214fe..e174d3c1 100644 --- a/packages/webui/components/file-browser/file-browser.tsx +++ b/packages/webui/components/file-browser/file-browser.tsx @@ -8,6 +8,7 @@ import type { SearchCondition, SearchSort } from '@shumai/dtos' import type { ShareLinkInfo } from '@shumai/dtos' import type { CreateUploadTaskRequest } from '@shumai/dtos' import { formatSize } from '@/ui/lib/format' +import { ulid } from 'ulid' import { usePermissions } from '@/ui/hooks/use-permissions' import { useFieldStore } from '@/ui/stores/fields' import { useUploadStore } from '@/ui/stores/upload' @@ -692,7 +693,7 @@ export function FileBrowser({ const parentDir = { name: dir, type: 'folder' as const, - id: crypto.randomUUID(), + id: ulid(), children: newDir, size: 0, } @@ -703,7 +704,7 @@ export function FileBrowser({ currentLevel = directories.get(currentPath)! } } - const fileWithId = { file, id: crypto.randomUUID() } + const fileWithId = { file, id: ulid() } fileWithIds.push(fileWithId) currentLevel.push({ name: fileName, diff --git a/packages/webui/components/manage-fields-dialog.tsx b/packages/webui/components/manage-fields-dialog.tsx index 1e8f9530..583e40dd 100644 --- a/packages/webui/components/manage-fields-dialog.tsx +++ b/packages/webui/components/manage-fields-dialog.tsx @@ -4,6 +4,7 @@ import { FieldType, type SelectOption, } from '@shumai/dtos' +import { ulid } from 'ulid' import { client } from '@/ui/api/client' import { useMutation, useQueryClient } from '@tanstack/react-query' import { InferRequestType, InferResponseType } from 'hono/client' @@ -445,7 +446,7 @@ export function ManageFieldsDialog({ projectId, open, onOpenChange }: ManageFiel onClick={() => { // Logic to add option const newOption = { - id: crypto.randomUUID(), + id: ulid(), displayName: 'New Option', color: '#808080', } diff --git a/packages/webui/package.json b/packages/webui/package.json index b42e095f..cb5a4da9 100644 --- a/packages/webui/package.json +++ b/packages/webui/package.json @@ -82,7 +82,8 @@ "zod": "4.4.3", "date-fns": "4.4.0", "hono": "4.12.23", - "@shumai/dtos": "workspace:*" + "@shumai/dtos": "workspace:*", + "ulid": "3.0.2" }, "devDependencies": { "@tailwindcss/postcss": "4.3.0", diff --git a/packages/workflow-core/package.json b/packages/workflow-core/package.json index 7a0db689..f8844396 100644 --- a/packages/workflow-core/package.json +++ b/packages/workflow-core/package.json @@ -11,6 +11,7 @@ "@shumai/core": "workspace:*", "@temporalio/client": "1.17.2", "@temporalio/workflow": "1.17.2", - "@temporalio/worker": "1.17.2" + "@temporalio/worker": "1.17.2", + "ulid": "3.0.2" } } diff --git a/packages/workflow-core/src/workflow.ts b/packages/workflow-core/src/workflow.ts index 24881516..f437d72e 100644 --- a/packages/workflow-core/src/workflow.ts +++ b/packages/workflow-core/src/workflow.ts @@ -1,5 +1,6 @@ import { prisma, registerWorkflowTrigger, WorkflowTask } from '@shumai/db' import path from 'path' +import { ulid } from 'ulid' import * as taskActivities from './activities/task' import { Executor } from './executor' import { LocalExecutor } from './local-executor' @@ -73,8 +74,7 @@ export class WorkflowService { const activities = (globalThis as any).__localActivities // For agent_queue and transcode_queue, use worker-specific unique queues - const crypto = await import('crypto') - const workerId = crypto.randomUUID() + const workerId = ulid() const workerSpecificQueue = `${queue}-${workerId}` console.log(`Starting Temporal workers for domain: ${queue}`)