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
refactor: share server length caps with client through pure lib leaves (#9111)
[._.]/ Adam Eivy4308a44eb84f
diff --git a/client/src/components/pipeline/arcCanvas/ThemeChips.jsx b/client/src/components/pipeline/arcCanvas/ThemeChips.jsxindex 4a742129a2..77c5c2532c 100644--- a/client/src/components/pipeline/arcCanvas/ThemeChips.jsx+++ b/client/src/components/pipeline/arcCanvas/ThemeChips.jsx@@ -2,6 +2,7 @@ import { useRef, useState } from 'react';import { Plus, Loader2, X } from 'lucide-react';import toast from '../../ui/Toast';import { updatePipelineSeries } from '../../../services/api';+import { ARC_LIMITS } from '../../../../../server/lib/storyArcLimits.js';const THEME_COLORS = ['border-sky-400/40 bg-sky-500/10 text-sky-200',@@ -14,9 +15,7 @@ const THEME_COLORS = ['border-orange-400/40 bg-orange-500/10 text-orange-200',];-// Theme pill limits — mirror server/lib/storyArc.js ARC_LIMITS.-const THEME_MAX = 100;-const THEMES_PER_ARC_MAX = 20;+const { THEME_MAX, THEMES_PER_ARC_MAX } = ARC_LIMITS;// Inline-editable theme pills. Click a pill to rename, hover for the × to// remove, trailing dashed "+ Add theme" pill opens an inline input. Eachdiff --git a/client/src/hooks/useShellSession.js b/client/src/hooks/useShellSession.jsindex bc97a7c608..a322677b18 100644--- a/client/src/hooks/useShellSession.js+++ b/client/src/hooks/useShellSession.js@@ -15,9 +15,10 @@ import {import { readFileAsBase64 } from '../utils/fileUpload';import * as api from '../services/api';import toast from '../components/ui/Toast';+import { MAX_TOTAL_SESSIONS } from '../../../server/lib/shellLimits.js';-// Must match MAX_TOTAL_SESSIONS in server/services/shell.js-export const MAX_SESSIONS = 20;+// Shared with the server (lib/shellLimits.js) so the "at cap" UI can't drift.+export const MAX_SESSIONS = MAX_TOTAL_SESSIONS;// recoverToSurvivor's no-op fallback, for the one caller already sitting at bare// /shell and content to stay there when nothing is free to adopt.diff --git a/client/src/hooks/useShellSession.test.jsx b/client/src/hooks/useShellSession.test.jsxindex 1cab038414..6b9a118046 100644--- a/client/src/hooks/useShellSession.test.jsx+++ b/client/src/hooks/useShellSession.test.jsx@@ -35,6 +35,7 @@ vi.mock('../services/api', () => ({ sendShellImage }));vi.mock('../components/ui/Toast', () => ({ default: toastMock }));import { useShellSession, MAX_SESSIONS } from './useShellSession.js';+import { MAX_TOTAL_SESSIONS } from '../../../server/lib/shellLimits.js';const wrapper = ({ children }) => (<MemoryRouter initialEntries={['/shell']}>{children}</MemoryRouter>@@ -153,7 +154,7 @@ describe('useShellSession', () => {});it('exports the shell session cap', () => {- expect(MAX_SESSIONS).toBe(20);+ expect(MAX_SESSIONS).toBe(MAX_TOTAL_SESSIONS);});// Losing the session you are looking at must not strand you on a dead terminaldiff --git a/client/src/services/apiAlbums.js b/client/src/services/apiAlbums.jsindex aaf7e8a8cd..431c4d997c 100644--- a/client/src/services/apiAlbums.js+++ b/client/src/services/apiAlbums.js@@ -20,9 +20,6 @@ export const deleteAlbum = (id, requestOptions = {}) => request(`/albums/${encod...requestOptions,});-// Mirror server caps in server/services/albums/logic.js — bump both sides.-export const ALBUM_TITLE_MAX = 200;-export const ALBUM_DESCRIPTION_MAX = 4000;-export const ALBUM_GENRE_MAX = 120;+// Caps come from the server leaf so client inputs and the server sanitizer can't drift.+export { TITLE_MAX as ALBUM_TITLE_MAX, DESCRIPTION_MAX as ALBUM_DESCRIPTION_MAX, GENRE_MAX as ALBUM_GENRE_MAX, RELEASE_YEAR_MAX as ALBUM_RELEASE_YEAR_MAX } from '../../../server/lib/albumLimits.js';export const ALBUM_RELEASE_YEAR_MIN = 1850;-export const ALBUM_RELEASE_YEAR_MAX = 2200;diff --git a/client/src/services/apiArtists.js b/client/src/services/apiArtists.jsindex 7383f1cb47..622ddce0ba 100644--- a/client/src/services/apiArtists.js+++ b/client/src/services/apiArtists.js@@ -21,11 +21,5 @@ export const deleteArtist = (id, requestOptions = {}) => request(`/artists/${enc...requestOptions,});-// Mirror server caps in server/services/artists/logic.js — bump both sides.-export const ARTIST_NAME_MAX = 120;-export const ARTIST_GENRE_MAX = 120;-export const ARTIST_BIO_MAX = 4000;-export const ARTIST_MUSICAL_STYLE_MAX = 4000;-export const ARTIST_PHYSICAL_DESCRIPTION_MAX = 2000;-export const ARTIST_PORTRAIT_STYLE_MAX = 2000;-export const ARTIST_PORTRAIT_IMAGE_URL_MAX = 1000;+// Caps come from the server leaf so client inputs and the server sanitizer can't drift.+export { NAME_MAX as ARTIST_NAME_MAX, GENRE_MAX as ARTIST_GENRE_MAX, BIO_MAX as ARTIST_BIO_MAX, MUSICAL_STYLE_MAX as ARTIST_MUSICAL_STYLE_MAX, PHYSICAL_DESCRIPTION_MAX as ARTIST_PHYSICAL_DESCRIPTION_MAX, PORTRAIT_STYLE_MAX as ARTIST_PORTRAIT_STYLE_MAX, PORTRAIT_IMAGE_URL_MAX as ARTIST_PORTRAIT_IMAGE_URL_MAX } from '../../../server/lib/artistLimits.js';diff --git a/client/src/services/apiAuthors.js b/client/src/services/apiAuthors.jsindex c77e846232..5b49d00dfd 100644--- a/client/src/services/apiAuthors.js+++ b/client/src/services/apiAuthors.js@@ -20,10 +20,5 @@ export const deleteAuthor = (id, requestOptions = {}) => request(`/authors/${enc...requestOptions,});-// Mirror server caps in server/services/authors/logic.js — bump both sides.-export const AUTHOR_NAME_MAX = 120;-export const AUTHOR_WRITING_STYLE_MAX = 4000;-export const AUTHOR_BIO_MAX = 4000;-export const AUTHOR_PHYSICAL_DESCRIPTION_MAX = 2000;-export const AUTHOR_HEADSHOT_STYLE_MAX = 2000;-export const AUTHOR_HEADSHOT_IMAGE_URL_MAX = 1000;+// Caps come from the server leaf so client inputs and the server sanitizer can't drift.+export { NAME_MAX as AUTHOR_NAME_MAX, WRITING_STYLE_MAX as AUTHOR_WRITING_STYLE_MAX, BIO_MAX as AUTHOR_BIO_MAX, PHYSICAL_DESCRIPTION_MAX as AUTHOR_PHYSICAL_DESCRIPTION_MAX, HEADSHOT_STYLE_MAX as AUTHOR_HEADSHOT_STYLE_MAX, HEADSHOT_IMAGE_URL_MAX as AUTHOR_HEADSHOT_IMAGE_URL_MAX } from '../../../server/lib/authorLimits.js';diff --git a/client/src/services/apiPipeline.js b/client/src/services/apiPipeline.jsindex fa72e7b91e..486e49d9d2 100644--- a/client/src/services/apiPipeline.js+++ b/client/src/services/apiPipeline.js@@ -116,8 +116,8 @@ export const discoverSeriesVoice = (id, opts = {}, requestOptions = {}) =>...requestOptions,});-// Mirror server caps in `server/services/pipeline/series.js` — bump both sides.-export const SERIES_TITLE_LOGO_MAX = 2000;+// Cap comes from the server leaf so the client input and the sanitizer can't drift.+export { TITLE_LOGO_MAX as SERIES_TITLE_LOGO_MAX } from '../../../server/lib/storyArcLimits.js';// ---- Issues ----export const listPipelineIssues = (seriesId, options = {}) =>diff --git a/client/src/services/apiTracks.js b/client/src/services/apiTracks.jsindex 5cab9b3bc6..6b2e444de4 100644--- a/client/src/services/apiTracks.js+++ b/client/src/services/apiTracks.js@@ -131,7 +131,5 @@ export const renderTrackCode = (id, formData, requestOptions = {}) => request(`/...requestOptions,});-// Mirror server caps in server/services/tracks/logic.js — bump both sides.-export const TRACK_TITLE_MAX = 200;-export const TRACK_LYRICS_MAX = 20000;-export const TRACK_PROMPT_MAX = 8000;+// Caps come from the server leaf so client inputs and the server sanitizer can't drift.+export { TITLE_MAX as TRACK_TITLE_MAX, LYRICS_MAX as TRACK_LYRICS_MAX, PROMPT_MAX as TRACK_PROMPT_MAX } from '../../../server/lib/trackLimits.js';diff --git a/server/lib/README.md b/server/lib/README.mdindex 0321072430..8bce6cfdae 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -783,3 +783,8 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `musicVideoCreativeContext.js` | `musicVideoCreativeContext(concept)` composes the selected universe style and authored cast/place/object bible for planning and generation. || `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. || `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). Dependency-free; the client create drawer imports it. |+| `albumLimits.js` | Album record length/count caps shared by the albums sanitizer and client editors. |+| `artistLimits.js` | Artist record length caps shared by the artists sanitizer and client editors. |+| `authorLimits.js` | Author record length caps shared by the authors sanitizer and client editors. |+| `trackLimits.js` | Track record length/count caps shared by the tracks sanitizer and client editors. |+| `shellLimits.js` | `MAX_TOTAL_SESSIONS` shell-session cap shared by the shell service and the Shell UI. |diff --git a/server/lib/albumLimits.js b/server/lib/albumLimits.jsnew file mode 100644index 0000000000..202cae169b--- /dev/null+++ b/server/lib/albumLimits.js@@ -0,0 +1,13 @@+// Length/count caps for albums records. Pure constants so the server sanitizer+// (services/albums/logic.js) and the client editors import ONE definition —+// see storyArcLimits.js for the same pattern.+export const TITLE_MAX = 200;+export const ARTIST_ID_MAX = 80;+export const ARTIST_NAME_MAX = 120;+export const DESCRIPTION_MAX = 4000;+export const GENRE_MAX = 120;+export const COVER_IMAGE_URL_MAX = 1000;+export const TRACK_IDS_MAX = 200;+export const TRACK_ID_MAX = 80;+export const RELEASE_YEAR_MIN = 1850;+export const RELEASE_YEAR_MAX = 2200;diff --git a/server/lib/artistLimits.js b/server/lib/artistLimits.jsnew file mode 100644index 0000000000..917611b8a5--- /dev/null+++ b/server/lib/artistLimits.js@@ -0,0 +1,10 @@+// Length/count caps for artists records. Pure constants so the server sanitizer+// (services/artists/logic.js) and the client editors import ONE definition —+// see storyArcLimits.js for the same pattern.+export const NAME_MAX = 120;+export const GENRE_MAX = 120;+export const BIO_MAX = 4000;+export const MUSICAL_STYLE_MAX = 4000;+export const PHYSICAL_DESCRIPTION_MAX = 2000;+export const PORTRAIT_STYLE_MAX = 2000;+export const PORTRAIT_IMAGE_URL_MAX = 1000;diff --git a/server/lib/authorLimits.js b/server/lib/authorLimits.jsnew file mode 100644index 0000000000..4207e863c7--- /dev/null+++ b/server/lib/authorLimits.js@@ -0,0 +1,9 @@+// Length/count caps for authors records. Pure constants so the server sanitizer+// (services/authors/logic.js) and the client editors import ONE definition —+// see storyArcLimits.js for the same pattern.+export const NAME_MAX = 120;+export const WRITING_STYLE_MAX = 4000;+export const BIO_MAX = 4000;+export const PHYSICAL_DESCRIPTION_MAX = 2000;+export const HEADSHOT_STYLE_MAX = 2000;+export const HEADSHOT_IMAGE_URL_MAX = 1000;diff --git a/server/lib/index.js b/server/lib/index.jsindex 954ae867ed..1d6cfe1c52 100644--- a/server/lib/index.js+++ b/server/lib/index.js@@ -765,3 +765,8 @@ export * from './databaseWriterRegistry.js';export * from './musicVideoCreativeContext.js';export * from './moodBoardStyleContext.js';export * from './musicVideoAutomation.js';+export * as albumLimits from './albumLimits.js';+export * as artistLimits from './artistLimits.js';+export * as authorLimits from './authorLimits.js';+export * as trackLimits from './trackLimits.js';+export * from './shellLimits.js';diff --git a/server/lib/shellLimits.js b/server/lib/shellLimits.jsnew file mode 100644index 0000000000..5a46de3b9e--- /dev/null+++ b/server/lib/shellLimits.js@@ -0,0 +1,6 @@+// Soft ceiling on concurrent user-spawned interactive shells. Each session is a+// single idle PTY (a few MB, one OS process), and the deployment is single-user+// on a private network — so this is a sanity bound against runaway tab-spamming,+// not a resource/abuse defense. External views (TUI runs) don't count.+// Pure leaf: services/shell.js imports node-pty, so the browser cannot import it.+export const MAX_TOTAL_SESSIONS = 20;diff --git a/server/lib/storyArcLimits.js b/server/lib/storyArcLimits.jsindex b8bfb09ade..0c4b9ab815 100644--- a/server/lib/storyArcLimits.js+++ b/server/lib/storyArcLimits.js@@ -38,3 +38,6 @@ export const SERIES_DESIGN_FIELDS = Object.freeze({continuingTensions: 'Continuing tensions',endingCondition: 'Ending condition',});++// Title/logo design concept prose (series bible) — see services/pipeline/series.js.+export const TITLE_LOGO_MAX = 2000;diff --git a/server/lib/trackLimits.js b/server/lib/trackLimits.jsnew file mode 100644index 0000000000..76105d810a--- /dev/null+++ b/server/lib/trackLimits.js@@ -0,0 +1,17 @@+// Length/count caps for tracks records. Pure constants so the server sanitizer+// (services/tracks/logic.js) and the client editors import ONE definition —+// see storyArcLimits.js for the same pattern.+export const TITLE_MAX = 200;+export const ALBUM_ID_MAX = 80;+export const ARTIST_ID_MAX = 80;+export const ARTIST_NAME_MAX = 120;+export const CONCEPT_MAX = 8000;+export const LYRICS_MAX = 20000;+export const PROMPT_MAX = 8000;+export const ENGINE_MAX = 60;+export const MODEL_ID_MAX = 120;+export const EXECUTION_PROFILE_MAX = 80;+export const AUDIO_FILENAME_MAX = 256;+export const RENDER_ID_MAX = 80;+export const RENDER_SOURCE_MAX = 40;+export const RENDERS_MAX = 100;diff --git a/server/services/albums/logic.js b/server/services/albums/logic.jsindex aa38293fdc..57f8ae48f2 100644--- a/server/services/albums/logic.js+++ b/server/services/albums/logic.js@@ -26,21 +26,13 @@import { compareNewerWins } from '../../lib/lwwTimestamp.js';import { localImageFilename } from '../../lib/localImageFilename.js';import { isStr, trimTo } from '../../lib/textUtils.js';+import { TITLE_MAX, ARTIST_ID_MAX, ARTIST_NAME_MAX, DESCRIPTION_MAX, GENRE_MAX, COVER_IMAGE_URL_MAX, TRACK_IDS_MAX, TRACK_ID_MAX, RELEASE_YEAR_MIN, RELEASE_YEAR_MAX } from '../../lib/albumLimits.js';+export { TITLE_MAX, ARTIST_ID_MAX, ARTIST_NAME_MAX, DESCRIPTION_MAX, GENRE_MAX, COVER_IMAGE_URL_MAX, TRACK_IDS_MAX, TRACK_ID_MAX, RELEASE_YEAR_MIN, RELEASE_YEAR_MAX };export const ALBUM_ID_RE = /^album-[A-Za-z0-9-]{1,64}$/;-export const TITLE_MAX = 200;-export const ARTIST_ID_MAX = 80;-export const ARTIST_NAME_MAX = 120;-export const DESCRIPTION_MAX = 4000;-export const GENRE_MAX = 120;-export const COVER_IMAGE_URL_MAX = 1000;-export const TRACK_IDS_MAX = 200;-export const TRACK_ID_MAX = 80;// Sane bounds for a release year — wide enough for archival reissues, narrow// enough to reject a fat-fingered/garbage value.-export const RELEASE_YEAR_MIN = 1850;-export const RELEASE_YEAR_MAX = 2200;// Clamp an integer release year into the supported band; null when unparseable// so an album without a year stays distinct from one pinned to a bound.diff --git a/server/services/artists/logic.js b/server/services/artists/logic.jsindex f8b1eb37dd..dd5cdd6669 100644--- a/server/services/artists/logic.js+++ b/server/services/artists/logic.js@@ -27,16 +27,11 @@import { compareNewerWins } from '../../lib/lwwTimestamp.js';import { localImageFilename } from '../../lib/localImageFilename.js';import { isStr, trimTo } from '../../lib/textUtils.js';+import { NAME_MAX, GENRE_MAX, BIO_MAX, MUSICAL_STYLE_MAX, PHYSICAL_DESCRIPTION_MAX, PORTRAIT_STYLE_MAX, PORTRAIT_IMAGE_URL_MAX } from '../../lib/artistLimits.js';+export { NAME_MAX, GENRE_MAX, BIO_MAX, MUSICAL_STYLE_MAX, PHYSICAL_DESCRIPTION_MAX, PORTRAIT_STYLE_MAX, PORTRAIT_IMAGE_URL_MAX };export const ARTIST_ID_RE = /^artist-[A-Za-z0-9-]{1,64}$/;-export const NAME_MAX = 120;-export const GENRE_MAX = 120;-export const BIO_MAX = 4000;-export const MUSICAL_STYLE_MAX = 4000;-export const PHYSICAL_DESCRIPTION_MAX = 2000;-export const PORTRAIT_STYLE_MAX = 2000;-export const PORTRAIT_IMAGE_URL_MAX = 1000;/*** Normalize a raw artist record into the canonical stored shape. Returns nulldiff --git a/server/services/authors/logic.js b/server/services/authors/logic.jsindex 0a5ed1970b..3ad1ff44c8 100644--- a/server/services/authors/logic.js+++ b/server/services/authors/logic.js@@ -27,15 +27,11 @@import { compareNewerWins } from '../../lib/lwwTimestamp.js';import { localImageFilename } from '../../lib/localImageFilename.js';import { isStr, trimTo } from '../../lib/textUtils.js';+import { NAME_MAX, WRITING_STYLE_MAX, BIO_MAX, PHYSICAL_DESCRIPTION_MAX, HEADSHOT_STYLE_MAX, HEADSHOT_IMAGE_URL_MAX } from '../../lib/authorLimits.js';+export { NAME_MAX, WRITING_STYLE_MAX, BIO_MAX, PHYSICAL_DESCRIPTION_MAX, HEADSHOT_STYLE_MAX, HEADSHOT_IMAGE_URL_MAX };export const AUTHOR_ID_RE = /^auth-[A-Za-z0-9-]{1,64}$/;-export const NAME_MAX = 120;-export const WRITING_STYLE_MAX = 4000;-export const BIO_MAX = 4000;-export const PHYSICAL_DESCRIPTION_MAX = 2000;-export const HEADSHOT_STYLE_MAX = 2000;-export const HEADSHOT_IMAGE_URL_MAX = 1000;/*** Normalize a raw author record into the canonical stored shape. Returns nulldiff --git a/server/services/pipeline/series.js b/server/services/pipeline/series.jsindex 8b2b0ab791..0aa0a79970 100644--- a/server/services/pipeline/series.js+++ b/server/services/pipeline/series.js@@ -20,6 +20,7 @@ import { sanitizeCharacterArcList } from '../../lib/seriesCharacterArc.js';import { sanitizeStyleGuide } from '../../lib/styleGuide.js';import { sanitizeProseExportSettings } from '../../lib/proseExportSettings.js';import { LOGLINE_MAX, PREMISE_MAX, STYLE_NOTES_MAX } from '../../lib/universeBibleLimits.js';+import { TITLE_LOGO_MAX } from '../../lib/storyArcLimits.js';import { sanitizeSeverityWeights, sanitizeBlockingSeverities } from '../../lib/editorial/severityConfig.js';import { CHECK_SEVERITIES } from '../../lib/editorial/checkInfra/taxonomy.js';import { sanitizeOrigin } from '../../lib/sharingOrigin.js';@@ -75,7 +76,7 @@ export const STYLE_PROMPT_OVERRIDE_MODE_DEFAULT = 'prepend';// Title/logo design concept — prose description injected into cover + TV// title-screen prompts as the "logo design" cue. Generated from the universe's// style notes on series creation; editable in the bible.-export const TITLE_LOGO_MAX = 2000;+export { TITLE_LOGO_MAX };// Derived cover thumbnail — the filename of a rendered volume/issue cover,// stamped by seriesCoverImage.refreshSeriesCoverImage so the pipeline series// list can show a thumbnail (like the universe reference image) withoutdiff --git a/server/services/shell.js b/server/services/shell.jsindex 9bd5c79dff..370bc3e35d 100644--- a/server/services/shell.js+++ b/server/services/shell.js@@ -11,16 +11,11 @@ import { buildReadinessProbe } from '../lib/shellReadinessProbe.js';import { prepareCliSpawn } from '../lib/bufferedSpawn.js';import { createReplayBuffer } from '../lib/terminalReplay.js';import { findCommandOnPath } from '../lib/processEnv.js';+import { MAX_TOTAL_SESSIONS } from '../lib/shellLimits.js';// Store active shell sessions (persist across socket reconnects)const shellSessions = new Map();-// Soft ceiling on concurrent user-spawned interactive shells. Each session is a-// single idle PTY (a few MB, one OS process), and the deployment is single-user-// on a private network — so this is a sanity bound against runaway tab-spamming,-// not a resource/abuse defense. External views (TUI runs) don't count.-const MAX_TOTAL_SESSIONS = 20;-// Re-exported so a session caller reaches the Enter byte without importing the// TUI-handshake module directly. See lib/tuiHandshake.js for why it is CR.export { SUBMIT_KEY };diff --git a/server/services/tracks/logic.js b/server/services/tracks/logic.jsindex 61f3b1395b..ffadd98f45 100644--- a/server/services/tracks/logic.js+++ b/server/services/tracks/logic.js@@ -53,31 +53,19 @@ import { compareNewerWins } from '../../lib/lwwTimestamp.js';import { sanitizeChiptuneScore } from '../../lib/chiptuneScore.js';import { normalizeWaveSketch } from '../../lib/waveSketch.js';import { isStr, trimTo } from '../../lib/textUtils.js';+import { TITLE_MAX, ALBUM_ID_MAX, ARTIST_ID_MAX, ARTIST_NAME_MAX, CONCEPT_MAX, LYRICS_MAX, PROMPT_MAX, ENGINE_MAX, MODEL_ID_MAX, EXECUTION_PROFILE_MAX, AUDIO_FILENAME_MAX, RENDER_ID_MAX, RENDER_SOURCE_MAX, RENDERS_MAX } from '../../lib/trackLimits.js';+export { TITLE_MAX, ALBUM_ID_MAX, ARTIST_ID_MAX, ARTIST_NAME_MAX, CONCEPT_MAX, LYRICS_MAX, PROMPT_MAX, ENGINE_MAX, MODEL_ID_MAX, EXECUTION_PROFILE_MAX, AUDIO_FILENAME_MAX, RENDER_ID_MAX, RENDER_SOURCE_MAX, RENDERS_MAX };export const TRACK_ID_RE = /^track-[A-Za-z0-9-]{1,64}$/;-export const TITLE_MAX = 200;-export const ALBUM_ID_MAX = 80;-export const ARTIST_ID_MAX = 80;-export const ARTIST_NAME_MAX = 120;-export const CONCEPT_MAX = 8000;-export const LYRICS_MAX = 20000;-export const PROMPT_MAX = 8000;-export const ENGINE_MAX = 60;-export const MODEL_ID_MAX = 120;-export const EXECUTION_PROFILE_MAX = 80;-export const AUDIO_FILENAME_MAX = 256;-export const RENDER_ID_MAX = 80;// Render provenance slug (see `source` above). A lowercase slug rather than a// closed enum so a later import source is a value, not a sanitizer change; the// routes that WRITE a source validate it against the sources they support.-export const RENDER_SOURCE_MAX = 40;const RENDER_SOURCE_RE = /^[a-z0-9-]{1,40}$/;export const RENDER_SOURCES = Object.freeze({ UPLOAD: 'upload', SUNO: 'suno', YOUTUBE: 'youtube' });// Cap the render history per track so a runaway generate loop can't grow the// record unboundedly. Oldest renders fall off first (slice(-RENDERS_MAX)); the// audio bytes stay in the shared library (they may be referenced elsewhere).-export const RENDERS_MAX = 100;// A track clip's usable duration band — wide enough for a long-form generation,// bounded so a garbage value can't poison the record.export const DURATION_MIN_SEC = 1;