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

Keep captions on uploads and other non-imported pins

Claude61f1448ca687
diff --git a/client/src/lib/moodBoardAnalysis.js b/client/src/lib/moodBoardAnalysis.js
index cc64923a8d..191508d82c 100644
--- a/client/src/lib/moodBoardAnalysis.js
+++ b/client/src/lib/moodBoardAnalysis.js
@@ -44,7 +44,7 @@ export function moodBoardAnalysisFromResult(item, result) {
* then a gallery item's caption prompt. A pin imported from X, Pinterest or
* another page (or a frame cut from one) never offers its caption: that text is
* someone else's, so only an analysis inferred from its pixels is a prompt.
- * Mirrors the server's `moodBoardItemCaption`. Returns empty string if no prompt exists.
+ * Same imported-pin rule as the server's `moodBoardItemCaption`. Returns empty string if no prompt exists.
*/
export function moodBoardItemPrompt(item) {
if (item?.analysis?.prompt && typeof item.analysis.prompt === 'string' && item.analysis.prompt.trim()) {
diff --git a/server/lib/README.md b/server/lib/README.md
index df53d44d16..45d00a732d 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -878,7 +878,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `musicVideoCreativeContext.js` | `musicVideoDirectionContext(direction)` bounds the authoritative Cast & Sets bible; `musicVideoCodeDirectionContext(direction)` renders the approved procedural direction (rules + reusable character definitions) for code-authoring requests; `musicVideoCreativeContext(concept)` composes the selected universe style and authored cast/place/object bible for planning and generation; `musicVideoSongStyleContext(concept)` splits `concept.songStyle` (a Suno style prompt; minus-prefixed terms are excluded styles) and turns it into design direction for the planning LLMs (never an image prompt). |
| `musicVideoCharacterStyles.js` | Built-in Music Video character styles (a fixed-identity performer a project loads as its base concept and cast): `MUSIC_VIDEO_CHARACTER_STYLES` / `_IDS`, `getMusicVideoCharacterStyle`, `summarizeMusicVideoCharacterStyle` (picker projection), `musicVideoCharacterStyleSnapshot` (the `concept.characterStyle` text), `musicVideoCharacterStyleSubject` / `…SubjectId` / `…ReferenceId` (the protagonist and character-sheet reference a pick adds), `musicVideoCharacterSheetPrompt` (renders the style's own sheet). Pure; `services/musicVideo/characterStyles.js` keeps each install's sheet image. |
-| `moodBoardStyleContext.js` | `collectBoardStyleContext(board)` bounds a board's notes, captions, analyzed prompts, and composite style for creative prompts. `moodBoardImageCandidates(board, resolveItem)` lists the poster first, then pinned local images. `moodBoardItemCaption(item)` returns a caption only on a PortOS gallery pin, never imported X/Pinterest text. |
+| `moodBoardStyleContext.js` | `collectBoardStyleContext(board)` bounds a board's notes, captions, analyzed prompts, and composite style for creative prompts. `moodBoardImageCandidates(board, resolveItem)` lists the poster first, then pinned local images. `moodBoardItemCaption(item)` returns an item's caption unless it was imported from X/Pinterest/another page (or a frame cut from one). |
| `musicVideoAutonomous.js` | `supersededStillsCheckpoint(project, readiness)` retires only an old stills checkpoint from presentation once a current final render and approvals supersede it, preserving run history. Fully-autonomous Music Video vocabulary: `AUTONOMOUS_STAGES` (brief → lyrics → style → song → analyze → produce), optional `AUTONOMOUS_CHECKPOINT_IDS`, `normalizeAutonomousSettings` / `normalizeAutonomousBrief` / `normalizeAutopilotParams` (the shared run settings, a run's stored brief, and the scheduled task's params), `autonomousMedium` / `autonomousPool` (tool picks → footage vs code, production route pool), `sunoSongFields` + Suno limits/URL helpers, `normalizeSunoOptions` (the brief's optional `suno` form options: exclude styles, vocal gender, model version), and `pickBrainIdea` / `ideaToPrompt` for the scheduled task. Pure; the client drawer and the run service import it. |
| `musicVideoAutomation.js` | Music Video automation brief: `MUSIC_VIDEO_AUTOMATION_TOOLS` (image/video backends derived from `generationModes.js` plus `code:render`, each flagged `metered`), `MUSIC_VIDEO_AUTOMATION_TOOL_IDS`, and `normalizeMusicVideoAutomation(patch, current)` (per-sub-field merge, catalog-ordered tools, `budgetUsd: null` = no cap, `llm: null` clears the direction-LLM pin, `llmStages` merges per stage with `null` clearing one, server-written `routes` survive but are never patch-settable). Also `normalizeMusicVideoLlm` / `normalizeMusicVideoEffort` / `musicVideoLlmRouteLabel` for that pin and the effective route a stage ran on (#9545), and `MUSIC_VIDEO_LLM_STAGES` / `MUSIC_VIDEO_LLM_STAGE_LABELS` / `normalizeMusicVideoLlmStages` for the per-stage pins. Dependency-light; the client create drawer imports it. |
| `albumLimits.js` | Album record length/count caps shared by the albums sanitizer and client editors. |
diff --git a/server/lib/moodBoardStyleContext.js b/server/lib/moodBoardStyleContext.js
index db81f81eb0..d6c87fc623 100644
--- a/server/lib/moodBoardStyleContext.js
+++ b/server/lib/moodBoardStyleContext.js
@@ -22,29 +22,28 @@ const CONTEXT_ITEMS_MAX = 60;
const CONTEXT_FIELD_MAX = 600;
const CONTEXT_TOTAL_CHARS_MAX = 24000;
-const LOCAL_MEDIA_KEY = /^(?:image|video):/;
const EXTERNAL_SOURCE = /^(?:https?:|frame:)/i;
/**
- * The caption a model may read for a board item, or `''`. Only a pin from
- * PortOS's own gallery carries a caption PortOS wrote (its generation prompt).
- * A pin imported from X, Pinterest or another page — and a frame cut from one —
- * can hold someone else's text: misleading at best, a prompt injection at
- * worst. That text stays on the board for display, but only the prompt the
- * item's analysis inferred from its pixels reaches a model.
+ * The caption a model may read for a board item, or `''`. A pin imported from
+ * X, Pinterest or another page (its `source` is that page) — and a frame cut
+ * from one — can hold someone else's text: misleading at best, a prompt
+ * injection at worst. That text stays on the board for display, but only the
+ * prompt the item's analysis inferred from its pixels reaches a model. Captions
+ * the user or PortOS wrote (gallery pins, uploads, notes) still count.
*/
export function moodBoardItemCaption(item) {
if (typeof item?.caption !== 'string' || !item.caption.trim()) return '';
- if (typeof item.mediaKey !== 'string' || !LOCAL_MEDIA_KEY.test(item.mediaKey)) return '';
if (typeof item.source === 'string' && EXTERNAL_SOURCE.test(item.source)) return '';
return item.caption.trim();
}
/**
* Reduce a board to the style-relevant text fragments the LLM sees. An item
- * contributes only what it actually carries: a text note, a PortOS-written
- * caption (`moodBoardItemCaption`), and/or a persisted analysis (prompt + negative + rationale). Media items without any
- * of those contribute nothing — synthesis reads text, not pixels (analyzing
+ * contributes only what it actually carries: a text note, a caption that did
+ * not come from an imported page (`moodBoardItemCaption`), and/or a persisted
+ * analysis (prompt + negative + rationale). Media items without any of those
+ * contribute nothing — synthesis reads text, not pixels (analyzing
* an item is Phase 3's explicit per-item vision step).
*/
export function collectBoardStyleContext(board) {
diff --git a/server/services/moodBoard/analyzeJob.js b/server/services/moodBoard/analyzeJob.js
index 7f1dc88145..a31e358619 100644
--- a/server/services/moodBoard/analyzeJob.js
+++ b/server/services/moodBoard/analyzeJob.js
@@ -21,9 +21,12 @@ import { getBoard, updateBoard, updateBoardItem, backfillGalleryPrompts } from '
const jobs = new Map();
-// An imported pin's caption is not a prompt, so that pin still gets analyzed.
+// A gallery pin's caption is its generation prompt; an imported pin's caption
+// is not a prompt at all, so that pin still gets analyzed.
function itemHasPrompt(item) {
- return hasText(item?.analysis?.prompt) || hasText(item?.prompt) || Boolean(moodBoardItemCaption(item));
+ if (hasText(item?.analysis?.prompt) || hasText(item?.prompt)) return true;
+ const galleryKey = typeof item?.mediaKey === 'string' && /^(image|video):/.test(item.mediaKey);
+ return galleryKey && Boolean(moodBoardItemCaption(item));
}
// `{ kind, filename }` for an item prompt-from-media can read, else null.