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 (codex): lock competing headshot controls during a render
[._.]/ Adam Eivy22c146819f85
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 805396a206..5c47599d30 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,7 +2,7 @@## Added-- **Generate an author headshot from the persona's description + style** — The Authors editor's headshot field gains a **Generate** button alongside Upload and Choose from gallery: it folds the author's **physical description** (the subject) and **headshot style** (the art direction) into one portrait prompt and renders through the existing image-gen system, dropping the result straight into the headshot slot. The button stays disabled until at least one of those fields is filled. While a render is in flight the thumbnail shows the live diffusion preview and step percentage (async local/codex backends); the synchronous external SD-API backend lands the image directly. Switching authors mid-render cancels the in-flight tracking so a completed render can't write the wrong persona's headshot. (`client/src/pages/Authors.jsx`)+- **Generate an author headshot from the persona's description + style** — The Authors editor's headshot field gains a **Generate** button alongside Upload and Choose from gallery: it folds the author's **physical description** (the subject) and **headshot style** (the art direction) into one portrait prompt and renders through the existing image-gen system, dropping the result straight into the headshot slot. The button stays disabled until at least one of those fields is filled. While a render is in flight the thumbnail shows the live diffusion preview and step percentage (async local/codex backends), and the Upload / gallery / URL controls lock so a manual choice can't be clobbered when the render lands; the synchronous external SD-API backend lands the image directly. Switching authors mid-render cancels the in-flight tracking so a completed (or still-pending) render can't write the wrong persona's headshot. (`client/src/pages/Authors.jsx`)- **Author personas — manage reusable authors and pick one for a series** — Create gains an **Authors** page (`/authors`, reachable from the sidebar and ⌘K) for managing reusable author personas: each carries a **name**, **writing style**, **bio**, a **physical description** and a **headshot style** (the prompt inputs for generating a book-cover author headshot), plus an optional **headshot image** you can **upload** (a photo from your device), **choose from your image gallery** (the same searchable picker the image-gen page uses), or paste a URL into — with a live thumbnail preview and one-click clear. The Series Pipeline's author field — previously a free-text byline on both the create form and the series bible — is now an **author picker** that lists your personas: selecting one stores the persona link (`authorId`) **and** the denormalized byline string on the series, so covers and title screens still render the right name. Picking "— No author —" clears it; a legacy free-text byline with no linked persona is shown as a hint until you link one. Authors are stored in PostgreSQL (`authors` table, `db-primary`); they're local-only for now (a federated peer renders a synced series' byline from the string it carries) — cross-machine sync of the personas themselves is tracked as a follow-up. (`server/services/authors/`, `server/routes/authors.js`, `server/scripts/init-db.sql`, `server/lib/db.js`, `server/services/pipeline/series.js`, `client/src/pages/Authors.jsx`, `client/src/components/pipeline/AuthorPicker.jsx`, `client/src/services/apiAuthors.js`, `client/src/components/Layout.jsx`, `server/lib/navManifest.js`)diff --git a/client/src/pages/Authors.jsx b/client/src/pages/Authors.jsxindex e6e372b897..2069653550 100644--- a/client/src/pages/Authors.jsx+++ b/client/src/pages/Authors.jsx@@ -404,7 +404,7 @@ export default function Authors() {<buttontype="button"onClick={() => fileInputRef.current?.click()}- disabled={uploadingHeadshot}+ disabled={uploadingHeadshot || isGenerating}className="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg bg-port-bg border border-port-border text-white text-sm hover:border-port-accent disabled:opacity-50">{uploadingHeadshot ? <Loader2 size={14} className="animate-spin" /> : <Upload size={14} />}@@ -413,7 +413,8 @@ export default function Authors() {<buttontype="button"onClick={() => setGalleryOpen(true)}- className="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg bg-port-bg border border-port-border text-white text-sm hover:border-port-accent"+ disabled={isGenerating}+ className="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg bg-port-bg border border-port-border text-white text-sm hover:border-port-accent disabled:opacity-50"><ImageIcon size={14} /> Choose from gallery</button>@@ -428,9 +429,10 @@ export default function Authors() {<inputvalue={form.headshotImageUrl}onChange={(e) => setHeadshot(e.target.value)}+ disabled={isGenerating}placeholder="/images/… or https://…"maxLength={AUTHOR_HEADSHOT_IMAGE_URL_MAX}- className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white text-sm"+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white text-sm disabled:opacity-50"/></div></div>diff --git a/client/src/pages/Authors.test.jsx b/client/src/pages/Authors.test.jsxindex a56c27b4f6..7f9d251009 100644--- a/client/src/pages/Authors.test.jsx+++ b/client/src/pages/Authors.test.jsx@@ -113,6 +113,22 @@ describe('Authors headshot generation', () => {expect(img.getAttribute('src')).toBe('/data/images/final.png');});+ it('disables the competing headshot controls while a render is in flight', async () => {+ generateImage.mockResolvedValue({ jobId: 'job-3', filename: 'job-3.png', path: '/data/images/job-3.png' });+ await openCreateForm();+ fireEvent.change(screen.getByPlaceholderText(/silver-streaked dark hair/i), {+ target: { value: 'Woman in her 40s' },+ });+ fireEvent.click(screen.getByRole('button', { name: /Generate/i }));+ await waitFor(() => expect(generateImage).toHaveBeenCalledTimes(1));++ // The async job is in flight — a manual headshot change would be clobbered+ // on completion, so Upload / gallery / URL are locked until it settles.+ expect(screen.getByRole('button', { name: 'Upload' }).disabled).toBe(true);+ expect(screen.getByRole('button', { name: 'Choose from gallery' }).disabled).toBe(true);+ expect(screen.getByPlaceholderText(/https:/i).disabled).toBe(true);+ });+it('does not overwrite a different author when one is selected mid-render', async () => {generateImage.mockResolvedValue({ jobId: 'job-2', filename: 'job-2.png', path: '/data/images/job-2.png' });listAuthors.mockResolvedValue([