@clipwright/core 0.76.0 → 0.77.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/creator-profile.js +1 -1
- package/dist/design.js +1 -1
- package/dist/faceless-price.d.ts +0 -1
- package/dist/faceless-price.js +0 -1
- package/dist/openapi.js +25 -25
- package/package.json +1 -1
- package/dist/faceless-image-qualification.d.ts +0 -97
- package/dist/faceless-image-qualification.js +0 -143
package/dist/creator-profile.js
CHANGED
|
@@ -141,7 +141,7 @@ export const creatorProfile = z.strictObject({
|
|
|
141
141
|
median_comment_rate: z.number().nonnegative().nullable().describe("The median comment_rate of the videos with both counts, four decimals; null " +
|
|
142
142
|
`under ${CREATOR_COMMENT_NORM_MIN_VIDEOS} such videos.`),
|
|
143
143
|
cadence: cadenceShape,
|
|
144
|
-
voice_proposal: scriptVoice.optional().describe("A script voice proposed from the author's own captions
|
|
144
|
+
voice_proposal: scriptVoice.optional().describe("A script voice proposed from the author's own captions: their topics and a closing " +
|
|
145
145
|
"line they repeat. Third-party text, not saved until passed to brand_kit; it suits only this author's own brand kit."),
|
|
146
146
|
});
|
|
147
147
|
const measuredProfile = z.object({
|
package/dist/design.js
CHANGED
|
@@ -149,7 +149,7 @@ export const extractBrandResponse = z.object({
|
|
|
149
149
|
url: z.string(),
|
|
150
150
|
design: design,
|
|
151
151
|
resolved: resolvedDesign,
|
|
152
|
-
voice: scriptVoice.optional().describe("A proposed script voice read from the page's own words
|
|
152
|
+
voice: scriptVoice.optional().describe("A proposed script voice read from the page's own words: third-party text, not " +
|
|
153
153
|
"saved until passed to brand_kit."),
|
|
154
154
|
brand_name: brandName.optional().describe("A proposed brand name read from the page: third-party text, not saved until passed to " +
|
|
155
155
|
"brand_kit."),
|
package/dist/faceless-price.d.ts
CHANGED
|
@@ -85,7 +85,6 @@ export declare const FACELESS_MIN_BASE_CREDITS = 50;
|
|
|
85
85
|
export declare const FACELESS_SHOT_CREDITS_PER_SECOND = 30;
|
|
86
86
|
export declare const FACELESS_MAX_SHOTS = 10;
|
|
87
87
|
export declare const FACELESS_SHOT_MAX_SEC = 5;
|
|
88
|
-
export declare const FACELESS_MAX_CAP_USD_MICROS = 10000000;
|
|
89
88
|
export declare const facelessShotSecondsCeiling: (shots: number) => number;
|
|
90
89
|
export declare function facelessPartsBase(images: number, outputFrames: number): number;
|
|
91
90
|
export declare const FACELESS_EXPLAINER_POSE_PICTURES = 9;
|
package/dist/faceless-price.js
CHANGED
|
@@ -56,7 +56,6 @@ export const FACELESS_MIN_BASE_CREDITS = DELIVERED_VIDEO_MINIMUM_CREDITS;
|
|
|
56
56
|
export const FACELESS_SHOT_CREDITS_PER_SECOND = 30;
|
|
57
57
|
export const FACELESS_MAX_SHOTS = 10;
|
|
58
58
|
export const FACELESS_SHOT_MAX_SEC = 5;
|
|
59
|
-
export const FACELESS_MAX_CAP_USD_MICROS = 10_000_000;
|
|
60
59
|
export const facelessShotSecondsCeiling = (shots) => shots * FACELESS_SHOT_MAX_SEC;
|
|
61
60
|
export function facelessPartsBase(images, outputFrames) {
|
|
62
61
|
return images * FACELESS_IMAGE_CREDITS + Math.ceil(FACELESS_CREDITS_PER_1500_FRAMES * outputFrames / 1500);
|
package/dist/openapi.js
CHANGED
|
@@ -161,25 +161,25 @@ export const OPENAPI_ROUTES = {
|
|
|
161
161
|
"POST /v1/assets/{id}": { exposure: "public", operationId: "updateAsset", tag: "Assets", params: ASSET,
|
|
162
162
|
body: named("UpdateAssetRequest", updateAssetRequest), responses: { 200: named("Asset", asset) } },
|
|
163
163
|
"DELETE /v1/assets/{id}": { exposure: "public", operationId: "deleteAsset", tag: "Assets", params: ASSET, responses: { 204: null } },
|
|
164
|
-
"POST /v1/film-drafts": { exposure: "excluded", reason: "Not offered yet: film drafts join the contract when their mode launches
|
|
165
|
-
"POST /v1/film-drafts/{id}/files": { exposure: "excluded", reason: "Not offered yet: film drafts join the contract when their mode launches
|
|
166
|
-
"GET /v1/film-drafts/{id}": { exposure: "excluded", reason: "Not offered yet: film drafts join the contract when their mode launches
|
|
167
|
-
"POST /v1/film-drafts/{id}/check": { exposure: "excluded", reason: "Not offered yet: the film check joins the contract with the drafts it reads
|
|
168
|
-
"POST /v1/film-stills/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
169
|
-
"POST /v1/film-stills": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
170
|
-
"POST /v1/film-voices/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
171
|
-
"POST /v1/film-voices": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
172
|
-
"POST /v1/film-renders/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
173
|
-
"POST /v1/film-renders": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
174
|
-
"POST /v1/film-heroes/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
175
|
-
"POST /v1/film-heroes": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
176
|
-
"POST /v1/film-edits/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
177
|
-
"POST /v1/film-edits": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
178
|
-
"POST /v1/take-frames/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
179
|
-
"POST /v1/take-frames": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
180
|
-
"POST /v1/take-checks/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
181
|
-
"POST /v1/take-checks": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
182
|
-
"GET /v1/film-runs/{id}": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches
|
|
164
|
+
"POST /v1/film-drafts": { exposure: "excluded", reason: "Not offered yet: film drafts join the contract when their mode launches." },
|
|
165
|
+
"POST /v1/film-drafts/{id}/files": { exposure: "excluded", reason: "Not offered yet: film drafts join the contract when their mode launches." },
|
|
166
|
+
"GET /v1/film-drafts/{id}": { exposure: "excluded", reason: "Not offered yet: film drafts join the contract when their mode launches." },
|
|
167
|
+
"POST /v1/film-drafts/{id}/check": { exposure: "excluded", reason: "Not offered yet: the film check joins the contract with the drafts it reads." },
|
|
168
|
+
"POST /v1/film-stills/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
169
|
+
"POST /v1/film-stills": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
170
|
+
"POST /v1/film-voices/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
171
|
+
"POST /v1/film-voices": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
172
|
+
"POST /v1/film-renders/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
173
|
+
"POST /v1/film-renders": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
174
|
+
"POST /v1/film-heroes/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
175
|
+
"POST /v1/film-heroes": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
176
|
+
"POST /v1/film-edits/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
177
|
+
"POST /v1/film-edits": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
178
|
+
"POST /v1/take-frames/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
179
|
+
"POST /v1/take-frames": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
180
|
+
"POST /v1/take-checks/quote": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
181
|
+
"POST /v1/take-checks": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
182
|
+
"GET /v1/film-runs/{id}": { exposure: "excluded", reason: "Not offered yet: film runs join the contract when their mode launches." },
|
|
183
183
|
"POST /v1/film-cuts/check": { exposure: "excluded", reason: "Offered through MCP (check_cut)." },
|
|
184
184
|
"POST /v1/film-cuts/quote": { exposure: "excluded", reason: "Offered through MCP (quote_cut, render_cut)." },
|
|
185
185
|
"POST /v1/film-cuts": { exposure: "excluded", reason: "Offered through MCP (quote_cut, render_cut)." },
|
|
@@ -188,12 +188,12 @@ export const OPENAPI_ROUTES = {
|
|
|
188
188
|
"POST /v1/cuts": { exposure: "excluded", reason: "Offered through MCP (create_cut, get_cut, update_cut)." },
|
|
189
189
|
"POST /v1/cuts/{id}": { exposure: "excluded", reason: "Offered through MCP (create_cut, get_cut, update_cut)." },
|
|
190
190
|
"GET /v1/cuts/{id}": { exposure: "excluded", reason: "Offered through MCP (create_cut, get_cut, update_cut)." },
|
|
191
|
-
"GET /v1/film-guide": { exposure: "excluded", reason: "Not offered yet: the film guide joins the contract when its mode launches
|
|
192
|
-
"GET /v1/film-kit": { exposure: "excluded", reason: "Not offered yet: the film kit joins the contract when its mode launches
|
|
193
|
-
"GET /v1/ad-guide": { exposure: "excluded", reason: "Not offered yet: the ad guide joins the contract when it opens to every account
|
|
194
|
-
"POST /v1/ads": { exposure: "excluded", reason: "Not offered yet: ad records join the contract with the ad guide, when it opens to every account
|
|
195
|
-
"POST /v1/ads/{id}": { exposure: "excluded", reason: "Not offered yet: ad records join the contract with the ad guide, when it opens to every account
|
|
196
|
-
"GET /v1/ads/{id}": { exposure: "excluded", reason: "Not offered yet: ad records join the contract with the ad guide, when it opens to every account
|
|
191
|
+
"GET /v1/film-guide": { exposure: "excluded", reason: "Not offered yet: the film guide joins the contract when its mode launches." },
|
|
192
|
+
"GET /v1/film-kit": { exposure: "excluded", reason: "Not offered yet: the film kit joins the contract when its mode launches." },
|
|
193
|
+
"GET /v1/ad-guide": { exposure: "excluded", reason: "Not offered yet: the ad guide joins the contract when it opens to every account." },
|
|
194
|
+
"POST /v1/ads": { exposure: "excluded", reason: "Not offered yet: ad records join the contract with the ad guide, when it opens to every account." },
|
|
195
|
+
"POST /v1/ads/{id}": { exposure: "excluded", reason: "Not offered yet: ad records join the contract with the ad guide, when it opens to every account." },
|
|
196
|
+
"GET /v1/ads/{id}": { exposure: "excluded", reason: "Not offered yet: ad records join the contract with the ad guide, when it opens to every account." },
|
|
197
197
|
"GET /internal/portfolio-metrics": { exposure: "excluded",
|
|
198
198
|
reason: "Internal funnel aggregates behind their own secret, outside the client contract (docs/03-api.md section 12)." },
|
|
199
199
|
"GET /v1/public/workflows": { exposure: "public", operationId: "listWorkflows", tag: "Workflows", anonymous: true,
|
package/package.json
CHANGED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const plan: z.ZodObject<{
|
|
3
|
-
version: z.ZodLiteral<"faceless_image_v1">;
|
|
4
|
-
script: z.ZodString;
|
|
5
|
-
aspectRatio: z.ZodLiteral<"9:16">;
|
|
6
|
-
resolution: z.ZodLiteral<"1080p">;
|
|
7
|
-
brollPolicy: z.ZodEnum<{
|
|
8
|
-
anyone: "anyone";
|
|
9
|
-
no_actor: "no_actor";
|
|
10
|
-
no_people: "no_people";
|
|
11
|
-
}>;
|
|
12
|
-
assets: z.ZodArray<z.ZodObject<{
|
|
13
|
-
id: z.ZodString;
|
|
14
|
-
role: z.ZodEnum<{
|
|
15
|
-
character: "character";
|
|
16
|
-
scene: "scene";
|
|
17
|
-
style: "style";
|
|
18
|
-
}>;
|
|
19
|
-
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
20
|
-
kind: z.ZodLiteral<"supplied">;
|
|
21
|
-
url: z.ZodURL;
|
|
22
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
23
|
-
kind: z.ZodLiteral<"generated">;
|
|
24
|
-
prompt: z.ZodString;
|
|
25
|
-
styleId: z.ZodOptional<z.ZodString>;
|
|
26
|
-
characterIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
-
}, z.core.$strict>], "kind">;
|
|
28
|
-
}, z.core.$strict>>;
|
|
29
|
-
scenes: z.ZodArray<z.ZodObject<{
|
|
30
|
-
id: z.ZodString;
|
|
31
|
-
assetId: z.ZodString;
|
|
32
|
-
durationFrames: z.ZodNumber;
|
|
33
|
-
motion: z.ZodOptional<z.ZodObject<{
|
|
34
|
-
direction: z.ZodEnum<{
|
|
35
|
-
in: "in";
|
|
36
|
-
out: "out";
|
|
37
|
-
}>;
|
|
38
|
-
amount: z.ZodNumber;
|
|
39
|
-
}, z.core.$strict>>;
|
|
40
|
-
}, z.core.$strict>>;
|
|
41
|
-
}, z.core.$strict>;
|
|
42
|
-
export type FacelessImagePlan = z.infer<typeof plan>;
|
|
43
|
-
export declare function parseFacelessImagePlan(input: unknown): FacelessImagePlan;
|
|
44
|
-
export declare function quoteFacelessImage(input: unknown): {
|
|
45
|
-
pricingVersion: "faceless-image-v1-shadow";
|
|
46
|
-
aspectRatio: "9:16";
|
|
47
|
-
resolution: "1080p";
|
|
48
|
-
outputFrames: number;
|
|
49
|
-
outputSeconds: number;
|
|
50
|
-
credits: number;
|
|
51
|
-
customerCreditCeiling: number;
|
|
52
|
-
baseGeneratedImages: number;
|
|
53
|
-
maxGeneratedImages: number;
|
|
54
|
-
retryHeadroom: number;
|
|
55
|
-
costBreakdown: {
|
|
56
|
-
generatedImages: {
|
|
57
|
-
status: "unmeasured";
|
|
58
|
-
usd: null;
|
|
59
|
-
exposureBasis: "hypothetical_two_attempts_per_generated_asset_within_shared_allowance";
|
|
60
|
-
maxPaidAttemptsPerAsset: number;
|
|
61
|
-
maxPaidImageCalls: number;
|
|
62
|
-
};
|
|
63
|
-
tts: {
|
|
64
|
-
status: "unmeasured";
|
|
65
|
-
usd: null;
|
|
66
|
-
};
|
|
67
|
-
rendering: {
|
|
68
|
-
status: "unmeasured";
|
|
69
|
-
usd: null;
|
|
70
|
-
};
|
|
71
|
-
storage: {
|
|
72
|
-
status: "unmeasured";
|
|
73
|
-
usd: null;
|
|
74
|
-
};
|
|
75
|
-
paymentFees: {
|
|
76
|
-
status: "unmeasured";
|
|
77
|
-
usd: null;
|
|
78
|
-
};
|
|
79
|
-
paidFailures: {
|
|
80
|
-
status: "unmeasured";
|
|
81
|
-
usd: null;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
totalCostUsd: null;
|
|
85
|
-
contributionMargin: null;
|
|
86
|
-
costQualified: boolean;
|
|
87
|
-
marginQualified: boolean;
|
|
88
|
-
sceneCount: number;
|
|
89
|
-
sceneSources: {
|
|
90
|
-
sceneId: string;
|
|
91
|
-
assetId: string;
|
|
92
|
-
sourceKind: "generated" | "supplied";
|
|
93
|
-
}[];
|
|
94
|
-
maxPaidAttempts: 0;
|
|
95
|
-
maxUsdSpend: 0;
|
|
96
|
-
};
|
|
97
|
-
export {};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { brollPolicy } from "./broll-policy.js";
|
|
3
|
-
import { CANVAS_FPS } from "./media-timebase.js";
|
|
4
|
-
import { MAX_URL_LENGTH } from "./skills.js";
|
|
5
|
-
import { DEFAULT_TTS_MODEL, speechTextFor, TTS_MODEL_CHAR_CAP } from "./voices.js";
|
|
6
|
-
const id = z.string().min(1);
|
|
7
|
-
const suppliedSource = z.strictObject({
|
|
8
|
-
kind: z.literal("supplied"),
|
|
9
|
-
url: z.url().max(MAX_URL_LENGTH).refine(url => {
|
|
10
|
-
const source = new URL(url);
|
|
11
|
-
return source.protocol === "https:" && /\.(png|jpe?g)$/i.test(source.pathname);
|
|
12
|
-
}, "supplied image URL must use HTTPS with a PNG or JPEG path suffix"),
|
|
13
|
-
});
|
|
14
|
-
const generatedSource = z.strictObject({
|
|
15
|
-
kind: z.literal("generated"),
|
|
16
|
-
prompt: z.string().trim().min(1),
|
|
17
|
-
styleId: id.optional(),
|
|
18
|
-
characterIds: z.array(id).optional(),
|
|
19
|
-
});
|
|
20
|
-
const asset = z.strictObject({
|
|
21
|
-
id,
|
|
22
|
-
role: z.enum(["scene", "style", "character"]),
|
|
23
|
-
source: z.discriminatedUnion("kind", [suppliedSource, generatedSource]),
|
|
24
|
-
});
|
|
25
|
-
const scene = z.strictObject({
|
|
26
|
-
id,
|
|
27
|
-
assetId: id,
|
|
28
|
-
durationFrames: z.number().int().positive().refine(Number.isSafeInteger, "durationFrames must be a safe integer"),
|
|
29
|
-
motion: z.strictObject({ direction: z.enum(["in", "out"]), amount: z.number().min(0).lt(1) }).optional(),
|
|
30
|
-
});
|
|
31
|
-
const plan = z.strictObject({
|
|
32
|
-
version: z.literal("faceless_image_v1"),
|
|
33
|
-
script: z.string().trim().min(1).refine(text => speechTextFor(text, DEFAULT_TTS_MODEL).length <= TTS_MODEL_CHAR_CAP[DEFAULT_TTS_MODEL], `script exceeds ${DEFAULT_TTS_MODEL} limit of ${TTS_MODEL_CHAR_CAP[DEFAULT_TTS_MODEL]} characters after stress normalization`),
|
|
34
|
-
aspectRatio: z.literal("9:16"),
|
|
35
|
-
resolution: z.literal("1080p"),
|
|
36
|
-
brollPolicy,
|
|
37
|
-
assets: z.array(asset).min(1),
|
|
38
|
-
scenes: z.array(scene).min(1).max(100),
|
|
39
|
-
});
|
|
40
|
-
export function parseFacelessImagePlan(input) {
|
|
41
|
-
const parsed = plan.parse(input);
|
|
42
|
-
const assets = new Map();
|
|
43
|
-
for (const entry of parsed.assets) {
|
|
44
|
-
if (assets.has(entry.id))
|
|
45
|
-
throw new Error(`duplicate faceless IMAGE asset ID: ${entry.id}`);
|
|
46
|
-
if (entry.role !== "scene" && entry.source.kind === "generated" &&
|
|
47
|
-
(entry.source.styleId !== undefined || entry.source.characterIds !== undefined)) {
|
|
48
|
-
throw new Error(`faceless IMAGE references belong on scene assets: ${entry.id}`);
|
|
49
|
-
}
|
|
50
|
-
assets.set(entry.id, entry);
|
|
51
|
-
}
|
|
52
|
-
const used = new Set();
|
|
53
|
-
const sceneIds = new Set();
|
|
54
|
-
let sharedStyleId;
|
|
55
|
-
for (const entry of parsed.scenes) {
|
|
56
|
-
if (sceneIds.has(entry.id))
|
|
57
|
-
throw new Error(`duplicate faceless IMAGE scene ID: ${entry.id}`);
|
|
58
|
-
sceneIds.add(entry.id);
|
|
59
|
-
const image = assets.get(entry.assetId);
|
|
60
|
-
if (image?.role !== "scene")
|
|
61
|
-
throw new Error(`faceless IMAGE scene asset missing or wrong role: ${entry.assetId}`);
|
|
62
|
-
used.add(image.id);
|
|
63
|
-
if (image.source.kind === "generated") {
|
|
64
|
-
const style = image.source.styleId === undefined ? undefined : assets.get(image.source.styleId);
|
|
65
|
-
if (style?.role !== "style")
|
|
66
|
-
throw new Error(`faceless IMAGE style asset missing or wrong role: ${image.id}`);
|
|
67
|
-
if (sharedStyleId !== undefined && sharedStyleId !== style.id)
|
|
68
|
-
throw new Error("faceless IMAGE scenes require one shared style anchor");
|
|
69
|
-
sharedStyleId = style.id;
|
|
70
|
-
used.add(style.id);
|
|
71
|
-
const characters = image.source.characterIds ?? [];
|
|
72
|
-
if (parsed.brollPolicy !== "anyone" && characters.length > 0)
|
|
73
|
-
throw new Error("character references require the anyone policy");
|
|
74
|
-
if (new Set(characters).size !== characters.length)
|
|
75
|
-
throw new Error(`duplicate character reference: ${image.id}`);
|
|
76
|
-
for (const characterId of characters) {
|
|
77
|
-
const character = assets.get(characterId);
|
|
78
|
-
if (character?.role !== "character")
|
|
79
|
-
throw new Error(`faceless IMAGE character asset missing or wrong role: ${characterId}`);
|
|
80
|
-
used.add(characterId);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
for (const entry of parsed.assets) {
|
|
85
|
-
if (!used.has(entry.id))
|
|
86
|
-
throw new Error(`unreferenced faceless IMAGE asset: ${entry.id}`);
|
|
87
|
-
}
|
|
88
|
-
const outputFrames = parsed.scenes.reduce((sum, entry) => sum + entry.durationFrames, 0);
|
|
89
|
-
if (!Number.isSafeInteger(outputFrames) || outputFrames > 300 * CANVAS_FPS)
|
|
90
|
-
throw new Error("faceless IMAGE exceeds 300 seconds");
|
|
91
|
-
const maxGeneratedImages = Math.floor((24 * outputFrames) / (60 * CANVAS_FPS));
|
|
92
|
-
const baseGeneratedImages = parsed.assets.filter(entry => entry.source.kind === "generated").length;
|
|
93
|
-
if (baseGeneratedImages > maxGeneratedImages)
|
|
94
|
-
throw new Error("faceless IMAGE exceeds generated image allowance");
|
|
95
|
-
return parsed;
|
|
96
|
-
}
|
|
97
|
-
export function quoteFacelessImage(input) {
|
|
98
|
-
const parsed = parseFacelessImagePlan(input);
|
|
99
|
-
const outputFrames = parsed.scenes.reduce((sum, entry) => sum + entry.durationFrames, 0);
|
|
100
|
-
const maxGeneratedImages = Math.floor((24 * outputFrames) / (60 * CANVAS_FPS));
|
|
101
|
-
const baseGeneratedImages = parsed.assets.filter(entry => entry.source.kind === "generated").length;
|
|
102
|
-
const raw = (180n * BigInt(outputFrames) + BigInt(60 * CANVAS_FPS - 1)) / BigInt(60 * CANVAS_FPS);
|
|
103
|
-
const credits = Number(raw > 200n ? raw : 200n);
|
|
104
|
-
const assetById = new Map(parsed.assets.map(entry => [entry.id, entry]));
|
|
105
|
-
return {
|
|
106
|
-
pricingVersion: "faceless-image-v1-shadow",
|
|
107
|
-
aspectRatio: parsed.aspectRatio,
|
|
108
|
-
resolution: parsed.resolution,
|
|
109
|
-
outputFrames,
|
|
110
|
-
outputSeconds: outputFrames / CANVAS_FPS,
|
|
111
|
-
credits,
|
|
112
|
-
customerCreditCeiling: credits,
|
|
113
|
-
baseGeneratedImages,
|
|
114
|
-
maxGeneratedImages,
|
|
115
|
-
retryHeadroom: maxGeneratedImages - baseGeneratedImages,
|
|
116
|
-
costBreakdown: {
|
|
117
|
-
generatedImages: {
|
|
118
|
-
status: "unmeasured",
|
|
119
|
-
usd: null,
|
|
120
|
-
exposureBasis: "hypothetical_two_attempts_per_generated_asset_within_shared_allowance",
|
|
121
|
-
maxPaidAttemptsPerAsset: 2,
|
|
122
|
-
maxPaidImageCalls: Math.min(maxGeneratedImages, 2 * baseGeneratedImages),
|
|
123
|
-
},
|
|
124
|
-
tts: { status: "unmeasured", usd: null },
|
|
125
|
-
rendering: { status: "unmeasured", usd: null },
|
|
126
|
-
storage: { status: "unmeasured", usd: null },
|
|
127
|
-
paymentFees: { status: "unmeasured", usd: null },
|
|
128
|
-
paidFailures: { status: "unmeasured", usd: null },
|
|
129
|
-
},
|
|
130
|
-
totalCostUsd: null,
|
|
131
|
-
contributionMargin: null,
|
|
132
|
-
costQualified: false,
|
|
133
|
-
marginQualified: false,
|
|
134
|
-
sceneCount: parsed.scenes.length,
|
|
135
|
-
sceneSources: parsed.scenes.map(entry => ({
|
|
136
|
-
sceneId: entry.id,
|
|
137
|
-
assetId: entry.assetId,
|
|
138
|
-
sourceKind: assetById.get(entry.assetId).source.kind,
|
|
139
|
-
})),
|
|
140
|
-
maxPaidAttempts: 0,
|
|
141
|
-
maxUsdSpend: 0,
|
|
142
|
-
};
|
|
143
|
-
}
|