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
add click-to-enlarge lightbox for reference-set images
[._.]/ Adam Eivyf4ad9d12507c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 55bc15aa07..e2951d114e 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -19,6 +19,7 @@- **Seed a character's main reference from an existing sprite, an upload, or your render history — and fork a character from its reference** — the "design image (optional)" upload on the main-reference form is now a three-way **Reference image** picker: upload a file, pick one from your image render-history gallery, or pick another sprite that already has a locked reference, each with a fidelity slider controlling how tightly the render follows it (image+text→image). Separately, a locked reference is immutable and can never be regenerated — so a character with a frozen main now shows a **Fork from this reference** button that spins up a brand-new character whose main is generated from this one's reference plus a prompt describing the change ("same character but in a red coat"), then opens the new sprite. New endpoints `GET /api/sprites/reference-sources` and `POST /api/sprites/:id/fork`.- **The Sprite Manager opens on a full Library catalog, with rename and delete built in** — landing on the Sprite Manager now shows the **Library** itself: a searchable, grouped grid of every character/place/object, each card carrying a real preview thumbnail — a character's locked main reference, or, for a place/object (or a character with no reference yet), the first image asset on disk, falling back to a kind icon only when there's no image at all — instead of jumping you straight into one sprite. The catalog is the `/sprites` route (not a modal buried behind a button), so it's directly linkable, and each card gives you full record control: click to open it, the pencil to **rename** in place (for records whose generated name you want to fix), or the trash to **delete** behind a cautious inline Cancel/Delete confirm (a delete drops the record from your library; its files stay on disk and its id stays reserved). The same **rename** and **delete** controls sit in a sprite's detail header, so you can fix or remove the one you're looking at without going back to the grid (deleting it returns you there). Search, **New Sprite**, and **Import** live in the page header (New Sprite/Import are modals), the left sidebar is gone so the catalog and detail panes run full width, and opening a sprite shows a **Library** link back to the grid. The per-character workspace tab that used to read "Library" is now **Assets**, since "Library" means the catalog. New endpoint `GET /api/sprites/thumbnails`.+- **Click any reference-set image to enlarge it** — the Reference Set's inline thumbnails (the frozen main reference, each locked directional anchor, and every generation candidate) are now click-to-zoom: clicking one opens a large, pixel-perfect preview over the same checkerboard the asset inspector uses, so you can actually judge a candidate before locking it instead of squinting at a thumbnail. Previews elsewhere are unaffected unless they opt in.- **Atlas manifests are folded into the atlas, not a confusing "Manifests" shelf** — a character's asset library used to show a separate **Manifests** group of near-identical JSON cards sitting apart from the sprite-sheet PNGs they describe, so it was never clear that each manifest is just the build metadata for one atlas version. Manifests are no longer their own group: a runtime atlas card gains a **Manifest** button that opens its sidecar (the geometry, chroma key, and source provenance the compiler recorded), and the inspector now says plainly that it's behind-the-scenes metadata removed together with its atlas. The other internal JSON (publish pointers, run records, the reference-set manifest) no longer appears as inert cards at all. Nothing changes on disk — manifests are still written and still deleted as a unit with their atlas version.- **Every walk direction is trimmable now, whatever produced it** — a direction whose art came from the source pipeline's older video-first "redraw" path (pioneer's *east* being the case in the wild) showed its "approved ✓" card with no **Edit in Loop Trimmer** link, because loop trimming was wired only to grok-generated runs. The Loop Trimmer now resolves any run's geometry from the run's own manifest/strip regardless of where it was authored, so imported and redraw directions are trimmable exactly like native ones — the link appears on every direction that has a packed strip. (Saved trims stay preview-only; there's no run behind them to re-trim.)- **Sprite runs are stored vendor-neutrally** — under the hood, PortOS used to file its own walk generations under a `grok/` directory, baking one provider into the on-disk layout. Runs now live under a neutral `runs/` tree with the provider recorded as run metadata instead, so future agent services or generation methods slot in without a storage change and nothing downstream (trimming, atlas compile, publish, backups) assumes a vendor. Existing installs are migrated automatically on upgrade: each character's `grok/<run>/` directories are renamed to `runs/<run>/`, every embedded path is rewritten, and the checksums that pin the finalized walk set + compiled atlas are recomputed so a re-compile stays a no-op — your published atlases are unaffected. Imported/redraw characters and the atlas image bytes are left untouched.diff --git a/client/src/components/sprites/ReferenceWorkflow.jsx b/client/src/components/sprites/ReferenceWorkflow.jsxindex 46cde31aa6..34df32fda7 100644--- a/client/src/components/sprites/ReferenceWorkflow.jsx+++ b/client/src/components/sprites/ReferenceWorkflow.jsx@@ -23,9 +23,12 @@ const CHROMA_KEYS = ['#FF00FF', '#00FF00', '#0000FF'];// Thin alias so the existing call sites keep their `className` semantics// (sizing on the box) while the checkerboard + pixelation rules live in one-// place — see SpritePreview.+// place — see SpritePreview. Every reference-set image is click-to-enlarge+// (zoomable) — the main reference, locked anchors, and candidate tiles all open+// a SpriteLightbox on click, since none of them live in the asset browser that+// has its own inspector.function SpriteImg({ recordId, path, className }) {- return <SpritePreview recordId={recordId} path={path} className={className} />;+ return <SpritePreview recordId={recordId} path={path} className={className} zoomable />;}// Candidate thumbnail with an inline lock confirm (locking is irreversible —diff --git a/client/src/components/sprites/SpriteLightbox.jsx b/client/src/components/sprites/SpriteLightbox.jsxnew file mode 100644index 0000000000..65bef6aab0--- /dev/null+++ b/client/src/components/sprites/SpriteLightbox.jsx@@ -0,0 +1,54 @@+/**+ * Enlarged preview of a single sprite asset — the click-to-zoom surface for the+ * inline sprite thumbnails (reference set, anchors, candidates) that aren't in+ * the asset browser (which has its own richer AssetInspector). Mirrors that+ * inspector's framing — solid card over a dense backdrop, checkerboarded box,+ * pixel-preserving image — but with no metadata/actions, just the big picture.+ *+ * Inlines the checkerboard + <img> rather than reusing SpritePreview so the two+ * don't form an import cycle (SpritePreview opens this on zoom); the shared+ * spriteAssets helpers keep the checker-on-box rule identical.+ */++import { X } from 'lucide-react';+import Modal from '../ui/Modal.jsx';+import { checkerboardStyle, spriteAssetUrl, PIXELATED } from './spriteAssets.js';++export default function SpriteLightbox({ recordId, path, alt, onClose }) {+ const fileName = path.split('/').pop();+ return (+ <Modal+ open+ onClose={onClose}+ size="2xl"+ ariaLabel={`Preview ${path}`}+ backdropClassName="bg-black/90"+ panelClassName="bg-port-card border border-port-border rounded-lg p-3 shadow-2xl"+ >+ <div className="space-y-2">+ <div className="flex items-center justify-between gap-3">+ <h3 className="text-xs font-semibold text-white break-all">{fileName}</h3>+ <button+ type="button"+ onClick={onClose}+ aria-label="Close preview"+ className="shrink-0 text-gray-400 hover:text-white"+ >+ <X className="w-4 h-4" />+ </button>+ </div>+ <span+ className="block overflow-hidden rounded border border-port-border"+ style={checkerboardStyle(12)}+ >+ <img+ src={spriteAssetUrl(recordId, path)}+ alt={alt ?? path}+ className="mx-auto max-w-full max-h-[75vh] object-contain"+ style={PIXELATED}+ />+ </span>+ </div>+ </Modal>+ );+}diff --git a/client/src/components/sprites/SpritePreview.jsx b/client/src/components/sprites/SpritePreview.jsxindex de9e6df7fd..4943cbbca7 100644--- a/client/src/components/sprites/SpritePreview.jsx+++ b/client/src/components/sprites/SpritePreview.jsx@@ -11,7 +11,9 @@* element is shared instead.*/+import { useState } from 'react';import { checkerboardStyle, spriteAssetUrl, PIXELATED } from './spriteAssets.js';+import SpriteLightbox from './SpriteLightbox.jsx';export default function SpritePreview({recordId,@@ -21,19 +23,45 @@ export default function SpritePreview({imgClassName = 'w-full h-full object-contain',cell = 6,loading = 'lazy',+ // Opt in to click-to-enlarge: the checkerboard box becomes a button that+ // opens a SpriteLightbox. Off by default so a preview nested inside another+ // interactive element (e.g. a catalog card that's itself a button) stays a+ // plain <span> and never nests buttons.+ zoomable = false,}) {+ const [zoomed, setZoomed] = useState(false);+ const img = (+ <img+ src={spriteAssetUrl(recordId, path)}+ alt={alt ?? path}+ loading={loading}+ className={imgClassName}+ style={PIXELATED}+ />+ );++ if (!zoomable) {+ return (+ <span className={`block overflow-hidden ${className}`} style={checkerboardStyle(cell)}>+ {img}+ </span>+ );+ }+return (- <span- className={`block overflow-hidden ${className}`}- style={checkerboardStyle(cell)}- >- <img- src={spriteAssetUrl(recordId, path)}- alt={alt ?? path}- loading={loading}- className={imgClassName}- style={PIXELATED}- />- </span>+ <>+ <button+ type="button"+ onClick={() => setZoomed(true)}+ aria-label={`Enlarge ${alt || path}`}+ className={`block overflow-hidden cursor-zoom-in ${className}`}+ style={checkerboardStyle(cell)}+ >+ {img}+ </button>+ {zoomed && (+ <SpriteLightbox recordId={recordId} path={path} alt={alt} onClose={() => setZoomed(false)} />+ )}+ </>);}diff --git a/client/src/components/sprites/SpritePreview.test.jsx b/client/src/components/sprites/SpritePreview.test.jsxnew file mode 100644index 0000000000..bc14a294f1--- /dev/null+++ b/client/src/components/sprites/SpritePreview.test.jsx@@ -0,0 +1,33 @@+/**+ * SpritePreview — the one way to render a sprite asset. Covers the default+ * (plain checkerboarded image, no interactivity) and the opt-in `zoomable`+ * path, which turns the box into a button that opens a SpriteLightbox.+ */++import { describe, it, expect } from 'vitest';+import { render, screen } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import SpritePreview from './SpritePreview.jsx';++describe('SpritePreview', () => {+ it('renders a non-interactive image by default', () => {+ render(<SpritePreview recordId="field-medic" path="reference/main.png" />);+ expect(screen.getByRole('img')).toHaveAttribute('src', '/data/sprites/field-medic/reference/main.png');+ expect(screen.queryByRole('button')).not.toBeInTheDocument();+ });++ it('opens an enlarged lightbox when zoomable and clicked', async () => {+ render(<SpritePreview recordId="field-medic" path="reference/walk-south-v1.png" zoomable />);++ const trigger = screen.getByRole('button', { name: /Enlarge/ });+ expect(screen.queryByRole('button', { name: 'Close preview' })).not.toBeInTheDocument();++ await userEvent.click(trigger);+ expect(screen.getByRole('button', { name: 'Close preview' })).toBeInTheDocument();+ // The lightbox shows the file name and the enlarged image.+ expect(screen.getByText('walk-south-v1.png')).toBeInTheDocument();++ await userEvent.click(screen.getByRole('button', { name: 'Close preview' }));+ expect(screen.queryByRole('button', { name: 'Close preview' })).not.toBeInTheDocument();+ });+});