@discomedia/utils 1.0.72 → 1.0.74

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import require$$0$3, { EventEmitter } from 'events';
2
2
  import require$$1 from 'https';
3
- import require$$2 from 'http';
3
+ import require$$2$1 from 'http';
4
4
  import require$$3$1 from 'net';
5
5
  import require$$4 from 'tls';
6
6
  import require$$3 from 'crypto';
@@ -8,9 +8,10 @@ import require$$0$2 from 'stream';
8
8
  import require$$7 from 'url';
9
9
  import require$$0 from 'zlib';
10
10
  import require$$0$1 from 'buffer';
11
+ import require$$2 from 'util';
11
12
  import require$$0$4 from 'fs';
12
13
  import require$$1$1 from 'path';
13
- import require$$2$1 from 'os';
14
+ import require$$2$2 from 'os';
14
15
 
15
16
  /**
16
17
  * Logs a message to the console.
@@ -1146,6 +1147,7 @@ const OPENAI_MODELS = [
1146
1147
  'gpt-5',
1147
1148
  'gpt-5-mini',
1148
1149
  'gpt-5.4-mini',
1150
+ 'gpt-5.4-nano',
1149
1151
  'gpt-5-nano',
1150
1152
  'gpt-5.1',
1151
1153
  'gpt-5.4',
@@ -1188,6 +1190,7 @@ const OPENROUTER_MODELS = [
1188
1190
  'openai/gpt-5',
1189
1191
  'openai/gpt-5-mini',
1190
1192
  'openai/gpt-5.4-mini',
1193
+ 'openai/gpt-5.4-nano',
1191
1194
  'openai/gpt-5-nano',
1192
1195
  'openai/gpt-5.1',
1193
1196
  'openai/gpt-5.4',
@@ -1698,7 +1701,7 @@ const safeJSON = (text) => {
1698
1701
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1699
1702
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1700
1703
 
1701
- const VERSION = '6.37.0'; // x-release-please-version
1704
+ const VERSION = '6.39.0'; // x-release-please-version
1702
1705
 
1703
1706
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1704
1707
  const isRunningInBrowser = () => {
@@ -3147,19 +3150,22 @@ class WorkloadIdentityAuth {
3147
3150
  }
3148
3151
  async refreshToken() {
3149
3152
  const subjectToken = await this.config.provider.getToken();
3153
+ const body = {
3154
+ grant_type: TOKEN_EXCHANGE_GRANT_TYPE,
3155
+ subject_token: subjectToken,
3156
+ subject_token_type: SUBJECT_TOKEN_TYPES[this.config.provider.tokenType],
3157
+ identity_provider_id: this.config.identityProviderId,
3158
+ service_account_id: this.config.serviceAccountId,
3159
+ };
3160
+ if (this.config.clientId) {
3161
+ body['client_id'] = this.config.clientId;
3162
+ }
3150
3163
  const response = await this.fetch(this.tokenExchangeUrl, {
3151
3164
  method: 'POST',
3152
3165
  headers: {
3153
3166
  'Content-Type': 'application/json',
3154
3167
  },
3155
- body: JSON.stringify({
3156
- grant_type: TOKEN_EXCHANGE_GRANT_TYPE,
3157
- client_id: this.config.clientId,
3158
- subject_token: subjectToken,
3159
- subject_token_type: SUBJECT_TOKEN_TYPES[this.config.provider.tokenType],
3160
- identity_provider_id: this.config.identityProviderId,
3161
- service_account_id: this.config.serviceAccountId,
3162
- }),
3168
+ body: JSON.stringify(body),
3163
3169
  });
3164
3170
  if (!response.ok) {
3165
3171
  const errorText = await response.text();
@@ -5231,6 +5237,43 @@ let Certificates$1 = class Certificates extends APIResource {
5231
5237
  }
5232
5238
  };
5233
5239
 
5240
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5241
+ let DataRetention$1 = class DataRetention extends APIResource {
5242
+ /**
5243
+ * Retrieves organization data retention controls.
5244
+ *
5245
+ * @example
5246
+ * ```ts
5247
+ * const organizationDataRetention =
5248
+ * await client.admin.organization.dataRetention.retrieve();
5249
+ * ```
5250
+ */
5251
+ retrieve(options) {
5252
+ return this._client.get('/organization/data_retention', {
5253
+ ...options,
5254
+ __security: { adminAPIKeyAuth: true },
5255
+ });
5256
+ }
5257
+ /**
5258
+ * Updates organization data retention controls.
5259
+ *
5260
+ * @example
5261
+ * ```ts
5262
+ * const organizationDataRetention =
5263
+ * await client.admin.organization.dataRetention.update({
5264
+ * retention_type: 'zero_data_retention',
5265
+ * });
5266
+ * ```
5267
+ */
5268
+ update(body, options) {
5269
+ return this._client.post('/organization/data_retention', {
5270
+ body,
5271
+ ...options,
5272
+ __security: { adminAPIKeyAuth: true },
5273
+ });
5274
+ }
5275
+ };
5276
+
5234
5277
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5235
5278
  class Invites extends APIResource {
5236
5279
  /**
@@ -5327,6 +5370,22 @@ let Roles$5 = class Roles extends APIResource {
5327
5370
  __security: { adminAPIKeyAuth: true },
5328
5371
  });
5329
5372
  }
5373
+ /**
5374
+ * Retrieves an organization role.
5375
+ *
5376
+ * @example
5377
+ * ```ts
5378
+ * const role = await client.admin.organization.roles.retrieve(
5379
+ * 'role_id',
5380
+ * );
5381
+ * ```
5382
+ */
5383
+ retrieve(roleID, options) {
5384
+ return this._client.get(path `/organization/roles/${roleID}`, {
5385
+ ...options,
5386
+ __security: { adminAPIKeyAuth: true },
5387
+ });
5388
+ }
5330
5389
  /**
5331
5390
  * Updates an existing organization role.
5332
5391
  *
@@ -5380,6 +5439,92 @@ let Roles$5 = class Roles extends APIResource {
5380
5439
  }
5381
5440
  };
5382
5441
 
5442
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5443
+ let SpendAlerts$1 = class SpendAlerts extends APIResource {
5444
+ /**
5445
+ * Creates an organization spend alert.
5446
+ *
5447
+ * @example
5448
+ * ```ts
5449
+ * const organizationSpendAlert =
5450
+ * await client.admin.organization.spendAlerts.create({
5451
+ * currency: 'USD',
5452
+ * interval: 'month',
5453
+ * notification_channel: {
5454
+ * recipients: ['string'],
5455
+ * type: 'email',
5456
+ * },
5457
+ * threshold_amount: 0,
5458
+ * });
5459
+ * ```
5460
+ */
5461
+ create(body, options) {
5462
+ return this._client.post('/organization/spend_alerts', {
5463
+ body,
5464
+ ...options,
5465
+ __security: { adminAPIKeyAuth: true },
5466
+ });
5467
+ }
5468
+ /**
5469
+ * Updates an organization spend alert.
5470
+ *
5471
+ * @example
5472
+ * ```ts
5473
+ * const organizationSpendAlert =
5474
+ * await client.admin.organization.spendAlerts.update(
5475
+ * 'alert_id',
5476
+ * {
5477
+ * currency: 'USD',
5478
+ * interval: 'month',
5479
+ * notification_channel: {
5480
+ * recipients: ['string'],
5481
+ * type: 'email',
5482
+ * },
5483
+ * threshold_amount: 0,
5484
+ * },
5485
+ * );
5486
+ * ```
5487
+ */
5488
+ update(alertID, body, options) {
5489
+ return this._client.post(path `/organization/spend_alerts/${alertID}`, {
5490
+ body,
5491
+ ...options,
5492
+ __security: { adminAPIKeyAuth: true },
5493
+ });
5494
+ }
5495
+ /**
5496
+ * Lists organization spend alerts.
5497
+ *
5498
+ * @example
5499
+ * ```ts
5500
+ * // Automatically fetches more pages as needed.
5501
+ * for await (const organizationSpendAlert of client.admin.organization.spendAlerts.list()) {
5502
+ * // ...
5503
+ * }
5504
+ * ```
5505
+ */
5506
+ list(query = {}, options) {
5507
+ return this._client.getAPIList('/organization/spend_alerts', (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
5508
+ }
5509
+ /**
5510
+ * Deletes an organization spend alert.
5511
+ *
5512
+ * @example
5513
+ * ```ts
5514
+ * const organizationSpendAlertDeleted =
5515
+ * await client.admin.organization.spendAlerts.delete(
5516
+ * 'alert_id',
5517
+ * );
5518
+ * ```
5519
+ */
5520
+ delete(alertID, options) {
5521
+ return this._client.delete(path `/organization/spend_alerts/${alertID}`, {
5522
+ ...options,
5523
+ __security: { adminAPIKeyAuth: true },
5524
+ });
5525
+ }
5526
+ };
5527
+
5383
5528
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5384
5529
  class Usage extends APIResource {
5385
5530
  /**
@@ -5490,6 +5635,24 @@ class Usage extends APIResource {
5490
5635
  __security: { adminAPIKeyAuth: true },
5491
5636
  });
5492
5637
  }
5638
+ /**
5639
+ * Get file search calls usage details for the organization.
5640
+ *
5641
+ * @example
5642
+ * ```ts
5643
+ * const response =
5644
+ * await client.admin.organization.usage.fileSearchCalls({
5645
+ * start_time: 0,
5646
+ * });
5647
+ * ```
5648
+ */
5649
+ fileSearchCalls(query, options) {
5650
+ return this._client.get('/organization/usage/file_search_calls', {
5651
+ query,
5652
+ ...options,
5653
+ __security: { adminAPIKeyAuth: true },
5654
+ });
5655
+ }
5493
5656
  /**
5494
5657
  * Get images usage details for the organization.
5495
5658
  *
@@ -5544,6 +5707,24 @@ class Usage extends APIResource {
5544
5707
  __security: { adminAPIKeyAuth: true },
5545
5708
  });
5546
5709
  }
5710
+ /**
5711
+ * Get web search calls usage details for the organization.
5712
+ *
5713
+ * @example
5714
+ * ```ts
5715
+ * const response =
5716
+ * await client.admin.organization.usage.webSearchCalls({
5717
+ * start_time: 0,
5718
+ * });
5719
+ * ```
5720
+ */
5721
+ webSearchCalls(query, options) {
5722
+ return this._client.get('/organization/usage/web_search_calls', {
5723
+ query,
5724
+ ...options,
5725
+ __security: { adminAPIKeyAuth: true },
5726
+ });
5727
+ }
5547
5728
  }
5548
5729
 
5549
5730
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
@@ -5567,6 +5748,25 @@ let Roles$4 = class Roles extends APIResource {
5567
5748
  __security: { adminAPIKeyAuth: true },
5568
5749
  });
5569
5750
  }
5751
+ /**
5752
+ * Retrieves an organization role assigned to a group.
5753
+ *
5754
+ * @example
5755
+ * ```ts
5756
+ * const role =
5757
+ * await client.admin.organization.groups.roles.retrieve(
5758
+ * 'role_id',
5759
+ * { group_id: 'group_id' },
5760
+ * );
5761
+ * ```
5762
+ */
5763
+ retrieve(roleID, params, options) {
5764
+ const { group_id } = params;
5765
+ return this._client.get(path `/organization/groups/${group_id}/roles/${roleID}`, {
5766
+ ...options,
5767
+ __security: { adminAPIKeyAuth: true },
5768
+ });
5769
+ }
5570
5770
  /**
5571
5771
  * Lists the organization roles assigned to a group within the organization.
5572
5772
  *
@@ -5625,6 +5825,25 @@ let Users$2 = class Users extends APIResource {
5625
5825
  __security: { adminAPIKeyAuth: true },
5626
5826
  });
5627
5827
  }
5828
+ /**
5829
+ * Retrieves a user in a group.
5830
+ *
5831
+ * @example
5832
+ * ```ts
5833
+ * const user =
5834
+ * await client.admin.organization.groups.users.retrieve(
5835
+ * 'user_id',
5836
+ * { group_id: 'group_id' },
5837
+ * );
5838
+ * ```
5839
+ */
5840
+ retrieve(userID, params, options) {
5841
+ const { group_id } = params;
5842
+ return this._client.get(path `/organization/groups/${group_id}/users/${userID}`, {
5843
+ ...options,
5844
+ __security: { adminAPIKeyAuth: true },
5845
+ });
5846
+ }
5628
5847
  /**
5629
5848
  * Lists the users assigned to a group.
5630
5849
  *
@@ -5686,6 +5905,23 @@ let Groups$1 = class Groups extends APIResource {
5686
5905
  __security: { adminAPIKeyAuth: true },
5687
5906
  });
5688
5907
  }
5908
+ /**
5909
+ * Retrieves a group.
5910
+ *
5911
+ * @example
5912
+ * ```ts
5913
+ * const group =
5914
+ * await client.admin.organization.groups.retrieve(
5915
+ * 'group_id',
5916
+ * );
5917
+ * ```
5918
+ */
5919
+ retrieve(groupID, options) {
5920
+ return this._client.get(path `/organization/groups/${groupID}`, {
5921
+ ...options,
5922
+ __security: { adminAPIKeyAuth: true },
5923
+ });
5924
+ }
5689
5925
  /**
5690
5926
  * Updates a group's information.
5691
5927
  *
@@ -5860,6 +6096,142 @@ class Certificates extends APIResource {
5860
6096
  }
5861
6097
  }
5862
6098
 
6099
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6100
+ class DataRetention extends APIResource {
6101
+ /**
6102
+ * Retrieves project data retention controls.
6103
+ *
6104
+ * @example
6105
+ * ```ts
6106
+ * const projectDataRetention =
6107
+ * await client.admin.organization.projects.dataRetention.retrieve(
6108
+ * 'project_id',
6109
+ * );
6110
+ * ```
6111
+ */
6112
+ retrieve(projectID, options) {
6113
+ return this._client.get(path `/organization/projects/${projectID}/data_retention`, {
6114
+ ...options,
6115
+ __security: { adminAPIKeyAuth: true },
6116
+ });
6117
+ }
6118
+ /**
6119
+ * Updates project data retention controls.
6120
+ *
6121
+ * @example
6122
+ * ```ts
6123
+ * const projectDataRetention =
6124
+ * await client.admin.organization.projects.dataRetention.update(
6125
+ * 'project_id',
6126
+ * { retention_type: 'organization_default' },
6127
+ * );
6128
+ * ```
6129
+ */
6130
+ update(projectID, body, options) {
6131
+ return this._client.post(path `/organization/projects/${projectID}/data_retention`, {
6132
+ body,
6133
+ ...options,
6134
+ __security: { adminAPIKeyAuth: true },
6135
+ });
6136
+ }
6137
+ }
6138
+
6139
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6140
+ class HostedToolPermissions extends APIResource {
6141
+ /**
6142
+ * Returns hosted tool permissions for a project.
6143
+ *
6144
+ * @example
6145
+ * ```ts
6146
+ * const projectHostedToolPermissions =
6147
+ * await client.admin.organization.projects.hostedToolPermissions.retrieve(
6148
+ * 'project_id',
6149
+ * );
6150
+ * ```
6151
+ */
6152
+ retrieve(projectID, options) {
6153
+ return this._client.get(path `/organization/projects/${projectID}/hosted_tool_permissions`, {
6154
+ ...options,
6155
+ __security: { adminAPIKeyAuth: true },
6156
+ });
6157
+ }
6158
+ /**
6159
+ * Updates hosted tool permissions for a project.
6160
+ *
6161
+ * @example
6162
+ * ```ts
6163
+ * const projectHostedToolPermissions =
6164
+ * await client.admin.organization.projects.hostedToolPermissions.update(
6165
+ * 'project_id',
6166
+ * );
6167
+ * ```
6168
+ */
6169
+ update(projectID, body, options) {
6170
+ return this._client.post(path `/organization/projects/${projectID}/hosted_tool_permissions`, {
6171
+ body,
6172
+ ...options,
6173
+ __security: { adminAPIKeyAuth: true },
6174
+ });
6175
+ }
6176
+ }
6177
+
6178
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6179
+ class ModelPermissions extends APIResource {
6180
+ /**
6181
+ * Returns model permissions for a project.
6182
+ *
6183
+ * @example
6184
+ * ```ts
6185
+ * const projectModelPermissions =
6186
+ * await client.admin.organization.projects.modelPermissions.retrieve(
6187
+ * 'project_id',
6188
+ * );
6189
+ * ```
6190
+ */
6191
+ retrieve(projectID, options) {
6192
+ return this._client.get(path `/organization/projects/${projectID}/model_permissions`, {
6193
+ ...options,
6194
+ __security: { adminAPIKeyAuth: true },
6195
+ });
6196
+ }
6197
+ /**
6198
+ * Updates model permissions for a project.
6199
+ *
6200
+ * @example
6201
+ * ```ts
6202
+ * const projectModelPermissions =
6203
+ * await client.admin.organization.projects.modelPermissions.update(
6204
+ * 'project_id',
6205
+ * { mode: 'allow_list', model_ids: ['string'] },
6206
+ * );
6207
+ * ```
6208
+ */
6209
+ update(projectID, body, options) {
6210
+ return this._client.post(path `/organization/projects/${projectID}/model_permissions`, {
6211
+ body,
6212
+ ...options,
6213
+ __security: { adminAPIKeyAuth: true },
6214
+ });
6215
+ }
6216
+ /**
6217
+ * Deletes model permissions for a project.
6218
+ *
6219
+ * @example
6220
+ * ```ts
6221
+ * const projectModelPermissionsDeleted =
6222
+ * await client.admin.organization.projects.modelPermissions.delete(
6223
+ * 'project_id',
6224
+ * );
6225
+ * ```
6226
+ */
6227
+ delete(projectID, options) {
6228
+ return this._client.delete(path `/organization/projects/${projectID}/model_permissions`, {
6229
+ ...options,
6230
+ __security: { adminAPIKeyAuth: true },
6231
+ });
6232
+ }
6233
+ }
6234
+
5863
6235
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5864
6236
  class RateLimits extends APIResource {
5865
6237
  /**
@@ -5921,6 +6293,25 @@ let Roles$3 = class Roles extends APIResource {
5921
6293
  __security: { adminAPIKeyAuth: true },
5922
6294
  });
5923
6295
  }
6296
+ /**
6297
+ * Retrieves a project role.
6298
+ *
6299
+ * @example
6300
+ * ```ts
6301
+ * const role =
6302
+ * await client.admin.organization.projects.roles.retrieve(
6303
+ * 'role_id',
6304
+ * { project_id: 'project_id' },
6305
+ * );
6306
+ * ```
6307
+ */
6308
+ retrieve(roleID, params, options) {
6309
+ const { project_id } = params;
6310
+ return this._client.get(path `/projects/${project_id}/roles/${roleID}`, {
6311
+ ...options,
6312
+ __security: { adminAPIKeyAuth: true },
6313
+ });
6314
+ }
5924
6315
  /**
5925
6316
  * Updates an existing project role.
5926
6317
  *
@@ -6023,6 +6414,22 @@ class ServiceAccounts extends APIResource {
6023
6414
  __security: { adminAPIKeyAuth: true },
6024
6415
  });
6025
6416
  }
6417
+ /**
6418
+ * Updates a service account in the project.
6419
+ *
6420
+ * @example
6421
+ * ```ts
6422
+ * const projectServiceAccount =
6423
+ * await client.admin.organization.projects.serviceAccounts.update(
6424
+ * 'service_account_id',
6425
+ * { project_id: 'project_id' },
6426
+ * );
6427
+ * ```
6428
+ */
6429
+ update(serviceAccountID, params, options) {
6430
+ const { project_id, ...body } = params;
6431
+ return this._client.post(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { body, ...options, __security: { adminAPIKeyAuth: true } });
6432
+ }
6026
6433
  /**
6027
6434
  * Returns a list of service accounts in the project.
6028
6435
  *
@@ -6060,6 +6467,101 @@ class ServiceAccounts extends APIResource {
6060
6467
  }
6061
6468
  }
6062
6469
 
6470
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6471
+ class SpendAlerts extends APIResource {
6472
+ /**
6473
+ * Creates a project spend alert.
6474
+ *
6475
+ * @example
6476
+ * ```ts
6477
+ * const projectSpendAlert =
6478
+ * await client.admin.organization.projects.spendAlerts.create(
6479
+ * 'project_id',
6480
+ * {
6481
+ * currency: 'USD',
6482
+ * interval: 'month',
6483
+ * notification_channel: {
6484
+ * recipients: ['string'],
6485
+ * type: 'email',
6486
+ * },
6487
+ * threshold_amount: 0,
6488
+ * },
6489
+ * );
6490
+ * ```
6491
+ */
6492
+ create(projectID, body, options) {
6493
+ return this._client.post(path `/organization/projects/${projectID}/spend_alerts`, {
6494
+ body,
6495
+ ...options,
6496
+ __security: { adminAPIKeyAuth: true },
6497
+ });
6498
+ }
6499
+ /**
6500
+ * Updates a project spend alert.
6501
+ *
6502
+ * @example
6503
+ * ```ts
6504
+ * const projectSpendAlert =
6505
+ * await client.admin.organization.projects.spendAlerts.update(
6506
+ * 'alert_id',
6507
+ * {
6508
+ * project_id: 'project_id',
6509
+ * currency: 'USD',
6510
+ * interval: 'month',
6511
+ * notification_channel: {
6512
+ * recipients: ['string'],
6513
+ * type: 'email',
6514
+ * },
6515
+ * threshold_amount: 0,
6516
+ * },
6517
+ * );
6518
+ * ```
6519
+ */
6520
+ update(alertID, params, options) {
6521
+ const { project_id, ...body } = params;
6522
+ return this._client.post(path `/organization/projects/${project_id}/spend_alerts/${alertID}`, {
6523
+ body,
6524
+ ...options,
6525
+ __security: { adminAPIKeyAuth: true },
6526
+ });
6527
+ }
6528
+ /**
6529
+ * Lists project spend alerts.
6530
+ *
6531
+ * @example
6532
+ * ```ts
6533
+ * // Automatically fetches more pages as needed.
6534
+ * for await (const projectSpendAlert of client.admin.organization.projects.spendAlerts.list(
6535
+ * 'project_id',
6536
+ * )) {
6537
+ * // ...
6538
+ * }
6539
+ * ```
6540
+ */
6541
+ list(projectID, query = {}, options) {
6542
+ return this._client.getAPIList(path `/organization/projects/${projectID}/spend_alerts`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
6543
+ }
6544
+ /**
6545
+ * Deletes a project spend alert.
6546
+ *
6547
+ * @example
6548
+ * ```ts
6549
+ * const projectSpendAlertDeleted =
6550
+ * await client.admin.organization.projects.spendAlerts.delete(
6551
+ * 'alert_id',
6552
+ * { project_id: 'project_id' },
6553
+ * );
6554
+ * ```
6555
+ */
6556
+ delete(alertID, params, options) {
6557
+ const { project_id } = params;
6558
+ return this._client.delete(path `/organization/projects/${project_id}/spend_alerts/${alertID}`, {
6559
+ ...options,
6560
+ __security: { adminAPIKeyAuth: true },
6561
+ });
6562
+ }
6563
+ }
6564
+
6063
6565
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6064
6566
  let Roles$2 = class Roles extends APIResource {
6065
6567
  /**
@@ -6082,6 +6584,25 @@ let Roles$2 = class Roles extends APIResource {
6082
6584
  __security: { adminAPIKeyAuth: true },
6083
6585
  });
6084
6586
  }
6587
+ /**
6588
+ * Retrieves a project role assigned to a group.
6589
+ *
6590
+ * @example
6591
+ * ```ts
6592
+ * const role =
6593
+ * await client.admin.organization.projects.groups.roles.retrieve(
6594
+ * 'role_id',
6595
+ * { project_id: 'project_id', group_id: 'group_id' },
6596
+ * );
6597
+ * ```
6598
+ */
6599
+ retrieve(roleID, params, options) {
6600
+ const { project_id, group_id } = params;
6601
+ return this._client.get(path `/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
6602
+ ...options,
6603
+ __security: { adminAPIKeyAuth: true },
6604
+ });
6605
+ }
6085
6606
  /**
6086
6607
  * Lists the project roles assigned to a group within a project.
6087
6608
  *
@@ -6146,6 +6667,26 @@ class Groups extends APIResource {
6146
6667
  __security: { adminAPIKeyAuth: true },
6147
6668
  });
6148
6669
  }
6670
+ /**
6671
+ * Retrieves a project's group.
6672
+ *
6673
+ * @example
6674
+ * ```ts
6675
+ * const projectGroup =
6676
+ * await client.admin.organization.projects.groups.retrieve(
6677
+ * 'group_id',
6678
+ * { project_id: 'project_id' },
6679
+ * );
6680
+ * ```
6681
+ */
6682
+ retrieve(groupID, params, options) {
6683
+ const { project_id, ...query } = params;
6684
+ return this._client.get(path `/organization/projects/${project_id}/groups/${groupID}`, {
6685
+ query,
6686
+ ...options,
6687
+ __security: { adminAPIKeyAuth: true },
6688
+ });
6689
+ }
6149
6690
  /**
6150
6691
  * Lists the groups that have access to a project.
6151
6692
  *
@@ -6206,6 +6747,25 @@ let Roles$1 = class Roles extends APIResource {
6206
6747
  __security: { adminAPIKeyAuth: true },
6207
6748
  });
6208
6749
  }
6750
+ /**
6751
+ * Retrieves a project role assigned to a user.
6752
+ *
6753
+ * @example
6754
+ * ```ts
6755
+ * const role =
6756
+ * await client.admin.organization.projects.users.roles.retrieve(
6757
+ * 'role_id',
6758
+ * { project_id: 'project_id', user_id: 'user_id' },
6759
+ * );
6760
+ * ```
6761
+ */
6762
+ retrieve(roleID, params, options) {
6763
+ const { project_id, user_id } = params;
6764
+ return this._client.get(path `/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
6765
+ ...options,
6766
+ __security: { adminAPIKeyAuth: true },
6767
+ });
6768
+ }
6209
6769
  /**
6210
6770
  * Lists the project roles assigned to a user within a project.
6211
6771
  *
@@ -6359,8 +6919,12 @@ class Projects extends APIResource {
6359
6919
  this.serviceAccounts = new ServiceAccounts(this._client);
6360
6920
  this.apiKeys = new APIKeys(this._client);
6361
6921
  this.rateLimits = new RateLimits(this._client);
6922
+ this.modelPermissions = new ModelPermissions(this._client);
6923
+ this.hostedToolPermissions = new HostedToolPermissions(this._client);
6362
6924
  this.groups = new Groups(this._client);
6363
6925
  this.roles = new Roles$3(this._client);
6926
+ this.dataRetention = new DataRetention(this._client);
6927
+ this.spendAlerts = new SpendAlerts(this._client);
6364
6928
  this.certificates = new Certificates(this._client);
6365
6929
  }
6366
6930
  /**
@@ -6458,8 +7022,12 @@ Projects.Users = Users$1;
6458
7022
  Projects.ServiceAccounts = ServiceAccounts;
6459
7023
  Projects.APIKeys = APIKeys;
6460
7024
  Projects.RateLimits = RateLimits;
7025
+ Projects.ModelPermissions = ModelPermissions;
7026
+ Projects.HostedToolPermissions = HostedToolPermissions;
6461
7027
  Projects.Groups = Groups;
6462
7028
  Projects.Roles = Roles$3;
7029
+ Projects.DataRetention = DataRetention;
7030
+ Projects.SpendAlerts = SpendAlerts;
6463
7031
  Projects.Certificates = Certificates;
6464
7032
 
6465
7033
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
@@ -6483,6 +7051,25 @@ class Roles extends APIResource {
6483
7051
  __security: { adminAPIKeyAuth: true },
6484
7052
  });
6485
7053
  }
7054
+ /**
7055
+ * Retrieves an organization role assigned to a user.
7056
+ *
7057
+ * @example
7058
+ * ```ts
7059
+ * const role =
7060
+ * await client.admin.organization.users.roles.retrieve(
7061
+ * 'role_id',
7062
+ * { user_id: 'user_id' },
7063
+ * );
7064
+ * ```
7065
+ */
7066
+ retrieve(roleID, params, options) {
7067
+ const { user_id } = params;
7068
+ return this._client.get(path `/organization/users/${user_id}/roles/${roleID}`, {
7069
+ ...options,
7070
+ __security: { adminAPIKeyAuth: true },
7071
+ });
7072
+ }
6486
7073
  /**
6487
7074
  * Lists the organization roles assigned to a user within the organization.
6488
7075
  *
@@ -6605,6 +7192,8 @@ class Organization extends APIResource {
6605
7192
  this.users = new Users(this._client);
6606
7193
  this.groups = new Groups$1(this._client);
6607
7194
  this.roles = new Roles$5(this._client);
7195
+ this.dataRetention = new DataRetention$1(this._client);
7196
+ this.spendAlerts = new SpendAlerts$1(this._client);
6608
7197
  this.certificates = new Certificates$1(this._client);
6609
7198
  this.projects = new Projects(this._client);
6610
7199
  }
@@ -6616,6 +7205,8 @@ Organization.Invites = Invites;
6616
7205
  Organization.Users = Users;
6617
7206
  Organization.Groups = Groups$1;
6618
7207
  Organization.Roles = Roles$5;
7208
+ Organization.DataRetention = DataRetention$1;
7209
+ Organization.SpendAlerts = SpendAlerts$1;
6619
7210
  Organization.Certificates = Certificates$1;
6620
7211
  Organization.Projects = Projects;
6621
7212
 
@@ -13610,7 +14201,7 @@ const DEFAULT_MODEL = 'gpt-5.4-mini';
13610
14201
  const GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS = 272_000;
13611
14202
  const GPT_5_HIGH_CONTEXT_INPUT_MULTIPLIER = 2;
13612
14203
  const GPT_5_HIGH_CONTEXT_OUTPUT_MULTIPLIER = 1.5;
13613
- /** Token costs in USD per 1M tokens. Last updated May 2026. */
14204
+ /** Token costs in USD per 1M tokens. Last updated May 2026 from the OpenAI API pricing page. */
13614
14205
  const openAiModelCosts = {
13615
14206
  'gpt-5': {
13616
14207
  inputCost: 1.25 / 1_000_000,
@@ -13623,9 +14214,14 @@ const openAiModelCosts = {
13623
14214
  outputCost: 2 / 1_000_000,
13624
14215
  },
13625
14216
  'gpt-5.4-mini': {
13626
- inputCost: 0.25 / 1_000_000,
13627
- cacheHitCost: 0.025 / 1_000_000,
13628
- outputCost: 2 / 1_000_000,
14217
+ inputCost: 0.75 / 1_000_000,
14218
+ cacheHitCost: 0.075 / 1_000_000,
14219
+ outputCost: 4.5 / 1_000_000,
14220
+ },
14221
+ 'gpt-5.4-nano': {
14222
+ inputCost: 0.2 / 1_000_000,
14223
+ cacheHitCost: 0.02 / 1_000_000,
14224
+ outputCost: 1.25 / 1_000_000,
13629
14225
  },
13630
14226
  'gpt-5-nano': {
13631
14227
  inputCost: 0.05 / 1_000_000,
@@ -16252,6 +16848,10 @@ function requireReceiver () {
16252
16848
  * extensions
16253
16849
  * @param {Boolean} [options.isServer=false] Specifies whether to operate in
16254
16850
  * client or server mode
16851
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
16852
+ * buffered data chunks
16853
+ * @param {Number} [options.maxFragments=0] The maximum number of message
16854
+ * fragments
16255
16855
  * @param {Number} [options.maxPayload=0] The maximum allowed message length
16256
16856
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
16257
16857
  * not to skip UTF-8 validation for text and close messages
@@ -16266,6 +16866,8 @@ function requireReceiver () {
16266
16866
  this._binaryType = options.binaryType || BINARY_TYPES[0];
16267
16867
  this._extensions = options.extensions || {};
16268
16868
  this._isServer = !!options.isServer;
16869
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
16870
+ this._maxFragments = options.maxFragments | 0;
16269
16871
  this._maxPayload = options.maxPayload | 0;
16270
16872
  this._skipUTF8Validation = !!options.skipUTF8Validation;
16271
16873
  this[kWebSocket] = undefined;
@@ -16301,6 +16903,22 @@ function requireReceiver () {
16301
16903
  _write(chunk, encoding, cb) {
16302
16904
  if (this._opcode === 0x08 && this._state == GET_INFO) return cb();
16303
16905
 
16906
+ if (
16907
+ this._maxBufferedChunks > 0 &&
16908
+ this._buffers.length >= this._maxBufferedChunks
16909
+ ) {
16910
+ cb(
16911
+ this.createError(
16912
+ RangeError,
16913
+ 'Too many buffered chunks',
16914
+ false,
16915
+ 1008,
16916
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
16917
+ )
16918
+ );
16919
+ return;
16920
+ }
16921
+
16304
16922
  this._bufferedBytes += chunk.length;
16305
16923
  this._buffers.push(chunk);
16306
16924
  this.startLoop(cb);
@@ -16697,6 +17315,22 @@ function requireReceiver () {
16697
17315
  }
16698
17316
 
16699
17317
  if (data.length) {
17318
+ if (
17319
+ this._maxFragments > 0 &&
17320
+ this._fragments.length >= this._maxFragments
17321
+ ) {
17322
+ const error = this.createError(
17323
+ RangeError,
17324
+ 'Too many message fragments',
17325
+ false,
17326
+ 1008,
17327
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
17328
+ );
17329
+
17330
+ cb(error);
17331
+ return;
17332
+ }
17333
+
16700
17334
  //
16701
17335
  // This message is not compressed so its length is the sum of the payload
16702
17336
  // length of all fragments.
@@ -16736,6 +17370,22 @@ function requireReceiver () {
16736
17370
  return;
16737
17371
  }
16738
17372
 
17373
+ if (
17374
+ this._maxFragments > 0 &&
17375
+ this._fragments.length >= this._maxFragments
17376
+ ) {
17377
+ const error = this.createError(
17378
+ RangeError,
17379
+ 'Too many message fragments',
17380
+ false,
17381
+ 1008,
17382
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
17383
+ );
17384
+
17385
+ cb(error);
17386
+ return;
17387
+ }
17388
+
16739
17389
  this._fragments.push(buf);
16740
17390
  }
16741
17391
 
@@ -16930,6 +17580,9 @@ function requireSender () {
16930
17580
 
16931
17581
  const { Duplex } = require$$0$2;
16932
17582
  const { randomFillSync } = require$$3;
17583
+ const {
17584
+ types: { isUint8Array }
17585
+ } = require$$2;
16933
17586
 
16934
17587
  const PerMessageDeflate = requirePermessageDeflate();
16935
17588
  const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants();
@@ -17126,8 +17779,10 @@ function requireSender () {
17126
17779
 
17127
17780
  if (typeof data === 'string') {
17128
17781
  buf.write(data, 2);
17129
- } else {
17782
+ } else if (isUint8Array(data)) {
17130
17783
  buf.set(data, 2);
17784
+ } else {
17785
+ throw new TypeError('Second argument must be a string or a Uint8Array');
17131
17786
  }
17132
17787
  }
17133
17788
 
@@ -18051,7 +18706,7 @@ function requireWebsocket () {
18051
18706
 
18052
18707
  const EventEmitter = require$$0$3;
18053
18708
  const https = require$$1;
18054
- const http = require$$2;
18709
+ const http = require$$2$1;
18055
18710
  const net = require$$3$1;
18056
18711
  const tls = require$$4;
18057
18712
  const { randomBytes, createHash } = require$$3;
@@ -18248,6 +18903,10 @@ function requireWebsocket () {
18248
18903
  * multiple times in the same tick
18249
18904
  * @param {Function} [options.generateMask] The function used to generate the
18250
18905
  * masking key
18906
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
18907
+ * buffered data chunks
18908
+ * @param {Number} [options.maxFragments=0] The maximum number of message
18909
+ * fragments
18251
18910
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
18252
18911
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
18253
18912
  * not to skip UTF-8 validation for text and close messages
@@ -18259,6 +18918,8 @@ function requireWebsocket () {
18259
18918
  binaryType: this.binaryType,
18260
18919
  extensions: this._extensions,
18261
18920
  isServer: this._isServer,
18921
+ maxBufferedChunks: options.maxBufferedChunks,
18922
+ maxFragments: options.maxFragments,
18262
18923
  maxPayload: options.maxPayload,
18263
18924
  skipUTF8Validation: options.skipUTF8Validation
18264
18925
  });
@@ -18687,6 +19348,10 @@ function requireWebsocket () {
18687
19348
  * masking key
18688
19349
  * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
18689
19350
  * handshake request
19351
+ * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
19352
+ * buffered data chunks
19353
+ * @param {Number} [options.maxFragments=131072] The maximum number of message
19354
+ * fragments
18690
19355
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
18691
19356
  * size
18692
19357
  * @param {Number} [options.maxRedirects=10] The maximum number of redirects
@@ -18707,6 +19372,8 @@ function requireWebsocket () {
18707
19372
  autoPong: true,
18708
19373
  closeTimeout: CLOSE_TIMEOUT,
18709
19374
  protocolVersion: protocolVersions[1],
19375
+ maxBufferedChunks: 1024 * 1024,
19376
+ maxFragments: 128 * 1024,
18710
19377
  maxPayload: 100 * 1024 * 1024,
18711
19378
  skipUTF8Validation: false,
18712
19379
  perMessageDeflate: true,
@@ -19064,6 +19731,8 @@ function requireWebsocket () {
19064
19731
  websocket.setSocket(socket, head, {
19065
19732
  allowSynchronousEvents: opts.allowSynchronousEvents,
19066
19733
  generateMask: opts.generateMask,
19734
+ maxBufferedChunks: opts.maxBufferedChunks,
19735
+ maxFragments: opts.maxFragments,
19067
19736
  maxPayload: opts.maxPayload,
19068
19737
  skipUTF8Validation: opts.skipUTF8Validation
19069
19738
  });
@@ -19706,7 +20375,7 @@ function requireWebsocketServer () {
19706
20375
  hasRequiredWebsocketServer = 1;
19707
20376
 
19708
20377
  const EventEmitter = require$$0$3;
19709
- const http = require$$2;
20378
+ const http = require$$2$1;
19710
20379
  const { Duplex } = require$$0$2;
19711
20380
  const { createHash } = require$$3;
19712
20381
 
@@ -19746,6 +20415,10 @@ function requireWebsocketServer () {
19746
20415
  * called
19747
20416
  * @param {Function} [options.handleProtocols] A hook to handle protocols
19748
20417
  * @param {String} [options.host] The hostname where to bind the server
20418
+ * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
20419
+ * buffered data chunks
20420
+ * @param {Number} [options.maxFragments=131072] The maximum number of message
20421
+ * fragments
19749
20422
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
19750
20423
  * size
19751
20424
  * @param {Boolean} [options.noServer=false] Enable no server mode
@@ -19768,6 +20441,8 @@ function requireWebsocketServer () {
19768
20441
  options = {
19769
20442
  allowSynchronousEvents: true,
19770
20443
  autoPong: true,
20444
+ maxBufferedChunks: 1024 * 1024,
20445
+ maxFragments: 128 * 1024,
19771
20446
  maxPayload: 100 * 1024 * 1024,
19772
20447
  skipUTF8Validation: false,
19773
20448
  perMessageDeflate: false,
@@ -20127,6 +20802,8 @@ function requireWebsocketServer () {
20127
20802
 
20128
20803
  ws.setSocket(socket, head, {
20129
20804
  allowSynchronousEvents: this.options.allowSynchronousEvents,
20805
+ maxBufferedChunks: this.options.maxBufferedChunks,
20806
+ maxFragments: this.options.maxFragments,
20130
20807
  maxPayload: this.options.maxPayload,
20131
20808
  skipUTF8Validation: this.options.skipUTF8Validation
20132
20809
  });
@@ -20271,7 +20948,7 @@ function requireMain () {
20271
20948
  hasRequiredMain = 1;
20272
20949
  const fs = require$$0$4;
20273
20950
  const path = require$$1$1;
20274
- const os = require$$2$1;
20951
+ const os = require$$2$2;
20275
20952
  const crypto = require$$3;
20276
20953
 
20277
20954
  // Array of tips to display randomly