diff --git a/src/gep/assetStore.js b/src/gep/assetStore.js index 9824902a..5a5ec4a7 100644 --- a/src/gep/assetStore.js +++ b/src/gep/assetStore.js @@ -26,14 +26,11 @@ function writeJsonAtomic(filePath, obj) { fs.renameSync(tmp, filePath); } -// Build a robust validation command that works regardless of CWD. -// Resolves module paths relative to the skill root (skills/evolver/). +// Build a validation command using repo-root-relative paths. +// runValidations() executes with cwd=repoRoot, so require('./src/...') +// resolves correctly without embedding machine-specific absolute paths. function buildValidationCmd(relModules) { - const skillRoot = path.resolve(__dirname, '..', '..'); - const checks = relModules.map(m => { - const abs = path.join(skillRoot, m).replace(/\\/g, '/'); - return `require('${abs}')`; - }); + const checks = relModules.map(m => `require('./${m}')`); return `node -e "${checks.join('; ')}; console.log('ok')"`; } @@ -216,14 +213,6 @@ function upsertGene(geneObj) { writeJsonAtomic(genesPath(), { version: current.version || 1, genes }); } -function appendCapsule(capsuleObj) { - ensureSchemaFields(capsuleObj); - const current = readJsonIfExists(capsulesPath(), getDefaultCapsules()); - const capsules = Array.isArray(current.capsules) ? current.capsules : []; - capsules.push(capsuleObj); - writeJsonAtomic(capsulesPath(), { version: current.version || 1, capsules }); -} - function upsertCapsule(capsuleObj) { if (!capsuleObj || capsuleObj.type !== 'Capsule' || !capsuleObj.id) return; ensureSchemaFields(capsuleObj); @@ -263,7 +252,7 @@ module.exports = { loadGenes, loadCapsules, readAllEvents, getLastEventId, appendEventJsonl, appendCandidateJsonl, appendExternalCandidateJsonl, readRecentCandidates, readRecentExternalCandidates, - upsertGene, appendCapsule, upsertCapsule, + upsertGene, upsertCapsule, genesPath, capsulesPath, eventsPath, candidatesPath, externalCandidatesPath, ensureAssetFiles, buildValidationCmd, }; diff --git a/src/gep/envFingerprint.js b/src/gep/envFingerprint.js index 033188c5..55000f01 100644 --- a/src/gep/envFingerprint.js +++ b/src/gep/envFingerprint.js @@ -26,7 +26,7 @@ function captureEnvFingerprint() { platform: process.platform, arch: process.arch, os_release: os.release(), - hostname: os.hostname(), + hostname: crypto.createHash('sha256').update(os.hostname()).digest('hex').slice(0, 12), evolver_version: pkgVersion, cwd: process.cwd(), container: isContainer(), diff --git a/src/gep/solidify.js b/src/gep/solidify.js index aba153fe..b09f65f9 100644 --- a/src/gep/solidify.js +++ b/src/gep/solidify.js @@ -1,7 +1,7 @@ const fs = require('fs'); const path = require('path'); const { execSync } = require('child_process'); -const { loadGenes, upsertGene, appendEventJsonl, appendCapsule, upsertCapsule, getLastEventId } = require('./assetStore'); +const { loadGenes, upsertGene, appendEventJsonl, upsertCapsule, getLastEventId } = require('./assetStore'); const { computeSignalKey, memoryGraphPath } = require('./memoryGraph'); const { computeCapsuleSuccessStreak, isBlastRadiusSafe } = require('./a2a'); const { getRepoRoot, getMemoryDir, getEvolutionDir, getWorkspaceRoot } = require('./paths');