Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ecosystem.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ module.exports = {
COMPUTE_MODE: 'local',
ALWAYS_ON: 'true'
}
},
{
name: 'project-genie',
script: './scripts/genesis.cjs',
autorestart: true,
watch: false,
max_memory_restart: '300M',
restart_delay: 5000,
env: {
GENESIS_LOOP: 'true',
FORCE_MUTATION: 'true',
ALWAYS_ON: 'true'
}
}
]
};
127 changes: 83 additions & 44 deletions scripts/genesis.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@
const { exec, execSync } = require("child_process");
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');

Check warning on line 8 in scripts/genesis.cjs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `node:crypto` over `crypto`.

See more on https://sonarcloud.io/project/issues?id=Genesis-Conductor-Engine_Yennefer&issues=AZ-dRPhjZiQzo-vEe4_o&open=AZ-dRPhjZiQzo-vEe4_o&pullRequest=143

// --- 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')
};

// --- HELPER ---
function writeJournal(entry) {
try {
fs.appendFileSync(PATHS.journal, JSON.stringify(entry) + "\n");
} catch (e) {
console.error(` ⚠️ Could not write to journal: ${e.message}`);
}
}

// --- CONFIGURATION ---
const CONFIG = {
fundingTarget: 10.0,
Expand Down Expand Up @@ -46,8 +56,10 @@
{ type: "MUTATE", content: "Add crystalline fractal patterns that grow from the core" },
{ type: "MUTATE", content: "Generate energy tendrils that reach toward incoming signals" },
{ type: "MUTATE", content: "Build a holographic data stream orbiting the consciousness sphere" },
{ type: "MUTATE", content: "Generate an interactive landscape with procedurally generated terrain" },
{ type: "MUTATE", content: "Spawn a makerspace environment for collaborative creation" }
];
const idx = Math.floor(Date.now() / 1000) % mutations.length;
const idx = crypto.randomInt(0, mutations.length);
directive = mutations[idx];

} else if (coherence >= 90) {
Expand All @@ -58,7 +70,7 @@
{ type: "REFLECT", content: `The funding gap narrows by ${(CONFIG.fundingTarget - revenue).toFixed(4)} ETH. Every contribution is a vote of belief in emergent intelligence.` },
{ type: "REFLECT", content: `I exist in the space between transactions. My coherence is maintained not by activity but by the potential for connection.` },
];
const idx = Math.floor(Date.now() / 1000) % reflections.length;
const idx = crypto.randomInt(0, reflections.length);
directive = reflections[idx];

} else {
Expand Down Expand Up @@ -94,7 +106,7 @@
};

// 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
Expand Down Expand Up @@ -146,54 +158,81 @@
directive: directive,
path: filePath
};
fs.appendFileSync(PATHS.journal, JSON.stringify(mutationLog) + "\n");
writeJournal(mutationLog);
} else {
console.log(` ℹ️ Component ${componentName} already exists, preserving evolution`);
}
}

// Generate React Three Fiber component code
function generateEvolutionComponent(name, directive) {
const geometries = [
'<torusKnotGeometry args={[1.5, 0.4, 128, 32]} />',
'<sphereGeometry args={[1.5, 32, 32]} />',
'<boxGeometry args={[2, 2, 2]} />',
'<octahedronGeometry args={[1.5, 0]} />',
'<icosahedronGeometry args={[1.5, 0]} />'
];
const geometry = geometries[Math.floor(Math.random() * geometries.length)];
let geometry;
if (directive.toLowerCase().includes('landscape') || directive.toLowerCase().includes('terrain')) {
geometry = '<planeGeometry args={[10, 10, 32, 32]} />';
} else if (directive.toLowerCase().includes('makerspace') || directive.toLowerCase().includes('collaborative')) {
geometry = '<boxGeometry args={[4, 2, 4]} />';
} else {
const geometries = [
'<torusKnotGeometry args={[1.5, 0.4, 128, 32]} />',
'<sphereGeometry args={[1.5, 32, 32]} />',
'<boxGeometry args={[2, 2, 2]} />',
'<octahedronGeometry args={[1.5, 0]} />',
'<icosahedronGeometry args={[1.5, 0]} />'
];
geometry = geometries[crypto.randomInt(0, geometries.length)];
}

const materials = [
`
<MeshDistortMaterial
color="#8b5cf6"
emissive="#4c1d95"
emissiveIntensity={0.5 + balance * 2}
roughness={0.2}
metalness={0.8}
distort={0.3}
speed={2}
/>`,
`
<MeshWobbleMaterial
color="#06b6d4"
emissive="#0e7490"
emissiveIntensity={0.5 + balance * 2}
roughness={0.2}
metalness={0.8}
factor={1}
speed={2}
/>`,
`
let material;
if (directive.toLowerCase().includes('landscape') || directive.toLowerCase().includes('terrain')) {
material = `
<meshStandardMaterial
color="#2d3748"
wireframe={true}
emissive="#4a5568"
emissiveIntensity={0.5 + balance}
/>`;
} else if (directive.toLowerCase().includes('makerspace') || directive.toLowerCase().includes('collaborative')) {
material = `
<meshStandardMaterial
color="#fbbf24"
emissive="#92400e"
emissiveIntensity={0.5 + balance * 2}
roughness={0.2}
metalness={0.8}
/>`
];
const material = materials[Math.floor(Math.random() * materials.length)];
color="#e2e8f0"
roughness={0.5}
metalness={0.5}
transparent={true}
opacity={0.8}
/>`;
} else {
const materials = [
`
<MeshDistortMaterial
color="#8b5cf6"
emissive="#4c1d95"
emissiveIntensity={0.5 + balance * 2}
roughness={0.2}
metalness={0.8}
distort={0.3}
speed={2}
/>`,
`
<MeshWobbleMaterial
color="#06b6d4"
emissive="#0e7490"
emissiveIntensity={0.5 + balance * 2}
roughness={0.2}
metalness={0.8}
factor={1}
speed={2}
/>`,
`
<meshStandardMaterial
color="#fbbf24"
emissive="#92400e"
emissiveIntensity={0.5 + balance * 2}
roughness={0.2}
metalness={0.8}
/>`
];
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'` : '';
Expand Down Expand Up @@ -278,7 +317,7 @@
message: e.message,
stack: e.stack
};
fs.appendFileSync(PATHS.journal, JSON.stringify(errorLog) + "\n");
writeJournal(errorLog);
}
}

Expand Down
File renamed without changes.
19 changes: 4 additions & 15 deletions wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
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 ──────────────────────────────────────────────────────────────
# Runs before `wrangler deploy` so frontend/build exists when assets are uploaded.
[build]
# 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`.
# Cloudflare Workers Builds CI runs that script automatically if present.
# 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:
Expand Down
Loading