@omnichar/contracts 0.9.1 → 0.10.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/v1/charInspection.d.ts +50 -0
- package/dist/v1/charInspection.d.ts.map +1 -0
- package/dist/v1/charInspection.js +35 -0
- package/dist/v1/charInspection.js.map +1 -0
- package/dist/v1/characterListings.d.ts +73 -0
- package/dist/v1/characterListings.d.ts.map +1 -0
- package/dist/v1/characterListings.js +61 -0
- package/dist/v1/characterListings.js.map +1 -0
- package/dist/v1/characters.d.ts +1 -0
- package/dist/v1/characters.d.ts.map +1 -1
- package/dist/v1/characters.js +2 -0
- package/dist/v1/characters.js.map +1 -1
- package/dist/v1/index.d.ts +4 -0
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +4 -0
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/me.d.ts +1 -0
- package/dist/v1/me.d.ts.map +1 -1
- package/dist/v1/me.js +3 -0
- package/dist/v1/me.js.map +1 -1
- package/dist/v1/runs.d.ts +126 -0
- package/dist/v1/runs.d.ts.map +1 -1
- package/dist/v1/runs.js +20 -0
- package/dist/v1/runs.js.map +1 -1
- package/dist/v1/sessions.d.ts +349 -0
- package/dist/v1/sessions.d.ts.map +1 -0
- package/dist/v1/sessions.js +73 -0
- package/dist/v1/sessions.js.map +1 -0
- package/dist/v1/studio.d.ts +119 -0
- package/dist/v1/studio.d.ts.map +1 -0
- package/dist/v1/studio.js +98 -0
- package/dist/v1/studio.js.map +1 -0
- package/dist/v1/usernames.d.ts +35 -0
- package/dist/v1/usernames.d.ts.map +1 -0
- package/dist/v1/usernames.js +67 -0
- package/dist/v1/usernames.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const MAX_SESSION_TEXT = 4000;
|
|
3
|
+
export declare const MAX_SESSION_UPLOADS = 8;
|
|
4
|
+
export declare const BUILD_STEPS: readonly ["name", "faces", "extras", "desc"];
|
|
5
|
+
export type BuildStep = (typeof BUILD_STEPS)[number];
|
|
6
|
+
export declare const appendItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7
|
+
kind: z.ZodLiteral<"bot">;
|
|
8
|
+
text: z.ZodString;
|
|
9
|
+
step: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
10
|
+
name: "name";
|
|
11
|
+
faces: "faces";
|
|
12
|
+
extras: "extras";
|
|
13
|
+
desc: "desc";
|
|
14
|
+
review: "review";
|
|
15
|
+
}>>>;
|
|
16
|
+
summary: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
description: z.ZodString;
|
|
19
|
+
faces: z.ZodNumber;
|
|
20
|
+
extras: z.ZodNumber;
|
|
21
|
+
coverKey: z.ZodNullable<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>>>;
|
|
23
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
24
|
+
kind: z.ZodLiteral<"user">;
|
|
25
|
+
text: z.ZodString;
|
|
26
|
+
answers: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
27
|
+
name: "name";
|
|
28
|
+
faces: "faces";
|
|
29
|
+
extras: "extras";
|
|
30
|
+
desc: "desc";
|
|
31
|
+
}>>>;
|
|
32
|
+
skipped: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
uploadKeys: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
34
|
+
}, z.core.$strip>], "kind">;
|
|
35
|
+
export declare const sessionItemPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
36
|
+
kind: z.ZodLiteral<"bot">;
|
|
37
|
+
text: z.ZodString;
|
|
38
|
+
step: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
39
|
+
name: "name";
|
|
40
|
+
faces: "faces";
|
|
41
|
+
extras: "extras";
|
|
42
|
+
desc: "desc";
|
|
43
|
+
review: "review";
|
|
44
|
+
}>>>;
|
|
45
|
+
summary: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
description: z.ZodString;
|
|
48
|
+
faces: z.ZodNumber;
|
|
49
|
+
extras: z.ZodNumber;
|
|
50
|
+
coverKey: z.ZodNullable<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>>>;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
kind: z.ZodLiteral<"user">;
|
|
54
|
+
text: z.ZodString;
|
|
55
|
+
answers: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
56
|
+
name: "name";
|
|
57
|
+
faces: "faces";
|
|
58
|
+
extras: "extras";
|
|
59
|
+
desc: "desc";
|
|
60
|
+
}>>>;
|
|
61
|
+
skipped: z.ZodDefault<z.ZodBoolean>;
|
|
62
|
+
uploadKeys: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
kind: z.ZodLiteral<"gen">;
|
|
65
|
+
runId: z.ZodUUID;
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
kind: z.ZodLiteral<"build">;
|
|
68
|
+
runId: z.ZodUUID;
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
}, z.core.$strip>], "kind">;
|
|
71
|
+
export declare const sessionItemSchema: z.ZodObject<{
|
|
72
|
+
id: z.ZodUUID;
|
|
73
|
+
seq: z.ZodNumber;
|
|
74
|
+
createdAt: z.ZodISODateTime;
|
|
75
|
+
item: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
76
|
+
kind: z.ZodLiteral<"bot">;
|
|
77
|
+
text: z.ZodString;
|
|
78
|
+
step: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
79
|
+
name: "name";
|
|
80
|
+
faces: "faces";
|
|
81
|
+
extras: "extras";
|
|
82
|
+
desc: "desc";
|
|
83
|
+
review: "review";
|
|
84
|
+
}>>>;
|
|
85
|
+
summary: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
86
|
+
name: z.ZodString;
|
|
87
|
+
description: z.ZodString;
|
|
88
|
+
faces: z.ZodNumber;
|
|
89
|
+
extras: z.ZodNumber;
|
|
90
|
+
coverKey: z.ZodNullable<z.ZodString>;
|
|
91
|
+
}, z.core.$strip>>>;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
kind: z.ZodLiteral<"user">;
|
|
94
|
+
text: z.ZodString;
|
|
95
|
+
answers: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
96
|
+
name: "name";
|
|
97
|
+
faces: "faces";
|
|
98
|
+
extras: "extras";
|
|
99
|
+
desc: "desc";
|
|
100
|
+
}>>>;
|
|
101
|
+
skipped: z.ZodDefault<z.ZodBoolean>;
|
|
102
|
+
uploadKeys: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
kind: z.ZodLiteral<"gen">;
|
|
105
|
+
runId: z.ZodUUID;
|
|
106
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
107
|
+
kind: z.ZodLiteral<"build">;
|
|
108
|
+
runId: z.ZodUUID;
|
|
109
|
+
name: z.ZodString;
|
|
110
|
+
}, z.core.$strip>], "kind">;
|
|
111
|
+
thumbUrls: z.ZodDefault<z.ZodArray<z.ZodURL>>;
|
|
112
|
+
run: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
113
|
+
id: z.ZodUUID;
|
|
114
|
+
workflowSlug: z.ZodString;
|
|
115
|
+
workflowTitle: z.ZodString;
|
|
116
|
+
runtime: z.ZodEnum<{
|
|
117
|
+
serverless: "serverless";
|
|
118
|
+
pod: "pod";
|
|
119
|
+
}>;
|
|
120
|
+
status: z.ZodEnum<{
|
|
121
|
+
queued: "queued";
|
|
122
|
+
dispatching: "dispatching";
|
|
123
|
+
running: "running";
|
|
124
|
+
succeeded: "succeeded";
|
|
125
|
+
failed: "failed";
|
|
126
|
+
canceled: "canceled";
|
|
127
|
+
}>;
|
|
128
|
+
createdAt: z.ZodISODateTime;
|
|
129
|
+
startedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
130
|
+
finishedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
131
|
+
preview: z.ZodNullable<z.ZodObject<{
|
|
132
|
+
url: z.ZodURL;
|
|
133
|
+
thumbUrl: z.ZodNullable<z.ZodURL>;
|
|
134
|
+
mediaKind: z.ZodString;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
credits: z.ZodNullable<z.ZodNumber>;
|
|
137
|
+
estimateCredits: z.ZodNullable<z.ZodNumber>;
|
|
138
|
+
kind: z.ZodDefault<z.ZodEnum<{
|
|
139
|
+
image: "image";
|
|
140
|
+
video: "video";
|
|
141
|
+
build: "build";
|
|
142
|
+
other: "other";
|
|
143
|
+
}>>;
|
|
144
|
+
sessionId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
|
|
145
|
+
studio: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
146
|
+
mode: z.ZodEnum<{
|
|
147
|
+
image: "image";
|
|
148
|
+
video: "video";
|
|
149
|
+
}>;
|
|
150
|
+
prompt: z.ZodString;
|
|
151
|
+
ratio: z.ZodEnum<{
|
|
152
|
+
"16:9": "16:9";
|
|
153
|
+
"1:1": "1:1";
|
|
154
|
+
"3:4": "3:4";
|
|
155
|
+
"9:16": "9:16";
|
|
156
|
+
"4:5": "4:5";
|
|
157
|
+
}>;
|
|
158
|
+
resolution: z.ZodEnum<{
|
|
159
|
+
"0.5k": "0.5k";
|
|
160
|
+
"1k": "1k";
|
|
161
|
+
"2k": "2k";
|
|
162
|
+
"4k": "4k";
|
|
163
|
+
}>;
|
|
164
|
+
seconds: z.ZodNullable<z.ZodNumber>;
|
|
165
|
+
characterName: z.ZodNullable<z.ZodString>;
|
|
166
|
+
cast: z.ZodDefault<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
167
|
+
kind: z.ZodLiteral<"own">;
|
|
168
|
+
characterId: z.ZodUUID;
|
|
169
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
170
|
+
kind: z.ZodLiteral<"community">;
|
|
171
|
+
slug: z.ZodString;
|
|
172
|
+
}, z.core.$strip>], "kind">>>;
|
|
173
|
+
}, z.core.$strip>>>;
|
|
174
|
+
outputCount: z.ZodDefault<z.ZodNumber>;
|
|
175
|
+
billableMs: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
176
|
+
}, z.core.$strip>>>;
|
|
177
|
+
outputs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodUUID;
|
|
179
|
+
mediaKind: z.ZodString;
|
|
180
|
+
bytes: z.ZodNumber;
|
|
181
|
+
url: z.ZodURL;
|
|
182
|
+
thumbUrl: z.ZodNullable<z.ZodURL>;
|
|
183
|
+
expiresAt: z.ZodISODateTime;
|
|
184
|
+
label: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
185
|
+
checkpoint: z.ZodDefault<z.ZodBoolean>;
|
|
186
|
+
}, z.core.$strip>>>;
|
|
187
|
+
characterId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
export declare const sessionSummarySchema: z.ZodObject<{
|
|
190
|
+
id: z.ZodUUID;
|
|
191
|
+
title: z.ZodNullable<z.ZodString>;
|
|
192
|
+
createdAt: z.ZodISODateTime;
|
|
193
|
+
updatedAt: z.ZodISODateTime;
|
|
194
|
+
resultCount: z.ZodNumber;
|
|
195
|
+
busy: z.ZodBoolean;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
export declare const sessionDetailSchema: z.ZodObject<{
|
|
198
|
+
id: z.ZodUUID;
|
|
199
|
+
title: z.ZodNullable<z.ZodString>;
|
|
200
|
+
createdAt: z.ZodISODateTime;
|
|
201
|
+
updatedAt: z.ZodISODateTime;
|
|
202
|
+
resultCount: z.ZodNumber;
|
|
203
|
+
busy: z.ZodBoolean;
|
|
204
|
+
items: z.ZodArray<z.ZodObject<{
|
|
205
|
+
id: z.ZodUUID;
|
|
206
|
+
seq: z.ZodNumber;
|
|
207
|
+
createdAt: z.ZodISODateTime;
|
|
208
|
+
item: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
209
|
+
kind: z.ZodLiteral<"bot">;
|
|
210
|
+
text: z.ZodString;
|
|
211
|
+
step: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
212
|
+
name: "name";
|
|
213
|
+
faces: "faces";
|
|
214
|
+
extras: "extras";
|
|
215
|
+
desc: "desc";
|
|
216
|
+
review: "review";
|
|
217
|
+
}>>>;
|
|
218
|
+
summary: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
219
|
+
name: z.ZodString;
|
|
220
|
+
description: z.ZodString;
|
|
221
|
+
faces: z.ZodNumber;
|
|
222
|
+
extras: z.ZodNumber;
|
|
223
|
+
coverKey: z.ZodNullable<z.ZodString>;
|
|
224
|
+
}, z.core.$strip>>>;
|
|
225
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
226
|
+
kind: z.ZodLiteral<"user">;
|
|
227
|
+
text: z.ZodString;
|
|
228
|
+
answers: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
229
|
+
name: "name";
|
|
230
|
+
faces: "faces";
|
|
231
|
+
extras: "extras";
|
|
232
|
+
desc: "desc";
|
|
233
|
+
}>>>;
|
|
234
|
+
skipped: z.ZodDefault<z.ZodBoolean>;
|
|
235
|
+
uploadKeys: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
236
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
237
|
+
kind: z.ZodLiteral<"gen">;
|
|
238
|
+
runId: z.ZodUUID;
|
|
239
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
240
|
+
kind: z.ZodLiteral<"build">;
|
|
241
|
+
runId: z.ZodUUID;
|
|
242
|
+
name: z.ZodString;
|
|
243
|
+
}, z.core.$strip>], "kind">;
|
|
244
|
+
thumbUrls: z.ZodDefault<z.ZodArray<z.ZodURL>>;
|
|
245
|
+
run: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
246
|
+
id: z.ZodUUID;
|
|
247
|
+
workflowSlug: z.ZodString;
|
|
248
|
+
workflowTitle: z.ZodString;
|
|
249
|
+
runtime: z.ZodEnum<{
|
|
250
|
+
serverless: "serverless";
|
|
251
|
+
pod: "pod";
|
|
252
|
+
}>;
|
|
253
|
+
status: z.ZodEnum<{
|
|
254
|
+
queued: "queued";
|
|
255
|
+
dispatching: "dispatching";
|
|
256
|
+
running: "running";
|
|
257
|
+
succeeded: "succeeded";
|
|
258
|
+
failed: "failed";
|
|
259
|
+
canceled: "canceled";
|
|
260
|
+
}>;
|
|
261
|
+
createdAt: z.ZodISODateTime;
|
|
262
|
+
startedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
263
|
+
finishedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
264
|
+
preview: z.ZodNullable<z.ZodObject<{
|
|
265
|
+
url: z.ZodURL;
|
|
266
|
+
thumbUrl: z.ZodNullable<z.ZodURL>;
|
|
267
|
+
mediaKind: z.ZodString;
|
|
268
|
+
}, z.core.$strip>>;
|
|
269
|
+
credits: z.ZodNullable<z.ZodNumber>;
|
|
270
|
+
estimateCredits: z.ZodNullable<z.ZodNumber>;
|
|
271
|
+
kind: z.ZodDefault<z.ZodEnum<{
|
|
272
|
+
image: "image";
|
|
273
|
+
video: "video";
|
|
274
|
+
build: "build";
|
|
275
|
+
other: "other";
|
|
276
|
+
}>>;
|
|
277
|
+
sessionId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
|
|
278
|
+
studio: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
279
|
+
mode: z.ZodEnum<{
|
|
280
|
+
image: "image";
|
|
281
|
+
video: "video";
|
|
282
|
+
}>;
|
|
283
|
+
prompt: z.ZodString;
|
|
284
|
+
ratio: z.ZodEnum<{
|
|
285
|
+
"16:9": "16:9";
|
|
286
|
+
"1:1": "1:1";
|
|
287
|
+
"3:4": "3:4";
|
|
288
|
+
"9:16": "9:16";
|
|
289
|
+
"4:5": "4:5";
|
|
290
|
+
}>;
|
|
291
|
+
resolution: z.ZodEnum<{
|
|
292
|
+
"0.5k": "0.5k";
|
|
293
|
+
"1k": "1k";
|
|
294
|
+
"2k": "2k";
|
|
295
|
+
"4k": "4k";
|
|
296
|
+
}>;
|
|
297
|
+
seconds: z.ZodNullable<z.ZodNumber>;
|
|
298
|
+
characterName: z.ZodNullable<z.ZodString>;
|
|
299
|
+
cast: z.ZodDefault<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
300
|
+
kind: z.ZodLiteral<"own">;
|
|
301
|
+
characterId: z.ZodUUID;
|
|
302
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
303
|
+
kind: z.ZodLiteral<"community">;
|
|
304
|
+
slug: z.ZodString;
|
|
305
|
+
}, z.core.$strip>], "kind">>>;
|
|
306
|
+
}, z.core.$strip>>>;
|
|
307
|
+
outputCount: z.ZodDefault<z.ZodNumber>;
|
|
308
|
+
billableMs: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
309
|
+
}, z.core.$strip>>>;
|
|
310
|
+
outputs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
311
|
+
id: z.ZodUUID;
|
|
312
|
+
mediaKind: z.ZodString;
|
|
313
|
+
bytes: z.ZodNumber;
|
|
314
|
+
url: z.ZodURL;
|
|
315
|
+
thumbUrl: z.ZodNullable<z.ZodURL>;
|
|
316
|
+
expiresAt: z.ZodISODateTime;
|
|
317
|
+
label: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
318
|
+
checkpoint: z.ZodDefault<z.ZodBoolean>;
|
|
319
|
+
}, z.core.$strip>>>;
|
|
320
|
+
characterId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
|
|
321
|
+
}, z.core.$strip>>;
|
|
322
|
+
}, z.core.$strip>;
|
|
323
|
+
export declare const sessionsQuerySchema: z.ZodObject<{
|
|
324
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
325
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
326
|
+
q: z.ZodOptional<z.ZodString>;
|
|
327
|
+
}, z.core.$strip>;
|
|
328
|
+
export declare const sessionListSchema: z.ZodObject<{
|
|
329
|
+
items: z.ZodArray<z.ZodObject<{
|
|
330
|
+
id: z.ZodUUID;
|
|
331
|
+
title: z.ZodNullable<z.ZodString>;
|
|
332
|
+
createdAt: z.ZodISODateTime;
|
|
333
|
+
updatedAt: z.ZodISODateTime;
|
|
334
|
+
resultCount: z.ZodNumber;
|
|
335
|
+
busy: z.ZodBoolean;
|
|
336
|
+
}, z.core.$strip>>;
|
|
337
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
338
|
+
}, z.core.$strip>;
|
|
339
|
+
export declare const renameSessionBodySchema: z.ZodObject<{
|
|
340
|
+
title: z.ZodString;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
export type AppendItem = z.input<typeof appendItemSchema>;
|
|
343
|
+
export type SessionItemPayload = z.infer<typeof sessionItemPayloadSchema>;
|
|
344
|
+
export type SessionItem = z.infer<typeof sessionItemSchema>;
|
|
345
|
+
export type SessionSummary = z.infer<typeof sessionSummarySchema>;
|
|
346
|
+
export type SessionDetail = z.infer<typeof sessionDetailSchema>;
|
|
347
|
+
export type SessionsQuery = z.infer<typeof sessionsQuerySchema>;
|
|
348
|
+
export type SessionList = z.infer<typeof sessionListSchema>;
|
|
349
|
+
//# sourceMappingURL=sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/v1/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,gBA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M,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pageQuerySchema, pageOf } from './common.js';
|
|
3
|
+
import { runArtifactSchema, runSummarySchema } from './runs.js';
|
|
4
|
+
// A session is one studio conversation. Items are append-only; a run's own state lives on the run,
|
|
5
|
+
// so an item only points at it and the session never holds a second copy that could disagree.
|
|
6
|
+
export const MAX_SESSION_TEXT = 4000;
|
|
7
|
+
export const MAX_SESSION_UPLOADS = 8;
|
|
8
|
+
export const BUILD_STEPS = ['name', 'faces', 'extras', 'desc'];
|
|
9
|
+
const text = z.string().trim().max(MAX_SESSION_TEXT);
|
|
10
|
+
// What a client may append. `gen` and `build` are written by the server alone, as it starts the run.
|
|
11
|
+
export const appendItemSchema = z.discriminatedUnion('kind', [
|
|
12
|
+
z.object({
|
|
13
|
+
kind: z.literal('bot'),
|
|
14
|
+
text: text.min(1),
|
|
15
|
+
step: z.enum([...BUILD_STEPS, 'review']).nullable().default(null),
|
|
16
|
+
// The review card, frozen as it was shown so a later edit to the draft cannot rewrite history.
|
|
17
|
+
summary: z
|
|
18
|
+
.object({
|
|
19
|
+
name: z.string().trim().min(1).max(80),
|
|
20
|
+
description: z.string().trim().max(2000),
|
|
21
|
+
faces: z.number().int().min(0).max(MAX_SESSION_UPLOADS),
|
|
22
|
+
extras: z.number().int().min(0).max(MAX_SESSION_UPLOADS),
|
|
23
|
+
coverKey: z.string().max(512).nullable(),
|
|
24
|
+
})
|
|
25
|
+
.nullable()
|
|
26
|
+
.default(null),
|
|
27
|
+
}),
|
|
28
|
+
z.object({
|
|
29
|
+
kind: z.literal('user'),
|
|
30
|
+
text: text.min(1),
|
|
31
|
+
// Which build question this answers, so the server can title the session from the name.
|
|
32
|
+
answers: z.enum(BUILD_STEPS).nullable().default(null),
|
|
33
|
+
skipped: z.boolean().default(false),
|
|
34
|
+
// The caller's own upload keys, checked on append and signed on read.
|
|
35
|
+
uploadKeys: z.array(z.string().min(1).max(512)).max(MAX_SESSION_UPLOADS).default([]),
|
|
36
|
+
}),
|
|
37
|
+
]);
|
|
38
|
+
export const sessionItemPayloadSchema = z.discriminatedUnion('kind', [
|
|
39
|
+
...appendItemSchema.options,
|
|
40
|
+
z.object({ kind: z.literal('gen'), runId: z.uuid() }),
|
|
41
|
+
z.object({ kind: z.literal('build'), runId: z.uuid(), name: z.string() }),
|
|
42
|
+
]);
|
|
43
|
+
export const sessionItemSchema = z.object({
|
|
44
|
+
id: z.uuid(),
|
|
45
|
+
seq: z.number().int().nonnegative(),
|
|
46
|
+
createdAt: z.iso.datetime(),
|
|
47
|
+
item: sessionItemPayloadSchema,
|
|
48
|
+
// Signed thumbnails for a `user` item's uploads, in the order they were sent.
|
|
49
|
+
thumbUrls: z.array(z.url()).default([]),
|
|
50
|
+
// The run behind a `gen` or `build` item, read fresh so a finished run shows as finished.
|
|
51
|
+
run: runSummarySchema.nullable().default(null),
|
|
52
|
+
outputs: z.array(runArtifactSchema).default([]),
|
|
53
|
+
// The character a finished `build` produced, when it is still in the caller's library.
|
|
54
|
+
characterId: z.uuid().nullable().default(null),
|
|
55
|
+
});
|
|
56
|
+
export const sessionSummarySchema = z.object({
|
|
57
|
+
id: z.uuid(),
|
|
58
|
+
title: z.string().nullable(),
|
|
59
|
+
createdAt: z.iso.datetime(),
|
|
60
|
+
updatedAt: z.iso.datetime(),
|
|
61
|
+
resultCount: z.number().int().nonnegative(),
|
|
62
|
+
// A generation or build in it is still going.
|
|
63
|
+
busy: z.boolean(),
|
|
64
|
+
});
|
|
65
|
+
export const sessionDetailSchema = sessionSummarySchema.extend({
|
|
66
|
+
items: z.array(sessionItemSchema),
|
|
67
|
+
});
|
|
68
|
+
export const sessionsQuerySchema = pageQuerySchema.extend({
|
|
69
|
+
q: z.string().trim().max(120).optional(),
|
|
70
|
+
});
|
|
71
|
+
export const sessionListSchema = pageOf(sessionSummarySchema);
|
|
72
|
+
export const renameSessionBodySchema = z.object({ title: z.string().trim().min(1).max(120) });
|
|
73
|
+
//# sourceMappingURL=sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../src/v1/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAE/D,mGAAmG;AACnG,8FAA8F;AAE9F,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAA;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAEpC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;AAGvE,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;AAEpD,qGAAqG;AACrG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC3D,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QACtB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACjB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;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C,CAAC,IAAI,EAAE;IACZ,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC3B,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC3C,8CAA8C;IAC9C,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;CAClB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC,MAAM,CAAC;IAC7D,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;CAClC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC,MAAM,CAAC;IACxD,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAA;AAE7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type VideoResolution } from './videoPricing.js';
|
|
3
|
+
export declare const STUDIO_MODES: readonly ["video", "image"];
|
|
4
|
+
export type StudioMode = (typeof STUDIO_MODES)[number];
|
|
5
|
+
export declare const STUDIO_RESOLUTIONS: readonly ["0.5k", "1k", "2k", "4k"];
|
|
6
|
+
export type StudioResolution = (typeof STUDIO_RESOLUTIONS)[number];
|
|
7
|
+
export declare const STUDIO_RATIOS: readonly ["1:1", "3:4", "4:5", "9:16", "16:9"];
|
|
8
|
+
export type StudioRatio = (typeof STUDIO_RATIOS)[number];
|
|
9
|
+
export declare const VIDEO_STUDIO_RATIOS: readonly StudioRatio[];
|
|
10
|
+
export declare const ratiosFor: (mode: StudioMode) => readonly StudioRatio[];
|
|
11
|
+
export declare const IMAGE_MICRO_BY_RESOLUTION: Record<StudioResolution, number>;
|
|
12
|
+
export declare const IMAGE_LONG_EDGE: Record<StudioResolution, number>;
|
|
13
|
+
export declare const VIDEO_RESOLUTION_FOR: Record<StudioResolution, VideoResolution>;
|
|
14
|
+
/** Width and height for an image at this tier and shape. */
|
|
15
|
+
export declare function imageDimensions(resolution: StudioResolution, ratio: StudioRatio): {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
export type StudioQuote = {
|
|
20
|
+
mode: StudioMode;
|
|
21
|
+
resolution: StudioResolution;
|
|
22
|
+
seconds?: number | undefined;
|
|
23
|
+
hasCharacter: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** What one generate costs, in micro-credits. The same function the server charges by. */
|
|
26
|
+
export declare function studioRunMicro(quote: StudioQuote): number;
|
|
27
|
+
export declare const studioRunCredits: (quote: StudioQuote) => number;
|
|
28
|
+
export declare const castSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
29
|
+
kind: z.ZodLiteral<"own">;
|
|
30
|
+
characterId: z.ZodUUID;
|
|
31
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
+
kind: z.ZodLiteral<"community">;
|
|
33
|
+
slug: z.ZodString;
|
|
34
|
+
}, z.core.$strip>], "kind">;
|
|
35
|
+
export declare const generateBodySchema: z.ZodObject<{
|
|
36
|
+
mode: z.ZodEnum<{
|
|
37
|
+
image: "image";
|
|
38
|
+
video: "video";
|
|
39
|
+
}>;
|
|
40
|
+
prompt: z.ZodString;
|
|
41
|
+
ratio: z.ZodEnum<{
|
|
42
|
+
"16:9": "16:9";
|
|
43
|
+
"1:1": "1:1";
|
|
44
|
+
"3:4": "3:4";
|
|
45
|
+
"9:16": "9:16";
|
|
46
|
+
"4:5": "4:5";
|
|
47
|
+
}>;
|
|
48
|
+
resolution: z.ZodEnum<{
|
|
49
|
+
"0.5k": "0.5k";
|
|
50
|
+
"1k": "1k";
|
|
51
|
+
"2k": "2k";
|
|
52
|
+
"4k": "4k";
|
|
53
|
+
}>;
|
|
54
|
+
seconds: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
cast: z.ZodDefault<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
56
|
+
kind: z.ZodLiteral<"own">;
|
|
57
|
+
characterId: z.ZodUUID;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
kind: z.ZodLiteral<"community">;
|
|
60
|
+
slug: z.ZodString;
|
|
61
|
+
}, z.core.$strip>], "kind">>>;
|
|
62
|
+
sessionId: z.ZodOptional<z.ZodUUID>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export declare const generateResponseSchema: z.ZodObject<{
|
|
65
|
+
runId: z.ZodUUID;
|
|
66
|
+
sessionId: z.ZodNullable<z.ZodUUID>;
|
|
67
|
+
credits: z.ZodNumber;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export declare const studioSettingsSchema: z.ZodObject<{
|
|
70
|
+
mode: z.ZodEnum<{
|
|
71
|
+
image: "image";
|
|
72
|
+
video: "video";
|
|
73
|
+
}>;
|
|
74
|
+
prompt: z.ZodString;
|
|
75
|
+
ratio: z.ZodEnum<{
|
|
76
|
+
"16:9": "16:9";
|
|
77
|
+
"1:1": "1:1";
|
|
78
|
+
"3:4": "3:4";
|
|
79
|
+
"9:16": "9:16";
|
|
80
|
+
"4:5": "4:5";
|
|
81
|
+
}>;
|
|
82
|
+
resolution: z.ZodEnum<{
|
|
83
|
+
"0.5k": "0.5k";
|
|
84
|
+
"1k": "1k";
|
|
85
|
+
"2k": "2k";
|
|
86
|
+
"4k": "4k";
|
|
87
|
+
}>;
|
|
88
|
+
seconds: z.ZodNullable<z.ZodNumber>;
|
|
89
|
+
characterName: z.ZodNullable<z.ZodString>;
|
|
90
|
+
cast: z.ZodDefault<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
91
|
+
kind: z.ZodLiteral<"own">;
|
|
92
|
+
characterId: z.ZodUUID;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
kind: z.ZodLiteral<"community">;
|
|
95
|
+
slug: z.ZodString;
|
|
96
|
+
}, z.core.$strip>], "kind">>>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
export declare const communityCharacterSchema: z.ZodObject<{
|
|
99
|
+
slug: z.ZodString;
|
|
100
|
+
name: z.ZodString;
|
|
101
|
+
summary: z.ZodString;
|
|
102
|
+
archs: z.ZodArray<z.ZodString>;
|
|
103
|
+
coverUrl: z.ZodNullable<z.ZodURL>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
export declare const communityCharacterListSchema: z.ZodObject<{
|
|
106
|
+
items: z.ZodArray<z.ZodObject<{
|
|
107
|
+
slug: z.ZodString;
|
|
108
|
+
name: z.ZodString;
|
|
109
|
+
summary: z.ZodString;
|
|
110
|
+
archs: z.ZodArray<z.ZodString>;
|
|
111
|
+
coverUrl: z.ZodNullable<z.ZodURL>;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
export type GenerateBody = z.input<typeof generateBodySchema>;
|
|
115
|
+
export type GenerateResponse = z.infer<typeof generateResponseSchema>;
|
|
116
|
+
export type StudioSettings = z.infer<typeof studioSettingsSchema>;
|
|
117
|
+
export type Cast = z.infer<typeof castSchema>;
|
|
118
|
+
export type CommunityCharacter = z.infer<typeof communityCharacterSchema>;
|
|
119
|
+
//# sourceMappingURL=studio.d.ts.map
|
|
@@ -0,0 +1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YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAOzD;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,WAAW,WACE,CAAA;AAGrD,eAAO,MAAM,UAAU;;;;;;2BAGrB,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAa3B,CAAA;AAEJ,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAA;AAGF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS/B,CAAA;AAGF,eAAO,MAAM,wBAAwB;;;;;;iBAMnC,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;iBAEvC,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACrE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AACjE,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA;AAC7C,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MICRO_PER_CREDIT } from './credits.js';
|
|
3
|
+
import { MAX_VIDEO_SECONDS, MIN_VIDEO_SECONDS, billedVideoReferences, videoRunMicro, } from './videoPricing.js';
|
|
4
|
+
// The studio's one-box generate: a prompt, a mode and three presets. The server maps each preset
|
|
5
|
+
// onto a workflow's own fields, so the browser never learns a node id or a width.
|
|
6
|
+
export const STUDIO_MODES = ['video', 'image'];
|
|
7
|
+
export const STUDIO_RESOLUTIONS = ['0.5k', '1k', '2k', '4k'];
|
|
8
|
+
export const STUDIO_RATIOS = ['1:1', '3:4', '4:5', '9:16', '16:9'];
|
|
9
|
+
// MiniMax H3 offers no 4:5, so video leaves it out rather than rounding it to a shape nobody chose.
|
|
10
|
+
export const VIDEO_STUDIO_RATIOS = ['1:1', '3:4', '9:16', '16:9'];
|
|
11
|
+
export const ratiosFor = (mode) => mode === 'video' ? VIDEO_STUDIO_RATIOS : STUDIO_RATIOS;
|
|
12
|
+
export const IMAGE_MICRO_BY_RESOLUTION = {
|
|
13
|
+
'0.5k': 2_000_000,
|
|
14
|
+
'1k': 3_000_000,
|
|
15
|
+
'2k': 6_000_000,
|
|
16
|
+
'4k': 12_000_000,
|
|
17
|
+
};
|
|
18
|
+
// Pixels on the long edge. The short edge follows from the ratio.
|
|
19
|
+
export const IMAGE_LONG_EDGE = {
|
|
20
|
+
'0.5k': 512,
|
|
21
|
+
'1k': 1024,
|
|
22
|
+
'2k': 2048,
|
|
23
|
+
'4k': 4096,
|
|
24
|
+
};
|
|
25
|
+
export const VIDEO_RESOLUTION_FOR = {
|
|
26
|
+
'0.5k': '480p',
|
|
27
|
+
'1k': '768p',
|
|
28
|
+
'2k': '2K',
|
|
29
|
+
'4k': '4K',
|
|
30
|
+
};
|
|
31
|
+
// Latent models need both edges on a 16px grid; anything else is cropped or rejected downstream.
|
|
32
|
+
const onGrid = (px) => Math.max(16, Math.round(px / 16) * 16);
|
|
33
|
+
/** Width and height for an image at this tier and shape. */
|
|
34
|
+
export function imageDimensions(resolution, ratio) {
|
|
35
|
+
const [w, h] = ratio.split(':').map(Number);
|
|
36
|
+
const long = IMAGE_LONG_EDGE[resolution];
|
|
37
|
+
return w >= h
|
|
38
|
+
? { width: onGrid(long), height: onGrid((long * h) / w) }
|
|
39
|
+
: { width: onGrid((long * w) / h), height: onGrid(long) };
|
|
40
|
+
}
|
|
41
|
+
/** What one generate costs, in micro-credits. The same function the server charges by. */
|
|
42
|
+
export function studioRunMicro(quote) {
|
|
43
|
+
if (quote.mode === 'image')
|
|
44
|
+
return IMAGE_MICRO_BY_RESOLUTION[quote.resolution];
|
|
45
|
+
return videoRunMicro({
|
|
46
|
+
resolution: VIDEO_RESOLUTION_FOR[quote.resolution],
|
|
47
|
+
seconds: quote.seconds ?? MIN_VIDEO_SECONDS,
|
|
48
|
+
referenceImages: billedVideoReferences({ uploads: 0, hasCharacter: quote.hasCharacter }),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export const studioRunCredits = (quote) => Math.ceil(studioRunMicro(quote) / MICRO_PER_CREDIT);
|
|
52
|
+
// A community character is named by its gallery slug; the server imports it on first use.
|
|
53
|
+
export const castSchema = z.discriminatedUnion('kind', [
|
|
54
|
+
z.object({ kind: z.literal('own'), characterId: z.uuid() }),
|
|
55
|
+
z.object({ kind: z.literal('community'), slug: z.string().min(1).max(120) }),
|
|
56
|
+
]);
|
|
57
|
+
export const generateBodySchema = z
|
|
58
|
+
.object({
|
|
59
|
+
mode: z.enum(STUDIO_MODES),
|
|
60
|
+
prompt: z.string().trim().min(1).max(4000),
|
|
61
|
+
ratio: z.enum(STUDIO_RATIOS),
|
|
62
|
+
resolution: z.enum(STUDIO_RESOLUTIONS),
|
|
63
|
+
seconds: z.number().int().min(MIN_VIDEO_SECONDS).max(MAX_VIDEO_SECONDS).optional(),
|
|
64
|
+
cast: castSchema.nullable().default(null),
|
|
65
|
+
sessionId: z.uuid().optional(),
|
|
66
|
+
})
|
|
67
|
+
.refine((body) => ratiosFor(body.mode).includes(body.ratio), {
|
|
68
|
+
message: 'That shape is not available for video.',
|
|
69
|
+
path: ['ratio'],
|
|
70
|
+
});
|
|
71
|
+
export const generateResponseSchema = z.object({
|
|
72
|
+
runId: z.uuid(),
|
|
73
|
+
sessionId: z.uuid().nullable(),
|
|
74
|
+
credits: z.number().int().nonnegative(),
|
|
75
|
+
});
|
|
76
|
+
// What the studio recorded about a run it started, read back by the run list.
|
|
77
|
+
export const studioSettingsSchema = z.object({
|
|
78
|
+
mode: z.enum(STUDIO_MODES),
|
|
79
|
+
prompt: z.string(),
|
|
80
|
+
ratio: z.enum(STUDIO_RATIOS),
|
|
81
|
+
resolution: z.enum(STUDIO_RESOLUTIONS),
|
|
82
|
+
seconds: z.number().int().nullable(),
|
|
83
|
+
characterName: z.string().nullable(),
|
|
84
|
+
// Which character was cast, so Run again and Edit prompt can cast the same one.
|
|
85
|
+
cast: castSchema.nullable().default(null),
|
|
86
|
+
});
|
|
87
|
+
// A published character anyone may cast. `coverUrl` is on the media gateway's public route.
|
|
88
|
+
export const communityCharacterSchema = z.object({
|
|
89
|
+
slug: z.string(),
|
|
90
|
+
name: z.string(),
|
|
91
|
+
summary: z.string(),
|
|
92
|
+
archs: z.array(z.string()),
|
|
93
|
+
coverUrl: z.url().nullable(),
|
|
94
|
+
});
|
|
95
|
+
export const communityCharacterListSchema = z.object({
|
|
96
|
+
items: z.array(communityCharacterSchema),
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=studio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studio.js","sourceRoot":"","sources":["../../src/v1/studio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,GAEd,MAAM,mBAAmB,CAAA;AAE1B,iGAAiG;AACjG,kFAAkF;AAElF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAA;AAGvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAGrE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAA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