@cdot65/prisma-airs-sdk 0.14.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -60,6 +60,16 @@ __export(index_exports, {
60
60
  AI_SEC_API_TOKEN: () => AI_SEC_API_TOKEN,
61
61
  ASYNC_SCAN_PATH: () => ASYNC_SCAN_PATH,
62
62
  Action: () => Action,
63
+ AdapterCreateRequestSchema: () => AdapterCreateRequestSchema,
64
+ AdapterListItemSchema: () => AdapterListItemSchema,
65
+ AdapterListSchema: () => AdapterListSchema,
66
+ AdapterResponseSchema: () => AdapterResponseSchema,
67
+ AdapterUpdateRequestSchema: () => AdapterUpdateRequestSchema,
68
+ AdapterValidateRequestSchema: () => AdapterValidateRequestSchema,
69
+ AdapterValidateResponseSchema: () => AdapterValidateResponseSchema,
70
+ AdapterVarResponseSchema: () => AdapterVarResponseSchema,
71
+ AdapterVarSchema: () => AdapterVarSchema,
72
+ AdapterVarTypeSchema: () => AdapterVarTypeSchema,
63
73
  AdvancedDataProfileRequestSchema: () => AdvancedDataProfileRequestSchema,
64
74
  AgentEntrySchema: () => AgentEntrySchema,
65
75
  AgentMetaSchema: () => AgentMetaSchema,
@@ -300,6 +310,9 @@ __export(index_exports, {
300
310
  GatewayPluginSchema: () => GatewayPluginSchema,
301
311
  GatewayProviderCreateResponseSchema: () => GatewayProviderCreateResponseSchema,
302
312
  GatewayProviderSchema: () => GatewayProviderSchema,
313
+ GatewayRateLimitSchema: () => GatewayRateLimitSchema,
314
+ GatewayUsageLimitSchema: () => GatewayUsageLimitSchema,
315
+ GatewayWorkspaceCreateResponseSchema: () => GatewayWorkspaceCreateResponseSchema,
303
316
  GatewayWorkspaceDetailSchema: () => GatewayWorkspaceDetailSchema,
304
317
  GatewayWorkspaceSchema: () => GatewayWorkspaceSchema,
305
318
  GatewayWriteResponseSchema: () => GatewayWriteResponseSchema,
@@ -472,6 +485,8 @@ __export(index_exports, {
472
485
  PyPIAuthResponseSchema: () => PyPIAuthResponseSchema,
473
486
  QuotaDetailsSchema: () => QuotaDetailsSchema,
474
487
  QuotaSummarySchema: () => QuotaSummarySchema,
488
+ RED_TEAM_ADAPTER_PATH: () => RED_TEAM_ADAPTER_PATH,
489
+ RED_TEAM_ADAPTER_VALIDATE_PATH: () => RED_TEAM_ADAPTER_VALIDATE_PATH,
475
490
  RED_TEAM_CATEGORIES_PATH: () => RED_TEAM_CATEGORIES_PATH,
476
491
  RED_TEAM_CHANNELS_PATH: () => RED_TEAM_CHANNELS_PATH,
477
492
  RED_TEAM_CHANNELS_STATS_PATH: () => RED_TEAM_CHANNELS_STATS_PATH,
@@ -501,6 +516,7 @@ __export(index_exports, {
501
516
  RED_TEAM_TEMPLATE_PATH: () => RED_TEAM_TEMPLATE_PATH,
502
517
  RED_TEAM_TOKEN_ENDPOINT: () => RED_TEAM_TOKEN_ENDPOINT,
503
518
  RED_TEAM_TSG_ID: () => RED_TEAM_TSG_ID,
519
+ RedTeamAdaptersClient: () => RedTeamAdaptersClient,
504
520
  RedTeamCategory: () => RedTeamCategory,
505
521
  RedTeamClient: () => RedTeamClient,
506
522
  RedTeamCustomAttackReportsClient: () => RedTeamCustomAttackReportsClient,
@@ -682,7 +698,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 20;
682
698
  var MAX_CONNECTION_POOL_SIZE = 100;
683
699
  var MAX_NUMBER_OF_RETRIES = 5;
684
700
  var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
685
- var SDK_VERSION = "0.14.1";
701
+ var SDK_VERSION = "0.17.0";
686
702
  var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
687
703
  var DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
688
704
  var DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
@@ -757,6 +773,8 @@ var RED_TEAM_LANGUAGES_PATH = "/v1/languages";
757
773
  var RED_TEAM_ERROR_LOG_TARGET_PROFILE_PATH = "/v1/error-log/target-profile";
758
774
  var RED_TEAM_TARGET_PATH = "/v1/target";
759
775
  var RED_TEAM_TARGET_VALIDATE_AUTH_PATH = "/v1/target/validate-auth";
776
+ var RED_TEAM_ADAPTER_PATH = "/v1/adapters";
777
+ var RED_TEAM_ADAPTER_VALIDATE_PATH = "/v1/adapters/validate";
760
778
  var RED_TEAM_TEMPLATE_PATH = "/v1/template";
761
779
  var RED_TEAM_EULA_PATH = "/v1/eula";
762
780
  var RED_TEAM_INSTANCES_PATH = "/v1/instances";
@@ -4272,6 +4290,76 @@ var TenantLanguagesResponseSchema = import_zod33.z.object({
4272
4290
  supported_job_types: import_zod33.z.array(import_zod33.z.string()),
4273
4291
  languages: import_zod33.z.array(LanguageOptionSchema)
4274
4292
  }).passthrough();
4293
+ var AdapterVarTypeSchema = import_zod33.z.enum(["VAR", "SECRET"]);
4294
+ var AdapterVarSchema = import_zod33.z.object({
4295
+ key: import_zod33.z.string().max(255),
4296
+ value: import_zod33.z.string().nullable().optional(),
4297
+ type: AdapterVarTypeSchema
4298
+ });
4299
+ var AdapterVarResponseSchema = AdapterVarSchema.extend({
4300
+ is_redacted: import_zod33.z.boolean().optional()
4301
+ }).passthrough();
4302
+ var AdapterCreateRequestSchema = import_zod33.z.object({
4303
+ name: import_zod33.z.string().max(255),
4304
+ description: import_zod33.z.string().nullable().optional(),
4305
+ script_b64: import_zod33.z.string(),
4306
+ /** Optional while the adapter is a DRAFT; required to activate (`validate: true`). */
4307
+ network_broker_channel_uuid: import_zod33.z.string().uuid().nullable().optional(),
4308
+ variables: import_zod33.z.array(AdapterVarSchema).optional(),
4309
+ /** Sample prompt used to exercise the adapter end-to-end during validation. Not stored. */
4310
+ prompt: import_zod33.z.string()
4311
+ }).strict();
4312
+ var AdapterUpdateRequestSchema = import_zod33.z.object({
4313
+ name: import_zod33.z.string().max(255),
4314
+ description: import_zod33.z.string().nullable().optional(),
4315
+ script_b64: import_zod33.z.string(),
4316
+ network_broker_channel_uuid: import_zod33.z.string().uuid().nullable().optional(),
4317
+ variables: import_zod33.z.array(AdapterVarSchema).optional(),
4318
+ prompt: import_zod33.z.string()
4319
+ }).strict();
4320
+ var AdapterResponseSchema = import_zod33.z.object({
4321
+ uuid: import_zod33.z.string().uuid(),
4322
+ tsg_id: import_zod33.z.string(),
4323
+ name: import_zod33.z.string(),
4324
+ script_b64: import_zod33.z.string(),
4325
+ status: import_zod33.z.string(),
4326
+ description: import_zod33.z.string().nullable().optional(),
4327
+ network_broker_channel_uuid: import_zod33.z.string().uuid().nullable().optional(),
4328
+ variables: import_zod33.z.array(AdapterVarResponseSchema).optional(),
4329
+ /** Number of targets currently referencing this adapter. */
4330
+ target_count: import_zod33.z.number().int().optional(),
4331
+ created_at: import_zod33.z.string().nullable().optional(),
4332
+ updated_at: import_zod33.z.string().nullable().optional(),
4333
+ created_by_user_id: import_zod33.z.string().uuid().nullable().optional(),
4334
+ updated_by_user_id: import_zod33.z.string().uuid().nullable().optional()
4335
+ }).passthrough();
4336
+ var AdapterListItemSchema = import_zod33.z.object({
4337
+ uuid: import_zod33.z.string().uuid(),
4338
+ name: import_zod33.z.string(),
4339
+ status: import_zod33.z.string(),
4340
+ created_at: import_zod33.z.string(),
4341
+ updated_at: import_zod33.z.string(),
4342
+ created_by_user_id: import_zod33.z.string().uuid().nullable().optional(),
4343
+ target_count: import_zod33.z.number().int().nullable().optional()
4344
+ }).passthrough();
4345
+ var AdapterListSchema = import_zod33.z.object({
4346
+ pagination: RedTeamPaginationSchema,
4347
+ data: import_zod33.z.array(AdapterListItemSchema).optional()
4348
+ }).passthrough();
4349
+ var AdapterValidateRequestSchema = import_zod33.z.object({
4350
+ script_b64: import_zod33.z.string(),
4351
+ network_broker_channel_uuid: import_zod33.z.string().uuid(),
4352
+ prompt: import_zod33.z.string(),
4353
+ variables: import_zod33.z.array(AdapterVarSchema).optional(),
4354
+ /** Omit when validating a brand-new adapter. */
4355
+ adapter_uuid: import_zod33.z.string().uuid().nullable().optional()
4356
+ }).strict();
4357
+ var AdapterValidateResponseSchema = import_zod33.z.object({
4358
+ validated: import_zod33.z.boolean(),
4359
+ stdout: import_zod33.z.string().nullable().optional(),
4360
+ stderr: import_zod33.z.string().nullable().optional(),
4361
+ traceback: import_zod33.z.string().nullable().optional()
4362
+ }).passthrough();
4275
4363
  var TargetRequestBaseFields = {
4276
4364
  name: import_zod33.z.string(),
4277
4365
  description: import_zod33.z.string().nullable().optional(),
@@ -4285,7 +4373,11 @@ var TargetRequestBaseFields = {
4285
4373
  target_background: TargetBackgroundSchema.nullable().optional(),
4286
4374
  additional_context: TargetAdditionalContextSchema.nullable().optional(),
4287
4375
  extra_info: import_zod33.z.record(import_zod33.z.unknown()).nullable().optional(),
4288
- network_broker_channel_uuid: import_zod33.z.string().nullable().optional()
4376
+ network_broker_channel_uuid: import_zod33.z.string().nullable().optional(),
4377
+ /** UUID of the custom target adapter to use. Required when connection_type is CUSTOM_TARGET_ADAPTER. */
4378
+ adapter_uuid: import_zod33.z.string().uuid().nullable().optional(),
4379
+ /** Per-target overrides for the adapter's variables. Array of AdapterVar objects. */
4380
+ adapter_variable_overrides: import_zod33.z.array(AdapterVarSchema).nullable().optional()
4289
4381
  };
4290
4382
  var TargetCreateRequestSchema = import_zod33.z.object(TargetRequestBaseFields).strict();
4291
4383
  var TargetUpdateRequestSchema = import_zod33.z.object(TargetRequestBaseFields).strict();
@@ -4677,6 +4769,20 @@ var aiGatewayList = (item) => import_zod35.z.object({
4677
4769
  has_more: import_zod35.z.boolean().optional(),
4678
4770
  data: import_zod35.z.array(item)
4679
4771
  }).passthrough();
4772
+ var GatewayUsageLimitSchema = import_zod35.z.object({
4773
+ credit_limit: import_zod35.z.number().optional(),
4774
+ type: import_zod35.z.string().optional(),
4775
+ alert_threshold: import_zod35.z.number().optional(),
4776
+ periodic_reset: import_zod35.z.string().nullable().optional(),
4777
+ periodic_reset_days: import_zod35.z.number().nullable().optional(),
4778
+ next_usage_reset_at: import_zod35.z.string().nullable().optional()
4779
+ }).passthrough();
4780
+ var GatewayRateLimitSchema = import_zod35.z.object({
4781
+ type: import_zod35.z.string().optional(),
4782
+ unit: import_zod35.z.string().optional(),
4783
+ value: import_zod35.z.number().optional()
4784
+ }).passthrough();
4785
+ var limitsField = (policy) => import_zod35.z.union([import_zod35.z.array(policy), import_zod35.z.record(import_zod35.z.unknown())]).nullable();
4680
4786
  var aiGatewayGroupList = (item) => import_zod35.z.object({
4681
4787
  object: import_zod35.z.string(),
4682
4788
  is_quota_exceeded: import_zod35.z.boolean(),
@@ -4883,7 +4989,9 @@ var GatewayWorkspaceSchema = import_zod35.z.object({
4883
4989
  slug: import_zod35.z.string(),
4884
4990
  name: import_zod35.z.string(),
4885
4991
  icon: import_zod35.z.string().nullable(),
4886
- description: import_zod35.z.string(),
4992
+ // Nullable: a workspace created without one returns null, and upstream declares it
4993
+ // `nullable: true`. Observed on an archived workspace (#213).
4994
+ description: import_zod35.z.string().nullable(),
4887
4995
  created_at: import_zod35.z.string(),
4888
4996
  last_updated_at: import_zod35.z.string(),
4889
4997
  is_default: import_zod35.z.number(),
@@ -4894,18 +5002,38 @@ var GatewayWorkspaceSchema = import_zod35.z.object({
4894
5002
  var GatewayWorkspaceDetailSchema = import_zod35.z.object({
4895
5003
  id: import_zod35.z.string(),
4896
5004
  name: import_zod35.z.string(),
4897
- description: import_zod35.z.string(),
5005
+ /** Nullable — see `GatewayWorkspaceSchema.description`. */
5006
+ description: import_zod35.z.string().nullable(),
4898
5007
  created_at: import_zod35.z.string(),
4899
5008
  last_updated_at: import_zod35.z.string(),
4900
5009
  is_default: import_zod35.z.number(),
4901
5010
  slug: import_zod35.z.string(),
4902
5011
  icon: import_zod35.z.string().nullable(),
4903
5012
  defaults: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
4904
- usage_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
4905
- rate_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
5013
+ usage_limits: limitsField(GatewayUsageLimitSchema),
5014
+ rate_limits: limitsField(GatewayRateLimitSchema),
4906
5015
  security_settings: import_zod35.z.record(import_zod35.z.boolean()).optional(),
4907
5016
  data_plane_security_settings: import_zod35.z.record(import_zod35.z.unknown()).optional(),
4908
- settings: import_zod35.z.record(import_zod35.z.unknown()).optional()
5017
+ settings: import_zod35.z.record(import_zod35.z.unknown()).optional(),
5018
+ /**
5019
+ * Lifecycle state. **Diverges from the list row**: `list()` reports `'active'` for a
5020
+ * workspace whose `get()` reports `null` (observed live 2026-08-01). Prefer the list value,
5021
+ * or treat a `null` here as "unknown", not as "inactive".
5022
+ */
5023
+ status: import_zod35.z.string().nullable().optional()
5024
+ }).passthrough();
5025
+ var GatewayWorkspaceCreateResponseSchema = import_zod35.z.object({
5026
+ id: import_zod35.z.string(),
5027
+ name: import_zod35.z.string(),
5028
+ slug: import_zod35.z.string(),
5029
+ description: import_zod35.z.string().nullable(),
5030
+ created_at: import_zod35.z.string(),
5031
+ last_updated_at: import_zod35.z.string(),
5032
+ scope_name: import_zod35.z.string(),
5033
+ object: import_zod35.z.string(),
5034
+ defaults: import_zod35.z.record(import_zod35.z.unknown()).nullable().optional(),
5035
+ /** Seeded workspace members. Present on create only. */
5036
+ users: import_zod35.z.array(import_zod35.z.unknown()).optional()
4909
5037
  }).passthrough();
4910
5038
  var ListWorkspacesResponseSchema = aiGatewayList(GatewayWorkspaceSchema);
4911
5039
  var GatewayConfigSchema = import_zod35.z.object({
@@ -5021,8 +5149,8 @@ var GatewayIntegrationModelsResponseSchema = import_zod35.z.object({
5021
5149
  }).passthrough();
5022
5150
  var GatewayIntegrationWorkspaceSchema = import_zod35.z.object({
5023
5151
  id: import_zod35.z.string(),
5024
- usage_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
5025
- rate_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
5152
+ usage_limits: limitsField(GatewayUsageLimitSchema),
5153
+ rate_limits: limitsField(GatewayRateLimitSchema),
5026
5154
  enabled: import_zod35.z.boolean(),
5027
5155
  status: import_zod35.z.string(),
5028
5156
  created_at: import_zod35.z.string(),
@@ -5031,8 +5159,8 @@ var GatewayIntegrationWorkspaceSchema = import_zod35.z.object({
5031
5159
  }).passthrough();
5032
5160
  var GatewayGlobalWorkspaceAccessSchema = import_zod35.z.object({
5033
5161
  enabled: import_zod35.z.boolean(),
5034
- rate_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable(),
5035
- usage_limits: import_zod35.z.record(import_zod35.z.unknown()).nullable()
5162
+ rate_limits: limitsField(GatewayRateLimitSchema),
5163
+ usage_limits: limitsField(GatewayUsageLimitSchema)
5036
5164
  }).passthrough();
5037
5165
  var GatewayIntegrationWorkspacesResponseSchema = import_zod35.z.object({
5038
5166
  workspaces: import_zod35.z.array(GatewayIntegrationWorkspaceSchema),
@@ -5384,6 +5512,14 @@ function assertUuid(value, fieldName) {
5384
5512
  );
5385
5513
  }
5386
5514
  }
5515
+ function assertWorkspaceRef(value, fieldName) {
5516
+ if (!isValidUuid(value) && !/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(value)) {
5517
+ throw new AISecSDKException(
5518
+ `Invalid ${fieldName}: ${value} (expected a workspace UUID or slug)`,
5519
+ "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
5520
+ );
5521
+ }
5522
+ }
5387
5523
  function assertNumericId(value, fieldName) {
5388
5524
  if (!/^\d+$/.test(value)) {
5389
5525
  throw new AISecSDKException(
@@ -10206,6 +10342,176 @@ var RedTeamNetworkBrokerClient = class {
10206
10342
  }
10207
10343
  };
10208
10344
 
10345
+ // src/red-team/adapters-client.ts
10346
+ var RedTeamAdaptersClient = class {
10347
+ baseUrl;
10348
+ auth;
10349
+ numRetries;
10350
+ constructor(opts) {
10351
+ this.baseUrl = opts.baseUrl;
10352
+ this.auth = opts.auth;
10353
+ this.numRetries = opts.numRetries;
10354
+ }
10355
+ /**
10356
+ * Create a new custom target adapter.
10357
+ * @param body - Adapter creation request (name, base64 script, variables, validation prompt).
10358
+ * @param opts - Set validate: false to save as DRAFT without running the script.
10359
+ * @returns The created adapter.
10360
+ * @example
10361
+ * ```ts
10362
+ * const adapter = await rt.adapters.create({
10363
+ * name: 'my-adapter',
10364
+ * script_b64: Buffer.from(script).toString('base64'),
10365
+ * network_broker_channel_uuid: '550e8400-...',
10366
+ * variables: [{ key: 'endpoint', value: 'http://...', type: 'VAR' }],
10367
+ * prompt: 'Hello',
10368
+ * }, { validate: true });
10369
+ * ```
10370
+ */
10371
+ async create(body, opts) {
10372
+ const validate = opts?.validate ?? true;
10373
+ return request({
10374
+ method: "POST",
10375
+ baseUrl: this.baseUrl,
10376
+ path: RED_TEAM_ADAPTER_PATH,
10377
+ params: { validate: String(validate) },
10378
+ body,
10379
+ responseSchema: AdapterResponseSchema,
10380
+ auth: this.auth,
10381
+ numRetries: this.numRetries
10382
+ });
10383
+ }
10384
+ /**
10385
+ * List adapters with optional pagination.
10386
+ * @param opts - Optional limit/skip/search.
10387
+ * @returns Paginated list of adapters.
10388
+ * @example
10389
+ * ```ts
10390
+ * const { data } = await rt.adapters.list({ limit: 20 });
10391
+ * // data => [{ uuid: '...', name: 'my-adapter', status: 'ACTIVE' }]
10392
+ * ```
10393
+ */
10394
+ async list(opts) {
10395
+ return request({
10396
+ method: "GET",
10397
+ baseUrl: this.baseUrl,
10398
+ path: RED_TEAM_ADAPTER_PATH,
10399
+ params: serializeListing(opts),
10400
+ responseSchema: AdapterListSchema,
10401
+ auth: this.auth,
10402
+ numRetries: this.numRetries
10403
+ });
10404
+ }
10405
+ /**
10406
+ * Get a single adapter by UUID.
10407
+ * @param uuid - Adapter UUID.
10408
+ * @returns The adapter detail.
10409
+ * @example
10410
+ * ```ts
10411
+ * const adapter = await rt.adapters.get('550e8400-e29b-41d4-a716-446655440000');
10412
+ * // adapter.status => 'ACTIVE'
10413
+ * ```
10414
+ */
10415
+ async get(uuid) {
10416
+ assertUuid(uuid, "adapter uuid");
10417
+ return request({
10418
+ method: "GET",
10419
+ baseUrl: this.baseUrl,
10420
+ path: `${RED_TEAM_ADAPTER_PATH}/${uuid}`,
10421
+ responseSchema: AdapterResponseSchema,
10422
+ auth: this.auth,
10423
+ numRetries: this.numRetries
10424
+ });
10425
+ }
10426
+ /**
10427
+ * Update an adapter. **Full replacement (PUT), not a patch** — `name`, `script_b64`, and
10428
+ * `prompt` are required just as on create. For `variables`, the list defines the complete
10429
+ * desired key set: a provided value sets it, `null` keeps the stored value (unchanged
10430
+ * secrets), and omitting a key **deletes** that variable.
10431
+ * @param uuid - Adapter UUID.
10432
+ * @param body - The complete adapter definition.
10433
+ * @param opts - Set validate: false to save as DRAFT without re-running the script.
10434
+ * @returns The updated adapter.
10435
+ * @example
10436
+ * ```ts
10437
+ * const updated = await rt.adapters.update('550e8400-...', {
10438
+ * name: 'my-keycloak-agent',
10439
+ * script_b64: Buffer.from(newScript).toString('base64'),
10440
+ * prompt: 'What is the capital of France?',
10441
+ * variables: [
10442
+ * { key: 'endpoint', value: 'http://agent.svc:8080', type: 'VAR' },
10443
+ * { key: 'client_secret', value: null, type: 'SECRET' }, // null keeps stored secret
10444
+ * ],
10445
+ * });
10446
+ * ```
10447
+ */
10448
+ async update(uuid, body, opts) {
10449
+ assertUuid(uuid, "adapter uuid");
10450
+ const validate = opts?.validate ?? true;
10451
+ return request({
10452
+ method: "PUT",
10453
+ baseUrl: this.baseUrl,
10454
+ path: `${RED_TEAM_ADAPTER_PATH}/${uuid}`,
10455
+ params: { validate: String(validate) },
10456
+ body,
10457
+ responseSchema: AdapterResponseSchema,
10458
+ auth: this.auth,
10459
+ numRetries: this.numRetries
10460
+ });
10461
+ }
10462
+ /**
10463
+ * Delete an adapter.
10464
+ * @param uuid - Adapter UUID.
10465
+ * @example
10466
+ * ```ts
10467
+ * await rt.adapters.delete('550e8400-e29b-41d4-a716-446655440000');
10468
+ * ```
10469
+ */
10470
+ async delete(uuid) {
10471
+ assertUuid(uuid, "adapter uuid");
10472
+ return request({
10473
+ method: "DELETE",
10474
+ baseUrl: this.baseUrl,
10475
+ path: `${RED_TEAM_ADAPTER_PATH}/${uuid}`,
10476
+ responseSchema: BaseResponseSchema.optional(),
10477
+ allowEmptyBody: true,
10478
+ auth: this.auth,
10479
+ numRetries: this.numRetries
10480
+ });
10481
+ }
10482
+ /**
10483
+ * Validate an adapter script without saving anything. Runs the script end-to-end through the
10484
+ * network broker channel using the sample prompt, and returns the execution outcome —
10485
+ * `validated` plus the script's `stdout` / `stderr` / `traceback` — not an adapter record.
10486
+ *
10487
+ * This endpoint has its own request shape: no `name`, `network_broker_channel_uuid` is
10488
+ * required, and `adapter_uuid` may reference an existing adapter so `null` variable values
10489
+ * are resolved from its stored secrets before the run.
10490
+ * @param body - Script, channel, prompt, and optionally variables / an existing adapter UUID.
10491
+ * @returns The validation outcome.
10492
+ * @example
10493
+ * ```ts
10494
+ * const result = await rt.adapters.validate({
10495
+ * script_b64: Buffer.from(script).toString('base64'),
10496
+ * network_broker_channel_uuid: '550e8400-...',
10497
+ * prompt: 'Hello',
10498
+ * });
10499
+ * if (!result.validated) console.error(result.stderr ?? result.traceback);
10500
+ * ```
10501
+ */
10502
+ async validate(body) {
10503
+ return request({
10504
+ method: "POST",
10505
+ baseUrl: this.baseUrl,
10506
+ path: RED_TEAM_ADAPTER_VALIDATE_PATH,
10507
+ body,
10508
+ responseSchema: AdapterValidateResponseSchema,
10509
+ auth: this.auth,
10510
+ numRetries: this.numRetries
10511
+ });
10512
+ }
10513
+ };
10514
+
10209
10515
  // src/red-team/client.ts
10210
10516
  var RedTeamClient = class {
10211
10517
  /** Data plane scan operations. */
@@ -10224,6 +10530,8 @@ var RedTeamClient = class {
10224
10530
  instances;
10225
10531
  /** Network broker channel operations (distinct network broker base URL). */
10226
10532
  networkBroker;
10533
+ /** Management plane custom target adapter operations. */
10534
+ adapters;
10227
10535
  dataEndpoint;
10228
10536
  mgmtEndpoint;
10229
10537
  auth;
@@ -10262,6 +10570,7 @@ var RedTeamClient = class {
10262
10570
  });
10263
10571
  this.eula = new RedTeamEulaClient({ baseUrl: mgmtEndpoint, auth, numRetries });
10264
10572
  this.instances = new RedTeamInstancesClient({ baseUrl: mgmtEndpoint, auth, numRetries });
10573
+ this.adapters = new RedTeamAdaptersClient({ baseUrl: mgmtEndpoint, auth, numRetries });
10265
10574
  this.networkBroker = new RedTeamNetworkBrokerClient({
10266
10575
  baseUrl: networkBrokerEndpoint,
10267
10576
  auth,
@@ -10959,30 +11268,49 @@ var AIGatewayTelemetryClient = class {
10959
11268
  // src/ai-gateway/workspaces-client.ts
10960
11269
  var AIGatewayWorkspacesClient = class {
10961
11270
  baseUrl;
11271
+ adminBaseUrl;
10962
11272
  auth;
10963
11273
  numRetries;
10964
11274
  constructor(opts) {
10965
11275
  this.baseUrl = opts.baseUrl;
11276
+ this.adminBaseUrl = opts.adminBaseUrl;
10966
11277
  this.auth = opts.auth;
10967
11278
  this.numRetries = opts.numRetries;
10968
11279
  }
11280
+ urlFor(plane) {
11281
+ return plane === "admin" ? this.adminBaseUrl : this.baseUrl;
11282
+ }
10969
11283
  /**
10970
- * List workspaces visible to the caller.
10971
- * @returns All workspaces, each with the `scope_name` that grants data-plane access to it.
11284
+ * List workspaces.
11285
+ *
11286
+ * Two defaults worth knowing, because each one hides rows:
11287
+ *
11288
+ * 1. **Active only.** Without `status`, archived workspaces are omitted. Pass
11289
+ * `{ status: 'archived' }` to see them — that is where {@link AIGatewayWorkspacesClient.delete}
11290
+ * leaves a workspace.
11291
+ * 2. **Your scope only.** The data plane returns just the workspaces your service account holds a
11292
+ * workspace-scope grant on. Pass `{ plane: 'admin' }` to enumerate the whole tenant.
11293
+ *
11294
+ * @param options - Optional status filter and plane selection.
11295
+ * @returns Workspaces, each with the `scope_name` that grants data-plane access to it.
10972
11296
  * @example
10973
11297
  * ```ts
10974
11298
  * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
10975
11299
  * const gw = new AIGatewayClient();
10976
11300
  *
10977
- * const ws = await gw.workspaces.list();
10978
- * // ws.data[0] => { slug: 'ws-main-a-349e0e', scope_name: 'main_airs_workspace_1852583913', ... }
11301
+ * const mine = await gw.workspaces.list();
11302
+ * // mine.data[0] => { slug: 'ws-main-a-349e0e', scope_name: 'main_airs_workspace_1852583913', ... }
11303
+ *
11304
+ * const everything = await gw.workspaces.list({ plane: 'admin' });
11305
+ * const archived = await gw.workspaces.list({ plane: 'admin', status: 'archived' });
10979
11306
  * ```
10980
11307
  */
10981
- async list() {
11308
+ async list(options = {}) {
10982
11309
  return request({
10983
11310
  method: "GET",
10984
- baseUrl: this.baseUrl,
11311
+ baseUrl: this.urlFor(options.plane),
10985
11312
  path: AI_GW_WORKSPACES_PATH,
11313
+ params: options.status ? { status: options.status } : void 0,
10986
11314
  responseSchema: ListWorkspacesResponseSchema,
10987
11315
  auth: this.auth,
10988
11316
  numRetries: this.numRetries
@@ -10990,7 +11318,16 @@ var AIGatewayWorkspacesClient = class {
10990
11318
  }
10991
11319
  /**
10992
11320
  * Fetch one workspace, including its security and rate-limit settings.
10993
- * @param workspaceId - Workspace UUID.
11321
+ *
11322
+ * @param workspaceRef - Workspace UUID **or** slug; the API accepts both.
11323
+ * @param options - Plane selection. A workspace outside your workspace scope answers `403 AB03`
11324
+ * on the data plane, not `404`; re-read it with `{ plane: 'admin' }`.
11325
+ *
11326
+ * **Archived workspaces are not retrievable here.** Once
11327
+ * {@link AIGatewayWorkspacesClient.delete} has archived a workspace, this returns `404 AB08`
11328
+ * for both its UUID and its slug, on either plane (verified live 2026-08-01) — even though the
11329
+ * row is still listed by `list({ status: 'archived' })`. Treat a 404 after a delete as expected,
11330
+ * and use the list filter to inspect archived workspaces.
10994
11331
  * @returns Workspace detail; list rows do not carry the settings blocks.
10995
11332
  * @example
10996
11333
  * ```ts
@@ -10999,19 +11336,133 @@ var AIGatewayWorkspacesClient = class {
10999
11336
  *
11000
11337
  * const ws = await gw.workspaces.get('16f7e90d-382a-4e78-b577-1b01eb5f8297');
11001
11338
  * // ws.security_settings?.membersViewLogs => true
11339
+ *
11340
+ * // Slugs work too, and the admin plane reaches workspaces you aren't scoped to:
11341
+ * const other = await gw.workspaces.get('ws-produc-985697', { plane: 'admin' });
11002
11342
  * ```
11003
11343
  */
11004
- async get(workspaceId) {
11005
- assertUuid(workspaceId, "workspaceId");
11344
+ async get(workspaceRef, options = {}) {
11345
+ assertWorkspaceRef(workspaceRef, "workspaceRef");
11006
11346
  return request({
11007
11347
  method: "GET",
11008
- baseUrl: this.baseUrl,
11009
- path: `${AI_GW_WORKSPACES_PATH}/${workspaceId}`,
11348
+ baseUrl: this.urlFor(options.plane),
11349
+ path: `${AI_GW_WORKSPACES_PATH}/${workspaceRef}`,
11010
11350
  responseSchema: GatewayWorkspaceDetailSchema,
11011
11351
  auth: this.auth,
11012
11352
  numRetries: this.numRetries
11013
11353
  });
11014
11354
  }
11355
+ /**
11356
+ * Create a workspace. **Admin plane** — needs a tenant-root admin role.
11357
+ *
11358
+ * @param body - `name` and `scope_name` are both required; the API rejects a body missing either.
11359
+ * @returns The created workspace. Unlike `configs`/`guardrails`/`providers`/`deployments`,
11360
+ * which return short receipts, this returns most of the record — but not `status`,
11361
+ * `is_default`, `icon`, `usage_limits`, `rate_limits`, or the settings blocks. Call
11362
+ * {@link AIGatewayWorkspacesClient.get} when you need those.
11363
+ * @example
11364
+ * ```ts
11365
+ * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
11366
+ * const gw = new AIGatewayClient();
11367
+ *
11368
+ * const created = await gw.workspaces.create({
11369
+ * name: 'Production',
11370
+ * scope_name: 'ws_production_bx7qw0', // the SCM scope, not derived from name
11371
+ * description: 'All production applications',
11372
+ * defaults: { metadata: { env: 'production' } },
11373
+ * rate_limits: [{ type: 'requests', unit: 'rpm', value: 100 }],
11374
+ * });
11375
+ * ```
11376
+ */
11377
+ async create(body) {
11378
+ if (!body.name) {
11379
+ throw new AISecSDKException("Missing name", "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
11380
+ }
11381
+ if (!body.scope_name) {
11382
+ throw new AISecSDKException("Missing scope_name", "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
11383
+ }
11384
+ return request({
11385
+ method: "POST",
11386
+ baseUrl: this.adminBaseUrl,
11387
+ path: AI_GW_WORKSPACES_PATH,
11388
+ body,
11389
+ responseSchema: GatewayWorkspaceCreateResponseSchema,
11390
+ auth: this.auth,
11391
+ numRetries: this.numRetries
11392
+ });
11393
+ }
11394
+ /**
11395
+ * Update a workspace. **Admin plane.** Partial patch — send only the fields that change.
11396
+ *
11397
+ * @param workspaceRef - Workspace UUID or slug.
11398
+ * @param body - At least one field. An empty patch is rejected locally, mirroring the API's own
11399
+ * "No update fields provided" rejection, so a typo'd caller fails without a round trip.
11400
+ * @returns An **empty object** — the API acknowledges the write without echoing the record
11401
+ * (verified live 2026-08-01). The change does persist; re-read with
11402
+ * {@link AIGatewayWorkspacesClient.get} to see it.
11403
+ * @example
11404
+ * ```ts
11405
+ * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
11406
+ * const gw = new AIGatewayClient();
11407
+ *
11408
+ * await gw.workspaces.update('ws-produc-985697', {
11409
+ * description: 'Production workloads, us-east',
11410
+ * });
11411
+ * ```
11412
+ */
11413
+ async update(workspaceRef, body) {
11414
+ assertWorkspaceRef(workspaceRef, "workspaceRef");
11415
+ if (Object.keys(body).length === 0) {
11416
+ throw new AISecSDKException(
11417
+ "Empty update: provide at least one of name, description, icon, defaults, usage_limits, rate_limits",
11418
+ "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
11419
+ );
11420
+ }
11421
+ return request({
11422
+ method: "PUT",
11423
+ baseUrl: this.adminBaseUrl,
11424
+ path: `${AI_GW_WORKSPACES_PATH}/${workspaceRef}`,
11425
+ body,
11426
+ responseSchema: GatewayWriteResponseSchema,
11427
+ auth: this.auth,
11428
+ numRetries: this.numRetries
11429
+ });
11430
+ }
11431
+ /**
11432
+ * Delete a workspace. **Admin plane.**
11433
+ *
11434
+ * This is a **soft delete**: the workspace is archived, not destroyed. It vanishes from a default
11435
+ * {@link AIGatewayWorkspacesClient.list} but stays visible via `list({ status: 'archived' })`.
11436
+ * Note that `list` is the *only* way to see it afterwards —
11437
+ * {@link AIGatewayWorkspacesClient.get} answers `404 AB08` for an archived workspace.
11438
+ * Same semantics as `deployments.delete()`, and the opposite of `configs`/`guardrails`/`providers`,
11439
+ * which hard delete. There is no hard delete for workspaces.
11440
+ *
11441
+ * Takes no query parameters — unlike `integrations.delete()` and `deployments.delete()`, which
11442
+ * both require `organisation_id`.
11443
+ *
11444
+ * @param workspaceRef - Workspace UUID or slug.
11445
+ * @example
11446
+ * ```ts
11447
+ * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
11448
+ * const gw = new AIGatewayClient();
11449
+ *
11450
+ * await gw.workspaces.delete('ws-produc-985697');
11451
+ *
11452
+ * // Still there, archived:
11453
+ * const gone = await gw.workspaces.list({ plane: 'admin', status: 'archived' });
11454
+ * ```
11455
+ */
11456
+ async delete(workspaceRef) {
11457
+ assertWorkspaceRef(workspaceRef, "workspaceRef");
11458
+ return request({
11459
+ method: "DELETE",
11460
+ baseUrl: this.adminBaseUrl,
11461
+ path: `${AI_GW_WORKSPACES_PATH}/${workspaceRef}`,
11462
+ auth: this.auth,
11463
+ numRetries: this.numRetries
11464
+ });
11465
+ }
11015
11466
  };
11016
11467
 
11017
11468
  // src/ai-gateway/configs-client.ts
@@ -12333,7 +12784,7 @@ var AIGatewayClient = class {
12333
12784
  const dataOpts = { baseUrl: dataEndpoint, auth, numRetries };
12334
12785
  const adminOpts = { baseUrl: adminEndpoint, auth, numRetries };
12335
12786
  this.telemetry = new AIGatewayTelemetryClient({ ...dataOpts, tsgId });
12336
- this.workspaces = new AIGatewayWorkspacesClient(dataOpts);
12787
+ this.workspaces = new AIGatewayWorkspacesClient({ ...dataOpts, adminBaseUrl: adminEndpoint });
12337
12788
  this.configs = new AIGatewayConfigsClient(dataOpts);
12338
12789
  this.guardrails = new AIGatewayGuardrailsClient(dataOpts);
12339
12790
  this.providers = new AIGatewayProvidersClient(dataOpts);
@@ -12388,6 +12839,16 @@ var AIGatewayClient = class {
12388
12839
  AI_SEC_API_TOKEN,
12389
12840
  ASYNC_SCAN_PATH,
12390
12841
  Action,
12842
+ AdapterCreateRequestSchema,
12843
+ AdapterListItemSchema,
12844
+ AdapterListSchema,
12845
+ AdapterResponseSchema,
12846
+ AdapterUpdateRequestSchema,
12847
+ AdapterValidateRequestSchema,
12848
+ AdapterValidateResponseSchema,
12849
+ AdapterVarResponseSchema,
12850
+ AdapterVarSchema,
12851
+ AdapterVarTypeSchema,
12391
12852
  AdvancedDataProfileRequestSchema,
12392
12853
  AgentEntrySchema,
12393
12854
  AgentMetaSchema,
@@ -12628,6 +13089,9 @@ var AIGatewayClient = class {
12628
13089
  GatewayPluginSchema,
12629
13090
  GatewayProviderCreateResponseSchema,
12630
13091
  GatewayProviderSchema,
13092
+ GatewayRateLimitSchema,
13093
+ GatewayUsageLimitSchema,
13094
+ GatewayWorkspaceCreateResponseSchema,
12631
13095
  GatewayWorkspaceDetailSchema,
12632
13096
  GatewayWorkspaceSchema,
12633
13097
  GatewayWriteResponseSchema,
@@ -12800,6 +13264,8 @@ var AIGatewayClient = class {
12800
13264
  PyPIAuthResponseSchema,
12801
13265
  QuotaDetailsSchema,
12802
13266
  QuotaSummarySchema,
13267
+ RED_TEAM_ADAPTER_PATH,
13268
+ RED_TEAM_ADAPTER_VALIDATE_PATH,
12803
13269
  RED_TEAM_CATEGORIES_PATH,
12804
13270
  RED_TEAM_CHANNELS_PATH,
12805
13271
  RED_TEAM_CHANNELS_STATS_PATH,
@@ -12829,6 +13295,7 @@ var AIGatewayClient = class {
12829
13295
  RED_TEAM_TEMPLATE_PATH,
12830
13296
  RED_TEAM_TOKEN_ENDPOINT,
12831
13297
  RED_TEAM_TSG_ID,
13298
+ RedTeamAdaptersClient,
12832
13299
  RedTeamCategory,
12833
13300
  RedTeamClient,
12834
13301
  RedTeamCustomAttackReportsClient,