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

Add text-to-image, image-to-image and video send buttons to mood board item cards

[._.]/ Adam Eivy6b2dd32f2d7a
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index f7f79b96af..d8dd6da62f 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -197,7 +197,7 @@ grep -i "what you want to do" client/src/lib/README.md
| `ports.js` | `PORTS` + `DEFAULT_PEER_PORT`, re-exported from the pure leaf `server/lib/ports.js` (which `ports.test.js` pins against `ecosystem.config.cjs`, the source of truth — see docs/PORTS.md). Use these instead of re-hardcoding a port literal in a form default, a copy-paste help string, or a cross-machine URL. |
| `providerManagement.js` | What every AI Providers surface shares about a service instance (#7567, #8014): `catalogSummary` reads its catalog state honestly (keeps `unknown` / `known`-and-empty / `failed`-with-retained-models distinct), `serviceReadinessCopy` / `SERVICE_READINESS_COPY` give one phrasing per `readiness` value (badge tone + label, and the predicate the compose popover and compatibility matrix append to the service's name), `draftFromTransports` / `transportsFromDraft` round-trip its `transports` map through a text form, dropping a blank endpoint rather than sending an empty one, and `classifyServiceCategory` / `SERVICE_CATEGORIES` / `serviceMatchesQuery` / `sortServices` / `servicePresetAction` group the Services view by what the definition offers (not the instance's selected plan) and decide whether a card may start a derived preset. |
| `morsePractice.js` | Pure deterministic adaptive Morse sampler — `selectMorsePrompt` combines bounded weak-character/confusion weighting with a non-zero exploration floor and only emits material valid for the active Koch pool; `canAdvanceMorseLevel` guards level advancement on sample count, accuracy, and effective speed. |
-| `moodBoardAnalysis.js` | `moodBoardAnalysisFromResult(item, result)` picks the type-matched prompt-from-media payload stored on a pin; `boardAnalyzePlan(items)` splits pins into already-analyzed, still-readable, and skipped; `boardPosterRenderCfg(imageCfg, mode)` builds the explicit landscape poster render (any chosen image service) and `posterStyleKey(style)` detects a style change while that render is in flight. |
+| `moodBoardAnalysis.js` | `moodBoardAnalysisFromResult(item, result)` picks the type-matched prompt-from-media payload stored on a pin; `boardAnalyzePlan(items)` splits pins into already-analyzed, still-readable, and skipped; `boardPosterRenderCfg(imageCfg, mode)` builds the explicit landscape poster render (any chosen image service) and `posterStyleKey(style)` detects a style change while that render is in flight; `moodBoardItemSendLinks(item)` builds the text-to-image / image-to-image / video handoff URLs for a pin card. |
| `moodBoardItemSrc.js` | `moodBoardItemSrc(item)` resolves a mood-board item to a display image/poster src (`imageUrl` → served `image:<file>` bytes → derived video thumbnail → null); `moodBoardPosterSrc(board)` resolves the board's canonical poster filename to `/data/images/…`; `moodBoardCollageSrc(board)` resolves the persisted collage (`collageImageRef`) the same way; `moodBoardItemVideoSrc(item)` resolves a `type:'video'` item's playback URL; `moodBoardItemAnalysisSource(item)` resolves an item to a prompt-from-media source (null when not a local gallery asset). Shared by MoodBoardDetail + MoodBoardReferenceStrip. |
| `rapidReaderPosition.js` | Cursor-to-word mapping plus privacy-preserving Rapid Reader progress persistence keyed by a text fingerprint; stores position/settings without storing pasted source text. |
| `registerServiceWorker.js` | `registerServiceWorker()` / `unregisterServiceWorkers()` — wires up the offline app-shell + low-bandwidth asset-caching service worker (`public/sw.js`). Registers only in a production secure context (HTTPS or localhost); no-ops over plain-HTTP Tailnet and tears down any stale SW in dev. Called once from `main.jsx`. |
diff --git a/client/src/lib/moodBoardAnalysis.js b/client/src/lib/moodBoardAnalysis.js
index 60778255d8..5919194e0e 100644
--- a/client/src/lib/moodBoardAnalysis.js
+++ b/client/src/lib/moodBoardAnalysis.js
@@ -121,3 +121,29 @@ export function boardPosterRenderCfg(imageCfg, mode) {
height: BOARD_POSTER_SIZE.height,
};
}
+
+/**
+ * Generator handoff links for a board item's card: text-to-image and
+ * text-to-video need a prompt (the analyzed one, else caption); image-to-image
+ * and image-to-video also need the item to be a local gallery image. Each key
+ * is null when that handoff doesn't apply. The negative prompt rides along only
+ * when the analysis saved one.
+ */
+export function moodBoardItemSendLinks(item) {
+ const prompt = moodBoardItemPrompt(item);
+ const negative = typeof item?.analysis?.negativePrompt === 'string' ? item.analysis.negativePrompt.trim() : '';
+ const source = moodBoardItemAnalysisSource(item);
+ const imageFile = item?.type === 'image' && source?.kind !== 'video' ? source?.filename : null;
+ const build = (path, extra = {}) => {
+ const params = new URLSearchParams();
+ if (prompt) params.set('prompt', prompt);
+ if (negative) params.set('negativePrompt', negative);
+ for (const [k, v] of Object.entries(extra)) params.set(k, v);
+ return `${path}?${params}`;
+ };
+ return {
+ textToImage: prompt ? build('/media/image') : null,
+ imageToImage: imageFile ? build('/media/image', { initImageFile: imageFile }) : null,
+ video: imageFile ? build('/media/video', { sourceImageFile: imageFile }) : (prompt ? build('/media/video') : null),
+ };
+}
diff --git a/client/src/lib/moodBoardAnalysis.test.js b/client/src/lib/moodBoardAnalysis.test.js
index 67348b3c2a..eaf620a8ca 100644
--- a/client/src/lib/moodBoardAnalysis.test.js
+++ b/client/src/lib/moodBoardAnalysis.test.js
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest';
import { IMAGE_GEN_MODE } from './imageGenModes';
import {
+ moodBoardItemSendLinks,
BOARD_POSTER_SIZE,
boardAnalyzePlan,
boardPosterRenderCfg,
@@ -139,3 +140,26 @@ describe('boardPosterRenderCfg', () => {
.not.toBe(posterStyleKey({ prompt: 'oil', negativePrompt: 'gloss' }));
});
});
+
+describe('moodBoardItemSendLinks', () => {
+ it('offers all three handoffs for an analyzed gallery image', () => {
+ const links = moodBoardItemSendLinks({
+ type: 'image', mediaKey: 'image:a b.png',
+ analysis: { prompt: 'a red fox', negativePrompt: 'blurry' },
+ });
+ expect(links.textToImage).toBe('/media/image?prompt=a+red+fox&negativePrompt=blurry');
+ expect(links.imageToImage).toContain('initImageFile=a+b.png');
+ expect(links.video).toContain('/media/video?');
+ expect(links.video).toContain('sourceImageFile=a+b.png');
+ });
+
+ it('hides image-sourced handoffs for external pins and falls back to text-to-video for video items', () => {
+ const external = moodBoardItemSendLinks({ type: 'image', imageUrl: 'https://example.com/x.png', analysis: { prompt: 'p' } });
+ expect(external.imageToImage).toBeNull();
+ expect(external.video).toBe('/media/video?prompt=p');
+ const video = moodBoardItemSendLinks({ type: 'video', mediaKey: 'video:c.mp4', analysis: { prompt: 'p' } });
+ expect(video.imageToImage).toBeNull();
+ expect(video.video).toBe('/media/video?prompt=p');
+ expect(moodBoardItemSendLinks({ type: 'image', mediaKey: 'image:z.png' }).textToImage).toBeNull();
+ });
+});
diff --git a/client/src/pages/MoodBoardDetail.jsx b/client/src/pages/MoodBoardDetail.jsx
index 0d30dbc8d3..8dcfd65102 100644
--- a/client/src/pages/MoodBoardDetail.jsx
+++ b/client/src/pages/MoodBoardDetail.jsx
@@ -11,7 +11,7 @@
import { useEffect, useState, useCallback, useMemo, useRef } from 'react';
import { useParams, useNavigate, Link } from 'react-router';
-import { ArrowLeft, ImageIcon, FileText, Trash2, Plus, Save, Link2, Unlink, RefreshCw, Images, Film, Play, ScanEye, Copy, AtSign, Download, Sparkles, Clapperboard, Paintbrush } from 'lucide-react';
+import { ArrowLeft, ImageIcon, FileText, Trash2, Plus, Save, Link2, Unlink, RefreshCw, Images, Film, Play, ScanEye, Copy, AtSign, Download, Sparkles, Clapperboard, Paintbrush, Wand2 } from 'lucide-react';
import PageSkeleton from '../components/ui/PageSkeleton';
import toast from '../components/ui/Toast';
import TabPills from '../components/ui/TabPills';
@@ -46,6 +46,7 @@ import {
moodBoardItemPrompt,
isMoodBoardItemAnalyzed,
moodBoardItemHasPrompt,
+ moodBoardItemSendLinks,
} from '../lib/moodBoardAnalysis';
import { timeAgo } from '../utils/formatters';
import useMounted from '../hooks/useMounted';
@@ -574,6 +575,7 @@ function MoodBoardEditor({ id }) {
const hasPrompt = moodBoardItemHasPrompt(item);
const promptText = moodBoardItemPrompt(item);
const displayText = promptText || item.caption || '';
+ const sendLinks = moodBoardItemSendLinks(item);
return (
<div key={item.id} className="min-w-0 bg-port-card border border-port-border rounded-md overflow-hidden flex flex-col">
<div className="relative w-full aspect-square bg-port-bg">
@@ -765,6 +767,21 @@ function MoodBoardEditor({ id }) {
{item.render?.status === 'queued' ? 'Rendering…' : 'Render'}
</button>
) : null}
+ {[
+ ['textToImage', ImageIcon, 'Text to image with this prompt'],
+ ['imageToImage', Wand2, 'Send to image-to-image'],
+ ['video', Film, sendLinks.imageToImage ? 'Send to video' : 'Text to video with this prompt'],
+ ].map(([key, Icon, label]) => (sendLinks[key] ? (
+ <Link
+ key={key}
+ to={sendLinks[key]}
+ title={label}
+ aria-label={label}
+ className="min-h-[44px] min-w-[44px] shrink-0 inline-flex items-center justify-center p-1 text-gray-500 hover:text-white transition-colors"
+ >
+ <Icon className="w-3.5 h-3.5" aria-hidden="true" />
+ </Link>
+ ) : null))}
{analysisSource ? (
<button
type="button"