@transloadit/node 4.11.0 → 4.12.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/README.md +1 -1
- package/dist/alphalib/imagemagickDensity.d.ts +4 -0
- package/dist/alphalib/imagemagickDensity.d.ts.map +1 -0
- package/dist/alphalib/imagemagickDensity.js +10 -0
- package/dist/alphalib/imagemagickDensity.js.map +1 -0
- package/dist/alphalib/types/assemblyReplay.d.ts +308 -4
- package/dist/alphalib/types/assemblyReplay.d.ts.map +1 -1
- package/dist/alphalib/types/assemblyReplay.js +22 -2
- package/dist/alphalib/types/assemblyReplay.js.map +1 -1
- package/dist/alphalib/types/assemblyStatus.d.ts +11 -10
- package/dist/alphalib/types/assemblyStatus.d.ts.map +1 -1
- package/dist/alphalib/types/assemblyStatus.js +25 -0
- package/dist/alphalib/types/assemblyStatus.js.map +1 -1
- package/dist/alphalib/types/robots/_index.d.ts +93 -0
- package/dist/alphalib/types/robots/_index.d.ts.map +1 -1
- package/dist/alphalib/types/robots/_instructions-primitives.d.ts +14 -2
- package/dist/alphalib/types/robots/_instructions-primitives.d.ts.map +1 -1
- package/dist/alphalib/types/robots/_instructions-primitives.js +36 -6
- package/dist/alphalib/types/robots/_instructions-primitives.js.map +1 -1
- package/dist/alphalib/types/robots/ai-chat.d.ts +13475 -1034
- package/dist/alphalib/types/robots/ai-chat.d.ts.map +1 -1
- package/dist/alphalib/types/robots/ai-chat.js +307 -60
- package/dist/alphalib/types/robots/ai-chat.js.map +1 -1
- package/dist/alphalib/types/robots/audio-artwork.d.ts.map +1 -1
- package/dist/alphalib/types/robots/audio-artwork.js +1 -0
- package/dist/alphalib/types/robots/audio-artwork.js.map +1 -1
- package/dist/alphalib/types/robots/audio-concat.d.ts +12 -0
- package/dist/alphalib/types/robots/audio-concat.d.ts.map +1 -1
- package/dist/alphalib/types/robots/audio-concat.js +3 -1
- package/dist/alphalib/types/robots/audio-concat.js.map +1 -1
- package/dist/alphalib/types/robots/audio-encode.d.ts.map +1 -1
- package/dist/alphalib/types/robots/audio-encode.js +1 -0
- package/dist/alphalib/types/robots/audio-encode.js.map +1 -1
- package/dist/alphalib/types/robots/audio-loop.d.ts.map +1 -1
- package/dist/alphalib/types/robots/audio-loop.js +1 -0
- package/dist/alphalib/types/robots/audio-loop.js.map +1 -1
- package/dist/alphalib/types/robots/audio-merge.d.ts.map +1 -1
- package/dist/alphalib/types/robots/audio-merge.js +1 -0
- package/dist/alphalib/types/robots/audio-merge.js.map +1 -1
- package/dist/alphalib/types/robots/audio-split.d.ts.map +1 -1
- package/dist/alphalib/types/robots/audio-split.js +1 -0
- package/dist/alphalib/types/robots/audio-split.js.map +1 -1
- package/dist/alphalib/types/robots/audio-waveform.d.ts.map +1 -1
- package/dist/alphalib/types/robots/audio-waveform.js +1 -0
- package/dist/alphalib/types/robots/audio-waveform.js.map +1 -1
- package/dist/alphalib/types/robots/azure-import.d.ts +12 -0
- package/dist/alphalib/types/robots/azure-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/backblaze-import.d.ts +12 -0
- package/dist/alphalib/types/robots/backblaze-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/box-import.d.ts +12 -0
- package/dist/alphalib/types/robots/box-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/cloudfiles-import.d.ts +12 -0
- package/dist/alphalib/types/robots/cloudfiles-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/cloudflare-import.d.ts +12 -0
- package/dist/alphalib/types/robots/cloudflare-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/digitalocean-import.d.ts +12 -0
- package/dist/alphalib/types/robots/digitalocean-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/document-merge.d.ts +12 -0
- package/dist/alphalib/types/robots/document-merge.d.ts.map +1 -1
- package/dist/alphalib/types/robots/document-merge.js +2 -1
- package/dist/alphalib/types/robots/document-merge.js.map +1 -1
- package/dist/alphalib/types/robots/document-ocr.d.ts +10 -10
- package/dist/alphalib/types/robots/document-ocr.d.ts.map +1 -1
- package/dist/alphalib/types/robots/document-ocr.js +4 -4
- package/dist/alphalib/types/robots/document-ocr.js.map +1 -1
- package/dist/alphalib/types/robots/dropbox-import.d.ts +12 -0
- package/dist/alphalib/types/robots/dropbox-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/file-preview.d.ts +12 -12
- package/dist/alphalib/types/robots/file-preview.js +2 -2
- package/dist/alphalib/types/robots/file-preview.js.map +1 -1
- package/dist/alphalib/types/robots/file-serve.d.ts.map +1 -1
- package/dist/alphalib/types/robots/file-serve.js +1 -0
- package/dist/alphalib/types/robots/file-serve.js.map +1 -1
- package/dist/alphalib/types/robots/file-verify.d.ts +12 -0
- package/dist/alphalib/types/robots/file-verify.d.ts.map +1 -1
- package/dist/alphalib/types/robots/file-verify.js +6 -0
- package/dist/alphalib/types/robots/file-verify.js.map +1 -1
- package/dist/alphalib/types/robots/ftp-import.d.ts +12 -0
- package/dist/alphalib/types/robots/ftp-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/google-import.d.ts +12 -0
- package/dist/alphalib/types/robots/google-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/http-import.d.ts +12 -12
- package/dist/alphalib/types/robots/http-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/http-import.js +0 -6
- package/dist/alphalib/types/robots/http-import.js.map +1 -1
- package/dist/alphalib/types/robots/image-bgremove.d.ts +10 -10
- package/dist/alphalib/types/robots/image-bgremove.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-bgremove.js +4 -4
- package/dist/alphalib/types/robots/image-bgremove.js.map +1 -1
- package/dist/alphalib/types/robots/image-describe.d.ts +10 -10
- package/dist/alphalib/types/robots/image-describe.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-describe.js +4 -4
- package/dist/alphalib/types/robots/image-describe.js.map +1 -1
- package/dist/alphalib/types/robots/image-facedetect.d.ts +10 -10
- package/dist/alphalib/types/robots/image-facedetect.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-facedetect.js +4 -4
- package/dist/alphalib/types/robots/image-facedetect.js.map +1 -1
- package/dist/alphalib/types/robots/image-generate.d.ts +6 -6
- package/dist/alphalib/types/robots/image-generate.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-generate.js +2 -2
- package/dist/alphalib/types/robots/image-generate.js.map +1 -1
- package/dist/alphalib/types/robots/image-merge.d.ts +68 -8
- package/dist/alphalib/types/robots/image-merge.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-merge.js +46 -3
- package/dist/alphalib/types/robots/image-merge.js.map +1 -1
- package/dist/alphalib/types/robots/image-ocr.d.ts +10 -10
- package/dist/alphalib/types/robots/image-ocr.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-ocr.js +4 -4
- package/dist/alphalib/types/robots/image-ocr.js.map +1 -1
- package/dist/alphalib/types/robots/image-resize.d.ts +9 -8
- package/dist/alphalib/types/robots/image-resize.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-resize.js +9 -8
- package/dist/alphalib/types/robots/image-resize.js.map +1 -1
- package/dist/alphalib/types/robots/image-upscale.d.ts +4 -4
- package/dist/alphalib/types/robots/image-upscale.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-upscale.js +2 -2
- package/dist/alphalib/types/robots/image-upscale.js.map +1 -1
- package/dist/alphalib/types/robots/mega-import.d.ts +12 -0
- package/dist/alphalib/types/robots/mega-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/minio-import.d.ts +12 -0
- package/dist/alphalib/types/robots/minio-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/s3-import.d.ts +12 -0
- package/dist/alphalib/types/robots/s3-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/sftp-import.d.ts +24 -0
- package/dist/alphalib/types/robots/sftp-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/sftp-import.js +6 -2
- package/dist/alphalib/types/robots/sftp-import.js.map +1 -1
- package/dist/alphalib/types/robots/speech-transcribe.d.ts +10 -10
- package/dist/alphalib/types/robots/speech-transcribe.d.ts.map +1 -1
- package/dist/alphalib/types/robots/speech-transcribe.js +9 -9
- package/dist/alphalib/types/robots/speech-transcribe.js.map +1 -1
- package/dist/alphalib/types/robots/supabase-import.d.ts +12 -0
- package/dist/alphalib/types/robots/supabase-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/swift-import.d.ts +12 -0
- package/dist/alphalib/types/robots/swift-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/text-speak.d.ts +10 -10
- package/dist/alphalib/types/robots/text-speak.d.ts.map +1 -1
- package/dist/alphalib/types/robots/text-speak.js +4 -4
- package/dist/alphalib/types/robots/text-speak.js.map +1 -1
- package/dist/alphalib/types/robots/text-translate.d.ts +10 -10
- package/dist/alphalib/types/robots/text-translate.d.ts.map +1 -1
- package/dist/alphalib/types/robots/text-translate.js +4 -4
- package/dist/alphalib/types/robots/text-translate.js.map +1 -1
- package/dist/alphalib/types/robots/tigris-import.d.ts +12 -0
- package/dist/alphalib/types/robots/tigris-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/tlcdn-deliver.d.ts.map +1 -1
- package/dist/alphalib/types/robots/tlcdn-deliver.js +1 -0
- package/dist/alphalib/types/robots/tlcdn-deliver.js.map +1 -1
- package/dist/alphalib/types/robots/video-adaptive.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-adaptive.js +1 -0
- package/dist/alphalib/types/robots/video-adaptive.js.map +1 -1
- package/dist/alphalib/types/robots/video-artwork.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-artwork.js +1 -0
- package/dist/alphalib/types/robots/video-artwork.js.map +1 -1
- package/dist/alphalib/types/robots/video-concat.d.ts +12 -0
- package/dist/alphalib/types/robots/video-concat.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-concat.js +3 -1
- package/dist/alphalib/types/robots/video-concat.js.map +1 -1
- package/dist/alphalib/types/robots/video-encode.d.ts +4 -4
- package/dist/alphalib/types/robots/video-encode.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-encode.js +1 -0
- package/dist/alphalib/types/robots/video-encode.js.map +1 -1
- package/dist/alphalib/types/robots/video-generate.d.ts +6 -6
- package/dist/alphalib/types/robots/video-generate.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-generate.js +3 -2
- package/dist/alphalib/types/robots/video-generate.js.map +1 -1
- package/dist/alphalib/types/robots/video-merge.d.ts +12 -0
- package/dist/alphalib/types/robots/video-merge.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-merge.js +4 -6
- package/dist/alphalib/types/robots/video-merge.js.map +1 -1
- package/dist/alphalib/types/robots/video-ondemand.d.ts +4 -4
- package/dist/alphalib/types/robots/video-ondemand.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-ondemand.js +1 -0
- package/dist/alphalib/types/robots/video-ondemand.js.map +1 -1
- package/dist/alphalib/types/robots/video-split.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-split.js +1 -0
- package/dist/alphalib/types/robots/video-split.js.map +1 -1
- package/dist/alphalib/types/robots/video-subtitle.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-subtitle.js +1 -0
- package/dist/alphalib/types/robots/video-subtitle.js.map +1 -1
- package/dist/alphalib/types/robots/video-thumbs.d.ts +24 -0
- package/dist/alphalib/types/robots/video-thumbs.d.ts.map +1 -1
- package/dist/alphalib/types/robots/video-thumbs.js +29 -0
- package/dist/alphalib/types/robots/video-thumbs.js.map +1 -1
- package/dist/alphalib/types/robots/vimeo-import.d.ts +12 -0
- package/dist/alphalib/types/robots/vimeo-import.d.ts.map +1 -1
- package/dist/alphalib/types/robots/wasabi-import.d.ts +12 -0
- package/dist/alphalib/types/robots/wasabi-import.d.ts.map +1 -1
- package/dist/cli/semanticIntents/imageDescribe.d.ts +1 -1
- package/dist/cli/semanticIntents/imageDescribe.d.ts.map +1 -1
- package/dist/cli/semanticIntents/imageDescribe.js +2 -2
- package/dist/cli/semanticIntents/imageDescribe.js.map +1 -1
- package/package.json +2 -2
- package/src/alphalib/imagemagickDensity.ts +15 -0
- package/src/alphalib/types/assemblyReplay.ts +31 -2
- package/src/alphalib/types/assemblyStatus.ts +29 -0
- package/src/alphalib/types/robots/_instructions-primitives.ts +39 -6
- package/src/alphalib/types/robots/ai-chat.ts +451 -60
- package/src/alphalib/types/robots/audio-artwork.ts +1 -0
- package/src/alphalib/types/robots/audio-concat.ts +3 -0
- package/src/alphalib/types/robots/audio-encode.ts +1 -0
- package/src/alphalib/types/robots/audio-loop.ts +1 -0
- package/src/alphalib/types/robots/audio-merge.ts +1 -0
- package/src/alphalib/types/robots/audio-split.ts +1 -0
- package/src/alphalib/types/robots/audio-waveform.ts +1 -0
- package/src/alphalib/types/robots/document-merge.ts +7 -1
- package/src/alphalib/types/robots/document-ocr.ts +5 -4
- package/src/alphalib/types/robots/file-preview.ts +2 -2
- package/src/alphalib/types/robots/file-serve.ts +1 -0
- package/src/alphalib/types/robots/file-verify.ts +6 -0
- package/src/alphalib/types/robots/http-import.ts +0 -6
- package/src/alphalib/types/robots/image-bgremove.ts +11 -4
- package/src/alphalib/types/robots/image-describe.ts +5 -4
- package/src/alphalib/types/robots/image-facedetect.ts +5 -4
- package/src/alphalib/types/robots/image-generate.ts +7 -2
- package/src/alphalib/types/robots/image-merge.ts +46 -2
- package/src/alphalib/types/robots/image-ocr.ts +5 -4
- package/src/alphalib/types/robots/image-resize.ts +11 -7
- package/src/alphalib/types/robots/image-upscale.ts +7 -2
- package/src/alphalib/types/robots/sftp-import.ts +12 -2
- package/src/alphalib/types/robots/speech-transcribe.ts +9 -8
- package/src/alphalib/types/robots/text-speak.ts +5 -4
- package/src/alphalib/types/robots/text-translate.ts +5 -4
- package/src/alphalib/types/robots/tlcdn-deliver.ts +1 -0
- package/src/alphalib/types/robots/video-adaptive.ts +1 -0
- package/src/alphalib/types/robots/video-artwork.ts +1 -0
- package/src/alphalib/types/robots/video-concat.ts +3 -0
- package/src/alphalib/types/robots/video-encode.ts +1 -0
- package/src/alphalib/types/robots/video-generate.ts +8 -2
- package/src/alphalib/types/robots/video-merge.ts +5 -5
- package/src/alphalib/types/robots/video-ondemand.ts +1 -0
- package/src/alphalib/types/robots/video-split.ts +1 -0
- package/src/alphalib/types/robots/video-subtitle.ts +1 -0
- package/src/alphalib/types/robots/video-thumbs.ts +29 -0
- package/src/cli/semanticIntents/imageDescribe.ts +2 -3
|
@@ -2,15 +2,28 @@ import type { RobotMetaInput } from './_instructions-primitives.ts'
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
autoProviderDescription,
|
|
7
|
+
interpolateRobot,
|
|
8
|
+
robotBase,
|
|
9
|
+
robotUse,
|
|
10
|
+
} from './_instructions-primitives.ts'
|
|
6
11
|
|
|
7
12
|
// We duplicate coreMessageSchema (and its related types) from structuredAiVercel.ts here
|
|
8
13
|
// so that we do not need to distribute structuredAiVercel.ts to for instance
|
|
9
14
|
// the node-sdk, which does rely on this ai-chat file to determine
|
|
10
15
|
// support Robot parameters.
|
|
11
16
|
|
|
17
|
+
export type JsonValue =
|
|
18
|
+
| string
|
|
19
|
+
| number
|
|
20
|
+
| boolean
|
|
21
|
+
| null
|
|
22
|
+
| JsonValue[]
|
|
23
|
+
| { [key: string]: JsonValue }
|
|
24
|
+
|
|
12
25
|
// Define JSONValue schema for proper type matching with AI SDK
|
|
13
|
-
const jsonValueSchema: z.ZodType = z.lazy(() =>
|
|
26
|
+
const jsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>
|
|
14
27
|
z.union([
|
|
15
28
|
z.string(),
|
|
16
29
|
z.number(),
|
|
@@ -21,74 +34,323 @@ const jsonValueSchema: z.ZodType = z.lazy(() =>
|
|
|
21
34
|
]),
|
|
22
35
|
)
|
|
23
36
|
|
|
24
|
-
// Define provider
|
|
37
|
+
// Define provider options schema to match the AI SDK.
|
|
25
38
|
const providerMetadataSchema = z.record(z.record(jsonValueSchema)).optional()
|
|
26
39
|
|
|
40
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
41
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function withCurrentProviderOptions(value: Record<string, unknown>): Record<string, unknown> {
|
|
45
|
+
const { experimental_providerMetadata, ...rest } = value
|
|
46
|
+
const providerOptions = value.providerOptions ?? experimental_providerMetadata
|
|
47
|
+
return providerOptions === undefined ? rest : { ...rest, providerOptions }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function legacyToolOutput(
|
|
51
|
+
result: unknown,
|
|
52
|
+
isError: boolean,
|
|
53
|
+
experimentalContent: unknown,
|
|
54
|
+
): unknown {
|
|
55
|
+
if (!isError && Array.isArray(experimentalContent)) {
|
|
56
|
+
const content = experimentalContent.flatMap((part): unknown[] => {
|
|
57
|
+
if (!isRecord(part)) {
|
|
58
|
+
return []
|
|
59
|
+
}
|
|
60
|
+
if (part.type === 'text' && typeof part.text === 'string') {
|
|
61
|
+
return [{ type: 'text', text: part.text }]
|
|
62
|
+
}
|
|
63
|
+
if (part.type === 'image' && typeof part.data === 'string') {
|
|
64
|
+
return [
|
|
65
|
+
{
|
|
66
|
+
type: 'image-data',
|
|
67
|
+
data: part.data,
|
|
68
|
+
mediaType: typeof part.mimeType === 'string' ? part.mimeType : 'image',
|
|
69
|
+
},
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
if (
|
|
73
|
+
part.type === 'media' &&
|
|
74
|
+
typeof part.data === 'string' &&
|
|
75
|
+
typeof part.mediaType === 'string'
|
|
76
|
+
) {
|
|
77
|
+
return [{ type: 'file-data', data: part.data, mediaType: part.mediaType }]
|
|
78
|
+
}
|
|
79
|
+
return []
|
|
80
|
+
})
|
|
81
|
+
if (content.length === experimentalContent.length) {
|
|
82
|
+
return { type: 'content', value: content }
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let parsed: ReturnType<typeof jsonValueSchema.safeParse> | undefined
|
|
87
|
+
try {
|
|
88
|
+
// Zod's recursive JSON schema overflows before returning a failed parse for circular values.
|
|
89
|
+
parsed = jsonValueSchema.safeParse(result)
|
|
90
|
+
} catch {
|
|
91
|
+
parsed = undefined
|
|
92
|
+
}
|
|
93
|
+
if (parsed?.success) {
|
|
94
|
+
return { type: isError ? 'error-json' : 'json', value: parsed.data }
|
|
95
|
+
}
|
|
96
|
+
return { type: isError ? 'error-text' : 'text', value: stringifyLegacyToolResult(result) }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function stringifyLegacyToolResult(result: unknown): string {
|
|
100
|
+
try {
|
|
101
|
+
const serialized = JSON.stringify(result)
|
|
102
|
+
if (serialized !== undefined) {
|
|
103
|
+
return serialized
|
|
104
|
+
}
|
|
105
|
+
} catch {
|
|
106
|
+
// Fall back to the platform string representation for circular or unsupported values.
|
|
107
|
+
}
|
|
108
|
+
return String(result)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function normalizeMessagePart(value: unknown): unknown {
|
|
112
|
+
if (!isRecord(value)) {
|
|
113
|
+
return value
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const normalized = withCurrentProviderOptions(value)
|
|
117
|
+
if (normalized.type === 'image' && !('mediaType' in normalized) && 'mimeType' in normalized) {
|
|
118
|
+
const { mimeType, ...rest } = normalized
|
|
119
|
+
return { ...rest, mediaType: mimeType }
|
|
120
|
+
}
|
|
121
|
+
if (
|
|
122
|
+
normalized.type === 'media' &&
|
|
123
|
+
typeof normalized.data === 'string' &&
|
|
124
|
+
typeof normalized.mediaType === 'string'
|
|
125
|
+
) {
|
|
126
|
+
const { data, mediaType, type: _type, ...rest } = normalized
|
|
127
|
+
return { ...rest, type: 'file', data: { type: 'data', data }, mediaType }
|
|
128
|
+
}
|
|
129
|
+
if (normalized.type === 'tool-call' && !('input' in normalized) && 'args' in normalized) {
|
|
130
|
+
const { args, ...rest } = normalized
|
|
131
|
+
return { ...rest, input: args }
|
|
132
|
+
}
|
|
133
|
+
if (normalized.type === 'tool-result' && 'output' in normalized) {
|
|
134
|
+
const output = normalized.output
|
|
135
|
+
if (isRecord(output) && output.type === 'content' && Array.isArray(output.value)) {
|
|
136
|
+
return {
|
|
137
|
+
...normalized,
|
|
138
|
+
output: {
|
|
139
|
+
...output,
|
|
140
|
+
value: output.value.map((part) => {
|
|
141
|
+
if (
|
|
142
|
+
isRecord(part) &&
|
|
143
|
+
part.type === 'media' &&
|
|
144
|
+
typeof part.data === 'string' &&
|
|
145
|
+
typeof part.mediaType === 'string'
|
|
146
|
+
) {
|
|
147
|
+
return { type: 'file-data', data: part.data, mediaType: part.mediaType }
|
|
148
|
+
}
|
|
149
|
+
return part
|
|
150
|
+
}),
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (normalized.type === 'tool-result' && !('output' in normalized)) {
|
|
156
|
+
const { experimental_content: experimentalContent, isError, result, ...rest } = normalized
|
|
157
|
+
return {
|
|
158
|
+
...rest,
|
|
159
|
+
output: legacyToolOutput(result, isError === true, experimentalContent),
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return normalized
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function normalizeMessage(value: unknown): unknown {
|
|
166
|
+
if (!isRecord(value)) {
|
|
167
|
+
return value
|
|
168
|
+
}
|
|
169
|
+
const normalized = withCurrentProviderOptions(value)
|
|
170
|
+
return Array.isArray(normalized.content)
|
|
171
|
+
? { ...normalized, content: normalized.content.map(normalizeMessagePart) }
|
|
172
|
+
: normalized
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const inlineDataSchema = z.union([z.string(), z.instanceof(Uint8Array), z.instanceof(ArrayBuffer)])
|
|
176
|
+
const providerReferenceSchema = z.record(z.string(), z.string())
|
|
177
|
+
const taggedFileDataSchema = z.discriminatedUnion('type', [
|
|
178
|
+
z.object({ type: z.literal('data'), data: inlineDataSchema }),
|
|
179
|
+
z.object({ type: z.literal('url'), url: z.instanceof(URL) }),
|
|
180
|
+
z.object({ type: z.literal('reference'), reference: providerReferenceSchema }),
|
|
181
|
+
z.object({ type: z.literal('text'), text: z.string() }),
|
|
182
|
+
])
|
|
183
|
+
const taggedReasoningFileDataSchema = z.discriminatedUnion('type', [
|
|
184
|
+
z.object({ type: z.literal('data'), data: inlineDataSchema }),
|
|
185
|
+
z.object({ type: z.literal('url'), url: z.instanceof(URL) }),
|
|
186
|
+
])
|
|
187
|
+
|
|
27
188
|
const textPartSchema = z.object({
|
|
28
189
|
type: z.literal('text'),
|
|
29
190
|
text: z.string(),
|
|
30
|
-
|
|
191
|
+
providerOptions: providerMetadataSchema,
|
|
31
192
|
})
|
|
32
193
|
const imagePartSchema = z.object({
|
|
33
194
|
type: z.literal('image'),
|
|
34
|
-
image: z.union([
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
z.instanceof(ArrayBuffer),
|
|
38
|
-
// Note: Buffer is not included here since it's Node.js-only and this code runs in browsers.
|
|
39
|
-
// Node.js Buffer extends Uint8Array, so Uint8Array validation handles Buffer values too.
|
|
40
|
-
z.instanceof(URL),
|
|
41
|
-
]),
|
|
42
|
-
mimeType: z.string().optional(),
|
|
43
|
-
experimental_providerMetadata: providerMetadataSchema,
|
|
195
|
+
image: z.union([inlineDataSchema, z.instanceof(URL), providerReferenceSchema]),
|
|
196
|
+
mediaType: z.string().optional(),
|
|
197
|
+
providerOptions: providerMetadataSchema,
|
|
44
198
|
})
|
|
45
199
|
const filePartSchema = z.object({
|
|
46
200
|
type: z.literal('file'),
|
|
47
201
|
data: z.union([
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
z.instanceof(ArrayBuffer),
|
|
51
|
-
// Note: Buffer is not included here since it's Node.js-only and this code runs in browsers.
|
|
52
|
-
// Node.js Buffer extends Uint8Array, so Uint8Array validation handles Buffer values too.
|
|
202
|
+
taggedFileDataSchema,
|
|
203
|
+
inlineDataSchema,
|
|
53
204
|
z.instanceof(URL),
|
|
205
|
+
providerReferenceSchema,
|
|
54
206
|
]),
|
|
207
|
+
filename: z.string().optional(),
|
|
55
208
|
mediaType: z.string(),
|
|
56
|
-
|
|
209
|
+
providerOptions: providerMetadataSchema,
|
|
210
|
+
})
|
|
211
|
+
const reasoningPartSchema = z.object({
|
|
212
|
+
type: z.literal('reasoning'),
|
|
213
|
+
text: z.string(),
|
|
214
|
+
providerOptions: providerMetadataSchema,
|
|
57
215
|
})
|
|
58
|
-
|
|
216
|
+
function isCustomKind(value: string): value is `${string}.${string}` {
|
|
217
|
+
return value.includes('.')
|
|
218
|
+
}
|
|
219
|
+
const customPartSchema = z.object({
|
|
220
|
+
type: z.literal('custom'),
|
|
221
|
+
kind: z.string().refine(isCustomKind),
|
|
222
|
+
providerOptions: providerMetadataSchema,
|
|
223
|
+
})
|
|
224
|
+
const reasoningFilePartSchema = z.object({
|
|
225
|
+
type: z.literal('reasoning-file'),
|
|
226
|
+
data: z.union([taggedReasoningFileDataSchema, inlineDataSchema, z.instanceof(URL)]),
|
|
227
|
+
mediaType: z.string(),
|
|
228
|
+
providerOptions: providerMetadataSchema,
|
|
229
|
+
})
|
|
230
|
+
const toolCallPartBaseSchema = z.object({
|
|
59
231
|
type: z.literal('tool-call'),
|
|
60
232
|
toolCallId: z.string(),
|
|
61
233
|
toolName: z.string(),
|
|
62
|
-
|
|
63
|
-
|
|
234
|
+
input: z.unknown(),
|
|
235
|
+
providerOptions: providerMetadataSchema,
|
|
236
|
+
providerExecuted: z.boolean().optional(),
|
|
64
237
|
})
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
238
|
+
type ToolCallPart = Omit<z.infer<typeof toolCallPartBaseSchema>, 'input'> & { input: unknown }
|
|
239
|
+
const toolCallPartSchema = toolCallPartBaseSchema.transform(
|
|
240
|
+
(part): ToolCallPart => ({ ...part, input: part.input }),
|
|
241
|
+
)
|
|
242
|
+
const toolOutputSchema = z.discriminatedUnion('type', [
|
|
243
|
+
z.object({ type: z.literal('text'), value: z.string(), providerOptions: providerMetadataSchema }),
|
|
244
|
+
z.object({
|
|
245
|
+
type: z.literal('json'),
|
|
246
|
+
value: jsonValueSchema,
|
|
247
|
+
providerOptions: providerMetadataSchema,
|
|
248
|
+
}),
|
|
249
|
+
z.object({
|
|
250
|
+
type: z.literal('execution-denied'),
|
|
251
|
+
reason: z.string().optional(),
|
|
252
|
+
providerOptions: providerMetadataSchema,
|
|
253
|
+
}),
|
|
254
|
+
z.object({
|
|
255
|
+
type: z.literal('error-text'),
|
|
256
|
+
value: z.string(),
|
|
257
|
+
providerOptions: providerMetadataSchema,
|
|
258
|
+
}),
|
|
259
|
+
z.object({
|
|
260
|
+
type: z.literal('error-json'),
|
|
261
|
+
value: jsonValueSchema,
|
|
262
|
+
providerOptions: providerMetadataSchema,
|
|
263
|
+
}),
|
|
264
|
+
z.object({
|
|
265
|
+
type: z.literal('content'),
|
|
266
|
+
value: z.array(
|
|
72
267
|
z.union([
|
|
73
268
|
z.object({
|
|
74
269
|
type: z.literal('text'),
|
|
75
270
|
text: z.string(),
|
|
271
|
+
providerOptions: providerMetadataSchema,
|
|
272
|
+
}),
|
|
273
|
+
z.object({
|
|
274
|
+
type: z.literal('file'),
|
|
275
|
+
data: taggedFileDataSchema,
|
|
276
|
+
mediaType: z.string(),
|
|
277
|
+
filename: z.string().optional(),
|
|
278
|
+
providerOptions: providerMetadataSchema,
|
|
76
279
|
}),
|
|
77
280
|
z.object({
|
|
78
|
-
type: z.literal('
|
|
281
|
+
type: z.literal('file-data'),
|
|
79
282
|
data: z.string(),
|
|
80
|
-
|
|
283
|
+
mediaType: z.string(),
|
|
284
|
+
filename: z.string().optional(),
|
|
285
|
+
providerOptions: providerMetadataSchema,
|
|
286
|
+
}),
|
|
287
|
+
z.object({
|
|
288
|
+
type: z.literal('file-url'),
|
|
289
|
+
url: z.string(),
|
|
290
|
+
mediaType: z.string().optional(),
|
|
291
|
+
providerOptions: providerMetadataSchema,
|
|
292
|
+
}),
|
|
293
|
+
z.object({
|
|
294
|
+
type: z.literal('file-id'),
|
|
295
|
+
fileId: z.union([z.string(), providerReferenceSchema]),
|
|
296
|
+
providerOptions: providerMetadataSchema,
|
|
297
|
+
}),
|
|
298
|
+
z.object({
|
|
299
|
+
type: z.literal('file-reference'),
|
|
300
|
+
providerReference: providerReferenceSchema,
|
|
301
|
+
providerOptions: providerMetadataSchema,
|
|
81
302
|
}),
|
|
303
|
+
z.object({
|
|
304
|
+
type: z.literal('image-data'),
|
|
305
|
+
data: z.string(),
|
|
306
|
+
mediaType: z.string(),
|
|
307
|
+
providerOptions: providerMetadataSchema,
|
|
308
|
+
}),
|
|
309
|
+
z.object({
|
|
310
|
+
type: z.literal('image-url'),
|
|
311
|
+
url: z.string(),
|
|
312
|
+
providerOptions: providerMetadataSchema,
|
|
313
|
+
}),
|
|
314
|
+
z.object({
|
|
315
|
+
type: z.literal('image-file-id'),
|
|
316
|
+
fileId: z.union([z.string(), providerReferenceSchema]),
|
|
317
|
+
providerOptions: providerMetadataSchema,
|
|
318
|
+
}),
|
|
319
|
+
z.object({
|
|
320
|
+
type: z.literal('image-file-reference'),
|
|
321
|
+
providerReference: providerReferenceSchema,
|
|
322
|
+
providerOptions: providerMetadataSchema,
|
|
323
|
+
}),
|
|
324
|
+
z.object({ type: z.literal('custom'), providerOptions: providerMetadataSchema }),
|
|
82
325
|
]),
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
326
|
+
),
|
|
327
|
+
}),
|
|
328
|
+
])
|
|
329
|
+
const toolResultPartSchema = z.object({
|
|
330
|
+
type: z.literal('tool-result'),
|
|
331
|
+
toolCallId: z.string(),
|
|
332
|
+
toolName: z.string(),
|
|
333
|
+
output: toolOutputSchema,
|
|
334
|
+
providerOptions: providerMetadataSchema,
|
|
335
|
+
})
|
|
336
|
+
const toolApprovalRequestSchema = z.object({
|
|
337
|
+
type: z.literal('tool-approval-request'),
|
|
338
|
+
approvalId: z.string(),
|
|
339
|
+
toolCallId: z.string(),
|
|
340
|
+
isAutomatic: z.boolean().optional(),
|
|
341
|
+
signature: z.string().optional(),
|
|
342
|
+
})
|
|
343
|
+
const toolApprovalResponseSchema = z.object({
|
|
344
|
+
type: z.literal('tool-approval-response'),
|
|
345
|
+
approvalId: z.string(),
|
|
346
|
+
approved: z.boolean(),
|
|
347
|
+
reason: z.string().optional(),
|
|
348
|
+
providerExecuted: z.boolean().optional(),
|
|
87
349
|
})
|
|
88
350
|
const coreSystemMessageSchema = z.object({
|
|
89
351
|
role: z.literal('system'),
|
|
90
352
|
content: z.string(),
|
|
91
|
-
|
|
353
|
+
providerOptions: providerMetadataSchema,
|
|
92
354
|
})
|
|
93
355
|
const coreUserMessageSchema = z.object({
|
|
94
356
|
role: z.literal('user'),
|
|
@@ -96,24 +358,141 @@ const coreUserMessageSchema = z.object({
|
|
|
96
358
|
z.string(),
|
|
97
359
|
z.array(z.union([textPartSchema, imagePartSchema, filePartSchema])),
|
|
98
360
|
]),
|
|
99
|
-
|
|
361
|
+
providerOptions: providerMetadataSchema,
|
|
100
362
|
})
|
|
101
363
|
const coreAssistantMessageSchema = z.object({
|
|
102
364
|
role: z.literal('assistant'),
|
|
103
|
-
content: z.union([
|
|
104
|
-
|
|
365
|
+
content: z.union([
|
|
366
|
+
z.string(),
|
|
367
|
+
z.array(
|
|
368
|
+
z.union([
|
|
369
|
+
textPartSchema,
|
|
370
|
+
customPartSchema,
|
|
371
|
+
filePartSchema,
|
|
372
|
+
reasoningPartSchema,
|
|
373
|
+
reasoningFilePartSchema,
|
|
374
|
+
toolCallPartSchema,
|
|
375
|
+
toolResultPartSchema,
|
|
376
|
+
toolApprovalRequestSchema,
|
|
377
|
+
]),
|
|
378
|
+
),
|
|
379
|
+
]),
|
|
380
|
+
providerOptions: providerMetadataSchema,
|
|
105
381
|
})
|
|
106
382
|
const coreToolMessageSchema = z.object({
|
|
107
383
|
role: z.literal('tool'),
|
|
108
|
-
content: z.array(toolResultPartSchema),
|
|
109
|
-
|
|
384
|
+
content: z.array(z.union([toolResultPartSchema, toolApprovalResponseSchema])),
|
|
385
|
+
providerOptions: providerMetadataSchema,
|
|
110
386
|
})
|
|
111
|
-
const
|
|
387
|
+
const coreMessageOutputSchema = z.discriminatedUnion('role', [
|
|
112
388
|
coreSystemMessageSchema,
|
|
113
389
|
coreUserMessageSchema,
|
|
114
390
|
coreAssistantMessageSchema,
|
|
115
391
|
coreToolMessageSchema,
|
|
116
392
|
])
|
|
393
|
+
const coreMessageSchema = z.preprocess(normalizeMessage, coreMessageOutputSchema)
|
|
394
|
+
|
|
395
|
+
type ProviderMetadata = NonNullable<z.output<typeof providerMetadataSchema>>
|
|
396
|
+
type CompatibleProviderOptions<Part extends { providerOptions?: ProviderMetadata }> = Omit<
|
|
397
|
+
Part,
|
|
398
|
+
'providerOptions'
|
|
399
|
+
> & {
|
|
400
|
+
providerOptions?: ProviderMetadata
|
|
401
|
+
experimental_providerMetadata?: ProviderMetadata
|
|
402
|
+
}
|
|
403
|
+
type MessageProviderOptions = {
|
|
404
|
+
providerOptions?: ProviderMetadata
|
|
405
|
+
experimental_providerMetadata?: ProviderMetadata
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
type TextPartInput = CompatibleProviderOptions<z.output<typeof textPartSchema>>
|
|
409
|
+
type ImagePartInput = CompatibleProviderOptions<z.output<typeof imagePartSchema>>
|
|
410
|
+
type LegacyImagePartInput = CompatibleProviderOptions<
|
|
411
|
+
Omit<z.output<typeof imagePartSchema>, 'mediaType'> & { mimeType?: string }
|
|
412
|
+
>
|
|
413
|
+
type FilePartInput = CompatibleProviderOptions<z.output<typeof filePartSchema>>
|
|
414
|
+
type CustomPartInput = CompatibleProviderOptions<z.output<typeof customPartSchema>>
|
|
415
|
+
type ReasoningPartInput = CompatibleProviderOptions<z.output<typeof reasoningPartSchema>>
|
|
416
|
+
type ReasoningFilePartInput = CompatibleProviderOptions<z.output<typeof reasoningFilePartSchema>>
|
|
417
|
+
type ToolCallPartInput = CompatibleProviderOptions<z.output<typeof toolCallPartSchema>>
|
|
418
|
+
type LegacyToolCallPartInput = Omit<ToolCallPartInput, 'input'> & { args: unknown }
|
|
419
|
+
type ToolResultPartInput = CompatibleProviderOptions<z.output<typeof toolResultPartSchema>>
|
|
420
|
+
|
|
421
|
+
type LegacyTextToolContentPart = { type: 'text'; text: string }
|
|
422
|
+
type LegacyImageToolContentPart = { type: 'image'; data: string; mimeType?: string }
|
|
423
|
+
type LegacyMediaToolContentPart = { type: 'media'; data: string; mediaType: string }
|
|
424
|
+
type LegacyToolContentPart =
|
|
425
|
+
| LegacyTextToolContentPart
|
|
426
|
+
| LegacyImageToolContentPart
|
|
427
|
+
| LegacyMediaToolContentPart
|
|
428
|
+
type CurrentToolContentPart = Extract<
|
|
429
|
+
z.output<typeof toolOutputSchema>,
|
|
430
|
+
{ type: 'content' }
|
|
431
|
+
>['value'][number]
|
|
432
|
+
type LegacyToolResultPartInput = {
|
|
433
|
+
type: 'tool-result'
|
|
434
|
+
toolCallId: string
|
|
435
|
+
toolName: string
|
|
436
|
+
output?:
|
|
437
|
+
| Exclude<z.output<typeof toolOutputSchema>, { type: 'content' }>
|
|
438
|
+
| { type: 'content'; value: Array<CurrentToolContentPart | LegacyToolContentPart> }
|
|
439
|
+
result?: unknown
|
|
440
|
+
isError?: boolean
|
|
441
|
+
experimental_content?: LegacyToolContentPart[]
|
|
442
|
+
} & MessageProviderOptions
|
|
443
|
+
type LegacyMediaMessagePartInput = LegacyMediaToolContentPart & MessageProviderOptions
|
|
444
|
+
|
|
445
|
+
type CoreSystemMessageInput = {
|
|
446
|
+
role: 'system'
|
|
447
|
+
content: string
|
|
448
|
+
} & MessageProviderOptions
|
|
449
|
+
type CoreUserMessageInput = {
|
|
450
|
+
role: 'user'
|
|
451
|
+
content:
|
|
452
|
+
| string
|
|
453
|
+
| Array<
|
|
454
|
+
| TextPartInput
|
|
455
|
+
| ImagePartInput
|
|
456
|
+
| LegacyImagePartInput
|
|
457
|
+
| FilePartInput
|
|
458
|
+
| LegacyMediaMessagePartInput
|
|
459
|
+
>
|
|
460
|
+
} & MessageProviderOptions
|
|
461
|
+
type CoreAssistantMessageInput = {
|
|
462
|
+
role: 'assistant'
|
|
463
|
+
content:
|
|
464
|
+
| string
|
|
465
|
+
| Array<
|
|
466
|
+
| TextPartInput
|
|
467
|
+
| CustomPartInput
|
|
468
|
+
| FilePartInput
|
|
469
|
+
| ReasoningPartInput
|
|
470
|
+
| ReasoningFilePartInput
|
|
471
|
+
| ToolCallPartInput
|
|
472
|
+
| LegacyToolCallPartInput
|
|
473
|
+
| ToolResultPartInput
|
|
474
|
+
| LegacyToolResultPartInput
|
|
475
|
+
| z.output<typeof toolApprovalRequestSchema>
|
|
476
|
+
>
|
|
477
|
+
} & MessageProviderOptions
|
|
478
|
+
type CoreToolMessageInput = {
|
|
479
|
+
role: 'tool'
|
|
480
|
+
content: Array<
|
|
481
|
+
ToolResultPartInput | LegacyToolResultPartInput | z.output<typeof toolApprovalResponseSchema>
|
|
482
|
+
>
|
|
483
|
+
} & MessageProviderOptions
|
|
484
|
+
|
|
485
|
+
export type CoreMessageInput =
|
|
486
|
+
| z.output<typeof coreMessageOutputSchema>
|
|
487
|
+
| CoreSystemMessageInput
|
|
488
|
+
| CoreUserMessageInput
|
|
489
|
+
| CoreAssistantMessageInput
|
|
490
|
+
| CoreToolMessageInput
|
|
491
|
+
|
|
492
|
+
type WithTypedMessages<Instructions extends { messages: unknown }> = Omit<
|
|
493
|
+
Instructions,
|
|
494
|
+
'messages'
|
|
495
|
+
> & { messages: string | CoreMessageInput[] }
|
|
117
496
|
|
|
118
497
|
export const meta: RobotMetaInput = {
|
|
119
498
|
name: 'AiChatRobot',
|
|
@@ -154,17 +533,26 @@ export const meta: RobotMetaInput = {
|
|
|
154
533
|
}
|
|
155
534
|
|
|
156
535
|
/**
|
|
157
|
-
*
|
|
536
|
+
* Transloadit's supported /ai/chat models and their input capabilities.
|
|
537
|
+
* This is intentionally not a complete vendor catalog: add models only after runtime behavior,
|
|
538
|
+
* pricing, and file handling have been reviewed.
|
|
158
539
|
* Key format: 'vendor/model'
|
|
159
540
|
*/
|
|
160
541
|
export const MODEL_CAPABILITIES: Record<string, { pdf: boolean; image: boolean }> = {
|
|
542
|
+
'anthropic/claude-sonnet-4-6': { pdf: true, image: true },
|
|
161
543
|
'anthropic/claude-4-sonnet-20250514': { pdf: true, image: true },
|
|
544
|
+
'anthropic/claude-sonnet-4-20250514': { pdf: true, image: true },
|
|
545
|
+
'anthropic/claude-opus-4-8': { pdf: true, image: true },
|
|
546
|
+
'anthropic/claude-opus-5': { pdf: true, image: true },
|
|
162
547
|
'anthropic/claude-4-opus-20250514': { pdf: true, image: true },
|
|
548
|
+
'anthropic/claude-opus-4-20250514': { pdf: true, image: true },
|
|
163
549
|
'anthropic/claude-sonnet-4-5': { pdf: true, image: true },
|
|
164
550
|
'anthropic/claude-opus-4-5': { pdf: true, image: true },
|
|
165
551
|
'anthropic/claude-opus-4-6': { pdf: true, image: true },
|
|
166
552
|
'anthropic/claude-opus-4-7': { pdf: true, image: true },
|
|
167
|
-
'anthropic/claude-
|
|
553
|
+
'anthropic/claude-fable-5': { pdf: true, image: true },
|
|
554
|
+
'anthropic/claude-fable-5-1': { pdf: true, image: true },
|
|
555
|
+
'anthropic/claude-sonnet-5': { pdf: true, image: true },
|
|
168
556
|
'openai/gpt-4.1-2025-04-14': { pdf: false, image: true },
|
|
169
557
|
'openai/chatgpt-4o-latest': { pdf: false, image: true },
|
|
170
558
|
'openai/o3-2025-04-16': { pdf: false, image: true },
|
|
@@ -176,6 +564,8 @@ export const MODEL_CAPABILITIES: Record<string, { pdf: boolean; image: boolean }
|
|
|
176
564
|
'openai/gpt-5.2-chat-latest': { pdf: false, image: true },
|
|
177
565
|
'openai/gpt-5.2-pro': { pdf: false, image: true },
|
|
178
566
|
'openai/gpt-5.5': { pdf: false, image: true },
|
|
567
|
+
'openai/gpt-5.6-sol': { pdf: false, image: true },
|
|
568
|
+
'openai/gpt-6-astra': { pdf: false, image: true },
|
|
179
569
|
'openai/gpt-5.4': { pdf: false, image: true },
|
|
180
570
|
'openai/gpt-5.4-mini': { pdf: false, image: true },
|
|
181
571
|
'openai/gpt-5.4-nano': { pdf: false, image: true },
|
|
@@ -183,10 +573,8 @@ export const MODEL_CAPABILITIES: Record<string, { pdf: boolean; image: boolean }
|
|
|
183
573
|
'moonshot/kimi-k2': { pdf: false, image: false },
|
|
184
574
|
}
|
|
185
575
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
// flagship model). Keep this aligned with MODEL_CAPABILITIES.
|
|
189
|
-
export const AI_CHAT_DEFAULT_MODEL = 'openai/gpt-5.5' satisfies keyof typeof MODEL_CAPABILITIES
|
|
576
|
+
/** Default /ai/chat model for `auto` or omitted selections; keep aligned with the API backend. */
|
|
577
|
+
export const AI_CHAT_DEFAULT_MODEL = 'openai/gpt-6-astra' satisfies keyof typeof MODEL_CAPABILITIES
|
|
190
578
|
|
|
191
579
|
const supportedModelsList = Object.keys(MODEL_CAPABILITIES)
|
|
192
580
|
|
|
@@ -226,19 +614,19 @@ export const robotAiChatInstructionsSchema = robotBase
|
|
|
226
614
|
.enum(['xhigh', 'high', 'medium', 'low'])
|
|
227
615
|
.optional()
|
|
228
616
|
.describe(
|
|
229
|
-
'Controls how much effort the model spends on reasoning. Higher values produce more thorough responses but cost more tokens. Applies to models that support extended thinking (OpenAI o-series, GPT-5.x, Anthropic Claude with thinking). If omitted, the model default is used.',
|
|
617
|
+
'Controls how much effort the model spends on reasoning. Higher values produce more thorough responses but cost more tokens. Applies to models that support extended thinking (OpenAI o-series, GPT-5.x, GPT-6, Anthropic Claude with thinking). If omitted, the model default is used.',
|
|
230
618
|
),
|
|
231
619
|
credentials: z
|
|
232
620
|
.union([z.string(), z.array(z.string())])
|
|
233
621
|
.optional()
|
|
234
622
|
.describe(
|
|
235
|
-
'Names of template credentials to make available to the robot. When using your own AI provider keys, Transloadit charges a
|
|
623
|
+
'Names of template credentials to make available to the robot. When using your own AI provider keys, Transloadit charges a 30% markup (minimum $0.0005 per request).',
|
|
236
624
|
),
|
|
237
625
|
test_credentials: z
|
|
238
626
|
.boolean()
|
|
239
627
|
.optional()
|
|
240
628
|
.describe(
|
|
241
|
-
'Use Transloadit-provided credentials for testing. Usage is billed at provider cost plus a
|
|
629
|
+
'Use Transloadit-provided credentials for testing. Usage is billed at provider cost plus a 30% markup (minimum $0.0005 per request).',
|
|
242
630
|
),
|
|
243
631
|
mcp_servers: z
|
|
244
632
|
.array(
|
|
@@ -266,9 +654,9 @@ export const robotAiChatInstructionsWithHiddenFieldsSchema = robotAiChatInstruct
|
|
|
266
654
|
result: z.union([z.literal('debug'), robotAiChatInstructionsSchema.shape.result]),
|
|
267
655
|
provider: z
|
|
268
656
|
.string()
|
|
269
|
-
.
|
|
657
|
+
.default('auto')
|
|
270
658
|
.describe(
|
|
271
|
-
|
|
659
|
+
`${autoProviderDescription} This is a hidden placeholder for future model routing flexibility.`,
|
|
272
660
|
),
|
|
273
661
|
// These are listed here because we don't have these properties in the public documentation.
|
|
274
662
|
// They should set these keys using template credentials.
|
|
@@ -283,13 +671,16 @@ export const robotAiChatInstructionsWithHiddenFieldsSchema = robotAiChatInstruct
|
|
|
283
671
|
})
|
|
284
672
|
|
|
285
673
|
export type RobotAiChatInstructions = z.infer<typeof robotAiChatInstructionsSchema>
|
|
674
|
+
export type RobotAiChatInstructionsInput = WithTypedMessages<
|
|
675
|
+
z.input<typeof robotAiChatInstructionsSchema>
|
|
676
|
+
>
|
|
286
677
|
|
|
287
678
|
export type RobotAiChatInstructionsWithHiddenFields = z.infer<
|
|
288
679
|
typeof robotAiChatInstructionsWithHiddenFieldsSchema
|
|
289
680
|
>
|
|
290
681
|
|
|
291
|
-
export type RobotAiChatInstructionsWithHiddenFieldsInput =
|
|
292
|
-
typeof robotAiChatInstructionsWithHiddenFieldsSchema
|
|
682
|
+
export type RobotAiChatInstructionsWithHiddenFieldsInput = WithTypedMessages<
|
|
683
|
+
z.input<typeof robotAiChatInstructionsWithHiddenFieldsSchema>
|
|
293
684
|
>
|
|
294
685
|
|
|
295
686
|
export const interpolatableRobotAiChatInstructionsSchema = interpolateRobot(
|
|
@@ -298,8 +689,8 @@ export const interpolatableRobotAiChatInstructionsSchema = interpolateRobot(
|
|
|
298
689
|
export type InterpolatableRobotAiChatInstructions = z.infer<
|
|
299
690
|
typeof interpolatableRobotAiChatInstructionsSchema
|
|
300
691
|
>
|
|
301
|
-
export type InterpolatableRobotAiChatInstructionsInput =
|
|
302
|
-
typeof interpolatableRobotAiChatInstructionsSchema
|
|
692
|
+
export type InterpolatableRobotAiChatInstructionsInput = WithTypedMessages<
|
|
693
|
+
z.input<typeof interpolatableRobotAiChatInstructionsSchema>
|
|
303
694
|
>
|
|
304
695
|
|
|
305
696
|
export const interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema = interpolateRobot(
|
|
@@ -308,6 +699,6 @@ export const interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema = inter
|
|
|
308
699
|
export type InterpolatableRobotAiChatInstructionsWithHiddenFields = z.infer<
|
|
309
700
|
typeof interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema
|
|
310
701
|
>
|
|
311
|
-
export type InterpolatableRobotAiChatInstructionsWithHiddenFieldsInput =
|
|
312
|
-
typeof interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema
|
|
702
|
+
export type InterpolatableRobotAiChatInstructionsWithHiddenFieldsInput = WithTypedMessages<
|
|
703
|
+
z.input<typeof interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema>
|
|
313
704
|
>
|
|
@@ -43,6 +43,7 @@ export const meta: RobotMetaInput = {
|
|
|
43
43
|
queueSlotCount: 20,
|
|
44
44
|
isAllowedForUrlTransform: true,
|
|
45
45
|
trackOutputFileSize: true,
|
|
46
|
+
applyCommunityPlanMediaTrim: true,
|
|
46
47
|
isInternal: false,
|
|
47
48
|
removeJobResultFilesFromDiskRightAfterStoringOnS3: false,
|
|
48
49
|
stage: 'ga',
|
|
@@ -5,6 +5,7 @@ import { z } from 'zod'
|
|
|
5
5
|
import { stackVersions } from '../stackVersions.ts'
|
|
6
6
|
import {
|
|
7
7
|
bitrateSchema,
|
|
8
|
+
inputSortBySchema,
|
|
8
9
|
interpolateRobot,
|
|
9
10
|
robotBase,
|
|
10
11
|
robotFFmpegAudio,
|
|
@@ -64,6 +65,7 @@ export const meta: RobotMetaInput = {
|
|
|
64
65
|
queueSlotCount: 20,
|
|
65
66
|
isAllowedForUrlTransform: true,
|
|
66
67
|
trackOutputFileSize: true,
|
|
68
|
+
applyCommunityPlanMediaTrim: true,
|
|
67
69
|
isInternal: false,
|
|
68
70
|
removeJobResultFilesFromDiskRightAfterStoringOnS3: false,
|
|
69
71
|
stage: 'ga',
|
|
@@ -104,6 +106,7 @@ The duration of the crossfade is controlled by the \`audio_fade_seconds\` parame
|
|
|
104
106
|
|
|
105
107
|
Note: This parameter requires at least 2 audio files to concatenate and only works with audio files, not video files.
|
|
106
108
|
`),
|
|
109
|
+
sort_by: inputSortBySchema,
|
|
107
110
|
})
|
|
108
111
|
.strict()
|
|
109
112
|
|