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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review: mlProfile authoritative clearing with sexSource='mortalloom'; tmp file names include UUID for collision safety
Adam Eivyec380f67b269
diff --git a/server/lib/fileUtils.js b/server/lib/fileUtils.jsindex 9d6f77f130..260084c6a2 100644--- a/server/lib/fileUtils.js+++ b/server/lib/fileUtils.js@@ -6,6 +6,7 @@import { mkdir, readFile, writeFile, rename, unlink } from 'fs/promises';import { existsSync } from 'fs';+import { randomUUID } from 'crypto';import { join, dirname } from 'path';import { fileURLToPath } from 'url';@@ -105,7 +106,7 @@ export async function ensureDirs(dirs) {*/export async function atomicWrite(filePath, data) {const payload = typeof data === 'string' ? data : JSON.stringify(data, null, 2);- const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;+ const tmp = `${filePath}.${process.pid}.${Date.now()}.${randomUUID()}.tmp`;await writeFile(tmp, payload);// Node's fs.rename uses MoveFileExW with MOVEFILE_REPLACE_EXISTING on Windows (atomic// overwrite), but still fails with EPERM/EACCES if the destination is locked (AV scan,@@ -114,7 +115,7 @@ export async function atomicWrite(filePath, data) {const err = await rename(tmp, filePath).then(() => null, (e) => e);if (!err) return;if (process.platform === 'win32' && ['EPERM', 'EACCES', 'EEXIST'].includes(err.code)) {- const bak = `${filePath}.${process.pid}.${Date.now()}.bak`;+ const bak = `${filePath}.${process.pid}.${Date.now()}.${randomUUID()}.bak`;const hadExisting = await rename(filePath, bak).then(() => true, (e) => {if (e.code === 'ENOENT') return false;throw e;diff --git a/server/lib/meatspaceValidation.js b/server/lib/meatspaceValidation.jsindex 4867527e7b..4c35c94857 100644--- a/server/lib/meatspaceValidation.js+++ b/server/lib/meatspaceValidation.js@@ -51,7 +51,7 @@ export const lifestyleSchema = z.object({export const configSchema = z.object({sex: z.enum(['male', 'female']).nullable().optional(),- sexSource: z.enum(['genome', 'questionnaire']).nullable().optional(),+ sexSource: z.enum(['genome', 'questionnaire', 'mortalloom']).nullable().optional(),lifestyle: lifestyleSchema.optional()});diff --git a/server/services/meatspace.js b/server/services/meatspace.jsindex 8eeddf4274..03c75da8d6 100644--- a/server/services/meatspace.js+++ b/server/services/meatspace.js@@ -217,11 +217,11 @@ export async function getConfig() {// so edits made in the iOS/macOS app show up here without a manual import.const mlProfile = await mlGetProfileIfEnabled();if (mlProfile) {- if (mlProfile.biologicalSex) {- config.sex = mlProfile.biologicalSex;- config.sexSource = config.sexSource || 'questionnaire';+ if ('biologicalSex' in mlProfile) {+ config.sex = mlProfile.biologicalSex ?? null;+ config.sexSource = 'mortalloom';}- if (mlProfile.birthDate) config.birthDate = mlProfile.birthDate;+ if ('birthDate' in mlProfile) config.birthDate = mlProfile.birthDate ?? null;if (mlProfile.lifestyle && typeof mlProfile.lifestyle === 'object') {config.lifestyle = { ...config.lifestyle, ...mlProfile.lifestyle };}