@transloadit/zod 5.0.1 → 6.0.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/v3/assemblyStatus.d.ts +682 -682
- package/dist/v3/assemblyStatus.d.ts.map +1 -1
- package/dist/v3/assemblyStatus.js +23 -14
- package/dist/v3/robots/_ai-models.d.ts.map +1 -1
- package/dist/v3/robots/_ai-models.js +2 -0
- package/dist/v3/robots/_google-image-seed.d.ts +8 -0
- package/dist/v3/robots/_google-image-seed.d.ts.map +1 -0
- package/dist/v3/robots/_google-image-seed.js +11 -0
- package/dist/v3/robots/_instructions-primitives.d.ts +2 -0
- package/dist/v3/robots/_instructions-primitives.d.ts.map +1 -1
- package/dist/v3/robots/_instructions-primitives.js +11 -14
- package/dist/v3/robots/ai-chat.d.ts +1 -1
- package/dist/v3/robots/ai-chat.d.ts.map +1 -1
- package/dist/v3/robots/google-import.d.ts +4 -6
- package/dist/v3/robots/google-import.d.ts.map +1 -1
- package/dist/v3/robots/google-import.js +5 -2
- package/dist/v3/robots/google-store.d.ts.map +1 -1
- package/dist/v3/robots/google-store.js +5 -13
- package/dist/v3/robots/http-import.d.ts.map +1 -1
- package/dist/v3/robots/http-import.js +4 -0
- package/dist/v3/robots/image-generate.d.ts.map +1 -1
- package/dist/v3/robots/image-generate.js +6 -1
- package/dist/v3/robots/image-resize.d.ts +4 -0
- package/dist/v3/robots/image-resize.d.ts.map +1 -1
- package/dist/v3/robots/image-resize.js +34 -6
- package/dist/v3/robots/s3-store.d.ts.map +1 -1
- package/dist/v3/robots/s3-store.js +21 -17
- package/dist/v3/robots/video-thumbs.d.ts +6 -0
- package/dist/v3/robots/video-thumbs.d.ts.map +1 -1
- package/dist/v3/robots/video-thumbs.js +15 -5
- package/dist/v4/assemblyStatus.d.ts +75 -1183
- package/dist/v4/assemblyStatus.d.ts.map +1 -1
- package/dist/v4/assemblyStatus.js +23 -14
- package/dist/v4/robots/_ai-models.d.ts.map +1 -1
- package/dist/v4/robots/_ai-models.js +2 -0
- package/dist/v4/robots/_google-image-seed.d.ts +8 -0
- package/dist/v4/robots/_google-image-seed.d.ts.map +1 -0
- package/dist/v4/robots/_google-image-seed.js +11 -0
- package/dist/v4/robots/_instructions-primitives.d.ts +2 -0
- package/dist/v4/robots/_instructions-primitives.d.ts.map +1 -1
- package/dist/v4/robots/_instructions-primitives.js +11 -13
- package/dist/v4/robots/ai-chat.d.ts +1 -1
- package/dist/v4/robots/ai-chat.d.ts.map +1 -1
- package/dist/v4/robots/google-import.d.ts +4 -4
- package/dist/v4/robots/google-import.d.ts.map +1 -1
- package/dist/v4/robots/google-import.js +5 -2
- package/dist/v4/robots/google-store.d.ts.map +1 -1
- package/dist/v4/robots/google-store.js +5 -13
- package/dist/v4/robots/http-import.d.ts.map +1 -1
- package/dist/v4/robots/http-import.js +4 -0
- package/dist/v4/robots/image-generate.d.ts.map +1 -1
- package/dist/v4/robots/image-generate.js +5 -1
- package/dist/v4/robots/image-resize.d.ts +4 -0
- package/dist/v4/robots/image-resize.d.ts.map +1 -1
- package/dist/v4/robots/image-resize.js +34 -6
- package/dist/v4/robots/s3-store.d.ts.map +1 -1
- package/dist/v4/robots/s3-store.js +21 -17
- package/dist/v4/robots/video-thumbs.d.ts +6 -0
- package/dist/v4/robots/video-thumbs.d.ts.map +1 -1
- package/dist/v4/robots/video-thumbs.js +15 -5
- package/package.json +2 -2
|
@@ -4,6 +4,32 @@ import { imagemagickDensityPattern } from "../imagemagickDensity.js";
|
|
|
4
4
|
import { zodInputPreservingTransform } from "../lib/zodInputSemantics.js";
|
|
5
5
|
import { color_without_alpha_with_named, colorspaceSchema, complexHeightSchema, complexWidthSchema, createProcessingExample, defineRobotWithHiddenFields, httpUrlSchema, imageAdaptiveFilteringSchema, imageQualitySchema, percentageSchema, positionSchema, robotBase, robotImagemagick, robotImageProcessingMeta, robotUse, unsafeCoordinatesSchema, } from "./_instructions-primitives.js";
|
|
6
6
|
const imageResizeGravitySchema = z.union([positionSchema, z.enum(['attention', 'entropy'])]);
|
|
7
|
+
/** Input MIME types eligible for automatic libvips processing in /image/resize. */
|
|
8
|
+
export const imageResizeDaemonInputMimes = [
|
|
9
|
+
'image/jpg',
|
|
10
|
+
'image/jpeg',
|
|
11
|
+
'image/jxl',
|
|
12
|
+
'image/png',
|
|
13
|
+
'image/tiff',
|
|
14
|
+
'image/tiff-fx',
|
|
15
|
+
'image/gif',
|
|
16
|
+
'image/webp',
|
|
17
|
+
'image/svg',
|
|
18
|
+
'image/svg+xml',
|
|
19
|
+
];
|
|
20
|
+
/** Output formats eligible for automatic libvips processing in /image/resize. */
|
|
21
|
+
export const imageResizeDaemonOutputFormats = [
|
|
22
|
+
'heic',
|
|
23
|
+
'heif',
|
|
24
|
+
'jpeg',
|
|
25
|
+
'jpg',
|
|
26
|
+
'jxl',
|
|
27
|
+
'png',
|
|
28
|
+
'raw',
|
|
29
|
+
'tiff',
|
|
30
|
+
'webp',
|
|
31
|
+
'avif',
|
|
32
|
+
];
|
|
7
33
|
export const meta = {
|
|
8
34
|
...robotImageProcessingMeta,
|
|
9
35
|
example_code: createProcessingExample('resized', '/image/resize', {
|
|
@@ -141,14 +167,14 @@ Height of the new image, in pixels. If not specified, will default to the height
|
|
|
141
167
|
.union([
|
|
142
168
|
z
|
|
143
169
|
.literal('crop')
|
|
144
|
-
.describe(`Cuts an area out of an image
|
|
170
|
+
.describe(`Cuts an area out of an image. Coordinates in the \`crop\` parameter imply this strategy. With coordinates, ImageMagick crops without resizing; libvips enlarges the image if \`x2\` or \`y2\` exceeds its dimensions, even with \`zoom: false\`. Without coordinates, set both \`width\` and \`height\`; this uses \`fillcrop\`, with \`gravity\` selecting which part is kept. With the default \`zoom\` setting, this coordinate-free path scales the image to cover that rectangle before trimming.
|
|
145
171
|
|
|
146
172
|
To crop around human faces, see [🤖/image/facedetect](https://transloadit.com/docs/robots/image-facedetect/) instead.`),
|
|
147
173
|
z
|
|
148
174
|
.literal('fillcrop')
|
|
149
175
|
.describe(`Scales the image to fit into our 100×100 target while preserving aspect ratio, while trimming away any excess surface. This means both sides will become exactly 100 pixels, at the tradeoff of destroying parts of the image.
|
|
150
176
|
|
|
151
|
-
By default the resulting image is horizontally/vertically centered to fill the target rectangle. Use the \`gravity\` parameter to change where to crop the image, such as \`"bottom\`
|
|
177
|
+
By default the resulting image is horizontally/vertically centered to fill the target rectangle. Use the \`gravity\` parameter to change where to crop the image, such as \`"bottom"\` or \`"left"\`.`),
|
|
152
178
|
z
|
|
153
179
|
.literal('fit')
|
|
154
180
|
.describe(`Uses the larger side of the original image as a base for the resize. Aspect ratio is preserved. Either side will become at most 100 pixels.
|
|
@@ -192,7 +218,7 @@ For example:
|
|
|
192
218
|
}
|
|
193
219
|
\`\`\`
|
|
194
220
|
|
|
195
|
-
This will crop the area from \`(80, 100)\` to \`(600, 800)\` from a 1000×1000 pixels image, which is a
|
|
221
|
+
This will crop the area from \`(80, 100)\` to \`(600, 800)\` from a 1000×1000 pixels image, which is a rectangle whose width is 520px and height is 700px. If \`crop\` is set, the width and height parameters are ignored, and the \`resize_strategy\` is set to \`crop\` automatically.
|
|
196
222
|
|
|
197
223
|
You can also use a JSON string of such an object with coordinates in similar fashion:
|
|
198
224
|
|
|
@@ -203,9 +229,11 @@ You can also use a JSON string of such an object with coordinates in similar fas
|
|
|
203
229
|
To crop around human faces, see [🤖/image/facedetect](/docs/robots/image-facedetect/).
|
|
204
230
|
`),
|
|
205
231
|
gravity: imageResizeGravitySchema.default('center').describe(`
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
232
|
+
Sets crop direction for \`crop\` or \`fillcrop\` without explicit coordinates.
|
|
233
|
+
Content-aware \`attention\` and \`entropy\` need libvips, \`fillcrop\`, \`width\` and \`height\`.
|
|
234
|
+
Effects such as \`sepia\` or \`text\`, and inputs such as HEIC, can use ImageMagick.
|
|
235
|
+
It centers these crops and the Assembly reports a warning.
|
|
236
|
+
Crop in a separate /image/resize Step before effects, or convert unsupported inputs to PNG first.
|
|
209
237
|
`),
|
|
210
238
|
strip: z
|
|
211
239
|
.boolean()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-store.d.ts","sourceRoot":"","sources":["../../../src/v4/robots/s3-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,+BAA+B,EAC/B,cAAc,EACd,uBAAuB,EACxB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAgB1B,eAAO,MAAM,IAAI,EAAE,cAYlB,CAAA;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"s3-store.d.ts","sourceRoot":"","sources":["../../../src/v4/robots/s3-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,+BAA+B,EAC/B,cAAc,EACd,uBAAuB,EACxB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAgB1B,eAAO,MAAM,IAAI,EAAE,cAYlB,CAAA;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4GhC,CAAA;AAEX,QAAA,MAAM,YAAY;;CAMjB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,+BAA+B,CAC3D,OAAO,8BAA8B,CAAC,KAAK,EAC3C,OAAO,YAAY,CAC8D,CAAA;AAEnF,eAAO,MACa,8CAA8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAChD,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAC5B,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAC3E,CAAA;AAEnB,KAAK,YAAY,GAAG,uBAAuB,CAAC,OAAO,eAAe,CAAC,CAAA;AAEnE,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;AAC7D,MAAM,MAAM,6BAA6B,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;AACjE,MAAM,MAAM,wCAAwC,GAAG,YAAY,CAAC,cAAc,CAAC,CAAA;AACnF,MAAM,MAAM,sCAAsC,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAA;AACxF,MAAM,MAAM,2CAA2C,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAA;AAC7F,MAAM,MAAM,sDAAsD,GAChE,YAAY,CAAC,4BAA4B,CAAC,CAAA;AAC5C,MAAM,MAAM,2DAA2D,GACrE,YAAY,CAAC,2BAA2B,CAAC,CAAA"}
|
|
@@ -21,48 +21,54 @@ export const robotS3StoreInstructionsSchema = robotBase
|
|
|
21
21
|
.merge(robotUse)
|
|
22
22
|
.merge(s3Base)
|
|
23
23
|
.extend({
|
|
24
|
+
// URL rewriting does not fix bucket addressing, and custom paths need not use file.url_name.
|
|
25
|
+
// Keep the bucket warning separate from the old blanket filename-sanitization claim.
|
|
24
26
|
robot: z.literal('/s3/store').describe(`
|
|
25
27
|
If you are new to Amazon S3, see our tutorial on [using your own S3 bucket](/docs/faq/how-to-set-up-an-amazon-s3-bucket/).
|
|
26
28
|
|
|
27
|
-
The URL to the result file in your S3 bucket will be returned in the <dfn>Assembly Status JSON</dfn>. If your S3 bucket has versioning enabled, the version ID of the file will be returned within \`meta.version_id
|
|
29
|
+
The URL to the result file in your S3 bucket will be returned in the <dfn>Assembly Status JSON</dfn>. A returned URL does not make a private object public or grant read access. If your S3 bucket has versioning enabled, the version ID of the file will be returned within \`meta.version_id\`.
|
|
28
30
|
|
|
29
31
|
> [!Warning]
|
|
30
|
-
> **
|
|
32
|
+
> **Configure private buckets explicitly.** The Robot’s default \`acl\` is still \`"${s3StoreAclSchema.parse(undefined)}"\`. For a private bucket, set \`acl: "bucket-default"\` and do not supply ACL or grant headers. This omits the generated ACL header and works with [Bucket owner enforced Object Ownership](https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html), where ACLs are disabled. Keep S3 Block Public Access enabled. Setting \`acl: "private"\` still sends an ACL and is not equivalent to omitting it.
|
|
31
33
|
|
|
32
34
|
> [!Warning]
|
|
33
|
-
> **Use DNS-compliant bucket names.**
|
|
35
|
+
> **Use DNS-compliant bucket names.** Follow AWS’s [bucket naming rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html). The \`url_prefix\` parameter changes returned URLs; it does not change the bucket or its access permissions.
|
|
34
36
|
|
|
35
37
|
<span id="minimum-s3-iam-permissions" aria-hidden="true"></span>
|
|
36
38
|
|
|
37
39
|
## Limit access
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
Use a dedicated AWS identity with access limited to the destination bucket and object prefix. Do not use [AWS root access keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/root-user-best-practices.html). Store its access key ID, secret access key, bucket name and region as \`key\`, \`secret\`, \`bucket\` and \`bucket_region\` in <dfn>Template Credentials</dfn>, then reference their name with \`credentials\`. Trusted backend integrations can instead supply those parameters directly; do not expose AWS secrets in browser instructions.
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
The following is an [identity-based IAM policy](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html), attached to that dedicated identity, not a bucket policy. It intentionally has no \`Principal\`. Replace \`{BUCKET_NAME}\` and use a Robot \`path\` beginning with \`uploads/\`, or adapt both the policy prefix and the path together.
|
|
44
|
+
|
|
45
|
+
This example covers uploads and failed multipart-upload cleanup with an explicit \`bucket_region\`, \`acl: "bucket-default"\`, no ACL/grant headers, no tags and S3-managed encryption (SSE-S3). Existing bucket policies, organization controls or endpoint policies can still deny access.
|
|
42
46
|
|
|
43
47
|
\`\`\`json
|
|
44
48
|
{
|
|
45
49
|
"Version": "2012-10-17",
|
|
46
50
|
"Statement": [
|
|
47
51
|
{
|
|
48
|
-
"Sid": "
|
|
52
|
+
"Sid": "UploadAndAbortWithinPrefix",
|
|
49
53
|
"Effect": "Allow",
|
|
50
|
-
"Action": ["s3:
|
|
51
|
-
"Resource":
|
|
54
|
+
"Action": ["s3:PutObject", "s3:AbortMultipartUpload"],
|
|
55
|
+
"Resource": "arn:aws:s3:::{BUCKET_NAME}/uploads/*"
|
|
52
56
|
}
|
|
53
57
|
]
|
|
54
58
|
}
|
|
55
59
|
\`\`\`
|
|
56
60
|
|
|
57
|
-
The \`
|
|
61
|
+
The uploader uses either \`PutObject\` or \`CreateMultipartUpload\`, \`UploadPart\` and \`CompleteMultipartUpload\`; failed multipart uploads can trigger \`AbortMultipartUpload\`. AWS maps the successful upload operations to \`s3:PutObject\`. Write access can **overwrite an existing object key**; it is not add-only. Choose unique object paths and consider versioning for recovery.
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
Add permissions only for features you use, following AWS’s [operation permission reference](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-policy-actions.html):
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
- Without an explicit \`bucket_region\`, region discovery can require \`s3:GetBucketLocation\` and fallback \`s3:ListBucket\` on the bucket ARN, \`arn:aws:s3:::{BUCKET_NAME}\`, without an object suffix. Supplying the correct region avoids these discovery requests.
|
|
66
|
+
- ACL or grant headers require \`s3:PutObjectAcl\`; tags require \`s3:PutObjectTagging\` on the allowed object prefix. \`bucket-default\` does not remove ACL/grant headers you supply in \`headers\`.
|
|
67
|
+
- Downloading private results requires separate read authorization. Even a URL generated with \`sign_urls_for\` needs the signing identity to have the appropriate read permissions.
|
|
62
68
|
|
|
63
|
-
|
|
69
|
+
S3 applies its [bucket encryption configuration](https://docs.aws.amazon.com/AmazonS3/latest/userguide/default-bucket-encryption.html) when no encryption override is sent. You can request SSE-KMS through \`headers\`, using \`x-amz-server-side-encryption: aws:kms\` and \`x-amz-server-side-encryption-aws-kms-key-id\`. When either bucket default encryption or request headers select [SSE-KMS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html), the uploading identity needs \`kms:GenerateDataKey\` on the relevant key, plus \`kms:Decrypt\` for multipart uploads. For a customer-managed key, grant these permissions with a compatible KMS key policy; the base S3 policy above does not include them. Do not add blanket \`kms:*\` or \`sts:*\` grants.
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
Short-lived AWS credentials are a matching set of \`key\`, \`secret\` and \`session_token\`. Have a trusted backend obtain and refresh all three, then supply them together when it creates the Assembly. It can pass them directly in Robot instructions or save and update them together through the [Template Credentials API](/docs/api/template-credentials-post/). Keep all three out of browser instructions; replacing only the session token does not refresh expired access keys. This Robot passes the supplied credentials to S3; it does not assume a role or refresh expired credentials. Keep temporary credentials valid for the upload.
|
|
66
72
|
`),
|
|
67
73
|
path: storeFilePath,
|
|
68
74
|
url_prefix: z
|
|
@@ -72,9 +78,7 @@ Please keep in mind that if you use bucket encryption you may also need to add \
|
|
|
72
78
|
The URL prefix used for the returned URL, such as \`"http://my.cdn.com/some/path/"\`.
|
|
73
79
|
`),
|
|
74
80
|
acl: s3StoreAclSchema.describe(`
|
|
75
|
-
The
|
|
76
|
-
|
|
77
|
-
Please keep in mind that the default value \`"${s3StoreAclSchema.parse(undefined)}"\` can lead to permission errors due to the \`"Block all public access"\` checkbox that is checked by default when creating a new Amazon S3 Bucket in the AWS console.
|
|
81
|
+
The ACL used for this file. The default remains \`"${s3StoreAclSchema.parse(undefined)}"\`, which can conflict with S3 Block Public Access and disabled ACLs. For modern private buckets, explicitly set \`"bucket-default"\` to omit the generated ACL header, and do not supply ACL/grant headers in \`headers\`. \`"private"\` still sends an ACL.
|
|
78
82
|
`),
|
|
79
83
|
check_integrity: z
|
|
80
84
|
.boolean()
|
|
@@ -118,7 +122,7 @@ This parameter provides signed URLs in the result JSON (in the \`signed_url\` an
|
|
|
118
122
|
session_token: optionalWithV3Semantics(z
|
|
119
123
|
.string())
|
|
120
124
|
.describe(`
|
|
121
|
-
The session token to
|
|
125
|
+
The session token belonging to the temporary AWS access key ID and secret access key supplied for this upload. The Robot does not assume a role or refresh these credentials; they must remain valid for the upload.
|
|
122
126
|
`),
|
|
123
127
|
})
|
|
124
128
|
.strict();
|
|
@@ -2,6 +2,12 @@ import type { RobotDefinition, RobotMetaInput, RobotSchemaVariantTypes } from '.
|
|
|
2
2
|
import { z } from 'zod/v4';
|
|
3
3
|
/** Markup over the AI provider cost for smart thumbnail selection. */
|
|
4
4
|
export declare const smartThumbnailMarkupPercent = 50;
|
|
5
|
+
/** Dedicated vision model so /ai/chat default upgrades do not change thumbnail analysis costs. */
|
|
6
|
+
export declare const smartThumbnailModel = "openai/gpt-5.4-mini";
|
|
7
|
+
/** Maximum long-side dimension of scoring previews; returned thumbnails keep their output size. */
|
|
8
|
+
export declare const smartThumbnailAnalysisMaxSize = 512;
|
|
9
|
+
/** Frame ranking needs little reasoning compared with general-purpose chat. */
|
|
10
|
+
export declare const smartThumbnailReasoningEffort = "low";
|
|
5
11
|
/** Candidate-pool size shared by smart thumbnail execution and its documented default example. */
|
|
6
12
|
export declare function getSmartThumbnailCandidateCount(count: number, maximumCandidates: number): number;
|
|
7
13
|
export declare const meta: RobotMetaInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-thumbs.d.ts","sourceRoot":"","sources":["../../../src/v4/robots/video-thumbs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"video-thumbs.d.ts","sourceRoot":"","sources":["../../../src/v4/robots/video-thumbs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,uBAAuB,EACxB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAe1B,sEAAsE;AACtE,eAAO,MAAM,2BAA2B,KAAK,CAAA;AAE7C,kGAAkG;AAClG,eAAO,MAAM,mBAAmB,wBAAkE,CAAA;AAElG,mGAAmG;AACnG,eAAO,MAAM,6BAA6B,MAAM,CAAA;AAEhD,+EAA+E;AAC/E,eAAO,MAAM,6BAA6B,QAAQ,CAAA;AAOlD,kGAAkG;AAClG,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAEhG;AAED,eAAO,MAAM,IAAI,EAAE,cAmBlB,CAAA;AAED,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4GpC,CAAA;AAEX,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,OAAO,kCAAkC,CAAC,KAAK,CACtC,CAAA;AAEvD,eAAO,MACa,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBACpD,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAChC,gEAAgE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAC/E,CAAA;AAEnB,KAAK,YAAY,GAAG,uBAAuB,CAAC,OAAO,eAAe,CAAC,CAAA;AAEnE,MAAM,MAAM,4BAA4B,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;AACjE,MAAM,MAAM,4CAA4C,GAAG,YAAY,CAAC,cAAc,CAAC,CAAA;AACvF,MAAM,MAAM,0CAA0C,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAA;AAC5F,MAAM,MAAM,+CAA+C,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAA;AACjG,MAAM,MAAM,0DAA0D,GACpE,YAAY,CAAC,4BAA4B,CAAC,CAAA;AAC5C,MAAM,MAAM,+DAA+D,GACzE,YAAY,CAAC,2BAA2B,CAAC,CAAA"}
|
|
@@ -4,6 +4,12 @@ import { stackVersions } from "../stackVersions.js";
|
|
|
4
4
|
import { color_with_alpha, createProcessingExample, defineRobot, percentageSchema, resize_strategy, robotBase, robotFFmpeg, robotUse, robotVideoEncodingMeta, } from "./_instructions-primitives.js";
|
|
5
5
|
/** Markup over the AI provider cost for smart thumbnail selection. */
|
|
6
6
|
export const smartThumbnailMarkupPercent = 50;
|
|
7
|
+
/** Dedicated vision model so /ai/chat default upgrades do not change thumbnail analysis costs. */
|
|
8
|
+
export const smartThumbnailModel = 'openai/gpt-5.4-mini';
|
|
9
|
+
/** Maximum long-side dimension of scoring previews; returned thumbnails keep their output size. */
|
|
10
|
+
export const smartThumbnailAnalysisMaxSize = 512;
|
|
11
|
+
/** Frame ranking needs little reasoning compared with general-purpose chat. */
|
|
12
|
+
export const smartThumbnailReasoningEffort = 'low';
|
|
7
13
|
const thumbnailCountSchema = z.number().int().min(1).max(999).default(8);
|
|
8
14
|
const smartMaximumCandidatesSchema = z.number().int().min(2).max(100).default(20);
|
|
9
15
|
const defaultThumbnailCount = thumbnailCountSchema.parse(undefined);
|
|
@@ -36,13 +42,15 @@ export const robotVideoThumbsInstructionsSchema = robotBase
|
|
|
36
42
|
.merge(robotFFmpeg)
|
|
37
43
|
.extend({
|
|
38
44
|
robot: z.literal('/video/thumbs').describe(`
|
|
39
|
-
Set \`smart: true\` to select strong preview images with AI instead of taking frames only at regular intervals. The Robot scores candidate frames for clarity, brightness, composition, faces, expressions, action, and visual interest, then returns the best \`count\` frames in chronological order. Smart results include \`file.meta.smart_score\` and \`file.meta.smart_reasons\`. If AI scoring is unavailable, the Assembly continues with the candidate frames in fallback order. No AI credentials are required.
|
|
45
|
+
Set \`smart: true\` to select strong preview images with AI instead of taking frames only at regular intervals. The Robot scores candidate frames for clarity, brightness, composition, faces, expressions, action, and visual interest, then returns the best \`count\` frames in chronological order. Smart results include \`file.meta.smart_score\` and \`file.meta.smart_reasons\`. If AI scoring is unavailable, the Assembly continues with the candidate frames in fallback order and includes a warning. No AI credentials are required.
|
|
40
46
|
|
|
41
47
|
## AI pricing
|
|
42
48
|
|
|
43
|
-
Regular \`/video/thumbs\` processing charges still apply. AI frame analysis is billed separately at the underlying provider cost plus a ${smartThumbnailMarkupPercent}% Transloadit markup. The exact AI charge varies with the number of candidate frames
|
|
49
|
+
Regular \`/video/thumbs\` processing charges still apply. AI frame analysis is billed separately at the underlying provider cost plus a ${smartThumbnailMarkupPercent}% Transloadit markup. Smart selection uses the dedicated \`${smartThumbnailModel}\` vision model with \`${smartThumbnailReasoningEffort}\` reasoning, independently of the \`/ai/chat\` default. The exact AI charge varies with the number of candidate frames and provider pricing.
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
The AI scores preview copies capped at ${smartThumbnailAnalysisMaxSize} pixels on the long side, preserving aspect ratio and without enlarging smaller images. Returned thumbnails keep the requested output dimensions and format; larger outputs do not increase the scoring preview beyond this limit.
|
|
52
|
+
|
|
53
|
+
\`smart_max_candidates\` is the main cost and latency control. The Robot analyzes up to three candidates per requested thumbnail, capped by \`smart_max_candidates\`, but never fewer than \`count\`. With the defaults of \`count: ${defaultThumbnailCount}\` and \`smart_max_candidates: ${defaultSmartMaximumCandidates}\`, it analyzes ${getSmartThumbnailCandidateCount(defaultThumbnailCount, defaultSmartMaximumCandidates)} frames and returns the best ${defaultThumbnailCount}. Lower the candidate limit to reduce AI cost and latency. Raising it can enlarge the pool up to three times \`count\`; higher limits have no effect.
|
|
46
54
|
|
|
47
55
|
> [!Note]
|
|
48
56
|
> Use \`count\` with smart selection. To consistently extract exact timestamps with \`offsets\`, set \`smart: false\`.
|
|
@@ -121,17 +129,19 @@ The AI evaluates frames based on:
|
|
|
121
129
|
- Action and motion (avoiding transition frames)
|
|
122
130
|
- Overall visual interest
|
|
123
131
|
|
|
124
|
-
Regular \`/video/thumbs\` processing charges still apply. AI frame analysis is billed separately at the underlying provider cost plus a ${smartThumbnailMarkupPercent}% Transloadit markup. You do not need to provide AI credentials.
|
|
132
|
+
Regular \`/video/thumbs\` processing charges still apply. AI frame analysis uses a dedicated low-cost vision model with \`${smartThumbnailReasoningEffort}\` reasoning and preview copies capped at ${smartThumbnailAnalysisMaxSize} pixels on the long side. Returned thumbnails retain their requested dimensions and format. Analysis is billed separately at the underlying provider cost plus a ${smartThumbnailMarkupPercent}% Transloadit markup. You do not need to provide AI credentials.
|
|
125
133
|
|
|
126
134
|
Smart mode generates its own regularly spaced candidate timestamps; use \`smart: false\` with \`offsets\` when you need specified timestamps. Selected smart thumbnails are returned in chronological order, not score order. Inspect \`meta.thumb_offset\`, \`meta.smart_score\`, and \`meta.smart_reasons\` when evaluating the selection.
|
|
127
135
|
|
|
128
|
-
If AI scoring fails, the Robot selects
|
|
136
|
+
If AI scoring fails, the Robot selects extracted candidates in chronological order and records a fallback reason. With no candidates, it attempts standard extraction. Both fallbacks add an Assembly warning. A completed Assembly does not guarantee a representative or publication-safe poster; check that outputs exist and apply your application’s review policy.
|
|
129
137
|
`),
|
|
130
138
|
smart_max_candidates: smartMaximumCandidatesSchema.describe(`
|
|
131
139
|
The maximum size of the candidate pool when \`smart\` is \`true\`. The Robot analyzes up to three candidates per requested thumbnail, capped by this value, but it will never analyze fewer candidates than the requested \`count\`.
|
|
132
140
|
|
|
133
141
|
A higher number may yield better results but increases processing time and AI cost. With the defaults of \`count: ${defaultThumbnailCount}\` and \`smart_max_candidates: ${defaultSmartMaximumCandidates}\`, the Robot analyzes ${getSmartThumbnailCandidateCount(defaultThumbnailCount, defaultSmartMaximumCandidates)} frames and returns the best ${defaultThumbnailCount} in chronological order.
|
|
134
142
|
|
|
143
|
+
Raising this limit above three times \`count\` does not enlarge the pool. For example, \`count: 1\` analyzes at most three candidates.
|
|
144
|
+
|
|
135
145
|
This parameter is only used when \`smart\` is \`true\`.
|
|
136
146
|
`),
|
|
137
147
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transloadit/zod",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Transloadit Zod schemas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"zod": "^4.4.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@transloadit/types": "^
|
|
53
|
+
"@transloadit/types": "^6.0.0",
|
|
54
54
|
"@types/node": "^25.8.0"
|
|
55
55
|
}
|
|
56
56
|
}
|