@clipwright/core 0.79.0 → 0.81.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/contracts/v1/workflow-execution.d.ts +54 -0
- package/dist/contracts/v1/workflow-next.d.ts +27 -0
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -0
- package/dist/faceless-public.d.ts +27 -0
- package/dist/faceless-public.js +3 -0
- package/dist/faceless-route-estimate.d.ts +82 -0
- package/dist/faceless-route-estimate.js +102 -0
- package/dist/faceless-routes.d.ts +15 -0
- package/dist/faceless-routes.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/own-agent-price.d.ts +9 -3
- package/dist/own-agent-price.js +18 -5
- package/dist/own-agent-runs.d.ts +6 -2
- package/dist/own-agent-runs.js +11 -4
- package/dist/prices.js +3 -2
- package/dist/reference-display.js +3 -1
- package/dist/skills.d.ts +2 -2
- package/dist/skills.js +23 -15
- package/dist/speech-words.d.ts +2 -0
- package/dist/speech-words.js +70 -0
- package/dist/voice-admission.d.ts +1 -0
- package/package.json +1 -1
|
@@ -235,6 +235,33 @@ export declare const workflowQuoteBinding: z.ZodObject<{
|
|
|
235
235
|
standard: z.ZodNumber;
|
|
236
236
|
pro: z.ZodNumber;
|
|
237
237
|
}, z.core.$strict>>;
|
|
238
|
+
alternatives: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
239
|
+
route: z.ZodEnum<{
|
|
240
|
+
cartoon: "cartoon";
|
|
241
|
+
explainer: "explainer";
|
|
242
|
+
pictures: "pictures";
|
|
243
|
+
}>;
|
|
244
|
+
available: z.ZodBoolean;
|
|
245
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
246
|
+
from: z.ZodNumber;
|
|
247
|
+
parts: z.ZodArray<z.ZodObject<{
|
|
248
|
+
part: z.ZodString;
|
|
249
|
+
count: z.ZodNumber;
|
|
250
|
+
credits_each: z.ZodNumber;
|
|
251
|
+
quote_tool: z.ZodString;
|
|
252
|
+
}, z.core.$strict>>;
|
|
253
|
+
add_ons: z.ZodArray<z.ZodObject<{
|
|
254
|
+
part: z.ZodString;
|
|
255
|
+
credits_each: z.ZodNumber;
|
|
256
|
+
quote_tool: z.ZodString;
|
|
257
|
+
}, z.core.$strict>>;
|
|
258
|
+
looks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
259
|
+
id: z.ZodString;
|
|
260
|
+
name: z.ZodString;
|
|
261
|
+
sample: z.ZodURL;
|
|
262
|
+
}, z.core.$strict>>>;
|
|
263
|
+
note: z.ZodString;
|
|
264
|
+
}, z.core.$strict>>>;
|
|
238
265
|
warnings: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
239
266
|
contract_version: z.ZodString;
|
|
240
267
|
}, z.core.$strict>;
|
|
@@ -457,6 +484,33 @@ export declare const workflowQuoteBindingRead: z.ZodObject<{
|
|
|
457
484
|
standard: z.ZodNumber;
|
|
458
485
|
pro: z.ZodNumber;
|
|
459
486
|
}, z.core.$strict>>;
|
|
487
|
+
alternatives: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
488
|
+
route: z.ZodEnum<{
|
|
489
|
+
cartoon: "cartoon";
|
|
490
|
+
explainer: "explainer";
|
|
491
|
+
pictures: "pictures";
|
|
492
|
+
}>;
|
|
493
|
+
available: z.ZodBoolean;
|
|
494
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
495
|
+
from: z.ZodNumber;
|
|
496
|
+
parts: z.ZodArray<z.ZodObject<{
|
|
497
|
+
part: z.ZodString;
|
|
498
|
+
count: z.ZodNumber;
|
|
499
|
+
credits_each: z.ZodNumber;
|
|
500
|
+
quote_tool: z.ZodString;
|
|
501
|
+
}, z.core.$strict>>;
|
|
502
|
+
add_ons: z.ZodArray<z.ZodObject<{
|
|
503
|
+
part: z.ZodString;
|
|
504
|
+
credits_each: z.ZodNumber;
|
|
505
|
+
quote_tool: z.ZodString;
|
|
506
|
+
}, z.core.$strict>>;
|
|
507
|
+
looks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
508
|
+
id: z.ZodString;
|
|
509
|
+
name: z.ZodString;
|
|
510
|
+
sample: z.ZodURL;
|
|
511
|
+
}, z.core.$strict>>>;
|
|
512
|
+
note: z.ZodString;
|
|
513
|
+
}, z.core.$strict>>>;
|
|
460
514
|
warnings: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
461
515
|
contract_version: z.ZodString;
|
|
462
516
|
tariffId: z.ZodString;
|
|
@@ -229,6 +229,33 @@ export declare const workflowQuoteAnswer: z.ZodObject<{
|
|
|
229
229
|
standard: z.ZodNumber;
|
|
230
230
|
pro: z.ZodNumber;
|
|
231
231
|
}, z.core.$strict>>;
|
|
232
|
+
alternatives: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
233
|
+
route: z.ZodEnum<{
|
|
234
|
+
cartoon: "cartoon";
|
|
235
|
+
explainer: "explainer";
|
|
236
|
+
pictures: "pictures";
|
|
237
|
+
}>;
|
|
238
|
+
available: z.ZodBoolean;
|
|
239
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
240
|
+
from: z.ZodNumber;
|
|
241
|
+
parts: z.ZodArray<z.ZodObject<{
|
|
242
|
+
part: z.ZodString;
|
|
243
|
+
count: z.ZodNumber;
|
|
244
|
+
credits_each: z.ZodNumber;
|
|
245
|
+
quote_tool: z.ZodString;
|
|
246
|
+
}, z.core.$strict>>;
|
|
247
|
+
add_ons: z.ZodArray<z.ZodObject<{
|
|
248
|
+
part: z.ZodString;
|
|
249
|
+
credits_each: z.ZodNumber;
|
|
250
|
+
quote_tool: z.ZodString;
|
|
251
|
+
}, z.core.$strict>>;
|
|
252
|
+
looks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
253
|
+
id: z.ZodString;
|
|
254
|
+
name: z.ZodString;
|
|
255
|
+
sample: z.ZodURL;
|
|
256
|
+
}, z.core.$strict>>>;
|
|
257
|
+
note: z.ZodString;
|
|
258
|
+
}, z.core.$strict>>>;
|
|
232
259
|
warnings: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
233
260
|
contract_version: z.ZodString;
|
|
234
261
|
}, z.core.$strict>;
|
package/dist/errors.d.ts
CHANGED
|
@@ -246,7 +246,7 @@ export type EditCeilingReachedError = z.infer<typeof editCeilingReachedError>;
|
|
|
246
246
|
export declare function editCeilingReachedBody(args: Omit<EditCeilingReachedError["error"], "code" | "message">, counting?: "revision" | "candidate"): EditCeilingReachedError;
|
|
247
247
|
export declare function unusableSourceMessage(errorClass: string, detail: string): string;
|
|
248
248
|
export declare const MALFORMED_BODY_MESSAGE: string;
|
|
249
|
-
declare const BARE_ERROR_CODES: readonly ["analysis_enqueue_failed", "aspect_conflict", "actor_unavailable", "actor_format_unavailable", "actor_storage_unavailable", "actor_generation_disabled", "actor_in_use", "ad_limited", "ad_not_found", "ad_slot_in_use", "ad_slot_unchecked", "asset_cap_exceeded", "asset_ingest_cap_exceeded", "asset_not_found", "asset_not_ready", "assets_disabled", "creator_profile_limited", "creator_profile_not_found", "creator_url_unsupported", "cut_busy", "cut_limited", "cut_not_found", "cut_preview_limited", "cut_slot_in_use", "deletion_held", "editing_window_not_set", "explainer_busy", "feedback_limited", "film_asset_not_ready", "film_draft_limited", "film_draft_not_found", "film_draft_stale", "film_hero_limited", "film_run_not_found", "film_voice_not_ready", "generations_disabled", "generations_marking_pending", "idempotency_key_required", "idempotency_key_reused", "ingest_enqueue_failed", "insufficient_scope", "internal_error", "invalid_image", "invalid_request", "malformed_body", "no_changes", "not_found", "own_agent_disabled", "own_agent_marking_pending", "paid_render_disabled", "payload_too_large", "reference_analysis_disabled", "reference_analysis_limited", "reference_analysis_not_found", "reference_not_analyzable", "reference_not_usable", "reference_url_unsupported", "revision_needs_generated_unit", "rights_not_confirmed", "run_media_in_use", "run_not_finished", "run_not_found", "source_aspect_mismatch", "source_not_usable", "take_check_limited", "take_frames_limited", "trend_page_unavailable", "trend_search_limited", "trend_search_not_found", "trends_unavailable", "trial_excludes_generation", "unauthorized", "unsupported_combination", "unsupported_media_type", "unusable_source", "upload_cap_exceeded", "upload_digest_mismatch", "upload_expired", "upload_in_use", "upload_not_finished", "upload_page_rate_limited", "upload_page_used", "upload_size_mismatch", "upstream_error", "url_fetch_busy", "url_fetch_failed", "url_fetch_rate_limited", "url_fetch_refused", "url_import_disabled"];
|
|
249
|
+
declare const BARE_ERROR_CODES: readonly ["analysis_enqueue_failed", "aspect_conflict", "actor_unavailable", "actor_format_unavailable", "actor_storage_unavailable", "actor_generation_disabled", "actor_in_use", "ad_limited", "ad_not_found", "ad_slot_in_use", "ad_slot_unchecked", "asset_cap_exceeded", "asset_ingest_cap_exceeded", "asset_not_found", "asset_not_ready", "assets_disabled", "creator_profile_limited", "creator_profile_not_found", "creator_url_unsupported", "cut_busy", "cut_limited", "cut_not_found", "cut_preview_limited", "cut_slot_in_use", "deletion_held", "editing_window_not_set", "explainer_busy", "feedback_limited", "film_asset_not_ready", "film_draft_limited", "film_draft_not_found", "film_draft_stale", "film_hero_limited", "film_run_not_found", "film_voice_not_ready", "generations_disabled", "generations_marking_pending", "idempotency_key_required", "idempotency_key_reused", "ingest_enqueue_failed", "insufficient_scope", "internal_error", "invalid_image", "invalid_request", "malformed_body", "no_changes", "not_found", "own_agent_disabled", "own_agent_marking_pending", "paid_render_disabled", "payload_too_large", "reference_analysis_disabled", "reference_analysis_limited", "reference_analysis_not_found", "reference_not_analyzable", "reference_not_usable", "reference_url_unsupported", "revision_needs_generated_unit", "rights_not_confirmed", "run_media_in_use", "run_not_finished", "run_not_found", "source_aspect_mismatch", "source_not_usable", "take_check_limited", "take_frames_limited", "trend_page_unavailable", "trend_search_limited", "trend_search_not_found", "trends_unavailable", "trial_excludes_generation", "unauthorized", "unsupported_combination", "unsupported_media_type", "unusable_source", "upload_cap_exceeded", "upload_digest_mismatch", "upload_expired", "upload_in_use", "upload_not_finished", "upload_page_rate_limited", "upload_page_used", "upload_size_mismatch", "upstream_error", "url_fetch_busy", "url_fetch_failed", "url_fetch_rate_limited", "url_fetch_refused", "url_import_disabled", "voice_busy"];
|
|
250
250
|
export type BareApiErrorCode = (typeof BARE_ERROR_CODES)[number];
|
|
251
251
|
export declare const API_ERROR_CODES: readonly string[];
|
|
252
252
|
export declare function apiErrorBody(args: {
|
package/dist/errors.js
CHANGED
|
@@ -7339,6 +7339,33 @@ export declare const facelessQuoteResponse: z.ZodObject<{
|
|
|
7339
7339
|
standard: z.ZodNumber;
|
|
7340
7340
|
pro: z.ZodNumber;
|
|
7341
7341
|
}, z.core.$strict>>;
|
|
7342
|
+
alternatives: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7343
|
+
route: z.ZodEnum<{
|
|
7344
|
+
cartoon: "cartoon";
|
|
7345
|
+
explainer: "explainer";
|
|
7346
|
+
pictures: "pictures";
|
|
7347
|
+
}>;
|
|
7348
|
+
available: z.ZodBoolean;
|
|
7349
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
7350
|
+
from: z.ZodNumber;
|
|
7351
|
+
parts: z.ZodArray<z.ZodObject<{
|
|
7352
|
+
part: z.ZodString;
|
|
7353
|
+
count: z.ZodNumber;
|
|
7354
|
+
credits_each: z.ZodNumber;
|
|
7355
|
+
quote_tool: z.ZodString;
|
|
7356
|
+
}, z.core.$strict>>;
|
|
7357
|
+
add_ons: z.ZodArray<z.ZodObject<{
|
|
7358
|
+
part: z.ZodString;
|
|
7359
|
+
credits_each: z.ZodNumber;
|
|
7360
|
+
quote_tool: z.ZodString;
|
|
7361
|
+
}, z.core.$strict>>;
|
|
7362
|
+
looks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7363
|
+
id: z.ZodString;
|
|
7364
|
+
name: z.ZodString;
|
|
7365
|
+
sample: z.ZodURL;
|
|
7366
|
+
}, z.core.$strict>>>;
|
|
7367
|
+
note: z.ZodString;
|
|
7368
|
+
}, z.core.$strict>>>;
|
|
7342
7369
|
warnings: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
7343
7370
|
contract_version: z.ZodString;
|
|
7344
7371
|
}, z.core.$strict>;
|
package/dist/faceless-public.js
CHANGED
|
@@ -22,6 +22,7 @@ import { pauseTrim } from "./reference-voice.js";
|
|
|
22
22
|
import { pinnedMascot } from "./mascots.js";
|
|
23
23
|
import { filmDirections } from "./film-directions.js";
|
|
24
24
|
import { maxCreditsField } from "./max-credits.js";
|
|
25
|
+
import { FACELESS_ROUTE_ESTIMATE_TEXT, facelessAlternative } from "./faceless-route-estimate.js";
|
|
25
26
|
import { sceneBible, sceneDirectionMark, storedSceneProposal } from "./scene-bible.js";
|
|
26
27
|
export const qualifiedImageUrl = uploadResponse.shape.url.max(MAX_URL_LENGTH).refine((value) => {
|
|
27
28
|
const host = new URL(value).hostname.toLowerCase();
|
|
@@ -333,6 +334,8 @@ export const facelessQuoteResponse = facelessQuote.extend({
|
|
|
333
334
|
skill: z.literal("make_faceless"),
|
|
334
335
|
explainer_fit: z.strictObject({ fits: z.boolean(), reason: z.string(), rewrite: z.string().optional() }).optional(),
|
|
335
336
|
explainer_tiers: z.strictObject({ tier: z.enum(EXPLAINER_TIERS), standard: z.number().int().positive(), pro: z.number().int().positive() }).optional(),
|
|
337
|
+
alternatives: z.array(facelessAlternative).optional().describe("The ways to make this video, this quote first as route pictures, each " +
|
|
338
|
+
`with the credits it starts from and the price of each add-on. Beside this quote, each is ${FACELESS_ROUTE_ESTIMATE_TEXT}.`),
|
|
336
339
|
warnings: z.array(z.string()).default([]),
|
|
337
340
|
contract_version: z.string().min(1),
|
|
338
341
|
}).strict();
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const FACELESS_ROUTE_ESTIMATE_TEXT = "an estimate, not a quote: each part is quoted and approved before it is made";
|
|
3
|
+
export declare const FACELESS_CARTOON_TRIAL_REASON = "pictures and clips need a gift code or a purchase";
|
|
4
|
+
export declare const CARTOON_ESTIMATE: {
|
|
5
|
+
readonly pictureRestS: 1.5;
|
|
6
|
+
readonly poseEveryS: 1;
|
|
7
|
+
readonly takeShare: {
|
|
8
|
+
readonly low: number;
|
|
9
|
+
readonly high: number;
|
|
10
|
+
};
|
|
11
|
+
readonly take: {
|
|
12
|
+
readonly model: "seedance-2.0-mini";
|
|
13
|
+
readonly resolution: "480p";
|
|
14
|
+
readonly duration_s: 4;
|
|
15
|
+
};
|
|
16
|
+
readonly pictureModel: "seedream-5.0-flash";
|
|
17
|
+
};
|
|
18
|
+
declare const routePart: z.ZodObject<{
|
|
19
|
+
part: z.ZodString;
|
|
20
|
+
count: z.ZodNumber;
|
|
21
|
+
credits_each: z.ZodNumber;
|
|
22
|
+
quote_tool: z.ZodString;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export type FacelessRoutePart = z.infer<typeof routePart>;
|
|
25
|
+
declare const routeAddOn: z.ZodObject<{
|
|
26
|
+
part: z.ZodString;
|
|
27
|
+
credits_each: z.ZodNumber;
|
|
28
|
+
quote_tool: z.ZodString;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export type FacelessRouteAddOn = z.infer<typeof routeAddOn>;
|
|
31
|
+
export declare const facelessRouteLook: z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
sample: z.ZodURL;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
export type FacelessRouteLook = z.infer<typeof facelessRouteLook>;
|
|
37
|
+
export declare const facelessAlternative: z.ZodObject<{
|
|
38
|
+
route: z.ZodEnum<{
|
|
39
|
+
cartoon: "cartoon";
|
|
40
|
+
explainer: "explainer";
|
|
41
|
+
pictures: "pictures";
|
|
42
|
+
}>;
|
|
43
|
+
available: z.ZodBoolean;
|
|
44
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
45
|
+
from: z.ZodNumber;
|
|
46
|
+
parts: z.ZodArray<z.ZodObject<{
|
|
47
|
+
part: z.ZodString;
|
|
48
|
+
count: z.ZodNumber;
|
|
49
|
+
credits_each: z.ZodNumber;
|
|
50
|
+
quote_tool: z.ZodString;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
add_ons: z.ZodArray<z.ZodObject<{
|
|
53
|
+
part: z.ZodString;
|
|
54
|
+
credits_each: z.ZodNumber;
|
|
55
|
+
quote_tool: z.ZodString;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
looks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
sample: z.ZodURL;
|
|
61
|
+
}, z.core.$strict>>>;
|
|
62
|
+
note: z.ZodString;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
export type FacelessAlternative = z.infer<typeof facelessAlternative>;
|
|
65
|
+
export declare function cartoonRouteEstimate(seconds: number): Pick<FacelessAlternative, "from" | "parts" | "add_ons"> | undefined;
|
|
66
|
+
export declare function explainerRouteEstimate(seconds: number): Pick<FacelessAlternative, "from" | "parts" | "add_ons">;
|
|
67
|
+
export interface FacelessAlternativesInput {
|
|
68
|
+
seconds: number;
|
|
69
|
+
totalCredits: number;
|
|
70
|
+
cartoon: {
|
|
71
|
+
available: boolean;
|
|
72
|
+
looks: readonly FacelessRouteLook[];
|
|
73
|
+
} | null;
|
|
74
|
+
explainer: {
|
|
75
|
+
fit?: {
|
|
76
|
+
fits: boolean;
|
|
77
|
+
reason: string;
|
|
78
|
+
};
|
|
79
|
+
} | null;
|
|
80
|
+
}
|
|
81
|
+
export declare function facelessAlternatives(input: FacelessAlternativesInput): FacelessAlternative[] | undefined;
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { FACELESS_ROUTE_IDS, FACELESS_ROUTES } from "./faceless-routes.js";
|
|
3
|
+
import { priceGeneration } from "./generations.js";
|
|
4
|
+
import { OWN_CUT_MAX_SECONDS, OWN_CUT_MIN_SECONDS, OWN_FILM_MAX_SECONDS, OWN_HERO_POSES, ownAgentTermsNow } from "./own-agent-price.js";
|
|
5
|
+
export const FACELESS_ROUTE_ESTIMATE_TEXT = "an estimate, not a quote: each part is quoted and approved before it is made";
|
|
6
|
+
export const FACELESS_CARTOON_TRIAL_REASON = "pictures and clips need a gift code or a purchase";
|
|
7
|
+
export const CARTOON_ESTIMATE = {
|
|
8
|
+
pictureRestS: 1.5,
|
|
9
|
+
poseEveryS: 1,
|
|
10
|
+
takeShare: { low: 2 / 11, high: 7 / 8 },
|
|
11
|
+
take: { model: "seedance-2.0-mini", resolution: "480p", duration_s: 4 },
|
|
12
|
+
pictureModel: "seedream-5.0-flash",
|
|
13
|
+
};
|
|
14
|
+
const routePart = z.strictObject({
|
|
15
|
+
part: z.string().min(1),
|
|
16
|
+
count: z.number().int().nonnegative().describe("How many units the starting price carries."),
|
|
17
|
+
credits_each: z.number().int().nonnegative(),
|
|
18
|
+
quote_tool: z.string().min(1),
|
|
19
|
+
});
|
|
20
|
+
const routeAddOn = z.strictObject({
|
|
21
|
+
part: z.string().min(1),
|
|
22
|
+
credits_each: z.number().int().nonnegative().describe("What each extra unit adds on top of the starting price."),
|
|
23
|
+
quote_tool: z.string().min(1),
|
|
24
|
+
});
|
|
25
|
+
export const facelessRouteLook = z.strictObject({ id: z.string().min(1), name: z.string().min(1), sample: z.url() });
|
|
26
|
+
export const facelessAlternative = z.strictObject({
|
|
27
|
+
route: z.enum(FACELESS_ROUTE_IDS),
|
|
28
|
+
available: z.boolean(),
|
|
29
|
+
reason: z.string().min(1).optional().describe("Why the route is not available on this account."),
|
|
30
|
+
from: z.number().int().nonnegative().describe("What the way starts from at this length: the sum of its parts."),
|
|
31
|
+
parts: z.array(routePart).min(1).describe("What the starting price is made of."),
|
|
32
|
+
add_ons: z.array(routeAddOn).describe("What can raise the way above its start, each at its price per unit."),
|
|
33
|
+
looks: z.array(facelessRouteLook).optional().describe("The cartoon's drawing styles, each with a sample picture."),
|
|
34
|
+
note: z.string().min(1),
|
|
35
|
+
});
|
|
36
|
+
const wholeSeconds = (seconds, min, max) => {
|
|
37
|
+
if (!Number.isFinite(seconds) || seconds <= 0)
|
|
38
|
+
throw new Error(`${seconds} s is not a length`);
|
|
39
|
+
return Math.min(max, Math.max(min, Math.ceil(seconds - 1e-9)));
|
|
40
|
+
};
|
|
41
|
+
const row = (part, low, high, each, tool, addOn) => ({ part, low, high, each, tool, ...addOn ? { addOn } : {} });
|
|
42
|
+
const priced = (rows) => ({
|
|
43
|
+
from: rows.reduce((total, one) => total + one.low * one.each, 0),
|
|
44
|
+
parts: rows.filter(one => one.low > 0).map(one => ({ part: one.part, count: one.low, credits_each: one.each, quote_tool: one.tool })),
|
|
45
|
+
add_ons: rows.filter(one => one.high > one.low)
|
|
46
|
+
.map(one => ({ part: one.addOn?.part ?? one.part, credits_each: one.addOn?.each ?? one.each, quote_tool: one.tool })),
|
|
47
|
+
});
|
|
48
|
+
export function cartoonRouteEstimate(seconds) {
|
|
49
|
+
const s = wholeSeconds(seconds, OWN_CUT_MIN_SECONDS, OWN_CUT_MAX_SECONDS), terms = ownAgentTermsNow(), plan = CARTOON_ESTIMATE;
|
|
50
|
+
const picture = priceGeneration({ model: plan.pictureModel, prompt: "-", aspect_ratio: "9:16" })?.unit_credits;
|
|
51
|
+
const takeSecond = priceGeneration({ model: plan.take.model, prompt: "-", mode: "first_frame", aspect_ratio: "9:16", resolution: plan.take.resolution,
|
|
52
|
+
duration_s: plan.take.duration_s })?.unit_credits;
|
|
53
|
+
if (picture === undefined || takeSecond === undefined)
|
|
54
|
+
return undefined;
|
|
55
|
+
const beats = { low: Math.ceil(s / plan.pictureRestS), high: Math.ceil(s / plan.poseEveryS) };
|
|
56
|
+
const takes = { low: Math.ceil(beats.low * plan.takeShare.low), high: Math.ceil(beats.low * plan.takeShare.high) };
|
|
57
|
+
const over = Math.max(0, s - terms.cut_included_seconds);
|
|
58
|
+
return priced([
|
|
59
|
+
row("voice, seconds", s, s, terms.voice_credits_per_second, "quote_voice"),
|
|
60
|
+
row("character sheet", 1, 1, picture, "quote_image"),
|
|
61
|
+
row("pictures, one a beat", beats.low, beats.high, picture, "quote_image", { part: "an extra picture", each: picture }),
|
|
62
|
+
row(`clip seconds, ${plan.take.duration_s} s a clip`, takes.low * plan.take.duration_s, takes.high * plan.take.duration_s, takeSecond, "quote_video", { part: "an extra moving shot", each: takeSecond * plan.take.duration_s }),
|
|
63
|
+
row("the cut", 1, 1, terms.cut_credits, "quote_cut"),
|
|
64
|
+
...over > 0 ? [row(`cut seconds over ${terms.cut_included_seconds}`, over, over, terms.cut_extra_second_credits, "quote_cut")] : [],
|
|
65
|
+
row("described sound bed", 0, 1, terms.cut_bed_credits, "quote_cut", { part: "a described sound bed", each: terms.cut_bed_credits }),
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
export function explainerRouteEstimate(seconds) {
|
|
69
|
+
const s = wholeSeconds(seconds, 1, OWN_FILM_MAX_SECONDS), terms = ownAgentTermsNow();
|
|
70
|
+
const over = Math.max(0, s - terms.included_seconds);
|
|
71
|
+
return priced([
|
|
72
|
+
row("the film", 1, 1, terms.render_credits, "quote_render"),
|
|
73
|
+
...over > 0 ? [row(`film seconds over ${terms.included_seconds}`, over, over, terms.extra_second_credits, "quote_render")] : [],
|
|
74
|
+
row("voice, seconds", s, s, terms.voice_credits_per_second, "quote_voice"),
|
|
75
|
+
row("hero poses", 0, OWN_HERO_POSES, terms.pose_credits, "quote_film_hero", { part: "a new hero (a saved mascot costs nothing)", each: OWN_HERO_POSES * terms.pose_credits }),
|
|
76
|
+
]);
|
|
77
|
+
}
|
|
78
|
+
const routeName = (route) => FACELESS_ROUTES.find(one => one.route === route).name;
|
|
79
|
+
export function facelessAlternatives(input) {
|
|
80
|
+
if (input.cartoon === null && input.explainer === null)
|
|
81
|
+
return undefined;
|
|
82
|
+
const pictures = { route: "pictures", available: true,
|
|
83
|
+
...priced([row("the whole video: this make_faceless quote", 1, 1, input.totalCredits, "quote_faceless")]),
|
|
84
|
+
note: `${routeName("pictures")}: this quote. make_faceless makes the whole video in one run.` };
|
|
85
|
+
const cartoonParts = input.cartoon === null ? undefined : cartoonRouteEstimate(input.seconds);
|
|
86
|
+
const cartoon = input.cartoon === null || cartoonParts === undefined ? [] : [{ route: "cartoon",
|
|
87
|
+
available: input.cartoon.available, ...input.cartoon.available ? {} : { reason: FACELESS_CARTOON_TRIAL_REASON }, ...cartoonParts,
|
|
88
|
+
looks: [...input.cartoon.looks],
|
|
89
|
+
note: `${routeName("cartoon")}: your agent makes it part by part from get_film_guide format cartoon: a voice, a character sheet, a ` +
|
|
90
|
+
"picture a beat, short clips where the hero moves, and the cut. It starts at a picture every 1.5 s and few clips; extra " +
|
|
91
|
+
"pictures, moving shots and a described sound bed are add_ons, each at its price. Other picture and clip models: quote_image and quote_video. " +
|
|
92
|
+
`This is ${FACELESS_ROUTE_ESTIMATE_TEXT}.` }];
|
|
93
|
+
const fit = input.explainer?.fit;
|
|
94
|
+
const explainer = input.explainer === null ? [] : [{ route: "explainer", available: true,
|
|
95
|
+
...explainerRouteEstimate(input.seconds),
|
|
96
|
+
note: `${routeName("explainer")}: your agent writes the film from get_film_guide format explainer and renders it with render_film, ` +
|
|
97
|
+
"about half an hour of your own model time. A saved mascot as the hero costs nothing; a new hero is an add_on. " +
|
|
98
|
+
"Stills inside the free daily allowance cost nothing, and music only when asked." +
|
|
99
|
+
(fit ? ` ${fit.fits ? "This script fits an explainer" : "This script fits an explainer poorly"}: ${fit.reason}` : "") +
|
|
100
|
+
` This is ${FACELESS_ROUTE_ESTIMATE_TEXT}.` }];
|
|
101
|
+
return cartoon.length + explainer.length > 0 ? [pictures, ...cartoon, ...explainer] : undefined;
|
|
102
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const FACELESS_ROUTES: readonly [{
|
|
2
|
+
readonly route: "pictures";
|
|
3
|
+
readonly name: "Still pictures";
|
|
4
|
+
readonly tool: "make_faceless";
|
|
5
|
+
}, {
|
|
6
|
+
readonly route: "cartoon";
|
|
7
|
+
readonly name: "Cartoon";
|
|
8
|
+
readonly tool: "render_cut";
|
|
9
|
+
}, {
|
|
10
|
+
readonly route: "explainer";
|
|
11
|
+
readonly name: "Explainer";
|
|
12
|
+
readonly tool: "render_film";
|
|
13
|
+
}];
|
|
14
|
+
export type FacelessRoute = (typeof FACELESS_ROUTES)[number]["route"];
|
|
15
|
+
export declare const FACELESS_ROUTE_IDS: [FacelessRoute, ...FacelessRoute[]];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const FACELESS_ROUTES = [
|
|
2
|
+
{ route: "pictures", name: "Still pictures", tool: "make_faceless" },
|
|
3
|
+
{ route: "cartoon", name: "Cartoon", tool: "render_cut" },
|
|
4
|
+
{ route: "explainer", name: "Explainer", tool: "render_film" },
|
|
5
|
+
];
|
|
6
|
+
export const FACELESS_ROUTE_IDS = FACELESS_ROUTES.map(r => r.route);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,8 +6,9 @@ export type OwnAgentSkill = (typeof OWN_AGENT_SKILLS)[number];
|
|
|
6
6
|
export declare const OWN_STILL_CREDITS = 1;
|
|
7
7
|
export declare const OWN_FREE_STILLS = 120, OWN_FREE_STILLS_WINDOW_HOURS = 24;
|
|
8
8
|
export declare const OWN_FILM_RENDER_CREDITS = 100, OWN_FILM_INCLUDED_SECONDS = 60, OWN_FILM_EXTRA_SECOND_CREDITS = 2;
|
|
9
|
-
export declare const OWN_VOICE_CREDITS_PER_SECOND =
|
|
10
|
-
export declare const
|
|
9
|
+
export declare const OWN_VOICE_CREDITS_PER_SECOND = 1;
|
|
10
|
+
export declare const OWN_VOICE_FLOOR_CHARS_PER_SECOND = 25;
|
|
11
|
+
export declare const OWN_STILLS_MAX_PER_CALL = 24, OWN_FILM_MAX_SECONDS = 120, OWN_VOICE_MAX_SECONDS = 455;
|
|
11
12
|
export declare const OWN_STILLS_SINGLE_MAX = 8;
|
|
12
13
|
export declare const OWN_HERO_POSE_CREDITS = 9, OWN_HERO_POSES = 9;
|
|
13
14
|
export declare const OWN_HERO_HEAD_CREDITS = 120;
|
|
@@ -25,6 +26,8 @@ export declare const OWN_HERO_FREE_POSES_WINDOW_HOURS = 24;
|
|
|
25
26
|
export declare const CUT_PREVIEWS_PER_HOUR = 20;
|
|
26
27
|
export declare const CUTS_IN_FLIGHT_PER_ACCOUNT = 4;
|
|
27
28
|
export declare const CUT_BUSY_RETRY_SECONDS = 120;
|
|
29
|
+
export declare const VOICES_IN_FLIGHT_PER_ACCOUNT = 2;
|
|
30
|
+
export declare const VOICE_BUSY_RETRY_SECONDS = 60;
|
|
28
31
|
export declare const OWN_TAKE_CHECK_CREDITS = 10;
|
|
29
32
|
export declare const OWN_TAKE_CHECK_PICTURE_CREDITS = 20;
|
|
30
33
|
export declare const OWN_TAKE_CHECK_PICTURE_LONG_CREDITS = 38, TAKE_PICTURE_SHORT_TIER_SECONDS = 4.1;
|
|
@@ -51,6 +54,7 @@ export declare const ownAgentTerms: z.ZodObject<{
|
|
|
51
54
|
included_seconds: z.ZodNumber;
|
|
52
55
|
extra_second_credits: z.ZodNumber;
|
|
53
56
|
voice_credits_per_second: z.ZodNumber;
|
|
57
|
+
voice_floor_chars_per_second: z.ZodOptional<z.ZodNumber>;
|
|
54
58
|
pose_credits: z.ZodOptional<z.ZodNumber>;
|
|
55
59
|
head_credits: z.ZodOptional<z.ZodNumber>;
|
|
56
60
|
sprite_credits: z.ZodOptional<z.ZodNumber>;
|
|
@@ -74,7 +78,8 @@ export declare const ownAgentTermsNow: (options?: {
|
|
|
74
78
|
sprites?: boolean;
|
|
75
79
|
}) => OwnAgentTerms;
|
|
76
80
|
export declare function ownFilmRenderCredits(s: number, terms?: OwnAgentTerms, music?: boolean): number;
|
|
77
|
-
export declare
|
|
81
|
+
export declare function ownVoiceCredits(s: number, terms?: OwnAgentTerms, chars?: number): number;
|
|
82
|
+
export declare function ownVoiceFloorCredits(chars: number, terms?: OwnAgentTerms): number;
|
|
78
83
|
export declare function ownStillsCredits(n: number, terms?: OwnAgentTerms, free?: number): number;
|
|
79
84
|
export declare function ownHeroCredits(n: number, terms?: OwnAgentTerms, sprites?: number, head?: boolean): number;
|
|
80
85
|
export declare function ownEditCredits(s: number, terms?: OwnAgentTerms, music?: boolean): number;
|
|
@@ -89,6 +94,7 @@ export type OwnAgentDelivery = {
|
|
|
89
94
|
} | {
|
|
90
95
|
skill: "film_voice";
|
|
91
96
|
seconds: number;
|
|
97
|
+
chars?: number;
|
|
92
98
|
} | {
|
|
93
99
|
skill: "film_render";
|
|
94
100
|
seconds: number;
|
package/dist/own-agent-price.js
CHANGED
|
@@ -8,8 +8,9 @@ export const OWN_AGENT_SKILLS = ["film_stills", "film_voice", "film_render", "fi
|
|
|
8
8
|
export const OWN_STILL_CREDITS = 1;
|
|
9
9
|
export const OWN_FREE_STILLS = 120, OWN_FREE_STILLS_WINDOW_HOURS = 24;
|
|
10
10
|
export const OWN_FILM_RENDER_CREDITS = 100, OWN_FILM_INCLUDED_SECONDS = 60, OWN_FILM_EXTRA_SECOND_CREDITS = 2;
|
|
11
|
-
export const OWN_VOICE_CREDITS_PER_SECOND =
|
|
12
|
-
export const
|
|
11
|
+
export const OWN_VOICE_CREDITS_PER_SECOND = 1;
|
|
12
|
+
export const OWN_VOICE_FLOOR_CHARS_PER_SECOND = 25;
|
|
13
|
+
export const OWN_STILLS_MAX_PER_CALL = 24, OWN_FILM_MAX_SECONDS = 120, OWN_VOICE_MAX_SECONDS = 455;
|
|
13
14
|
export const OWN_STILLS_SINGLE_MAX = 8;
|
|
14
15
|
export const OWN_HERO_POSE_CREDITS = 9, OWN_HERO_POSES = FACELESS_EXPLAINER_POSE_PICTURES;
|
|
15
16
|
export const OWN_HERO_HEAD_CREDITS = 120;
|
|
@@ -27,6 +28,8 @@ export const OWN_HERO_FREE_POSES_WINDOW_HOURS = 24;
|
|
|
27
28
|
export const CUT_PREVIEWS_PER_HOUR = 20;
|
|
28
29
|
export const CUTS_IN_FLIGHT_PER_ACCOUNT = 4;
|
|
29
30
|
export const CUT_BUSY_RETRY_SECONDS = 120;
|
|
31
|
+
export const VOICES_IN_FLIGHT_PER_ACCOUNT = 2;
|
|
32
|
+
export const VOICE_BUSY_RETRY_SECONDS = 60;
|
|
30
33
|
export const OWN_TAKE_CHECK_CREDITS = 10;
|
|
31
34
|
export const OWN_TAKE_CHECK_PICTURE_CREDITS = 20;
|
|
32
35
|
export const OWN_TAKE_CHECK_PICTURE_LONG_CREDITS = 38, TAKE_PICTURE_SHORT_TIER_SECONDS = 4.1;
|
|
@@ -45,6 +48,7 @@ export const ownAgentTerms = z.strictObject({
|
|
|
45
48
|
included_seconds: z.number().int().positive(),
|
|
46
49
|
extra_second_credits: z.number().int().nonnegative(),
|
|
47
50
|
voice_credits_per_second: z.number().int().nonnegative(),
|
|
51
|
+
voice_floor_chars_per_second: z.number().int().positive().optional(),
|
|
48
52
|
pose_credits: z.number().int().nonnegative().optional(),
|
|
49
53
|
head_credits: z.number().int().nonnegative().optional(),
|
|
50
54
|
sprite_credits: z.number().int().nonnegative().optional(),
|
|
@@ -69,7 +73,7 @@ const CUT_TERMS = ["cut_credits", "cut_included_seconds", "cut_extra_second_cred
|
|
|
69
73
|
export const ownAgentTermsNow = (options = {}) => ({ tariff: OWN_AGENT_TARIFF, still_credits: OWN_STILL_CREDITS,
|
|
70
74
|
render_credits: OWN_FILM_RENDER_CREDITS,
|
|
71
75
|
included_seconds: OWN_FILM_INCLUDED_SECONDS, extra_second_credits: OWN_FILM_EXTRA_SECOND_CREDITS, voice_credits_per_second: OWN_VOICE_CREDITS_PER_SECOND,
|
|
72
|
-
pose_credits: OWN_HERO_POSE_CREDITS, head_credits: OWN_HERO_HEAD_CREDITS, ...(options.sprites ? { sprite_credits: OWN_HERO_SPRITE_CREDITS } : {}),
|
|
76
|
+
voice_floor_chars_per_second: OWN_VOICE_FLOOR_CHARS_PER_SECOND, pose_credits: OWN_HERO_POSE_CREDITS, head_credits: OWN_HERO_HEAD_CREDITS, ...(options.sprites ? { sprite_credits: OWN_HERO_SPRITE_CREDITS } : {}),
|
|
73
77
|
edit_credits: OWN_EDIT_CREDITS, music_credits: MUSIC_BED_CREDITS, film_music_credits: FILM_MUSIC_BED_CREDITS,
|
|
74
78
|
take_check_credits: OWN_TAKE_CHECK_CREDITS,
|
|
75
79
|
picture_check_credits: OWN_TAKE_CHECK_PICTURE_CREDITS, picture_check_long_credits: OWN_TAKE_CHECK_PICTURE_LONG_CREDITS, free_stills: OWN_FREE_STILLS, free_stills_window_hours: OWN_FREE_STILLS_WINDOW_HOURS, cut_credits: OWN_CUT_CREDITS, cut_included_seconds: OWN_CUT_INCLUDED_SECONDS,
|
|
@@ -91,7 +95,16 @@ export function ownFilmRenderCredits(s, terms = ownAgentTermsNow(), music = fals
|
|
|
91
95
|
throw new Error("these terms price no film music");
|
|
92
96
|
return film + (music ? terms.film_music_credits : 0);
|
|
93
97
|
}
|
|
94
|
-
export
|
|
98
|
+
export function ownVoiceCredits(s, terms = ownAgentTermsNow(), chars) {
|
|
99
|
+
const bySeconds = terms.voice_credits_per_second * seconds(s, OWN_VOICE_MAX_SECONDS, "a take");
|
|
100
|
+
return chars === undefined ? bySeconds : Math.max(bySeconds, ownVoiceFloorCredits(chars, terms));
|
|
101
|
+
}
|
|
102
|
+
export function ownVoiceFloorCredits(chars, terms = ownAgentTermsNow()) {
|
|
103
|
+
if (!Number.isSafeInteger(chars) || chars < 0)
|
|
104
|
+
throw new Error(`${chars} characters is not a script length`);
|
|
105
|
+
const per = terms.voice_floor_chars_per_second;
|
|
106
|
+
return per === undefined ? 0 : terms.voice_credits_per_second * Math.ceil(chars / per);
|
|
107
|
+
}
|
|
95
108
|
export function ownStillsCredits(n, terms = ownAgentTermsNow(), free = 0) {
|
|
96
109
|
if (!Number.isSafeInteger(free) || free < 0 || free > (terms.free_stills ?? 0))
|
|
97
110
|
throw new Error(`${free} free stills is outside these terms`);
|
|
@@ -148,7 +161,7 @@ export function ownTakeFramesCredits(sheets) {
|
|
|
148
161
|
}
|
|
149
162
|
export function ownAgentCharge(delivery, terms, heldCredits) {
|
|
150
163
|
const charge = delivery.skill === "film_stills" || delivery.skill === "film_cut_preview" ? ownStillsCredits(delivery.frames, terms, delivery.free)
|
|
151
|
-
: delivery.skill === "film_voice" ? ownVoiceCredits(delivery.seconds, terms)
|
|
164
|
+
: delivery.skill === "film_voice" ? ownVoiceCredits(delivery.seconds, terms, delivery.chars)
|
|
152
165
|
: delivery.skill === "film_hero" ? ownHeroCredits(delivery.poses, terms, delivery.sprites ?? 0, delivery.head === true)
|
|
153
166
|
: delivery.skill === "film_edit" ? ownEditCredits(delivery.seconds, terms, delivery.music === true)
|
|
154
167
|
: delivery.skill === "film_take_frames" ? ownTakeFramesCredits(delivery.sheets)
|
package/dist/own-agent-runs.d.ts
CHANGED
|
@@ -21,7 +21,9 @@ export declare const OWN_AGENT_CUT_PREVIEW_TASK = "own-agent-cut-preview";
|
|
|
21
21
|
export declare const FILM_STILL_FPS = 30, FILM_RENDER_FPS = 25;
|
|
22
22
|
export declare const FILM_STILL_ANCHOR_LAG_SEC = 0.25;
|
|
23
23
|
export declare const FILM_TAIL_SEC = 0.8;
|
|
24
|
-
export declare const OWN_VOICE_SLOWEST_CHARS_PER_SECOND = 13, OWN_VOICE_MAX_CHARS
|
|
24
|
+
export declare const OWN_VOICE_SLOWEST_CHARS_PER_SECOND = 13, OWN_VOICE_MAX_CHARS: number;
|
|
25
|
+
export declare const OWN_VOICE_MIN_TEMPO = 0.85, OWN_VOICE_MAX_TEMPO = 1.2;
|
|
26
|
+
export declare const OWN_HERO_SCRIPT_MAX_CHARS = 1500;
|
|
25
27
|
export declare const filmStillsInput: z.ZodObject<{
|
|
26
28
|
draft_id: z.ZodString;
|
|
27
29
|
revision: z.ZodNumber;
|
|
@@ -50,6 +52,7 @@ export type FilmStillsRequest = z.input<typeof filmStillsInput>;
|
|
|
50
52
|
export declare const filmVoiceInput: z.ZodObject<{
|
|
51
53
|
text: z.ZodString;
|
|
52
54
|
voice: z.ZodOptional<z.ZodString>;
|
|
55
|
+
tempo: z.ZodOptional<z.ZodNumber>;
|
|
53
56
|
cut_id: z.ZodOptional<z.ZodString>;
|
|
54
57
|
max_credits: z.ZodOptional<z.ZodNumber>;
|
|
55
58
|
}, z.core.$strict>;
|
|
@@ -489,6 +492,7 @@ export declare const ownAgentQuote: z.ZodObject<{
|
|
|
489
492
|
free_units: z.ZodOptional<z.ZodNumber>;
|
|
490
493
|
free_left: z.ZodOptional<z.ZodNumber>;
|
|
491
494
|
frames: z.ZodOptional<z.ZodNumber>;
|
|
495
|
+
min_credits: z.ZodOptional<z.ZodNumber>;
|
|
492
496
|
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
493
497
|
item: z.ZodEnum<{
|
|
494
498
|
bed: "bed";
|
|
@@ -687,4 +691,4 @@ export declare const filmRun: z.ZodObject<{
|
|
|
687
691
|
}, z.core.$strict>;
|
|
688
692
|
export type FilmRun = z.infer<typeof filmRun>;
|
|
689
693
|
export declare const isOwnAgentSkill: (skill: unknown) => skill is (typeof OWN_AGENT_SKILLS)[number];
|
|
690
|
-
export declare const OWN_VOICE_CEILING_LIMIT =
|
|
694
|
+
export declare const OWN_VOICE_CEILING_LIMIT = 455;
|
package/dist/own-agent-runs.js
CHANGED
|
@@ -11,7 +11,7 @@ import { MASCOT_POSES } from "./mascots.js";
|
|
|
11
11
|
import { maxCreditsField } from "./max-credits.js";
|
|
12
12
|
import { OWN_AGENT_SKILLS, OWN_FREE_STILLS, OWN_FREE_STILLS_WINDOW_HOURS, OWN_STILLS_MAX_PER_CALL, OWN_STILLS_SINGLE_MAX, OWN_VOICE_MAX_SECONDS } from "./own-agent-price.js";
|
|
13
13
|
import { runId } from "./runs.js";
|
|
14
|
-
import { VOICE_NAME_PATTERN } from "./voices.js";
|
|
14
|
+
import { TTS_MODEL_CHAR_CAP, VOICE_NAME_PATTERN } from "./voices.js";
|
|
15
15
|
export const FILM_STILLS_QUOTE_PATH = "/v1/film-stills/quote";
|
|
16
16
|
export const FILM_STILLS_PATH = "/v1/film-stills";
|
|
17
17
|
export const FILM_VOICES_QUOTE_PATH = "/v1/film-voices/quote";
|
|
@@ -33,7 +33,9 @@ export const OWN_AGENT_CUT_PREVIEW_TASK = "own-agent-cut-preview";
|
|
|
33
33
|
export const FILM_STILL_FPS = 30, FILM_RENDER_FPS = 25;
|
|
34
34
|
export const FILM_STILL_ANCHOR_LAG_SEC = 0.25;
|
|
35
35
|
export const FILM_TAIL_SEC = 0.8;
|
|
36
|
-
export const OWN_VOICE_SLOWEST_CHARS_PER_SECOND = 13, OWN_VOICE_MAX_CHARS =
|
|
36
|
+
export const OWN_VOICE_SLOWEST_CHARS_PER_SECOND = 13, OWN_VOICE_MAX_CHARS = TTS_MODEL_CHAR_CAP.eleven_v4;
|
|
37
|
+
export const OWN_VOICE_MIN_TEMPO = 0.85, OWN_VOICE_MAX_TEMPO = 1.2;
|
|
38
|
+
export const OWN_HERO_SCRIPT_MAX_CHARS = 1500;
|
|
37
39
|
const anchor = z.string().regex(/^[A-Za-z_]\w{0,40}$/, "an anchor is an identifier");
|
|
38
40
|
const sceneImages = z.array(facelessCustomerSceneImage).max(EXPLAINER_MAX_PRODUCT_PICTURES).optional()
|
|
39
41
|
.describe(`Up to ${EXPLAINER_MAX_PRODUCT_PICTURES} of your product pictures, p1 first: each on the script words its anchor names, placed by ` +
|
|
@@ -52,11 +54,14 @@ export const filmStillsInput = z.strictObject({
|
|
|
52
54
|
max_credits: maxCreditsField,
|
|
53
55
|
});
|
|
54
56
|
export const filmVoiceInput = z.strictObject({
|
|
55
|
-
text: z.string().trim().min(1).max(OWN_VOICE_MAX_CHARS).describe(
|
|
57
|
+
text: z.string().trim().min(1).max(OWN_VOICE_MAX_CHARS).describe(`The script, spoken exactly as written in one take of up to ${OWN_VOICE_MAX_CHARS} characters`),
|
|
56
58
|
voice: z.string({ error: "voice must be a voice name from list_voices, as a string" })
|
|
57
59
|
.regex(VOICE_NAME_PATTERN, "voice is not a voice name: take one from list_voices with skill=make_faceless").optional()
|
|
58
60
|
.describe("A narrator (list_voices with skill=make_faceless); the fastest of the script's language when omitted. The API refuses a name " +
|
|
59
61
|
"list_voices does not return, before any charge"),
|
|
62
|
+
tempo: z.number().min(OWN_VOICE_MIN_TEMPO).max(OWN_VOICE_MAX_TEMPO).optional()
|
|
63
|
+
.describe(`How fast the take plays, ${OWN_VOICE_MIN_TEMPO} to ${OWN_VOICE_MAX_TEMPO} of the narrator's own read, its pitch kept: 1 is the ` +
|
|
64
|
+
"read as spoken, below 1 slower and longer. Omitted, the voice's own tempo"),
|
|
60
65
|
cut_id: cutId.optional().describe("The cut record this voice is for: the record then names it as its voice and says what comes next"),
|
|
61
66
|
max_credits: maxCreditsField,
|
|
62
67
|
});
|
|
@@ -271,7 +276,7 @@ export const filmHeroInput = z.strictObject({
|
|
|
271
276
|
character_reference: qualifiedImageUrl.optional().describe("https image of the character the poses are drawn after: a public picture, your upload, a " +
|
|
272
277
|
"saved asset or your actor's picture (list_actors); a person's photo is drawn as a cartoon unless character_details ask for a photoreal look"),
|
|
273
278
|
character_details: z.string().trim().min(1).max(2000).optional().describe("The character's look in words: shape, colours, one distinctive detail"),
|
|
274
|
-
script: z.string().trim().min(1).max(
|
|
279
|
+
script: z.string().trim().min(1).max(OWN_HERO_SCRIPT_MAX_CHARS).optional()
|
|
275
280
|
.describe("With no character named: the film's script, and a hero is invented to fit its meaning"),
|
|
276
281
|
voice_run_id: runId.optional().describe("With no character and no script: a delivered make_voice run of this account, whose text is the script"),
|
|
277
282
|
mascot_id: assetId.optional().describe("Alone, instead of the fields above: a saved mascot of this account (list_assets with mascot true) that lacks " +
|
|
@@ -304,6 +309,8 @@ export const ownAgentQuote = z.strictObject({
|
|
|
304
309
|
`${OWN_FREE_STILLS_WINDOW_HOURS} h are`),
|
|
305
310
|
free_left: z.number().int().nonnegative().optional().describe("Free stills the draft, or the account's previews, have left in the rolling day after this call"),
|
|
306
311
|
frames: z.number().int().positive().optional(),
|
|
312
|
+
min_credits: z.number().int().nonnegative().optional()
|
|
313
|
+
.describe("A voice: the least this take is charged, by its script's length, however short it plays"),
|
|
307
314
|
items: z.array(z.strictObject({ item: z.enum(["cut", "extra_seconds", "bed", "take_sound", "music"]), units: z.number().int().nonnegative(),
|
|
308
315
|
credits: z.number().int().nonnegative() })).optional(),
|
|
309
316
|
lines: z.array(ownAgentQuoteLine).optional(),
|
package/dist/prices.js
CHANGED
|
@@ -12,7 +12,7 @@ import { REFERENCE_ANALYSIS_TARIFFS, REFERENCE_DATA_CREDITS, referenceAnalysisPr
|
|
|
12
12
|
import { CREATOR_PROFILE_CREDITS, CREATOR_PROFILE_VIDEOS } from "./creator-profile.js";
|
|
13
13
|
import { TREND_FREE_PAGES_PER_DAY, TREND_FREE_SEARCHES_PER_MONTH, TREND_PAGE_PAID_CREDITS, TREND_PAGE_WINDOW_SECONDS, TREND_SEARCH_CREDITS, TREND_SEARCH_MAX_PAGES, TREND_SEARCH_REELS, } from "./trend-search.js";
|
|
14
14
|
import { FILM_MUSIC_BED_CREDITS, MUSIC_BED_CREDITS } from "./music.js";
|
|
15
|
-
import { HERO_RUNS_PER_HOUR, OWN_FILM_EXTRA_SECOND_CREDITS, OWN_FILM_INCLUDED_SECONDS, OWN_FILM_RENDER_CREDITS, OWN_HERO_POSE_CREDITS, OWN_HERO_POSES, OWN_HERO_FREE_POSES_PER_DAY, OWN_HERO_FREE_POSES_WINDOW_HOURS, OWN_FREE_STILLS, OWN_FREE_STILLS_WINDOW_HOURS, OWN_STILL_CREDITS, OWN_STILLS_MAX_PER_CALL, OWN_VOICE_CREDITS_PER_SECOND, OWN_EDIT_CREDITS, OWN_EDIT_MAX_SECONDS, OWN_TAKE_CHECK_CREDITS, OWN_CUT_BED_CREDITS, OWN_CUT_CREDITS, OWN_CUT_EXTRA_SECOND_CREDITS, OWN_CUT_INCLUDED_SECONDS, OWN_CUT_MAX_NEW_SOUNDS, OWN_CUT_MAX_SECONDS, OWN_CUT_MIN_SECONDS, OWN_CUT_TAKE_SOUND_CREDITS_PER_SECOND, OWN_TAKE_CHECK_PICTURE_CREDITS, OWN_TAKE_CHECK_PICTURE_LONG_CREDITS, OWN_TAKE_FRAMES_MAX, TAKE_PICTURE_SHORT_TIER_SECONDS, OWN_HERO_HEAD_CREDITS, OWN_HERO_MAX_SPRITES, OWN_HERO_SPRITE_CREDITS, OWN_HERO_TALKING_POSES, ownAgentTermsNow, ownHeroCredits } from "./own-agent-price.js";
|
|
15
|
+
import { HERO_RUNS_PER_HOUR, OWN_FILM_EXTRA_SECOND_CREDITS, OWN_FILM_INCLUDED_SECONDS, OWN_FILM_RENDER_CREDITS, OWN_HERO_POSE_CREDITS, OWN_HERO_POSES, OWN_HERO_FREE_POSES_PER_DAY, OWN_HERO_FREE_POSES_WINDOW_HOURS, OWN_FREE_STILLS, OWN_FREE_STILLS_WINDOW_HOURS, OWN_STILL_CREDITS, OWN_STILLS_MAX_PER_CALL, OWN_VOICE_CREDITS_PER_SECOND, OWN_VOICE_FLOOR_CHARS_PER_SECOND, OWN_EDIT_CREDITS, OWN_EDIT_MAX_SECONDS, OWN_TAKE_CHECK_CREDITS, OWN_CUT_BED_CREDITS, OWN_CUT_CREDITS, OWN_CUT_EXTRA_SECOND_CREDITS, OWN_CUT_INCLUDED_SECONDS, OWN_CUT_MAX_NEW_SOUNDS, OWN_CUT_MAX_SECONDS, OWN_CUT_MIN_SECONDS, OWN_CUT_TAKE_SOUND_CREDITS_PER_SECOND, OWN_TAKE_CHECK_PICTURE_CREDITS, OWN_TAKE_CHECK_PICTURE_LONG_CREDITS, OWN_TAKE_FRAMES_MAX, TAKE_PICTURE_SHORT_TIER_SECONDS, OWN_HERO_HEAD_CREDITS, OWN_HERO_MAX_SPRITES, OWN_HERO_SPRITE_CREDITS, OWN_HERO_TALKING_POSES, ownAgentTermsNow, ownHeroCredits } from "./own-agent-price.js";
|
|
16
16
|
import { CUT_PREVIEW_MAX_STILLS } from "./film-cut.js";
|
|
17
17
|
export const PRICES_PATH = "/v1/public/prices";
|
|
18
18
|
const referenceAnalysisTableText = (tariff, index) => `${index === 0 ? "By the reel's length, " : `${referenceAnalysisSince(tariff)}, `}` +
|
|
@@ -263,7 +263,8 @@ function buildPriceList(offer, diy) {
|
|
|
263
263
|
`${OWN_FREE_STILLS_WINDOW_HOURS} hours are free; each still past them is charged once it is drawn. quote_stills says how many of yours ` +
|
|
264
264
|
"are free. A draft its check refuses costs nothing and uses none of the free stills." }),
|
|
265
265
|
paid({ tool: "make_voice", route: "POST /v1/film-voices", quote_tool: "quote_voice", unit: "second", credits: OWN_VOICE_CREDITS_PER_SECOND,
|
|
266
|
-
notes: "A narrated take with each word's timing, charged by its delivered seconds
|
|
266
|
+
notes: "A narrated take with each word's timing, charged by its delivered seconds and at least one credit for every " +
|
|
267
|
+
`${OWN_VOICE_FLOOR_CHARS_PER_SECOND} characters of its script, however short it plays; a take that fails costs nothing.` }),
|
|
267
268
|
paid({ tool: "render_film", route: "POST /v1/film-renders", quote_tool: "quote_render",
|
|
268
269
|
lines: [{ label: `film up to ${OWN_FILM_INCLUDED_SECONDS} s`, unit: "call", credits: OWN_FILM_RENDER_CREDITS },
|
|
269
270
|
{ label: `each second over ${OWN_FILM_INCLUDED_SECONDS} s`, unit: "second", credits: OWN_FILM_EXTRA_SECOND_CREDITS },
|
|
@@ -51,7 +51,9 @@ const NO_SCRIPT_MAKES = { get_ad_guide: "a multi-shot ad", get_film_guide: "a fa
|
|
|
51
51
|
export const NO_SCRIPT_LINE_HEAD = "**No script or product of your own?**";
|
|
52
52
|
export const noScriptLine = ({ tools, credits_from }) => `${NO_SCRIPT_LINE_HEAD} Make a video on this reel's topic anyway; you write the script on its mechanic. Start with ` +
|
|
53
53
|
`${tools.map(tool => NO_SCRIPT_MAKES[tool] ? `${tool} (${NO_SCRIPT_MAKES[tool]})` : tool).join(", ")}` +
|
|
54
|
-
`${credits_from === undefined ? "" : `; a video made for you costs at least ${credits_from} credits`}
|
|
54
|
+
`${credits_from === undefined ? "" : `; a video made for you costs at least ${credits_from} credits`}.` +
|
|
55
|
+
`${!tools.includes("make_faceless") ? "" : tools.includes("get_film_guide") ? " With no product, show quote_faceless's ways and prices first."
|
|
56
|
+
: " With no product, quote_faceless first."}`;
|
|
55
57
|
export function referenceAnalysisMarkdown(analysis) {
|
|
56
58
|
const profile = analysis.reference_profile, data = analysis.data, source = analysis.source, lines = [];
|
|
57
59
|
const duration = profile?.source.duration_s ?? data?.duration_s ?? source?.duration_s ?? null;
|
package/dist/skills.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare const STOPS_RULE: string;
|
|
|
103
103
|
export declare const LOOK_STEP: string;
|
|
104
104
|
export declare const AD_GUIDE_INSTRUCTION: string;
|
|
105
105
|
export declare const adMethodInstruction: (adGuide: boolean) => string;
|
|
106
|
-
export declare const FACELESS_DIY_INSTRUCTION
|
|
106
|
+
export declare const FACELESS_DIY_INSTRUCTION = "An estimate is no go-ahead; follow the pick's get_film_guide workflow, keeping its look.";
|
|
107
107
|
export interface InstructionModes {
|
|
108
108
|
ownAgent: boolean;
|
|
109
109
|
explainer: boolean;
|
|
@@ -113,7 +113,7 @@ export interface InstructionModes {
|
|
|
113
113
|
export declare const ROUTER_HEAD = "Pick the format first, then follow its workflow:";
|
|
114
114
|
export declare const AD_ROUTE: string;
|
|
115
115
|
export declare const PRESENTER_ROUTE = "- An ad, a product video or a person talking to camera: make_ugc, with the five choices below.";
|
|
116
|
-
export declare function formatRouter(
|
|
116
|
+
export declare function formatRouter(modes: InstructionModes): string;
|
|
117
117
|
export declare const UNTRUSTED_RULE: string;
|
|
118
118
|
export declare const NO_SCRIPT: string;
|
|
119
119
|
export declare const mcpServerInstructions: ({ ownAgent, explainer, adGuide, facelessDiy }: {
|
package/dist/skills.js
CHANGED
|
@@ -187,23 +187,29 @@ export const adMethodInstruction = (adGuide) => "Ads: a make_ugc video is the pr
|
|
|
187
187
|
"the product's name, the offer, the call to action), the hook, live shots of the actor (shots) and edit_sounds on cuts. "
|
|
188
188
|
: "list_moves moves fit a number, the name, the offer, the call to action; a live shot (shots) the hook; edit_sounds the cuts. ") +
|
|
189
189
|
"A quote_ugc with no device names suggestions[] and adds nothing.";
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
const facelessHead = (guides) => `- A faceless story, list, how-to, kids${guides ? ", own-pictures" : ""} or cartoon video, or a topic with no product: `;
|
|
191
|
+
export const FACELESS_DIY_INSTRUCTION = "An estimate is no go-ahead; follow the pick's get_film_guide workflow, keeping its look.";
|
|
192
|
+
const SOLD_EXPLAINER = "make_faceless, format explainer";
|
|
193
|
+
const facelessQuoteStep = (ownAgent) => (ownAgent ? "show quote_faceless's ways" : "quote_faceless");
|
|
194
|
+
function facelessRoute({ ownAgent, explainer, facelessDiy }) {
|
|
195
|
+
const first = `${facelessQuoteStep(ownAgent)} first`;
|
|
196
|
+
if (!ownAgent)
|
|
197
|
+
return `${facelessHead(false)}${first}, then make_faceless${explainer ? `, or an explainer (${SOLD_EXPLAINER})` : ""}.`;
|
|
198
|
+
if (!facelessDiy)
|
|
199
|
+
return `${facelessHead(false)}${first}: make_faceless, or an explainer ` +
|
|
200
|
+
`${explainer ? `(${SOLD_EXPLAINER}, or yours from get_film_guide)` : "you write from get_film_guide (format explainer)"}.`;
|
|
201
|
+
return `${facelessHead(true)}show quote_faceless's ways and prices first; the user picks still pictures (make_faceless), cartoon or ` +
|
|
202
|
+
`explainer${explainer ? ` (yours or ${SOLD_EXPLAINER})` : ""}. ${FACELESS_DIY_INSTRUCTION}`;
|
|
203
|
+
}
|
|
192
204
|
export const ROUTER_HEAD = "Pick the format first, then follow its workflow:";
|
|
193
205
|
export const AD_ROUTE = "- An ad or a product video: by default a multi-shot ad from generated clips (generate_image, generate_video, " +
|
|
194
206
|
"make_voice, render_edit); read get_ad_guide section workflow first. Not for a person talking to camera.";
|
|
195
207
|
export const PRESENTER_ROUTE = "- An ad, a product video or a person talking to camera: make_ugc, with the five choices below.";
|
|
196
|
-
|
|
197
|
-
export function formatRouter({ ownAgent, explainer, adGuide, facelessDiy }) {
|
|
198
|
-
const explainerLine = explainer ? `${EXPLAINER_ROUTE}an explainer (make_faceless, format explainer)` +
|
|
199
|
-
(ownAgent ? " or yours from get_film_guide." : ".")
|
|
200
|
-
: ownAgent ? `${EXPLAINER_ROUTE}an explainer you write from get_film_guide (format explainer).` : "";
|
|
208
|
+
export function formatRouter(modes) {
|
|
201
209
|
return [ROUTER_HEAD,
|
|
202
|
-
...adGuide ? [AD_ROUTE, "- A person talking to camera (UGC, a testimonial, a talking head), when asked for one: make_ugc, with the five " +
|
|
210
|
+
...modes.adGuide ? [AD_ROUTE, "- A person talking to camera (UGC, a testimonial, a talking head), when asked for one: make_ugc, with the five " +
|
|
203
211
|
"choices of get_ad_guide section workflow."] : [PRESENTER_ROUTE],
|
|
204
|
-
|
|
205
|
-
"words of topic.",
|
|
206
|
-
...explainerLine ? [explainerLine] : [],
|
|
212
|
+
facelessRoute(modes),
|
|
207
213
|
"- One image or one clip: generate_image or generate_video directly.",
|
|
208
214
|
"- Like a reel the user brings: analyze_reference (quote_analysis first), then its format.",
|
|
209
215
|
].join("\n");
|
|
@@ -219,7 +225,7 @@ const serverInstructions = (offer, modes) => "Clipwright makes presenter (UGC) a
|
|
|
219
225
|
"file; it publishes nothing anywhere.\n\n" +
|
|
220
226
|
"describe_tool answers a tool's or a field's full guidance, free: read it before its first use, such as quote_ugc templates.\n\n" +
|
|
221
227
|
"Quote first. Call the matching quote tool before every paid tool: quote_ugc before make_ugc, quote_faceless before " +
|
|
222
|
-
"make_faceless
|
|
228
|
+
"make_faceless. Show the user the credits and wait for the user's go-ahead before the paid call; a go-ahead for " +
|
|
223
229
|
"this order with unchanged terms needs no second ask. A quote_ugc price is an estimate: the charge follows the " +
|
|
224
230
|
"measured video and can land above or below it, so say so before the run. Take prices from the quote or list_prices, " +
|
|
225
231
|
"never from memory.\n\n" +
|
|
@@ -237,7 +243,8 @@ const serverInstructions = (offer, modes) => "Clipwright makes presenter (UGC) a
|
|
|
237
243
|
`${HOOK_STOP} ${MUSIC_STOP} ${STOPS_RULE}\n\n${LOOK_STEP}\n\n${adMethodInstruction(false)}\n\n`) +
|
|
238
244
|
"If no tool fits, or an answer or a result disappoints, offer to tell Clipwright with " +
|
|
239
245
|
"send_feedback (free; pass run_id). Send it once the user agrees.\n\n" +
|
|
240
|
-
|
|
246
|
+
`Start from what works. Only a topic, no product: ${facelessQuoteStep(modes.ownAgent)} first. When the user asks for a video with only a ` +
|
|
247
|
+
"product, a link or a plain script, don't go " +
|
|
241
248
|
"straight to one talking-head make_ugc; lead this brief. 1. Ask the topic in a few words, then run find_trends on it over the " +
|
|
242
249
|
"last 7 days (its default) and show 3 to 5 reels that took off, with views and x_median; when few are on topic or took off, " +
|
|
243
250
|
"try 2 or 3 other wordings of the topic, then a longer window. The user picks one or brings their own reel. 2. Break the " +
|
|
@@ -246,7 +253,7 @@ const serverInstructions = (offer, modes) => "Clipwright makes presenter (UGC) a
|
|
|
246
253
|
"(x to the author, the questions in the comments, who speaks in the reference), show the choice and its reason to the user, " +
|
|
247
254
|
"then pick the presenter, setting and the script's voice to match and pass it as audience. Write the script on the " +
|
|
248
255
|
"reference's mechanic (hook, structure, pacing), never its words: the user's own, or yours from a few words of topic when the user has " +
|
|
249
|
-
|
|
256
|
+
`none; with no product, ${facelessQuoteStep(modes.ownAgent)} on the topic instead. ` +
|
|
250
257
|
"3. Compile it with plan_reference_remake, passing the analysis_id (the analysis's next), not the profile, and show the script for approval. " +
|
|
251
258
|
"A user who brings a reel and asks for a video like it starts at step 2. Turn the user's notes into a revised script " +
|
|
252
259
|
"and compile it again with plan_id, base_version and review_notes; a note about a picture or graphic on a line goes in " +
|
|
@@ -288,7 +295,8 @@ const serverInstructions = (offer, modes) => "Clipwright makes presenter (UGC) a
|
|
|
288
295
|
export const MCP_SERVER_INSTRUCTIONS = mcpServerInstructions({ ownAgent: false });
|
|
289
296
|
export const MAKE_FACELESS_DESCRIPTION = "Start a paid finished faceless video from a script or brief. You select 30–90 seconds; " +
|
|
290
297
|
"the video ends with its narration, runs at least 25 seconds (an explainer, as long as its narration) and at most a quarter past the selection, never beyond 90. " +
|
|
291
|
-
"The video has an opening animated clip and image scenes. Captions are on by default and can be turned off."
|
|
298
|
+
"The video has an opening animated clip and image scenes. Captions are on by default and can be turned off. " +
|
|
299
|
+
"Its quote can also name the other faceless ways, each with an estimate.";
|
|
292
300
|
export const MAKE_FACELESS_AGENT_PROTOCOL = "It answers a run_id at once; poll get_run with its poll.arguments until 'succeeded' (video_url) or 'failed'. " +
|
|
293
301
|
"attempt=2,3,… starts a new run for the same input.";
|
|
294
302
|
const IMAGE_MOTION_DESCRIPTION = "Optional picture zoom. A picture fills the frame, cut to its shape when the shapes differ " +
|
package/dist/speech-words.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { WordTiming } from "./tts-backend.js";
|
|
2
2
|
export declare const LEXICAL_WORD: RegExp;
|
|
3
3
|
export declare function lexicalWords(text: string): string[];
|
|
4
|
+
export declare function withoutAudioTags(text: string): string;
|
|
5
|
+
export declare function withoutAudioTagWords<W>(words: readonly W[], textOf: (word: W) => string, withText: (word: W, text: string) => W): W[];
|
|
4
6
|
export declare function lexicalWordTimings(words: readonly WordTiming[]): WordTiming[];
|
package/dist/speech-words.js
CHANGED
|
@@ -2,6 +2,76 @@ export const LEXICAL_WORD = /[\p{L}\p{N}\p{M}]+(?:['’][\p{L}\p{N}\p{M}]+)*/gu;
|
|
|
2
2
|
export function lexicalWords(text) {
|
|
3
3
|
return text.normalize("NFKC").match(LEXICAL_WORD) ?? [];
|
|
4
4
|
}
|
|
5
|
+
const AUDIO_TAG = /\[[^[\]]+\]/gu;
|
|
6
|
+
const tagSpans = (text) => [...text.matchAll(AUDIO_TAG)].filter(match => {
|
|
7
|
+
const inner = match[0].slice(1, -1), length = inner.replace(/\s+/gu, " ").length;
|
|
8
|
+
return length <= 40 && (inner.match(/\s+/gu)?.length ?? 0) <= 3;
|
|
9
|
+
}).map(match => [match.index, match.index + match[0].length]);
|
|
10
|
+
const blank = (char) => char === " " || char === "\t";
|
|
11
|
+
const PAUSE_MARK = /[.,!?;:…]/u;
|
|
12
|
+
export function withoutAudioTags(text) {
|
|
13
|
+
const spans = tagSpans(text);
|
|
14
|
+
if (!spans.length)
|
|
15
|
+
return text;
|
|
16
|
+
const parts = [];
|
|
17
|
+
let at = 0;
|
|
18
|
+
const last = () => parts.at(-1)?.at(-1);
|
|
19
|
+
for (const [start, end] of spans) {
|
|
20
|
+
if (start > at)
|
|
21
|
+
parts.push(text.slice(at, start));
|
|
22
|
+
at = end;
|
|
23
|
+
if (!parts.length || blank(last()))
|
|
24
|
+
while (blank(text[at]))
|
|
25
|
+
at++;
|
|
26
|
+
const next = text[at];
|
|
27
|
+
if (next !== undefined && PAUSE_MARK.test(next)) {
|
|
28
|
+
while (parts.length) {
|
|
29
|
+
const part = parts.pop();
|
|
30
|
+
let cut = part.length;
|
|
31
|
+
while (cut > 0 && blank(part[cut - 1]))
|
|
32
|
+
cut--;
|
|
33
|
+
if (cut > 0) {
|
|
34
|
+
parts.push(cut === part.length ? part : part.slice(0, cut));
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (next !== undefined && !/\s/u.test(next) && parts.length && !/\s/u.test(last()))
|
|
40
|
+
parts.push(" ");
|
|
41
|
+
}
|
|
42
|
+
parts.push(text.slice(at));
|
|
43
|
+
return parts.join("").trim();
|
|
44
|
+
}
|
|
45
|
+
export function withoutAudioTagWords(words, textOf, withText) {
|
|
46
|
+
const texts = words.map(word => textOf(word)), spans = tagSpans(texts.join(" "));
|
|
47
|
+
if (!spans.length)
|
|
48
|
+
return [...words];
|
|
49
|
+
const out = [];
|
|
50
|
+
let from = 0, span = 0;
|
|
51
|
+
for (const [at, word] of words.entries()) {
|
|
52
|
+
const text = texts[at], to = from + text.length;
|
|
53
|
+
while (span < spans.length && spans[span][1] <= from)
|
|
54
|
+
span++;
|
|
55
|
+
let kept = "", cursor = from;
|
|
56
|
+
for (let s = span; s < spans.length && spans[s][0] < to; s++) {
|
|
57
|
+
const [start, end] = spans[s];
|
|
58
|
+
if (start > cursor)
|
|
59
|
+
kept += text.slice(cursor - from, start - from);
|
|
60
|
+
kept += " ";
|
|
61
|
+
cursor = Math.max(cursor, Math.min(end, to));
|
|
62
|
+
}
|
|
63
|
+
if (cursor === from && kept === "") {
|
|
64
|
+
out.push(word);
|
|
65
|
+
from = to + 1;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
kept = `${kept}${text.slice(cursor - from)}`.trim().replace(/\s+/gu, " ");
|
|
69
|
+
if (lexicalWords(kept).length)
|
|
70
|
+
out.push(withText(word, kept));
|
|
71
|
+
from = to + 1;
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
5
75
|
export function lexicalWordTimings(words) {
|
|
6
76
|
const out = [];
|
|
7
77
|
let lead = "";
|
|
@@ -7561,6 +7561,7 @@ export declare function filmVoiceRefusal(voice: string, options?: {
|
|
|
7561
7561
|
export declare function serverFilmVoiceInputWith(voiceRefusal: (voice: string) => string | undefined): z.ZodObject<{
|
|
7562
7562
|
text: z.ZodString;
|
|
7563
7563
|
voice: z.ZodOptional<z.ZodString>;
|
|
7564
|
+
tempo: z.ZodOptional<z.ZodNumber>;
|
|
7564
7565
|
cut_id: z.ZodOptional<z.ZodString>;
|
|
7565
7566
|
max_credits: z.ZodOptional<z.ZodNumber>;
|
|
7566
7567
|
}, z.core.$strict>;
|