@drawcall/design 0.4.0 → 0.4.1

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/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * as v1 from "./v1/index.js";
2
2
  export { designSkill } from "./skill.generated.js";
3
3
  export { frameCreationCapabilities, type FrameCreationCapability, type FrameCreationCapabilityId, type FrameCreationInput, } from "./v1/capabilities.js";
4
+ export { IMAGE_GENERATION_MODEL, IMAGE_GENERATION_PROVIDER, } from "./v1/schemas.js";
4
5
  export { parseFrameSize } from "./target.js";
5
6
  export { acknowledgesInspection, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncMaps, projectSyncUrl, type InspectionAppliedMessage, type InspectionCommand, type InspectionFrameMessage, } from "./protocol.js";
6
7
  export type { BinaryFile, CreateFrame, CreateProjectFromBrief, CreateGltsFrame, CreateImageFrame, CreateMarketFrame, GenerateImageFrame, DesignFile, FileList, FileMutation, Frame, GltsFrame, ImageFrame, ImageGenerationOperation, ImageGenerationProvenance, ImageGenerationResult, MarketFrame, Project, ProjectDerivationStatus, Screenshot, TextFile, User, } from "./v1/schemas.js";
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * as v1 from "./v1/index.js";
2
2
  export { designSkill } from "./skill.generated.js";
3
3
  export { frameCreationCapabilities, } from "./v1/capabilities.js";
4
+ export { IMAGE_GENERATION_MODEL, IMAGE_GENERATION_PROVIDER, } from "./v1/schemas.js";
4
5
  export { parseFrameSize } from "./target.js";
5
6
  export { acknowledgesInspection, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncMaps, projectSyncUrl, } from "./protocol.js";
@@ -128,7 +128,24 @@ export declare const contract: {
128
128
  updatedAt: z.ZodString;
129
129
  type: z.ZodLiteral<"image">;
130
130
  file: z.ZodString;
131
- provenance: z.ZodOptional<z.ZodObject<{
131
+ provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
132
+ kind: z.ZodLiteral<"generated">;
133
+ operation: z.ZodEnum<{
134
+ generate: "generate";
135
+ edit: "edit";
136
+ }>;
137
+ prompt: z.ZodString;
138
+ references: z.ZodArray<z.ZodObject<{
139
+ frameId: z.ZodString;
140
+ frameUpdatedAt: z.ZodString;
141
+ }, z.core.$strip>>;
142
+ result: z.ZodEnum<{
143
+ replace: "replace";
144
+ new: "new";
145
+ }>;
146
+ provider: z.ZodLiteral<"fal-ai">;
147
+ model: z.ZodLiteral<"openai/gpt-image-2">;
148
+ }, z.core.$strip>, z.ZodObject<{
132
149
  kind: z.ZodLiteral<"generated">;
133
150
  operation: z.ZodEnum<{
134
151
  generate: "generate";
@@ -139,13 +156,13 @@ export declare const contract: {
139
156
  frameId: z.ZodString;
140
157
  frameUpdatedAt: z.ZodString;
141
158
  }, z.core.$strip>>;
142
- provider: z.ZodLiteral<"cloudflare-workers-ai">;
143
- model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
144
159
  result: z.ZodEnum<{
145
160
  replace: "replace";
146
161
  new: "new";
147
162
  }>;
148
- }, z.core.$strip>>;
163
+ provider: z.ZodLiteral<"cloudflare-workers-ai">;
164
+ model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
165
+ }, z.core.$strip>], "provider">>;
149
166
  }, z.core.$strip>, z.ZodObject<{
150
167
  id: z.ZodString;
151
168
  projectId: z.ZodString;
@@ -207,7 +224,24 @@ export declare const contract: {
207
224
  updatedAt: z.ZodString;
208
225
  type: z.ZodLiteral<"image">;
209
226
  file: z.ZodString;
210
- provenance: z.ZodOptional<z.ZodObject<{
227
+ provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
228
+ kind: z.ZodLiteral<"generated">;
229
+ operation: z.ZodEnum<{
230
+ generate: "generate";
231
+ edit: "edit";
232
+ }>;
233
+ prompt: z.ZodString;
234
+ references: z.ZodArray<z.ZodObject<{
235
+ frameId: z.ZodString;
236
+ frameUpdatedAt: z.ZodString;
237
+ }, z.core.$strip>>;
238
+ result: z.ZodEnum<{
239
+ replace: "replace";
240
+ new: "new";
241
+ }>;
242
+ provider: z.ZodLiteral<"fal-ai">;
243
+ model: z.ZodLiteral<"openai/gpt-image-2">;
244
+ }, z.core.$strip>, z.ZodObject<{
211
245
  kind: z.ZodLiteral<"generated">;
212
246
  operation: z.ZodEnum<{
213
247
  generate: "generate";
@@ -218,13 +252,13 @@ export declare const contract: {
218
252
  frameId: z.ZodString;
219
253
  frameUpdatedAt: z.ZodString;
220
254
  }, z.core.$strip>>;
221
- provider: z.ZodLiteral<"cloudflare-workers-ai">;
222
- model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
223
255
  result: z.ZodEnum<{
224
256
  replace: "replace";
225
257
  new: "new";
226
258
  }>;
227
- }, z.core.$strip>>;
259
+ provider: z.ZodLiteral<"cloudflare-workers-ai">;
260
+ model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
261
+ }, z.core.$strip>], "provider">>;
228
262
  }, z.core.$strip>, z.ZodObject<{
229
263
  id: z.ZodString;
230
264
  projectId: z.ZodString;
@@ -280,7 +314,24 @@ export declare const contract: {
280
314
  updatedAt: z.ZodString;
281
315
  type: z.ZodLiteral<"image">;
282
316
  file: z.ZodString;
283
- provenance: z.ZodOptional<z.ZodObject<{
317
+ provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
318
+ kind: z.ZodLiteral<"generated">;
319
+ operation: z.ZodEnum<{
320
+ generate: "generate";
321
+ edit: "edit";
322
+ }>;
323
+ prompt: z.ZodString;
324
+ references: z.ZodArray<z.ZodObject<{
325
+ frameId: z.ZodString;
326
+ frameUpdatedAt: z.ZodString;
327
+ }, z.core.$strip>>;
328
+ result: z.ZodEnum<{
329
+ replace: "replace";
330
+ new: "new";
331
+ }>;
332
+ provider: z.ZodLiteral<"fal-ai">;
333
+ model: z.ZodLiteral<"openai/gpt-image-2">;
334
+ }, z.core.$strip>, z.ZodObject<{
284
335
  kind: z.ZodLiteral<"generated">;
285
336
  operation: z.ZodEnum<{
286
337
  generate: "generate";
@@ -291,13 +342,13 @@ export declare const contract: {
291
342
  frameId: z.ZodString;
292
343
  frameUpdatedAt: z.ZodString;
293
344
  }, z.core.$strip>>;
294
- provider: z.ZodLiteral<"cloudflare-workers-ai">;
295
- model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
296
345
  result: z.ZodEnum<{
297
346
  replace: "replace";
298
347
  new: "new";
299
348
  }>;
300
- }, z.core.$strip>>;
349
+ provider: z.ZodLiteral<"cloudflare-workers-ai">;
350
+ model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
351
+ }, z.core.$strip>], "provider">>;
301
352
  }, z.core.$strip>, z.ZodObject<{
302
353
  id: z.ZodString;
303
354
  projectId: z.ZodString;
@@ -341,7 +392,24 @@ export declare const contract: {
341
392
  updatedAt: z.ZodString;
342
393
  type: z.ZodLiteral<"image">;
343
394
  file: z.ZodString;
344
- provenance: z.ZodOptional<z.ZodObject<{
395
+ provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
396
+ kind: z.ZodLiteral<"generated">;
397
+ operation: z.ZodEnum<{
398
+ generate: "generate";
399
+ edit: "edit";
400
+ }>;
401
+ prompt: z.ZodString;
402
+ references: z.ZodArray<z.ZodObject<{
403
+ frameId: z.ZodString;
404
+ frameUpdatedAt: z.ZodString;
405
+ }, z.core.$strip>>;
406
+ result: z.ZodEnum<{
407
+ replace: "replace";
408
+ new: "new";
409
+ }>;
410
+ provider: z.ZodLiteral<"fal-ai">;
411
+ model: z.ZodLiteral<"openai/gpt-image-2">;
412
+ }, z.core.$strip>, z.ZodObject<{
345
413
  kind: z.ZodLiteral<"generated">;
346
414
  operation: z.ZodEnum<{
347
415
  generate: "generate";
@@ -352,13 +420,13 @@ export declare const contract: {
352
420
  frameId: z.ZodString;
353
421
  frameUpdatedAt: z.ZodString;
354
422
  }, z.core.$strip>>;
355
- provider: z.ZodLiteral<"cloudflare-workers-ai">;
356
- model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
357
423
  result: z.ZodEnum<{
358
424
  replace: "replace";
359
425
  new: "new";
360
426
  }>;
361
- }, z.core.$strip>>;
427
+ provider: z.ZodLiteral<"cloudflare-workers-ai">;
428
+ model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
429
+ }, z.core.$strip>], "provider">>;
362
430
  }, z.core.$strip>, z.ZodObject<{
363
431
  id: z.ZodString;
364
432
  projectId: z.ZodString;
@@ -76,7 +76,11 @@ export declare const imageGenerationReferenceSchema: z.ZodObject<{
76
76
  frameId: z.ZodString;
77
77
  frameUpdatedAt: z.ZodString;
78
78
  }, z.core.$strip>;
79
- export declare const imageGenerationProvenanceSchema: z.ZodObject<{
79
+ export declare const IMAGE_GENERATION_PROVIDER = "fal-ai";
80
+ export declare const IMAGE_GENERATION_MODEL = "openai/gpt-image-2";
81
+ export declare const LEGACY_IMAGE_GENERATION_PROVIDER = "cloudflare-workers-ai";
82
+ export declare const LEGACY_IMAGE_GENERATION_MODEL = "@cf/black-forest-labs/flux-2-klein-4b";
83
+ export declare const imageGenerationProvenanceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
80
84
  kind: z.ZodLiteral<"generated">;
81
85
  operation: z.ZodEnum<{
82
86
  generate: "generate";
@@ -87,13 +91,30 @@ export declare const imageGenerationProvenanceSchema: z.ZodObject<{
87
91
  frameId: z.ZodString;
88
92
  frameUpdatedAt: z.ZodString;
89
93
  }, z.core.$strip>>;
90
- provider: z.ZodLiteral<"cloudflare-workers-ai">;
91
- model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
92
94
  result: z.ZodEnum<{
93
95
  replace: "replace";
94
96
  new: "new";
95
97
  }>;
96
- }, z.core.$strip>;
98
+ provider: z.ZodLiteral<"fal-ai">;
99
+ model: z.ZodLiteral<"openai/gpt-image-2">;
100
+ }, z.core.$strip>, z.ZodObject<{
101
+ kind: z.ZodLiteral<"generated">;
102
+ operation: z.ZodEnum<{
103
+ generate: "generate";
104
+ edit: "edit";
105
+ }>;
106
+ prompt: z.ZodString;
107
+ references: z.ZodArray<z.ZodObject<{
108
+ frameId: z.ZodString;
109
+ frameUpdatedAt: z.ZodString;
110
+ }, z.core.$strip>>;
111
+ result: z.ZodEnum<{
112
+ replace: "replace";
113
+ new: "new";
114
+ }>;
115
+ provider: z.ZodLiteral<"cloudflare-workers-ai">;
116
+ model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
117
+ }, z.core.$strip>], "provider">;
97
118
  export declare const imageFrameSchema: z.ZodObject<{
98
119
  id: z.ZodString;
99
120
  projectId: z.ZodString;
@@ -107,7 +128,7 @@ export declare const imageFrameSchema: z.ZodObject<{
107
128
  updatedAt: z.ZodString;
108
129
  type: z.ZodLiteral<"image">;
109
130
  file: z.ZodString;
110
- provenance: z.ZodOptional<z.ZodObject<{
131
+ provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
111
132
  kind: z.ZodLiteral<"generated">;
112
133
  operation: z.ZodEnum<{
113
134
  generate: "generate";
@@ -118,13 +139,30 @@ export declare const imageFrameSchema: z.ZodObject<{
118
139
  frameId: z.ZodString;
119
140
  frameUpdatedAt: z.ZodString;
120
141
  }, z.core.$strip>>;
121
- provider: z.ZodLiteral<"cloudflare-workers-ai">;
122
- model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
123
142
  result: z.ZodEnum<{
124
143
  replace: "replace";
125
144
  new: "new";
126
145
  }>;
127
- }, z.core.$strip>>;
146
+ provider: z.ZodLiteral<"fal-ai">;
147
+ model: z.ZodLiteral<"openai/gpt-image-2">;
148
+ }, z.core.$strip>, z.ZodObject<{
149
+ kind: z.ZodLiteral<"generated">;
150
+ operation: z.ZodEnum<{
151
+ generate: "generate";
152
+ edit: "edit";
153
+ }>;
154
+ prompt: z.ZodString;
155
+ references: z.ZodArray<z.ZodObject<{
156
+ frameId: z.ZodString;
157
+ frameUpdatedAt: z.ZodString;
158
+ }, z.core.$strip>>;
159
+ result: z.ZodEnum<{
160
+ replace: "replace";
161
+ new: "new";
162
+ }>;
163
+ provider: z.ZodLiteral<"cloudflare-workers-ai">;
164
+ model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
165
+ }, z.core.$strip>], "provider">>;
128
166
  }, z.core.$strip>;
129
167
  export declare const marketFrameSchema: z.ZodObject<{
130
168
  id: z.ZodString;
@@ -165,7 +203,7 @@ export declare const frameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
165
203
  updatedAt: z.ZodString;
166
204
  type: z.ZodLiteral<"image">;
167
205
  file: z.ZodString;
168
- provenance: z.ZodOptional<z.ZodObject<{
206
+ provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
169
207
  kind: z.ZodLiteral<"generated">;
170
208
  operation: z.ZodEnum<{
171
209
  generate: "generate";
@@ -176,13 +214,30 @@ export declare const frameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
176
214
  frameId: z.ZodString;
177
215
  frameUpdatedAt: z.ZodString;
178
216
  }, z.core.$strip>>;
179
- provider: z.ZodLiteral<"cloudflare-workers-ai">;
180
- model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
181
217
  result: z.ZodEnum<{
182
218
  replace: "replace";
183
219
  new: "new";
184
220
  }>;
185
- }, z.core.$strip>>;
221
+ provider: z.ZodLiteral<"fal-ai">;
222
+ model: z.ZodLiteral<"openai/gpt-image-2">;
223
+ }, z.core.$strip>, z.ZodObject<{
224
+ kind: z.ZodLiteral<"generated">;
225
+ operation: z.ZodEnum<{
226
+ generate: "generate";
227
+ edit: "edit";
228
+ }>;
229
+ prompt: z.ZodString;
230
+ references: z.ZodArray<z.ZodObject<{
231
+ frameId: z.ZodString;
232
+ frameUpdatedAt: z.ZodString;
233
+ }, z.core.$strip>>;
234
+ result: z.ZodEnum<{
235
+ replace: "replace";
236
+ new: "new";
237
+ }>;
238
+ provider: z.ZodLiteral<"cloudflare-workers-ai">;
239
+ model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
240
+ }, z.core.$strip>], "provider">>;
186
241
  }, z.core.$strip>, z.ZodObject<{
187
242
  id: z.ZodString;
188
243
  projectId: z.ZodString;
@@ -99,17 +99,29 @@ export const imageGenerationReferenceSchema = z.object({
99
99
  frameId: designIdSchema,
100
100
  frameUpdatedAt: z.string().datetime(),
101
101
  });
102
- export const imageGenerationProvenanceSchema = z.object({
102
+ export const IMAGE_GENERATION_PROVIDER = "fal-ai";
103
+ export const IMAGE_GENERATION_MODEL = "openai/gpt-image-2";
104
+ export const LEGACY_IMAGE_GENERATION_PROVIDER = "cloudflare-workers-ai";
105
+ export const LEGACY_IMAGE_GENERATION_MODEL = "@cf/black-forest-labs/flux-2-klein-4b";
106
+ const imageGenerationProvenanceBaseSchema = z.object({
103
107
  kind: z.literal("generated"),
104
108
  operation: imageGenerationOperationSchema,
105
109
  prompt: z.string().min(1).max(MAX_IMAGE_GENERATION_PROMPT_LENGTH),
106
110
  references: z
107
111
  .array(imageGenerationReferenceSchema)
108
112
  .max(MAX_IMAGE_GENERATION_REFERENCES),
109
- provider: z.literal("cloudflare-workers-ai"),
110
- model: z.literal("@cf/black-forest-labs/flux-2-klein-4b"),
111
113
  result: imageGenerationResultSchema,
112
114
  });
115
+ export const imageGenerationProvenanceSchema = z.discriminatedUnion("provider", [
116
+ imageGenerationProvenanceBaseSchema.extend({
117
+ provider: z.literal(IMAGE_GENERATION_PROVIDER),
118
+ model: z.literal(IMAGE_GENERATION_MODEL),
119
+ }),
120
+ imageGenerationProvenanceBaseSchema.extend({
121
+ provider: z.literal(LEGACY_IMAGE_GENERATION_PROVIDER),
122
+ model: z.literal(LEGACY_IMAGE_GENERATION_MODEL),
123
+ }),
124
+ ]);
113
125
  export const imageFrameSchema = frameBaseSchema.extend({
114
126
  type: z.literal("image"),
115
127
  file: projectPathSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawcall/design",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Typed API and remote CLI for Drawcall Design",
5
5
  "repository": {
6
6
  "type": "git",