[object Object]

← back to Wallco Ai

generator: read-only /api/generator/cooldowns — surfaces which categories the tick is skipping for bad-aesthetic cooldown (per-category failure counts + threshold)

5024636d993331923c018088f220b756a2221d0d · 2026-05-31 21:27:36 -0700 · Steve Abrams

Files touched

Diff

commit 5024636d993331923c018088f220b756a2221d0d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sun May 31 21:27:36 2026 -0700

    generator: read-only /api/generator/cooldowns — surfaces which categories the tick is skipping for bad-aesthetic cooldown (per-category failure counts + threshold)
---
 server.js | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/server.js b/server.js
index abf0752..d350b48 100644
--- a/server.js
+++ b/server.js
@@ -20965,6 +20965,30 @@ app.get('/api/generator/palette', (_req, res) => {
   } catch (e) { res.status(500).json({ error: e.message }); }
 });
 
+// Cooldown surfacing — which categories the generator is currently SKIPPING
+// because they've accumulated ≥ GENERATOR_COOLDOWN bad-aesthetic rejections.
+// generator_tick.js silently skips these to stop burning GPU on a failing
+// aesthetic; this read-only endpoint makes that visible (e.g. to show on the
+// wallco-generator loop chip in CNCP). Returns per-category failure counts and
+// a cooldown flag against the same threshold the tick uses.
+app.get('/api/generator/cooldowns', (req, res) => {
+  if (!isAdmin(req)) return res.status(404).json({ error: 'not found' });
+  try {
+    const { loadRows } = require('./lib/bad-aesthetic');
+    const threshold = parseInt(process.env.GENERATOR_COOLDOWN || '50', 10);
+    const counts = {};
+    for (const r of loadRows()) {
+      const c = (r.category || '').toLowerCase();
+      if (!c) continue;
+      counts[c] = (counts[c] || 0) + 1;
+    }
+    const categories = Object.keys(counts)
+      .map(c => ({ category: c, failures: counts[c], cooldown: counts[c] >= threshold }))
+      .sort((a, b) => b.failures - a.failures);
+    res.json({ threshold, cooling_down: categories.filter(x => x.cooldown).map(x => x.category), categories });
+  } catch (e) { res.status(500).json({ error: e.message }); }
+});
+
 // Curator-queue digest — one read-only snapshot of where generator output sits
 // in the pipeline, so the curator backlog is visible at a glance. Counts only
 // machine-generated designs (generator NOT NULL). 'awaiting_review' is the

← f127079 generator: read-only /api/generator/digest — curator-queue s  ·  back to Wallco Ai  ·  READ-ONLY designs.json integrity audit 2026-06-01: clean (no ba89b1e →