@vettly/shared 0.1.9

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,795 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Shared types and Zod schemas for unified moderation API
5
+ */
6
+
7
+ declare const ContentTypeSchema: z.ZodEnum<["text", "image", "video"]>;
8
+ type ContentType = z.infer<typeof ContentTypeSchema>;
9
+ declare const UseCaseTypeSchema: z.ZodEnum<["social_post", "comment", "profile", "message", "review", "listing", "bio", "other"]>;
10
+ type UseCaseType = z.infer<typeof UseCaseTypeSchema>;
11
+ declare const CategorySchema: z.ZodEnum<["hate_speech", "harassment", "violence", "self_harm", "sexual", "spam", "profanity", "scam", "illegal"]>;
12
+ type Category = z.infer<typeof CategorySchema>;
13
+ declare const ProviderNameSchema: z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>;
14
+ type ProviderName = z.infer<typeof ProviderNameSchema>;
15
+ interface ProviderResult {
16
+ provider: ProviderName;
17
+ flagged: boolean;
18
+ categories: Partial<Record<Category, number>>;
19
+ confidence?: number;
20
+ latency: number;
21
+ cost: number;
22
+ raw?: unknown;
23
+ }
24
+ declare const ActionSchema: z.ZodEnum<["block", "warn", "flag", "allow"]>;
25
+ type Action = z.infer<typeof ActionSchema>;
26
+ declare const RuleSchema: z.ZodEffects<z.ZodObject<{
27
+ category: z.ZodEnum<["hate_speech", "harassment", "violence", "self_harm", "sexual", "spam", "profanity", "scam", "illegal"]>;
28
+ threshold: z.ZodNumber;
29
+ provider: z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>;
30
+ action: z.ZodEnum<["block", "warn", "flag", "allow"]>;
31
+ priority: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
32
+ customPrompt: z.ZodOptional<z.ZodString>;
33
+ customCategory: z.ZodOptional<z.ZodString>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
36
+ threshold: number;
37
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
38
+ action: "block" | "warn" | "flag" | "allow";
39
+ priority: number;
40
+ customPrompt?: string | undefined;
41
+ customCategory?: string | undefined;
42
+ }, {
43
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
44
+ threshold: number;
45
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
46
+ action: "block" | "warn" | "flag" | "allow";
47
+ priority?: number | undefined;
48
+ customPrompt?: string | undefined;
49
+ customCategory?: string | undefined;
50
+ }>, {
51
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
52
+ threshold: number;
53
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
54
+ action: "block" | "warn" | "flag" | "allow";
55
+ priority: number;
56
+ customPrompt?: string | undefined;
57
+ customCategory?: string | undefined;
58
+ }, {
59
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
60
+ threshold: number;
61
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
62
+ action: "block" | "warn" | "flag" | "allow";
63
+ priority?: number | undefined;
64
+ customPrompt?: string | undefined;
65
+ customCategory?: string | undefined;
66
+ }>;
67
+ type Rule = z.infer<typeof RuleSchema>;
68
+ declare const OverrideSchema: z.ZodObject<{
69
+ locale: z.ZodOptional<z.ZodString>;
70
+ region: z.ZodOptional<z.ZodString>;
71
+ data_residency: z.ZodOptional<z.ZodString>;
72
+ provider: z.ZodOptional<z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ provider?: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback" | undefined;
75
+ locale?: string | undefined;
76
+ region?: string | undefined;
77
+ data_residency?: string | undefined;
78
+ }, {
79
+ provider?: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback" | undefined;
80
+ locale?: string | undefined;
81
+ region?: string | undefined;
82
+ data_residency?: string | undefined;
83
+ }>;
84
+ type Override = z.infer<typeof OverrideSchema>;
85
+ declare const FallbackConfigSchema: z.ZodObject<{
86
+ provider: z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>;
87
+ on_timeout: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
88
+ timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
91
+ on_timeout: boolean;
92
+ timeout_ms: number;
93
+ }, {
94
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
95
+ on_timeout?: boolean | undefined;
96
+ timeout_ms?: number | undefined;
97
+ }>;
98
+ type FallbackConfig = z.infer<typeof FallbackConfigSchema>;
99
+ declare const PolicySchema: z.ZodObject<{
100
+ name: z.ZodString;
101
+ version: z.ZodString;
102
+ rules: z.ZodArray<z.ZodEffects<z.ZodObject<{
103
+ category: z.ZodEnum<["hate_speech", "harassment", "violence", "self_harm", "sexual", "spam", "profanity", "scam", "illegal"]>;
104
+ threshold: z.ZodNumber;
105
+ provider: z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>;
106
+ action: z.ZodEnum<["block", "warn", "flag", "allow"]>;
107
+ priority: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
108
+ customPrompt: z.ZodOptional<z.ZodString>;
109
+ customCategory: z.ZodOptional<z.ZodString>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
112
+ threshold: number;
113
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
114
+ action: "block" | "warn" | "flag" | "allow";
115
+ priority: number;
116
+ customPrompt?: string | undefined;
117
+ customCategory?: string | undefined;
118
+ }, {
119
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
120
+ threshold: number;
121
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
122
+ action: "block" | "warn" | "flag" | "allow";
123
+ priority?: number | undefined;
124
+ customPrompt?: string | undefined;
125
+ customCategory?: string | undefined;
126
+ }>, {
127
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
128
+ threshold: number;
129
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
130
+ action: "block" | "warn" | "flag" | "allow";
131
+ priority: number;
132
+ customPrompt?: string | undefined;
133
+ customCategory?: string | undefined;
134
+ }, {
135
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
136
+ threshold: number;
137
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
138
+ action: "block" | "warn" | "flag" | "allow";
139
+ priority?: number | undefined;
140
+ customPrompt?: string | undefined;
141
+ customCategory?: string | undefined;
142
+ }>, "many">;
143
+ overrides: z.ZodOptional<z.ZodArray<z.ZodObject<{
144
+ locale: z.ZodOptional<z.ZodString>;
145
+ region: z.ZodOptional<z.ZodString>;
146
+ data_residency: z.ZodOptional<z.ZodString>;
147
+ provider: z.ZodOptional<z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ provider?: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback" | undefined;
150
+ locale?: string | undefined;
151
+ region?: string | undefined;
152
+ data_residency?: string | undefined;
153
+ }, {
154
+ provider?: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback" | undefined;
155
+ locale?: string | undefined;
156
+ region?: string | undefined;
157
+ data_residency?: string | undefined;
158
+ }>, "many">>;
159
+ fallback: z.ZodOptional<z.ZodObject<{
160
+ provider: z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>;
161
+ on_timeout: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
162
+ timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
165
+ on_timeout: boolean;
166
+ timeout_ms: number;
167
+ }, {
168
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
169
+ on_timeout?: boolean | undefined;
170
+ timeout_ms?: number | undefined;
171
+ }>>;
172
+ }, "strip", z.ZodTypeAny, {
173
+ name: string;
174
+ version: string;
175
+ rules: {
176
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
177
+ threshold: number;
178
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
179
+ action: "block" | "warn" | "flag" | "allow";
180
+ priority: number;
181
+ customPrompt?: string | undefined;
182
+ customCategory?: string | undefined;
183
+ }[];
184
+ fallback?: {
185
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
186
+ on_timeout: boolean;
187
+ timeout_ms: number;
188
+ } | undefined;
189
+ overrides?: {
190
+ provider?: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback" | undefined;
191
+ locale?: string | undefined;
192
+ region?: string | undefined;
193
+ data_residency?: string | undefined;
194
+ }[] | undefined;
195
+ }, {
196
+ name: string;
197
+ version: string;
198
+ rules: {
199
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
200
+ threshold: number;
201
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
202
+ action: "block" | "warn" | "flag" | "allow";
203
+ priority?: number | undefined;
204
+ customPrompt?: string | undefined;
205
+ customCategory?: string | undefined;
206
+ }[];
207
+ fallback?: {
208
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
209
+ on_timeout?: boolean | undefined;
210
+ timeout_ms?: number | undefined;
211
+ } | undefined;
212
+ overrides?: {
213
+ provider?: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback" | undefined;
214
+ locale?: string | undefined;
215
+ region?: string | undefined;
216
+ data_residency?: string | undefined;
217
+ }[] | undefined;
218
+ }>;
219
+ type Policy = z.infer<typeof PolicySchema>;
220
+ declare const DecisionSchema: z.ZodObject<{
221
+ id: z.ZodString;
222
+ content: z.ZodString;
223
+ contentHash: z.ZodString;
224
+ contentType: z.ZodEnum<["text", "image", "video"]>;
225
+ policy: z.ZodObject<{
226
+ id: z.ZodString;
227
+ version: z.ZodString;
228
+ }, "strip", z.ZodTypeAny, {
229
+ version: string;
230
+ id: string;
231
+ }, {
232
+ version: string;
233
+ id: string;
234
+ }>;
235
+ result: z.ZodObject<{
236
+ safe: z.ZodBoolean;
237
+ flagged: z.ZodBoolean;
238
+ action: z.ZodEnum<["block", "warn", "flag", "allow"]>;
239
+ categories: z.ZodArray<z.ZodObject<{
240
+ category: z.ZodEnum<["hate_speech", "harassment", "violence", "self_harm", "sexual", "spam", "profanity", "scam", "illegal"]>;
241
+ score: z.ZodNumber;
242
+ threshold: z.ZodNumber;
243
+ triggered: z.ZodBoolean;
244
+ }, "strip", z.ZodTypeAny, {
245
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
246
+ threshold: number;
247
+ score: number;
248
+ triggered: boolean;
249
+ }, {
250
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
251
+ threshold: number;
252
+ score: number;
253
+ triggered: boolean;
254
+ }>, "many">;
255
+ }, "strip", z.ZodTypeAny, {
256
+ action: "block" | "warn" | "flag" | "allow";
257
+ safe: boolean;
258
+ flagged: boolean;
259
+ categories: {
260
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
261
+ threshold: number;
262
+ score: number;
263
+ triggered: boolean;
264
+ }[];
265
+ }, {
266
+ action: "block" | "warn" | "flag" | "allow";
267
+ safe: boolean;
268
+ flagged: boolean;
269
+ categories: {
270
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
271
+ threshold: number;
272
+ score: number;
273
+ triggered: boolean;
274
+ }[];
275
+ }>;
276
+ provider: z.ZodObject<{
277
+ name: z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>;
278
+ latency: z.ZodNumber;
279
+ cost: z.ZodNumber;
280
+ }, "strip", z.ZodTypeAny, {
281
+ name: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
282
+ latency: number;
283
+ cost: number;
284
+ }, {
285
+ name: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
286
+ latency: number;
287
+ cost: number;
288
+ }>;
289
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
290
+ timestamp: z.ZodString;
291
+ requestId: z.ZodOptional<z.ZodString>;
292
+ }, "strip", z.ZodTypeAny, {
293
+ provider: {
294
+ name: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
295
+ latency: number;
296
+ cost: number;
297
+ };
298
+ id: string;
299
+ content: string;
300
+ contentHash: string;
301
+ contentType: "text" | "image" | "video";
302
+ policy: {
303
+ version: string;
304
+ id: string;
305
+ };
306
+ result: {
307
+ action: "block" | "warn" | "flag" | "allow";
308
+ safe: boolean;
309
+ flagged: boolean;
310
+ categories: {
311
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
312
+ threshold: number;
313
+ score: number;
314
+ triggered: boolean;
315
+ }[];
316
+ };
317
+ timestamp: string;
318
+ metadata?: Record<string, unknown> | undefined;
319
+ requestId?: string | undefined;
320
+ }, {
321
+ provider: {
322
+ name: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
323
+ latency: number;
324
+ cost: number;
325
+ };
326
+ id: string;
327
+ content: string;
328
+ contentHash: string;
329
+ contentType: "text" | "image" | "video";
330
+ policy: {
331
+ version: string;
332
+ id: string;
333
+ };
334
+ result: {
335
+ action: "block" | "warn" | "flag" | "allow";
336
+ safe: boolean;
337
+ flagged: boolean;
338
+ categories: {
339
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
340
+ threshold: number;
341
+ score: number;
342
+ triggered: boolean;
343
+ }[];
344
+ };
345
+ timestamp: string;
346
+ metadata?: Record<string, unknown> | undefined;
347
+ requestId?: string | undefined;
348
+ }>;
349
+ type Decision = z.infer<typeof DecisionSchema>;
350
+ declare const MultiModalCheckRequestSchema: z.ZodEffects<z.ZodObject<{
351
+ text: z.ZodOptional<z.ZodString>;
352
+ images: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
353
+ video: z.ZodOptional<z.ZodString>;
354
+ context: z.ZodOptional<z.ZodObject<{
355
+ useCase: z.ZodDefault<z.ZodEnum<["social_post", "comment", "profile", "message", "review", "listing", "bio", "other"]>>;
356
+ userId: z.ZodOptional<z.ZodString>;
357
+ userReputation: z.ZodOptional<z.ZodNumber>;
358
+ locale: z.ZodOptional<z.ZodString>;
359
+ region: z.ZodOptional<z.ZodString>;
360
+ }, "strip", z.ZodTypeAny, {
361
+ useCase: "message" | "social_post" | "comment" | "profile" | "review" | "listing" | "bio" | "other";
362
+ locale?: string | undefined;
363
+ region?: string | undefined;
364
+ userId?: string | undefined;
365
+ userReputation?: number | undefined;
366
+ }, {
367
+ locale?: string | undefined;
368
+ region?: string | undefined;
369
+ useCase?: "message" | "social_post" | "comment" | "profile" | "review" | "listing" | "bio" | "other" | undefined;
370
+ userId?: string | undefined;
371
+ userReputation?: number | undefined;
372
+ }>>;
373
+ policyId: z.ZodString;
374
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
375
+ requestId: z.ZodOptional<z.ZodString>;
376
+ }, "strip", z.ZodTypeAny, {
377
+ policyId: string;
378
+ text?: string | undefined;
379
+ video?: string | undefined;
380
+ metadata?: Record<string, unknown> | undefined;
381
+ requestId?: string | undefined;
382
+ images?: string[] | undefined;
383
+ context?: {
384
+ useCase: "message" | "social_post" | "comment" | "profile" | "review" | "listing" | "bio" | "other";
385
+ locale?: string | undefined;
386
+ region?: string | undefined;
387
+ userId?: string | undefined;
388
+ userReputation?: number | undefined;
389
+ } | undefined;
390
+ }, {
391
+ policyId: string;
392
+ text?: string | undefined;
393
+ video?: string | undefined;
394
+ metadata?: Record<string, unknown> | undefined;
395
+ requestId?: string | undefined;
396
+ images?: string[] | undefined;
397
+ context?: {
398
+ locale?: string | undefined;
399
+ region?: string | undefined;
400
+ useCase?: "message" | "social_post" | "comment" | "profile" | "review" | "listing" | "bio" | "other" | undefined;
401
+ userId?: string | undefined;
402
+ userReputation?: number | undefined;
403
+ } | undefined;
404
+ }>, {
405
+ policyId: string;
406
+ text?: string | undefined;
407
+ video?: string | undefined;
408
+ metadata?: Record<string, unknown> | undefined;
409
+ requestId?: string | undefined;
410
+ images?: string[] | undefined;
411
+ context?: {
412
+ useCase: "message" | "social_post" | "comment" | "profile" | "review" | "listing" | "bio" | "other";
413
+ locale?: string | undefined;
414
+ region?: string | undefined;
415
+ userId?: string | undefined;
416
+ userReputation?: number | undefined;
417
+ } | undefined;
418
+ }, {
419
+ policyId: string;
420
+ text?: string | undefined;
421
+ video?: string | undefined;
422
+ metadata?: Record<string, unknown> | undefined;
423
+ requestId?: string | undefined;
424
+ images?: string[] | undefined;
425
+ context?: {
426
+ locale?: string | undefined;
427
+ region?: string | undefined;
428
+ useCase?: "message" | "social_post" | "comment" | "profile" | "review" | "listing" | "bio" | "other" | undefined;
429
+ userId?: string | undefined;
430
+ userReputation?: number | undefined;
431
+ } | undefined;
432
+ }>;
433
+ type MultiModalCheckRequest = z.infer<typeof MultiModalCheckRequestSchema>;
434
+ declare const CheckRequestSchema: z.ZodObject<{
435
+ content: z.ZodString;
436
+ policyId: z.ZodString;
437
+ contentType: z.ZodDefault<z.ZodOptional<z.ZodEnum<["text", "image", "video"]>>>;
438
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
439
+ requestId: z.ZodOptional<z.ZodString>;
440
+ }, "strip", z.ZodTypeAny, {
441
+ content: string;
442
+ contentType: "text" | "image" | "video";
443
+ policyId: string;
444
+ metadata?: Record<string, unknown> | undefined;
445
+ requestId?: string | undefined;
446
+ }, {
447
+ content: string;
448
+ policyId: string;
449
+ contentType?: "text" | "image" | "video" | undefined;
450
+ metadata?: Record<string, unknown> | undefined;
451
+ requestId?: string | undefined;
452
+ }>;
453
+ type CheckRequest = z.infer<typeof CheckRequestSchema>;
454
+ declare const ContentItemResultSchema: z.ZodObject<{
455
+ contentType: z.ZodEnum<["text", "image", "video"]>;
456
+ contentRef: z.ZodOptional<z.ZodString>;
457
+ contentItemId: z.ZodOptional<z.ZodString>;
458
+ safe: z.ZodBoolean;
459
+ flagged: z.ZodBoolean;
460
+ action: z.ZodEnum<["block", "warn", "flag", "allow"]>;
461
+ categories: z.ZodArray<z.ZodObject<{
462
+ category: z.ZodEnum<["hate_speech", "harassment", "violence", "self_harm", "sexual", "spam", "profanity", "scam", "illegal"]>;
463
+ score: z.ZodNumber;
464
+ triggered: z.ZodBoolean;
465
+ }, "strip", z.ZodTypeAny, {
466
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
467
+ score: number;
468
+ triggered: boolean;
469
+ }, {
470
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
471
+ score: number;
472
+ triggered: boolean;
473
+ }>, "many">;
474
+ provider: z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>;
475
+ latency: z.ZodNumber;
476
+ cost: z.ZodNumber;
477
+ evidence: z.ZodOptional<z.ZodObject<{
478
+ url: z.ZodOptional<z.ZodString>;
479
+ expiresAt: z.ZodOptional<z.ZodString>;
480
+ }, "strip", z.ZodTypeAny, {
481
+ url?: string | undefined;
482
+ expiresAt?: string | undefined;
483
+ }, {
484
+ url?: string | undefined;
485
+ expiresAt?: string | undefined;
486
+ }>>;
487
+ }, "strip", z.ZodTypeAny, {
488
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
489
+ action: "block" | "warn" | "flag" | "allow";
490
+ contentType: "text" | "image" | "video";
491
+ safe: boolean;
492
+ flagged: boolean;
493
+ categories: {
494
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
495
+ score: number;
496
+ triggered: boolean;
497
+ }[];
498
+ latency: number;
499
+ cost: number;
500
+ contentRef?: string | undefined;
501
+ contentItemId?: string | undefined;
502
+ evidence?: {
503
+ url?: string | undefined;
504
+ expiresAt?: string | undefined;
505
+ } | undefined;
506
+ }, {
507
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
508
+ action: "block" | "warn" | "flag" | "allow";
509
+ contentType: "text" | "image" | "video";
510
+ safe: boolean;
511
+ flagged: boolean;
512
+ categories: {
513
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
514
+ score: number;
515
+ triggered: boolean;
516
+ }[];
517
+ latency: number;
518
+ cost: number;
519
+ contentRef?: string | undefined;
520
+ contentItemId?: string | undefined;
521
+ evidence?: {
522
+ url?: string | undefined;
523
+ expiresAt?: string | undefined;
524
+ } | undefined;
525
+ }>;
526
+ type ContentItemResult = z.infer<typeof ContentItemResultSchema>;
527
+ declare const MultiModalCheckResponseSchema: z.ZodObject<{
528
+ decisionId: z.ZodString;
529
+ safe: z.ZodBoolean;
530
+ flagged: z.ZodBoolean;
531
+ action: z.ZodEnum<["block", "warn", "flag", "allow"]>;
532
+ results: z.ZodArray<z.ZodObject<{
533
+ contentType: z.ZodEnum<["text", "image", "video"]>;
534
+ contentRef: z.ZodOptional<z.ZodString>;
535
+ contentItemId: z.ZodOptional<z.ZodString>;
536
+ safe: z.ZodBoolean;
537
+ flagged: z.ZodBoolean;
538
+ action: z.ZodEnum<["block", "warn", "flag", "allow"]>;
539
+ categories: z.ZodArray<z.ZodObject<{
540
+ category: z.ZodEnum<["hate_speech", "harassment", "violence", "self_harm", "sexual", "spam", "profanity", "scam", "illegal"]>;
541
+ score: z.ZodNumber;
542
+ triggered: z.ZodBoolean;
543
+ }, "strip", z.ZodTypeAny, {
544
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
545
+ score: number;
546
+ triggered: boolean;
547
+ }, {
548
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
549
+ score: number;
550
+ triggered: boolean;
551
+ }>, "many">;
552
+ provider: z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>;
553
+ latency: z.ZodNumber;
554
+ cost: z.ZodNumber;
555
+ evidence: z.ZodOptional<z.ZodObject<{
556
+ url: z.ZodOptional<z.ZodString>;
557
+ expiresAt: z.ZodOptional<z.ZodString>;
558
+ }, "strip", z.ZodTypeAny, {
559
+ url?: string | undefined;
560
+ expiresAt?: string | undefined;
561
+ }, {
562
+ url?: string | undefined;
563
+ expiresAt?: string | undefined;
564
+ }>>;
565
+ }, "strip", z.ZodTypeAny, {
566
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
567
+ action: "block" | "warn" | "flag" | "allow";
568
+ contentType: "text" | "image" | "video";
569
+ safe: boolean;
570
+ flagged: boolean;
571
+ categories: {
572
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
573
+ score: number;
574
+ triggered: boolean;
575
+ }[];
576
+ latency: number;
577
+ cost: number;
578
+ contentRef?: string | undefined;
579
+ contentItemId?: string | undefined;
580
+ evidence?: {
581
+ url?: string | undefined;
582
+ expiresAt?: string | undefined;
583
+ } | undefined;
584
+ }, {
585
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
586
+ action: "block" | "warn" | "flag" | "allow";
587
+ contentType: "text" | "image" | "video";
588
+ safe: boolean;
589
+ flagged: boolean;
590
+ categories: {
591
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
592
+ score: number;
593
+ triggered: boolean;
594
+ }[];
595
+ latency: number;
596
+ cost: number;
597
+ contentRef?: string | undefined;
598
+ contentItemId?: string | undefined;
599
+ evidence?: {
600
+ url?: string | undefined;
601
+ expiresAt?: string | undefined;
602
+ } | undefined;
603
+ }>, "many">;
604
+ totalLatency: z.ZodNumber;
605
+ totalCost: z.ZodNumber;
606
+ requestId: z.ZodOptional<z.ZodString>;
607
+ }, "strip", z.ZodTypeAny, {
608
+ action: "block" | "warn" | "flag" | "allow";
609
+ safe: boolean;
610
+ flagged: boolean;
611
+ decisionId: string;
612
+ results: {
613
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
614
+ action: "block" | "warn" | "flag" | "allow";
615
+ contentType: "text" | "image" | "video";
616
+ safe: boolean;
617
+ flagged: boolean;
618
+ categories: {
619
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
620
+ score: number;
621
+ triggered: boolean;
622
+ }[];
623
+ latency: number;
624
+ cost: number;
625
+ contentRef?: string | undefined;
626
+ contentItemId?: string | undefined;
627
+ evidence?: {
628
+ url?: string | undefined;
629
+ expiresAt?: string | undefined;
630
+ } | undefined;
631
+ }[];
632
+ totalLatency: number;
633
+ totalCost: number;
634
+ requestId?: string | undefined;
635
+ }, {
636
+ action: "block" | "warn" | "flag" | "allow";
637
+ safe: boolean;
638
+ flagged: boolean;
639
+ decisionId: string;
640
+ results: {
641
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
642
+ action: "block" | "warn" | "flag" | "allow";
643
+ contentType: "text" | "image" | "video";
644
+ safe: boolean;
645
+ flagged: boolean;
646
+ categories: {
647
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
648
+ score: number;
649
+ triggered: boolean;
650
+ }[];
651
+ latency: number;
652
+ cost: number;
653
+ contentRef?: string | undefined;
654
+ contentItemId?: string | undefined;
655
+ evidence?: {
656
+ url?: string | undefined;
657
+ expiresAt?: string | undefined;
658
+ } | undefined;
659
+ }[];
660
+ totalLatency: number;
661
+ totalCost: number;
662
+ requestId?: string | undefined;
663
+ }>;
664
+ type MultiModalCheckResponse = z.infer<typeof MultiModalCheckResponseSchema>;
665
+ declare const CheckResponseSchema: z.ZodObject<{
666
+ decisionId: z.ZodString;
667
+ safe: z.ZodBoolean;
668
+ flagged: z.ZodBoolean;
669
+ action: z.ZodEnum<["block", "warn", "flag", "allow"]>;
670
+ categories: z.ZodArray<z.ZodObject<{
671
+ category: z.ZodEnum<["hate_speech", "harassment", "violence", "self_harm", "sexual", "spam", "profanity", "scam", "illegal"]>;
672
+ score: z.ZodNumber;
673
+ triggered: z.ZodBoolean;
674
+ }, "strip", z.ZodTypeAny, {
675
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
676
+ score: number;
677
+ triggered: boolean;
678
+ }, {
679
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
680
+ score: number;
681
+ triggered: boolean;
682
+ }>, "many">;
683
+ provider: z.ZodEnum<["openai", "perspective", "hive", "azure", "bot_detection", "gemini_vision", "mock", "fallback"]>;
684
+ latency: z.ZodNumber;
685
+ cost: z.ZodNumber;
686
+ requestId: z.ZodOptional<z.ZodString>;
687
+ }, "strip", z.ZodTypeAny, {
688
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
689
+ action: "block" | "warn" | "flag" | "allow";
690
+ safe: boolean;
691
+ flagged: boolean;
692
+ categories: {
693
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
694
+ score: number;
695
+ triggered: boolean;
696
+ }[];
697
+ latency: number;
698
+ cost: number;
699
+ decisionId: string;
700
+ requestId?: string | undefined;
701
+ }, {
702
+ provider: "openai" | "perspective" | "hive" | "azure" | "bot_detection" | "gemini_vision" | "mock" | "fallback";
703
+ action: "block" | "warn" | "flag" | "allow";
704
+ safe: boolean;
705
+ flagged: boolean;
706
+ categories: {
707
+ category: "hate_speech" | "harassment" | "violence" | "self_harm" | "sexual" | "spam" | "profanity" | "scam" | "illegal";
708
+ score: number;
709
+ triggered: boolean;
710
+ }[];
711
+ latency: number;
712
+ cost: number;
713
+ decisionId: string;
714
+ requestId?: string | undefined;
715
+ }>;
716
+ type CheckResponse = z.infer<typeof CheckResponseSchema>;
717
+ declare const ReplayRequestSchema: z.ZodObject<{
718
+ decisionId: z.ZodString;
719
+ policyId: z.ZodString;
720
+ }, "strip", z.ZodTypeAny, {
721
+ policyId: string;
722
+ decisionId: string;
723
+ }, {
724
+ policyId: string;
725
+ decisionId: string;
726
+ }>;
727
+ type ReplayRequest = z.infer<typeof ReplayRequestSchema>;
728
+ declare class ModerationError extends Error {
729
+ code: string;
730
+ statusCode: number;
731
+ details?: unknown | undefined;
732
+ constructor(message: string, code: string, statusCode?: number, details?: unknown | undefined);
733
+ }
734
+ declare class PolicyValidationError extends ModerationError {
735
+ constructor(message: string, details?: unknown);
736
+ }
737
+ declare class ProviderError extends ModerationError {
738
+ constructor(message: string, provider: ProviderName, details?: Record<string, unknown>);
739
+ }
740
+ declare const WebhookEventTypeSchema: z.ZodEnum<["decision.created", "decision.flagged", "decision.blocked", "policy.created", "policy.updated"]>;
741
+ type WebhookEventType = z.infer<typeof WebhookEventTypeSchema>;
742
+ declare const WebhookEndpointSchema: z.ZodObject<{
743
+ url: z.ZodEffects<z.ZodString, string, string>;
744
+ events: z.ZodArray<z.ZodEnum<["decision.created", "decision.flagged", "decision.blocked", "policy.created", "policy.updated"]>, "many">;
745
+ description: z.ZodOptional<z.ZodString>;
746
+ }, "strip", z.ZodTypeAny, {
747
+ url: string;
748
+ events: ("decision.created" | "decision.flagged" | "decision.blocked" | "policy.created" | "policy.updated")[];
749
+ description?: string | undefined;
750
+ }, {
751
+ url: string;
752
+ events: ("decision.created" | "decision.flagged" | "decision.blocked" | "policy.created" | "policy.updated")[];
753
+ description?: string | undefined;
754
+ }>;
755
+ type WebhookEndpoint = z.infer<typeof WebhookEndpointSchema>;
756
+ type JsonPrimitive = string | number | boolean | null;
757
+ type JsonArray = JsonValue[];
758
+ type JsonObject = {
759
+ [key: string]: JsonValue;
760
+ };
761
+ type JsonValue = JsonPrimitive | JsonObject | JsonArray;
762
+ interface ModerationContext {
763
+ userId?: string;
764
+ sessionId?: string;
765
+ locale?: string;
766
+ region?: string;
767
+ metadata?: Record<string, unknown>;
768
+ }
769
+
770
+ /**
771
+ * Generate a SHA256 hash of content
772
+ */
773
+ declare function hashContent(content: string): string;
774
+ /**
775
+ * Generate a UUID v4
776
+ */
777
+ declare function generateUUID(): string;
778
+ /**
779
+ * Generate a request ID for idempotency
780
+ */
781
+ declare function generateRequestId(): string;
782
+ /**
783
+ * Calculate policy version hash from YAML content
784
+ */
785
+ declare function calculatePolicyVersion(yaml: string): string;
786
+ /**
787
+ * Format cost in USD
788
+ */
789
+ declare function formatCost(cost: number): string;
790
+ /**
791
+ * Format latency in ms
792
+ */
793
+ declare function formatLatency(ms: number): string;
794
+
795
+ export { type Action, ActionSchema, type Category, CategorySchema, type CheckRequest, CheckRequestSchema, type CheckResponse, CheckResponseSchema, type ContentItemResult, ContentItemResultSchema, type ContentType, ContentTypeSchema, type Decision, DecisionSchema, type FallbackConfig, FallbackConfigSchema, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ModerationContext, ModerationError, type MultiModalCheckRequest, MultiModalCheckRequestSchema, type MultiModalCheckResponse, MultiModalCheckResponseSchema, type Override, OverrideSchema, type Policy, PolicySchema, PolicyValidationError, ProviderError, type ProviderName, ProviderNameSchema, type ProviderResult, type ReplayRequest, ReplayRequestSchema, type Rule, RuleSchema, type UseCaseType, UseCaseTypeSchema, type WebhookEndpoint, WebhookEndpointSchema, type WebhookEventType, WebhookEventTypeSchema, calculatePolicyVersion, formatCost, formatLatency, generateRequestId, generateUUID, hashContent };