transloadit 4.1.0 → 4.1.3
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/alphalib/mcache.d.ts +2 -2
- package/dist/alphalib/mcache.d.ts.map +1 -1
- package/dist/alphalib/mcache.js.map +1 -1
- package/dist/alphalib/types/assembliesGet.d.ts +4 -4
- package/dist/alphalib/types/assemblyReplay.d.ts +392 -178
- package/dist/alphalib/types/assemblyReplay.d.ts.map +1 -1
- package/dist/alphalib/types/assemblyReplayNotification.d.ts +392 -178
- package/dist/alphalib/types/assemblyReplayNotification.d.ts.map +1 -1
- package/dist/alphalib/types/assemblyStatus.d.ts +102 -102
- package/dist/alphalib/types/bill.d.ts +4 -4
- package/dist/alphalib/types/robots/_index.d.ts +3277 -932
- package/dist/alphalib/types/robots/_index.d.ts.map +1 -1
- package/dist/alphalib/types/robots/_index.js +4 -0
- package/dist/alphalib/types/robots/_index.js.map +1 -1
- package/dist/alphalib/types/robots/_instructions-primitives.d.ts +27 -16
- package/dist/alphalib/types/robots/_instructions-primitives.d.ts.map +1 -1
- package/dist/alphalib/types/robots/_instructions-primitives.js +1 -0
- package/dist/alphalib/types/robots/_instructions-primitives.js.map +1 -1
- package/dist/alphalib/types/robots/ai-chat.d.ts +2096 -0
- package/dist/alphalib/types/robots/ai-chat.d.ts.map +1 -0
- package/dist/alphalib/types/robots/ai-chat.js +223 -0
- package/dist/alphalib/types/robots/ai-chat.js.map +1 -0
- package/dist/alphalib/types/robots/assembly-savejson.d.ts +4 -4
- package/dist/alphalib/types/robots/audio-artwork.d.ts +16 -16
- package/dist/alphalib/types/robots/audio-concat.d.ts +16 -16
- package/dist/alphalib/types/robots/audio-encode.d.ts +16 -16
- package/dist/alphalib/types/robots/audio-loop.d.ts +16 -16
- package/dist/alphalib/types/robots/audio-merge.d.ts +16 -16
- package/dist/alphalib/types/robots/audio-waveform.d.ts +226 -21
- package/dist/alphalib/types/robots/audio-waveform.d.ts.map +1 -1
- package/dist/alphalib/types/robots/audio-waveform.js +134 -7
- package/dist/alphalib/types/robots/audio-waveform.js.map +1 -1
- package/dist/alphalib/types/robots/azure-import.d.ts +8 -8
- package/dist/alphalib/types/robots/azure-store.d.ts +8 -8
- package/dist/alphalib/types/robots/backblaze-import.d.ts +8 -8
- package/dist/alphalib/types/robots/backblaze-store.d.ts +8 -8
- package/dist/alphalib/types/robots/cloudfiles-import.d.ts +8 -8
- package/dist/alphalib/types/robots/cloudfiles-store.d.ts +8 -8
- package/dist/alphalib/types/robots/cloudflare-import.d.ts +8 -8
- package/dist/alphalib/types/robots/cloudflare-store.d.ts +8 -8
- package/dist/alphalib/types/robots/digitalocean-import.d.ts +8 -8
- package/dist/alphalib/types/robots/digitalocean-store.d.ts +8 -8
- package/dist/alphalib/types/robots/document-autorotate.d.ts +8 -8
- package/dist/alphalib/types/robots/document-convert.d.ts +8 -8
- package/dist/alphalib/types/robots/document-merge.d.ts +8 -8
- package/dist/alphalib/types/robots/document-ocr.d.ts +8 -8
- package/dist/alphalib/types/robots/document-split.d.ts +8 -8
- package/dist/alphalib/types/robots/document-thumbs.d.ts +8 -8
- package/dist/alphalib/types/robots/dropbox-import.d.ts +8 -8
- package/dist/alphalib/types/robots/dropbox-store.d.ts +8 -8
- package/dist/alphalib/types/robots/edgly-deliver.d.ts +8 -8
- package/dist/alphalib/types/robots/file-compress.d.ts +12 -12
- package/dist/alphalib/types/robots/file-decompress.d.ts +8 -8
- package/dist/alphalib/types/robots/file-filter.d.ts +12 -12
- package/dist/alphalib/types/robots/file-hash.d.ts +8 -8
- package/dist/alphalib/types/robots/file-preview.d.ts +8 -8
- package/dist/alphalib/types/robots/file-read.d.ts +8 -8
- package/dist/alphalib/types/robots/file-serve.d.ts +8 -8
- package/dist/alphalib/types/robots/file-verify.d.ts +8 -8
- package/dist/alphalib/types/robots/file-virusscan.d.ts +8 -8
- package/dist/alphalib/types/robots/file-watermark.d.ts +8 -8
- package/dist/alphalib/types/robots/ftp-import.d.ts +8 -8
- package/dist/alphalib/types/robots/ftp-store.d.ts +8 -8
- package/dist/alphalib/types/robots/google-import.d.ts +8 -8
- package/dist/alphalib/types/robots/google-store.d.ts +8 -8
- package/dist/alphalib/types/robots/html-convert.d.ts +8 -8
- package/dist/alphalib/types/robots/http-import.d.ts +8 -8
- package/dist/alphalib/types/robots/image-bgremove.d.ts +20 -8
- package/dist/alphalib/types/robots/image-bgremove.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-bgremove.js +4 -0
- package/dist/alphalib/types/robots/image-bgremove.js.map +1 -1
- package/dist/alphalib/types/robots/image-describe.d.ts +8 -8
- package/dist/alphalib/types/robots/image-facedetect.d.ts +8 -8
- package/dist/alphalib/types/robots/image-generate.d.ts +32 -29
- package/dist/alphalib/types/robots/image-generate.d.ts.map +1 -1
- package/dist/alphalib/types/robots/image-generate.js +6 -3
- package/dist/alphalib/types/robots/image-generate.js.map +1 -1
- package/dist/alphalib/types/robots/image-merge.d.ts +8 -8
- package/dist/alphalib/types/robots/image-ocr.d.ts +8 -8
- package/dist/alphalib/types/robots/image-optimize.d.ts +16 -16
- package/dist/alphalib/types/robots/image-resize.d.ts +16 -16
- package/dist/alphalib/types/robots/meta-read.d.ts +8 -8
- package/dist/alphalib/types/robots/meta-write.d.ts +20 -24
- package/dist/alphalib/types/robots/meta-write.d.ts.map +1 -1
- package/dist/alphalib/types/robots/meta-write.js +1 -2
- package/dist/alphalib/types/robots/meta-write.js.map +1 -1
- package/dist/alphalib/types/robots/minio-import.d.ts +8 -8
- package/dist/alphalib/types/robots/minio-store.d.ts +8 -8
- package/dist/alphalib/types/robots/progress-simulate.d.ts +4 -4
- package/dist/alphalib/types/robots/s3-import.d.ts +16 -16
- package/dist/alphalib/types/robots/s3-store.d.ts +12 -12
- package/dist/alphalib/types/robots/script-run.d.ts +8 -8
- package/dist/alphalib/types/robots/sftp-import.d.ts +8 -8
- package/dist/alphalib/types/robots/sftp-store.d.ts +8 -8
- package/dist/alphalib/types/robots/speech-transcribe.d.ts +8 -8
- package/dist/alphalib/types/robots/supabase-import.d.ts +8 -8
- package/dist/alphalib/types/robots/supabase-store.d.ts +8 -8
- package/dist/alphalib/types/robots/swift-import.d.ts +8 -8
- package/dist/alphalib/types/robots/swift-store.d.ts +8 -8
- package/dist/alphalib/types/robots/text-speak.d.ts +8 -8
- package/dist/alphalib/types/robots/text-translate.d.ts +16 -16
- package/dist/alphalib/types/robots/tigris-import.d.ts +8 -8
- package/dist/alphalib/types/robots/tigris-store.d.ts +8 -8
- package/dist/alphalib/types/robots/tlcdn-deliver.d.ts +8 -8
- package/dist/alphalib/types/robots/tus-store.d.ts +8 -8
- package/dist/alphalib/types/robots/upload-handle.d.ts +8 -8
- package/dist/alphalib/types/robots/video-adaptive.d.ts +16 -16
- package/dist/alphalib/types/robots/video-concat.d.ts +16 -16
- package/dist/alphalib/types/robots/video-encode.d.ts +16 -16
- package/dist/alphalib/types/robots/video-merge.d.ts +16 -16
- package/dist/alphalib/types/robots/video-ondemand.d.ts +20 -20
- package/dist/alphalib/types/robots/video-subtitle.d.ts +24 -24
- package/dist/alphalib/types/robots/video-thumbs.d.ts +8 -8
- package/dist/alphalib/types/robots/vimeo-import.d.ts +8 -8
- package/dist/alphalib/types/robots/vimeo-store.d.ts +8 -8
- package/dist/alphalib/types/robots/wasabi-import.d.ts +8 -8
- package/dist/alphalib/types/robots/wasabi-store.d.ts +8 -8
- package/dist/alphalib/types/robots/youtube-store.d.ts +12 -12
- package/dist/alphalib/types/template.d.ts +6183 -2096
- package/dist/alphalib/types/template.d.ts.map +1 -1
- package/dist/alphalib/types/templateCredential.d.ts +11 -11
- package/dist/alphalib/types/templateCredential.d.ts.map +1 -1
- package/dist/alphalib/types/templateCredential.js +1 -0
- package/dist/alphalib/types/templateCredential.js.map +1 -1
- package/dist/cli/OutputCtl.d.ts +2 -1
- package/dist/cli/OutputCtl.d.ts.map +1 -1
- package/dist/cli/OutputCtl.js +1 -1
- package/dist/cli/OutputCtl.js.map +1 -1
- package/dist/cli/commands/BaseCommand.d.ts +3 -2
- package/dist/cli/commands/BaseCommand.d.ts.map +1 -1
- package/dist/cli/commands/BaseCommand.js +6 -8
- package/dist/cli/commands/BaseCommand.js.map +1 -1
- package/dist/cli/commands/assemblies.d.ts +1 -1
- package/dist/cli/commands/assemblies.d.ts.map +1 -1
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.js +2 -8
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/notifications.d.ts +0 -7
- package/dist/cli/commands/notifications.d.ts.map +1 -1
- package/dist/cli/commands/notifications.js +1 -1
- package/dist/cli/commands/notifications.js.map +1 -1
- package/dist/cli/commands/templates.d.ts +1 -9
- package/dist/cli/commands/templates.d.ts.map +1 -1
- package/dist/cli/commands/templates.js +1 -1
- package/dist/cli/commands/templates.js.map +1 -1
- package/dist/cli/helpers.d.ts +6 -2
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/helpers.js +7 -0
- package/dist/cli/helpers.js.map +1 -1
- package/dist/cli/types.d.ts +3 -77
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js +2 -17
- package/dist/cli/types.js.map +1 -1
- package/package.json +16 -22
- package/src/alphalib/mcache.ts +4 -4
- package/src/alphalib/types/robots/_index.ts +14 -1
- package/src/alphalib/types/robots/_instructions-primitives.ts +21 -15
- package/src/alphalib/types/robots/ai-chat.ts +278 -0
- package/src/alphalib/types/robots/audio-waveform.ts +142 -9
- package/src/alphalib/types/robots/image-bgremove.ts +6 -0
- package/src/alphalib/types/robots/image-generate.ts +6 -3
- package/src/alphalib/types/robots/meta-write.ts +1 -2
- package/src/alphalib/types/templateCredential.ts +1 -0
- package/src/cli/OutputCtl.ts +1 -1
- package/src/cli/commands/BaseCommand.ts +6 -8
- package/src/cli/commands/assemblies.ts +1 -1
- package/src/cli/commands/auth.ts +2 -10
- package/src/cli/commands/notifications.ts +2 -2
- package/src/cli/commands/templates.ts +3 -3
- package/src/cli/helpers.ts +12 -3
- package/src/cli/types.ts +2 -115
- package/CHANGELOG.md +0 -240
package/dist/cli/types.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Steps } from '../alphalib/types/template.ts';
|
|
3
|
-
|
|
4
|
-
import type { AssemblyStatus, Transloadit } from '../Transloadit.ts';
|
|
5
|
-
import type { IOutputCtl } from './OutputCtl.ts';
|
|
6
|
-
export type { AssemblyStatus, BillResponse, ListedTemplate, TemplateResponse };
|
|
7
|
-
export type { Transloadit };
|
|
8
|
-
export type { CreateAssemblyOptions } from '../Transloadit.ts';
|
|
9
|
-
export declare const APIErrorSchema: z.ZodObject<{
|
|
3
|
+
declare const APIErrorSchema: z.ZodObject<{
|
|
10
4
|
error: z.ZodString;
|
|
11
5
|
message: z.ZodString;
|
|
12
6
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -17,7 +11,7 @@ export declare const APIErrorSchema: z.ZodObject<{
|
|
|
17
11
|
message: string;
|
|
18
12
|
}>;
|
|
19
13
|
export type APIError = z.infer<typeof APIErrorSchema>;
|
|
20
|
-
|
|
14
|
+
declare const TransloaditAPIErrorSchema: z.ZodObject<{
|
|
21
15
|
error: z.ZodOptional<z.ZodString>;
|
|
22
16
|
message: z.ZodString;
|
|
23
17
|
code: z.ZodOptional<z.ZodString>;
|
|
@@ -76,77 +70,9 @@ export interface TemplateFile {
|
|
|
76
70
|
file: string;
|
|
77
71
|
data: TemplateFileData;
|
|
78
72
|
}
|
|
79
|
-
export interface TemplateListItem {
|
|
80
|
-
id: string;
|
|
81
|
-
modified: string;
|
|
82
|
-
name?: string;
|
|
83
|
-
}
|
|
84
|
-
export interface BaseInvocation {
|
|
85
|
-
error?: boolean;
|
|
86
|
-
message?: string;
|
|
87
|
-
mode: string;
|
|
88
|
-
action?: string;
|
|
89
|
-
logLevel?: number;
|
|
90
|
-
jsonMode?: boolean;
|
|
91
|
-
}
|
|
92
|
-
export interface AssemblyInvocation extends BaseInvocation {
|
|
93
|
-
mode: 'assemblies';
|
|
94
|
-
action?: 'create' | 'get' | 'list' | 'delete' | 'replay';
|
|
95
|
-
inputs: string[];
|
|
96
|
-
output?: string;
|
|
97
|
-
recursive?: boolean;
|
|
98
|
-
watch?: boolean;
|
|
99
|
-
del?: boolean;
|
|
100
|
-
reprocessStale?: boolean;
|
|
101
|
-
steps?: string;
|
|
102
|
-
template?: string;
|
|
103
|
-
fields?: Record<string, string>;
|
|
104
|
-
assemblies?: string[];
|
|
105
|
-
before?: string;
|
|
106
|
-
after?: string;
|
|
107
|
-
keywords?: string[];
|
|
108
|
-
notify_url?: string;
|
|
109
|
-
reparse?: boolean;
|
|
110
|
-
}
|
|
111
|
-
export interface TemplateInvocation extends BaseInvocation {
|
|
112
|
-
mode: 'templates';
|
|
113
|
-
action?: 'create' | 'get' | 'list' | 'delete' | 'modify' | 'sync';
|
|
114
|
-
templates?: string[];
|
|
115
|
-
template?: string;
|
|
116
|
-
name?: string;
|
|
117
|
-
file?: string;
|
|
118
|
-
files?: string[];
|
|
119
|
-
before?: string;
|
|
120
|
-
after?: string;
|
|
121
|
-
order?: 'asc' | 'desc';
|
|
122
|
-
sort?: string;
|
|
123
|
-
fields?: string[];
|
|
124
|
-
recursive?: boolean;
|
|
125
|
-
}
|
|
126
|
-
export interface BillInvocation extends BaseInvocation {
|
|
127
|
-
mode: 'bills';
|
|
128
|
-
action?: 'get';
|
|
129
|
-
months: string[];
|
|
130
|
-
}
|
|
131
|
-
export interface NotificationInvocation extends BaseInvocation {
|
|
132
|
-
mode: 'assembly-notifications';
|
|
133
|
-
action?: 'list' | 'replay';
|
|
134
|
-
assemblies?: string[];
|
|
135
|
-
notify_url?: string;
|
|
136
|
-
type?: string;
|
|
137
|
-
assembly_id?: string;
|
|
138
|
-
pagesize?: number;
|
|
139
|
-
}
|
|
140
|
-
export interface HelpInvocation extends BaseInvocation {
|
|
141
|
-
mode: 'help' | 'version' | 'register';
|
|
142
|
-
}
|
|
143
|
-
export type Invocation = AssemblyInvocation | TemplateInvocation | BillInvocation | NotificationInvocation | HelpInvocation;
|
|
144
|
-
export type CommandHandler<T extends BaseInvocation = BaseInvocation> = (output: IOutputCtl, client: Transloadit | undefined, invocation: T) => void | Promise<void>;
|
|
145
|
-
export declare function isError(value: unknown): value is Error;
|
|
146
73
|
export declare function ensureError(value: unknown): Error;
|
|
147
74
|
export declare function isAPIError(value: unknown): value is APIError;
|
|
148
75
|
export declare function isTransloaditAPIError(value: unknown): value is TransloaditAPIError;
|
|
149
76
|
export declare function isErrnoException(value: unknown): value is NodeJS.ErrnoException;
|
|
150
|
-
export
|
|
151
|
-
export declare function assertDefined<T>(value: T | undefined | null, message: string): T;
|
|
77
|
+
export {};
|
|
152
78
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/cli/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AAI1D,QAAA,MAAM,cAAc;;;;;;;;;EAGlB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe7B,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAG3E,MAAM,WAAW,gBAAgB;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,eAAO,MAAM,sBAAsB,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAKhB,CAAA;AAE/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,gBAAgB,CAAA;CACvB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAKjD;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAGD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAElF;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,cAAc,CAE/E"}
|
package/dist/cli/types.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { optionalStepsSchema } from "../alphalib/types/template.js";
|
|
3
3
|
// Zod schemas for runtime validation
|
|
4
|
-
|
|
4
|
+
const APIErrorSchema = z.object({
|
|
5
5
|
error: z.string(),
|
|
6
6
|
message: z.string(),
|
|
7
7
|
});
|
|
8
|
-
|
|
8
|
+
const TransloaditAPIErrorSchema = z.object({
|
|
9
9
|
error: z.string().optional(),
|
|
10
10
|
message: z.string(),
|
|
11
11
|
code: z.string().optional(),
|
|
@@ -27,10 +27,6 @@ export const TemplateFileDataSchema = z
|
|
|
27
27
|
steps: optionalStepsSchema,
|
|
28
28
|
})
|
|
29
29
|
.passthrough();
|
|
30
|
-
// Type guard for Error
|
|
31
|
-
export function isError(value) {
|
|
32
|
-
return value instanceof Error;
|
|
33
|
-
}
|
|
34
30
|
// Helper to ensure error is Error type
|
|
35
31
|
export function ensureError(value) {
|
|
36
32
|
if (value instanceof Error) {
|
|
@@ -50,15 +46,4 @@ export function isTransloaditAPIError(value) {
|
|
|
50
46
|
export function isErrnoException(value) {
|
|
51
47
|
return value instanceof Error && 'code' in value;
|
|
52
48
|
}
|
|
53
|
-
// Safe array access helper
|
|
54
|
-
export function safeGet(arr, index) {
|
|
55
|
-
return arr[index];
|
|
56
|
-
}
|
|
57
|
-
// Assert defined helper
|
|
58
|
-
export function assertDefined(value, message) {
|
|
59
|
-
if (value === undefined || value === null) {
|
|
60
|
-
throw new Error(message);
|
|
61
|
-
}
|
|
62
|
-
return value;
|
|
63
|
-
}
|
|
64
49
|
//# sourceMappingURL=types.js.map
|
package/dist/cli/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAEnE,qCAAqC;AACrC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAA;AAGF,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3C,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,IAAI,EAAE,CAAC;aACJ,MAAM,CAAC;YACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC7B,CAAC;aACD,QAAQ,EAAE;QACb,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAClC,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAA;AAUF,MAAM,CAAC,MAAM,sBAAsB,GAAgC,CAAC;KACjE,MAAM,CAAC;IACN,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9C,KAAK,EAAE,mBAAmB;CAC3B,CAAC;KACD,WAAW,EAAiC,CAAA;AAO/C,uCAAuC;AACvC,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,yBAAyB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAC5D,CAAC;AAED,0BAA0B;AAC1B,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAA;AAChD,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,OAAO,yBAAyB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAA;AAC3D,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,CAAA;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "transloadit",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "Node.js SDK for Transloadit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -32,26 +32,16 @@
|
|
|
32
32
|
"p-queue": "^9.0.1",
|
|
33
33
|
"recursive-readdir": "^2.2.3",
|
|
34
34
|
"tus-js-client": "^4.3.1",
|
|
35
|
+
"typanion": "^3.14.0",
|
|
35
36
|
"type-fest": "^4.41.0",
|
|
36
37
|
"zod": "3.25.76"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@biomejs/biome": "^2.2.4",
|
|
40
40
|
"@types/debug": "^4.1.12",
|
|
41
|
+
"@types/minimist": "^1.2.5",
|
|
42
|
+
"@types/node": "^24.10.3",
|
|
41
43
|
"@types/recursive-readdir": "^2.2.4",
|
|
42
|
-
"
|
|
43
|
-
"@vitest/coverage-v8": "^3.2.4",
|
|
44
|
-
"badge-maker": "^5.0.2",
|
|
45
|
-
"execa": "9.6.0",
|
|
46
|
-
"image-size": "^2.0.2",
|
|
47
|
-
"nock": "^14.0.10",
|
|
48
|
-
"npm-run-all": "^4.1.5",
|
|
49
|
-
"p-retry": "^7.0.0",
|
|
50
|
-
"rimraf": "^6.1.2",
|
|
51
|
-
"temp": "^0.9.4",
|
|
52
|
-
"tsx": "4.20.5",
|
|
53
|
-
"typescript": "5.9.2",
|
|
54
|
-
"vitest": "^3.2.4"
|
|
44
|
+
"minimatch": "^10.1.1"
|
|
55
45
|
},
|
|
56
46
|
"repository": {
|
|
57
47
|
"type": "git",
|
|
@@ -63,15 +53,17 @@
|
|
|
63
53
|
"scripts": {
|
|
64
54
|
"check": "yarn lint:ts && yarn fix && yarn test:unit",
|
|
65
55
|
"fix:js": "biome check --write .",
|
|
66
|
-
"lint:ts": "
|
|
56
|
+
"lint:ts": "yarn --cwd ../.. tsc:node",
|
|
67
57
|
"fix:js:unsafe": "biome check --write . --unsafe",
|
|
68
58
|
"lint:js": "biome check .",
|
|
69
59
|
"lint": "npm-run-all --parallel 'lint:js'",
|
|
70
60
|
"fix": "npm-run-all --serial 'fix:js'",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"test": "vitest run --coverage"
|
|
61
|
+
"lint:deps": "knip --dependencies --no-progress",
|
|
62
|
+
"fix:deps": "knip --dependencies --no-progress --fix",
|
|
63
|
+
"prepack": "node ../../scripts/prepare-transloadit.ts",
|
|
64
|
+
"test:unit": "../../node_modules/.bin/vitest run --coverage ./test/unit",
|
|
65
|
+
"test:e2e": "../../node_modules/.bin/vitest run ./test/e2e",
|
|
66
|
+
"test": "../../node_modules/.bin/vitest run --coverage"
|
|
75
67
|
},
|
|
76
68
|
"license": "MIT",
|
|
77
69
|
"main": "./dist/Transloadit.js",
|
|
@@ -83,5 +75,7 @@
|
|
|
83
75
|
"dist",
|
|
84
76
|
"src"
|
|
85
77
|
],
|
|
86
|
-
"bin":
|
|
87
|
-
|
|
78
|
+
"bin": {
|
|
79
|
+
"transloadit": "./dist/cli.js"
|
|
80
|
+
}
|
|
81
|
+
}
|
package/src/alphalib/mcache.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SevLogger } from '@transloadit/sev-logger'
|
|
2
2
|
import type { Schema } from 'zod'
|
|
3
3
|
|
|
4
|
-
export interface McacheOpts
|
|
4
|
+
export interface McacheOpts {
|
|
5
5
|
ttlMs?: number
|
|
6
6
|
zodSchema?: Schema
|
|
7
7
|
logger?: SevLogger
|
|
@@ -37,10 +37,10 @@ interface CacheEntry<T> {
|
|
|
37
37
|
*/
|
|
38
38
|
export class Mcache<T> {
|
|
39
39
|
#cache: Map<string, CacheEntry<T>>
|
|
40
|
-
#opts: Required<Omit<McacheOpts
|
|
41
|
-
Pick<McacheOpts
|
|
40
|
+
#opts: Required<Omit<McacheOpts, 'logger' | 'zodSchema' | 'keyFn'>> &
|
|
41
|
+
Pick<McacheOpts, 'logger' | 'zodSchema' | 'keyFn'>
|
|
42
42
|
|
|
43
|
-
constructor(opts: McacheOpts
|
|
43
|
+
constructor(opts: McacheOpts = {}) {
|
|
44
44
|
this.#cache = new Map()
|
|
45
45
|
this.#opts = {
|
|
46
46
|
ttlMs: opts.ttlMs ?? Number.POSITIVE_INFINITY,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
|
-
|
|
2
|
+
import {
|
|
3
|
+
meta as aiChatMeta,
|
|
4
|
+
interpolatableRobotAiChatInstructionsSchema,
|
|
5
|
+
interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema,
|
|
6
|
+
} from './ai-chat.ts'
|
|
3
7
|
import {
|
|
4
8
|
meta as audioArtworkMeta,
|
|
5
9
|
interpolatableRobotAudioArtworkInstructionsSchema,
|
|
@@ -474,6 +478,7 @@ const robotStepsInstructions = [
|
|
|
474
478
|
interpolatableRobotSwiftStoreInstructionsSchema,
|
|
475
479
|
interpolatableRobotTextSpeakInstructionsSchema,
|
|
476
480
|
interpolatableRobotTextTranslateInstructionsSchema,
|
|
481
|
+
interpolatableRobotAiChatInstructionsSchema,
|
|
477
482
|
interpolatableRobotTigrisImportInstructionsSchema,
|
|
478
483
|
interpolatableRobotTigrisStoreInstructionsSchema,
|
|
479
484
|
interpolatableRobotTlcdnDeliverInstructionsSchema,
|
|
@@ -558,6 +563,7 @@ const robotStepsInstructionsWithHiddenFields = [
|
|
|
558
563
|
interpolatableRobotSwiftStoreInstructionsWithHiddenFieldsSchema,
|
|
559
564
|
interpolatableRobotTextSpeakInstructionsWithHiddenFieldsSchema,
|
|
560
565
|
interpolatableRobotTextTranslateInstructionsWithHiddenFieldsSchema,
|
|
566
|
+
interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema,
|
|
561
567
|
interpolatableRobotTigrisImportInstructionsWithHiddenFieldsSchema,
|
|
562
568
|
interpolatableRobotTigrisStoreInstructionsWithHiddenFieldsSchema,
|
|
563
569
|
interpolatableRobotTlcdnDeliverInstructionsWithHiddenFieldsSchema,
|
|
@@ -605,6 +611,7 @@ export type RobotsWithHiddenBots = z.infer<typeof robotsWithHiddenBotsSchema>
|
|
|
605
611
|
export type RobotsWithHiddenBotsAndFields = z.infer<typeof robotsWithHiddenBotsAndFieldsSchema>
|
|
606
612
|
|
|
607
613
|
export const robotsMeta = {
|
|
614
|
+
aiChatMeta,
|
|
608
615
|
audioArtworkMeta,
|
|
609
616
|
audioConcatMeta,
|
|
610
617
|
audioEncodeMeta,
|
|
@@ -687,6 +694,12 @@ export const robotsMeta = {
|
|
|
687
694
|
youtubeStoreMeta,
|
|
688
695
|
}
|
|
689
696
|
|
|
697
|
+
export type {
|
|
698
|
+
InterpolatableRobotAiChatInstructions,
|
|
699
|
+
InterpolatableRobotAiChatInstructionsInput,
|
|
700
|
+
InterpolatableRobotAiChatInstructionsWithHiddenFields,
|
|
701
|
+
InterpolatableRobotAiChatInstructionsWithHiddenFieldsInput,
|
|
702
|
+
} from './ai-chat.ts'
|
|
690
703
|
export type {
|
|
691
704
|
InterpolatableRobotAssemblySavejsonInstructions,
|
|
692
705
|
InterpolatableRobotAssemblySavejsonInstructionsInput,
|
|
@@ -4,6 +4,7 @@ import { z } from 'zod'
|
|
|
4
4
|
import { stackVersions } from '../stackVersions.ts'
|
|
5
5
|
|
|
6
6
|
export const robotNames = z.enum([
|
|
7
|
+
'AiChatRobot',
|
|
7
8
|
'UploadHandleRobot',
|
|
8
9
|
'FileServeRobot',
|
|
9
10
|
'FileWatermarkRobot',
|
|
@@ -395,21 +396,18 @@ export function interpolateRecursive<Schema extends z.ZodFirstPartySchemaTypes>(
|
|
|
395
396
|
*/
|
|
396
397
|
const uninterpolatableKeys = ['robot', 'use'] as const
|
|
397
398
|
|
|
398
|
-
type InterpolatableRobot<Schema extends z.ZodObject<z.ZodRawShape>> =
|
|
399
|
-
infer T,
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
Catchall
|
|
411
|
-
>
|
|
412
|
-
: never
|
|
399
|
+
type InterpolatableRobot<Schema extends z.ZodObject<z.ZodRawShape>> =
|
|
400
|
+
Schema extends z.ZodObject<infer T, infer UnknownKeys, infer Catchall>
|
|
401
|
+
? z.ZodObject<
|
|
402
|
+
{
|
|
403
|
+
[Key in keyof T]: Key extends (typeof uninterpolatableKeys)[number]
|
|
404
|
+
? T[Key]
|
|
405
|
+
: InterpolatableSchema<T[Key]>
|
|
406
|
+
},
|
|
407
|
+
UnknownKeys,
|
|
408
|
+
Catchall
|
|
409
|
+
>
|
|
410
|
+
: never
|
|
413
411
|
|
|
414
412
|
export function interpolateRobot<Schema extends z.ZodObject<z.ZodRawShape>>(
|
|
415
413
|
schema: Schema,
|
|
@@ -1762,3 +1760,11 @@ Delta to apply to segment duration. This is optional and allows fine-tuning of s
|
|
|
1762
1760
|
`),
|
|
1763
1761
|
})
|
|
1764
1762
|
.strict()
|
|
1763
|
+
|
|
1764
|
+
/**
|
|
1765
|
+
* Type for the normalized use parameter from AssemblyNormalizer
|
|
1766
|
+
* The steps array can contain either strings or objects with name property
|
|
1767
|
+
*/
|
|
1768
|
+
export interface NormalizedUse {
|
|
1769
|
+
steps: Array<{ name: string; as?: string; fields?: string }>
|
|
1770
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { RobotMetaInput } from './_instructions-primitives.ts'
|
|
3
|
+
import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts'
|
|
4
|
+
|
|
5
|
+
// We duplicate coreMessageSchema (and its related types) from structuredAiVercel.ts here
|
|
6
|
+
// so that we do not need to distribute structuredAiVercel.ts to for instance
|
|
7
|
+
// the node-sdk, which does rely on this ai-chat file to determine
|
|
8
|
+
// support Robot parameters.
|
|
9
|
+
|
|
10
|
+
// Define JSONValue schema for proper type matching with AI SDK
|
|
11
|
+
const jsonValueSchema: z.ZodType = z.lazy(() =>
|
|
12
|
+
z.union([
|
|
13
|
+
z.string(),
|
|
14
|
+
z.number(),
|
|
15
|
+
z.boolean(),
|
|
16
|
+
z.null(),
|
|
17
|
+
z.array(jsonValueSchema),
|
|
18
|
+
z.record(jsonValueSchema),
|
|
19
|
+
]),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
// Define provider metadata schema to match the AI SDK v5
|
|
23
|
+
const providerMetadataSchema = z.record(z.record(jsonValueSchema)).optional()
|
|
24
|
+
|
|
25
|
+
const textPartSchema = z.object({
|
|
26
|
+
type: z.literal('text'),
|
|
27
|
+
text: z.string(),
|
|
28
|
+
experimental_providerMetadata: providerMetadataSchema,
|
|
29
|
+
})
|
|
30
|
+
const imagePartSchema = z.object({
|
|
31
|
+
type: z.literal('image'),
|
|
32
|
+
image: z.union([
|
|
33
|
+
z.string(),
|
|
34
|
+
z.instanceof(Uint8Array),
|
|
35
|
+
z.instanceof(ArrayBuffer),
|
|
36
|
+
// Note: Buffer is not included here since it's Node.js-only and this code runs in browsers.
|
|
37
|
+
// Node.js Buffer extends Uint8Array, so Uint8Array validation handles Buffer values too.
|
|
38
|
+
z.instanceof(URL),
|
|
39
|
+
]),
|
|
40
|
+
mimeType: z.string().optional(),
|
|
41
|
+
experimental_providerMetadata: providerMetadataSchema,
|
|
42
|
+
})
|
|
43
|
+
const filePartSchema = z.object({
|
|
44
|
+
type: z.literal('file'),
|
|
45
|
+
data: z.union([
|
|
46
|
+
z.string(),
|
|
47
|
+
z.instanceof(Uint8Array),
|
|
48
|
+
z.instanceof(ArrayBuffer),
|
|
49
|
+
// Note: Buffer is not included here since it's Node.js-only and this code runs in browsers.
|
|
50
|
+
// Node.js Buffer extends Uint8Array, so Uint8Array validation handles Buffer values too.
|
|
51
|
+
z.instanceof(URL),
|
|
52
|
+
]),
|
|
53
|
+
mediaType: z.string(),
|
|
54
|
+
experimental_providerMetadata: providerMetadataSchema,
|
|
55
|
+
})
|
|
56
|
+
const toolCallPartSchema = z.object({
|
|
57
|
+
type: z.literal('tool-call'),
|
|
58
|
+
toolCallId: z.string(),
|
|
59
|
+
toolName: z.string(),
|
|
60
|
+
args: z.record(jsonValueSchema),
|
|
61
|
+
experimental_providerMetadata: providerMetadataSchema,
|
|
62
|
+
})
|
|
63
|
+
const toolResultPartSchema = z.object({
|
|
64
|
+
type: z.literal('tool-result'),
|
|
65
|
+
toolCallId: z.string(),
|
|
66
|
+
toolName: z.string(),
|
|
67
|
+
result: z.unknown(),
|
|
68
|
+
experimental_content: z
|
|
69
|
+
.array(
|
|
70
|
+
z.union([
|
|
71
|
+
z.object({
|
|
72
|
+
type: z.literal('text'),
|
|
73
|
+
text: z.string(),
|
|
74
|
+
}),
|
|
75
|
+
z.object({
|
|
76
|
+
type: z.literal('image'),
|
|
77
|
+
data: z.string(),
|
|
78
|
+
mimeType: z.string().optional(),
|
|
79
|
+
}),
|
|
80
|
+
]),
|
|
81
|
+
)
|
|
82
|
+
.optional(),
|
|
83
|
+
isError: z.boolean().optional(),
|
|
84
|
+
experimental_providerMetadata: providerMetadataSchema,
|
|
85
|
+
})
|
|
86
|
+
const coreSystemMessageSchema = z.object({
|
|
87
|
+
role: z.literal('system'),
|
|
88
|
+
content: z.string(),
|
|
89
|
+
experimental_providerMetadata: providerMetadataSchema,
|
|
90
|
+
})
|
|
91
|
+
const coreUserMessageSchema = z.object({
|
|
92
|
+
role: z.literal('user'),
|
|
93
|
+
content: z.union([
|
|
94
|
+
z.string(),
|
|
95
|
+
z.array(z.union([textPartSchema, imagePartSchema, filePartSchema])),
|
|
96
|
+
]),
|
|
97
|
+
experimental_providerMetadata: providerMetadataSchema,
|
|
98
|
+
})
|
|
99
|
+
const coreAssistantMessageSchema = z.object({
|
|
100
|
+
role: z.literal('assistant'),
|
|
101
|
+
content: z.union([z.string(), z.array(z.union([textPartSchema, toolCallPartSchema]))]),
|
|
102
|
+
experimental_providerMetadata: providerMetadataSchema,
|
|
103
|
+
})
|
|
104
|
+
const coreToolMessageSchema = z.object({
|
|
105
|
+
role: z.literal('tool'),
|
|
106
|
+
content: z.array(toolResultPartSchema),
|
|
107
|
+
experimental_providerMetadata: providerMetadataSchema,
|
|
108
|
+
})
|
|
109
|
+
const coreMessageSchema = z.discriminatedUnion('role', [
|
|
110
|
+
coreSystemMessageSchema,
|
|
111
|
+
coreUserMessageSchema,
|
|
112
|
+
coreAssistantMessageSchema,
|
|
113
|
+
coreToolMessageSchema,
|
|
114
|
+
])
|
|
115
|
+
|
|
116
|
+
export const meta: RobotMetaInput = {
|
|
117
|
+
name: 'AiChatRobot',
|
|
118
|
+
allowed_for_url_transform: true,
|
|
119
|
+
bytescount: 1,
|
|
120
|
+
discount_factor: 1,
|
|
121
|
+
discount_pct: 0,
|
|
122
|
+
minimum_charge: 0,
|
|
123
|
+
output_factor: 0.6,
|
|
124
|
+
purpose_sentence: 'generates AI chat responses from prompts',
|
|
125
|
+
purpose_verb: 'generate',
|
|
126
|
+
purpose_word: 'generate',
|
|
127
|
+
purpose_words: 'Generate AI chat responses',
|
|
128
|
+
service_slug: 'artificial-intelligence',
|
|
129
|
+
slot_count: 10,
|
|
130
|
+
title: 'Generate AI chat responses',
|
|
131
|
+
typical_file_size_mb: 0.01,
|
|
132
|
+
typical_file_type: 'document',
|
|
133
|
+
priceFactor: 1,
|
|
134
|
+
queueSlotCount: 10,
|
|
135
|
+
// Is this a sensbile minimum charge? What if the customer supplies their own keys? Is it low enough for these cases?
|
|
136
|
+
minimumChargeUsd: 0.06,
|
|
137
|
+
isAllowedForUrlTransform: true,
|
|
138
|
+
trackOutputFileSize: true,
|
|
139
|
+
isInternal: false,
|
|
140
|
+
removeJobResultFilesFromDiskRightAfterStoringOnS3: false,
|
|
141
|
+
stage: 'alpha',
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export const vendorModelSchema = z
|
|
145
|
+
.string()
|
|
146
|
+
.regex(/^[a-z]+\/[a-z0-9.-]+$/, 'Must be in format "vendor/model"')
|
|
147
|
+
.refine(
|
|
148
|
+
(val) => {
|
|
149
|
+
const [vendor, model] = val.split('/')
|
|
150
|
+
if (vendor === 'anthropic') {
|
|
151
|
+
return model === 'claude-4-sonnet-20250514' || model === 'claude-4-opus-20250514'
|
|
152
|
+
}
|
|
153
|
+
if (vendor === 'openai') {
|
|
154
|
+
return (
|
|
155
|
+
model === 'gpt-4.1-2025-04-14' ||
|
|
156
|
+
model === 'chatgpt-4o-latest' ||
|
|
157
|
+
model === 'o3-2025-04-16' ||
|
|
158
|
+
model === 'gpt-4o-audio-preview'
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
if (vendor === 'google') {
|
|
162
|
+
return model === 'gemini-2.5-pro'
|
|
163
|
+
}
|
|
164
|
+
if (vendor === 'moonshot') {
|
|
165
|
+
return model === 'kimi-k2'
|
|
166
|
+
}
|
|
167
|
+
return false
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
message:
|
|
171
|
+
'Invalid vendor/model combination. Supported: anthropic/claude-4-sonnet-20250514, anthropic/claude-4-opus-20250514, openai/gpt-4.1-2025-04-14, openai/chatgpt-4o-latest, openai/o3-2025-04-16, openai/gpt-4o-audio-preview, google/gemini-2.5-pro, moonshot/kimi-k2',
|
|
172
|
+
},
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
export type VendorModel = z.infer<typeof vendorModelSchema>
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Model capabilities for /ai/chat. This centralizes which models support which input types.
|
|
179
|
+
* Key format: 'vendor/model'
|
|
180
|
+
*/
|
|
181
|
+
export const MODEL_CAPABILITIES: Record<string, { pdf: boolean; image: boolean }> = {
|
|
182
|
+
'anthropic/claude-4-sonnet-20250514': { pdf: true, image: true },
|
|
183
|
+
'anthropic/claude-4-opus-20250514': { pdf: true, image: true },
|
|
184
|
+
'google/gemini-2.5-pro': { pdf: true, image: true },
|
|
185
|
+
'openai/gpt-4.1-2025-04-14': { pdf: false, image: true },
|
|
186
|
+
'openai/chatgpt-4o-latest': { pdf: false, image: true },
|
|
187
|
+
'openai/o3-2025-04-16': { pdf: false, image: true },
|
|
188
|
+
'openai/gpt-4o-audio-preview': { pdf: false, image: false },
|
|
189
|
+
'moonshot/kimi-k2': { pdf: false, image: false },
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export const robotAiChatInstructionsSchema = robotBase
|
|
193
|
+
.merge(robotUse)
|
|
194
|
+
.extend({
|
|
195
|
+
robot: z.literal('/ai/chat'),
|
|
196
|
+
// TODO: Is the auto mode yet implemented?
|
|
197
|
+
model: z
|
|
198
|
+
.union([vendorModelSchema, z.literal('auto')])
|
|
199
|
+
.default('auto')
|
|
200
|
+
.describe(
|
|
201
|
+
'The model to use. Transloadit can pick the best model for the job if you set this to "auto".',
|
|
202
|
+
),
|
|
203
|
+
format: z.enum(['json', 'text', 'meta']).default('json'),
|
|
204
|
+
return_messages: z.enum(['all', 'last']).default('last'),
|
|
205
|
+
schema: z.string().optional().describe('The JSON Schema that the LLM should output'),
|
|
206
|
+
messages: z
|
|
207
|
+
.union([z.string(), z.array(coreMessageSchema)])
|
|
208
|
+
.describe('The prompt, or message history to send to the LLM.'),
|
|
209
|
+
system_message: z
|
|
210
|
+
.string()
|
|
211
|
+
.optional()
|
|
212
|
+
.describe('Set the system/developer prompt, if the model allows it'),
|
|
213
|
+
credentials: z
|
|
214
|
+
.union([z.string(), z.array(z.string())])
|
|
215
|
+
.optional()
|
|
216
|
+
.describe('Names of template credentials to make available to the robot.'),
|
|
217
|
+
mcp_servers: z
|
|
218
|
+
.array(
|
|
219
|
+
z.object({
|
|
220
|
+
type: z.enum(['sse', 'http']),
|
|
221
|
+
url: z.string(),
|
|
222
|
+
headers: z.record(z.string()).optional(),
|
|
223
|
+
}),
|
|
224
|
+
)
|
|
225
|
+
.optional()
|
|
226
|
+
.describe('The MCP servers to use. This is used to call tools from the LLM.'),
|
|
227
|
+
})
|
|
228
|
+
.strict()
|
|
229
|
+
|
|
230
|
+
export const robotAiChatInstructionsWithHiddenFieldsSchema = robotAiChatInstructionsSchema.extend({
|
|
231
|
+
result: z.union([z.literal('debug'), robotAiChatInstructionsSchema.shape.result]),
|
|
232
|
+
provider: z
|
|
233
|
+
.string()
|
|
234
|
+
.optional()
|
|
235
|
+
.describe(
|
|
236
|
+
'Where to run the model. By the default, it is the vendor. For instance, anthropic:claude* runs on the Anthropic API. But, Claude could also be run on AWS Bedrock. This is a hidden placeholder for now, but will be used in the future to allow for more flexibility in where to run models. ',
|
|
237
|
+
),
|
|
238
|
+
// These are listed here because we don't have these properties in the public documentation.
|
|
239
|
+
// They should set these keys using template credentials.
|
|
240
|
+
openai_api_key: z.string().optional().describe('The API key to use for the OpenAI API.'),
|
|
241
|
+
anthropic_api_key: z.string().optional().describe('The API key to use for the Anthropic API.'),
|
|
242
|
+
deepseek_api_key: z.string().optional().describe('The API key to use for the DeepSeek API.'),
|
|
243
|
+
google_generative_ai_api_key: z
|
|
244
|
+
.string()
|
|
245
|
+
.optional()
|
|
246
|
+
.describe('The API key to use for the Google Generative AI API.'),
|
|
247
|
+
xai_api_key: z.string().optional().describe('The API key to use for the xAI API.'),
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
export type RobotAiChatInstructions = z.infer<typeof robotAiChatInstructionsSchema>
|
|
251
|
+
|
|
252
|
+
export type RobotAiChatInstructionsWithHiddenFields = z.infer<
|
|
253
|
+
typeof robotAiChatInstructionsWithHiddenFieldsSchema
|
|
254
|
+
>
|
|
255
|
+
|
|
256
|
+
export type RobotAiChatInstructionsWithHiddenFieldsInput = z.input<
|
|
257
|
+
typeof robotAiChatInstructionsWithHiddenFieldsSchema
|
|
258
|
+
>
|
|
259
|
+
|
|
260
|
+
export const interpolatableRobotAiChatInstructionsSchema = interpolateRobot(
|
|
261
|
+
robotAiChatInstructionsSchema,
|
|
262
|
+
)
|
|
263
|
+
export type InterpolatableRobotAiChatInstructions = z.infer<
|
|
264
|
+
typeof interpolatableRobotAiChatInstructionsSchema
|
|
265
|
+
>
|
|
266
|
+
export type InterpolatableRobotAiChatInstructionsInput = z.input<
|
|
267
|
+
typeof interpolatableRobotAiChatInstructionsSchema
|
|
268
|
+
>
|
|
269
|
+
|
|
270
|
+
export const interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema = interpolateRobot(
|
|
271
|
+
robotAiChatInstructionsWithHiddenFieldsSchema,
|
|
272
|
+
)
|
|
273
|
+
export type InterpolatableRobotAiChatInstructionsWithHiddenFields = z.infer<
|
|
274
|
+
typeof interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema
|
|
275
|
+
>
|
|
276
|
+
export type InterpolatableRobotAiChatInstructionsWithHiddenFieldsInput = z.input<
|
|
277
|
+
typeof interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema
|
|
278
|
+
>
|