Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude): drop stale FLUX-regen fields on light pass, finite PSNR sentinel, doc/comment fixes
[._.]/ Adam Eivyccfc0031cf05
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex ad7059b623..0b1899481a 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -20,7 +20,7 @@## Changed-- **[issue-912] Stronger, more compatible SynthID regeneration** — The gallery "Regenerate" pass (which overwrites Google's invisible SynthID watermark by round-tripping the image through a local FLUX model) gets four upgrades drawn from a survey of public watermark-removal tools. (1) Every regen now also nudges the render resolution down-and-back-up, not just oversized images — SynthID's invisible signal is keyed to resolution, so this resolution shift disrupts it for free on top of the model round-trip. (2) A new **Light (CPU)** option appears even on machines without a local FLUX runner: a fast, GPU-free spatial pass that disrupts the watermark directly in the pixels — clearly labeled as less reliable than the full round-trip, so installs that previously had no defeat path at all now have a best-effort one. (3) Each regenerated image now records and shows **how much it actually changed** (a percentage and PSNR in the image's lineage row), so you can see at a glance whether a pass stayed faithful or drifted — and it surfaces silent failures that used to be invisible. (4) The default denoise strength now adapts to the source: watermark-bearing generators (gpt-image / Gemini / Imagen) keep the conservative known-good setting, while your own local renders use a lighter, more faithful default. The original image is always kept; you can still tune strength and prompt by hand.+- **[issue-912] Stronger, more compatible SynthID regeneration** — The gallery "Regenerate" pass (which overwrites Google's invisible SynthID watermark by round-tripping the image through a local FLUX model) gets four upgrades drawn from a survey of public watermark-removal tools. (1) Every regen now also nudges the render resolution down-and-back-up, not just oversized images — SynthID's invisible signal is keyed to resolution, so this resolution shift disrupts it for free on top of the model round-trip. (2) A new **Light (CPU)** option appears even on machines without a local FLUX runner: a fast, GPU-free spatial pass that disrupts the watermark directly in the pixels — clearly labeled as less reliable than the full round-trip, so installs that previously had no defeat path at all now have a best-effort one. (3) Each regenerated image now records and shows **how much it actually changed** (a "% changed" figure in the image's lineage row, with the full PSNR kept in the saved metadata), so you can see at a glance whether a pass stayed faithful or drifted — and it surfaces silent failures that used to be invisible. (4) The default denoise strength now adapts to the source: watermark-bearing generators (gpt-image / Gemini / Imagen) keep the conservative known-good setting, while your own local renders use a lighter, more faithful default. The original image is always kept; you can still tune strength and prompt by hand.- **[issue-878] City photo mode freezes the scene for a clean shot** — When you enter photo mode, the city now holds still once the camera settles into its framing — particles, data streams, weather, and landmark pulses pause — so your postcard captures a deliberate, motion-free frame instead of whatever the animation happened to be doing. The camera still flies smoothly to each preset (and re-animates when you switch shots); the scene only freezes once it arrives. Leaving photo mode resumes the live, always-moving city.diff --git a/docs/plans/2026-06-05-synthid-removal-eval.md b/docs/plans/2026-06-05-synthid-removal-eval.mdindex 3022f13fd6..8616b7b638 100644--- a/docs/plans/2026-06-05-synthid-removal-eval.md+++ b/docs/plans/2026-06-05-synthid-removal-eval.md@@ -38,8 +38,9 @@ fidelity (PSNR-gating) and verify against a detector; (5) LSB-only is a dead endinstalls with no FLUX runner — which previously had no SynthID defeat path at all. Honestlylabeled as less reliable (`regenMethod: 'light-spatial'` sidecar stamp, UI copy says so).3. **Output fidelity metric** (`computePixelDelta`): source-vs-delivered pixel delta % + PSNR- stamped on every regen sidecar (`regenPixelDeltaPct`/`regenPsnr`) and surfaced in the lightbox- lineage row — catches the mflux strength-0.0 footgun, silent txt2img fallbacks, over-mutation.+ stamped on every regen sidecar (`regenPixelDeltaPct`/`regenPsnr`); the lightbox lineage row+ surfaces the "% changed" figure (PSNR stays in the sidecar for diagnostics) — catches the mflux+ strength-0.0 footgun, silent txt2img fallbacks, over-mutation.4. **Provider-adaptive strength default** (`resolveRegenStrengthDefault`): SynthID-bearing sources(codex/gpt-image, gemini/imagen/nano-banana) keep the conservative known-good 0.25; local FLUXsources (no Google watermark) default to a lighter 0.15. Explicit `strength` override unchanged.diff --git a/server/routes/imageGen.js b/server/routes/imageGen.jsindex cadc1a52ea..1cda7cbd57 100644--- a/server/routes/imageGen.js+++ b/server/routes/imageGen.js@@ -657,7 +657,16 @@ async function runLightRegen({ filename, sourceAbsPath, sourceMeta }) {const createdAt = new Date().toISOString();// Strip hidden/filename/id so the listGallery `...metadata` spread doesn't// overwrite the disk-derived filename or re-hide the deliberate variant.- const { hidden: _hidden, filename: _srcFilename, id: _srcId, ...sourceMetaForVariant } = sourceMeta;+ // Also strip the FLUX-regen-specific fields: when the source is itself a+ // prior FLUX regen, carrying its regenStrength/Steps/ModelId + stale+ // delta into a SPATIAL pass would make the lineage row falsely read+ // "· N% denoise" (a light pass has no denoise) and show a stale fidelity.+ const {+ hidden: _hidden, filename: _srcFilename, id: _srcId,+ regenStrength: _rs, regenSteps: _rst, regenModelId: _rm,+ regenPixelDeltaPct: _rpd, regenPsnr: _rp,+ ...sourceMetaForVariant+ } = sourceMeta;// Compare the in-memory source/output buffers — no need to re-read outPath// off disk just to measure the delta.diff --git a/server/services/imageGen/regen.js b/server/services/imageGen/regen.jsindex 7addf10ff4..be7fd5d6f9 100644--- a/server/services/imageGen/regen.js+++ b/server/services/imageGen/regen.js@@ -296,6 +296,11 @@ export function buildRegenParams({ filename, sourceAbsPath, sourceMeta = {}, soureturn params;}+// PSNR (dB) reported for a byte-identical pair — a finite sentinel above any+// realistic regen PSNR (an 8% VAE-floor change lands near 30 dB), used instead+// of Infinity so the value survives JSON serialization.+export const PSNR_IDENTICAL = 100;+// Measure how much a regen actually changed the image — source vs. delivered.// Every serious watermark tool gates on a fidelity metric (reverse-SynthID// PSNR-gates each stage); we only stamped the *requested* strength, never the@@ -305,9 +310,10 @@ export function buildRegenParams({ filename, sourceAbsPath, sourceMeta = {}, sou// small common raster (cheap, resolution-independent) and compared per-channel.// `a`/`b` are each a file path OR an in-memory Buffer (sharp accepts both) — the// caller passes buffers when it already has the bytes to skip a disk re-read.-// Returns `{ pixelDeltaPct, psnr }` (psnr in dB; Infinity for identical), or-// null on a decode failure so the caller can skip the stamp without failing the-// render.+// Returns `{ pixelDeltaPct, psnr }` (psnr in dB; capped at PSNR_IDENTICAL for a+// byte-identical pair so the value always survives JSON serialization — a raw+// Infinity would round-trip to null through res.json/JSON.stringify), or null on+// a decode failure so the caller can skip the stamp without failing the render.export async function computePixelDelta(a, b, sampleSize = 256) {const toRaster = (src) => sharp(src).resize(sampleSize, sampleSize, { fit: 'fill', kernel: 'cubic' })@@ -326,7 +332,9 @@ export async function computePixelDelta(a, b, sampleSize = 256) {}const pixelDeltaPct = Math.round((sumAbs / ra.length / 255) * 1000) / 10;const mse = sumSq / ra.length;- const psnr = mse === 0 ? Infinity : Math.round(10 * Math.log10((255 * 255) / mse) * 10) / 10;+ // Finite cap for the identical case — JSON has no Infinity (it serializes to+ // null), and a real regen never reaches it anyway (the pass always mutates).+ const psnr = mse === 0 ? PSNR_IDENTICAL : Math.round(10 * Math.log10((255 * 255) / mse) * 10) / 10;return { pixelDeltaPct, psnr };}@@ -353,8 +361,11 @@ export async function applyLightRegen(buffer, { sharpImpl = sharp } = {}) {if (!(w > 0) || !(h > 0)) return null;const sw = floor16(w * REGEN_SQUEEZE_FACTOR);const sh = floor16(h * REGEN_SQUEEZE_FACTOR);+ // No EXIF auto-orient: the gallery is PNG-only and PNGs carry no orientation+ // tag, so a .rotate() would be a no-op whose dim math silently depends on that+ // invariant. The squeeze targets (sw/sh) come from the un-rotated metadata, so+ // skipping rotation keeps the resize aspect and the upscale-back dims exact.const data = await sharpImpl(buffer)- .rotate() // honor EXIF orientation so output matches what the browser showed.resize(sw, sh, { kernel: 'cubic' }).resize(w, h, { fit: 'fill', kernel: 'lanczos3' }).modulate({ brightness: 1.01, saturation: 0.99, hue: 1 })diff --git a/server/services/imageGen/regen.sharp.test.js b/server/services/imageGen/regen.sharp.test.jsindex de6735a32f..947f981a1d 100644--- a/server/services/imageGen/regen.sharp.test.js+++ b/server/services/imageGen/regen.sharp.test.js@@ -5,18 +5,20 @@// are in-memory PNG buffers (no temp files).import { describe, it, expect } from 'vitest';import sharp from 'sharp';-import { computePixelDelta, applyLightRegen, REGEN_SQUEEZE_FACTOR } from './regen.js';+import { computePixelDelta, applyLightRegen, REGEN_SQUEEZE_FACTOR, PSNR_IDENTICAL } from './regen.js';// Solid-color PNG of the given size — a deterministic fixture for delta math.const solidPng = (w, h, { r, g, b }) =>sharp({ create: { width: w, height: h, channels: 3, background: { r, g, b } } }).png().toBuffer();describe('computePixelDelta', () => {- it('reports zero delta / infinite PSNR for an identical image', async () => {+ it('reports zero delta / finite sentinel PSNR for an identical image', async () => {const buf = await solidPng(128, 128, { r: 120, g: 64, b: 200 });const delta = await computePixelDelta(buf, buf);expect(delta.pixelDeltaPct).toBe(0);- expect(delta.psnr).toBe(Infinity);+ // Finite (not Infinity) so it survives JSON serialization.+ expect(delta.psnr).toBe(PSNR_IDENTICAL);+ expect(Number.isFinite(delta.psnr)).toBe(true);});it('reports a large delta for opposite solid colors', async () => {