Files
APAW/agent-evolution/scripts/rebuild-template.cjs
¨NW¨ 3badb259cc feat: bidirectional research dashboard + agent config fixes
- Integrate apaw_agent_model_research_v3.html as standalone dashboard
- Add model-benchmarks.json with 32 agents, 11 scored models, 11 recommendations
- Add build-research-dashboard.ts: inject live data into template → standalone HTML
- Add rebuild-template.cjs: regenerate template from v3.html source
- Add sync-benchmarks-from-yaml.cjs: sync YAML → JSON round-trip
- Add sync-model-research.ts: apply recommendation matrix to config files
- Add model-benchmarks.schema.json and model-research.schema.json for validation
- Add bidirectional-data-flow.md architecture documentation
- Add log-execution.cjs pipeline hook
- Update capability-index.yaml: add fallback_models, failover_strategy
- Update kilo-meta.json, kilo.jsonc, KILO_SPEC.md with synced models
- Update evolution.md / research.md / self-evolution.md / evolutionary-sync.md docs
- Fix security-auditor.md: quote YAML color (#DC2626)
- Fix orchestrator.md: remove duplicate devops-engineer key
- Build research-dashboard.html (106KB standalone) + dated archive
2026-04-29 21:04:22 +01:00

75 lines
3.3 KiB
JavaScript

const fs = require('fs');
const v3 = fs.readFileSync('agent-evolution/ideas/apaw_agent_model_research_v3.html', 'utf8');
const dataStart = v3.indexOf('// ACTUAL STATE from _kilo.zip');
const renderStart = v3.indexOf('// ======================= RENDER =======================');
if (dataStart === -1 || renderStart === -1) {
console.error('Cannot find markers');
process.exit(1);
}
const mapping = `// BENCHMARK_DATA_PLACEHOLDER - will be replaced by build script
const EMBEDDED_DATA = {};
// === MAP EMBEDDED_DATA -> original v3 format ===
const allModels = EMBEDDED_DATA.models || [];
const scoreModelIds = Object.keys((EMBEDDED_DATA.agent_model_scores || [])[0]?.scores || {});
const activeModels = allModels.filter(m => scoreModelIds.includes(m.id));
const cfg = (EMBEDDED_DATA.agent_current_config || []).map(c => {
const modelId = (c.model || '').replace('ollama-cloud/', '');
const badge = c.badge_type || (
modelId.includes('qwen3') ? 'qwen' :
modelId.includes('minimax') ? 'minimax' :
modelId.includes('nemotron') ? 'nemotron' :
modelId.includes('glm') ? 'glm' :
modelId.includes('kimi') ? 'kimi' :
modelId.includes('deepseek') ? 'deepseek' : 'groq'
);
return { a: c.agent, m: modelId, p: c.provider || 'Ollama', cat: c.category || 'General', b: badge, fit: c.fit_score || 0, s: c.status || 'good', prev: c.previous_model };
});
const groqModels = (EMBEDDED_DATA.groq_models || []).map(g => ({
id: g.id, rpm: g.rpm, rpd: g.rpd, tpm: g.tpm, tpd: g.tpd, speed: g.speed, use: g.use_case
}));
const ollamaModels = activeModels.map(m => ({
n: m.name, org: m.organization, par: m.parameters, ctx: m.context_window,
swe: m.swe_bench, ifScore: m.if_score, cat: m.categories || [],
str: m.description, tags: m.tags || [], or: m.openrouter, groqSpeed: m.speed_tps
}));
const ifScores = {};
activeModels.forEach((m, i) => { if (m.if_score) ifScores[i] = m.if_score; });
const hmModels = activeModels.map(m => ({
n: m.display_name || m.name?.split(' ').pop() || m.id,
p: m.provider === 'ollama-cloud' ? 'Ollama Cloud' : m.provider === 'openrouter' ? 'OpenRouter' : m.provider || 'Ollama',
if: m.if_score || 0
}));
const hmAgents = (EMBEDDED_DATA.agent_model_scores || []).map(ag => {
const scores = activeModels.map(m => ag.scores?.[m.id] ?? 0);
const fullModelId = allModels[ag.current_model_index]?.id;
const c = activeModels.findIndex(m => m.id === fullModelId);
return { n: ag.agent, c: c, re: ag.reasoning_effort || 'M', s: scores };
});
const recs = (EMBEDDED_DATA.recommendations || []).map(r => ({
a: r.agent, from: r.from_model, fromP: r.from_provider || 'Ollama',
to: r.to_model, toP: r.to_provider || 'Ollama', imp: r.impact || 'low',
q: r.quality_change || '0', sp: r.speed_change || '=', ctx: r.context_change || '-',
prov: r.provider_change || r.to_provider || 'Ollama', r: r.rationale
}));
const impactData = (EMBEDDED_DATA.impact_data || []).map(d => ({
cat: d.category, b: d.before, a: d.after, d: d.delta, n: d.notes || d.note
}));
`;
const final = v3.substring(0, dataStart) + mapping + v3.substring(renderStart);
fs.writeFileSync('agent-evolution/research-dashboard.template.html', final);
console.log('Template written:', final.length, 'chars,', final.split('\n').length, 'lines');