Skip to content

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

feat([issue-912]): in-lightbox regen controls (strength slider + optional prompt) + lower floor

[._.]/ Adam Eivybdc1e9853f33
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index eee7c08f79..dc6f79e97e 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -14,7 +14,7 @@
- **[issue-842] Turn a draft into a Creative Director project from the editor** — With live mode enabled in Writers Room, a new "CD Bridge" panel can read the prose around your cursor and propose a short film treatment — a logline, synopsis, an overall visual style, and a handful of filmable scenes (each with its own shot description and duration). Review it in the panel and send it into a brand-new Creative Director project in one click, then jump straight to it via an "Open in Creative Director" link on the work menu. It never overwrites an existing project, and it shares the same opt-in and daily suggestion budget as the inline continuation suggestions.
- **[issue-715] "Why am I seeing this?" chips across Chief of Staff, Goals, and the dashboard** — The same provenance chip now appears wherever PortOS shows you something it derived rather than something you set. The Chief of Staff's actionable-insights banner explains how its top item was derived — a live count of your records (pending approvals, blocked tasks) reads as data-backed, while a success-rate-driven suggestion reads as inferred. A goal's detail panel marks its urgency and activity-budget readings as modeled from your health timeline and linked activities — not numbers you entered — so a derived reading never reads as a fact you stated. On the dashboard, the Proactive Alerts card declares its alerts are inferred from trends in your goals, costs, and system metrics, while the Decision Log card declares its entries are read straight from the ledger of choices the Chief of Staff actually made. Tap any chip for how it was derived and what would change it.
- **[issue-952] Cinematic depth-of-field in City photo mode** — Photo mode now blurs the background for a cinematic look: whatever the current framing points at stays sharp while the rest of the city falls off softly, and each preset focuses on its own subject (the low-angle shot uses a shallower, more dramatic focus). It's on by default; toggle it with the "Depth" button in the photo bar or the D key, and your captured postcard matches what you see. Depth-of-field only runs while you're in photo mode, so the live dashboard is unaffected.
-- **[issue-912] Regenerate gallery images to defeat SynthID watermarks** — Generated images gain a "Regenerate" action in the lightbox, next to "Clean", whenever a local FLUX image generator is installed. The existing Clean only strips embedded provenance metadata and can't touch SynthID — Google's invisible per-pixel watermark — which survives by design. Regenerate is the honest defeat path: it round-trips the picture through a local FLUX model so the watermark signal is overwritten by fresh sampling, while keeping the change to the image as small as possible — it uses no prompt and a low denoise, so the result is a near-faithful copy of the original rather than a reinterpretation. It runs entirely on-device, is never applied automatically, and saves the result as a new variant beside the original (which is kept); the lightbox's variant switch lets you toggle between them. Very large source images (e.g. 4K) are handled by regenerating at a model-friendly resolution and scaling the clean result back up to the original size, so a big image no longer stalls the pass.
+- **[issue-912] Regenerate gallery images to defeat SynthID watermarks** — Generated images gain a "Regenerate" action in the lightbox, next to "Clean", whenever a local FLUX image generator is installed. The existing Clean only strips embedded provenance metadata and can't touch SynthID — Google's invisible per-pixel watermark — which survives by design. Regenerate is the honest defeat path: it round-trips the picture through a local FLUX model so the watermark signal is overwritten by fresh sampling, while keeping the change to the image as small as possible — it uses no prompt and a low denoise, so the result is a near-faithful copy of the original rather than a reinterpretation. It runs entirely on-device, is never applied automatically, and saves the result as a new variant beside the original (which is kept); the lightbox's variant switch lets you toggle between them. Very large source images (e.g. 4K) are handled by regenerating at a model-friendly resolution and scaling the clean result back up to the original size, so a big image no longer stalls the pass. The Regenerate button opens an inline panel with a strength slider (lower = more faithful) and an optional prompt field, so you can dial in how much the pass changes the image — or paste a prompt for a creative re-roll — right from the lightbox.
- **[issue-877] City records its history for a future timeline scrubber** — The City now quietly snapshots its own state on a schedule (every 5 minutes by default), capturing which apps are online, how many agents are working, system health, and the other landmark readouts. These frames accumulate locally — never synced to peers — so an upcoming timeline view can let you scrub back and watch the city change over time. There's nothing to interact with yet; this is the recording groundwork. You can tune the capture interval, set how many frames to keep, or turn it off in settings.
## Changed
diff --git a/client/src/components/media/MediaLightbox.jsx b/client/src/components/media/MediaLightbox.jsx
index afbd67e2c7..a365f509d4 100644
--- a/client/src/components/media/MediaLightbox.jsx
+++ b/client/src/components/media/MediaLightbox.jsx
@@ -80,6 +80,7 @@ export default function MediaLightbox({
onClean,
onRegenerate,
regenAvailable = false,
+ regenBounds = null,
onPrevious,
onNext,
hasPrevious = false,
@@ -323,6 +324,7 @@ export default function MediaLightbox({
onClean={onClean}
onRegenerate={onRegenerate}
regenAvailable={regenAvailable}
+ regenBounds={regenBounds}
copy={copy}
onRefine={() => setRefineOpen(true)}
annotation={annotation}
@@ -364,7 +366,7 @@ function PeerNotes({ others }) {
function SettingsPane({
item, meta, isVideo,
- onClose, onRemix, onSendToVideo, onContinue, onClean, onRegenerate, regenAvailable,
+ onClose, onRemix, onSendToVideo, onContinue, onClean, onRegenerate, regenAvailable, regenBounds,
copy, onRefine,
annotation, onAnnotationChange,
variantGroup, onSelectVariant,
@@ -372,6 +374,30 @@ function SettingsPane({
const asideClasses = 'md:w-80 lg:w-96 shrink-0 flex flex-col border-t md:border-t-0 md:border-l border-port-border max-h-[40vh] md:max-h-[92vh]';
const [cleaning, setCleaning] = useState(false);
const [regenerating, setRegenerating] = useState(false);
+ // Regen controls: the button toggles an inline panel (strength slider +
+ // optional prompt) so a watermark-defeat pass can be tuned without leaving the
+ // lightbox. Slider bounds come from the server (`regenBounds`) so the floor
+ // stays in lock-step with route validation.
+ const regenMin = typeof regenBounds?.strengthMin === 'number' ? regenBounds.strengthMin : 0.02;
+ const regenMax = typeof regenBounds?.strengthMax === 'number' ? regenBounds.strengthMax : 0.6;
+ const regenDefault = typeof regenBounds?.strengthDefault === 'number' ? regenBounds.strengthDefault : 0.25;
+ const [regenOpen, setRegenOpen] = useState(false);
+ const [regenStrength, setRegenStrength] = useState(regenDefault);
+ const [regenPrompt, setRegenPrompt] = useState('');
+ const runRegen = async () => {
+ if (regenerating) return;
+ setRegenerating(true);
+ let ok = false;
+ try {
+ await onRegenerate(item, { strength: regenStrength, prompt: regenPrompt.trim() || undefined });
+ ok = true;
+ } catch {
+ // Caller toasts its own error; stay open so the user can retry.
+ } finally {
+ setRegenerating(false);
+ }
+ if (ok) onClose();
+ };
const starred = !!annotation?.starred;
const closeThenRun = (handler) => {
onClose?.();
@@ -625,15 +651,59 @@ function SettingsPane({
{!isVideo && onRegenerate && regenAvailable && (
<button
type="button"
- disabled={regenerating}
- onClick={runBusyAction(regenerating, setRegenerating, onRegenerate)}
+ onClick={() => setRegenOpen((o) => !o)}
+ aria-expanded={regenOpen}
title="Regenerate through a local FLUX model (img2img) to overwrite SynthID watermarking. Creates a new variant; the original is kept."
aria-label="Regenerate image to defeat SynthID watermark"
- className="flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs bg-port-accent/80 text-white hover:opacity-90 rounded disabled:opacity-50 disabled:cursor-not-allowed"
+ className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs text-white hover:opacity-90 rounded ${regenOpen ? 'bg-port-accent' : 'bg-port-accent/80'}`}
>
- <Wand2 className="w-3.5 h-3.5" /> {regenerating ? 'Queuing…' : 'Regenerate'}
+ <Wand2 className="w-3.5 h-3.5" /> Regenerate
</button>
)}
+ {!isVideo && onRegenerate && regenAvailable && regenOpen && (
+ <div className="w-full mt-1 p-2.5 rounded border border-port-border bg-port-bg/60 space-y-2">
+ <div>
+ <div className="flex items-center justify-between mb-1">
+ <label htmlFor="regen-strength" className="text-[11px] uppercase tracking-wide text-gray-400">Strength</label>
+ <span className="text-xs text-gray-200 tabular-nums">{regenStrength.toFixed(2)}</span>
+ </div>
+ <input
+ id="regen-strength"
+ type="range"
+ min={regenMin}
+ max={regenMax}
+ step={0.01}
+ value={regenStrength}
+ onChange={(e) => setRegenStrength(Number(e.target.value))}
+ disabled={regenerating}
+ className="w-full accent-port-accent"
+ />
+ <p className="mt-1 text-[10px] leading-snug text-gray-500">
+ Lower = more faithful (a re-encode floor of ~8% change). The watermark is overwritten by the round-trip regardless; raise it only if a low value doesn’t clear your detector.
+ </p>
+ </div>
+ <div>
+ <label htmlFor="regen-prompt" className="block mb-1 text-[11px] uppercase tracking-wide text-gray-400">Prompt <span className="normal-case text-gray-500">(optional)</span></label>
+ <input
+ id="regen-prompt"
+ type="text"
+ value={regenPrompt}
+ onChange={(e) => setRegenPrompt(e.target.value)}
+ disabled={regenerating}
+ placeholder="Leave empty for minimal change"
+ className="w-full px-2 py-1 text-xs rounded bg-port-card border border-port-border text-gray-100 placeholder:text-gray-600 focus:outline-none focus:border-port-accent"
+ />
+ </div>
+ <button
+ type="button"
+ disabled={regenerating}
+ onClick={runRegen}
+ className="w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs bg-port-accent text-white hover:opacity-90 rounded disabled:opacity-50 disabled:cursor-not-allowed"
+ >
+ <Wand2 className="w-3.5 h-3.5" /> {regenerating ? 'Queuing…' : `Regenerate at ${regenStrength.toFixed(2)}`}
+ </button>
+ </div>
+ )}
{isVideo && onContinue && (
<button
type="button"
diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsx
index 14ef2d54fe..d567ad2cff 100644
--- a/client/src/pages/ImageGen.jsx
+++ b/client/src/pages/ImageGen.jsx
@@ -250,9 +250,12 @@ export default function ImageGen() {
// Re-checked on mount AND when the Settings drawer closes (via
// reloadBackends) so installing the FLUX venv mid-session reveals the action
// without a hard reload, matching how the other backend gates refresh.
- const [regenAvailable, setRegenAvailable] = useState(false);
+ // Full availability payload ({ available, strengthMin/Max/Default, … }) so the
+ // lightbox slider reads its bounds from the server.
+ const [regenInfo, setRegenInfo] = useState(null);
+ const regenAvailable = !!regenInfo?.available;
const refreshRegenAvailability = useCallback(() => {
- getRegenAvailability().then((r) => setRegenAvailable(!!r?.available)).catch(() => {});
+ getRegenAvailability().then((r) => setRegenInfo(r || null)).catch(() => {});
}, []);
useEffect(() => { refreshRegenAvailability(); }, [refreshRegenAvailability]);
@@ -834,9 +837,9 @@ export default function ImageGen() {
// FLUX render: it returns a job ack, and the finished variant lands in the
// gallery via the queue-completion refresh (useMediaCompletionRefresh /
// pollQueue). Bump pendingQueued so the queue indicator + 4s poll engage.
- const handleRegenerate = async (img) => {
+ const handleRegenerate = async (img, opts = {}) => {
if (!img?.filename) throw new Error('Missing filename');
- await regenerateGalleryImage(img.filename).catch((err) => {
+ await regenerateGalleryImage(img.filename, { strength: opts.strength, prompt: opts.prompt }).catch((err) => {
toast.error(err.message || 'Failed to start regeneration');
throw err;
});
@@ -1318,8 +1321,9 @@ export default function ImageGen() {
onRemix={(item) => item?.raw && handleRemix(item.raw)}
onSendToVideo={(item) => item?.raw?.filename && sendToVideo(item.raw)}
onClean={(item) => handleClean(item?.raw)}
- onRegenerate={(item) => handleRegenerate(item?.raw)}
+ onRegenerate={(item, opts) => handleRegenerate(item?.raw, opts)}
regenAvailable={regenAvailable}
+ regenBounds={regenInfo}
/>
diff --git a/client/src/services/apiImageVideo.js b/client/src/services/apiImageVideo.js
index cb34a9d72d..296da771f8 100644
--- a/client/src/services/apiImageVideo.js
+++ b/client/src/services/apiImageVideo.js
@@ -30,13 +30,18 @@ export const cleanGalleryImage = (filename) => request(`/image-gen/${encodeURICo
// of a gallery image; returns the queue ack ({ jobId, position, ... }) — the
// finished render lands in the gallery via the normal queue-completion refresh.
// `silent` so the lightbox owns its own error toast (single-layer rule).
-export const regenerateGalleryImage = (filename, { strength, steps } = {}) =>
+export const regenerateGalleryImage = (filename, { strength, steps, prompt } = {}) =>
request(`/image-gen/${encodeURIComponent(filename)}/regenerate`, {
method: 'POST',
- body: JSON.stringify({ ...(strength != null ? { strength } : {}), ...(steps != null ? { steps } : {}) }),
+ body: JSON.stringify({
+ ...(strength != null ? { strength } : {}),
+ ...(steps != null ? { steps } : {}),
+ ...(prompt != null ? { prompt } : {}),
+ }),
silent: true,
});
-// Whether the local FLUX regen backend is installed (hardware gate). `{ available, modelId, reason }`.
+// Whether the local FLUX regen backend is installed (hardware gate). Also carries
+// the strength slider bounds: `{ available, modelId, reason, strengthMin, strengthMax, strengthDefault }`.
export const getRegenAvailability = () => request('/image-gen/regen/availability', { silent: true });
// HuggingFace token (gated local Flux models). Stored in settings.imageGen.hfToken;
diff --git a/server/routes/imageGen.js b/server/routes/imageGen.js
index f49f1ead40..9533d8ae89 100644
--- a/server/routes/imageGen.js
+++ b/server/routes/imageGen.js
@@ -148,11 +148,14 @@ const avatarSchema = z.object({
prompt: z.string().max(2000).optional(),
});
-// SynthID-defeat regen (issue #912). Body is optional — both fields default
-// server-side (strength → DEFAULT_REGEN_STRENGTH, steps → the model default).
+// SynthID-defeat regen (issue #912). Body is optional — every field defaults
+// server-side (strength → DEFAULT_REGEN_STRENGTH, steps → the model default,
+// prompt → empty for minimal mutation). An empty/whitespace `prompt` is treated
+// as "no prompt" by buildRegenParams, so the UI can send '' for the default.
const regenerateSchema = z.object({
strength: z.number().min(REGEN_STRENGTH_MIN).max(REGEN_STRENGTH_MAX).optional(),
steps: z.number().int().min(1).max(50).optional(),
+ prompt: z.string().max(8000).optional(),
});
router.get('/status', asyncHandler(async (req, res) => {
@@ -660,6 +663,7 @@ router.post('/:filename/regenerate', asyncHandler(async (req, res) => {
pythonPath: backend.pythonPath,
strength,
steps: body.steps,
+ promptOverride: body.prompt,
});
const queued = enqueueJob({ kind: 'image', params });
console.log(`♻️ Regenerating ${filename} via ${backend.model.id} (strength=${strength}) → job ${queued.jobId.slice(0, 8)}`);
diff --git a/server/routes/imageGen.test.js b/server/routes/imageGen.test.js
index 7ef341dd5d..4da199d8ed 100644
--- a/server/routes/imageGen.test.js
+++ b/server/routes/imageGen.test.js
@@ -802,6 +802,18 @@ describe('Image Gen Routes', () => {
expect(response.body.available).toBe(true);
expect(typeof response.body.modelId).toBe('string');
});
+
+ it('carries the strength slider bounds for the lightbox control', async () => {
+ const response = await request(app).get('/api/image-gen/regen/availability');
+ expect(typeof response.body.strengthMin).toBe('number');
+ expect(typeof response.body.strengthMax).toBe('number');
+ expect(typeof response.body.strengthDefault).toBe('number');
+ // Floor is a small positive value (strength 0 is the degenerate
+ // ignore-the-init-image case), and the default sits within the bounds.
+ expect(response.body.strengthMin).toBeGreaterThan(0);
+ expect(response.body.strengthDefault).toBeGreaterThanOrEqual(response.body.strengthMin);
+ expect(response.body.strengthDefault).toBeLessThanOrEqual(response.body.strengthMax);
+ });
});
describe('POST /api/image-gen/:filename/regenerate', () => {
diff --git a/server/services/imageGen/regen.js b/server/services/imageGen/regen.js
index f46aae4eb5..cadda1612c 100644
--- a/server/services/imageGen/regen.js
+++ b/server/services/imageGen/regen.js
@@ -42,7 +42,16 @@ const IS_WIN = process.platform === 'win32';
// minimum their SynthID detector still clears. Tune the default once that floor
// is known.
export const DEFAULT_REGEN_STRENGTH = 0.25;
-export const REGEN_STRENGTH_MIN = 0.1;
+// Floor is a small POSITIVE value, not 0. Empirically, mflux special-cases
+// strength 0.0 as "ignore the init image" — it regenerates a fresh, near-random
+// image (~49% pixel change) instead of round-tripping the source, which defeats
+// the whole point. 0.02 is the lowest value that still does a faithful pass; in
+// the 0.02–0.25 range the change is a flat ~8% (the VAE round-trip's own
+// reconstruction error — the irreducible minimum for this approach), so
+// "minimal processing" is already reached at the low end. The default stays at
+// a known-good 0.25 until a lower value is confirmed to still clear a SynthID
+// detector.
+export const REGEN_STRENGTH_MIN = 0.02;
export const REGEN_STRENGTH_MAX = 0.6;
// FLUX runs self-attention over latent tokens (~pixels/256) and the cost is
@@ -160,13 +169,17 @@ export async function resolveRegenBackend({ sourceModelId } = {}) {
}
// Slim shape for the UI gate — drives whether the lightbox shows the
-// Regenerate action at all.
+// Regenerate action, and carries the strength bounds so the in-lightbox slider
+// stays in lock-step with server validation (one place to tune the floor).
export async function getRegenAvailability() {
const resolved = await resolveRegenBackend();
return {
available: resolved.available,
modelId: resolved.model?.id || null,
reason: resolved.available ? null : resolved.reason,
+ strengthMin: REGEN_STRENGTH_MIN,
+ strengthMax: REGEN_STRENGTH_MAX,
+ strengthDefault: DEFAULT_REGEN_STRENGTH,
};
}