diff --git a/archon-ui-main/package-lock.json b/archon-ui-main/package-lock.json index 831b1a928c..7986b794b9 100644 --- a/archon-ui-main/package-lock.json +++ b/archon-ui-main/package-lock.json @@ -26,6 +26,7 @@ "react-router-dom": "^6.26.2", "socket.io-client": "^4.8.1", "tailwind-merge": "latest", + "uuid": "^11.1.0", "zod": "^3.25.46" }, "devDependencies": { @@ -35,6 +36,7 @@ "@types/node": "^20.19.0", "@types/react": "^18.3.1", "@types/react-dom": "^18.3.1", + "@types/uuid": "^10.0.0", "@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/parser": "^5.54.0", "@vitejs/plugin-react": "^4.2.1", @@ -2977,6 +2979,13 @@ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", "license": "MIT" }, + "node_modules/@types/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", @@ -10025,6 +10034,19 @@ "dev": true, "license": "MIT" }, + "node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/archon-ui-main/package.json b/archon-ui-main/package.json index fc6a1d1a60..fb4634de36 100644 --- a/archon-ui-main/package.json +++ b/archon-ui-main/package.json @@ -36,6 +36,7 @@ "react-router-dom": "^6.26.2", "socket.io-client": "^4.8.1", "tailwind-merge": "latest", + "uuid": "^11.1.0", "zod": "^3.25.46" }, "devDependencies": { @@ -45,6 +46,7 @@ "@types/node": "^20.19.0", "@types/react": "^18.3.1", "@types/react-dom": "^18.3.1", + "@types/uuid": "^10.0.0", "@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/parser": "^5.54.0", "@vitejs/plugin-react": "^4.2.1", diff --git a/archon-ui-main/src/config/api.ts b/archon-ui-main/src/config/api.ts index 6b7799b380..b77bf3904c 100644 --- a/archon-ui-main/src/config/api.ts +++ b/archon-ui-main/src/config/api.ts @@ -12,25 +12,10 @@ export function getApiUrl(): string { return import.meta.env.VITE_API_URL; } - // For relative URLs in production (goes through proxy) - if (import.meta.env.PROD) { - return ''; - } - - // For development, construct from window location - const protocol = window.location.protocol; - const host = window.location.hostname; - const port = import.meta.env.ARCHON_SERVER_PORT; - - if (!port) { - throw new Error( - 'ARCHON_SERVER_PORT environment variable is required. ' + - 'Please set it in your environment variables. ' + - 'Default value: 8181' - ); - } - - return `${protocol}//${host}:${port}`; + // In both development (via Vite proxy) and production, we use a relative path. + // This ensures that requests are proxied correctly by the dev server or + // sent to the same origin in production. + return ''; } // Get the base path for API endpoints diff --git a/archon-ui-main/src/services/testService.ts b/archon-ui-main/src/services/testService.ts index 9b99957bb7..fba846f534 100644 --- a/archon-ui-main/src/services/testService.ts +++ b/archon-ui-main/src/services/testService.ts @@ -40,6 +40,7 @@ export interface TestStatus { } import { getApiUrl, getWebSocketUrl } from '../config/api'; +import { v4 as uuidv4 } from 'uuid'; // Use unified API configuration const API_BASE_URL = getApiUrl(); @@ -159,7 +160,7 @@ class TestService { onError?: (error: Error) => void, onComplete?: () => void ): Promise { - const execution_id = crypto.randomUUID(); + const execution_id = uuidv4(); try { // Send initial status