@nodaro/shared 3.69.0 → 3.70.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 (176) hide show
  1. package/dist/{chunk-OZA4DE23.js → chunk-2VOXSVIE.js} +3 -3
  2. package/dist/{chunk-OZA4DE23.js.map → chunk-2VOXSVIE.js.map} +1 -1
  3. package/dist/{chunk-LSX2OFNB.js → chunk-42ICEVUN.js} +3 -3
  4. package/dist/{chunk-LSX2OFNB.js.map → chunk-42ICEVUN.js.map} +1 -1
  5. package/dist/{chunk-I6TBKTW3.cjs → chunk-4U7QAUV3.cjs} +73 -73
  6. package/dist/{chunk-I6TBKTW3.cjs.map → chunk-4U7QAUV3.cjs.map} +1 -1
  7. package/dist/{chunk-7EQJIGVT.js → chunk-52JNQG4K.js} +3 -3
  8. package/dist/{chunk-7EQJIGVT.js.map → chunk-52JNQG4K.js.map} +1 -1
  9. package/dist/{chunk-PERUFUVH.cjs → chunk-5B337MCI.cjs} +15 -15
  10. package/dist/{chunk-PERUFUVH.cjs.map → chunk-5B337MCI.cjs.map} +1 -1
  11. package/dist/{chunk-LY6IR5LL.cjs → chunk-5DRSENY3.cjs} +24 -24
  12. package/dist/{chunk-LY6IR5LL.cjs.map → chunk-5DRSENY3.cjs.map} +1 -1
  13. package/dist/{chunk-KLEKJUQI.js → chunk-BIQ7COJP.js} +5 -5
  14. package/dist/{chunk-KLEKJUQI.js.map → chunk-BIQ7COJP.js.map} +1 -1
  15. package/dist/{chunk-54E2JO4E.cjs → chunk-BLGZW3UF.cjs} +38 -26
  16. package/dist/chunk-BLGZW3UF.cjs.map +1 -0
  17. package/dist/{chunk-KSHAAPQF.cjs → chunk-BOCHNFDU.cjs} +4 -4
  18. package/dist/chunk-BOCHNFDU.cjs.map +1 -0
  19. package/dist/{chunk-ML55U7WM.js → chunk-C2UHX7OF.js} +3 -3
  20. package/dist/{chunk-ML55U7WM.js.map → chunk-C2UHX7OF.js.map} +1 -1
  21. package/dist/{chunk-Q2LEJXLZ.cjs → chunk-C32IL6RD.cjs} +2 -2
  22. package/dist/{chunk-Q2LEJXLZ.cjs.map → chunk-C32IL6RD.cjs.map} +1 -1
  23. package/dist/{chunk-PLANUXQL.cjs → chunk-CV2BEK52.cjs} +25 -3
  24. package/dist/chunk-CV2BEK52.cjs.map +1 -0
  25. package/dist/{chunk-RURPG6IS.cjs → chunk-DOY47F7S.cjs} +7 -7
  26. package/dist/{chunk-RURPG6IS.cjs.map → chunk-DOY47F7S.cjs.map} +1 -1
  27. package/dist/{chunk-LZPG4XHT.js → chunk-EWNDK4FV.js} +3 -3
  28. package/dist/{chunk-LZPG4XHT.js.map → chunk-EWNDK4FV.js.map} +1 -1
  29. package/dist/{chunk-25C2E2GI.cjs → chunk-FMQ43SJP.cjs} +6 -6
  30. package/dist/{chunk-25C2E2GI.cjs.map → chunk-FMQ43SJP.cjs.map} +1 -1
  31. package/dist/{chunk-NTCSXKZ3.cjs → chunk-FWPGRC4X.cjs} +5 -5
  32. package/dist/{chunk-NTCSXKZ3.cjs.map → chunk-FWPGRC4X.cjs.map} +1 -1
  33. package/dist/{chunk-WML66SUV.cjs → chunk-GC77W57T.cjs} +18 -18
  34. package/dist/{chunk-WML66SUV.cjs.map → chunk-GC77W57T.cjs.map} +1 -1
  35. package/dist/{chunk-5ZCZL73I.js → chunk-H2E4QXEZ.js} +3 -3
  36. package/dist/{chunk-5ZCZL73I.js.map → chunk-H2E4QXEZ.js.map} +1 -1
  37. package/dist/{chunk-OOUJZR4K.js → chunk-HA2PVTER.js} +5 -5
  38. package/dist/{chunk-OOUJZR4K.js.map → chunk-HA2PVTER.js.map} +1 -1
  39. package/dist/{chunk-XZYZYWKG.cjs → chunk-HBRDKHIW.cjs} +21 -21
  40. package/dist/{chunk-XZYZYWKG.cjs.map → chunk-HBRDKHIW.cjs.map} +1 -1
  41. package/dist/{chunk-ZWEVRMFN.cjs → chunk-HWBLZSM3.cjs} +14 -7
  42. package/dist/chunk-HWBLZSM3.cjs.map +1 -0
  43. package/dist/{chunk-AH6OQXLW.js → chunk-IKN54UGB.js} +3 -3
  44. package/dist/{chunk-AH6OQXLW.js.map → chunk-IKN54UGB.js.map} +1 -1
  45. package/dist/{chunk-UVUHVY7F.js → chunk-JCYTTTM2.js} +2 -2
  46. package/dist/{chunk-UVUHVY7F.js.map → chunk-JCYTTTM2.js.map} +1 -1
  47. package/dist/{chunk-QNPYYSLT.cjs → chunk-JEUZNHLL.cjs} +33 -33
  48. package/dist/{chunk-QNPYYSLT.cjs.map → chunk-JEUZNHLL.cjs.map} +1 -1
  49. package/dist/{chunk-TAPBDT47.js → chunk-JVYDKXGY.js} +4 -4
  50. package/dist/{chunk-TAPBDT47.js.map → chunk-JVYDKXGY.js.map} +1 -1
  51. package/dist/{chunk-YVQFYW2U.js → chunk-K3YGI5IW.js} +25 -4
  52. package/dist/chunk-K3YGI5IW.js.map +1 -0
  53. package/dist/{chunk-OEOOXL3F.js → chunk-KKFFQUMM.js} +5 -5
  54. package/dist/{chunk-OEOOXL3F.js.map → chunk-KKFFQUMM.js.map} +1 -1
  55. package/dist/{chunk-BDW25A7Y.js → chunk-LTBM2KMY.js} +20 -10
  56. package/dist/chunk-LTBM2KMY.js.map +1 -0
  57. package/dist/{chunk-AGIG5HUU.cjs → chunk-MZ772ZXA.cjs} +17 -17
  58. package/dist/{chunk-AGIG5HUU.cjs.map → chunk-MZ772ZXA.cjs.map} +1 -1
  59. package/dist/{chunk-G6AOKNAY.js → chunk-NS34PZ2S.js} +3 -3
  60. package/dist/{chunk-G6AOKNAY.js.map → chunk-NS34PZ2S.js.map} +1 -1
  61. package/dist/{chunk-6Q4BS6AR.js → chunk-NT3ZFUNJ.js} +31 -3
  62. package/dist/chunk-NT3ZFUNJ.js.map +1 -0
  63. package/dist/{chunk-DNWFFVC6.js → chunk-O53P2D4V.js} +3 -3
  64. package/dist/{chunk-DNWFFVC6.js.map → chunk-O53P2D4V.js.map} +1 -1
  65. package/dist/{chunk-5WHU7CYE.js → chunk-OW5AXH2Y.js} +51 -7
  66. package/dist/chunk-OW5AXH2Y.js.map +1 -0
  67. package/dist/{chunk-UJREE6EQ.cjs → chunk-OZHE77T3.cjs} +9 -9
  68. package/dist/{chunk-UJREE6EQ.cjs.map → chunk-OZHE77T3.cjs.map} +1 -1
  69. package/dist/{chunk-DE55SA2X.js → chunk-PKWRAMVB.js} +6 -6
  70. package/dist/{chunk-DE55SA2X.js.map → chunk-PKWRAMVB.js.map} +1 -1
  71. package/dist/{chunk-3OHRFSQL.cjs → chunk-POZBRZUM.cjs} +73 -60
  72. package/dist/chunk-POZBRZUM.cjs.map +1 -0
  73. package/dist/{chunk-TWUFC32F.cjs → chunk-PWIKUOLB.cjs} +8 -8
  74. package/dist/{chunk-TWUFC32F.cjs.map → chunk-PWIKUOLB.cjs.map} +1 -1
  75. package/dist/{chunk-3AB3YIFM.cjs → chunk-PYYYBINP.cjs} +6 -6
  76. package/dist/{chunk-3AB3YIFM.cjs.map → chunk-PYYYBINP.cjs.map} +1 -1
  77. package/dist/{chunk-6QJHSN6J.cjs → chunk-QCGSL4CJ.cjs} +4 -4
  78. package/dist/{chunk-6QJHSN6J.cjs.map → chunk-QCGSL4CJ.cjs.map} +1 -1
  79. package/dist/{chunk-7OSUEYZ4.js → chunk-QCVQVKCI.js} +3 -3
  80. package/dist/{chunk-7OSUEYZ4.js.map → chunk-QCVQVKCI.js.map} +1 -1
  81. package/dist/{chunk-7PC2YHBN.cjs → chunk-QCZYYAPZ.cjs} +48 -48
  82. package/dist/{chunk-7PC2YHBN.cjs.map → chunk-QCZYYAPZ.cjs.map} +1 -1
  83. package/dist/{chunk-4IMEJQVQ.cjs → chunk-QV32JI4L.cjs} +4 -4
  84. package/dist/{chunk-4IMEJQVQ.cjs.map → chunk-QV32JI4L.cjs.map} +1 -1
  85. package/dist/{chunk-YT4ZTJVC.js → chunk-QVAUBB2T.js} +11 -11
  86. package/dist/{chunk-YT4ZTJVC.js.map → chunk-QVAUBB2T.js.map} +1 -1
  87. package/dist/{chunk-FUYBUT65.js → chunk-R22UHRR6.js} +14 -7
  88. package/dist/chunk-R22UHRR6.js.map +1 -0
  89. package/dist/{chunk-KL6GAYTT.js → chunk-S6DXSQCV.js} +5 -3
  90. package/dist/chunk-S6DXSQCV.js.map +1 -0
  91. package/dist/{chunk-V24EPI5N.cjs → chunk-U4DIGIC3.cjs} +5 -3
  92. package/dist/chunk-U4DIGIC3.cjs.map +1 -0
  93. package/dist/{chunk-H5KHWTAE.js → chunk-UY6QZX7H.js} +4 -4
  94. package/dist/chunk-UY6QZX7H.js.map +1 -0
  95. package/dist/{chunk-PHQVAPSD.js → chunk-V6TC2NDG.js} +29 -17
  96. package/dist/chunk-V6TC2NDG.js.map +1 -0
  97. package/dist/{chunk-DBD4BCGH.cjs → chunk-VDFQKLDG.cjs} +33 -2
  98. package/dist/chunk-VDFQKLDG.cjs.map +1 -0
  99. package/dist/{chunk-MGSGLRHZ.cjs → chunk-WHV7MDNC.cjs} +70 -11
  100. package/dist/chunk-WHV7MDNC.cjs.map +1 -0
  101. package/dist/{chunk-5EQRIUGI.cjs → chunk-XBHDXURR.cjs} +78 -78
  102. package/dist/{chunk-5EQRIUGI.cjs.map → chunk-XBHDXURR.cjs.map} +1 -1
  103. package/dist/{chunk-TDU45K6Z.js → chunk-YLDY23N2.js} +5 -5
  104. package/dist/{chunk-TDU45K6Z.js.map → chunk-YLDY23N2.js.map} +1 -1
  105. package/dist/entries/apps.cjs +43 -43
  106. package/dist/entries/apps.js +8 -8
  107. package/dist/entries/credits.cjs +246 -238
  108. package/dist/entries/credits.d.cts +16 -1
  109. package/dist/entries/credits.d.ts +16 -1
  110. package/dist/entries/credits.js +11 -11
  111. package/dist/entries/llm-models.cjs +76 -72
  112. package/dist/entries/llm-models.d.cts +38 -4
  113. package/dist/entries/llm-models.d.ts +38 -4
  114. package/dist/entries/llm-models.js +2 -2
  115. package/dist/entries/media.cjs +87 -87
  116. package/dist/entries/media.js +1 -1
  117. package/dist/entries/model-catalog.cjs +133 -133
  118. package/dist/entries/model-catalog.js +4 -4
  119. package/dist/entries/models.cjs +431 -415
  120. package/dist/entries/models.d.cts +62 -27
  121. package/dist/entries/models.d.ts +62 -27
  122. package/dist/entries/models.js +7 -7
  123. package/dist/entries/nodes.cjs +215 -215
  124. package/dist/entries/nodes.js +11 -11
  125. package/dist/entries/pipeline.cjs +153 -153
  126. package/dist/entries/pipeline.js +3 -3
  127. package/dist/entries/social.cjs +237 -177
  128. package/dist/entries/social.d.cts +183 -6
  129. package/dist/entries/social.d.ts +183 -6
  130. package/dist/entries/social.js +2 -2
  131. package/dist/entries/ugc.cjs +71 -71
  132. package/dist/entries/ugc.js +4 -4
  133. package/dist/entries/video.cjs +153 -153
  134. package/dist/entries/video.js +7 -7
  135. package/dist/entries/workflow.cjs +152 -152
  136. package/dist/entries/workflow.js +4 -4
  137. package/dist/index.cjs +1959 -1871
  138. package/dist/index.d.cts +4 -4
  139. package/dist/index.d.ts +4 -4
  140. package/dist/index.js +26 -26
  141. package/package.json +1 -1
  142. package/src/__tests__/cast-swap-limits.test.ts +54 -20
  143. package/src/__tests__/competitors.test.ts +64 -0
  144. package/src/__tests__/lip-sync-pricing.test.ts +29 -2
  145. package/src/__tests__/llm-models.test.ts +50 -7
  146. package/src/__tests__/suno-separate.test.ts +32 -0
  147. package/src/cast-swap-limits.ts +43 -25
  148. package/src/competitors.ts +80 -8
  149. package/src/entries/credits.ts +2 -0
  150. package/src/entries/llm-models.ts +2 -0
  151. package/src/entries/models.ts +4 -0
  152. package/src/entries/social.ts +33 -0
  153. package/src/generated/unit-contracts.ts +1 -0
  154. package/src/lip-sync-pricing.ts +25 -0
  155. package/src/llm-models.ts +60 -4
  156. package/src/model-catalog.ts +12 -5
  157. package/src/node-runtime-keys.ts +2 -2
  158. package/src/suno-separate.ts +51 -0
  159. package/src/topics.ts +162 -0
  160. package/src/video-face-mesh.ts +1 -1
  161. package/dist/chunk-3OHRFSQL.cjs.map +0 -1
  162. package/dist/chunk-54E2JO4E.cjs.map +0 -1
  163. package/dist/chunk-5WHU7CYE.js.map +0 -1
  164. package/dist/chunk-6Q4BS6AR.js.map +0 -1
  165. package/dist/chunk-BDW25A7Y.js.map +0 -1
  166. package/dist/chunk-DBD4BCGH.cjs.map +0 -1
  167. package/dist/chunk-FUYBUT65.js.map +0 -1
  168. package/dist/chunk-H5KHWTAE.js.map +0 -1
  169. package/dist/chunk-KL6GAYTT.js.map +0 -1
  170. package/dist/chunk-KSHAAPQF.cjs.map +0 -1
  171. package/dist/chunk-MGSGLRHZ.cjs.map +0 -1
  172. package/dist/chunk-PHQVAPSD.js.map +0 -1
  173. package/dist/chunk-PLANUXQL.cjs.map +0 -1
  174. package/dist/chunk-V24EPI5N.cjs.map +0 -1
  175. package/dist/chunk-YVQFYW2U.js.map +0 -1
  176. package/dist/chunk-ZWEVRMFN.cjs.map +0 -1
package/src/llm-models.ts CHANGED
@@ -15,6 +15,14 @@
15
15
 
16
16
  export type LlmTier = "economy" | "standard" | "premium"
17
17
  export type KieApiFormat = "chat-completions" | "messages" | "responses"
18
+
19
+ /** How a document is sent to a model, per lane (see `LlmModelDef.fileWire`). */
20
+ export interface LlmFileWire {
21
+ /** The shape on the aggregator's lane: `input-file` (responses dialect) or `image-url` (chat-completions dialect). */
22
+ kie: "input-file" | "image-url"
23
+ /** The shape on the vendor's own API, for a model that has one. */
24
+ direct?: "inline-data"
25
+ }
18
26
  export type LlmVendor = "anthropic" | "deepseek" | "google" | "moonshot" | "openai" | "xai"
19
27
 
20
28
  export const LLM_REASONING_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"] as const
@@ -118,6 +126,30 @@ export interface LlmModelDef {
118
126
  * and `kieSlugOrModel` (`gemini-3.1-pro` → `gemini-3.1-pro-preview`).
119
127
  */
120
128
  directGeminiModel?: string
129
+ /**
130
+ * How a document (PDF) is sent to this model on each lane that can serve it
131
+ * (decided 2026-11-17). Declared by exactly the models whose modality caps
132
+ * say `file` ({@link llmAcceptsFiles}); a lane's builder sends a document
133
+ * only in the shape named here and refuses one on a model that names none,
134
+ * so a file is never dropped on the way.
135
+ *
136
+ * `kie`:
137
+ * - `"input-file"`: an inline `input_file` part on the responses dialect.
138
+ * - `"image-url"`: an `image_url` part on the chat-completions dialect,
139
+ * holding a `data:application/pdf;base64,…` URL or an https link whose
140
+ * path ends in `.pdf`. That dialect silently drops the `file` and
141
+ * `input_file` shapes (a billed answer about no file), so this is the one
142
+ * shape sent there.
143
+ *
144
+ * `direct`: `"inline-data"`, an `application/pdf` inline part on the vendor's
145
+ * own API. Set on every file model that declares a direct lane, and on no
146
+ * other.
147
+ *
148
+ * Never derived from the dialect: a model gets a shape only by its own
149
+ * probe, recorded with its date on the entry, and
150
+ * `llm-models.test.ts` lists every declaration by model.
151
+ */
152
+ fileWire?: LlmFileWire
121
153
  /**
122
154
  * Try the direct-vendor lane FIRST for this model, with KIE as the failure
123
155
  * fallback. Absent (while `directGeminiModel` is set) = KIE first, direct
@@ -725,6 +757,19 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
725
757
  // `models/gemini-4-hydrogen` (models.list, 2026-11-16: input 1,048,576,
726
758
  // output 65,536).
727
759
  directGeminiModel: "gemini-4-hydrogen",
760
+ // Reads PDF files (decided 2026-11-17). Measured on KIE 2026-11-17: a PDF
761
+ // is read only as an `image_url` part (a `data:application/pdf` URL, or an
762
+ // https link ending in `.pdf`); the `file` and `input_file` shapes are
763
+ // dropped, billed. Read correctly at 1, 5, 14 and 15 pages (facts from
764
+ // pages 2, 8 and 11), up to 2.2 MB by link and 1.36 million characters
765
+ // inline; 1,280 to 2,670 prompt tokens a page. Google's own API reads an
766
+ // inline `application/pdf` part (probed 2026-11-17, thinking LOW): the
767
+ // same three documents answered correctly with almost the same counts —
768
+ // 5 pages 13,332 prompt tokens (KIE 13,357), 14 pages 28,048 (28,068),
769
+ // 15 pages and 2.2 MB 19,207 (19,220) — 520 image tokens a page plus the
770
+ // page's text. Not measured on either lane: a blank or scanned page, more
771
+ // than 15 pages, more than 2.2 MB, several files in one call.
772
+ fileWire: { kie: "image-url", direct: "inline-data" },
728
773
  // KIE accepted reasoning_effort low / medium / high / xhigh (xhigh reasons
729
774
  // clearly deeper); Google 400s thinkingLevel MINIMAL on this model ("not
730
775
  // supported") and answers LOW / MEDIUM / HIGH / XHIGH (probed 2026-11-16).
@@ -1012,6 +1057,8 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
1012
1057
  // `effortPriced`. The charge follows what KIE states or reports.
1013
1058
  kieSlugOrModel: "gpt-6-1-terra",
1014
1059
  vendor: "openai",
1060
+ // A PDF goes inline as an `input_file` part (probed 2026-11-13).
1061
+ fileWire: { kie: "input-file" },
1015
1062
  structuredOutputMode: "responses-json-schema",
1016
1063
  supportsImages: true,
1017
1064
  maxOutputTokens: 16384,
@@ -1634,9 +1681,10 @@ export function defaultReasoningEffort(feature: string, modelId?: string): LlmRe
1634
1681
  * input requires a separate audio-capable model we don't route to today.
1635
1682
  *
1636
1683
  * `file` (decided 2026-11-13): the model reads documents (PDF) sent with the
1637
- * call. Declared on the one model that does — GPT-6.1 Terra — and never
1638
- * derived for any other: absent means no. Read it through
1639
- * {@link llmAcceptsFiles}.
1684
+ * call. Declared on each model that does — GPT-6.1 Terra, and Gemini 4
1685
+ * Hydrogen from 2026-11-17 — and never derived for any other: absent means
1686
+ * no. Read it through {@link llmAcceptsFiles}. A model that declares it also
1687
+ * declares how a file is sent to it (`fileWire` on its registry entry).
1640
1688
  */
1641
1689
  export const LLM_MODALITY_CAPS: Record<string, LlmModalityCaps> = {
1642
1690
  // Keeps full caps after KIE dropped its channel (2026-11-13): it stays a
@@ -1686,7 +1734,10 @@ export const LLM_MODALITY_CAPS: Record<string, LlmModalityCaps> = {
1686
1734
  // audio were not probed. Google's own API (where a media call is pinned
1687
1735
  // when this install has a Gemini key, as Carbon's) lists video and audio
1688
1736
  // input for it; not probed with media.
1689
- "gemini-4-hydrogen": { image: true, video: true, audio: true },
1737
+ // It also reads documents (PDF, decided 2026-11-17; `fileWire` on its
1738
+ // registry entry says how each lane is sent one). The `file` cap is read only
1739
+ // by the LLM nodes (`llmAcceptsFiles`), so it enrols the model in nothing else.
1740
+ "gemini-4-hydrogen": { image: true, video: true, audio: true, file: true },
1690
1741
  "claude-haiku-4.5": { image: true, video: false, audio: false },
1691
1742
  "claude-haiku-5.5": { image: true, video: false, audio: false },
1692
1743
  "claude-sonnet-4.6": { image: true, video: false, audio: false },
@@ -1769,6 +1820,11 @@ export function llmAcceptsFiles(modelId: string | undefined): boolean {
1769
1820
  return Boolean(modelId && LLM_MODALITY_CAPS[modelId]?.file)
1770
1821
  }
1771
1822
 
1823
+ /** How `modelId` is sent a document on each lane (`fileWire` on its registry entry); `undefined` for a model that reads none. */
1824
+ export function llmFileWire(modelId: string | undefined): LlmFileWire | undefined {
1825
+ return llmAcceptsFiles(modelId) ? LLM_MODELS.find((m) => m.id === modelId)?.fileWire : undefined
1826
+ }
1827
+
1772
1828
  /** The models that read documents, in registry order — what a refusal names. */
1773
1829
  export const LLM_FILE_MODELS: readonly LlmModelDef[] = LLM_MODELS.filter((m) => llmAcceptsFiles(m.id))
1774
1830
 
@@ -4154,9 +4154,10 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
4154
4154
  },
4155
4155
  // LatentSync, HeyGen Lipsync Precision and Lipsync 2 Pro run on Replicate
4156
4156
  // (providers/replicate/lip-sync.ts). Listed so a deployment's model
4157
- // restriction can name them (decided 2026-11-12); what they are sent and
4158
- // charged did not change. They take no size: the result keeps the size of the
4159
- // video they are given.
4157
+ // restriction can name them (decided 2026-11-12). They take no size: the
4158
+ // result keeps the size of the video they are given. LatentSync holds the
4159
+ // bucket of its audio's length and is charged what the run used
4160
+ // (`isLipSyncChargedAtRunCost`, decided 2026-11-18).
4160
4161
  "latentsync": {
4161
4162
  id: "latentsync",
4162
4163
  kind: "video",
@@ -4165,9 +4166,15 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
4165
4166
  maker: "bytedance",
4166
4167
  label: "LatentSync",
4167
4168
  series: "LatentSync",
4168
- description: "Diffusion lip sync on an existing video — strong on singing and expressive vocals. Video input.",
4169
+ description: "Diffusion lip sync on an existing video — strong on singing and expressive vocals. Video input, charged by what the run uses.",
4169
4170
  useCases: ["lip-sync", "dubbing", "video-to-video"],
4170
- pricing: [{ identifier: "latentsync", credits: 7 }],
4171
+ pricing: [
4172
+ { identifier: "latentsync:15s", credits: 100, note: "hold — the run is charged what it used" },
4173
+ { identifier: "latentsync:30s", credits: 160, note: "hold" },
4174
+ { identifier: "latentsync:60s", credits: 280, note: "hold" },
4175
+ { identifier: "latentsync:120s", credits: 520, note: "hold" },
4176
+ { identifier: "latentsync:300s", credits: 1240, note: "hold, 5-min ceiling" },
4177
+ ],
4171
4178
  },
4172
4179
  "heygen-lipsync-precision": {
4173
4180
  id: "heygen-lipsync-precision",
@@ -1,4 +1,4 @@
1
- import { SUNO_SEPARATE_META_FIELDS, SUNO_SEPARATE_RESULT_FIELDS } from "./suno-separate.js"
1
+ import { SUNO_SEPARATE_ID_FIELDS, SUNO_SEPARATE_META_FIELDS, SUNO_SEPARATE_RESULT_FIELDS } from "./suno-separate.js"
2
2
 
3
3
  /**
4
4
  * Field names on a node's `data` that hold runtime / result / transient execution
@@ -203,7 +203,7 @@ export const NODE_TYPE_EXECUTION_DATA_KEYS: Readonly<Record<string, readonly str
203
203
  "ugc-clips": ["ugcOutputs", "quote"],
204
204
  "ugc-clip": ["ugcOutputs", "clipWarnings", "durationSec", "rerenderPending"],
205
205
  "ugc-cards": ["ugcOutputs"],
206
- "suno-separate": [...SUNO_SEPARATE_RESULT_FIELDS, ...SUNO_SEPARATE_META_FIELDS.filter((key) => key !== "stemName")],
206
+ "suno-separate": [...SUNO_SEPARATE_RESULT_FIELDS, ...SUNO_SEPARATE_META_FIELDS.filter((key) => key !== "stemName"), ...SUNO_SEPARATE_ID_FIELDS],
207
207
  }
208
208
 
209
209
  /** Is `key` execution data (run state or a run's result) on a node of `type`: global, or that type's own? */
@@ -159,6 +159,57 @@ export type SunoSeparateResultField = (typeof SUNO_SEPARATE_RESULT_FIELDS)[numbe
159
159
  /** Non-URL fields a run's output records about how it ran. */
160
160
  export const SUNO_SEPARATE_META_FIELDS = ["separateType", "stemName", "engineUsed", "sunoRefused", "fallbackReason"] as const
161
161
 
162
+ /**
163
+ * The Suno ids a run's output carries for its stems: `sunoTaskId`, the
164
+ * separation task, and `sunoStemIds`, each stem's or take's own id by its
165
+ * result field (`{ vocalUrl: "<id>", … }`). Suno Convert to WAV takes a stem
166
+ * by the separation's task id and the stem's id. A run that Demucs or the
167
+ * connected cloud delivered has none, and neither has an output written before
168
+ * the ids were kept.
169
+ */
170
+ export const SUNO_SEPARATE_ID_FIELDS = ["sunoTaskId", "sunoStemIds"] as const
171
+
172
+ /** The result field behind a handle (old spellings included); the primary field for any other handle, or none. */
173
+ export function sunoSeparateHandleField(
174
+ output: Readonly<Record<string, unknown>>,
175
+ handle: string | null | undefined,
176
+ ): SunoSeparateResultField | undefined {
177
+ switch (handle) {
178
+ case "vocals":
179
+ case "vocal":
180
+ case "vocal-out":
181
+ return "vocalUrl"
182
+ case "instrumental":
183
+ case "instrumental-out":
184
+ return "instrumentalUrl"
185
+ case "isolated":
186
+ return "isolatedUrl"
187
+ case "without":
188
+ return "withoutUrl"
189
+ default: {
190
+ const primary = sunoSeparatePrimaryUrl(output)
191
+ return primary === undefined ? undefined : SUNO_SEPARATE_RESULT_FIELDS.find((field) => str(output[field]) === primary)
192
+ }
193
+ }
194
+ }
195
+
196
+ /**
197
+ * The Suno ids of the stem behind one handle — the separation's task id and
198
+ * that stem's own id — or undefined when the output does not carry both (a
199
+ * Demucs or cloud run, an older output, a stem that did not come back).
200
+ */
201
+ export function sunoSeparateHandleIds(
202
+ output: Readonly<Record<string, unknown>>,
203
+ handle: string | null | undefined,
204
+ ): { readonly taskId: string; readonly audioId: string } | undefined {
205
+ const taskId = str(output.sunoTaskId)
206
+ const ids = output.sunoStemIds
207
+ if (!taskId || typeof ids !== "object" || ids === null || Array.isArray(ids)) return undefined
208
+ const field = sunoSeparateHandleField(output, handle)
209
+ const audioId = field ? str((ids as Record<string, unknown>)[field]) : undefined
210
+ return audioId ? { taskId, audioId } : undefined
211
+ }
212
+
162
213
  function str(v: unknown): string | undefined {
163
214
  return typeof v === "string" && v !== "" ? v : undefined
164
215
  }
package/src/topics.ts ADDED
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Topics — the wire contract of topic tracking.
3
+ *
4
+ * A person follows a hashtag or phrase with no brand around it ("ai video")
5
+ * on the platforms they pick. Each scan searches the term on each platform,
6
+ * 20, 40 or 60 posts per search, keeps the posts that really name it, and
7
+ * produces cards about what is spreading. Scans are kept like a tracked
8
+ * brand's, and run on a schedule or on demand.
9
+ *
10
+ * Why public: these are the shapes `/v1/topics*` answers. How a card is
11
+ * decided is not part of the contract.
12
+ */
13
+ import type { ActionCard, CompetitorSchedule } from "./competitors.js"
14
+ import { COMPETITOR_SCAN_PAGE_CREDIT_ID } from "./competitors.js"
15
+ import type { SocialPlatform, SocialPost } from "./social-search.js"
16
+ import { SOCIAL_SEARCH_CREDITS_PER_PAGE, socialSearchEffectiveCount, socialSearchPages } from "./social-search.js"
17
+
18
+ /** Where a topic can be searched. */
19
+ export const TOPIC_PLATFORMS = ["tiktok", "instagram", "youtube", "x", "reddit", "linkedin"] as const
20
+ export type TopicPlatform = (typeof TOPIC_PLATFORMS)[number]
21
+ export const TOPIC_DEFAULT_PLATFORMS: readonly TopicPlatform[] = ["tiktok", "instagram", "youtube", "x"]
22
+
23
+ /** Posts each search of a topic reads: one, two or three Social Search pages. */
24
+ export const TOPIC_POST_COUNTS = [20, 40, 60] as const
25
+ export type TopicPostCount = (typeof TOPIC_POST_COUNTS)[number]
26
+
27
+ export const TOPIC_SCAN_NODE_TYPE = "topic-scan"
28
+ /** A topic scan is charged this id per Social Search page it runs, summed. */
29
+ export const TOPIC_SCAN_PAGE_CREDIT_ID = "topic-scan:per-page"
30
+ /** The most topics any person can follow (the platform's own ceiling; a plan allows fewer). */
31
+ export const TOPICS_MAX = 200
32
+
33
+ /** The per-page scan rates (a brand's and a topic's), at their base price: one Social Search page each. */
34
+ export const SCAN_PAGE_CREDIT_COSTS: Readonly<Record<string, number>> = {
35
+ [COMPETITOR_SCAN_PAGE_CREDIT_ID]: SOCIAL_SEARCH_CREDITS_PER_PAGE,
36
+ [TOPIC_SCAN_PAGE_CREDIT_ID]: SOCIAL_SEARCH_CREDITS_PER_PAGE,
37
+ }
38
+
39
+ export interface TrackedTopic {
40
+ readonly id: string
41
+ /** Its display name. */
42
+ readonly name: string
43
+ /** The hashtag or phrase it searches. */
44
+ readonly term: string
45
+ readonly platforms: readonly TopicPlatform[]
46
+ readonly postCount: TopicPostCount
47
+ readonly schedule: CompetitorSchedule
48
+ readonly nextScanAt: string | null
49
+ readonly lastScanAt: string | null
50
+ readonly lastScanId: string | null
51
+ /** Why the last scan (or scheduled start) fell short; null when it did not. */
52
+ readonly lastScanError: string | null
53
+ /** A scan is running now. */
54
+ readonly scanning: boolean
55
+ /** Social Search pages one scan runs: the scan costs this many pages. */
56
+ readonly pages: number
57
+ readonly createdAt: string
58
+ readonly updatedAt: string
59
+ }
60
+
61
+ /** What a plan allows a person on the Topics page. */
62
+ export interface TopicLimits {
63
+ /** Topics a person can follow; 0 = none; null = no cap. */
64
+ readonly topics: number | null
65
+ }
66
+
67
+ /** `GET /v1/topics`. */
68
+ export interface TopicListResult {
69
+ readonly data: readonly TrackedTopic[]
70
+ /** Your plan's caps. Absent when the plan could not be read just now: neither locked nor unlimited, only unknown. */
71
+ readonly limits?: TopicLimits
72
+ /** How many months of scans your plan keeps. Absent when the plan could not be read just now. */
73
+ readonly historyMonths?: number
74
+ }
75
+
76
+ export interface CreateTopicInput {
77
+ readonly name: string
78
+ /** The hashtag or phrase to search. Default: the name. */
79
+ readonly term?: string
80
+ /** Default: TikTok, Instagram, YouTube and X. */
81
+ readonly platforms?: readonly TopicPlatform[]
82
+ /** Default 20. */
83
+ readonly postCount?: TopicPostCount
84
+ /** Default weekly. */
85
+ readonly schedule?: CompetitorSchedule
86
+ }
87
+
88
+ export type UpdateTopicInput = Partial<CreateTopicInput>
89
+
90
+ export interface TopicScanCounts {
91
+ /** Posts the scan kept (the ones that name the term). */
92
+ readonly posts: number
93
+ readonly searches: number
94
+ readonly failedSearches: number
95
+ /** The platforms whose search returned. */
96
+ readonly okSearches?: readonly string[]
97
+ }
98
+
99
+ export interface TopicScan {
100
+ readonly id: string
101
+ readonly at: string
102
+ readonly counts: TopicScanCounts
103
+ readonly posts: readonly SocialPost[]
104
+ readonly cards: readonly ActionCard[]
105
+ }
106
+
107
+ export interface TopicScanSummary {
108
+ readonly id: string
109
+ readonly at: string
110
+ readonly counts: TopicScanCounts
111
+ readonly cards: number
112
+ }
113
+
114
+ /** `GET /v1/topics/:id`. */
115
+ export interface TopicDetail extends TrackedTopic {
116
+ readonly latestScan: TopicScan | null
117
+ /** Newest first, at most twelve. */
118
+ readonly scans: readonly TopicScanSummary[]
119
+ }
120
+
121
+ /** One platform as one scan found it. */
122
+ export interface TopicHistoryPlatform {
123
+ readonly platform: SocialPlatform
124
+ /** Posts kept there. */
125
+ readonly posts: number
126
+ /** Their summed reach (views, plays or points); null when the platform gives none. */
127
+ readonly reach: number | null
128
+ }
129
+
130
+ export interface TopicHistoryPoint {
131
+ readonly id: string
132
+ readonly at: string
133
+ readonly platforms: readonly TopicHistoryPlatform[]
134
+ }
135
+
136
+ /** `GET /v1/topics/:id/history`: the topic's scans, oldest first. */
137
+ export interface TopicHistory {
138
+ readonly scans: readonly TopicHistoryPoint[]
139
+ }
140
+
141
+ /** `GET /v1/topics/cards`: the cards of every topic's latest scan, most urgent first, and the posts they rest on. */
142
+ export interface TopicCardsResult {
143
+ readonly cards: readonly ActionCard[]
144
+ readonly posts: Readonly<Record<string, SocialPost>>
145
+ }
146
+
147
+ /** Social Search pages a topic scan runs: each platform's search at the topic's post count (some platforms read one page only). */
148
+ export function topicScanPages(t: { readonly platforms: readonly string[]; readonly postCount: number }): number {
149
+ return t.platforms
150
+ .filter((p): p is TopicPlatform => (TOPIC_PLATFORMS as readonly string[]).includes(p))
151
+ .reduce((sum, platform) => sum + socialSearchPages(socialSearchEffectiveCount(platform, "keyword", t.postCount)), 0)
152
+ }
153
+
154
+ /** The credits a topic scan of this many pages costs, before the live price table loads. */
155
+ export function topicScanCredits(pages: number): number {
156
+ return !Number.isFinite(pages) || pages <= 0 ? 0 : Math.round(pages) * SOCIAL_SEARCH_CREDITS_PER_PAGE
157
+ }
158
+
159
+ /** Whether a value is one of the topic platforms. */
160
+ export function isTopicPlatform(value: string): value is TopicPlatform {
161
+ return (TOPIC_PLATFORMS as readonly string[]).includes(value)
162
+ }
@@ -2,7 +2,7 @@
2
2
  * Video Face Mesh (`POST /v1/video-face-mesh`, job type `video-face-mesh`):
3
3
  * thin GRAY face lines — a wireframe, and darker eye and lip outlines, each a
4
4
  * tone of the picture under it — drawn on the faces of a clip, frame for
5
- * frame. An internal step of Nodaro Motion's face masking: the lines go on
5
+ * frame. An internal step of Video Remake's face masking: the lines go on
6
6
  * the masked (or depth) clip so the video model still sees where the mouth
7
7
  * and the eyes are. A request may draw only the eye and lip outlines, only
8
8
  * the lip outline, or the face's contours (`parts`).