@nodaro/shared 3.30.0 → 3.32.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.
- package/README.md +17 -0
- package/dist/chunk-2NIQO2J3.cjs +54 -0
- package/dist/chunk-2NIQO2J3.cjs.map +1 -0
- package/dist/chunk-2OJIVO7R.cjs +32 -0
- package/dist/chunk-2OJIVO7R.cjs.map +1 -0
- package/dist/chunk-2RF4Z7KG.cjs +803 -0
- package/dist/chunk-2RF4Z7KG.cjs.map +1 -0
- package/dist/chunk-3CUFITU7.js +1905 -0
- package/dist/chunk-3CUFITU7.js.map +1 -0
- package/dist/chunk-3RYKIUAE.js +86 -0
- package/dist/chunk-3RYKIUAE.js.map +1 -0
- package/dist/chunk-44I73CQS.cjs +194 -0
- package/dist/chunk-44I73CQS.cjs.map +1 -0
- package/dist/chunk-5AUSSJIM.cjs +3372 -0
- package/dist/chunk-5AUSSJIM.cjs.map +1 -0
- package/dist/chunk-5PC6JBGJ.cjs +1419 -0
- package/dist/chunk-5PC6JBGJ.cjs.map +1 -0
- package/dist/chunk-5RU2HCW2.js +30 -0
- package/dist/chunk-5RU2HCW2.js.map +1 -0
- package/dist/chunk-5THUHJ3E.js +46 -0
- package/dist/chunk-5THUHJ3E.js.map +1 -0
- package/dist/chunk-5U7VLG43.js +141 -0
- package/dist/chunk-5U7VLG43.js.map +1 -0
- package/dist/chunk-6DAWSVX2.cjs +103 -0
- package/dist/chunk-6DAWSVX2.cjs.map +1 -0
- package/dist/chunk-6DKDOWBL.js +1567 -0
- package/dist/chunk-6DKDOWBL.js.map +1 -0
- package/dist/chunk-6IJOPRZP.cjs +197 -0
- package/dist/chunk-6IJOPRZP.cjs.map +1 -0
- package/dist/chunk-7G7G42KS.js +86 -0
- package/dist/chunk-7G7G42KS.js.map +1 -0
- package/dist/chunk-AINCI23X.js +2171 -0
- package/dist/chunk-AINCI23X.js.map +1 -0
- package/dist/chunk-AROWPFO2.js +773 -0
- package/dist/chunk-AROWPFO2.js.map +1 -0
- package/dist/chunk-AVQK77G6.cjs +2000 -0
- package/dist/chunk-AVQK77G6.cjs.map +1 -0
- package/dist/chunk-C57NEO3X.js +3327 -0
- package/dist/chunk-C57NEO3X.js.map +1 -0
- package/dist/chunk-CK3GK34R.js +1381 -0
- package/dist/chunk-CK3GK34R.js.map +1 -0
- package/dist/chunk-E2TGXG6X.cjs +1770 -0
- package/dist/chunk-E2TGXG6X.cjs.map +1 -0
- package/dist/chunk-EK362Q45.cjs +38 -0
- package/dist/chunk-EK362Q45.cjs.map +1 -0
- package/dist/chunk-FBV5DF6D.js +95 -0
- package/dist/chunk-FBV5DF6D.js.map +1 -0
- package/dist/chunk-FG4E7MTG.cjs +4 -0
- package/dist/chunk-FG4E7MTG.cjs.map +1 -0
- package/dist/chunk-G6IIVKMO.js +26 -0
- package/dist/chunk-G6IIVKMO.js.map +1 -0
- package/dist/chunk-HGC5JNVA.cjs +1503 -0
- package/dist/chunk-HGC5JNVA.cjs.map +1 -0
- package/dist/chunk-HSHCCBIV.js +255 -0
- package/dist/chunk-HSHCCBIV.js.map +1 -0
- package/dist/chunk-IEBZHTPE.js +254 -0
- package/dist/chunk-IEBZHTPE.js.map +1 -0
- package/dist/chunk-ISJDAFKS.js +1604 -0
- package/dist/chunk-ISJDAFKS.js.map +1 -0
- package/dist/chunk-J6KHW2E5.cjs +1963 -0
- package/dist/chunk-J6KHW2E5.cjs.map +1 -0
- package/dist/chunk-J7BMO73N.cjs +114 -0
- package/dist/chunk-J7BMO73N.cjs.map +1 -0
- package/dist/chunk-JL4C5VJ7.cjs +488 -0
- package/dist/chunk-JL4C5VJ7.cjs.map +1 -0
- package/dist/chunk-JSGIEF6Z.cjs +1087 -0
- package/dist/chunk-JSGIEF6Z.cjs.map +1 -0
- package/dist/chunk-JSNV5O2F.cjs +34 -0
- package/dist/chunk-JSNV5O2F.cjs.map +1 -0
- package/dist/chunk-JWA5SGCS.js +203 -0
- package/dist/chunk-JWA5SGCS.js.map +1 -0
- package/dist/chunk-JX5YZ4DH.cjs +430 -0
- package/dist/chunk-JX5YZ4DH.cjs.map +1 -0
- package/dist/chunk-KHCBJ7KD.js +42 -0
- package/dist/chunk-KHCBJ7KD.js.map +1 -0
- package/dist/chunk-KU6S7IYV.cjs +210 -0
- package/dist/chunk-KU6S7IYV.cjs.map +1 -0
- package/dist/chunk-LKAIXWK3.js +181 -0
- package/dist/chunk-LKAIXWK3.js.map +1 -0
- package/dist/chunk-LPW3XNC2.js +471 -0
- package/dist/chunk-LPW3XNC2.js.map +1 -0
- package/dist/chunk-M36G6SRP.js +447 -0
- package/dist/chunk-M36G6SRP.js.map +1 -0
- package/dist/chunk-MRXGWL42.cjs +4 -0
- package/dist/chunk-MRXGWL42.cjs.map +1 -0
- package/dist/chunk-NB72XWXQ.cjs +54 -0
- package/dist/chunk-NB72XWXQ.cjs.map +1 -0
- package/dist/chunk-NEJ2PV4C.cjs +211 -0
- package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
- package/dist/chunk-NT6IJH4L.cjs +273 -0
- package/dist/chunk-NT6IJH4L.cjs.map +1 -0
- package/dist/chunk-O5MP52U2.cjs +526 -0
- package/dist/chunk-O5MP52U2.cjs.map +1 -0
- package/dist/chunk-O7PUQLJ3.cjs +818 -0
- package/dist/chunk-O7PUQLJ3.cjs.map +1 -0
- package/dist/chunk-PQHS255G.js +1369 -0
- package/dist/chunk-PQHS255G.js.map +1 -0
- package/dist/chunk-PRYE7AZQ.cjs +1227 -0
- package/dist/chunk-PRYE7AZQ.cjs.map +1 -0
- package/dist/chunk-Q4CDQ2KO.js +21 -0
- package/dist/chunk-Q4CDQ2KO.js.map +1 -0
- package/dist/chunk-QELDJGDK.cjs +1714 -0
- package/dist/chunk-QELDJGDK.cjs.map +1 -0
- package/dist/chunk-QJRP44ZO.js +769 -0
- package/dist/chunk-QJRP44ZO.js.map +1 -0
- package/dist/chunk-QNGNOU4Z.js +29 -0
- package/dist/chunk-QNGNOU4Z.js.map +1 -0
- package/dist/chunk-RJL7RCEM.cjs +159 -0
- package/dist/chunk-RJL7RCEM.cjs.map +1 -0
- package/dist/chunk-RN3RMBJZ.js +1164 -0
- package/dist/chunk-RN3RMBJZ.js.map +1 -0
- package/dist/chunk-S5DMKUWK.cjs +1273 -0
- package/dist/chunk-S5DMKUWK.cjs.map +1 -0
- package/dist/chunk-SES6GDBQ.cjs +624 -0
- package/dist/chunk-SES6GDBQ.cjs.map +1 -0
- package/dist/chunk-TNPDV7I4.cjs +2346 -0
- package/dist/chunk-TNPDV7I4.cjs.map +1 -0
- package/dist/chunk-TZBIY5C3.js +187 -0
- package/dist/chunk-TZBIY5C3.js.map +1 -0
- package/dist/chunk-TZE673G6.js +3 -0
- package/dist/chunk-TZE673G6.js.map +1 -0
- package/dist/chunk-ULXI7A6Q.cjs +1047 -0
- package/dist/chunk-ULXI7A6Q.cjs.map +1 -0
- package/dist/chunk-VIWSWVAW.js +1782 -0
- package/dist/chunk-VIWSWVAW.js.map +1 -0
- package/dist/chunk-VWGNPMJZ.cjs +19 -0
- package/dist/chunk-VWGNPMJZ.cjs.map +1 -0
- package/dist/chunk-WDIBOWAA.js +1054 -0
- package/dist/chunk-WDIBOWAA.js.map +1 -0
- package/dist/chunk-WNG7HRVA.cjs +25 -0
- package/dist/chunk-WNG7HRVA.cjs.map +1 -0
- package/dist/chunk-WNVQ3SMB.cjs +96 -0
- package/dist/chunk-WNVQ3SMB.cjs.map +1 -0
- package/dist/chunk-WRSWH7US.cjs +285 -0
- package/dist/chunk-WRSWH7US.cjs.map +1 -0
- package/dist/chunk-XAMC4S53.js +17 -0
- package/dist/chunk-XAMC4S53.js.map +1 -0
- package/dist/chunk-XNISPHTZ.js +1039 -0
- package/dist/chunk-XNISPHTZ.js.map +1 -0
- package/dist/chunk-Y2PM3FFL.js +3 -0
- package/dist/chunk-Y2PM3FFL.js.map +1 -0
- package/dist/chunk-YBPBK5KI.js +1030 -0
- package/dist/chunk-YBPBK5KI.js.map +1 -0
- package/dist/chunk-YHRG7UOC.js +31 -0
- package/dist/chunk-YHRG7UOC.js.map +1 -0
- package/dist/chunk-YWNYGYI7.cjs +31 -0
- package/dist/chunk-YWNYGYI7.cjs.map +1 -0
- package/dist/chunk-YYV35XOS.js +122 -0
- package/dist/chunk-YYV35XOS.js.map +1 -0
- package/dist/chunk-Z2OL5AJD.cjs +133 -0
- package/dist/chunk-Z2OL5AJD.cjs.map +1 -0
- package/dist/chunk-Z4AZW6FY.js +920 -0
- package/dist/chunk-Z4AZW6FY.js.map +1 -0
- package/dist/chunk-ZDFHA2EC.js +572 -0
- package/dist/chunk-ZDFHA2EC.js.map +1 -0
- package/dist/chunk-ZNZDQAXN.js +175 -0
- package/dist/chunk-ZNZDQAXN.js.map +1 -0
- package/dist/chunk-ZRL2UFTH.cjs +1073 -0
- package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
- package/dist/chunk-ZT77RY6R.js +404 -0
- package/dist/chunk-ZT77RY6R.js.map +1 -0
- package/dist/entries/apps.cjs +155 -0
- package/dist/entries/apps.cjs.map +1 -0
- package/dist/entries/apps.d.cts +283 -0
- package/dist/entries/apps.d.ts +283 -0
- package/dist/entries/apps.js +10 -0
- package/dist/entries/apps.js.map +1 -0
- package/dist/entries/captions.cjs +124 -0
- package/dist/entries/captions.cjs.map +1 -0
- package/dist/entries/captions.d.cts +354 -0
- package/dist/entries/captions.d.ts +354 -0
- package/dist/entries/captions.js +3 -0
- package/dist/entries/captions.js.map +1 -0
- package/dist/entries/catalogs.cjs +165 -0
- package/dist/entries/catalogs.cjs.map +1 -0
- package/dist/entries/catalogs.d.cts +385 -0
- package/dist/entries/catalogs.d.ts +385 -0
- package/dist/entries/catalogs.js +4 -0
- package/dist/entries/catalogs.js.map +1 -0
- package/dist/entries/credits.cjs +592 -0
- package/dist/entries/credits.cjs.map +1 -0
- package/dist/entries/credits.d.cts +1429 -0
- package/dist/entries/credits.d.ts +1429 -0
- package/dist/entries/credits.js +11 -0
- package/dist/entries/credits.js.map +1 -0
- package/dist/entries/edl.cjs +409 -0
- package/dist/entries/edl.cjs.map +1 -0
- package/dist/entries/edl.d.cts +1199 -0
- package/dist/entries/edl.d.ts +1199 -0
- package/dist/entries/edl.js +4 -0
- package/dist/entries/edl.js.map +1 -0
- package/dist/entries/entities.cjs +530 -0
- package/dist/entries/entities.cjs.map +1 -0
- package/dist/entries/entities.d.cts +1371 -0
- package/dist/entries/entities.d.ts +1371 -0
- package/dist/entries/entities.js +5 -0
- package/dist/entries/entities.js.map +1 -0
- package/dist/entries/i18n.cjs +48 -0
- package/dist/entries/i18n.cjs.map +1 -0
- package/dist/entries/i18n.d.cts +69 -0
- package/dist/entries/i18n.d.ts +69 -0
- package/dist/entries/i18n.js +3 -0
- package/dist/entries/i18n.js.map +1 -0
- package/dist/entries/llm-models.cjs +177 -0
- package/dist/entries/llm-models.cjs.map +1 -0
- package/dist/entries/llm-models.d.cts +435 -0
- package/dist/entries/llm-models.d.ts +435 -0
- package/dist/entries/llm-models.js +4 -0
- package/dist/entries/llm-models.js.map +1 -0
- package/dist/entries/media.cjs +335 -0
- package/dist/entries/media.cjs.map +1 -0
- package/dist/entries/media.d.cts +518 -0
- package/dist/entries/media.d.ts +518 -0
- package/dist/entries/media.js +6 -0
- package/dist/entries/media.js.map +1 -0
- package/dist/entries/model-catalog.cjs +247 -0
- package/dist/entries/model-catalog.cjs.map +1 -0
- package/dist/entries/model-catalog.d.cts +202 -0
- package/dist/entries/model-catalog.d.ts +202 -0
- package/dist/entries/model-catalog.js +6 -0
- package/dist/entries/model-catalog.js.map +1 -0
- package/dist/entries/models.cjs +833 -0
- package/dist/entries/models.cjs.map +1 -0
- package/dist/entries/models.d.cts +287 -0
- package/dist/entries/models.d.ts +287 -0
- package/dist/entries/models.js +8 -0
- package/dist/entries/models.js.map +1 -0
- package/dist/entries/nodes.cjs +789 -0
- package/dist/entries/nodes.cjs.map +1 -0
- package/dist/entries/nodes.d.cts +1600 -0
- package/dist/entries/nodes.d.ts +1600 -0
- package/dist/entries/nodes.js +16 -0
- package/dist/entries/nodes.js.map +1 -0
- package/dist/entries/organizations.cjs +80 -0
- package/dist/entries/organizations.cjs.map +1 -0
- package/dist/entries/organizations.d.cts +466 -0
- package/dist/entries/organizations.d.ts +466 -0
- package/dist/entries/organizations.js +3 -0
- package/dist/entries/organizations.js.map +1 -0
- package/dist/entries/pipeline.cjs +594 -0
- package/dist/entries/pipeline.cjs.map +1 -0
- package/dist/entries/pipeline.d.cts +2617 -0
- package/dist/entries/pipeline.d.ts +2617 -0
- package/dist/entries/pipeline.js +5 -0
- package/dist/entries/pipeline.js.map +1 -0
- package/dist/entries/scene3d.cjs +704 -0
- package/dist/entries/scene3d.cjs.map +1 -0
- package/dist/entries/scene3d.d.cts +4284 -0
- package/dist/entries/scene3d.d.ts +4284 -0
- package/dist/entries/scene3d.js +3 -0
- package/dist/entries/scene3d.js.map +1 -0
- package/dist/entries/social.cjs +714 -0
- package/dist/entries/social.cjs.map +1 -0
- package/dist/entries/social.d.cts +1366 -0
- package/dist/entries/social.d.ts +1366 -0
- package/dist/entries/social.js +5 -0
- package/dist/entries/social.js.map +1 -0
- package/dist/entries/types.cjs +13 -0
- package/dist/entries/types.cjs.map +1 -0
- package/dist/entries/types.d.cts +162 -0
- package/dist/entries/types.d.ts +162 -0
- package/dist/entries/types.js +4 -0
- package/dist/entries/types.js.map +1 -0
- package/dist/entries/ugc.cjs +279 -0
- package/dist/entries/ugc.cjs.map +1 -0
- package/dist/entries/ugc.d.cts +575 -0
- package/dist/entries/ugc.d.ts +575 -0
- package/dist/entries/ugc.js +6 -0
- package/dist/entries/ugc.js.map +1 -0
- package/dist/entries/video.cjs +549 -0
- package/dist/entries/video.cjs.map +1 -0
- package/dist/entries/video.d.cts +1791 -0
- package/dist/entries/video.d.ts +1791 -0
- package/dist/entries/video.js +8 -0
- package/dist/entries/video.js.map +1 -0
- package/dist/entries/workflow.cjs +574 -0
- package/dist/entries/workflow.cjs.map +1 -0
- package/dist/entries/workflow.d.cts +1733 -0
- package/dist/entries/workflow.d.ts +1733 -0
- package/dist/entries/workflow.js +5 -0
- package/dist/entries/workflow.js.map +1 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.cts +19 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.ts +19 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.cts +174 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.ts +174 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.cts +208 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.ts +208 -0
- package/dist/index.cjs +7731 -26444
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -23733
- package/dist/index.d.ts +32 -23733
- package/dist/index.js +40 -24641
- package/dist/index.js.map +1 -1
- package/dist/model-catalog-flJYaa-g.d.cts +561 -0
- package/dist/model-catalog-flJYaa-g.d.ts +561 -0
- package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
- package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
- package/dist/presentation-utils-BIqiCzSA.d.cts +90 -0
- package/dist/presentation-utils-BdiObtwq.d.ts +90 -0
- package/dist/scene-node-types-DjenYFLO.d.cts +1949 -0
- package/dist/scene-node-types-DjenYFLO.d.ts +1949 -0
- package/dist/supported-fonts-CRoF1gOy.d.cts +16 -0
- package/dist/supported-fonts-CRoF1gOy.d.ts +16 -0
- package/dist/types-BRlFPEru.d.cts +511 -0
- package/dist/types-BRlFPEru.d.ts +511 -0
- package/dist/types-DffyGSy5.d.cts +67 -0
- package/dist/types-DffyGSy5.d.ts +67 -0
- package/package.json +102 -1
- package/src/__tests__/add-captions-plan.test.ts +6 -2
- package/src/__tests__/caption-edge-dash.test.ts +23 -0
- package/src/__tests__/entity-image-handle.test.ts +61 -1
- package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
- package/src/__tests__/input-field-extra-keys.test.ts +1 -0
- package/src/__tests__/json-kinds.test.ts +10 -0
- package/src/__tests__/model-seed-capability.test.ts +34 -0
- package/src/__tests__/no-internal-imports.test.ts +1 -1
- package/src/__tests__/node-aspect-ratio.test.ts +25 -0
- package/src/__tests__/node-preset-extract.test.ts +8 -0
- package/src/__tests__/node-run-routes.test.ts +63 -0
- package/src/__tests__/node-runtime-keys.test.ts +70 -0
- package/src/__tests__/package-entries.test.ts +50 -0
- package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
- package/src/__tests__/presentation-utils.test.ts +14 -0
- package/src/__tests__/preview-gate-use-case.test.ts +151 -0
- package/src/__tests__/producer-types.test.ts +15 -0
- package/src/__tests__/run-continuation.test.ts +7 -1
- package/src/__tests__/seedance-draft.test.ts +74 -0
- package/src/__tests__/site-capture-node.test.ts +58 -0
- package/src/__tests__/ugc-clip-saved-list.test.ts +19 -0
- package/src/__tests__/ugc-lane-wires.test.ts +228 -0
- package/src/__tests__/ugc-node-wires.test.ts +606 -0
- package/src/__tests__/ugc-run-state.test.ts +85 -7
- package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
- package/src/__tests__/video-analysis-pricing.test.ts +6 -6
- package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
- package/src/__tests__/workflow-export-strip.test.ts +14 -0
- package/src/add-captions-plan.ts +9 -3
- package/src/caption-edge-dash.ts +33 -0
- package/src/credit-estimators/index.ts +22 -1
- package/src/credit-estimators/pitch-tempo.ts +15 -1
- package/src/credit-estimators/speech.ts +72 -4
- package/src/credit-estimators/unit-quote.ts +52 -0
- package/src/credit-estimators/video-sfx.ts +15 -0
- package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
- package/src/entity-image-handle.ts +50 -1
- package/src/entries/apps.ts +63 -0
- package/src/entries/captions.ts +34 -0
- package/src/entries/catalogs.ts +65 -0
- package/src/entries/credits.ts +104 -0
- package/src/entries/edl.ts +42 -0
- package/src/entries/entities.ts +144 -0
- package/src/entries/i18n.ts +31 -0
- package/src/entries/llm-models.ts +63 -0
- package/src/entries/media.ts +36 -0
- package/src/entries/model-catalog.ts +89 -0
- package/src/entries/models.ts +266 -0
- package/src/entries/nodes.ts +245 -0
- package/src/entries/organizations.ts +9 -0
- package/src/entries/pipeline.ts +43 -0
- package/src/entries/scene3d.ts +27 -0
- package/src/entries/social.ts +297 -0
- package/src/entries/types.ts +26 -0
- package/src/entries/ugc.ts +14 -0
- package/src/entries/video.ts +59 -0
- package/src/entries/workflow.ts +172 -0
- package/src/fan-out-rows.ts +2 -0
- package/src/index.ts +25 -1838
- package/src/json-kinds.ts +13 -0
- package/src/model-catalog.ts +97 -36
- package/src/model-constants.ts +3 -0
- package/src/node-mappable-fields.ts +1 -0
- package/src/node-preset-export.ts +2 -2
- package/src/node-preset-extract.ts +6 -4
- package/src/node-run-routes.ts +78 -0
- package/src/node-runtime-keys.ts +50 -1
- package/src/normalize-node-params.ts +30 -0
- package/src/presentation-utils.ts +8 -0
- package/src/preview-gate.ts +92 -14
- package/src/producer-types.ts +26 -2
- package/src/run-continuation.ts +21 -0
- package/src/seedance-draft.ts +64 -0
- package/src/site-capture-node.ts +82 -0
- package/src/social-post.ts +13 -0
- package/src/ugc-lane-wires.ts +246 -0
- package/src/ugc-node-wires.ts +653 -0
- package/src/ugc-run-state.ts +65 -8
- package/src/video-analysis-pricing.ts +31 -29
- package/src/workflow-export.ts +3 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest"
|
|
2
2
|
import { LEGACY_EXPOSED_FIELD_KEYS } from "../exposed-field-keys.js"
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
UGC_CREATOR_CANDIDATES_KEY, UGC_NODE_RUN_STATE_KEYS, UGC_NODE_TYPES, UGC_OVERRIDABLE_FIELDS, UGC_PICK_FIRST_MESSAGE, findUgcLockedFields, stripUgcRunState, ugcPickPending,
|
|
5
|
+
ugcRunWaitsForPick,
|
|
6
|
+
} from "../ugc-run-state.js"
|
|
4
7
|
|
|
5
8
|
describe("UGC run state", () => {
|
|
6
|
-
it("covers exactly the
|
|
7
|
-
const five = ["ugc-cards", "ugc-clip", "ugc-clips", "ugc-creator", "ugc-script"]
|
|
9
|
+
it("covers exactly the six UGC types", () => {
|
|
10
|
+
const five = ["ugc-cards", "ugc-clip", "ugc-clips", "ugc-creator", "ugc-finish-clips", "ugc-script"]
|
|
8
11
|
expect([...UGC_NODE_TYPES].sort()).toEqual(five)
|
|
9
12
|
expect(Object.keys(UGC_NODE_RUN_STATE_KEYS).sort()).toEqual(five)
|
|
10
13
|
expect(Object.keys(UGC_OVERRIDABLE_FIELDS).sort()).toEqual(five)
|
|
@@ -22,10 +25,10 @@ describe("UGC run state", () => {
|
|
|
22
25
|
|
|
23
26
|
it("strips every run-state key and turns keepResult off, leaving choices and other nodes alone", () => {
|
|
24
27
|
const nodes = [
|
|
25
|
-
{ id: "c", type: "ugc-creator", data: { source: "photo", gender: "man", keepResult: true, result: { v: 1 } } },
|
|
28
|
+
{ id: "c", type: "ugc-creator", data: { source: "photo", gender: "man", photoUrl: "https://cdn.example/me.png", keepResult: true, result: { v: 1 } } },
|
|
26
29
|
{ id: "s", type: "ugc-script", data: { targetDurationSec: 20, keepResult: true, result: { v: 1 } } },
|
|
27
30
|
{ id: "l", type: "ugc-clips", data: { voiceId: "v", quote: { lines: [] }, result: {}, __listResults: ["{}"], ugcOutputs: { "plan-out": "{}" } } },
|
|
28
|
-
{ id: "k", type: "ugc-clip", data: { rerender: { "2": 1 }, warnings: ["x"], __listResults: ["u"], __listResultMeta: [], clipWarnings: [], durationSec: 9 } },
|
|
31
|
+
{ id: "k", type: "ugc-clip", data: { rerender: { "2": 1 }, rerenderPending: { "2": true }, warnings: ["x"], __listResults: ["u"], __listResultMeta: [], clipWarnings: [], durationSec: 9 } },
|
|
29
32
|
{ id: "d", type: "ugc-cards", data: { result: { report: "No issues." } } },
|
|
30
33
|
{ id: "t", type: "text-prompt", data: { text: "keep", result: "keep" } },
|
|
31
34
|
]
|
|
@@ -42,6 +45,37 @@ describe("UGC run state", () => {
|
|
|
42
45
|
expect(out[5]).toBe(nodes[5]) // other nodes are returned as they are
|
|
43
46
|
})
|
|
44
47
|
|
|
48
|
+
it("never ships the author's own photo: a UGC Creator's photo goes, its source stays — a My photo run's image (that photo) too", () => {
|
|
49
|
+
const photo = "https://cdn.example/me.png"
|
|
50
|
+
// What a My photo run writes onto the creator: its image IS the photo (the creator wire names it).
|
|
51
|
+
const [creator] = stripUgcRunState([
|
|
52
|
+
{
|
|
53
|
+
id: "c",
|
|
54
|
+
type: "ugc-creator",
|
|
55
|
+
data: {
|
|
56
|
+
source: "photo",
|
|
57
|
+
gender: "woman",
|
|
58
|
+
photoUrl: photo,
|
|
59
|
+
generatedImageUrl: photo,
|
|
60
|
+
ugcOutputs: { creator: '{"v":1}', image: photo },
|
|
61
|
+
result: { v: 1, identityImages: [photo] },
|
|
62
|
+
executionStatus: "completed",
|
|
63
|
+
resultsRunId: "exec-1",
|
|
64
|
+
resultsRunEndedAt: "2026-10-09T09:00:40.000Z",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
])
|
|
68
|
+
expect(JSON.stringify(creator)).not.toContain(photo)
|
|
69
|
+
expect(creator!.data).not.toHaveProperty("generatedImageUrl")
|
|
70
|
+
expect(creator!.data).toMatchObject({ source: "photo", gender: "woman", keepResult: false })
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it("no published creator carries the author's last image, whatever its source", () => {
|
|
74
|
+
expect(UGC_NODE_RUN_STATE_KEYS["ugc-creator"]).toContain("generatedImageUrl")
|
|
75
|
+
const [creator] = stripUgcRunState([{ id: "c", type: "ugc-creator", data: { source: "sampled", gender: "man", generatedImageUrl: "https://cdn.example/drawn.png" } }])
|
|
76
|
+
expect(creator!.data).toEqual({ source: "sampled", gender: "man", keepResult: false })
|
|
77
|
+
})
|
|
78
|
+
|
|
45
79
|
it("leaves a UGC node with no data object alone", () => {
|
|
46
80
|
const node = { id: "x", type: "ugc-clip" }
|
|
47
81
|
expect(stripUgcRunState([node])).toEqual([node])
|
|
@@ -56,8 +90,9 @@ describe("UGC run state", () => {
|
|
|
56
90
|
{ nodeId: "script", nodeType: "ugc-script", field: "keepResult" },
|
|
57
91
|
{ nodeId: "clip", nodeType: "ugc-clip", field: "rerender" },
|
|
58
92
|
])
|
|
59
|
-
//
|
|
60
|
-
expect(findUgcLockedFields(nodes, { script: { language: "he" } })).toEqual([
|
|
93
|
+
// The script's language is a choice a run may set; a future field is refused without anyone listing it.
|
|
94
|
+
expect(findUgcLockedFields(nodes, { script: { language: "he" } })).toEqual([])
|
|
95
|
+
expect(findUgcLockedFields(nodes, { script: { voice: "x" } })).toEqual([{ nodeId: "script", nodeType: "ugc-script", field: "voice" }])
|
|
61
96
|
})
|
|
62
97
|
|
|
63
98
|
it("ignores non-UGC nodes and missing inputs", () => {
|
|
@@ -65,4 +100,47 @@ describe("UGC run state", () => {
|
|
|
65
100
|
expect(findUgcLockedFields(null, { t: { text: "x" } })).toEqual([])
|
|
66
101
|
expect(findUgcLockedFields([{ id: "c", type: "ugc-creator" }], undefined)).toEqual([])
|
|
67
102
|
})
|
|
103
|
+
|
|
104
|
+
it("a creator's candidates are run state: stripped at publish and locked against a run's overrides", () => {
|
|
105
|
+
const nodes = [{ id: "c", type: "ugc-creator", data: { source: "sampled", gender: "woman", keepResult: false, candidates: [{ imageUrl: "https://cdn.example/a.png", record: { v: 1 } }] } }]
|
|
106
|
+
expect(UGC_NODE_RUN_STATE_KEYS["ugc-creator"]).toContain(UGC_CREATOR_CANDIDATES_KEY)
|
|
107
|
+
expect(stripUgcRunState(nodes)[0]!.data).toEqual({ source: "sampled", gender: "woman", keepResult: false })
|
|
108
|
+
expect(findUgcLockedFields(nodes, { c: { candidates: [] } })).toEqual([{ nodeId: "c", nodeType: "ugc-creator", field: "candidates" }])
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
describe("Pick a creator first", () => {
|
|
113
|
+
const option = { imageUrl: "https://cdn.example/a.png", record: { v: 1 } }
|
|
114
|
+
const creator = (candidates?: unknown) => ({ id: "c", type: "ugc-creator", data: { source: "sampled", ...(candidates ? { candidates } : {}) } })
|
|
115
|
+
it("options waiting: one or more stored on the node", () => {
|
|
116
|
+
expect(ugcPickPending(creator([option, option]).data)).toBe(true)
|
|
117
|
+
expect(ugcPickPending(creator([option]).data)).toBe(true)
|
|
118
|
+
expect(ugcPickPending(creator([]).data)).toBe(false)
|
|
119
|
+
expect(ugcPickPending(creator().data)).toBe(false)
|
|
120
|
+
})
|
|
121
|
+
it("a run that executes a creator with options waiting is refused; its own re-draw is not; other nodes never are", () => {
|
|
122
|
+
expect(ugcRunWaitsForPick([creator([option, option])])).toBe(true)
|
|
123
|
+
expect(ugcRunWaitsForPick([creator([option, option])], { redrawId: "c" })).toBe(false)
|
|
124
|
+
expect(ugcRunWaitsForPick([creator()])).toBe(false)
|
|
125
|
+
expect(ugcRunWaitsForPick([{ id: "x", type: "ugc-clips", data: { candidates: [option] } }])).toBe(false)
|
|
126
|
+
expect(UGC_PICK_FIRST_MESSAGE).toBe("Pick a creator first.")
|
|
127
|
+
})
|
|
128
|
+
it("the note of the last draw is run state", () => {
|
|
129
|
+
expect(UGC_NODE_RUN_STATE_KEYS["ugc-creator"]).toContain("optionFailed")
|
|
130
|
+
})
|
|
131
|
+
it("reads options only from a data object, and only a list counts", () => {
|
|
132
|
+
for (const data of [undefined, null, "candidates", [option], { candidates: { 0: option } }, { candidates: "x" }]) {
|
|
133
|
+
expect(ugcPickPending(data), JSON.stringify(data)).toBe(false)
|
|
134
|
+
}
|
|
135
|
+
expect(ugcRunWaitsForPick([])).toBe(false)
|
|
136
|
+
expect(ugcRunWaitsForPick([{ id: "c", type: null, data: { candidates: [option] } }, { id: "d" }])).toBe(false)
|
|
137
|
+
})
|
|
138
|
+
it("a second creator waiting is refused even while the first is re-drawn", () => {
|
|
139
|
+
const other = { ...creator([option]), id: "c2" }
|
|
140
|
+
expect(ugcRunWaitsForPick([creator([option, option]), other], { redrawId: "c" })).toBe(true)
|
|
141
|
+
})
|
|
142
|
+
it("the note of the last draw is stripped at publish", () => {
|
|
143
|
+
const nodes = [{ id: "c", type: "ugc-creator", data: { source: "sampled", gender: "woman", keepResult: false, optionFailed: true } }]
|
|
144
|
+
expect(stripUgcRunState(nodes)[0]!.data).toEqual({ source: "sampled", gender: "woman", keepResult: false })
|
|
145
|
+
})
|
|
68
146
|
})
|
|
@@ -164,7 +164,7 @@ describe("bare video-analysis node-type credit id", () => {
|
|
|
164
164
|
// that prompt again, moving the pin 8_482 -> 8_706, and 357 wrote 2076:
|
|
165
165
|
// the transition vocabulary v2 doctrine (twelve named values; absent =
|
|
166
166
|
// nothing asserted) grew it once more, moving the pin 8_706 -> 9_082.
|
|
167
|
-
expect(ceiling).toBe(
|
|
167
|
+
expect(ceiling).toBe(2076)
|
|
168
168
|
})
|
|
169
169
|
|
|
170
170
|
it("the bare id still bounds the default tier at the ceiling bucket", () => {
|
|
@@ -194,10 +194,10 @@ describe("video-audit-pricing", () => {
|
|
|
194
194
|
it("videoAuditCreditsForBucket: table lookup by resolved bucket + family, snapping a raw duration onto the ladder", () => {
|
|
195
195
|
expect(videoAuditCreditsForBucket(60, false)).toBe(215)
|
|
196
196
|
expect(videoAuditCreditsForBucket(60, true)).toBe(396)
|
|
197
|
-
expect(videoAuditCreditsForBucket(180, false)).toBe(
|
|
198
|
-
expect(videoAuditCreditsForBucket(360, false)).toBe(
|
|
199
|
-
expect(videoAuditCreditsForBucket(600, false)).toBe(
|
|
200
|
-
expect(videoAuditCreditsForBucket(600, true)).toBe(
|
|
197
|
+
expect(videoAuditCreditsForBucket(180, false)).toBe(290)
|
|
198
|
+
expect(videoAuditCreditsForBucket(360, false)).toBe(663)
|
|
199
|
+
expect(videoAuditCreditsForBucket(600, false)).toBe(1073)
|
|
200
|
+
expect(videoAuditCreditsForBucket(600, true)).toBe(1921)
|
|
201
201
|
// Not just exact ladder values — a raw duration snaps up to its bucket.
|
|
202
202
|
expect(videoAuditCreditsForBucket(70, false)).toBe(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:180s"])
|
|
203
203
|
expect(videoAuditCreditsForBucket(9999, true)).toBe(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:auto:600s"])
|
|
@@ -238,8 +238,8 @@ describe("video-audit-pricing", () => {
|
|
|
238
238
|
// 600s bucket here, same convention as VIDEO_ANALYSIS_BUCKET_CREDITS).
|
|
239
239
|
expect(Object.keys(VIDEO_AUDIT_BUCKET_CREDITS)).toHaveLength(8)
|
|
240
240
|
// Bare-id values quoted in the task/catalog must equal each family's 600s ceiling.
|
|
241
|
-
expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:600s"]).toBe(
|
|
242
|
-
expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:auto:600s"]).toBe(
|
|
241
|
+
expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:600s"]).toBe(1073)
|
|
242
|
+
expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:auto:600s"]).toBe(1921)
|
|
243
243
|
})
|
|
244
244
|
|
|
245
245
|
it("auto family = base family + the gemini-3-flash (legacy fast tier) row at the same bucket, exactly — single-source, never hand-added", () => {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import { parseVoiceChangerProQuoteCreditId, voiceChangerProQuoteCreditId } from "../credit-estimators/voice-changer-pro-quote.js"
|
|
3
|
+
|
|
4
|
+
describe("the whole-convert quote id", () => {
|
|
5
|
+
it("writes one slot per changed speaker, a missing measure as the bare kind", () => {
|
|
6
|
+
expect(
|
|
7
|
+
voiceChangerProQuoteCreditId([
|
|
8
|
+
{ kind: "sts", seconds: 26.76 },
|
|
9
|
+
{ kind: "respeak", chars: 1200 },
|
|
10
|
+
{ kind: "sts", seconds: null },
|
|
11
|
+
{ kind: "respeak", chars: 0 },
|
|
12
|
+
]),
|
|
13
|
+
).toBe("voice-changer-pro:sts-26.76,respeak-1200,sts,respeak")
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it("reads back exactly what it wrote, per kind and in order", () => {
|
|
17
|
+
const id = voiceChangerProQuoteCreditId([
|
|
18
|
+
{ kind: "respeak", chars: 87 },
|
|
19
|
+
{ kind: "sts", seconds: 2 + 1 / 3 },
|
|
20
|
+
{ kind: "sts", seconds: null },
|
|
21
|
+
{ kind: "respeak", chars: null },
|
|
22
|
+
])
|
|
23
|
+
expect(parseVoiceChangerProQuoteCreditId(id)).toEqual({
|
|
24
|
+
stsSlotSeconds: [2 + 1 / 3, null],
|
|
25
|
+
respeakChars: [87, null],
|
|
26
|
+
respeakEngines: [null, null],
|
|
27
|
+
respeakTranslated: [false, false],
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it("names a v4 slot's engine, and a translated v4 slot as such; v3 keeps the id it always had", () => {
|
|
32
|
+
expect(
|
|
33
|
+
voiceChangerProQuoteCreditId([
|
|
34
|
+
{ kind: "respeak", chars: 1200, engine: "v4" },
|
|
35
|
+
{ kind: "respeak", chars: 1200, engine: "v4", translated: true },
|
|
36
|
+
{ kind: "respeak", chars: 1200, engine: "v3" },
|
|
37
|
+
{ kind: "respeak", chars: null, engine: "v4", translated: true },
|
|
38
|
+
{ kind: "respeak", chars: null, engine: "v4" },
|
|
39
|
+
]),
|
|
40
|
+
).toBe("voice-changer-pro:respeak-v4-1200,respeak-v4t-1200,respeak-1200,respeak-v4t,respeak-v4")
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it("never writes a translated v3 slot: only v4 speaks a translation, as the convert route reads it", () => {
|
|
44
|
+
expect(voiceChangerProQuoteCreditId([{ kind: "respeak", chars: 500, engine: "v3", translated: true }])).toBe(
|
|
45
|
+
"voice-changer-pro:respeak-500",
|
|
46
|
+
)
|
|
47
|
+
expect(voiceChangerProQuoteCreditId([{ kind: "respeak", chars: 500, translated: true }])).toBe("voice-changer-pro:respeak-500")
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it("reads each Re-speak slot's engine and translation back, index-aligned with its characters", () => {
|
|
51
|
+
expect(parseVoiceChangerProQuoteCreditId("voice-changer-pro:respeak-v4t-900,sts-12,respeak-v3-40,respeak,respeak-v4")).toEqual({
|
|
52
|
+
stsSlotSeconds: [12],
|
|
53
|
+
respeakChars: [900, 40, null, null],
|
|
54
|
+
respeakEngines: ["v4", "v3", null, "v4"],
|
|
55
|
+
respeakTranslated: [true, false, false, false],
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it.each([
|
|
60
|
+
"voice-changer-pro",
|
|
61
|
+
"voice-changer-pro:",
|
|
62
|
+
"voice-changer-pro-respeak:sts-10",
|
|
63
|
+
"voice-changer-pro:sts-0",
|
|
64
|
+
"voice-changer-pro:sts--3",
|
|
65
|
+
"voice-changer-pro:sts-1e3",
|
|
66
|
+
"voice-changer-pro:sts-10,",
|
|
67
|
+
"voice-changer-pro:lipsync-3",
|
|
68
|
+
"voice-changer-pro:3u",
|
|
69
|
+
"voice-changer-pro:respeak-v3t-100",
|
|
70
|
+
"voice-changer-pro:respeak-v5-100",
|
|
71
|
+
"voice-changer-pro:respeak-v4-",
|
|
72
|
+
"voice-changer-pro:respeak-v4-0",
|
|
73
|
+
"voice-changer-pro:respeak:v4-100",
|
|
74
|
+
"voice-changer-pro:sts-v4-10",
|
|
75
|
+
"voice-changer-pro:respeak-100-v4",
|
|
76
|
+
])("is not %s", (id) => {
|
|
77
|
+
expect(parseVoiceChangerProQuoteCreditId(id)).toBeUndefined()
|
|
78
|
+
})
|
|
79
|
+
})
|
|
@@ -139,3 +139,17 @@ describe("stripExportContent — template export hygiene", () => {
|
|
|
139
139
|
expect((outSub.data as Record<string, unknown>).referencedWorkflowId).toBeUndefined()
|
|
140
140
|
})
|
|
141
141
|
})
|
|
142
|
+
|
|
143
|
+
describe("stripExportContent — a type's own run results under generic names", () => {
|
|
144
|
+
it("strips UGC Clips' quote and UGC Clip's length from those types, and never another node's setting of the same name", () => {
|
|
145
|
+
const nodes: GenericNode[] = [
|
|
146
|
+
{ id: "c", type: "ugc-clips", data: { label: "Clips", quote: { expected: 1 }, voiceId: "v" } },
|
|
147
|
+
{ id: "k", type: "ugc-clip", data: { label: "Clip", durationSec: 7, clipWarnings: ["w"], rerenderPending: { 1: true }, rerender: { 1: 1 } } },
|
|
148
|
+
{ id: "x", type: "some-future-node", data: { label: "Other", quote: "a quote to show", durationSec: 12 } },
|
|
149
|
+
]
|
|
150
|
+
const [clips, clip, other] = stripExportContent(nodes)
|
|
151
|
+
expect(clips.data).toEqual({ label: "Clips", voiceId: "v" })
|
|
152
|
+
expect(clip.data).toEqual({ label: "Clip", rerender: { 1: 1 } })
|
|
153
|
+
expect(other.data).toEqual({ label: "Other", quote: "a quote to show", durationSec: 12 })
|
|
154
|
+
})
|
|
155
|
+
})
|
package/src/add-captions-plan.ts
CHANGED
|
@@ -39,10 +39,16 @@ export function styleCaptionPlan(
|
|
|
39
39
|
const parsed = parseCaptionPlan(raw)
|
|
40
40
|
if ("error" in parsed) return { error: parsed.error }
|
|
41
41
|
const bodyLevers = captionPlanBodyLevers(nodeData, styler.leverKeys)
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const styled = styler.segmentsFor(parsed.plan, bodyLevers ? { bodyLevers } : undefined).segments
|
|
43
|
+
// The PARSED segments go on, never the helper's raw ones: the route's schema
|
|
44
|
+
// fills each word entry's defaults (`timestampMs` / `confidence` → null), and a
|
|
45
|
+
// DAG payload never passes the route, so returning the raw list sent a server
|
|
46
|
+
// run word entries the add-captions route itself would have completed.
|
|
47
|
+
const segments: Record<string, unknown>[] = []
|
|
48
|
+
for (let i = 0; i < styled.length; i++) {
|
|
49
|
+
const r = captionSegmentInputSchema.safeParse(styled[i])
|
|
45
50
|
if (!r.success) return { error: `Caption plan: segment ${i + 1}: ${r.error.issues[0]?.message ?? "invalid"}.` }
|
|
51
|
+
segments.push(r.data)
|
|
46
52
|
}
|
|
47
53
|
const overlap = findSegmentOverlap(segments as { startMs: number; endMs: number }[])
|
|
48
54
|
if (overlap) return { error: `Caption plan: ${overlap}.` }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A caption line never starts or ends on a lone dash.
|
|
3
|
+
*
|
|
4
|
+
* A speech engine times a dash written between two spaces ("Nodaro — every model")
|
|
5
|
+
* as a token of its own, and forced alignment keeps it. Inside a line the dash
|
|
6
|
+
* reads as written; at a line's edge — the line breaks right after it, or the
|
|
7
|
+
* next line opens with it — it reads as a stray mark. The display drops such a
|
|
8
|
+
* token from the edge of the line it lands on; the words keep their own timings.
|
|
9
|
+
*
|
|
10
|
+
* One rule for every place that breaks captions into lines: the render's line
|
|
11
|
+
* grouping (word-timed captions) and the wrap of a static text block.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Dash characters only: hyphen-minus, the Unicode hyphens and dashes (U+2010–U+2015), minus, the Hebrew maqaf, and their small/full-width forms. */
|
|
15
|
+
const BARE_DASH = /^[-‐-―−־﹘﹣-]+$/u
|
|
16
|
+
|
|
17
|
+
/** True when the token, trimmed, is nothing but dash characters ("—", "–", "-"). A hyphenated word ("ה-AI", "re-run") is not. */
|
|
18
|
+
export function isBareDashToken(text: string): boolean {
|
|
19
|
+
return BARE_DASH.test(text.trim())
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The items with every lone-dash token at either end removed (a copy; the input
|
|
24
|
+
* is never mutated). A line holding nothing but dashes comes back empty — the
|
|
25
|
+
* caller drops it rather than show it.
|
|
26
|
+
*/
|
|
27
|
+
export function trimEdgeDashTokens<T>(items: readonly T[], textOf: (item: T) => string): T[] {
|
|
28
|
+
let start = 0
|
|
29
|
+
let end = items.length
|
|
30
|
+
while (start < end && isBareDashToken(textOf(items[start]!))) start++
|
|
31
|
+
while (end > start && isBareDashToken(textOf(items[end - 1]!))) end--
|
|
32
|
+
return items.slice(start, end)
|
|
33
|
+
}
|
|
@@ -14,7 +14,7 @@ export {
|
|
|
14
14
|
imageOverlayCredits,
|
|
15
15
|
} from "./image-overlay.js"
|
|
16
16
|
|
|
17
|
-
export { VIDEO_SFX_PRICING, videoSfxCreditId } from "./video-sfx.js"
|
|
17
|
+
export { VIDEO_SFX_PRICING, videoSfxCreditId, videoSfxQuoteCreditId } from "./video-sfx.js"
|
|
18
18
|
|
|
19
19
|
export {
|
|
20
20
|
TEXT_TO_AUDIO_PRICING,
|
|
@@ -49,13 +49,34 @@ export {
|
|
|
49
49
|
speechUnitCreditId,
|
|
50
50
|
speechPriceUnits,
|
|
51
51
|
speechCredits,
|
|
52
|
+
speechQuoteCreditId,
|
|
53
|
+
parseSpeechQuoteCreditId,
|
|
54
|
+
isSpeechLengthPriceId,
|
|
55
|
+
speechLengthPriceModel,
|
|
56
|
+
type SpeechQuoteCreditIdParts,
|
|
52
57
|
} from "./speech.js"
|
|
53
58
|
|
|
59
|
+
export {
|
|
60
|
+
unitQuoteCreditId,
|
|
61
|
+
parseUnitQuoteCreditId,
|
|
62
|
+
type UnitQuoteCreditIdParts,
|
|
63
|
+
} from "./unit-quote.js"
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
VOICE_CHANGER_PRO_QUOTE_RATE_ID,
|
|
67
|
+
voiceChangerProQuoteCreditId,
|
|
68
|
+
parseVoiceChangerProQuoteCreditId,
|
|
69
|
+
type VoiceChangerProQuoteSlot,
|
|
70
|
+
type VoiceChangerProQuoteCreditIdParts,
|
|
71
|
+
type VoiceChangerProQuoteRespeakEngine,
|
|
72
|
+
} from "./voice-changer-pro-quote.js"
|
|
73
|
+
|
|
54
74
|
export {
|
|
55
75
|
PITCH_TEMPO_PRICING,
|
|
56
76
|
PITCH_TEMPO_LIMITS,
|
|
57
77
|
pitchTempoStartedMinutes,
|
|
58
78
|
pitchTempoCreditId,
|
|
79
|
+
pitchTempoQuoteCreditId,
|
|
59
80
|
parsePitchTempoCreditId,
|
|
60
81
|
pitchTempoBaseCredits,
|
|
61
82
|
semitonesToPitchRatio,
|
|
@@ -36,7 +36,8 @@ export const PITCH_TEMPO_LIMITS = {
|
|
|
36
36
|
/**
|
|
37
37
|
* Started minutes of an input of `durationSec` seconds: ceil(sec / 60), at
|
|
38
38
|
* least 1, at most 30. An unknown or non-positive length counts as one minute
|
|
39
|
-
*
|
|
39
|
+
* here; a quote of an unknown length names 30 instead
|
|
40
|
+
* ({@link pitchTempoQuoteCreditId}), and a run always measures.
|
|
40
41
|
*/
|
|
41
42
|
export function pitchTempoStartedMinutes(durationSec: number | null | undefined): number {
|
|
42
43
|
if (typeof durationSec !== "number" || !Number.isFinite(durationSec) || durationSec <= 0) return 1
|
|
@@ -48,6 +49,19 @@ export function pitchTempoCreditId(durationSec: number | null | undefined): stri
|
|
|
48
49
|
return `pitch-tempo:${pitchTempoStartedMinutes(durationSec)}m`
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
/**
|
|
53
|
+
* The id a QUOTE names for an input of `durationSec` seconds — every estimate
|
|
54
|
+
* before a run. A known length is the id its run reserves
|
|
55
|
+
* ({@link pitchTempoCreditId}). An UNKNOWN length is the 30-minute id
|
|
56
|
+
* (decided 2026-10-13): a run measures the file before it reserves and refuses
|
|
57
|
+
* one it cannot measure or one over 30 minutes, so 30 minutes is the most any
|
|
58
|
+
* run can be charged and the quote is never below the charge.
|
|
59
|
+
*/
|
|
60
|
+
export function pitchTempoQuoteCreditId(durationSec: number | null | undefined): string {
|
|
61
|
+
const known = typeof durationSec === "number" && Number.isFinite(durationSec) && durationSec > 0
|
|
62
|
+
return pitchTempoCreditId(known ? durationSec : PITCH_TEMPO_PRICING.MAX_DURATION_SEC)
|
|
63
|
+
}
|
|
64
|
+
|
|
51
65
|
/** The minutes of a `pitch-tempo:<N>m` id (1 ≤ N ≤ 30), or `undefined` for any other id. */
|
|
52
66
|
export function parsePitchTempoCreditId(id: string): { minutes: number } | undefined {
|
|
53
67
|
const m = /^pitch-tempo:(\d+)m$/.exec(id)
|
|
@@ -5,9 +5,14 @@
|
|
|
5
5
|
* add-on) is priced per STARTED 100 characters of the text actually sent,
|
|
6
6
|
* with a minimum number of units per request. The amount of one unit is a
|
|
7
7
|
* `model_pricing` row per model — `<model id>:per-100-chars`, admin-editable
|
|
8
|
-
* — and never lives here.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* — and never lives here. `speechCredits(chars, row)` is the list price of a
|
|
9
|
+
* request at a catalog row. An instance prices the WHOLE request and rounds it
|
|
10
|
+
* once, so the price it serves for one unit times the units is only an upper
|
|
11
|
+
* bound of what the request costs there. The exact charge of a
|
|
12
|
+
* request of N units is served under its own id, `speechQuoteCreditId(model,
|
|
13
|
+
* N)` (`<model>:per-100-chars:<N>u`), by the same price lookups that serve the
|
|
14
|
+
* unit row (credits.model-costs, GET /v1/credits/model-cost): a client quotes
|
|
15
|
+
* that answer rather than multiplying.
|
|
11
16
|
*
|
|
12
17
|
* Why 100 and not 1,000: the per-request error is at most one unit, and a
|
|
13
18
|
* whole number of units times a charged unit price never under-quotes the
|
|
@@ -15,7 +20,9 @@
|
|
|
15
20
|
*
|
|
16
21
|
* Decided 2026-10-06. Every name here is a published contract.
|
|
17
22
|
*/
|
|
18
|
-
import { canonicalTtsProvider } from "../tts-capabilities.js"
|
|
23
|
+
import { canonicalTtsProvider, findTtsCapabilities } from "../tts-capabilities.js"
|
|
24
|
+
import { findDialogueCapabilities } from "../dialogue-capabilities.js"
|
|
25
|
+
import { unitQuoteCreditId } from "./unit-quote.js"
|
|
19
26
|
|
|
20
27
|
/** Characters per price unit. */
|
|
21
28
|
export const SPEECH_PRICE_UNIT_CHARS = 100
|
|
@@ -49,3 +56,64 @@ export function speechPriceUnits(chars: number): number {
|
|
|
49
56
|
export function speechCredits(chars: number, perUnitCredits: number): number {
|
|
50
57
|
return speechPriceUnits(chars) * perUnitCredits
|
|
51
58
|
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The id of the exact charge of a whole request of `units` units on `modelId`:
|
|
62
|
+
* `<model>:per-100-chars:<N>u`. Never a row of its own — a price lookup prices
|
|
63
|
+
* it from the model's unit row × N as one whole, exactly as a request of that
|
|
64
|
+
* length is reserved. Served only while length pricing is on, like the unit
|
|
65
|
+
* row it is priced from.
|
|
66
|
+
*/
|
|
67
|
+
export function speechQuoteCreditId(modelId: string, units: number): string {
|
|
68
|
+
return unitQuoteCreditId(speechUnitCreditId(modelId), units)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** A `<model>:per-100-chars:<N>u` id, read back. */
|
|
72
|
+
export interface SpeechQuoteCreditIdParts {
|
|
73
|
+
/** The speech model (canonical id) the request runs as. */
|
|
74
|
+
model: string
|
|
75
|
+
/** Its `<model>:per-100-chars` unit row. */
|
|
76
|
+
unitId: string
|
|
77
|
+
/** Units priced: at least the floor, at most the model's per-request cap in started hundreds. */
|
|
78
|
+
units: number
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const SPEECH_QUOTE_ID = /^(.+):per-100-chars:(\d{1,6})u$/
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The parts of a `<model>:per-100-chars:<N>u` id, or undefined for any other id
|
|
85
|
+
* — including a model that is not a speech model under its canonical id, and a
|
|
86
|
+
* unit count no request on that model can be priced at (below the floor, or
|
|
87
|
+
* above the model's cap in started hundreds).
|
|
88
|
+
*/
|
|
89
|
+
export function parseSpeechQuoteCreditId(id: string): SpeechQuoteCreditIdParts | undefined {
|
|
90
|
+
if (typeof id !== "string") return undefined
|
|
91
|
+
const m = SPEECH_QUOTE_ID.exec(id)
|
|
92
|
+
if (!m) return undefined
|
|
93
|
+
const model = m[1]!
|
|
94
|
+
if (canonicalTtsProvider(model) !== model) return undefined
|
|
95
|
+
const caps = findTtsCapabilities(model) ?? findDialogueCapabilities(model)
|
|
96
|
+
if (!caps) return undefined
|
|
97
|
+
const units = Number(m[2])
|
|
98
|
+
if (!Number.isInteger(units) || units < SPEECH_FLOOR_UNITS || units > speechPriceUnits(caps.maxChars)) return undefined
|
|
99
|
+
return { model, unitId: speechUnitCreditId(model), units }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Whether an id is a length price of speech — a `<model>:per-100-chars` unit
|
|
104
|
+
* row or a `<model>:per-100-chars:<N>u` request quote — by its shape alone.
|
|
105
|
+
* Both are served only while the server prices speech by length.
|
|
106
|
+
*/
|
|
107
|
+
export function isSpeechLengthPriceId(id: string): boolean {
|
|
108
|
+
return typeof id === "string" && /:per-100-chars(?::\d+u)?$/.test(id)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The speech model a length price id is priced for — the id a request of
|
|
113
|
+
* that model is reserved at, so the two are priced under the same id — or
|
|
114
|
+
* undefined for any other id.
|
|
115
|
+
*/
|
|
116
|
+
export function speechLengthPriceModel(id: string): string | undefined {
|
|
117
|
+
if (!isSpeechLengthPriceId(id)) return undefined
|
|
118
|
+
return id.replace(/:per-100-chars(?::\d+u)?$/, "")
|
|
119
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The price of a whole run priced per unit, as ONE id.
|
|
3
|
+
*
|
|
4
|
+
* Some runs are charged a multiple of a one-unit price row: minutes of an
|
|
5
|
+
* Apply EDL or Speaker View render, 5-second steps of a Trim / Loop / Combine
|
|
6
|
+
* / Mask Composite result, seconds of an LTX extend or retake, started
|
|
7
|
+
* hundreds of a speech text. The server prices such a run as a whole — the
|
|
8
|
+
* row's base × the units, marked up ONCE and rounded up once — so a client
|
|
9
|
+
* that multiplies the served one-unit price (already rounded up) by the units
|
|
10
|
+
* can quote more than the run is charged.
|
|
11
|
+
*
|
|
12
|
+
* `unitQuoteCreditId(rateId, units)` names that whole price:
|
|
13
|
+
* `<rateId>:<units>u`. `POST /v1/credits/model-costs` and
|
|
14
|
+
* `GET /v1/credits/model-cost` answer it with the figure the run is charged,
|
|
15
|
+
* for a rate the server charges per unit and a unit count a run can have;
|
|
16
|
+
* any other id lands in `missing`. A client quotes that answer rather than
|
|
17
|
+
* multiplying. (A speech request's id, `<model>:per-100-chars:<N>u`, is this
|
|
18
|
+
* id on the model's per-100-characters row.)
|
|
19
|
+
*
|
|
20
|
+
* Units may be fractional — a retake window is set to the frame — and are
|
|
21
|
+
* written exactly as JavaScript prints the number, so the server reads back
|
|
22
|
+
* the same value the client priced.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** `<rateId>:<units>u` — the id of the whole price of `units` of `rateId`. */
|
|
26
|
+
export function unitQuoteCreditId(rateId: string, units: number): string {
|
|
27
|
+
return `${rateId}:${String(units)}u`
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** A `<rateId>:<units>u` id, read back. */
|
|
31
|
+
export interface UnitQuoteCreditIdParts {
|
|
32
|
+
/** The one-unit price row. */
|
|
33
|
+
rateId: string
|
|
34
|
+
/** How many of it the run is priced at (a positive number, possibly fractional). */
|
|
35
|
+
units: number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const UNIT_QUOTE_ID = /^(.+):(\d{1,7}(?:\.\d{1,20})?)u$/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The parts of a `<rateId>:<units>u` id by its shape alone, or undefined. Which
|
|
42
|
+
* rates the server prices this way, and at how many units, is the server's to
|
|
43
|
+
* say: an id it does not price lands in `missing`.
|
|
44
|
+
*/
|
|
45
|
+
export function parseUnitQuoteCreditId(id: string): UnitQuoteCreditIdParts | undefined {
|
|
46
|
+
if (typeof id !== "string") return undefined
|
|
47
|
+
const m = UNIT_QUOTE_ID.exec(id)
|
|
48
|
+
if (!m) return undefined
|
|
49
|
+
const units = Number(m[2])
|
|
50
|
+
if (!Number.isFinite(units) || units <= 0) return undefined
|
|
51
|
+
return { rateId: m[1]!, units }
|
|
52
|
+
}
|
|
@@ -39,3 +39,18 @@ export function videoSfxCreditId(durationSec: number | null | undefined): string
|
|
|
39
39
|
const bucket = VIDEO_SFX_BUCKETS.find((b) => seconds <= b.upToSec) ?? VIDEO_SFX_BUCKETS[VIDEO_SFX_BUCKETS.length - 1]!
|
|
40
40
|
return bucket.creditId
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The price row a QUOTE names for an input video of `durationSec` seconds —
|
|
45
|
+
* every estimate before a run (the node's Run button, the workflow estimate,
|
|
46
|
+
* the server's run estimate, a listing). A known length is the row its run is
|
|
47
|
+
* charged ({@link videoSfxCreditId}). An UNKNOWN length is the last row, 300
|
|
48
|
+
* seconds (decided 2026-10-13): a run measures the clip before it reserves and
|
|
49
|
+
* refuses one over 300 s, so that row is the most any run can be charged —
|
|
50
|
+
* the quote is never below the charge, as Video Mask and Video Depth quote an
|
|
51
|
+
* unknown clip at their highest row.
|
|
52
|
+
*/
|
|
53
|
+
export function videoSfxQuoteCreditId(durationSec: number | null | undefined): string {
|
|
54
|
+
const known = typeof durationSec === "number" && Number.isFinite(durationSec) && durationSec > 0
|
|
55
|
+
return videoSfxCreditId(known ? durationSec : VIDEO_SFX_PRICING.MAX_DURATION_SEC)
|
|
56
|
+
}
|