@clipwright/core 0.79.0 → 0.80.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/errors.d.ts +1 -1
- package/dist/errors.js +1 -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/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
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
|
@@ -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 },
|
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>;
|