Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor: replace uuid, cors, globals, geist with owned code

Adam Eivyf9857677b70c
diff --git a/client/eslint.config.js b/client/eslint.config.js
index d124e2712a..38ee271e34 100644
--- a/client/eslint.config.js
+++ b/client/eslint.config.js
@@ -1,8 +1,48 @@
import js from '@eslint/js';
-import globals from 'globals';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
+const browserGlobals = {
+ window: 'readonly', document: 'readonly', navigator: 'readonly',
+ location: 'readonly', history: 'readonly', screen: 'readonly',
+ console: 'readonly', alert: 'readonly', confirm: 'readonly', prompt: 'readonly',
+ setTimeout: 'readonly', clearTimeout: 'readonly',
+ setInterval: 'readonly', clearInterval: 'readonly',
+ requestAnimationFrame: 'readonly', cancelAnimationFrame: 'readonly',
+ queueMicrotask: 'readonly',
+ fetch: 'readonly', URL: 'readonly', URLSearchParams: 'readonly',
+ FormData: 'readonly', File: 'readonly', FileReader: 'readonly',
+ Blob: 'readonly', Event: 'readonly', CustomEvent: 'readonly',
+ EventTarget: 'readonly', AbortController: 'readonly', AbortSignal: 'readonly',
+ ReadableStream: 'readonly', WritableStream: 'readonly', TransformStream: 'readonly',
+ DecompressionStream: 'readonly',
+ localStorage: 'readonly', sessionStorage: 'readonly', indexedDB: 'readonly',
+ performance: 'readonly', crypto: 'readonly',
+ Worker: 'readonly', SharedWorker: 'readonly', MessageChannel: 'readonly',
+ MessageEvent: 'readonly', BroadcastChannel: 'readonly',
+ HTMLElement: 'readonly', HTMLInputElement: 'readonly', HTMLCanvasElement: 'readonly',
+ HTMLVideoElement: 'readonly', HTMLTextAreaElement: 'readonly',
+ Element: 'readonly', Node: 'readonly', NodeList: 'readonly', Text: 'readonly',
+ MutationObserver: 'readonly', IntersectionObserver: 'readonly',
+ ResizeObserver: 'readonly',
+ WebGLRenderingContext: 'readonly', WebGL2RenderingContext: 'readonly',
+ ArrayBuffer: 'readonly', Uint8Array: 'readonly', Uint16Array: 'readonly',
+ Uint32Array: 'readonly', Int8Array: 'readonly', Int16Array: 'readonly',
+ Int32Array: 'readonly', Float32Array: 'readonly', Float64Array: 'readonly',
+ DataView: 'readonly', TextDecoder: 'readonly', TextEncoder: 'readonly',
+ atob: 'readonly', btoa: 'readonly',
+ Image: 'readonly', Audio: 'readonly', SVGElement: 'readonly',
+ getComputedStyle: 'readonly', matchMedia: 'readonly',
+ self: 'readonly', globalThis: 'readonly',
+};
+
+const nodeGlobals = {
+ process: 'readonly', Buffer: 'readonly', global: 'readonly',
+ __dirname: 'readonly', __filename: 'readonly',
+ require: 'readonly', module: 'writable', exports: 'writable',
+ setImmediate: 'readonly', clearImmediate: 'readonly',
+};
+
export default [
{
ignores: ['dist/**', 'node_modules/**'],
@@ -19,8 +59,8 @@ export default [
},
},
globals: {
- ...globals.browser,
- ...globals.node,
+ ...browserGlobals,
+ ...nodeGlobals,
},
},
plugins: {
diff --git a/client/package.json b/client/package.json
index fec4544ca6..36c5b39b80 100644
--- a/client/package.json
+++ b/client/package.json
@@ -19,7 +19,6 @@
"@xterm/addon-web-links": "0.12.0",
"@xterm/xterm": "6.0.0",
"fflate": "0.8.2",
- "geist": "1.7.0",
"lucide-react": "0.562.0",
"react": "18.3.1",
"react-diff-viewer-continued": "4.1.2",
@@ -38,7 +37,6 @@
"eslint": "9.23.0",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "5.2.0",
- "globals": "16.0.0",
"tailwindcss": "4.2.1",
"vite": "7.3.1"
}
diff --git a/server/index.js b/server/index.js
index db88f2ff3c..f43ec9073e 100644
--- a/server/index.js
+++ b/server/index.js
@@ -1,5 +1,4 @@
import express from 'express';
-import cors from 'cors';
import { createServer } from 'http';
import { Server } from 'socket.io';
import { fileURLToPath } from 'url';
@@ -193,10 +192,14 @@ initAutoFixer();
initTaskLearning();
// Middleware - allow any origin for Tailscale access
-app.use(cors({
- origin: true,
- credentials: true
-}));
+app.use((req, res, next) => {
+ res.header('Access-Control-Allow-Origin', req.headers.origin || '*');
+ res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,PATCH,DELETE,OPTIONS');
+ res.header('Access-Control-Allow-Headers', 'Content-Type,Authorization');
+ res.header('Access-Control-Allow-Credentials', 'true');
+ if (req.method === 'OPTIONS') return res.sendStatus(204);
+ next();
+});
app.use(express.json({ limit: '50mb' }));
app.use(express.urlencoded({ limit: '50mb', extended: true }));
diff --git a/server/lib/uuid.js b/server/lib/uuid.js
new file mode 100644
index 0000000000..aefa184cbf
--- /dev/null
+++ b/server/lib/uuid.js
@@ -0,0 +1 @@
+export const v4 = () => crypto.randomUUID();
diff --git a/server/package.json b/server/package.json
index 86dab2bc16..c2a861cd92 100644
--- a/server/package.json
+++ b/server/package.json
@@ -11,8 +11,6 @@
"test:coverage": "vitest run --coverage"
},
"dependencies": {
- "axios": "1.7.9",
- "cors": "2.8.5",
"express": "5.2.1",
"googleapis": "171.4.0",
"multer": "2.0.2",
@@ -25,7 +23,6 @@
"socket.io": "4.8.3",
"socket.io-client": "4.8.3",
"unzipper": "0.12.3",
- "uuid": "11.0.3",
"ws": "8.18.0",
"zod": "3.24.1"
},
diff --git a/server/routes/attachments.js b/server/routes/attachments.js
index 8460a2b63c..ca61b2a54c 100644
--- a/server/routes/attachments.js
+++ b/server/routes/attachments.js
@@ -7,7 +7,7 @@ import { Router } from 'express';
import { writeFile, unlink, readdir, stat } from 'fs/promises';
import { existsSync } from 'fs';
import { join, basename, extname, resolve } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { asyncHandler, ServerError } from '../lib/errorHandler.js';
import { ensureDir, PATHS, RISKY_MIME_TYPES } from '../lib/fileUtils.js';
diff --git a/server/routes/screenshots.js b/server/routes/screenshots.js
index 69376a6222..a20518c780 100644
--- a/server/routes/screenshots.js
+++ b/server/routes/screenshots.js
@@ -2,7 +2,7 @@ import { Router } from 'express';
import { writeFile } from 'fs/promises';
import { existsSync } from 'fs';
import { join, basename, resolve } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { asyncHandler, ServerError } from '../lib/errorHandler.js';
import { ensureDir, PATHS } from '../lib/fileUtils.js';
diff --git a/server/routes/uploads.js b/server/routes/uploads.js
index 1436887388..397ccd5f1a 100644
--- a/server/routes/uploads.js
+++ b/server/routes/uploads.js
@@ -7,7 +7,7 @@ import { Router } from 'express';
import { writeFile, unlink, readdir, stat } from 'fs/promises';
import { existsSync } from 'fs';
import { join, basename, extname, resolve } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { asyncHandler, ServerError } from '../lib/errorHandler.js';
import { ensureDir, PATHS, RISKY_MIME_TYPES } from '../lib/fileUtils.js';
diff --git a/server/services/agentDrafts.js b/server/services/agentDrafts.js
index b02ab64efb..159e046250 100644
--- a/server/services/agentDrafts.js
+++ b/server/services/agentDrafts.js
@@ -7,7 +7,7 @@
import { readFile, writeFile } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, PATHS, safeJSONParse } from '../lib/fileUtils.js';
const DRAFTS_DIR = join(PATHS.agentPersonalities, 'drafts');
diff --git a/server/services/agentPersonalities.js b/server/services/agentPersonalities.js
index c25c0ec754..c9f7bb940a 100644
--- a/server/services/agentPersonalities.js
+++ b/server/services/agentPersonalities.js
@@ -7,7 +7,7 @@
*/
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import EventEmitter from 'events';
import { PATHS, createCachedStore } from '../lib/fileUtils.js';
diff --git a/server/services/apps.js b/server/services/apps.js
index 844a2213c2..2fe9de0483 100644
--- a/server/services/apps.js
+++ b/server/services/apps.js
@@ -1,6 +1,6 @@
import { writeFile } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import EventEmitter from 'events';
import { ensureDir, readJSONFile, PATHS } from '../lib/fileUtils.js';
import { NON_PM2_TYPES } from './streamingDetect.js';
diff --git a/server/services/autobiography.js b/server/services/autobiography.js
index c37edcac85..92aedcfb5b 100644
--- a/server/services/autobiography.js
+++ b/server/services/autobiography.js
@@ -9,7 +9,7 @@
import { writeFile } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, PATHS, readJSONFile } from '../lib/fileUtils.js';
import { addNotification, NOTIFICATION_TYPES, exists as notificationExists } from './notifications.js';
import { getActiveProvider, getProviderById } from './providers.js';
diff --git a/server/services/autobiography.test.js b/server/services/autobiography.test.js
index 41482c0cf4..1d000def55 100644
--- a/server/services/autobiography.test.js
+++ b/server/services/autobiography.test.js
@@ -23,7 +23,7 @@ vi.mock('./notifications.js', () => ({
// Mock uuid
let uuidCounter = 0;
-vi.mock('uuid', () => ({
+vi.mock('../lib/uuid.js', () => ({
v4: () => `test-uuid-${++uuidCounter}`
}));
diff --git a/server/services/automationScheduler.js b/server/services/automationScheduler.js
index 3fe8a0fcf1..c6934d60da 100644
--- a/server/services/automationScheduler.js
+++ b/server/services/automationScheduler.js
@@ -6,7 +6,7 @@
*/
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import EventEmitter from 'events';
import { PATHS, createCachedStore } from '../lib/fileUtils.js';
import * as eventScheduler from './eventScheduler.js';
diff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.js
index d2b015b64d..7877571259 100644
--- a/server/services/autonomousJobs.js
+++ b/server/services/autonomousJobs.js
@@ -18,7 +18,7 @@ import { writeFile, readFile, rename, readdir, stat, rm } from 'fs/promises'
import { join, dirname } from 'path'
import { fileURLToPath } from 'url'
import { existsSync } from 'fs'
-import { v4 as uuidv4 } from 'uuid'
+import { v4 as uuidv4 } from '../lib/uuid.js'
import { spawn } from 'child_process'
import { cosEvents } from './cosEvents.js'
import { DAY, ensureDir, HOUR, PATHS, readJSONFile } from '../lib/fileUtils.js'
diff --git a/server/services/brainStorage.js b/server/services/brainStorage.js
index 3f0366fa5a..f78a9a75f0 100644
--- a/server/services/brainStorage.js
+++ b/server/services/brainStorage.js
@@ -10,7 +10,7 @@
import { readFile, writeFile, appendFile } from 'fs/promises';
import { existsSync } from 'fs';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import EventEmitter from 'events';
import { ensureDir, readJSONFile, safeJSONParse, PATHS } from '../lib/fileUtils.js';
import { createMutex } from '../lib/asyncMutex.js';
diff --git a/server/services/calendarAccounts.js b/server/services/calendarAccounts.js
index 16140c8a6b..518d0541de 100644
--- a/server/services/calendarAccounts.js
+++ b/server/services/calendarAccounts.js
@@ -1,6 +1,6 @@
import { writeFile } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, PATHS, readJSONFile } from '../lib/fileUtils.js';
const ACCOUNTS_FILE = join(PATHS.calendar, 'accounts.json');
diff --git a/server/services/calendarApiSync.js b/server/services/calendarApiSync.js
index 5f5f61b489..ca7b2a7e86 100644
--- a/server/services/calendarApiSync.js
+++ b/server/services/calendarApiSync.js
@@ -1,4 +1,4 @@
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import crypto from 'crypto';
import { getToken, clearTokenCache } from './messageTokenExtractor.js';
diff --git a/server/services/calendarGoogleSync.js b/server/services/calendarGoogleSync.js
index 15c9e9f78c..2a169aa4e2 100644
--- a/server/services/calendarGoogleSync.js
+++ b/server/services/calendarGoogleSync.js
@@ -1,4 +1,4 @@
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { createHash } from 'crypto';
import { spawn } from 'child_process';
import { getAccount, updateSyncStatus, updateSubcalendars, mergeDiscoveredSubcalendars } from './calendarAccounts.js';
diff --git a/server/services/cleanupAgentWorktree.test.js b/server/services/cleanupAgentWorktree.test.js
index efc523ee9b..7b72c16b87 100644
--- a/server/services/cleanupAgentWorktree.test.js
+++ b/server/services/cleanupAgentWorktree.test.js
@@ -20,7 +20,7 @@ vi.mock('fs', () => ({
existsSync: vi.fn(() => false)
}));
-vi.mock('uuid', () => ({
+vi.mock('../lib/uuid.js', () => ({
v4: vi.fn(() => 'mock-uuid')
}));
diff --git a/server/services/cos.js b/server/services/cos.js
index 80134739fd..b4044385d3 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -17,7 +17,7 @@ import { join } from 'path';
import { exec, execFile } from 'child_process';
import { execPm2 } from './pm2.js';
import { promisify } from 'util';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { getActiveProvider } from './providers.js';
import { parseTasksMarkdown, groupTasksByStatus, getNextTask, getAutoApprovedTasks, getAwaitingApprovalTasks, updateTaskStatus, generateTasksMarkdown } from '../lib/taskParser.js';
import { isAppOnCooldown, getNextAppForReview, markAppReviewStarted, markIdleReviewStarted } from './appActivity.js';
diff --git a/server/services/cosEvolution.js b/server/services/cosEvolution.js
index 67f58533a3..b1d7d1f87e 100644
--- a/server/services/cosEvolution.js
+++ b/server/services/cosEvolution.js
@@ -12,7 +12,7 @@
import { promises as fs } from 'fs'
import path from 'path'
-import { v4 as uuidv4 } from 'uuid'
+import { v4 as uuidv4 } from '../lib/uuid.js'
import { cosEvents } from './cosEvents.js'
import * as lmStudioManager from './lmStudioManager.js'
import { safeJSONParse, ensureDir, PATHS } from '../lib/fileUtils.js'
diff --git a/server/services/digital-twin.js b/server/services/digital-twin.js
index 3bc0ff3dc0..29b3e3fe88 100644
--- a/server/services/digital-twin.js
+++ b/server/services/digital-twin.js
@@ -12,7 +12,7 @@
import { readFile, writeFile, unlink, readdir, stat } from 'fs/promises';
import { existsSync } from 'fs';
import { join, basename } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import EventEmitter from 'events';
import { getActiveProvider, getProviderById } from './providers.js';
import { buildPrompt } from './promptService.js';
diff --git a/server/services/digital-twin.test.js b/server/services/digital-twin.test.js
index 7b9a606229..f39d435f1d 100644
--- a/server/services/digital-twin.test.js
+++ b/server/services/digital-twin.test.js
@@ -18,7 +18,7 @@ vi.mock('fs', () => ({
}));
let uuidCounter = 0;
-vi.mock('uuid', () => ({
+vi.mock('../lib/uuid.js', () => ({
v4: () => `test-uuid-${++uuidCounter}`
}));
diff --git a/server/services/featureAgents.js b/server/services/featureAgents.js
index 2f23bdcc63..d8ba0de4a5 100644
--- a/server/services/featureAgents.js
+++ b/server/services/featureAgents.js
@@ -9,7 +9,7 @@
import { writeFile, readFile, rename, readdir, rm } from 'fs/promises';
import { join } from 'path';
import { existsSync } from 'fs';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { cosEvents } from './cosEvents.js';
import { ensureDir, PATHS, readJSONFile } from '../lib/fileUtils.js';
import { createMutex } from '../lib/asyncMutex.js';
diff --git a/server/services/feedbackLoop.js b/server/services/feedbackLoop.js
index 5e31177011..774c95ec6c 100644
--- a/server/services/feedbackLoop.js
+++ b/server/services/feedbackLoop.js
@@ -9,7 +9,7 @@
import { readFile, writeFile } from 'fs/promises';
import { existsSync } from 'fs';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, safeJSONParse, PATHS } from '../lib/fileUtils.js';
import { digitalTwinEvents } from './digital-twin.js';
diff --git a/server/services/goalCalendarScheduler.js b/server/services/goalCalendarScheduler.js
index 025f647a0c..196755bdce 100644
--- a/server/services/goalCalendarScheduler.js
+++ b/server/services/goalCalendarScheduler.js
@@ -1,6 +1,6 @@
import { google } from 'googleapis';
import { writeFile } from 'fs/promises';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { join } from 'path';
import { PATHS, readJSONFile, ensureDir } from '../lib/fileUtils.js';
import { ServerError } from '../lib/errorHandler.js';
diff --git a/server/services/goalCheckIn.js b/server/services/goalCheckIn.js
index f5ecbc179f..401f297527 100644
--- a/server/services/goalCheckIn.js
+++ b/server/services/goalCheckIn.js
@@ -1,6 +1,6 @@
import { writeFile } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { PATHS, readJSONFile, ensureDir } from '../lib/fileUtils.js';
import { callProviderAISimple, parseLLMJSON } from '../lib/aiProvider.js';
import { addNotification, NOTIFICATION_TYPES } from './notifications.js';
diff --git a/server/services/history.js b/server/services/history.js
index 291a002e76..554e6ea5ce 100644
--- a/server/services/history.js
+++ b/server/services/history.js
@@ -1,6 +1,6 @@
import { writeFile } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, PATHS, readJSONFile } from '../lib/fileUtils.js';
const DATA_DIR = PATHS.data;
diff --git a/server/services/identity.js b/server/services/identity.js
index 1b1cf58f0d..9da2c220bf 100644
--- a/server/services/identity.js
+++ b/server/services/identity.js
@@ -1,6 +1,6 @@
import { readFile, writeFile } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { PATHS, ensureDir, safeJSONParse } from '../lib/fileUtils.js';
import { ServerError } from '../lib/errorHandler.js';
import { getGenomeSummary } from './genome.js';
diff --git a/server/services/memory.js b/server/services/memory.js
index 7dd4ca569b..79088ff12c 100644
--- a/server/services/memory.js
+++ b/server/services/memory.js
@@ -8,7 +8,7 @@
import { writeFile, readdir, rm } from 'fs/promises';
import { existsSync } from 'fs';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { cosEvents } from './cos.js';
import { findTopK, findAboveThreshold, clusterBySimilarity } from '../lib/vectorMath.js';
import * as notifications from './notifications.js';
diff --git a/server/services/memory.test.js b/server/services/memory.test.js
index 7a9daf0ca6..8f664ee68f 100644
--- a/server/services/memory.test.js
+++ b/server/services/memory.test.js
@@ -14,7 +14,7 @@ vi.mock('fs', () => ({
}));
// Mock uuid
-vi.mock('uuid', () => ({
+vi.mock('../lib/uuid.js', () => ({
v4: vi.fn().mockReturnValue('test-uuid-1234')
}));
diff --git a/server/services/memoryDB.js b/server/services/memoryDB.js
index 03edd34483..3a41be4944 100644
--- a/server/services/memoryDB.js
+++ b/server/services/memoryDB.js
@@ -7,7 +7,7 @@
* Same exported interface as memory.js so routes/consumers don't change.
*/
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { query, withTransaction, pgvectorToArray, arrayToPgvector } from '../lib/db.js';
import { cosEvents } from './cos.js';
import * as notifications from './notifications.js';
diff --git a/server/services/messageAccounts.js b/server/services/messageAccounts.js
index 63d3a49b89..8edc4bfff5 100644
--- a/server/services/messageAccounts.js
+++ b/server/services/messageAccounts.js
@@ -1,6 +1,6 @@
import { readFile, writeFile } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, PATHS, safeJSONParse } from '../lib/fileUtils.js';
const ACCOUNTS_FILE = join(PATHS.messages, 'accounts.json');
diff --git a/server/services/messageApiSync.js b/server/services/messageApiSync.js
index 4e9166222b..c84661e2fc 100644
--- a/server/services/messageApiSync.js
+++ b/server/services/messageApiSync.js
@@ -4,7 +4,7 @@
* Falls back to Playwright scraping if token extraction fails.
*/
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import crypto from 'crypto';
import { getToken } from './messageTokenExtractor.js';
diff --git a/server/services/messageDrafts.js b/server/services/messageDrafts.js
index 29f728cf0a..a318f84b95 100644
--- a/server/services/messageDrafts.js
+++ b/server/services/messageDrafts.js
@@ -1,6 +1,6 @@
import { readFile, writeFile } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, PATHS, safeJSONParse } from '../lib/fileUtils.js';
const DRAFTS_FILE = join(PATHS.messages, 'drafts.json');
diff --git a/server/services/messageGmailSync.js b/server/services/messageGmailSync.js
index 456927f16b..476e276abe 100644
--- a/server/services/messageGmailSync.js
+++ b/server/services/messageGmailSync.js
@@ -4,7 +4,7 @@
*/
import { google } from 'googleapis';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import crypto from 'crypto';
import { getAuthenticatedClient } from './googleAuth.js';
diff --git a/server/services/messagePlaywrightSync.js b/server/services/messagePlaywrightSync.js
index 917109c07b..13aba3ae92 100644
--- a/server/services/messagePlaywrightSync.js
+++ b/server/services/messagePlaywrightSync.js
@@ -1,7 +1,7 @@
import { readFile, writeFile } from 'fs/promises';
import { join } from 'path';
import crypto from 'crypto';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, PATHS, safeJSONParse } from '../lib/fileUtils.js';
import { loadConfig } from './browserService.js';
diff --git a/server/services/missions.js b/server/services/missions.js
index f4f26526d7..0e20170552 100644
--- a/server/services/missions.js
+++ b/server/services/missions.js
@@ -7,7 +7,7 @@
import { promises as fs } from 'fs'
import path from 'path'
-import { v4 as uuidv4 } from 'uuid'
+import { v4 as uuidv4 } from '../lib/uuid.js'
import { cosEvents } from './cosEvents.js'
import { safeJSONParse, ensureDir, PATHS } from '../lib/fileUtils.js'
diff --git a/server/services/notifications.js b/server/services/notifications.js
index ad750d11e9..e60d593bcc 100644
--- a/server/services/notifications.js
+++ b/server/services/notifications.js
@@ -10,7 +10,7 @@
import { writeFile, rename } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { EventEmitter } from 'events';
import { ensureDir, PATHS, readJSONFile } from '../lib/fileUtils.js';
import { createMutex } from '../lib/asyncMutex.js';
diff --git a/server/services/platformAccounts.js b/server/services/platformAccounts.js
index 209188a065..7d990b1e99 100644
--- a/server/services/platformAccounts.js
+++ b/server/services/platformAccounts.js
@@ -7,7 +7,7 @@
*/
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import EventEmitter from 'events';
import { PATHS, createCachedStore } from '../lib/fileUtils.js';
diff --git a/server/services/review.js b/server/services/review.js
index c5fe79d0d8..b74a8f3030 100644
--- a/server/services/review.js
+++ b/server/services/review.js
@@ -7,7 +7,7 @@
import { writeFile, rename, readFile, readdir } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { EventEmitter } from 'events';
import { ensureDir, PATHS, readJSONFile } from '../lib/fileUtils.js';
import { cosEvents } from './cosEvents.js';
diff --git a/server/services/shell.js b/server/services/shell.js
index 48e1a68777..afd1c5fcb0 100644
--- a/server/services/shell.js
+++ b/server/services/shell.js
@@ -1,6 +1,6 @@
import * as pty from 'node-pty';
import os from 'os';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
// Store active shell sessions (persist across socket reconnects)
const shellSessions = new Map();
diff --git a/server/services/socialAccounts.js b/server/services/socialAccounts.js
index 8207a9de1c..7bf32f1b5a 100644
--- a/server/services/socialAccounts.js
+++ b/server/services/socialAccounts.js
@@ -10,7 +10,7 @@
*/
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import EventEmitter from 'events';
import { PATHS, createCachedStore } from '../lib/fileUtils.js';
diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.js
index 852b2fd179..65f95f68df 100644
--- a/server/services/subAgentSpawner.js
+++ b/server/services/subAgentSpawner.js
@@ -11,7 +11,7 @@ import { join, relative, resolve, sep } from 'path';
import { writeFile, mkdir, readFile, readdir, rm, stat, unlink } from 'fs/promises'; // mkdir kept for non-recursive use
import { existsSync } from 'fs';
import { homedir } from 'os';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { cosEvents, emitLog } from './cosEvents.js';
import { registerAgent, updateAgent, completeAgent, appendAgentOutput } from './cosAgents.js';
import { getConfig, updateTask, addTask, getTaskById, checkStagePrecondition } from './cos.js';
diff --git a/server/services/taste-questionnaire.js b/server/services/taste-questionnaire.js
index ab0bbfb92a..2fb44068e1 100644
--- a/server/services/taste-questionnaire.js
+++ b/server/services/taste-questionnaire.js
@@ -9,7 +9,7 @@
import { readFile, writeFile } from 'fs/promises';
import { existsSync } from 'fs';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, safeJSONParse, PATHS } from '../lib/fileUtils.js';
import { getActiveProvider, getProviderById } from './providers.js';
import { buildPrompt } from './promptService.js';
diff --git a/server/services/telegram.js b/server/services/telegram.js
index 52c68cd12f..e363d19162 100644
--- a/server/services/telegram.js
+++ b/server/services/telegram.js
@@ -8,7 +8,7 @@
import TelegramBot from 'node-telegram-bot-api';
import { writeFile, rename } from 'fs/promises';
import { join } from 'path';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { getSettings } from './settings.js';
import { notificationEvents, NOTIFICATION_TYPES, getNotifications } from './notifications.js';
import { approveMemory, rejectMemory } from './memory.js';
diff --git a/server/services/timeCapsule.js b/server/services/timeCapsule.js
index aa0a2944db..e357c1f354 100644
--- a/server/services/timeCapsule.js
+++ b/server/services/timeCapsule.js
@@ -9,7 +9,7 @@ import { readFile, writeFile, unlink, readdir, stat } from 'fs/promises';
import { existsSync } from 'fs';
import { join } from 'path';
import { createHash } from 'crypto';
-import { v4 as uuidv4 } from 'uuid';
+import { v4 as uuidv4 } from '../lib/uuid.js';
import { ensureDir, PATHS } from '../lib/fileUtils.js';
const DIGITAL_TWIN_DIR = PATHS.digitalTwin;
diff --git a/server/services/toolStateMachine.js b/server/services/toolStateMachine.js
index 2ae6213c53..2d173cb5a9 100644
--- a/server/services/toolStateMachine.js
+++ b/server/services/toolStateMachine.js
@@ -5,7 +5,7 @@
* Provides structured error recovery and execution tracking.
*/
-import { v4 as uuidv4 } from 'uuid'
+import { v4 as uuidv4 } from '../lib/uuid.js'
import { cosEvents } from './cosEvents.js'
// Tool execution states