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: remove dead submit path and fix publishing wiring gaps (#10171)
Adam Eivy8a9461a405be
diff --git a/client/src/components/musicVideo/ExcerptPanel.jsx b/client/src/components/musicVideo/ExcerptPanel.jsxindex 40a6424e3b..13c5e764b4 100644--- a/client/src/components/musicVideo/ExcerptPanel.jsx+++ b/client/src/components/musicVideo/ExcerptPanel.jsx@@ -167,6 +167,7 @@ export default function ExcerptPanel({ project, rendering, occupied = rendering,const [aspect, setAspect] = useState(projectAspect);const [fade, setFade] = useState(false);const [suggestions, setSuggestions] = useState(null);+ const [suggestionError, setSuggestionError] = useState(null);const [suggesting, setSuggesting] = useState(false);const idFor = (s) => `mv-excerpt-${project?.id}-${s}`;const valid = Number.isFinite(startSec) && Number.isFinite(endSec) && endSec > startSec;@@ -176,9 +177,10 @@ export default function ExcerptPanel({ project, rendering, occupied = rendering,const render = (s, e, opts) => actions.startExcerpt(s, e, opts);const suggestHooks = () => {setSuggesting(true);+ setSuggestionError(null);getMusicVideoSocialCuts(project.id, { count: 3 }, { silent: true }).then((res) => setSuggestions(res?.suggestions || []))- .catch(() => setSuggestions([]))+ .catch((err) => { setSuggestions(null); setSuggestionError(err?.message || 'Failed to find hooks'); }).finally(() => setSuggesting(false));};@@ -228,7 +230,13 @@ export default function ExcerptPanel({ project, rendering, occupied = rendering,<Sparkles size={12} /> {suggesting ? 'Finding hooks…' : 'Suggest hooks'}</button></div>- {suggestions && suggestions.length === 0 && <p className="text-xs text-port-text-muted">No hook windows found. Time the lyrics first.</p>}+ {suggestionError && (+ <div className="flex items-center justify-between gap-2 text-xs">+ <p className="text-port-error">{suggestionError}</p>+ <button type="button" onClick={suggestHooks} disabled={suggesting} className="text-port-accent disabled:opacity-50">Retry</button>+ </div>+ )}+ {!suggestionError && suggestions && suggestions.length === 0 && <p className="text-xs text-port-text-muted">No hook windows found. Time the lyrics first.</p>}{suggestions && suggestions.length > 0 && (<ul className="space-y-1">{suggestions.map((s) => (diff --git a/client/src/components/musicVideo/ProjectActionGroups.jsx b/client/src/components/musicVideo/ProjectActionGroups.jsxindex e38f701262..ab54c1e583 100644--- a/client/src/components/musicVideo/ProjectActionGroups.jsx+++ b/client/src/components/musicVideo/ProjectActionGroups.jsx@@ -204,6 +204,25 @@ export function RenderFinalButton({ project, renderJob, readiness }) {const documentBlocked = !documentMode ? '' : noAudio ? 'Link a track first': !(project.audioAnalysis?.durationSec > 0) ? 'Analyze the track first — the document is timed against the song': !project.composition?.document ? 'Start from the template or import a composition document first' : '';++ // Determine the blocker reason for display+ let blockerReason = '';+ if (!readiness?.readyForProduction) {+ blockerReason = 'Approve the current visual guide, timed storyboard and animated proof first';+ } else if (eidoverseMode && eidoverseBlocked) {+ blockerReason = eidoverseBlocked;+ } else if (documentMode && documentBlocked) {+ blockerReason = documentBlocked;+ } else if (codeMode && !codeReady) {+ blockerReason = 'Analyze the song or time a scene before rendering code';+ } else if (sceneCount === 0) {+ blockerReason = 'Add scenes first';+ } else if (readySceneCount !== sceneCount) {+ blockerReason = layered+ ? `${sceneCount - readySceneCount} scene${sceneCount - readySceneCount === 1 ? ' is' : 's are'} not ready — footage needs a video, a still needs a frame and a span, a card needs a span`+ : `Generate videos for all ${sceneCount} scenes first`;+ }+if (renderJob.active && renderJob.context === project.id) {return (<button onClick={renderJob.cancel} disabled={renderJob.pending}@@ -213,25 +232,18 @@ export function RenderFinalButton({ project, renderJob, readiness }) {</button>);}++ const isDisabled = !readiness?.readyForProduction || renderJob.active || (eidoverseMode ? !!eidoverseBlocked : documentMode ? !!documentBlocked : codeMode ? !codeReady : (sceneCount === 0 || readySceneCount !== sceneCount));+return (- <button onClick={() => renderJob.start(project.id)} disabled={!readiness?.readyForProduction || renderJob.active || (eidoverseMode ? !!eidoverseBlocked : documentMode ? !!documentBlocked : codeMode ? !codeReady : (sceneCount === 0 || readySceneCount !== sceneCount))}- title={!readiness?.readyForProduction ? 'Approve the current visual guide, timed storyboard and animated proof first' : renderJob.active- ? 'Wait for the other project render to finish, or return to it to cancel'- : eidoverseMode- ? (eidoverseBlocked || 'Render the Eidoverse scene over the master song')- : documentMode- ? (documentBlocked || 'Render the composition document over the song')- : codeMode- ? (codeReady ? 'Render the code-rendered video over the song. This does not generate footage.' : 'Analyze the song or time a scene before rendering code')- : sceneCount === 0- ? 'Add scenes first'- : readySceneCount !== sceneCount- ? (layered- ? `${sceneCount - readySceneCount} scene${sceneCount - readySceneCount === 1 ? ' is' : 's are'} not ready — footage needs a video, a still needs a frame and a span, a card needs a span`- : `Generate videos for all ${sceneCount} scenes first`)- : 'Render the complete music video over the track'}- className="flex items-center gap-1 bg-port-accent text-white rounded px-2 py-1.5 text-sm min-h-[44px] sm:min-h-0 disabled:opacity-50">- <Film size={15} /> {renderJob.active ? 'Rendering another project…' : 'Render final'}- </button>+ <div className="space-y-1">+ <button onClick={() => renderJob.start(project.id)} disabled={isDisabled}+ className="flex items-center gap-1 bg-port-accent text-white rounded px-2 py-1.5 text-sm min-h-[44px] sm:min-h-0 disabled:opacity-50">+ <Film size={15} /> {renderJob.active ? 'Rendering another project…' : 'Render final'}+ </button>+ {isDisabled && blockerReason && (+ <p className="text-xs text-port-text-muted">{blockerReason}</p>+ )}+ </div>);}diff --git a/client/src/components/musicVideo/PublishKitPanel.jsx b/client/src/components/musicVideo/PublishKitPanel.jsxindex b6a77c2c1a..b7884954dc 100644--- a/client/src/components/musicVideo/PublishKitPanel.jsx+++ b/client/src/components/musicVideo/PublishKitPanel.jsx@@ -103,9 +103,12 @@ export default function PublishKitPanel({ project, publishKit, enabledTargets })<p role="status" className="text-xs text-port-warning">Kit built from an earlier render. Fill draft is refused until you rebuild it. Use Rebuild kit.</p>)}{publishKit.building && (- <div>+ <div className="space-y-2"><div className="h-1.5 bg-port-bg rounded overflow-hidden"><div className="h-full bg-port-accent transition-all" style={{ width: `${publishKit.progress}%` }} /></div>- <p className="text-xs text-port-text-muted mt-1">Encoding — {Math.round(publishKit.progress)}%</p>+ <div className="flex items-center justify-between">+ <p className="text-xs text-port-text-muted">Encoding — {Math.round(publishKit.progress)}%</p>+ <button type="button" onClick={publishKit.cancelBuild} className="text-xs text-port-text-muted hover:text-port-text-base px-2 py-1">Cancel</button>+ </div></div>)}{kit.builtAt && (diff --git a/client/src/components/musicVideo/PublishPostingPanel.jsx b/client/src/components/musicVideo/PublishPostingPanel.jsxindex cc5b0d4f5e..78ee610b47 100644--- a/client/src/components/musicVideo/PublishPostingPanel.jsx+++ b/client/src/components/musicVideo/PublishPostingPanel.jsx@@ -55,9 +55,11 @@ function TargetOptions({ target, kit, options, setOption, flairs, idFor }) {return <div className="grid sm:grid-cols-2 gap-2">{text('territory', 'Territory', 'art')}<div className="sm:col-span-2">{area('firstComment', 'First comment (optional)')}</div></div>;}if (target === 'suno') {+ // Prefill from kit links or run output if available+ const defaultSongUrl = kit.links?.song || (options.songUrl ? null : 'https://suno.com/song/…');return (<div className="grid sm:grid-cols-2 gap-2 items-end">- {text('songUrl', 'Song URL (the take to publish)', kit.links?.song || 'https://suno.com/song/…')}+ {text('songUrl', 'Song URL (the take to publish)', defaultSongUrl)}<label className="flex items-center gap-1.5 text-xs min-h-[44px] sm:min-h-0"><input type="checkbox" checked={options.pin !== false} onChange={(e) => setOption('pin', e.target.checked)} /> Pin to profile</label>@@ -124,7 +126,14 @@ function ManualLink({ idFor, label, onSave }) {function TargetRow({ project, kit, entry, publishing }) {const { target, label, note } = entry;const idFor = (key) => `mv-post-${project.id}-${target}-${key}`;- const [options, setOptions] = useState({});+ const [options, setOptions] = useState(() => {+ // Prefill Suno URL from autonomous run if available+ if (target === 'suno' && project?.autonomousRun?.output?.sunoSongIds?.length > 0) {+ const songId = project.autonomousRun.output.sunoSongIds[0];+ return { songUrl: `https://suno.com/song/${encodeURIComponent(songId)}` };+ }+ return {};+ });const setOption = (key, value) => setOptions((prev) => ({ ...prev, [key]: value }));const draft = publishing.drafts[target];const busy = publishing.busy[target];@@ -136,7 +145,6 @@ function TargetRow({ project, kit, entry, publishing }) {return (<li className="rounded border border-port-border p-2 space-y-2">- <p className="text-xs text-port-text-muted">Preparing a draft may upload files and save platform metadata. This is separate from production and never publishes.</p><div className="flex flex-wrap items-start justify-between gap-2"><div className="min-w-0"><div className="text-xs font-medium">{label}{account && <span className="font-normal text-port-text-muted"> as @{account}</span>}</div>@@ -170,13 +178,10 @@ function TargetRow({ project, kit, entry, publishing }) {<div key={k} className="contents"><dt className="text-port-text-muted">{k}</dt><dd className="min-w-0 break-words whitespace-pre-wrap">{v}</dd></div>))}</dl>- <div className="flex flex-wrap gap-2">- <p className="text-sm">Review and publish yourself in the destination platform's open browser tab. PortOS cannot submit this draft. Record the resulting link below.</p>- <button type="button" onClick={() => publishing.discard(target)} disabled={!!busy}- className="flex items-center gap-1 border border-port-border disabled:opacity-50 rounded px-2 py-1.5 text-xs min-h-[44px] sm:min-h-0">- <XIcon size={13} /> Discard- </button>- </div>+ <button type="button" onClick={() => publishing.discard(target)} disabled={!!busy}+ className="flex items-center gap-1 border border-port-border disabled:opacity-50 rounded px-2 py-1.5 text-xs min-h-[44px] sm:min-h-0">+ <XIcon size={13} /> Discard+ </button></div>)}</li>diff --git a/client/src/components/musicVideo/PublishPostingPanel.test.jsx b/client/src/components/musicVideo/PublishPostingPanel.test.jsxindex 338f9c5452..11a65aee6b 100644--- a/client/src/components/musicVideo/PublishPostingPanel.test.jsx+++ b/client/src/components/musicVideo/PublishPostingPanel.test.jsx@@ -43,7 +43,7 @@ describe('PublishPostingPanel (#9282)', () => {expect(within(sn).getByText('Song')).toBeInTheDocument();expect(publishing.submit).not.toHaveBeenCalled();expect(within(sn).queryByRole('button', { name: /Post to Stacker News/ })).toBeNull();- expect(within(sn).getByText(/PortOS cannot submit this draft/)).toBeInTheDocument();+ expect(within(sn).getByRole('button', { name: /Discard/ })).toBeInTheDocument();fireEvent.click(within(sn).getByRole('button', { name: /Discard/ }));expect(publishing.discard).toHaveBeenCalledWith('stackerNews');});diff --git a/client/src/hooks/useMusicVideoPublishing.js b/client/src/hooks/useMusicVideoPublishing.jsindex 81cde1496b..76ac95defb 100644--- a/client/src/hooks/useMusicVideoPublishing.js+++ b/client/src/hooks/useMusicVideoPublishing.js@@ -1,8 +1,6 @@import { useCallback, useEffect, useRef, useState } from 'react';-import toast from '../components/ui/Toast';import {prepareMusicVideoPublishDraft,- submitMusicVideoPublishDraft,discardMusicVideoPublishDraft,getMusicVideoPublishPlatforms,updateMusicVideoPublishPlatforms,@@ -12,11 +10,10 @@ import {const EMPTY_POSTING = { drafts: {}, busy: {}, errors: {} };/**- * Music Video posting (#9282). Each platform is two explicit steps: `prepare`- * fills the post in the PortOS Browser and returns what it filled (a summary- * and a screenshot) for the director to review; `submit` posts that same- * draft. Nothing posts without the second press. Errors are kept per platform- * so a sign-in prompt stays beside the platform that needs it.+ * Music Video posting (#9282). `prepare` fills the post in the PortOS Browser+ * and returns what it filled (a summary and a screenshot) for the director to+ * review. Manual posting is handled outside this hook. Errors are kept per+ * platform so a sign-in prompt stays beside the platform that needs it.** Platforms are opt-in (#9287): `platforms` is the director's saved choice of* where they post (with an optional account each), `history` their posts and@@ -61,28 +58,6 @@ export default function useMusicVideoPublishing({ project, replaceProject } = {}.finally(() => setFor('busy', target, null));};- const submit = (target) => {- const draft = drafts[target];- if (!draft) return Promise.resolve(null);- setFor('busy', target, 'submit');- setFor('errors', target, null);- return submitMusicVideoPublishDraft(projectId, draft.draftId, { silent: true })- .then((res) => {- if (res?.project) replaceProject?.(res.project);- loadPlatforms();- setFor('drafts', target, null);- toast.success('Posted');- return res?.post || null;- })- .catch((err) => {- // A gone draft can't be posted again; the director fills it afresh.- if (err?.code === 'PUBLISH_DRAFT_MISSING') setFor('drafts', target, null);- fail(target, err);- return null;- })- .finally(() => setFor('busy', target, null));- };-const discard = (target) => {const draft = drafts[target];setFor('drafts', target, null);@@ -103,5 +78,5 @@ export default function useMusicVideoPublishing({ project, replaceProject } = {}const enabledTargets = Object.entries(platforms || {}).filter(([, p]) => p?.enabled).map(([t]) => t);- return { drafts, busy, errors, prepare, submit, discard, platforms, history, enabledTargets, setPlatform, recordPost };+ return { drafts, busy, errors, prepare, discard, platforms, history, enabledTargets, setPlatform, recordPost };}diff --git a/client/src/services/apiMusicVideo.js b/client/src/services/apiMusicVideo.jsindex 728f2d0573..f7a89efc75 100644--- a/client/src/services/apiMusicVideo.js+++ b/client/src/services/apiMusicVideo.js@@ -214,11 +214,9 @@ export const selectMusicVideoPublishThumbnail = (id, filename, options = {}) =>request(`/music-video/${encodeURIComponent(id)}/publish-kit/thumbnail`, { method: 'PUT', body: JSON.stringify({ filename }), ...options });// ---- Posting (#9282) ----// Prepare fills the platform's post in the PortOS Browser → { draftId, target,-// summary, screenshot }; submit posts that live draft → { project, post }.+// summary, screenshot }. Manual posting is handled outside this wrapper.export const prepareMusicVideoPublishDraft = (id, target, options = {}, reqOptions = {}) =>request(`/music-video/${encodeURIComponent(id)}/publish/${encodeURIComponent(target)}/prepare`, { method: 'POST', body: JSON.stringify(options || {}), ...reqOptions });-export const submitMusicVideoPublishDraft = (id, draftId, options = {}) =>- request(`/music-video/${encodeURIComponent(id)}/publish/drafts/${encodeURIComponent(draftId)}/submit`, { method: 'POST', ...options });export const discardMusicVideoPublishDraft = (id, draftId, options = {}) =>request(`/music-video/${encodeURIComponent(id)}/publish/drafts/${encodeURIComponent(draftId)}`, { method: 'DELETE', ...options });// Where the director posts (#9287): { platforms, history } and platform toggles;diff --git a/server/routes/musicVideo.js b/server/routes/musicVideo.jsindex 849eab9e0b..2fd4a171ab 100644--- a/server/routes/musicVideo.js+++ b/server/routes/musicVideo.js@@ -118,7 +118,7 @@ import { startExcerptRender, attachExcerptRenderSseClient, cancelExcerptRender }import { deleteExcerpt, addReviewNote, editReviewNote, deleteReviewNote } from '../services/musicVideo/excerptService.js';import { suggestSocialCuts } from '../services/musicVideo/socialCuts.js';import { getActivePublishKitBuild, startPublishKitBuild, attachPublishKitSseClient, cancelPublishKitBuild, draftPublishKitCopy, updatePublishKitCopy, selectPublishKitThumbnail } from '../services/musicVideo/publishKit.js';-import { preparePublishDraft, submitPublishDraft, discardPublishDraft, recordPublishPost } from '../services/musicVideo/publish/index.js';+import { preparePublishDraft, discardPublishDraft, recordPublishPost } from '../services/musicVideo/publish/index.js';import { getPublishPlatforms, updatePublishPlatforms, publishHistory } from '../services/musicVideo/publish/platforms.js';import {getDependencyImpact,@@ -774,10 +774,6 @@ router.post('/:id/publish/:target/prepare', asyncHandler(async (req, res) => {res.json(await preparePublishDraft(req.params.id, target, options));}));-router.post('/:id/publish/drafts/:draftId/submit', asyncHandler(async (req, res) => {- res.json(await submitPublishDraft(req.params.id, req.params.draftId));-}));-router.delete('/:id/publish/drafts/:draftId', asyncHandler(async (req, res) => {res.json({ ok: await discardPublishDraft(req.params.id, req.params.draftId) });}));diff --git a/server/services/musicVideo/publish/index.js b/server/services/musicVideo/publish/index.jsindex cf71a2f58e..54041904dd 100644--- a/server/services/musicVideo/publish/index.js+++ b/server/services/musicVideo/publish/index.js@@ -108,15 +108,6 @@ export async function preparePublishDraft(projectId, target, options = {}, deps});}-/** Final publication is deliberately unavailable to agents and API callers.- * The operator reviews and publishes in the destination platform itself.- */-export async function submitPublishDraft() {- throw new ServerError('Publish manually in the destination platform, then record the post link in PortOS.', {- status: 403, code: 'PUBLISH_MANUAL_REQUIRED',- });-}-/** Close a draft without posting it. */export async function discardPublishDraft(projectId, draftId) {const draft = drafts.get(draftId);