@clipwright/core 0.62.0 → 0.64.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/ad-guide.d.ts +8 -0
- package/dist/ad-guide.js +2 -0
- package/dist/ads.d.ts +78 -1
- package/dist/ads.js +4 -3
- package/dist/brand-styles.d.ts +6 -0
- package/dist/cut-ids.d.ts +3 -0
- package/dist/cut-ids.js +4 -0
- package/dist/cuts.d.ts +221 -0
- package/dist/cuts.js +51 -0
- package/dist/design.d.ts +30 -0
- package/dist/design.js +29 -1
- package/dist/endpoints.js +10 -0
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +5 -0
- package/dist/faceless-direction-summary.d.ts +3 -0
- package/dist/faceless-direction-summary.js +3 -0
- package/dist/faceless-public-plan.js +4 -4
- package/dist/faceless-storyboard.js +8 -9
- package/dist/film-cut.d.ts +851 -0
- package/dist/film-cut.js +168 -0
- package/dist/film-guide.d.ts +35 -0
- package/dist/film-guide.js +12 -0
- package/dist/film-look.d.ts +3 -0
- package/dist/film-look.js +3 -0
- package/dist/generations.d.ts +2 -1
- package/dist/generations.js +9 -1
- package/dist/idempotency.js +2 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/openapi.js +8 -0
- package/dist/own-agent-price.d.ts +40 -3
- package/dist/own-agent-price.js +48 -10
- package/dist/own-agent-runs.d.ts +79 -1
- package/dist/own-agent-runs.js +60 -10
- package/dist/prices.d.ts +1 -0
- package/dist/prices.js +27 -2
- package/dist/runs.d.ts +1 -0
- package/dist/runs.js +3 -0
- package/dist/speech-words.d.ts +4 -0
- package/dist/speech-words.js +30 -0
- package/dist/trend-niches.d.ts +57 -0
- package/dist/trend-niches.js +59 -4
- package/dist/trend-search.d.ts +1 -0
- package/dist/trend-search.js +3 -1
- package/package.json +1 -1
package/dist/own-agent-runs.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare const filmVoiceInput: z.ZodObject<{
|
|
|
64
64
|
narrator_tr_confident_woman: "narrator_tr_confident_woman";
|
|
65
65
|
narrator_tr_mature_man: "narrator_tr_mature_man";
|
|
66
66
|
}>>;
|
|
67
|
+
cut_id: z.ZodOptional<z.ZodString>;
|
|
67
68
|
max_credits: z.ZodOptional<z.ZodNumber>;
|
|
68
69
|
}, z.core.$strict>;
|
|
69
70
|
export type FilmVoiceInput = z.infer<typeof filmVoiceInput>;
|
|
@@ -222,13 +223,53 @@ export declare const takeFramesInput: z.ZodObject<{
|
|
|
222
223
|
}, z.core.$strict>;
|
|
223
224
|
export type TakeFramesInput = z.infer<typeof takeFramesInput>;
|
|
224
225
|
export type TakeFramesRequest = z.input<typeof takeFramesInput>;
|
|
226
|
+
export declare const TAKE_CHECK_AGAINST: readonly ["motion", "picture"];
|
|
227
|
+
export type TakeCheckAgainst = (typeof TAKE_CHECK_AGAINST)[number];
|
|
228
|
+
export declare const TAKE_PICTURE_MAX_CHANGES = 4, TAKE_PICTURE_MAX_LOCKS = 6;
|
|
229
|
+
export declare const pictureTakeAsk: z.ZodObject<{
|
|
230
|
+
start: z.ZodString;
|
|
231
|
+
changes: z.ZodArray<z.ZodObject<{
|
|
232
|
+
at_s: z.ZodNumber;
|
|
233
|
+
cause: z.ZodString;
|
|
234
|
+
result: z.ZodString;
|
|
235
|
+
}, z.core.$strict>>;
|
|
236
|
+
camera: z.ZodDefault<z.ZodString>;
|
|
237
|
+
end: z.ZodString;
|
|
238
|
+
locks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
239
|
+
}, z.core.$strict>;
|
|
240
|
+
export type PictureTakeAsk = z.infer<typeof pictureTakeAsk>;
|
|
225
241
|
export declare const takeCheckInput: z.ZodObject<{
|
|
226
242
|
run_id: z.ZodOptional<z.ZodString>;
|
|
227
243
|
asset_id: z.ZodOptional<z.ZodString>;
|
|
228
|
-
|
|
244
|
+
against: z.ZodOptional<z.ZodEnum<{
|
|
245
|
+
motion: "motion";
|
|
246
|
+
picture: "picture";
|
|
247
|
+
}>>;
|
|
248
|
+
direction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
249
|
+
start: z.ZodString;
|
|
250
|
+
changes: z.ZodArray<z.ZodObject<{
|
|
251
|
+
at_s: z.ZodNumber;
|
|
252
|
+
cause: z.ZodString;
|
|
253
|
+
result: z.ZodString;
|
|
254
|
+
}, z.core.$strict>>;
|
|
255
|
+
camera: z.ZodDefault<z.ZodString>;
|
|
256
|
+
end: z.ZodString;
|
|
257
|
+
locks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
258
|
+
}, z.core.$strict>]>;
|
|
259
|
+
look: z.ZodOptional<z.ZodObject<{
|
|
260
|
+
words: z.ZodString;
|
|
261
|
+
palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
262
|
+
}, z.core.$strict>>;
|
|
263
|
+
picture: z.ZodOptional<z.ZodObject<{
|
|
264
|
+
run_id: z.ZodOptional<z.ZodString>;
|
|
265
|
+
upload_id: z.ZodOptional<z.ZodString>;
|
|
266
|
+
rights_confirmed: z.ZodOptional<z.ZodBoolean>;
|
|
267
|
+
asset_id: z.ZodOptional<z.ZodString>;
|
|
268
|
+
}, z.core.$strict>>;
|
|
229
269
|
product_image: z.ZodOptional<z.ZodString>;
|
|
230
270
|
moves: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
231
271
|
ad_id: z.ZodOptional<z.ZodString>;
|
|
272
|
+
cut_id: z.ZodOptional<z.ZodString>;
|
|
232
273
|
slot: z.ZodOptional<z.ZodString>;
|
|
233
274
|
format: z.ZodOptional<z.ZodEnum<{
|
|
234
275
|
fashion: "fashion";
|
|
@@ -311,6 +352,17 @@ export declare const takeCheckVerdict: z.ZodObject<{
|
|
|
311
352
|
finding: z.ZodNullable<z.ZodString>;
|
|
312
353
|
shake: z.ZodNullable<z.ZodString>;
|
|
313
354
|
}, z.core.$strict>>;
|
|
355
|
+
against: z.ZodOptional<z.ZodEnum<{
|
|
356
|
+
motion: "motion";
|
|
357
|
+
picture: "picture";
|
|
358
|
+
}>>;
|
|
359
|
+
action_at_s: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
360
|
+
subject: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
361
|
+
x: z.ZodNumber;
|
|
362
|
+
y: z.ZodNumber;
|
|
363
|
+
w: z.ZodNumber;
|
|
364
|
+
h: z.ZodNumber;
|
|
365
|
+
}, z.core.$strict>>>;
|
|
314
366
|
}, z.core.$strict>;
|
|
315
367
|
export type TakeCheckVerdict = z.infer<typeof takeCheckVerdict>;
|
|
316
368
|
export declare const takeCheckPassed: (verdict: Pick<TakeCheckVerdict, "findings" | "clean">) => boolean;
|
|
@@ -340,6 +392,8 @@ export declare const ownAgentQuoteLine: z.ZodObject<{
|
|
|
340
392
|
export type OwnAgentQuoteLine = z.infer<typeof ownAgentQuoteLine>;
|
|
341
393
|
export declare const ownAgentQuote: z.ZodObject<{
|
|
342
394
|
skill: z.ZodEnum<{
|
|
395
|
+
film_cut: "film_cut";
|
|
396
|
+
film_cut_preview: "film_cut_preview";
|
|
343
397
|
film_edit: "film_edit";
|
|
344
398
|
film_hero: "film_hero";
|
|
345
399
|
film_render: "film_render";
|
|
@@ -362,6 +416,17 @@ export declare const ownAgentQuote: z.ZodObject<{
|
|
|
362
416
|
free_units: z.ZodOptional<z.ZodNumber>;
|
|
363
417
|
free_left: z.ZodOptional<z.ZodNumber>;
|
|
364
418
|
frames: z.ZodOptional<z.ZodNumber>;
|
|
419
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
420
|
+
item: z.ZodEnum<{
|
|
421
|
+
bed: "bed";
|
|
422
|
+
cut: "cut";
|
|
423
|
+
extra_seconds: "extra_seconds";
|
|
424
|
+
music: "music";
|
|
425
|
+
take_sound: "take_sound";
|
|
426
|
+
}>;
|
|
427
|
+
units: z.ZodNumber;
|
|
428
|
+
credits: z.ZodNumber;
|
|
429
|
+
}, z.core.$strict>>>;
|
|
365
430
|
lines: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
366
431
|
label: z.ZodString;
|
|
367
432
|
unit: z.ZodEnum<{
|
|
@@ -401,6 +466,8 @@ export declare const filmWord: z.ZodObject<{
|
|
|
401
466
|
export declare const filmRun: z.ZodObject<{
|
|
402
467
|
run_id: z.ZodString;
|
|
403
468
|
skill: z.ZodEnum<{
|
|
469
|
+
film_cut: "film_cut";
|
|
470
|
+
film_cut_preview: "film_cut_preview";
|
|
404
471
|
film_edit: "film_edit";
|
|
405
472
|
film_hero: "film_hero";
|
|
406
473
|
film_render: "film_render";
|
|
@@ -514,6 +581,17 @@ export declare const filmRun: z.ZodObject<{
|
|
|
514
581
|
finding: z.ZodNullable<z.ZodString>;
|
|
515
582
|
shake: z.ZodNullable<z.ZodString>;
|
|
516
583
|
}, z.core.$strict>>;
|
|
584
|
+
against: z.ZodOptional<z.ZodEnum<{
|
|
585
|
+
motion: "motion";
|
|
586
|
+
picture: "picture";
|
|
587
|
+
}>>;
|
|
588
|
+
action_at_s: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
589
|
+
subject: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
590
|
+
x: z.ZodNumber;
|
|
591
|
+
y: z.ZodNumber;
|
|
592
|
+
w: z.ZodNumber;
|
|
593
|
+
h: z.ZodNumber;
|
|
594
|
+
}, z.core.$strict>>>;
|
|
517
595
|
}, z.core.$strict>>;
|
|
518
596
|
next: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
519
597
|
action: z.ZodString;
|
package/dist/own-agent-runs.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { assetId } from "./asset-identity.js";
|
|
3
3
|
import { adId, adSlotId } from "./ad-ids.js";
|
|
4
|
+
import { cutId } from "./cut-ids.js";
|
|
4
5
|
import { diyBlocked, diyNext } from "./diy-next.js";
|
|
5
6
|
import { editMusic } from "./edit-music.js";
|
|
6
7
|
import { EXPLAINER_MAX_PRODUCT_PICTURES, facelessCustomerSceneImage, qualifiedImageUrl } from "./faceless-public.js";
|
|
7
8
|
import { FACELESS_VOICE_NAMES } from "./faceless-voices.js";
|
|
9
|
+
import { filmCutPicture } from "./film-cut.js";
|
|
8
10
|
import { filmDraftId } from "./film-drafts.js";
|
|
9
11
|
import { MASCOT_POSES } from "./mascots.js";
|
|
10
12
|
import { maxCreditsField } from "./max-credits.js";
|
|
@@ -49,6 +51,7 @@ export const filmStillsInput = z.strictObject({
|
|
|
49
51
|
export const filmVoiceInput = z.strictObject({
|
|
50
52
|
text: z.string().trim().min(1).max(OWN_VOICE_MAX_CHARS).describe("The script, spoken exactly as written"),
|
|
51
53
|
voice: z.enum(FACELESS_VOICE_NAMES).optional().describe("A narrator (list_voices with skill=make_faceless); the fastest of the script's language when omitted"),
|
|
54
|
+
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"),
|
|
52
55
|
max_credits: maxCreditsField,
|
|
53
56
|
});
|
|
54
57
|
export const filmRenderInput = z.strictObject({
|
|
@@ -70,7 +73,8 @@ const editClip = z.strictObject({
|
|
|
70
73
|
from: editSecond.describe("The second of the clip the cut starts at"),
|
|
71
74
|
to: editSecond.describe("The second of the clip the cut ends at, after from"),
|
|
72
75
|
speed: z.number().min(0.5).max(2).default(1).describe("Play speed; the clip lasts (to - from) / speed in the edit. 1.2 lifts a slow beat"),
|
|
73
|
-
slot: adSlotId.optional().describe("With ad_id: the slot of the ad this clip fills
|
|
76
|
+
slot: adSlotId.optional().describe("With ad_id: the slot of the ad this clip fills. A clip made with generate_video must have passed " +
|
|
77
|
+
"check_take in that slot; your own footage needs no check"),
|
|
74
78
|
}).refine(clip => (clip.run_id === undefined) !== (clip.asset_id === undefined), "name the clip by run_id or by asset_id, one of them")
|
|
75
79
|
.refine(clip => clip.to > clip.from, "to must be after from");
|
|
76
80
|
const voicePiece = z.strictObject({
|
|
@@ -111,8 +115,8 @@ export const filmEditInput = z.strictObject({
|
|
|
111
115
|
.describe("Seconds the last frame is held at the end, for the packshot"),
|
|
112
116
|
music: editMusic.optional().describe("Music from at to the end: a library track (free) or one made for the cut (paid on delivery); " +
|
|
113
117
|
"under a voice it plays lower"),
|
|
114
|
-
ad_id: adId.optional().describe("The ad record this cut belongs to: every clip then names its slot, and a
|
|
115
|
-
"check_take is refused before any credits"),
|
|
118
|
+
ad_id: adId.optional().describe("The ad record this cut belongs to: every clip then names its slot, and a clip made with generate_video " +
|
|
119
|
+
"that has not passed check_take in its slot is refused before any credits; your own footage needs no check"),
|
|
116
120
|
max_credits: maxCreditsField,
|
|
117
121
|
}).refine(edit => edit.ad_id !== undefined || edit.clips.every(clip => clip.slot === undefined), "a clip's slot needs ad_id")
|
|
118
122
|
.refine(edit => edit.ad_id === undefined || edit.clips.every(clip => clip.slot !== undefined), "with ad_id, every clip names its slot");
|
|
@@ -143,20 +147,59 @@ export const takeFramesInput = z.strictObject({
|
|
|
143
147
|
.describe("Only this part of the frame, enlarged: x, y from the top-left corner and w, h, each a share of the frame's width or height"),
|
|
144
148
|
max_credits: maxCreditsField,
|
|
145
149
|
}).refine(oneTake, ONE_TAKE).refine(v => v.from === undefined || v.to === undefined || v.to > v.from, "to must be after from");
|
|
150
|
+
export const TAKE_CHECK_AGAINST = ["motion", "picture"];
|
|
151
|
+
export const TAKE_PICTURE_MAX_CHANGES = 4, TAKE_PICTURE_MAX_LOCKS = 6;
|
|
152
|
+
const words = (most) => z.string().trim().min(1).max(most);
|
|
153
|
+
export const pictureTakeAsk = z.strictObject({
|
|
154
|
+
start: words(300).describe("What the first frame shows"),
|
|
155
|
+
changes: z.array(z.strictObject({ at_s: takeSecond.describe("The second of the take the change starts"), cause: words(200), result: words(240) }))
|
|
156
|
+
.min(1).max(TAKE_PICTURE_MAX_CHANGES).describe("Each change the take was asked to show, in order"),
|
|
157
|
+
camera: words(160).default("as made").describe("The camera's move; omitted, as made"),
|
|
158
|
+
end: words(300).describe("What the last frame shows"),
|
|
159
|
+
locks: z.array(words(200)).max(TAKE_PICTURE_MAX_LOCKS).default([]).describe("What must stay as the picture shows it"),
|
|
160
|
+
});
|
|
161
|
+
const hexColour = z.string().regex(/^#[0-9a-fA-F]{6}$/, "a colour is #RRGGBB");
|
|
162
|
+
const PICTURE_ONLY = ["look", "picture", "cut_id"], MOTION_ONLY = ["product_image", "moves", "format", "ad_id"];
|
|
146
163
|
export const takeCheckInput = z.strictObject({
|
|
147
164
|
...takeSource,
|
|
148
|
-
|
|
149
|
-
|
|
165
|
+
against: z.enum(TAKE_CHECK_AGAINST).optional().describe("motion (an ad shot, the default) or picture: the take against the picture it was " +
|
|
166
|
+
"made from, with direction as start, changes, camera, end and locks"),
|
|
167
|
+
direction: z.union([z.string().trim().min(1).max(TAKE_CHECK_PROMPT_MAX_CHARS), pictureTakeAsk])
|
|
168
|
+
.describe("What the take was asked to show: the shot's part of the prompt you made it with (its action and timeline), up to 1500 characters; " +
|
|
169
|
+
"with against picture, the object of start, changes, camera, end and locks"),
|
|
170
|
+
look: z.strictObject({ words: words(200).describe("The video's look in words"),
|
|
171
|
+
palette: z.array(hexColour).min(3).max(5).optional().describe("Its colours") }).optional()
|
|
172
|
+
.describe("With against picture: the look a colour outside it is named against"),
|
|
173
|
+
picture: filmCutPicture.optional().describe("With against picture: the picture the take is checked against; needed only when the take " +
|
|
174
|
+
"was not made from a first frame, and it must be that first frame when it was"),
|
|
150
175
|
product_image: qualifiedImageUrl.optional()
|
|
151
176
|
.describe("https picture of the product as it really is (your upload or a saved asset): the take's product is compared with it"),
|
|
152
177
|
moves: z.array(takeSecond).max(TAKE_CHECK_MAX_MOVES).optional()
|
|
153
178
|
.describe("Seconds of the take where a hand meets the product (a grip, a lid, a set-down): looked at first"),
|
|
154
179
|
ad_id: adId.optional().describe("With slot: the ad record the verdict joins, as a take of that slot"),
|
|
155
|
-
|
|
180
|
+
cut_id: cutId.optional().describe("With against picture, required with slot: the cut record the verdict joins, as a take of that slot"),
|
|
181
|
+
slot: adSlotId.optional().describe("With ad_id or cut_id: the slot of the record this take is for; on a cut record, a slot that needs a take"),
|
|
156
182
|
format: z.enum(TAKE_MOTION_FORMATS).optional().describe("What the take's motion is measured against: fashion (people and clothes in " +
|
|
157
183
|
"motion: fashion, lifestyle, sport) or product (a product worked in the hands); omitted, product"),
|
|
158
184
|
max_credits: maxCreditsField,
|
|
159
|
-
}).refine(oneTake, ONE_TAKE)
|
|
185
|
+
}).refine(oneTake, ONE_TAKE)
|
|
186
|
+
.superRefine((v, ctx) => {
|
|
187
|
+
const picture = v.against === "picture", refuse = (path, message) => ctx.addIssue({ code: z.ZodIssueCode.custom, path: [path], message });
|
|
188
|
+
if (picture && v.cut_id === undefined)
|
|
189
|
+
refuse("cut_id", "with against picture, name the cut record (create_cut) the take is for");
|
|
190
|
+
if (picture && v.slot === undefined)
|
|
191
|
+
refuse("slot", "with against picture, name the cut record's slot the take is for");
|
|
192
|
+
if (!picture && (v.ad_id === undefined) !== (v.slot === undefined))
|
|
193
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: [], message: "ad_id and slot go together" });
|
|
194
|
+
if (picture !== (typeof v.direction === "object"))
|
|
195
|
+
refuse("direction", picture ? "with against picture, direction is an object of start, changes, " +
|
|
196
|
+
"camera, end and locks" : "direction is the shot's prompt as text; the object form goes with against picture");
|
|
197
|
+
if (picture && v.look === undefined)
|
|
198
|
+
refuse("look", "with against picture, name the look");
|
|
199
|
+
for (const key of picture ? MOTION_ONLY : PICTURE_ONLY)
|
|
200
|
+
if (v[key] !== undefined)
|
|
201
|
+
refuse(key, picture ? `${key} goes with a motion check, not against picture` : `${key} goes with against picture`);
|
|
202
|
+
});
|
|
160
203
|
export const TAKE_DEFECT_LEVELS = ["asset", "action", "camera", "roll"];
|
|
161
204
|
const takeWindow = z.strictObject({ from: z.number().min(0), to: z.number().min(0) });
|
|
162
205
|
const motionNumbers = {
|
|
@@ -177,7 +220,11 @@ export const takeCheckVerdict = z.strictObject({ duration_sec: z.number().positi
|
|
|
177
220
|
findings: z.array(z.strictObject({ code: z.string(), level: z.enum(TAKE_DEFECT_LEVELS), from: z.number().min(0), to: z.number().min(0),
|
|
178
221
|
whole_take: z.boolean(), why: z.string().nullable() })),
|
|
179
222
|
clean: z.array(takeWindow),
|
|
180
|
-
motion: takeMotion.optional()
|
|
223
|
+
motion: takeMotion.optional(),
|
|
224
|
+
against: z.enum(TAKE_CHECK_AGAINST).optional(),
|
|
225
|
+
action_at_s: z.number().min(0).nullable().optional().describe("Against picture: the second the first asked change shows; null when it never does"),
|
|
226
|
+
subject: z.strictObject({ x: z.number().min(0).max(1), y: z.number().min(0).max(1), w: z.number().min(0).max(1), h: z.number().min(0).max(1) })
|
|
227
|
+
.nullable().optional().describe("Against picture: the main subject's box at that second, shares of the frame from its top-left corner") });
|
|
181
228
|
export const takeCheckPassed = (verdict) => verdict.clean.length > 0 && !verdict.findings.some(finding => finding.whole_take);
|
|
182
229
|
export const FILM_HERO_SOURCE_FIELDS = ["character_reference", "character_details", "script", "voice_run_id"];
|
|
183
230
|
export const filmHeroInput = z.strictObject({
|
|
@@ -207,9 +254,12 @@ export const ownAgentQuote = z.strictObject({
|
|
|
207
254
|
units: z.number().int().nonnegative(),
|
|
208
255
|
film_sec: filmSec.optional(),
|
|
209
256
|
free_units: z.number().int().nonnegative().optional()
|
|
210
|
-
.describe(`How many of the asked stills are free: the first ${OWN_FREE_STILLS} stills of a draft in any
|
|
211
|
-
|
|
257
|
+
.describe(`How many of the asked stills are free: the first ${OWN_FREE_STILLS} stills of a draft, or previews of an account, in any ` +
|
|
258
|
+
`${OWN_FREE_STILLS_WINDOW_HOURS} h are`),
|
|
259
|
+
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"),
|
|
212
260
|
frames: z.number().int().positive().optional(),
|
|
261
|
+
items: z.array(z.strictObject({ item: z.enum(["cut", "extra_seconds", "bed", "take_sound", "music"]), units: z.number().int().nonnegative(),
|
|
262
|
+
credits: z.number().int().nonnegative() })).optional(),
|
|
213
263
|
lines: z.array(ownAgentQuoteLine).optional(),
|
|
214
264
|
warnings: z.array(z.string()),
|
|
215
265
|
next: diyNext.optional(),
|
package/dist/prices.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export type PricesResponseRead = z.infer<typeof pricesResponseRead>;
|
|
|
93
93
|
export declare const isPaidEntry: (entry: PriceEntry) => boolean;
|
|
94
94
|
export declare const FREE_RUN_ROUTES: ReadonlySet<string>;
|
|
95
95
|
export declare const AD_DIY_PRICES: readonly PriceEntry[];
|
|
96
|
+
export declare const FACELESS_DIY_PRICES: readonly PriceEntry[];
|
|
96
97
|
export declare function priceListFor(env: Record<string, string | undefined>): readonly PriceEntry[];
|
|
97
98
|
export declare const PRICE_LIST: readonly PriceEntry[];
|
|
98
99
|
export declare const priceText: (entry: PriceEntry) => string;
|
package/dist/prices.js
CHANGED
|
@@ -11,7 +11,8 @@ import { REFERENCE_ANALYSIS_CREDITS, REFERENCE_DATA_CREDITS } from "./reference-
|
|
|
11
11
|
import { CREATOR_PROFILE_CREDITS, CREATOR_PROFILE_VIDEOS } from "./creator-profile.js";
|
|
12
12
|
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";
|
|
13
13
|
import { isMusicEnabled, MUSIC_BED_CREDITS } from "./music.js";
|
|
14
|
-
import { isOwnAgentEnabled, OWN_FILM_EXTRA_SECOND_CREDITS, OWN_FILM_INCLUDED_SECONDS, OWN_FILM_RENDER_CREDITS, OWN_HERO_POSE_CREDITS, OWN_HERO_POSES, 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 } from "./own-agent-price.js";
|
|
14
|
+
import { isOwnAgentEnabled, OWN_FILM_EXTRA_SECOND_CREDITS, OWN_FILM_INCLUDED_SECONDS, OWN_FILM_RENDER_CREDITS, OWN_HERO_POSE_CREDITS, OWN_HERO_POSES, 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, TAKE_PICTURE_SHORT_TIER_SECONDS } from "./own-agent-price.js";
|
|
15
|
+
import { CUT_PREVIEW_MAX_STILLS } from "./film-cut.js";
|
|
15
16
|
export const PRICES_PATH = "/v1/public/prices";
|
|
16
17
|
export const PRICE_UNITS = ["call", "second", "face_second", "image", "clip", "clip_second", "still", "scene", "track"];
|
|
17
18
|
export const priceEntryLine = z.strictObject({
|
|
@@ -123,11 +124,35 @@ export const AD_DIY_PRICES = Object.freeze([
|
|
|
123
124
|
"delivered cut; an edit that fails costs nothing." }),
|
|
124
125
|
paid({ tool: "check_take", route: "POST /v1/take-checks", quote_tool: "quote_take_check", unit: "call", credits: OWN_TAKE_CHECK_CREDITS,
|
|
125
126
|
notes: "One of your clips judged frame by frame against the prompt it was made with: each defect with its seconds and how to repair " +
|
|
126
|
-
"it, and the clean windows. Charged only for a delivered verdict; a check that
|
|
127
|
+
"it, and the clean windows. Charged only for a delivered verdict; a check that delivers no verdict costs nothing." }),
|
|
127
128
|
{ action: "take_frames", tool: "take_frames", route: "POST /v1/take-frames", variant: null, lines: [{ label: null, unit: "call", credits: 0 }],
|
|
128
129
|
formula: null, minimum_credits: null, quote_tool: null,
|
|
129
130
|
notes: "Free: one of your clips as contact sheets, each frame labelled with its second, up to 96 frames a call." },
|
|
130
131
|
]);
|
|
132
|
+
export const FACELESS_DIY_PRICES = Object.freeze([
|
|
133
|
+
paid({ tool: "render_cut", route: "POST /v1/film-cuts", quote_tool: "quote_cut", lines: [
|
|
134
|
+
{ label: `the cut, up to ${OWN_CUT_INCLUDED_SECONDS} s`, unit: "call", credits: OWN_CUT_CREDITS },
|
|
135
|
+
{ label: `each second over ${OWN_CUT_INCLUDED_SECONDS}`, unit: "second", credits: OWN_CUT_EXTRA_SECOND_CREDITS },
|
|
136
|
+
{ label: "a described bed, once per cut", unit: "call", credits: OWN_CUT_BED_CREDITS },
|
|
137
|
+
{ label: "a take's own sound, each second of the whole take", unit: "second", credits: OWN_CUT_TAKE_SOUND_CREDITS_PER_SECOND },
|
|
138
|
+
{ label: "music", unit: "track", credits: MUSIC_BED_CREDITS }
|
|
139
|
+
],
|
|
140
|
+
notes: `One faceless video of ${OWN_CUT_MIN_SECONDS} to ${OWN_CUT_MAX_SECONDS} s from your checked cut sheet, vertical 720p in stereo, with up ` +
|
|
141
|
+
`to ${OWN_CUT_MAX_NEW_SOUNDS} described sounds made. Charged only for a delivered video and only for the parts it carries; a cut that ` +
|
|
142
|
+
"fails costs nothing." }),
|
|
143
|
+
paid({ tool: "check_take", variant: "against a picture", route: "POST /v1/take-checks", quote_tool: "quote_take_check", unit: "call",
|
|
144
|
+
credits: OWN_TAKE_CHECK_PICTURE_CREDITS,
|
|
145
|
+
notes: `One take of your cut record, up to ${TAKE_PICTURE_SHORT_TIER_SECONDS} s long, judged against the picture it was made from: each ` +
|
|
146
|
+
"defect with its seconds, the clean windows, the second its action shows and where its subject stands. Charged only for a delivered " +
|
|
147
|
+
"verdict; a check that delivers no verdict costs nothing." }),
|
|
148
|
+
paid({ tool: "check_take", variant: `against a picture, a take over ${TAKE_PICTURE_SHORT_TIER_SECONDS} s`, route: "POST /v1/take-checks",
|
|
149
|
+
quote_tool: "quote_take_check", unit: "call", credits: OWN_TAKE_CHECK_PICTURE_LONG_CREDITS,
|
|
150
|
+
notes: `The same check of a take longer than ${TAKE_PICTURE_SHORT_TIER_SECONDS} s. Charged only for a delivered verdict; a check that ` +
|
|
151
|
+
"delivers no verdict costs nothing." }),
|
|
152
|
+
paid({ tool: "preview_cut", route: "POST /v1/cut-previews", quote_tool: "quote_cut_preview", unit: "still", credits: OWN_STILL_CREDITS,
|
|
153
|
+
notes: `Up to ${CUT_PREVIEW_MAX_STILLS} frames of your checked cut sheet as the video draws them, on the words you name. The first ` +
|
|
154
|
+
`${OWN_FREE_STILLS} preview stills of an account in any ${OWN_FREE_STILLS_WINDOW_HOURS} h are free; a preview that fails costs nothing.` }),
|
|
155
|
+
]);
|
|
131
156
|
function buildPriceList(liveShots, scenes, facelessShots = false, facelessScenes = false, music = false, explainer = false, ownAgent = false) {
|
|
132
157
|
const unit = EDIT_UNIT_PRICES;
|
|
133
158
|
const parts = PARTS_FACE_TARIFF;
|
package/dist/runs.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare const AI_DISCLOSURE_TEXT = "This video was generated with AI: the
|
|
|
33
33
|
export declare const FACELESS_AI_DISCLOSURE_TEXT = "This video was generated with AI: the voice, the opening clip and the images are synthetic.";
|
|
34
34
|
export declare const FACELESS_EXPLAINER_AI_DISCLOSURE_TEXT = "This video was generated with AI: the voice, the animation and the images in it are synthetic.";
|
|
35
35
|
export declare const FACELESS_OWN_IMAGES_AI_DISCLOSURE_TEXT: string;
|
|
36
|
+
export declare const FILM_CUT_AI_DISCLOSURE_TEXT = "This video was generated with AI: the voice is synthetic, and so is every picture and clip its author did not supply.";
|
|
36
37
|
export declare function aiDisclosureText(skill: string, input: unknown): string;
|
|
37
38
|
export declare function facelessOwnImages(input: unknown): boolean;
|
|
38
39
|
export declare const AI_DISCLOSURE_EMBEDDED_METADATA_KEY = "ai-disclosure-embedded";
|
package/dist/runs.js
CHANGED
|
@@ -40,7 +40,10 @@ export const FACELESS_AI_DISCLOSURE_TEXT = "This video was generated with AI: th
|
|
|
40
40
|
export const FACELESS_EXPLAINER_AI_DISCLOSURE_TEXT = "This video was generated with AI: the voice, the animation and the images in it are synthetic.";
|
|
41
41
|
export const FACELESS_OWN_IMAGES_AI_DISCLOSURE_TEXT = "This video was generated with AI: the voice and the opening clip are synthetic, " +
|
|
42
42
|
"and so is every image its author did not supply.";
|
|
43
|
+
export const FILM_CUT_AI_DISCLOSURE_TEXT = "This video was generated with AI: the voice is synthetic, and so is every picture and clip its author did not supply.";
|
|
43
44
|
export function aiDisclosureText(skill, input) {
|
|
45
|
+
if (skill === "film_cut" || skill === "film_cut_preview")
|
|
46
|
+
return FILM_CUT_AI_DISCLOSURE_TEXT;
|
|
44
47
|
if (skill === "revise_long_form")
|
|
45
48
|
return AI_DISCLOSURE_TEXT;
|
|
46
49
|
if (skill !== "make_faceless")
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const LEXICAL_WORD = /[\p{L}\p{N}\p{M}]+(?:['’][\p{L}\p{N}\p{M}]+)*/gu;
|
|
2
|
+
export function lexicalWords(text) {
|
|
3
|
+
return text.normalize("NFKC").match(LEXICAL_WORD) ?? [];
|
|
4
|
+
}
|
|
5
|
+
export function lexicalWordTimings(words) {
|
|
6
|
+
const out = [];
|
|
7
|
+
let lead = "";
|
|
8
|
+
for (const timed of words) {
|
|
9
|
+
const text = timed.word.normalize("NFKC"), matches = [...text.matchAll(LEXICAL_WORD)];
|
|
10
|
+
if (!matches.length) {
|
|
11
|
+
const last = out.at(-1);
|
|
12
|
+
if (last)
|
|
13
|
+
last.word += text;
|
|
14
|
+
else
|
|
15
|
+
lead += text;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const letters = matches.reduce((sum, match) => sum + match[0].length, 0), span = timed.endSec - timed.startSec;
|
|
19
|
+
let before = 0;
|
|
20
|
+
matches.forEach((match, at) => {
|
|
21
|
+
const from = at === 0 ? 0 : match.index, to = matches[at + 1]?.index ?? text.length, after = before + match[0].length;
|
|
22
|
+
out.push({ word: (at === 0 ? lead : "") + text.slice(from, to),
|
|
23
|
+
startSec: at === 0 ? timed.startSec : timed.startSec + span * before / letters,
|
|
24
|
+
endSec: at === matches.length - 1 ? timed.endSec : timed.startSec + span * after / letters });
|
|
25
|
+
before = after;
|
|
26
|
+
});
|
|
27
|
+
lead = "";
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
package/dist/trend-niches.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { type CreatorPlatform } from "./creator-profile.js";
|
|
2
3
|
import { type FindTrendsRequest, type TrendReel } from "./trend-search.js";
|
|
3
4
|
export declare const TREND_NICHES_PATH = "/v1/trend-niches";
|
|
4
5
|
export declare const TREND_NICHES_MAX = 3;
|
|
@@ -41,6 +42,25 @@ export declare const trendNiche: z.ZodObject<{
|
|
|
41
42
|
primary: z.ZodBoolean;
|
|
42
43
|
}, z.core.$strict>;
|
|
43
44
|
export type TrendNiche = z.infer<typeof trendNiche>;
|
|
45
|
+
export declare const TREND_NICHE_SUGGESTIONS_MAX = 3;
|
|
46
|
+
export declare const trendNicheSuggestion: z.ZodObject<{
|
|
47
|
+
keywords: z.ZodString;
|
|
48
|
+
platform: z.ZodEnum<{
|
|
49
|
+
instagram: "instagram";
|
|
50
|
+
mix: "mix";
|
|
51
|
+
tiktok: "tiktok";
|
|
52
|
+
}>;
|
|
53
|
+
from: z.ZodObject<{
|
|
54
|
+
platform: z.ZodEnum<{
|
|
55
|
+
instagram: "instagram";
|
|
56
|
+
tiktok: "tiktok";
|
|
57
|
+
}>;
|
|
58
|
+
handle: z.ZodString;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
videos: z.ZodNumber;
|
|
61
|
+
took_off: z.ZodNumber;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
export type TrendNicheSuggestion = z.infer<typeof trendNicheSuggestion>;
|
|
44
64
|
export declare const trendNiches: z.ZodObject<{
|
|
45
65
|
niches: z.ZodArray<z.ZodObject<{
|
|
46
66
|
keywords: z.ZodString;
|
|
@@ -54,6 +74,23 @@ export declare const trendNiches: z.ZodObject<{
|
|
|
54
74
|
}, z.core.$strict>>;
|
|
55
75
|
max_niches: z.ZodNumber;
|
|
56
76
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
77
|
+
suggested: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
78
|
+
keywords: z.ZodString;
|
|
79
|
+
platform: z.ZodEnum<{
|
|
80
|
+
instagram: "instagram";
|
|
81
|
+
mix: "mix";
|
|
82
|
+
tiktok: "tiktok";
|
|
83
|
+
}>;
|
|
84
|
+
from: z.ZodObject<{
|
|
85
|
+
platform: z.ZodEnum<{
|
|
86
|
+
instagram: "instagram";
|
|
87
|
+
tiktok: "tiktok";
|
|
88
|
+
}>;
|
|
89
|
+
handle: z.ZodString;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
videos: z.ZodNumber;
|
|
92
|
+
took_off: z.ZodNumber;
|
|
93
|
+
}, z.core.$strict>>>;
|
|
57
94
|
}, z.core.$strict>;
|
|
58
95
|
export type TrendNiches = z.infer<typeof trendNiches>;
|
|
59
96
|
export declare const trendNichesRead: z.ZodObject<{
|
|
@@ -65,8 +102,28 @@ export declare const trendNichesRead: z.ZodObject<{
|
|
|
65
102
|
}, z.core.$strip>>;
|
|
66
103
|
max_niches: z.ZodNumber;
|
|
67
104
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
105
|
+
suggested: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
106
|
+
keywords: z.ZodString;
|
|
107
|
+
platform: z.ZodString;
|
|
108
|
+
from: z.ZodObject<{
|
|
109
|
+
platform: z.ZodString;
|
|
110
|
+
handle: z.ZodString;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
videos: z.ZodNumber;
|
|
113
|
+
took_off: z.ZodNumber;
|
|
114
|
+
}, z.core.$strip>>>;
|
|
68
115
|
}, z.core.$strip>;
|
|
69
116
|
export type TrendNichesRead = z.infer<typeof trendNichesRead>;
|
|
117
|
+
export declare function suggestTrendNiches(profiles: readonly {
|
|
118
|
+
platform: CreatorPlatform;
|
|
119
|
+
handle: string;
|
|
120
|
+
videos: readonly {
|
|
121
|
+
caption: string | null;
|
|
122
|
+
tookOff: boolean;
|
|
123
|
+
}[];
|
|
124
|
+
}[], saved: readonly {
|
|
125
|
+
keywords: string;
|
|
126
|
+
}[]): TrendNicheSuggestion[];
|
|
70
127
|
export declare const findTrendsInput: z.ZodObject<{
|
|
71
128
|
keywords: z.ZodOptional<z.ZodString>;
|
|
72
129
|
platform: z.ZodOptional<z.ZodEnum<{
|
package/dist/trend-niches.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { CREATOR_PLATFORMS } from "./creator-profile.js";
|
|
3
|
+
import { findTrendsRequest, TREND_FREE_PAGES_PER_DAY, TREND_LANGUAGE_DESCRIPTION, TREND_PAGE_PAID_CREDITS, TREND_PAGE_WINDOW_SECONDS, TREND_PLATFORMS, TREND_SEARCH_DEFAULT_DAYS, TREND_SEARCH_MAX_DAYS, TREND_SEARCH_MAX_PAGES, TREND_SEARCH_MIN_DAYS, trendPage, trendSearchId, } from "./trend-search.js";
|
|
3
4
|
import { maxCreditsField } from "./max-credits.js";
|
|
4
5
|
export const TREND_NICHES_PATH = "/v1/trend-niches";
|
|
5
6
|
export const TREND_NICHES_MAX = 3;
|
|
@@ -8,7 +9,7 @@ const language = z.string().regex(/^[a-z]{2}$/);
|
|
|
8
9
|
export const trendNicheInput = z.strictObject({
|
|
9
10
|
keywords: keywords.describe("The niche's topic in a few words, as you would search it."),
|
|
10
11
|
platform: z.enum(TREND_PLATFORMS).default("mix").describe("mix (default): TikTok and Instagram together; or one of them."),
|
|
11
|
-
language: language.optional().describe(
|
|
12
|
+
language: language.optional().describe(TREND_LANGUAGE_DESCRIPTION),
|
|
12
13
|
});
|
|
13
14
|
const wordsOf = (value) => value.trim().toLowerCase().replace(/\s+/g, " ");
|
|
14
15
|
export const trendNicheKey = (niche) => `${niche.platform}:${niche.language ?? "*"}:${wordsOf(niche.keywords)}`;
|
|
@@ -23,20 +24,72 @@ export const trendNiche = z.strictObject({
|
|
|
23
24
|
language: z.string().nullable(),
|
|
24
25
|
primary: z.boolean().describe("True for the first: a trend search with no keywords searches it."),
|
|
25
26
|
});
|
|
27
|
+
export const TREND_NICHE_SUGGESTIONS_MAX = 3;
|
|
28
|
+
export const trendNicheSuggestion = z.strictObject({
|
|
29
|
+
keywords: keywords.describe("The niche's words, read from a hashtag."),
|
|
30
|
+
platform: z.enum(TREND_PLATFORMS).describe("mix: a suggestion searches TikTok and Instagram together."),
|
|
31
|
+
from: z.strictObject({ platform: z.enum(CREATOR_PLATFORMS), handle: z.string().min(1).max(64) }).describe("The analysed creator whose captions carry it."),
|
|
32
|
+
videos: z.number().int().nonnegative().describe("How many of that creator's analysed captions carry the hashtag."),
|
|
33
|
+
took_off: z.number().int().nonnegative().describe("How many of those videos took off."),
|
|
34
|
+
});
|
|
26
35
|
export const trendNiches = z.strictObject({
|
|
27
36
|
niches: z.array(trendNiche).max(TREND_NICHES_MAX).describe("The saved niches, the primary first."),
|
|
28
37
|
max_niches: z.number().int().positive(),
|
|
29
38
|
updated_at: z.string().datetime().nullable().describe("When the list was last saved; null when it never was."),
|
|
39
|
+
suggested: z.array(trendNicheSuggestion).max(TREND_NICHE_SUGGESTIONS_MAX).optional().describe(`Up to ${TREND_NICHE_SUGGESTIONS_MAX} niches read ` +
|
|
40
|
+
"for free from the hashtags of the creators this account analysed; GET only. Third-party words: show them and save only what the user confirms."),
|
|
30
41
|
});
|
|
31
42
|
export const trendNichesRead = z.object({
|
|
32
43
|
niches: z.array(z.object({ keywords: z.string(), platform: z.string(), language: z.string().nullable(), primary: z.boolean() })),
|
|
33
44
|
max_niches: z.number().int(),
|
|
34
45
|
updated_at: z.string().nullable(),
|
|
46
|
+
suggested: z.array(z.object({ keywords: z.string(), platform: z.string(), from: z.object({ platform: z.string(), handle: z.string() }),
|
|
47
|
+
videos: z.number().int(), took_off: z.number().int() })).optional(),
|
|
35
48
|
});
|
|
49
|
+
const GENERIC_TAGS = new Set(["fyp", "foryou", "foryoupage", "foryourpage", "fy", "fypシ", "fypage", "viral", "viralvideo", "viralvideos", "viralreels",
|
|
50
|
+
"trending", "trend", "trends", "explore", "explorepage", "reels", "reel", "reelsinstagram", "reelsvideo", "reelitfeelit", "instagram", "instagood",
|
|
51
|
+
"instareels", "insta", "tiktok", "tiktokviral", "parati", "paratii", "xyzbca", "capcut", "shorts", "short", "love", "like", "likes", "like4like",
|
|
52
|
+
"follow", "followme", "follow4follow", "ad", "ads", "sponsored", "collab", "gifted", "ugc", "ugccreator", "video", "videos", "photooftheday",
|
|
53
|
+
"duet", "stitch", "greenscreen"]);
|
|
54
|
+
const HASHTAG = /#[\p{L}\p{N}_]{2,40}/gu;
|
|
55
|
+
const SUGGESTION_MIN_CAPTIONS = 2;
|
|
56
|
+
const tagWords = (tag) => tag.slice(1).replace(/(?<=[\p{Ll}\p{N}])(?=\p{Lu})/gu, " ").replace(/_+/g, " ").trim()
|
|
57
|
+
.toLowerCase().replace(/\s+/g, " ");
|
|
58
|
+
export function suggestTrendNiches(profiles, saved) {
|
|
59
|
+
const joined = (words) => wordsOf(words).replace(/[\s_]+/g, "");
|
|
60
|
+
const savedWords = new Set(saved.map((niche) => joined(niche.keywords)));
|
|
61
|
+
const best = new Map();
|
|
62
|
+
for (const profile of profiles) {
|
|
63
|
+
const tags = new Map();
|
|
64
|
+
for (const video of profile.videos) {
|
|
65
|
+
const better = (tag, held) => (held === undefined || tag !== tag.toLowerCase() && held === held.toLowerCase() ? tag : held);
|
|
66
|
+
const inCaption = new Map();
|
|
67
|
+
for (const tag of video.caption?.match(HASHTAG) ?? [])
|
|
68
|
+
inCaption.set(tag.toLowerCase(), better(tag, inCaption.get(tag.toLowerCase())));
|
|
69
|
+
for (const [key, tag] of inCaption) {
|
|
70
|
+
const held = tags.get(key);
|
|
71
|
+
tags.set(key, { videos: (held?.videos ?? 0) + 1, tookOff: (held?.tookOff ?? 0) + (video.tookOff ? 1 : 0), spelled: better(tag, held?.spelled) });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
for (const [key, tag] of tags) {
|
|
75
|
+
const words = tagWords(tag.spelled);
|
|
76
|
+
if (tag.videos < SUGGESTION_MIN_CAPTIONS || GENERIC_TAGS.has(joined(key.slice(1))) || savedWords.has(joined(words))
|
|
77
|
+
|| !keywords.safeParse(words).success)
|
|
78
|
+
continue;
|
|
79
|
+
const weight = tag.videos + 2 * tag.tookOff, held = best.get(joined(words));
|
|
80
|
+
if (held !== undefined && held.weight >= weight)
|
|
81
|
+
continue;
|
|
82
|
+
best.set(joined(words), { weight, suggestion: { keywords: words, platform: "mix", from: { platform: profile.platform, handle: profile.handle },
|
|
83
|
+
videos: tag.videos, took_off: tag.tookOff } });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return [...best.values()].sort((a, b) => b.weight - a.weight || a.suggestion.keywords.localeCompare(b.suggestion.keywords))
|
|
87
|
+
.slice(0, TREND_NICHE_SUGGESTIONS_MAX).map((entry) => entry.suggestion);
|
|
88
|
+
}
|
|
36
89
|
export const findTrendsInput = z.strictObject({
|
|
37
90
|
keywords: keywords.optional().describe("The topic in a few words; absent: the primary saved niche (trend_niches) with its platform and language."),
|
|
38
91
|
platform: z.enum(TREND_PLATFORMS).optional().describe("mix (default): TikTok and Instagram ranked together; or one of them."),
|
|
39
|
-
language: language.optional().describe(
|
|
92
|
+
language: language.optional().describe(TREND_LANGUAGE_DESCRIPTION),
|
|
40
93
|
posted_within_days: z.number().int().min(TREND_SEARCH_MIN_DAYS).max(TREND_SEARCH_MAX_DAYS).optional()
|
|
41
94
|
.describe(`Reels posted within this many days: ${TREND_SEARCH_MIN_DAYS} is the last 24 hours, ${TREND_SEARCH_DEFAULT_DAYS} by default, ` +
|
|
42
95
|
`at most ${TREND_SEARCH_MAX_DAYS}.`),
|
|
@@ -75,4 +128,6 @@ export const TREND_NICHE_REFRESH_DAYS = 7;
|
|
|
75
128
|
export const TREND_DIGEST_REELS = 5;
|
|
76
129
|
export const digestReels = (reels) => reels.filter((reel) => reel.top || reel.takeoff !== null).slice(0, TREND_DIGEST_REELS);
|
|
77
130
|
export const TREND_NICHES_DESCRIPTION = "Free. With no niches: the account's saved niches, the first the primary. niches: save the user's confirmed list " +
|
|
78
|
-
`(at most ${TREND_NICHES_MAX}, it replaces the saved one; [] clears it). find_trends and quote_trends with no keywords search the primary niche
|
|
131
|
+
`(at most ${TREND_NICHES_MAX}, it replaces the saved one; [] clears it). find_trends and quote_trends with no keywords search the primary niche. ` +
|
|
132
|
+
`The read also answers suggested: up to ${TREND_NICHE_SUGGESTIONS_MAX} niches from the hashtags of creators this account analysed. Show them; ` +
|
|
133
|
+
"a niche is saved only once the user confirms it. With no suggestions, you may propose two or three wordings from the about that extract_brand returned.";
|
package/dist/trend-search.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export declare const findTrendsPayload: z.ZodObject<{
|
|
|
81
81
|
page: z.ZodOptional<z.ZodNumber>;
|
|
82
82
|
}, z.core.$strict>;
|
|
83
83
|
export type FindTrendsPayload = z.infer<typeof findTrendsPayload>;
|
|
84
|
+
export declare const TREND_LANGUAGE_DESCRIPTION: string;
|
|
84
85
|
export declare const findTrendsRequest: z.ZodObject<{
|
|
85
86
|
keywords: z.ZodString;
|
|
86
87
|
platform: z.ZodDefault<z.ZodEnum<{
|
package/dist/trend-search.js
CHANGED
|
@@ -79,11 +79,13 @@ export const TREND_SEARCH_ERROR_MESSAGES = {
|
|
|
79
79
|
no_more_places: "no new reel with a known x_median was found past the places already shown; nothing was charged; start a new search with other words",
|
|
80
80
|
};
|
|
81
81
|
export const findTrendsPayload = z.strictObject({ searchId: trendSearchId, accountId: z.string().min(1), page: trendPage.optional() });
|
|
82
|
+
export const TREND_LANGUAGE_DESCRIPTION = "ISO 639-1: keeps reels in this language, read from the platform's label or the caption; " +
|
|
83
|
+
"a reel whose language cannot be told is kept.";
|
|
82
84
|
export const findTrendsRequest = z.strictObject({
|
|
83
85
|
keywords: z.string().min(2).max(100).refine((value) => value.trim().length >= 2, "keywords needs at least 2 characters besides spaces")
|
|
84
86
|
.describe("The topic in a few words."),
|
|
85
87
|
platform: z.enum(TREND_PLATFORMS).default("mix"),
|
|
86
|
-
language: z.string().regex(/^[a-z]{2}$/).optional().describe(
|
|
88
|
+
language: z.string().regex(/^[a-z]{2}$/).optional().describe(TREND_LANGUAGE_DESCRIPTION),
|
|
87
89
|
posted_within_days: z.number().int().min(TREND_SEARCH_MIN_DAYS).max(TREND_SEARCH_MAX_DAYS).default(TREND_SEARCH_DEFAULT_DAYS)
|
|
88
90
|
.describe(`Reels posted within this many days: ${TREND_SEARCH_MIN_DAYS} is the last 24 hours, ${TREND_SEARCH_DEFAULT_DAYS} by default, ` +
|
|
89
91
|
`at most ${TREND_SEARCH_MAX_DAYS}.`),
|