@tangle-network/agent-app 0.7.2 → 0.8.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.
@@ -0,0 +1,463 @@
1
+ import { z } from 'zod';
2
+
3
+ interface BrandTokens {
4
+ primaryColor: string;
5
+ accentColor: string;
6
+ textColor: string;
7
+ fontFamily: string;
8
+ logoUrl?: string;
9
+ businessName: string;
10
+ voice: string;
11
+ }
12
+ type AssetFormat = 'email' | 'image:feed' | 'image:story' | 'image:carousel' | 'video:reel' | 'video:feed' | 'copy:caption' | 'copy:headline' | 'copy:sms';
13
+ type AssetStatus = 'draft' | 'pending_review' | 'approved' | 'rejected' | 'scheduled' | 'published';
14
+ interface EmailHeroSection {
15
+ type: 'hero';
16
+ headline: string;
17
+ subheadline?: string;
18
+ imageUrl?: string;
19
+ ctaLabel?: string;
20
+ ctaUrl?: string;
21
+ }
22
+ interface EmailBodySection {
23
+ type: 'body';
24
+ text: string;
25
+ }
26
+ interface EmailFeatureSection {
27
+ type: 'feature';
28
+ headline: string;
29
+ description: string;
30
+ imageUrl?: string;
31
+ }
32
+ interface EmailTestimonialSection {
33
+ type: 'testimonial';
34
+ quote: string;
35
+ author: string;
36
+ role?: string;
37
+ avatarUrl?: string;
38
+ }
39
+ interface EmailCtaSection {
40
+ type: 'cta';
41
+ label: string;
42
+ url: string;
43
+ subtext?: string;
44
+ }
45
+ interface EmailDividerSection {
46
+ type: 'divider';
47
+ }
48
+ type EmailSection = EmailHeroSection | EmailBodySection | EmailFeatureSection | EmailTestimonialSection | EmailCtaSection | EmailDividerSection;
49
+ interface EmailContent {
50
+ subject: string;
51
+ preheader?: string;
52
+ sections: EmailSection[];
53
+ }
54
+ type ImageLayerType = 'text' | 'image' | 'shape' | 'logo';
55
+ interface ImageTextLayer {
56
+ type: 'text';
57
+ text: string;
58
+ fontSize?: number;
59
+ fontWeight?: 'normal' | 'bold';
60
+ color?: string;
61
+ x: number;
62
+ y: number;
63
+ width?: number;
64
+ align?: 'left' | 'center' | 'right';
65
+ }
66
+ interface ImageImageLayer {
67
+ type: 'image';
68
+ url: string;
69
+ x: number;
70
+ y: number;
71
+ width: number;
72
+ height: number;
73
+ opacity?: number;
74
+ }
75
+ interface ImageShapeLayer {
76
+ type: 'shape';
77
+ shape: 'rect' | 'circle' | 'rounded-rect';
78
+ x: number;
79
+ y: number;
80
+ width: number;
81
+ height: number;
82
+ fill?: string;
83
+ opacity?: number;
84
+ }
85
+ interface ImageLogoLayer {
86
+ type: 'logo';
87
+ x: number;
88
+ y: number;
89
+ width?: number;
90
+ }
91
+ type ImageLayer = ImageTextLayer | ImageImageLayer | ImageShapeLayer | ImageLogoLayer;
92
+ type ImageBackground = {
93
+ type: 'color';
94
+ value: string;
95
+ } | {
96
+ type: 'gradient';
97
+ from: string;
98
+ to: string;
99
+ direction?: string;
100
+ } | {
101
+ type: 'image';
102
+ url: string;
103
+ overlay?: string;
104
+ overlayOpacity?: number;
105
+ };
106
+ interface ImageSlide {
107
+ background: ImageBackground;
108
+ layers: ImageLayer[];
109
+ }
110
+ interface ImageContent {
111
+ slides: ImageSlide[];
112
+ }
113
+ interface VideoTextAnimationScene {
114
+ type: 'text-animation';
115
+ durationSeconds: number;
116
+ headline: string;
117
+ subtext?: string;
118
+ animation?: 'fade' | 'slide-up' | 'typewriter';
119
+ background?: ImageBackground;
120
+ }
121
+ interface VideoImageRevealScene {
122
+ type: 'image-reveal';
123
+ durationSeconds: number;
124
+ imageUrl: string;
125
+ caption?: string;
126
+ }
127
+ interface VideoSlideScene {
128
+ type: 'slide';
129
+ durationSeconds: number;
130
+ slide: ImageSlide;
131
+ }
132
+ interface VideoCountdownScene {
133
+ type: 'countdown';
134
+ durationSeconds: number;
135
+ from: number;
136
+ label?: string;
137
+ }
138
+ type VideoScene = VideoTextAnimationScene | VideoImageRevealScene | VideoSlideScene | VideoCountdownScene;
139
+ interface VideoCaption {
140
+ startSeconds: number;
141
+ endSeconds: number;
142
+ text: string;
143
+ }
144
+ interface VideoContent {
145
+ durationSeconds: number;
146
+ scenes: VideoScene[];
147
+ audioUrl?: string;
148
+ captions?: VideoCaption[];
149
+ renderedUrl?: string;
150
+ }
151
+ type CopyPlatform = 'instagram' | 'tiktok' | 'x' | 'linkedin' | 'sms' | 'email-subject';
152
+ interface CopyContent {
153
+ headline: string;
154
+ body: string;
155
+ hashtags?: string[];
156
+ platform: CopyPlatform;
157
+ characterCount?: number;
158
+ }
159
+ type AssetContentMap = {
160
+ email: EmailContent;
161
+ 'image:feed': ImageContent;
162
+ 'image:story': ImageContent;
163
+ 'image:carousel': ImageContent;
164
+ 'video:reel': VideoContent;
165
+ 'video:feed': VideoContent;
166
+ 'copy:caption': CopyContent;
167
+ 'copy:headline': CopyContent;
168
+ 'copy:sms': CopyContent;
169
+ };
170
+ interface AssetSpec<F extends AssetFormat = AssetFormat> {
171
+ id: string;
172
+ workspaceId: string;
173
+ campaignId?: string;
174
+ format: F;
175
+ brand: BrandTokens;
176
+ content: AssetContentMap[F];
177
+ status: AssetStatus;
178
+ scheduledAt?: string;
179
+ createdAt: string;
180
+ updatedAt: string;
181
+ }
182
+ interface AssetVariant {
183
+ id: string;
184
+ parentId: string;
185
+ label: string;
186
+ spec: AssetSpec;
187
+ approvedAt?: string;
188
+ rejectedAt?: string;
189
+ editLog: ApprovalEvent[];
190
+ }
191
+ interface ApprovalEvent {
192
+ assetId: string;
193
+ variantId?: string;
194
+ action: 'approved' | 'rejected' | 'edited' | 'scheduled';
195
+ editedFields?: string[];
196
+ userId: string;
197
+ timestamp: string;
198
+ }
199
+ interface ConversionMetrics {
200
+ impressions: number;
201
+ clicks: number;
202
+ conversions: number;
203
+ ctr: number;
204
+ cvr: number;
205
+ }
206
+
207
+ declare const BrandTokensSchema: z.ZodObject<{
208
+ primaryColor: z.ZodString;
209
+ accentColor: z.ZodString;
210
+ textColor: z.ZodString;
211
+ fontFamily: z.ZodString;
212
+ logoUrl: z.ZodOptional<z.ZodString>;
213
+ businessName: z.ZodString;
214
+ voice: z.ZodString;
215
+ }, z.core.$strip>;
216
+ declare const EmailContentSchema: z.ZodObject<{
217
+ subject: z.ZodString;
218
+ preheader: z.ZodOptional<z.ZodString>;
219
+ sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
220
+ type: z.ZodLiteral<"hero">;
221
+ headline: z.ZodString;
222
+ subheadline: z.ZodOptional<z.ZodString>;
223
+ imageUrl: z.ZodOptional<z.ZodString>;
224
+ ctaLabel: z.ZodOptional<z.ZodString>;
225
+ ctaUrl: z.ZodOptional<z.ZodString>;
226
+ }, z.core.$strip>, z.ZodObject<{
227
+ type: z.ZodLiteral<"body">;
228
+ text: z.ZodString;
229
+ }, z.core.$strip>, z.ZodObject<{
230
+ type: z.ZodLiteral<"feature">;
231
+ headline: z.ZodString;
232
+ description: z.ZodString;
233
+ imageUrl: z.ZodOptional<z.ZodString>;
234
+ }, z.core.$strip>, z.ZodObject<{
235
+ type: z.ZodLiteral<"testimonial">;
236
+ quote: z.ZodString;
237
+ author: z.ZodString;
238
+ role: z.ZodOptional<z.ZodString>;
239
+ avatarUrl: z.ZodOptional<z.ZodString>;
240
+ }, z.core.$strip>, z.ZodObject<{
241
+ type: z.ZodLiteral<"cta">;
242
+ label: z.ZodString;
243
+ url: z.ZodString;
244
+ subtext: z.ZodOptional<z.ZodString>;
245
+ }, z.core.$strip>, z.ZodObject<{
246
+ type: z.ZodLiteral<"divider">;
247
+ }, z.core.$strip>], "type">>;
248
+ }, z.core.$strip>;
249
+ declare const ImageContentSchema: z.ZodObject<{
250
+ slides: z.ZodArray<z.ZodObject<{
251
+ background: z.ZodDiscriminatedUnion<[z.ZodObject<{
252
+ type: z.ZodLiteral<"color">;
253
+ value: z.ZodString;
254
+ }, z.core.$strip>, z.ZodObject<{
255
+ type: z.ZodLiteral<"gradient">;
256
+ from: z.ZodString;
257
+ to: z.ZodString;
258
+ direction: z.ZodOptional<z.ZodString>;
259
+ }, z.core.$strip>, z.ZodObject<{
260
+ type: z.ZodLiteral<"image">;
261
+ url: z.ZodString;
262
+ overlay: z.ZodOptional<z.ZodString>;
263
+ overlayOpacity: z.ZodOptional<z.ZodNumber>;
264
+ }, z.core.$strip>], "type">;
265
+ layers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
266
+ type: z.ZodLiteral<"text">;
267
+ text: z.ZodString;
268
+ fontSize: z.ZodOptional<z.ZodNumber>;
269
+ fontWeight: z.ZodOptional<z.ZodEnum<{
270
+ bold: "bold";
271
+ normal: "normal";
272
+ }>>;
273
+ color: z.ZodOptional<z.ZodString>;
274
+ x: z.ZodNumber;
275
+ y: z.ZodNumber;
276
+ width: z.ZodOptional<z.ZodNumber>;
277
+ align: z.ZodOptional<z.ZodEnum<{
278
+ left: "left";
279
+ center: "center";
280
+ right: "right";
281
+ }>>;
282
+ }, z.core.$strip>, z.ZodObject<{
283
+ type: z.ZodLiteral<"image">;
284
+ url: z.ZodString;
285
+ x: z.ZodNumber;
286
+ y: z.ZodNumber;
287
+ width: z.ZodNumber;
288
+ height: z.ZodNumber;
289
+ opacity: z.ZodOptional<z.ZodNumber>;
290
+ }, z.core.$strip>, z.ZodObject<{
291
+ type: z.ZodLiteral<"shape">;
292
+ shape: z.ZodEnum<{
293
+ rect: "rect";
294
+ circle: "circle";
295
+ "rounded-rect": "rounded-rect";
296
+ }>;
297
+ x: z.ZodNumber;
298
+ y: z.ZodNumber;
299
+ width: z.ZodNumber;
300
+ height: z.ZodNumber;
301
+ fill: z.ZodOptional<z.ZodString>;
302
+ opacity: z.ZodOptional<z.ZodNumber>;
303
+ }, z.core.$strip>, z.ZodObject<{
304
+ type: z.ZodLiteral<"logo">;
305
+ x: z.ZodNumber;
306
+ y: z.ZodNumber;
307
+ width: z.ZodOptional<z.ZodNumber>;
308
+ }, z.core.$strip>], "type">>;
309
+ }, z.core.$strip>>;
310
+ }, z.core.$strip>;
311
+ declare const VideoContentSchema: z.ZodObject<{
312
+ durationSeconds: z.ZodNumber;
313
+ scenes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
314
+ type: z.ZodLiteral<"text-animation">;
315
+ durationSeconds: z.ZodNumber;
316
+ headline: z.ZodString;
317
+ subtext: z.ZodOptional<z.ZodString>;
318
+ animation: z.ZodOptional<z.ZodEnum<{
319
+ fade: "fade";
320
+ "slide-up": "slide-up";
321
+ typewriter: "typewriter";
322
+ }>>;
323
+ background: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
324
+ type: z.ZodLiteral<"color">;
325
+ value: z.ZodString;
326
+ }, z.core.$strip>, z.ZodObject<{
327
+ type: z.ZodLiteral<"gradient">;
328
+ from: z.ZodString;
329
+ to: z.ZodString;
330
+ direction: z.ZodOptional<z.ZodString>;
331
+ }, z.core.$strip>, z.ZodObject<{
332
+ type: z.ZodLiteral<"image">;
333
+ url: z.ZodString;
334
+ overlay: z.ZodOptional<z.ZodString>;
335
+ overlayOpacity: z.ZodOptional<z.ZodNumber>;
336
+ }, z.core.$strip>], "type">>;
337
+ }, z.core.$strip>, z.ZodObject<{
338
+ type: z.ZodLiteral<"image-reveal">;
339
+ durationSeconds: z.ZodNumber;
340
+ imageUrl: z.ZodString;
341
+ caption: z.ZodOptional<z.ZodString>;
342
+ }, z.core.$strip>, z.ZodObject<{
343
+ type: z.ZodLiteral<"slide">;
344
+ durationSeconds: z.ZodNumber;
345
+ slide: z.ZodObject<{
346
+ background: z.ZodDiscriminatedUnion<[z.ZodObject<{
347
+ type: z.ZodLiteral<"color">;
348
+ value: z.ZodString;
349
+ }, z.core.$strip>, z.ZodObject<{
350
+ type: z.ZodLiteral<"gradient">;
351
+ from: z.ZodString;
352
+ to: z.ZodString;
353
+ direction: z.ZodOptional<z.ZodString>;
354
+ }, z.core.$strip>, z.ZodObject<{
355
+ type: z.ZodLiteral<"image">;
356
+ url: z.ZodString;
357
+ overlay: z.ZodOptional<z.ZodString>;
358
+ overlayOpacity: z.ZodOptional<z.ZodNumber>;
359
+ }, z.core.$strip>], "type">;
360
+ layers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
361
+ type: z.ZodLiteral<"text">;
362
+ text: z.ZodString;
363
+ fontSize: z.ZodOptional<z.ZodNumber>;
364
+ fontWeight: z.ZodOptional<z.ZodEnum<{
365
+ bold: "bold";
366
+ normal: "normal";
367
+ }>>;
368
+ color: z.ZodOptional<z.ZodString>;
369
+ x: z.ZodNumber;
370
+ y: z.ZodNumber;
371
+ width: z.ZodOptional<z.ZodNumber>;
372
+ align: z.ZodOptional<z.ZodEnum<{
373
+ left: "left";
374
+ center: "center";
375
+ right: "right";
376
+ }>>;
377
+ }, z.core.$strip>, z.ZodObject<{
378
+ type: z.ZodLiteral<"image">;
379
+ url: z.ZodString;
380
+ x: z.ZodNumber;
381
+ y: z.ZodNumber;
382
+ width: z.ZodNumber;
383
+ height: z.ZodNumber;
384
+ opacity: z.ZodOptional<z.ZodNumber>;
385
+ }, z.core.$strip>, z.ZodObject<{
386
+ type: z.ZodLiteral<"shape">;
387
+ shape: z.ZodEnum<{
388
+ rect: "rect";
389
+ circle: "circle";
390
+ "rounded-rect": "rounded-rect";
391
+ }>;
392
+ x: z.ZodNumber;
393
+ y: z.ZodNumber;
394
+ width: z.ZodNumber;
395
+ height: z.ZodNumber;
396
+ fill: z.ZodOptional<z.ZodString>;
397
+ opacity: z.ZodOptional<z.ZodNumber>;
398
+ }, z.core.$strip>, z.ZodObject<{
399
+ type: z.ZodLiteral<"logo">;
400
+ x: z.ZodNumber;
401
+ y: z.ZodNumber;
402
+ width: z.ZodOptional<z.ZodNumber>;
403
+ }, z.core.$strip>], "type">>;
404
+ }, z.core.$strip>;
405
+ }, z.core.$strip>, z.ZodObject<{
406
+ type: z.ZodLiteral<"countdown">;
407
+ durationSeconds: z.ZodNumber;
408
+ from: z.ZodNumber;
409
+ label: z.ZodOptional<z.ZodString>;
410
+ }, z.core.$strip>], "type">>;
411
+ audioUrl: z.ZodOptional<z.ZodString>;
412
+ captions: z.ZodOptional<z.ZodArray<z.ZodObject<{
413
+ startSeconds: z.ZodNumber;
414
+ endSeconds: z.ZodNumber;
415
+ text: z.ZodString;
416
+ }, z.core.$strip>>>;
417
+ renderedUrl: z.ZodOptional<z.ZodString>;
418
+ }, z.core.$strip>;
419
+ declare const CopyContentSchema: z.ZodObject<{
420
+ headline: z.ZodString;
421
+ body: z.ZodString;
422
+ hashtags: z.ZodOptional<z.ZodArray<z.ZodString>>;
423
+ platform: z.ZodEnum<{
424
+ instagram: "instagram";
425
+ tiktok: "tiktok";
426
+ x: "x";
427
+ linkedin: "linkedin";
428
+ sms: "sms";
429
+ "email-subject": "email-subject";
430
+ }>;
431
+ characterCount: z.ZodOptional<z.ZodNumber>;
432
+ }, z.core.$strip>;
433
+ declare const ApprovalEventSchema: z.ZodObject<{
434
+ assetId: z.ZodString;
435
+ variantId: z.ZodOptional<z.ZodString>;
436
+ action: z.ZodEnum<{
437
+ approved: "approved";
438
+ rejected: "rejected";
439
+ scheduled: "scheduled";
440
+ edited: "edited";
441
+ }>;
442
+ editedFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
443
+ userId: z.ZodString;
444
+ timestamp: z.ZodString;
445
+ }, z.core.$strip>;
446
+ declare const ConversionMetricsSchema: z.ZodObject<{
447
+ impressions: z.ZodNumber;
448
+ clicks: z.ZodNumber;
449
+ conversions: z.ZodNumber;
450
+ ctr: z.ZodNumber;
451
+ cvr: z.ZodNumber;
452
+ }, z.core.$strip>;
453
+ /**
454
+ * Validates an unknown value as an AssetSpec, including format-specific
455
+ * content validation. Throws ZodError on invalid input.
456
+ */
457
+ declare function parseAssetSpec(raw: unknown): AssetSpec;
458
+ /**
459
+ * Safe parse — returns null instead of throwing.
460
+ */
461
+ declare function safeParseAssetSpec(raw: unknown): AssetSpec | null;
462
+
463
+ export { type ApprovalEvent, ApprovalEventSchema, type AssetContentMap, type AssetFormat, type AssetSpec, type AssetStatus, type AssetVariant, type BrandTokens, BrandTokensSchema, type ConversionMetrics, ConversionMetricsSchema, type CopyContent, CopyContentSchema, type CopyPlatform, type EmailBodySection, type EmailContent, EmailContentSchema, type EmailCtaSection, type EmailDividerSection, type EmailFeatureSection, type EmailHeroSection, type EmailSection, type EmailTestimonialSection, type ImageBackground, type ImageContent, ImageContentSchema, type ImageImageLayer, type ImageLayer, type ImageLayerType, type ImageLogoLayer, type ImageShapeLayer, type ImageSlide, type ImageTextLayer, type VideoCaption, type VideoContent, VideoContentSchema, type VideoCountdownScene, type VideoImageRevealScene, type VideoScene, type VideoSlideScene, type VideoTextAnimationScene, parseAssetSpec, safeParseAssetSpec };
@@ -0,0 +1,23 @@
1
+ import {
2
+ ApprovalEventSchema,
3
+ BrandTokensSchema,
4
+ ConversionMetricsSchema,
5
+ CopyContentSchema,
6
+ EmailContentSchema,
7
+ ImageContentSchema,
8
+ VideoContentSchema,
9
+ parseAssetSpec,
10
+ safeParseAssetSpec
11
+ } from "../chunk-5PTGEJZL.js";
12
+ export {
13
+ ApprovalEventSchema,
14
+ BrandTokensSchema,
15
+ ConversionMetricsSchema,
16
+ CopyContentSchema,
17
+ EmailContentSchema,
18
+ ImageContentSchema,
19
+ VideoContentSchema,
20
+ parseAssetSpec,
21
+ safeParseAssetSpec
22
+ };
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,236 @@
1
+ // src/assets/schema.ts
2
+ import { z } from "zod";
3
+ var BrandTokensSchema = z.object({
4
+ primaryColor: z.string(),
5
+ accentColor: z.string(),
6
+ textColor: z.string(),
7
+ fontFamily: z.string(),
8
+ logoUrl: z.string().optional(),
9
+ businessName: z.string(),
10
+ voice: z.string()
11
+ });
12
+ var EmailHeroSectionSchema = z.object({
13
+ type: z.literal("hero"),
14
+ headline: z.string(),
15
+ subheadline: z.string().optional(),
16
+ imageUrl: z.string().optional(),
17
+ ctaLabel: z.string().optional(),
18
+ ctaUrl: z.string().optional()
19
+ });
20
+ var EmailBodySectionSchema = z.object({
21
+ type: z.literal("body"),
22
+ text: z.string()
23
+ });
24
+ var EmailFeatureSectionSchema = z.object({
25
+ type: z.literal("feature"),
26
+ headline: z.string(),
27
+ description: z.string(),
28
+ imageUrl: z.string().optional()
29
+ });
30
+ var EmailTestimonialSectionSchema = z.object({
31
+ type: z.literal("testimonial"),
32
+ quote: z.string(),
33
+ author: z.string(),
34
+ role: z.string().optional(),
35
+ avatarUrl: z.string().optional()
36
+ });
37
+ var EmailCtaSectionSchema = z.object({
38
+ type: z.literal("cta"),
39
+ label: z.string(),
40
+ url: z.string(),
41
+ subtext: z.string().optional()
42
+ });
43
+ var EmailDividerSectionSchema = z.object({
44
+ type: z.literal("divider")
45
+ });
46
+ var EmailSectionSchema = z.discriminatedUnion("type", [
47
+ EmailHeroSectionSchema,
48
+ EmailBodySectionSchema,
49
+ EmailFeatureSectionSchema,
50
+ EmailTestimonialSectionSchema,
51
+ EmailCtaSectionSchema,
52
+ EmailDividerSectionSchema
53
+ ]);
54
+ var EmailContentSchema = z.object({
55
+ subject: z.string(),
56
+ preheader: z.string().optional(),
57
+ sections: z.array(EmailSectionSchema)
58
+ });
59
+ var ImageBackgroundSchema = z.discriminatedUnion("type", [
60
+ z.object({ type: z.literal("color"), value: z.string() }),
61
+ z.object({ type: z.literal("gradient"), from: z.string(), to: z.string(), direction: z.string().optional() }),
62
+ z.object({ type: z.literal("image"), url: z.string(), overlay: z.string().optional(), overlayOpacity: z.number().optional() })
63
+ ]);
64
+ var ImageTextLayerSchema = z.object({
65
+ type: z.literal("text"),
66
+ text: z.string(),
67
+ fontSize: z.number().optional(),
68
+ fontWeight: z.enum(["normal", "bold"]).optional(),
69
+ color: z.string().optional(),
70
+ x: z.number(),
71
+ y: z.number(),
72
+ width: z.number().optional(),
73
+ align: z.enum(["left", "center", "right"]).optional()
74
+ });
75
+ var ImageImageLayerSchema = z.object({
76
+ type: z.literal("image"),
77
+ url: z.string(),
78
+ x: z.number(),
79
+ y: z.number(),
80
+ width: z.number(),
81
+ height: z.number(),
82
+ opacity: z.number().optional()
83
+ });
84
+ var ImageShapeLayerSchema = z.object({
85
+ type: z.literal("shape"),
86
+ shape: z.enum(["rect", "circle", "rounded-rect"]),
87
+ x: z.number(),
88
+ y: z.number(),
89
+ width: z.number(),
90
+ height: z.number(),
91
+ fill: z.string().optional(),
92
+ opacity: z.number().optional()
93
+ });
94
+ var ImageLogoLayerSchema = z.object({
95
+ type: z.literal("logo"),
96
+ x: z.number(),
97
+ y: z.number(),
98
+ width: z.number().optional()
99
+ });
100
+ var ImageLayerSchema = z.discriminatedUnion("type", [
101
+ ImageTextLayerSchema,
102
+ ImageImageLayerSchema,
103
+ ImageShapeLayerSchema,
104
+ ImageLogoLayerSchema
105
+ ]);
106
+ var ImageSlideSchema = z.object({
107
+ background: ImageBackgroundSchema,
108
+ layers: z.array(ImageLayerSchema)
109
+ });
110
+ var ImageContentSchema = z.object({
111
+ slides: z.array(ImageSlideSchema).min(1)
112
+ });
113
+ var VideoTextAnimationSceneSchema = z.object({
114
+ type: z.literal("text-animation"),
115
+ durationSeconds: z.number().positive(),
116
+ headline: z.string(),
117
+ subtext: z.string().optional(),
118
+ animation: z.enum(["fade", "slide-up", "typewriter"]).optional(),
119
+ background: ImageBackgroundSchema.optional()
120
+ });
121
+ var VideoImageRevealSceneSchema = z.object({
122
+ type: z.literal("image-reveal"),
123
+ durationSeconds: z.number().positive(),
124
+ imageUrl: z.string(),
125
+ caption: z.string().optional()
126
+ });
127
+ var VideoSlideSceneSchema = z.object({
128
+ type: z.literal("slide"),
129
+ durationSeconds: z.number().positive(),
130
+ slide: ImageSlideSchema
131
+ });
132
+ var VideoCountdownSceneSchema = z.object({
133
+ type: z.literal("countdown"),
134
+ durationSeconds: z.number().positive(),
135
+ from: z.number().int().positive(),
136
+ label: z.string().optional()
137
+ });
138
+ var VideoSceneSchema = z.discriminatedUnion("type", [
139
+ VideoTextAnimationSceneSchema,
140
+ VideoImageRevealSceneSchema,
141
+ VideoSlideSceneSchema,
142
+ VideoCountdownSceneSchema
143
+ ]);
144
+ var VideoCaptionSchema = z.object({
145
+ startSeconds: z.number().nonnegative(),
146
+ endSeconds: z.number().positive(),
147
+ text: z.string()
148
+ });
149
+ var VideoContentSchema = z.object({
150
+ durationSeconds: z.number().positive(),
151
+ scenes: z.array(VideoSceneSchema).min(1),
152
+ audioUrl: z.string().optional(),
153
+ captions: z.array(VideoCaptionSchema).optional(),
154
+ renderedUrl: z.string().optional()
155
+ });
156
+ var CopyContentSchema = z.object({
157
+ headline: z.string(),
158
+ body: z.string(),
159
+ hashtags: z.array(z.string()).optional(),
160
+ platform: z.enum(["instagram", "tiktok", "x", "linkedin", "sms", "email-subject"]),
161
+ characterCount: z.number().optional()
162
+ });
163
+ var ApprovalEventSchema = z.object({
164
+ assetId: z.string(),
165
+ variantId: z.string().optional(),
166
+ action: z.enum(["approved", "rejected", "edited", "scheduled"]),
167
+ editedFields: z.array(z.string()).optional(),
168
+ userId: z.string(),
169
+ timestamp: z.string()
170
+ });
171
+ var ConversionMetricsSchema = z.object({
172
+ impressions: z.number().nonnegative(),
173
+ clicks: z.number().nonnegative(),
174
+ conversions: z.number().nonnegative(),
175
+ ctr: z.number().nonnegative(),
176
+ cvr: z.number().nonnegative()
177
+ });
178
+ var AssetFormatValues = [
179
+ "email",
180
+ "image:feed",
181
+ "image:story",
182
+ "image:carousel",
183
+ "video:reel",
184
+ "video:feed",
185
+ "copy:caption",
186
+ "copy:headline",
187
+ "copy:sms"
188
+ ];
189
+ var ContentSchemaByFormat = {
190
+ email: EmailContentSchema,
191
+ "image:feed": ImageContentSchema,
192
+ "image:story": ImageContentSchema,
193
+ "image:carousel": ImageContentSchema,
194
+ "video:reel": VideoContentSchema,
195
+ "video:feed": VideoContentSchema,
196
+ "copy:caption": CopyContentSchema,
197
+ "copy:headline": CopyContentSchema,
198
+ "copy:sms": CopyContentSchema
199
+ };
200
+ var AssetSpecBaseSchema = z.object({
201
+ id: z.string(),
202
+ workspaceId: z.string(),
203
+ campaignId: z.string().optional(),
204
+ format: z.enum(AssetFormatValues),
205
+ brand: BrandTokensSchema,
206
+ status: z.enum(["draft", "pending_review", "approved", "rejected", "scheduled", "published"]),
207
+ scheduledAt: z.string().optional(),
208
+ createdAt: z.string(),
209
+ updatedAt: z.string()
210
+ });
211
+ function parseAssetSpec(raw) {
212
+ const base = AssetSpecBaseSchema.parse(raw);
213
+ const contentSchema = ContentSchemaByFormat[base.format];
214
+ const content = contentSchema.parse(raw.content);
215
+ return { ...base, content };
216
+ }
217
+ function safeParseAssetSpec(raw) {
218
+ try {
219
+ return parseAssetSpec(raw);
220
+ } catch {
221
+ return null;
222
+ }
223
+ }
224
+
225
+ export {
226
+ BrandTokensSchema,
227
+ EmailContentSchema,
228
+ ImageContentSchema,
229
+ VideoContentSchema,
230
+ CopyContentSchema,
231
+ ApprovalEventSchema,
232
+ ConversionMetricsSchema,
233
+ parseAssetSpec,
234
+ safeParseAssetSpec
235
+ };
236
+ //# sourceMappingURL=chunk-5PTGEJZL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/assets/schema.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { AssetSpec, AssetFormat } from './types'\n\n// --- Brand ---\n\nexport const BrandTokensSchema = z.object({\n primaryColor: z.string(),\n accentColor: z.string(),\n textColor: z.string(),\n fontFamily: z.string(),\n logoUrl: z.string().optional(),\n businessName: z.string(),\n voice: z.string(),\n})\n\n// --- Email ---\n\nconst EmailHeroSectionSchema = z.object({\n type: z.literal('hero'),\n headline: z.string(),\n subheadline: z.string().optional(),\n imageUrl: z.string().optional(),\n ctaLabel: z.string().optional(),\n ctaUrl: z.string().optional(),\n})\n\nconst EmailBodySectionSchema = z.object({\n type: z.literal('body'),\n text: z.string(),\n})\n\nconst EmailFeatureSectionSchema = z.object({\n type: z.literal('feature'),\n headline: z.string(),\n description: z.string(),\n imageUrl: z.string().optional(),\n})\n\nconst EmailTestimonialSectionSchema = z.object({\n type: z.literal('testimonial'),\n quote: z.string(),\n author: z.string(),\n role: z.string().optional(),\n avatarUrl: z.string().optional(),\n})\n\nconst EmailCtaSectionSchema = z.object({\n type: z.literal('cta'),\n label: z.string(),\n url: z.string(),\n subtext: z.string().optional(),\n})\n\nconst EmailDividerSectionSchema = z.object({\n type: z.literal('divider'),\n})\n\nconst EmailSectionSchema = z.discriminatedUnion('type', [\n EmailHeroSectionSchema,\n EmailBodySectionSchema,\n EmailFeatureSectionSchema,\n EmailTestimonialSectionSchema,\n EmailCtaSectionSchema,\n EmailDividerSectionSchema,\n])\n\nexport const EmailContentSchema = z.object({\n subject: z.string(),\n preheader: z.string().optional(),\n sections: z.array(EmailSectionSchema),\n})\n\n// --- Image ---\n\nconst ImageBackgroundSchema = z.discriminatedUnion('type', [\n z.object({ type: z.literal('color'), value: z.string() }),\n z.object({ type: z.literal('gradient'), from: z.string(), to: z.string(), direction: z.string().optional() }),\n z.object({ type: z.literal('image'), url: z.string(), overlay: z.string().optional(), overlayOpacity: z.number().optional() }),\n])\n\nconst ImageTextLayerSchema = z.object({\n type: z.literal('text'),\n text: z.string(),\n fontSize: z.number().optional(),\n fontWeight: z.enum(['normal', 'bold']).optional(),\n color: z.string().optional(),\n x: z.number(),\n y: z.number(),\n width: z.number().optional(),\n align: z.enum(['left', 'center', 'right']).optional(),\n})\n\nconst ImageImageLayerSchema = z.object({\n type: z.literal('image'),\n url: z.string(),\n x: z.number(),\n y: z.number(),\n width: z.number(),\n height: z.number(),\n opacity: z.number().optional(),\n})\n\nconst ImageShapeLayerSchema = z.object({\n type: z.literal('shape'),\n shape: z.enum(['rect', 'circle', 'rounded-rect']),\n x: z.number(),\n y: z.number(),\n width: z.number(),\n height: z.number(),\n fill: z.string().optional(),\n opacity: z.number().optional(),\n})\n\nconst ImageLogoLayerSchema = z.object({\n type: z.literal('logo'),\n x: z.number(),\n y: z.number(),\n width: z.number().optional(),\n})\n\nconst ImageLayerSchema = z.discriminatedUnion('type', [\n ImageTextLayerSchema,\n ImageImageLayerSchema,\n ImageShapeLayerSchema,\n ImageLogoLayerSchema,\n])\n\nconst ImageSlideSchema = z.object({\n background: ImageBackgroundSchema,\n layers: z.array(ImageLayerSchema),\n})\n\nexport const ImageContentSchema = z.object({\n slides: z.array(ImageSlideSchema).min(1),\n})\n\n// --- Video ---\n\nconst VideoTextAnimationSceneSchema = z.object({\n type: z.literal('text-animation'),\n durationSeconds: z.number().positive(),\n headline: z.string(),\n subtext: z.string().optional(),\n animation: z.enum(['fade', 'slide-up', 'typewriter']).optional(),\n background: ImageBackgroundSchema.optional(),\n})\n\nconst VideoImageRevealSceneSchema = z.object({\n type: z.literal('image-reveal'),\n durationSeconds: z.number().positive(),\n imageUrl: z.string(),\n caption: z.string().optional(),\n})\n\nconst VideoSlideSceneSchema = z.object({\n type: z.literal('slide'),\n durationSeconds: z.number().positive(),\n slide: ImageSlideSchema,\n})\n\nconst VideoCountdownSceneSchema = z.object({\n type: z.literal('countdown'),\n durationSeconds: z.number().positive(),\n from: z.number().int().positive(),\n label: z.string().optional(),\n})\n\nconst VideoSceneSchema = z.discriminatedUnion('type', [\n VideoTextAnimationSceneSchema,\n VideoImageRevealSceneSchema,\n VideoSlideSceneSchema,\n VideoCountdownSceneSchema,\n])\n\nconst VideoCaptionSchema = z.object({\n startSeconds: z.number().nonnegative(),\n endSeconds: z.number().positive(),\n text: z.string(),\n})\n\nexport const VideoContentSchema = z.object({\n durationSeconds: z.number().positive(),\n scenes: z.array(VideoSceneSchema).min(1),\n audioUrl: z.string().optional(),\n captions: z.array(VideoCaptionSchema).optional(),\n renderedUrl: z.string().optional(),\n})\n\n// --- Copy ---\n\nexport const CopyContentSchema = z.object({\n headline: z.string(),\n body: z.string(),\n hashtags: z.array(z.string()).optional(),\n platform: z.enum(['instagram', 'tiktok', 'x', 'linkedin', 'sms', 'email-subject']),\n characterCount: z.number().optional(),\n})\n\n// --- Approval ---\n\nexport const ApprovalEventSchema = z.object({\n assetId: z.string(),\n variantId: z.string().optional(),\n action: z.enum(['approved', 'rejected', 'edited', 'scheduled']),\n editedFields: z.array(z.string()).optional(),\n userId: z.string(),\n timestamp: z.string(),\n})\n\nexport const ConversionMetricsSchema = z.object({\n impressions: z.number().nonnegative(),\n clicks: z.number().nonnegative(),\n conversions: z.number().nonnegative(),\n ctr: z.number().nonnegative(),\n cvr: z.number().nonnegative(),\n})\n\n// --- Content map for discriminated parse ---\n\nconst AssetFormatValues = [\n 'email',\n 'image:feed',\n 'image:story',\n 'image:carousel',\n 'video:reel',\n 'video:feed',\n 'copy:caption',\n 'copy:headline',\n 'copy:sms',\n] as const\n\nconst ContentSchemaByFormat = {\n email: EmailContentSchema,\n 'image:feed': ImageContentSchema,\n 'image:story': ImageContentSchema,\n 'image:carousel': ImageContentSchema,\n 'video:reel': VideoContentSchema,\n 'video:feed': VideoContentSchema,\n 'copy:caption': CopyContentSchema,\n 'copy:headline': CopyContentSchema,\n 'copy:sms': CopyContentSchema,\n} as const\n\nconst AssetSpecBaseSchema = z.object({\n id: z.string(),\n workspaceId: z.string(),\n campaignId: z.string().optional(),\n format: z.enum(AssetFormatValues),\n brand: BrandTokensSchema,\n status: z.enum(['draft', 'pending_review', 'approved', 'rejected', 'scheduled', 'published']),\n scheduledAt: z.string().optional(),\n createdAt: z.string(),\n updatedAt: z.string(),\n})\n\n/**\n * Validates an unknown value as an AssetSpec, including format-specific\n * content validation. Throws ZodError on invalid input.\n */\nexport function parseAssetSpec(raw: unknown): AssetSpec {\n const base = AssetSpecBaseSchema.parse(raw)\n const contentSchema = ContentSchemaByFormat[base.format]\n const content = contentSchema.parse((raw as Record<string, unknown>).content)\n return { ...base, content } as AssetSpec\n}\n\n/**\n * Safe parse — returns null instead of throwing.\n */\nexport function safeParseAssetSpec(raw: unknown): AssetSpec | null {\n try {\n return parseAssetSpec(raw)\n } catch {\n return null\n }\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAKX,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,cAAc,EAAE,OAAO;AA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BAAsB,EAAE,OAAO;AAAA,EACnC,IAAI,EAAE,OAAO;AAAA,EACb,aAAa,EAAE,OAAO;AAAA,EACtB,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,QAAQ,EAAE,KAAK,iBAAiB;AAAA,EAChC,OAAO;AAAA,EACP,QAAQ,EAAE,KAAK,CAAC,SAAS,kBAAkB,YAAY,YAAY,aAAa,WAAW,CAAC;AAAA,EAC5F,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,WAAW,EAAE,OAAO;AAAA,EACpB,WAAW,EAAE,OAAO;AACtB,CAAC;AAMM,SAAS,eAAe,KAAyB;AACtD,QAAM,OAAO,oBAAoB,MAAM,GAAG;AAC1C,QAAM,gBAAgB,sBAAsB,KAAK,MAAM;AACvD,QAAM,UAAU,cAAc,MAAO,IAAgC,OAAO;AAC5E,SAAO,EAAE,GAAG,MAAM,QAAQ;AAC5B;AAKO,SAAS,mBAAmB,KAAgC;AACjE,MAAI;AACF,WAAO,eAAe,GAAG;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
package/dist/index.d.ts CHANGED
@@ -16,7 +16,9 @@ export { HubExecClient, HubExecClientOptions, HubExecErrorCode, HubExecResult, H
16
16
  export { CompleteMissionInput, CreateMissionInput, DEFAULT_MISSION_STEP_KINDS, InMemoryMissionStore, MISSION_CONTROL_CHANNEL_ID, MissionApprovalsPort, MissionAuditEvent, MissionConcurrencyError, MissionCostLedger, MissionEngine, MissionEngineOptions, MissionEventSink, MissionGateKind, MissionGateOptions, MissionGateProposal, MissionOutcome, MissionPlanRunOptions, MissionProposalResolution, MissionRecord, MissionService, MissionServiceOptions, MissionState, MissionStatus, MissionStep, MissionStepState, MissionStepStatus, MissionStorePort, MissionStreamEvent, MissionStreamStatus, MissionStreamStep, MissionStreamStepStatus, MissionUpdateGuard, MissionUpdatePatch, ParseMissionBlocksOptions, ParsedMission, ParsedMissionStep, PlanOutcome, RetryableStepError, SandboxDispatch, SandboxDispatchDoneResult, SandboxDispatchInProgressResult, SandboxDispatchInput, SandboxDispatchResult, SetStepStatusPatch, StepGateClassification, StepOutcome, applyMissionEvent, asMissionStreamEvent, budgetGateProposalId, buildAgentMissionPlan, createInMemoryMissionStore, createMissionEngine, createMissionService, isMissionStopRequested, isMissionTerminal, mergeMissionState, noopEventSink, parseMissionBlocks, parseSessionStreamEnvelope, reduceMissionEvents, stepGateProposalId, volumeGateProposalId } from './missions/index.js';
17
17
  export { CookieOptions, JsonObject, KvLike, RateLimitResult, RequestContext, SecurityHeaderOptions, addSecurityHeaders, checkRateLimit, clearCookieHeader, extractRequestContext, parseJsonObjectBody, readCookieValue, requireString, serializeCookie } from './web/index.js';
18
18
  export { BuildRedactedDocumentOptions, DEFAULT_REDACTION_PATTERNS, RedactForIngestionOptions, RedactedDocSegment, RedactedDocument, RedactionPattern, RedactionSpan, RevealResult, RevealSpanOptions, buildRedactedDocument, detectSpans, maskSpans, redactForIngestion, revealSpan } from './redact/index.js';
19
+ export { ApprovalEvent, ApprovalEventSchema, AssetContentMap, AssetFormat, AssetSpec, AssetStatus, AssetVariant, BrandTokens, BrandTokensSchema, ConversionMetrics, ConversionMetricsSchema, CopyContent, CopyContentSchema, CopyPlatform, EmailBodySection, EmailContent, EmailContentSchema, EmailCtaSection, EmailDividerSection, EmailFeatureSection, EmailHeroSection, EmailSection, EmailTestimonialSection, ImageBackground, ImageContent, ImageContentSchema, ImageImageLayer, ImageLayer, ImageLayerType, ImageLogoLayer, ImageShapeLayer, ImageSlide, ImageTextLayer, VideoCaption, VideoContent, VideoContentSchema, VideoCountdownScene, VideoImageRevealScene, VideoScene, VideoSlideScene, VideoTextAnimationScene, parseAssetSpec, safeParseAssetSpec } from './assets/index.js';
19
20
  export { C as CatalogModel, M as ModelCatalog, R as RouterModel, _ as __resetCatalogCache, b as buildCatalog, f as fetchModelCatalog, n as normalizeModelId } from './model-catalog-BEAEVDaa.js';
20
21
  export { CompletionRequirement, CompletionVerdict, CorrectnessChecker, ProducedState, RuntimeEventLike, SatisfiedBy, TaskGold, createLlmCorrectnessChecker, extractProducedState, verifyCompletion, weightedComposite } from '@tangle-network/agent-eval';
21
22
  export { C as CreateTangleRouterModelConfigOptions, D as DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR, a as DEFAULT_TANGLE_ROUTER_BASE_URL, R as ResolveModelOptions, b as ResolveUserTangleExecutionKeyForUserOptions, c as ResolveUserTangleExecutionKeyOptions, d as ResolvedTangleExecutionKey, T as TangleBillingEnforcementOptions, e as TangleExecutionEnvironment, f as TangleExecutionKeyError, g as TangleExecutionKeyErrorCode, h as TangleExecutionKeyHttpError, i as TangleExecutionKeySource, j as TangleModelConfig, k as createTangleRouterModelConfig, l as isTangleBillingEnforcementDisabled, m as isTangleExecutionKeyError, r as resolveTangleExecutionEnvironment, n as resolveTangleModelConfig, o as resolveUserTangleExecutionKey, p as resolveUserTangleExecutionKeyForUser, t as tangleExecutionKeyHttpError } from './model-CKzniMMr.js';
22
23
  import '@tangle-network/agent-knowledge';
24
+ import 'zod';
package/dist/index.js CHANGED
@@ -38,6 +38,17 @@ import {
38
38
  redactForIngestion,
39
39
  revealSpan
40
40
  } from "./chunk-5RMIUJDI.js";
41
+ import {
42
+ ApprovalEventSchema,
43
+ BrandTokensSchema,
44
+ ConversionMetricsSchema,
45
+ CopyContentSchema,
46
+ EmailContentSchema,
47
+ ImageContentSchema,
48
+ VideoContentSchema,
49
+ parseAssetSpec,
50
+ safeParseAssetSpec
51
+ } from "./chunk-5PTGEJZL.js";
41
52
  import {
42
53
  createKnowledgeLoop,
43
54
  createReviewerDecider,
@@ -176,6 +187,10 @@ import {
176
187
  } from "./chunk-ZXNXAQAH.js";
177
188
  export {
178
189
  APP_TOOL_NAMES,
190
+ ApprovalEventSchema,
191
+ BrandTokensSchema,
192
+ ConversionMetricsSchema,
193
+ CopyContentSchema,
179
194
  DEFAULT_APP_TOOL_PATHS,
180
195
  DEFAULT_HARNESS,
181
196
  DEFAULT_HEADER_NAMES,
@@ -185,7 +200,9 @@ export {
185
200
  DEFAULT_TANGLE_ROUTER_BASE_URL,
186
201
  DELEGATION_MCP_SERVER_KEY,
187
202
  DELEGATION_TOOLS,
203
+ EmailContentSchema,
188
204
  HubExecClient,
205
+ ImageContentSchema,
189
206
  KNOWN_HARNESSES,
190
207
  MISSION_CONTROL_CHANNEL_ID,
191
208
  MissionConcurrencyError,
@@ -195,6 +212,7 @@ export {
195
212
  TURN_EVENTS_MIGRATION_SQL,
196
213
  TangleExecutionKeyError,
197
214
  ToolInputError,
215
+ VideoContentSchema,
198
216
  __resetCatalogCache,
199
217
  addSecurityHeaders,
200
218
  agentAppConfigJsonSchema,
@@ -281,6 +299,7 @@ export {
281
299
  normalizeTime,
282
300
  normalizeToolEvent,
283
301
  outcomeStatus,
302
+ parseAssetSpec,
284
303
  parseJsonObjectBody,
285
304
  parseMissionBlocks,
286
305
  parseSessionStreamEnvelope,
@@ -304,6 +323,7 @@ export {
304
323
  revealSpan,
305
324
  reviewCandidate,
306
325
  runAppToolLoop,
326
+ safeParseAssetSpec,
307
327
  serializeCookie,
308
328
  stepGateProposalId,
309
329
  streamAppToolLoop,
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.7.2",
4
- "packageManager": "pnpm@10.33.4",
5
- "description": "Application-shell framework for Tangle agent products: a bounded tool loop, the structured agent\u2192app tool side channel, integration-hub client, per-workspace billing, and crypto \u2014 composed over the Tangle agent substrate through typed seams.",
3
+ "version": "0.8.0",
4
+ "description": "Application-shell framework for Tangle agent products: a bounded tool loop, the structured agent→app tool side channel, integration-hub client, per-workspace billing, and crypto — composed over the Tangle agent substrate through typed seams.",
6
5
  "keywords": [
7
6
  "tangle",
8
7
  "ai-agent",
@@ -141,26 +140,23 @@
141
140
  "types": "./dist/store/index.d.ts",
142
141
  "import": "./dist/store/index.js",
143
142
  "default": "./dist/store/index.js"
143
+ },
144
+ "./assets": {
145
+ "types": "./dist/assets/index.d.ts",
146
+ "import": "./dist/assets/index.js",
147
+ "default": "./dist/assets/index.js"
144
148
  }
145
149
  },
146
- "scripts": {
147
- "build": "tsup",
148
- "dev": "tsup --watch",
149
- "prepare": "tsup",
150
- "test": "vitest run",
151
- "test:watch": "vitest",
152
- "typecheck": "tsc --noEmit"
153
- },
154
150
  "devDependencies": {
155
151
  "@tangle-network/agent-eval": "^0.82.0",
156
152
  "@tangle-network/agent-integrations": "^0.32.0",
157
153
  "@tangle-network/agent-knowledge": "^1.5.2",
158
154
  "@types/node": "^25.6.0",
155
+ "@types/react": "^19.0.0",
156
+ "react": "^19.0.0",
159
157
  "tsup": "^8.0.0",
160
158
  "typescript": "^5.7.0",
161
- "vitest": "^3.0.0",
162
- "react": "^19.0.0",
163
- "@types/react": "^19.0.0"
159
+ "vitest": "^3.0.0"
164
160
  },
165
161
  "peerDependencies": {
166
162
  "@tangle-network/agent-eval": ">=0.82.0",
@@ -179,5 +175,15 @@
179
175
  "react": {
180
176
  "optional": true
181
177
  }
178
+ },
179
+ "dependencies": {
180
+ "zod": "^4.4.3"
181
+ },
182
+ "scripts": {
183
+ "build": "tsup",
184
+ "dev": "tsup --watch",
185
+ "test": "vitest run",
186
+ "test:watch": "vitest",
187
+ "typecheck": "tsc --noEmit"
182
188
  }
183
- }
189
+ }