@crowdstrike/aidr 1.0.2

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.
Files changed (51) hide show
  1. package/.editorconfig +9 -0
  2. package/.github/CODEOWNERS +1 -0
  3. package/.github/workflows/ci.yml +128 -0
  4. package/.pnpmfile.cjs +17 -0
  5. package/.releaserc.json +21 -0
  6. package/LICENSE.txt +21 -0
  7. package/README.md +3 -0
  8. package/biome.json +67 -0
  9. package/dist/chunk.cjs +34 -0
  10. package/dist/index.cjs +356 -0
  11. package/dist/index.d.cts +2347 -0
  12. package/dist/index.d.mts +2347 -0
  13. package/dist/index.mjs +354 -0
  14. package/dist/schemas/ai-guard.cjs +1000 -0
  15. package/dist/schemas/ai-guard.d.cts +1232 -0
  16. package/dist/schemas/ai-guard.d.mts +1232 -0
  17. package/dist/schemas/ai-guard.mjs +907 -0
  18. package/dist/schemas/index.cjs +7 -0
  19. package/dist/schemas/index.d.cts +64 -0
  20. package/dist/schemas/index.d.mts +64 -0
  21. package/dist/schemas/index.mjs +3 -0
  22. package/dist/schemas.cjs +139 -0
  23. package/dist/schemas.mjs +108 -0
  24. package/flake.lock +59 -0
  25. package/flake.nix +26 -0
  26. package/openapi-ts.config.ts +15 -0
  27. package/package.json +55 -0
  28. package/pnpm-workspace.yaml +3 -0
  29. package/scripts/generate-models +15 -0
  30. package/scripts/test +10 -0
  31. package/specs/ai-guard.openapi.json +3721 -0
  32. package/src/client.ts +441 -0
  33. package/src/core/error.ts +78 -0
  34. package/src/index.ts +2 -0
  35. package/src/internal/builtin-types.ts +18 -0
  36. package/src/internal/errors.ts +34 -0
  37. package/src/internal/headers.ts +100 -0
  38. package/src/internal/parse.ts +30 -0
  39. package/src/internal/request-options.ts +57 -0
  40. package/src/internal/types.ts +3 -0
  41. package/src/internal/utils/sleep.ts +3 -0
  42. package/src/internal/utils/values.ts +38 -0
  43. package/src/schemas/ai-guard.ts +1215 -0
  44. package/src/schemas/index.ts +114 -0
  45. package/src/services/ai-guard.ts +27 -0
  46. package/src/types/ai-guard.ts +2276 -0
  47. package/src/types/index.ts +161 -0
  48. package/tests/ai-guard.test.ts +29 -0
  49. package/tsconfig.json +26 -0
  50. package/tsdown.config.mts +14 -0
  51. package/vitest.config.mts +4 -0
@@ -0,0 +1,2347 @@
1
+ //#region src/internal/builtin-types.d.ts
2
+ type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
3
+ //#endregion
4
+ //#region src/internal/headers.d.ts
5
+ type HeaderValue = string | undefined | null;
6
+ type NullableHeaders = {
7
+ /** Brand check, prevent users from creating a NullableHeaders. */
8
+ [brand_privateNullableHeaders]: true;
9
+ /** Parsed headers. */
10
+ values: Headers;
11
+ /** Set of lowercase header names explicitly set to null. */
12
+ nulls: Set<string>;
13
+ };
14
+ type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | NullableHeaders;
15
+ declare const brand_privateNullableHeaders: unique symbol;
16
+ //#endregion
17
+ //#region src/internal/types.d.ts
18
+ type PromiseOrValue<T> = T | Promise<T>;
19
+ //#endregion
20
+ //#region src/internal/request-options.d.ts
21
+ type RequestOptions = {
22
+ /** Query parameters to include in the request URL. */
23
+ query?: object | undefined | null;
24
+ /**
25
+ * The request body. Can be a string, JSON object, FormData, or other
26
+ * supported types.
27
+ */
28
+ body?: unknown;
29
+ /**
30
+ * The maximum number of times that the client will retry a request in case of
31
+ * a temporary failure, like a network error or a 5XX error from the server.
32
+ *
33
+ * @default 2
34
+ */
35
+ maxRetries?: number;
36
+ /**
37
+ * The maximum number of times that the client will poll for an async request
38
+ * result when receiving a HTTP/202 response.
39
+ *
40
+ * @default 5
41
+ */
42
+ maxPollingAttempts?: number;
43
+ /**
44
+ * The maximum amount of time (in milliseconds) that the client should wait
45
+ * for a response from the server before timing out a single request.
46
+ *
47
+ * @unit milliseconds
48
+ */
49
+ timeout?: number;
50
+ /**
51
+ * Template for constructing the base URL for API requests. The placeholder
52
+ * `{SERVICE_NAME}` will be replaced with the service name slug.
53
+ */
54
+ baseURLTemplate?: string;
55
+ /**
56
+ * HTTP headers to include with the request. Can be a Headers object, plain
57
+ * object, or array of tuples.
58
+ */
59
+ headers?: HeadersLike;
60
+ /** An AbortSignal that can be used to cancel the request. */
61
+ signal?: AbortSignal | undefined | null;
62
+ };
63
+ //#endregion
64
+ //#region src/types/ai-guard.d.ts
65
+ /** biome-ignore-all lint/style/useConsistentArrayType: generated. */
66
+ /**
67
+ * Response Schema
68
+ *
69
+ * Pangea standard response schema
70
+ */
71
+ type PangeaResponse = {
72
+ /**
73
+ * A unique identifier assigned to each request made to the API. It is used to track and identify a specific request and its associated data. The `request_id` can be helpful for troubleshooting, auditing, and tracing the flow of requests within the system. It allows users to reference and retrieve information related to a particular request, such as the response, parameters, and raw data associated with that specific request.
74
+ *
75
+ * ```
76
+ * "request_id":"prq_x6fdiizbon6j3bsdvnpmwxsz2aan7fqd"
77
+ * ```
78
+ */
79
+ request_id: string;
80
+ /**
81
+ * The timestamp indicates the exact moment when a request is made to the API. It represents the date and time at which the request was initiated by the client. The `request_time` is useful for tracking and analyzing the timing of requests, measuring response times, and monitoring performance metrics. It allows users to determine the duration between the request initiation and the corresponding response, aiding in the assessment of API performance and latency.
82
+ *
83
+ * ```
84
+ * "request_time":"2022-09-21T17:24:33.105Z"
85
+ * ```
86
+ */
87
+ request_time: string;
88
+ /**
89
+ * Duration it takes for the API to process a request and generate a response. It represents the elapsed time from when the request is received by the API to when the corresponding response is returned to the client.
90
+ *
91
+ * ```
92
+ * "response_time":"2022-09-21T17:24:34.007Z"
93
+ * ```
94
+ */
95
+ response_time: string;
96
+ /**
97
+ * It represents the status or outcome of the API request made for IP information. It indicates the current state or condition of the request and provides information on the success or failure of the request.
98
+ *
99
+ * ```
100
+ * "status":"success"
101
+ * ```
102
+ */
103
+ status: string;
104
+ /**
105
+ * Provides a concise and brief overview of the purpose or primary objective of the API endpoint. It serves as a high-level summary or description of the functionality or feature offered by the endpoint.
106
+ */
107
+ summary?: string;
108
+ result?: {
109
+ [key: string]: unknown;
110
+ };
111
+ };
112
+ type PangeaValidationErrors = PangeaResponse;
113
+ /**
114
+ * Device status. Allowed values are active, pending, disabled
115
+ */
116
+ type AidrDeviceStatus = 'pending' | 'active' | 'disabled';
117
+ type AidrIpv4OrV6 = string;
118
+ type AidrDevice = {
119
+ /**
120
+ * client generated unique ID.
121
+ */
122
+ id: string;
123
+ /**
124
+ * Device name
125
+ */
126
+ name?: string;
127
+ status?: AidrDeviceStatus;
128
+ /**
129
+ * Arbitrary device metadata.
130
+ */
131
+ metadata?: {
132
+ [key: string]: unknown;
133
+ };
134
+ /**
135
+ * Owning user identifier.
136
+ */
137
+ user_id?: string;
138
+ /**
139
+ * Last observed IP address for this device.
140
+ */
141
+ last_used_ip?: AidrIpv4OrV6;
142
+ };
143
+ type AidrDeviceCheckResult = {
144
+ device?: AidrDeviceResult;
145
+ config?: AidrServiceConfigResult;
146
+ access_token?: AidrDeviceTokenInfo;
147
+ };
148
+ type AidrDeviceTokenInfo = {
149
+ /**
150
+ * The access token issued for given device.
151
+ */
152
+ token?: string;
153
+ /**
154
+ * The lifetime in seconds of the access token.
155
+ */
156
+ expires_in?: number;
157
+ /**
158
+ * Timestamp when the record when token is created (RFC 3339 format)
159
+ */
160
+ created_at?: string;
161
+ };
162
+ type AidrDeviceResult = {
163
+ /**
164
+ * client generated unique ID.
165
+ */
166
+ id: string;
167
+ /**
168
+ * Device name
169
+ */
170
+ name?: string;
171
+ status: AidrDeviceStatus;
172
+ /**
173
+ * Arbitrary device metadata.
174
+ */
175
+ metadata?: {
176
+ [key: string]: unknown;
177
+ };
178
+ /**
179
+ * Owning user identifier (UUID/string).
180
+ */
181
+ user_id?: string;
182
+ /**
183
+ * Last observed IP address for this device.
184
+ */
185
+ last_used_ip?: AidrIpv4OrV6;
186
+ /**
187
+ * Timestamp when the record was created (RFC 3339 format)
188
+ */
189
+ created_at?: string;
190
+ /**
191
+ * Timestamp when the record was last updated (RFC 3339 format)
192
+ */
193
+ updated_at?: string;
194
+ };
195
+ /**
196
+ * client generated unique ID.
197
+ */
198
+ type AidrDeviceId = string;
199
+ /**
200
+ * List or filter/search device records.
201
+ */
202
+ type AidrDeviceSearch = {
203
+ filter?: {
204
+ /**
205
+ * Only records where created_at equals this value.
206
+ */
207
+ created_at?: string;
208
+ /**
209
+ * Only records where created_at is greater than this value.
210
+ */
211
+ created_at__gt?: string;
212
+ /**
213
+ * Only records where created_at is greater than or equal to this value.
214
+ */
215
+ created_at__gte?: string;
216
+ /**
217
+ * Only records where created_at is less than this value.
218
+ */
219
+ created_at__lt?: string;
220
+ /**
221
+ * Only records where created_at is less than or equal to this value.
222
+ */
223
+ created_at__lte?: string;
224
+ /**
225
+ * Only records where updated_at equals this value.
226
+ */
227
+ updated_at?: string;
228
+ /**
229
+ * Only records where updated_at is greater than this value.
230
+ */
231
+ updated_at__gt?: string;
232
+ /**
233
+ * Only records where updated_at is greater than or equal to this value.
234
+ */
235
+ updated_at__gte?: string;
236
+ /**
237
+ * Only records where updated_at is less than this value.
238
+ */
239
+ updated_at__lt?: string;
240
+ /**
241
+ * Only records where updated_at is less than or equal to this value.
242
+ */
243
+ updated_at__lte?: string;
244
+ /**
245
+ * Only records where id is equal to the value
246
+ */
247
+ id?: string;
248
+ /**
249
+ * Only records where id includes each substring.
250
+ */
251
+ id__contains?: Array<string>;
252
+ /**
253
+ * Only records where id equals one of the provided substrings.
254
+ */
255
+ id__in?: Array<string>;
256
+ /**
257
+ * Only records where name is equal to the value
258
+ */
259
+ name?: string;
260
+ /**
261
+ * Only records where name includes each substring.
262
+ */
263
+ name__contains?: Array<string>;
264
+ /**
265
+ * Only records where name equals one of the provided substrings.
266
+ */
267
+ name__in?: Array<string>;
268
+ /**
269
+ * Only records where status is equal to the value
270
+ */
271
+ status?: AidrDeviceStatus;
272
+ /**
273
+ * Only records where status includes each substring.
274
+ */
275
+ status__contains?: Array<AidrDeviceStatus>;
276
+ /**
277
+ * Only records where status equals one of the provided substrings.
278
+ */
279
+ status__in?: Array<AidrDeviceStatus>;
280
+ };
281
+ /**
282
+ * Reflected value from a previous response to obtain the next page of results.
283
+ */
284
+ last?: string;
285
+ /**
286
+ * Order results asc(ending) or desc(ending).
287
+ */
288
+ order?: 'asc' | 'desc';
289
+ /**
290
+ * Which field to order results by.
291
+ */
292
+ order_by?: 'name' | 'created_at' | 'updated_at';
293
+ /**
294
+ * Maximum results to include in the response.
295
+ */
296
+ size?: number;
297
+ };
298
+ type AidrDeviceSearchResult = {
299
+ /**
300
+ * Pagination count of returned records
301
+ */
302
+ count?: number;
303
+ /**
304
+ * Pagination last cursor
305
+ */
306
+ last?: string;
307
+ devices?: Array<AidrDeviceResult>;
308
+ };
309
+ /**
310
+ * MetricEvent data
311
+ */
312
+ type AidrMetricOnlyData = {
313
+ /**
314
+ * Application ID
315
+ */
316
+ app_id?: string;
317
+ /**
318
+ * Actor/User ID
319
+ */
320
+ actor_id?: string;
321
+ /**
322
+ * LLM provider name
323
+ */
324
+ llm_provider?: string;
325
+ /**
326
+ * Model name
327
+ */
328
+ model?: string;
329
+ /**
330
+ * Version of the model
331
+ */
332
+ model_version?: string;
333
+ /**
334
+ * Number of tokens in the request
335
+ */
336
+ request_token_count?: number;
337
+ /**
338
+ * Number of tokens in the response
339
+ */
340
+ response_token_count?: number;
341
+ /**
342
+ * Source IP address
343
+ */
344
+ source_ip?: string;
345
+ /**
346
+ * Geographic source location
347
+ */
348
+ source_location?: string;
349
+ /**
350
+ * Type of event
351
+ */
352
+ event_type?: string;
353
+ /**
354
+ * Unique collector instance ID
355
+ */
356
+ collector_instance_id?: string;
357
+ /**
358
+ * Additional metadata as key-value pairs
359
+ */
360
+ extra_info?: {
361
+ [key: string]: unknown;
362
+ };
363
+ };
364
+ /**
365
+ * List or filter/search saved filter records.
366
+ */
367
+ type AidrSavedFilterSearch = {
368
+ filter?: {
369
+ /**
370
+ * Only records where created_at equals this value.
371
+ */
372
+ created_at?: string;
373
+ /**
374
+ * Only records where created_at is greater than this value.
375
+ */
376
+ created_at__gt?: string;
377
+ /**
378
+ * Only records where created_at is greater than or equal to this value.
379
+ */
380
+ created_at__gte?: string;
381
+ /**
382
+ * Only records where created_at is less than this value.
383
+ */
384
+ created_at__lt?: string;
385
+ /**
386
+ * Only records where created_at is less than or equal to this value.
387
+ */
388
+ created_at__lte?: string;
389
+ /**
390
+ * Only records where updated_at equals this value.
391
+ */
392
+ updated_at?: string;
393
+ /**
394
+ * Only records where updated_at is greater than this value.
395
+ */
396
+ updated_at__gt?: string;
397
+ /**
398
+ * Only records where updated_at is greater than or equal to this value.
399
+ */
400
+ updated_at__gte?: string;
401
+ /**
402
+ * Only records where updated_at is less than this value.
403
+ */
404
+ updated_at__lt?: string;
405
+ /**
406
+ * Only records where updated_at is less than or equal to this value.
407
+ */
408
+ updated_at__lte?: string;
409
+ /**
410
+ * Only records where id is equal to the value
411
+ */
412
+ id?: string;
413
+ /**
414
+ * Only records where id includes each substring.
415
+ */
416
+ id__contains?: Array<string>;
417
+ /**
418
+ * Only records where id equals one of the provided substrings.
419
+ */
420
+ id__in?: Array<string>;
421
+ /**
422
+ * Only records where name is equal to the value
423
+ */
424
+ name?: string;
425
+ /**
426
+ * Only records where name includes each substring.
427
+ */
428
+ name__contains?: Array<string>;
429
+ /**
430
+ * Only records where name equals one of the provided substrings.
431
+ */
432
+ name__in?: Array<string>;
433
+ };
434
+ /**
435
+ * Reflected value from a previous response to obtain the next page of results.
436
+ */
437
+ last?: string;
438
+ /**
439
+ * Order results asc(ending) or desc(ending).
440
+ */
441
+ order?: 'asc' | 'desc';
442
+ /**
443
+ * Which field to order results by.
444
+ */
445
+ order_by?: 'name' | 'created_at' | 'updated_at';
446
+ /**
447
+ * Maximum results to include in the response.
448
+ */
449
+ size?: number;
450
+ };
451
+ type AidrSavedFilterSearchResult = {
452
+ /**
453
+ * Pagination count of returned records
454
+ */
455
+ count?: number;
456
+ /**
457
+ * Pagination last cursor
458
+ */
459
+ last?: string;
460
+ saved_filters?: Array<AidrSavedFilterResult>;
461
+ };
462
+ type AidrSavedFilter = {
463
+ /**
464
+ * Unique name for the saved filter
465
+ */
466
+ name: string;
467
+ /**
468
+ * Filter details
469
+ */
470
+ filter: {
471
+ [key: string]: unknown;
472
+ };
473
+ };
474
+ type AidrSavedFilterResult = {
475
+ /**
476
+ * Unique name for the saved filter
477
+ */
478
+ name: string;
479
+ /**
480
+ * Filter details
481
+ */
482
+ filter: {
483
+ [key: string]: unknown;
484
+ };
485
+ /**
486
+ * Timestamp when the record was created (RFC 3339 format)
487
+ */
488
+ created_at: string;
489
+ /**
490
+ * Timestamp when the record was last updated (RFC 3339 format)
491
+ */
492
+ updated_at: string;
493
+ };
494
+ /**
495
+ * List or filter/search field alias records.
496
+ */
497
+ type AidrFieldAliasSearch = {
498
+ filter?: {
499
+ /**
500
+ * Only records where created_at equals this value.
501
+ */
502
+ created_at?: string;
503
+ /**
504
+ * Only records where created_at is greater than this value.
505
+ */
506
+ created_at__gt?: string;
507
+ /**
508
+ * Only records where created_at is greater than or equal to this value.
509
+ */
510
+ created_at__gte?: string;
511
+ /**
512
+ * Only records where created_at is less than this value.
513
+ */
514
+ created_at__lt?: string;
515
+ /**
516
+ * Only records where created_at is less than or equal to this value.
517
+ */
518
+ created_at__lte?: string;
519
+ /**
520
+ * Only records where field name is equal to the value
521
+ */
522
+ field_name?: string;
523
+ /**
524
+ * Only records where field name includes each substring.
525
+ */
526
+ field_name__contains?: Array<string>;
527
+ /**
528
+ * Only records where name equals one of the provided substrings.
529
+ */
530
+ field_name__in?: Array<string>;
531
+ /**
532
+ * Only records where field type equals this value.
533
+ */
534
+ field_type?: string;
535
+ /**
536
+ * Only records where field type includes each substring.
537
+ */
538
+ field_type__contains?: Array<string>;
539
+ /**
540
+ * Only records where field type equals one of the provided substrings.
541
+ */
542
+ field_type__in?: Array<string>;
543
+ /**
544
+ * Only records where field alias equals this value.
545
+ */
546
+ field_alias?: string;
547
+ /**
548
+ * Only records where field alias includes each substring.
549
+ */
550
+ field_alias__contains?: Array<string>;
551
+ /**
552
+ * Only records where field alias equals one of the provided substrings.
553
+ */
554
+ field_alias__in?: Array<string>;
555
+ /**
556
+ * Only records where updated_at equals this value.
557
+ */
558
+ updated_at?: string;
559
+ /**
560
+ * Only records where updated_at is greater than this value.
561
+ */
562
+ updated_at__gt?: string;
563
+ /**
564
+ * Only records where updated_at is greater than or equal to this value.
565
+ */
566
+ updated_at__gte?: string;
567
+ /**
568
+ * Only records where updated_at is less than this value.
569
+ */
570
+ updated_at__lt?: string;
571
+ /**
572
+ * Only records where updated_at is less than or equal to this value.
573
+ */
574
+ updated_at__lte?: string;
575
+ };
576
+ /**
577
+ * Reflected value from a previous response to obtain the next page of results.
578
+ */
579
+ last?: string;
580
+ /**
581
+ * Order results asc(ending) or desc(ending).
582
+ */
583
+ order?: 'asc' | 'desc';
584
+ /**
585
+ * Which field to order results by.
586
+ */
587
+ order_by?: 'field_name' | 'field_type' | 'created_at' | 'updated_at' | 'published_at' | 'field_alias';
588
+ /**
589
+ * Maximum results to include in the response.
590
+ */
591
+ size?: number;
592
+ };
593
+ type AidrFieldAliasSearchResult = {
594
+ /**
595
+ * Pagination limit
596
+ */
597
+ count?: number;
598
+ /**
599
+ * Pagination last count
600
+ */
601
+ last?: string;
602
+ items?: Array<AidrFieldAliasResult>;
603
+ };
604
+ type AidrCustomlist = {
605
+ /**
606
+ * Name of the list
607
+ */
608
+ name?: string;
609
+ /**
610
+ * Type of the list
611
+ */
612
+ type?: 'site';
613
+ /**
614
+ * Content of the list based on type
615
+ */
616
+ content?: Array<unknown>;
617
+ };
618
+ type ChatCompletionsGuard = {
619
+ /**
620
+ * 'messages' contains Prompt content and role array in JSON format. The `content` is the multimodel text or image input that will be analyzed. Additional properties such as 'tools' may be provided for analysis.
621
+ */
622
+ guard_input: {
623
+ [key: string]: unknown;
624
+ };
625
+ /**
626
+ * Id of source application/agent
627
+ */
628
+ app_id?: string;
629
+ /**
630
+ * User/Service account id/service account
631
+ */
632
+ user_id?: string;
633
+ /**
634
+ * Underlying LLM. Example: 'OpenAI'.
635
+ */
636
+ llm_provider?: string;
637
+ /**
638
+ * Model used to perform the event. Example: 'gpt'.
639
+ */
640
+ model?: string;
641
+ /**
642
+ * Model version used to perform the event. Example: '3.5'.
643
+ */
644
+ model_version?: string;
645
+ /**
646
+ * IP address of user or app or agent.
647
+ */
648
+ source_ip?: string;
649
+ /**
650
+ * Location of user or app or agent.
651
+ */
652
+ source_location?: string;
653
+ /**
654
+ * For gateway-like integrations with multi-tenant support.
655
+ */
656
+ tenant_id?: string;
657
+ /**
658
+ * (AIDR) Event Type.
659
+ */
660
+ event_type?: 'input' | 'output' | 'tool_input' | 'tool_output' | 'tool_listing';
661
+ /**
662
+ * (AIDR) collector instance id.
663
+ */
664
+ collector_instance_id?: string;
665
+ /**
666
+ * (AIDR) Logging schema.
667
+ */
668
+ extra_info?: {
669
+ /**
670
+ * Name of source application/agent.
671
+ */
672
+ app_name?: string;
673
+ /**
674
+ * The group of source application/agent.
675
+ */
676
+ app_group?: string;
677
+ /**
678
+ * Version of the source application/agent.
679
+ */
680
+ app_version?: string;
681
+ /**
682
+ * Name of subject actor/service account.
683
+ */
684
+ actor_name?: string;
685
+ /**
686
+ * The group of subject actor.
687
+ */
688
+ actor_group?: string;
689
+ /**
690
+ * Geographic region or data center.
691
+ */
692
+ source_region?: string;
693
+ /**
694
+ * Sub tenant of the user or organization
695
+ */
696
+ sub_tenant?: string;
697
+ /**
698
+ * MCP tools grouped by server
699
+ *
700
+ * Each item groups tools for a given MCP server.
701
+ */
702
+ mcp_tools?: Array<{
703
+ /**
704
+ * MCP server name
705
+ */
706
+ server_name: string;
707
+ tools: Array<string>;
708
+ }>;
709
+ [key: string]: unknown | string | Array<{
710
+ /**
711
+ * MCP server name
712
+ */
713
+ server_name: string;
714
+ tools: Array<string>;
715
+ }> | undefined;
716
+ };
717
+ };
718
+ type AidrPromptInjectionResult = {
719
+ /**
720
+ * The action taken by this Detector
721
+ */
722
+ action?: string;
723
+ /**
724
+ * Triggered prompt injection analyzers.
725
+ */
726
+ analyzer_responses?: Array<{
727
+ analyzer: string;
728
+ confidence: number;
729
+ }>;
730
+ };
731
+ type AidrRedactEntityResult = {
732
+ /**
733
+ * Detected redaction rules.
734
+ */
735
+ entities?: Array<{
736
+ /**
737
+ * The action taken on this Entity
738
+ */
739
+ action: string;
740
+ type: string;
741
+ value: string;
742
+ start_pos?: number;
743
+ }>;
744
+ };
745
+ type AidrMaliciousEntityResult = {
746
+ /**
747
+ * Detected harmful items.
748
+ */
749
+ entities?: Array<{
750
+ type: string;
751
+ value: string;
752
+ start_pos?: number;
753
+ raw?: {
754
+ [key: string]: unknown;
755
+ };
756
+ }>;
757
+ };
758
+ type AidrSingleEntityResult = {
759
+ /**
760
+ * The action taken by this Detector
761
+ */
762
+ action?: string;
763
+ /**
764
+ * Detected entities.
765
+ */
766
+ entities?: Array<string>;
767
+ };
768
+ type AidrLanguageResult = {
769
+ /**
770
+ * The action taken by this Detector
771
+ */
772
+ action?: string;
773
+ language?: string;
774
+ };
775
+ type AidrTopicResult = {
776
+ /**
777
+ * The action taken by this Detector
778
+ */
779
+ action?: string;
780
+ /**
781
+ * List of topics detected
782
+ */
783
+ topics?: Array<{
784
+ topic: string;
785
+ confidence: number;
786
+ }>;
787
+ };
788
+ /**
789
+ * Result of the recipe evaluating configured rules
790
+ */
791
+ type AidrAccessRulesResponse = {
792
+ [key: string]: unknown | AccessRuleResult;
793
+ };
794
+ type AidrPolicy = {
795
+ /**
796
+ * Unique identifier for the policy
797
+ */
798
+ key: string;
799
+ /**
800
+ * A friendly display name for the policy
801
+ */
802
+ name: string;
803
+ /**
804
+ * A detailed description for the policy
805
+ */
806
+ description?: string;
807
+ /**
808
+ * The schema version used for the policy definition
809
+ */
810
+ schema_version: 'v1.1';
811
+ /**
812
+ * Settings for Detectors, including which detectors to enable and how they behave
813
+ */
814
+ detector_settings?: DetectorSettings;
815
+ /**
816
+ * Configuration for access rules used in an AIDR policy.
817
+ */
818
+ access_rules?: Array<AccessRuleSettings>;
819
+ /**
820
+ * Connector-level Redact configuration. These settings allow you to define reusable redaction parameters, such as FPE tweak value.
821
+ */
822
+ connector_settings?: {
823
+ /**
824
+ * Settings for Redact integration at the policy level
825
+ */
826
+ redact?: {
827
+ /**
828
+ * ID of a Vault secret containing the tweak value used for Format-Preserving Encryption (FPE). Enables deterministic encryption, ensuring that identical inputs produce consistent encrypted outputs.
829
+ */
830
+ fpe_tweak_vault_secret_id?: string;
831
+ };
832
+ };
833
+ };
834
+ type AidrCustomlistResult = {
835
+ /**
836
+ * Unique identifier for the list
837
+ */
838
+ id?: string;
839
+ /**
840
+ * Name of the list
841
+ */
842
+ name?: string;
843
+ /**
844
+ * Type of the list
845
+ */
846
+ type?: 'site';
847
+ /**
848
+ * Content of the list
849
+ */
850
+ content?: Array<{
851
+ [key: string]: unknown;
852
+ }>;
853
+ created_at?: string;
854
+ updated_at?: string;
855
+ };
856
+ type AidrPolicyResult = {
857
+ id: PolicyId;
858
+ /**
859
+ * Unique identifier for the policy
860
+ */
861
+ key: string;
862
+ /**
863
+ * A friendly display name for the policy
864
+ */
865
+ name: string;
866
+ /**
867
+ * A detailed description for the policy
868
+ */
869
+ description?: string;
870
+ /**
871
+ * The schema version used for the policy definition
872
+ */
873
+ schema_version: 'v1.1';
874
+ /**
875
+ * The current revision of the policy
876
+ */
877
+ revision: number;
878
+ /**
879
+ * Settings for Detectors, including which detectors to enable and how they behave
880
+ */
881
+ detector_settings?: DetectorSettings;
882
+ /**
883
+ * Configuration for access rules used in an AIDR policy.
884
+ */
885
+ access_rules?: Array<AccessRuleSettings>;
886
+ /**
887
+ * Connector-level Redact configuration. These settings allow you to define reusable redaction parameters, such as FPE tweak value.
888
+ */
889
+ connector_settings?: {
890
+ /**
891
+ * Settings for Redact integration at the policy level
892
+ */
893
+ redact?: {
894
+ /**
895
+ * ID of a Vault secret containing the tweak value used for Format-Preserving Encryption (FPE). Enables deterministic encryption, ensuring that identical inputs produce consistent encrypted outputs.
896
+ */
897
+ fpe_tweak_vault_secret_id?: string;
898
+ };
899
+ };
900
+ /**
901
+ * Timestamp when the record was created (RFC 3339 format)
902
+ */
903
+ created_at?: string;
904
+ /**
905
+ * Timestamp when the record was last updated (RFC 3339 format)
906
+ */
907
+ updated_at?: string;
908
+ };
909
+ type AidrPolicyDefaults = {
910
+ default_policies: {
911
+ [key: string]: unknown | RecipeConfig;
912
+ };
913
+ };
914
+ /**
915
+ * List or filter/search policy records.
916
+ */
917
+ type AidrPolicySearch = {
918
+ filter?: {
919
+ /**
920
+ * Only records where key is equal to the value
921
+ */
922
+ key?: string;
923
+ /**
924
+ * Only records where key includes each substring.
925
+ */
926
+ key__contains?: Array<string>;
927
+ /**
928
+ * Only records where name equals one of the provided substrings.
929
+ */
930
+ name__in?: Array<string>;
931
+ /**
932
+ * Only records where status equals this value.
933
+ */
934
+ status?: string;
935
+ };
936
+ /**
937
+ * Reflected value from a previous response to obtain the next page of results.
938
+ */
939
+ last?: string;
940
+ /**
941
+ * Order results asc(ending) or desc(ending).
942
+ */
943
+ order?: 'asc' | 'desc';
944
+ /**
945
+ * Which field to order results by.
946
+ */
947
+ order_by?: 'key' | 'name' | 'created_at' | 'updated_at';
948
+ /**
949
+ * Maximum results to include in the response.
950
+ */
951
+ size?: number;
952
+ };
953
+ type AidrPolicySearchResult = {
954
+ /**
955
+ * Pagination limit
956
+ */
957
+ count?: number;
958
+ /**
959
+ * Pagination last count
960
+ */
961
+ last?: string;
962
+ policies?: Array<AidrPolicyResult>;
963
+ };
964
+ type AidrPromptItemListResult = {
965
+ policies?: Array<AidrPromptItem>;
966
+ };
967
+ type AidrPromptItem = {
968
+ /**
969
+ * Unique id for the item
970
+ */
971
+ id?: string;
972
+ /**
973
+ * Type for the item
974
+ */
975
+ type?: string;
976
+ /**
977
+ * Data for the item
978
+ */
979
+ content?: string;
980
+ };
981
+ type AidrFieldAlias = {
982
+ /**
983
+ * Unique name for the field
984
+ */
985
+ field_name: string;
986
+ /**
987
+ * Field type
988
+ */
989
+ field_type: string;
990
+ /**
991
+ * Alternate display name or alias
992
+ */
993
+ field_alias: string;
994
+ /**
995
+ * Array of tag strings
996
+ */
997
+ field_tags?: Array<string>;
998
+ };
999
+ type AidrFieldAliasResult = {
1000
+ /**
1001
+ * Unique name for the field
1002
+ */
1003
+ field_name: string;
1004
+ /**
1005
+ * Field type
1006
+ */
1007
+ field_type: string;
1008
+ /**
1009
+ * Alternate display name or alias
1010
+ */
1011
+ field_alias: string;
1012
+ /**
1013
+ * Array of tag strings
1014
+ */
1015
+ field_tags?: Array<string>;
1016
+ /**
1017
+ * Timestamp when the record was created (RFC 3339 format)
1018
+ */
1019
+ created_at: string;
1020
+ /**
1021
+ * Timestamp when the record was last updated (RFC 3339 format)
1022
+ */
1023
+ updated_at: string;
1024
+ };
1025
+ type AidrPolicycollectionResult = {
1026
+ /**
1027
+ * Unique identifier for the policy collection
1028
+ */
1029
+ key?: string;
1030
+ /**
1031
+ * Name of the policy collection
1032
+ */
1033
+ name?: string;
1034
+ /**
1035
+ * Type of the policy collection
1036
+ */
1037
+ type?: 'logging' | 'gateway' | 'browser' | 'application' | 'agentic';
1038
+ /**
1039
+ * Settings for the policy collection
1040
+ */
1041
+ settings?: {
1042
+ [key: string]: unknown;
1043
+ };
1044
+ created_at?: string;
1045
+ updated_at?: string;
1046
+ };
1047
+ /**
1048
+ * List or filter/search policy collection records.
1049
+ */
1050
+ type AidrPolicycollectionSearch = {
1051
+ filter?: {
1052
+ /**
1053
+ * Only records where created_at equals this value.
1054
+ */
1055
+ created_at?: string;
1056
+ /**
1057
+ * Only records where created_at is greater than this value.
1058
+ */
1059
+ created_at__gt?: string;
1060
+ /**
1061
+ * Only records where created_at is greater than or equal to this value.
1062
+ */
1063
+ created_at__gte?: string;
1064
+ /**
1065
+ * Only records where created_at is less than this value.
1066
+ */
1067
+ created_at__lt?: string;
1068
+ /**
1069
+ * Only records where created_at is less than or equal to this value.
1070
+ */
1071
+ created_at__lte?: string;
1072
+ /**
1073
+ * Only records where updated_at equals this value.
1074
+ */
1075
+ updated_at?: string;
1076
+ /**
1077
+ * Only records where updated_at is greater than this value.
1078
+ */
1079
+ updated_at__gt?: string;
1080
+ /**
1081
+ * Only records where updated_at is greater than or equal to this value.
1082
+ */
1083
+ updated_at__gte?: string;
1084
+ /**
1085
+ * Only records where updated_at is less than this value.
1086
+ */
1087
+ updated_at__lt?: string;
1088
+ /**
1089
+ * Only records where updated_at is less than or equal to this value.
1090
+ */
1091
+ updated_at__lte?: string;
1092
+ /**
1093
+ * Only records where type is equal to the value
1094
+ */
1095
+ type?: 'logging' | 'gateway' | 'browser' | 'application' | 'agentic';
1096
+ /**
1097
+ * Only records where type equals one of the provided values.
1098
+ */
1099
+ type__in?: Array<'logging' | 'gateway' | 'browser' | 'application' | 'agentic'>;
1100
+ /**
1101
+ * Only records where key is equal to the value
1102
+ */
1103
+ key?: string;
1104
+ /**
1105
+ * Only records where key includes each substring.
1106
+ */
1107
+ key__contains?: Array<string>;
1108
+ /**
1109
+ * Only records where key equals one of the provided substrings.
1110
+ */
1111
+ key__in?: Array<string>;
1112
+ /**
1113
+ * Only records where name is equal to the value
1114
+ */
1115
+ name?: string;
1116
+ /**
1117
+ * Only records where name includes each substring.
1118
+ */
1119
+ name__contains?: Array<string>;
1120
+ /**
1121
+ * Only records where name equals one of the provided substrings.
1122
+ */
1123
+ name__in?: Array<string>;
1124
+ };
1125
+ /**
1126
+ * Reflected value from a previous response to obtain the next page of results.
1127
+ */
1128
+ last?: string;
1129
+ /**
1130
+ * Order results asc(ending) or desc(ending).
1131
+ */
1132
+ order?: 'asc' | 'desc';
1133
+ /**
1134
+ * Which field to order results by.
1135
+ */
1136
+ order_by?: 'key' | 'name' | 'type' | 'created_at' | 'updated_at';
1137
+ /**
1138
+ * Maximum results to include in the response.
1139
+ */
1140
+ size?: number;
1141
+ };
1142
+ type AidrPolicycollectionSearchResult = {
1143
+ collections?: Array<AidrPolicycollectionResult>;
1144
+ /**
1145
+ * Total number of policy collections
1146
+ */
1147
+ count?: number;
1148
+ /**
1149
+ * Pagination cursor
1150
+ */
1151
+ last?: string;
1152
+ };
1153
+ /**
1154
+ * List or filter/search list records.
1155
+ */
1156
+ type AidrCustomlistSearch = {
1157
+ filter?: {
1158
+ /**
1159
+ * Only records where created_at equals this value.
1160
+ */
1161
+ created_at?: string;
1162
+ /**
1163
+ * Only records where created_at is greater than this value.
1164
+ */
1165
+ created_at__gt?: string;
1166
+ /**
1167
+ * Only records where created_at is greater than or equal to this value.
1168
+ */
1169
+ created_at__gte?: string;
1170
+ /**
1171
+ * Only records where created_at is less than this value.
1172
+ */
1173
+ created_at__lt?: string;
1174
+ /**
1175
+ * Only records where created_at is less than or equal to this value.
1176
+ */
1177
+ created_at__lte?: string;
1178
+ /**
1179
+ * Only records where updated_at equals this value.
1180
+ */
1181
+ updated_at?: string;
1182
+ /**
1183
+ * Only records where updated_at is greater than this value.
1184
+ */
1185
+ updated_at__gt?: string;
1186
+ /**
1187
+ * Only records where updated_at is greater than or equal to this value.
1188
+ */
1189
+ updated_at__gte?: string;
1190
+ /**
1191
+ * Only records where updated_at is less than this value.
1192
+ */
1193
+ updated_at__lt?: string;
1194
+ /**
1195
+ * Only records where updated_at is less than or equal to this value.
1196
+ */
1197
+ updated_at__lte?: string;
1198
+ /**
1199
+ * Only records where type is equal to the value
1200
+ */
1201
+ type?: string;
1202
+ /**
1203
+ * Only records where name is equal to the value
1204
+ */
1205
+ name?: string;
1206
+ /**
1207
+ * Only records where name includes each substring.
1208
+ */
1209
+ name__contains?: Array<string>;
1210
+ /**
1211
+ * Only records where name equals one of the provided substrings.
1212
+ */
1213
+ name__in?: Array<string>;
1214
+ };
1215
+ /**
1216
+ * Reflected value from a previous response to obtain the next page of results.
1217
+ */
1218
+ last?: string;
1219
+ /**
1220
+ * Order results asc(ending) or desc(ending).
1221
+ */
1222
+ order?: 'asc' | 'desc';
1223
+ /**
1224
+ * Which field to order results by.
1225
+ */
1226
+ order_by?: 'id' | 'name' | 'created_at' | 'updated_at';
1227
+ /**
1228
+ * Maximum results to include in the response.
1229
+ */
1230
+ size?: number;
1231
+ };
1232
+ type AidrCustomlistSearchResult = {
1233
+ lists?: Array<AidrCustomlistResult>;
1234
+ /**
1235
+ * Total number of lists
1236
+ */
1237
+ count?: number;
1238
+ /**
1239
+ * Pagination cursor
1240
+ */
1241
+ last?: string;
1242
+ };
1243
+ /**
1244
+ * AIDR Collector Summary list
1245
+ */
1246
+ type AidrSensorInsights = {
1247
+ /**
1248
+ * set to get instance level data
1249
+ */
1250
+ is_instance_data?: boolean;
1251
+ /**
1252
+ * Optional filters of the form `<field>__contains` or `<field>__in`
1253
+ */
1254
+ filters?: {
1255
+ /**
1256
+ * Only records where id equals this value.
1257
+ */
1258
+ collector_id?: string;
1259
+ /**
1260
+ * Only records where id includes each substring.
1261
+ */
1262
+ collector_id__contains?: Array<string>;
1263
+ /**
1264
+ * Only records where id equals one of the provided substrings.
1265
+ */
1266
+ collector_id__in?: Array<string>;
1267
+ /**
1268
+ * Only records where instance id equals this value.
1269
+ */
1270
+ instance_id?: string;
1271
+ /**
1272
+ * Only records where id includes each substring.
1273
+ */
1274
+ instance_id__contains?: Array<string>;
1275
+ /**
1276
+ * Only records where id equals one of the provided substrings.
1277
+ */
1278
+ instance_id__in?: Array<string>;
1279
+ /**
1280
+ * Only records where sensor type equals this value.
1281
+ */
1282
+ collector_type?: string;
1283
+ /**
1284
+ * Only records where id includes each substring.
1285
+ */
1286
+ collector_type_contains?: Array<string>;
1287
+ /**
1288
+ * Only records where id equals one of the provided substrings.
1289
+ */
1290
+ collector_type__in?: Array<string>;
1291
+ };
1292
+ /**
1293
+ * field to sort by
1294
+ */
1295
+ order_by?: string;
1296
+ /**
1297
+ * Sort direction (default: asc)
1298
+ */
1299
+ order?: 'asc' | 'desc';
1300
+ /**
1301
+ * Pagination limit
1302
+ */
1303
+ count?: number;
1304
+ /**
1305
+ * Pagination last count
1306
+ */
1307
+ last?: string;
1308
+ };
1309
+ /**
1310
+ * AIDR Collector Summary Result Data
1311
+ */
1312
+ type AidrSensorInsightsResult = {
1313
+ /**
1314
+ * Pagination limit
1315
+ */
1316
+ count?: number;
1317
+ /**
1318
+ * Pagination last count
1319
+ */
1320
+ last?: string;
1321
+ items?: Array<AidrSensorInsightsItem>;
1322
+ };
1323
+ /**
1324
+ * AIDR Collector Summary Result Data
1325
+ */
1326
+ type AidrSensorInsightsItem = {
1327
+ /**
1328
+ * latest updated time
1329
+ */
1330
+ updated_at: string;
1331
+ /**
1332
+ * created time
1333
+ */
1334
+ created_at: string;
1335
+ /**
1336
+ * total event counts
1337
+ */
1338
+ count: number;
1339
+ collector_id: ServiceConfigId;
1340
+ /**
1341
+ * Collector instance id
1342
+ */
1343
+ instance_id?: string;
1344
+ /**
1345
+ * collector type
1346
+ */
1347
+ collector_type: string;
1348
+ };
1349
+ /**
1350
+ * AIDR Service Config Settings
1351
+ */
1352
+ type AidrServiceConfig = {
1353
+ id?: ServiceConfigId;
1354
+ name?: string;
1355
+ version?: string;
1356
+ metric_pool_rid?: AidrMetricpoolId;
1357
+ updated_at?: AidrTimestamp;
1358
+ collector_type?: string;
1359
+ /**
1360
+ * Collector type specific settings.
1361
+ */
1362
+ settings?: {
1363
+ [key: string]: unknown;
1364
+ };
1365
+ warning_threshold?: AidrGolangDuration;
1366
+ in_active_threshold?: AidrGolangDuration;
1367
+ [key: string]: unknown | ServiceConfigId | string | AidrMetricpoolId | AidrTimestamp | {
1368
+ [key: string]: unknown;
1369
+ } | AidrGolangDuration | undefined;
1370
+ };
1371
+ /**
1372
+ * Duration string (e.g., '100ms', '2h')
1373
+ */
1374
+ type AidrGolangDuration = unknown | unknown;
1375
+ /**
1376
+ * List or filter/config records.
1377
+ */
1378
+ type AidrServiceConfigList = {
1379
+ filter?: {
1380
+ /**
1381
+ * Only records where name equals this value.
1382
+ */
1383
+ name?: string;
1384
+ /**
1385
+ * Only records where name includes each substring.
1386
+ */
1387
+ name__contains?: Array<string>;
1388
+ /**
1389
+ * Only records where name equals one of the provided substrings.
1390
+ */
1391
+ name__in?: Array<string>;
1392
+ /**
1393
+ * Only records where collector_type equals this value.
1394
+ */
1395
+ collector_type?: string;
1396
+ /**
1397
+ * Only records where collector_type includes each substring.
1398
+ */
1399
+ collector_type__contains?: Array<string>;
1400
+ /**
1401
+ * Only records where collector_type equals one of the provided substrings.
1402
+ */
1403
+ collector_type__in?: Array<string>;
1404
+ /**
1405
+ * Only records where id equals this value.
1406
+ */
1407
+ id?: string;
1408
+ /**
1409
+ * Only records where id includes each substring.
1410
+ */
1411
+ id__contains?: Array<string>;
1412
+ /**
1413
+ * Only records where id equals one of the provided substrings.
1414
+ */
1415
+ id__in?: Array<string>;
1416
+ /**
1417
+ * Only records where created_at equals this value.
1418
+ */
1419
+ created_at?: string;
1420
+ /**
1421
+ * Only records where created_at is greater than this value.
1422
+ */
1423
+ created_at__gt?: string;
1424
+ /**
1425
+ * Only records where created_at is greater than or equal to this value.
1426
+ */
1427
+ created_at__gte?: string;
1428
+ /**
1429
+ * Only records where created_at is less than this value.
1430
+ */
1431
+ created_at__lt?: string;
1432
+ /**
1433
+ * Only records where created_at is less than or equal to this value.
1434
+ */
1435
+ created_at__lte?: string;
1436
+ /**
1437
+ * Only records where updated_at equals this value.
1438
+ */
1439
+ updated_at?: string;
1440
+ /**
1441
+ * Only records where updated_at is greater than this value.
1442
+ */
1443
+ updated_at__gt?: string;
1444
+ /**
1445
+ * Only records where updated_at is greater than or equal to this value.
1446
+ */
1447
+ updated_at__gte?: string;
1448
+ /**
1449
+ * Only records where updated_at is less than this value.
1450
+ */
1451
+ updated_at__lt?: string;
1452
+ /**
1453
+ * Only records where updated_at is less than or equal to this value.
1454
+ */
1455
+ updated_at__lte?: string;
1456
+ };
1457
+ /**
1458
+ * Reflected value from a previous response to obtain the next page of results.
1459
+ */
1460
+ last?: string;
1461
+ /**
1462
+ * Order results asc(ending) or desc(ending).
1463
+ */
1464
+ order?: 'asc' | 'desc';
1465
+ /**
1466
+ * Which field to order results by.
1467
+ */
1468
+ order_by?: 'id' | 'created_at' | 'updated_at';
1469
+ /**
1470
+ * Maximum results to include in the response.
1471
+ */
1472
+ size?: number;
1473
+ };
1474
+ /**
1475
+ * audit data activity configuration
1476
+ */
1477
+ type AidrAuditDataActivity = {
1478
+ audit_config_id?: ServiceConfigId;
1479
+ enabled?: boolean;
1480
+ };
1481
+ /**
1482
+ * A service config ID
1483
+ */
1484
+ type AidrMetricpoolId = string;
1485
+ type AidrLog = {
1486
+ event: {
1487
+ [key: string]: unknown;
1488
+ };
1489
+ };
1490
+ type AidrLogs = {
1491
+ events: Array<{
1492
+ [key: string]: unknown;
1493
+ }>;
1494
+ };
1495
+ /**
1496
+ * An empty object
1497
+ */
1498
+ type AidrEmpty = {
1499
+ [key: string]: never;
1500
+ };
1501
+ /**
1502
+ * Collector health endpoint object
1503
+ */
1504
+ type AidrSensorHealth = {
1505
+ collector_instance_id: string;
1506
+ };
1507
+ /**
1508
+ * A service config ID
1509
+ */
1510
+ type ServiceConfigId = string;
1511
+ /**
1512
+ * A filter ID
1513
+ */
1514
+ type FilterId = string;
1515
+ /**
1516
+ * A Policy ID
1517
+ */
1518
+ type PolicyId = string;
1519
+ type AidrServiceConfigResult = AidrServiceConfig;
1520
+ /**
1521
+ * A time in ISO-8601 format
1522
+ */
1523
+ type AidrTimestamp = string;
1524
+ /**
1525
+ * A time in ISO-8601 format or null
1526
+ */
1527
+ type AirdTimestampNullable = AuthnTimestamp | null;
1528
+ /**
1529
+ * Define field name and path mapping to extract from the log
1530
+ */
1531
+ type AidrResourceFieldMapping = {
1532
+ [key: string]: {
1533
+ path: string;
1534
+ type: 'string' | 'int' | 'bool';
1535
+ disabled?: boolean;
1536
+ };
1537
+ };
1538
+ /**
1539
+ * AIDR metric pool settings
1540
+ */
1541
+ type AidrMetricpoolResource = {
1542
+ id?: AidrMetricpoolId;
1543
+ updated_at?: AidrTimestamp;
1544
+ field_mappings?: AidrResourceFieldMapping;
1545
+ };
1546
+ type AidrOtelResourceLogs = {
1547
+ resource?: AidrOtelResource;
1548
+ scopeLogs: Array<AidrOtelScopeLogs>;
1549
+ [key: string]: unknown | AidrOtelResource | Array<AidrOtelScopeLogs> | undefined;
1550
+ };
1551
+ type AidrOtelResource = {
1552
+ attributes?: Array<AidrOtelKeyValue>;
1553
+ [key: string]: unknown | Array<AidrOtelKeyValue> | undefined;
1554
+ };
1555
+ type AidrOtelScopeLogs = {
1556
+ scope?: AidrOtelInstrumentationScope;
1557
+ logRecords: Array<AidrOtelLogRecord>;
1558
+ [key: string]: unknown | AidrOtelInstrumentationScope | Array<AidrOtelLogRecord> | undefined;
1559
+ };
1560
+ type AidrOtelInstrumentationScope = {
1561
+ name?: string;
1562
+ version?: string;
1563
+ [key: string]: unknown | string | undefined;
1564
+ };
1565
+ type AidrOtelLogRecord = {
1566
+ timeUnixNano?: string;
1567
+ observedTimeUnixNano?: string;
1568
+ severityNumber?: number;
1569
+ severityText?: string;
1570
+ name?: string;
1571
+ body: AidrOtelAnyValue;
1572
+ attributes?: Array<AidrOtelKeyValue>;
1573
+ flags?: number;
1574
+ traceId?: string;
1575
+ spanId?: string;
1576
+ traceFlags?: string;
1577
+ [key: string]: unknown | string | number | string | AidrOtelAnyValue | Array<AidrOtelKeyValue> | undefined;
1578
+ };
1579
+ type AidrOtelKeyValue = {
1580
+ key: string;
1581
+ value: AidrOtelAnyValue;
1582
+ [key: string]: unknown | string | AidrOtelAnyValue;
1583
+ };
1584
+ type AidrOtelAnyValue = {
1585
+ stringValue: string;
1586
+ } | {
1587
+ boolValue: boolean | 'true' | 'false' | 'True' | 'False';
1588
+ } | {
1589
+ intValue: number | string;
1590
+ } | {
1591
+ doubleValue: number | string;
1592
+ } | {
1593
+ arrayValue: AidrOtelArrayValue;
1594
+ } | {
1595
+ kvlistValue: AidrOtelKeyValueList;
1596
+ } | {
1597
+ bytesValue: string;
1598
+ };
1599
+ type AidrOtelArrayValue = {
1600
+ values: Array<AidrOtelAnyValue>;
1601
+ [key: string]: unknown | Array<AidrOtelAnyValue>;
1602
+ };
1603
+ type AidrOtelKeyValueList = {
1604
+ values: Array<AidrOtelKeyValue>;
1605
+ [key: string]: unknown | Array<AidrOtelKeyValue>;
1606
+ };
1607
+ /**
1608
+ * AIDR Search Request
1609
+ */
1610
+ type AidrMetric = {
1611
+ /**
1612
+ * start of the query window
1613
+ */
1614
+ start_time: string;
1615
+ /**
1616
+ * end of the query window, if not specified then current time is used as end_time
1617
+ */
1618
+ end_time?: string;
1619
+ /**
1620
+ * Bucket size for time‐series aggregation
1621
+ */
1622
+ interval?: 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly';
1623
+ /**
1624
+ * Optional filters for the field. For example `<field>__gte` or `<field>__lt`
1625
+ */
1626
+ filters?: {
1627
+ [key: string]: number | number | boolean | number | boolean;
1628
+ };
1629
+ /**
1630
+ * Optional tag filters of the tag fields. For example `<field>__contains` or `<field>__in`
1631
+ */
1632
+ tag_filters?: {
1633
+ [key: string]: Array<string>;
1634
+ };
1635
+ /**
1636
+ * Per-detector filters. Use '<key>__exists' for key existence, or '<key>.(count|detected_count)__{op}' for numeric comparisons.
1637
+ */
1638
+ detector_filters?: {
1639
+ [key: string]: number | boolean;
1640
+ };
1641
+ /**
1642
+ * Optional list of tag keys to group by (for bar‑chart or Sankey)
1643
+ */
1644
+ group_by?: Array<string>;
1645
+ /**
1646
+ * field to sort by
1647
+ */
1648
+ order_by?: string;
1649
+ /**
1650
+ * Sort direction (default: asc)
1651
+ */
1652
+ order?: 'asc' | 'desc';
1653
+ limit?: number;
1654
+ offset?: number;
1655
+ };
1656
+ /**
1657
+ * AIDR Aggregate Search Request
1658
+ */
1659
+ type AidrMetricAggregatesSearchParams = {
1660
+ /**
1661
+ * start of the query window
1662
+ */
1663
+ start_time: string;
1664
+ /**
1665
+ * end of the query window, if not specified then current time is used as end_time
1666
+ */
1667
+ end_time?: string;
1668
+ /**
1669
+ * Bucket size for time‐series aggregation
1670
+ */
1671
+ interval?: 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly';
1672
+ /**
1673
+ * list of tag keys to aggregate
1674
+ */
1675
+ aggregate_fields?: Array<string>;
1676
+ /**
1677
+ * Optional filters for the field. For example `<field>__gte` or `<field>__lt`
1678
+ */
1679
+ filters?: {
1680
+ [key: string]: number | number | boolean | number | boolean;
1681
+ };
1682
+ /**
1683
+ * Per-detector filters. Use '<key>__exists' for key existence, or '<key>.(count|detected_count)__{op}' for numeric comparisons.
1684
+ */
1685
+ detector_filters?: {
1686
+ [key: string]: number | boolean;
1687
+ };
1688
+ /**
1689
+ * Optional tag filters of the tag fields. For example `<field>__contains` or `<field>__in`
1690
+ */
1691
+ tag_filters?: {
1692
+ [key: string]: Array<string>;
1693
+ };
1694
+ /**
1695
+ * Optional list of tag keys to group by (for bar‑chart or Sankey)
1696
+ */
1697
+ group_by?: Array<string>;
1698
+ /**
1699
+ * field to sort by
1700
+ */
1701
+ order_by?: string;
1702
+ /**
1703
+ * Sort direction (default: asc)
1704
+ */
1705
+ order?: 'asc' | 'desc';
1706
+ limit?: number;
1707
+ offset?: number;
1708
+ };
1709
+ /**
1710
+ * AIDR Metric Search Result Data
1711
+ */
1712
+ type AidrMetricResult = {
1713
+ items?: Array<AidrMetricItem>;
1714
+ };
1715
+ /**
1716
+ * AIDR Metric Search Aggregate Result Data
1717
+ */
1718
+ type AidrMetricAggregatesResult = {
1719
+ items?: Array<AidrMetricAggregateItem>;
1720
+ };
1721
+ type AidrMetricAggregateItem = Array<{
1722
+ /**
1723
+ * Bucketed time or null.
1724
+ */
1725
+ bucket_time?: string | null;
1726
+ /**
1727
+ * Map of tag keys to unique count.
1728
+ */
1729
+ counts: {
1730
+ [key: string]: number;
1731
+ };
1732
+ }>;
1733
+ type AidrMetricItem = Array<{
1734
+ /**
1735
+ * Bucketed time or null.
1736
+ */
1737
+ bucket_time?: string | null;
1738
+ /**
1739
+ * Map of tag keys to values.
1740
+ */
1741
+ tags?: {
1742
+ [key: string]: string;
1743
+ };
1744
+ count: number;
1745
+ detectors_count: number;
1746
+ is_blocked: boolean;
1747
+ request_token_count: number;
1748
+ response_token_count: number;
1749
+ detectors: AidrMetricResultDetectorItem;
1750
+ }>;
1751
+ type AidrMetricResultDetectorItem = {
1752
+ [key: string]: unknown | {
1753
+ /**
1754
+ * Total occurrences for this detector key.
1755
+ */
1756
+ count: number;
1757
+ /**
1758
+ * Occurrences that were flagged/detected.
1759
+ */
1760
+ detected_count: number;
1761
+ };
1762
+ };
1763
+ /**
1764
+ * A time in ISO-8601 format
1765
+ */
1766
+ type AuthnTimestamp = string;
1767
+ /**
1768
+ * Details about the evaluation of a single rule, including whether it matched, the action to take, the rule name, and optional debugging information.
1769
+ */
1770
+ type AccessRuleResult = {
1771
+ /**
1772
+ * Whether this rule's logic evaluated to true for the input.
1773
+ */
1774
+ matched: boolean;
1775
+ /**
1776
+ * The action resulting from the rule evaluation. One of 'allowed', 'blocked', or 'reported'.
1777
+ */
1778
+ action: string;
1779
+ /**
1780
+ * A human-readable name for the rule.
1781
+ */
1782
+ name: string;
1783
+ /**
1784
+ * The JSON logic expression evaluated for this rule.
1785
+ */
1786
+ logic?: {
1787
+ [key: string]: unknown;
1788
+ };
1789
+ /**
1790
+ * The input attribute values that were available during rule evaluation.
1791
+ */
1792
+ attributes?: {
1793
+ [key: string]: unknown;
1794
+ };
1795
+ };
1796
+ /**
1797
+ * Defines an AI Guard recipe - a named configuration of detectors and redaction settings used to analyze and protect data flows in AI-powered applications.
1798
+ *
1799
+ * Recipes specify which detectors are active, how they behave, and may include reusable settings such as FPE tweaks.
1800
+ *
1801
+ * For details, see the [AI Guard Recipes](https://pangea.cloud/docs/ai-guard/recipes) documentation.
1802
+ */
1803
+ type RecipeConfig = {
1804
+ /**
1805
+ * Human-readable name of the recipe
1806
+ */
1807
+ name: string;
1808
+ /**
1809
+ * Detailed description of the recipe's purpose or use case
1810
+ */
1811
+ description: string;
1812
+ /**
1813
+ * Optional version identifier for the recipe. Can be used to track changes.
1814
+ */
1815
+ version?: string;
1816
+ /**
1817
+ * Settings for [AI Guard Detectors](https://pangea.cloud/docs/ai-guard/recipes#detectors), including which detectors to enable and how they behave
1818
+ */
1819
+ detectors?: DetectorSettings;
1820
+ /**
1821
+ * Configuration for access rules used in an AI Guard recipe.
1822
+ */
1823
+ access_rules?: Array<AccessRuleSettings>;
1824
+ /**
1825
+ * Connector-level Redact configuration. These settings allow you to define reusable redaction parameters, such as FPE tweak value.
1826
+ */
1827
+ connector_settings?: {
1828
+ /**
1829
+ * Settings for Redact integration at the recipe level
1830
+ */
1831
+ redact?: {
1832
+ /**
1833
+ * ID of a Vault secret containing the tweak value used for Format-Preserving Encryption (FPE). Enables deterministic encryption, ensuring that identical inputs produce consistent encrypted outputs.
1834
+ */
1835
+ fpe_tweak_vault_secret_id?: string;
1836
+ };
1837
+ };
1838
+ };
1839
+ /**
1840
+ * Configuration for individual detectors used in an AI Guard recipe. Each entry specifies the detector to use, its enabled state, detector-specific settings, and the [action](https://pangea.cloud/docs/ai-guard/recipes#actions) to apply when detections occur.
1841
+ */
1842
+ type DetectorSettings = Array<{
1843
+ /**
1844
+ * Identifier of the detector to apply, such as `prompt_injection`, `pii_entity`, or `malicious_entity`
1845
+ */
1846
+ detector_name: string;
1847
+ /**
1848
+ * Specifies whether the detector is enabled or disabled in this configuration
1849
+ */
1850
+ state: 'disabled' | 'enabled';
1851
+ /**
1852
+ * Detector-specific settings
1853
+ */
1854
+ settings: {
1855
+ /**
1856
+ * List of detection and redaction rules applied by this detector
1857
+ */
1858
+ rules?: Array<{
1859
+ /**
1860
+ * Identifier of the redaction rule to apply. This should match a rule defined in the [Redact service](https://pangea.cloud/docs/redact/using-redact/using-redact).
1861
+ */
1862
+ redact_rule_id: string;
1863
+ redaction: RuleRedactionConfig;
1864
+ /**
1865
+ * If `true`, indicates that further processing should be stopped when this rule is triggered
1866
+ */
1867
+ block?: boolean;
1868
+ /**
1869
+ * If `true`, disables this specific rule even if the detector is enabled
1870
+ */
1871
+ disabled?: boolean;
1872
+ /**
1873
+ * If `true`, performs a reputation check using the configured intel provider. Applies to the Malicious Entity detector when using IP, URL, or Domain Intel services.
1874
+ */
1875
+ reputation_check?: boolean;
1876
+ /**
1877
+ * If `true`, applies redaction or transformation when the detected value is determined to be malicious by intel analysis
1878
+ */
1879
+ transform_if_malicious?: boolean;
1880
+ }>;
1881
+ };
1882
+ }>;
1883
+ type RuleRedactionConfig = ({
1884
+ redaction_type?: 'mask' | 'detect_only';
1885
+ } | {
1886
+ redaction_type?: 'replacement';
1887
+ } | {
1888
+ redaction_type?: 'partial_masking';
1889
+ } | {
1890
+ redaction_type?: 'hash';
1891
+ } | {
1892
+ redaction_type?: 'fpe';
1893
+ }) & {
1894
+ /**
1895
+ * Redaction method to apply for this rule
1896
+ */
1897
+ redaction_type: 'mask' | 'partial_masking' | 'replacement' | 'hash' | 'detect_only' | 'fpe';
1898
+ /**
1899
+ * Replacement string to use when `redaction_type` is `replacement`
1900
+ */
1901
+ redaction_value?: string;
1902
+ /**
1903
+ * Parameters to control how text is masked when `redaction_type` is `partial_masking`
1904
+ */
1905
+ partial_masking?: {
1906
+ /**
1907
+ * Defines the masking strategy. Use `unmask` to specify how many characters to keep visible. Use `mask` to specify how many to hide.
1908
+ */
1909
+ masking_type?: 'unmask' | 'mask';
1910
+ /**
1911
+ * Number of leading characters to leave unmasked when `masking_type` is `unmask`
1912
+ */
1913
+ unmasked_from_left?: number;
1914
+ /**
1915
+ * Number of trailing characters to leave unmasked when `masking_type` is `unmask`
1916
+ */
1917
+ unmasked_from_right?: number;
1918
+ /**
1919
+ * Number of leading characters to mask when `masking_type` is `mask`
1920
+ */
1921
+ masked_from_left?: number;
1922
+ /**
1923
+ * Number of trailing characters to mask when `masking_type` is `mask`
1924
+ */
1925
+ masked_from_right?: number;
1926
+ /**
1927
+ * List of characters that should not be masked (for example, hyphens or periods)
1928
+ */
1929
+ chars_to_ignore?: Array<string>;
1930
+ /**
1931
+ * Character to use when masking text
1932
+ */
1933
+ masking_char?: string;
1934
+ };
1935
+ /**
1936
+ * Hash configuration when `redaction_type` is `hash`
1937
+ */
1938
+ hash?: {
1939
+ /**
1940
+ * Hashing algorithm to use for redaction
1941
+ */
1942
+ hash_type: 'md5' | 'sha256';
1943
+ } | null;
1944
+ /**
1945
+ * Alphabet used for Format-Preserving Encryption (FPE). Determines the character set for encryption.
1946
+ */
1947
+ fpe_alphabet?: 'numeric' | 'alphalower' | 'alphaupper' | 'alpha' | 'alphanumericlower' | 'alphanumericupper' | 'alphanumeric' | null;
1948
+ };
1949
+ /**
1950
+ * Configuration for an individual access rule used in an AI Guard recipe. Each rule defines its matching logic and the action to apply when the logic evaluates to true.
1951
+ */
1952
+ type AccessRuleSettings = {
1953
+ /**
1954
+ * Unique identifier for this rule. Should be user-readable and consistent across recipe updates.
1955
+ */
1956
+ rule_key: string;
1957
+ /**
1958
+ * Display label for the rule shown in user interfaces.
1959
+ */
1960
+ name: string;
1961
+ /**
1962
+ * Action to apply if the rule matches. Use 'block' to stop further processing or 'report' to simply log the match.
1963
+ */
1964
+ state: 'block' | 'report';
1965
+ /**
1966
+ * JSON Logic condition that determines whether this rule matches.
1967
+ */
1968
+ logic: {
1969
+ [key: string]: unknown;
1970
+ };
1971
+ };
1972
+ type LanguageResult = {
1973
+ /**
1974
+ * The action taken by this Detector
1975
+ */
1976
+ action?: string;
1977
+ language?: string;
1978
+ };
1979
+ type RedactEntityResult = {
1980
+ /**
1981
+ * Detected redaction rules.
1982
+ */
1983
+ entities?: Array<{
1984
+ /**
1985
+ * The action taken on this Entity
1986
+ */
1987
+ action: string;
1988
+ type: string;
1989
+ value: string;
1990
+ redacted: boolean;
1991
+ start_pos?: number;
1992
+ }>;
1993
+ };
1994
+ type MaliciousEntityAction = 'report' | 'defang' | 'disabled' | 'block';
1995
+ type PiiEntityAction = 'disabled' | 'report' | 'block' | 'mask' | 'partial_masking' | 'replacement' | 'hash' | 'fpe';
1996
+ type AidrPostV1GuardChatCompletionsData = {
1997
+ body?: ChatCompletionsGuard;
1998
+ path?: never;
1999
+ query?: never;
2000
+ url: '/v1/guard_chat_completions';
2001
+ };
2002
+ type AidrPostV1GuardChatCompletionsErrors = {
2003
+ /**
2004
+ * Validation errors
2005
+ */
2006
+ 400: PangeaResponse & PangeaValidationErrors;
2007
+ };
2008
+ type AidrPostV1GuardChatCompletionsError = AidrPostV1GuardChatCompletionsErrors[keyof AidrPostV1GuardChatCompletionsErrors];
2009
+ type AidrPostV1GuardChatCompletionsResponses = {
2010
+ /**
2011
+ * No description provided
2012
+ */
2013
+ 200: PangeaResponse & {
2014
+ result?: {
2015
+ /**
2016
+ * Updated structured prompt.
2017
+ */
2018
+ guard_output?: {
2019
+ [key: string]: unknown;
2020
+ };
2021
+ /**
2022
+ * Whether or not the prompt triggered a block detection.
2023
+ */
2024
+ blocked?: boolean;
2025
+ /**
2026
+ * Whether or not the original input was transformed.
2027
+ */
2028
+ transformed?: boolean;
2029
+ /**
2030
+ * The Policy that was used.
2031
+ */
2032
+ policy?: string;
2033
+ /**
2034
+ * Result of the policy analyzing and input prompt.
2035
+ */
2036
+ detectors: {
2037
+ malicious_prompt?: {
2038
+ /**
2039
+ * Whether or not the Malicious Prompt was detected.
2040
+ */
2041
+ detected?: boolean;
2042
+ /**
2043
+ * Details about the analyzers.
2044
+ */
2045
+ data?: AidrPromptInjectionResult;
2046
+ };
2047
+ confidential_and_pii_entity?: {
2048
+ /**
2049
+ * Whether or not the PII Entities were detected.
2050
+ */
2051
+ detected?: boolean;
2052
+ /**
2053
+ * Details about the detected entities.
2054
+ */
2055
+ data?: AidrRedactEntityResult;
2056
+ };
2057
+ malicious_entity?: {
2058
+ /**
2059
+ * Whether or not the Malicious Entities were detected.
2060
+ */
2061
+ detected?: boolean;
2062
+ /**
2063
+ * Details about the detected entities.
2064
+ */
2065
+ data?: AidrMaliciousEntityResult;
2066
+ };
2067
+ custom_entity?: {
2068
+ /**
2069
+ * Whether or not the Custom Entities were detected.
2070
+ */
2071
+ detected?: boolean;
2072
+ /**
2073
+ * Details about the detected entities.
2074
+ */
2075
+ data?: AidrRedactEntityResult;
2076
+ };
2077
+ secret_and_key_entity?: {
2078
+ /**
2079
+ * Whether or not the Secret Entities were detected.
2080
+ */
2081
+ detected?: boolean;
2082
+ /**
2083
+ * Details about the detected entities.
2084
+ */
2085
+ data?: AidrRedactEntityResult;
2086
+ };
2087
+ competitors?: {
2088
+ /**
2089
+ * Whether or not the Competitors were detected.
2090
+ */
2091
+ detected?: boolean;
2092
+ /**
2093
+ * Details about the detected entities.
2094
+ */
2095
+ data?: AidrSingleEntityResult;
2096
+ };
2097
+ language?: {
2098
+ /**
2099
+ * Whether or not the Languages were detected.
2100
+ */
2101
+ detected?: boolean;
2102
+ /**
2103
+ * Details about the detected languages.
2104
+ */
2105
+ data?: AidrLanguageResult;
2106
+ };
2107
+ topic?: {
2108
+ /**
2109
+ * Whether or not the Topics were detected.
2110
+ */
2111
+ detected?: boolean;
2112
+ /**
2113
+ * Details about the detected topics.
2114
+ */
2115
+ data?: AidrTopicResult;
2116
+ };
2117
+ code?: {
2118
+ /**
2119
+ * Whether or not the Code was detected.
2120
+ */
2121
+ detected?: boolean;
2122
+ /**
2123
+ * Details about the detected code.
2124
+ */
2125
+ data?: AidrLanguageResult;
2126
+ };
2127
+ };
2128
+ access_rules?: AidrAccessRulesResponse;
2129
+ /**
2130
+ * If an FPE redaction method returned results, this will be the context passed to unredact.
2131
+ */
2132
+ fpe_context?: string;
2133
+ };
2134
+ };
2135
+ };
2136
+ type AidrPostV1GuardChatCompletionsResponse = AidrPostV1GuardChatCompletionsResponses[keyof AidrPostV1GuardChatCompletionsResponses];
2137
+ type GetAsyncRequestData = {
2138
+ body?: never;
2139
+ path: {
2140
+ /**
2141
+ * The request ID to poll
2142
+ */
2143
+ requestId: string;
2144
+ };
2145
+ query?: never;
2146
+ url: '/request/{requestId}';
2147
+ };
2148
+ type GetAsyncRequestResponses = {
2149
+ /**
2150
+ * Response
2151
+ */
2152
+ 200: PangeaResponse;
2153
+ /**
2154
+ * Asynchronous request in progress
2155
+ */
2156
+ 202: PangeaResponse & {
2157
+ result?: {
2158
+ ttl_mins?: number;
2159
+ retry_counter?: number;
2160
+ location?: string;
2161
+ };
2162
+ };
2163
+ };
2164
+ type GetAsyncRequestResponse = GetAsyncRequestResponses[keyof GetAsyncRequestResponses];
2165
+ //#endregion
2166
+ //#region src/types/index.d.ts
2167
+ type BaseAPIResponse = {
2168
+ /**
2169
+ * A unique identifier assigned to each request made to the API. It is used to
2170
+ * track and identify a specific request and its associated data. The
2171
+ * `request_id` can be helpful for troubleshooting, auditing, and tracing the
2172
+ * flow of requests within the system. It allows users to reference and
2173
+ * retrieve information related to a particular request, such as the response,
2174
+ * parameters, and raw data associated with that specific request.
2175
+ *
2176
+ * ```
2177
+ * "request_id":"prq_x6fdiizbon6j3bsdvnpmwxsz2aan7fqd"
2178
+ * ```
2179
+ */
2180
+ request_id: string;
2181
+ /**
2182
+ * The timestamp indicates the exact moment when a request is made to the API.
2183
+ * It represents the date and time at which the request was initiated by the
2184
+ * client. The `request_time` is useful for tracking and analyzing the timing
2185
+ * of requests, measuring response times, and monitoring performance metrics.
2186
+ * It allows users to determine the duration between the request initiation
2187
+ * and the corresponding response, aiding in the assessment of API performance
2188
+ * and latency.
2189
+ *
2190
+ * ```
2191
+ * "request_time":"2022-09-21T17:24:33.105Z"
2192
+ * ```
2193
+ */
2194
+ request_time: string;
2195
+ /**
2196
+ * Duration it takes for the API to process a request and generate a response.
2197
+ * It represents the elapsed time from when the request is received by the API
2198
+ * to when the corresponding response is returned to the client.
2199
+ *
2200
+ * ```
2201
+ * "response_time":"2022-09-21T17:24:34.007Z"
2202
+ * ```
2203
+ */
2204
+ response_time: string;
2205
+ /**
2206
+ * It represents the status or outcome of the API request made for IP
2207
+ * information. It indicates the current state or condition of the request and
2208
+ * provides information on the success or failure of the request.
2209
+ */
2210
+ status: string;
2211
+ /**
2212
+ * Provides a concise and brief overview of the purpose or primary objective
2213
+ * of the API endpoint. It serves as a high-level summary or description of
2214
+ * the functionality or feature offered by the endpoint.
2215
+ */
2216
+ summary: string;
2217
+ result: unknown;
2218
+ };
2219
+ type AcceptedResponse = BaseAPIResponse & {
2220
+ status: 'Accepted';
2221
+ result: {
2222
+ ttl_mins: number;
2223
+ retry_counter: number;
2224
+ location: string;
2225
+ };
2226
+ };
2227
+ type ErrorResponse = BaseAPIResponse & {
2228
+ result: Array<{
2229
+ code: 'FieldRequired' | 'InvalidString' | 'InvalidNumber' | 'InvalidInteger' | 'InvalidObject' | 'InvalidArray' | 'InvalidNull' | 'InvalidBool' | 'BadFormat' | 'BadFormatPangeaDuration' | 'BadFormatDateTime' | 'BadFormatTime' | 'BadFormatDate' | 'BadFormatEmail' | 'BadFormatHostname' | 'BadFormatIPv4' | 'BadFormatIPv6' | 'BadFormatIPAddress' | 'BadFormatUUID' | 'BadFormatURI' | 'BadFormatURIReference' | 'BadFormatIRI' | 'BadFormatIRIReference' | 'BadFormatJSONPointer' | 'BadFormatRelativeJSONPointer' | 'BadFormatRegex' | 'BadFormatJSONPath' | 'BadFormatBase64' | 'DoesNotMatchPattern' | 'DoesNotMatchPatternProperties' | 'NotEnumMember' | 'AboveMaxLength' | 'BelowMinLength' | 'AboveMaxItems' | 'BelowMinItems' | 'NotMultipleOf' | 'NotWithinRange' | 'UnexpectedProperty' | 'InvalidPropertyName' | 'AboveMaxProperties' | 'BelowMinProperties' | 'NotContains' | 'ContainsTooMany' | 'ContainsTooFew' | 'ItemNotUnique' | 'UnexpectedAdditionalItem' | 'InvalidConst' | 'IsDependentOn' | 'IsTooBig' | 'IsTooSmall' | 'ShouldNotBeValid' | 'NoUnevaluatedItems' | 'NoUnevaluatedProperties' | 'DoesNotExist' | 'IsReadOnly' | 'CannotAddToDefault' | 'MustProvideOne' | 'MutuallyExclusive' | 'BadState' | 'InaccessibleURI' | 'ProviderDisabled' | 'ConfigProjectMismatch' | 'ConfigServiceMismatch' | 'ConfigNotExist';
2230
+ /**
2231
+ * Human readable description of the error
2232
+ */
2233
+ detail: string;
2234
+ /**
2235
+ * Path to the data source of the error
2236
+ */
2237
+ source: string;
2238
+ /**
2239
+ * The Schema path where the error occurred
2240
+ */
2241
+ path?: string;
2242
+ }> | null;
2243
+ };
2244
+ type SuccessResponse<T> = BaseAPIResponse & {
2245
+ status: 'Success';
2246
+ result: T;
2247
+ };
2248
+ /** Standard API response schema. */
2249
+ type APIResponse<T> = AcceptedResponse | ErrorResponse | SuccessResponse<T>;
2250
+ type MaybeAcceptedResponse<T> = AcceptedResponse | SuccessResponse<T>;
2251
+ //#endregion
2252
+ //#region src/client.d.ts
2253
+ interface ClientOptions {
2254
+ /** CS AIDR API token.*/
2255
+ token: string;
2256
+ /**
2257
+ * Template for constructing the base URL for API requests. The placeholder
2258
+ * `{SERVICE_NAME}` will be replaced with the service name slug.
2259
+ */
2260
+ baseURLTemplate: string;
2261
+ /**
2262
+ * The maximum number of times that the client will retry a request in case of
2263
+ * a temporary failure, like a network error or a 5XX error from the server.
2264
+ *
2265
+ * @default 2
2266
+ */
2267
+ maxRetries?: number | undefined;
2268
+ /**
2269
+ * The maximum number of times that the client will poll for an async request
2270
+ * result when receiving a HTTP/202 response.
2271
+ *
2272
+ * @default 5
2273
+ */
2274
+ maxPollingAttempts?: number | undefined;
2275
+ /**
2276
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
2277
+ * from the server before timing out a single request.
2278
+ *
2279
+ * @unit milliseconds
2280
+ */
2281
+ timeout?: number;
2282
+ /**
2283
+ * Specify a custom `fetch` function implementation.
2284
+ *
2285
+ * If not provided, we expect that `fetch` is defined globally.
2286
+ */
2287
+ fetch?: Fetch | undefined;
2288
+ /**
2289
+ * Default headers to include with every request to the API.
2290
+ *
2291
+ * These can be removed in individual requests by explicitly setting the
2292
+ * header to `null` in request options.
2293
+ */
2294
+ defaultHeaders?: HeadersLike | undefined;
2295
+ }
2296
+ declare abstract class Client {
2297
+ /** CS AIDR API token.*/
2298
+ token: string;
2299
+ /**
2300
+ * Template for constructing the base URL for API requests. The placeholder
2301
+ * `{SERVICE_NAME}` will be replaced with the service name slug.
2302
+ */
2303
+ baseURLTemplate: string;
2304
+ timeout: number;
2305
+ maxRetries: number;
2306
+ maxPollingAttempts: number;
2307
+ private readonly fetch;
2308
+ private readonly _options;
2309
+ protected abstract serviceName: string;
2310
+ constructor(options: ClientOptions);
2311
+ /**
2312
+ * Will retrieve the result, or will return HTTP/202 if the original request
2313
+ * is still in progress.
2314
+ */
2315
+ getAsyncRequest<T>(requestId: string): Promise<MaybeAcceptedResponse<T>>;
2316
+ /**
2317
+ * Polls for an async request result with exponential backoff.
2318
+ * Continues polling until a success response is received or max attempts are reached.
2319
+ */
2320
+ private pollAsyncRequest;
2321
+ protected get<R>(path: string, opts?: PromiseOrValue<RequestOptions>): Promise<R>;
2322
+ protected post<R>(path: string, opts?: PromiseOrValue<RequestOptions>): Promise<R>;
2323
+ private methodRequest;
2324
+ private request;
2325
+ private makeRequest;
2326
+ private shouldRetry;
2327
+ private retryRequest;
2328
+ private calculateDefaultRetryTimeoutMillis;
2329
+ private fetchWithTimeout;
2330
+ private buildRequest;
2331
+ private buildURL;
2332
+ private buildBody;
2333
+ private buildHeaders;
2334
+ private authHeaders;
2335
+ }
2336
+ //#endregion
2337
+ //#region src/services/ai-guard.d.ts
2338
+ declare class AIGuard extends Client {
2339
+ serviceName: string;
2340
+ /**
2341
+ * Analyze and redact content to avoid manipulation of the model, addition of
2342
+ * malicious content, and other undesirable data transfers.
2343
+ */
2344
+ guardChatCompletions(body: ChatCompletionsGuard, options?: RequestOptions): Promise<MaybeAcceptedResponse<AidrPostV1GuardChatCompletionsResponse['result']>>;
2345
+ }
2346
+ //#endregion
2347
+ export { AIGuard, APIResponse, AcceptedResponse, AccessRuleResult, AccessRuleSettings, AidrAccessRulesResponse, AidrAuditDataActivity, AidrCustomlist, AidrCustomlistResult, AidrCustomlistSearch, AidrCustomlistSearchResult, AidrDevice, AidrDeviceCheckResult, AidrDeviceId, AidrDeviceResult, AidrDeviceSearch, AidrDeviceSearchResult, AidrDeviceStatus, AidrDeviceTokenInfo, AidrEmpty, AidrFieldAlias, AidrFieldAliasResult, AidrFieldAliasSearch, AidrFieldAliasSearchResult, AidrGolangDuration, AidrIpv4OrV6, AidrLanguageResult, AidrLog, AidrLogs, AidrMaliciousEntityResult, AidrMetric, AidrMetricAggregateItem, AidrMetricAggregatesResult, AidrMetricAggregatesSearchParams, AidrMetricItem, AidrMetricOnlyData, AidrMetricResult, AidrMetricResultDetectorItem, AidrMetricpoolId, AidrMetricpoolResource, AidrOtelAnyValue, AidrOtelArrayValue, AidrOtelInstrumentationScope, AidrOtelKeyValue, AidrOtelKeyValueList, AidrOtelLogRecord, AidrOtelResource, AidrOtelResourceLogs, AidrOtelScopeLogs, AidrPolicy, AidrPolicyDefaults, AidrPolicyResult, AidrPolicySearch, AidrPolicySearchResult, AidrPolicycollectionResult, AidrPolicycollectionSearch, AidrPolicycollectionSearchResult, AidrPostV1GuardChatCompletionsData, AidrPostV1GuardChatCompletionsError, AidrPostV1GuardChatCompletionsErrors, AidrPostV1GuardChatCompletionsResponse, AidrPostV1GuardChatCompletionsResponses, AidrPromptInjectionResult, AidrPromptItem, AidrPromptItemListResult, AidrRedactEntityResult, AidrResourceFieldMapping, AidrSavedFilter, AidrSavedFilterResult, AidrSavedFilterSearch, AidrSavedFilterSearchResult, AidrSensorHealth, AidrSensorInsights, AidrSensorInsightsItem, AidrSensorInsightsResult, AidrServiceConfig, AidrServiceConfigList, AidrServiceConfigResult, AidrSingleEntityResult, AidrTimestamp, AidrTopicResult, AirdTimestampNullable, AuthnTimestamp, ChatCompletionsGuard, DetectorSettings, ErrorResponse, FilterId, GetAsyncRequestData, GetAsyncRequestResponse, GetAsyncRequestResponses, LanguageResult, MaliciousEntityAction, MaybeAcceptedResponse, PangeaResponse, PangeaValidationErrors, PiiEntityAction, PolicyId, RecipeConfig, RedactEntityResult, RuleRedactionConfig, ServiceConfigId };