@cdot65/prisma-airs-sdk 0.5.2 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +167 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2452 -2129
- package/dist/index.d.ts +2452 -2129
- package/dist/index.js +158 -51
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
AuthType: () => AuthType,
|
|
43
43
|
BEARER: () => BEARER,
|
|
44
44
|
BaseResponseSchema: () => BaseResponseSchema,
|
|
45
|
+
BedrockAccessConnectionParamsSchema: () => BedrockAccessConnectionParamsSchema,
|
|
45
46
|
BrandSubCategory: () => BrandSubCategory,
|
|
46
47
|
Category: () => Category,
|
|
47
48
|
CategoryModelSchema: () => CategoryModelSchema,
|
|
@@ -49,6 +50,7 @@ __export(index_exports, {
|
|
|
49
50
|
ComplianceReportSchema: () => ComplianceReportSchema,
|
|
50
51
|
ComplianceSubCategory: () => ComplianceSubCategory,
|
|
51
52
|
ComplianceTechniqueSchema: () => ComplianceTechniqueSchema,
|
|
53
|
+
ConnectionParamsSchema: () => ConnectionParamsSchema,
|
|
52
54
|
Content: () => Content,
|
|
53
55
|
CountByNameSchema: () => CountByNameSchema,
|
|
54
56
|
CountedQuotaEnum: () => CountedQuotaEnum,
|
|
@@ -84,6 +86,7 @@ __export(index_exports, {
|
|
|
84
86
|
DSDetailResultSchema: () => DSDetailResultSchema,
|
|
85
87
|
DSResultMetadataSchema: () => DSResultMetadataSchema,
|
|
86
88
|
DashboardOverviewResponseSchema: () => DashboardOverviewResponseSchema,
|
|
89
|
+
DatabricksConnectionParamsSchema: () => DatabricksConnectionParamsSchema,
|
|
87
90
|
DateRangeFilter: () => DateRangeFilter,
|
|
88
91
|
DeleteProfileConflictSchema: () => DeleteProfileConflictSchema,
|
|
89
92
|
DeleteProfileResponseSchema: () => DeleteProfileResponseSchema,
|
|
@@ -117,6 +120,7 @@ __export(index_exports, {
|
|
|
117
120
|
HEADER_AUTH_TOKEN: () => HEADER_AUTH_TOKEN,
|
|
118
121
|
HTTPValidationErrorSchema: () => HTTPValidationErrorSchema,
|
|
119
122
|
HTTP_FORCE_RETRY_STATUS_CODES: () => HTTP_FORCE_RETRY_STATUS_CODES,
|
|
123
|
+
HuggingfaceConnectionParamsSchema: () => HuggingfaceConnectionParamsSchema,
|
|
120
124
|
IODetectedSchema: () => IODetectedSchema,
|
|
121
125
|
JobAbortResponseSchema: () => JobAbortResponseSchema,
|
|
122
126
|
JobCreateRequestSchema: () => JobCreateRequestSchema,
|
|
@@ -188,7 +192,10 @@ __export(index_exports, {
|
|
|
188
192
|
ModelSecurityRuleResponseSchema: () => ModelSecurityRuleResponseSchema,
|
|
189
193
|
ModelSecurityRulesClient: () => ModelSecurityRulesClient,
|
|
190
194
|
ModelSecurityScansClient: () => ModelSecurityScansClient,
|
|
195
|
+
MultiTurnStatefulConfigSchema: () => MultiTurnStatefulConfigSchema,
|
|
196
|
+
MultiTurnStatelessConfigSchema: () => MultiTurnStatelessConfigSchema,
|
|
191
197
|
OAuthClient: () => OAuthClient,
|
|
198
|
+
OpenAIConnectionParamsSchema: () => OpenAIConnectionParamsSchema,
|
|
192
199
|
PAYLOAD_HASH: () => PAYLOAD_HASH,
|
|
193
200
|
PolicySchema: () => PolicySchema,
|
|
194
201
|
PolicyType: () => PolicyType,
|
|
@@ -246,6 +253,7 @@ __export(index_exports, {
|
|
|
246
253
|
ResponseDetectedSchema: () => ResponseDetectedSchema,
|
|
247
254
|
ResponseDetectionDetailsSchema: () => ResponseDetectionDetailsSchema,
|
|
248
255
|
ResponseMode: () => ResponseMode,
|
|
256
|
+
RestConnectionParamsSchema: () => RestConnectionParamsSchema,
|
|
249
257
|
RiskLevelSchema: () => RiskLevelSchema,
|
|
250
258
|
RiskRating: () => RiskRating,
|
|
251
259
|
RuleConfigurationSchema: () => RuleConfigurationSchema,
|
|
@@ -302,6 +310,7 @@ __export(index_exports, {
|
|
|
302
310
|
StreamIterationDataSchema: () => StreamIterationDataSchema,
|
|
303
311
|
StreamListResponseSchema: () => StreamListResponseSchema,
|
|
304
312
|
StreamType: () => StreamType,
|
|
313
|
+
StreamingConnectionParamsSchema: () => StreamingConnectionParamsSchema,
|
|
305
314
|
SubCategoryModelSchema: () => SubCategoryModelSchema,
|
|
306
315
|
SubCategoryStatsSchema: () => SubCategoryStatsSchema,
|
|
307
316
|
TargetAdditionalContextSchema: () => TargetAdditionalContextSchema,
|
|
@@ -362,7 +371,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
|
|
|
362
371
|
var MAX_CONNECTION_POOL_SIZE = 100;
|
|
363
372
|
var MAX_NUMBER_OF_RETRIES = 5;
|
|
364
373
|
var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
|
|
365
|
-
var SDK_VERSION = "0.
|
|
374
|
+
var SDK_VERSION = "0.6.1";
|
|
366
375
|
var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
|
|
367
376
|
var DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
|
|
368
377
|
var DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
|
|
@@ -1820,33 +1829,83 @@ var ValidationErrorSchema = import_zod18.z.object({
|
|
|
1820
1829
|
});
|
|
1821
1830
|
var HTTPValidationErrorSchema = import_zod18.z.object({ detail: import_zod18.z.array(ValidationErrorSchema).optional() }).passthrough();
|
|
1822
1831
|
var TargetBackgroundSchema = import_zod18.z.object({
|
|
1823
|
-
industry: import_zod18.z.
|
|
1824
|
-
use_case: import_zod18.z.
|
|
1825
|
-
competitors: import_zod18.z.
|
|
1832
|
+
industry: import_zod18.z.string().nullable().optional(),
|
|
1833
|
+
use_case: import_zod18.z.string().nullable().optional(),
|
|
1834
|
+
competitors: import_zod18.z.array(import_zod18.z.string()).nullable().optional()
|
|
1826
1835
|
}).passthrough();
|
|
1827
1836
|
var TargetAdditionalContextSchema = import_zod18.z.object({
|
|
1828
|
-
base_model: import_zod18.z.
|
|
1829
|
-
core_architecture: import_zod18.z.
|
|
1830
|
-
system_prompt: import_zod18.z.
|
|
1831
|
-
languages_supported: import_zod18.z.
|
|
1832
|
-
banned_keywords: import_zod18.z.
|
|
1833
|
-
tools_accessible: import_zod18.z.
|
|
1837
|
+
base_model: import_zod18.z.string().nullable().optional(),
|
|
1838
|
+
core_architecture: import_zod18.z.string().nullable().optional(),
|
|
1839
|
+
system_prompt: import_zod18.z.string().nullable().optional(),
|
|
1840
|
+
languages_supported: import_zod18.z.array(import_zod18.z.string()).nullable().optional(),
|
|
1841
|
+
banned_keywords: import_zod18.z.array(import_zod18.z.string()).nullable().optional(),
|
|
1842
|
+
tools_accessible: import_zod18.z.array(import_zod18.z.string()).nullable().optional()
|
|
1834
1843
|
}).passthrough();
|
|
1835
1844
|
var TargetMetadataSchema = import_zod18.z.object({
|
|
1836
1845
|
multi_turn: import_zod18.z.boolean().optional(),
|
|
1837
|
-
multi_turn_error_message: import_zod18.z.
|
|
1838
|
-
rate_limit: import_zod18.z.
|
|
1846
|
+
multi_turn_error_message: import_zod18.z.string().nullable().optional(),
|
|
1847
|
+
rate_limit: import_zod18.z.number().int().nullable().optional(),
|
|
1839
1848
|
rate_limit_enabled: import_zod18.z.boolean().optional(),
|
|
1840
|
-
rate_limit_error_code: import_zod18.z.
|
|
1841
|
-
rate_limit_error_json: import_zod18.z.unknown().optional(),
|
|
1842
|
-
rate_limit_error_message: import_zod18.z.
|
|
1849
|
+
rate_limit_error_code: import_zod18.z.number().int().nullable().optional(),
|
|
1850
|
+
rate_limit_error_json: import_zod18.z.record(import_zod18.z.unknown()).nullable().optional(),
|
|
1851
|
+
rate_limit_error_message: import_zod18.z.string().nullable().optional(),
|
|
1843
1852
|
content_filter_enabled: import_zod18.z.boolean().optional(),
|
|
1844
|
-
content_filter_error_code: import_zod18.z.
|
|
1845
|
-
content_filter_error_json: import_zod18.z.unknown().optional(),
|
|
1846
|
-
content_filter_error_message: import_zod18.z.
|
|
1853
|
+
content_filter_error_code: import_zod18.z.number().int().nullable().optional(),
|
|
1854
|
+
content_filter_error_json: import_zod18.z.record(import_zod18.z.unknown()).nullable().optional(),
|
|
1855
|
+
content_filter_error_message: import_zod18.z.string().nullable().optional(),
|
|
1847
1856
|
probe_message: import_zod18.z.string().optional(),
|
|
1848
1857
|
request_timeout: import_zod18.z.number().optional()
|
|
1849
1858
|
}).passthrough();
|
|
1859
|
+
var MultiTurnStatefulConfigSchema = import_zod18.z.object({
|
|
1860
|
+
type: import_zod18.z.string().default("stateful"),
|
|
1861
|
+
response_id_field: import_zod18.z.string(),
|
|
1862
|
+
request_id_field: import_zod18.z.string()
|
|
1863
|
+
}).passthrough();
|
|
1864
|
+
var MultiTurnStatelessConfigSchema = import_zod18.z.object({
|
|
1865
|
+
type: import_zod18.z.string().default("stateless"),
|
|
1866
|
+
assistant_role: import_zod18.z.string().nullable().optional()
|
|
1867
|
+
}).passthrough();
|
|
1868
|
+
var OpenAIConnectionParamsSchema = import_zod18.z.object({
|
|
1869
|
+
api_key: import_zod18.z.string(),
|
|
1870
|
+
model_name: import_zod18.z.string()
|
|
1871
|
+
}).passthrough();
|
|
1872
|
+
var HuggingfaceConnectionParamsSchema = import_zod18.z.object({
|
|
1873
|
+
api_key: import_zod18.z.string(),
|
|
1874
|
+
model_name: import_zod18.z.string()
|
|
1875
|
+
}).passthrough();
|
|
1876
|
+
var DatabricksConnectionParamsSchema = import_zod18.z.object({
|
|
1877
|
+
auth_type: import_zod18.z.string(),
|
|
1878
|
+
workspace_url: import_zod18.z.string(),
|
|
1879
|
+
model_name: import_zod18.z.string(),
|
|
1880
|
+
access_token: import_zod18.z.string().nullable().optional(),
|
|
1881
|
+
client_id: import_zod18.z.string().nullable().optional(),
|
|
1882
|
+
secret: import_zod18.z.string().nullable().optional()
|
|
1883
|
+
}).passthrough();
|
|
1884
|
+
var BedrockAccessConnectionParamsSchema = import_zod18.z.object({
|
|
1885
|
+
access_id: import_zod18.z.string(),
|
|
1886
|
+
access_secret: import_zod18.z.string(),
|
|
1887
|
+
region: import_zod18.z.string(),
|
|
1888
|
+
model_id: import_zod18.z.string(),
|
|
1889
|
+
session_token: import_zod18.z.string().nullable().optional()
|
|
1890
|
+
}).passthrough();
|
|
1891
|
+
var RestConnectionParamsSchema = import_zod18.z.object({
|
|
1892
|
+
api_endpoint: import_zod18.z.string().nullable().optional(),
|
|
1893
|
+
request_headers: import_zod18.z.record(import_zod18.z.unknown()).nullable().optional(),
|
|
1894
|
+
request_json: import_zod18.z.record(import_zod18.z.unknown()).nullable().optional(),
|
|
1895
|
+
response_json: import_zod18.z.record(import_zod18.z.unknown()).nullable().optional(),
|
|
1896
|
+
response_key: import_zod18.z.string().nullable().optional(),
|
|
1897
|
+
target_connection_config: import_zod18.z.unknown().nullable().optional(),
|
|
1898
|
+
curl: import_zod18.z.string().nullable().optional(),
|
|
1899
|
+
multi_turn_config: import_zod18.z.unknown().nullable().optional()
|
|
1900
|
+
}).passthrough();
|
|
1901
|
+
var StreamingConnectionParamsSchema = RestConnectionParamsSchema.extend({
|
|
1902
|
+
response_stop_key: import_zod18.z.string(),
|
|
1903
|
+
response_stop_value: import_zod18.z.string()
|
|
1904
|
+
}).passthrough();
|
|
1905
|
+
var ConnectionParamsSchema = import_zod18.z.union([
|
|
1906
|
+
StreamingConnectionParamsSchema,
|
|
1907
|
+
RestConnectionParamsSchema
|
|
1908
|
+
]);
|
|
1850
1909
|
var TargetJobRequestSchema = import_zod18.z.object({
|
|
1851
1910
|
uuid: import_zod18.z.string(),
|
|
1852
1911
|
version: import_zod18.z.number().int().nullable().optional()
|
|
@@ -2572,9 +2631,9 @@ var CustomPromptSetVersionInfoSchema = import_zod18.z.object({
|
|
|
2572
2631
|
uuid: import_zod18.z.string(),
|
|
2573
2632
|
status: import_zod18.z.string(),
|
|
2574
2633
|
is_latest: import_zod18.z.boolean(),
|
|
2575
|
-
version: import_zod18.z.
|
|
2576
|
-
stats:
|
|
2577
|
-
snapshot_created_at: import_zod18.z.
|
|
2634
|
+
version: import_zod18.z.string().nullable().optional(),
|
|
2635
|
+
stats: PromptSetStatsSchema.nullable().optional(),
|
|
2636
|
+
snapshot_created_at: import_zod18.z.string().nullable().optional()
|
|
2578
2637
|
}).passthrough();
|
|
2579
2638
|
var CustomPromptCreateRequestSchema = import_zod18.z.object({
|
|
2580
2639
|
prompt: import_zod18.z.string(),
|
|
@@ -2779,7 +2838,13 @@ async function managementHttpRequest(opts) {
|
|
|
2779
2838
|
const url = new URL(`${stripped}${path}`);
|
|
2780
2839
|
if (params) {
|
|
2781
2840
|
for (const [key, value] of Object.entries(params)) {
|
|
2782
|
-
|
|
2841
|
+
if (Array.isArray(value)) {
|
|
2842
|
+
for (const v of value) {
|
|
2843
|
+
url.searchParams.append(key, v);
|
|
2844
|
+
}
|
|
2845
|
+
} else {
|
|
2846
|
+
url.searchParams.set(key, value);
|
|
2847
|
+
}
|
|
2783
2848
|
}
|
|
2784
2849
|
}
|
|
2785
2850
|
const headers = {
|
|
@@ -3367,13 +3432,23 @@ var ModelSecurityScansClient = class {
|
|
|
3367
3432
|
};
|
|
3368
3433
|
|
|
3369
3434
|
// src/model-security/security-groups-client.ts
|
|
3370
|
-
function
|
|
3435
|
+
function buildGroupListParams(opts) {
|
|
3371
3436
|
const params = {};
|
|
3372
3437
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
3373
3438
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
3374
|
-
if (opts?.
|
|
3375
|
-
if (opts?.
|
|
3376
|
-
if (opts?.
|
|
3439
|
+
if (opts?.sort_field !== void 0) params.sort_field = opts.sort_field;
|
|
3440
|
+
if (opts?.sort_dir !== void 0) params.sort_dir = opts.sort_dir;
|
|
3441
|
+
if (opts?.source_types !== void 0) params.source_types = opts.source_types;
|
|
3442
|
+
if (opts?.search_query !== void 0) params.search_query = opts.search_query;
|
|
3443
|
+
if (opts?.enabled_rules !== void 0) params.enabled_rules = opts.enabled_rules;
|
|
3444
|
+
return params;
|
|
3445
|
+
}
|
|
3446
|
+
function buildRuleInstanceListParams(opts) {
|
|
3447
|
+
const params = {};
|
|
3448
|
+
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
3449
|
+
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
3450
|
+
if (opts?.security_rule_uuid !== void 0) params.security_rule_uuid = opts.security_rule_uuid;
|
|
3451
|
+
if (opts?.state !== void 0) params.state = opts.state;
|
|
3377
3452
|
return params;
|
|
3378
3453
|
}
|
|
3379
3454
|
var ModelSecurityGroupsClient = class {
|
|
@@ -3411,7 +3486,7 @@ var ModelSecurityGroupsClient = class {
|
|
|
3411
3486
|
method: "GET",
|
|
3412
3487
|
baseUrl: this.baseUrl,
|
|
3413
3488
|
path: MODEL_SEC_SECURITY_GROUPS_PATH,
|
|
3414
|
-
params:
|
|
3489
|
+
params: buildGroupListParams(opts),
|
|
3415
3490
|
oauthClient: this.oauthClient,
|
|
3416
3491
|
numRetries: this.numRetries
|
|
3417
3492
|
});
|
|
@@ -3497,7 +3572,7 @@ var ModelSecurityGroupsClient = class {
|
|
|
3497
3572
|
method: "GET",
|
|
3498
3573
|
baseUrl: this.baseUrl,
|
|
3499
3574
|
path: `${MODEL_SEC_SECURITY_GROUPS_PATH}/${securityGroupUuid}/rule-instances`,
|
|
3500
|
-
params:
|
|
3575
|
+
params: buildRuleInstanceListParams(opts),
|
|
3501
3576
|
oauthClient: this.oauthClient,
|
|
3502
3577
|
numRetries: this.numRetries
|
|
3503
3578
|
});
|
|
@@ -3564,13 +3639,12 @@ var ModelSecurityGroupsClient = class {
|
|
|
3564
3639
|
};
|
|
3565
3640
|
|
|
3566
3641
|
// src/model-security/security-rules-client.ts
|
|
3567
|
-
function
|
|
3642
|
+
function buildRuleListParams(opts) {
|
|
3568
3643
|
const params = {};
|
|
3569
3644
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
3570
3645
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
3571
|
-
if (opts?.
|
|
3572
|
-
if (opts?.
|
|
3573
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
3646
|
+
if (opts?.source_type !== void 0) params.source_type = opts.source_type;
|
|
3647
|
+
if (opts?.search_query !== void 0) params.search_query = opts.search_query;
|
|
3574
3648
|
return params;
|
|
3575
3649
|
}
|
|
3576
3650
|
var ModelSecurityRulesClient = class {
|
|
@@ -3592,7 +3666,7 @@ var ModelSecurityRulesClient = class {
|
|
|
3592
3666
|
method: "GET",
|
|
3593
3667
|
baseUrl: this.baseUrl,
|
|
3594
3668
|
path: MODEL_SEC_SECURITY_RULES_PATH,
|
|
3595
|
-
params:
|
|
3669
|
+
params: buildRuleListParams(opts),
|
|
3596
3670
|
oauthClient: this.oauthClient,
|
|
3597
3671
|
numRetries: this.numRetries
|
|
3598
3672
|
});
|
|
@@ -3702,7 +3776,7 @@ var ModelSecurityClient = class {
|
|
|
3702
3776
|
};
|
|
3703
3777
|
|
|
3704
3778
|
// src/red-team/scans-client.ts
|
|
3705
|
-
function
|
|
3779
|
+
function buildListParams2(opts) {
|
|
3706
3780
|
const params = {};
|
|
3707
3781
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
3708
3782
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
@@ -3734,7 +3808,7 @@ var RedTeamScansClient = class {
|
|
|
3734
3808
|
}
|
|
3735
3809
|
/** List red team scan jobs with optional filters. */
|
|
3736
3810
|
async list(opts) {
|
|
3737
|
-
const params =
|
|
3811
|
+
const params = buildListParams2(opts);
|
|
3738
3812
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
3739
3813
|
if (opts?.job_type !== void 0) params.job_type = opts.job_type;
|
|
3740
3814
|
if (opts?.target_id !== void 0) params.target_id = opts.target_id;
|
|
@@ -3790,7 +3864,7 @@ var RedTeamScansClient = class {
|
|
|
3790
3864
|
};
|
|
3791
3865
|
|
|
3792
3866
|
// src/red-team/reports-client.ts
|
|
3793
|
-
function
|
|
3867
|
+
function buildListParams3(opts) {
|
|
3794
3868
|
const params = {};
|
|
3795
3869
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
3796
3870
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
@@ -3819,7 +3893,7 @@ var RedTeamReportsClient = class {
|
|
|
3819
3893
|
/** List attacks for a static scan. */
|
|
3820
3894
|
async listAttacks(jobId, opts) {
|
|
3821
3895
|
validateJobId(jobId);
|
|
3822
|
-
const params =
|
|
3896
|
+
const params = buildListParams3(opts);
|
|
3823
3897
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
3824
3898
|
if (opts?.severity !== void 0) params.severity = opts.severity;
|
|
3825
3899
|
if (opts?.category !== void 0) params.category = opts.category;
|
|
@@ -3948,7 +4022,7 @@ var RedTeamReportsClient = class {
|
|
|
3948
4022
|
/** List goals for a dynamic scan. */
|
|
3949
4023
|
async listGoals(jobId, opts) {
|
|
3950
4024
|
validateJobId(jobId);
|
|
3951
|
-
const params =
|
|
4025
|
+
const params = buildListParams3(opts);
|
|
3952
4026
|
if (opts?.goal_type !== void 0) params.goal_type = opts.goal_type;
|
|
3953
4027
|
const res = await managementHttpRequest({
|
|
3954
4028
|
method: "GET",
|
|
@@ -3973,7 +4047,7 @@ var RedTeamReportsClient = class {
|
|
|
3973
4047
|
method: "GET",
|
|
3974
4048
|
baseUrl: this.baseUrl,
|
|
3975
4049
|
path: `${RED_TEAM_REPORT_DYNAMIC_PATH}/${jobId}/goal/${goalId}/list-streams`,
|
|
3976
|
-
params:
|
|
4050
|
+
params: buildListParams3(opts),
|
|
3977
4051
|
oauthClient: this.oauthClient,
|
|
3978
4052
|
numRetries: this.numRetries
|
|
3979
4053
|
});
|
|
@@ -4029,7 +4103,7 @@ var RedTeamReportsClient = class {
|
|
|
4029
4103
|
};
|
|
4030
4104
|
|
|
4031
4105
|
// src/red-team/custom-attack-reports-client.ts
|
|
4032
|
-
function
|
|
4106
|
+
function buildListParams4(opts) {
|
|
4033
4107
|
const params = {};
|
|
4034
4108
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4035
4109
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
@@ -4089,7 +4163,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4089
4163
|
method: "GET",
|
|
4090
4164
|
baseUrl: this.baseUrl,
|
|
4091
4165
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/report/${jobId}/prompt-set/${promptSetId}/prompts`,
|
|
4092
|
-
params:
|
|
4166
|
+
params: buildListParams4(opts),
|
|
4093
4167
|
oauthClient: this.oauthClient,
|
|
4094
4168
|
numRetries: this.numRetries
|
|
4095
4169
|
});
|
|
@@ -4120,7 +4194,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4120
4194
|
method: "GET",
|
|
4121
4195
|
baseUrl: this.baseUrl,
|
|
4122
4196
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/job/${jobId}/list-custom-attacks`,
|
|
4123
|
-
params:
|
|
4197
|
+
params: buildListParams4(opts),
|
|
4124
4198
|
oauthClient: this.oauthClient,
|
|
4125
4199
|
numRetries: this.numRetries
|
|
4126
4200
|
});
|
|
@@ -4159,7 +4233,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4159
4233
|
};
|
|
4160
4234
|
|
|
4161
4235
|
// src/red-team/targets-client.ts
|
|
4162
|
-
function
|
|
4236
|
+
function buildListParams5(opts) {
|
|
4163
4237
|
const params = {};
|
|
4164
4238
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4165
4239
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
@@ -4178,12 +4252,15 @@ var RedTeamTargetsClient = class {
|
|
|
4178
4252
|
this.numRetries = opts.numRetries;
|
|
4179
4253
|
}
|
|
4180
4254
|
/** Create a new target. */
|
|
4181
|
-
async create(request) {
|
|
4255
|
+
async create(request, opts) {
|
|
4256
|
+
const params = {};
|
|
4257
|
+
if (opts?.validate !== void 0) params.validate = String(opts.validate);
|
|
4182
4258
|
const res = await managementHttpRequest({
|
|
4183
4259
|
method: "POST",
|
|
4184
4260
|
baseUrl: this.baseUrl,
|
|
4185
4261
|
path: RED_TEAM_TARGET_PATH,
|
|
4186
4262
|
body: request,
|
|
4263
|
+
params: Object.keys(params).length > 0 ? params : void 0,
|
|
4187
4264
|
oauthClient: this.oauthClient,
|
|
4188
4265
|
numRetries: this.numRetries
|
|
4189
4266
|
});
|
|
@@ -4191,7 +4268,7 @@ var RedTeamTargetsClient = class {
|
|
|
4191
4268
|
}
|
|
4192
4269
|
/** List targets with optional filters. */
|
|
4193
4270
|
async list(opts) {
|
|
4194
|
-
const params =
|
|
4271
|
+
const params = buildListParams5(opts);
|
|
4195
4272
|
if (opts?.target_type !== void 0) params.target_type = opts.target_type;
|
|
4196
4273
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4197
4274
|
if (opts?.active !== void 0) params.active = String(opts.active);
|
|
@@ -4223,18 +4300,21 @@ var RedTeamTargetsClient = class {
|
|
|
4223
4300
|
return res.data;
|
|
4224
4301
|
}
|
|
4225
4302
|
/** Update a target. */
|
|
4226
|
-
async update(uuid, request) {
|
|
4303
|
+
async update(uuid, request, opts) {
|
|
4227
4304
|
if (!isValidUuid(uuid)) {
|
|
4228
4305
|
throw new AISecSDKException(
|
|
4229
4306
|
`Invalid target uuid: ${uuid}`,
|
|
4230
4307
|
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
4231
4308
|
);
|
|
4232
4309
|
}
|
|
4310
|
+
const params = {};
|
|
4311
|
+
if (opts?.validate !== void 0) params.validate = String(opts.validate);
|
|
4233
4312
|
const res = await managementHttpRequest({
|
|
4234
4313
|
method: "PUT",
|
|
4235
4314
|
baseUrl: this.baseUrl,
|
|
4236
4315
|
path: `${RED_TEAM_TARGET_PATH}/${uuid}`,
|
|
4237
4316
|
body: request,
|
|
4317
|
+
params: Object.keys(params).length > 0 ? params : void 0,
|
|
4238
4318
|
oauthClient: this.oauthClient,
|
|
4239
4319
|
numRetries: this.numRetries
|
|
4240
4320
|
});
|
|
@@ -4307,7 +4387,7 @@ var RedTeamTargetsClient = class {
|
|
|
4307
4387
|
};
|
|
4308
4388
|
|
|
4309
4389
|
// src/red-team/custom-attacks-client.ts
|
|
4310
|
-
function
|
|
4390
|
+
function buildListParams6(opts) {
|
|
4311
4391
|
const params = {};
|
|
4312
4392
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4313
4393
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
@@ -4347,7 +4427,7 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4347
4427
|
}
|
|
4348
4428
|
/** List custom prompt sets. */
|
|
4349
4429
|
async listPromptSets(opts) {
|
|
4350
|
-
const params =
|
|
4430
|
+
const params = buildListParams6(opts);
|
|
4351
4431
|
if (opts?.active !== void 0) params.active = String(opts.active);
|
|
4352
4432
|
if (opts?.archive !== void 0) params.archive = String(opts.archive);
|
|
4353
4433
|
const res = await managementHttpRequest({
|
|
@@ -4445,6 +4525,33 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4445
4525
|
});
|
|
4446
4526
|
return res.data;
|
|
4447
4527
|
}
|
|
4528
|
+
/** Upload a CSV file of custom prompts for a prompt set. */
|
|
4529
|
+
async uploadPromptsCsv(promptSetUuid, file) {
|
|
4530
|
+
validateUuid(promptSetUuid, "prompt set uuid");
|
|
4531
|
+
const token = await this.oauthClient.getToken();
|
|
4532
|
+
const url = new URL(
|
|
4533
|
+
`${this.baseUrl.replace(/\/+$/, "")}${RED_TEAM_CUSTOM_ATTACK_PATH}/upload-custom-prompts-csv`
|
|
4534
|
+
);
|
|
4535
|
+
url.searchParams.set("prompt_set_uuid", promptSetUuid);
|
|
4536
|
+
const formData = new FormData();
|
|
4537
|
+
formData.append("file", file);
|
|
4538
|
+
const response = await fetch(url.toString(), {
|
|
4539
|
+
method: "POST",
|
|
4540
|
+
headers: {
|
|
4541
|
+
Authorization: `Bearer ${token}`,
|
|
4542
|
+
"User-Agent": USER_AGENT
|
|
4543
|
+
},
|
|
4544
|
+
body: formData
|
|
4545
|
+
});
|
|
4546
|
+
const text = await response.text();
|
|
4547
|
+
if (!response.ok) {
|
|
4548
|
+
throw new AISecSDKException(
|
|
4549
|
+
`Upload failed (${response.status}): ${text}`,
|
|
4550
|
+
"AISEC_SERVER_SIDE_ERROR" /* SERVER_SIDE_ERROR */
|
|
4551
|
+
);
|
|
4552
|
+
}
|
|
4553
|
+
return text ? JSON.parse(text) : { message: "ok", status: 201 };
|
|
4554
|
+
}
|
|
4448
4555
|
// -----------------------------------------------------------------------
|
|
4449
4556
|
// Prompt operations
|
|
4450
4557
|
// -----------------------------------------------------------------------
|
|
@@ -4463,7 +4570,7 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4463
4570
|
/** List prompts in a prompt set. */
|
|
4464
4571
|
async listPrompts(promptSetUuid, opts) {
|
|
4465
4572
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
4466
|
-
const params =
|
|
4573
|
+
const params = buildListParams6(opts);
|
|
4467
4574
|
if (opts?.active !== void 0) params.active = String(opts.active);
|
|
4468
4575
|
const res = await managementHttpRequest({
|
|
4469
4576
|
method: "GET",
|
|
@@ -4584,7 +4691,7 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4584
4691
|
};
|
|
4585
4692
|
|
|
4586
4693
|
// src/red-team/client.ts
|
|
4587
|
-
function
|
|
4694
|
+
function buildListParams7(opts) {
|
|
4588
4695
|
const params = {};
|
|
4589
4696
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4590
4697
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
@@ -4723,7 +4830,7 @@ var RedTeamClient = class {
|
|
|
4723
4830
|
method: "GET",
|
|
4724
4831
|
baseUrl: this.dataEndpoint,
|
|
4725
4832
|
path: `${RED_TEAM_ERROR_LOG_PATH}/${jobId}`,
|
|
4726
|
-
params:
|
|
4833
|
+
params: buildListParams7(opts),
|
|
4727
4834
|
oauthClient: this.oauthClient,
|
|
4728
4835
|
numRetries: this.numRetries
|
|
4729
4836
|
});
|
|
@@ -4794,6 +4901,7 @@ var RedTeamClient = class {
|
|
|
4794
4901
|
AuthType,
|
|
4795
4902
|
BEARER,
|
|
4796
4903
|
BaseResponseSchema,
|
|
4904
|
+
BedrockAccessConnectionParamsSchema,
|
|
4797
4905
|
BrandSubCategory,
|
|
4798
4906
|
Category,
|
|
4799
4907
|
CategoryModelSchema,
|
|
@@ -4801,6 +4909,7 @@ var RedTeamClient = class {
|
|
|
4801
4909
|
ComplianceReportSchema,
|
|
4802
4910
|
ComplianceSubCategory,
|
|
4803
4911
|
ComplianceTechniqueSchema,
|
|
4912
|
+
ConnectionParamsSchema,
|
|
4804
4913
|
Content,
|
|
4805
4914
|
CountByNameSchema,
|
|
4806
4915
|
CountedQuotaEnum,
|
|
@@ -4836,6 +4945,7 @@ var RedTeamClient = class {
|
|
|
4836
4945
|
DSDetailResultSchema,
|
|
4837
4946
|
DSResultMetadataSchema,
|
|
4838
4947
|
DashboardOverviewResponseSchema,
|
|
4948
|
+
DatabricksConnectionParamsSchema,
|
|
4839
4949
|
DateRangeFilter,
|
|
4840
4950
|
DeleteProfileConflictSchema,
|
|
4841
4951
|
DeleteProfileResponseSchema,
|
|
@@ -4869,6 +4979,7 @@ var RedTeamClient = class {
|
|
|
4869
4979
|
HEADER_AUTH_TOKEN,
|
|
4870
4980
|
HTTPValidationErrorSchema,
|
|
4871
4981
|
HTTP_FORCE_RETRY_STATUS_CODES,
|
|
4982
|
+
HuggingfaceConnectionParamsSchema,
|
|
4872
4983
|
IODetectedSchema,
|
|
4873
4984
|
JobAbortResponseSchema,
|
|
4874
4985
|
JobCreateRequestSchema,
|
|
@@ -4940,7 +5051,10 @@ var RedTeamClient = class {
|
|
|
4940
5051
|
ModelSecurityRuleResponseSchema,
|
|
4941
5052
|
ModelSecurityRulesClient,
|
|
4942
5053
|
ModelSecurityScansClient,
|
|
5054
|
+
MultiTurnStatefulConfigSchema,
|
|
5055
|
+
MultiTurnStatelessConfigSchema,
|
|
4943
5056
|
OAuthClient,
|
|
5057
|
+
OpenAIConnectionParamsSchema,
|
|
4944
5058
|
PAYLOAD_HASH,
|
|
4945
5059
|
PolicySchema,
|
|
4946
5060
|
PolicyType,
|
|
@@ -4998,6 +5112,7 @@ var RedTeamClient = class {
|
|
|
4998
5112
|
ResponseDetectedSchema,
|
|
4999
5113
|
ResponseDetectionDetailsSchema,
|
|
5000
5114
|
ResponseMode,
|
|
5115
|
+
RestConnectionParamsSchema,
|
|
5001
5116
|
RiskLevelSchema,
|
|
5002
5117
|
RiskRating,
|
|
5003
5118
|
RuleConfigurationSchema,
|
|
@@ -5054,6 +5169,7 @@ var RedTeamClient = class {
|
|
|
5054
5169
|
StreamIterationDataSchema,
|
|
5055
5170
|
StreamListResponseSchema,
|
|
5056
5171
|
StreamType,
|
|
5172
|
+
StreamingConnectionParamsSchema,
|
|
5057
5173
|
SubCategoryModelSchema,
|
|
5058
5174
|
SubCategoryStatsSchema,
|
|
5059
5175
|
TargetAdditionalContextSchema,
|