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 (claude): guard apply-target matching, gate attach on valid url, blur-commit seconds inputs, re-point stale analyze deep link
Adam Eivyc060fded9e98
diff --git a/client/src/components/songs/ReferenceAnalysis.jsx b/client/src/components/songs/ReferenceAnalysis.jsxindex dc9a0cd812..aaa4fd8742 100644--- a/client/src/components/songs/ReferenceAnalysis.jsx+++ b/client/src/components/songs/ReferenceAnalysis.jsx@@ -48,6 +48,26 @@ const secToMs = (raw) => {return Number.isFinite(n) ? Math.max(0, Math.round(n * 1000)) : 0;};+// Seconds input that commits on blur/Enter rather than per keystroke — a+// controlled `value={msToSec(...)}` reformats on every render, which fights+// sequential typing ("14" becomes "1.04"). Uncontrolled while focused; the+// caller passes a `key` tied to `valueMs` so an external update (the+// set-from-playhead flag buttons) remounts it with the fresh value.+function SecondsInput({ valueMs, onCommit, ariaLabel }) {+ return (+ <input+ type="number"+ min={0}+ step={0.1}+ defaultValue={msToSec(valueMs)}+ onBlur={(e) => onCommit(secToMs(e.target.value))}+ onKeyDown={(e) => { if (e.key === 'Enter') e.currentTarget.blur(); }}+ aria-label={ariaLabel}+ className="w-20 bg-port-bg border border-port-border rounded-lg px-2 py-1 text-xs text-white focus:border-port-accent focus:outline-none"+ />+ );+}+// --- Attach controls (edit-tab reference card) ------------------------------/**@@ -342,8 +362,11 @@ export default function ReferenceAnalysis({}setProposal({ layerId: seg.layerId, text });// Default the comparison to the stored part whose role matches the- // segment's layer (layer ids double as harmony-part roles).- const match = scoreParts.find((p) => p.role === seg.layerId);+ // segment's layer (layer ids double as harmony-part roles). Only when+ // the segment actually HAS a layer and the part a non-empty role — an+ // unassigned segment ('' layerId) must not silently preselect a+ // role-less hand-added part as the overwrite target.+ const match = seg.layerId ? scoreParts.find((p) => p.role && p.role === seg.layerId) : null;setCompareId(match?.id || '');}, 30);}, [decoded, tempo, songKey, scoreParts]);@@ -471,14 +494,11 @@ export default function ReferenceAnalysis({</select><label className="flex items-center gap-1 text-xs text-gray-400"><span>from</span>- <input- type="number"- min={0}- step={0.1}- value={msToSec(seg.startMs)}- onChange={(e) => updateSegment(idx, { startMs: secToMs(e.target.value) })}- aria-label="Segment start (seconds)"- className="w-20 bg-port-bg border border-port-border rounded-lg px-2 py-1 text-xs text-white focus:border-port-accent focus:outline-none"+ <SecondsInput+ key={`start-${seg.startMs}`}+ valueMs={seg.startMs}+ onCommit={(ms) => updateSegment(idx, { startMs: ms })}+ ariaLabel="Segment start (seconds)"/><span>s</span></label>@@ -487,14 +507,11 @@ export default function ReferenceAnalysis({</button><label className="flex items-center gap-1 text-xs text-gray-400"><span>to</span>- <input- type="number"- min={0}- step={0.1}- value={msToSec(seg.endMs)}- onChange={(e) => updateSegment(idx, { endMs: secToMs(e.target.value) })}- aria-label="Segment end (seconds)"- className="w-20 bg-port-bg border border-port-border rounded-lg px-2 py-1 text-xs text-white focus:border-port-accent focus:outline-none"+ <SecondsInput+ key={`end-${seg.endMs}`}+ valueMs={seg.endMs}+ onCommit={(ms) => updateSegment(idx, { endMs: ms })}+ ariaLabel="Segment end (seconds)"/><span>s</span></label>diff --git a/client/src/pages/RoundEditor.jsx b/client/src/pages/RoundEditor.jsxindex 8c944a2261..ec23c9676c 100644--- a/client/src/pages/RoundEditor.jsx+++ b/client/src/pages/RoundEditor.jsx@@ -223,7 +223,20 @@ export default function RoundEditor() {partnerRoundIds: song.partnerRoundIds || [],};const data = await updateRound(id, patch, { silent: true });- if (data?.round) setServerSong(data.round);+ if (data?.round) {+ setServerSong(data.round);+ // Saving strips temp reference ids, so a freshly-added reference gets a+ // new server uuid — re-point an open ?analyze= deep link at its saved+ // twin (matched by url + audioFilename) instead of stranding the+ // workbench on a "no longer exists" fallback.+ if (analyzeId && !(data.round.references || []).some((r) => r.id === analyzeId)) {+ const old = (song.references || []).find((r) => r.id === analyzeId);+ const twin = old && (data.round.references || []).find(+ (r) => r.url === old.url && (r.audioFilename || '') === (old.audioFilename || ''),+ );+ setAnalyze(twin ? twin.id : null);+ }+ }toast.success('Round saved');return data?.round;}, { errorMessage: 'Failed to save round' });@@ -705,17 +718,26 @@ export default function RoundEditor() {{tiktokVideoId(r.url) && <p className="text-xs text-port-success">✓ TikTok video — embeds in View</p>}{/* Reference-audio analysis (#2106): attach audio (upload ormic capture while the video plays), then analyze it into- per-layer proposed parts. */}+ per-layer proposed parts. Gated on a valid http(s) URL —+ the server DROPS a reference whose url fails that check,+ so letting the user attach audio/segments to a droppable+ row would silently lose that work on Save. */}<div className="flex flex-wrap items-center gap-2 pt-1 border-t border-port-border/60">- <ReferenceAudioAttach reference={r} onUpdate={(key, value) => updateReference(r.id, key, value)} />- {r.audioFilename && (- <button- type="button"- onClick={() => setAnalyze(r.id)}- className="flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-port-accent/50 text-port-accent hover:bg-port-accent/10"- >- <AudioLines size={14} /> Analyze audio- </button>+ {isHttpUrl(r.url) ? (+ <>+ <ReferenceAudioAttach reference={r} onUpdate={(key, value) => updateReference(r.id, key, value)} />+ {r.audioFilename && (+ <button+ type="button"+ onClick={() => setAnalyze(r.id)}+ className="flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-port-accent/50 text-port-accent hover:bg-port-accent/10"+ >+ <AudioLines size={14} /> Analyze audio+ </button>+ )}+ </>+ ) : (+ <span className="text-xs text-gray-600">Enter a valid http(s) link above to attach audio for analysis.</span>)}</div></div>