@nodaro/shared 3.67.0 → 3.68.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/dist/{chunk-JTYCJ5OL.cjs → chunk-4XR66IWF.cjs} +51 -13
- package/dist/chunk-4XR66IWF.cjs.map +1 -0
- package/dist/{chunk-6FQBKI2A.cjs → chunk-6JSYNKFL.cjs} +4 -4
- package/dist/{chunk-6FQBKI2A.cjs.map → chunk-6JSYNKFL.cjs.map} +1 -1
- package/dist/{chunk-23IKLMRL.cjs → chunk-BCY3A62O.cjs} +4 -4
- package/dist/{chunk-23IKLMRL.cjs.map → chunk-BCY3A62O.cjs.map} +1 -1
- package/dist/{chunk-RVQW623D.js → chunk-BHL7TAQO.js} +43 -12
- package/dist/chunk-BHL7TAQO.js.map +1 -0
- package/dist/{chunk-CLAKSLXF.js → chunk-E3PU7YC6.js} +3 -3
- package/dist/{chunk-CLAKSLXF.js.map → chunk-E3PU7YC6.js.map} +1 -1
- package/dist/{chunk-ALRXY4QH.cjs → chunk-N7ZJD4CK.cjs} +6 -2
- package/dist/chunk-N7ZJD4CK.cjs.map +1 -0
- package/dist/{chunk-O2QOBA6Q.js → chunk-NPGP6FMU.js} +43 -3
- package/dist/chunk-NPGP6FMU.js.map +1 -0
- package/dist/chunk-NWNRATS3.js +13 -0
- package/dist/chunk-NWNRATS3.js.map +1 -0
- package/dist/{chunk-ZQ2BHOFH.cjs → chunk-Q2LEJXLZ.cjs} +6 -6
- package/dist/{chunk-ZQ2BHOFH.cjs.map → chunk-Q2LEJXLZ.cjs.map} +1 -1
- package/dist/{chunk-O6TBB4IF.cjs → chunk-TZWXZDSX.cjs} +48 -2
- package/dist/chunk-TZWXZDSX.cjs.map +1 -0
- package/dist/{chunk-CFTXW3ZL.js → chunk-UVUHVY7F.js} +3 -3
- package/dist/{chunk-CFTXW3ZL.js.map → chunk-UVUHVY7F.js.map} +1 -1
- package/dist/{chunk-GTBW2KAY.js → chunk-XNJDAW3M.js} +3 -3
- package/dist/{chunk-GTBW2KAY.js.map → chunk-XNJDAW3M.js.map} +1 -1
- package/dist/entries/credits.cjs +192 -164
- package/dist/entries/credits.d.cts +82 -5
- package/dist/entries/credits.d.ts +82 -5
- package/dist/entries/credits.js +2 -2
- package/dist/entries/media.cjs +111 -107
- package/dist/entries/media.d.cts +17 -2
- package/dist/entries/media.d.ts +17 -2
- package/dist/entries/media.js +3 -3
- package/dist/entries/models.cjs +82 -82
- package/dist/entries/models.js +3 -3
- package/dist/entries/runtime-config.cjs +53 -29
- package/dist/entries/runtime-config.d.cts +53 -1
- package/dist/entries/runtime-config.d.ts +53 -1
- package/dist/entries/runtime-config.js +1 -1
- package/dist/entries/types.d.cts +12 -5
- package/dist/entries/types.d.ts +12 -5
- package/dist/index.cjs +435 -379
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -6
- package/package.json +1 -1
- package/src/__tests__/add-captions-nemotron-pricing.test.ts +13 -1
- package/src/__tests__/fixtures/measured-input-quote-parity.json +1816 -1
- package/src/__tests__/fixtures/planned-length-quote-parity.json +55 -10
- package/src/__tests__/fixtures/video-utility-quote-parity.json +834 -38
- package/src/__tests__/nemotron-transcribe-pricing.test.ts +32 -0
- package/src/__tests__/runtime-config-lists.test.ts +92 -0
- package/src/catalog-projection.ts +12 -5
- package/src/credit-estimators/add-captions-nemotron.ts +11 -1
- package/src/credit-estimators/index.ts +6 -1
- package/src/credit-estimators/nemotron-transcribe.ts +35 -3
- package/src/credit-estimators/pitch-tempo.ts +14 -0
- package/src/credit-estimators/video-sfx.ts +15 -0
- package/src/credit-estimators/video-utils.ts +48 -12
- package/src/entries/credits.ts +1 -0
- package/src/entries/runtime-config.ts +10 -1
- package/src/lip-sync-pricing.ts +15 -0
- package/src/priced-clip-seconds.ts +19 -1
- package/src/runtime-config/lists.ts +87 -0
- package/src/runtime-config/worlds.ts +10 -0
- package/dist/chunk-ALRXY4QH.cjs.map +0 -1
- package/dist/chunk-JTYCJ5OL.cjs.map +0 -1
- package/dist/chunk-O2QOBA6Q.js.map +0 -1
- package/dist/chunk-O6TBB4IF.cjs.map +0 -1
- package/dist/chunk-RVQW623D.js.map +0 -1
- package/dist/chunk-SMOO5FAH.js +0 -10
- package/dist/chunk-SMOO5FAH.js.map +0 -1
|
@@ -2,12 +2,16 @@ import { describe, expect, it } from "vitest"
|
|
|
2
2
|
import {
|
|
3
3
|
NEMOTRON_TRANSCRIBE_ID,
|
|
4
4
|
NEMOTRON_TRANSCRIBE_PRICING,
|
|
5
|
+
NEMOTRON_UPWARD_GRACE_SEC,
|
|
6
|
+
nemotronHeldMinutes,
|
|
5
7
|
nemotronTranscribeBaseCredits,
|
|
6
8
|
nemotronTranscribeCreditId,
|
|
9
|
+
nemotronTranscribeHeldCreditId,
|
|
7
10
|
nemotronTranscribeQuoteCreditId,
|
|
8
11
|
nemotronTranscribeStartedMinutes,
|
|
9
12
|
parseNemotronTranscribeCreditId,
|
|
10
13
|
} from "../credit-estimators/nemotron-transcribe.js"
|
|
14
|
+
import { addCaptionsNemotronHeldCreditId, addCaptionsNemotronQuoteCreditId, parseAddCaptionsNemotronCreditId } from "../credit-estimators/add-captions-nemotron.js"
|
|
11
15
|
import { MODEL_CATALOG } from "../model-catalog.js"
|
|
12
16
|
|
|
13
17
|
const RATE = NEMOTRON_TRANSCRIBE_PRICING.CREDITS_PER_RATE_DEFAULT
|
|
@@ -53,6 +57,34 @@ describe("Nemotron 3.5 Transcribe pricing (per started minute, decided 2026-11-1
|
|
|
53
57
|
expect(nemotronTranscribeQuoteCreditId(125)).toBe("nemotron-3-5-transcribe:3m")
|
|
54
58
|
})
|
|
55
59
|
|
|
60
|
+
it("holds a measured file at the minutes the charge settles at: up to the grace past a minute is the minute below", () => {
|
|
61
|
+
expect(NEMOTRON_UPWARD_GRACE_SEC).toBe(1)
|
|
62
|
+
// A re-encoded 60-second cut measures a hair past 60 s (60.0004–60.011 s): held, and charged, at one minute.
|
|
63
|
+
expect(nemotronHeldMinutes(60)).toBe(1)
|
|
64
|
+
expect(nemotronHeldMinutes(60.0004)).toBe(1)
|
|
65
|
+
expect(nemotronHeldMinutes(60.011)).toBe(1)
|
|
66
|
+
expect(nemotronHeldMinutes(61)).toBe(1)
|
|
67
|
+
expect(nemotronHeldMinutes(61.001)).toBe(2)
|
|
68
|
+
expect(nemotronHeldMinutes(0.4)).toBe(1)
|
|
69
|
+
expect(nemotronHeldMinutes(3600)).toBe(60)
|
|
70
|
+
expect(nemotronTranscribeHeldCreditId(60.011)).toBe("nemotron-3-5-transcribe:1m")
|
|
71
|
+
expect(nemotronTranscribeHeldCreditId(125)).toBe("nemotron-3-5-transcribe:3m")
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
// The guard: a quote of a known length is never below the hold of a file that measures up to the grace past it.
|
|
75
|
+
const KNOWN = [0.5, 1, 30, 59, 59.5, 60, 60.5, 61, 119, 120, 180, 599.99, 600, 1800, 3540, 3599, 3600]
|
|
76
|
+
const OVER = [0, 1e-6, 0.0004, 0.011, 0.25, 0.5, 0.999, NEMOTRON_UPWARD_GRACE_SEC]
|
|
77
|
+
it.each(KNOWN)("a quote of %s s is never below the hold of a file measured up to the grace past it", (known) => {
|
|
78
|
+
for (const over of OVER) {
|
|
79
|
+
const measured = Math.min(known + over, NEMOTRON_TRANSCRIBE_PRICING.MAX_DURATION_SEC)
|
|
80
|
+
const quoted = parseNemotronTranscribeCreditId(nemotronTranscribeQuoteCreditId(known))!.minutes
|
|
81
|
+
expect(parseNemotronTranscribeCreditId(nemotronTranscribeHeldCreditId(measured))!.minutes, `${known} + ${over}`).toBeLessThanOrEqual(quoted)
|
|
82
|
+
// Add Captions on Nemotron: the same rule, its own ids.
|
|
83
|
+
const captionQuote = parseAddCaptionsNemotronCreditId(addCaptionsNemotronQuoteCreditId(known))!.minutes
|
|
84
|
+
expect(parseAddCaptionsNemotronCreditId(addCaptionsNemotronHeldCreditId(measured))!.minutes, `${known} + ${over}`).toBeLessThanOrEqual(captionQuote)
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
|
|
56
88
|
it("lists the four-minute rate row in the catalog at the launch rate", () => {
|
|
57
89
|
const entry = MODEL_CATALOG[NEMOTRON_TRANSCRIBE_ID as keyof typeof MODEL_CATALOG] as unknown as { pricing: Array<{ identifier: string; credits: number }>; maker?: string }
|
|
58
90
|
expect(entry.pricing).toEqual([expect.objectContaining({ identifier: NEMOTRON_TRANSCRIBE_PRICING.RATE_CREDIT_ID, credits: RATE })])
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
ALLOW_LIST_EXEMPT_NODE_TYPES,
|
|
4
|
+
WORLD_IDS,
|
|
5
|
+
isAllowListGatedNodeType,
|
|
6
|
+
listsSet,
|
|
7
|
+
listsWithhold,
|
|
8
|
+
nodeListsWithhold,
|
|
9
|
+
worldOffered,
|
|
10
|
+
} from "../entries/runtime-config.js"
|
|
11
|
+
|
|
12
|
+
const NONE = { allow: [], deny: [] }
|
|
13
|
+
const everything = () => true
|
|
14
|
+
|
|
15
|
+
describe("listsWithhold — a deployment's own allow/deny lists", () => {
|
|
16
|
+
it("lists that are not set withhold nothing", () => {
|
|
17
|
+
expect(listsWithhold(NONE, "generate-image", everything)).toBe(false)
|
|
18
|
+
expect(listsSet(NONE)).toBe(false)
|
|
19
|
+
expect(listsSet(undefined)).toBe(false)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it("a non-empty allow withholds every governed id outside it", () => {
|
|
23
|
+
const lists = { allow: ["generate-image"], deny: [] }
|
|
24
|
+
expect(listsSet(lists)).toBe(true)
|
|
25
|
+
expect(listsWithhold(lists, "generate-image", everything)).toBe(false)
|
|
26
|
+
expect(listsWithhold(lists, "generate-video", everything)).toBe(true)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it("an id the allow list does not govern is withheld only by deny", () => {
|
|
30
|
+
const lists = { allow: ["generate-image"], deny: ["preview"] }
|
|
31
|
+
const governed = (id: string) => id !== "sticky-note" && id !== "preview"
|
|
32
|
+
expect(listsWithhold(lists, "sticky-note", governed)).toBe(false)
|
|
33
|
+
expect(listsWithhold(lists, "preview", governed)).toBe(true)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it("deny withholds what it names, also inside allow", () => {
|
|
37
|
+
const lists = { allow: ["generate-image", "dubbing"], deny: ["dubbing"] }
|
|
38
|
+
expect(listsSet({ allow: [], deny: ["dubbing"] })).toBe(true)
|
|
39
|
+
expect(listsWithhold(lists, "dubbing", everything)).toBe(true)
|
|
40
|
+
expect(listsWithhold(lists, "generate-image", everything)).toBe(false)
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
describe("nodeListsWithhold — the node lists", () => {
|
|
45
|
+
it("a whitelist never withholds a utility node or Site Capture by leaving it out", () => {
|
|
46
|
+
const lists = { allow: ["generate-image"], deny: [] }
|
|
47
|
+
expect(ALLOW_LIST_EXEMPT_NODE_TYPES).toEqual(expect.arrayContaining(["sticky-note", "preview", "group", "site-capture"]))
|
|
48
|
+
for (const type of ALLOW_LIST_EXEMPT_NODE_TYPES) {
|
|
49
|
+
expect(isAllowListGatedNodeType(type), type).toBe(false)
|
|
50
|
+
expect(nodeListsWithhold(lists, type), type).toBe(false)
|
|
51
|
+
expect(nodeListsWithhold({ allow: ["generate-image"], deny: [type] }, type), type).toBe(true)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it("a whitelist withholds every other node type it does not list, features with no canvas node included", () => {
|
|
56
|
+
const lists = { allow: ["generate-image", "dubbing"], deny: [] }
|
|
57
|
+
for (const type of ["generate-video", "combine-text", "sub-workflow", "cast-swap", "voice-clone-one-off"]) {
|
|
58
|
+
expect(isAllowListGatedNodeType(type), type).toBe(true)
|
|
59
|
+
expect(nodeListsWithhold(lists, type), type).toBe(true)
|
|
60
|
+
}
|
|
61
|
+
expect(nodeListsWithhold(lists, "dubbing")).toBe(false)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it("a deny of the Voice Clone node withholds a one-off clone too; a whitelist without it does not", () => {
|
|
65
|
+
expect(nodeListsWithhold({ allow: [], deny: ["voice-clone"] }, "voice-clone-one-off")).toBe(true)
|
|
66
|
+
expect(nodeListsWithhold({ allow: ["voice-clone-one-off"], deny: [] }, "voice-clone-one-off")).toBe(false)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it("takes the caller's own idea of what a whitelist governs", () => {
|
|
70
|
+
const lists = { allow: ["generate-image"], deny: [] }
|
|
71
|
+
expect(nodeListsWithhold(lists, "a-type-the-caller-does-not-know", (type) => type === "generate-video")).toBe(false)
|
|
72
|
+
expect(nodeListsWithhold(lists, "generate-video", (type) => type === "generate-video")).toBe(true)
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
describe("worldOffered — a world, by the profile's allowlist and the node types it runs", () => {
|
|
77
|
+
it("every world, where nothing is withheld and no allowlist is set", () => {
|
|
78
|
+
for (const id of WORLD_IDS) expect(worldOffered(undefined, id, () => false), id).toBe(true)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it("not a world the allowlist leaves out", () => {
|
|
82
|
+
expect(worldOffered({ allow: ["image"] }, "video", () => false)).toBe(false)
|
|
83
|
+
expect(worldOffered({ allow: ["image"] }, "image", () => false)).toBe(true)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it("not a world one of whose node types is withheld; a world that runs none follows the allowlist alone", () => {
|
|
87
|
+
const withheld = (type: string) => type === "text-to-video"
|
|
88
|
+
expect(worldOffered(undefined, "video", withheld)).toBe(false)
|
|
89
|
+
expect(worldOffered(undefined, "image", withheld)).toBe(true)
|
|
90
|
+
expect(worldOffered(undefined, "app", () => true)).toBe(true)
|
|
91
|
+
})
|
|
92
|
+
})
|
|
@@ -50,6 +50,13 @@ export interface ProjectedCatalogOption {
|
|
|
50
50
|
* look previews, which only Nodaro Cloud serves. Absent when the option has
|
|
51
51
|
* no picture. Content-hashed where self-hosted: a changed picture gets a new
|
|
52
52
|
* URL, so it can be cached indefinitely.
|
|
53
|
+
*
|
|
54
|
+
* On a deployment that shows its own pictures (`catalogs.images: "own"`) it
|
|
55
|
+
* is the deployment's picture: an absolute URL on its media host, or — on
|
|
56
|
+
* the REST replies — a path on the deployment's own site (`/brand/…`), which
|
|
57
|
+
* resolves against the address the API was called at (a page on that site
|
|
58
|
+
* uses it as it is; a client elsewhere resolves it against its API base).
|
|
59
|
+
* The MCP tools give that path absolute.
|
|
53
60
|
*/
|
|
54
61
|
imageUrl?: string
|
|
55
62
|
/**
|
|
@@ -61,11 +68,11 @@ export interface ProjectedCatalogOption {
|
|
|
61
68
|
*/
|
|
62
69
|
imageSrcSet?: string
|
|
63
70
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
71
|
+
* The option's enlarged picture: the larger version to show where a picker
|
|
72
|
+
* shows the option big (hover, zoom, a detail view). Present only on a
|
|
73
|
+
* deployment that shows its own pictures (`catalogs.images: "own"`) and gave
|
|
74
|
+
* one for this option, on the REST replies; on its media host or a path on
|
|
75
|
+
* its site, like `imageUrl`. Absent otherwise — draw `imageUrl` there instead.
|
|
69
76
|
*/
|
|
70
77
|
imageLargeUrl?: string
|
|
71
78
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import {
|
|
23
23
|
NEMOTRON_TRANSCRIBE_PRICING,
|
|
24
|
+
nemotronHeldMinutes,
|
|
24
25
|
nemotronTranscribeBaseCredits,
|
|
25
26
|
nemotronTranscribeStartedMinutes,
|
|
26
27
|
} from "./nemotron-transcribe.js"
|
|
@@ -37,11 +38,20 @@ export function addCaptionsNemotronMinutesId(minutes: number): string {
|
|
|
37
38
|
return `${ADD_CAPTIONS_NEMOTRON_ID_PREFIX}:${n}m`
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
/** The id a Nemotron caption run on a video of `durationSec` seconds
|
|
41
|
+
/** The id of a Nemotron caption run on a video of `durationSec` seconds' started minutes (the price of that length; a quote names it). */
|
|
41
42
|
export function addCaptionsNemotronCreditId(durationSec: number | null | undefined): string {
|
|
42
43
|
return addCaptionsNemotronMinutesId(nemotronTranscribeStartedMinutes(durationSec))
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* The id a Nemotron caption run on a video it measured at `measuredSec`
|
|
48
|
+
* seconds HOLDS: the started minutes less the one second its charge forgives
|
|
49
|
+
* (`nemotronHeldMinutes`, the Transcribe node's own rule).
|
|
50
|
+
*/
|
|
51
|
+
export function addCaptionsNemotronHeldCreditId(measuredSec: number): string {
|
|
52
|
+
return addCaptionsNemotronMinutesId(nemotronHeldMinutes(measuredSec))
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
/**
|
|
46
56
|
* The id a QUOTE names for a video of `durationSec` seconds — every estimate
|
|
47
57
|
* before a run. A known length is the id its run holds; an UNKNOWN length is
|
|
@@ -14,7 +14,7 @@ export {
|
|
|
14
14
|
imageOverlayCredits,
|
|
15
15
|
} from "./image-overlay.js"
|
|
16
16
|
|
|
17
|
-
export { VIDEO_SFX_PRICING, videoSfxCreditId, videoSfxQuoteCreditId } from "./video-sfx.js"
|
|
17
|
+
export { VIDEO_SFX_PRICING, videoSfxCreditId, videoSfxHeldCreditId, videoSfxQuoteCreditId } from "./video-sfx.js"
|
|
18
18
|
|
|
19
19
|
export {
|
|
20
20
|
TEXT_TO_AUDIO_PRICING,
|
|
@@ -80,6 +80,7 @@ export {
|
|
|
80
80
|
PITCH_TEMPO_LIMITS,
|
|
81
81
|
pitchTempoStartedMinutes,
|
|
82
82
|
pitchTempoCreditId,
|
|
83
|
+
pitchTempoHeldCreditId,
|
|
83
84
|
pitchTempoQuoteCreditId,
|
|
84
85
|
parsePitchTempoCreditId,
|
|
85
86
|
pitchTempoBaseCredits,
|
|
@@ -89,8 +90,11 @@ export {
|
|
|
89
90
|
export {
|
|
90
91
|
NEMOTRON_TRANSCRIBE_ID,
|
|
91
92
|
NEMOTRON_TRANSCRIBE_PRICING,
|
|
93
|
+
NEMOTRON_UPWARD_GRACE_SEC,
|
|
92
94
|
nemotronTranscribeStartedMinutes,
|
|
95
|
+
nemotronHeldMinutes,
|
|
93
96
|
nemotronTranscribeCreditId,
|
|
97
|
+
nemotronTranscribeHeldCreditId,
|
|
94
98
|
nemotronTranscribeQuoteCreditId,
|
|
95
99
|
parseNemotronTranscribeCreditId,
|
|
96
100
|
nemotronTranscribeBaseCredits,
|
|
@@ -101,6 +105,7 @@ export {
|
|
|
101
105
|
ADD_CAPTIONS_NEMOTRON_ID_PREFIX,
|
|
102
106
|
addCaptionsNemotronMinutesId,
|
|
103
107
|
addCaptionsNemotronCreditId,
|
|
108
|
+
addCaptionsNemotronHeldCreditId,
|
|
104
109
|
addCaptionsNemotronQuoteCreditId,
|
|
105
110
|
parseAddCaptionsNemotronCreditId,
|
|
106
111
|
addCaptionsNemotronBaseCredits,
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* The base price is 0.75 credits a minute, which no whole-credit row can hold
|
|
6
6
|
* (`model_pricing.credit_cost` is an integer), so the rate row prices FOUR
|
|
7
7
|
* minutes — the same trick as Nodaro Video Upscale's four-second rows. A run
|
|
8
|
-
* reserves `nemotron-3-5-transcribe:<N>m` (N = started minutes, 1..60
|
|
8
|
+
* reserves `nemotron-3-5-transcribe:<N>m` (N = started minutes, 1..60; a
|
|
9
|
+
* measured file's less the one second its charge forgives), which
|
|
9
10
|
* billing prices as that row × N ÷ 4, rounded up once for the whole run, then
|
|
10
11
|
* marked up once — never a row of its own, so a retune of the rate row moves
|
|
11
12
|
* the route, the workflow run, the node's Run button and every estimate
|
|
@@ -16,7 +17,9 @@
|
|
|
16
17
|
* `lib/nemotron-transcribe-settle.ts`).
|
|
17
18
|
*
|
|
18
19
|
* Worked base prices at the row's launch value of 3 (per 4 minutes):
|
|
19
|
-
* 0:45 → 1, 1:00 → 1, 1:
|
|
20
|
+
* 0:45 → 1, 1:00 → 1, 1:05 → 2, 10:00 → 8, 60:00 → 45
|
|
21
|
+
* (a length's started minutes; a measured file up to 1 s past a minute is
|
|
22
|
+
* held and charged the minute below, {@link nemotronHeldMinutes}).
|
|
20
23
|
* The listed (marked-up) price follows from those.
|
|
21
24
|
*/
|
|
22
25
|
|
|
@@ -50,11 +53,40 @@ export function nemotronTranscribeStartedMinutes(durationSec: number | null | un
|
|
|
50
53
|
return Math.min(NEMOTRON_TRANSCRIBE_PRICING.MAX_MINUTES, Math.max(1, Math.ceil(durationSec / 60)))
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
/** `nemotron-3-5-transcribe:<N>m` — the id
|
|
56
|
+
/** `nemotron-3-5-transcribe:<N>m` — the id of `durationSec` seconds' started minutes (the price of that length; a quote names it). */
|
|
54
57
|
export function nemotronTranscribeCreditId(durationSec: number | null | undefined): string {
|
|
55
58
|
return `${NEMOTRON_TRANSCRIBE_ID}:${nemotronTranscribeStartedMinutes(durationSec)}m`
|
|
56
59
|
}
|
|
57
60
|
|
|
61
|
+
/**
|
|
62
|
+
* How far past a whole minute a file may run and still be held and charged the
|
|
63
|
+
* minute below it: one second (decided 2026-11-12 for the charge, which reads
|
|
64
|
+
* KIE's decoded length; the hold reads it too, {@link nemotronHeldMinutes}).
|
|
65
|
+
* Decoders and containers disagree by a few hundredths at a file's end — a
|
|
66
|
+
* 60-second cut re-encoded with its sound measures 60.0004–60.011 s.
|
|
67
|
+
*/
|
|
68
|
+
export const NEMOTRON_UPWARD_GRACE_SEC = 1
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The started minutes a run HOLDS for a file it measured at `measuredSec`
|
|
72
|
+
* before it runs: those of the length less {@link NEMOTRON_UPWARD_GRACE_SEC},
|
|
73
|
+
* at least 1, at most 60 — the minutes its charge settles at when KIE decodes
|
|
74
|
+
* the file within the grace of them (backend `nemotronChargeId`, which forgives
|
|
75
|
+
* only a length past the HELD minutes). So a quote of a length the graph knows
|
|
76
|
+
* is never below the hold of a file that measures up to the grace past it, and
|
|
77
|
+
* a file a hair past a minute is held and charged as that minute. The one rule
|
|
78
|
+
* both holds read: the Transcribe node's (`nemotronTranscribeHeldCreditId`) and
|
|
79
|
+
* Add Captions' on Nemotron (`addCaptionsNemotronHeldCreditId`).
|
|
80
|
+
*/
|
|
81
|
+
export function nemotronHeldMinutes(measuredSec: number): number {
|
|
82
|
+
return nemotronTranscribeStartedMinutes(measuredSec - NEMOTRON_UPWARD_GRACE_SEC)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** `nemotron-3-5-transcribe:<N>m` — the id a run on a file it measured at `measuredSec` seconds holds ({@link nemotronHeldMinutes}). */
|
|
86
|
+
export function nemotronTranscribeHeldCreditId(measuredSec: number): string {
|
|
87
|
+
return `${NEMOTRON_TRANSCRIBE_ID}:${nemotronHeldMinutes(measuredSec)}m`
|
|
88
|
+
}
|
|
89
|
+
|
|
58
90
|
/**
|
|
59
91
|
* The id a QUOTE names for a file of `durationSec` seconds — every estimate
|
|
60
92
|
* before a run. A known length is the id its run reserves. An UNKNOWN length is
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* 0:45 → 20, 1:00 → 20, 1:01 → 40, 3:10 → 80, 30:00 → 600.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { gracedMeasuredSec } from "../priced-clip-seconds.js"
|
|
18
|
+
|
|
17
19
|
export const PITCH_TEMPO_PRICING = {
|
|
18
20
|
/** The rate row: credits per started minute. Never reserved by itself. */
|
|
19
21
|
RATE_CREDIT_ID: "pitch-tempo",
|
|
@@ -49,6 +51,18 @@ export function pitchTempoCreditId(durationSec: number | null | undefined): stri
|
|
|
49
51
|
return `pitch-tempo:${pitchTempoStartedMinutes(durationSec)}m`
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
/**
|
|
55
|
+
* `pitch-tempo:<N>m` — the id a run HOLDS and is CHARGED for an input it
|
|
56
|
+
* measured at `measuredSec` seconds: the started minutes of the length less
|
|
57
|
+
* `CLIP_PRICE_GRACE_SEC` (0.05 s, decided 2026-11-14), so a file a hair past a
|
|
58
|
+
* minute is charged the minute its length is quoted at
|
|
59
|
+
* ({@link pitchTempoQuoteCreditId} reads the length exactly).
|
|
60
|
+
*/
|
|
61
|
+
export function pitchTempoHeldCreditId(measuredSec: number): string {
|
|
62
|
+
// Less a float-noise hair too (`gracedMeasuredSec`): 60.05 s less 0.05 s is 60.00000000000001, not past a minute.
|
|
63
|
+
return pitchTempoCreditId(Math.max(Number.MIN_VALUE, gracedMeasuredSec(measuredSec)))
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
/**
|
|
53
67
|
* The id a QUOTE names for an input of `durationSec` seconds — every estimate
|
|
54
68
|
* before a run. A known length is the id its run reserves
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* 5 s → `:8s`, 12 s → `:15s`, 31 s → `:60s`, 180 s → `:300s`.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { gracedMeasuredSec } from "../priced-clip-seconds.js"
|
|
14
|
+
|
|
13
15
|
export const VIDEO_SFX_PRICING = {
|
|
14
16
|
/** The longest input video a run accepts, in seconds. */
|
|
15
17
|
MAX_DURATION_SEC: 300,
|
|
@@ -40,6 +42,19 @@ export function videoSfxCreditId(durationSec: number | null | undefined): string
|
|
|
40
42
|
return bucket.creditId
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
/**
|
|
46
|
+
* The price row a run HOLDS and is CHARGED for an input video it measured at
|
|
47
|
+
* `measuredSec` seconds: the row of the length less `CLIP_PRICE_GRACE_SEC`
|
|
48
|
+
* (0.05 s, decided 2026-11-14), so a container a hair past a row's length (a
|
|
49
|
+
* re-encoded 30 s cut measures 30.016 s) is charged that row, the one its
|
|
50
|
+
* length is quoted at ({@link videoSfxQuoteCreditId}, which reads the length
|
|
51
|
+
* exactly). Past the grace, the next row.
|
|
52
|
+
*/
|
|
53
|
+
export function videoSfxHeldCreditId(measuredSec: number): string {
|
|
54
|
+
// Less a float-noise hair too (`gracedMeasuredSec`): 15.05 s less 0.05 s is 15.000000000000002, not past 15 s.
|
|
55
|
+
return videoSfxCreditId(Math.max(Number.MIN_VALUE, gracedMeasuredSec(measuredSec)))
|
|
56
|
+
}
|
|
57
|
+
|
|
43
58
|
/**
|
|
44
59
|
* The price row a QUOTE names for an input video of `durationSec` seconds —
|
|
45
60
|
* every estimate before a run (the node's Run button, the workflow estimate,
|
|
@@ -58,8 +58,30 @@ export interface CombineVideosEstimatorInput {
|
|
|
58
58
|
transitionDuration?: number
|
|
59
59
|
trimStartFrames?: number
|
|
60
60
|
trimEndFrames?: number
|
|
61
|
+
/**
|
|
62
|
+
* The frame rate the clips' frame trims are cut at (the rate the join
|
|
63
|
+
* conforms its clips to), when known. Absent, 24 fps, the estimate's
|
|
64
|
+
* long-standing assumption. The trims come off at the joins only: the start
|
|
65
|
+
* of every clip but the first, the end of every clip but the last.
|
|
66
|
+
*/
|
|
67
|
+
trimFramesPerSecond?: number
|
|
68
|
+
/**
|
|
69
|
+
* Per-join transitions (Combine Videos' `transitions`): `index` k is the
|
|
70
|
+
* join between clip k and clip k + 1. A join with an entry blends for its
|
|
71
|
+
* own `duration` (a `"cut"`, or a duration of 0, overlaps nothing); every
|
|
72
|
+
* other join keeps `transition` / `transitionDuration`. An index outside the
|
|
73
|
+
* joins is ignored, and a later entry for the same join wins, as the join
|
|
74
|
+
* renders them.
|
|
75
|
+
*/
|
|
76
|
+
transitions?: ReadonlyArray<{ readonly index?: number; readonly transition?: string; readonly duration?: number }>
|
|
61
77
|
}
|
|
62
78
|
|
|
79
|
+
/** The most a join may overlap, as a share of the shortest clip it joins (the render's own clamp). */
|
|
80
|
+
const COMBINE_MAX_OVERLAP_SHARE = 0.9
|
|
81
|
+
|
|
82
|
+
/** A length in seconds when it is a positive one, else 0 (a transition with no length overlaps nothing). */
|
|
83
|
+
const positiveSeconds = (v: unknown): number => (typeof v === "number" && Number.isFinite(v) && v > 0 ? v : 0)
|
|
84
|
+
|
|
63
85
|
export function estimateLoopVideoCredits(
|
|
64
86
|
data: LoopVideoEstimatorInput,
|
|
65
87
|
upstreamDuration?: number,
|
|
@@ -130,19 +152,33 @@ export function estimateCombineVideosCredits(
|
|
|
130
152
|
const fallback = VIDEO_UTIL_PRICING.FALLBACK_DURATION_SECONDS
|
|
131
153
|
const n = upstreamDurations.length
|
|
132
154
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
155
|
+
const trimFps =
|
|
156
|
+
data.trimFramesPerSecond !== undefined && Number.isFinite(data.trimFramesPerSecond) && data.trimFramesPerSecond > 0
|
|
157
|
+
? data.trimFramesPerSecond
|
|
158
|
+
: VIDEO_UTIL_PRICING.FRAMES_PER_CREDIT
|
|
159
|
+
const startSec = (data.trimStartFrames ?? 0) / trimFps
|
|
160
|
+
const endSec = (data.trimEndFrames ?? 0) / trimFps
|
|
161
|
+
// Each clip as the join cuts it: the trims come off only where two clips
|
|
162
|
+
// meet — the start of every clip but the first, the end of every clip but
|
|
163
|
+
// the last. The film's own first and last frames are kept.
|
|
164
|
+
const clips = upstreamDurations.map((d, i) => {
|
|
165
|
+
const sec = typeof d === "number" && Number.isFinite(d) && d >= 0 ? d : fallback
|
|
166
|
+
return sec - (i > 0 ? startSec : 0) - (i < n - 1 ? endSec : 0)
|
|
167
|
+
})
|
|
168
|
+
let total = clips.reduce((sum, sec) => sum + sec, 0)
|
|
169
|
+
|
|
170
|
+
// Each join's overlap, as the join renders it: its own transition where one
|
|
171
|
+
// is set, else the global one; at most 90 % of the shortest clip.
|
|
172
|
+
const globalOverlap = data.transition && data.transition !== "cut" ? Math.max(0, data.transitionDuration ?? 0.5) : 0
|
|
173
|
+
const overrides = new Map<number, number>()
|
|
174
|
+
for (const entry of data.transitions ?? []) {
|
|
175
|
+
const index = entry?.index
|
|
176
|
+
if (typeof index !== "number" || !Number.isInteger(index) || index < 0 || index >= n - 1) continue
|
|
177
|
+
const overlap = positiveSeconds(entry.duration)
|
|
178
|
+
overrides.set(index, entry.transition === "cut" ? 0 : overlap)
|
|
136
179
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
total -= (data.transitionDuration ?? 0.5) * (n - 1)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const trimSecPerClip =
|
|
143
|
-
((data.trimStartFrames ?? 0) + (data.trimEndFrames ?? 0)) /
|
|
144
|
-
VIDEO_UTIL_PRICING.FRAMES_PER_CREDIT
|
|
145
|
-
total -= trimSecPerClip * n
|
|
180
|
+
const maxOverlap = Math.max(0, Math.min(...clips) * COMBINE_MAX_OVERLAP_SHARE)
|
|
181
|
+
for (let k = 0; k < n - 1; k++) total -= Math.min(overrides.get(k) ?? globalOverlap, maxOverlap)
|
|
146
182
|
|
|
147
183
|
const base = Math.ceil(Math.max(0, total) / 5)
|
|
148
184
|
const inputAdder = Math.max(0, n - 2)
|
package/src/entries/credits.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@nodaro/shared/runtime-config` — The deployment runtime config contract: `/config.js`'s keys and their shapes, a lenient parser,
|
|
2
|
+
* `@nodaro/shared/runtime-config` — The deployment runtime config contract: `/config.js`'s keys and their shapes, a lenient parser, the worlds a deployment can offer, and how its own lists withhold what it offers.
|
|
3
3
|
*
|
|
4
4
|
* One of the package's subpath entries (see `src/index.ts`). The root
|
|
5
5
|
* re-exports every entry, so each name here is also importable from
|
|
@@ -10,10 +10,19 @@ export {
|
|
|
10
10
|
WORLD_REQUIRED_NODE_TYPES,
|
|
11
11
|
isWorldId,
|
|
12
12
|
worldAllowed,
|
|
13
|
+
worldOffered,
|
|
13
14
|
orderWorlds,
|
|
14
15
|
type WorldId,
|
|
15
16
|
type SurfaceWorlds,
|
|
16
17
|
} from "../runtime-config/worlds.js"
|
|
18
|
+
export {
|
|
19
|
+
ALLOW_LIST_EXEMPT_NODE_TYPES,
|
|
20
|
+
isAllowListGatedNodeType,
|
|
21
|
+
listsSet,
|
|
22
|
+
listsWithhold,
|
|
23
|
+
nodeListsWithhold,
|
|
24
|
+
type SurfaceAllowDeny,
|
|
25
|
+
} from "../runtime-config/lists.js"
|
|
17
26
|
export {
|
|
18
27
|
RUNTIME_CONFIG_GLOBAL,
|
|
19
28
|
RUNTIME_CONFIG_KEYS,
|
package/src/lip-sync-pricing.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { unitQuoteCreditId } from "./credit-estimators/unit-quote.js"
|
|
16
|
+
import { gracedMeasuredSec } from "./priced-clip-seconds.js"
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* A lip-sync model charged at a per-second rate: the rate's one-second price
|
|
@@ -61,6 +62,20 @@ export function lipSyncBilledSeconds(rate: LipSyncAudioRate, measuredSec: number
|
|
|
61
62
|
return Math.max(rate.minSeconds, Math.ceil(measuredSec))
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
/**
|
|
66
|
+
* The seconds a run of a per-second-rate model is HELD and CHARGED for audio
|
|
67
|
+
* it measured at `measuredSec`: {@link lipSyncBilledSeconds} of the length less
|
|
68
|
+
* `CLIP_PRICE_GRACE_SEC` (0.05 s, decided 2026-11-14), so audio a hair past a
|
|
69
|
+
* whole second (a decoder's few hundredths at a file's end) is charged the
|
|
70
|
+
* second its length is quoted at. A quote reads the length exactly
|
|
71
|
+
* ({@link lipSyncEstimateSeconds}).
|
|
72
|
+
*/
|
|
73
|
+
export function lipSyncHeldSeconds(rate: LipSyncAudioRate, measuredSec: number): number {
|
|
74
|
+
if (!Number.isFinite(measuredSec) || measuredSec <= 0) return rate.minSeconds
|
|
75
|
+
return lipSyncBilledSeconds(rate, Math.max(Number.MIN_VALUE, gracedMeasuredSec(measuredSec)))
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
64
79
|
/**
|
|
65
80
|
* The length the editor quotes a lip-sync run on while its audio's length is
|
|
66
81
|
* not known yet — the 15 seconds every model priced by its audio shows then
|
|
@@ -12,7 +12,14 @@
|
|
|
12
12
|
* read the clip's real length. Other models round as they always have.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* How far past a whole second a clip is still priced as that second — and how
|
|
17
|
+
* far past a mark a measured file may run and still be HELD and CHARGED at
|
|
18
|
+
* that mark by the steps that measure their input and round with no grace of
|
|
19
|
+
* their own (decided 2026-11-14: Video SFX's rows, Pitch & Tempo's and
|
|
20
|
+
* Dubbing's minutes, OmniHuman 2.0's seconds). Their quotes read the length
|
|
21
|
+
* exactly, so a quote is never below the charge of a file up to this past it.
|
|
22
|
+
*/
|
|
16
23
|
export const CLIP_PRICE_GRACE_SEC = 0.05
|
|
17
24
|
|
|
18
25
|
/**
|
|
@@ -22,6 +29,17 @@ export const CLIP_PRICE_GRACE_SEC = 0.05
|
|
|
22
29
|
*/
|
|
23
30
|
const FLOAT_NOISE_SEC = 1e-9
|
|
24
31
|
|
|
32
|
+
/**
|
|
33
|
+
* A measured length less the hair its hold and charge forgive
|
|
34
|
+
* (`CLIP_PRICE_GRACE_SEC`) and less float noise: the ONE arithmetic Video
|
|
35
|
+
* SFX's, Pitch & Tempo's, Dubbing's and OmniHuman 2.0's held rows are read
|
|
36
|
+
* from. It can be 0 or below for a file under the grace; each caller keeps its
|
|
37
|
+
* own floor.
|
|
38
|
+
*/
|
|
39
|
+
export function gracedMeasuredSec(measuredSec: number): number {
|
|
40
|
+
return measuredSec - CLIP_PRICE_GRACE_SEC - FLOAT_NOISE_SEC
|
|
41
|
+
}
|
|
42
|
+
|
|
25
43
|
/** At least one second. The caller has checked that `sec` is a real length. */
|
|
26
44
|
export function pricedClipSeconds(sec: number): number {
|
|
27
45
|
return Math.max(1, Math.ceil(sec - CLIP_PRICE_GRACE_SEC - FLOAT_NOISE_SEC))
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a deployment's own lists withhold what it offers: `surface.nodes` and
|
|
3
|
+
* `surface.models` in its runtime configuration, each an `allow` / `deny`
|
|
4
|
+
* pair. This is the platform's rule before any admin setting (Admin →
|
|
5
|
+
* Availability can replace the lists, and switches models off); a client
|
|
6
|
+
* applies it the same way before the platform's per-viewer answer
|
|
7
|
+
* (`GET /v1/surface/availability`) has arrived, or after it could not be read,
|
|
8
|
+
* so a restricted deployment is judged by its own lists from the first paint.
|
|
9
|
+
* The worlds' half is `worldOffered` (worlds.ts).
|
|
10
|
+
*
|
|
11
|
+
* Structural vocabulary only (ids and node-type names), no content.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** One kind's lists (`surface.nodes`, `surface.models`). */
|
|
15
|
+
export interface SurfaceAllowDeny {
|
|
16
|
+
readonly allow: readonly string[]
|
|
17
|
+
readonly deny: readonly string[]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Whether a kind's lists say anything: either one names an id. */
|
|
21
|
+
export function listsSet(lists: SurfaceAllowDeny | undefined): boolean {
|
|
22
|
+
return lists !== undefined && (lists.allow.length > 0 || lists.deny.length > 0)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Whether `lists` withhold `id`. A non-empty `allow` is a whitelist: it
|
|
27
|
+
* withholds every id outside it that it governs (`gated`: a whitelist only
|
|
28
|
+
* inverts over the ids an operator can see and set). `deny` withholds every
|
|
29
|
+
* id it names, governed or not, and wins over `allow`.
|
|
30
|
+
*/
|
|
31
|
+
export function listsWithhold(lists: SurfaceAllowDeny, id: string, gated: (id: string) => boolean): boolean {
|
|
32
|
+
if (lists.allow.length > 0 && gated(id) && !lists.allow.includes(id)) return true
|
|
33
|
+
return lists.deny.includes(id)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Node types an `allow` list never withholds by leaving them out, so only
|
|
38
|
+
* `deny` withholds them: the canvas's utility nodes (they cost nothing and run
|
|
39
|
+
* nothing, and a whitelist that forgot the sticky note must not take away the
|
|
40
|
+
* canvas's notes) and Site Capture (an install switch governs it). The
|
|
41
|
+
* platform's own registry is held to this list.
|
|
42
|
+
*/
|
|
43
|
+
export const ALLOW_LIST_EXEMPT_NODE_TYPES: readonly string[] = Object.freeze([
|
|
44
|
+
"collect",
|
|
45
|
+
"component",
|
|
46
|
+
"deduplicate",
|
|
47
|
+
"extract-field",
|
|
48
|
+
"filter-list",
|
|
49
|
+
"group",
|
|
50
|
+
"json-process",
|
|
51
|
+
"merge-lists",
|
|
52
|
+
"preview",
|
|
53
|
+
"router",
|
|
54
|
+
"selector",
|
|
55
|
+
"site-capture",
|
|
56
|
+
"sort-list",
|
|
57
|
+
"sticky-note",
|
|
58
|
+
"teleport-receive",
|
|
59
|
+
"teleport-send",
|
|
60
|
+
])
|
|
61
|
+
|
|
62
|
+
const EXEMPT: ReadonlySet<string> = new Set(ALLOW_LIST_EXEMPT_NODE_TYPES)
|
|
63
|
+
|
|
64
|
+
/** Whether a node whitelist governs `type`: every node type but {@link ALLOW_LIST_EXEMPT_NODE_TYPES}. */
|
|
65
|
+
export function isAllowListGatedNodeType(type: string): boolean {
|
|
66
|
+
return !EXEMPT.has(type)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Capabilities a `deny` of another node withholds too: a one-off voice clone
|
|
71
|
+
* inside a speech node is voice cloning behind another door, so a deployment
|
|
72
|
+
* that denies the Voice Clone node withholds it.
|
|
73
|
+
*/
|
|
74
|
+
const DENY_OF_NODE_WITHHOLDS: ReadonlyMap<string, string> = new Map([["voice-clone-one-off", "voice-clone"]])
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Whether a deployment's node lists withhold `type`: {@link listsWithhold}
|
|
78
|
+
* over the node types a whitelist governs, and a capability that follows a
|
|
79
|
+
* denied node. `gated` is the caller's universe; by default
|
|
80
|
+
* {@link isAllowListGatedNodeType}, which governs a type it has never heard of
|
|
81
|
+
* (a client then withholds it rather than offering it).
|
|
82
|
+
*/
|
|
83
|
+
export function nodeListsWithhold(nodes: SurfaceAllowDeny, type: string, gated: (type: string) => boolean = isAllowListGatedNodeType): boolean {
|
|
84
|
+
if (listsWithhold(nodes, type, gated)) return true
|
|
85
|
+
const follows = DENY_OF_NODE_WITHHOLDS.get(type)
|
|
86
|
+
return follows !== undefined && nodes.deny.includes(follows)
|
|
87
|
+
}
|
|
@@ -68,6 +68,16 @@ export function worldAllowed(worlds: SurfaceWorlds | undefined, id: string): boo
|
|
|
68
68
|
return worlds?.allow === undefined || worlds.allow.includes(id)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Whether a world is offered: the profile's allowlist lets it through and none
|
|
73
|
+
* of the node types it runs (`WORLD_REQUIRED_NODE_TYPES`) is withheld, as
|
|
74
|
+
* `nodeWithheld` judges them: the platform per viewer, or a client by the
|
|
75
|
+
* deployment's own lists (`nodeListsWithhold`) before the platform's answer.
|
|
76
|
+
*/
|
|
77
|
+
export function worldOffered(worlds: SurfaceWorlds | undefined, id: WorldId, nodeWithheld: (type: string) => boolean): boolean {
|
|
78
|
+
return worldAllowed(worlds, id) && !WORLD_REQUIRED_NODE_TYPES[id].some(nodeWithheld)
|
|
79
|
+
}
|
|
80
|
+
|
|
71
81
|
/** Every world, `order`'s known ids first (each once), then the rest in canonical order. */
|
|
72
82
|
export function orderWorlds(order?: readonly string[]): WorldId[] {
|
|
73
83
|
const out: WorldId[] = []
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/priced-clip-seconds.ts"],"names":[],"mappings":";;;AAeO,IAAM,oBAAA,GAAuB;AAOpC,IAAM,eAAA,GAAkB,IAAA;AAGjB,SAAS,kBAAkB,GAAA,EAAqB;AACrD,EAAA,OAAO,IAAA,CAAK,IAAI,CAAA,EAAG,IAAA,CAAK,KAAK,GAAA,GAAM,oBAAA,GAAuB,eAAe,CAAC,CAAA;AAC5E","file":"chunk-ALRXY4QH.cjs","sourcesContent":["/**\n * The whole seconds a clip is PRICED at by Video Depth (both providers), Video\n * Mask, Mask Composite and the face mesh: its length rounded up, after ignoring\n * up to {@link CLIP_PRICE_GRACE_SEC} past a whole second.\n *\n * A whole-second cut of a 29.97 or 23.976 fps clip can come out a little long:\n * 12 s is 360 frames, a 12.012 s file. A quote reads the cut, a run measures the\n * file, and both land on the same row through this one rule, wherever those steps\n * are reserved, charged or quoted.\n *\n * It decides the price only. Each step's limits (the 300 s cap, the frame cap)\n * read the clip's real length. Other models round as they always have.\n */\n\n/** How far past a whole second a clip is still priced as that second. */\nexport const CLIP_PRICE_GRACE_SEC = 0.05\n\n/**\n * Float noise: a length that is arithmetic can land a hair past the edge, and\n * must not round up for it. 1.35 s at 90 fps, priced at the 30 fps basis, is\n * 4.050000000000001: 4, not 5.\n */\nconst FLOAT_NOISE_SEC = 1e-9\n\n/** At least one second. The caller has checked that `sec` is a real length. */\nexport function pricedClipSeconds(sec: number): number {\n return Math.max(1, Math.ceil(sec - CLIP_PRICE_GRACE_SEC - FLOAT_NOISE_SEC))\n}\n"]}
|