@clipwright/core 0.61.0 → 0.63.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.
Files changed (50) hide show
  1. package/dist/ad-guide.d.ts +27 -0
  2. package/dist/ad-guide.js +7 -0
  3. package/dist/ad-ids.d.ts +3 -0
  4. package/dist/ad-ids.js +4 -0
  5. package/dist/ads.d.ts +222 -0
  6. package/dist/ads.js +57 -0
  7. package/dist/api-failure.d.ts +6 -0
  8. package/dist/api-failure.js +16 -5
  9. package/dist/cut-ids.d.ts +3 -0
  10. package/dist/cut-ids.js +4 -0
  11. package/dist/cuts.d.ts +221 -0
  12. package/dist/cuts.js +51 -0
  13. package/dist/diy-next.d.ts +18 -0
  14. package/dist/diy-next.js +13 -0
  15. package/dist/edit-music.d.ts +397 -0
  16. package/dist/edit-music.js +77 -0
  17. package/dist/endpoints.js +14 -0
  18. package/dist/errors.d.ts +29 -1
  19. package/dist/errors.js +23 -0
  20. package/dist/faceless-direction-summary.d.ts +3 -0
  21. package/dist/faceless-direction-summary.js +3 -0
  22. package/dist/faceless-public-plan.js +4 -4
  23. package/dist/faceless-storyboard.js +8 -9
  24. package/dist/film-cut.d.ts +851 -0
  25. package/dist/film-cut.js +168 -0
  26. package/dist/film-guide.d.ts +27 -0
  27. package/dist/film-guide.js +10 -0
  28. package/dist/generations.d.ts +2 -1
  29. package/dist/generations.js +9 -1
  30. package/dist/idempotency.js +2 -1
  31. package/dist/index.d.ts +6 -0
  32. package/dist/index.js +6 -0
  33. package/dist/openapi.js +11 -0
  34. package/dist/own-agent-price.d.ts +41 -5
  35. package/dist/own-agent-price.js +53 -14
  36. package/dist/own-agent-runs.d.ts +320 -2
  37. package/dist/own-agent-runs.js +119 -14
  38. package/dist/prices.d.ts +1 -0
  39. package/dist/prices.js +22 -2
  40. package/dist/runs.d.ts +1 -0
  41. package/dist/runs.js +3 -0
  42. package/dist/speech-words.d.ts +4 -0
  43. package/dist/speech-words.js +30 -0
  44. package/dist/templates/sounds.d.ts +24 -0
  45. package/dist/templates/sounds.js +2 -0
  46. package/dist/trend-niches.d.ts +57 -0
  47. package/dist/trend-niches.js +59 -4
  48. package/dist/trend-search.d.ts +1 -0
  49. package/dist/trend-search.js +3 -1
  50. package/package.json +1 -1
package/dist/errors.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { diyBlocked, diyNext } from "./diy-next.js";
2
3
  import { EDIT_ISSUE_CODES } from "./edit-validate.js";
3
4
  import { workflowCommandError } from "./contracts/v1/workflow-execution.js";
4
5
  import { actorCreationLimitedError, rateLimitedError } from "./rate-limit.js";
@@ -52,6 +53,17 @@ export const accountNotAdmittedError = z.object({
52
53
  message: z.string().min(1),
53
54
  }),
54
55
  });
56
+ export const takeUncheckedError = z.object({
57
+ error: z.object({
58
+ code: z.literal("take_unchecked"),
59
+ message: z.string().min(1),
60
+ next: diyNext,
61
+ blocked: diyBlocked,
62
+ }),
63
+ });
64
+ export function takeUncheckedBody(args) {
65
+ return takeUncheckedError.parse({ error: { code: "take_unchecked", ...args } });
66
+ }
55
67
  export function insufficientCreditsBody(args) {
56
68
  return insufficientCreditsError.parse({
57
69
  error: {
@@ -289,6 +301,10 @@ const BARE_ERROR_CODES = [
289
301
  "actor_storage_unavailable",
290
302
  "actor_generation_disabled",
291
303
  "actor_in_use",
304
+ "ad_limited",
305
+ "ad_not_found",
306
+ "ad_slot_in_use",
307
+ "ad_slot_unchecked",
292
308
  "asset_cap_exceeded",
293
309
  "asset_ingest_cap_exceeded",
294
310
  "asset_not_found",
@@ -297,6 +313,10 @@ const BARE_ERROR_CODES = [
297
313
  "creator_profile_limited",
298
314
  "creator_profile_not_found",
299
315
  "creator_url_unsupported",
316
+ "cut_limited",
317
+ "cut_not_found",
318
+ "cut_preview_limited",
319
+ "cut_slot_in_use",
300
320
  "deletion_held",
301
321
  "editing_window_not_set",
302
322
  "explainer_busy",
@@ -339,6 +359,8 @@ const BARE_ERROR_CODES = [
339
359
  "run_not_found",
340
360
  "source_aspect_mismatch",
341
361
  "source_not_usable",
362
+ "take_check_limited",
363
+ "take_frames_limited",
342
364
  "trend_page_unavailable",
343
365
  "trend_search_limited",
344
366
  "trend_search_not_found",
@@ -368,6 +390,7 @@ export const API_ERROR_CODES = [
368
390
  scriptEncodingLostError.shape.error.shape.code.value,
369
391
  insufficientCreditsError.shape.error.shape.code.value,
370
392
  maxCreditsExceededError.shape.error.shape.code.value,
393
+ takeUncheckedError.shape.error.shape.code.value,
371
394
  debtOutstandingError.shape.error.shape.code.value,
372
395
  accountNotAdmittedError.shape.error.shape.code.value,
373
396
  editConflictError.shape.error.shape.code.value,
@@ -1,6 +1,9 @@
1
1
  import { z } from "zod";
2
2
  export declare const FACELESS_BEAT_KINDS: readonly ["live", "still_move", "static_insert", "customer_image", "card"];
3
3
  export declare const FACELESS_SHOT_SIZES: readonly ["ecu", "cu", "mcu", "ms", "mws", "ws", "ews"];
4
+ export declare const FACELESS_CAMERA_MOVES: readonly ["hold", "push_in", "pull_out", "pan_left", "pan_right", "tilt_up", "tilt_down", "handheld"];
5
+ export declare const FACELESS_SPEEDS: readonly ["steady", "brisk", "punch"];
6
+ export declare const FACELESS_CUT_LOOKS: readonly ["hard", "flash", "whip"];
4
7
  export declare const facelessDirectionSummary: z.ZodObject<{
5
8
  beats: z.ZodArray<z.ZodObject<{
6
9
  words: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
@@ -1,6 +1,9 @@
1
1
  import { z } from "zod";
2
2
  export const FACELESS_BEAT_KINDS = ["live", "still_move", "static_insert", "customer_image", "card"];
3
3
  export const FACELESS_SHOT_SIZES = ["ecu", "cu", "mcu", "ms", "mws", "ws", "ews"];
4
+ export const FACELESS_CAMERA_MOVES = ["hold", "push_in", "pull_out", "pan_left", "pan_right", "tilt_up", "tilt_down", "handheld"];
5
+ export const FACELESS_SPEEDS = ["steady", "brisk", "punch"];
6
+ export const FACELESS_CUT_LOOKS = ["hard", "flash", "whip"];
4
7
  const word = z.number().int().nonnegative().safe();
5
8
  export const facelessDirectionSummary = z.strictObject({
6
9
  beats: z.array(z.strictObject({ words: z.tuple([word, word]).nullable(), kind: z.enum(FACELESS_BEAT_KINDS), shot_size: z.enum(FACELESS_SHOT_SIZES) })),
@@ -3,6 +3,7 @@ import { FACELESS_MAX_OUTPUT_FRAMES, FACELESS_MIN_OUTPUT_FRAMES } from "./facele
3
3
  import { parseCutStyle } from "./faceless-cut-style.js";
4
4
  import { assertStoryboardWords } from "./faceless-storyboard.js";
5
5
  import { facelessCutScore } from "./faceless-storyboard-v2-timing.js";
6
+ import { LEXICAL_WORD } from "./speech-words.js";
6
7
  const index = z.number().int().nonnegative().safe();
7
8
  const phrase = z.strictObject({ wordStart: index, wordEnd: index, accentWord: index });
8
9
  const storySchema = z.strictObject({
@@ -17,10 +18,9 @@ const storySchema = z.strictObject({
17
18
  })).min(2),
18
19
  captionPhrases: z.array(phrase).min(1).optional(),
19
20
  });
20
- const lexicalWordPattern = /[\p{L}\p{N}\p{M}]+(?:['’][\p{L}\p{N}\p{M}]+)*/gu;
21
21
  export function facelessSpeechWordSpans(script) {
22
- const matches = [...script.matchAll(lexicalWordPattern)];
23
- const normalizedCount = script.normalize("NFKC").match(lexicalWordPattern)?.length ?? 0;
22
+ const matches = [...script.matchAll(LEXICAL_WORD)];
23
+ const normalizedCount = script.normalize("NFKC").match(LEXICAL_WORD)?.length ?? 0;
24
24
  if (!matches.length || matches.length !== normalizedCount)
25
25
  throw new Error("unsupported faceless script word boundaries");
26
26
  const compactOffset = Array(script.length + 1).fill(0);
@@ -34,7 +34,7 @@ export function facelessSpeechWordSpans(script) {
34
34
  }
35
35
  export function facelessSpeechLexicalWords(script) {
36
36
  return facelessSpeechWordSpans(script).map(({ word }) => {
37
- const normalized = word.normalize("NFKC").match(lexicalWordPattern);
37
+ const normalized = word.normalize("NFKC").match(LEXICAL_WORD);
38
38
  if (normalized?.length !== 1)
39
39
  throw new Error("unsupported faceless lexical word");
40
40
  return normalized[0].replace(/[’]/gu, "'").normalize("NFD")
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- const tokenPattern = /[\p{L}\p{N}\p{M}]+(?:['’][\p{L}\p{N}\p{M}]+)*/gu;
2
+ import { lexicalWords as tokens } from "./speech-words.js";
3
3
  const nonblank = z.string().trim().min(1);
4
4
  const index = z.number().int().nonnegative();
5
5
  const sha256 = z.string().regex(/^[0-9a-fA-F]{64}$/);
@@ -32,9 +32,6 @@ const proposalSchema = z.strictObject({
32
32
  accentWord: index,
33
33
  })).min(1),
34
34
  });
35
- function tokens(input) {
36
- return input.normalize("NFKC").match(tokenPattern) ?? [];
37
- }
38
35
  function lexical(input) {
39
36
  return input.normalize("NFKC").replace(/[’]/gu, "'").normalize("NFD")
40
37
  .replace(/\p{M}/gu, "").toLocaleLowerCase("und");
@@ -76,15 +73,17 @@ export function parseStoryboardProposal(input) {
76
73
  }
77
74
  export function assertStoryboardWords(script, words) {
78
75
  const scriptWords = tokens(script);
76
+ const differs = (i) => { const measured = tokens(words[i].word); return measured.length !== 1 || lexical(measured[0]) !== lexical(scriptWords[i]); };
77
+ const quoted = (i) => `"${words[i].word.slice(0, 40)}" in the voice, "${scriptWords[i].slice(0, 40)}" in the text`;
79
78
  if (scriptWords.length === 0 || scriptWords.length !== words.length) {
80
- throw new Error("storyboard word count mismatch");
79
+ const shared = Math.min(words.length, scriptWords.length), at = Array.from({ length: shared }, (_, i) => i).find(differs);
80
+ throw new Error(`storyboard word count mismatch: the voice has ${words.length} words and its text ${scriptWords.length}` +
81
+ (at === undefined ? "" : `; word ${at} is the first that differs: ${quoted(at)}`));
81
82
  }
82
83
  for (let i = 0; i < words.length; i++) {
83
84
  const timed = words[i];
84
- const measured = tokens(timed.word);
85
- if (measured.length !== 1 || lexical(measured[0]) !== lexical(scriptWords[i])) {
86
- throw new Error(`storyboard word ${i} differs from script`);
87
- }
85
+ if (differs(i))
86
+ throw new Error(`storyboard word ${i} differs from script: ${quoted(i)}`);
88
87
  if (!Number.isFinite(timed.startSec) || !Number.isFinite(timed.endSec) ||
89
88
  timed.startSec < 0 || timed.endSec <= timed.startSec ||
90
89
  (i > 0 && timed.startSec < words[i - 1].endSec)) {