@clipwright/core 0.77.0 → 0.78.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/actors.js +2 -2
- package/dist/aspect.d.ts +1 -2
- package/dist/aspect.js +2 -18
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/long-form-pricing.d.ts +0 -1
- package/dist/long-form-pricing.js +0 -1
- package/dist/render-backend.d.ts +1 -3
- package/dist/render-backend.js +0 -5
- package/dist/tts-backend.d.ts +1 -2
- package/dist/voice-admission.js +2 -2
- package/dist/voice-listing.d.ts +1 -2
- package/dist/voice-listing.js +2 -4
- package/dist/voice-verified-models.d.ts +3 -0
- package/dist/voice-verified-models.js +5 -0
- package/package.json +1 -1
- package/dist/vendor-response.d.ts +0 -20
- package/dist/vendor-response.js +0 -94
package/dist/actors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ACTOR_FULL_PORTRAIT_FACE_HEIGHT, ACTOR_WIDE_PORTRAIT_FACE_HEIGHT, actorIdScope } from "./account-actors.js";
|
|
3
|
-
import {
|
|
3
|
+
import { outputFrame } from "./aspect.js";
|
|
4
4
|
import { sharpCropOf } from "./scene-place.js";
|
|
5
5
|
import { ACTOR_FOR_GENDER, actorId, ASPECT_RATIOS, LEGACY_RUN_RESOLUTION, RESOLUTIONS } from "./skills.js";
|
|
6
6
|
import { defaultVoiceOf, DEFAULT_VOICE_PRESET, speaksOwnVoices, VOICE_PRESETS } from "./voices.js";
|
|
@@ -101,7 +101,7 @@ function presenterPlaceSoftness(input, pin) {
|
|
|
101
101
|
const aspect = ASPECT_RATIOS.find(ratio => ratio === asset?.aspect_ratio), resolution = RESOLUTIONS.find(entry => entry === input.resolution) ?? LEGACY_RUN_RESOLUTION;
|
|
102
102
|
if (!place || largest === undefined || !asset?.width || !aspect)
|
|
103
103
|
return undefined;
|
|
104
|
-
const sharp = sharpCropOf(asset.width,
|
|
104
|
+
const sharp = sharpCropOf(asset.width, outputFrame(resolution, aspect).width);
|
|
105
105
|
if (place.face_height / largest <= sharp)
|
|
106
106
|
return undefined;
|
|
107
107
|
return `presenter_place face height ${place.face_height.toFixed(2)}: the actor's ${view} portrait shows the face under ${largest} of its height, so a ` +
|
package/dist/aspect.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export interface ResolveAspectInput {
|
|
|
20
20
|
}
|
|
21
21
|
export declare function resolveAspectRatio(input: ResolveAspectInput): AspectResolution;
|
|
22
22
|
export declare function exactAspectLabel(width: number, height: number): string;
|
|
23
|
-
export declare function vendorAspectFor(source: AspectSource, supported: readonly AspectRatio[]): AspectRatio;
|
|
24
23
|
export interface DeliveredClip {
|
|
25
24
|
width: number;
|
|
26
25
|
height: number;
|
|
@@ -37,7 +36,7 @@ export declare function deliveredResolutionWarning(requested: Resolution, delive
|
|
|
37
36
|
width: number;
|
|
38
37
|
height: number;
|
|
39
38
|
}): string | null;
|
|
40
|
-
export declare function
|
|
39
|
+
export declare function outputFrame(resolution: Resolution, aspectRatio: AspectRatio): {
|
|
41
40
|
width: number;
|
|
42
41
|
height: number;
|
|
43
42
|
};
|
package/dist/aspect.js
CHANGED
|
@@ -67,22 +67,6 @@ export function exactAspectLabel(width, height) {
|
|
|
67
67
|
const divisor = gcd(w, h);
|
|
68
68
|
return `${w / divisor}:${h / divisor}`;
|
|
69
69
|
}
|
|
70
|
-
export function vendorAspectFor(source, supported) {
|
|
71
|
-
if (supported.length === 0) {
|
|
72
|
-
throw new Error("vendorAspectFor: backend declares no supported aspect ratios");
|
|
73
|
-
}
|
|
74
|
-
const sourceRatio = source.width / source.height;
|
|
75
|
-
let best = supported[0];
|
|
76
|
-
let bestDistance = aspectDistance(ASPECT_RATIO_VALUES[best], sourceRatio);
|
|
77
|
-
for (const candidate of supported) {
|
|
78
|
-
const distance = aspectDistance(ASPECT_RATIO_VALUES[candidate], sourceRatio);
|
|
79
|
-
if (distance < bestDistance) {
|
|
80
|
-
best = candidate;
|
|
81
|
-
bestDistance = distance;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return best;
|
|
85
|
-
}
|
|
86
70
|
export function deliveryWarnings(args) {
|
|
87
71
|
const { predicted, actual } = args;
|
|
88
72
|
const tolerance = args.durationToleranceSec ?? 0.05;
|
|
@@ -102,7 +86,7 @@ export function deliveryWarnings(args) {
|
|
|
102
86
|
export function upscaleWarning(source, resolution, aspectRatio) {
|
|
103
87
|
if (source === null || source.origin !== "probed")
|
|
104
88
|
return null;
|
|
105
|
-
const frame =
|
|
89
|
+
const frame = outputFrame(resolution, aspectRatio);
|
|
106
90
|
const sourceShort = Math.min(source.width, source.height);
|
|
107
91
|
const frameShort = Math.min(frame.width, frame.height);
|
|
108
92
|
if (sourceShort >= frameShort)
|
|
@@ -122,7 +106,7 @@ export function deliveredResolutionWarning(requested, delivered) {
|
|
|
122
106
|
return `resolution ${requested} was requested, but the video is delivered at ` +
|
|
123
107
|
`${delivered.width}×${delivered.height}; resolution does not change the price`;
|
|
124
108
|
}
|
|
125
|
-
export function
|
|
109
|
+
export function outputFrame(resolution, aspectRatio) {
|
|
126
110
|
const short = SHORT_SIDE_BY_RESOLUTION[resolution];
|
|
127
111
|
const ratio = ASPECT_RATIO_VALUES[aspectRatio];
|
|
128
112
|
const even = (value) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -60,7 +60,6 @@ export * from "./pacing.js";
|
|
|
60
60
|
export * from "./render-backend.js";
|
|
61
61
|
export * from "./tts-backend.js";
|
|
62
62
|
export * from "./speech-words.js";
|
|
63
|
-
export * from "./vendor-response.js";
|
|
64
63
|
export * from "./public-endpoints.js";
|
|
65
64
|
export * from "./endpoints.js";
|
|
66
65
|
export * from "./endpoint-notes.js";
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,6 @@ export * from "./pacing.js";
|
|
|
60
60
|
export * from "./render-backend.js";
|
|
61
61
|
export * from "./tts-backend.js";
|
|
62
62
|
export * from "./speech-words.js";
|
|
63
|
-
export * from "./vendor-response.js";
|
|
64
63
|
export * from "./public-endpoints.js";
|
|
65
64
|
export * from "./endpoints.js";
|
|
66
65
|
export * from "./endpoint-notes.js";
|
|
@@ -22,7 +22,6 @@ export declare function calculateFaceCharge(intervals: readonly FaceBillingInter
|
|
|
22
22
|
credits: number;
|
|
23
23
|
minimumApplied: boolean;
|
|
24
24
|
};
|
|
25
|
-
export declare const FACE_RESERVE_SHAPE_MARGIN = 1.15;
|
|
26
25
|
export declare const longFormQuoteSchema: z.ZodReadonly<z.ZodObject<{
|
|
27
26
|
pricingVersion: z.ZodString;
|
|
28
27
|
rateCreditsPerFaceSecond: z.ZodNumber;
|
|
@@ -46,7 +46,6 @@ export function calculateFaceCharge(intervals, fps, tariff) {
|
|
|
46
46
|
return { faceFrames: Number(frames), billableFaceSeconds: Number(seconds), credits: Number(credits),
|
|
47
47
|
minimumApplied: usageCredits < minimum };
|
|
48
48
|
}
|
|
49
|
-
export const FACE_RESERVE_SHAPE_MARGIN = 1.15;
|
|
50
49
|
const credits = z.number().int().nonnegative().max(2_147_483_647);
|
|
51
50
|
const pricing = {
|
|
52
51
|
pricingVersion: z.string().min(1).max(200),
|
package/dist/render-backend.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { AspectRatio, Resolution } from "./skills.js";
|
|
2
|
-
import type { VendorRefusalClass } from "./vendor-response.js";
|
|
3
2
|
export type AudioSource = {
|
|
4
3
|
kind: "url";
|
|
5
4
|
url: string;
|
|
@@ -43,9 +42,8 @@ export interface RenderBackend {
|
|
|
43
42
|
pollAvatarJob(handle: AvatarJobHandle, options?: {
|
|
44
43
|
deadlineMs: number;
|
|
45
44
|
}): Promise<AvatarClipResult>;
|
|
46
|
-
classifyRefusal(error: unknown):
|
|
45
|
+
classifyRefusal(error: unknown): "account_standing" | "vendor" | "unknown";
|
|
47
46
|
}
|
|
48
|
-
export declare function isRetryableVendorError(error: unknown): boolean;
|
|
49
47
|
export declare function negotiateCapabilities(req: Pick<AvatarClipRequest, "resolution" | "aspectRatio">, caps: BackendCapabilities, backendName: string): {
|
|
50
48
|
resolution: Resolution;
|
|
51
49
|
aspectRatio: AspectRatio;
|
package/dist/render-backend.js
CHANGED
package/dist/tts-backend.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { VendorRefusalClass } from "./vendor-response.js";
|
|
2
1
|
export interface WordTiming {
|
|
3
2
|
word: string;
|
|
4
3
|
startSec: number;
|
|
@@ -27,7 +26,7 @@ export interface TtsBackend {
|
|
|
27
26
|
readonly name: string;
|
|
28
27
|
readonly capabilities: TtsCapabilities;
|
|
29
28
|
synthesize(req: SpeechRequest): Promise<SpeechResult>;
|
|
30
|
-
classifyRefusal(error: unknown):
|
|
29
|
+
classifyRefusal(error: unknown): "account_standing" | "vendor" | "unknown";
|
|
31
30
|
}
|
|
32
31
|
export declare function charTimingsToWords(characters: readonly string[], startTimes: readonly number[], endTimes: readonly number[]): WordTiming[];
|
|
33
32
|
export declare const ALIGNMENT_TAIL_TOLERANCE_SEC = 0.1;
|
package/dist/voice-admission.js
CHANGED
|
@@ -5,7 +5,7 @@ import { isFacelessVoiceName } from "./faceless-voices.js";
|
|
|
5
5
|
import { filmVoiceInput } from "./own-agent-runs.js";
|
|
6
6
|
import { normalizeVoiceLabel } from "./voice-catalog.js";
|
|
7
7
|
import { VOICE_CATALOG } from "./voice-catalog-data.js";
|
|
8
|
-
import {
|
|
8
|
+
import { verifiedVoiceModels } from "./voice-verified-models.js";
|
|
9
9
|
import { isModelVoiceName, isVoicePresetName, MODEL_VOICES, resolveTtsModel, voicePresetOf, withPublishedPresetsOnly, } from "./voices.js";
|
|
10
10
|
export function catalogVoiceRefusal(voice, voices = VOICE_CATALOG.voices, options = {}) {
|
|
11
11
|
if (isVoicePresetName(voice) || isModelVoiceName(voice))
|
|
@@ -75,7 +75,7 @@ export function buildVoiceVerificationWarnings(input, gender, voices = VOICE_CAT
|
|
|
75
75
|
if (entry === undefined)
|
|
76
76
|
return [];
|
|
77
77
|
const model = resolveTtsModel(input, gender);
|
|
78
|
-
if (!
|
|
78
|
+
if (!verifiedVoiceModels(voices).includes(model))
|
|
79
79
|
return [];
|
|
80
80
|
if (entry.verified_models.includes(model))
|
|
81
81
|
return [];
|
package/dist/voice-listing.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type CatalogFileVoice, type TtsModelLanguagesFile, type VoiceCatalogFile, type VoicesQuery } from "./voice-catalog.js";
|
|
3
|
-
import {
|
|
3
|
+
import { type VoiceCatalogEntry, type VoicePreset } from "./voices.js";
|
|
4
4
|
export { TTS_MODEL_LANGUAGES, VOICE_CATALOG } from "./voice-catalog-data.js";
|
|
5
5
|
export declare const MEASURED_MODEL_LANGUAGES: Readonly<Record<string, readonly string[]>>;
|
|
6
|
-
export declare function vendorVerifiedModels(voices?: readonly CatalogFileVoice[]): readonly (typeof TTS_MODELS)[number][];
|
|
7
6
|
export declare function serverVoicesQueryFor(voices?: readonly CatalogFileVoice[]): z.ZodObject<{
|
|
8
7
|
language: z.ZodOptional<z.ZodEnum<{
|
|
9
8
|
bg: "bg";
|
package/dist/voice-listing.js
CHANGED
|
@@ -3,15 +3,13 @@ import { CATALOG_LANGUAGES, normalizeVoiceLabel, VOICES_QUERY_FIELDS, voicesQuer
|
|
|
3
3
|
import { TTS_MODEL_LANGUAGES, VOICE_CATALOG } from "./voice-catalog-data.js";
|
|
4
4
|
import { FACELESS_SPEECH_MODEL, FACELESS_VOICE_NAMES, FACELESS_VOICES } from "./faceless-voices.js";
|
|
5
5
|
import { measuredPaceOf, VOICE_PACE } from "./voice-pace.js";
|
|
6
|
+
import { verifiedVoiceModels } from "./voice-verified-models.js";
|
|
6
7
|
import { ELEVENLABS_TTS_MODELS, GOOGLE_TTS_MODEL, MODEL_VOICE_NAMES, MODEL_VOICES, resolveTtsModel, TTS_MODEL_CHAR_CAP, TTS_MODELS, VOICE_PRESETS, } from "./voices.js";
|
|
7
8
|
export { TTS_MODEL_LANGUAGES, VOICE_CATALOG } from "./voice-catalog-data.js";
|
|
8
9
|
const isLive = (voice) => voice.retired_at === undefined;
|
|
9
10
|
export const MEASURED_MODEL_LANGUAGES = {
|
|
10
11
|
[GOOGLE_TTS_MODEL]: ["en", "ru"],
|
|
11
12
|
};
|
|
12
|
-
export function vendorVerifiedModels(voices = VOICE_CATALOG.voices) {
|
|
13
|
-
return TTS_MODELS.filter((model) => voices.some((voice) => isLive(voice) && voice.verified_models.includes(model)));
|
|
14
|
-
}
|
|
15
13
|
function labelValues(voices, raw) {
|
|
16
14
|
const values = voices.filter(isLive).map((voice) => normalizeVoiceLabel(raw(voice)));
|
|
17
15
|
return [...new Set(values.filter((value) => value !== undefined))].sort();
|
|
@@ -87,7 +85,7 @@ export function listVoices(query, catalog = VOICE_CATALOG, modelLanguages = TTS_
|
|
|
87
85
|
id,
|
|
88
86
|
char_limit: TTS_MODEL_CHAR_CAP[id],
|
|
89
87
|
languages: languagesOf(id),
|
|
90
|
-
vendor_verifies_voices:
|
|
88
|
+
vendor_verifies_voices: verifiedVoiceModels(catalog.voices).includes(id),
|
|
91
89
|
})),
|
|
92
90
|
};
|
|
93
91
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VOICE_CATALOG } from "./voice-catalog-data.js";
|
|
2
|
+
import { TTS_MODELS } from "./voices.js";
|
|
3
|
+
export function verifiedVoiceModels(voices = VOICE_CATALOG.voices) {
|
|
4
|
+
return TTS_MODELS.filter((model) => voices.some((voice) => voice.retired_at === undefined && voice.verified_models.includes(model)));
|
|
5
|
+
}
|
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type VendorDispatchFact = {
|
|
2
|
-
readonly kind: "unsent";
|
|
3
|
-
} | {
|
|
4
|
-
readonly kind: "responded";
|
|
5
|
-
readonly status: number;
|
|
6
|
-
};
|
|
7
|
-
export declare function markVendorUnsent<E>(error: E): E;
|
|
8
|
-
export declare function markVendorResponse<E>(error: E, status: number): E;
|
|
9
|
-
export declare function vendorDispatchFact(error: unknown): VendorDispatchFact | undefined;
|
|
10
|
-
export type VendorJobVerdict = "succeeded" | "failed";
|
|
11
|
-
export declare function markVendorJobVerdict<E>(error: E, verdict: VendorJobVerdict): E;
|
|
12
|
-
export declare function vendorJobVerdict(error: unknown): VendorJobVerdict | undefined;
|
|
13
|
-
export declare function markVendorJobUnbilled<E>(error: E): E;
|
|
14
|
-
export declare function vendorJobUnbilled(error: unknown): boolean;
|
|
15
|
-
export type VendorRefusalClass = "account_standing" | "vendor" | "unknown";
|
|
16
|
-
export declare function markVendorRefusal<E>(error: E, refusal: VendorRefusalClass): E;
|
|
17
|
-
export declare function vendorRefusalClass(error: unknown): VendorRefusalClass;
|
|
18
|
-
export declare function withRefusalClass<T>(backend: {
|
|
19
|
-
classifyRefusal(error: unknown): VendorRefusalClass;
|
|
20
|
-
}, call: () => Promise<T>): Promise<T>;
|
package/dist/vendor-response.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
const VENDOR_DISPATCH_FACT = "clipwrightVendorDispatchFact";
|
|
2
|
-
function mark(error, fact) {
|
|
3
|
-
if (typeof error !== "object" || error === null) {
|
|
4
|
-
return error;
|
|
5
|
-
}
|
|
6
|
-
Object.defineProperty(error, VENDOR_DISPATCH_FACT, {
|
|
7
|
-
value: fact,
|
|
8
|
-
enumerable: false,
|
|
9
|
-
writable: false,
|
|
10
|
-
configurable: true,
|
|
11
|
-
});
|
|
12
|
-
return error;
|
|
13
|
-
}
|
|
14
|
-
export function markVendorUnsent(error) {
|
|
15
|
-
return mark(error, { kind: "unsent" });
|
|
16
|
-
}
|
|
17
|
-
export function markVendorResponse(error, status) {
|
|
18
|
-
return mark(error, { kind: "responded", status });
|
|
19
|
-
}
|
|
20
|
-
export function vendorDispatchFact(error) {
|
|
21
|
-
if (typeof error !== "object" || error === null) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
const value = error[VENDOR_DISPATCH_FACT];
|
|
25
|
-
if (typeof value !== "object" || value === null) {
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
const fact = value;
|
|
29
|
-
if (fact.kind === "unsent") {
|
|
30
|
-
return { kind: "unsent" };
|
|
31
|
-
}
|
|
32
|
-
if (fact.kind === "responded" && typeof fact.status === "number") {
|
|
33
|
-
return { kind: "responded", status: fact.status };
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
const VENDOR_JOB_VERDICT = "clipwrightVendorJobVerdict";
|
|
38
|
-
export function markVendorJobVerdict(error, verdict) {
|
|
39
|
-
if (typeof error !== "object" || error === null) {
|
|
40
|
-
return error;
|
|
41
|
-
}
|
|
42
|
-
Object.defineProperty(error, VENDOR_JOB_VERDICT, {
|
|
43
|
-
value: verdict,
|
|
44
|
-
enumerable: false,
|
|
45
|
-
writable: false,
|
|
46
|
-
configurable: true,
|
|
47
|
-
});
|
|
48
|
-
return error;
|
|
49
|
-
}
|
|
50
|
-
export function vendorJobVerdict(error) {
|
|
51
|
-
if (typeof error !== "object" || error === null) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
const value = error[VENDOR_JOB_VERDICT];
|
|
55
|
-
return value === "succeeded" || value === "failed" ? value : undefined;
|
|
56
|
-
}
|
|
57
|
-
const VENDOR_JOB_UNBILLED = "clipwrightVendorJobUnbilled";
|
|
58
|
-
export function markVendorJobUnbilled(error) {
|
|
59
|
-
if (typeof error !== "object" || error === null)
|
|
60
|
-
return error;
|
|
61
|
-
Object.defineProperty(error, VENDOR_JOB_UNBILLED, { value: true, enumerable: false, writable: false, configurable: true });
|
|
62
|
-
return error;
|
|
63
|
-
}
|
|
64
|
-
export function vendorJobUnbilled(error) {
|
|
65
|
-
return typeof error === "object" && error !== null && error[VENDOR_JOB_UNBILLED] === true;
|
|
66
|
-
}
|
|
67
|
-
const VENDOR_REFUSAL_CLASS = "clipwrightVendorRefusalClass";
|
|
68
|
-
export function markVendorRefusal(error, refusal) {
|
|
69
|
-
if (typeof error !== "object" || error === null) {
|
|
70
|
-
return error;
|
|
71
|
-
}
|
|
72
|
-
Object.defineProperty(error, VENDOR_REFUSAL_CLASS, {
|
|
73
|
-
value: refusal,
|
|
74
|
-
enumerable: false,
|
|
75
|
-
writable: false,
|
|
76
|
-
configurable: true,
|
|
77
|
-
});
|
|
78
|
-
return error;
|
|
79
|
-
}
|
|
80
|
-
export function vendorRefusalClass(error) {
|
|
81
|
-
if (typeof error !== "object" || error === null) {
|
|
82
|
-
return "unknown";
|
|
83
|
-
}
|
|
84
|
-
const value = error[VENDOR_REFUSAL_CLASS];
|
|
85
|
-
return value === "account_standing" || value === "vendor" ? value : "unknown";
|
|
86
|
-
}
|
|
87
|
-
export async function withRefusalClass(backend, call) {
|
|
88
|
-
try {
|
|
89
|
-
return await call();
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
throw markVendorRefusal(error, backend.classifyRefusal(error));
|
|
93
|
-
}
|
|
94
|
-
}
|