@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.js CHANGED
@@ -29,7 +29,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 20;
29
29
  var MAX_CONNECTION_POOL_SIZE = 100;
30
30
  var MAX_NUMBER_OF_RETRIES = 5;
31
31
  var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
32
- var SDK_VERSION = "0.14.1";
32
+ var SDK_VERSION = "0.17.0";
33
33
  var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
34
34
  var DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
35
35
  var DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
@@ -104,6 +104,8 @@ var RED_TEAM_LANGUAGES_PATH = "/v1/languages";
104
104
  var RED_TEAM_ERROR_LOG_TARGET_PROFILE_PATH = "/v1/error-log/target-profile";
105
105
  var RED_TEAM_TARGET_PATH = "/v1/target";
106
106
  var RED_TEAM_TARGET_VALIDATE_AUTH_PATH = "/v1/target/validate-auth";
107
+ var RED_TEAM_ADAPTER_PATH = "/v1/adapters";
108
+ var RED_TEAM_ADAPTER_VALIDATE_PATH = "/v1/adapters/validate";
107
109
  var RED_TEAM_TEMPLATE_PATH = "/v1/template";
108
110
  var RED_TEAM_EULA_PATH = "/v1/eula";
109
111
  var RED_TEAM_INSTANCES_PATH = "/v1/instances";
@@ -3619,6 +3621,76 @@ var TenantLanguagesResponseSchema = z33.object({
3619
3621
  supported_job_types: z33.array(z33.string()),
3620
3622
  languages: z33.array(LanguageOptionSchema)
3621
3623
  }).passthrough();
3624
+ var AdapterVarTypeSchema = z33.enum(["VAR", "SECRET"]);
3625
+ var AdapterVarSchema = z33.object({
3626
+ key: z33.string().max(255),
3627
+ value: z33.string().nullable().optional(),
3628
+ type: AdapterVarTypeSchema
3629
+ });
3630
+ var AdapterVarResponseSchema = AdapterVarSchema.extend({
3631
+ is_redacted: z33.boolean().optional()
3632
+ }).passthrough();
3633
+ var AdapterCreateRequestSchema = z33.object({
3634
+ name: z33.string().max(255),
3635
+ description: z33.string().nullable().optional(),
3636
+ script_b64: z33.string(),
3637
+ /** Optional while the adapter is a DRAFT; required to activate (`validate: true`). */
3638
+ network_broker_channel_uuid: z33.string().uuid().nullable().optional(),
3639
+ variables: z33.array(AdapterVarSchema).optional(),
3640
+ /** Sample prompt used to exercise the adapter end-to-end during validation. Not stored. */
3641
+ prompt: z33.string()
3642
+ }).strict();
3643
+ var AdapterUpdateRequestSchema = z33.object({
3644
+ name: z33.string().max(255),
3645
+ description: z33.string().nullable().optional(),
3646
+ script_b64: z33.string(),
3647
+ network_broker_channel_uuid: z33.string().uuid().nullable().optional(),
3648
+ variables: z33.array(AdapterVarSchema).optional(),
3649
+ prompt: z33.string()
3650
+ }).strict();
3651
+ var AdapterResponseSchema = z33.object({
3652
+ uuid: z33.string().uuid(),
3653
+ tsg_id: z33.string(),
3654
+ name: z33.string(),
3655
+ script_b64: z33.string(),
3656
+ status: z33.string(),
3657
+ description: z33.string().nullable().optional(),
3658
+ network_broker_channel_uuid: z33.string().uuid().nullable().optional(),
3659
+ variables: z33.array(AdapterVarResponseSchema).optional(),
3660
+ /** Number of targets currently referencing this adapter. */
3661
+ target_count: z33.number().int().optional(),
3662
+ created_at: z33.string().nullable().optional(),
3663
+ updated_at: z33.string().nullable().optional(),
3664
+ created_by_user_id: z33.string().uuid().nullable().optional(),
3665
+ updated_by_user_id: z33.string().uuid().nullable().optional()
3666
+ }).passthrough();
3667
+ var AdapterListItemSchema = z33.object({
3668
+ uuid: z33.string().uuid(),
3669
+ name: z33.string(),
3670
+ status: z33.string(),
3671
+ created_at: z33.string(),
3672
+ updated_at: z33.string(),
3673
+ created_by_user_id: z33.string().uuid().nullable().optional(),
3674
+ target_count: z33.number().int().nullable().optional()
3675
+ }).passthrough();
3676
+ var AdapterListSchema = z33.object({
3677
+ pagination: RedTeamPaginationSchema,
3678
+ data: z33.array(AdapterListItemSchema).optional()
3679
+ }).passthrough();
3680
+ var AdapterValidateRequestSchema = z33.object({
3681
+ script_b64: z33.string(),
3682
+ network_broker_channel_uuid: z33.string().uuid(),
3683
+ prompt: z33.string(),
3684
+ variables: z33.array(AdapterVarSchema).optional(),
3685
+ /** Omit when validating a brand-new adapter. */
3686
+ adapter_uuid: z33.string().uuid().nullable().optional()
3687
+ }).strict();
3688
+ var AdapterValidateResponseSchema = z33.object({
3689
+ validated: z33.boolean(),
3690
+ stdout: z33.string().nullable().optional(),
3691
+ stderr: z33.string().nullable().optional(),
3692
+ traceback: z33.string().nullable().optional()
3693
+ }).passthrough();
3622
3694
  var TargetRequestBaseFields = {
3623
3695
  name: z33.string(),
3624
3696
  description: z33.string().nullable().optional(),
@@ -3632,7 +3704,11 @@ var TargetRequestBaseFields = {
3632
3704
  target_background: TargetBackgroundSchema.nullable().optional(),
3633
3705
  additional_context: TargetAdditionalContextSchema.nullable().optional(),
3634
3706
  extra_info: z33.record(z33.unknown()).nullable().optional(),
3635
- network_broker_channel_uuid: z33.string().nullable().optional()
3707
+ network_broker_channel_uuid: z33.string().nullable().optional(),
3708
+ /** UUID of the custom target adapter to use. Required when connection_type is CUSTOM_TARGET_ADAPTER. */
3709
+ adapter_uuid: z33.string().uuid().nullable().optional(),
3710
+ /** Per-target overrides for the adapter's variables. Array of AdapterVar objects. */
3711
+ adapter_variable_overrides: z33.array(AdapterVarSchema).nullable().optional()
3636
3712
  };
3637
3713
  var TargetCreateRequestSchema = z33.object(TargetRequestBaseFields).strict();
3638
3714
  var TargetUpdateRequestSchema = z33.object(TargetRequestBaseFields).strict();
@@ -4024,6 +4100,20 @@ var aiGatewayList = (item) => z35.object({
4024
4100
  has_more: z35.boolean().optional(),
4025
4101
  data: z35.array(item)
4026
4102
  }).passthrough();
4103
+ var GatewayUsageLimitSchema = z35.object({
4104
+ credit_limit: z35.number().optional(),
4105
+ type: z35.string().optional(),
4106
+ alert_threshold: z35.number().optional(),
4107
+ periodic_reset: z35.string().nullable().optional(),
4108
+ periodic_reset_days: z35.number().nullable().optional(),
4109
+ next_usage_reset_at: z35.string().nullable().optional()
4110
+ }).passthrough();
4111
+ var GatewayRateLimitSchema = z35.object({
4112
+ type: z35.string().optional(),
4113
+ unit: z35.string().optional(),
4114
+ value: z35.number().optional()
4115
+ }).passthrough();
4116
+ var limitsField = (policy) => z35.union([z35.array(policy), z35.record(z35.unknown())]).nullable();
4027
4117
  var aiGatewayGroupList = (item) => z35.object({
4028
4118
  object: z35.string(),
4029
4119
  is_quota_exceeded: z35.boolean(),
@@ -4230,7 +4320,9 @@ var GatewayWorkspaceSchema = z35.object({
4230
4320
  slug: z35.string(),
4231
4321
  name: z35.string(),
4232
4322
  icon: z35.string().nullable(),
4233
- description: z35.string(),
4323
+ // Nullable: a workspace created without one returns null, and upstream declares it
4324
+ // `nullable: true`. Observed on an archived workspace (#213).
4325
+ description: z35.string().nullable(),
4234
4326
  created_at: z35.string(),
4235
4327
  last_updated_at: z35.string(),
4236
4328
  is_default: z35.number(),
@@ -4241,18 +4333,38 @@ var GatewayWorkspaceSchema = z35.object({
4241
4333
  var GatewayWorkspaceDetailSchema = z35.object({
4242
4334
  id: z35.string(),
4243
4335
  name: z35.string(),
4244
- description: z35.string(),
4336
+ /** Nullable — see `GatewayWorkspaceSchema.description`. */
4337
+ description: z35.string().nullable(),
4245
4338
  created_at: z35.string(),
4246
4339
  last_updated_at: z35.string(),
4247
4340
  is_default: z35.number(),
4248
4341
  slug: z35.string(),
4249
4342
  icon: z35.string().nullable(),
4250
4343
  defaults: z35.record(z35.unknown()).nullable(),
4251
- usage_limits: z35.record(z35.unknown()).nullable(),
4252
- rate_limits: z35.record(z35.unknown()).nullable(),
4344
+ usage_limits: limitsField(GatewayUsageLimitSchema),
4345
+ rate_limits: limitsField(GatewayRateLimitSchema),
4253
4346
  security_settings: z35.record(z35.boolean()).optional(),
4254
4347
  data_plane_security_settings: z35.record(z35.unknown()).optional(),
4255
- settings: z35.record(z35.unknown()).optional()
4348
+ settings: z35.record(z35.unknown()).optional(),
4349
+ /**
4350
+ * Lifecycle state. **Diverges from the list row**: `list()` reports `'active'` for a
4351
+ * workspace whose `get()` reports `null` (observed live 2026-08-01). Prefer the list value,
4352
+ * or treat a `null` here as "unknown", not as "inactive".
4353
+ */
4354
+ status: z35.string().nullable().optional()
4355
+ }).passthrough();
4356
+ var GatewayWorkspaceCreateResponseSchema = z35.object({
4357
+ id: z35.string(),
4358
+ name: z35.string(),
4359
+ slug: z35.string(),
4360
+ description: z35.string().nullable(),
4361
+ created_at: z35.string(),
4362
+ last_updated_at: z35.string(),
4363
+ scope_name: z35.string(),
4364
+ object: z35.string(),
4365
+ defaults: z35.record(z35.unknown()).nullable().optional(),
4366
+ /** Seeded workspace members. Present on create only. */
4367
+ users: z35.array(z35.unknown()).optional()
4256
4368
  }).passthrough();
4257
4369
  var ListWorkspacesResponseSchema = aiGatewayList(GatewayWorkspaceSchema);
4258
4370
  var GatewayConfigSchema = z35.object({
@@ -4368,8 +4480,8 @@ var GatewayIntegrationModelsResponseSchema = z35.object({
4368
4480
  }).passthrough();
4369
4481
  var GatewayIntegrationWorkspaceSchema = z35.object({
4370
4482
  id: z35.string(),
4371
- usage_limits: z35.record(z35.unknown()).nullable(),
4372
- rate_limits: z35.record(z35.unknown()).nullable(),
4483
+ usage_limits: limitsField(GatewayUsageLimitSchema),
4484
+ rate_limits: limitsField(GatewayRateLimitSchema),
4373
4485
  enabled: z35.boolean(),
4374
4486
  status: z35.string(),
4375
4487
  created_at: z35.string(),
@@ -4378,8 +4490,8 @@ var GatewayIntegrationWorkspaceSchema = z35.object({
4378
4490
  }).passthrough();
4379
4491
  var GatewayGlobalWorkspaceAccessSchema = z35.object({
4380
4492
  enabled: z35.boolean(),
4381
- rate_limits: z35.record(z35.unknown()).nullable(),
4382
- usage_limits: z35.record(z35.unknown()).nullable()
4493
+ rate_limits: limitsField(GatewayRateLimitSchema),
4494
+ usage_limits: limitsField(GatewayUsageLimitSchema)
4383
4495
  }).passthrough();
4384
4496
  var GatewayIntegrationWorkspacesResponseSchema = z35.object({
4385
4497
  workspaces: z35.array(GatewayIntegrationWorkspaceSchema),
@@ -4731,6 +4843,14 @@ function assertUuid(value, fieldName) {
4731
4843
  );
4732
4844
  }
4733
4845
  }
4846
+ function assertWorkspaceRef(value, fieldName) {
4847
+ if (!isValidUuid(value) && !/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(value)) {
4848
+ throw new AISecSDKException(
4849
+ `Invalid ${fieldName}: ${value} (expected a workspace UUID or slug)`,
4850
+ "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
4851
+ );
4852
+ }
4853
+ }
4734
4854
  function assertNumericId(value, fieldName) {
4735
4855
  if (!/^\d+$/.test(value)) {
4736
4856
  throw new AISecSDKException(
@@ -9553,6 +9673,176 @@ var RedTeamNetworkBrokerClient = class {
9553
9673
  }
9554
9674
  };
9555
9675
 
9676
+ // src/red-team/adapters-client.ts
9677
+ var RedTeamAdaptersClient = class {
9678
+ baseUrl;
9679
+ auth;
9680
+ numRetries;
9681
+ constructor(opts) {
9682
+ this.baseUrl = opts.baseUrl;
9683
+ this.auth = opts.auth;
9684
+ this.numRetries = opts.numRetries;
9685
+ }
9686
+ /**
9687
+ * Create a new custom target adapter.
9688
+ * @param body - Adapter creation request (name, base64 script, variables, validation prompt).
9689
+ * @param opts - Set validate: false to save as DRAFT without running the script.
9690
+ * @returns The created adapter.
9691
+ * @example
9692
+ * ```ts
9693
+ * const adapter = await rt.adapters.create({
9694
+ * name: 'my-adapter',
9695
+ * script_b64: Buffer.from(script).toString('base64'),
9696
+ * network_broker_channel_uuid: '550e8400-...',
9697
+ * variables: [{ key: 'endpoint', value: 'http://...', type: 'VAR' }],
9698
+ * prompt: 'Hello',
9699
+ * }, { validate: true });
9700
+ * ```
9701
+ */
9702
+ async create(body, opts) {
9703
+ const validate = opts?.validate ?? true;
9704
+ return request({
9705
+ method: "POST",
9706
+ baseUrl: this.baseUrl,
9707
+ path: RED_TEAM_ADAPTER_PATH,
9708
+ params: { validate: String(validate) },
9709
+ body,
9710
+ responseSchema: AdapterResponseSchema,
9711
+ auth: this.auth,
9712
+ numRetries: this.numRetries
9713
+ });
9714
+ }
9715
+ /**
9716
+ * List adapters with optional pagination.
9717
+ * @param opts - Optional limit/skip/search.
9718
+ * @returns Paginated list of adapters.
9719
+ * @example
9720
+ * ```ts
9721
+ * const { data } = await rt.adapters.list({ limit: 20 });
9722
+ * // data => [{ uuid: '...', name: 'my-adapter', status: 'ACTIVE' }]
9723
+ * ```
9724
+ */
9725
+ async list(opts) {
9726
+ return request({
9727
+ method: "GET",
9728
+ baseUrl: this.baseUrl,
9729
+ path: RED_TEAM_ADAPTER_PATH,
9730
+ params: serializeListing(opts),
9731
+ responseSchema: AdapterListSchema,
9732
+ auth: this.auth,
9733
+ numRetries: this.numRetries
9734
+ });
9735
+ }
9736
+ /**
9737
+ * Get a single adapter by UUID.
9738
+ * @param uuid - Adapter UUID.
9739
+ * @returns The adapter detail.
9740
+ * @example
9741
+ * ```ts
9742
+ * const adapter = await rt.adapters.get('550e8400-e29b-41d4-a716-446655440000');
9743
+ * // adapter.status => 'ACTIVE'
9744
+ * ```
9745
+ */
9746
+ async get(uuid) {
9747
+ assertUuid(uuid, "adapter uuid");
9748
+ return request({
9749
+ method: "GET",
9750
+ baseUrl: this.baseUrl,
9751
+ path: `${RED_TEAM_ADAPTER_PATH}/${uuid}`,
9752
+ responseSchema: AdapterResponseSchema,
9753
+ auth: this.auth,
9754
+ numRetries: this.numRetries
9755
+ });
9756
+ }
9757
+ /**
9758
+ * Update an adapter. **Full replacement (PUT), not a patch** — `name`, `script_b64`, and
9759
+ * `prompt` are required just as on create. For `variables`, the list defines the complete
9760
+ * desired key set: a provided value sets it, `null` keeps the stored value (unchanged
9761
+ * secrets), and omitting a key **deletes** that variable.
9762
+ * @param uuid - Adapter UUID.
9763
+ * @param body - The complete adapter definition.
9764
+ * @param opts - Set validate: false to save as DRAFT without re-running the script.
9765
+ * @returns The updated adapter.
9766
+ * @example
9767
+ * ```ts
9768
+ * const updated = await rt.adapters.update('550e8400-...', {
9769
+ * name: 'my-keycloak-agent',
9770
+ * script_b64: Buffer.from(newScript).toString('base64'),
9771
+ * prompt: 'What is the capital of France?',
9772
+ * variables: [
9773
+ * { key: 'endpoint', value: 'http://agent.svc:8080', type: 'VAR' },
9774
+ * { key: 'client_secret', value: null, type: 'SECRET' }, // null keeps stored secret
9775
+ * ],
9776
+ * });
9777
+ * ```
9778
+ */
9779
+ async update(uuid, body, opts) {
9780
+ assertUuid(uuid, "adapter uuid");
9781
+ const validate = opts?.validate ?? true;
9782
+ return request({
9783
+ method: "PUT",
9784
+ baseUrl: this.baseUrl,
9785
+ path: `${RED_TEAM_ADAPTER_PATH}/${uuid}`,
9786
+ params: { validate: String(validate) },
9787
+ body,
9788
+ responseSchema: AdapterResponseSchema,
9789
+ auth: this.auth,
9790
+ numRetries: this.numRetries
9791
+ });
9792
+ }
9793
+ /**
9794
+ * Delete an adapter.
9795
+ * @param uuid - Adapter UUID.
9796
+ * @example
9797
+ * ```ts
9798
+ * await rt.adapters.delete('550e8400-e29b-41d4-a716-446655440000');
9799
+ * ```
9800
+ */
9801
+ async delete(uuid) {
9802
+ assertUuid(uuid, "adapter uuid");
9803
+ return request({
9804
+ method: "DELETE",
9805
+ baseUrl: this.baseUrl,
9806
+ path: `${RED_TEAM_ADAPTER_PATH}/${uuid}`,
9807
+ responseSchema: BaseResponseSchema.optional(),
9808
+ allowEmptyBody: true,
9809
+ auth: this.auth,
9810
+ numRetries: this.numRetries
9811
+ });
9812
+ }
9813
+ /**
9814
+ * Validate an adapter script without saving anything. Runs the script end-to-end through the
9815
+ * network broker channel using the sample prompt, and returns the execution outcome —
9816
+ * `validated` plus the script's `stdout` / `stderr` / `traceback` — not an adapter record.
9817
+ *
9818
+ * This endpoint has its own request shape: no `name`, `network_broker_channel_uuid` is
9819
+ * required, and `adapter_uuid` may reference an existing adapter so `null` variable values
9820
+ * are resolved from its stored secrets before the run.
9821
+ * @param body - Script, channel, prompt, and optionally variables / an existing adapter UUID.
9822
+ * @returns The validation outcome.
9823
+ * @example
9824
+ * ```ts
9825
+ * const result = await rt.adapters.validate({
9826
+ * script_b64: Buffer.from(script).toString('base64'),
9827
+ * network_broker_channel_uuid: '550e8400-...',
9828
+ * prompt: 'Hello',
9829
+ * });
9830
+ * if (!result.validated) console.error(result.stderr ?? result.traceback);
9831
+ * ```
9832
+ */
9833
+ async validate(body) {
9834
+ return request({
9835
+ method: "POST",
9836
+ baseUrl: this.baseUrl,
9837
+ path: RED_TEAM_ADAPTER_VALIDATE_PATH,
9838
+ body,
9839
+ responseSchema: AdapterValidateResponseSchema,
9840
+ auth: this.auth,
9841
+ numRetries: this.numRetries
9842
+ });
9843
+ }
9844
+ };
9845
+
9556
9846
  // src/red-team/client.ts
9557
9847
  var RedTeamClient = class {
9558
9848
  /** Data plane scan operations. */
@@ -9571,6 +9861,8 @@ var RedTeamClient = class {
9571
9861
  instances;
9572
9862
  /** Network broker channel operations (distinct network broker base URL). */
9573
9863
  networkBroker;
9864
+ /** Management plane custom target adapter operations. */
9865
+ adapters;
9574
9866
  dataEndpoint;
9575
9867
  mgmtEndpoint;
9576
9868
  auth;
@@ -9609,6 +9901,7 @@ var RedTeamClient = class {
9609
9901
  });
9610
9902
  this.eula = new RedTeamEulaClient({ baseUrl: mgmtEndpoint, auth, numRetries });
9611
9903
  this.instances = new RedTeamInstancesClient({ baseUrl: mgmtEndpoint, auth, numRetries });
9904
+ this.adapters = new RedTeamAdaptersClient({ baseUrl: mgmtEndpoint, auth, numRetries });
9612
9905
  this.networkBroker = new RedTeamNetworkBrokerClient({
9613
9906
  baseUrl: networkBrokerEndpoint,
9614
9907
  auth,
@@ -10306,30 +10599,49 @@ var AIGatewayTelemetryClient = class {
10306
10599
  // src/ai-gateway/workspaces-client.ts
10307
10600
  var AIGatewayWorkspacesClient = class {
10308
10601
  baseUrl;
10602
+ adminBaseUrl;
10309
10603
  auth;
10310
10604
  numRetries;
10311
10605
  constructor(opts) {
10312
10606
  this.baseUrl = opts.baseUrl;
10607
+ this.adminBaseUrl = opts.adminBaseUrl;
10313
10608
  this.auth = opts.auth;
10314
10609
  this.numRetries = opts.numRetries;
10315
10610
  }
10611
+ urlFor(plane) {
10612
+ return plane === "admin" ? this.adminBaseUrl : this.baseUrl;
10613
+ }
10316
10614
  /**
10317
- * List workspaces visible to the caller.
10318
- * @returns All workspaces, each with the `scope_name` that grants data-plane access to it.
10615
+ * List workspaces.
10616
+ *
10617
+ * Two defaults worth knowing, because each one hides rows:
10618
+ *
10619
+ * 1. **Active only.** Without `status`, archived workspaces are omitted. Pass
10620
+ * `{ status: 'archived' }` to see them — that is where {@link AIGatewayWorkspacesClient.delete}
10621
+ * leaves a workspace.
10622
+ * 2. **Your scope only.** The data plane returns just the workspaces your service account holds a
10623
+ * workspace-scope grant on. Pass `{ plane: 'admin' }` to enumerate the whole tenant.
10624
+ *
10625
+ * @param options - Optional status filter and plane selection.
10626
+ * @returns Workspaces, each with the `scope_name` that grants data-plane access to it.
10319
10627
  * @example
10320
10628
  * ```ts
10321
10629
  * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
10322
10630
  * const gw = new AIGatewayClient();
10323
10631
  *
10324
- * const ws = await gw.workspaces.list();
10325
- * // ws.data[0] => { slug: 'ws-main-a-349e0e', scope_name: 'main_airs_workspace_1852583913', ... }
10632
+ * const mine = await gw.workspaces.list();
10633
+ * // mine.data[0] => { slug: 'ws-main-a-349e0e', scope_name: 'main_airs_workspace_1852583913', ... }
10634
+ *
10635
+ * const everything = await gw.workspaces.list({ plane: 'admin' });
10636
+ * const archived = await gw.workspaces.list({ plane: 'admin', status: 'archived' });
10326
10637
  * ```
10327
10638
  */
10328
- async list() {
10639
+ async list(options = {}) {
10329
10640
  return request({
10330
10641
  method: "GET",
10331
- baseUrl: this.baseUrl,
10642
+ baseUrl: this.urlFor(options.plane),
10332
10643
  path: AI_GW_WORKSPACES_PATH,
10644
+ params: options.status ? { status: options.status } : void 0,
10333
10645
  responseSchema: ListWorkspacesResponseSchema,
10334
10646
  auth: this.auth,
10335
10647
  numRetries: this.numRetries
@@ -10337,7 +10649,16 @@ var AIGatewayWorkspacesClient = class {
10337
10649
  }
10338
10650
  /**
10339
10651
  * Fetch one workspace, including its security and rate-limit settings.
10340
- * @param workspaceId - Workspace UUID.
10652
+ *
10653
+ * @param workspaceRef - Workspace UUID **or** slug; the API accepts both.
10654
+ * @param options - Plane selection. A workspace outside your workspace scope answers `403 AB03`
10655
+ * on the data plane, not `404`; re-read it with `{ plane: 'admin' }`.
10656
+ *
10657
+ * **Archived workspaces are not retrievable here.** Once
10658
+ * {@link AIGatewayWorkspacesClient.delete} has archived a workspace, this returns `404 AB08`
10659
+ * for both its UUID and its slug, on either plane (verified live 2026-08-01) — even though the
10660
+ * row is still listed by `list({ status: 'archived' })`. Treat a 404 after a delete as expected,
10661
+ * and use the list filter to inspect archived workspaces.
10341
10662
  * @returns Workspace detail; list rows do not carry the settings blocks.
10342
10663
  * @example
10343
10664
  * ```ts
@@ -10346,19 +10667,133 @@ var AIGatewayWorkspacesClient = class {
10346
10667
  *
10347
10668
  * const ws = await gw.workspaces.get('16f7e90d-382a-4e78-b577-1b01eb5f8297');
10348
10669
  * // ws.security_settings?.membersViewLogs => true
10670
+ *
10671
+ * // Slugs work too, and the admin plane reaches workspaces you aren't scoped to:
10672
+ * const other = await gw.workspaces.get('ws-produc-985697', { plane: 'admin' });
10349
10673
  * ```
10350
10674
  */
10351
- async get(workspaceId) {
10352
- assertUuid(workspaceId, "workspaceId");
10675
+ async get(workspaceRef, options = {}) {
10676
+ assertWorkspaceRef(workspaceRef, "workspaceRef");
10353
10677
  return request({
10354
10678
  method: "GET",
10355
- baseUrl: this.baseUrl,
10356
- path: `${AI_GW_WORKSPACES_PATH}/${workspaceId}`,
10679
+ baseUrl: this.urlFor(options.plane),
10680
+ path: `${AI_GW_WORKSPACES_PATH}/${workspaceRef}`,
10357
10681
  responseSchema: GatewayWorkspaceDetailSchema,
10358
10682
  auth: this.auth,
10359
10683
  numRetries: this.numRetries
10360
10684
  });
10361
10685
  }
10686
+ /**
10687
+ * Create a workspace. **Admin plane** — needs a tenant-root admin role.
10688
+ *
10689
+ * @param body - `name` and `scope_name` are both required; the API rejects a body missing either.
10690
+ * @returns The created workspace. Unlike `configs`/`guardrails`/`providers`/`deployments`,
10691
+ * which return short receipts, this returns most of the record — but not `status`,
10692
+ * `is_default`, `icon`, `usage_limits`, `rate_limits`, or the settings blocks. Call
10693
+ * {@link AIGatewayWorkspacesClient.get} when you need those.
10694
+ * @example
10695
+ * ```ts
10696
+ * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
10697
+ * const gw = new AIGatewayClient();
10698
+ *
10699
+ * const created = await gw.workspaces.create({
10700
+ * name: 'Production',
10701
+ * scope_name: 'ws_production_bx7qw0', // the SCM scope, not derived from name
10702
+ * description: 'All production applications',
10703
+ * defaults: { metadata: { env: 'production' } },
10704
+ * rate_limits: [{ type: 'requests', unit: 'rpm', value: 100 }],
10705
+ * });
10706
+ * ```
10707
+ */
10708
+ async create(body) {
10709
+ if (!body.name) {
10710
+ throw new AISecSDKException("Missing name", "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
10711
+ }
10712
+ if (!body.scope_name) {
10713
+ throw new AISecSDKException("Missing scope_name", "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
10714
+ }
10715
+ return request({
10716
+ method: "POST",
10717
+ baseUrl: this.adminBaseUrl,
10718
+ path: AI_GW_WORKSPACES_PATH,
10719
+ body,
10720
+ responseSchema: GatewayWorkspaceCreateResponseSchema,
10721
+ auth: this.auth,
10722
+ numRetries: this.numRetries
10723
+ });
10724
+ }
10725
+ /**
10726
+ * Update a workspace. **Admin plane.** Partial patch — send only the fields that change.
10727
+ *
10728
+ * @param workspaceRef - Workspace UUID or slug.
10729
+ * @param body - At least one field. An empty patch is rejected locally, mirroring the API's own
10730
+ * "No update fields provided" rejection, so a typo'd caller fails without a round trip.
10731
+ * @returns An **empty object** — the API acknowledges the write without echoing the record
10732
+ * (verified live 2026-08-01). The change does persist; re-read with
10733
+ * {@link AIGatewayWorkspacesClient.get} to see it.
10734
+ * @example
10735
+ * ```ts
10736
+ * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
10737
+ * const gw = new AIGatewayClient();
10738
+ *
10739
+ * await gw.workspaces.update('ws-produc-985697', {
10740
+ * description: 'Production workloads, us-east',
10741
+ * });
10742
+ * ```
10743
+ */
10744
+ async update(workspaceRef, body) {
10745
+ assertWorkspaceRef(workspaceRef, "workspaceRef");
10746
+ if (Object.keys(body).length === 0) {
10747
+ throw new AISecSDKException(
10748
+ "Empty update: provide at least one of name, description, icon, defaults, usage_limits, rate_limits",
10749
+ "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
10750
+ );
10751
+ }
10752
+ return request({
10753
+ method: "PUT",
10754
+ baseUrl: this.adminBaseUrl,
10755
+ path: `${AI_GW_WORKSPACES_PATH}/${workspaceRef}`,
10756
+ body,
10757
+ responseSchema: GatewayWriteResponseSchema,
10758
+ auth: this.auth,
10759
+ numRetries: this.numRetries
10760
+ });
10761
+ }
10762
+ /**
10763
+ * Delete a workspace. **Admin plane.**
10764
+ *
10765
+ * This is a **soft delete**: the workspace is archived, not destroyed. It vanishes from a default
10766
+ * {@link AIGatewayWorkspacesClient.list} but stays visible via `list({ status: 'archived' })`.
10767
+ * Note that `list` is the *only* way to see it afterwards —
10768
+ * {@link AIGatewayWorkspacesClient.get} answers `404 AB08` for an archived workspace.
10769
+ * Same semantics as `deployments.delete()`, and the opposite of `configs`/`guardrails`/`providers`,
10770
+ * which hard delete. There is no hard delete for workspaces.
10771
+ *
10772
+ * Takes no query parameters — unlike `integrations.delete()` and `deployments.delete()`, which
10773
+ * both require `organisation_id`.
10774
+ *
10775
+ * @param workspaceRef - Workspace UUID or slug.
10776
+ * @example
10777
+ * ```ts
10778
+ * import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
10779
+ * const gw = new AIGatewayClient();
10780
+ *
10781
+ * await gw.workspaces.delete('ws-produc-985697');
10782
+ *
10783
+ * // Still there, archived:
10784
+ * const gone = await gw.workspaces.list({ plane: 'admin', status: 'archived' });
10785
+ * ```
10786
+ */
10787
+ async delete(workspaceRef) {
10788
+ assertWorkspaceRef(workspaceRef, "workspaceRef");
10789
+ return request({
10790
+ method: "DELETE",
10791
+ baseUrl: this.adminBaseUrl,
10792
+ path: `${AI_GW_WORKSPACES_PATH}/${workspaceRef}`,
10793
+ auth: this.auth,
10794
+ numRetries: this.numRetries
10795
+ });
10796
+ }
10362
10797
  };
10363
10798
 
10364
10799
  // src/ai-gateway/configs-client.ts
@@ -11680,7 +12115,7 @@ var AIGatewayClient = class {
11680
12115
  const dataOpts = { baseUrl: dataEndpoint, auth, numRetries };
11681
12116
  const adminOpts = { baseUrl: adminEndpoint, auth, numRetries };
11682
12117
  this.telemetry = new AIGatewayTelemetryClient({ ...dataOpts, tsgId });
11683
- this.workspaces = new AIGatewayWorkspacesClient(dataOpts);
12118
+ this.workspaces = new AIGatewayWorkspacesClient({ ...dataOpts, adminBaseUrl: adminEndpoint });
11684
12119
  this.configs = new AIGatewayConfigsClient(dataOpts);
11685
12120
  this.guardrails = new AIGatewayGuardrailsClient(dataOpts);
11686
12121
  this.providers = new AIGatewayProvidersClient(dataOpts);
@@ -11734,6 +12169,16 @@ export {
11734
12169
  AI_SEC_API_TOKEN,
11735
12170
  ASYNC_SCAN_PATH,
11736
12171
  Action,
12172
+ AdapterCreateRequestSchema,
12173
+ AdapterListItemSchema,
12174
+ AdapterListSchema,
12175
+ AdapterResponseSchema,
12176
+ AdapterUpdateRequestSchema,
12177
+ AdapterValidateRequestSchema,
12178
+ AdapterValidateResponseSchema,
12179
+ AdapterVarResponseSchema,
12180
+ AdapterVarSchema,
12181
+ AdapterVarTypeSchema,
11737
12182
  AdvancedDataProfileRequestSchema,
11738
12183
  AgentEntrySchema,
11739
12184
  AgentMetaSchema,
@@ -11974,6 +12419,9 @@ export {
11974
12419
  GatewayPluginSchema,
11975
12420
  GatewayProviderCreateResponseSchema,
11976
12421
  GatewayProviderSchema,
12422
+ GatewayRateLimitSchema,
12423
+ GatewayUsageLimitSchema,
12424
+ GatewayWorkspaceCreateResponseSchema,
11977
12425
  GatewayWorkspaceDetailSchema,
11978
12426
  GatewayWorkspaceSchema,
11979
12427
  GatewayWriteResponseSchema,
@@ -12146,6 +12594,8 @@ export {
12146
12594
  PyPIAuthResponseSchema,
12147
12595
  QuotaDetailsSchema,
12148
12596
  QuotaSummarySchema,
12597
+ RED_TEAM_ADAPTER_PATH,
12598
+ RED_TEAM_ADAPTER_VALIDATE_PATH,
12149
12599
  RED_TEAM_CATEGORIES_PATH,
12150
12600
  RED_TEAM_CHANNELS_PATH,
12151
12601
  RED_TEAM_CHANNELS_STATS_PATH,
@@ -12175,6 +12625,7 @@ export {
12175
12625
  RED_TEAM_TEMPLATE_PATH,
12176
12626
  RED_TEAM_TOKEN_ENDPOINT,
12177
12627
  RED_TEAM_TSG_ID,
12628
+ RedTeamAdaptersClient,
12178
12629
  RedTeamCategory,
12179
12630
  RedTeamClient,
12180
12631
  RedTeamCustomAttackReportsClient,