@hasna/evals 0.1.27 → 0.1.29

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/cli/index.js CHANGED
@@ -1019,7 +1019,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1019
1019
  this._exitCallback = (err) => {
1020
1020
  if (err.code !== "commander.executeSubCommandAsync") {
1021
1021
  throw err;
1022
- }
1022
+ } else {}
1023
1023
  };
1024
1024
  }
1025
1025
  return this;
@@ -5275,9 +5275,6 @@ var require_data = __commonJS((exports, module) => {
5275
5275
  var require_utils = __commonJS((exports, module) => {
5276
5276
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
5277
5277
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
5278
- var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
5279
- var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
5280
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
5281
5278
  function stringArrayToHexStripped(input) {
5282
5279
  let acc = "";
5283
5280
  let code = 0;
@@ -5471,77 +5468,27 @@ var require_utils = __commonJS((exports, module) => {
5471
5468
  }
5472
5469
  return output.join("");
5473
5470
  }
5474
- var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
5475
- var HOST_DELIM_RE = /[@/?#:]/g;
5476
- var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
5477
- function reescapeHostDelimiters(host, isIP) {
5478
- const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
5479
- re.lastIndex = 0;
5480
- return host.replace(re, (ch) => HOST_DELIMS[ch]);
5481
- }
5482
- function normalizePercentEncoding(input, decodeUnreserved = false) {
5483
- if (input.indexOf("%") === -1) {
5484
- return input;
5471
+ function normalizeComponentEncoding(component, esc) {
5472
+ const func = esc !== true ? escape : unescape;
5473
+ if (component.scheme !== undefined) {
5474
+ component.scheme = func(component.scheme);
5485
5475
  }
5486
- let output = "";
5487
- for (let i = 0;i < input.length; i++) {
5488
- if (input[i] === "%" && i + 2 < input.length) {
5489
- const hex = input.slice(i + 1, i + 3);
5490
- if (isHexPair(hex)) {
5491
- const normalizedHex = hex.toUpperCase();
5492
- const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
5493
- if (decodeUnreserved && isUnreserved(decoded)) {
5494
- output += decoded;
5495
- } else {
5496
- output += "%" + normalizedHex;
5497
- }
5498
- i += 2;
5499
- continue;
5500
- }
5501
- }
5502
- output += input[i];
5476
+ if (component.userinfo !== undefined) {
5477
+ component.userinfo = func(component.userinfo);
5503
5478
  }
5504
- return output;
5505
- }
5506
- function normalizePathEncoding(input) {
5507
- let output = "";
5508
- for (let i = 0;i < input.length; i++) {
5509
- if (input[i] === "%" && i + 2 < input.length) {
5510
- const hex = input.slice(i + 1, i + 3);
5511
- if (isHexPair(hex)) {
5512
- const normalizedHex = hex.toUpperCase();
5513
- const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
5514
- if (decoded !== "." && isUnreserved(decoded)) {
5515
- output += decoded;
5516
- } else {
5517
- output += "%" + normalizedHex;
5518
- }
5519
- i += 2;
5520
- continue;
5521
- }
5522
- }
5523
- if (isPathCharacter(input[i])) {
5524
- output += input[i];
5525
- } else {
5526
- output += escape(input[i]);
5527
- }
5479
+ if (component.host !== undefined) {
5480
+ component.host = func(component.host);
5528
5481
  }
5529
- return output;
5530
- }
5531
- function escapePreservingEscapes(input) {
5532
- let output = "";
5533
- for (let i = 0;i < input.length; i++) {
5534
- if (input[i] === "%" && i + 2 < input.length) {
5535
- const hex = input.slice(i + 1, i + 3);
5536
- if (isHexPair(hex)) {
5537
- output += "%" + hex.toUpperCase();
5538
- i += 2;
5539
- continue;
5540
- }
5541
- }
5542
- output += escape(input[i]);
5482
+ if (component.path !== undefined) {
5483
+ component.path = func(component.path);
5543
5484
  }
5544
- return output;
5485
+ if (component.query !== undefined) {
5486
+ component.query = func(component.query);
5487
+ }
5488
+ if (component.fragment !== undefined) {
5489
+ component.fragment = func(component.fragment);
5490
+ }
5491
+ return component;
5545
5492
  }
5546
5493
  function recomposeAuthority(component) {
5547
5494
  const uriTokens = [];
@@ -5556,7 +5503,7 @@ var require_utils = __commonJS((exports, module) => {
5556
5503
  if (ipV6res.isIPV6 === true) {
5557
5504
  host = `[${ipV6res.escapedHost}]`;
5558
5505
  } else {
5559
- host = reescapeHostDelimiters(host, false);
5506
+ host = component.host;
5560
5507
  }
5561
5508
  }
5562
5509
  uriTokens.push(host);
@@ -5570,10 +5517,7 @@ var require_utils = __commonJS((exports, module) => {
5570
5517
  module.exports = {
5571
5518
  nonSimpleDomain,
5572
5519
  recomposeAuthority,
5573
- reescapeHostDelimiters,
5574
- normalizePercentEncoding,
5575
- normalizePathEncoding,
5576
- escapePreservingEscapes,
5520
+ normalizeComponentEncoding,
5577
5521
  removeDotSegments,
5578
5522
  isIPv4,
5579
5523
  isUUID,
@@ -5758,11 +5702,11 @@ var require_schemes = __commonJS((exports, module) => {
5758
5702
 
5759
5703
  // node_modules/fast-uri/index.js
5760
5704
  var require_fast_uri = __commonJS((exports, module) => {
5761
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
5705
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
5762
5706
  var { SCHEMES, getSchemeHandler } = require_schemes();
5763
5707
  function normalize(uri, options) {
5764
5708
  if (typeof uri === "string") {
5765
- uri = normalizeString(uri, options);
5709
+ uri = serialize(parse(uri, options), options);
5766
5710
  } else if (typeof uri === "object") {
5767
5711
  uri = parse(serialize(uri, options), options);
5768
5712
  }
@@ -5828,9 +5772,19 @@ var require_fast_uri = __commonJS((exports, module) => {
5828
5772
  return target;
5829
5773
  }
5830
5774
  function equal(uriA, uriB, options) {
5831
- const normalizedA = normalizeComparableURI(uriA, options);
5832
- const normalizedB = normalizeComparableURI(uriB, options);
5833
- return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
5775
+ if (typeof uriA === "string") {
5776
+ uriA = unescape(uriA);
5777
+ uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
5778
+ } else if (typeof uriA === "object") {
5779
+ uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
5780
+ }
5781
+ if (typeof uriB === "string") {
5782
+ uriB = unescape(uriB);
5783
+ uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
5784
+ } else if (typeof uriB === "object") {
5785
+ uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
5786
+ }
5787
+ return uriA.toLowerCase() === uriB.toLowerCase();
5834
5788
  }
5835
5789
  function serialize(cmpts, opts) {
5836
5790
  const component = {
@@ -5856,12 +5810,12 @@ var require_fast_uri = __commonJS((exports, module) => {
5856
5810
  schemeHandler.serialize(component, options);
5857
5811
  if (component.path !== undefined) {
5858
5812
  if (!options.skipEscape) {
5859
- component.path = escapePreservingEscapes(component.path);
5813
+ component.path = escape(component.path);
5860
5814
  if (component.scheme !== undefined) {
5861
5815
  component.path = component.path.split("%3A").join(":");
5862
5816
  }
5863
5817
  } else {
5864
- component.path = normalizePercentEncoding(component.path);
5818
+ component.path = unescape(component.path);
5865
5819
  }
5866
5820
  }
5867
5821
  if (options.reference !== "suffix" && component.scheme) {
@@ -5896,16 +5850,7 @@ var require_fast_uri = __commonJS((exports, module) => {
5896
5850
  return uriTokens.join("");
5897
5851
  }
5898
5852
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
5899
- function getParseError(parsed, matches) {
5900
- if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
5901
- return 'URI path must start with "/" when authority is present.';
5902
- }
5903
- if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
5904
- return "URI port is malformed.";
5905
- }
5906
- return;
5907
- }
5908
- function parseWithStatus(uri, opts) {
5853
+ function parse(uri, opts) {
5909
5854
  const options = Object.assign({}, opts);
5910
5855
  const parsed = {
5911
5856
  scheme: undefined,
@@ -5916,7 +5861,6 @@ var require_fast_uri = __commonJS((exports, module) => {
5916
5861
  query: undefined,
5917
5862
  fragment: undefined
5918
5863
  };
5919
- let malformedAuthorityOrPort = false;
5920
5864
  let isIP = false;
5921
5865
  if (options.reference === "suffix") {
5922
5866
  if (options.scheme) {
@@ -5937,11 +5881,6 @@ var require_fast_uri = __commonJS((exports, module) => {
5937
5881
  if (isNaN(parsed.port)) {
5938
5882
  parsed.port = matches[5];
5939
5883
  }
5940
- const parseError = getParseError(parsed, matches);
5941
- if (parseError !== undefined) {
5942
- parsed.error = parsed.error || parseError;
5943
- malformedAuthorityOrPort = true;
5944
- }
5945
5884
  if (parsed.host) {
5946
5885
  const ipv4result = isIPv4(parsed.host);
5947
5886
  if (ipv4result === false) {
@@ -5980,18 +5919,14 @@ var require_fast_uri = __commonJS((exports, module) => {
5980
5919
  parsed.scheme = unescape(parsed.scheme);
5981
5920
  }
5982
5921
  if (parsed.host !== undefined) {
5983
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
5922
+ parsed.host = unescape(parsed.host);
5984
5923
  }
5985
5924
  }
5986
5925
  if (parsed.path) {
5987
- parsed.path = normalizePathEncoding(parsed.path);
5926
+ parsed.path = escape(unescape(parsed.path));
5988
5927
  }
5989
5928
  if (parsed.fragment) {
5990
- try {
5991
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5992
- } catch {
5993
- parsed.error = parsed.error || "URI malformed";
5994
- }
5929
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5995
5930
  }
5996
5931
  }
5997
5932
  if (schemeHandler && schemeHandler.parse) {
@@ -6000,29 +5935,7 @@ var require_fast_uri = __commonJS((exports, module) => {
6000
5935
  } else {
6001
5936
  parsed.error = parsed.error || "URI can not be parsed.";
6002
5937
  }
6003
- return { parsed, malformedAuthorityOrPort };
6004
- }
6005
- function parse(uri, opts) {
6006
- return parseWithStatus(uri, opts).parsed;
6007
- }
6008
- function normalizeString(uri, opts) {
6009
- return normalizeStringWithStatus(uri, opts).normalized;
6010
- }
6011
- function normalizeStringWithStatus(uri, opts) {
6012
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
6013
- return {
6014
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
6015
- malformedAuthorityOrPort
6016
- };
6017
- }
6018
- function normalizeComparableURI(uri, opts) {
6019
- if (typeof uri === "string") {
6020
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
6021
- return malformedAuthorityOrPort ? undefined : normalized;
6022
- }
6023
- if (typeof uri === "object") {
6024
- return serialize(uri, opts);
6025
- }
5938
+ return parsed;
6026
5939
  }
6027
5940
  var fastUri = {
6028
5941
  SCHEMES,
@@ -6157,7 +6070,7 @@ var require_core = __commonJS((exports) => {
6157
6070
  constructor(opts = {}) {
6158
6071
  this.schemas = {};
6159
6072
  this.refs = {};
6160
- this.formats = Object.create(null);
6073
+ this.formats = {};
6161
6074
  this._compilations = new Set;
6162
6075
  this._loading = {};
6163
6076
  this._cache = new Map;
@@ -8543,6 +8456,20 @@ var require_ajv = __commonJS((exports, module) => {
8543
8456
  } });
8544
8457
  });
8545
8458
 
8459
+ // src/core/redaction.ts
8460
+ function redactAdapterConfig(config) {
8461
+ if (!config || !("apiKey" in config))
8462
+ return config;
8463
+ const { apiKey: _apiKey, ...safeConfig } = config;
8464
+ return safeConfig;
8465
+ }
8466
+ function redactRunSecrets(run) {
8467
+ return {
8468
+ ...run,
8469
+ adapterConfig: redactAdapterConfig(run.adapterConfig)
8470
+ };
8471
+ }
8472
+
8546
8473
  // src/db/store.ts
8547
8474
  var exports_store = {};
8548
8475
  __export(exports_store, {
@@ -8558,11 +8485,33 @@ __export(exports_store, {
8558
8485
  clearBaseline: () => clearBaseline
8559
8486
  });
8560
8487
  import { Database } from "bun:sqlite";
8561
- import { mkdirSync } from "fs";
8488
+ import { copyFileSync, existsSync as existsSync3, mkdirSync, readdirSync, statSync } from "fs";
8562
8489
  import { homedir as homedir3 } from "os";
8563
8490
  import { join as join3 } from "path";
8491
+ function homeDir() {
8492
+ return process.env["HOME"] || process.env["USERPROFILE"] || homedir3();
8493
+ }
8494
+ function defaultDbPath() {
8495
+ const home = homeDir();
8496
+ const newDir = join3(home, ".hasna", "evals");
8497
+ const oldDir = join3(home, ".evals");
8498
+ if (existsSync3(oldDir) && !existsSync3(newDir)) {
8499
+ mkdirSync(newDir, { recursive: true });
8500
+ try {
8501
+ for (const file of readdirSync(oldDir)) {
8502
+ const oldPath = join3(oldDir, file);
8503
+ const newPath = join3(newDir, file);
8504
+ try {
8505
+ if (statSync(oldPath).isFile())
8506
+ copyFileSync(oldPath, newPath);
8507
+ } catch {}
8508
+ }
8509
+ } catch {}
8510
+ }
8511
+ return join3(newDir, "evals.db");
8512
+ }
8564
8513
  function getDbPath() {
8565
- return process.env["EVALS_DB_PATH"] ?? join3(homedir3(), ".hasna", "evals", "evals.db");
8514
+ return process.env["EVALS_DB_PATH"] ?? defaultDbPath();
8566
8515
  }
8567
8516
  function getDatabase() {
8568
8517
  if (_db)
@@ -8604,10 +8553,11 @@ function migrate(db) {
8604
8553
  }
8605
8554
  function saveRun(run) {
8606
8555
  const db = getDatabase();
8556
+ const safeRun = redactRunSecrets(run);
8607
8557
  db.prepare(`
8608
8558
  INSERT OR REPLACE INTO runs (id, created_at, dataset, stats, adapter, data)
8609
8559
  VALUES (?, ?, ?, ?, ?, ?)
8610
- `).run(run.id, run.createdAt, run.dataset, JSON.stringify(run.stats), run.adapterConfig ? JSON.stringify(run.adapterConfig) : null, JSON.stringify(run));
8560
+ `).run(safeRun.id, safeRun.createdAt, safeRun.dataset, JSON.stringify(safeRun.stats), safeRun.adapterConfig ? JSON.stringify(safeRun.adapterConfig) : null, JSON.stringify(safeRun));
8611
8561
  }
8612
8562
  function getRun(id) {
8613
8563
  const db = getDatabase();
@@ -8717,24 +8667,24 @@ __export(exports_dist, {
8717
8667
  import { createRequire } from "module";
8718
8668
  import { Database as Database2 } from "bun:sqlite";
8719
8669
  import {
8720
- existsSync as existsSync5,
8670
+ existsSync as existsSync6,
8721
8671
  mkdirSync as mkdirSync2,
8722
- readdirSync,
8723
- copyFileSync
8672
+ readdirSync as readdirSync2,
8673
+ copyFileSync as copyFileSync2
8724
8674
  } from "fs";
8725
8675
  import { homedir as homedir6 } from "os";
8726
8676
  import { join as join6, relative } from "path";
8727
8677
  import { existsSync as existsSync22, mkdirSync as mkdirSync22, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
8728
8678
  import { homedir as homedir22 } from "os";
8729
8679
  import { join as join22 } from "path";
8730
- import { readdirSync as readdirSync3, existsSync as existsSync6 } from "fs";
8680
+ import { readdirSync as readdirSync3, existsSync as existsSync62 } from "fs";
8731
8681
  import { join as join62 } from "path";
8732
8682
  import { homedir as homedir52 } from "os";
8733
8683
  import { hostname } from "os";
8734
8684
  import { existsSync as existsSync32, readFileSync as readFileSync22 } from "fs";
8735
8685
  import { homedir as homedir32 } from "os";
8736
8686
  import { join as join32 } from "path";
8737
- import { existsSync as existsSync42, readdirSync as readdirSync2 } from "fs";
8687
+ import { existsSync as existsSync42, readdirSync as readdirSync22 } from "fs";
8738
8688
  import { join as join42 } from "path";
8739
8689
  import { join as join52, dirname } from "path";
8740
8690
  import { existsSync as existsSync52, writeFileSync as writeFileSync22, unlinkSync, mkdirSync as mkdirSync3 } from "fs";
@@ -9631,9 +9581,9 @@ function getDbPath2(serviceName) {
9631
9581
  function migrateDotfile(serviceName) {
9632
9582
  const legacyDir = join6(homedir6(), `.${serviceName}`);
9633
9583
  const newDir = join6(HASNA_DIR, serviceName);
9634
- if (!existsSync5(legacyDir))
9584
+ if (!existsSync6(legacyDir))
9635
9585
  return [];
9636
- if (existsSync5(newDir))
9586
+ if (existsSync6(newDir))
9637
9587
  return [];
9638
9588
  mkdirSync2(newDir, { recursive: true });
9639
9589
  const migrated = [];
@@ -9641,7 +9591,7 @@ function migrateDotfile(serviceName) {
9641
9591
  return migrated;
9642
9592
  }
9643
9593
  function copyDirRecursive(src, dest, root, migrated) {
9644
- const entries = readdirSync(src, { withFileTypes: true });
9594
+ const entries = readdirSync2(src, { withFileTypes: true });
9645
9595
  for (const entry of entries) {
9646
9596
  const srcPath = join6(src, entry.name);
9647
9597
  const destPath = join6(dest, entry.name);
@@ -9649,13 +9599,13 @@ function copyDirRecursive(src, dest, root, migrated) {
9649
9599
  mkdirSync2(destPath, { recursive: true });
9650
9600
  copyDirRecursive(srcPath, destPath, root, migrated);
9651
9601
  } else {
9652
- copyFileSync(srcPath, destPath);
9602
+ copyFileSync2(srcPath, destPath);
9653
9603
  migrated.push(relative(root, srcPath));
9654
9604
  }
9655
9605
  }
9656
9606
  }
9657
9607
  function hasLegacyDotfile(serviceName) {
9658
- return existsSync5(join6(homedir6(), `.${serviceName}`));
9608
+ return existsSync6(join6(homedir6(), `.${serviceName}`));
9659
9609
  }
9660
9610
  function getHasnaDir() {
9661
9611
  mkdirSync2(HASNA_DIR, { recursive: true });
@@ -9711,7 +9661,7 @@ function isSyncExcludedTable(table) {
9711
9661
  }
9712
9662
  function discoverServices() {
9713
9663
  const dataDir = join62(homedir52(), ".hasna");
9714
- if (!existsSync6(dataDir))
9664
+ if (!existsSync62(dataDir))
9715
9665
  return [];
9716
9666
  try {
9717
9667
  const entries = readdirSync3(dataDir, { withFileTypes: true });
@@ -9733,7 +9683,7 @@ function discoverSyncableServices2() {
9733
9683
  }
9734
9684
  function getServiceDbPath(service) {
9735
9685
  const dataDir = join62(homedir52(), ".hasna", service);
9736
- if (!existsSync6(dataDir))
9686
+ if (!existsSync62(dataDir))
9737
9687
  return null;
9738
9688
  const candidates = [
9739
9689
  join62(dataDir, `${service}.db`),
@@ -9749,7 +9699,7 @@ function getServiceDbPath(service) {
9749
9699
  }
9750
9700
  } catch {}
9751
9701
  for (const p of candidates) {
9752
- if (existsSync6(p))
9702
+ if (existsSync62(p))
9753
9703
  return p;
9754
9704
  }
9755
9705
  return null;
@@ -10777,7 +10727,7 @@ function discoverSyncableServices() {
10777
10727
  const hasnaDir = getHasnaDir();
10778
10728
  const services = [];
10779
10729
  try {
10780
- const entries = readdirSync2(hasnaDir, { withFileTypes: true });
10730
+ const entries = readdirSync22(hasnaDir, { withFileTypes: true });
10781
10731
  for (const entry of entries) {
10782
10732
  if (!entry.isDirectory())
10783
10733
  continue;
@@ -19769,7 +19719,6 @@ var HASNA_EVENTS_HOME_ENV = "HASNA_EVENTS_HOME";
19769
19719
  function getEventsDataDir(override) {
19770
19720
  return override || process.env[HASNA_EVENTS_DIR_ENV] || process.env[HASNA_EVENTS_HOME_ENV] || join(homedir(), ".hasna", "events");
19771
19721
  }
19772
-
19773
19722
  class JsonEventsStore {
19774
19723
  dataDir;
19775
19724
  channelsPath;
@@ -24948,33 +24897,6 @@ class InvalidWebhookSignatureError extends Error {
24948
24897
  }
24949
24898
  }
24950
24899
 
24951
- class OAuthError extends APIError2 {
24952
- constructor(status, error2, headers) {
24953
- let finalMessage = "OAuth2 authentication error";
24954
- let error_code = undefined;
24955
- if (error2 && typeof error2 === "object") {
24956
- const errorData = error2;
24957
- error_code = errorData["error"];
24958
- const description = errorData["error_description"];
24959
- if (description && typeof description === "string") {
24960
- finalMessage = description;
24961
- } else if (error_code) {
24962
- finalMessage = error_code;
24963
- }
24964
- }
24965
- super(status, error2, finalMessage, headers);
24966
- this.error_code = error_code;
24967
- }
24968
- }
24969
-
24970
- class SubjectTokenProviderError extends OpenAIError {
24971
- constructor(message, provider, cause) {
24972
- super(message);
24973
- this.provider = provider;
24974
- this.cause = cause;
24975
- }
24976
- }
24977
-
24978
24900
  // node_modules/openai/internal/utils/values.mjs
24979
24901
  var startsWithSchemeRegexp2 = /^[a-z][a-z0-9+.-]*:/i;
24980
24902
  var isAbsoluteURL2 = (url) => {
@@ -25022,7 +24944,7 @@ var safeJSON2 = (text) => {
25022
24944
  var sleep2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
25023
24945
 
25024
24946
  // node_modules/openai/version.mjs
25025
- var VERSION2 = "6.42.0";
24947
+ var VERSION2 = "6.33.0";
25026
24948
 
25027
24949
  // node_modules/openai/internal/detect-platform.mjs
25028
24950
  var isRunningInBrowser2 = () => {
@@ -25713,7 +25635,7 @@ var formatRequestDetails2 = (details) => {
25713
25635
  if (details.headers) {
25714
25636
  details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
25715
25637
  name,
25716
- name.toLowerCase() === "authorization" || name.toLowerCase() === "api-key" || name.toLowerCase() === "x-api-key" || name.toLowerCase() === "cookie" || name.toLowerCase() === "set-cookie" ? "***" : value
25638
+ name.toLowerCase() === "authorization" || name.toLowerCase() === "cookie" || name.toLowerCase() === "set-cookie" ? "***" : value
25717
25639
  ]));
25718
25640
  }
25719
25641
  if ("retryOfRequestLogID" in details) {
@@ -26194,125 +26116,6 @@ class ConversationCursorPage extends AbstractPage2 {
26194
26116
  }
26195
26117
  }
26196
26118
 
26197
- class NextCursorPage extends AbstractPage2 {
26198
- constructor(client, response, body, options) {
26199
- super(client, response, body, options);
26200
- this.data = body.data || [];
26201
- this.has_more = body.has_more || false;
26202
- this.next = body.next || null;
26203
- }
26204
- getPaginatedItems() {
26205
- return this.data ?? [];
26206
- }
26207
- hasNextPage() {
26208
- if (this.has_more === false) {
26209
- return false;
26210
- }
26211
- return super.hasNextPage();
26212
- }
26213
- nextPageRequestOptions() {
26214
- const cursor = this.next;
26215
- if (!cursor) {
26216
- return null;
26217
- }
26218
- return {
26219
- ...this.options,
26220
- query: {
26221
- ...maybeObj2(this.options.query),
26222
- after: cursor
26223
- }
26224
- };
26225
- }
26226
- }
26227
-
26228
- // node_modules/openai/auth/workload-identity-auth.mjs
26229
- var SUBJECT_TOKEN_TYPES = {
26230
- jwt: "urn:ietf:params:oauth:token-type:jwt",
26231
- id: "urn:ietf:params:oauth:token-type:id_token"
26232
- };
26233
- var TOKEN_EXCHANGE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:token-exchange";
26234
-
26235
- class WorkloadIdentityAuth {
26236
- constructor(config, fetch2) {
26237
- this.cachedToken = null;
26238
- this.refreshPromise = null;
26239
- this.tokenExchangeUrl = "https://auth.openai.com/oauth/token";
26240
- this.config = config;
26241
- this.fetch = fetch2 ?? getDefaultFetch2();
26242
- }
26243
- async getToken() {
26244
- if (!this.cachedToken || this.isTokenExpired(this.cachedToken)) {
26245
- if (this.refreshPromise) {
26246
- return await this.refreshPromise;
26247
- }
26248
- this.refreshPromise = this.refreshToken();
26249
- try {
26250
- const token = await this.refreshPromise;
26251
- return token;
26252
- } finally {
26253
- this.refreshPromise = null;
26254
- }
26255
- }
26256
- if (this.needsRefresh(this.cachedToken) && !this.refreshPromise) {
26257
- this.refreshPromise = this.refreshToken().finally(() => {
26258
- this.refreshPromise = null;
26259
- });
26260
- }
26261
- return this.cachedToken.token;
26262
- }
26263
- async refreshToken() {
26264
- const subjectToken = await this.config.provider.getToken();
26265
- const body = {
26266
- grant_type: TOKEN_EXCHANGE_GRANT_TYPE,
26267
- subject_token: subjectToken,
26268
- subject_token_type: SUBJECT_TOKEN_TYPES[this.config.provider.tokenType],
26269
- identity_provider_id: this.config.identityProviderId,
26270
- service_account_id: this.config.serviceAccountId
26271
- };
26272
- if (this.config.clientId) {
26273
- body["client_id"] = this.config.clientId;
26274
- }
26275
- const response = await this.fetch(this.tokenExchangeUrl, {
26276
- method: "POST",
26277
- headers: {
26278
- "Content-Type": "application/json"
26279
- },
26280
- body: JSON.stringify(body)
26281
- });
26282
- if (!response.ok) {
26283
- const errorText = await response.text();
26284
- let body2 = undefined;
26285
- try {
26286
- body2 = JSON.parse(errorText);
26287
- } catch {}
26288
- if (response.status === 400 || response.status === 401 || response.status === 403) {
26289
- throw new OAuthError(response.status, body2, response.headers);
26290
- }
26291
- throw APIError2.generate(response.status, body2, `Token exchange failed with status ${response.status}`, response.headers);
26292
- }
26293
- const tokenResponse = await response.json();
26294
- const expiresIn = tokenResponse.expires_in || 3600;
26295
- const expiresAt = Date.now() + expiresIn * 1000;
26296
- this.cachedToken = {
26297
- token: tokenResponse.access_token,
26298
- expiresAt
26299
- };
26300
- return tokenResponse.access_token;
26301
- }
26302
- isTokenExpired(cachedToken) {
26303
- return Date.now() >= cachedToken.expiresAt;
26304
- }
26305
- needsRefresh(cachedToken) {
26306
- const bufferSeconds = this.config.refreshBufferSeconds ?? 1200;
26307
- const bufferMs = bufferSeconds * 1000;
26308
- return Date.now() >= cachedToken.expiresAt - bufferMs;
26309
- }
26310
- invalidateToken() {
26311
- this.cachedToken = null;
26312
- this.refreshPromise = null;
26313
- }
26314
- }
26315
-
26316
26119
  // node_modules/openai/internal/uploads.mjs
26317
26120
  var checkFileSupport2 = () => {
26318
26121
  if (typeof File === "undefined") {
@@ -26519,7 +26322,7 @@ var path2 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
26519
26322
  // node_modules/openai/resources/chat/completions/messages.mjs
26520
26323
  class Messages3 extends APIResource2 {
26521
26324
  list(completionID, query = {}, options) {
26522
- return this._client.getAPIList(path2`/chat/completions/${completionID}/messages`, CursorPage, { query, ...options, __security: { bearerAuth: true } });
26325
+ return this._client.getAPIList(path2`/chat/completions/${completionID}/messages`, CursorPage, { query, ...options });
26523
26326
  }
26524
26327
  }
26525
26328
  // node_modules/openai/lib/parser.mjs
@@ -27780,38 +27583,19 @@ class Completions2 extends APIResource2 {
27780
27583
  this.messages = new Messages3(this._client);
27781
27584
  }
27782
27585
  create(body, options) {
27783
- return this._client.post("/chat/completions", {
27784
- body,
27785
- ...options,
27786
- stream: body.stream ?? false,
27787
- __security: { bearerAuth: true }
27788
- });
27586
+ return this._client.post("/chat/completions", { body, ...options, stream: body.stream ?? false });
27789
27587
  }
27790
27588
  retrieve(completionID, options) {
27791
- return this._client.get(path2`/chat/completions/${completionID}`, {
27792
- ...options,
27793
- __security: { bearerAuth: true }
27794
- });
27589
+ return this._client.get(path2`/chat/completions/${completionID}`, options);
27795
27590
  }
27796
27591
  update(completionID, body, options) {
27797
- return this._client.post(path2`/chat/completions/${completionID}`, {
27798
- body,
27799
- ...options,
27800
- __security: { bearerAuth: true }
27801
- });
27592
+ return this._client.post(path2`/chat/completions/${completionID}`, { body, ...options });
27802
27593
  }
27803
27594
  list(query = {}, options) {
27804
- return this._client.getAPIList("/chat/completions", CursorPage, {
27805
- query,
27806
- ...options,
27807
- __security: { bearerAuth: true }
27808
- });
27595
+ return this._client.getAPIList("/chat/completions", CursorPage, { query, ...options });
27809
27596
  }
27810
27597
  delete(completionID, options) {
27811
- return this._client.delete(path2`/chat/completions/${completionID}`, {
27812
- ...options,
27813
- __security: { bearerAuth: true }
27814
- });
27598
+ return this._client.delete(path2`/chat/completions/${completionID}`, options);
27815
27599
  }
27816
27600
  parse(body, options) {
27817
27601
  validateInputTools(body.tools);
@@ -27843,978 +27627,97 @@ class Chat extends APIResource2 {
27843
27627
  }
27844
27628
  }
27845
27629
  Chat.Completions = Completions2;
27846
- // node_modules/openai/resources/admin/organization/admin-api-keys.mjs
27847
- class AdminAPIKeys extends APIResource2 {
27848
- create(body, options) {
27849
- return this._client.post("/organization/admin_api_keys", {
27850
- body,
27851
- ...options,
27852
- __security: { adminAPIKeyAuth: true }
27853
- });
27854
- }
27855
- retrieve(keyID, options) {
27856
- return this._client.get(path2`/organization/admin_api_keys/${keyID}`, {
27857
- ...options,
27858
- __security: { adminAPIKeyAuth: true }
27859
- });
27630
+ // node_modules/openai/internal/headers.mjs
27631
+ var brand_privateNullableHeaders2 = /* @__PURE__ */ Symbol("brand.privateNullableHeaders");
27632
+ function* iterateHeaders2(headers) {
27633
+ if (!headers)
27634
+ return;
27635
+ if (brand_privateNullableHeaders2 in headers) {
27636
+ const { values, nulls } = headers;
27637
+ yield* values.entries();
27638
+ for (const name of nulls) {
27639
+ yield [name, null];
27640
+ }
27641
+ return;
27860
27642
  }
27861
- list(query = {}, options) {
27862
- return this._client.getAPIList("/organization/admin_api_keys", CursorPage, {
27863
- query,
27864
- ...options,
27865
- __security: { adminAPIKeyAuth: true }
27866
- });
27643
+ let shouldClear = false;
27644
+ let iter;
27645
+ if (headers instanceof Headers) {
27646
+ iter = headers.entries();
27647
+ } else if (isReadonlyArray2(headers)) {
27648
+ iter = headers;
27649
+ } else {
27650
+ shouldClear = true;
27651
+ iter = Object.entries(headers ?? {});
27867
27652
  }
27868
- delete(keyID, options) {
27869
- return this._client.delete(path2`/organization/admin_api_keys/${keyID}`, {
27870
- ...options,
27871
- __security: { adminAPIKeyAuth: true }
27872
- });
27653
+ for (let row of iter) {
27654
+ const name = row[0];
27655
+ if (typeof name !== "string")
27656
+ throw new TypeError("expected header name to be a string");
27657
+ const values = isReadonlyArray2(row[1]) ? row[1] : [row[1]];
27658
+ let didClear = false;
27659
+ for (const value of values) {
27660
+ if (value === undefined)
27661
+ continue;
27662
+ if (shouldClear && !didClear) {
27663
+ didClear = true;
27664
+ yield [name, null];
27665
+ }
27666
+ yield [name, value];
27667
+ }
27873
27668
  }
27874
27669
  }
27875
-
27876
- // node_modules/openai/resources/admin/organization/audit-logs.mjs
27877
- class AuditLogs extends APIResource2 {
27878
- list(query = {}, options) {
27879
- return this._client.getAPIList("/organization/audit_logs", ConversationCursorPage, {
27880
- query,
27881
- ...options,
27882
- __security: { adminAPIKeyAuth: true }
27883
- });
27670
+ var buildHeaders2 = (newHeaders) => {
27671
+ const targetHeaders = new Headers;
27672
+ const nullHeaders = new Set;
27673
+ for (const headers of newHeaders) {
27674
+ const seenHeaders = new Set;
27675
+ for (const [name, value] of iterateHeaders2(headers)) {
27676
+ const lowerName = name.toLowerCase();
27677
+ if (!seenHeaders.has(lowerName)) {
27678
+ targetHeaders.delete(name);
27679
+ seenHeaders.add(lowerName);
27680
+ }
27681
+ if (value === null) {
27682
+ targetHeaders.delete(name);
27683
+ nullHeaders.add(lowerName);
27684
+ } else {
27685
+ targetHeaders.append(name, value);
27686
+ nullHeaders.delete(lowerName);
27687
+ }
27688
+ }
27884
27689
  }
27885
- }
27690
+ return { [brand_privateNullableHeaders2]: true, values: targetHeaders, nulls: nullHeaders };
27691
+ };
27886
27692
 
27887
- // node_modules/openai/resources/admin/organization/certificates.mjs
27888
- class Certificates extends APIResource2 {
27693
+ // node_modules/openai/resources/audio/speech.mjs
27694
+ class Speech extends APIResource2 {
27889
27695
  create(body, options) {
27890
- return this._client.post("/organization/certificates", {
27891
- body,
27892
- ...options,
27893
- __security: { adminAPIKeyAuth: true }
27894
- });
27895
- }
27896
- retrieve(certificateID, query = {}, options) {
27897
- return this._client.get(path2`/organization/certificates/${certificateID}`, {
27898
- query,
27899
- ...options,
27900
- __security: { adminAPIKeyAuth: true }
27901
- });
27902
- }
27903
- update(certificateID, body, options) {
27904
- return this._client.post(path2`/organization/certificates/${certificateID}`, {
27696
+ return this._client.post("/audio/speech", {
27905
27697
  body,
27906
27698
  ...options,
27907
- __security: { adminAPIKeyAuth: true }
27908
- });
27909
- }
27910
- list(query = {}, options) {
27911
- return this._client.getAPIList("/organization/certificates", ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27912
- }
27913
- delete(certificateID, options) {
27914
- return this._client.delete(path2`/organization/certificates/${certificateID}`, {
27915
- ...options,
27916
- __security: { adminAPIKeyAuth: true }
27699
+ headers: buildHeaders2([{ Accept: "application/octet-stream" }, options?.headers]),
27700
+ __binaryResponse: true
27917
27701
  });
27918
27702
  }
27919
- activate(body, options) {
27920
- return this._client.getAPIList("/organization/certificates/activate", Page2, {
27703
+ }
27704
+
27705
+ // node_modules/openai/resources/audio/transcriptions.mjs
27706
+ class Transcriptions extends APIResource2 {
27707
+ create(body, options) {
27708
+ return this._client.post("/audio/transcriptions", multipartFormRequestOptions2({
27921
27709
  body,
27922
- method: "post",
27923
27710
  ...options,
27924
- __security: { adminAPIKeyAuth: true }
27925
- });
27711
+ stream: body.stream ?? false,
27712
+ __metadata: { model: body.model }
27713
+ }, this._client));
27926
27714
  }
27927
- deactivate(body, options) {
27928
- return this._client.getAPIList("/organization/certificates/deactivate", Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
27929
- }
27930
- }
27931
-
27932
- // node_modules/openai/resources/admin/organization/data-retention.mjs
27933
- class DataRetention extends APIResource2 {
27934
- retrieve(options) {
27935
- return this._client.get("/organization/data_retention", {
27936
- ...options,
27937
- __security: { adminAPIKeyAuth: true }
27938
- });
27939
- }
27940
- update(body, options) {
27941
- return this._client.post("/organization/data_retention", {
27942
- body,
27943
- ...options,
27944
- __security: { adminAPIKeyAuth: true }
27945
- });
27946
- }
27947
- }
27948
-
27949
- // node_modules/openai/resources/admin/organization/invites.mjs
27950
- class Invites extends APIResource2 {
27951
- create(body, options) {
27952
- return this._client.post("/organization/invites", {
27953
- body,
27954
- ...options,
27955
- __security: { adminAPIKeyAuth: true }
27956
- });
27957
- }
27958
- retrieve(inviteID, options) {
27959
- return this._client.get(path2`/organization/invites/${inviteID}`, {
27960
- ...options,
27961
- __security: { adminAPIKeyAuth: true }
27962
- });
27963
- }
27964
- list(query = {}, options) {
27965
- return this._client.getAPIList("/organization/invites", ConversationCursorPage, {
27966
- query,
27967
- ...options,
27968
- __security: { adminAPIKeyAuth: true }
27969
- });
27970
- }
27971
- delete(inviteID, options) {
27972
- return this._client.delete(path2`/organization/invites/${inviteID}`, {
27973
- ...options,
27974
- __security: { adminAPIKeyAuth: true }
27975
- });
27976
- }
27977
- }
27978
-
27979
- // node_modules/openai/resources/admin/organization/roles.mjs
27980
- class Roles extends APIResource2 {
27981
- create(body, options) {
27982
- return this._client.post("/organization/roles", {
27983
- body,
27984
- ...options,
27985
- __security: { adminAPIKeyAuth: true }
27986
- });
27987
- }
27988
- retrieve(roleID, options) {
27989
- return this._client.get(path2`/organization/roles/${roleID}`, {
27990
- ...options,
27991
- __security: { adminAPIKeyAuth: true }
27992
- });
27993
- }
27994
- update(roleID, body, options) {
27995
- return this._client.post(path2`/organization/roles/${roleID}`, {
27996
- body,
27997
- ...options,
27998
- __security: { adminAPIKeyAuth: true }
27999
- });
28000
- }
28001
- list(query = {}, options) {
28002
- return this._client.getAPIList("/organization/roles", NextCursorPage, {
28003
- query,
28004
- ...options,
28005
- __security: { adminAPIKeyAuth: true }
28006
- });
28007
- }
28008
- delete(roleID, options) {
28009
- return this._client.delete(path2`/organization/roles/${roleID}`, {
28010
- ...options,
28011
- __security: { adminAPIKeyAuth: true }
28012
- });
28013
- }
28014
- }
28015
-
28016
- // node_modules/openai/resources/admin/organization/spend-alerts.mjs
28017
- class SpendAlerts extends APIResource2 {
28018
- create(body, options) {
28019
- return this._client.post("/organization/spend_alerts", {
28020
- body,
28021
- ...options,
28022
- __security: { adminAPIKeyAuth: true }
28023
- });
28024
- }
28025
- update(alertID, body, options) {
28026
- return this._client.post(path2`/organization/spend_alerts/${alertID}`, {
28027
- body,
28028
- ...options,
28029
- __security: { adminAPIKeyAuth: true }
28030
- });
28031
- }
28032
- list(query = {}, options) {
28033
- return this._client.getAPIList("/organization/spend_alerts", ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28034
- }
28035
- delete(alertID, options) {
28036
- return this._client.delete(path2`/organization/spend_alerts/${alertID}`, {
28037
- ...options,
28038
- __security: { adminAPIKeyAuth: true }
28039
- });
28040
- }
28041
- }
28042
-
28043
- // node_modules/openai/resources/admin/organization/usage.mjs
28044
- class Usage extends APIResource2 {
28045
- audioSpeeches(query, options) {
28046
- return this._client.get("/organization/usage/audio_speeches", {
28047
- query,
28048
- ...options,
28049
- __security: { adminAPIKeyAuth: true }
28050
- });
28051
- }
28052
- audioTranscriptions(query, options) {
28053
- return this._client.get("/organization/usage/audio_transcriptions", {
28054
- query,
28055
- ...options,
28056
- __security: { adminAPIKeyAuth: true }
28057
- });
28058
- }
28059
- codeInterpreterSessions(query, options) {
28060
- return this._client.get("/organization/usage/code_interpreter_sessions", {
28061
- query,
28062
- ...options,
28063
- __security: { adminAPIKeyAuth: true }
28064
- });
28065
- }
28066
- completions(query, options) {
28067
- return this._client.get("/organization/usage/completions", {
28068
- query,
28069
- ...options,
28070
- __security: { adminAPIKeyAuth: true }
28071
- });
28072
- }
28073
- costs(query, options) {
28074
- return this._client.get("/organization/costs", {
28075
- query,
28076
- ...options,
28077
- __security: { adminAPIKeyAuth: true }
28078
- });
28079
- }
28080
- embeddings(query, options) {
28081
- return this._client.get("/organization/usage/embeddings", {
28082
- query,
28083
- ...options,
28084
- __security: { adminAPIKeyAuth: true }
28085
- });
28086
- }
28087
- fileSearchCalls(query, options) {
28088
- return this._client.get("/organization/usage/file_search_calls", {
28089
- query,
28090
- ...options,
28091
- __security: { adminAPIKeyAuth: true }
28092
- });
28093
- }
28094
- images(query, options) {
28095
- return this._client.get("/organization/usage/images", {
28096
- query,
28097
- ...options,
28098
- __security: { adminAPIKeyAuth: true }
28099
- });
28100
- }
28101
- moderations(query, options) {
28102
- return this._client.get("/organization/usage/moderations", {
28103
- query,
28104
- ...options,
28105
- __security: { adminAPIKeyAuth: true }
28106
- });
28107
- }
28108
- vectorStores(query, options) {
28109
- return this._client.get("/organization/usage/vector_stores", {
28110
- query,
28111
- ...options,
28112
- __security: { adminAPIKeyAuth: true }
28113
- });
28114
- }
28115
- webSearchCalls(query, options) {
28116
- return this._client.get("/organization/usage/web_search_calls", {
28117
- query,
28118
- ...options,
28119
- __security: { adminAPIKeyAuth: true }
28120
- });
28121
- }
28122
- }
28123
-
28124
- // node_modules/openai/resources/admin/organization/groups/roles.mjs
28125
- class Roles2 extends APIResource2 {
28126
- create(groupID, body, options) {
28127
- return this._client.post(path2`/organization/groups/${groupID}/roles`, {
28128
- body,
28129
- ...options,
28130
- __security: { adminAPIKeyAuth: true }
28131
- });
28132
- }
28133
- retrieve(roleID, params, options) {
28134
- const { group_id } = params;
28135
- return this._client.get(path2`/organization/groups/${group_id}/roles/${roleID}`, {
28136
- ...options,
28137
- __security: { adminAPIKeyAuth: true }
28138
- });
28139
- }
28140
- list(groupID, query = {}, options) {
28141
- return this._client.getAPIList(path2`/organization/groups/${groupID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28142
- }
28143
- delete(roleID, params, options) {
28144
- const { group_id } = params;
28145
- return this._client.delete(path2`/organization/groups/${group_id}/roles/${roleID}`, {
28146
- ...options,
28147
- __security: { adminAPIKeyAuth: true }
28148
- });
28149
- }
28150
- }
28151
-
28152
- // node_modules/openai/resources/admin/organization/groups/users.mjs
28153
- class Users extends APIResource2 {
28154
- create(groupID, body, options) {
28155
- return this._client.post(path2`/organization/groups/${groupID}/users`, {
28156
- body,
28157
- ...options,
28158
- __security: { adminAPIKeyAuth: true }
28159
- });
28160
- }
28161
- retrieve(userID, params, options) {
28162
- const { group_id } = params;
28163
- return this._client.get(path2`/organization/groups/${group_id}/users/${userID}`, {
28164
- ...options,
28165
- __security: { adminAPIKeyAuth: true }
28166
- });
28167
- }
28168
- list(groupID, query = {}, options) {
28169
- return this._client.getAPIList(path2`/organization/groups/${groupID}/users`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28170
- }
28171
- delete(userID, params, options) {
28172
- const { group_id } = params;
28173
- return this._client.delete(path2`/organization/groups/${group_id}/users/${userID}`, {
28174
- ...options,
28175
- __security: { adminAPIKeyAuth: true }
28176
- });
28177
- }
28178
- }
28179
-
28180
- // node_modules/openai/resources/admin/organization/groups/groups.mjs
28181
- class Groups extends APIResource2 {
28182
- constructor() {
28183
- super(...arguments);
28184
- this.users = new Users(this._client);
28185
- this.roles = new Roles2(this._client);
28186
- }
28187
- create(body, options) {
28188
- return this._client.post("/organization/groups", {
28189
- body,
28190
- ...options,
28191
- __security: { adminAPIKeyAuth: true }
28192
- });
28193
- }
28194
- retrieve(groupID, options) {
28195
- return this._client.get(path2`/organization/groups/${groupID}`, {
28196
- ...options,
28197
- __security: { adminAPIKeyAuth: true }
28198
- });
28199
- }
28200
- update(groupID, body, options) {
28201
- return this._client.post(path2`/organization/groups/${groupID}`, {
28202
- body,
28203
- ...options,
28204
- __security: { adminAPIKeyAuth: true }
28205
- });
28206
- }
28207
- list(query = {}, options) {
28208
- return this._client.getAPIList("/organization/groups", NextCursorPage, {
28209
- query,
28210
- ...options,
28211
- __security: { adminAPIKeyAuth: true }
28212
- });
28213
- }
28214
- delete(groupID, options) {
28215
- return this._client.delete(path2`/organization/groups/${groupID}`, {
28216
- ...options,
28217
- __security: { adminAPIKeyAuth: true }
28218
- });
28219
- }
28220
- }
28221
- Groups.Users = Users;
28222
- Groups.Roles = Roles2;
28223
-
28224
- // node_modules/openai/resources/admin/organization/projects/api-keys.mjs
28225
- class APIKeys extends APIResource2 {
28226
- retrieve(apiKeyID, params, options) {
28227
- const { project_id } = params;
28228
- return this._client.get(path2`/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
28229
- ...options,
28230
- __security: { adminAPIKeyAuth: true }
28231
- });
28232
- }
28233
- list(projectID, query = {}, options) {
28234
- return this._client.getAPIList(path2`/organization/projects/${projectID}/api_keys`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28235
- }
28236
- delete(apiKeyID, params, options) {
28237
- const { project_id } = params;
28238
- return this._client.delete(path2`/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
28239
- ...options,
28240
- __security: { adminAPIKeyAuth: true }
28241
- });
28242
- }
28243
- }
28244
-
28245
- // node_modules/openai/resources/admin/organization/projects/certificates.mjs
28246
- class Certificates2 extends APIResource2 {
28247
- list(projectID, query = {}, options) {
28248
- return this._client.getAPIList(path2`/organization/projects/${projectID}/certificates`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28249
- }
28250
- activate(projectID, body, options) {
28251
- return this._client.getAPIList(path2`/organization/projects/${projectID}/certificates/activate`, Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
28252
- }
28253
- deactivate(projectID, body, options) {
28254
- return this._client.getAPIList(path2`/organization/projects/${projectID}/certificates/deactivate`, Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
28255
- }
28256
- }
28257
-
28258
- // node_modules/openai/resources/admin/organization/projects/data-retention.mjs
28259
- class DataRetention2 extends APIResource2 {
28260
- retrieve(projectID, options) {
28261
- return this._client.get(path2`/organization/projects/${projectID}/data_retention`, {
28262
- ...options,
28263
- __security: { adminAPIKeyAuth: true }
28264
- });
28265
- }
28266
- update(projectID, body, options) {
28267
- return this._client.post(path2`/organization/projects/${projectID}/data_retention`, {
28268
- body,
28269
- ...options,
28270
- __security: { adminAPIKeyAuth: true }
28271
- });
28272
- }
28273
- }
28274
-
28275
- // node_modules/openai/resources/admin/organization/projects/hosted-tool-permissions.mjs
28276
- class HostedToolPermissions extends APIResource2 {
28277
- retrieve(projectID, options) {
28278
- return this._client.get(path2`/organization/projects/${projectID}/hosted_tool_permissions`, {
28279
- ...options,
28280
- __security: { adminAPIKeyAuth: true }
28281
- });
28282
- }
28283
- update(projectID, body, options) {
28284
- return this._client.post(path2`/organization/projects/${projectID}/hosted_tool_permissions`, {
28285
- body,
28286
- ...options,
28287
- __security: { adminAPIKeyAuth: true }
28288
- });
28289
- }
28290
- }
28291
-
28292
- // node_modules/openai/resources/admin/organization/projects/model-permissions.mjs
28293
- class ModelPermissions extends APIResource2 {
28294
- retrieve(projectID, options) {
28295
- return this._client.get(path2`/organization/projects/${projectID}/model_permissions`, {
28296
- ...options,
28297
- __security: { adminAPIKeyAuth: true }
28298
- });
28299
- }
28300
- update(projectID, body, options) {
28301
- return this._client.post(path2`/organization/projects/${projectID}/model_permissions`, {
28302
- body,
28303
- ...options,
28304
- __security: { adminAPIKeyAuth: true }
28305
- });
28306
- }
28307
- delete(projectID, options) {
28308
- return this._client.delete(path2`/organization/projects/${projectID}/model_permissions`, {
28309
- ...options,
28310
- __security: { adminAPIKeyAuth: true }
28311
- });
28312
- }
28313
- }
28314
-
28315
- // node_modules/openai/resources/admin/organization/projects/rate-limits.mjs
28316
- class RateLimits extends APIResource2 {
28317
- listRateLimits(projectID, query = {}, options) {
28318
- return this._client.getAPIList(path2`/organization/projects/${projectID}/rate_limits`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28319
- }
28320
- updateRateLimit(rateLimitID, params, options) {
28321
- const { project_id, ...body } = params;
28322
- return this._client.post(path2`/organization/projects/${project_id}/rate_limits/${rateLimitID}`, {
28323
- body,
28324
- ...options,
28325
- __security: { adminAPIKeyAuth: true }
28326
- });
28327
- }
28328
- }
28329
-
28330
- // node_modules/openai/resources/admin/organization/projects/roles.mjs
28331
- class Roles3 extends APIResource2 {
28332
- create(projectID, body, options) {
28333
- return this._client.post(path2`/projects/${projectID}/roles`, {
28334
- body,
28335
- ...options,
28336
- __security: { adminAPIKeyAuth: true }
28337
- });
28338
- }
28339
- retrieve(roleID, params, options) {
28340
- const { project_id } = params;
28341
- return this._client.get(path2`/projects/${project_id}/roles/${roleID}`, {
28342
- ...options,
28343
- __security: { adminAPIKeyAuth: true }
28344
- });
28345
- }
28346
- update(roleID, params, options) {
28347
- const { project_id, ...body } = params;
28348
- return this._client.post(path2`/projects/${project_id}/roles/${roleID}`, {
28349
- body,
28350
- ...options,
28351
- __security: { adminAPIKeyAuth: true }
28352
- });
28353
- }
28354
- list(projectID, query = {}, options) {
28355
- return this._client.getAPIList(path2`/projects/${projectID}/roles`, NextCursorPage, {
28356
- query,
28357
- ...options,
28358
- __security: { adminAPIKeyAuth: true }
28359
- });
28360
- }
28361
- delete(roleID, params, options) {
28362
- const { project_id } = params;
28363
- return this._client.delete(path2`/projects/${project_id}/roles/${roleID}`, {
28364
- ...options,
28365
- __security: { adminAPIKeyAuth: true }
28366
- });
28367
- }
28368
- }
28369
-
28370
- // node_modules/openai/resources/admin/organization/projects/service-accounts.mjs
28371
- class ServiceAccounts extends APIResource2 {
28372
- create(projectID, body, options) {
28373
- return this._client.post(path2`/organization/projects/${projectID}/service_accounts`, {
28374
- body,
28375
- ...options,
28376
- __security: { adminAPIKeyAuth: true }
28377
- });
28378
- }
28379
- retrieve(serviceAccountID, params, options) {
28380
- const { project_id } = params;
28381
- return this._client.get(path2`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
28382
- ...options,
28383
- __security: { adminAPIKeyAuth: true }
28384
- });
28385
- }
28386
- update(serviceAccountID, params, options) {
28387
- const { project_id, ...body } = params;
28388
- return this._client.post(path2`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { body, ...options, __security: { adminAPIKeyAuth: true } });
28389
- }
28390
- list(projectID, query = {}, options) {
28391
- return this._client.getAPIList(path2`/organization/projects/${projectID}/service_accounts`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28392
- }
28393
- delete(serviceAccountID, params, options) {
28394
- const { project_id } = params;
28395
- return this._client.delete(path2`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { ...options, __security: { adminAPIKeyAuth: true } });
28396
- }
28397
- }
28398
-
28399
- // node_modules/openai/resources/admin/organization/projects/spend-alerts.mjs
28400
- class SpendAlerts2 extends APIResource2 {
28401
- create(projectID, body, options) {
28402
- return this._client.post(path2`/organization/projects/${projectID}/spend_alerts`, {
28403
- body,
28404
- ...options,
28405
- __security: { adminAPIKeyAuth: true }
28406
- });
28407
- }
28408
- update(alertID, params, options) {
28409
- const { project_id, ...body } = params;
28410
- return this._client.post(path2`/organization/projects/${project_id}/spend_alerts/${alertID}`, {
28411
- body,
28412
- ...options,
28413
- __security: { adminAPIKeyAuth: true }
28414
- });
28415
- }
28416
- list(projectID, query = {}, options) {
28417
- return this._client.getAPIList(path2`/organization/projects/${projectID}/spend_alerts`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28418
- }
28419
- delete(alertID, params, options) {
28420
- const { project_id } = params;
28421
- return this._client.delete(path2`/organization/projects/${project_id}/spend_alerts/${alertID}`, {
28422
- ...options,
28423
- __security: { adminAPIKeyAuth: true }
28424
- });
28425
- }
28426
- }
28427
-
28428
- // node_modules/openai/resources/admin/organization/projects/groups/roles.mjs
28429
- class Roles4 extends APIResource2 {
28430
- create(groupID, params, options) {
28431
- const { project_id, ...body } = params;
28432
- return this._client.post(path2`/projects/${project_id}/groups/${groupID}/roles`, {
28433
- body,
28434
- ...options,
28435
- __security: { adminAPIKeyAuth: true }
28436
- });
28437
- }
28438
- retrieve(roleID, params, options) {
28439
- const { project_id, group_id } = params;
28440
- return this._client.get(path2`/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
28441
- ...options,
28442
- __security: { adminAPIKeyAuth: true }
28443
- });
28444
- }
28445
- list(groupID, params, options) {
28446
- const { project_id, ...query } = params;
28447
- return this._client.getAPIList(path2`/projects/${project_id}/groups/${groupID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28448
- }
28449
- delete(roleID, params, options) {
28450
- const { project_id, group_id } = params;
28451
- return this._client.delete(path2`/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
28452
- ...options,
28453
- __security: { adminAPIKeyAuth: true }
28454
- });
28455
- }
28456
- }
28457
-
28458
- // node_modules/openai/resources/admin/organization/projects/groups/groups.mjs
28459
- class Groups2 extends APIResource2 {
28460
- constructor() {
28461
- super(...arguments);
28462
- this.roles = new Roles4(this._client);
28463
- }
28464
- create(projectID, body, options) {
28465
- return this._client.post(path2`/organization/projects/${projectID}/groups`, {
28466
- body,
28467
- ...options,
28468
- __security: { adminAPIKeyAuth: true }
28469
- });
28470
- }
28471
- retrieve(groupID, params, options) {
28472
- const { project_id, ...query } = params;
28473
- return this._client.get(path2`/organization/projects/${project_id}/groups/${groupID}`, {
28474
- query,
28475
- ...options,
28476
- __security: { adminAPIKeyAuth: true }
28477
- });
28478
- }
28479
- list(projectID, query = {}, options) {
28480
- return this._client.getAPIList(path2`/organization/projects/${projectID}/groups`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28481
- }
28482
- delete(groupID, params, options) {
28483
- const { project_id } = params;
28484
- return this._client.delete(path2`/organization/projects/${project_id}/groups/${groupID}`, {
28485
- ...options,
28486
- __security: { adminAPIKeyAuth: true }
28487
- });
28488
- }
28489
- }
28490
- Groups2.Roles = Roles4;
28491
-
28492
- // node_modules/openai/resources/admin/organization/projects/users/roles.mjs
28493
- class Roles5 extends APIResource2 {
28494
- create(userID, params, options) {
28495
- const { project_id, ...body } = params;
28496
- return this._client.post(path2`/projects/${project_id}/users/${userID}/roles`, {
28497
- body,
28498
- ...options,
28499
- __security: { adminAPIKeyAuth: true }
28500
- });
28501
- }
28502
- retrieve(roleID, params, options) {
28503
- const { project_id, user_id } = params;
28504
- return this._client.get(path2`/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
28505
- ...options,
28506
- __security: { adminAPIKeyAuth: true }
28507
- });
28508
- }
28509
- list(userID, params, options) {
28510
- const { project_id, ...query } = params;
28511
- return this._client.getAPIList(path2`/projects/${project_id}/users/${userID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28512
- }
28513
- delete(roleID, params, options) {
28514
- const { project_id, user_id } = params;
28515
- return this._client.delete(path2`/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
28516
- ...options,
28517
- __security: { adminAPIKeyAuth: true }
28518
- });
28519
- }
28520
- }
28521
-
28522
- // node_modules/openai/resources/admin/organization/projects/users/users.mjs
28523
- class Users2 extends APIResource2 {
28524
- constructor() {
28525
- super(...arguments);
28526
- this.roles = new Roles5(this._client);
28527
- }
28528
- create(projectID, body, options) {
28529
- return this._client.post(path2`/organization/projects/${projectID}/users`, {
28530
- body,
28531
- ...options,
28532
- __security: { adminAPIKeyAuth: true }
28533
- });
28534
- }
28535
- retrieve(userID, params, options) {
28536
- const { project_id } = params;
28537
- return this._client.get(path2`/organization/projects/${project_id}/users/${userID}`, {
28538
- ...options,
28539
- __security: { adminAPIKeyAuth: true }
28540
- });
28541
- }
28542
- update(userID, params, options) {
28543
- const { project_id, ...body } = params;
28544
- return this._client.post(path2`/organization/projects/${project_id}/users/${userID}`, {
28545
- body,
28546
- ...options,
28547
- __security: { adminAPIKeyAuth: true }
28548
- });
28549
- }
28550
- list(projectID, query = {}, options) {
28551
- return this._client.getAPIList(path2`/organization/projects/${projectID}/users`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28552
- }
28553
- delete(userID, params, options) {
28554
- const { project_id } = params;
28555
- return this._client.delete(path2`/organization/projects/${project_id}/users/${userID}`, {
28556
- ...options,
28557
- __security: { adminAPIKeyAuth: true }
28558
- });
28559
- }
28560
- }
28561
- Users2.Roles = Roles5;
28562
-
28563
- // node_modules/openai/resources/admin/organization/projects/projects.mjs
28564
- class Projects extends APIResource2 {
28565
- constructor() {
28566
- super(...arguments);
28567
- this.users = new Users2(this._client);
28568
- this.serviceAccounts = new ServiceAccounts(this._client);
28569
- this.apiKeys = new APIKeys(this._client);
28570
- this.rateLimits = new RateLimits(this._client);
28571
- this.modelPermissions = new ModelPermissions(this._client);
28572
- this.hostedToolPermissions = new HostedToolPermissions(this._client);
28573
- this.groups = new Groups2(this._client);
28574
- this.roles = new Roles3(this._client);
28575
- this.dataRetention = new DataRetention2(this._client);
28576
- this.spendAlerts = new SpendAlerts2(this._client);
28577
- this.certificates = new Certificates2(this._client);
28578
- }
28579
- create(body, options) {
28580
- return this._client.post("/organization/projects", {
28581
- body,
28582
- ...options,
28583
- __security: { adminAPIKeyAuth: true }
28584
- });
28585
- }
28586
- retrieve(projectID, options) {
28587
- return this._client.get(path2`/organization/projects/${projectID}`, {
28588
- ...options,
28589
- __security: { adminAPIKeyAuth: true }
28590
- });
28591
- }
28592
- update(projectID, body, options) {
28593
- return this._client.post(path2`/organization/projects/${projectID}`, {
28594
- body,
28595
- ...options,
28596
- __security: { adminAPIKeyAuth: true }
28597
- });
28598
- }
28599
- list(query = {}, options) {
28600
- return this._client.getAPIList("/organization/projects", ConversationCursorPage, {
28601
- query,
28602
- ...options,
28603
- __security: { adminAPIKeyAuth: true }
28604
- });
28605
- }
28606
- archive(projectID, options) {
28607
- return this._client.post(path2`/organization/projects/${projectID}/archive`, {
28608
- ...options,
28609
- __security: { adminAPIKeyAuth: true }
28610
- });
28611
- }
28612
- }
28613
- Projects.Users = Users2;
28614
- Projects.ServiceAccounts = ServiceAccounts;
28615
- Projects.APIKeys = APIKeys;
28616
- Projects.RateLimits = RateLimits;
28617
- Projects.ModelPermissions = ModelPermissions;
28618
- Projects.HostedToolPermissions = HostedToolPermissions;
28619
- Projects.Groups = Groups2;
28620
- Projects.Roles = Roles3;
28621
- Projects.DataRetention = DataRetention2;
28622
- Projects.SpendAlerts = SpendAlerts2;
28623
- Projects.Certificates = Certificates2;
28624
-
28625
- // node_modules/openai/resources/admin/organization/users/roles.mjs
28626
- class Roles6 extends APIResource2 {
28627
- create(userID, body, options) {
28628
- return this._client.post(path2`/organization/users/${userID}/roles`, {
28629
- body,
28630
- ...options,
28631
- __security: { adminAPIKeyAuth: true }
28632
- });
28633
- }
28634
- retrieve(roleID, params, options) {
28635
- const { user_id } = params;
28636
- return this._client.get(path2`/organization/users/${user_id}/roles/${roleID}`, {
28637
- ...options,
28638
- __security: { adminAPIKeyAuth: true }
28639
- });
28640
- }
28641
- list(userID, query = {}, options) {
28642
- return this._client.getAPIList(path2`/organization/users/${userID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28643
- }
28644
- delete(roleID, params, options) {
28645
- const { user_id } = params;
28646
- return this._client.delete(path2`/organization/users/${user_id}/roles/${roleID}`, {
28647
- ...options,
28648
- __security: { adminAPIKeyAuth: true }
28649
- });
28650
- }
28651
- }
28652
-
28653
- // node_modules/openai/resources/admin/organization/users/users.mjs
28654
- class Users3 extends APIResource2 {
28655
- constructor() {
28656
- super(...arguments);
28657
- this.roles = new Roles6(this._client);
28658
- }
28659
- retrieve(userID, options) {
28660
- return this._client.get(path2`/organization/users/${userID}`, {
28661
- ...options,
28662
- __security: { adminAPIKeyAuth: true }
28663
- });
28664
- }
28665
- update(userID, body, options) {
28666
- return this._client.post(path2`/organization/users/${userID}`, {
28667
- body,
28668
- ...options,
28669
- __security: { adminAPIKeyAuth: true }
28670
- });
28671
- }
28672
- list(query = {}, options) {
28673
- return this._client.getAPIList("/organization/users", ConversationCursorPage, {
28674
- query,
28675
- ...options,
28676
- __security: { adminAPIKeyAuth: true }
28677
- });
28678
- }
28679
- delete(userID, options) {
28680
- return this._client.delete(path2`/organization/users/${userID}`, {
28681
- ...options,
28682
- __security: { adminAPIKeyAuth: true }
28683
- });
28684
- }
28685
- }
28686
- Users3.Roles = Roles6;
28687
-
28688
- // node_modules/openai/resources/admin/organization/organization.mjs
28689
- class Organization extends APIResource2 {
28690
- constructor() {
28691
- super(...arguments);
28692
- this.auditLogs = new AuditLogs(this._client);
28693
- this.adminAPIKeys = new AdminAPIKeys(this._client);
28694
- this.usage = new Usage(this._client);
28695
- this.invites = new Invites(this._client);
28696
- this.users = new Users3(this._client);
28697
- this.groups = new Groups(this._client);
28698
- this.roles = new Roles(this._client);
28699
- this.dataRetention = new DataRetention(this._client);
28700
- this.spendAlerts = new SpendAlerts(this._client);
28701
- this.certificates = new Certificates(this._client);
28702
- this.projects = new Projects(this._client);
28703
- }
28704
- }
28705
- Organization.AuditLogs = AuditLogs;
28706
- Organization.AdminAPIKeys = AdminAPIKeys;
28707
- Organization.Usage = Usage;
28708
- Organization.Invites = Invites;
28709
- Organization.Users = Users3;
28710
- Organization.Groups = Groups;
28711
- Organization.Roles = Roles;
28712
- Organization.DataRetention = DataRetention;
28713
- Organization.SpendAlerts = SpendAlerts;
28714
- Organization.Certificates = Certificates;
28715
- Organization.Projects = Projects;
28716
-
28717
- // node_modules/openai/resources/admin/admin.mjs
28718
- class Admin extends APIResource2 {
28719
- constructor() {
28720
- super(...arguments);
28721
- this.organization = new Organization(this._client);
28722
- }
28723
- }
28724
- Admin.Organization = Organization;
28725
- // node_modules/openai/internal/headers.mjs
28726
- var brand_privateNullableHeaders2 = /* @__PURE__ */ Symbol("brand.privateNullableHeaders");
28727
- function* iterateHeaders2(headers) {
28728
- if (!headers)
28729
- return;
28730
- if (brand_privateNullableHeaders2 in headers) {
28731
- const { values, nulls } = headers;
28732
- yield* values.entries();
28733
- for (const name of nulls) {
28734
- yield [name, null];
28735
- }
28736
- return;
28737
- }
28738
- let shouldClear = false;
28739
- let iter;
28740
- if (headers instanceof Headers) {
28741
- iter = headers.entries();
28742
- } else if (isReadonlyArray2(headers)) {
28743
- iter = headers;
28744
- } else {
28745
- shouldClear = true;
28746
- iter = Object.entries(headers ?? {});
28747
- }
28748
- for (let row of iter) {
28749
- const name = row[0];
28750
- if (typeof name !== "string")
28751
- throw new TypeError("expected header name to be a string");
28752
- const values = isReadonlyArray2(row[1]) ? row[1] : [row[1]];
28753
- let didClear = false;
28754
- for (const value of values) {
28755
- if (value === undefined)
28756
- continue;
28757
- if (shouldClear && !didClear) {
28758
- didClear = true;
28759
- yield [name, null];
28760
- }
28761
- yield [name, value];
28762
- }
28763
- }
28764
- }
28765
- var buildHeaders2 = (newHeaders) => {
28766
- const targetHeaders = new Headers;
28767
- const nullHeaders = new Set;
28768
- for (const headers of newHeaders) {
28769
- const seenHeaders = new Set;
28770
- for (const [name, value] of iterateHeaders2(headers)) {
28771
- const lowerName = name.toLowerCase();
28772
- if (!seenHeaders.has(lowerName)) {
28773
- targetHeaders.delete(name);
28774
- seenHeaders.add(lowerName);
28775
- }
28776
- if (value === null) {
28777
- targetHeaders.delete(name);
28778
- nullHeaders.add(lowerName);
28779
- } else {
28780
- targetHeaders.append(name, value);
28781
- nullHeaders.delete(lowerName);
28782
- }
28783
- }
28784
- }
28785
- return { [brand_privateNullableHeaders2]: true, values: targetHeaders, nulls: nullHeaders };
28786
- };
28787
-
28788
- // node_modules/openai/resources/audio/speech.mjs
28789
- class Speech extends APIResource2 {
28790
- create(body, options) {
28791
- return this._client.post("/audio/speech", {
28792
- body,
28793
- ...options,
28794
- headers: buildHeaders2([{ Accept: "application/octet-stream" }, options?.headers]),
28795
- __security: { bearerAuth: true },
28796
- __binaryResponse: true
28797
- });
28798
- }
28799
- }
28800
-
28801
- // node_modules/openai/resources/audio/transcriptions.mjs
28802
- class Transcriptions extends APIResource2 {
28803
- create(body, options) {
28804
- return this._client.post("/audio/transcriptions", multipartFormRequestOptions2({
28805
- body,
28806
- ...options,
28807
- stream: body.stream ?? false,
28808
- __metadata: { model: body.model },
28809
- __security: { bearerAuth: true }
28810
- }, this._client));
28811
- }
28812
- }
28813
-
28814
- // node_modules/openai/resources/audio/translations.mjs
28815
- class Translations extends APIResource2 {
28816
- create(body, options) {
28817
- return this._client.post("/audio/translations", multipartFormRequestOptions2({ body, ...options, __metadata: { model: body.model }, __security: { bearerAuth: true } }, this._client));
27715
+ }
27716
+
27717
+ // node_modules/openai/resources/audio/translations.mjs
27718
+ class Translations extends APIResource2 {
27719
+ create(body, options) {
27720
+ return this._client.post("/audio/translations", multipartFormRequestOptions2({ body, ...options, __metadata: { model: body.model } }, this._client));
28818
27721
  }
28819
27722
  }
28820
27723
 
@@ -28833,23 +27736,16 @@ Audio.Speech = Speech;
28833
27736
  // node_modules/openai/resources/batches.mjs
28834
27737
  class Batches3 extends APIResource2 {
28835
27738
  create(body, options) {
28836
- return this._client.post("/batches", { body, ...options, __security: { bearerAuth: true } });
27739
+ return this._client.post("/batches", { body, ...options });
28837
27740
  }
28838
27741
  retrieve(batchID, options) {
28839
- return this._client.get(path2`/batches/${batchID}`, { ...options, __security: { bearerAuth: true } });
27742
+ return this._client.get(path2`/batches/${batchID}`, options);
28840
27743
  }
28841
27744
  list(query = {}, options) {
28842
- return this._client.getAPIList("/batches", CursorPage, {
28843
- query,
28844
- ...options,
28845
- __security: { bearerAuth: true }
28846
- });
27745
+ return this._client.getAPIList("/batches", CursorPage, { query, ...options });
28847
27746
  }
28848
27747
  cancel(batchID, options) {
28849
- return this._client.post(path2`/batches/${batchID}/cancel`, {
28850
- ...options,
28851
- __security: { bearerAuth: true }
28852
- });
27748
+ return this._client.post(path2`/batches/${batchID}/cancel`, options);
28853
27749
  }
28854
27750
  }
28855
27751
  // node_modules/openai/resources/beta/assistants.mjs
@@ -28858,38 +27754,33 @@ class Assistants extends APIResource2 {
28858
27754
  return this._client.post("/assistants", {
28859
27755
  body,
28860
27756
  ...options,
28861
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28862
- __security: { bearerAuth: true }
27757
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28863
27758
  });
28864
27759
  }
28865
27760
  retrieve(assistantID, options) {
28866
27761
  return this._client.get(path2`/assistants/${assistantID}`, {
28867
27762
  ...options,
28868
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28869
- __security: { bearerAuth: true }
27763
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28870
27764
  });
28871
27765
  }
28872
27766
  update(assistantID, body, options) {
28873
27767
  return this._client.post(path2`/assistants/${assistantID}`, {
28874
27768
  body,
28875
27769
  ...options,
28876
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28877
- __security: { bearerAuth: true }
27770
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28878
27771
  });
28879
27772
  }
28880
27773
  list(query = {}, options) {
28881
27774
  return this._client.getAPIList("/assistants", CursorPage, {
28882
27775
  query,
28883
27776
  ...options,
28884
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28885
- __security: { bearerAuth: true }
27777
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28886
27778
  });
28887
27779
  }
28888
27780
  delete(assistantID, options) {
28889
27781
  return this._client.delete(path2`/assistants/${assistantID}`, {
28890
27782
  ...options,
28891
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28892
- __security: { bearerAuth: true }
27783
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28893
27784
  });
28894
27785
  }
28895
27786
  }
@@ -28900,8 +27791,7 @@ class Sessions extends APIResource2 {
28900
27791
  return this._client.post("/realtime/sessions", {
28901
27792
  body,
28902
27793
  ...options,
28903
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28904
- __security: { bearerAuth: true }
27794
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28905
27795
  });
28906
27796
  }
28907
27797
  }
@@ -28912,8 +27802,7 @@ class TranscriptionSessions extends APIResource2 {
28912
27802
  return this._client.post("/realtime/transcription_sessions", {
28913
27803
  body,
28914
27804
  ...options,
28915
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28916
- __security: { bearerAuth: true }
27805
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28917
27806
  });
28918
27807
  }
28919
27808
  }
@@ -28935,15 +27824,13 @@ class Sessions2 extends APIResource2 {
28935
27824
  return this._client.post("/chatkit/sessions", {
28936
27825
  body,
28937
27826
  ...options,
28938
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28939
- __security: { bearerAuth: true }
27827
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28940
27828
  });
28941
27829
  }
28942
27830
  cancel(sessionID, options) {
28943
27831
  return this._client.post(path2`/chatkit/sessions/${sessionID}/cancel`, {
28944
27832
  ...options,
28945
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28946
- __security: { bearerAuth: true }
27833
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28947
27834
  });
28948
27835
  }
28949
27836
  }
@@ -28953,32 +27840,24 @@ class Threads extends APIResource2 {
28953
27840
  retrieve(threadID, options) {
28954
27841
  return this._client.get(path2`/chatkit/threads/${threadID}`, {
28955
27842
  ...options,
28956
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28957
- __security: { bearerAuth: true }
27843
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28958
27844
  });
28959
27845
  }
28960
27846
  list(query = {}, options) {
28961
27847
  return this._client.getAPIList("/chatkit/threads", ConversationCursorPage, {
28962
27848
  query,
28963
27849
  ...options,
28964
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28965
- __security: { bearerAuth: true }
27850
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28966
27851
  });
28967
27852
  }
28968
27853
  delete(threadID, options) {
28969
27854
  return this._client.delete(path2`/chatkit/threads/${threadID}`, {
28970
27855
  ...options,
28971
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28972
- __security: { bearerAuth: true }
27856
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28973
27857
  });
28974
27858
  }
28975
27859
  listItems(threadID, query = {}, options) {
28976
- return this._client.getAPIList(path2`/chatkit/threads/${threadID}/items`, ConversationCursorPage, {
28977
- query,
28978
- ...options,
28979
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28980
- __security: { bearerAuth: true }
28981
- });
27860
+ return this._client.getAPIList(path2`/chatkit/threads/${threadID}/items`, ConversationCursorPage, { query, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]) });
28982
27861
  }
28983
27862
  }
28984
27863
 
@@ -28999,16 +27878,14 @@ class Messages4 extends APIResource2 {
28999
27878
  return this._client.post(path2`/threads/${threadID}/messages`, {
29000
27879
  body,
29001
27880
  ...options,
29002
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29003
- __security: { bearerAuth: true }
27881
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29004
27882
  });
29005
27883
  }
29006
27884
  retrieve(messageID, params, options) {
29007
27885
  const { thread_id } = params;
29008
27886
  return this._client.get(path2`/threads/${thread_id}/messages/${messageID}`, {
29009
27887
  ...options,
29010
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29011
- __security: { bearerAuth: true }
27888
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29012
27889
  });
29013
27890
  }
29014
27891
  update(messageID, params, options) {
@@ -29016,24 +27893,21 @@ class Messages4 extends APIResource2 {
29016
27893
  return this._client.post(path2`/threads/${thread_id}/messages/${messageID}`, {
29017
27894
  body,
29018
27895
  ...options,
29019
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29020
- __security: { bearerAuth: true }
27896
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29021
27897
  });
29022
27898
  }
29023
27899
  list(threadID, query = {}, options) {
29024
27900
  return this._client.getAPIList(path2`/threads/${threadID}/messages`, CursorPage, {
29025
27901
  query,
29026
27902
  ...options,
29027
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29028
- __security: { bearerAuth: true }
27903
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29029
27904
  });
29030
27905
  }
29031
27906
  delete(messageID, params, options) {
29032
27907
  const { thread_id } = params;
29033
27908
  return this._client.delete(path2`/threads/${thread_id}/messages/${messageID}`, {
29034
27909
  ...options,
29035
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29036
- __security: { bearerAuth: true }
27910
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29037
27911
  });
29038
27912
  }
29039
27913
  }
@@ -29045,8 +27919,7 @@ class Steps extends APIResource2 {
29045
27919
  return this._client.get(path2`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, {
29046
27920
  query,
29047
27921
  ...options,
29048
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29049
- __security: { bearerAuth: true }
27922
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29050
27923
  });
29051
27924
  }
29052
27925
  list(runID, params, options) {
@@ -29054,8 +27927,7 @@ class Steps extends APIResource2 {
29054
27927
  return this._client.getAPIList(path2`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, {
29055
27928
  query,
29056
27929
  ...options,
29057
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29058
- __security: { bearerAuth: true }
27930
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29059
27931
  });
29060
27932
  }
29061
27933
  }
@@ -29077,10 +27949,10 @@ var toFloat32Array = (base64Str) => {
29077
27949
  // node_modules/openai/internal/utils/env.mjs
29078
27950
  var readEnv2 = (env) => {
29079
27951
  if (typeof globalThis.process !== "undefined") {
29080
- return globalThis.process.env?.[env]?.trim() || undefined;
27952
+ return globalThis.process.env?.[env]?.trim() ?? undefined;
29081
27953
  }
29082
27954
  if (typeof globalThis.Deno !== "undefined") {
29083
- return globalThis.Deno.env?.get?.(env)?.trim() || undefined;
27955
+ return globalThis.Deno.env?.get?.(env)?.trim();
29084
27956
  }
29085
27957
  return;
29086
27958
  };
@@ -29637,16 +28509,14 @@ class Runs extends APIResource2 {
29637
28509
  ...options,
29638
28510
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29639
28511
  stream: params.stream ?? false,
29640
- __synthesizeEventData: true,
29641
- __security: { bearerAuth: true }
28512
+ __synthesizeEventData: true
29642
28513
  });
29643
28514
  }
29644
28515
  retrieve(runID, params, options) {
29645
28516
  const { thread_id } = params;
29646
28517
  return this._client.get(path2`/threads/${thread_id}/runs/${runID}`, {
29647
28518
  ...options,
29648
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29649
- __security: { bearerAuth: true }
28519
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29650
28520
  });
29651
28521
  }
29652
28522
  update(runID, params, options) {
@@ -29654,24 +28524,21 @@ class Runs extends APIResource2 {
29654
28524
  return this._client.post(path2`/threads/${thread_id}/runs/${runID}`, {
29655
28525
  body,
29656
28526
  ...options,
29657
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29658
- __security: { bearerAuth: true }
28527
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29659
28528
  });
29660
28529
  }
29661
28530
  list(threadID, query2 = {}, options) {
29662
28531
  return this._client.getAPIList(path2`/threads/${threadID}/runs`, CursorPage, {
29663
28532
  query: query2,
29664
28533
  ...options,
29665
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29666
- __security: { bearerAuth: true }
28534
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29667
28535
  });
29668
28536
  }
29669
28537
  cancel(runID, params, options) {
29670
28538
  const { thread_id } = params;
29671
28539
  return this._client.post(path2`/threads/${thread_id}/runs/${runID}/cancel`, {
29672
28540
  ...options,
29673
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29674
- __security: { bearerAuth: true }
28541
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29675
28542
  });
29676
28543
  }
29677
28544
  async createAndPoll(threadId, body, options) {
@@ -29732,8 +28599,7 @@ class Runs extends APIResource2 {
29732
28599
  ...options,
29733
28600
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29734
28601
  stream: params.stream ?? false,
29735
- __synthesizeEventData: true,
29736
- __security: { bearerAuth: true }
28602
+ __synthesizeEventData: true
29737
28603
  });
29738
28604
  }
29739
28605
  async submitToolOutputsAndPoll(runId, params, options) {
@@ -29757,30 +28623,26 @@ class Threads2 extends APIResource2 {
29757
28623
  return this._client.post("/threads", {
29758
28624
  body,
29759
28625
  ...options,
29760
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29761
- __security: { bearerAuth: true }
28626
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29762
28627
  });
29763
28628
  }
29764
28629
  retrieve(threadID, options) {
29765
28630
  return this._client.get(path2`/threads/${threadID}`, {
29766
28631
  ...options,
29767
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29768
- __security: { bearerAuth: true }
28632
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29769
28633
  });
29770
28634
  }
29771
28635
  update(threadID, body, options) {
29772
28636
  return this._client.post(path2`/threads/${threadID}`, {
29773
28637
  body,
29774
28638
  ...options,
29775
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29776
- __security: { bearerAuth: true }
28639
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29777
28640
  });
29778
28641
  }
29779
28642
  delete(threadID, options) {
29780
28643
  return this._client.delete(path2`/threads/${threadID}`, {
29781
28644
  ...options,
29782
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29783
- __security: { bearerAuth: true }
28645
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29784
28646
  });
29785
28647
  }
29786
28648
  createAndRun(body, options) {
@@ -29789,8 +28651,7 @@ class Threads2 extends APIResource2 {
29789
28651
  ...options,
29790
28652
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29791
28653
  stream: body.stream ?? false,
29792
- __synthesizeEventData: true,
29793
- __security: { bearerAuth: true }
28654
+ __synthesizeEventData: true
29794
28655
  });
29795
28656
  }
29796
28657
  async createAndRunPoll(body, options) {
@@ -29821,12 +28682,7 @@ Beta2.Threads = Threads2;
29821
28682
  // node_modules/openai/resources/completions.mjs
29822
28683
  class Completions3 extends APIResource2 {
29823
28684
  create(body, options) {
29824
- return this._client.post("/completions", {
29825
- body,
29826
- ...options,
29827
- stream: body.stream ?? false,
29828
- __security: { bearerAuth: true }
29829
- });
28685
+ return this._client.post("/completions", { body, ...options, stream: body.stream ?? false });
29830
28686
  }
29831
28687
  }
29832
28688
  // node_modules/openai/resources/containers/files/content.mjs
@@ -29836,7 +28692,6 @@ class Content extends APIResource2 {
29836
28692
  return this._client.get(path2`/containers/${container_id}/files/${fileID}/content`, {
29837
28693
  ...options,
29838
28694
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
29839
- __security: { bearerAuth: true },
29840
28695
  __binaryResponse: true
29841
28696
  });
29842
28697
  }
@@ -29849,28 +28704,23 @@ class Files2 extends APIResource2 {
29849
28704
  this.content = new Content(this._client);
29850
28705
  }
29851
28706
  create(containerID, body, options) {
29852
- return this._client.post(path2`/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
28707
+ return this._client.post(path2`/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
29853
28708
  }
29854
28709
  retrieve(fileID, params, options) {
29855
28710
  const { container_id } = params;
29856
- return this._client.get(path2`/containers/${container_id}/files/${fileID}`, {
29857
- ...options,
29858
- __security: { bearerAuth: true }
29859
- });
28711
+ return this._client.get(path2`/containers/${container_id}/files/${fileID}`, options);
29860
28712
  }
29861
28713
  list(containerID, query2 = {}, options) {
29862
28714
  return this._client.getAPIList(path2`/containers/${containerID}/files`, CursorPage, {
29863
28715
  query: query2,
29864
- ...options,
29865
- __security: { bearerAuth: true }
28716
+ ...options
29866
28717
  });
29867
28718
  }
29868
28719
  delete(fileID, params, options) {
29869
28720
  const { container_id } = params;
29870
28721
  return this._client.delete(path2`/containers/${container_id}/files/${fileID}`, {
29871
28722
  ...options,
29872
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29873
- __security: { bearerAuth: true }
28723
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29874
28724
  });
29875
28725
  }
29876
28726
  }
@@ -29883,26 +28733,18 @@ class Containers extends APIResource2 {
29883
28733
  this.files = new Files2(this._client);
29884
28734
  }
29885
28735
  create(body, options) {
29886
- return this._client.post("/containers", { body, ...options, __security: { bearerAuth: true } });
28736
+ return this._client.post("/containers", { body, ...options });
29887
28737
  }
29888
28738
  retrieve(containerID, options) {
29889
- return this._client.get(path2`/containers/${containerID}`, {
29890
- ...options,
29891
- __security: { bearerAuth: true }
29892
- });
28739
+ return this._client.get(path2`/containers/${containerID}`, options);
29893
28740
  }
29894
28741
  list(query2 = {}, options) {
29895
- return this._client.getAPIList("/containers", CursorPage, {
29896
- query: query2,
29897
- ...options,
29898
- __security: { bearerAuth: true }
29899
- });
28742
+ return this._client.getAPIList("/containers", CursorPage, { query: query2, ...options });
29900
28743
  }
29901
28744
  delete(containerID, options) {
29902
28745
  return this._client.delete(path2`/containers/${containerID}`, {
29903
28746
  ...options,
29904
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29905
- __security: { bearerAuth: true }
28747
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29906
28748
  });
29907
28749
  }
29908
28750
  }
@@ -29914,27 +28756,19 @@ class Items extends APIResource2 {
29914
28756
  return this._client.post(path2`/conversations/${conversationID}/items`, {
29915
28757
  query: { include },
29916
28758
  body,
29917
- ...options,
29918
- __security: { bearerAuth: true }
28759
+ ...options
29919
28760
  });
29920
28761
  }
29921
28762
  retrieve(itemID, params, options) {
29922
28763
  const { conversation_id, ...query2 } = params;
29923
- return this._client.get(path2`/conversations/${conversation_id}/items/${itemID}`, {
29924
- query: query2,
29925
- ...options,
29926
- __security: { bearerAuth: true }
29927
- });
28764
+ return this._client.get(path2`/conversations/${conversation_id}/items/${itemID}`, { query: query2, ...options });
29928
28765
  }
29929
28766
  list(conversationID, query2 = {}, options) {
29930
- return this._client.getAPIList(path2`/conversations/${conversationID}/items`, ConversationCursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
28767
+ return this._client.getAPIList(path2`/conversations/${conversationID}/items`, ConversationCursorPage, { query: query2, ...options });
29931
28768
  }
29932
28769
  delete(itemID, params, options) {
29933
28770
  const { conversation_id } = params;
29934
- return this._client.delete(path2`/conversations/${conversation_id}/items/${itemID}`, {
29935
- ...options,
29936
- __security: { bearerAuth: true }
29937
- });
28771
+ return this._client.delete(path2`/conversations/${conversation_id}/items/${itemID}`, options);
29938
28772
  }
29939
28773
  }
29940
28774
 
@@ -29945,26 +28779,16 @@ class Conversations extends APIResource2 {
29945
28779
  this.items = new Items(this._client);
29946
28780
  }
29947
28781
  create(body = {}, options) {
29948
- return this._client.post("/conversations", { body, ...options, __security: { bearerAuth: true } });
28782
+ return this._client.post("/conversations", { body, ...options });
29949
28783
  }
29950
28784
  retrieve(conversationID, options) {
29951
- return this._client.get(path2`/conversations/${conversationID}`, {
29952
- ...options,
29953
- __security: { bearerAuth: true }
29954
- });
28785
+ return this._client.get(path2`/conversations/${conversationID}`, options);
29955
28786
  }
29956
28787
  update(conversationID, body, options) {
29957
- return this._client.post(path2`/conversations/${conversationID}`, {
29958
- body,
29959
- ...options,
29960
- __security: { bearerAuth: true }
29961
- });
28788
+ return this._client.post(path2`/conversations/${conversationID}`, { body, ...options });
29962
28789
  }
29963
28790
  delete(conversationID, options) {
29964
- return this._client.delete(path2`/conversations/${conversationID}`, {
29965
- ...options,
29966
- __security: { bearerAuth: true }
29967
- });
28791
+ return this._client.delete(path2`/conversations/${conversationID}`, options);
29968
28792
  }
29969
28793
  }
29970
28794
  Conversations.Items = Items;
@@ -29981,8 +28805,7 @@ class Embeddings extends APIResource2 {
29981
28805
  ...body,
29982
28806
  encoding_format
29983
28807
  },
29984
- ...options,
29985
- __security: { bearerAuth: true }
28808
+ ...options
29986
28809
  });
29987
28810
  if (hasUserProvidedEncodingFormat) {
29988
28811
  return response;
@@ -30003,14 +28826,11 @@ class Embeddings extends APIResource2 {
30003
28826
  class OutputItems extends APIResource2 {
30004
28827
  retrieve(outputItemID, params, options) {
30005
28828
  const { eval_id, run_id } = params;
30006
- return this._client.get(path2`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, {
30007
- ...options,
30008
- __security: { bearerAuth: true }
30009
- });
28829
+ return this._client.get(path2`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, options);
30010
28830
  }
30011
28831
  list(runID, params, options) {
30012
28832
  const { eval_id, ...query2 } = params;
30013
- return this._client.getAPIList(path2`/evals/${eval_id}/runs/${runID}/output_items`, CursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
28833
+ return this._client.getAPIList(path2`/evals/${eval_id}/runs/${runID}/output_items`, CursorPage, { query: query2, ...options });
30014
28834
  }
30015
28835
  }
30016
28836
 
@@ -30021,39 +28841,25 @@ class Runs2 extends APIResource2 {
30021
28841
  this.outputItems = new OutputItems(this._client);
30022
28842
  }
30023
28843
  create(evalID, body, options) {
30024
- return this._client.post(path2`/evals/${evalID}/runs`, {
30025
- body,
30026
- ...options,
30027
- __security: { bearerAuth: true }
30028
- });
28844
+ return this._client.post(path2`/evals/${evalID}/runs`, { body, ...options });
30029
28845
  }
30030
28846
  retrieve(runID, params, options) {
30031
28847
  const { eval_id } = params;
30032
- return this._client.get(path2`/evals/${eval_id}/runs/${runID}`, {
30033
- ...options,
30034
- __security: { bearerAuth: true }
30035
- });
28848
+ return this._client.get(path2`/evals/${eval_id}/runs/${runID}`, options);
30036
28849
  }
30037
28850
  list(evalID, query2 = {}, options) {
30038
28851
  return this._client.getAPIList(path2`/evals/${evalID}/runs`, CursorPage, {
30039
28852
  query: query2,
30040
- ...options,
30041
- __security: { bearerAuth: true }
28853
+ ...options
30042
28854
  });
30043
28855
  }
30044
28856
  delete(runID, params, options) {
30045
28857
  const { eval_id } = params;
30046
- return this._client.delete(path2`/evals/${eval_id}/runs/${runID}`, {
30047
- ...options,
30048
- __security: { bearerAuth: true }
30049
- });
28858
+ return this._client.delete(path2`/evals/${eval_id}/runs/${runID}`, options);
30050
28859
  }
30051
28860
  cancel(runID, params, options) {
30052
28861
  const { eval_id } = params;
30053
- return this._client.post(path2`/evals/${eval_id}/runs/${runID}`, {
30054
- ...options,
30055
- __security: { bearerAuth: true }
30056
- });
28862
+ return this._client.post(path2`/evals/${eval_id}/runs/${runID}`, options);
30057
28863
  }
30058
28864
  }
30059
28865
  Runs2.OutputItems = OutputItems;
@@ -30065,49 +28871,40 @@ class Evals extends APIResource2 {
30065
28871
  this.runs = new Runs2(this._client);
30066
28872
  }
30067
28873
  create(body, options) {
30068
- return this._client.post("/evals", { body, ...options, __security: { bearerAuth: true } });
28874
+ return this._client.post("/evals", { body, ...options });
30069
28875
  }
30070
28876
  retrieve(evalID, options) {
30071
- return this._client.get(path2`/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
28877
+ return this._client.get(path2`/evals/${evalID}`, options);
30072
28878
  }
30073
28879
  update(evalID, body, options) {
30074
- return this._client.post(path2`/evals/${evalID}`, { body, ...options, __security: { bearerAuth: true } });
28880
+ return this._client.post(path2`/evals/${evalID}`, { body, ...options });
30075
28881
  }
30076
28882
  list(query2 = {}, options) {
30077
- return this._client.getAPIList("/evals", CursorPage, {
30078
- query: query2,
30079
- ...options,
30080
- __security: { bearerAuth: true }
30081
- });
28883
+ return this._client.getAPIList("/evals", CursorPage, { query: query2, ...options });
30082
28884
  }
30083
28885
  delete(evalID, options) {
30084
- return this._client.delete(path2`/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
28886
+ return this._client.delete(path2`/evals/${evalID}`, options);
30085
28887
  }
30086
28888
  }
30087
28889
  Evals.Runs = Runs2;
30088
28890
  // node_modules/openai/resources/files.mjs
30089
28891
  class Files3 extends APIResource2 {
30090
28892
  create(body, options) {
30091
- return this._client.post("/files", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
28893
+ return this._client.post("/files", multipartFormRequestOptions2({ body, ...options }, this._client));
30092
28894
  }
30093
28895
  retrieve(fileID, options) {
30094
- return this._client.get(path2`/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
28896
+ return this._client.get(path2`/files/${fileID}`, options);
30095
28897
  }
30096
28898
  list(query2 = {}, options) {
30097
- return this._client.getAPIList("/files", CursorPage, {
30098
- query: query2,
30099
- ...options,
30100
- __security: { bearerAuth: true }
30101
- });
28899
+ return this._client.getAPIList("/files", CursorPage, { query: query2, ...options });
30102
28900
  }
30103
28901
  delete(fileID, options) {
30104
- return this._client.delete(path2`/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
28902
+ return this._client.delete(path2`/files/${fileID}`, options);
30105
28903
  }
30106
28904
  content(fileID, options) {
30107
28905
  return this._client.get(path2`/files/${fileID}/content`, {
30108
28906
  ...options,
30109
28907
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
30110
- __security: { bearerAuth: true },
30111
28908
  __binaryResponse: true
30112
28909
  });
30113
28910
  }
@@ -30134,18 +28931,10 @@ class Methods extends APIResource2 {
30134
28931
  // node_modules/openai/resources/fine-tuning/alpha/graders.mjs
30135
28932
  class Graders extends APIResource2 {
30136
28933
  run(body, options) {
30137
- return this._client.post("/fine_tuning/alpha/graders/run", {
30138
- body,
30139
- ...options,
30140
- __security: { bearerAuth: true }
30141
- });
28934
+ return this._client.post("/fine_tuning/alpha/graders/run", { body, ...options });
30142
28935
  }
30143
28936
  validate(body, options) {
30144
- return this._client.post("/fine_tuning/alpha/graders/validate", {
30145
- body,
30146
- ...options,
30147
- __security: { bearerAuth: true }
30148
- });
28937
+ return this._client.post("/fine_tuning/alpha/graders/validate", { body, ...options });
30149
28938
  }
30150
28939
  }
30151
28940
 
@@ -30161,21 +28950,20 @@ Alpha.Graders = Graders;
30161
28950
  // node_modules/openai/resources/fine-tuning/checkpoints/permissions.mjs
30162
28951
  class Permissions extends APIResource2 {
30163
28952
  create(fineTunedModelCheckpoint, body, options) {
30164
- return this._client.getAPIList(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
28953
+ return this._client.getAPIList(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, Page2, { body, method: "post", ...options });
30165
28954
  }
30166
28955
  retrieve(fineTunedModelCheckpoint, query2 = {}, options) {
30167
28956
  return this._client.get(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
30168
28957
  query: query2,
30169
- ...options,
30170
- __security: { adminAPIKeyAuth: true }
28958
+ ...options
30171
28959
  });
30172
28960
  }
30173
28961
  list(fineTunedModelCheckpoint, query2 = {}, options) {
30174
- return this._client.getAPIList(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, ConversationCursorPage, { query: query2, ...options, __security: { adminAPIKeyAuth: true } });
28962
+ return this._client.getAPIList(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, ConversationCursorPage, { query: query2, ...options });
30175
28963
  }
30176
28964
  delete(permissionID, params, options) {
30177
28965
  const { fine_tuned_model_checkpoint } = params;
30178
- return this._client.delete(path2`/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, { ...options, __security: { adminAPIKeyAuth: true } });
28966
+ return this._client.delete(path2`/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
30179
28967
  }
30180
28968
  }
30181
28969
 
@@ -30191,7 +28979,7 @@ Checkpoints.Permissions = Permissions;
30191
28979
  // node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs
30192
28980
  class Checkpoints2 extends APIResource2 {
30193
28981
  list(fineTuningJobID, query2 = {}, options) {
30194
- return this._client.getAPIList(path2`/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, CursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
28982
+ return this._client.getAPIList(path2`/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, CursorPage, { query: query2, ...options });
30195
28983
  }
30196
28984
  }
30197
28985
 
@@ -30202,41 +28990,25 @@ class Jobs extends APIResource2 {
30202
28990
  this.checkpoints = new Checkpoints2(this._client);
30203
28991
  }
30204
28992
  create(body, options) {
30205
- return this._client.post("/fine_tuning/jobs", { body, ...options, __security: { bearerAuth: true } });
28993
+ return this._client.post("/fine_tuning/jobs", { body, ...options });
30206
28994
  }
30207
28995
  retrieve(fineTuningJobID, options) {
30208
- return this._client.get(path2`/fine_tuning/jobs/${fineTuningJobID}`, {
30209
- ...options,
30210
- __security: { bearerAuth: true }
30211
- });
28996
+ return this._client.get(path2`/fine_tuning/jobs/${fineTuningJobID}`, options);
30212
28997
  }
30213
28998
  list(query2 = {}, options) {
30214
- return this._client.getAPIList("/fine_tuning/jobs", CursorPage, {
30215
- query: query2,
30216
- ...options,
30217
- __security: { bearerAuth: true }
30218
- });
28999
+ return this._client.getAPIList("/fine_tuning/jobs", CursorPage, { query: query2, ...options });
30219
29000
  }
30220
29001
  cancel(fineTuningJobID, options) {
30221
- return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/cancel`, {
30222
- ...options,
30223
- __security: { bearerAuth: true }
30224
- });
29002
+ return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options);
30225
29003
  }
30226
29004
  listEvents(fineTuningJobID, query2 = {}, options) {
30227
- return this._client.getAPIList(path2`/fine_tuning/jobs/${fineTuningJobID}/events`, CursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
29005
+ return this._client.getAPIList(path2`/fine_tuning/jobs/${fineTuningJobID}/events`, CursorPage, { query: query2, ...options });
30228
29006
  }
30229
29007
  pause(fineTuningJobID, options) {
30230
- return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/pause`, {
30231
- ...options,
30232
- __security: { bearerAuth: true }
30233
- });
29008
+ return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/pause`, options);
30234
29009
  }
30235
29010
  resume(fineTuningJobID, options) {
30236
- return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/resume`, {
30237
- ...options,
30238
- __security: { bearerAuth: true }
30239
- });
29011
+ return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/resume`, options);
30240
29012
  }
30241
29013
  }
30242
29014
  Jobs.Checkpoints = Checkpoints2;
@@ -30270,36 +29042,31 @@ Graders2.GraderModels = GraderModels;
30270
29042
  // node_modules/openai/resources/images.mjs
30271
29043
  class Images extends APIResource2 {
30272
29044
  createVariation(body, options) {
30273
- return this._client.post("/images/variations", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29045
+ return this._client.post("/images/variations", multipartFormRequestOptions2({ body, ...options }, this._client));
30274
29046
  }
30275
29047
  edit(body, options) {
30276
- return this._client.post("/images/edits", multipartFormRequestOptions2({ body, ...options, stream: body.stream ?? false, __security: { bearerAuth: true } }, this._client));
29048
+ return this._client.post("/images/edits", multipartFormRequestOptions2({ body, ...options, stream: body.stream ?? false }, this._client));
30277
29049
  }
30278
29050
  generate(body, options) {
30279
- return this._client.post("/images/generations", {
30280
- body,
30281
- ...options,
30282
- stream: body.stream ?? false,
30283
- __security: { bearerAuth: true }
30284
- });
29051
+ return this._client.post("/images/generations", { body, ...options, stream: body.stream ?? false });
30285
29052
  }
30286
29053
  }
30287
29054
  // node_modules/openai/resources/models.mjs
30288
29055
  class Models3 extends APIResource2 {
30289
29056
  retrieve(model, options) {
30290
- return this._client.get(path2`/models/${model}`, { ...options, __security: { bearerAuth: true } });
29057
+ return this._client.get(path2`/models/${model}`, options);
30291
29058
  }
30292
29059
  list(options) {
30293
- return this._client.getAPIList("/models", Page2, { ...options, __security: { bearerAuth: true } });
29060
+ return this._client.getAPIList("/models", Page2, options);
30294
29061
  }
30295
29062
  delete(model, options) {
30296
- return this._client.delete(path2`/models/${model}`, { ...options, __security: { bearerAuth: true } });
29063
+ return this._client.delete(path2`/models/${model}`, options);
30297
29064
  }
30298
29065
  }
30299
29066
  // node_modules/openai/resources/moderations.mjs
30300
29067
  class Moderations extends APIResource2 {
30301
29068
  create(body, options) {
30302
- return this._client.post("/moderations", { body, ...options, __security: { bearerAuth: true } });
29069
+ return this._client.post("/moderations", { body, ...options });
30303
29070
  }
30304
29071
  }
30305
29072
  // node_modules/openai/resources/realtime/calls.mjs
@@ -30308,31 +29075,27 @@ class Calls extends APIResource2 {
30308
29075
  return this._client.post(path2`/realtime/calls/${callID}/accept`, {
30309
29076
  body,
30310
29077
  ...options,
30311
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30312
- __security: { bearerAuth: true }
29078
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30313
29079
  });
30314
29080
  }
30315
29081
  hangup(callID, options) {
30316
29082
  return this._client.post(path2`/realtime/calls/${callID}/hangup`, {
30317
29083
  ...options,
30318
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30319
- __security: { bearerAuth: true }
29084
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30320
29085
  });
30321
29086
  }
30322
29087
  refer(callID, body, options) {
30323
29088
  return this._client.post(path2`/realtime/calls/${callID}/refer`, {
30324
29089
  body,
30325
29090
  ...options,
30326
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30327
- __security: { bearerAuth: true }
29091
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30328
29092
  });
30329
29093
  }
30330
29094
  reject(callID, body = {}, options) {
30331
29095
  return this._client.post(path2`/realtime/calls/${callID}/reject`, {
30332
29096
  body,
30333
29097
  ...options,
30334
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30335
- __security: { bearerAuth: true }
29098
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30336
29099
  });
30337
29100
  }
30338
29101
  }
@@ -30340,11 +29103,7 @@ class Calls extends APIResource2 {
30340
29103
  // node_modules/openai/resources/realtime/client-secrets.mjs
30341
29104
  class ClientSecrets extends APIResource2 {
30342
29105
  create(body, options) {
30343
- return this._client.post("/realtime/client_secrets", {
30344
- body,
30345
- ...options,
30346
- __security: { bearerAuth: true }
30347
- });
29106
+ return this._client.post("/realtime/client_secrets", { body, ...options });
30348
29107
  }
30349
29108
  }
30350
29109
 
@@ -30741,18 +29500,14 @@ function finalizeResponse(snapshot, params) {
30741
29500
  // node_modules/openai/resources/responses/input-items.mjs
30742
29501
  class InputItems extends APIResource2 {
30743
29502
  list(responseID, query2 = {}, options) {
30744
- return this._client.getAPIList(path2`/responses/${responseID}/input_items`, CursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
29503
+ return this._client.getAPIList(path2`/responses/${responseID}/input_items`, CursorPage, { query: query2, ...options });
30745
29504
  }
30746
29505
  }
30747
29506
 
30748
29507
  // node_modules/openai/resources/responses/input-tokens.mjs
30749
29508
  class InputTokens extends APIResource2 {
30750
29509
  count(body = {}, options) {
30751
- return this._client.post("/responses/input_tokens", {
30752
- body,
30753
- ...options,
30754
- __security: { bearerAuth: true }
30755
- });
29510
+ return this._client.post("/responses/input_tokens", { body, ...options });
30756
29511
  }
30757
29512
  }
30758
29513
 
@@ -30764,12 +29519,7 @@ class Responses extends APIResource2 {
30764
29519
  this.inputTokens = new InputTokens(this._client);
30765
29520
  }
30766
29521
  create(body, options) {
30767
- return this._client.post("/responses", {
30768
- body,
30769
- ...options,
30770
- stream: body.stream ?? false,
30771
- __security: { bearerAuth: true }
30772
- })._thenUnwrap((rsp) => {
29522
+ return this._client.post("/responses", { body, ...options, stream: body.stream ?? false })._thenUnwrap((rsp) => {
30773
29523
  if ("object" in rsp && rsp.object === "response") {
30774
29524
  addOutputText(rsp);
30775
29525
  }
@@ -30780,8 +29530,7 @@ class Responses extends APIResource2 {
30780
29530
  return this._client.get(path2`/responses/${responseID}`, {
30781
29531
  query: query2,
30782
29532
  ...options,
30783
- stream: query2?.stream ?? false,
30784
- __security: { bearerAuth: true }
29533
+ stream: query2?.stream ?? false
30785
29534
  })._thenUnwrap((rsp) => {
30786
29535
  if ("object" in rsp && rsp.object === "response") {
30787
29536
  addOutputText(rsp);
@@ -30792,8 +29541,7 @@ class Responses extends APIResource2 {
30792
29541
  delete(responseID, options) {
30793
29542
  return this._client.delete(path2`/responses/${responseID}`, {
30794
29543
  ...options,
30795
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30796
- __security: { bearerAuth: true }
29544
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30797
29545
  });
30798
29546
  }
30799
29547
  parse(body, options) {
@@ -30803,13 +29551,10 @@ class Responses extends APIResource2 {
30803
29551
  return ResponseStream.createResponse(this._client, body, options);
30804
29552
  }
30805
29553
  cancel(responseID, options) {
30806
- return this._client.post(path2`/responses/${responseID}/cancel`, {
30807
- ...options,
30808
- __security: { bearerAuth: true }
30809
- });
29554
+ return this._client.post(path2`/responses/${responseID}/cancel`, options);
30810
29555
  }
30811
29556
  compact(body, options) {
30812
- return this._client.post("/responses/compact", { body, ...options, __security: { bearerAuth: true } });
29557
+ return this._client.post("/responses/compact", { body, ...options });
30813
29558
  }
30814
29559
  }
30815
29560
  Responses.InputItems = InputItems;
@@ -30820,7 +29565,6 @@ class Content2 extends APIResource2 {
30820
29565
  return this._client.get(path2`/skills/${skillID}/content`, {
30821
29566
  ...options,
30822
29567
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
30823
- __security: { bearerAuth: true },
30824
29568
  __binaryResponse: true
30825
29569
  });
30826
29570
  }
@@ -30833,7 +29577,6 @@ class Content3 extends APIResource2 {
30833
29577
  return this._client.get(path2`/skills/${skill_id}/versions/${version}/content`, {
30834
29578
  ...options,
30835
29579
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
30836
- __security: { bearerAuth: true },
30837
29580
  __binaryResponse: true
30838
29581
  });
30839
29582
  }
@@ -30846,28 +29589,21 @@ class Versions2 extends APIResource2 {
30846
29589
  this.content = new Content3(this._client);
30847
29590
  }
30848
29591
  create(skillID, body = {}, options) {
30849
- return this._client.post(path2`/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
29592
+ return this._client.post(path2`/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
30850
29593
  }
30851
29594
  retrieve(version, params, options) {
30852
29595
  const { skill_id } = params;
30853
- return this._client.get(path2`/skills/${skill_id}/versions/${version}`, {
30854
- ...options,
30855
- __security: { bearerAuth: true }
30856
- });
29596
+ return this._client.get(path2`/skills/${skill_id}/versions/${version}`, options);
30857
29597
  }
30858
29598
  list(skillID, query2 = {}, options) {
30859
29599
  return this._client.getAPIList(path2`/skills/${skillID}/versions`, CursorPage, {
30860
29600
  query: query2,
30861
- ...options,
30862
- __security: { bearerAuth: true }
29601
+ ...options
30863
29602
  });
30864
29603
  }
30865
29604
  delete(version, params, options) {
30866
29605
  const { skill_id } = params;
30867
- return this._client.delete(path2`/skills/${skill_id}/versions/${version}`, {
30868
- ...options,
30869
- __security: { bearerAuth: true }
30870
- });
29606
+ return this._client.delete(path2`/skills/${skill_id}/versions/${version}`, options);
30871
29607
  }
30872
29608
  }
30873
29609
  Versions2.Content = Content3;
@@ -30880,27 +29616,19 @@ class Skills2 extends APIResource2 {
30880
29616
  this.versions = new Versions2(this._client);
30881
29617
  }
30882
29618
  create(body = {}, options) {
30883
- return this._client.post("/skills", maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
29619
+ return this._client.post("/skills", maybeMultipartFormRequestOptions({ body, ...options }, this._client));
30884
29620
  }
30885
29621
  retrieve(skillID, options) {
30886
- return this._client.get(path2`/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
29622
+ return this._client.get(path2`/skills/${skillID}`, options);
30887
29623
  }
30888
29624
  update(skillID, body, options) {
30889
- return this._client.post(path2`/skills/${skillID}`, {
30890
- body,
30891
- ...options,
30892
- __security: { bearerAuth: true }
30893
- });
29625
+ return this._client.post(path2`/skills/${skillID}`, { body, ...options });
30894
29626
  }
30895
29627
  list(query2 = {}, options) {
30896
- return this._client.getAPIList("/skills", CursorPage, {
30897
- query: query2,
30898
- ...options,
30899
- __security: { bearerAuth: true }
30900
- });
29628
+ return this._client.getAPIList("/skills", CursorPage, { query: query2, ...options });
30901
29629
  }
30902
29630
  delete(skillID, options) {
30903
- return this._client.delete(path2`/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
29631
+ return this._client.delete(path2`/skills/${skillID}`, options);
30904
29632
  }
30905
29633
  }
30906
29634
  Skills2.Content = Content2;
@@ -30908,7 +29636,7 @@ Skills2.Versions = Versions2;
30908
29636
  // node_modules/openai/resources/uploads/parts.mjs
30909
29637
  class Parts extends APIResource2 {
30910
29638
  create(uploadID, body, options) {
30911
- return this._client.post(path2`/uploads/${uploadID}/parts`, multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29639
+ return this._client.post(path2`/uploads/${uploadID}/parts`, multipartFormRequestOptions2({ body, ...options }, this._client));
30912
29640
  }
30913
29641
  }
30914
29642
 
@@ -30919,20 +29647,13 @@ class Uploads extends APIResource2 {
30919
29647
  this.parts = new Parts(this._client);
30920
29648
  }
30921
29649
  create(body, options) {
30922
- return this._client.post("/uploads", { body, ...options, __security: { bearerAuth: true } });
29650
+ return this._client.post("/uploads", { body, ...options });
30923
29651
  }
30924
29652
  cancel(uploadID, options) {
30925
- return this._client.post(path2`/uploads/${uploadID}/cancel`, {
30926
- ...options,
30927
- __security: { bearerAuth: true }
30928
- });
29653
+ return this._client.post(path2`/uploads/${uploadID}/cancel`, options);
30929
29654
  }
30930
29655
  complete(uploadID, body, options) {
30931
- return this._client.post(path2`/uploads/${uploadID}/complete`, {
30932
- body,
30933
- ...options,
30934
- __security: { bearerAuth: true }
30935
- });
29656
+ return this._client.post(path2`/uploads/${uploadID}/complete`, { body, ...options });
30936
29657
  }
30937
29658
  }
30938
29659
  Uploads.Parts = Parts;
@@ -30961,24 +29682,21 @@ class FileBatches extends APIResource2 {
30961
29682
  return this._client.post(path2`/vector_stores/${vectorStoreID}/file_batches`, {
30962
29683
  body,
30963
29684
  ...options,
30964
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30965
- __security: { bearerAuth: true }
29685
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30966
29686
  });
30967
29687
  }
30968
29688
  retrieve(batchID, params, options) {
30969
29689
  const { vector_store_id } = params;
30970
29690
  return this._client.get(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
30971
29691
  ...options,
30972
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30973
- __security: { bearerAuth: true }
29692
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30974
29693
  });
30975
29694
  }
30976
29695
  cancel(batchID, params, options) {
30977
29696
  const { vector_store_id } = params;
30978
29697
  return this._client.post(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
30979
29698
  ...options,
30980
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30981
- __security: { bearerAuth: true }
29699
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30982
29700
  });
30983
29701
  }
30984
29702
  async createAndPoll(vectorStoreId, body, options) {
@@ -30987,12 +29705,7 @@ class FileBatches extends APIResource2 {
30987
29705
  }
30988
29706
  listFiles(batchID, params, options) {
30989
29707
  const { vector_store_id, ...query2 } = params;
30990
- return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, {
30991
- query: query2,
30992
- ...options,
30993
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30994
- __security: { bearerAuth: true }
30995
- });
29708
+ return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, { query: query2, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
30996
29709
  }
30997
29710
  async poll(vectorStoreID, batchID, options) {
30998
29711
  const headers = buildHeaders2([
@@ -31059,16 +29772,14 @@ class Files4 extends APIResource2 {
31059
29772
  return this._client.post(path2`/vector_stores/${vectorStoreID}/files`, {
31060
29773
  body,
31061
29774
  ...options,
31062
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31063
- __security: { bearerAuth: true }
29775
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31064
29776
  });
31065
29777
  }
31066
29778
  retrieve(fileID, params, options) {
31067
29779
  const { vector_store_id } = params;
31068
29780
  return this._client.get(path2`/vector_stores/${vector_store_id}/files/${fileID}`, {
31069
29781
  ...options,
31070
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31071
- __security: { bearerAuth: true }
29782
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31072
29783
  });
31073
29784
  }
31074
29785
  update(fileID, params, options) {
@@ -31076,24 +29787,21 @@ class Files4 extends APIResource2 {
31076
29787
  return this._client.post(path2`/vector_stores/${vector_store_id}/files/${fileID}`, {
31077
29788
  body,
31078
29789
  ...options,
31079
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31080
- __security: { bearerAuth: true }
29790
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31081
29791
  });
31082
29792
  }
31083
29793
  list(vectorStoreID, query2 = {}, options) {
31084
29794
  return this._client.getAPIList(path2`/vector_stores/${vectorStoreID}/files`, CursorPage, {
31085
29795
  query: query2,
31086
29796
  ...options,
31087
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31088
- __security: { bearerAuth: true }
29797
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31089
29798
  });
31090
29799
  }
31091
29800
  delete(fileID, params, options) {
31092
29801
  const { vector_store_id } = params;
31093
29802
  return this._client.delete(path2`/vector_stores/${vector_store_id}/files/${fileID}`, {
31094
29803
  ...options,
31095
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31096
- __security: { bearerAuth: true }
29804
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31097
29805
  });
31098
29806
  }
31099
29807
  async createAndPoll(vectorStoreId, body, options) {
@@ -31145,11 +29853,7 @@ class Files4 extends APIResource2 {
31145
29853
  }
31146
29854
  content(fileID, params, options) {
31147
29855
  const { vector_store_id } = params;
31148
- return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/files/${fileID}/content`, Page2, {
31149
- ...options,
31150
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31151
- __security: { bearerAuth: true }
31152
- });
29856
+ return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/files/${fileID}/content`, Page2, { ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
31153
29857
  }
31154
29858
  }
31155
29859
 
@@ -31164,38 +29868,33 @@ class VectorStores extends APIResource2 {
31164
29868
  return this._client.post("/vector_stores", {
31165
29869
  body,
31166
29870
  ...options,
31167
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31168
- __security: { bearerAuth: true }
29871
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31169
29872
  });
31170
29873
  }
31171
29874
  retrieve(vectorStoreID, options) {
31172
29875
  return this._client.get(path2`/vector_stores/${vectorStoreID}`, {
31173
29876
  ...options,
31174
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31175
- __security: { bearerAuth: true }
29877
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31176
29878
  });
31177
29879
  }
31178
29880
  update(vectorStoreID, body, options) {
31179
29881
  return this._client.post(path2`/vector_stores/${vectorStoreID}`, {
31180
29882
  body,
31181
29883
  ...options,
31182
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31183
- __security: { bearerAuth: true }
29884
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31184
29885
  });
31185
29886
  }
31186
29887
  list(query2 = {}, options) {
31187
29888
  return this._client.getAPIList("/vector_stores", CursorPage, {
31188
29889
  query: query2,
31189
29890
  ...options,
31190
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31191
- __security: { bearerAuth: true }
29891
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31192
29892
  });
31193
29893
  }
31194
29894
  delete(vectorStoreID, options) {
31195
29895
  return this._client.delete(path2`/vector_stores/${vectorStoreID}`, {
31196
29896
  ...options,
31197
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31198
- __security: { bearerAuth: true }
29897
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31199
29898
  });
31200
29899
  }
31201
29900
  search(vectorStoreID, body, options) {
@@ -31203,8 +29902,7 @@ class VectorStores extends APIResource2 {
31203
29902
  body,
31204
29903
  method: "post",
31205
29904
  ...options,
31206
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31207
- __security: { bearerAuth: true }
29905
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31208
29906
  });
31209
29907
  }
31210
29908
  }
@@ -31213,47 +29911,39 @@ VectorStores.FileBatches = FileBatches;
31213
29911
  // node_modules/openai/resources/videos.mjs
31214
29912
  class Videos extends APIResource2 {
31215
29913
  create(body, options) {
31216
- return this._client.post("/videos", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29914
+ return this._client.post("/videos", multipartFormRequestOptions2({ body, ...options }, this._client));
31217
29915
  }
31218
29916
  retrieve(videoID, options) {
31219
- return this._client.get(path2`/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
29917
+ return this._client.get(path2`/videos/${videoID}`, options);
31220
29918
  }
31221
29919
  list(query2 = {}, options) {
31222
- return this._client.getAPIList("/videos", ConversationCursorPage, {
31223
- query: query2,
31224
- ...options,
31225
- __security: { bearerAuth: true }
31226
- });
29920
+ return this._client.getAPIList("/videos", ConversationCursorPage, { query: query2, ...options });
31227
29921
  }
31228
29922
  delete(videoID, options) {
31229
- return this._client.delete(path2`/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
29923
+ return this._client.delete(path2`/videos/${videoID}`, options);
31230
29924
  }
31231
29925
  createCharacter(body, options) {
31232
- return this._client.post("/videos/characters", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29926
+ return this._client.post("/videos/characters", multipartFormRequestOptions2({ body, ...options }, this._client));
31233
29927
  }
31234
29928
  downloadContent(videoID, query2 = {}, options) {
31235
29929
  return this._client.get(path2`/videos/${videoID}/content`, {
31236
29930
  query: query2,
31237
29931
  ...options,
31238
29932
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
31239
- __security: { bearerAuth: true },
31240
29933
  __binaryResponse: true
31241
29934
  });
31242
29935
  }
31243
29936
  edit(body, options) {
31244
- return this._client.post("/videos/edits", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29937
+ return this._client.post("/videos/edits", multipartFormRequestOptions2({ body, ...options }, this._client));
31245
29938
  }
31246
29939
  extend(body, options) {
31247
- return this._client.post("/videos/extensions", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29940
+ return this._client.post("/videos/extensions", multipartFormRequestOptions2({ body, ...options }, this._client));
31248
29941
  }
31249
29942
  getCharacter(characterID, options) {
31250
- return this._client.get(path2`/videos/characters/${characterID}`, {
31251
- ...options,
31252
- __security: { bearerAuth: true }
31253
- });
29943
+ return this._client.get(path2`/videos/characters/${characterID}`, options);
31254
29944
  }
31255
29945
  remix(videoID, body, options) {
31256
- return this._client.post(path2`/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
29946
+ return this._client.post(path2`/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
31257
29947
  }
31258
29948
  }
31259
29949
  // node_modules/openai/resources/webhooks/webhooks.mjs
@@ -31327,10 +30017,9 @@ var _OpenAI_instances;
31327
30017
  var _a3;
31328
30018
  var _OpenAI_encoder;
31329
30019
  var _OpenAI_baseURLOverridden;
31330
- var WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER = "workload-identity-auth";
31331
30020
 
31332
30021
  class OpenAI {
31333
- constructor({ baseURL = readEnv2("OPENAI_BASE_URL"), apiKey = readEnv2("OPENAI_API_KEY") ?? null, adminAPIKey = readEnv2("OPENAI_ADMIN_KEY") ?? null, organization = readEnv2("OPENAI_ORG_ID") ?? null, project = readEnv2("OPENAI_PROJECT_ID") ?? null, webhookSecret = readEnv2("OPENAI_WEBHOOK_SECRET") ?? null, workloadIdentity, ...opts } = {}) {
30022
+ constructor({ baseURL = readEnv2("OPENAI_BASE_URL"), apiKey = readEnv2("OPENAI_API_KEY"), organization = readEnv2("OPENAI_ORG_ID") ?? null, project = readEnv2("OPENAI_PROJECT_ID") ?? null, webhookSecret = readEnv2("OPENAI_WEBHOOK_SECRET") ?? null, ...opts } = {}) {
31334
30023
  _OpenAI_instances.add(this);
31335
30024
  _OpenAI_encoder.set(this, undefined);
31336
30025
  this.completions = new Completions3(this);
@@ -31348,7 +30037,6 @@ class OpenAI {
31348
30037
  this.beta = new Beta2(this);
31349
30038
  this.batches = new Batches3(this);
31350
30039
  this.uploads = new Uploads(this);
31351
- this.admin = new Admin(this);
31352
30040
  this.responses = new Responses(this);
31353
30041
  this.realtime = new Realtime2(this);
31354
30042
  this.conversations = new Conversations(this);
@@ -31356,22 +30044,17 @@ class OpenAI {
31356
30044
  this.containers = new Containers(this);
31357
30045
  this.skills = new Skills2(this);
31358
30046
  this.videos = new Videos(this);
30047
+ if (apiKey === undefined) {
30048
+ throw new OpenAIError("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");
30049
+ }
31359
30050
  const options = {
31360
30051
  apiKey,
31361
- adminAPIKey,
31362
30052
  organization,
31363
30053
  project,
31364
30054
  webhookSecret,
31365
- workloadIdentity,
31366
30055
  ...opts,
31367
30056
  baseURL: baseURL || `https://api.openai.com/v1`
31368
30057
  };
31369
- if (apiKey && workloadIdentity) {
31370
- throw new OpenAIError("The `apiKey` and `workloadIdentity` options are mutually exclusive");
31371
- }
31372
- if (!apiKey && !adminAPIKey && !workloadIdentity) {
31373
- throw new OpenAIError("Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.");
31374
- }
31375
30058
  if (!options.dangerouslyAllowBrowser && isRunningInBrowser2()) {
31376
30059
  throw new OpenAIError(`It looks like you're running in a browser-like environment.
31377
30060
 
@@ -31394,24 +30077,8 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31394
30077
  this.maxRetries = options.maxRetries ?? 2;
31395
30078
  this.fetch = options.fetch ?? getDefaultFetch2();
31396
30079
  __classPrivateFieldSet2(this, _OpenAI_encoder, FallbackEncoder2, "f");
31397
- const customHeadersEnv = readEnv2("OPENAI_CUSTOM_HEADERS");
31398
- if (customHeadersEnv) {
31399
- const parsed = {};
31400
- for (const line of customHeadersEnv.split(`
31401
- `)) {
31402
- const colon = line.indexOf(":");
31403
- if (colon >= 0) {
31404
- parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
31405
- }
31406
- }
31407
- options.defaultHeaders = buildHeaders2([parsed, options.defaultHeaders]);
31408
- }
31409
30080
  this._options = options;
31410
- if (workloadIdentity) {
31411
- this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
31412
- }
31413
- this.apiKey = typeof apiKey === "string" ? apiKey : null;
31414
- this.adminAPIKey = adminAPIKey;
30081
+ this.apiKey = typeof apiKey === "string" ? apiKey : "Missing Key";
31415
30082
  this.organization = organization;
31416
30083
  this.project = project;
31417
30084
  this.webhookSecret = webhookSecret;
@@ -31426,9 +30093,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31426
30093
  logLevel: this.logLevel,
31427
30094
  fetch: this.fetch,
31428
30095
  fetchOptions: this.fetchOptions,
31429
- apiKey: this._options.apiKey,
31430
- adminAPIKey: this.adminAPIKey,
31431
- workloadIdentity: this._options.workloadIdentity,
30096
+ apiKey: this.apiKey,
31432
30097
  organization: this.organization,
31433
30098
  project: this.project,
31434
30099
  webhookSecret: this.webhookSecret,
@@ -31439,45 +30104,12 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31439
30104
  defaultQuery() {
31440
30105
  return this._options.defaultQuery;
31441
30106
  }
31442
- validateHeaders({ values: values2, nulls }, schemes = {
31443
- bearerAuth: true,
31444
- adminAPIKeyAuth: true
31445
- }) {
31446
- if (values2.get("authorization") || values2.get("api-key")) {
31447
- return;
31448
- }
31449
- if (nulls.has("authorization") || nulls.has("api-key")) {
31450
- return;
31451
- }
31452
- if (this._workloadIdentityAuth && schemes.bearerAuth) {
31453
- return;
31454
- }
31455
- throw new Error('Could not resolve authentication method. Expected either apiKey or adminAPIKey to be set. Or for one of the "Authorization" or "api-key" headers to be explicitly omitted');
31456
- }
31457
- async authHeaders(opts, schemes = {
31458
- bearerAuth: true,
31459
- adminAPIKeyAuth: true
31460
- }) {
31461
- return buildHeaders2([
31462
- schemes.bearerAuth ? await this.bearerAuth(opts) : null,
31463
- schemes.adminAPIKeyAuth ? await this.adminAPIKeyAuth(opts) : null
31464
- ]);
30107
+ validateHeaders({ values: values2, nulls }) {
30108
+ return;
31465
30109
  }
31466
- async bearerAuth(opts) {
31467
- if (this._workloadIdentityAuth) {
31468
- return buildHeaders2([{ Authorization: `Bearer ${await this._workloadIdentityAuth.getToken()}` }]);
31469
- }
31470
- if (this.apiKey == null) {
31471
- return;
31472
- }
30110
+ async authHeaders(opts) {
31473
30111
  return buildHeaders2([{ Authorization: `Bearer ${this.apiKey}` }]);
31474
30112
  }
31475
- async adminAPIKeyAuth(opts) {
31476
- if (this.adminAPIKey == null) {
31477
- return;
31478
- }
31479
- return buildHeaders2([{ Authorization: `Bearer ${this.adminAPIKey}` }]);
31480
- }
31481
30113
  stringifyQuery(query2) {
31482
30114
  return stringifyQuery2(query2);
31483
30115
  }
@@ -31522,10 +30154,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31522
30154
  return url.toString();
31523
30155
  }
31524
30156
  async prepareOptions(options) {
31525
- const security = options.__security ?? { bearerAuth: true };
31526
- if (security.bearerAuth) {
31527
- await this._callApiKey();
31528
- }
30157
+ await this._callApiKey();
31529
30158
  }
31530
30159
  async prepareRequest(request, { url, options }) {}
31531
30160
  get(path3, opts) {
@@ -31575,9 +30204,8 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31575
30204
  if (options.signal?.aborted) {
31576
30205
  throw new APIUserAbortError2;
31577
30206
  }
31578
- const security = options.__security ?? { bearerAuth: true };
31579
30207
  const controller = new AbortController;
31580
- const response = await this.fetchWithAuth(url, req, timeout, controller, security).catch(castToError2);
30208
+ const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError2);
31581
30209
  const headersTime = Date.now();
31582
30210
  if (response instanceof globalThis.Error) {
31583
30211
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
@@ -31602,31 +30230,14 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31602
30230
  durationMs: headersTime - startTime,
31603
30231
  message: response.message
31604
30232
  }));
31605
- if (response instanceof OAuthError || response instanceof SubjectTokenProviderError) {
31606
- throw response;
31607
- }
31608
30233
  if (isTimeout) {
31609
30234
  throw new APIConnectionTimeoutError2;
31610
30235
  }
31611
- throw new APIConnectionError2({
31612
- message: getConnectionErrorMessage(response),
31613
- cause: response
31614
- });
30236
+ throw new APIConnectionError2({ cause: response });
31615
30237
  }
31616
30238
  const specialHeaders = [...response.headers.entries()].filter(([name]) => name === "x-request-id").map(([name, value]) => ", " + name + ": " + JSON.stringify(value)).join("");
31617
30239
  const responseInfo = `[${requestLogID}${retryLogStr}${specialHeaders}] ${req.method} ${url} ${response.ok ? "succeeded" : "failed"} with status ${response.status} in ${headersTime - startTime}ms`;
31618
30240
  if (!response.ok) {
31619
- if (response.status === 401 && this._workloadIdentityAuth && security.bearerAuth && !options.__metadata?.["hasStreamingBody"] && !options.__metadata?.["workloadIdentityTokenRefreshed"]) {
31620
- await CancelReadableStream2(response.body);
31621
- this._workloadIdentityAuth.invalidateToken();
31622
- return this.makeRequest({
31623
- ...options,
31624
- __metadata: {
31625
- ...options.__metadata,
31626
- workloadIdentityTokenRefreshed: true
31627
- }
31628
- }, retriesRemaining, retryOfRequestLogID ?? requestLogID);
31629
- }
31630
30241
  const shouldRetry = await this.shouldRetry(response);
31631
30242
  if (retriesRemaining && shouldRetry) {
31632
30243
  const retryMessage2 = `retrying, ${retriesRemaining} attempts remaining`;
@@ -31674,21 +30285,6 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31674
30285
  const request = this.makeRequest(options, null, undefined);
31675
30286
  return new PagePromise2(this, request, Page3);
31676
30287
  }
31677
- async fetchWithAuth(url, init, timeout, controller, schemes = {
31678
- bearerAuth: true,
31679
- adminAPIKeyAuth: true
31680
- }) {
31681
- if (this._workloadIdentityAuth && schemes.bearerAuth) {
31682
- const headers = init.headers;
31683
- const authHeader = headers.get("Authorization");
31684
- if (!authHeader || authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
31685
- const token = await this._workloadIdentityAuth.getToken();
31686
- headers.set("Authorization", `Bearer ${token}`);
31687
- }
31688
- }
31689
- const response = await this.fetchWithTimeout(url, init, timeout, controller);
31690
- return response;
31691
- }
31692
30288
  async fetchWithTimeout(url, init, ms, controller) {
31693
30289
  const { signal, method, ...options } = init || {};
31694
30290
  const abort = this._makeAbort(controller);
@@ -31767,13 +30363,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31767
30363
  if ("timeout" in options)
31768
30364
  validatePositiveInteger2("timeout", options.timeout);
31769
30365
  options.timeout = options.timeout ?? this.timeout;
31770
- const { bodyHeaders, body, isStreamingBody } = this.buildBody({ options });
31771
- if (isStreamingBody) {
31772
- inputOptions.__metadata = {
31773
- ...inputOptions.__metadata,
31774
- hasStreamingBody: true
31775
- };
31776
- }
30366
+ const { bodyHeaders, body } = this.buildBody({ options });
31777
30367
  const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
31778
30368
  const req = {
31779
30369
  method,
@@ -31804,12 +30394,12 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31804
30394
  "OpenAI-Organization": this.organization,
31805
30395
  "OpenAI-Project": this.project
31806
30396
  },
31807
- await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
30397
+ await this.authHeaders(options),
31808
30398
  this._options.defaultHeaders,
31809
30399
  bodyHeaders,
31810
30400
  options.headers
31811
30401
  ]);
31812
- this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
30402
+ this.validateHeaders(headers);
31813
30403
  return headers.values;
31814
30404
  }
31815
30405
  _makeAbort(controller) {
@@ -31817,27 +30407,20 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31817
30407
  }
31818
30408
  buildBody({ options: { body, headers: rawHeaders } }) {
31819
30409
  if (!body) {
31820
- return { bodyHeaders: undefined, body: undefined, isStreamingBody: false };
30410
+ return { bodyHeaders: undefined, body: undefined };
31821
30411
  }
31822
30412
  const headers = buildHeaders2([rawHeaders]);
31823
- const isReadableStream = typeof globalThis.ReadableStream !== "undefined" && body instanceof globalThis.ReadableStream;
31824
- const isRetryableBody = !isReadableStream && (typeof body === "string" || body instanceof ArrayBuffer || ArrayBuffer.isView(body) || typeof globalThis.Blob !== "undefined" && body instanceof globalThis.Blob || body instanceof URLSearchParams || body instanceof FormData);
31825
- if (ArrayBuffer.isView(body) || body instanceof ArrayBuffer || body instanceof DataView || typeof body === "string" && headers.values.has("content-type") || globalThis.Blob && body instanceof globalThis.Blob || body instanceof FormData || body instanceof URLSearchParams || isReadableStream) {
31826
- return { bodyHeaders: undefined, body, isStreamingBody: !isRetryableBody };
30413
+ if (ArrayBuffer.isView(body) || body instanceof ArrayBuffer || body instanceof DataView || typeof body === "string" && headers.values.has("content-type") || globalThis.Blob && body instanceof globalThis.Blob || body instanceof FormData || body instanceof URLSearchParams || globalThis.ReadableStream && body instanceof globalThis.ReadableStream) {
30414
+ return { bodyHeaders: undefined, body };
31827
30415
  } else if (typeof body === "object" && ((Symbol.asyncIterator in body) || (Symbol.iterator in body) && ("next" in body) && typeof body.next === "function")) {
31828
- return {
31829
- bodyHeaders: undefined,
31830
- body: ReadableStreamFrom2(body),
31831
- isStreamingBody: true
31832
- };
30416
+ return { bodyHeaders: undefined, body: ReadableStreamFrom2(body) };
31833
30417
  } else if (typeof body === "object" && headers.values.get("content-type") === "application/x-www-form-urlencoded") {
31834
30418
  return {
31835
30419
  bodyHeaders: { "content-type": "application/x-www-form-urlencoded" },
31836
- body: this.stringifyQuery(body),
31837
- isStreamingBody: false
30420
+ body: this.stringifyQuery(body)
31838
30421
  };
31839
30422
  } else {
31840
- return { ...__classPrivateFieldGet2(this, _OpenAI_encoder, "f").call(this, { body, headers }), isStreamingBody: false };
30423
+ return __classPrivateFieldGet2(this, _OpenAI_encoder, "f").call(this, { body, headers });
31841
30424
  }
31842
30425
  }
31843
30426
  }
@@ -31876,7 +30459,6 @@ OpenAI.Webhooks = Webhooks;
31876
30459
  OpenAI.Beta = Beta2;
31877
30460
  OpenAI.Batches = Batches3;
31878
30461
  OpenAI.Uploads = Uploads;
31879
- OpenAI.Admin = Admin;
31880
30462
  OpenAI.Responses = Responses;
31881
30463
  OpenAI.Realtime = Realtime2;
31882
30464
  OpenAI.Conversations = Conversations;
@@ -31884,23 +30466,6 @@ OpenAI.Evals = Evals;
31884
30466
  OpenAI.Containers = Containers;
31885
30467
  OpenAI.Skills = Skills2;
31886
30468
  OpenAI.Videos = Videos;
31887
- function getConnectionErrorMessage(error3) {
31888
- if (isUndiciDispatcherVersionMismatchError(error3)) {
31889
- return `Connection error. This may be caused by passing an undici dispatcher, such as ProxyAgent, that is incompatible with the fetch implementation. If you are using undici's ProxyAgent, pass the fetch implementation from the same undici package: import { fetch, ProxyAgent } from 'undici'; new OpenAI({ fetch, fetchOptions: { dispatcher: new ProxyAgent(...) } });`;
31890
- }
31891
- return;
31892
- }
31893
- function isUndiciDispatcherVersionMismatchError(error3) {
31894
- let current = error3;
31895
- for (let i = 0;i < 8 && current && typeof current === "object"; i++) {
31896
- const err = current;
31897
- if (err.code === "UND_ERR_INVALID_ARG" && typeof err.message === "string" && err.message.includes("invalid onRequestStart method")) {
31898
- return true;
31899
- }
31900
- current = err.cause;
31901
- }
31902
- return false;
31903
- }
31904
30469
  // node_modules/openai/azure.mjs
31905
30470
  var _deployments_endpoints = new Set([
31906
30471
  "/completions",
@@ -32088,6 +30653,50 @@ function setNestedValue(obj, path3, value) {
32088
30653
  const last = parts[parts.length - 1] ?? "";
32089
30654
  cur[last] = value;
32090
30655
  }
30656
+ function parseToolArguments(value) {
30657
+ if (!value)
30658
+ return;
30659
+ if (typeof value === "object" && !Array.isArray(value)) {
30660
+ return value;
30661
+ }
30662
+ if (typeof value === "string") {
30663
+ try {
30664
+ const parsed = JSON.parse(value);
30665
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
30666
+ } catch {
30667
+ return;
30668
+ }
30669
+ }
30670
+ return;
30671
+ }
30672
+ function normalizeToolCalls(value) {
30673
+ if (!Array.isArray(value))
30674
+ return;
30675
+ const calls = value.flatMap((item) => {
30676
+ if (!item || typeof item !== "object")
30677
+ return [];
30678
+ const record = item;
30679
+ const fn = record["function"];
30680
+ if (fn && typeof fn === "object") {
30681
+ const functionRecord = fn;
30682
+ const name2 = functionRecord["name"];
30683
+ if (typeof name2 !== "string" || !name2)
30684
+ return [];
30685
+ return [{
30686
+ name: name2,
30687
+ arguments: parseToolArguments(functionRecord["arguments"])
30688
+ }];
30689
+ }
30690
+ const name = record["name"] ?? record["toolName"];
30691
+ if (typeof name !== "string" || !name)
30692
+ return [];
30693
+ return [{
30694
+ name,
30695
+ arguments: parseToolArguments(record["arguments"] ?? record["args"])
30696
+ }];
30697
+ });
30698
+ return calls.length > 0 ? calls : undefined;
30699
+ }
32091
30700
  async function callHttpAdapter(config, input, turns) {
32092
30701
  const start = Date.now();
32093
30702
  try {
@@ -32114,6 +30723,22 @@ async function callHttpAdapter(config, input, turns) {
32114
30723
  signal: config.timeoutMs ? AbortSignal.timeout(config.timeoutMs) : undefined
32115
30724
  });
32116
30725
  const durationMs = Date.now() - start;
30726
+ if (!response.ok) {
30727
+ const text = await response.text().catch(() => response.statusText);
30728
+ return {
30729
+ output: "",
30730
+ durationMs,
30731
+ statusCode: response.status,
30732
+ error: `HTTP ${response.status}: ${text.slice(0, 500)}`
30733
+ };
30734
+ }
30735
+ if (config.responseMode === "text") {
30736
+ return {
30737
+ output: await response.text(),
30738
+ durationMs,
30739
+ statusCode: response.status
30740
+ };
30741
+ }
32117
30742
  const data = await response.json();
32118
30743
  let output;
32119
30744
  if (config.outputPath) {
@@ -32124,11 +30749,13 @@ async function callHttpAdapter(config, input, turns) {
32124
30749
  const usage = getNestedValue(data, "usage");
32125
30750
  const inputTokens = Number(usage?.["prompt_tokens"] ?? usage?.["input_tokens"] ?? 0) || undefined;
32126
30751
  const outputTokens = Number(usage?.["completion_tokens"] ?? usage?.["output_tokens"] ?? 0) || undefined;
30752
+ const toolCalls = normalizeToolCalls(getNestedValue(data, "choices.0.message.tool_calls")) ?? normalizeToolCalls(getNestedValue(data, "toolCalls")) ?? normalizeToolCalls(getNestedValue(data, "tool_calls"));
32127
30753
  return {
32128
30754
  output,
32129
30755
  durationMs,
32130
30756
  inputTokens,
32131
30757
  outputTokens,
30758
+ toolCalls,
32132
30759
  statusCode: response.status
32133
30760
  };
32134
30761
  } catch (err) {
@@ -32179,13 +30806,34 @@ async function callAnthropicAdapter(config, input, turns) {
32179
30806
  }
32180
30807
 
32181
30808
  // src/adapters/openai.ts
30809
+ function normalizeBaseURL(baseURL) {
30810
+ if (!baseURL)
30811
+ return;
30812
+ try {
30813
+ const url = new URL(baseURL);
30814
+ if (url.pathname === "" || url.pathname === "/") {
30815
+ url.pathname = "/v1";
30816
+ return url.toString();
30817
+ }
30818
+ } catch {
30819
+ return baseURL;
30820
+ }
30821
+ return baseURL;
30822
+ }
30823
+ function resolveApiKey(config) {
30824
+ if (config.apiKey)
30825
+ return config.apiKey;
30826
+ if (config.baseURL)
30827
+ return "ollama";
30828
+ return process.env["OPENAI_API_KEY"];
30829
+ }
32182
30830
  async function callOpenAIAdapter(config, input, turns) {
32183
30831
  const start = Date.now();
32184
- const client = new OpenAI({
32185
- apiKey: config.apiKey ?? process.env["OPENAI_API_KEY"],
32186
- baseURL: config.baseURL
32187
- });
32188
30832
  try {
30833
+ const client = new OpenAI({
30834
+ apiKey: resolveApiKey(config),
30835
+ baseURL: normalizeBaseURL(config.baseURL)
30836
+ });
32189
30837
  const messages = [];
32190
30838
  if (config.systemPrompt)
32191
30839
  messages.push({ role: "system", content: config.systemPrompt });
@@ -32443,7 +31091,7 @@ async function runEvals(cases, options) {
32443
31091
  id: randomUUID3(),
32444
31092
  createdAt: new Date().toISOString(),
32445
31093
  dataset: options.dataset,
32446
- adapterConfig: options.adapter,
31094
+ adapterConfig: redactAdapterConfig(options.adapter),
32447
31095
  results,
32448
31096
  stats
32449
31097
  };
@@ -32512,7 +31160,7 @@ function printTerminalReport(run) {
32512
31160
  console.log();
32513
31161
  }
32514
31162
  function toJson(run) {
32515
- return JSON.stringify(run, null, 2);
31163
+ return JSON.stringify(redactRunSecrets(run), null, 2);
32516
31164
  }
32517
31165
  function toMarkdown(run) {
32518
31166
  const { results, stats } = run;
@@ -32605,21 +31253,85 @@ function printDiffReport(diff) {
32605
31253
  init_store();
32606
31254
 
32607
31255
  // src/cli/adapter-parser.ts
31256
+ function parsePositiveInteger(value, flag) {
31257
+ if (value === undefined)
31258
+ return;
31259
+ const parsed = Number(value);
31260
+ if (!Number.isInteger(parsed) || parsed <= 0) {
31261
+ throw new Error(`${flag} must be a positive integer`);
31262
+ }
31263
+ return parsed;
31264
+ }
31265
+ function parseHeaders2(value) {
31266
+ if (!value)
31267
+ return;
31268
+ const parsed = JSON.parse(value);
31269
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
31270
+ throw new Error("--headers must be a JSON object");
31271
+ }
31272
+ return Object.fromEntries(Object.entries(parsed).map(([key, headerValue]) => {
31273
+ if (typeof headerValue !== "string") {
31274
+ throw new Error("--headers values must be strings");
31275
+ }
31276
+ return [key, headerValue];
31277
+ }));
31278
+ }
31279
+ function parseHttpMethod(value) {
31280
+ if (!value)
31281
+ return;
31282
+ const method = value.toUpperCase();
31283
+ if (method === "GET" || method === "POST" || method === "PUT" || method === "PATCH") {
31284
+ return method;
31285
+ }
31286
+ throw new Error("--method must be GET, POST, PUT, or PATCH");
31287
+ }
31288
+ function parseResponseMode(value) {
31289
+ if (!value)
31290
+ return;
31291
+ if (value === "json" || value === "text")
31292
+ return value;
31293
+ throw new Error("--response-mode must be json or text");
31294
+ }
32608
31295
  function parseAdapterConfig(opts) {
32609
31296
  const type = opts["adapter"] ?? "http";
31297
+ const apiKey = opts["apiKey"] ?? (opts["apiKeyEnv"] ? process.env[opts["apiKeyEnv"]] : undefined);
32610
31298
  switch (type) {
32611
31299
  case "http":
32612
31300
  if (!opts["url"])
32613
31301
  throw new Error("--url is required for http adapter");
32614
- return { type: "http", url: opts["url"] };
31302
+ return {
31303
+ type: "http",
31304
+ url: opts["url"],
31305
+ method: parseHttpMethod(opts["method"]),
31306
+ headers: parseHeaders2(opts["headers"]),
31307
+ responseMode: parseResponseMode(opts["responseMode"]),
31308
+ inputPath: opts["inputPath"],
31309
+ outputPath: opts["outputPath"],
31310
+ timeoutMs: parsePositiveInteger(opts["timeoutMs"], "--timeout-ms")
31311
+ };
32615
31312
  case "anthropic":
32616
31313
  if (!opts["model"])
32617
31314
  throw new Error("--model is required for anthropic adapter");
32618
- return { type: "anthropic", model: opts["model"], systemPrompt: opts["system"] };
31315
+ const anthropicMaxTokens = parsePositiveInteger(opts["maxTokens"], "--max-tokens");
31316
+ return {
31317
+ type: "anthropic",
31318
+ model: opts["model"],
31319
+ systemPrompt: opts["system"],
31320
+ ...anthropicMaxTokens ? { maxTokens: anthropicMaxTokens } : {},
31321
+ ...apiKey ? { apiKey } : {}
31322
+ };
32619
31323
  case "openai":
32620
31324
  if (!opts["model"])
32621
31325
  throw new Error("--model is required for openai adapter");
32622
- return { type: "openai", model: opts["model"], systemPrompt: opts["system"] };
31326
+ const openAIMaxTokens = parsePositiveInteger(opts["maxTokens"], "--max-tokens");
31327
+ return {
31328
+ type: "openai",
31329
+ model: opts["model"],
31330
+ systemPrompt: opts["system"],
31331
+ ...openAIMaxTokens ? { maxTokens: openAIMaxTokens } : {},
31332
+ baseURL: opts["baseUrl"] ?? opts["url"],
31333
+ ...apiKey ? { apiKey } : {}
31334
+ };
32623
31335
  case "function":
32624
31336
  if (!opts["module"])
32625
31337
  throw new Error("--module is required for function adapter");
@@ -32627,7 +31339,11 @@ function parseAdapterConfig(opts) {
32627
31339
  case "cli":
32628
31340
  if (!opts["command"])
32629
31341
  throw new Error("--command is required for cli adapter");
32630
- return { type: "cli", command: opts["command"] };
31342
+ return {
31343
+ type: "cli",
31344
+ command: opts["command"],
31345
+ timeoutMs: parsePositiveInteger(opts["timeoutMs"], "--timeout-ms")
31346
+ };
32631
31347
  case "mcp":
32632
31348
  if (!opts["mcpCommand"])
32633
31349
  throw new Error("--mcp-command is required for mcp adapter");
@@ -32636,7 +31352,8 @@ function parseAdapterConfig(opts) {
32636
31352
  return {
32637
31353
  type: "mcp",
32638
31354
  command: opts["mcpCommand"].split(" "),
32639
- tool: opts["tool"]
31355
+ tool: opts["tool"],
31356
+ timeoutMs: parsePositiveInteger(opts["timeoutMs"], "--timeout-ms")
32640
31357
  };
32641
31358
  default:
32642
31359
  throw new Error(`Unknown adapter type: ${type}. Use: http|anthropic|openai|mcp|function|cli`);
@@ -32645,7 +31362,7 @@ function parseAdapterConfig(opts) {
32645
31362
 
32646
31363
  // src/cli/commands/run.ts
32647
31364
  function runCommand() {
32648
- return new Command("run").description("Run an eval dataset against your app").argument("<dataset>", "Path to JSONL/JSON dataset or glob pattern").option("--adapter <type>", "Adapter type: http|anthropic|openai|mcp|function|cli", "http").option("--url <url>", "App URL (for http adapter)").option("--model <model>", "Model name (for anthropic/openai adapter)").option("--system <prompt>", "System prompt (for anthropic/openai adapter)").option("--module <path>", "Module path (for function adapter)").option("--export <name>", "Export name (for function adapter, default: default)").option("--command <cmd>", "Shell command (for cli adapter, use {{input}} placeholder)").option("--mcp-command <cmd>", "MCP server command (for mcp adapter)").option("--tool <name>", "MCP tool name (for mcp adapter)").option("--concurrency <n>", "Parallel execution limit", "5").option("--repeat <n>", "Run each case N times (Pass^k metric)", "1").option("--tags <tags>", "Comma-separated tags to filter cases").option("--no-judge", "Skip LLM judge, run assertions only").option("--output <format>", "Output format: terminal|json|markdown", "terminal").option("--save", "Save run to database").option("-j, --json", "Alias for --output json").action(async (dataset, opts) => {
31365
+ return new Command("run").description("Run an eval dataset against your app").argument("<dataset>", "Path to JSONL/JSON dataset or glob pattern").option("--adapter <type>", "Adapter type: http|anthropic|openai|mcp|function|cli", "http").option("--url <url>", "App URL (for http) or OpenAI-compatible base URL").option("--method <method>", "HTTP method: GET|POST|PUT|PATCH").option("--headers <json>", "HTTP headers as a JSON object").option("--response-mode <mode>", "HTTP response parser: json|text").option("--input-path <path>", "HTTP request path for input, e.g. data.query").option("--output-path <path>", "HTTP response path for output, e.g. result.text").option("--timeout-ms <n>", "Adapter timeout in milliseconds").option("--model <model>", "Model name (for anthropic/openai adapter)").option("--max-tokens <n>", "Max output tokens for model adapters").option("--api-key <key>", "Provider API key override").option("--base-url <url>", "OpenAI-compatible base URL").option("--system <prompt>", "System prompt (for anthropic/openai adapter)").option("--api-key-env <name>", "Env var containing provider API key").option("--module <path>", "Module path (for function adapter)").option("--export <name>", "Export name (for function adapter, default: default)").option("--command <cmd>", "Shell command (for cli adapter, use {{input}} placeholder)").option("--mcp-command <cmd>", "MCP server command (for mcp adapter)").option("--tool <name>", "MCP tool name (for mcp adapter)").option("--concurrency <n>", "Parallel execution limit", "5").option("--repeat <n>", "Run each case N times (Pass^k metric)", "1").option("--tags <tags>", "Comma-separated tags to filter cases").option("--no-judge", "Skip LLM judge, run assertions only").option("--output <format>", "Output format: terminal|json|markdown", "terminal").option("--save", "Save run to database").option("-j, --json", "Alias for --output json").action(async (dataset, opts) => {
32649
31366
  const { cases, warnings } = await loadDataset(dataset, {
32650
31367
  tags: opts["tags"] ? opts["tags"].split(",") : undefined
32651
31368
  });
@@ -32685,7 +31402,7 @@ init_loader();
32685
31402
  init_store();
32686
31403
  function ciCommand() {
32687
31404
  const cmd = new Command("ci").description("Run evals in CI mode \u2014 exit non-zero on regression");
32688
- cmd.command("run <dataset>").description("Run and compare to baseline").option("--adapter <type>", "Adapter type: http|anthropic|openai|mcp|function|cli", "http").option("--url <url>", "App URL (for http adapter)").option("--model <model>", "Model name (for anthropic/openai adapter)").option("--system <prompt>", "System prompt (for anthropic/openai adapter)").option("--module <path>", "Module path (for function adapter)").option("--export <name>", "Export name (for function adapter)").option("--command <cmd>", "Shell command (for cli adapter)").option("--mcp-command <cmd>", "MCP server command (for mcp adapter)").option("--tool <name>", "MCP tool name (for mcp adapter)").option("--no-judge", "Skip LLM judge, assertions only").option("--baseline <name>", "Baseline name to compare against", "main").option("--fail-if-regression <pct>", "Fail if score drops by more than N%", "0").option("--output <format>", "Output format: terminal|markdown", "terminal").option("-j, --json", "Output JSON").action(async (dataset, opts) => {
31405
+ cmd.command("run <dataset>").description("Run and compare to baseline").option("--adapter <type>", "Adapter type: http|anthropic|openai|mcp|function|cli", "http").option("--url <url>", "App URL (for http) or OpenAI-compatible base URL").option("--method <method>", "HTTP method: GET|POST|PUT|PATCH").option("--headers <json>", "HTTP headers as a JSON object").option("--response-mode <mode>", "HTTP response parser: json|text").option("--input-path <path>", "HTTP request path for input, e.g. data.query").option("--output-path <path>", "HTTP response path for output, e.g. result.text").option("--timeout-ms <n>", "Adapter timeout in milliseconds").option("--model <model>", "Model name (for anthropic/openai adapter)").option("--max-tokens <n>", "Max output tokens for model adapters").option("--api-key <key>", "Provider API key override").option("--base-url <url>", "OpenAI-compatible base URL").option("--system <prompt>", "System prompt (for anthropic/openai adapter)").option("--api-key-env <name>", "Env var containing provider API key").option("--module <path>", "Module path (for function adapter)").option("--export <name>", "Export name (for function adapter)").option("--command <cmd>", "Shell command (for cli adapter)").option("--mcp-command <cmd>", "MCP server command (for mcp adapter)").option("--tool <name>", "MCP tool name (for mcp adapter)").option("--no-judge", "Skip LLM judge, assertions only").option("--baseline <name>", "Baseline name to compare against", "main").option("--fail-if-regression <pct>", "Fail if score drops by more than N%", "0").option("--output <format>", "Output format: terminal|markdown", "terminal").option("-j, --json", "Output JSON").action(async (dataset, opts) => {
32689
31406
  const { cases } = await loadDataset(dataset);
32690
31407
  const adapter = parseAdapterConfig(opts);
32691
31408
  const run = await runEvals(cases, { dataset, adapter, skipJudge: opts["judge"] === false || opts["noJudge"] === true });
@@ -32990,14 +31707,14 @@ function kappaLabel(k) {
32990
31707
  }
32991
31708
 
32992
31709
  // src/cli/commands/doctor.ts
32993
- import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
31710
+ import { existsSync as existsSync4, readFileSync as readFileSync2 } from "fs";
32994
31711
  import { homedir as homedir4 } from "os";
32995
31712
  import { join as join4 } from "path";
32996
- function resolveApiKey(envVar, secretsPath, secretsKey) {
31713
+ function resolveApiKey2(envVar, secretsPath, secretsKey) {
32997
31714
  if (process.env[envVar])
32998
31715
  return process.env[envVar];
32999
31716
  const fullPath = join4(homedir4(), ".secrets", secretsPath);
33000
- if (existsSync3(fullPath)) {
31717
+ if (existsSync4(fullPath)) {
33001
31718
  try {
33002
31719
  const content = readFileSync2(fullPath, "utf8");
33003
31720
  for (const line of content.split(`
@@ -33018,13 +31735,13 @@ function resolveApiKey(envVar, secretsPath, secretsKey) {
33018
31735
  function doctorCommand() {
33019
31736
  return new Command("doctor").description("Health check \u2014 verify API keys, DB, and config").option("-j, --json", "Output JSON").action(async (opts) => {
33020
31737
  const checks = [];
33021
- const anthropicKey = resolveApiKey("ANTHROPIC_API_KEY", "hasnaxyz/anthropic/live.env", "HASNAXYZ_ANTHROPIC_LIVE_API_KEY");
31738
+ const anthropicKey = resolveApiKey2("ANTHROPIC_API_KEY", "hasnaxyz/anthropic/live.env", "HASNAXYZ_ANTHROPIC_LIVE_API_KEY");
33022
31739
  checks.push({
33023
31740
  name: "ANTHROPIC_API_KEY",
33024
31741
  ok: !!anthropicKey,
33025
31742
  hint: "export ANTHROPIC_API_KEY=<your-key> (or add to ~/.secrets/hasnaxyz/anthropic/live.env)"
33026
31743
  });
33027
- const openaiKey = resolveApiKey("OPENAI_API_KEY", "hasnaxyz/openai/live.env", "HASNAXYZ_OPENAI_LIVE_API_KEY");
31744
+ const openaiKey = resolveApiKey2("OPENAI_API_KEY", "hasnaxyz/openai/live.env", "HASNAXYZ_OPENAI_LIVE_API_KEY");
33028
31745
  checks.push({
33029
31746
  name: "OPENAI_API_KEY (optional)",
33030
31747
  ok: !!openaiKey,
@@ -33042,7 +31759,7 @@ function doctorCommand() {
33042
31759
  }
33043
31760
  try {
33044
31761
  const { loadDataset: loadDataset2 } = await Promise.resolve().then(() => (init_loader(), exports_loader));
33045
- const { existsSync: existsSync4 } = await import("fs");
31762
+ const { existsSync: existsSync5 } = await import("fs");
33046
31763
  const { join: join5 } = await import("path");
33047
31764
  const { homedir: homedir5 } = await import("os");
33048
31765
  const candidates = [
@@ -33052,7 +31769,7 @@ function doctorCommand() {
33052
31769
  join5(import.meta.dir, "../datasets/examples/smoke.jsonl"),
33053
31770
  join5(homedir5(), ".hasna", "evals", "examples", "smoke.jsonl")
33054
31771
  ];
33055
- const found = candidates.find((p) => existsSync4(p));
31772
+ const found = candidates.find((p) => existsSync5(p));
33056
31773
  if (!found)
33057
31774
  throw new Error("not found");
33058
31775
  const { cases } = await loadDataset2(found);
@@ -33087,7 +31804,7 @@ function doctorCommand() {
33087
31804
  }
33088
31805
 
33089
31806
  // src/cli/commands/mcp.ts
33090
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, existsSync as existsSync4 } from "fs";
31807
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, existsSync as existsSync5 } from "fs";
33091
31808
  import { homedir as homedir5 } from "os";
33092
31809
  import { join as join5 } from "path";
33093
31810
  function mcpCommand() {
@@ -33113,7 +31830,7 @@ var ENTRY = { command: "/home/hasna/.bun/bin/evals-mcp", args: [] };
33113
31830
  function registerClaude() {
33114
31831
  const mcpPath = join5(homedir5(), ".claude", "mcp.json");
33115
31832
  let config = {};
33116
- if (existsSync4(mcpPath)) {
31833
+ if (existsSync5(mcpPath)) {
33117
31834
  config = JSON.parse(readFileSync3(mcpPath, "utf8"));
33118
31835
  }
33119
31836
  config.mcpServers = { ...config.mcpServers ?? {}, evals: ENTRY };
@@ -33125,7 +31842,7 @@ function registerClaude() {
33125
31842
  function registerCodex() {
33126
31843
  const cfgPath = join5(homedir5(), ".codex", "config.json");
33127
31844
  let config = {};
33128
- if (existsSync4(cfgPath)) {
31845
+ if (existsSync5(cfgPath)) {
33129
31846
  config = JSON.parse(readFileSync3(cfgPath, "utf8"));
33130
31847
  }
33131
31848
  config.mcpServers = { ...config.mcpServers ?? {}, evals: { type: "stdio", ...ENTRY, env: {} } };
@@ -33136,7 +31853,7 @@ function registerCodex() {
33136
31853
  function registerGemini() {
33137
31854
  const cfgPath = join5(homedir5(), ".gemini", "settings.json");
33138
31855
  let config = {};
33139
- if (existsSync4(cfgPath)) {
31856
+ if (existsSync5(cfgPath)) {
33140
31857
  config = JSON.parse(readFileSync3(cfgPath, "utf8"));
33141
31858
  }
33142
31859
  config.mcpServers = { ...config.mcpServers ?? {}, evals: ENTRY };
@@ -33148,14 +31865,62 @@ function registerGemini() {
33148
31865
  // src/cli/commands/capture.ts
33149
31866
  import { createServer } from "http";
33150
31867
  import { appendFileSync, writeFileSync as writeFileSync3 } from "fs";
31868
+ function readLatestMessageContent(messages) {
31869
+ if (!Array.isArray(messages))
31870
+ return;
31871
+ const latest = messages.at(-1);
31872
+ if (!latest || typeof latest !== "object")
31873
+ return;
31874
+ const content = latest["content"];
31875
+ return typeof content === "string" ? content : undefined;
31876
+ }
31877
+ function readOpenAIContent(response) {
31878
+ const choices = response["choices"];
31879
+ if (!Array.isArray(choices))
31880
+ return;
31881
+ const first = choices[0];
31882
+ if (!first || typeof first !== "object")
31883
+ return;
31884
+ const message = first["message"];
31885
+ if (!message || typeof message !== "object")
31886
+ return;
31887
+ const content = message["content"];
31888
+ return typeof content === "string" ? content : undefined;
31889
+ }
31890
+ function buildCapturedEvalCase(requestBody, responseBody, options = {}) {
31891
+ try {
31892
+ const reqJson = JSON.parse(requestBody);
31893
+ const resJson = JSON.parse(responseBody);
31894
+ const input = String(readLatestMessageContent(reqJson["messages"]) ?? reqJson["input"] ?? requestBody);
31895
+ const responseText = String(readOpenAIContent(resJson) ?? resJson["content"] ?? responseBody);
31896
+ const capturedAt = (options.now ?? new Date).toISOString();
31897
+ const suffix = (options.random ?? Math.random)().toString(36).slice(2, 7);
31898
+ return {
31899
+ id: `captured-${Date.parse(capturedAt)}-${suffix}`,
31900
+ input,
31901
+ expected: "Review and add expected behavior before promoting to eval suite",
31902
+ tags: ["captured", "needs-review"],
31903
+ metadata: {
31904
+ capturedAt,
31905
+ responsePreview: responseText.slice(0, 200)
31906
+ }
31907
+ };
31908
+ } catch {
31909
+ return null;
31910
+ }
31911
+ }
31912
+ function appendCapturedEvalCase(outputPath, evalCase) {
31913
+ appendFileSync(outputPath, JSON.stringify(evalCase) + `
31914
+ `);
31915
+ }
33151
31916
  function captureCommand() {
33152
31917
  return new Command("capture").description("Capture production traffic and write to a staging dataset").requiredOption("--app <url>", "Upstream app URL to proxy to").option("--port <n>", "Proxy port", "19441").option("--rate <n>", "Sampling rate 0.0\u20131.0", "0.1").option("--output <path>", "Output JSONL file", "captured.jsonl").action((opts) => {
33153
31918
  const appUrl = opts["app"] ?? "";
33154
31919
  const port = parseInt(opts["port"] ?? "19441");
33155
31920
  const rate = parseFloat(opts["rate"] ?? "0.1");
33156
- const output = opts["output"] ?? "captured.jsonl";
31921
+ const outputPath = opts["output"] ?? "captured.jsonl";
33157
31922
  let captured = 0;
33158
- writeFileSync3(output, "");
31923
+ writeFileSync3(outputPath, "");
33159
31924
  const server = createServer(async (req, res) => {
33160
31925
  const body = await new Promise((resolve) => {
33161
31926
  let data = "";
@@ -33173,31 +31938,20 @@ function captureCommand() {
33173
31938
  res.writeHead(upstreamRes.status, Object.fromEntries(upstreamRes.headers));
33174
31939
  res.end(responseBody);
33175
31940
  if (Math.random() < rate) {
33176
- try {
33177
- const reqJson = JSON.parse(body);
33178
- const resJson = JSON.parse(responseBody);
33179
- const input = String(reqJson["messages"]?.at(-1)?.content ?? reqJson["input"] ?? body);
33180
- const output2 = String(resJson["choices"]?.[0]?.message?.content ?? resJson["content"] ?? responseBody);
33181
- const evalCase = {
33182
- id: `captured-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
33183
- input,
33184
- expected: "Review and add expected behavior before promoting to eval suite",
33185
- tags: ["captured", "needs-review"],
33186
- metadata: { capturedAt: new Date().toISOString(), responsePreview: output2.slice(0, 200) }
33187
- };
33188
- appendFileSync(output2, JSON.stringify(evalCase) + `
33189
- `);
31941
+ const evalCase = buildCapturedEvalCase(body, responseBody);
31942
+ if (evalCase) {
31943
+ appendCapturedEvalCase(outputPath, evalCase);
33190
31944
  captured++;
33191
31945
  if (captured % 10 === 0)
33192
- console.log(`Captured ${captured} cases \u2192 ${output2}`);
33193
- } catch {}
31946
+ console.log(`Captured ${captured} cases \u2192 ${outputPath}`);
31947
+ }
33194
31948
  }
33195
31949
  });
33196
31950
  server.listen(port, () => {
33197
31951
  console.log(`\x1B[32m\u2713 Capture proxy running on http://localhost:${port}\x1B[0m`);
33198
31952
  console.log(` Forwarding to: ${appUrl}`);
33199
31953
  console.log(` Sampling rate: ${(rate * 100).toFixed(0)}%`);
33200
- console.log(` Output: ${output}`);
31954
+ console.log(` Output: ${outputPath}`);
33201
31955
  console.log(` Ctrl+C to stop
33202
31956
  `);
33203
31957
  });