@nodaro/shared 3.70.0 → 3.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/{chunk-FMQ43SJP.cjs → chunk-4A3ITJJB.cjs} +6 -6
  2. package/dist/{chunk-FMQ43SJP.cjs.map → chunk-4A3ITJJB.cjs.map} +1 -1
  3. package/dist/{chunk-XBHDXURR.cjs → chunk-4HV3LY4A.cjs} +78 -78
  4. package/dist/chunk-4HV3LY4A.cjs.map +1 -0
  5. package/dist/{chunk-52JNQG4K.js → chunk-6FUVGATF.js} +3 -3
  6. package/dist/{chunk-52JNQG4K.js.map → chunk-6FUVGATF.js.map} +1 -1
  7. package/dist/{chunk-GC77W57T.cjs → chunk-6PEWM2B3.cjs} +9 -9
  8. package/dist/{chunk-GC77W57T.cjs.map → chunk-6PEWM2B3.cjs.map} +1 -1
  9. package/dist/{chunk-BIQ7COJP.js → chunk-BO6IKV24.js} +5 -5
  10. package/dist/{chunk-BIQ7COJP.js.map → chunk-BO6IKV24.js.map} +1 -1
  11. package/dist/{chunk-IKN54UGB.js → chunk-BQV6NV7E.js} +3 -3
  12. package/dist/{chunk-IKN54UGB.js.map → chunk-BQV6NV7E.js.map} +1 -1
  13. package/dist/{chunk-LTBM2KMY.js → chunk-BVP4M5AK.js} +235 -9
  14. package/dist/chunk-BVP4M5AK.js.map +1 -0
  15. package/dist/{chunk-OW5AXH2Y.js → chunk-CL7ECTK2.js} +5 -4
  16. package/dist/chunk-CL7ECTK2.js.map +1 -0
  17. package/dist/{chunk-R22UHRR6.js → chunk-COA2OJIH.js} +39 -23
  18. package/dist/chunk-COA2OJIH.js.map +1 -0
  19. package/dist/{chunk-HW6TLOK4.cjs → chunk-DRPHRE4J.cjs} +2 -2
  20. package/dist/{chunk-HW6TLOK4.cjs.map → chunk-DRPHRE4J.cjs.map} +1 -1
  21. package/dist/{chunk-EWNDK4FV.js → chunk-F3XG5J5V.js} +3 -3
  22. package/dist/{chunk-EWNDK4FV.js.map → chunk-F3XG5J5V.js.map} +1 -1
  23. package/dist/{chunk-4U7QAUV3.cjs → chunk-H52P7DD2.cjs} +61 -61
  24. package/dist/{chunk-4U7QAUV3.cjs.map → chunk-H52P7DD2.cjs.map} +1 -1
  25. package/dist/{chunk-MZ772ZXA.cjs → chunk-HUCGHMOI.cjs} +17 -17
  26. package/dist/{chunk-MZ772ZXA.cjs.map → chunk-HUCGHMOI.cjs.map} +1 -1
  27. package/dist/{chunk-PYYYBINP.cjs → chunk-I4C6ZYU4.cjs} +6 -6
  28. package/dist/{chunk-PYYYBINP.cjs.map → chunk-I4C6ZYU4.cjs.map} +1 -1
  29. package/dist/{chunk-QCVQVKCI.js → chunk-JPSKVBYB.js} +3 -3
  30. package/dist/{chunk-QCVQVKCI.js.map → chunk-JPSKVBYB.js.map} +1 -1
  31. package/dist/{chunk-QVAUBB2T.js → chunk-K2P7KOIT.js} +9 -9
  32. package/dist/{chunk-QVAUBB2T.js.map → chunk-K2P7KOIT.js.map} +1 -1
  33. package/dist/{chunk-QV32JI4L.cjs → chunk-K5WRF2F3.cjs} +4 -4
  34. package/dist/{chunk-QV32JI4L.cjs.map → chunk-K5WRF2F3.cjs.map} +1 -1
  35. package/dist/{chunk-YLDY23N2.js → chunk-KD4UUCMW.js} +5 -5
  36. package/dist/{chunk-YLDY23N2.js.map → chunk-KD4UUCMW.js.map} +1 -1
  37. package/dist/{chunk-OZHE77T3.cjs → chunk-LBKMQAXD.cjs} +9 -9
  38. package/dist/{chunk-OZHE77T3.cjs.map → chunk-LBKMQAXD.cjs.map} +1 -1
  39. package/dist/{chunk-HBRDKHIW.cjs → chunk-MI4WEFJ4.cjs} +21 -21
  40. package/dist/{chunk-HBRDKHIW.cjs.map → chunk-MI4WEFJ4.cjs.map} +1 -1
  41. package/dist/{chunk-DOY47F7S.cjs → chunk-MN7BUGXF.cjs} +7 -7
  42. package/dist/{chunk-DOY47F7S.cjs.map → chunk-MN7BUGXF.cjs.map} +1 -1
  43. package/dist/{chunk-BLGZW3UF.cjs → chunk-NNCHSLFD.cjs} +291 -20
  44. package/dist/chunk-NNCHSLFD.cjs.map +1 -0
  45. package/dist/{chunk-NS34PZ2S.js → chunk-PPXUSZJU.js} +3 -3
  46. package/dist/{chunk-NS34PZ2S.js.map → chunk-PPXUSZJU.js.map} +1 -1
  47. package/dist/{chunk-PKWRAMVB.js → chunk-QME5O4NG.js} +7 -5
  48. package/dist/chunk-QME5O4NG.js.map +1 -0
  49. package/dist/{chunk-42ICEVUN.js → chunk-SAOIGWA2.js} +3 -3
  50. package/dist/{chunk-42ICEVUN.js.map → chunk-SAOIGWA2.js.map} +1 -1
  51. package/dist/{chunk-V6TC2NDG.js → chunk-SHSDGAI4.js} +4 -4
  52. package/dist/{chunk-V6TC2NDG.js.map → chunk-SHSDGAI4.js.map} +1 -1
  53. package/dist/{chunk-JEUZNHLL.cjs → chunk-SR7WH4FX.cjs} +33 -33
  54. package/dist/{chunk-JEUZNHLL.cjs.map → chunk-SR7WH4FX.cjs.map} +1 -1
  55. package/dist/{chunk-2VOXSVIE.js → chunk-SZ7ALYPK.js} +3 -3
  56. package/dist/{chunk-2VOXSVIE.js.map → chunk-SZ7ALYPK.js.map} +1 -1
  57. package/dist/{chunk-O53P2D4V.js → chunk-T4YYUI5Q.js} +3 -3
  58. package/dist/{chunk-O53P2D4V.js.map → chunk-T4YYUI5Q.js.map} +1 -1
  59. package/dist/{chunk-HWBLZSM3.cjs → chunk-TOYWEF6E.cjs} +39 -23
  60. package/dist/chunk-TOYWEF6E.cjs.map +1 -0
  61. package/dist/{chunk-FWPGRC4X.cjs → chunk-U6APV2PO.cjs} +5 -5
  62. package/dist/{chunk-FWPGRC4X.cjs.map → chunk-U6APV2PO.cjs.map} +1 -1
  63. package/dist/{chunk-QCZYYAPZ.cjs → chunk-UJIPIVTB.cjs} +48 -48
  64. package/dist/{chunk-QCZYYAPZ.cjs.map → chunk-UJIPIVTB.cjs.map} +1 -1
  65. package/dist/{chunk-KKFFQUMM.js → chunk-VZIMLPDC.js} +5 -5
  66. package/dist/chunk-VZIMLPDC.js.map +1 -0
  67. package/dist/{chunk-PWIKUOLB.cjs → chunk-W4CJ2P3F.cjs} +8 -8
  68. package/dist/{chunk-PWIKUOLB.cjs.map → chunk-W4CJ2P3F.cjs.map} +1 -1
  69. package/dist/{chunk-HP3YIWNJ.js → chunk-WARGPM7P.js} +2 -2
  70. package/dist/{chunk-HP3YIWNJ.js.map → chunk-WARGPM7P.js.map} +1 -1
  71. package/dist/{chunk-POZBRZUM.cjs → chunk-WHK3HTFY.cjs} +41 -41
  72. package/dist/{chunk-POZBRZUM.cjs.map → chunk-WHK3HTFY.cjs.map} +1 -1
  73. package/dist/{chunk-H2E4QXEZ.js → chunk-X3YRSRHP.js} +3 -3
  74. package/dist/{chunk-H2E4QXEZ.js.map → chunk-X3YRSRHP.js.map} +1 -1
  75. package/dist/{chunk-HA2PVTER.js → chunk-XK75VOEH.js} +4 -4
  76. package/dist/{chunk-HA2PVTER.js.map → chunk-XK75VOEH.js.map} +1 -1
  77. package/dist/{chunk-5DRSENY3.cjs → chunk-YHZUTPZL.cjs} +14 -12
  78. package/dist/{chunk-PKWRAMVB.js.map → chunk-YHZUTPZL.cjs.map} +1 -1
  79. package/dist/{chunk-WHV7MDNC.cjs → chunk-ZJQ2L3MI.cjs} +5 -3
  80. package/dist/chunk-ZJQ2L3MI.cjs.map +1 -0
  81. package/dist/entries/apps.cjs +42 -42
  82. package/dist/entries/apps.js +7 -7
  83. package/dist/entries/credits.cjs +418 -238
  84. package/dist/entries/credits.d.cts +262 -1
  85. package/dist/entries/credits.d.ts +262 -1
  86. package/dist/entries/credits.js +9 -9
  87. package/dist/entries/edl.cjs +60 -60
  88. package/dist/entries/edl.d.cts +96 -1
  89. package/dist/entries/edl.d.ts +96 -1
  90. package/dist/entries/edl.js +1 -1
  91. package/dist/entries/model-catalog.cjs +133 -133
  92. package/dist/entries/model-catalog.js +4 -4
  93. package/dist/entries/models.cjs +404 -404
  94. package/dist/entries/models.js +5 -5
  95. package/dist/entries/nodes.cjs +212 -212
  96. package/dist/entries/nodes.js +8 -8
  97. package/dist/entries/pipeline.cjs +153 -153
  98. package/dist/entries/pipeline.js +3 -3
  99. package/dist/entries/social.cjs +195 -191
  100. package/dist/entries/social.d.cts +9 -3
  101. package/dist/entries/social.d.ts +9 -3
  102. package/dist/entries/social.js +1 -1
  103. package/dist/entries/ugc.cjs +71 -71
  104. package/dist/entries/ugc.js +4 -4
  105. package/dist/entries/video.cjs +152 -152
  106. package/dist/entries/video.js +6 -6
  107. package/dist/index.cjs +1812 -1628
  108. package/dist/index.d.cts +3 -3
  109. package/dist/index.d.ts +3 -3
  110. package/dist/index.js +20 -20
  111. package/package.json +1 -1
  112. package/src/__tests__/audio-isolation-pricing.test.ts +49 -0
  113. package/src/__tests__/competitors.test.ts +6 -1
  114. package/src/__tests__/credit-identifiers.test.ts +9 -10
  115. package/src/__tests__/motion-transfer-pricing.test.ts +252 -0
  116. package/src/__tests__/video-to-video-pricing.test.ts +151 -0
  117. package/src/audio-isolation-pricing.ts +80 -0
  118. package/src/competitors.ts +8 -2
  119. package/src/credit-identifiers.ts +6 -0
  120. package/src/entries/credits.ts +54 -0
  121. package/src/entries/edl.ts +2 -0
  122. package/src/entries/social.ts +1 -0
  123. package/src/model-catalog.ts +34 -18
  124. package/src/motion-transfer-pricing.ts +239 -0
  125. package/src/producer-types.ts +2 -0
  126. package/src/use-case-output.ts +102 -0
  127. package/src/video-to-video-pricing.ts +248 -0
  128. package/dist/chunk-5DRSENY3.cjs.map +0 -1
  129. package/dist/chunk-BLGZW3UF.cjs.map +0 -1
  130. package/dist/chunk-HWBLZSM3.cjs.map +0 -1
  131. package/dist/chunk-KKFFQUMM.js.map +0 -1
  132. package/dist/chunk-LTBM2KMY.js.map +0 -1
  133. package/dist/chunk-OW5AXH2Y.js.map +0 -1
  134. package/dist/chunk-R22UHRR6.js.map +0 -1
  135. package/dist/chunk-WHV7MDNC.cjs.map +0 -1
  136. package/dist/chunk-XBHDXURR.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHWBLZSM3_cjs = require('./chunk-HWBLZSM3.cjs');
3
+ var chunkTOYWEF6E_cjs = require('./chunk-TOYWEF6E.cjs');
4
4
 
5
5
  // src/tts-capabilities.ts
6
6
  var TTS_PROVIDER_ALIASES = {
@@ -13,12 +13,12 @@ function canonicalTtsProvider(provider) {
13
13
  function findTtsCapabilities(provider) {
14
14
  if (typeof provider !== "string" || !provider) return void 0;
15
15
  const id = canonicalTtsProvider(provider);
16
- if (!Object.hasOwn(chunkHWBLZSM3_cjs.MODEL_CATALOG, id)) return void 0;
17
- const entry = chunkHWBLZSM3_cjs.MODEL_CATALOG[id];
16
+ if (!Object.hasOwn(chunkTOYWEF6E_cjs.MODEL_CATALOG, id)) return void 0;
17
+ const entry = chunkTOYWEF6E_cjs.MODEL_CATALOG[id];
18
18
  return entry.modes.includes("tts") ? entry.tts : void 0;
19
19
  }
20
20
  function getTtsCapabilities(provider) {
21
- return findTtsCapabilities(provider) ?? chunkHWBLZSM3_cjs.MODEL_CATALOG[TTS_FALLBACK_PROVIDER].tts;
21
+ return findTtsCapabilities(provider) ?? chunkTOYWEF6E_cjs.MODEL_CATALOG[TTS_FALLBACK_PROVIDER].tts;
22
22
  }
23
23
  function ttsSupportsAudioTags(provider) {
24
24
  return getTtsCapabilities(provider).audioTags;
@@ -96,7 +96,7 @@ function ttsDirectionProblem(provider, values) {
96
96
  var namedVoiceIds;
97
97
  function anyModelsNamedVoice(voice) {
98
98
  namedVoiceIds ??= new Set(
99
- Object.values(chunkHWBLZSM3_cjs.MODEL_CATALOG).flatMap((m) => m.modes.includes("tts") ? (m.tts?.voices ?? []).map((v) => v.id) : [])
99
+ Object.values(chunkTOYWEF6E_cjs.MODEL_CATALOG).flatMap((m) => m.modes.includes("tts") ? (m.tts?.voices ?? []).map((v) => v.id) : [])
100
100
  );
101
101
  return namedVoiceIds.has(voice);
102
102
  }
@@ -113,7 +113,7 @@ function ttsTakesReplica(provider) {
113
113
  return getTtsCapabilities(provider).replica === true;
114
114
  }
115
115
  function replicaModels() {
116
- return Object.values(chunkHWBLZSM3_cjs.MODEL_CATALOG).filter((m) => m.modes.includes("tts") && m.tts?.replica === true).map((m) => m.id);
116
+ return Object.values(chunkTOYWEF6E_cjs.MODEL_CATALOG).filter((m) => m.modes.includes("tts") && m.tts?.replica === true).map((m) => m.id);
117
117
  }
118
118
  function isHttpsLink(value) {
119
119
  if (typeof value !== "string") return false;
@@ -137,7 +137,7 @@ function ttsReplicaProblem(provider, value) {
137
137
  }
138
138
  function replicaConsentProblem(value) {
139
139
  if (value === void 0 || value === null) return void 0;
140
- return value.consent === true ? void 0 : `replica.consent must be true: it confirms "${chunkHWBLZSM3_cjs.REPLICA_CONSENT_ATTESTATION}"`;
140
+ return value.consent === true ? void 0 : `replica.consent must be true: it confirms "${chunkTOYWEF6E_cjs.REPLICA_CONSENT_ATTESTATION}"`;
141
141
  }
142
142
 
143
143
  exports.TTS_FALLBACK_PROVIDER = TTS_FALLBACK_PROVIDER;
@@ -164,5 +164,5 @@ exports.ttsSupportsStitching = ttsSupportsStitching;
164
164
  exports.ttsSupportsTimestamps = ttsSupportsTimestamps;
165
165
  exports.ttsTakesReplica = ttsTakesReplica;
166
166
  exports.ttsVoiceForModel = ttsVoiceForModel;
167
- //# sourceMappingURL=chunk-OZHE77T3.cjs.map
168
- //# sourceMappingURL=chunk-OZHE77T3.cjs.map
167
+ //# sourceMappingURL=chunk-LBKMQAXD.cjs.map
168
+ //# sourceMappingURL=chunk-LBKMQAXD.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tts-capabilities.ts"],"names":["MODEL_CATALOG","REPLICA_CONSENT_ATTESTATION"],"mappings":";;;;;AAmBO,IAAM,oBAAA,GAAyD;AAAA,EACpE,UAAA,EAAY;AACd;AAGO,IAAM,qBAAA,GAAwB;AAQ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A,OAAQ,KAAA,CAAgC,OAAA,KAAY,IAAA,GAChD,MAAA,GACA,8CAA8CC,6CAA2B,CAAA,CAAA,CAAA;AAC/E","file":"chunk-OZHE77T3.cjs","sourcesContent":["/**\n * Capability lookups for the text-to-speech lane.\n *\n * Every \"does this model do X\" decision on that lane reads the model's `tts`\n * sheet in `MODEL_CATALOG` through these helpers — tag stripping, which voice\n * settings are sent and shown, the language picker, whether neighbouring text\n * is sent. Declare the sheet honestly\n * on the catalog entry and a new model is covered everywhere; do not compare a\n * provider id by hand.\n *\n * \"The text-to-speech lane\" means the models that list the `tts` mode. The\n * dialogue models carry a sheet too, read by `dialogue-capabilities.ts`; a\n * text-to-speech request that names one runs as the fallback model, so these\n * helpers answer for the fallback there.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsDirectionSheet, type TtsSettingLever } from \"./model-catalog.js\"\nimport { REPLICA_CONSENT_ATTESTATION, type TtsNamedVoice, type TtsReplica } from \"./gemini-tts.js\"\n\n/** Legacy provider ids that are another model under an old name. They have no catalog entry of their own. */\nexport const TTS_PROVIDER_ALIASES: Readonly<Record<string, string>> = {\n elevenlabs: \"elevenlabs-turbo\",\n}\n\n/** The model a request runs on when its provider id is missing or unknown. */\nexport const TTS_FALLBACK_PROVIDER = \"elevenlabs-turbo\"\n\n/**\n * Resolve a legacy alias to the catalog id it runs as. Any other id passes\n * through unchanged. Own properties only: an id that happens to be the name of\n * an inherited object member (`constructor`, `__proto__`, `toString`) is an\n * unknown id like any other, never a function.\n */\nexport function canonicalTtsProvider(provider: string): string {\n return typeof provider === \"string\" && Object.hasOwn(TTS_PROVIDER_ALIASES, provider) ? TTS_PROVIDER_ALIASES[provider]! : provider\n}\n\n/** The capability sheet of a text-to-speech model, or `undefined` when the id is not one. */\nexport function findTtsCapabilities(provider: string | undefined): TtsCapabilities | undefined {\n // `typeof`: node data can be written straight into workflow JSON, so the \"string\" is not guaranteed — and\n // `Object.hasOwn` would coerce an array like [\"elevenlabs-v3\"] into that model's id. A non-string is an unknown id.\n if (typeof provider !== \"string\" || !provider) return undefined\n const id = canonicalTtsProvider(provider)\n if (!Object.hasOwn(MODEL_CATALOG, id)) return undefined\n const entry = MODEL_CATALOG[id]!\n return entry.modes.includes(\"tts\") ? entry.tts : undefined\n}\n\n/**\n * The capability sheet a text-to-speech request will actually run under: a\n * missing or unknown provider id runs as {@link TTS_FALLBACK_PROVIDER}, so it\n * gets that sheet — including its `maxChars` (turbo's 40,000), where\n * `getMaxTtsChars` keeps answering its 5,000 default for such ids.\n */\nexport function getTtsCapabilities(provider: string | undefined): TtsCapabilities {\n return findTtsCapabilities(provider) ?? MODEL_CATALOG[TTS_FALLBACK_PROVIDER]!.tts!\n}\n\n/** The model performs inline `[audio tags]`. false ⇒ strip them before sending. */\nexport function ttsSupportsAudioTags(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).audioTags\n}\n\n/** The model honours SSML `<break time=\"…\"/>` tags. */\nexport function ttsSupportsSsmlBreaks(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).ssmlBreaks\n}\n\n/**\n * The model conditions on neighbouring text (`previous_text` / `next_text`).\n * false ⇒ the provider funnel never puts the fields on the wire, whatever the\n * request carries — the model would reject them.\n */\nexport function ttsSupportsStitching(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).stitching\n}\n\n/** The model honours this voice-setting lever. */\nexport function ttsHasLever(provider: string | undefined, lever: TtsSettingLever): boolean {\n return getTtsCapabilities(provider).levers.includes(lever)\n}\n\n/** The model answers `/v1/text-to-speech/{voice}/with-timestamps` (character timings). */\nexport function ttsSupportsTimestamps(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).timestamps\n}\n\n/** Language codes offered for the model, in catalog order. */\nexport function ttsLanguageCodes(provider: string | undefined): readonly string[] {\n return getTtsCapabilities(provider).languages\n}\n\n/**\n * The named voices the model speaks, or `undefined` when it speaks the\n * ElevenLabs voices (premade, library, clones). See `TtsCapabilities.voices`.\n */\nexport function ttsNamedVoices(provider: string | undefined): readonly TtsNamedVoice[] | undefined {\n return getTtsCapabilities(provider).voices\n}\n\n/**\n * Whether `voice` is one the model can speak: on a model with named voices,\n * one of them by its exact wire name; on any other model, any id (the\n * ElevenLabs voice checks apply there, as before).\n */\nexport function ttsAcceptsVoice(provider: string | undefined, voice: string): boolean {\n const named = ttsNamedVoices(provider)\n return !named || named.some((v) => v.id === voice)\n}\n\n/**\n * The voice a request on a named-voice model runs with: the one it names when\n * the model speaks it, else the model's default. `undefined` on an ElevenLabs\n * model (its own default applies downstream).\n */\nexport function ttsNamedVoiceFor(provider: string | undefined, voice: unknown): string | undefined {\n const caps = getTtsCapabilities(provider)\n if (!caps.voices) return undefined\n return typeof voice === \"string\" && caps.voices.some((v) => v.id === voice) ? voice : caps.defaultVoice\n}\n\n/** The style direction the model takes (`TtsCapabilities.direction`), or `undefined` when it takes none. */\nexport function ttsDirection(provider: string | undefined): TtsDirectionSheet | undefined {\n return getTtsCapabilities(provider).direction\n}\n\n/** The model writes its tone tags `<in angle brackets>` from a closed list (`TtsCapabilities.tagSyntax`). */\nexport function ttsAngleTags(provider: string | undefined): readonly string[] | undefined {\n const caps = getTtsCapabilities(provider)\n return caps.audioTags && caps.tagSyntax === \"angle\" ? (caps.tags ?? []) : undefined\n}\n\n/**\n * The style direction of a request, as the model takes it: each field kept\n * only when the model's sheet names it and the value is one it accepts (a\n * listed choice, or free text within its cap — trimmed, an empty one\n * dropped). What the provider funnel sends and the workflow engine passes on;\n * the REST route rejects instead of dropping (`ttsDirectionProblem`).\n */\nexport interface TtsDirectionValues {\n styleDirection?: string\n pace?: string\n accent?: string\n audioProfile?: string\n}\n\nexport function ttsDirectionFor(provider: string | undefined, values: Readonly<Record<string, unknown>>): TtsDirectionValues {\n const sheet = ttsDirection(provider)\n if (!sheet) return {}\n const text = (value: unknown, max: number | undefined): string | undefined => {\n if (max === undefined || typeof value !== \"string\") return undefined\n const trimmed = value.trim()\n return trimmed && trimmed.length <= max ? trimmed : undefined\n }\n const choice = (value: unknown, choices: readonly string[] | undefined): string | undefined =>\n choices && typeof value === \"string\" && choices.includes(value) ? value : undefined\n const out: TtsDirectionValues = {}\n const style = sheet.styles ? choice(values.styleDirection, sheet.styles) : text(values.styleDirection, sheet.styleMaxChars)\n if (style !== undefined) out.styleDirection = style\n const pace = choice(values.pace, sheet.paces)\n if (pace !== undefined) out.pace = pace\n const accent = choice(values.accent, sheet.accents)\n if (accent !== undefined) out.accent = accent\n const profile = text(values.audioProfile, sheet.audioProfileMaxChars)\n if (profile !== undefined) out.audioProfile = profile\n return out\n}\n\n/**\n * Why a request's style direction cannot run on the model, or `undefined`\n * when it can. Only the fields the model takes are judged; on a model that\n * takes none, or a field it does not take, the value is never sent (as the\n * neighbour text on a model that does not stitch), so it is no problem.\n */\nexport function ttsDirectionProblem(provider: string | undefined, values: Readonly<Record<string, unknown>>): { field: keyof TtsDirectionValues; message: string } | undefined {\n const sheet = ttsDirection(provider)\n if (!sheet) return undefined\n const textProblem = (field: keyof TtsDirectionValues, max: number | undefined) => {\n const value = values[field]\n if (max === undefined || value === undefined) return undefined\n if (typeof value !== \"string\") return { field, message: `${field} must be a string` }\n return value.trim().length > max ? { field, message: `${field} must be at most ${max} characters` } : undefined\n }\n const choiceProblem = (field: keyof TtsDirectionValues, choices: readonly string[] | undefined) => {\n const value = values[field]\n if (!choices || value === undefined || value === \"\") return undefined\n return typeof value === \"string\" && choices.includes(value) ? undefined : { field, message: `${field} must be one of: ${choices.join(\", \")}` }\n }\n return (\n (sheet.styles ? choiceProblem(\"styleDirection\", sheet.styles) : textProblem(\"styleDirection\", sheet.styleMaxChars)) ??\n choiceProblem(\"pace\", sheet.paces) ??\n choiceProblem(\"accent\", sheet.accents) ??\n textProblem(\"audioProfile\", sheet.audioProfileMaxChars)\n )\n}\n\n/** Every voice name a named-voice model speaks (all of them, across models). Built once from the catalog. */\nlet namedVoiceIds: ReadonlySet<string> | undefined\nfunction anyModelsNamedVoice(voice: string): boolean {\n namedVoiceIds ??= new Set(\n Object.values(MODEL_CATALOG).flatMap((m) => (m.modes.includes(\"tts\") ? (m.tts?.voices ?? []).map((v) => v.id) : [])),\n )\n return namedVoiceIds.has(voice)\n}\n\n/**\n * The voice a text-to-speech run on `provider` speaks, when the model and the\n * voice may have been chosen apart — a published app's Model card, a field\n * mapping onto the model, an upstream Character's voice, a preset's voice with\n * a model the caller named (decided 2026-11-13: the editor's model-switch rule,\n * applied wherever the editor is not there to apply it):\n * - a model with named voices (Gemini): the voice when it is one of them, its\n * default voice for any other voice, and none (its default) for none;\n * - an ElevenLabs model: none (the deployment's default) for a voice that only\n * a named-voice model speaks (`Fola`, `Kore`…), else the voice as given.\n * Returns `undefined` for \"no voice named\"; never a voice the model refuses.\n */\nexport function ttsVoiceForModel(provider: string | undefined, voice: unknown): string | undefined {\n const named = typeof voice === \"string\" && voice.length > 0 ? voice : undefined\n const caps = getTtsCapabilities(provider)\n if (caps.voices) {\n if (named === undefined) return undefined\n return caps.voices.some((v) => v.id === named) ? named : caps.defaultVoice\n }\n return named !== undefined && anyModelsNamedVoice(named) ? undefined : named\n}\n\n/** The model clones a speaker's voice for one request (`TtsCapabilities.replica`: Gemini 3.8 Flash). */\nexport function ttsTakesReplica(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).replica === true\n}\n\n/** Every model that takes a one-off clone, in catalog order (for a refusal's sentence). */\nexport function replicaModels(): string[] {\n return Object.values(MODEL_CATALOG).filter((m) => m.modes.includes(\"tts\") && m.tts?.replica === true).map((m) => m.id)\n}\n\n/** Whether `value` is an https link (the only scheme a recording is fetched from). */\nfunction isHttpsLink(value: unknown): value is string {\n if (typeof value !== \"string\") return false\n try {\n return new URL(value).protocol === \"https:\"\n } catch {\n return false\n }\n}\n\n/** A request's one-off clone as the platform reads it: two https links, or undefined when absent or not that shape. */\nexport function replicaOf(value: unknown): TtsReplica | undefined {\n if (!value || typeof value !== \"object\") return undefined\n const { sourceAudioUrl, consentAudioUrl } = value as Record<string, unknown>\n return isHttpsLink(sourceAudioUrl) && isHttpsLink(consentAudioUrl) ? { sourceAudioUrl, consentAudioUrl } : undefined\n}\n\n/**\n * Why a request's one-off clone (`replica`) cannot run on the model, or\n * undefined (none asked, or one it takes). Refused, never dropped: a clone\n * that is not sent is someone else's voice. The recordings themselves (WAV,\n * size, length) are judged where they are fetched (backend\n * `lib/voice-replica.ts`).\n */\nexport function ttsReplicaProblem(provider: string | undefined, value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n if (!ttsTakesReplica(provider)) {\n return `${provider ?? \"This model\"} does not clone a voice; a one-off clone runs on ${replicaModels().join(\", \")}`\n }\n return replicaOf(value) ? undefined : \"replica needs sourceAudioUrl and consentAudioUrl, each an https link to a WAV recording\"\n}\n\n/**\n * Why an API or MCP clone lacks its consent, or undefined: a `replica` asked\n * must say `consent: true` — the caller's confirmation of\n * `REPLICA_CONSENT_ATTESTATION`, what the editor's checkbox says (decided\n * 2026-11-13). Refused before anything is read or held.\n */\nexport function replicaConsentProblem(value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n return (value as { consent?: unknown }).consent === true\n ? undefined\n : `replica.consent must be true: it confirms \"${REPLICA_CONSENT_ATTESTATION}\"`\n}\n\n"]}
1
+ {"version":3,"sources":["../src/tts-capabilities.ts"],"names":["MODEL_CATALOG","REPLICA_CONSENT_ATTESTATION"],"mappings":";;;;;AAmBO,IAAM,oBAAA,GAAyD;AAAA,EACpE,UAAA,EAAY;AACd;AAGO,IAAM,qBAAA,GAAwB;AAQ9B,SAAS,qBAAqB,QAAA,EAA0B;AAC7D,EAAA,OAAO,OAAO,QAAA,KAAa,QAAA,IAAY,MAAA,CAAO,MAAA,CAAO,sBAAsB,QAAQ,CAAA,GAAI,oBAAA,CAAqB,QAAQ,CAAA,GAAK,QAAA;AAC3H;AAGO,SAAS,oBAAoB,QAAA,EAA2D;AAG7F,EAAA,IAAI,OAAO,QAAA,KAAa,QAAA,IAAY,CAAC,UAAU,OAAO,MAAA;AACtD,EAAA,MAAM,EAAA,G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IAAI,GAAA,CAAI,KAAK,CAAA,CAAE,QAAA,KAAa,QAAA;AAAA,EACrC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAGO,SAAS,UAAU,KAAA,EAAwC;AAChE,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,UAAU,OAAO,MAAA;AAChD,EAAA,MAAM,EAAE,cAAA,EAAgB,eAAA,EAAgB,GAAI,KAAA;AAC5C,EAAA,OAAO,WAAA,CAAY,cAAc,CAAA,IAAK,WAAA,CAAY,eAAe,CAAA,GAAI,EAAE,cAAA,EAAgB,eAAA,EAAgB,GAAI,MAAA;AAC7G;AASO,SAAS,iBAAA,CAAkB,UAA8B,KAAA,EAAoC;AAClG,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,IAAA,EAAM,OAAO,MAAA;AAClD,EAAA,IAAI,CAAC,eAAA,CAAgB,QAAQ,CAAA,EAAG;AAC9B,IAAA,OAAO,CAAA,EAAG,YAAY,YAAY,CAAA,iDAAA,EAAoD,eAAc,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA;AAAA,EAClH;AACA,EAAA,OAAO,SAAA,CAAU,KAAK,CAAA,GAAI,MAAA,GAAY,yFAAA;AACxC;AAQO,SAAS,sBAAsB,KAAA,EAAoC;AACxE,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,IAAA,EAAM,OAAO,MAAA;AAClD,EAAA,OAAQ,KAAA,CAAgC,OAAA,KAAY,IAAA,GAChD,MAAA,GACA,8CAA8CC,6CAA2B,CAAA,CAAA,CAAA;AAC/E","file":"chunk-LBKMQAXD.cjs","sourcesContent":["/**\n * Capability lookups for the text-to-speech lane.\n *\n * Every \"does this model do X\" decision on that lane reads the model's `tts`\n * sheet in `MODEL_CATALOG` through these helpers — tag stripping, which voice\n * settings are sent and shown, the language picker, whether neighbouring text\n * is sent. Declare the sheet honestly\n * on the catalog entry and a new model is covered everywhere; do not compare a\n * provider id by hand.\n *\n * \"The text-to-speech lane\" means the models that list the `tts` mode. The\n * dialogue models carry a sheet too, read by `dialogue-capabilities.ts`; a\n * text-to-speech request that names one runs as the fallback model, so these\n * helpers answer for the fallback there.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsDirectionSheet, type TtsSettingLever } from \"./model-catalog.js\"\nimport { REPLICA_CONSENT_ATTESTATION, type TtsNamedVoice, type TtsReplica } from \"./gemini-tts.js\"\n\n/** Legacy provider ids that are another model under an old name. They have no catalog entry of their own. */\nexport const TTS_PROVIDER_ALIASES: Readonly<Record<string, string>> = {\n elevenlabs: \"elevenlabs-turbo\",\n}\n\n/** The model a request runs on when its provider id is missing or unknown. */\nexport const TTS_FALLBACK_PROVIDER = \"elevenlabs-turbo\"\n\n/**\n * Resolve a legacy alias to the catalog id it runs as. Any other id passes\n * through unchanged. Own properties only: an id that happens to be the name of\n * an inherited object member (`constructor`, `__proto__`, `toString`) is an\n * unknown id like any other, never a function.\n */\nexport function canonicalTtsProvider(provider: string): string {\n return typeof provider === \"string\" && Object.hasOwn(TTS_PROVIDER_ALIASES, provider) ? TTS_PROVIDER_ALIASES[provider]! : provider\n}\n\n/** The capability sheet of a text-to-speech model, or `undefined` when the id is not one. */\nexport function findTtsCapabilities(provider: string | undefined): TtsCapabilities | undefined {\n // `typeof`: node data can be written straight into workflow JSON, so the \"string\" is not guaranteed — and\n // `Object.hasOwn` would coerce an array like [\"elevenlabs-v3\"] into that model's id. A non-string is an unknown id.\n if (typeof provider !== \"string\" || !provider) return undefined\n const id = canonicalTtsProvider(provider)\n if (!Object.hasOwn(MODEL_CATALOG, id)) return undefined\n const entry = MODEL_CATALOG[id]!\n return entry.modes.includes(\"tts\") ? entry.tts : undefined\n}\n\n/**\n * The capability sheet a text-to-speech request will actually run under: a\n * missing or unknown provider id runs as {@link TTS_FALLBACK_PROVIDER}, so it\n * gets that sheet — including its `maxChars` (turbo's 40,000), where\n * `getMaxTtsChars` keeps answering its 5,000 default for such ids.\n */\nexport function getTtsCapabilities(provider: string | undefined): TtsCapabilities {\n return findTtsCapabilities(provider) ?? MODEL_CATALOG[TTS_FALLBACK_PROVIDER]!.tts!\n}\n\n/** The model performs inline `[audio tags]`. false ⇒ strip them before sending. */\nexport function ttsSupportsAudioTags(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).audioTags\n}\n\n/** The model honours SSML `<break time=\"…\"/>` tags. */\nexport function ttsSupportsSsmlBreaks(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).ssmlBreaks\n}\n\n/**\n * The model conditions on neighbouring text (`previous_text` / `next_text`).\n * false ⇒ the provider funnel never puts the fields on the wire, whatever the\n * request carries — the model would reject them.\n */\nexport function ttsSupportsStitching(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).stitching\n}\n\n/** The model honours this voice-setting lever. */\nexport function ttsHasLever(provider: string | undefined, lever: TtsSettingLever): boolean {\n return getTtsCapabilities(provider).levers.includes(lever)\n}\n\n/** The model answers `/v1/text-to-speech/{voice}/with-timestamps` (character timings). */\nexport function ttsSupportsTimestamps(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).timestamps\n}\n\n/** Language codes offered for the model, in catalog order. */\nexport function ttsLanguageCodes(provider: string | undefined): readonly string[] {\n return getTtsCapabilities(provider).languages\n}\n\n/**\n * The named voices the model speaks, or `undefined` when it speaks the\n * ElevenLabs voices (premade, library, clones). See `TtsCapabilities.voices`.\n */\nexport function ttsNamedVoices(provider: string | undefined): readonly TtsNamedVoice[] | undefined {\n return getTtsCapabilities(provider).voices\n}\n\n/**\n * Whether `voice` is one the model can speak: on a model with named voices,\n * one of them by its exact wire name; on any other model, any id (the\n * ElevenLabs voice checks apply there, as before).\n */\nexport function ttsAcceptsVoice(provider: string | undefined, voice: string): boolean {\n const named = ttsNamedVoices(provider)\n return !named || named.some((v) => v.id === voice)\n}\n\n/**\n * The voice a request on a named-voice model runs with: the one it names when\n * the model speaks it, else the model's default. `undefined` on an ElevenLabs\n * model (its own default applies downstream).\n */\nexport function ttsNamedVoiceFor(provider: string | undefined, voice: unknown): string | undefined {\n const caps = getTtsCapabilities(provider)\n if (!caps.voices) return undefined\n return typeof voice === \"string\" && caps.voices.some((v) => v.id === voice) ? voice : caps.defaultVoice\n}\n\n/** The style direction the model takes (`TtsCapabilities.direction`), or `undefined` when it takes none. */\nexport function ttsDirection(provider: string | undefined): TtsDirectionSheet | undefined {\n return getTtsCapabilities(provider).direction\n}\n\n/** The model writes its tone tags `<in angle brackets>` from a closed list (`TtsCapabilities.tagSyntax`). */\nexport function ttsAngleTags(provider: string | undefined): readonly string[] | undefined {\n const caps = getTtsCapabilities(provider)\n return caps.audioTags && caps.tagSyntax === \"angle\" ? (caps.tags ?? []) : undefined\n}\n\n/**\n * The style direction of a request, as the model takes it: each field kept\n * only when the model's sheet names it and the value is one it accepts (a\n * listed choice, or free text within its cap — trimmed, an empty one\n * dropped). What the provider funnel sends and the workflow engine passes on;\n * the REST route rejects instead of dropping (`ttsDirectionProblem`).\n */\nexport interface TtsDirectionValues {\n styleDirection?: string\n pace?: string\n accent?: string\n audioProfile?: string\n}\n\nexport function ttsDirectionFor(provider: string | undefined, values: Readonly<Record<string, unknown>>): TtsDirectionValues {\n const sheet = ttsDirection(provider)\n if (!sheet) return {}\n const text = (value: unknown, max: number | undefined): string | undefined => {\n if (max === undefined || typeof value !== \"string\") return undefined\n const trimmed = value.trim()\n return trimmed && trimmed.length <= max ? trimmed : undefined\n }\n const choice = (value: unknown, choices: readonly string[] | undefined): string | undefined =>\n choices && typeof value === \"string\" && choices.includes(value) ? value : undefined\n const out: TtsDirectionValues = {}\n const style = sheet.styles ? choice(values.styleDirection, sheet.styles) : text(values.styleDirection, sheet.styleMaxChars)\n if (style !== undefined) out.styleDirection = style\n const pace = choice(values.pace, sheet.paces)\n if (pace !== undefined) out.pace = pace\n const accent = choice(values.accent, sheet.accents)\n if (accent !== undefined) out.accent = accent\n const profile = text(values.audioProfile, sheet.audioProfileMaxChars)\n if (profile !== undefined) out.audioProfile = profile\n return out\n}\n\n/**\n * Why a request's style direction cannot run on the model, or `undefined`\n * when it can. Only the fields the model takes are judged; on a model that\n * takes none, or a field it does not take, the value is never sent (as the\n * neighbour text on a model that does not stitch), so it is no problem.\n */\nexport function ttsDirectionProblem(provider: string | undefined, values: Readonly<Record<string, unknown>>): { field: keyof TtsDirectionValues; message: string } | undefined {\n const sheet = ttsDirection(provider)\n if (!sheet) return undefined\n const textProblem = (field: keyof TtsDirectionValues, max: number | undefined) => {\n const value = values[field]\n if (max === undefined || value === undefined) return undefined\n if (typeof value !== \"string\") return { field, message: `${field} must be a string` }\n return value.trim().length > max ? { field, message: `${field} must be at most ${max} characters` } : undefined\n }\n const choiceProblem = (field: keyof TtsDirectionValues, choices: readonly string[] | undefined) => {\n const value = values[field]\n if (!choices || value === undefined || value === \"\") return undefined\n return typeof value === \"string\" && choices.includes(value) ? undefined : { field, message: `${field} must be one of: ${choices.join(\", \")}` }\n }\n return (\n (sheet.styles ? choiceProblem(\"styleDirection\", sheet.styles) : textProblem(\"styleDirection\", sheet.styleMaxChars)) ??\n choiceProblem(\"pace\", sheet.paces) ??\n choiceProblem(\"accent\", sheet.accents) ??\n textProblem(\"audioProfile\", sheet.audioProfileMaxChars)\n )\n}\n\n/** Every voice name a named-voice model speaks (all of them, across models). Built once from the catalog. */\nlet namedVoiceIds: ReadonlySet<string> | undefined\nfunction anyModelsNamedVoice(voice: string): boolean {\n namedVoiceIds ??= new Set(\n Object.values(MODEL_CATALOG).flatMap((m) => (m.modes.includes(\"tts\") ? (m.tts?.voices ?? []).map((v) => v.id) : [])),\n )\n return namedVoiceIds.has(voice)\n}\n\n/**\n * The voice a text-to-speech run on `provider` speaks, when the model and the\n * voice may have been chosen apart — a published app's Model card, a field\n * mapping onto the model, an upstream Character's voice, a preset's voice with\n * a model the caller named (decided 2026-11-13: the editor's model-switch rule,\n * applied wherever the editor is not there to apply it):\n * - a model with named voices (Gemini): the voice when it is one of them, its\n * default voice for any other voice, and none (its default) for none;\n * - an ElevenLabs model: none (the deployment's default) for a voice that only\n * a named-voice model speaks (`Fola`, `Kore`…), else the voice as given.\n * Returns `undefined` for \"no voice named\"; never a voice the model refuses.\n */\nexport function ttsVoiceForModel(provider: string | undefined, voice: unknown): string | undefined {\n const named = typeof voice === \"string\" && voice.length > 0 ? voice : undefined\n const caps = getTtsCapabilities(provider)\n if (caps.voices) {\n if (named === undefined) return undefined\n return caps.voices.some((v) => v.id === named) ? named : caps.defaultVoice\n }\n return named !== undefined && anyModelsNamedVoice(named) ? undefined : named\n}\n\n/** The model clones a speaker's voice for one request (`TtsCapabilities.replica`: Gemini 3.8 Flash). */\nexport function ttsTakesReplica(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).replica === true\n}\n\n/** Every model that takes a one-off clone, in catalog order (for a refusal's sentence). */\nexport function replicaModels(): string[] {\n return Object.values(MODEL_CATALOG).filter((m) => m.modes.includes(\"tts\") && m.tts?.replica === true).map((m) => m.id)\n}\n\n/** Whether `value` is an https link (the only scheme a recording is fetched from). */\nfunction isHttpsLink(value: unknown): value is string {\n if (typeof value !== \"string\") return false\n try {\n return new URL(value).protocol === \"https:\"\n } catch {\n return false\n }\n}\n\n/** A request's one-off clone as the platform reads it: two https links, or undefined when absent or not that shape. */\nexport function replicaOf(value: unknown): TtsReplica | undefined {\n if (!value || typeof value !== \"object\") return undefined\n const { sourceAudioUrl, consentAudioUrl } = value as Record<string, unknown>\n return isHttpsLink(sourceAudioUrl) && isHttpsLink(consentAudioUrl) ? { sourceAudioUrl, consentAudioUrl } : undefined\n}\n\n/**\n * Why a request's one-off clone (`replica`) cannot run on the model, or\n * undefined (none asked, or one it takes). Refused, never dropped: a clone\n * that is not sent is someone else's voice. The recordings themselves (WAV,\n * size, length) are judged where they are fetched (backend\n * `lib/voice-replica.ts`).\n */\nexport function ttsReplicaProblem(provider: string | undefined, value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n if (!ttsTakesReplica(provider)) {\n return `${provider ?? \"This model\"} does not clone a voice; a one-off clone runs on ${replicaModels().join(\", \")}`\n }\n return replicaOf(value) ? undefined : \"replica needs sourceAudioUrl and consentAudioUrl, each an https link to a WAV recording\"\n}\n\n/**\n * Why an API or MCP clone lacks its consent, or undefined: a `replica` asked\n * must say `consent: true` — the caller's confirmation of\n * `REPLICA_CONSENT_ATTESTATION`, what the editor's checkbox says (decided\n * 2026-11-13). Refused before anything is read or held.\n */\nexport function replicaConsentProblem(value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n return (value as { consent?: unknown }).consent === true\n ? undefined\n : `replica.consent must be true: it confirms \"${REPLICA_CONSENT_ATTESTATION}\"`\n}\n\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkQV32JI4L_cjs = require('./chunk-QV32JI4L.cjs');
3
+ var chunkK5WRF2F3_cjs = require('./chunk-K5WRF2F3.cjs');
4
4
 
5
5
  // src/ugc-call-body.ts
6
6
  var pick = (a, from, to) => a[from] !== void 0 && a[from] !== null ? { [to]: a[from] } : {};
@@ -86,7 +86,7 @@ function ugcPrelude(answer) {
86
86
  const speech = callOf(answer.speech, "generate_speech");
87
87
  const align = callOf(answer.align, "forced_alignment");
88
88
  const split = callOf(answer.split, "ugc_split_speech");
89
- if (!speech || !align || !split || typeof speech.text !== "string" || !isObject(split.plan)) return { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
89
+ if (!speech || !align || !split || typeof speech.text !== "string" || !isObject(split.plan)) return { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
90
90
  return {
91
91
  speech: {
92
92
  text: speech.text,
@@ -102,21 +102,21 @@ function ugcPrelude(answer) {
102
102
  function ugcPreludeOutput(step, output) {
103
103
  const value = step === "speech" ? output?.audioUrl : step === "alignment" ? output?.alignment : output?.segments;
104
104
  const ok = step === "speech" ? typeof value === "string" && value !== "" : Array.isArray(value) && value.length > 0;
105
- return ok ? { value } : { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
105
+ return ok ? { value } : { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
106
106
  }
107
107
  function ugcClipsPhase2Body(body, segments) {
108
108
  return { ...body, segments: [...segments] };
109
109
  }
110
110
  function ugcRunEstimateInput(plan) {
111
- const targetDurationSec = chunkQV32JI4L_cjs.ugcPlanLengthSec(plan);
111
+ const targetDurationSec = chunkK5WRF2F3_cjs.ugcPlanLengthSec(plan);
112
112
  const language = planOf(plan)?.language;
113
- if (targetDurationSec === void 0 || typeof language !== "string" || language === "en" || !chunkQV32JI4L_cjs.UGC_SCRIPT_LANGUAGES.includes(language)) {
114
- return { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
113
+ if (targetDurationSec === void 0 || typeof language !== "string" || language === "en" || !chunkK5WRF2F3_cjs.UGC_SCRIPT_LANGUAGES.includes(language)) {
114
+ return { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
115
115
  }
116
- return { runEstimate: { targetDurationSec, screenshotCount: chunkQV32JI4L_cjs.ugcPlanScreenshotCount(plan) ?? 0, source: "sampled", language } };
116
+ return { runEstimate: { targetDurationSec, screenshotCount: chunkK5WRF2F3_cjs.ugcPlanScreenshotCount(plan) ?? 0, source: "sampled", language } };
117
117
  }
118
118
  function ugcRenderHoldBody(input) {
119
- if (!Array.isArray(input.tickets) || input.tickets.length === 0) return { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
119
+ if (!Array.isArray(input.tickets) || input.tickets.length === 0) return { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
120
120
  return {
121
121
  path: "/v1/ugc/quote",
122
122
  body: {
@@ -138,18 +138,18 @@ function planOf(plan) {
138
138
  }
139
139
  var isCredits = (x) => typeof x === "number" && Number.isFinite(x) && x >= 0;
140
140
  function ugcRenderHoldVerdict(answer) {
141
- if (!isObject(answer) || !isCredits(answer.ceiling) || !isCredits(answer.runHold)) return { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
142
- return answer.ceiling > answer.runHold ? { error: chunkQV32JI4L_cjs.UGC_OVER_HOLD_MESSAGE } : { ok: true };
141
+ if (!isObject(answer) || !isCredits(answer.ceiling) || !isCredits(answer.runHold)) return { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
142
+ return answer.ceiling > answer.runHold ? { error: chunkK5WRF2F3_cjs.UGC_OVER_HOLD_MESSAGE } : { ok: true };
143
143
  }
144
144
  function ugcFinishPlan(input) {
145
145
  const clips = input.clipUrls.filter((u) => typeof u === "string" && u !== "");
146
- if (clips.length === 0) return { error: chunkQV32JI4L_cjs.UGC_FINISH_NEEDS_CLIPS_MESSAGE };
147
- const read = chunkQV32JI4L_cjs.readUgcWire(input.planOutWire, chunkQV32JI4L_cjs.UGC_NODE_MESSAGES.needsPlanOut);
146
+ if (clips.length === 0) return { error: chunkK5WRF2F3_cjs.UGC_FINISH_NEEDS_CLIPS_MESSAGE };
147
+ const read = chunkK5WRF2F3_cjs.readUgcWire(input.planOutWire, chunkK5WRF2F3_cjs.UGC_NODE_MESSAGES.needsPlanOut);
148
148
  if ("error" in read) return read;
149
149
  const finish = read.value.finish;
150
150
  if (finish === void 0) return { kind: "pass", clips };
151
- if (!isObject(finish) || !Array.isArray(finish.segments) || finish.segments.length === 0) return { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
152
- if (finish.segments.length !== clips.length) return { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
151
+ if (!isObject(finish) || !Array.isArray(finish.segments) || finish.segments.length === 0) return { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
152
+ if (finish.segments.length !== clips.length) return { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
153
153
  return {
154
154
  kind: "job",
155
155
  path: "/v1/ugc/finish",
@@ -157,12 +157,12 @@ function ugcFinishPlan(input) {
157
157
  };
158
158
  }
159
159
  function ugcFinishOutputs(output) {
160
- if (!output) return { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
161
- if (output.ready === false) return { error: chunkQV32JI4L_cjs.UGC_FINISH_NOT_READY_MESSAGE };
162
- if (output.ready !== true || !Array.isArray(output.clips) || output.clips.length === 0) return { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
160
+ if (!output) return { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
161
+ if (output.ready === false) return { error: chunkK5WRF2F3_cjs.UGC_FINISH_NOT_READY_MESSAGE };
162
+ if (output.ready !== true || !Array.isArray(output.clips) || output.clips.length === 0) return { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
163
163
  const warnings = Array.isArray(output.warnings) ? output.warnings.flatMap((w) => isObject(w) && typeof w.code === "string" ? [w.code] : typeof w === "string" ? [w] : []) : [];
164
164
  const rows = [...output.clips].filter(isObject).sort((a, b) => Number(a.clip) - Number(b.clip));
165
- if (rows.length !== output.clips.length || rows.some((r, i) => r.clip !== i + 1 || typeof r.url !== "string" || r.url === "")) return { error: chunkQV32JI4L_cjs.UGC_NEWER_APP_MESSAGE };
165
+ if (rows.length !== output.clips.length || rows.some((r, i) => r.clip !== i + 1 || typeof r.url !== "string" || r.url === "")) return { error: chunkK5WRF2F3_cjs.UGC_NEWER_APP_MESSAGE };
166
166
  return {
167
167
  clips: rows.map((r) => ({
168
168
  url: r.url,
@@ -175,7 +175,7 @@ function ugcFinishWired(edges, nodes, clipsId) {
175
175
  return edges.some((e) => e.source === clipsId && e.sourceHandle === "plan-out" && e.target !== void 0 && finishIds.has(e.target) && (e.targetHandle ?? "") === "plan");
176
176
  }
177
177
  function ugcLaneNeedsFinish(edges, nodes, clipsId) {
178
- return ugcFinishWired(edges, nodes, clipsId) ? null : chunkQV32JI4L_cjs.UGC_NEEDS_FINISH_MESSAGE;
178
+ return ugcFinishWired(edges, nodes, clipsId) ? null : chunkK5WRF2F3_cjs.UGC_NEEDS_FINISH_MESSAGE;
179
179
  }
180
180
 
181
181
  exports.UGC_FINISH_CLIPS_TYPE = UGC_FINISH_CLIPS_TYPE;
@@ -193,5 +193,5 @@ exports.ugcPreludeOutput = ugcPreludeOutput;
193
193
  exports.ugcRenderHoldBody = ugcRenderHoldBody;
194
194
  exports.ugcRenderHoldVerdict = ugcRenderHoldVerdict;
195
195
  exports.ugcRunEstimateInput = ugcRunEstimateInput;
196
- //# sourceMappingURL=chunk-HBRDKHIW.cjs.map
197
- //# sourceMappingURL=chunk-HBRDKHIW.cjs.map
196
+ //# sourceMappingURL=chunk-MI4WEFJ4.cjs.map
197
+ //# sourceMappingURL=chunk-MI4WEFJ4.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ugc-call-body.ts","../src/ugc-lane-wires.ts"],"names":["pick","UGC_NEWER_APP_MESSAGE","ugcPlanLengthSec","UGC_SCRIPT_LANGUAGES","ugcPlanScreenshotCount","UGC_OVER_HOLD_MESSAGE","UGC_FINISH_NEEDS_CLIPS_MESSAGE","readUgcWire","UGC_NODE_MESSAGES","UGC_FINISH_NOT_READY_MESSAGE","UGC_NEEDS_FINISH_MESSAGE"],"mappings":";;;;;AAkBA,IAAM,IAAA,GAAO,CAAC,CAAA,EAAsC,IAAA,EAAc,OAChE,CAAA,CAAE,IAAI,MAAM,MAAA,IAAa,CAAA,CAAE,IAAI,CAAA,KAAM,IAAA,GAAO,EAAE,CAAC,EAAE,GAAG,CAAA,CAAE,IAAI,CAAA,EAAE,GAAI,EAAC;AAGnE,SAAS,UAAU,CAAA,EAA+D;AAChF,EAAA,OAAO;AAAA,IACL,GAAG,IAAA,CAAK,CAAA,EAAG,UAAA,EAAY,UAAU,CAAA;AAAA,IACjC,GAAG,IAAA,CAAK,CAAA,EAAG,kBAAA,EAAoB,iBAAiB,CAAA;AAAA,IAChD,GAAI,EAAE,aAAA,KAAkB,IAAA,GAAO,EAAE,YAAA,EAAc,IAAA,KAAS,EAAC;AAAA,I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,EAAA,OAAO,KAAA,CAAM,KAAK,CAAC,CAAA,KAAM,EAAE,MAAA,KAAW,OAAA,IAAW,EAAE,YAAA,KAAiB,UAAA,IAAc,EAAE,MAAA,KAAW,MAAA,IAAa,UAAU,GAAA,CAAI,CAAA,CAAE,MAAM,CAAA,IAAA,CAAM,CAAA,CAAE,YAAA,IAAgB,EAAA,MAAQ,MAAM,CAAA;AAC1K;AAGO,SAAS,kBAAA,CACd,KAAA,EACA,KAAA,EACA,OAAA,EACe;AACf,EAAA,OAAO,cAAA,CAAe,KAAA,EAAO,KAAA,EAAO,OAAO,IAAI,IAAA,GAAOS,0CAAA;AACxD","file":"chunk-HBRDKHIW.cjs","sourcesContent":["/**\n * A UGC builder call `{ tool, args }` (MCP argument names) → the REST body of\n * the public route that tool dispatches to. The builder sets every price lever;\n * this adds none — its one addition is the image of a call that needs the\n * previous step's image (`imageArg`, or the photo of `image_to_text`). A tool\n * it does not know → undefined, so an app older than the builder fails plainly\n * instead of guessing. Kept equal to the MCP verbs by ugc-call-body-parity.test.ts.\n */\nexport interface UgcToolCall {\n readonly tool: string\n readonly args: Readonly<Record<string, unknown>>\n readonly imageArg?: string\n}\nexport type UgcRouteBody = {\n readonly path: \"/v1/generate-image\" | \"/v1/image-to-image\" | \"/v1/image-to-text/describe\"\n readonly body: Record<string, unknown>\n}\n\nconst pick = (a: Readonly<Record<string, unknown>>, from: string, to: string): Record<string, unknown> =>\n a[from] !== undefined && a[from] !== null ? { [to]: a[from] } : {}\n\n/** The LLM levers image_to_text forwards (the verb's llmPayloadFields). */\nfunction llmFields(a: Readonly<Record<string, unknown>>): Record<string, unknown> {\n return {\n ...pick(a, \"llmModel\", \"llmModel\"),\n ...pick(a, \"reasoning_effort\", \"reasoningEffort\"),\n ...(a.advanced_mode === true ? { advancedMode: true } : {}),\n ...pick(a, \"temperature\", \"temperature\"),\n ...pick(a, \"max_tokens\", \"maxTokens\"),\n }\n}\n\nexport function ugcCallToRouteBody(\n call: UgcToolCall,\n opts: { readonly image?: string } = {},\n): UgcRouteBody | { readonly error: string } | undefined {\n const args: Record<string, unknown> = { ...call.args }\n if (call.imageArg) {\n if (!opts.image) return { error: `${call.tool} needs the previous step's image` }\n args[call.imageArg] = opts.image\n }\n switch (call.tool) {\n case \"generate_image\":\n return {\n path: \"/v1/generate-image\",\n body: {\n ...pick(args, \"prompt\", \"prompt\"),\n ...pick(args, \"model\", \"provider\"),\n ...pick(args, \"aspect_ratio\", \"aspectRatio\"),\n ...pick(args, \"resolution\", \"resolution\"),\n ...pick(args, \"quality\", \"quality\"),\n ...pick(args, \"negative_prompt\", \"negativePrompt\"),\n },\n }\n case \"image_to_image\":\n return {\n path: \"/v1/image-to-image\",\n body: {\n ...pick(args, \"image_url\", \"imageUrl\"),\n ...pick(args, \"prompt\", \"prompt\"),\n ...pick(args, \"model\", \"provider\"),\n ...pick(args, \"resolution\", \"resolution\"),\n ...pick(args, \"quality\", \"quality\"),\n ...pick(args, \"strength\", \"strength\"),\n ...pick(args, \"aspect_ratio\", \"aspectRatio\"),\n ...pick(args, \"negative_prompt\", \"negativePrompt\"),\n ...pick(args, \"seed\", \"seed\"),\n },\n }\n case \"image_to_text\": {\n const image = opts.image ?? (typeof args.image_url === \"string\" ? args.image_url : undefined)\n if (!image) return { error: \"image_to_text needs an image\" }\n return {\n path: \"/v1/image-to-text/describe\",\n body: {\n imageUrl: image,\n ...pick(args, \"detail_level\", \"detailLevel\"),\n ...pick(args, \"custom_prompt\", \"customPrompt\"),\n ...llmFields(args),\n },\n }\n }\n default:\n return undefined\n }\n}\n","/**\n * The UGC wires of a language whose clips are cut from one recorded speech (the\n * segmented lane): UGC Clips' prelude (record the speech, time its words, split\n * it at its pauses, then ask for the clips again with the segments) and UGC\n * Finish (lay the speech back over the rendered clips and trim the dead air,\n * as one job over all of them). One pure implementation both engines call, as\n * the rest of the UGC wires (`ugc-node-wires.ts`).\n *\n * Content-free: an answer is read only for `phase`, its three calls' `tool`\n * and `args` (argument names, never their meaning), the `finish` call's\n * `args`, and a finished job's clip list. Which language takes this lane, which\n * voice speaks and what the calls say are the builder's.\n */\nimport {\n UGC_FINISH_NEEDS_CLIPS_MESSAGE,\n UGC_FINISH_NOT_READY_MESSAGE,\n UGC_NEEDS_FINISH_MESSAGE,\n UGC_NEWER_APP_MESSAGE,\n UGC_NODE_MESSAGES,\n UGC_OVER_HOLD_MESSAGE,\n UGC_SCRIPT_LANGUAGES,\n readUgcWire,\n ugcPlanLengthSec,\n ugcPlanScreenshotCount,\n} from \"./ugc-node-wires.js\"\nimport type { FanOutItemMeta } from \"./fan-out-meta.js\"\n\ntype Obj = Record<string, unknown>\nconst isObject = (x: unknown): x is Obj => !!x && typeof x === \"object\" && !Array.isArray(x)\n\n/** UGC Finish's node type. Not the plugin job it runs (`ugc-finish`): a price, a dispatch or a reconcile keyed on a type never confuses the two. */\nexport const UGC_FINISH_CLIPS_TYPE = \"ugc-finish-clips\"\n\n/** The child steps of UGC Clips' prelude, in run order: each is a job of its own, keyed by its step. */\nexport const UGC_PRELUDE_STEPS = [\"speech\", \"alignment\", \"split\"] as const\nexport type UgcPreludeStep = (typeof UGC_PRELUDE_STEPS)[number]\n\n/** The public route each prelude step runs on, and the node type its job is read as. */\nexport const UGC_PRELUDE_ROUTES: Readonly<Record<UgcPreludeStep, { readonly path: string; readonly jobType: string }>> = {\n speech: { path: \"/v1/text-to-speech\", jobType: \"text-to-speech\" },\n alignment: { path: \"/v1/forced-alignment\", jobType: \"forced-alignment\" },\n split: { path: \"/v1/ugc/segments\", jobType: \"ugc-segments\" },\n}\n\n/** The `/v1/ugc/clips` answer's phase: 1 = the prelude must run first, 2 = the clips; null = an answer with no phase (one call, as English). */\nexport function ugcClipsPhase(answer: Readonly<Obj>): 1 | 2 | null {\n return answer.phase === 1 ? 1 : answer.phase === 2 ? 2 : null\n}\n\nconst callOf = (raw: unknown, tool: string): Obj | undefined => {\n if (!isObject(raw) || raw.tool !== tool || !isObject(raw.args)) return undefined\n return raw.args\n}\nconst pick = (a: Readonly<Obj>, from: string, to: string): Obj => (a[from] !== undefined && a[from] !== null ? { [to]: a[from] } : {})\n\n/** What the prelude runs: the speech's route body, and the two that need the step before them. */\nexport interface UgcPrelude {\n readonly speech: Obj\n readonly alignment: (audioUrl: string) => Obj\n readonly split: (audioUrl: string, alignment: unknown) => Obj\n}\n\n/**\n * A phase-1 answer's three calls (`speech`, `align`, `split`, MCP argument names) → the REST bodies of\n * the public routes their MCP tools dispatch to: `generate_speech` → `/v1/text-to-speech` (text, voice,\n * voice type, model as provider, language code, as the verb maps them), `forced_alignment` →\n * `/v1/forced-alignment` (the transcript, with the speech's audio), `ugc_split_speech` →\n * `/v1/ugc/segments` (the plan, with the speech's audio and its word timings). A call that is missing\n * or names another tool → the newer-app sentence: the app never guesses.\n */\nexport function ugcPrelude(answer: Readonly<Obj>): UgcPrelude | { readonly error: string } {\n const speech = callOf(answer.speech, \"generate_speech\")\n const align = callOf(answer.align, \"forced_alignment\")\n const split = callOf(answer.split, \"ugc_split_speech\")\n if (!speech || !align || !split || typeof speech.text !== \"string\" || !isObject(split.plan)) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n speech: {\n text: speech.text,\n ...pick(speech, \"voice_id\", \"voice\"),\n ...pick(speech, \"voice_type\", \"voiceType\"),\n ...pick(speech, \"model\", \"provider\"),\n ...pick(speech, \"language_code\", \"languageCode\"),\n },\n alignment: (audioUrl) => ({ ...pick(align, \"transcript\", \"transcript\"), audioUrl }),\n split: (audioUrl, alignment) => ({ plan: split.plan, audioUrl, alignment }),\n }\n}\n\n/** The finished speech job's audio, its word timings and its segments, as their jobs write them. */\nexport function ugcPreludeOutput(step: UgcPreludeStep, output: Readonly<Obj> | undefined): { value: unknown } | { error: string } {\n const value = step === \"speech\" ? output?.audioUrl : step === \"alignment\" ? output?.alignment : output?.segments\n const ok = step === \"speech\" ? typeof value === \"string\" && value !== \"\" : Array.isArray(value) && value.length > 0\n return ok ? { value } : { error: UGC_NEWER_APP_MESSAGE }\n}\n\n/** The second `/v1/ugc/clips` call: the first call's body with the segments the split returned. */\nexport function ugcClipsPhase2Body(body: Readonly<Obj>, segments: readonly unknown[]): Obj {\n return { ...body, segments: [...segments] }\n}\n\n// ── The hold check once the speech is split ──────────────────────────────────\n\n/** The estimate input of a video cut from one recorded speech, as the hold check names it (`runEstimate`). */\nexport interface UgcRunEstimateInput {\n readonly targetDurationSec: number\n readonly screenshotCount: number\n readonly source: \"sampled\"\n readonly language: string\n}\n\n/**\n * The estimate input of the video a UGC Clips run belongs to, read from the plan the node was sent: its\n * length, its screenshot cards and its language — the reading a kept plan is priced with. Read on a\n * phase-1 answer, before the prelude spends anything, so a plan the check cannot read refuses the run\n * while nothing is paid. The creator's source prices no clip, so it is not read. A plan without a length,\n * or without a language this lane takes → the newer-app sentence: the check never guesses.\n */\nexport function ugcRunEstimateInput(plan: unknown): { runEstimate: UgcRunEstimateInput } | { error: string } {\n const targetDurationSec = ugcPlanLengthSec(plan)\n const language = planOf(plan)?.language\n if (targetDurationSec === undefined || typeof language !== \"string\" || language === \"en\" || !(UGC_SCRIPT_LANGUAGES as readonly unknown[]).includes(language)) {\n return { error: UGC_NEWER_APP_MESSAGE }\n }\n return { runEstimate: { targetDurationSec, screenshotCount: ugcPlanScreenshotCount(plan) ?? 0, source: \"sampled\", language } }\n}\n\n/**\n * The quote that checks a video cut from one recorded speech before any of its clips renders: the clips\n * the second `/v1/ugc/clips` call handed on, priced as the UGC Clips quote prices them (`tickets`,\n * `hasCards`, `finishes`), with `runEstimate` (`ugcRunEstimateInput`). The route then also answers\n * `runHold`, the most the video's estimate holds for the clips and the steps after them, which the run's\n * balance was checked against before it started (`ugcRenderHoldVerdict`). No clips → the newer-app sentence.\n */\nexport function ugcRenderHoldBody(input: { runEstimate: UgcRunEstimateInput; tickets: unknown; hasCards: boolean; finishes: boolean }): { path: \"/v1/ugc/quote\"; body: Obj } | { error: string } {\n if (!Array.isArray(input.tickets) || input.tickets.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n path: \"/v1/ugc/quote\",\n body: {\n tickets: [...input.tickets],\n hasCards: input.hasCards,\n ...(input.finishes ? { finishes: true } : {}),\n runEstimate: { ...input.runEstimate },\n },\n }\n}\n\n/** A plan, or its wire (a JSON string), as an object; undefined for anything else. */\nfunction planOf(plan: unknown): Obj | undefined {\n if (typeof plan !== \"string\") return isObject(plan) ? plan : undefined\n try {\n const parsed: unknown = JSON.parse(plan)\n return isObject(parsed) ? parsed : undefined\n } catch {\n return undefined\n }\n}\n\nconst isCredits = (x: unknown): x is number => typeof x === \"number\" && Number.isFinite(x) && x >= 0\n\n/**\n * The hold check's answer → go on, or stop before any clip renders: the clips and the steps after them\n * (`ceiling`, each clip at its hold) over what the run was checked for (`runHold`) → the over-hold\n * sentence. An answer without both figures stops too (the newer-app sentence): a clip never renders\n * on a figure nobody checked.\n */\nexport function ugcRenderHoldVerdict(answer: unknown): { readonly ok: true } | { readonly error: string } {\n if (!isObject(answer) || !isCredits(answer.ceiling) || !isCredits(answer.runHold)) return { error: UGC_NEWER_APP_MESSAGE }\n return answer.ceiling > answer.runHold ? { error: UGC_OVER_HOLD_MESSAGE } : { ok: true }\n}\n\n// ── UGC Finish ───────────────────────────────────────────────────────────────\n\n/** What UGC Finish does with the clips it was handed. */\nexport type UgcFinishPlan =\n /** No finish call on the plan (English): the clips go on as they came, no call, no job. */\n | { readonly kind: \"pass\"; readonly clips: readonly string[] }\n /** The finish job's body: the segments with their room, one roll per clip, in order. */\n | { readonly kind: \"job\"; readonly path: \"/v1/ugc/finish\"; readonly body: Obj }\n\n/**\n * UGC Finish's input → what it does. The `plan` input is UGC Clips' Script (sized) output; a plan\n * carrying `finish` (the segmented lane) asks for the finish job over the clips, in order; any other\n * plan passes the clips through. Clips are the fan-in list (`inputs.inputs`), in clip order.\n */\nexport function ugcFinishPlan(input: { planOutWire: unknown; clipUrls: readonly unknown[] }): UgcFinishPlan | { readonly error: string } {\n const clips = input.clipUrls.filter((u): u is string => typeof u === \"string\" && u !== \"\")\n if (clips.length === 0) return { error: UGC_FINISH_NEEDS_CLIPS_MESSAGE }\n const read = readUgcWire(input.planOutWire, UGC_NODE_MESSAGES.needsPlanOut)\n if (\"error\" in read) return read\n const finish = read.value.finish\n if (finish === undefined) return { kind: \"pass\", clips }\n if (!isObject(finish) || !Array.isArray(finish.segments) || finish.segments.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n if (finish.segments.length !== clips.length) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n kind: \"job\",\n path: \"/v1/ugc/finish\",\n body: { segments: finish.segments, clips: clips.map((url, i) => ({ clip: i + 1, rolls: [url] })) },\n }\n}\n\n/** A finished clip, as UGC Finish hands it on: its URL and the notes its downstream nodes read. */\nexport interface UgcFinishedClip { readonly url: string; readonly meta: FanOutItemMeta }\n\n/**\n * A finished `ugc-finish` job → the finished clips in clip order, each with its real length. `ready: false`\n * (a clip that does not follow its speech) → the not-ready sentence: the node fails, never hands on a\n * partial list. A dry finish's warning rides every clip's notes.\n */\nexport function ugcFinishOutputs(output: Readonly<Obj> | undefined): { clips: UgcFinishedClip[] } | { error: string } {\n if (!output) return { error: UGC_NEWER_APP_MESSAGE }\n if (output.ready === false) return { error: UGC_FINISH_NOT_READY_MESSAGE }\n if (output.ready !== true || !Array.isArray(output.clips) || output.clips.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n const warnings = Array.isArray(output.warnings)\n ? output.warnings.flatMap((w) => (isObject(w) && typeof w.code === \"string\" ? [w.code] : typeof w === \"string\" ? [w] : []))\n : []\n const rows = [...output.clips].filter(isObject).sort((a, b) => Number(a.clip) - Number(b.clip))\n if (rows.length !== output.clips.length || rows.some((r, i) => r.clip !== i + 1 || typeof r.url !== \"string\" || r.url === \"\")) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n clips: rows.map((r) => ({\n url: r.url as string,\n meta: { warnings, durationSec: typeof r.sec === \"number\" && Number.isFinite(r.sec) && r.sec > 0 ? r.sec : null },\n })),\n }\n}\n\n/**\n * Whether a UGC Finish reads this UGC Clips node's Script (sized) output: the graph can finish a video\n * whose clips are cut from one recorded speech. Read before the prelude spends anything.\n */\nexport function ugcFinishWired(\n edges: ReadonlyArray<{ readonly source?: string; readonly target?: string; readonly sourceHandle?: string | null; readonly targetHandle?: string | null }>,\n nodes: ReadonlyArray<{ readonly id?: string; readonly type?: string | null }>,\n clipsId: string,\n): boolean {\n const finishIds = new Set(nodes.filter((n) => n.type === UGC_FINISH_CLIPS_TYPE && typeof n.id === \"string\").map((n) => n.id as string))\n return edges.some((e) => e.source === clipsId && e.sourceHandle === \"plan-out\" && e.target !== undefined && finishIds.has(e.target) && (e.targetHandle ?? \"\") === \"plan\")\n}\n\n/** UGC Clips' refusal before its prelude: the sentence when no UGC Finish reads its Script (sized) output, else null. */\nexport function ugcLaneNeedsFinish(\n edges: Parameters<typeof ugcFinishWired>[0],\n nodes: Parameters<typeof ugcFinishWired>[1],\n clipsId: string,\n): string | null {\n return ugcFinishWired(edges, nodes, clipsId) ? null : UGC_NEEDS_FINISH_MESSAGE\n}\n"]}
1
+ {"version":3,"sources":["../src/ugc-call-body.ts","../src/ugc-lane-wires.ts"],"names":["pick","UGC_NEWER_APP_MESSAGE","ugcPlanLengthSec","UGC_SCRIPT_LANGUAGES","ugcPlanScreenshotCount","UGC_OVER_HOLD_MESSAGE","UGC_FINISH_NEEDS_CLIPS_MESSAGE","readUgcWire","UGC_NODE_MESSAGES","UGC_FINISH_NOT_READY_MESSAGE","UGC_NEEDS_FINISH_MESSAGE"],"mappings":";;;;;AAkBA,IAAM,IAAA,GAAO,CAAC,CAAA,EAAsC,IAAA,EAAc,OAChE,CAAA,CAAE,IAAI,MAAM,MAAA,IAAa,CAAA,CAAE,IAAI,CAAA,KAAM,IAAA,GAAO,EAAE,CAAC,EAAE,GAAG,CAAA,CAAE,IAAI,CAAA,EAAE,GAAI,EAAC;AAGnE,SAAS,UAAU,CAAA,EAA+D;AAChF,EAAA,OAAO;AAAA,IACL,GAAG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SAAA,GAAY,IAAI,GAAA,CAAI,KAAA,CAAM,OAAO,CAAC,CAAA,KAAM,EAAE,IAAA,KAAS,qBAAA,IAAyB,OAAO,CAAA,CAAE,EAAA,KAAO,QAAQ,CAAA,CAAE,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,EAAY,CAAC,CAAA;AACtI,EAAA,OAAO,KAAA,CAAM,KAAK,CAAC,CAAA,KAAM,EAAE,MAAA,KAAW,OAAA,IAAW,EAAE,YAAA,KAAiB,UAAA,IAAc,EAAE,MAAA,KAAW,MAAA,IAAa,UAAU,GAAA,CAAI,CAAA,CAAE,MAAM,CAAA,IAAA,CAAM,CAAA,CAAE,YAAA,IAAgB,EAAA,MAAQ,MAAM,CAAA;AAC1K;AAGO,SAAS,kBAAA,CACd,KAAA,EACA,KAAA,EACA,OAAA,EACe;AACf,EAAA,OAAO,cAAA,CAAe,KAAA,EAAO,KAAA,EAAO,OAAO,IAAI,IAAA,GAAOS,0CAAA;AACxD","file":"chunk-MI4WEFJ4.cjs","sourcesContent":["/**\n * A UGC builder call `{ tool, args }` (MCP argument names) → the REST body of\n * the public route that tool dispatches to. The builder sets every price lever;\n * this adds none — its one addition is the image of a call that needs the\n * previous step's image (`imageArg`, or the photo of `image_to_text`). A tool\n * it does not know → undefined, so an app older than the builder fails plainly\n * instead of guessing. Kept equal to the MCP verbs by ugc-call-body-parity.test.ts.\n */\nexport interface UgcToolCall {\n readonly tool: string\n readonly args: Readonly<Record<string, unknown>>\n readonly imageArg?: string\n}\nexport type UgcRouteBody = {\n readonly path: \"/v1/generate-image\" | \"/v1/image-to-image\" | \"/v1/image-to-text/describe\"\n readonly body: Record<string, unknown>\n}\n\nconst pick = (a: Readonly<Record<string, unknown>>, from: string, to: string): Record<string, unknown> =>\n a[from] !== undefined && a[from] !== null ? { [to]: a[from] } : {}\n\n/** The LLM levers image_to_text forwards (the verb's llmPayloadFields). */\nfunction llmFields(a: Readonly<Record<string, unknown>>): Record<string, unknown> {\n return {\n ...pick(a, \"llmModel\", \"llmModel\"),\n ...pick(a, \"reasoning_effort\", \"reasoningEffort\"),\n ...(a.advanced_mode === true ? { advancedMode: true } : {}),\n ...pick(a, \"temperature\", \"temperature\"),\n ...pick(a, \"max_tokens\", \"maxTokens\"),\n }\n}\n\nexport function ugcCallToRouteBody(\n call: UgcToolCall,\n opts: { readonly image?: string } = {},\n): UgcRouteBody | { readonly error: string } | undefined {\n const args: Record<string, unknown> = { ...call.args }\n if (call.imageArg) {\n if (!opts.image) return { error: `${call.tool} needs the previous step's image` }\n args[call.imageArg] = opts.image\n }\n switch (call.tool) {\n case \"generate_image\":\n return {\n path: \"/v1/generate-image\",\n body: {\n ...pick(args, \"prompt\", \"prompt\"),\n ...pick(args, \"model\", \"provider\"),\n ...pick(args, \"aspect_ratio\", \"aspectRatio\"),\n ...pick(args, \"resolution\", \"resolution\"),\n ...pick(args, \"quality\", \"quality\"),\n ...pick(args, \"negative_prompt\", \"negativePrompt\"),\n },\n }\n case \"image_to_image\":\n return {\n path: \"/v1/image-to-image\",\n body: {\n ...pick(args, \"image_url\", \"imageUrl\"),\n ...pick(args, \"prompt\", \"prompt\"),\n ...pick(args, \"model\", \"provider\"),\n ...pick(args, \"resolution\", \"resolution\"),\n ...pick(args, \"quality\", \"quality\"),\n ...pick(args, \"strength\", \"strength\"),\n ...pick(args, \"aspect_ratio\", \"aspectRatio\"),\n ...pick(args, \"negative_prompt\", \"negativePrompt\"),\n ...pick(args, \"seed\", \"seed\"),\n },\n }\n case \"image_to_text\": {\n const image = opts.image ?? (typeof args.image_url === \"string\" ? args.image_url : undefined)\n if (!image) return { error: \"image_to_text needs an image\" }\n return {\n path: \"/v1/image-to-text/describe\",\n body: {\n imageUrl: image,\n ...pick(args, \"detail_level\", \"detailLevel\"),\n ...pick(args, \"custom_prompt\", \"customPrompt\"),\n ...llmFields(args),\n },\n }\n }\n default:\n return undefined\n }\n}\n","/**\n * The UGC wires of a language whose clips are cut from one recorded speech (the\n * segmented lane): UGC Clips' prelude (record the speech, time its words, split\n * it at its pauses, then ask for the clips again with the segments) and UGC\n * Finish (lay the speech back over the rendered clips and trim the dead air,\n * as one job over all of them). One pure implementation both engines call, as\n * the rest of the UGC wires (`ugc-node-wires.ts`).\n *\n * Content-free: an answer is read only for `phase`, its three calls' `tool`\n * and `args` (argument names, never their meaning), the `finish` call's\n * `args`, and a finished job's clip list. Which language takes this lane, which\n * voice speaks and what the calls say are the builder's.\n */\nimport {\n UGC_FINISH_NEEDS_CLIPS_MESSAGE,\n UGC_FINISH_NOT_READY_MESSAGE,\n UGC_NEEDS_FINISH_MESSAGE,\n UGC_NEWER_APP_MESSAGE,\n UGC_NODE_MESSAGES,\n UGC_OVER_HOLD_MESSAGE,\n UGC_SCRIPT_LANGUAGES,\n readUgcWire,\n ugcPlanLengthSec,\n ugcPlanScreenshotCount,\n} from \"./ugc-node-wires.js\"\nimport type { FanOutItemMeta } from \"./fan-out-meta.js\"\n\ntype Obj = Record<string, unknown>\nconst isObject = (x: unknown): x is Obj => !!x && typeof x === \"object\" && !Array.isArray(x)\n\n/** UGC Finish's node type. Not the plugin job it runs (`ugc-finish`): a price, a dispatch or a reconcile keyed on a type never confuses the two. */\nexport const UGC_FINISH_CLIPS_TYPE = \"ugc-finish-clips\"\n\n/** The child steps of UGC Clips' prelude, in run order: each is a job of its own, keyed by its step. */\nexport const UGC_PRELUDE_STEPS = [\"speech\", \"alignment\", \"split\"] as const\nexport type UgcPreludeStep = (typeof UGC_PRELUDE_STEPS)[number]\n\n/** The public route each prelude step runs on, and the node type its job is read as. */\nexport const UGC_PRELUDE_ROUTES: Readonly<Record<UgcPreludeStep, { readonly path: string; readonly jobType: string }>> = {\n speech: { path: \"/v1/text-to-speech\", jobType: \"text-to-speech\" },\n alignment: { path: \"/v1/forced-alignment\", jobType: \"forced-alignment\" },\n split: { path: \"/v1/ugc/segments\", jobType: \"ugc-segments\" },\n}\n\n/** The `/v1/ugc/clips` answer's phase: 1 = the prelude must run first, 2 = the clips; null = an answer with no phase (one call, as English). */\nexport function ugcClipsPhase(answer: Readonly<Obj>): 1 | 2 | null {\n return answer.phase === 1 ? 1 : answer.phase === 2 ? 2 : null\n}\n\nconst callOf = (raw: unknown, tool: string): Obj | undefined => {\n if (!isObject(raw) || raw.tool !== tool || !isObject(raw.args)) return undefined\n return raw.args\n}\nconst pick = (a: Readonly<Obj>, from: string, to: string): Obj => (a[from] !== undefined && a[from] !== null ? { [to]: a[from] } : {})\n\n/** What the prelude runs: the speech's route body, and the two that need the step before them. */\nexport interface UgcPrelude {\n readonly speech: Obj\n readonly alignment: (audioUrl: string) => Obj\n readonly split: (audioUrl: string, alignment: unknown) => Obj\n}\n\n/**\n * A phase-1 answer's three calls (`speech`, `align`, `split`, MCP argument names) → the REST bodies of\n * the public routes their MCP tools dispatch to: `generate_speech` → `/v1/text-to-speech` (text, voice,\n * voice type, model as provider, language code, as the verb maps them), `forced_alignment` →\n * `/v1/forced-alignment` (the transcript, with the speech's audio), `ugc_split_speech` →\n * `/v1/ugc/segments` (the plan, with the speech's audio and its word timings). A call that is missing\n * or names another tool → the newer-app sentence: the app never guesses.\n */\nexport function ugcPrelude(answer: Readonly<Obj>): UgcPrelude | { readonly error: string } {\n const speech = callOf(answer.speech, \"generate_speech\")\n const align = callOf(answer.align, \"forced_alignment\")\n const split = callOf(answer.split, \"ugc_split_speech\")\n if (!speech || !align || !split || typeof speech.text !== \"string\" || !isObject(split.plan)) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n speech: {\n text: speech.text,\n ...pick(speech, \"voice_id\", \"voice\"),\n ...pick(speech, \"voice_type\", \"voiceType\"),\n ...pick(speech, \"model\", \"provider\"),\n ...pick(speech, \"language_code\", \"languageCode\"),\n },\n alignment: (audioUrl) => ({ ...pick(align, \"transcript\", \"transcript\"), audioUrl }),\n split: (audioUrl, alignment) => ({ plan: split.plan, audioUrl, alignment }),\n }\n}\n\n/** The finished speech job's audio, its word timings and its segments, as their jobs write them. */\nexport function ugcPreludeOutput(step: UgcPreludeStep, output: Readonly<Obj> | undefined): { value: unknown } | { error: string } {\n const value = step === \"speech\" ? output?.audioUrl : step === \"alignment\" ? output?.alignment : output?.segments\n const ok = step === \"speech\" ? typeof value === \"string\" && value !== \"\" : Array.isArray(value) && value.length > 0\n return ok ? { value } : { error: UGC_NEWER_APP_MESSAGE }\n}\n\n/** The second `/v1/ugc/clips` call: the first call's body with the segments the split returned. */\nexport function ugcClipsPhase2Body(body: Readonly<Obj>, segments: readonly unknown[]): Obj {\n return { ...body, segments: [...segments] }\n}\n\n// ── The hold check once the speech is split ──────────────────────────────────\n\n/** The estimate input of a video cut from one recorded speech, as the hold check names it (`runEstimate`). */\nexport interface UgcRunEstimateInput {\n readonly targetDurationSec: number\n readonly screenshotCount: number\n readonly source: \"sampled\"\n readonly language: string\n}\n\n/**\n * The estimate input of the video a UGC Clips run belongs to, read from the plan the node was sent: its\n * length, its screenshot cards and its language — the reading a kept plan is priced with. Read on a\n * phase-1 answer, before the prelude spends anything, so a plan the check cannot read refuses the run\n * while nothing is paid. The creator's source prices no clip, so it is not read. A plan without a length,\n * or without a language this lane takes → the newer-app sentence: the check never guesses.\n */\nexport function ugcRunEstimateInput(plan: unknown): { runEstimate: UgcRunEstimateInput } | { error: string } {\n const targetDurationSec = ugcPlanLengthSec(plan)\n const language = planOf(plan)?.language\n if (targetDurationSec === undefined || typeof language !== \"string\" || language === \"en\" || !(UGC_SCRIPT_LANGUAGES as readonly unknown[]).includes(language)) {\n return { error: UGC_NEWER_APP_MESSAGE }\n }\n return { runEstimate: { targetDurationSec, screenshotCount: ugcPlanScreenshotCount(plan) ?? 0, source: \"sampled\", language } }\n}\n\n/**\n * The quote that checks a video cut from one recorded speech before any of its clips renders: the clips\n * the second `/v1/ugc/clips` call handed on, priced as the UGC Clips quote prices them (`tickets`,\n * `hasCards`, `finishes`), with `runEstimate` (`ugcRunEstimateInput`). The route then also answers\n * `runHold`, the most the video's estimate holds for the clips and the steps after them, which the run's\n * balance was checked against before it started (`ugcRenderHoldVerdict`). No clips → the newer-app sentence.\n */\nexport function ugcRenderHoldBody(input: { runEstimate: UgcRunEstimateInput; tickets: unknown; hasCards: boolean; finishes: boolean }): { path: \"/v1/ugc/quote\"; body: Obj } | { error: string } {\n if (!Array.isArray(input.tickets) || input.tickets.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n path: \"/v1/ugc/quote\",\n body: {\n tickets: [...input.tickets],\n hasCards: input.hasCards,\n ...(input.finishes ? { finishes: true } : {}),\n runEstimate: { ...input.runEstimate },\n },\n }\n}\n\n/** A plan, or its wire (a JSON string), as an object; undefined for anything else. */\nfunction planOf(plan: unknown): Obj | undefined {\n if (typeof plan !== \"string\") return isObject(plan) ? plan : undefined\n try {\n const parsed: unknown = JSON.parse(plan)\n return isObject(parsed) ? parsed : undefined\n } catch {\n return undefined\n }\n}\n\nconst isCredits = (x: unknown): x is number => typeof x === \"number\" && Number.isFinite(x) && x >= 0\n\n/**\n * The hold check's answer → go on, or stop before any clip renders: the clips and the steps after them\n * (`ceiling`, each clip at its hold) over what the run was checked for (`runHold`) → the over-hold\n * sentence. An answer without both figures stops too (the newer-app sentence): a clip never renders\n * on a figure nobody checked.\n */\nexport function ugcRenderHoldVerdict(answer: unknown): { readonly ok: true } | { readonly error: string } {\n if (!isObject(answer) || !isCredits(answer.ceiling) || !isCredits(answer.runHold)) return { error: UGC_NEWER_APP_MESSAGE }\n return answer.ceiling > answer.runHold ? { error: UGC_OVER_HOLD_MESSAGE } : { ok: true }\n}\n\n// ── UGC Finish ───────────────────────────────────────────────────────────────\n\n/** What UGC Finish does with the clips it was handed. */\nexport type UgcFinishPlan =\n /** No finish call on the plan (English): the clips go on as they came, no call, no job. */\n | { readonly kind: \"pass\"; readonly clips: readonly string[] }\n /** The finish job's body: the segments with their room, one roll per clip, in order. */\n | { readonly kind: \"job\"; readonly path: \"/v1/ugc/finish\"; readonly body: Obj }\n\n/**\n * UGC Finish's input → what it does. The `plan` input is UGC Clips' Script (sized) output; a plan\n * carrying `finish` (the segmented lane) asks for the finish job over the clips, in order; any other\n * plan passes the clips through. Clips are the fan-in list (`inputs.inputs`), in clip order.\n */\nexport function ugcFinishPlan(input: { planOutWire: unknown; clipUrls: readonly unknown[] }): UgcFinishPlan | { readonly error: string } {\n const clips = input.clipUrls.filter((u): u is string => typeof u === \"string\" && u !== \"\")\n if (clips.length === 0) return { error: UGC_FINISH_NEEDS_CLIPS_MESSAGE }\n const read = readUgcWire(input.planOutWire, UGC_NODE_MESSAGES.needsPlanOut)\n if (\"error\" in read) return read\n const finish = read.value.finish\n if (finish === undefined) return { kind: \"pass\", clips }\n if (!isObject(finish) || !Array.isArray(finish.segments) || finish.segments.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n if (finish.segments.length !== clips.length) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n kind: \"job\",\n path: \"/v1/ugc/finish\",\n body: { segments: finish.segments, clips: clips.map((url, i) => ({ clip: i + 1, rolls: [url] })) },\n }\n}\n\n/** A finished clip, as UGC Finish hands it on: its URL and the notes its downstream nodes read. */\nexport interface UgcFinishedClip { readonly url: string; readonly meta: FanOutItemMeta }\n\n/**\n * A finished `ugc-finish` job → the finished clips in clip order, each with its real length. `ready: false`\n * (a clip that does not follow its speech) → the not-ready sentence: the node fails, never hands on a\n * partial list. A dry finish's warning rides every clip's notes.\n */\nexport function ugcFinishOutputs(output: Readonly<Obj> | undefined): { clips: UgcFinishedClip[] } | { error: string } {\n if (!output) return { error: UGC_NEWER_APP_MESSAGE }\n if (output.ready === false) return { error: UGC_FINISH_NOT_READY_MESSAGE }\n if (output.ready !== true || !Array.isArray(output.clips) || output.clips.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n const warnings = Array.isArray(output.warnings)\n ? output.warnings.flatMap((w) => (isObject(w) && typeof w.code === \"string\" ? [w.code] : typeof w === \"string\" ? [w] : []))\n : []\n const rows = [...output.clips].filter(isObject).sort((a, b) => Number(a.clip) - Number(b.clip))\n if (rows.length !== output.clips.length || rows.some((r, i) => r.clip !== i + 1 || typeof r.url !== \"string\" || r.url === \"\")) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n clips: rows.map((r) => ({\n url: r.url as string,\n meta: { warnings, durationSec: typeof r.sec === \"number\" && Number.isFinite(r.sec) && r.sec > 0 ? r.sec : null },\n })),\n }\n}\n\n/**\n * Whether a UGC Finish reads this UGC Clips node's Script (sized) output: the graph can finish a video\n * whose clips are cut from one recorded speech. Read before the prelude spends anything.\n */\nexport function ugcFinishWired(\n edges: ReadonlyArray<{ readonly source?: string; readonly target?: string; readonly sourceHandle?: string | null; readonly targetHandle?: string | null }>,\n nodes: ReadonlyArray<{ readonly id?: string; readonly type?: string | null }>,\n clipsId: string,\n): boolean {\n const finishIds = new Set(nodes.filter((n) => n.type === UGC_FINISH_CLIPS_TYPE && typeof n.id === \"string\").map((n) => n.id as string))\n return edges.some((e) => e.source === clipsId && e.sourceHandle === \"plan-out\" && e.target !== undefined && finishIds.has(e.target) && (e.targetHandle ?? \"\") === \"plan\")\n}\n\n/** UGC Clips' refusal before its prelude: the sentence when no UGC Finish reads its Script (sized) output, else null. */\nexport function ugcLaneNeedsFinish(\n edges: Parameters<typeof ugcFinishWired>[0],\n nodes: Parameters<typeof ugcFinishWired>[1],\n clipsId: string,\n): string | null {\n return ugcFinishWired(edges, nodes, clipsId) ? null : UGC_NEEDS_FINISH_MESSAGE\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHWBLZSM3_cjs = require('./chunk-HWBLZSM3.cjs');
3
+ var chunkTOYWEF6E_cjs = require('./chunk-TOYWEF6E.cjs');
4
4
 
5
5
  // src/image-model-roles.ts
6
6
  var IMAGE_MODEL_ROLE_DEFAULTS = {
@@ -17,7 +17,7 @@ var IMAGE_MODEL_RATIO_FALLBACKS = {
17
17
  };
18
18
  function imageModelDrawsRatio(modelId, aspectRatio) {
19
19
  if (!aspectRatio) return true;
20
- const ratios = chunkHWBLZSM3_cjs.MODEL_CATALOG[modelId]?.aspectRatios;
20
+ const ratios = chunkTOYWEF6E_cjs.MODEL_CATALOG[modelId]?.aspectRatios;
21
21
  return ratios === void 0 || ratios.includes(aspectRatio);
22
22
  }
23
23
  function defaultImageModel(role, aspectRatio) {
@@ -47,13 +47,13 @@ function videoUpscaleModelOf(provider) {
47
47
  }
48
48
  function videoUpscaleResolutionsFor(provider) {
49
49
  const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER);
50
- return chunkHWBLZSM3_cjs.MODEL_CATALOG[id]?.resolutions ?? [];
50
+ return chunkTOYWEF6E_cjs.MODEL_CATALOG[id]?.resolutions ?? [];
51
51
  }
52
52
  function normalizeVideoUpscaleResolution(provider, targetResolution) {
53
53
  if (typeof targetResolution !== "string" || targetResolution === "") return { targetResolution: void 0 };
54
54
  const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER);
55
- if ((chunkHWBLZSM3_cjs.MODEL_CATALOG[id]?.resolutions ?? []).length === 0) return { targetResolution };
56
- const normalized = chunkHWBLZSM3_cjs.normalizeModelInput(id, { resolution: targetResolution });
55
+ if ((chunkTOYWEF6E_cjs.MODEL_CATALOG[id]?.resolutions ?? []).length === 0) return { targetResolution };
56
+ const normalized = chunkTOYWEF6E_cjs.normalizeModelInput(id, { resolution: targetResolution });
57
57
  const adjustment = normalized.adjustments.find((a) => a.field === "resolution");
58
58
  return adjustment ? { targetResolution: normalized.resolution, adjustment } : { targetResolution: normalized.resolution };
59
59
  }
@@ -67,5 +67,5 @@ exports.imageModelDrawsRatio = imageModelDrawsRatio;
67
67
  exports.normalizeVideoUpscaleResolution = normalizeVideoUpscaleResolution;
68
68
  exports.videoUpscaleModelOf = videoUpscaleModelOf;
69
69
  exports.videoUpscaleResolutionsFor = videoUpscaleResolutionsFor;
70
- //# sourceMappingURL=chunk-DOY47F7S.cjs.map
71
- //# sourceMappingURL=chunk-DOY47F7S.cjs.map
70
+ //# sourceMappingURL=chunk-MN7BUGXF.cjs.map
71
+ //# sourceMappingURL=chunk-MN7BUGXF.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/image-model-roles.ts","../src/video-upscale-params.ts"],"names":["MODEL_CATALOG","normalizeModelInput"],"mappings":";;;;;AAuBO,IAAM,yBAAA,GAA4B;AAAA,EACvC,SAAA,EAAW,aAAA;AAAA,EACX,OAAA,EAAS,aAAA;AAAA,EACT,MAAA,EAAQ,aAAA;AAAA,EACR,IAAA,EAAM;AACR;AAWO,IAAM,2BAAA,GAAmF;AAAA,EAC9F,SAAA,EAAW,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EACjF,OAAA,EAAS,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EAC/E,MAAA,EAAQ,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EAC9E,IAAA,EAAM,CAAC,4BAAA,EAA8B,4BAAA,EAA8B,iBAAiB;AACtF;AAGO,SAAS,oBAAA,CAAqB,SAAiB,WAAA,EAAsC;AAC1F,EAAA,IAAI,CAAC,aAAa,OAAO,IAAA;AACzB,EAAA,MAAM,MAAA,GAASA,+BAAA,CAAc,OAAO,CAAA,EAAG,YAAA;AACvC,EAAA,OAAO,MAAA,KAAW,MAAA,IAAa,MAAA,CAAO,QAAA,CAAS,WAAW,CAAA;AAC5D;AAQO,SAAS,iBAAA,CAAkB,MAAsB,WAAA,EAAqC;AAC3F,EAAA,MAAM,OAAA,GAAU,0BAA0B,IAAI,CAAA;AAC9C,EAAA,IAAI,oBAAA,CAAqB,OAAA,EAAS,WAAW,CAAA,EAAG,OAAO,OAAA;AACvD,EAAA,OAAO,2BAAA,CAA4B,IAAI,CAAA,CAAE,IAAA,CAAK,CAAC,OAAO,oBAAA,CAAqB,EAAA,EAAI,WAAW,CAAC,CAAA,IAAK,OAAA;AAClG;AAOO,SAAS,wBAAA,CAAyB,UAAkB,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AE,UAAU,YAAY,CAAA;AAC9E,EAAA,OAAO,UAAA,GAAa,EAAE,gBAAA,EAAkB,UAAA,CAAW,UAAA,EAAY,YAAW,GAAI,EAAE,gBAAA,EAAkB,UAAA,CAAW,UAAA,EAAW;AAC1H","file":"chunk-DOY47F7S.cjs","sourcesContent":["import { MODEL_CATALOG } from \"./model-catalog.js\"\n\n/**\n * The platform's answer to \"which image model, when the caller names none\".\n *\n * One table by ROLE, so every surface that picks for the user (node defaults,\n * route and workflow fallbacks, MCP tools, studios, pipelines) reads the same\n * model instead of keeping its own literal. Before this table those literals\n * had drifted apart: the Generate Image node started on Nano Banana Pro, the\n * routes fell back to the original Nano Banana, and MCP used Nano Banana 2.1.\n *\n * Decided on 2026-10-08 from a blind five-model comparison, quality\n * first and price second:\n * - characters, general text-to-image and video anchors on GPT Image 2;\n * - edits on the current GPT Image Flare (2.6 since 2026-11-09), which renders\n * at its default Medium when a run names no quality.\n * With reference images attached, GPT Image 2 runs as its i2i sibling (the\n * provider swaps it), so `character` covers identity-from-reference too.\n *\n * Nano Banana Pro is no longer a default. It remains a FALLBACK only: last in\n * the ratio chain below, the GPT-family safety-block retry, and the swimwear\n * dressing model.\n */\nexport const IMAGE_MODEL_ROLE_DEFAULTS = {\n character: \"gpt-image-2\",\n general: \"gpt-image-2\",\n anchor: \"gpt-image-2\",\n edit: \"gpt-image-2-6-flare-i2i\",\n} as const\n\nexport type ImageModelRole = keyof typeof IMAGE_MODEL_ROLE_DEFAULTS\n\n/**\n * Where a role's model goes when it cannot draw the requested aspect ratio.\n * GPT Image 2 draws only auto / 1:1 / 16:9 / 9:16 / 4:3 / 3:4, so 21:9, 3:2,\n * 2:3, 4:5, 5:4 and the other wide or in-between ratios move to GPT Image 2.6\n * Sunburst. GPT Image 2.5 Sunburst stays behind it for the ratios only 2.5\n * draws, and Nano Banana Pro comes last.\n */\nexport const IMAGE_MODEL_RATIO_FALLBACKS: Readonly<Record<ImageModelRole, readonly string[]>> = {\n character: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n general: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n anchor: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n edit: [\"gpt-image-2-6-sunburst-i2i\", \"gpt-image-2-5-sunburst-i2i\", \"nano-banana-pro\"],\n}\n\n/** True when the model's catalog entry lists the ratio (or no ratio was asked for). */\nexport function imageModelDrawsRatio(modelId: string, aspectRatio?: string | null): boolean {\n if (!aspectRatio) return true\n const ratios = MODEL_CATALOG[modelId]?.aspectRatios\n return ratios === undefined || ratios.includes(aspectRatio)\n}\n\n/**\n * The default image model for a role at the requested aspect ratio: the role's\n * model when it draws the ratio, else the first fallback that does, else the\n * role's model (whose own ratio normalization then snaps the ratio). Read from\n * the catalog, so widening a model's documented ratios moves this with it.\n */\nexport function defaultImageModel(role: ImageModelRole, aspectRatio?: string | null): string {\n const primary = IMAGE_MODEL_ROLE_DEFAULTS[role]\n if (imageModelDrawsRatio(primary, aspectRatio)) return primary\n return IMAGE_MODEL_RATIO_FALLBACKS[role].find((id) => imageModelDrawsRatio(id, aspectRatio)) ?? primary\n}\n\n/**\n * The model an image node that names none runs on, by node type: the same\n * default its route and its workflow branch apply. For the node types that\n * have one; undefined for any other.\n */\nexport function defaultImageModelForNode(nodeType: string, aspectRatio?: string | null): string | undefined {\n switch (nodeType) {\n case \"generate-image\":\n return defaultImageModel(\"general\", aspectRatio)\n case \"image-to-image\":\n case \"modify-image\":\n return defaultImageModel(\"edit\", aspectRatio)\n case \"reference-board\":\n return defaultImageModel(\"character\", aspectRatio)\n default:\n return undefined\n }\n}\n","/**\n * The Video Upscale node's target resolution, per provider, from the catalog.\n *\n * The node stores one `targetResolution` for every provider, and the providers\n * take different sets: Topaz 720p / 1080p / 4K (a short side, its own list in\n * `topaz-video.ts`), Nodaro Video Upscale 1080p / 2K / 4K (an output box), the\n * VEO and Seedance HD upscales none. For a provider whose catalog entry\n * declares its resolutions (`resolutions`, `defaultResolution`; today Nodaro\n * Video Upscale), this is the one coercion every lane applies — a node written\n * straight into workflow JSON, a request to the API and an MCP call never pass\n * through the editor's menus: a value it does not take becomes its default. A\n * provider whose entry declares none (Topaz included) is left alone: its run\n * reads the field by its own rules.\n */\nimport { MODEL_CATALOG, normalizeModelInput, type ModelInputAdjustment } from \"./model-catalog.js\"\n\n/**\n * Every target resolution some Video Upscale provider takes — Nodaro Video\n * Upscale's route schema and the MCP verb's enum. Which ones a provider takes:\n * its catalog entry's `resolutions` where it declares them\n * ({@link normalizeVideoUpscaleResolution}), else its own list (Topaz's).\n */\nexport const VIDEO_UPSCALE_RESOLUTIONS = [\"720p\", \"1080p\", \"2k\", \"4k\"] as const\nexport type VideoUpscaleResolution = (typeof VIDEO_UPSCALE_RESOLUTIONS)[number]\n\n/** The provider a Video Upscale node runs when it names none. */\nconst DEFAULT_VIDEO_UPSCALE_PROVIDER = \"topaz\"\n\n/**\n * Video Upscale's `provider` value as the catalog model it runs: its \"topaz\"\n * is the catalog's `topaz-video`; every other value is its own id.\n */\nexport function videoUpscaleModelOf(provider: string): string {\n return provider === \"topaz\" ? \"topaz-video\" : provider\n}\n\n/** The resolutions a Video Upscale provider's catalog entry declares, in its order; empty when it declares none (Topaz keeps its own list). */\nexport function videoUpscaleResolutionsFor(provider: string | undefined): readonly string[] {\n const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER)\n return MODEL_CATALOG[id]?.resolutions ?? []\n}\n\nexport interface NormalizedVideoUpscaleResolution {\n /** The value to store and send: the one asked for, its canonical spelling, or the provider's default. */\n readonly targetResolution: string | undefined\n /** What changed, when anything did. */\n readonly adjustment?: ModelInputAdjustment\n}\n\n/**\n * `targetResolution` coerced to one `provider` takes. Unset stays unset (each\n * run applies its own default). A value the provider does not list becomes the\n * provider's `defaultResolution`, a spelling variant (\"2K\") its canonical form.\n * A provider with no resolution setting gets the value back unchanged; a value\n * that is not a string, or an empty one, reads as unset.\n */\nexport function normalizeVideoUpscaleResolution(\n provider: string | undefined,\n targetResolution: unknown,\n): NormalizedVideoUpscaleResolution {\n if (typeof targetResolution !== \"string\" || targetResolution === \"\") return { targetResolution: undefined }\n const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER)\n if ((MODEL_CATALOG[id]?.resolutions ?? []).length === 0) return { targetResolution }\n const normalized = normalizeModelInput(id, { resolution: targetResolution })\n const adjustment = normalized.adjustments.find((a) => a.field === \"resolution\")\n return adjustment ? { targetResolution: normalized.resolution, adjustment } : { targetResolution: normalized.resolution }\n}\n"]}
1
+ {"version":3,"sources":["../src/image-model-roles.ts","../src/video-upscale-params.ts"],"names":["MODEL_CATALOG","normalizeModelInput"],"mappings":";;;;;AAuBO,IAAM,yBAAA,GAA4B;AAAA,EACvC,SAAA,EAAW,aAAA;AAAA,EACX,OAAA,EAAS,aAAA;AAAA,EACT,MAAA,EAAQ,aAAA;AAAA,EACR,IAAA,EAAM;AACR;AAWO,IAAM,2BAAA,GAAmF;AAAA,EAC9F,SAAA,EAAW,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EACjF,OAAA,EAAS,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EAC/E,MAAA,EAAQ,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EAC9E,IAAA,EAAM,CAAC,4BAAA,EAA8B,4BAAA,EAA8B,iBAAiB;AACtF;AAGO,SAAS,oBAAA,CAAqB,SAAiB,WAAA,EAAsC;AAC1F,EAAA,IAAI,CAAC,aAAa,OAAO,IAAA;AACzB,EAAA,MAAM,MAAA,GAASA,+BAAA,CAAc,OAAO,CAAA,EAAG,YAAA;AACvC,EAAA,OAAO,MAAA,KAAW,MAAA,IAAa,MAAA,CAAO,QAAA,CAAS,WAAW,CAAA;AAC5D;AAQO,SAA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AAA,CAAoB,QAAA,IAAY,8BAA8B,CAAA;AACzE,EAAA,IAAA,CAAKA,+BAAA,CAAc,EAAE,CAAA,EAAG,WAAA,IAAe,IAAI,MAAA,KAAW,CAAA,EAAG,OAAO,EAAE,gBAAA,EAAiB;AACnF,EAAA,MAAM,aAAaC,qCAAA,CAAoB,EAAA,EAAI,EAAE,UAAA,EAAY,kBAAkB,CAAA;AAC3E,EAAA,MAAM,UAAA,GAAa,WAAW,WAAA,CAAY,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,UAAU,YAAY,CAAA;AAC9E,EAAA,OAAO,UAAA,GAAa,EAAE,gBAAA,EAAkB,UAAA,CAAW,UAAA,EAAY,YAAW,GAAI,EAAE,gBAAA,EAAkB,UAAA,CAAW,UAAA,EAAW;AAC1H","file":"chunk-MN7BUGXF.cjs","sourcesContent":["import { MODEL_CATALOG } from \"./model-catalog.js\"\n\n/**\n * The platform's answer to \"which image model, when the caller names none\".\n *\n * One table by ROLE, so every surface that picks for the user (node defaults,\n * route and workflow fallbacks, MCP tools, studios, pipelines) reads the same\n * model instead of keeping its own literal. Before this table those literals\n * had drifted apart: the Generate Image node started on Nano Banana Pro, the\n * routes fell back to the original Nano Banana, and MCP used Nano Banana 2.1.\n *\n * Decided on 2026-10-08 from a blind five-model comparison, quality\n * first and price second:\n * - characters, general text-to-image and video anchors on GPT Image 2;\n * - edits on the current GPT Image Flare (2.6 since 2026-11-09), which renders\n * at its default Medium when a run names no quality.\n * With reference images attached, GPT Image 2 runs as its i2i sibling (the\n * provider swaps it), so `character` covers identity-from-reference too.\n *\n * Nano Banana Pro is no longer a default. It remains a FALLBACK only: last in\n * the ratio chain below, the GPT-family safety-block retry, and the swimwear\n * dressing model.\n */\nexport const IMAGE_MODEL_ROLE_DEFAULTS = {\n character: \"gpt-image-2\",\n general: \"gpt-image-2\",\n anchor: \"gpt-image-2\",\n edit: \"gpt-image-2-6-flare-i2i\",\n} as const\n\nexport type ImageModelRole = keyof typeof IMAGE_MODEL_ROLE_DEFAULTS\n\n/**\n * Where a role's model goes when it cannot draw the requested aspect ratio.\n * GPT Image 2 draws only auto / 1:1 / 16:9 / 9:16 / 4:3 / 3:4, so 21:9, 3:2,\n * 2:3, 4:5, 5:4 and the other wide or in-between ratios move to GPT Image 2.6\n * Sunburst. GPT Image 2.5 Sunburst stays behind it for the ratios only 2.5\n * draws, and Nano Banana Pro comes last.\n */\nexport const IMAGE_MODEL_RATIO_FALLBACKS: Readonly<Record<ImageModelRole, readonly string[]>> = {\n character: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n general: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n anchor: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n edit: [\"gpt-image-2-6-sunburst-i2i\", \"gpt-image-2-5-sunburst-i2i\", \"nano-banana-pro\"],\n}\n\n/** True when the model's catalog entry lists the ratio (or no ratio was asked for). */\nexport function imageModelDrawsRatio(modelId: string, aspectRatio?: string | null): boolean {\n if (!aspectRatio) return true\n const ratios = MODEL_CATALOG[modelId]?.aspectRatios\n return ratios === undefined || ratios.includes(aspectRatio)\n}\n\n/**\n * The default image model for a role at the requested aspect ratio: the role's\n * model when it draws the ratio, else the first fallback that does, else the\n * role's model (whose own ratio normalization then snaps the ratio). Read from\n * the catalog, so widening a model's documented ratios moves this with it.\n */\nexport function defaultImageModel(role: ImageModelRole, aspectRatio?: string | null): string {\n const primary = IMAGE_MODEL_ROLE_DEFAULTS[role]\n if (imageModelDrawsRatio(primary, aspectRatio)) return primary\n return IMAGE_MODEL_RATIO_FALLBACKS[role].find((id) => imageModelDrawsRatio(id, aspectRatio)) ?? primary\n}\n\n/**\n * The model an image node that names none runs on, by node type: the same\n * default its route and its workflow branch apply. For the node types that\n * have one; undefined for any other.\n */\nexport function defaultImageModelForNode(nodeType: string, aspectRatio?: string | null): string | undefined {\n switch (nodeType) {\n case \"generate-image\":\n return defaultImageModel(\"general\", aspectRatio)\n case \"image-to-image\":\n case \"modify-image\":\n return defaultImageModel(\"edit\", aspectRatio)\n case \"reference-board\":\n return defaultImageModel(\"character\", aspectRatio)\n default:\n return undefined\n }\n}\n","/**\n * The Video Upscale node's target resolution, per provider, from the catalog.\n *\n * The node stores one `targetResolution` for every provider, and the providers\n * take different sets: Topaz 720p / 1080p / 4K (a short side, its own list in\n * `topaz-video.ts`), Nodaro Video Upscale 1080p / 2K / 4K (an output box), the\n * VEO and Seedance HD upscales none. For a provider whose catalog entry\n * declares its resolutions (`resolutions`, `defaultResolution`; today Nodaro\n * Video Upscale), this is the one coercion every lane applies — a node written\n * straight into workflow JSON, a request to the API and an MCP call never pass\n * through the editor's menus: a value it does not take becomes its default. A\n * provider whose entry declares none (Topaz included) is left alone: its run\n * reads the field by its own rules.\n */\nimport { MODEL_CATALOG, normalizeModelInput, type ModelInputAdjustment } from \"./model-catalog.js\"\n\n/**\n * Every target resolution some Video Upscale provider takes — Nodaro Video\n * Upscale's route schema and the MCP verb's enum. Which ones a provider takes:\n * its catalog entry's `resolutions` where it declares them\n * ({@link normalizeVideoUpscaleResolution}), else its own list (Topaz's).\n */\nexport const VIDEO_UPSCALE_RESOLUTIONS = [\"720p\", \"1080p\", \"2k\", \"4k\"] as const\nexport type VideoUpscaleResolution = (typeof VIDEO_UPSCALE_RESOLUTIONS)[number]\n\n/** The provider a Video Upscale node runs when it names none. */\nconst DEFAULT_VIDEO_UPSCALE_PROVIDER = \"topaz\"\n\n/**\n * Video Upscale's `provider` value as the catalog model it runs: its \"topaz\"\n * is the catalog's `topaz-video`; every other value is its own id.\n */\nexport function videoUpscaleModelOf(provider: string): string {\n return provider === \"topaz\" ? \"topaz-video\" : provider\n}\n\n/** The resolutions a Video Upscale provider's catalog entry declares, in its order; empty when it declares none (Topaz keeps its own list). */\nexport function videoUpscaleResolutionsFor(provider: string | undefined): readonly string[] {\n const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER)\n return MODEL_CATALOG[id]?.resolutions ?? []\n}\n\nexport interface NormalizedVideoUpscaleResolution {\n /** The value to store and send: the one asked for, its canonical spelling, or the provider's default. */\n readonly targetResolution: string | undefined\n /** What changed, when anything did. */\n readonly adjustment?: ModelInputAdjustment\n}\n\n/**\n * `targetResolution` coerced to one `provider` takes. Unset stays unset (each\n * run applies its own default). A value the provider does not list becomes the\n * provider's `defaultResolution`, a spelling variant (\"2K\") its canonical form.\n * A provider with no resolution setting gets the value back unchanged; a value\n * that is not a string, or an empty one, reads as unset.\n */\nexport function normalizeVideoUpscaleResolution(\n provider: string | undefined,\n targetResolution: unknown,\n): NormalizedVideoUpscaleResolution {\n if (typeof targetResolution !== \"string\" || targetResolution === \"\") return { targetResolution: undefined }\n const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER)\n if ((MODEL_CATALOG[id]?.resolutions ?? []).length === 0) return { targetResolution }\n const normalized = normalizeModelInput(id, { resolution: targetResolution })\n const adjustment = normalized.adjustments.find((a) => a.field === \"resolution\")\n return adjustment ? { targetResolution: normalized.resolution, adjustment } : { targetResolution: normalized.resolution }\n}\n"]}