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([issue-10583]): keep lyricType's internal helpers unexported
Claude764660658553
diff --git a/server/services/musicVideo/documentTemplates/shared/lyricType.js b/server/services/musicVideo/documentTemplates/shared/lyricType.jsindex 039c02678e..b1e03dc547 100644--- a/server/services/musicVideo/documentTemplates/shared/lyricType.js+++ b/server/services/musicVideo/documentTemplates/shared/lyricType.js@@ -66,7 +66,7 @@ function lastAtOrBefore(sorted, t) {}/** The role a section kind or label implies (`hook` for choruses, else null). */-export function roleForSection(kindOrLabel) {+function roleForSection(kindOrLabel) {if (!kindOrLabel) return null;const value = String(kindOrLabel).trim().toLowerCase();if (HOOK_SECTIONS.has(value)) return 'hook';@@ -87,7 +87,7 @@ export function roleForSection(kindOrLabel) {* in (lyricMarkers section headers, else the timed song section's label), else* `line`. A role that is not one of LYRIC_ROLES is ignored.*/-export function resolveLineRoles(lines, { lyricMarkers = [], sections = [], overrides = {} } = {}) {+function resolveLineRoles(lines, { lyricMarkers = [], sections = [], overrides = {} } = {}) {const valid = (role) => (LYRIC_ROLES.includes(role) ? role : null);const markers = (Array.isArray(lyricMarkers) ? lyricMarkers : []).filter((m) => m && Number.isInteger(m.line));const sectionMarkers = markers.filter((m) => m.type === 'section').sort((a, b) => a.line - b.line);@@ -112,7 +112,7 @@ export function resolveLineRoles(lines, { lyricMarkers = [], sections = [], over* are; a line with one timing for several tokens is matched against the song's* aligned words in its window, else spread across the line's first 80%.*/-export function wordsForLine(line, songWords = []) {+function wordsForLine(line, songWords = []) {const text = String(line?.text || '').trim();const tokens = text.split(/\s+/).filter(Boolean);const timed = (Array.isArray(line?.words) ? line.words : [])@@ -151,7 +151,7 @@ export function wordsForLine(line, songWords = []) {* 0.3s after the last word ends (capped at the next line's onset); a `hook`* exits on the first beat at or after its last word, with no fade.*/-export function lineWindow(words, role, { beats = [], nextOnset = null, fps = 24, endSec = null } = {}) {+function lineWindow(words, role, { beats = [], nextOnset = null, fps = 24, endSec = null } = {}) {const T = LYRIC_TIMING;const onset = words[0].startSec;const last = words[words.length - 1];@@ -172,7 +172,7 @@ export function lineWindow(words, role, { beats = [], nextOnset = null, fps = 24}/** The pixel box a text zone allows on a width × height frame (null for `none`). */-export function zoneRect(zone, width, height) {+function zoneRect(zone, width, height) {const unit = Math.min(width, height) / 1080;const insetX = Math.max(72 * unit, width * 0.06);const insetY = Math.max(72 * unit, height * 0.07);diff --git a/server/services/musicVideo/documentTemplates/shared/lyricType.test.js b/server/services/musicVideo/documentTemplates/shared/lyricType.test.jsindex ba0ab3edfc..48c96ea02f 100644--- a/server/services/musicVideo/documentTemplates/shared/lyricType.test.js+++ b/server/services/musicVideo/documentTemplates/shared/lyricType.test.js@@ -1,7 +1,11 @@import { existsSync, readFileSync } from 'node:fs';import { afterAll, beforeAll, describe, expect, it } from 'vitest';import { chromium } from 'playwright-core';-import { createLyricType, resolveLineRoles, zoneRect } from './lyricType.js';+import { createLyricType } from './lyricType.js';++// zoneRect is the module's public text-zone geometry, reached through the global classic scripts use.+const { zoneRect } = globalThis.PORTOS_LYRIC_TYPE;+const roles = (mv, options) => createLyricType(mv, options).lines.map((l) => l.role);// A synthetic song: a verse line, a chorus line, a spoken direction, all word-timed.const words = (text, start, step = 0.3) => text.split(' ').map((w, i) => ({ text: w, startSec: start + i * step, endSec: start + i * step + 0.25 }));@@ -31,10 +35,12 @@ const measure = (str, font) => str.length * Number(/(\d+)px/.exec(font)[1]) * 0.describe('lyricType roles', () => {it('takes roles from the lyric sheet: section headers, then a line\'s delivery direction, overrides first', () => {- expect(resolveLineRoles(MV.lyrics, { lyricMarkers: MV.lyricMarkers })).toEqual(['line', 'hook', 'stamp']);- expect(resolveLineRoles(MV.lyrics, { lyricMarkers: MV.lyricMarkers, overrides: { l1: 'data', 0: 'stamp' } })).toEqual(['stamp', 'data', 'stamp']);+ const unzoned = { ...MV, scenes: [] };+ expect(roles(unzoned)).toEqual(['line', 'hook', 'stamp']);+ expect(roles(unzoned, { overrides: { l1: 'data', 0: 'stamp' } })).toEqual(['stamp', 'data', 'stamp']);// No sheet markers: the timed section label decides.- expect(resolveLineRoles(MV.lyrics, { sections: [{ label: 'Verse', startSec: 0 }, { label: 'Final Chorus', startSec: 4 }] })).toEqual(['line', 'hook', 'hook']);+ const timed = { ...unzoned, lyricMarkers: [], song: { ...MV.song, sections: [{ label: 'Verse', startSec: 0 }, { label: 'Final Chorus', startSec: 4 }] } };+ expect(roles(timed)).toEqual(['line', 'hook', 'hook']);});it('lets a shot override the role of the lines sung over it', () => {