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: split creative commission generation spec into a zod-free leaf (#6816)
[._.]/ Adam Eivy6998ebae1ba8
diff --git a/server/lib/README.md b/server/lib/README.mdindex a34cad22e9..140e3028dc 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -86,7 +86,8 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `catalogValidation.js` | Creative ingredients catalog route schemas (scraps, ingredients, links, relations, tags, revisions, sync envelope). || `cosValidation.js` | Chief-of-Staff task/job/loop/learning schemas, the Code-Review settings slice, and the task-metadata sanitizer. `createCosTaskSchema`'s metadata-bound fields are carried onto the task by `services/cosTaskIntake.js` (parity-checked by its test). The Review-Loop reviewer vocabulary lives in `reviewerConfig.js` (#5702) and is re-exported flat from here. || `creativeBriefLimits.js` | `COMMISSION_NAME_MAX` / `COMMISSION_INTENT_MAX` / `COMMISSION_STYLE_SPEC_MAX` / `COMMISSION_BRIEF_TAG_MAX` and `CREATIVE_DIRECTOR_GOAL_MAX` — the creative brief caps `creativeCommissionValidation.js` and `creativeDirectorValidation.js` enforce and the browser forms use as a silent input `maxLength`. A pure leaf (the schemas pull `zod`) so `client/src/components/creative-commission/commissionForm.js` and `client/src/lib/creativeDirectorPlan.js` re-export one definition instead of copying the numbers. |-| `creativeCommissionValidation.js` | Creative Commission (Autonomous Creation Engine) create/update + brief/schedule/generation schemas. The brief field caps it enforces come from `creativeBriefLimits.js`. |+| `creativeCommissionSpec.js` | `GENERATION_KEY_DEFS` / `ABILITY_GENERATION_SPEC` / `resolvedDefault` and the quality / aspect-ratio / image-mode / video-mode enums — the generation-param spec `creativeCommissionValidation.js` builds its Zod schema from and the ability adapters sanitize against. A pure leaf (like `creativeBriefLimits.js`) so `client/src/components/creative-commission/commissionForm.js` derives its fields/bounds/defaults from it directly instead of hand-copying them (#6816). |+| `creativeCommissionValidation.js` | Creative Commission (Autonomous Creation Engine) create/update + brief/schedule/generation schemas. The brief field caps it enforces come from `creativeBriefLimits.js`; the generation-param spec comes from `creativeCommissionSpec.js`. || `creativeDirectorValidation.js` | Creative Director project/treatment/scene, inert Video draft preferences, and Create-Suite importer schemas. The directive `goal` cap it enforces comes from `creativeBriefLimits.js`. || `digitalTwinValidation.js` | Digital twin document/category schemas. || `eidoverseValidation.js` | Eidoverse world-projection schemas — the `EIDOVERSE_PROJECTION_SOURCE_KEYS` allowlist, the V1/V2 projection recipe union (includes/assets/terrain/scale/districts/environment, with the `..`-escape guard on every asset path), and the world augment/say/config-patch route bodies (incl. the 8KB augment-argument cap). Split out of `validation.js` (#5698), which re-exports it. |diff --git a/server/lib/creativeCommissionSpec.js b/server/lib/creativeCommissionSpec.jsnew file mode 100644index 0000000000..57652dfc38--- /dev/null+++ b/server/lib/creativeCommissionSpec.js@@ -0,0 +1,132 @@+/**+ * Creative Commission generation spec — a pure, dependency-free leaf (#6816).+ *+ * The per-generation-key descriptors (type/bounds/values/default) and their+ * per-ability grouping used to live inside `creativeCommissionValidation.js`,+ * which pulls `zod` — so the browser form could only mirror them by hand.+ * That hand-copy already drifted three ways before this split: the+ * `durationMode` default (client `'auto'` vs server `'manual'`), the video+ * backend enum (client missing fal/reactor, #6213/#6214), and the image+ * backend enum (client missing agy, #4901). Splitting the DATA out from the+ * Zod SCHEMA BUILDER lets the server schema, the ability adapters, and the+ * client form all derive from this one object — the way `creativeBriefLimits.js`+ * already does for the brief field caps.+ *+ * Zod-free and Node-builtin-free by contract, like `creativeBriefLimits.js`:+ * `commissionForm.js` imports this module directly, so anything added here+ * must stay importable by the browser bundle.+ */++import { QUEUEABLE_IMAGE_MODES, VIDEO_GEN_MODES } from './generationModes.js';+import { RENDER_TARGET_BACKEND_AUTO } from './renderTargets.js';++export const CREATIVE_COMMISSION_QUALITIES = Object.freeze(['draft', 'standard', 'high']);+export const CREATIVE_COMMISSION_ASPECT_RATIOS = Object.freeze(['16:9', '9:16', '1:1']);++// `AUTO` is the default and the no-op: it means "resolve at fire time the way+// this install already would" (settings.imageGen.mode / the local video+// default), so an existing commission that never sets the field behaves+// exactly as before. Re-exported from the render-target leaf (#3231) so the+// two "no pin" protocol values can never diverge.+export const COMMISSION_RENDER_BACKEND_AUTO = RENDER_TARGET_BACKEND_AUTO;++// Image backends a commission may pin: the queueable image modes (local /+// codex / grok / agy — `external` never queues) plus the auto sentinel.+// Derived from QUEUEABLE_IMAGE_MODES so a new backend needs no edit here.+export const CREATIVE_COMMISSION_IMAGE_MODES = Object.freeze([+ COMMISSION_RENDER_BACKEND_AUTO, ...QUEUEABLE_IMAGE_MODES,+]);++// Video backends a commission may pin: local (MLX runtimes), grok, fal, or+// reactor, plus auto. Derived from VIDEO_GEN_MODES so a new backend needs no+// edit here — this enum is exactly what drifted client-side when fal (#6213)+// and reactor (#6214) shipped with no matching form edit.+export const CREATIVE_COMMISSION_VIDEO_MODES = Object.freeze([+ COMMISSION_RENDER_BACKEND_AUTO, ...VIDEO_GEN_MODES,+]);++// A model id is a free string (the media-models registry is user-editable, so+// an enum here would reject a legitimately-installed model). Bounded like the+// existing `generation.model`.+export const COMMISSION_RENDER_MODEL_MAX = 64;++// Per-KEY generation descriptor — the SINGLE SOURCE OF TRUTH for a generation+// param's type, bounds, and default, consumed by the server's Zod schema+// (`creativeCommissionValidation.js`), the ability adapters' data-driven+// sanitizer (`services/creativeCommissions/abilityAdapters.js`), AND the+// client form (`commissionForm.js`) — no more hand-copying any of it.+//+// `default` seeds a BRAND-NEW commission/form (a product/UX choice). A+// descriptor may additionally carry `legacyAbsent`: what an EXISTING stored+// record with the key missing ENTIRELY means, when that differs from+// `default`. `durationMode` is the one key where they diverge — the form+// seeds a fresh commission to `'auto'` (#4494), but a record written before+// this key existed always rendered a fixed length, so an absent key on a real+// record must still resolve to `'manual'`. Use `resolvedDefault()` below+// wherever an ABSENT OR INVALID stored value needs a fallback; reserve a bare+// `.default` read for seeding a genuinely new/blank record.+//+// `type: 'id'` is a nullable free-string model id: absent/blank normalizes to+// `null` (= "the install's default model"), which is why its `default` is+// null rather than a string. Distinct from the `enum`/`int` numeric-or-member+// kinds so the Zod builder and the adapter coercion both stay data-driven.+export const GENERATION_KEY_DEFS = Object.freeze({+ quality: { type: 'enum', values: CREATIVE_COMMISSION_QUALITIES, default: 'standard' },+ aspectRatio: { type: 'enum', values: CREATIVE_COMMISSION_ASPECT_RATIOS, default: '16:9' },+ targetDurationSeconds: { type: 'int', min: 5, max: 600, default: 10 },+ durationMode: {+ type: 'enum', values: ['auto', 'manual'], default: 'auto', legacyAbsent: 'manual',+ },+ imageCount: { type: 'int', min: 1, max: 6, default: 1 },+ lengthSeconds: { type: 'int', min: 5, max: 600, default: 30 },+ episodeCount: { type: 'int', min: 1, max: 6, default: 1 },+ // Render-backend pin (#3135) — `auto` = no pin (today's behavior).+ imageMode: { type: 'enum', values: CREATIVE_COMMISSION_IMAGE_MODES, default: COMMISSION_RENDER_BACKEND_AUTO },+ videoMode: { type: 'enum', values: CREATIVE_COMMISSION_VIDEO_MODES, default: COMMISSION_RENDER_BACKEND_AUTO },+ // Optional model id, only meaningful when the matching mode is pinned to a+ // backend that HAS a model knob (local diffusion / local video runtimes; the+ // cloud CLIs pick their own model). null = the install default.+ imageModelId: { type: 'id', max: COMMISSION_RENDER_MODEL_MAX, default: null },+ videoModelId: { type: 'id', max: COMMISSION_RENDER_MODEL_MAX, default: null },+});++// The fallback for an ABSENT or INVALID stored value: a descriptor's+// `legacyAbsent` when it has one (a compatibility reading only `durationMode`+// needs today), else its `default`. Every store-side coercion (the ability+// adapters' sanitizer) and every client-side projection of a REAL record must+// resolve an absent/invalid value through this — never `.default` directly —+// so the two readings can't drift back apart. Seeding a brand-new blank form+// is the one exception: it reads `.default` directly, because there is no+// record yet for `legacyAbsent` to describe.+export function resolvedDefault(def) {+ return def.legacyAbsent ?? def.default;+}++// Which keys each output type carries (the universal `model` is added+// separately by the schema — every type accepts an optional engine/model+// override). The backend pins (#3135) are scoped to the abilities that+// actually enqueue that kind of render: `imageMode` on `image`, `videoMode` on+// `video`, and BOTH on `music-video` (its plan renders a video, and the+// planner may render stills for it too). `music` and `series` carry neither —+// a series' per-issue renders are pinned on the pipeline series/stage+// records, not here.+const ABILITY_GENERATION_KEYS = Object.freeze({+ video: ['quality', 'aspectRatio', 'targetDurationSeconds', 'durationMode', 'videoMode', 'videoModelId'],+ image: ['quality', 'aspectRatio', 'imageCount', 'imageMode', 'imageModelId'],+ music: ['lengthSeconds'],+ 'music-video': ['quality', 'aspectRatio', 'targetDurationSeconds', 'durationMode', 'videoMode', 'videoModelId', 'imageMode', 'imageModelId'],+ series: ['episodeCount'],+});++// Derived per-ability { keys, defaults } view — the shape the store sanitizer,+// the client form, and tests consume. `defaults` is the LEGACY-AWARE+// resolution (`resolvedDefault`, not a bare `.default`): it's what an+// ability's sanitizer resolves an absent/invalid raw generation object to,+// and what the client projects a real (possibly pre-existing) record's+// missing key as.+export const ABILITY_GENERATION_SPEC = Object.freeze(+ Object.fromEntries(Object.entries(ABILITY_GENERATION_KEYS).map(([ability, keys]) => [ability, {+ keys,+ defaults: Object.fromEntries(keys.map((k) => [k, resolvedDefault(GENERATION_KEY_DEFS[k])])),+ }])),+);diff --git a/server/lib/creativeCommissionValidation.js b/server/lib/creativeCommissionValidation.jsindex a83a923dee..f63541fffd 100644--- a/server/lib/creativeCommissionValidation.js+++ b/server/lib/creativeCommissionValidation.js@@ -1,11 +1,27 @@import { z } from 'zod';import { EFFORT_LEVELS } from './providerModels.js';-import { QUEUEABLE_IMAGE_MODES, VIDEO_GEN_MODES } from './generationModes.js';-import { RENDER_TARGET_BACKEND_AUTO } from './renderTargets.js';import { recurrenceRuleSchema } from './recurrenceValidation.js';import {COMMISSION_BRIEF_TAG_MAX, COMMISSION_INTENT_MAX, COMMISSION_NAME_MAX, COMMISSION_STYLE_SPEC_MAX,} from './creativeBriefLimits.js';+import {+ CREATIVE_COMMISSION_QUALITIES, CREATIVE_COMMISSION_ASPECT_RATIOS,+ CREATIVE_COMMISSION_IMAGE_MODES, CREATIVE_COMMISSION_VIDEO_MODES,+ COMMISSION_RENDER_BACKEND_AUTO, COMMISSION_RENDER_MODEL_MAX,+ GENERATION_KEY_DEFS, ABILITY_GENERATION_SPEC,+} from './creativeCommissionSpec.js';++// Re-exported for every existing importer of this module (abilityAdapters.js,+// validation.js's `export *`, the barrel's namespace, tests): the spec itself+// now lives in creativeCommissionSpec.js (#6816) — a zod-free leaf the browser+// form imports directly — and this module keeps building the Zod schema from+// it exactly as before.+export {+ CREATIVE_COMMISSION_QUALITIES, CREATIVE_COMMISSION_ASPECT_RATIOS,+ CREATIVE_COMMISSION_IMAGE_MODES, CREATIVE_COMMISSION_VIDEO_MODES,+ COMMISSION_RENDER_BACKEND_AUTO, COMMISSION_RENDER_MODEL_MAX,+ GENERATION_KEY_DEFS, ABILITY_GENERATION_SPEC,+};// =============================================================================// CREATIVE COMMISSION SCHEMAS (Autonomous Creation Engine — #2657, Phase 1)@@ -37,106 +53,6 @@ export const CREATIVE_COMMISSION_ABILITIES = Object.freeze(['video', 'image', 'm// used for anchored intervals such as every two weeks or the last Thursday.export const CREATIVE_COMMISSION_SCHEDULE_KINDS = Object.freeze(['DAILY', 'WEEKLY', 'CUSTOM', 'RECURRENCE']);-export const CREATIVE_COMMISSION_QUALITIES = Object.freeze(['draft', 'standard', 'high']);-export const CREATIVE_COMMISSION_ASPECT_RATIOS = Object.freeze(['16:9', '9:16', '1:1']);--// Per-commission render-backend pin (#3135). Before this, which backend actually-// rendered a commission's image/video was an accidental side effect of whatever-// the Creative Director planner LLM happened to write into the job params — in-// practice always local, because nothing ever set `params.mode`. These enums let-// a commission SAY "always render on Grok" (or Codex, or local) and have the-// scheduled fire honor it.-//-// `AUTO` is the default and the no-op: it means "resolve at fire time the way-// this install already would" (settings.imageGen.mode / the local video default),-// so an existing commission that never sets the field behaves exactly as before.-// It is deliberately NOT a member of the backend enums — it is the absence of a-// pin, mirroring the `'auto'` sentinel the pipeline visual stages already ship-// (client/src/components/pipeline/stages/VisualGenSettings.jsx). Re-exported-// from the render-target leaf (#3231) so the two "no pin" protocol values can-// never diverge.-export const COMMISSION_RENDER_BACKEND_AUTO = RENDER_TARGET_BACKEND_AUTO;--// Image backends a commission may pin: the queueable image modes (local / codex-// / grok — `external` never queues) plus the auto sentinel. Derived from-// QUEUEABLE_IMAGE_MODES so a new backend needs no edit here.-export const CREATIVE_COMMISSION_IMAGE_MODES = Object.freeze([- COMMISSION_RENDER_BACKEND_AUTO, ...QUEUEABLE_IMAGE_MODES,-]);--// Video backends a commission may pin: local (MLX runtimes) or grok, plus auto.-export const CREATIVE_COMMISSION_VIDEO_MODES = Object.freeze([- COMMISSION_RENDER_BACKEND_AUTO, ...VIDEO_GEN_MODES,-]);--// A model id is a free string (the media-models registry is user-editable, so an-// enum here would reject a legitimately-installed model). Bounded like the-// existing `generation.model`.-export const COMMISSION_RENDER_MODEL_MAX = 64;--// Per-KEY generation descriptor — the SINGLE SOURCE OF TRUTH for a generation-// param's type, bounds, and default. Everything else derives from this: the Zod-// superset (`creativeCommissionGenerationSchema`), the per-ability key lists +-// defaults (`ABILITY_GENERATION_SPEC`), and the ability adapter's data-driven-// `sanitizeGeneration`. Keeping the bounds here (not re-typed in the schema AND-// the adapter AND the client) is what stops the four-way drift. The client-// (commissionForm.js) still mirrors these values by hand: this module pulls-// `zod`, so the browser can import them only once they move to a pure leaf,-// the way the brief caps did (`creativeBriefLimits.js`).-// `type: 'id'` is a nullable free-string model id: absent/blank normalizes to-// `null` (= "the install's default model"), which is why its `default` is null-// rather than a string. Distinct from the `enum`/`int` numeric-or-member kinds so-// the Zod builder and the adapter coercion both stay data-driven.-export const GENERATION_KEY_DEFS = Object.freeze({- quality: { type: 'enum', values: CREATIVE_COMMISSION_QUALITIES, default: 'standard' },- aspectRatio: { type: 'enum', values: CREATIVE_COMMISSION_ASPECT_RATIOS, default: '16:9' },- targetDurationSeconds: { type: 'int', min: 5, max: 600, default: 10 },- durationMode: { type: 'enum', values: ['auto', 'manual'], default: 'manual' },- imageCount: { type: 'int', min: 1, max: 6, default: 1 },- lengthSeconds: { type: 'int', min: 5, max: 600, default: 30 },- episodeCount: { type: 'int', min: 1, max: 6, default: 1 },- // Render-backend pin (#3135) — `auto` = no pin (today's behavior).- imageMode: { type: 'enum', values: CREATIVE_COMMISSION_IMAGE_MODES, default: COMMISSION_RENDER_BACKEND_AUTO },- videoMode: { type: 'enum', values: CREATIVE_COMMISSION_VIDEO_MODES, default: COMMISSION_RENDER_BACKEND_AUTO },- // Optional model id, only meaningful when the matching mode is pinned to a- // backend that HAS a model knob (local diffusion / local video runtimes; the- // cloud CLIs pick their own model). null = the install default.- //- // NOT a replacement for the universal `generation.model` below it: that one maps- // onto the CD project's `modelId` (the LTX variant the legacy treatment/scene- // flow renders with, `sceneRunner.js`) and is left untouched by #3135. These two- // are the PLAN-driven path's per-backend pins, which the scene flow never reads.- imageModelId: { type: 'id', max: COMMISSION_RENDER_MODEL_MAX, default: null },- videoModelId: { type: 'id', max: COMMISSION_RENDER_MODEL_MAX, default: null },-});--// Which keys each output type carries (the universal `model` is added separately-// — every type accepts an optional engine/model override). The adapter fills-// these keys' defaults and preserves only them.-//-// The backend pins (#3135) are scoped to the abilities that actually enqueue that-// kind of render: `imageMode` on `image`, `videoMode` on `video`, and BOTH on-// `music-video` (its plan renders a video, and the planner may render stills for-// it too). `music` and `series` carry neither — a series' per-issue renders are-// pinned on the pipeline series/stage records, not here.-const ABILITY_GENERATION_KEYS = Object.freeze({- video: ['quality', 'aspectRatio', 'targetDurationSeconds', 'durationMode', 'videoMode', 'videoModelId'],- image: ['quality', 'aspectRatio', 'imageCount', 'imageMode', 'imageModelId'],- music: ['lengthSeconds'],- 'music-video': ['quality', 'aspectRatio', 'targetDurationSeconds', 'durationMode', 'videoMode', 'videoModelId', 'imageMode', 'imageModelId'],- series: ['episodeCount'],-});--// Derived per-ability { keys, defaults } view — the shape the store sanitizer and-// tests consume. Built from GENERATION_KEY_DEFS so a default only ever lives in-// one place.-export const ABILITY_GENERATION_SPEC = Object.freeze(- Object.fromEntries(Object.entries(ABILITY_GENERATION_KEYS).map(([ability, keys]) => [ability, {- keys,- defaults: Object.fromEntries(keys.map((k) => [k, GENERATION_KEY_DEFS[k].default])),- }])),-);-// Keys allowed for a given ability (the spec keys + the universal `model`). Used// by the create-path superRefine to flag a param that doesn't belong to the type.export function generationKeysForAbility(ability) {diff --git a/server/lib/index.js b/server/lib/index.jsindex ad9f0cbf9a..6805912f48 100644--- a/server/lib/index.js+++ b/server/lib/index.js@@ -35,6 +35,9 @@ export * as cosValidation from './cosValidation.js';export * from './cronValidation.js';export * from './cosToolContracts.js';export * as creativeCommissionValidation from './creativeCommissionValidation.js';+// The generation-key spec creativeCommissionValidation.js builds its Zod schema+// from, as a pure leaf the browser form imports directly (no zod, no Node builtins).+export * from './creativeCommissionSpec.js';export * as creativeDirectorValidation from './creativeDirectorValidation.js';// The brief/goal caps both schemas above and the browser forms share, as a pure leaf.export * from './creativeBriefLimits.js';diff --git a/server/services/creativeCommissions/abilityAdapters.js b/server/services/creativeCommissions/abilityAdapters.jsindex bb016ad5e9..d15dde4928 100644--- a/server/services/creativeCommissions/abilityAdapters.js+++ b/server/services/creativeCommissions/abilityAdapters.js@@ -35,6 +35,7 @@ import {ABILITY_GENERATION_SPEC, GENERATION_KEY_DEFS, CREATIVE_COMMISSION_ABILITIES,COMMISSION_RENDER_BACKEND_AUTO,} from '../../lib/creativeCommissionValidation.js';+import { resolvedDefault } from '../../lib/creativeCommissionSpec.js';import { VIDEO_GEN_MODE } from '../videoGen/modes.js';import { buildVideoPromptGuidance } from './videoPromptGuidance.js';@@ -46,18 +47,32 @@ function pickModel(raw) {return isStr(raw?.model) && raw.model.trim() ? raw.model.trim() : null;}+// A commission's effective duration mode, made explicit: an ABSENT durationMode+// on a real record reads as `legacyAbsent` ('manual' — the pre-#4494 behavior+// every record without the key was already rendering), never the fresh-commission+// `default` ('auto'). Mirrors the client form's own record projection+// (commissionForm.js `generationToForm`) — see creativeCommissionSpec.js's+// GENERATION_KEY_DEFS.durationMode for the compatibility split.+function isAutoDuration(generation) {+ return (generation?.durationMode ?? GENERATION_KEY_DEFS.durationMode.legacyAbsent) === 'auto';+}+// Coerce one generation value against its GENERATION_KEY_DEFS descriptor, falling-// back to the default when absent/invalid (absent-vs-empty: a wrong-type or-// out-of-range value falls back rather than corrupting the record).+// back to the RESOLVED default when absent/invalid (absent-vs-empty: a wrong-type+// or out-of-range value falls back rather than corrupting the record).+// `resolvedDefault` prefers a descriptor's `legacyAbsent` over its `default` —+// the only key that matters for today (`durationMode`) needs an absent value to+// keep meaning `manual`, the pre-#4494 behavior, even though `default` now seeds+// a brand-new commission with `auto` (see creativeCommissionSpec.js).function coerceGenerationValue(key, raw) {const def = GENERATION_KEY_DEFS[key];const v = raw?.[key];- if (def.type === 'enum') return def.values.includes(v) ? v : def.default;+ if (def.type === 'enum') return def.values.includes(v) ? v : resolvedDefault(def);// A model id (#3135): trim to a non-empty string, else null. A blank/absent id// means "the install's default model", which is a real, meaningful value — not// a validation failure — so it normalizes rather than erroring.- if (def.type === 'id') return isStr(v) && v.trim() ? v.trim().slice(0, def.max) : def.default;- return Number.isInteger(v) && v >= def.min && v <= def.max ? v : def.default;+ if (def.type === 'id') return isStr(v) && v.trim() ? v.trim().slice(0, def.max) : resolvedDefault(def);+ return Number.isInteger(v) && v >= def.min && v <= def.max ? v : resolvedDefault(def);}// Fill an ability's generation defaults and keep ONLY that ability's keys (+ the@@ -174,7 +189,7 @@ function buildVideoGeometryParams(commission, { defaultVideoModelId } = {}) {// Auto mode lets the planner choose a per-step duration; retain a valid// project fallback for plans that omit one. Music-video commissions still// use their legacy audio length as the manual fallback.- targetDurationSeconds: gen?.durationMode === 'auto'+ targetDurationSeconds: isAutoDuration(gen)? 10: (gen?.targetDurationSeconds || gen?.lengthSeconds || 10),// Only passed when the commission actually pinned a backend (#3135), so an@@ -196,7 +211,7 @@ const videoAdapter = {sanitizeGeneration: (raw) => sanitizeGenerationFor('video', raw),buildProjectParams: buildVideoGeometryParams,buildDirective(commission, { defaultVideoModelId, effectiveVideoMode, effectiveVideoModelId } = {}) {- const duration = commission?.generation?.durationMode === 'auto'+ const duration = isAutoDuration(commission?.generation)? ' Choose an appropriate duration between 5 and 600 seconds for the brief.' : '';const { lines, digest, constraints } = briefContext(commission, `Create a short-form video piece.${duration}`);lines.unshift(videoPromptGuidanceFor(commission, { defaultVideoModelId, effectiveVideoMode, effectiveVideoModelId }));@@ -247,7 +262,7 @@ const musicVideoAdapter = {sanitizeGeneration: (raw) => sanitizeGenerationFor('music-video', raw),buildProjectParams: buildVideoGeometryParams,buildDirective(commission, { defaultVideoModelId, effectiveVideoMode, effectiveVideoModelId } = {}) {- const duration = commission?.generation?.durationMode === 'auto'+ const duration = isAutoDuration(commission?.generation)? ' Choose an appropriate video duration between 5 and 600 seconds for the brief.' : '';const lead = `Create a short-form music video:${duration} Generate an original music bed AND a matching video scored to it.`;const { lines, digest, constraints } = briefContext(commission, lead);