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
fix: honor the picked Codex/CLI provider when composing a mood board style, and add an effort picker
[._.]/ Adam Eivyae462b683f18
diff --git a/client/src/components/moodBoard/MoodBoardStylePanel.jsx b/client/src/components/moodBoard/MoodBoardStylePanel.jsxindex dc071f9b19..f1cc22f442 100644--- a/client/src/components/moodBoard/MoodBoardStylePanel.jsx+++ b/client/src/components/moodBoard/MoodBoardStylePanel.jsx@@ -58,6 +58,7 @@ export default function MoodBoardStylePanel({ board, onBoardChange }) {const jobRunningRef = useRef(false);jobRunningRef.current = jobRunning;const [savingStyle, setSavingStyle] = useState(false);+ const [effort, setEffort] = useState('');const [rendererMode, setRendererMode] = useState('');const capturedKeyRef = useRef(null);@@ -124,6 +125,7 @@ export default function MoodBoardStylePanel({ board, onBoardChange }) {const updated = await composeMoodBoardPrompt(board.id, {providerId: selectedProviderId || undefined,model: selectedModel || undefined,+ effort: effort || undefined,}, { silent: true }).catch((err) => {if (mountedRef.current) toast.error(err?.message || 'Could not compose a board style from the item analyses');return null;@@ -194,6 +196,7 @@ export default function MoodBoardStylePanel({ board, onBoardChange }) {const started = await startMoodBoardAnalyze(board.id, {providerId: selectedProviderId,model: selectedModel || undefined,+ effort: effort || undefined,}, { silent: true }).catch((err) => {toast.error(err?.message || 'Could not start the board analysis');return null;@@ -284,6 +287,8 @@ export default function MoodBoardStylePanel({ board, onBoardChange }) {availableModels={availableModels}onProviderChange={setSelectedProviderId}onModelChange={setSelectedModel}+ effort={effort}+ onEffortChange={setEffort}disabled={busy || providersLoading}layout="row"/>diff --git a/client/src/services/apiMoodBoard.js b/client/src/services/apiMoodBoard.jsindex 982479609c..c4aaa566ec 100644--- a/client/src/services/apiMoodBoard.js+++ b/client/src/services/apiMoodBoard.js@@ -51,10 +51,10 @@ export const removeMoodBoardItem = (id, itemId, options) =>// Board analyze runs server-side so it survives navigation: start (or join) the// job, and read its live state on return. `null` = no run since server start.-export const startMoodBoardAnalyze = (id, { providerId, model } = {}, options = {}) =>+export const startMoodBoardAnalyze = (id, { providerId, model, effort } = {}, options = {}) =>request(`/mood-boards/${encodeURIComponent(id)}/analyze`, {method: 'POST',- body: JSON.stringify({ providerId, model }),+ body: JSON.stringify({ providerId, model, effort }),...options,});@@ -63,10 +63,10 @@ export const getMoodBoardAnalyze = (id, options = {}) =>// Distill stored per-item analyses into the board's own composite style prompt// and persist it on the board (`style`). Resolves to the updated board.-export const composeMoodBoardPrompt = (id, { providerId, model } = {}, options = {}) =>+export const composeMoodBoardPrompt = (id, { providerId, model, effort } = {}, options = {}) =>request(`/mood-boards/${encodeURIComponent(id)}/compose-prompt`, {method: 'POST',- body: JSON.stringify({ providerId, model }),+ body: JSON.stringify({ providerId, model, effort }),...options,});diff --git a/server/routes/moodBoard.js b/server/routes/moodBoard.jsindex 88127e5cb2..9b81f1b52a 100644--- a/server/routes/moodBoard.js+++ b/server/routes/moodBoard.js@@ -133,6 +133,7 @@ router.post('/:id/synthesize-style', asyncHandler(async (req, res) => {const composePromptSchema = z.object({providerId: z.string().trim().max(128).optional(),model: z.string().trim().max(256).optional(),+ effort: z.string().trim().max(64).optional(),}).strict();// Copy gallery generation prompts onto pins that lack any prompt, so the board// analyze step doesn't re-run vision on them. Resolves to the updated board.diff --git a/server/routes/moodBoard.test.js b/server/routes/moodBoard.test.jsindex a60cdee047..f157190463 100644--- a/server/routes/moodBoard.test.js+++ b/server/routes/moodBoard.test.js@@ -149,15 +149,15 @@ describe('mood-board routes', () => {svc.getBoard.mockResolvedValueOnce(board);composeBoardPrompt.mockResolvedValueOnce(style);svc.updateBoard.mockResolvedValueOnce({ ...board, style });- const res = await request(makeApp()).post('/api/mood-boards/mb-1/compose-prompt').send({ providerId: 'ollama', model: 'qwen' });+ const res = await request(makeApp()).post('/api/mood-boards/mb-1/compose-prompt').send({ providerId: 'ollama', model: 'qwen', effort: 'high' });expect(res.status).toBe(200);- expect(composeBoardPrompt).toHaveBeenCalledWith({ board, providerId: 'ollama', model: 'qwen' });+ expect(composeBoardPrompt).toHaveBeenCalledWith({ board, providerId: 'ollama', model: 'qwen', effort: 'high' });expect(svc.updateBoard).toHaveBeenCalledWith('mb-1', { style });expect(res.body.style.prompt).toBe('ink wash dusk');});it('400s on an unknown body key', async () => {- const res = await request(makeApp()).post('/api/mood-boards/mb-1/compose-prompt').send({ effort: 'high' });+ const res = await request(makeApp()).post('/api/mood-boards/mb-1/compose-prompt').send({ bogus: 'high' });expect(res.status).toBe(400);expect(composeBoardPrompt).not.toHaveBeenCalled();});diff --git a/server/services/moodBoard/analyzeJob.js b/server/services/moodBoard/analyzeJob.jsindex a8b49aa956..8bfa0da027 100644--- a/server/services/moodBoard/analyzeJob.js+++ b/server/services/moodBoard/analyzeJob.js@@ -73,7 +73,7 @@ function update(job, patch) {publish(job);}-async function run(job, { providerId, model }) {+async function run(job, { providerId, model, effort }) {const { boardId } = job;const filled = await backfillGalleryPrompts(boardId);if (!filled) throw new Error('Mood board not found');@@ -89,6 +89,7 @@ async function run(job, { providerId, model }) {targets: source.kind === 'video' ? ['image', 'video'] : ['image'],providerId,model,+ effort,}).catch((err) => {console.warn(`⚠️ mood-board ${boardId} item ${item.id} analysis failed: ${err.message}`);return null;@@ -108,7 +109,7 @@ async function run(job, { providerId, model }) {return;}update(job, { phase: 'composing' });- const style = await composeBoardPrompt({ board, providerId, model });+ const style = await composeBoardPrompt({ board, providerId, model, effort });await updateBoard(boardId, { style });update(job, { status: 'done', phase: null, finishedAt: new Date().toISOString() });}@@ -119,7 +120,7 @@ export function getAnalyzeJob(boardId) {}/** Start (or join, when one is already running) the analyze job for a board. */-export function startAnalyzeJob(boardId, { providerId, model } = {}) {+export function startAnalyzeJob(boardId, { providerId, model, effort } = {}) {const existing = jobs.get(boardId);if (existing?.status === 'running') return { ...existing };const job = {@@ -135,7 +136,7 @@ export function startAnalyzeJob(boardId, { providerId, model } = {}) {};jobs.set(boardId, job);publish(job);- run(job, { providerId, model }).catch((err) => {+ run(job, { providerId, model, effort }).catch((err) => {console.error(`❌ mood-board ${boardId} analyze failed: ${err.message}`);update(job, { status: 'failed', phase: null, error: err.message, finishedAt: new Date().toISOString() });});diff --git a/server/services/moodBoardCompositeStyle.js b/server/services/moodBoardCompositeStyle.jsindex 74afc7d617..9108a34ec6 100644--- a/server/services/moodBoardCompositeStyle.js+++ b/server/services/moodBoardCompositeStyle.js@@ -9,6 +9,8 @@*/import { parseLLMJSON, resolveAPIProvider } from './aiProvider.js';+import { getProviderById } from './providers.js';+import { isVisionCapableCliProvider } from '../lib/localModelHeuristics.js';import { ServerError } from '../lib/errorHandler.js';import { assertProvider, runPromptThroughProvider } from './promptRunner.js';import { trimTo } from '../lib/textUtils.js';@@ -69,7 +71,25 @@ Rules:- An empty negativePrompt is valid when the analyses share no consistent avoid.`;}-export async function composeBoardPrompt({ board, providerId, model } = {}) {+/**+ * The mood-board pickers list API providers AND vision-capable CLI providers+ * (Codex, Claude Code) because the same selection drives per-pin analysis. The+ * composite step is text-only, so honor that pick here too — resolving through+ * the API-only path swapped a chosen CLI provider for the first API provider+ * (e.g. Ollama) and then sent it the CLI provider's model id.+ */+async function resolveComposeProvider(providerId) {+ if (providerId) {+ const requested = await getProviderById(providerId).catch(() => null);+ if (requested && requested.enabled !== false+ && (requested.type === 'api' || isVisionCapableCliProvider(requested))) {+ return requested;+ }+ }+ return resolveAPIProvider(providerId);+}++export async function composeBoardPrompt({ board, providerId, model, effort } = {}) {const analyzed = analyzedItems(board);if (!analyzed.length) {throw new ServerError(@@ -87,7 +107,7 @@ export async function composeBoardPrompt({ board, providerId, model } = {}) {);}- const provider = await resolveAPIProvider(providerId);+ const provider = await resolveComposeProvider(providerId);assertProvider(provider, {message: 'Composing a board style needs an API-based provider. Configure one under Settings → Providers.',code: 'NO_API_PROVIDER',@@ -99,6 +119,7 @@ export async function composeBoardPrompt({ board, providerId, model } = {}) {prompt: buildCompositeStylePrompt({ context, analyzedItemCount: fed }),source: 'mood-board-composite-style',model: model || undefined,+ effort: effort || undefined,});let parsed;try {diff --git a/server/services/moodBoardCompositeStyle.test.js b/server/services/moodBoardCompositeStyle.test.jsindex c4b21a0427..00c6eca8b8 100644--- a/server/services/moodBoardCompositeStyle.test.js+++ b/server/services/moodBoardCompositeStyle.test.js@@ -9,8 +9,11 @@ vi.mock('./promptRunner.js', async (importActual) => {return { ...actual, runPromptThroughProvider: vi.fn() };});+vi.mock('./providers.js', () => ({ getProviderById: vi.fn() }));+const aiProvider = await import('./aiProvider.js');const promptRunner = await import('./promptRunner.js');+const providers = await import('./providers.js');const { composeBoardPrompt } = await import('./moodBoardCompositeStyle.js');const apiProvider = { id: 'ollama', type: 'api', defaultModel: 'qwen' };@@ -28,11 +31,29 @@ const analyzed = {beforeEach(() => {vi.clearAllMocks();+ providers.getProviderById.mockResolvedValue(null);aiProvider.resolveAPIProvider.mockResolvedValue(apiProvider);promptRunner.runPromptThroughProvider.mockResolvedValue({ text: composedText, model: 'qwen', provider: apiProvider });});describe('composeBoardPrompt', () => {+ it('runs the picked vision CLI provider with its model and effort instead of swapping to an API provider', async () => {+ const codex = { id: 'codex', type: 'cli', command: 'codex', enabled: true };+ providers.getProviderById.mockResolvedValue(codex);+ promptRunner.runPromptThroughProvider.mockResolvedValue({ text: composedText, model: 'gpt-5.6-luna', provider: codex });+ const style = await composeBoardPrompt({+ board: { id: 'mb-1', name: 'Foundry', items: [analyzed] },+ providerId: 'codex',+ model: 'gpt-5.6-luna',+ effort: 'high',+ });+ expect(aiProvider.resolveAPIProvider).not.toHaveBeenCalled();+ expect(promptRunner.runPromptThroughProvider).toHaveBeenCalledWith(expect.objectContaining({+ provider: codex, model: 'gpt-5.6-luna', effort: 'high',+ }));+ expect(style.providerId).toBe('codex');+ });+it('refuses a board whose items carry neither an analysis nor a caption', async () => {await expect(composeBoardPrompt({board: { id: 'mb-1', name: 'Empty', items: [{ id: 'i1', type: 'image', mediaKey: 'image:a.png', caption: null }] },