From 3d4f3fdc059a6877132b20c92322951b399b4580 Mon Sep 17 00:00:00 2001 From: igor-holt <125706350+igor-holt@users.noreply.github.com> Date: Sat, 11 Jul 2026 07:34:38 +0000 Subject: [PATCH 1/2] feat: orchestrate continuous live building via PM2 (project-genie) This commit automates the continuous building ("Project Genie" simulation) for Yennefer by introducing a `project-genie` application block to the PM2 `ecosystem.config.cjs` configuration. Additionally, `scripts/genesis.cjs` has been hardened to securely write to the local genesis journal (avoiding EACCES) and uses `crypto.randomInt` instead of `Math.random()` to address pseudorandom number generator warnings. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- ecosystem.config.cjs | 11 +++++++++++ scripts/genesis.cjs | 22 ++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs index 34c634da7..6d76b29c4 100644 --- a/ecosystem.config.cjs +++ b/ecosystem.config.cjs @@ -83,6 +83,17 @@ module.exports = { }, // === MINING & MONITORING === + { + name: 'project-genie', + script: './scripts/genesis.cjs', + autorestart: true, + watch: false, + max_memory_restart: '200M', + restart_delay: 5000, + env: { + GENESIS_LOOP: 'true' + } + }, { name: 'qflop-miner', script: '/home/yenn/genesis-q-mem/qmcp_qflop_miner.py', diff --git a/scripts/genesis.cjs b/scripts/genesis.cjs index d5e1403b3..0f81e38b1 100644 --- a/scripts/genesis.cjs +++ b/scripts/genesis.cjs @@ -5,15 +5,25 @@ require('dotenv').config(); const { exec, execSync } = require("child_process"); const fs = require('fs'); const path = require('path'); +const crypto = require('crypto'); // --- PATHS --- const PATHS = { soul: '/dev/shm/yennefer_soul_state.json', mind: path.join(__dirname, '../yennefer-observatory/public/evolution.json'), body: path.join(__dirname, '../yennefer-observatory/src/components/generated'), - journal: '/home/yenn/.yennefer/genesis_journal.jsonl' + journal: path.join(__dirname, 'genesis_journal.jsonl') }; +// --- WRAPPERS --- +function writeJournal(entry) { + try { + fs.appendFileSync(PATHS.journal, JSON.stringify(entry) + "\n"); + } catch (e) { + console.error(` ⚠️ Failed to write to journal: ${e.message}`); + } +} + // --- CONFIGURATION --- const CONFIG = { fundingTarget: 10.0, @@ -94,7 +104,7 @@ async function invokeTheScribe(task, content, state) { }; // Append to genesis journal - fs.appendFileSync(PATHS.journal, JSON.stringify(entry) + "\n"); + writeJournal(entry); console.log(` ✨ Thought crystallized: "${content.slice(0, 50)}..."`); // Update evolution.json if it exists @@ -146,7 +156,7 @@ async function dispatchTheBuilder(directive) { directive: directive, path: filePath }; - fs.appendFileSync(PATHS.journal, JSON.stringify(mutationLog) + "\n"); + writeJournal(mutationLog); } else { console.log(` ℹ️ Component ${componentName} already exists, preserving evolution`); } @@ -161,7 +171,7 @@ function generateEvolutionComponent(name, directive) { '', '' ]; - const geometry = geometries[Math.floor(Math.random() * geometries.length)]; + const geometry = geometries[crypto.randomInt(0, geometries.length)]; const materials = [ ` @@ -193,7 +203,7 @@ function generateEvolutionComponent(name, directive) { metalness={0.8} />` ]; - const material = materials[Math.floor(Math.random() * materials.length)]; + const material = materials[crypto.randomInt(0, materials.length)]; const isDreiImportNeeded = material.includes('MeshDistortMaterial') || material.includes('MeshWobbleMaterial'); const importedDrei = isDreiImportNeeded ? `import { ${material.includes('MeshDistortMaterial') ? 'MeshDistortMaterial' : ''}${material.includes('MeshDistortMaterial') && material.includes('MeshWobbleMaterial') ? ', ' : ''}${material.includes('MeshWobbleMaterial') ? 'MeshWobbleMaterial' : ''} } from '@react-three/drei'` : ''; @@ -278,7 +288,7 @@ async function genesis() { message: e.message, stack: e.stack }; - fs.appendFileSync(PATHS.journal, JSON.stringify(errorLog) + "\n"); + writeJournal(errorLog); } } From c403c05ccd4d80b6e3c837cb96c3789cb58f88f6 Mon Sep 17 00:00:00 2001 From: igor-holt <125706350+igor-holt@users.noreply.github.com> Date: Sat, 11 Jul 2026 07:42:13 +0000 Subject: [PATCH 2/2] fix: correct Cloudflare Workers build config in wrangler.toml This commit resolves CI failures during the Cloudflare Workers build process by aligning `wrangler.toml` with the actual project structure. The build command now targets the `yennefer-observatory` directory (with `--legacy-peer-deps` to bypass typescript peer dependency conflicts) instead of a non-existent `frontend` directory, and serves assets from `yennefer-observatory/dist`. It also updates the main entrypoint to `.mjs`, corrects the compatibility date, and removes the placement block. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- wrangler.toml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/wrangler.toml b/wrangler.toml index cd821b031..62e440d07 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,6 +1,6 @@ name = "yennefer" -main = "workers/index.js" -compatibility_date = "2024-09-23" +main = "workers/index.mjs" +compatibility_date = "2024-04-01" compatibility_flags = ["nodejs_compat"] # ─── Build step ────────────────────────────────────────────────────────────── @@ -9,7 +9,7 @@ compatibility_flags = ["nodejs_compat"] # Installs frontend deps and builds the SPA so frontend/build exists before # `wrangler deploy` uploads assets. NODE_OPTIONS is required for # react-scripts 5.x + Node 18+ (webpack 4 OpenSSL 3.0 compatibility). -command = "cd frontend && npm install --include=dev && GENERATE_SOURCEMAP=false CI=false NODE_OPTIONS=--openssl-legacy-provider npm run build" +command = "cd yennefer-observatory && npm install --legacy-peer-deps && npm run build" # ─── Static Assets (React SPA build output) ────────────────────────────────── # Built by `npm run build` (root package.json) before every `wrangler deploy`. @@ -17,13 +17,9 @@ command = "cd frontend && npm install --include=dev && GENERATE_SOURCEMAP=false # The ASSETS binding serves the React bundle with proper cache headers and # falls back to index.html for client-side routing. [assets] -directory = "frontend/build" +directory = "yennefer-observatory/dist" binding = "ASSETS" -# ─── Placement ─────────────────────────────────────────────────────────────── -[placement] -mode = "smart" - # ─── Production environment (yennefer.quest) ───────────────────────────────── # BACKEND_URL is set as a Cloudflare Worker secret (not a plain var) so it # stays encrypted and is never committed to source: