Spaces:
Running
Running
echoboi commited on
Commit Β·
bfc20f2
1
Parent(s): a2ab10e
- dashboard.py +38 -40
dashboard.py
CHANGED
|
@@ -73,11 +73,9 @@ h1 { color:#7ecfff; font-size:20px; margin-bottom:12px; border-bottom:1px soli
|
|
| 73 |
.proj-btn:hover { color:#ccc; }
|
| 74 |
.proj-btn.active { font-weight:bold; }
|
| 75 |
.proj-btn[data-project="base_client"] { border-color:#4a9eff; }
|
| 76 |
-
.proj-btn[data-project="
|
| 77 |
-
.proj-btn[data-project="
|
| 78 |
-
.proj-btn[data-project="
|
| 79 |
-
.proj-btn[data-project="alpha_evolve_gpt"].active{ background:#0d1f0d; color:#6fdb6f; }
|
| 80 |
-
.proj-btn[data-project="alpha_evolve"].active { background:#1f170a; color:#f0ad4e; }
|
| 81 |
/* LEAKAGE warning badge β logs from before hint-removal fix */
|
| 82 |
.mc-leakage { font-size:9px; padding:2px 6px; border-radius:3px; font-weight:bold;
|
| 83 |
display:inline-block; margin-top:3px; letter-spacing:.8px;
|
|
@@ -285,8 +283,6 @@ h1 { color:#7ecfff; font-size:20px; margin-bottom:12px; border-bottom:1px soli
|
|
| 285 |
<div class="proj-bar">
|
| 286 |
<button class="proj-btn active" data-project="base_client"
|
| 287 |
onclick="switchProject('base_client')">base_client<span class="proj-count" id="cnt-base_client"></span></button>
|
| 288 |
-
<button class="proj-btn" data-project="alpha_evolve_gpt"
|
| 289 |
-
onclick="switchProject('alpha_evolve_gpt')">alpha_evolve_gpt<span class="proj-count" id="cnt-alpha_evolve_gpt"></span></button>
|
| 290 |
<button class="proj-btn" data-project="alpha_evolve"
|
| 291 |
onclick="switchProject('alpha_evolve')">alpha_evolve<span class="proj-count" id="cnt-alpha_evolve"></span></button>
|
| 292 |
</div>
|
|
@@ -448,9 +444,8 @@ function normAcc(v) {
|
|
| 448 |
|
| 449 |
// ββ State ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 450 |
const projects = {
|
| 451 |
-
base_client:
|
| 452 |
-
|
| 453 |
-
alpha_evolve: { type:'env', agents:{}, active:null, knownIds:new Set(), filter:'all', activeProblem:null },
|
| 454 |
};
|
| 455 |
let activeProject = 'base_client';
|
| 456 |
|
|
@@ -611,19 +606,15 @@ function switchProject(proj) {
|
|
| 611 |
activeProject = proj;
|
| 612 |
document.querySelectorAll('.proj-btn').forEach(b => b.classList.toggle('active', b.dataset.project===proj));
|
| 613 |
const p = projects[proj];
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
} else {
|
| 618 |
-
document.getElementById('env-view').style.display = 'block';
|
| 619 |
-
document.getElementById('evolve-view').style.display = 'none';
|
| 620 |
-
}
|
| 621 |
const f = p.filter || 'all';
|
| 622 |
document.querySelectorAll('.filter-btn').forEach(b => b.classList.toggle('active', b.dataset.filter===f));
|
| 623 |
rebuildProblemBar();
|
| 624 |
rebuildModelGrid();
|
| 625 |
if (p.active) {
|
| 626 |
-
if (
|
| 627 |
else renderEnvAgent(p.active);
|
| 628 |
} else {
|
| 629 |
selectTopModel();
|
|
@@ -634,8 +625,8 @@ function rebuildTabBar() {
|
|
| 634 |
const p = projects[activeProject];
|
| 635 |
document.getElementById('tab-bar').innerHTML = '';
|
| 636 |
p.knownIds = new Set();
|
| 637 |
-
const
|
| 638 |
-
for (const id of Object.keys(items)) _addTabInternal(id);
|
| 639 |
rebuildProblemBar();
|
| 640 |
rebuildModelGrid();
|
| 641 |
if (!p.active) selectTopModel();
|
|
@@ -966,7 +957,8 @@ function renderDoc(elId, content) {
|
|
| 966 |
|
| 967 |
async function pollPhasesAndDocs() {
|
| 968 |
const p = projects[activeProject];
|
| 969 |
-
|
|
|
|
| 970 |
const id = p.active; if (!id) { setTimeout(pollPhasesAndDocs, 2000); return; }
|
| 971 |
const ag = p.agents[id];
|
| 972 |
const srcProj = (ag && ag.sourceProject) || activeProject;
|
|
@@ -1013,32 +1005,37 @@ async function discoverAll() {
|
|
| 1013 |
for (const [proj, ids] of Object.entries(data)) {
|
| 1014 |
const isLeakage = proj === 'leakage_v1' || proj === 'leakage_v2';
|
| 1015 |
const isBase = proj === 'base_client_v1' || proj === 'base_client_v2' || isLeakage;
|
| 1016 |
-
const
|
| 1017 |
-
|
| 1018 |
const prefix = proj === 'base_client_v1' ? 'v1' : proj === 'base_client_v2' ? 'v2'
|
| 1019 |
: proj === 'leakage_v1' ? 'lk1': proj === 'leakage_v2' ? 'lk2' : null;
|
| 1020 |
|
| 1021 |
const p = projects[mergedProj]; if (!p) continue;
|
| 1022 |
-
const store = p.type==='evolve' ? p.runs : p.agents;
|
| 1023 |
for (const rawId of ids) {
|
| 1024 |
const id = prefix ? `${prefix}::${rawId}` : rawId;
|
| 1025 |
-
if (!store[id]) store[id] =
|
| 1026 |
if (mergedProj === activeProject) addTab(id);
|
| 1027 |
}
|
| 1028 |
-
// Update count badge
|
| 1029 |
-
|
| 1030 |
-
|
| 1031 |
-
|
| 1032 |
-
cnt.textContent = total ? `(${total})` : '';
|
| 1033 |
} else {
|
| 1034 |
-
const cnt2 = document.getElementById('cnt-'+
|
| 1035 |
-
if (cnt2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1036 |
}
|
| 1037 |
}
|
| 1038 |
|
| 1039 |
const live = Object.values(projects).flatMap(p => {
|
| 1040 |
-
const
|
| 1041 |
-
return Object.values(
|
| 1042 |
});
|
| 1043 |
document.getElementById('status').innerHTML =
|
| 1044 |
`<span class="status-dot ${live.length?'live':'done'}" id="dot"></span>${live.length} agent(s) running`;
|
|
@@ -1050,7 +1047,8 @@ async function pollActive() {
|
|
| 1050 |
const p = projects[activeProject];
|
| 1051 |
const id = p.active; if (!id) { setTimeout(pollActive,700); return; }
|
| 1052 |
|
| 1053 |
-
|
|
|
|
| 1054 |
const run = p.runs[id]; if (!run || run.done) { setTimeout(pollActive,700); return; }
|
| 1055 |
try {
|
| 1056 |
const r = await fetch(`/api/evolve-log?run=${encodeURIComponent(id)}&offset=${run.offset}`);
|
|
@@ -1064,7 +1062,7 @@ async function pollActive() {
|
|
| 1064 |
renderEvolveRun(id);
|
| 1065 |
} else {
|
| 1066 |
const ag = p.agents[id]; if (!ag || ag.done) { setTimeout(pollActive,700); return; }
|
| 1067 |
-
const srcProj = ag.sourceProject || activeProject;
|
| 1068 |
const rawId = id.replace(/^(?:v[12]|lk[12])::/, '');
|
| 1069 |
try {
|
| 1070 |
const r = await fetch(`/api/log?project=${srcProj}&agent=${encodeURIComponent(rawId)}&offset=${ag.envOffset}`);
|
|
@@ -1099,7 +1097,7 @@ async function pollBackground() {
|
|
| 1099 |
// Poll non-active agents within the active project (so cards show data without needing a click)
|
| 1100 |
const ap = projects[activeProject];
|
| 1101 |
if (ap && ap.type !== 'evolve') {
|
| 1102 |
-
for (const [id, item] of Object.entries(ap.agents)) {
|
| 1103 |
if (id === ap.active || item.done) continue;
|
| 1104 |
const srcProj = item.sourceProject || activeProject;
|
| 1105 |
const rawId = id.replace(/^(?:v[12]|lk[12])::/, '');
|
|
@@ -1117,10 +1115,10 @@ async function pollBackground() {
|
|
| 1117 |
}
|
| 1118 |
for (const [proj, p] of Object.entries(projects)) {
|
| 1119 |
if (proj === activeProject) continue;
|
| 1120 |
-
const
|
| 1121 |
-
for (const [id, item] of Object.entries(store)) {
|
| 1122 |
if (item.done) continue;
|
| 1123 |
-
if (
|
| 1124 |
try {
|
| 1125 |
const r = await fetch(`/api/evolve-log?run=${encodeURIComponent(id)}&offset=${item.offset}`);
|
| 1126 |
if (r.ok) {
|
|
|
|
| 73 |
.proj-btn:hover { color:#ccc; }
|
| 74 |
.proj-btn.active { font-weight:bold; }
|
| 75 |
.proj-btn[data-project="base_client"] { border-color:#4a9eff; }
|
| 76 |
+
.proj-btn[data-project="alpha_evolve"] { border-color:#6fdb6f; }
|
| 77 |
+
.proj-btn[data-project="base_client"].active { background:#0d1a2e; color:#4a9eff; }
|
| 78 |
+
.proj-btn[data-project="alpha_evolve"].active { background:#0d1f0d; color:#6fdb6f; }
|
|
|
|
|
|
|
| 79 |
/* LEAKAGE warning badge β logs from before hint-removal fix */
|
| 80 |
.mc-leakage { font-size:9px; padding:2px 6px; border-radius:3px; font-weight:bold;
|
| 81 |
display:inline-block; margin-top:3px; letter-spacing:.8px;
|
|
|
|
| 283 |
<div class="proj-bar">
|
| 284 |
<button class="proj-btn active" data-project="base_client"
|
| 285 |
onclick="switchProject('base_client')">base_client<span class="proj-count" id="cnt-base_client"></span></button>
|
|
|
|
|
|
|
| 286 |
<button class="proj-btn" data-project="alpha_evolve"
|
| 287 |
onclick="switchProject('alpha_evolve')">alpha_evolve<span class="proj-count" id="cnt-alpha_evolve"></span></button>
|
| 288 |
</div>
|
|
|
|
| 444 |
|
| 445 |
// ββ State ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 446 |
const projects = {
|
| 447 |
+
base_client: { type:'env', agents:{}, active:null, knownIds:new Set(), filter:'all', activeProblem:null },
|
| 448 |
+
alpha_evolve: { type:'mixed', runs:{}, agents:{}, active:null, knownIds:new Set(), filter:'all', activeProblem:null },
|
|
|
|
| 449 |
};
|
| 450 |
let activeProject = 'base_client';
|
| 451 |
|
|
|
|
| 606 |
activeProject = proj;
|
| 607 |
document.querySelectorAll('.proj-btn').forEach(b => b.classList.toggle('active', b.dataset.project===proj));
|
| 608 |
const p = projects[proj];
|
| 609 |
+
const useEvolve = p.type==='evolve' || (p.type==='mixed' && p.active && !!p.runs[p.active]);
|
| 610 |
+
document.getElementById('env-view').style.display = useEvolve ? 'none' : 'block';
|
| 611 |
+
document.getElementById('evolve-view').style.display = useEvolve ? 'block' : 'none';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
const f = p.filter || 'all';
|
| 613 |
document.querySelectorAll('.filter-btn').forEach(b => b.classList.toggle('active', b.dataset.filter===f));
|
| 614 |
rebuildProblemBar();
|
| 615 |
rebuildModelGrid();
|
| 616 |
if (p.active) {
|
| 617 |
+
if (useEvolve) renderEvolveRun(p.active);
|
| 618 |
else renderEnvAgent(p.active);
|
| 619 |
} else {
|
| 620 |
selectTopModel();
|
|
|
|
| 625 |
const p = projects[activeProject];
|
| 626 |
document.getElementById('tab-bar').innerHTML = '';
|
| 627 |
p.knownIds = new Set();
|
| 628 |
+
const itemSets = p.type==='mixed' ? [p.runs, p.agents] : [p.type==='evolve' ? p.runs : p.agents];
|
| 629 |
+
for (const items of itemSets) for (const id of Object.keys(items)) _addTabInternal(id);
|
| 630 |
rebuildProblemBar();
|
| 631 |
rebuildModelGrid();
|
| 632 |
if (!p.active) selectTopModel();
|
|
|
|
| 957 |
|
| 958 |
async function pollPhasesAndDocs() {
|
| 959 |
const p = projects[activeProject];
|
| 960 |
+
const isEnvActive = p && (p.type==='env' || (p.type==='mixed' && p.active && !p.runs[p.active]));
|
| 961 |
+
if (!isEnvActive) { setTimeout(pollPhasesAndDocs, 2000); return; }
|
| 962 |
const id = p.active; if (!id) { setTimeout(pollPhasesAndDocs, 2000); return; }
|
| 963 |
const ag = p.agents[id];
|
| 964 |
const srcProj = (ag && ag.sourceProject) || activeProject;
|
|
|
|
| 1005 |
for (const [proj, ids] of Object.entries(data)) {
|
| 1006 |
const isLeakage = proj === 'leakage_v1' || proj === 'leakage_v2';
|
| 1007 |
const isBase = proj === 'base_client_v1' || proj === 'base_client_v2' || isLeakage;
|
| 1008 |
+
const isEvolveDir = proj === 'alpha_evolve_gpt';
|
| 1009 |
+
const mergedProj = isBase ? 'base_client' : isEvolveDir ? 'alpha_evolve' : proj;
|
| 1010 |
const prefix = proj === 'base_client_v1' ? 'v1' : proj === 'base_client_v2' ? 'v2'
|
| 1011 |
: proj === 'leakage_v1' ? 'lk1': proj === 'leakage_v2' ? 'lk2' : null;
|
| 1012 |
|
| 1013 |
const p = projects[mergedProj]; if (!p) continue;
|
| 1014 |
+
const store = (p.type==='evolve' || isEvolveDir) ? p.runs : p.agents;
|
| 1015 |
for (const rawId of ids) {
|
| 1016 |
const id = prefix ? `${prefix}::${rawId}` : rawId;
|
| 1017 |
+
if (!store[id]) store[id] = isEvolveDir ? newEvolveRun(id) : newEnvAgent(id, proj, isLeakage);
|
| 1018 |
if (mergedProj === activeProject) addTab(id);
|
| 1019 |
}
|
| 1020 |
+
// Update count badge
|
| 1021 |
+
if (isBase) {
|
| 1022 |
+
const cnt = document.getElementById('cnt-base_client');
|
| 1023 |
+
if (cnt) { const t=Object.keys(projects.base_client.agents).length; cnt.textContent=t?`(${t})`:''; }
|
|
|
|
| 1024 |
} else {
|
| 1025 |
+
const cnt2 = document.getElementById('cnt-'+mergedProj);
|
| 1026 |
+
if (cnt2) {
|
| 1027 |
+
const mp = projects[mergedProj];
|
| 1028 |
+
const t = mp.type==='mixed'
|
| 1029 |
+
? Object.keys(mp.runs).length + Object.keys(mp.agents).length
|
| 1030 |
+
: ids.length;
|
| 1031 |
+
cnt2.textContent = t ? `(${t})` : '';
|
| 1032 |
+
}
|
| 1033 |
}
|
| 1034 |
}
|
| 1035 |
|
| 1036 |
const live = Object.values(projects).flatMap(p => {
|
| 1037 |
+
const stores = p.type==='mixed' ? [p.runs, p.agents] : [p.type==='evolve' ? p.runs : p.agents];
|
| 1038 |
+
return stores.flatMap(s => Object.values(s).filter(x=>!x.done));
|
| 1039 |
});
|
| 1040 |
document.getElementById('status').innerHTML =
|
| 1041 |
`<span class="status-dot ${live.length?'live':'done'}" id="dot"></span>${live.length} agent(s) running`;
|
|
|
|
| 1047 |
const p = projects[activeProject];
|
| 1048 |
const id = p.active; if (!id) { setTimeout(pollActive,700); return; }
|
| 1049 |
|
| 1050 |
+
const isEvolveItem = p.type==='evolve' || (p.type==='mixed' && !!p.runs[id]);
|
| 1051 |
+
if (isEvolveItem) {
|
| 1052 |
const run = p.runs[id]; if (!run || run.done) { setTimeout(pollActive,700); return; }
|
| 1053 |
try {
|
| 1054 |
const r = await fetch(`/api/evolve-log?run=${encodeURIComponent(id)}&offset=${run.offset}`);
|
|
|
|
| 1062 |
renderEvolveRun(id);
|
| 1063 |
} else {
|
| 1064 |
const ag = p.agents[id]; if (!ag || ag.done) { setTimeout(pollActive,700); return; }
|
| 1065 |
+
const srcProj = ag.sourceProject || (p.type==='mixed' ? 'alpha_evolve' : activeProject);
|
| 1066 |
const rawId = id.replace(/^(?:v[12]|lk[12])::/, '');
|
| 1067 |
try {
|
| 1068 |
const r = await fetch(`/api/log?project=${srcProj}&agent=${encodeURIComponent(rawId)}&offset=${ag.envOffset}`);
|
|
|
|
| 1097 |
// Poll non-active agents within the active project (so cards show data without needing a click)
|
| 1098 |
const ap = projects[activeProject];
|
| 1099 |
if (ap && ap.type !== 'evolve') {
|
| 1100 |
+
for (const [id, item] of Object.entries(ap.type==='mixed' ? ap.agents : ap.agents)) {
|
| 1101 |
if (id === ap.active || item.done) continue;
|
| 1102 |
const srcProj = item.sourceProject || activeProject;
|
| 1103 |
const rawId = id.replace(/^(?:v[12]|lk[12])::/, '');
|
|
|
|
| 1115 |
}
|
| 1116 |
for (const [proj, p] of Object.entries(projects)) {
|
| 1117 |
if (proj === activeProject) continue;
|
| 1118 |
+
const bgStores = p.type==='mixed' ? [[p.runs,true],[p.agents,false]] : [[p.type==='evolve'?p.runs:p.agents, p.type==='evolve']];
|
| 1119 |
+
for (const [store, isEv] of bgStores) for (const [id, item] of Object.entries(store)) {
|
| 1120 |
if (item.done) continue;
|
| 1121 |
+
if (isEv) {
|
| 1122 |
try {
|
| 1123 |
const r = await fetch(`/api/evolve-log?run=${encodeURIComponent(id)}&offset=${item.offset}`);
|
| 1124 |
if (r.ok) {
|