@hasna/evals 0.1.28 → 0.1.30

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;
@@ -8572,11 +8485,33 @@ __export(exports_store, {
8572
8485
  clearBaseline: () => clearBaseline
8573
8486
  });
8574
8487
  import { Database } from "bun:sqlite";
8575
- import { mkdirSync } from "fs";
8488
+ import { copyFileSync, existsSync as existsSync3, mkdirSync, readdirSync, statSync } from "fs";
8576
8489
  import { homedir as homedir3 } from "os";
8577
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)) {
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() && !existsSync3(newPath))
8506
+ copyFileSync(oldPath, newPath);
8507
+ } catch {}
8508
+ }
8509
+ } catch {}
8510
+ }
8511
+ return join3(newDir, "evals.db");
8512
+ }
8578
8513
  function getDbPath() {
8579
- return process.env["EVALS_DB_PATH"] ?? join3(homedir3(), ".hasna", "evals", "evals.db");
8514
+ return process.env["EVALS_DB_PATH"] ?? defaultDbPath();
8580
8515
  }
8581
8516
  function getDatabase() {
8582
8517
  if (_db)
@@ -8732,24 +8667,24 @@ __export(exports_dist, {
8732
8667
  import { createRequire } from "module";
8733
8668
  import { Database as Database2 } from "bun:sqlite";
8734
8669
  import {
8735
- existsSync as existsSync5,
8670
+ existsSync as existsSync6,
8736
8671
  mkdirSync as mkdirSync2,
8737
- readdirSync,
8738
- copyFileSync
8672
+ readdirSync as readdirSync2,
8673
+ copyFileSync as copyFileSync2
8739
8674
  } from "fs";
8740
8675
  import { homedir as homedir6 } from "os";
8741
8676
  import { join as join6, relative } from "path";
8742
8677
  import { existsSync as existsSync22, mkdirSync as mkdirSync22, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
8743
8678
  import { homedir as homedir22 } from "os";
8744
8679
  import { join as join22 } from "path";
8745
- import { readdirSync as readdirSync3, existsSync as existsSync6 } from "fs";
8680
+ import { readdirSync as readdirSync3, existsSync as existsSync62 } from "fs";
8746
8681
  import { join as join62 } from "path";
8747
8682
  import { homedir as homedir52 } from "os";
8748
8683
  import { hostname } from "os";
8749
8684
  import { existsSync as existsSync32, readFileSync as readFileSync22 } from "fs";
8750
8685
  import { homedir as homedir32 } from "os";
8751
8686
  import { join as join32 } from "path";
8752
- import { existsSync as existsSync42, readdirSync as readdirSync2 } from "fs";
8687
+ import { existsSync as existsSync42, readdirSync as readdirSync22 } from "fs";
8753
8688
  import { join as join42 } from "path";
8754
8689
  import { join as join52, dirname } from "path";
8755
8690
  import { existsSync as existsSync52, writeFileSync as writeFileSync22, unlinkSync, mkdirSync as mkdirSync3 } from "fs";
@@ -9646,9 +9581,9 @@ function getDbPath2(serviceName) {
9646
9581
  function migrateDotfile(serviceName) {
9647
9582
  const legacyDir = join6(homedir6(), `.${serviceName}`);
9648
9583
  const newDir = join6(HASNA_DIR, serviceName);
9649
- if (!existsSync5(legacyDir))
9584
+ if (!existsSync6(legacyDir))
9650
9585
  return [];
9651
- if (existsSync5(newDir))
9586
+ if (existsSync6(newDir))
9652
9587
  return [];
9653
9588
  mkdirSync2(newDir, { recursive: true });
9654
9589
  const migrated = [];
@@ -9656,7 +9591,7 @@ function migrateDotfile(serviceName) {
9656
9591
  return migrated;
9657
9592
  }
9658
9593
  function copyDirRecursive(src, dest, root, migrated) {
9659
- const entries = readdirSync(src, { withFileTypes: true });
9594
+ const entries = readdirSync2(src, { withFileTypes: true });
9660
9595
  for (const entry of entries) {
9661
9596
  const srcPath = join6(src, entry.name);
9662
9597
  const destPath = join6(dest, entry.name);
@@ -9664,13 +9599,13 @@ function copyDirRecursive(src, dest, root, migrated) {
9664
9599
  mkdirSync2(destPath, { recursive: true });
9665
9600
  copyDirRecursive(srcPath, destPath, root, migrated);
9666
9601
  } else {
9667
- copyFileSync(srcPath, destPath);
9602
+ copyFileSync2(srcPath, destPath);
9668
9603
  migrated.push(relative(root, srcPath));
9669
9604
  }
9670
9605
  }
9671
9606
  }
9672
9607
  function hasLegacyDotfile(serviceName) {
9673
- return existsSync5(join6(homedir6(), `.${serviceName}`));
9608
+ return existsSync6(join6(homedir6(), `.${serviceName}`));
9674
9609
  }
9675
9610
  function getHasnaDir() {
9676
9611
  mkdirSync2(HASNA_DIR, { recursive: true });
@@ -9726,7 +9661,7 @@ function isSyncExcludedTable(table) {
9726
9661
  }
9727
9662
  function discoverServices() {
9728
9663
  const dataDir = join62(homedir52(), ".hasna");
9729
- if (!existsSync6(dataDir))
9664
+ if (!existsSync62(dataDir))
9730
9665
  return [];
9731
9666
  try {
9732
9667
  const entries = readdirSync3(dataDir, { withFileTypes: true });
@@ -9748,7 +9683,7 @@ function discoverSyncableServices2() {
9748
9683
  }
9749
9684
  function getServiceDbPath(service) {
9750
9685
  const dataDir = join62(homedir52(), ".hasna", service);
9751
- if (!existsSync6(dataDir))
9686
+ if (!existsSync62(dataDir))
9752
9687
  return null;
9753
9688
  const candidates = [
9754
9689
  join62(dataDir, `${service}.db`),
@@ -9764,7 +9699,7 @@ function getServiceDbPath(service) {
9764
9699
  }
9765
9700
  } catch {}
9766
9701
  for (const p of candidates) {
9767
- if (existsSync6(p))
9702
+ if (existsSync62(p))
9768
9703
  return p;
9769
9704
  }
9770
9705
  return null;
@@ -10792,7 +10727,7 @@ function discoverSyncableServices() {
10792
10727
  const hasnaDir = getHasnaDir();
10793
10728
  const services = [];
10794
10729
  try {
10795
- const entries = readdirSync2(hasnaDir, { withFileTypes: true });
10730
+ const entries = readdirSync22(hasnaDir, { withFileTypes: true });
10796
10731
  for (const entry of entries) {
10797
10732
  if (!entry.isDirectory())
10798
10733
  continue;
@@ -24962,33 +24897,6 @@ class InvalidWebhookSignatureError extends Error {
24962
24897
  }
24963
24898
  }
24964
24899
 
24965
- class OAuthError extends APIError2 {
24966
- constructor(status, error2, headers) {
24967
- let finalMessage = "OAuth2 authentication error";
24968
- let error_code = undefined;
24969
- if (error2 && typeof error2 === "object") {
24970
- const errorData = error2;
24971
- error_code = errorData["error"];
24972
- const description = errorData["error_description"];
24973
- if (description && typeof description === "string") {
24974
- finalMessage = description;
24975
- } else if (error_code) {
24976
- finalMessage = error_code;
24977
- }
24978
- }
24979
- super(status, error2, finalMessage, headers);
24980
- this.error_code = error_code;
24981
- }
24982
- }
24983
-
24984
- class SubjectTokenProviderError extends OpenAIError {
24985
- constructor(message, provider, cause) {
24986
- super(message);
24987
- this.provider = provider;
24988
- this.cause = cause;
24989
- }
24990
- }
24991
-
24992
24900
  // node_modules/openai/internal/utils/values.mjs
24993
24901
  var startsWithSchemeRegexp2 = /^[a-z][a-z0-9+.-]*:/i;
24994
24902
  var isAbsoluteURL2 = (url) => {
@@ -25036,7 +24944,7 @@ var safeJSON2 = (text) => {
25036
24944
  var sleep2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
25037
24945
 
25038
24946
  // node_modules/openai/version.mjs
25039
- var VERSION2 = "6.44.0";
24947
+ var VERSION2 = "6.33.0";
25040
24948
 
25041
24949
  // node_modules/openai/internal/detect-platform.mjs
25042
24950
  var isRunningInBrowser2 = () => {
@@ -25727,7 +25635,7 @@ var formatRequestDetails2 = (details) => {
25727
25635
  if (details.headers) {
25728
25636
  details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
25729
25637
  name,
25730
- 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
25731
25639
  ]));
25732
25640
  }
25733
25641
  if ("retryOfRequestLogID" in details) {
@@ -26208,125 +26116,6 @@ class ConversationCursorPage extends AbstractPage2 {
26208
26116
  }
26209
26117
  }
26210
26118
 
26211
- class NextCursorPage extends AbstractPage2 {
26212
- constructor(client, response, body, options) {
26213
- super(client, response, body, options);
26214
- this.data = body.data || [];
26215
- this.has_more = body.has_more || false;
26216
- this.next = body.next || null;
26217
- }
26218
- getPaginatedItems() {
26219
- return this.data ?? [];
26220
- }
26221
- hasNextPage() {
26222
- if (this.has_more === false) {
26223
- return false;
26224
- }
26225
- return super.hasNextPage();
26226
- }
26227
- nextPageRequestOptions() {
26228
- const cursor = this.next;
26229
- if (!cursor) {
26230
- return null;
26231
- }
26232
- return {
26233
- ...this.options,
26234
- query: {
26235
- ...maybeObj2(this.options.query),
26236
- after: cursor
26237
- }
26238
- };
26239
- }
26240
- }
26241
-
26242
- // node_modules/openai/auth/workload-identity-auth.mjs
26243
- var SUBJECT_TOKEN_TYPES = {
26244
- jwt: "urn:ietf:params:oauth:token-type:jwt",
26245
- id: "urn:ietf:params:oauth:token-type:id_token"
26246
- };
26247
- var TOKEN_EXCHANGE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:token-exchange";
26248
-
26249
- class WorkloadIdentityAuth {
26250
- constructor(config, fetch2) {
26251
- this.cachedToken = null;
26252
- this.refreshPromise = null;
26253
- this.tokenExchangeUrl = "https://auth.openai.com/oauth/token";
26254
- this.config = config;
26255
- this.fetch = fetch2 ?? getDefaultFetch2();
26256
- }
26257
- async getToken() {
26258
- if (!this.cachedToken || this.isTokenExpired(this.cachedToken)) {
26259
- if (this.refreshPromise) {
26260
- return await this.refreshPromise;
26261
- }
26262
- this.refreshPromise = this.refreshToken();
26263
- try {
26264
- const token = await this.refreshPromise;
26265
- return token;
26266
- } finally {
26267
- this.refreshPromise = null;
26268
- }
26269
- }
26270
- if (this.needsRefresh(this.cachedToken) && !this.refreshPromise) {
26271
- this.refreshPromise = this.refreshToken().finally(() => {
26272
- this.refreshPromise = null;
26273
- });
26274
- }
26275
- return this.cachedToken.token;
26276
- }
26277
- async refreshToken() {
26278
- const subjectToken = await this.config.provider.getToken();
26279
- const body = {
26280
- grant_type: TOKEN_EXCHANGE_GRANT_TYPE,
26281
- subject_token: subjectToken,
26282
- subject_token_type: SUBJECT_TOKEN_TYPES[this.config.provider.tokenType],
26283
- identity_provider_id: this.config.identityProviderId,
26284
- service_account_id: this.config.serviceAccountId
26285
- };
26286
- if (this.config.clientId) {
26287
- body["client_id"] = this.config.clientId;
26288
- }
26289
- const response = await this.fetch(this.tokenExchangeUrl, {
26290
- method: "POST",
26291
- headers: {
26292
- "Content-Type": "application/json"
26293
- },
26294
- body: JSON.stringify(body)
26295
- });
26296
- if (!response.ok) {
26297
- const errorText = await response.text();
26298
- let body2 = undefined;
26299
- try {
26300
- body2 = JSON.parse(errorText);
26301
- } catch {}
26302
- if (response.status === 400 || response.status === 401 || response.status === 403) {
26303
- throw new OAuthError(response.status, body2, response.headers);
26304
- }
26305
- throw APIError2.generate(response.status, body2, `Token exchange failed with status ${response.status}`, response.headers);
26306
- }
26307
- const tokenResponse = await response.json();
26308
- const expiresIn = tokenResponse.expires_in || 3600;
26309
- const expiresAt = Date.now() + expiresIn * 1000;
26310
- this.cachedToken = {
26311
- token: tokenResponse.access_token,
26312
- expiresAt
26313
- };
26314
- return tokenResponse.access_token;
26315
- }
26316
- isTokenExpired(cachedToken) {
26317
- return Date.now() >= cachedToken.expiresAt;
26318
- }
26319
- needsRefresh(cachedToken) {
26320
- const bufferSeconds = this.config.refreshBufferSeconds ?? 1200;
26321
- const bufferMs = bufferSeconds * 1000;
26322
- return Date.now() >= cachedToken.expiresAt - bufferMs;
26323
- }
26324
- invalidateToken() {
26325
- this.cachedToken = null;
26326
- this.refreshPromise = null;
26327
- }
26328
- }
26329
-
26330
26119
  // node_modules/openai/internal/uploads.mjs
26331
26120
  var checkFileSupport2 = () => {
26332
26121
  if (typeof File === "undefined") {
@@ -26533,7 +26322,7 @@ var path2 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
26533
26322
  // node_modules/openai/resources/chat/completions/messages.mjs
26534
26323
  class Messages3 extends APIResource2 {
26535
26324
  list(completionID, query = {}, options) {
26536
- 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 });
26537
26326
  }
26538
26327
  }
26539
26328
  // node_modules/openai/lib/parser.mjs
@@ -27030,12 +26819,7 @@ _AbstractChatCompletionRunner_instances = new WeakSet, _AbstractChatCompletionRu
27030
26819
  for (let i = this.messages.length - 1;i >= 0; i--) {
27031
26820
  const message = this.messages[i];
27032
26821
  if (isAssistantMessage(message) && message?.tool_calls?.length) {
27033
- for (let j = message.tool_calls.length - 1;j >= 0; j--) {
27034
- const toolCall = message.tool_calls[j];
27035
- if (toolCall?.type === "function") {
27036
- return toolCall.function;
27037
- }
27038
- }
26822
+ return message.tool_calls.filter((x) => x.type === "function").at(-1)?.function;
27039
26823
  }
27040
26824
  }
27041
26825
  return;
@@ -27799,38 +27583,19 @@ class Completions2 extends APIResource2 {
27799
27583
  this.messages = new Messages3(this._client);
27800
27584
  }
27801
27585
  create(body, options) {
27802
- return this._client.post("/chat/completions", {
27803
- body,
27804
- ...options,
27805
- stream: body.stream ?? false,
27806
- __security: { bearerAuth: true }
27807
- });
27586
+ return this._client.post("/chat/completions", { body, ...options, stream: body.stream ?? false });
27808
27587
  }
27809
27588
  retrieve(completionID, options) {
27810
- return this._client.get(path2`/chat/completions/${completionID}`, {
27811
- ...options,
27812
- __security: { bearerAuth: true }
27813
- });
27589
+ return this._client.get(path2`/chat/completions/${completionID}`, options);
27814
27590
  }
27815
27591
  update(completionID, body, options) {
27816
- return this._client.post(path2`/chat/completions/${completionID}`, {
27817
- body,
27818
- ...options,
27819
- __security: { bearerAuth: true }
27820
- });
27592
+ return this._client.post(path2`/chat/completions/${completionID}`, { body, ...options });
27821
27593
  }
27822
27594
  list(query = {}, options) {
27823
- return this._client.getAPIList("/chat/completions", CursorPage, {
27824
- query,
27825
- ...options,
27826
- __security: { bearerAuth: true }
27827
- });
27595
+ return this._client.getAPIList("/chat/completions", CursorPage, { query, ...options });
27828
27596
  }
27829
27597
  delete(completionID, options) {
27830
- return this._client.delete(path2`/chat/completions/${completionID}`, {
27831
- ...options,
27832
- __security: { bearerAuth: true }
27833
- });
27598
+ return this._client.delete(path2`/chat/completions/${completionID}`, options);
27834
27599
  }
27835
27600
  parse(body, options) {
27836
27601
  validateInputTools(body.tools);
@@ -27862,991 +27627,97 @@ class Chat extends APIResource2 {
27862
27627
  }
27863
27628
  }
27864
27629
  Chat.Completions = Completions2;
27865
- // node_modules/openai/resources/admin/organization/admin-api-keys.mjs
27866
- class AdminAPIKeys extends APIResource2 {
27867
- create(body, options) {
27868
- return this._client.post("/organization/admin_api_keys", {
27869
- body,
27870
- ...options,
27871
- __security: { adminAPIKeyAuth: true }
27872
- });
27873
- }
27874
- retrieve(keyID, options) {
27875
- return this._client.get(path2`/organization/admin_api_keys/${keyID}`, {
27876
- ...options,
27877
- __security: { adminAPIKeyAuth: true }
27878
- });
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;
27879
27642
  }
27880
- list(query = {}, options) {
27881
- return this._client.getAPIList("/organization/admin_api_keys", CursorPage, {
27882
- query,
27883
- ...options,
27884
- __security: { adminAPIKeyAuth: true }
27885
- });
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 ?? {});
27886
27652
  }
27887
- delete(keyID, options) {
27888
- return this._client.delete(path2`/organization/admin_api_keys/${keyID}`, {
27889
- ...options,
27890
- __security: { adminAPIKeyAuth: true }
27891
- });
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
+ }
27892
27668
  }
27893
27669
  }
27894
-
27895
- // node_modules/openai/resources/admin/organization/audit-logs.mjs
27896
- class AuditLogs extends APIResource2 {
27897
- list(query = {}, options) {
27898
- return this._client.getAPIList("/organization/audit_logs", ConversationCursorPage, {
27899
- query,
27900
- ...options,
27901
- __security: { adminAPIKeyAuth: true }
27902
- });
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
+ }
27903
27689
  }
27904
- }
27690
+ return { [brand_privateNullableHeaders2]: true, values: targetHeaders, nulls: nullHeaders };
27691
+ };
27905
27692
 
27906
- // node_modules/openai/resources/admin/organization/certificates.mjs
27907
- class Certificates extends APIResource2 {
27693
+ // node_modules/openai/resources/audio/speech.mjs
27694
+ class Speech extends APIResource2 {
27908
27695
  create(body, options) {
27909
- return this._client.post("/organization/certificates", {
27910
- body,
27911
- ...options,
27912
- __security: { adminAPIKeyAuth: true }
27913
- });
27914
- }
27915
- retrieve(certificateID, query = {}, options) {
27916
- return this._client.get(path2`/organization/certificates/${certificateID}`, {
27917
- query,
27918
- ...options,
27919
- __security: { adminAPIKeyAuth: true }
27920
- });
27921
- }
27922
- update(certificateID, body, options) {
27923
- return this._client.post(path2`/organization/certificates/${certificateID}`, {
27924
- body,
27925
- ...options,
27926
- __security: { adminAPIKeyAuth: true }
27927
- });
27928
- }
27929
- list(query = {}, options) {
27930
- return this._client.getAPIList("/organization/certificates", ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27931
- }
27932
- delete(certificateID, options) {
27933
- return this._client.delete(path2`/organization/certificates/${certificateID}`, {
27934
- ...options,
27935
- __security: { adminAPIKeyAuth: true }
27936
- });
27937
- }
27938
- activate(body, options) {
27939
- return this._client.getAPIList("/organization/certificates/activate", Page2, {
27696
+ return this._client.post("/audio/speech", {
27940
27697
  body,
27941
- method: "post",
27942
27698
  ...options,
27943
- __security: { adminAPIKeyAuth: true }
27699
+ headers: buildHeaders2([{ Accept: "application/octet-stream" }, options?.headers]),
27700
+ __binaryResponse: true
27944
27701
  });
27945
27702
  }
27946
- deactivate(body, options) {
27947
- return this._client.getAPIList("/organization/certificates/deactivate", Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
27948
- }
27949
27703
  }
27950
27704
 
27951
- // node_modules/openai/resources/admin/organization/data-retention.mjs
27952
- class DataRetention extends APIResource2 {
27953
- retrieve(options) {
27954
- return this._client.get("/organization/data_retention", {
27955
- ...options,
27956
- __security: { adminAPIKeyAuth: true }
27957
- });
27958
- }
27959
- update(body, options) {
27960
- return this._client.post("/organization/data_retention", {
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({
27961
27709
  body,
27962
27710
  ...options,
27963
- __security: { adminAPIKeyAuth: true }
27964
- });
27711
+ stream: body.stream ?? false,
27712
+ __metadata: { model: body.model }
27713
+ }, this._client));
27965
27714
  }
27966
27715
  }
27967
27716
 
27968
- // node_modules/openai/resources/admin/organization/invites.mjs
27969
- class Invites extends APIResource2 {
27717
+ // node_modules/openai/resources/audio/translations.mjs
27718
+ class Translations extends APIResource2 {
27970
27719
  create(body, options) {
27971
- return this._client.post("/organization/invites", {
27972
- body,
27973
- ...options,
27974
- __security: { adminAPIKeyAuth: true }
27975
- });
27976
- }
27977
- retrieve(inviteID, options) {
27978
- return this._client.get(path2`/organization/invites/${inviteID}`, {
27979
- ...options,
27980
- __security: { adminAPIKeyAuth: true }
27981
- });
27982
- }
27983
- list(query = {}, options) {
27984
- return this._client.getAPIList("/organization/invites", ConversationCursorPage, {
27985
- query,
27986
- ...options,
27987
- __security: { adminAPIKeyAuth: true }
27988
- });
27989
- }
27990
- delete(inviteID, options) {
27991
- return this._client.delete(path2`/organization/invites/${inviteID}`, {
27992
- ...options,
27993
- __security: { adminAPIKeyAuth: true }
27994
- });
27995
- }
27996
- }
27997
-
27998
- // node_modules/openai/resources/admin/organization/roles.mjs
27999
- class Roles extends APIResource2 {
28000
- create(body, options) {
28001
- return this._client.post("/organization/roles", {
28002
- body,
28003
- ...options,
28004
- __security: { adminAPIKeyAuth: true }
28005
- });
28006
- }
28007
- retrieve(roleID, options) {
28008
- return this._client.get(path2`/organization/roles/${roleID}`, {
28009
- ...options,
28010
- __security: { adminAPIKeyAuth: true }
28011
- });
28012
- }
28013
- update(roleID, body, options) {
28014
- return this._client.post(path2`/organization/roles/${roleID}`, {
28015
- body,
28016
- ...options,
28017
- __security: { adminAPIKeyAuth: true }
28018
- });
28019
- }
28020
- list(query = {}, options) {
28021
- return this._client.getAPIList("/organization/roles", NextCursorPage, {
28022
- query,
28023
- ...options,
28024
- __security: { adminAPIKeyAuth: true }
28025
- });
28026
- }
28027
- delete(roleID, options) {
28028
- return this._client.delete(path2`/organization/roles/${roleID}`, {
28029
- ...options,
28030
- __security: { adminAPIKeyAuth: true }
28031
- });
28032
- }
28033
- }
28034
-
28035
- // node_modules/openai/resources/admin/organization/spend-alerts.mjs
28036
- class SpendAlerts extends APIResource2 {
28037
- create(body, options) {
28038
- return this._client.post("/organization/spend_alerts", {
28039
- body,
28040
- ...options,
28041
- __security: { adminAPIKeyAuth: true }
28042
- });
28043
- }
28044
- retrieve(alertID, options) {
28045
- return this._client.get(path2`/organization/spend_alerts/${alertID}`, {
28046
- ...options,
28047
- __security: { adminAPIKeyAuth: true }
28048
- });
28049
- }
28050
- update(alertID, body, options) {
28051
- return this._client.post(path2`/organization/spend_alerts/${alertID}`, {
28052
- body,
28053
- ...options,
28054
- __security: { adminAPIKeyAuth: true }
28055
- });
28056
- }
28057
- list(query = {}, options) {
28058
- return this._client.getAPIList("/organization/spend_alerts", ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28059
- }
28060
- delete(alertID, options) {
28061
- return this._client.delete(path2`/organization/spend_alerts/${alertID}`, {
28062
- ...options,
28063
- __security: { adminAPIKeyAuth: true }
28064
- });
28065
- }
28066
- }
28067
-
28068
- // node_modules/openai/resources/admin/organization/usage.mjs
28069
- class Usage extends APIResource2 {
28070
- audioSpeeches(query, options) {
28071
- return this._client.get("/organization/usage/audio_speeches", {
28072
- query,
28073
- ...options,
28074
- __security: { adminAPIKeyAuth: true }
28075
- });
28076
- }
28077
- audioTranscriptions(query, options) {
28078
- return this._client.get("/organization/usage/audio_transcriptions", {
28079
- query,
28080
- ...options,
28081
- __security: { adminAPIKeyAuth: true }
28082
- });
28083
- }
28084
- codeInterpreterSessions(query, options) {
28085
- return this._client.get("/organization/usage/code_interpreter_sessions", {
28086
- query,
28087
- ...options,
28088
- __security: { adminAPIKeyAuth: true }
28089
- });
28090
- }
28091
- completions(query, options) {
28092
- return this._client.get("/organization/usage/completions", {
28093
- query,
28094
- ...options,
28095
- __security: { adminAPIKeyAuth: true }
28096
- });
28097
- }
28098
- costs(query, options) {
28099
- return this._client.get("/organization/costs", {
28100
- query,
28101
- ...options,
28102
- __security: { adminAPIKeyAuth: true }
28103
- });
28104
- }
28105
- embeddings(query, options) {
28106
- return this._client.get("/organization/usage/embeddings", {
28107
- query,
28108
- ...options,
28109
- __security: { adminAPIKeyAuth: true }
28110
- });
28111
- }
28112
- fileSearchCalls(query, options) {
28113
- return this._client.get("/organization/usage/file_search_calls", {
28114
- query,
28115
- ...options,
28116
- __security: { adminAPIKeyAuth: true }
28117
- });
28118
- }
28119
- images(query, options) {
28120
- return this._client.get("/organization/usage/images", {
28121
- query,
28122
- ...options,
28123
- __security: { adminAPIKeyAuth: true }
28124
- });
28125
- }
28126
- moderations(query, options) {
28127
- return this._client.get("/organization/usage/moderations", {
28128
- query,
28129
- ...options,
28130
- __security: { adminAPIKeyAuth: true }
28131
- });
28132
- }
28133
- vectorStores(query, options) {
28134
- return this._client.get("/organization/usage/vector_stores", {
28135
- query,
28136
- ...options,
28137
- __security: { adminAPIKeyAuth: true }
28138
- });
28139
- }
28140
- webSearchCalls(query, options) {
28141
- return this._client.get("/organization/usage/web_search_calls", {
28142
- query,
28143
- ...options,
28144
- __security: { adminAPIKeyAuth: true }
28145
- });
28146
- }
28147
- }
28148
-
28149
- // node_modules/openai/resources/admin/organization/groups/roles.mjs
28150
- class Roles2 extends APIResource2 {
28151
- create(groupID, body, options) {
28152
- return this._client.post(path2`/organization/groups/${groupID}/roles`, {
28153
- body,
28154
- ...options,
28155
- __security: { adminAPIKeyAuth: true }
28156
- });
28157
- }
28158
- retrieve(roleID, params, options) {
28159
- const { group_id } = params;
28160
- return this._client.get(path2`/organization/groups/${group_id}/roles/${roleID}`, {
28161
- ...options,
28162
- __security: { adminAPIKeyAuth: true }
28163
- });
28164
- }
28165
- list(groupID, query = {}, options) {
28166
- return this._client.getAPIList(path2`/organization/groups/${groupID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28167
- }
28168
- delete(roleID, params, options) {
28169
- const { group_id } = params;
28170
- return this._client.delete(path2`/organization/groups/${group_id}/roles/${roleID}`, {
28171
- ...options,
28172
- __security: { adminAPIKeyAuth: true }
28173
- });
28174
- }
28175
- }
28176
-
28177
- // node_modules/openai/resources/admin/organization/groups/users.mjs
28178
- class Users extends APIResource2 {
28179
- create(groupID, body, options) {
28180
- return this._client.post(path2`/organization/groups/${groupID}/users`, {
28181
- body,
28182
- ...options,
28183
- __security: { adminAPIKeyAuth: true }
28184
- });
28185
- }
28186
- retrieve(userID, params, options) {
28187
- const { group_id } = params;
28188
- return this._client.get(path2`/organization/groups/${group_id}/users/${userID}`, {
28189
- ...options,
28190
- __security: { adminAPIKeyAuth: true }
28191
- });
28192
- }
28193
- list(groupID, query = {}, options) {
28194
- return this._client.getAPIList(path2`/organization/groups/${groupID}/users`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28195
- }
28196
- delete(userID, params, options) {
28197
- const { group_id } = params;
28198
- return this._client.delete(path2`/organization/groups/${group_id}/users/${userID}`, {
28199
- ...options,
28200
- __security: { adminAPIKeyAuth: true }
28201
- });
28202
- }
28203
- }
28204
-
28205
- // node_modules/openai/resources/admin/organization/groups/groups.mjs
28206
- class Groups extends APIResource2 {
28207
- constructor() {
28208
- super(...arguments);
28209
- this.users = new Users(this._client);
28210
- this.roles = new Roles2(this._client);
28211
- }
28212
- create(body, options) {
28213
- return this._client.post("/organization/groups", {
28214
- body,
28215
- ...options,
28216
- __security: { adminAPIKeyAuth: true }
28217
- });
28218
- }
28219
- retrieve(groupID, options) {
28220
- return this._client.get(path2`/organization/groups/${groupID}`, {
28221
- ...options,
28222
- __security: { adminAPIKeyAuth: true }
28223
- });
28224
- }
28225
- update(groupID, body, options) {
28226
- return this._client.post(path2`/organization/groups/${groupID}`, {
28227
- body,
28228
- ...options,
28229
- __security: { adminAPIKeyAuth: true }
28230
- });
28231
- }
28232
- list(query = {}, options) {
28233
- return this._client.getAPIList("/organization/groups", NextCursorPage, {
28234
- query,
28235
- ...options,
28236
- __security: { adminAPIKeyAuth: true }
28237
- });
28238
- }
28239
- delete(groupID, options) {
28240
- return this._client.delete(path2`/organization/groups/${groupID}`, {
28241
- ...options,
28242
- __security: { adminAPIKeyAuth: true }
28243
- });
28244
- }
28245
- }
28246
- Groups.Users = Users;
28247
- Groups.Roles = Roles2;
28248
-
28249
- // node_modules/openai/resources/admin/organization/projects/api-keys.mjs
28250
- class APIKeys extends APIResource2 {
28251
- retrieve(apiKeyID, params, options) {
28252
- const { project_id } = params;
28253
- return this._client.get(path2`/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
28254
- ...options,
28255
- __security: { adminAPIKeyAuth: true }
28256
- });
28257
- }
28258
- list(projectID, query = {}, options) {
28259
- return this._client.getAPIList(path2`/organization/projects/${projectID}/api_keys`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28260
- }
28261
- delete(apiKeyID, params, options) {
28262
- const { project_id } = params;
28263
- return this._client.delete(path2`/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
28264
- ...options,
28265
- __security: { adminAPIKeyAuth: true }
28266
- });
28267
- }
28268
- }
28269
-
28270
- // node_modules/openai/resources/admin/organization/projects/certificates.mjs
28271
- class Certificates2 extends APIResource2 {
28272
- list(projectID, query = {}, options) {
28273
- return this._client.getAPIList(path2`/organization/projects/${projectID}/certificates`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28274
- }
28275
- activate(projectID, body, options) {
28276
- return this._client.getAPIList(path2`/organization/projects/${projectID}/certificates/activate`, Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
28277
- }
28278
- deactivate(projectID, body, options) {
28279
- return this._client.getAPIList(path2`/organization/projects/${projectID}/certificates/deactivate`, Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
28280
- }
28281
- }
28282
-
28283
- // node_modules/openai/resources/admin/organization/projects/data-retention.mjs
28284
- class DataRetention2 extends APIResource2 {
28285
- retrieve(projectID, options) {
28286
- return this._client.get(path2`/organization/projects/${projectID}/data_retention`, {
28287
- ...options,
28288
- __security: { adminAPIKeyAuth: true }
28289
- });
28290
- }
28291
- update(projectID, body, options) {
28292
- return this._client.post(path2`/organization/projects/${projectID}/data_retention`, {
28293
- body,
28294
- ...options,
28295
- __security: { adminAPIKeyAuth: true }
28296
- });
28297
- }
28298
- }
28299
-
28300
- // node_modules/openai/resources/admin/organization/projects/hosted-tool-permissions.mjs
28301
- class HostedToolPermissions extends APIResource2 {
28302
- retrieve(projectID, options) {
28303
- return this._client.get(path2`/organization/projects/${projectID}/hosted_tool_permissions`, {
28304
- ...options,
28305
- __security: { adminAPIKeyAuth: true }
28306
- });
28307
- }
28308
- update(projectID, body, options) {
28309
- return this._client.post(path2`/organization/projects/${projectID}/hosted_tool_permissions`, {
28310
- body,
28311
- ...options,
28312
- __security: { adminAPIKeyAuth: true }
28313
- });
28314
- }
28315
- }
28316
-
28317
- // node_modules/openai/resources/admin/organization/projects/model-permissions.mjs
28318
- class ModelPermissions extends APIResource2 {
28319
- retrieve(projectID, options) {
28320
- return this._client.get(path2`/organization/projects/${projectID}/model_permissions`, {
28321
- ...options,
28322
- __security: { adminAPIKeyAuth: true }
28323
- });
28324
- }
28325
- update(projectID, body, options) {
28326
- return this._client.post(path2`/organization/projects/${projectID}/model_permissions`, {
28327
- body,
28328
- ...options,
28329
- __security: { adminAPIKeyAuth: true }
28330
- });
28331
- }
28332
- delete(projectID, options) {
28333
- return this._client.delete(path2`/organization/projects/${projectID}/model_permissions`, {
28334
- ...options,
28335
- __security: { adminAPIKeyAuth: true }
28336
- });
28337
- }
28338
- }
28339
-
28340
- // node_modules/openai/resources/admin/organization/projects/rate-limits.mjs
28341
- class RateLimits extends APIResource2 {
28342
- listRateLimits(projectID, query = {}, options) {
28343
- return this._client.getAPIList(path2`/organization/projects/${projectID}/rate_limits`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28344
- }
28345
- updateRateLimit(rateLimitID, params, options) {
28346
- const { project_id, ...body } = params;
28347
- return this._client.post(path2`/organization/projects/${project_id}/rate_limits/${rateLimitID}`, {
28348
- body,
28349
- ...options,
28350
- __security: { adminAPIKeyAuth: true }
28351
- });
28352
- }
28353
- }
28354
-
28355
- // node_modules/openai/resources/admin/organization/projects/roles.mjs
28356
- class Roles3 extends APIResource2 {
28357
- create(projectID, body, options) {
28358
- return this._client.post(path2`/projects/${projectID}/roles`, {
28359
- body,
28360
- ...options,
28361
- __security: { adminAPIKeyAuth: true }
28362
- });
28363
- }
28364
- retrieve(roleID, params, options) {
28365
- const { project_id } = params;
28366
- return this._client.get(path2`/projects/${project_id}/roles/${roleID}`, {
28367
- ...options,
28368
- __security: { adminAPIKeyAuth: true }
28369
- });
28370
- }
28371
- update(roleID, params, options) {
28372
- const { project_id, ...body } = params;
28373
- return this._client.post(path2`/projects/${project_id}/roles/${roleID}`, {
28374
- body,
28375
- ...options,
28376
- __security: { adminAPIKeyAuth: true }
28377
- });
28378
- }
28379
- list(projectID, query = {}, options) {
28380
- return this._client.getAPIList(path2`/projects/${projectID}/roles`, NextCursorPage, {
28381
- query,
28382
- ...options,
28383
- __security: { adminAPIKeyAuth: true }
28384
- });
28385
- }
28386
- delete(roleID, params, options) {
28387
- const { project_id } = params;
28388
- return this._client.delete(path2`/projects/${project_id}/roles/${roleID}`, {
28389
- ...options,
28390
- __security: { adminAPIKeyAuth: true }
28391
- });
28392
- }
28393
- }
28394
-
28395
- // node_modules/openai/resources/admin/organization/projects/service-accounts.mjs
28396
- class ServiceAccounts extends APIResource2 {
28397
- create(projectID, body, options) {
28398
- return this._client.post(path2`/organization/projects/${projectID}/service_accounts`, {
28399
- body,
28400
- ...options,
28401
- __security: { adminAPIKeyAuth: true }
28402
- });
28403
- }
28404
- retrieve(serviceAccountID, params, options) {
28405
- const { project_id } = params;
28406
- return this._client.get(path2`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
28407
- ...options,
28408
- __security: { adminAPIKeyAuth: true }
28409
- });
28410
- }
28411
- update(serviceAccountID, params, options) {
28412
- const { project_id, ...body } = params;
28413
- return this._client.post(path2`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { body, ...options, __security: { adminAPIKeyAuth: true } });
28414
- }
28415
- list(projectID, query = {}, options) {
28416
- return this._client.getAPIList(path2`/organization/projects/${projectID}/service_accounts`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28417
- }
28418
- delete(serviceAccountID, params, options) {
28419
- const { project_id } = params;
28420
- return this._client.delete(path2`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { ...options, __security: { adminAPIKeyAuth: true } });
28421
- }
28422
- }
28423
-
28424
- // node_modules/openai/resources/admin/organization/projects/spend-alerts.mjs
28425
- class SpendAlerts2 extends APIResource2 {
28426
- create(projectID, body, options) {
28427
- return this._client.post(path2`/organization/projects/${projectID}/spend_alerts`, {
28428
- body,
28429
- ...options,
28430
- __security: { adminAPIKeyAuth: true }
28431
- });
28432
- }
28433
- retrieve(alertID, params, options) {
28434
- const { project_id } = params;
28435
- return this._client.get(path2`/organization/projects/${project_id}/spend_alerts/${alertID}`, {
28436
- ...options,
28437
- __security: { adminAPIKeyAuth: true }
28438
- });
28439
- }
28440
- update(alertID, params, options) {
28441
- const { project_id, ...body } = params;
28442
- return this._client.post(path2`/organization/projects/${project_id}/spend_alerts/${alertID}`, {
28443
- body,
28444
- ...options,
28445
- __security: { adminAPIKeyAuth: true }
28446
- });
28447
- }
28448
- list(projectID, query = {}, options) {
28449
- return this._client.getAPIList(path2`/organization/projects/${projectID}/spend_alerts`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28450
- }
28451
- delete(alertID, params, options) {
28452
- const { project_id } = params;
28453
- return this._client.delete(path2`/organization/projects/${project_id}/spend_alerts/${alertID}`, {
28454
- ...options,
28455
- __security: { adminAPIKeyAuth: true }
28456
- });
28457
- }
28458
- }
28459
-
28460
- // node_modules/openai/resources/admin/organization/projects/groups/roles.mjs
28461
- class Roles4 extends APIResource2 {
28462
- create(groupID, params, options) {
28463
- const { project_id, ...body } = params;
28464
- return this._client.post(path2`/projects/${project_id}/groups/${groupID}/roles`, {
28465
- body,
28466
- ...options,
28467
- __security: { adminAPIKeyAuth: true }
28468
- });
28469
- }
28470
- retrieve(roleID, params, options) {
28471
- const { project_id, group_id } = params;
28472
- return this._client.get(path2`/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
28473
- ...options,
28474
- __security: { adminAPIKeyAuth: true }
28475
- });
28476
- }
28477
- list(groupID, params, options) {
28478
- const { project_id, ...query } = params;
28479
- return this._client.getAPIList(path2`/projects/${project_id}/groups/${groupID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28480
- }
28481
- delete(roleID, params, options) {
28482
- const { project_id, group_id } = params;
28483
- return this._client.delete(path2`/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
28484
- ...options,
28485
- __security: { adminAPIKeyAuth: true }
28486
- });
28487
- }
28488
- }
28489
-
28490
- // node_modules/openai/resources/admin/organization/projects/groups/groups.mjs
28491
- class Groups2 extends APIResource2 {
28492
- constructor() {
28493
- super(...arguments);
28494
- this.roles = new Roles4(this._client);
28495
- }
28496
- create(projectID, body, options) {
28497
- return this._client.post(path2`/organization/projects/${projectID}/groups`, {
28498
- body,
28499
- ...options,
28500
- __security: { adminAPIKeyAuth: true }
28501
- });
28502
- }
28503
- retrieve(groupID, params, options) {
28504
- const { project_id, ...query } = params;
28505
- return this._client.get(path2`/organization/projects/${project_id}/groups/${groupID}`, {
28506
- query,
28507
- ...options,
28508
- __security: { adminAPIKeyAuth: true }
28509
- });
28510
- }
28511
- list(projectID, query = {}, options) {
28512
- return this._client.getAPIList(path2`/organization/projects/${projectID}/groups`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28513
- }
28514
- delete(groupID, params, options) {
28515
- const { project_id } = params;
28516
- return this._client.delete(path2`/organization/projects/${project_id}/groups/${groupID}`, {
28517
- ...options,
28518
- __security: { adminAPIKeyAuth: true }
28519
- });
28520
- }
28521
- }
28522
- Groups2.Roles = Roles4;
28523
-
28524
- // node_modules/openai/resources/admin/organization/projects/users/roles.mjs
28525
- class Roles5 extends APIResource2 {
28526
- create(userID, params, options) {
28527
- const { project_id, ...body } = params;
28528
- return this._client.post(path2`/projects/${project_id}/users/${userID}/roles`, {
28529
- body,
28530
- ...options,
28531
- __security: { adminAPIKeyAuth: true }
28532
- });
28533
- }
28534
- retrieve(roleID, params, options) {
28535
- const { project_id, user_id } = params;
28536
- return this._client.get(path2`/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
28537
- ...options,
28538
- __security: { adminAPIKeyAuth: true }
28539
- });
28540
- }
28541
- list(userID, params, options) {
28542
- const { project_id, ...query } = params;
28543
- return this._client.getAPIList(path2`/projects/${project_id}/users/${userID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28544
- }
28545
- delete(roleID, params, options) {
28546
- const { project_id, user_id } = params;
28547
- return this._client.delete(path2`/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
28548
- ...options,
28549
- __security: { adminAPIKeyAuth: true }
28550
- });
28551
- }
28552
- }
28553
-
28554
- // node_modules/openai/resources/admin/organization/projects/users/users.mjs
28555
- class Users2 extends APIResource2 {
28556
- constructor() {
28557
- super(...arguments);
28558
- this.roles = new Roles5(this._client);
28559
- }
28560
- create(projectID, body, options) {
28561
- return this._client.post(path2`/organization/projects/${projectID}/users`, {
28562
- body,
28563
- ...options,
28564
- __security: { adminAPIKeyAuth: true }
28565
- });
28566
- }
28567
- retrieve(userID, params, options) {
28568
- const { project_id } = params;
28569
- return this._client.get(path2`/organization/projects/${project_id}/users/${userID}`, {
28570
- ...options,
28571
- __security: { adminAPIKeyAuth: true }
28572
- });
28573
- }
28574
- update(userID, params, options) {
28575
- const { project_id, ...body } = params;
28576
- return this._client.post(path2`/organization/projects/${project_id}/users/${userID}`, {
28577
- body,
28578
- ...options,
28579
- __security: { adminAPIKeyAuth: true }
28580
- });
28581
- }
28582
- list(projectID, query = {}, options) {
28583
- return this._client.getAPIList(path2`/organization/projects/${projectID}/users`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28584
- }
28585
- delete(userID, params, options) {
28586
- const { project_id } = params;
28587
- return this._client.delete(path2`/organization/projects/${project_id}/users/${userID}`, {
28588
- ...options,
28589
- __security: { adminAPIKeyAuth: true }
28590
- });
28591
- }
28592
- }
28593
- Users2.Roles = Roles5;
28594
-
28595
- // node_modules/openai/resources/admin/organization/projects/projects.mjs
28596
- class Projects extends APIResource2 {
28597
- constructor() {
28598
- super(...arguments);
28599
- this.users = new Users2(this._client);
28600
- this.serviceAccounts = new ServiceAccounts(this._client);
28601
- this.apiKeys = new APIKeys(this._client);
28602
- this.rateLimits = new RateLimits(this._client);
28603
- this.modelPermissions = new ModelPermissions(this._client);
28604
- this.hostedToolPermissions = new HostedToolPermissions(this._client);
28605
- this.groups = new Groups2(this._client);
28606
- this.roles = new Roles3(this._client);
28607
- this.dataRetention = new DataRetention2(this._client);
28608
- this.spendAlerts = new SpendAlerts2(this._client);
28609
- this.certificates = new Certificates2(this._client);
28610
- }
28611
- create(body, options) {
28612
- return this._client.post("/organization/projects", {
28613
- body,
28614
- ...options,
28615
- __security: { adminAPIKeyAuth: true }
28616
- });
28617
- }
28618
- retrieve(projectID, options) {
28619
- return this._client.get(path2`/organization/projects/${projectID}`, {
28620
- ...options,
28621
- __security: { adminAPIKeyAuth: true }
28622
- });
28623
- }
28624
- update(projectID, body, options) {
28625
- return this._client.post(path2`/organization/projects/${projectID}`, {
28626
- body,
28627
- ...options,
28628
- __security: { adminAPIKeyAuth: true }
28629
- });
28630
- }
28631
- list(query = {}, options) {
28632
- return this._client.getAPIList("/organization/projects", ConversationCursorPage, {
28633
- query,
28634
- ...options,
28635
- __security: { adminAPIKeyAuth: true }
28636
- });
28637
- }
28638
- archive(projectID, options) {
28639
- return this._client.post(path2`/organization/projects/${projectID}/archive`, {
28640
- ...options,
28641
- __security: { adminAPIKeyAuth: true }
28642
- });
28643
- }
28644
- }
28645
- Projects.Users = Users2;
28646
- Projects.ServiceAccounts = ServiceAccounts;
28647
- Projects.APIKeys = APIKeys;
28648
- Projects.RateLimits = RateLimits;
28649
- Projects.ModelPermissions = ModelPermissions;
28650
- Projects.HostedToolPermissions = HostedToolPermissions;
28651
- Projects.Groups = Groups2;
28652
- Projects.Roles = Roles3;
28653
- Projects.DataRetention = DataRetention2;
28654
- Projects.SpendAlerts = SpendAlerts2;
28655
- Projects.Certificates = Certificates2;
28656
-
28657
- // node_modules/openai/resources/admin/organization/users/roles.mjs
28658
- class Roles6 extends APIResource2 {
28659
- create(userID, body, options) {
28660
- return this._client.post(path2`/organization/users/${userID}/roles`, {
28661
- body,
28662
- ...options,
28663
- __security: { adminAPIKeyAuth: true }
28664
- });
28665
- }
28666
- retrieve(roleID, params, options) {
28667
- const { user_id } = params;
28668
- return this._client.get(path2`/organization/users/${user_id}/roles/${roleID}`, {
28669
- ...options,
28670
- __security: { adminAPIKeyAuth: true }
28671
- });
28672
- }
28673
- list(userID, query = {}, options) {
28674
- return this._client.getAPIList(path2`/organization/users/${userID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
28675
- }
28676
- delete(roleID, params, options) {
28677
- const { user_id } = params;
28678
- return this._client.delete(path2`/organization/users/${user_id}/roles/${roleID}`, {
28679
- ...options,
28680
- __security: { adminAPIKeyAuth: true }
28681
- });
28682
- }
28683
- }
28684
-
28685
- // node_modules/openai/resources/admin/organization/users/users.mjs
28686
- class Users3 extends APIResource2 {
28687
- constructor() {
28688
- super(...arguments);
28689
- this.roles = new Roles6(this._client);
28690
- }
28691
- retrieve(userID, options) {
28692
- return this._client.get(path2`/organization/users/${userID}`, {
28693
- ...options,
28694
- __security: { adminAPIKeyAuth: true }
28695
- });
28696
- }
28697
- update(userID, body, options) {
28698
- return this._client.post(path2`/organization/users/${userID}`, {
28699
- body,
28700
- ...options,
28701
- __security: { adminAPIKeyAuth: true }
28702
- });
28703
- }
28704
- list(query = {}, options) {
28705
- return this._client.getAPIList("/organization/users", ConversationCursorPage, {
28706
- query,
28707
- ...options,
28708
- __security: { adminAPIKeyAuth: true }
28709
- });
28710
- }
28711
- delete(userID, options) {
28712
- return this._client.delete(path2`/organization/users/${userID}`, {
28713
- ...options,
28714
- __security: { adminAPIKeyAuth: true }
28715
- });
28716
- }
28717
- }
28718
- Users3.Roles = Roles6;
28719
-
28720
- // node_modules/openai/resources/admin/organization/organization.mjs
28721
- class Organization extends APIResource2 {
28722
- constructor() {
28723
- super(...arguments);
28724
- this.auditLogs = new AuditLogs(this._client);
28725
- this.adminAPIKeys = new AdminAPIKeys(this._client);
28726
- this.usage = new Usage(this._client);
28727
- this.invites = new Invites(this._client);
28728
- this.users = new Users3(this._client);
28729
- this.groups = new Groups(this._client);
28730
- this.roles = new Roles(this._client);
28731
- this.dataRetention = new DataRetention(this._client);
28732
- this.spendAlerts = new SpendAlerts(this._client);
28733
- this.certificates = new Certificates(this._client);
28734
- this.projects = new Projects(this._client);
28735
- }
28736
- }
28737
- Organization.AuditLogs = AuditLogs;
28738
- Organization.AdminAPIKeys = AdminAPIKeys;
28739
- Organization.Usage = Usage;
28740
- Organization.Invites = Invites;
28741
- Organization.Users = Users3;
28742
- Organization.Groups = Groups;
28743
- Organization.Roles = Roles;
28744
- Organization.DataRetention = DataRetention;
28745
- Organization.SpendAlerts = SpendAlerts;
28746
- Organization.Certificates = Certificates;
28747
- Organization.Projects = Projects;
28748
-
28749
- // node_modules/openai/resources/admin/admin.mjs
28750
- class Admin extends APIResource2 {
28751
- constructor() {
28752
- super(...arguments);
28753
- this.organization = new Organization(this._client);
28754
- }
28755
- }
28756
- Admin.Organization = Organization;
28757
- // node_modules/openai/internal/headers.mjs
28758
- var brand_privateNullableHeaders2 = /* @__PURE__ */ Symbol("brand.privateNullableHeaders");
28759
- function* iterateHeaders2(headers) {
28760
- if (!headers)
28761
- return;
28762
- if (brand_privateNullableHeaders2 in headers) {
28763
- const { values, nulls } = headers;
28764
- yield* values.entries();
28765
- for (const name of nulls) {
28766
- yield [name, null];
28767
- }
28768
- return;
28769
- }
28770
- let shouldClear = false;
28771
- let iter;
28772
- if (headers instanceof Headers) {
28773
- iter = headers.entries();
28774
- } else if (isReadonlyArray2(headers)) {
28775
- iter = headers;
28776
- } else {
28777
- shouldClear = true;
28778
- iter = Object.entries(headers ?? {});
28779
- }
28780
- for (let row of iter) {
28781
- const name = row[0];
28782
- if (typeof name !== "string")
28783
- throw new TypeError("expected header name to be a string");
28784
- const values = isReadonlyArray2(row[1]) ? row[1] : [row[1]];
28785
- let didClear = false;
28786
- for (const value of values) {
28787
- if (value === undefined)
28788
- continue;
28789
- if (shouldClear && !didClear) {
28790
- didClear = true;
28791
- yield [name, null];
28792
- }
28793
- yield [name, value];
28794
- }
28795
- }
28796
- }
28797
- var buildHeaders2 = (newHeaders) => {
28798
- const targetHeaders = new Headers;
28799
- const nullHeaders = new Set;
28800
- for (const headers of newHeaders) {
28801
- const seenHeaders = new Set;
28802
- for (const [name, value] of iterateHeaders2(headers)) {
28803
- const lowerName = name.toLowerCase();
28804
- if (!seenHeaders.has(lowerName)) {
28805
- targetHeaders.delete(name);
28806
- seenHeaders.add(lowerName);
28807
- }
28808
- if (value === null) {
28809
- targetHeaders.delete(name);
28810
- nullHeaders.add(lowerName);
28811
- } else {
28812
- targetHeaders.append(name, value);
28813
- nullHeaders.delete(lowerName);
28814
- }
28815
- }
28816
- }
28817
- return { [brand_privateNullableHeaders2]: true, values: targetHeaders, nulls: nullHeaders };
28818
- };
28819
-
28820
- // node_modules/openai/resources/audio/speech.mjs
28821
- class Speech extends APIResource2 {
28822
- create(body, options) {
28823
- return this._client.post("/audio/speech", {
28824
- body,
28825
- ...options,
28826
- headers: buildHeaders2([{ Accept: "application/octet-stream" }, options?.headers]),
28827
- __security: { bearerAuth: true },
28828
- __binaryResponse: true
28829
- });
28830
- }
28831
- }
28832
-
28833
- // node_modules/openai/resources/audio/transcriptions.mjs
28834
- class Transcriptions extends APIResource2 {
28835
- create(body, options) {
28836
- return this._client.post("/audio/transcriptions", multipartFormRequestOptions2({
28837
- body,
28838
- ...options,
28839
- stream: body.stream ?? false,
28840
- __metadata: { model: body.model },
28841
- __security: { bearerAuth: true }
28842
- }, this._client));
28843
- }
28844
- }
28845
-
28846
- // node_modules/openai/resources/audio/translations.mjs
28847
- class Translations extends APIResource2 {
28848
- create(body, options) {
28849
- return this._client.post("/audio/translations", multipartFormRequestOptions2({ body, ...options, __metadata: { model: body.model }, __security: { bearerAuth: true } }, this._client));
27720
+ return this._client.post("/audio/translations", multipartFormRequestOptions2({ body, ...options, __metadata: { model: body.model } }, this._client));
28850
27721
  }
28851
27722
  }
28852
27723
 
@@ -28865,23 +27736,16 @@ Audio.Speech = Speech;
28865
27736
  // node_modules/openai/resources/batches.mjs
28866
27737
  class Batches3 extends APIResource2 {
28867
27738
  create(body, options) {
28868
- return this._client.post("/batches", { body, ...options, __security: { bearerAuth: true } });
27739
+ return this._client.post("/batches", { body, ...options });
28869
27740
  }
28870
27741
  retrieve(batchID, options) {
28871
- return this._client.get(path2`/batches/${batchID}`, { ...options, __security: { bearerAuth: true } });
27742
+ return this._client.get(path2`/batches/${batchID}`, options);
28872
27743
  }
28873
27744
  list(query = {}, options) {
28874
- return this._client.getAPIList("/batches", CursorPage, {
28875
- query,
28876
- ...options,
28877
- __security: { bearerAuth: true }
28878
- });
27745
+ return this._client.getAPIList("/batches", CursorPage, { query, ...options });
28879
27746
  }
28880
27747
  cancel(batchID, options) {
28881
- return this._client.post(path2`/batches/${batchID}/cancel`, {
28882
- ...options,
28883
- __security: { bearerAuth: true }
28884
- });
27748
+ return this._client.post(path2`/batches/${batchID}/cancel`, options);
28885
27749
  }
28886
27750
  }
28887
27751
  // node_modules/openai/resources/beta/assistants.mjs
@@ -28890,38 +27754,33 @@ class Assistants extends APIResource2 {
28890
27754
  return this._client.post("/assistants", {
28891
27755
  body,
28892
27756
  ...options,
28893
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28894
- __security: { bearerAuth: true }
27757
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28895
27758
  });
28896
27759
  }
28897
27760
  retrieve(assistantID, options) {
28898
27761
  return this._client.get(path2`/assistants/${assistantID}`, {
28899
27762
  ...options,
28900
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28901
- __security: { bearerAuth: true }
27763
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28902
27764
  });
28903
27765
  }
28904
27766
  update(assistantID, body, options) {
28905
27767
  return this._client.post(path2`/assistants/${assistantID}`, {
28906
27768
  body,
28907
27769
  ...options,
28908
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28909
- __security: { bearerAuth: true }
27770
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28910
27771
  });
28911
27772
  }
28912
27773
  list(query = {}, options) {
28913
27774
  return this._client.getAPIList("/assistants", CursorPage, {
28914
27775
  query,
28915
27776
  ...options,
28916
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28917
- __security: { bearerAuth: true }
27777
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28918
27778
  });
28919
27779
  }
28920
27780
  delete(assistantID, options) {
28921
27781
  return this._client.delete(path2`/assistants/${assistantID}`, {
28922
27782
  ...options,
28923
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28924
- __security: { bearerAuth: true }
27783
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28925
27784
  });
28926
27785
  }
28927
27786
  }
@@ -28932,8 +27791,7 @@ class Sessions extends APIResource2 {
28932
27791
  return this._client.post("/realtime/sessions", {
28933
27792
  body,
28934
27793
  ...options,
28935
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28936
- __security: { bearerAuth: true }
27794
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28937
27795
  });
28938
27796
  }
28939
27797
  }
@@ -28944,8 +27802,7 @@ class TranscriptionSessions extends APIResource2 {
28944
27802
  return this._client.post("/realtime/transcription_sessions", {
28945
27803
  body,
28946
27804
  ...options,
28947
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28948
- __security: { bearerAuth: true }
27805
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28949
27806
  });
28950
27807
  }
28951
27808
  }
@@ -28967,15 +27824,13 @@ class Sessions2 extends APIResource2 {
28967
27824
  return this._client.post("/chatkit/sessions", {
28968
27825
  body,
28969
27826
  ...options,
28970
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28971
- __security: { bearerAuth: true }
27827
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28972
27828
  });
28973
27829
  }
28974
27830
  cancel(sessionID, options) {
28975
27831
  return this._client.post(path2`/chatkit/sessions/${sessionID}/cancel`, {
28976
27832
  ...options,
28977
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28978
- __security: { bearerAuth: true }
27833
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28979
27834
  });
28980
27835
  }
28981
27836
  }
@@ -28985,32 +27840,24 @@ class Threads extends APIResource2 {
28985
27840
  retrieve(threadID, options) {
28986
27841
  return this._client.get(path2`/chatkit/threads/${threadID}`, {
28987
27842
  ...options,
28988
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28989
- __security: { bearerAuth: true }
27843
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28990
27844
  });
28991
27845
  }
28992
27846
  list(query = {}, options) {
28993
27847
  return this._client.getAPIList("/chatkit/threads", ConversationCursorPage, {
28994
27848
  query,
28995
27849
  ...options,
28996
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28997
- __security: { bearerAuth: true }
27850
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28998
27851
  });
28999
27852
  }
29000
27853
  delete(threadID, options) {
29001
27854
  return this._client.delete(path2`/chatkit/threads/${threadID}`, {
29002
27855
  ...options,
29003
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
29004
- __security: { bearerAuth: true }
27856
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
29005
27857
  });
29006
27858
  }
29007
27859
  listItems(threadID, query = {}, options) {
29008
- return this._client.getAPIList(path2`/chatkit/threads/${threadID}/items`, ConversationCursorPage, {
29009
- query,
29010
- ...options,
29011
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
29012
- __security: { bearerAuth: true }
29013
- });
27860
+ return this._client.getAPIList(path2`/chatkit/threads/${threadID}/items`, ConversationCursorPage, { query, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]) });
29014
27861
  }
29015
27862
  }
29016
27863
 
@@ -29031,16 +27878,14 @@ class Messages4 extends APIResource2 {
29031
27878
  return this._client.post(path2`/threads/${threadID}/messages`, {
29032
27879
  body,
29033
27880
  ...options,
29034
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29035
- __security: { bearerAuth: true }
27881
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29036
27882
  });
29037
27883
  }
29038
27884
  retrieve(messageID, params, options) {
29039
27885
  const { thread_id } = params;
29040
27886
  return this._client.get(path2`/threads/${thread_id}/messages/${messageID}`, {
29041
27887
  ...options,
29042
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29043
- __security: { bearerAuth: true }
27888
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29044
27889
  });
29045
27890
  }
29046
27891
  update(messageID, params, options) {
@@ -29048,24 +27893,21 @@ class Messages4 extends APIResource2 {
29048
27893
  return this._client.post(path2`/threads/${thread_id}/messages/${messageID}`, {
29049
27894
  body,
29050
27895
  ...options,
29051
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29052
- __security: { bearerAuth: true }
27896
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29053
27897
  });
29054
27898
  }
29055
27899
  list(threadID, query = {}, options) {
29056
27900
  return this._client.getAPIList(path2`/threads/${threadID}/messages`, CursorPage, {
29057
27901
  query,
29058
27902
  ...options,
29059
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29060
- __security: { bearerAuth: true }
27903
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29061
27904
  });
29062
27905
  }
29063
27906
  delete(messageID, params, options) {
29064
27907
  const { thread_id } = params;
29065
27908
  return this._client.delete(path2`/threads/${thread_id}/messages/${messageID}`, {
29066
27909
  ...options,
29067
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29068
- __security: { bearerAuth: true }
27910
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29069
27911
  });
29070
27912
  }
29071
27913
  }
@@ -29077,8 +27919,7 @@ class Steps extends APIResource2 {
29077
27919
  return this._client.get(path2`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, {
29078
27920
  query,
29079
27921
  ...options,
29080
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29081
- __security: { bearerAuth: true }
27922
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29082
27923
  });
29083
27924
  }
29084
27925
  list(runID, params, options) {
@@ -29086,8 +27927,7 @@ class Steps extends APIResource2 {
29086
27927
  return this._client.getAPIList(path2`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, {
29087
27928
  query,
29088
27929
  ...options,
29089
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29090
- __security: { bearerAuth: true }
27930
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29091
27931
  });
29092
27932
  }
29093
27933
  }
@@ -29109,10 +27949,10 @@ var toFloat32Array = (base64Str) => {
29109
27949
  // node_modules/openai/internal/utils/env.mjs
29110
27950
  var readEnv2 = (env) => {
29111
27951
  if (typeof globalThis.process !== "undefined") {
29112
- return globalThis.process.env?.[env]?.trim() || undefined;
27952
+ return globalThis.process.env?.[env]?.trim() ?? undefined;
29113
27953
  }
29114
27954
  if (typeof globalThis.Deno !== "undefined") {
29115
- return globalThis.Deno.env?.get?.(env)?.trim() || undefined;
27955
+ return globalThis.Deno.env?.get?.(env)?.trim();
29116
27956
  }
29117
27957
  return;
29118
27958
  };
@@ -29669,16 +28509,14 @@ class Runs extends APIResource2 {
29669
28509
  ...options,
29670
28510
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29671
28511
  stream: params.stream ?? false,
29672
- __synthesizeEventData: true,
29673
- __security: { bearerAuth: true }
28512
+ __synthesizeEventData: true
29674
28513
  });
29675
28514
  }
29676
28515
  retrieve(runID, params, options) {
29677
28516
  const { thread_id } = params;
29678
28517
  return this._client.get(path2`/threads/${thread_id}/runs/${runID}`, {
29679
28518
  ...options,
29680
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29681
- __security: { bearerAuth: true }
28519
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29682
28520
  });
29683
28521
  }
29684
28522
  update(runID, params, options) {
@@ -29686,24 +28524,21 @@ class Runs extends APIResource2 {
29686
28524
  return this._client.post(path2`/threads/${thread_id}/runs/${runID}`, {
29687
28525
  body,
29688
28526
  ...options,
29689
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29690
- __security: { bearerAuth: true }
28527
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29691
28528
  });
29692
28529
  }
29693
28530
  list(threadID, query2 = {}, options) {
29694
28531
  return this._client.getAPIList(path2`/threads/${threadID}/runs`, CursorPage, {
29695
28532
  query: query2,
29696
28533
  ...options,
29697
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29698
- __security: { bearerAuth: true }
28534
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29699
28535
  });
29700
28536
  }
29701
28537
  cancel(runID, params, options) {
29702
28538
  const { thread_id } = params;
29703
28539
  return this._client.post(path2`/threads/${thread_id}/runs/${runID}/cancel`, {
29704
28540
  ...options,
29705
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29706
- __security: { bearerAuth: true }
28541
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29707
28542
  });
29708
28543
  }
29709
28544
  async createAndPoll(threadId, body, options) {
@@ -29764,8 +28599,7 @@ class Runs extends APIResource2 {
29764
28599
  ...options,
29765
28600
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29766
28601
  stream: params.stream ?? false,
29767
- __synthesizeEventData: true,
29768
- __security: { bearerAuth: true }
28602
+ __synthesizeEventData: true
29769
28603
  });
29770
28604
  }
29771
28605
  async submitToolOutputsAndPoll(runId, params, options) {
@@ -29789,30 +28623,26 @@ class Threads2 extends APIResource2 {
29789
28623
  return this._client.post("/threads", {
29790
28624
  body,
29791
28625
  ...options,
29792
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29793
- __security: { bearerAuth: true }
28626
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29794
28627
  });
29795
28628
  }
29796
28629
  retrieve(threadID, options) {
29797
28630
  return this._client.get(path2`/threads/${threadID}`, {
29798
28631
  ...options,
29799
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29800
- __security: { bearerAuth: true }
28632
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29801
28633
  });
29802
28634
  }
29803
28635
  update(threadID, body, options) {
29804
28636
  return this._client.post(path2`/threads/${threadID}`, {
29805
28637
  body,
29806
28638
  ...options,
29807
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29808
- __security: { bearerAuth: true }
28639
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29809
28640
  });
29810
28641
  }
29811
28642
  delete(threadID, options) {
29812
28643
  return this._client.delete(path2`/threads/${threadID}`, {
29813
28644
  ...options,
29814
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29815
- __security: { bearerAuth: true }
28645
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29816
28646
  });
29817
28647
  }
29818
28648
  createAndRun(body, options) {
@@ -29821,8 +28651,7 @@ class Threads2 extends APIResource2 {
29821
28651
  ...options,
29822
28652
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29823
28653
  stream: body.stream ?? false,
29824
- __synthesizeEventData: true,
29825
- __security: { bearerAuth: true }
28654
+ __synthesizeEventData: true
29826
28655
  });
29827
28656
  }
29828
28657
  async createAndRunPoll(body, options) {
@@ -29853,12 +28682,7 @@ Beta2.Threads = Threads2;
29853
28682
  // node_modules/openai/resources/completions.mjs
29854
28683
  class Completions3 extends APIResource2 {
29855
28684
  create(body, options) {
29856
- return this._client.post("/completions", {
29857
- body,
29858
- ...options,
29859
- stream: body.stream ?? false,
29860
- __security: { bearerAuth: true }
29861
- });
28685
+ return this._client.post("/completions", { body, ...options, stream: body.stream ?? false });
29862
28686
  }
29863
28687
  }
29864
28688
  // node_modules/openai/resources/containers/files/content.mjs
@@ -29868,7 +28692,6 @@ class Content extends APIResource2 {
29868
28692
  return this._client.get(path2`/containers/${container_id}/files/${fileID}/content`, {
29869
28693
  ...options,
29870
28694
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
29871
- __security: { bearerAuth: true },
29872
28695
  __binaryResponse: true
29873
28696
  });
29874
28697
  }
@@ -29881,28 +28704,23 @@ class Files2 extends APIResource2 {
29881
28704
  this.content = new Content(this._client);
29882
28705
  }
29883
28706
  create(containerID, body, options) {
29884
- 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));
29885
28708
  }
29886
28709
  retrieve(fileID, params, options) {
29887
28710
  const { container_id } = params;
29888
- return this._client.get(path2`/containers/${container_id}/files/${fileID}`, {
29889
- ...options,
29890
- __security: { bearerAuth: true }
29891
- });
28711
+ return this._client.get(path2`/containers/${container_id}/files/${fileID}`, options);
29892
28712
  }
29893
28713
  list(containerID, query2 = {}, options) {
29894
28714
  return this._client.getAPIList(path2`/containers/${containerID}/files`, CursorPage, {
29895
28715
  query: query2,
29896
- ...options,
29897
- __security: { bearerAuth: true }
28716
+ ...options
29898
28717
  });
29899
28718
  }
29900
28719
  delete(fileID, params, options) {
29901
28720
  const { container_id } = params;
29902
28721
  return this._client.delete(path2`/containers/${container_id}/files/${fileID}`, {
29903
28722
  ...options,
29904
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29905
- __security: { bearerAuth: true }
28723
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29906
28724
  });
29907
28725
  }
29908
28726
  }
@@ -29915,26 +28733,18 @@ class Containers extends APIResource2 {
29915
28733
  this.files = new Files2(this._client);
29916
28734
  }
29917
28735
  create(body, options) {
29918
- return this._client.post("/containers", { body, ...options, __security: { bearerAuth: true } });
28736
+ return this._client.post("/containers", { body, ...options });
29919
28737
  }
29920
28738
  retrieve(containerID, options) {
29921
- return this._client.get(path2`/containers/${containerID}`, {
29922
- ...options,
29923
- __security: { bearerAuth: true }
29924
- });
28739
+ return this._client.get(path2`/containers/${containerID}`, options);
29925
28740
  }
29926
28741
  list(query2 = {}, options) {
29927
- return this._client.getAPIList("/containers", CursorPage, {
29928
- query: query2,
29929
- ...options,
29930
- __security: { bearerAuth: true }
29931
- });
28742
+ return this._client.getAPIList("/containers", CursorPage, { query: query2, ...options });
29932
28743
  }
29933
28744
  delete(containerID, options) {
29934
28745
  return this._client.delete(path2`/containers/${containerID}`, {
29935
28746
  ...options,
29936
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29937
- __security: { bearerAuth: true }
28747
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29938
28748
  });
29939
28749
  }
29940
28750
  }
@@ -29946,27 +28756,19 @@ class Items extends APIResource2 {
29946
28756
  return this._client.post(path2`/conversations/${conversationID}/items`, {
29947
28757
  query: { include },
29948
28758
  body,
29949
- ...options,
29950
- __security: { bearerAuth: true }
28759
+ ...options
29951
28760
  });
29952
28761
  }
29953
28762
  retrieve(itemID, params, options) {
29954
28763
  const { conversation_id, ...query2 } = params;
29955
- return this._client.get(path2`/conversations/${conversation_id}/items/${itemID}`, {
29956
- query: query2,
29957
- ...options,
29958
- __security: { bearerAuth: true }
29959
- });
28764
+ return this._client.get(path2`/conversations/${conversation_id}/items/${itemID}`, { query: query2, ...options });
29960
28765
  }
29961
28766
  list(conversationID, query2 = {}, options) {
29962
- 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 });
29963
28768
  }
29964
28769
  delete(itemID, params, options) {
29965
28770
  const { conversation_id } = params;
29966
- return this._client.delete(path2`/conversations/${conversation_id}/items/${itemID}`, {
29967
- ...options,
29968
- __security: { bearerAuth: true }
29969
- });
28771
+ return this._client.delete(path2`/conversations/${conversation_id}/items/${itemID}`, options);
29970
28772
  }
29971
28773
  }
29972
28774
 
@@ -29977,26 +28779,16 @@ class Conversations extends APIResource2 {
29977
28779
  this.items = new Items(this._client);
29978
28780
  }
29979
28781
  create(body = {}, options) {
29980
- return this._client.post("/conversations", { body, ...options, __security: { bearerAuth: true } });
28782
+ return this._client.post("/conversations", { body, ...options });
29981
28783
  }
29982
28784
  retrieve(conversationID, options) {
29983
- return this._client.get(path2`/conversations/${conversationID}`, {
29984
- ...options,
29985
- __security: { bearerAuth: true }
29986
- });
28785
+ return this._client.get(path2`/conversations/${conversationID}`, options);
29987
28786
  }
29988
28787
  update(conversationID, body, options) {
29989
- return this._client.post(path2`/conversations/${conversationID}`, {
29990
- body,
29991
- ...options,
29992
- __security: { bearerAuth: true }
29993
- });
28788
+ return this._client.post(path2`/conversations/${conversationID}`, { body, ...options });
29994
28789
  }
29995
28790
  delete(conversationID, options) {
29996
- return this._client.delete(path2`/conversations/${conversationID}`, {
29997
- ...options,
29998
- __security: { bearerAuth: true }
29999
- });
28791
+ return this._client.delete(path2`/conversations/${conversationID}`, options);
30000
28792
  }
30001
28793
  }
30002
28794
  Conversations.Items = Items;
@@ -30013,8 +28805,7 @@ class Embeddings extends APIResource2 {
30013
28805
  ...body,
30014
28806
  encoding_format
30015
28807
  },
30016
- ...options,
30017
- __security: { bearerAuth: true }
28808
+ ...options
30018
28809
  });
30019
28810
  if (hasUserProvidedEncodingFormat) {
30020
28811
  return response;
@@ -30035,14 +28826,11 @@ class Embeddings extends APIResource2 {
30035
28826
  class OutputItems extends APIResource2 {
30036
28827
  retrieve(outputItemID, params, options) {
30037
28828
  const { eval_id, run_id } = params;
30038
- return this._client.get(path2`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, {
30039
- ...options,
30040
- __security: { bearerAuth: true }
30041
- });
28829
+ return this._client.get(path2`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, options);
30042
28830
  }
30043
28831
  list(runID, params, options) {
30044
28832
  const { eval_id, ...query2 } = params;
30045
- 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 });
30046
28834
  }
30047
28835
  }
30048
28836
 
@@ -30053,39 +28841,25 @@ class Runs2 extends APIResource2 {
30053
28841
  this.outputItems = new OutputItems(this._client);
30054
28842
  }
30055
28843
  create(evalID, body, options) {
30056
- return this._client.post(path2`/evals/${evalID}/runs`, {
30057
- body,
30058
- ...options,
30059
- __security: { bearerAuth: true }
30060
- });
28844
+ return this._client.post(path2`/evals/${evalID}/runs`, { body, ...options });
30061
28845
  }
30062
28846
  retrieve(runID, params, options) {
30063
28847
  const { eval_id } = params;
30064
- return this._client.get(path2`/evals/${eval_id}/runs/${runID}`, {
30065
- ...options,
30066
- __security: { bearerAuth: true }
30067
- });
28848
+ return this._client.get(path2`/evals/${eval_id}/runs/${runID}`, options);
30068
28849
  }
30069
28850
  list(evalID, query2 = {}, options) {
30070
28851
  return this._client.getAPIList(path2`/evals/${evalID}/runs`, CursorPage, {
30071
28852
  query: query2,
30072
- ...options,
30073
- __security: { bearerAuth: true }
28853
+ ...options
30074
28854
  });
30075
28855
  }
30076
28856
  delete(runID, params, options) {
30077
28857
  const { eval_id } = params;
30078
- return this._client.delete(path2`/evals/${eval_id}/runs/${runID}`, {
30079
- ...options,
30080
- __security: { bearerAuth: true }
30081
- });
28858
+ return this._client.delete(path2`/evals/${eval_id}/runs/${runID}`, options);
30082
28859
  }
30083
28860
  cancel(runID, params, options) {
30084
28861
  const { eval_id } = params;
30085
- return this._client.post(path2`/evals/${eval_id}/runs/${runID}`, {
30086
- ...options,
30087
- __security: { bearerAuth: true }
30088
- });
28862
+ return this._client.post(path2`/evals/${eval_id}/runs/${runID}`, options);
30089
28863
  }
30090
28864
  }
30091
28865
  Runs2.OutputItems = OutputItems;
@@ -30097,49 +28871,40 @@ class Evals extends APIResource2 {
30097
28871
  this.runs = new Runs2(this._client);
30098
28872
  }
30099
28873
  create(body, options) {
30100
- return this._client.post("/evals", { body, ...options, __security: { bearerAuth: true } });
28874
+ return this._client.post("/evals", { body, ...options });
30101
28875
  }
30102
28876
  retrieve(evalID, options) {
30103
- return this._client.get(path2`/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
28877
+ return this._client.get(path2`/evals/${evalID}`, options);
30104
28878
  }
30105
28879
  update(evalID, body, options) {
30106
- return this._client.post(path2`/evals/${evalID}`, { body, ...options, __security: { bearerAuth: true } });
28880
+ return this._client.post(path2`/evals/${evalID}`, { body, ...options });
30107
28881
  }
30108
28882
  list(query2 = {}, options) {
30109
- return this._client.getAPIList("/evals", CursorPage, {
30110
- query: query2,
30111
- ...options,
30112
- __security: { bearerAuth: true }
30113
- });
28883
+ return this._client.getAPIList("/evals", CursorPage, { query: query2, ...options });
30114
28884
  }
30115
28885
  delete(evalID, options) {
30116
- return this._client.delete(path2`/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
28886
+ return this._client.delete(path2`/evals/${evalID}`, options);
30117
28887
  }
30118
28888
  }
30119
28889
  Evals.Runs = Runs2;
30120
28890
  // node_modules/openai/resources/files.mjs
30121
28891
  class Files3 extends APIResource2 {
30122
28892
  create(body, options) {
30123
- return this._client.post("/files", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
28893
+ return this._client.post("/files", multipartFormRequestOptions2({ body, ...options }, this._client));
30124
28894
  }
30125
28895
  retrieve(fileID, options) {
30126
- return this._client.get(path2`/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
28896
+ return this._client.get(path2`/files/${fileID}`, options);
30127
28897
  }
30128
28898
  list(query2 = {}, options) {
30129
- return this._client.getAPIList("/files", CursorPage, {
30130
- query: query2,
30131
- ...options,
30132
- __security: { bearerAuth: true }
30133
- });
28899
+ return this._client.getAPIList("/files", CursorPage, { query: query2, ...options });
30134
28900
  }
30135
28901
  delete(fileID, options) {
30136
- return this._client.delete(path2`/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
28902
+ return this._client.delete(path2`/files/${fileID}`, options);
30137
28903
  }
30138
28904
  content(fileID, options) {
30139
28905
  return this._client.get(path2`/files/${fileID}/content`, {
30140
28906
  ...options,
30141
28907
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
30142
- __security: { bearerAuth: true },
30143
28908
  __binaryResponse: true
30144
28909
  });
30145
28910
  }
@@ -30166,18 +28931,10 @@ class Methods extends APIResource2 {
30166
28931
  // node_modules/openai/resources/fine-tuning/alpha/graders.mjs
30167
28932
  class Graders extends APIResource2 {
30168
28933
  run(body, options) {
30169
- return this._client.post("/fine_tuning/alpha/graders/run", {
30170
- body,
30171
- ...options,
30172
- __security: { bearerAuth: true }
30173
- });
28934
+ return this._client.post("/fine_tuning/alpha/graders/run", { body, ...options });
30174
28935
  }
30175
28936
  validate(body, options) {
30176
- return this._client.post("/fine_tuning/alpha/graders/validate", {
30177
- body,
30178
- ...options,
30179
- __security: { bearerAuth: true }
30180
- });
28937
+ return this._client.post("/fine_tuning/alpha/graders/validate", { body, ...options });
30181
28938
  }
30182
28939
  }
30183
28940
 
@@ -30193,21 +28950,20 @@ Alpha.Graders = Graders;
30193
28950
  // node_modules/openai/resources/fine-tuning/checkpoints/permissions.mjs
30194
28951
  class Permissions extends APIResource2 {
30195
28952
  create(fineTunedModelCheckpoint, body, options) {
30196
- 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 });
30197
28954
  }
30198
28955
  retrieve(fineTunedModelCheckpoint, query2 = {}, options) {
30199
28956
  return this._client.get(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
30200
28957
  query: query2,
30201
- ...options,
30202
- __security: { adminAPIKeyAuth: true }
28958
+ ...options
30203
28959
  });
30204
28960
  }
30205
28961
  list(fineTunedModelCheckpoint, query2 = {}, options) {
30206
- 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 });
30207
28963
  }
30208
28964
  delete(permissionID, params, options) {
30209
28965
  const { fine_tuned_model_checkpoint } = params;
30210
- 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);
30211
28967
  }
30212
28968
  }
30213
28969
 
@@ -30223,7 +28979,7 @@ Checkpoints.Permissions = Permissions;
30223
28979
  // node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs
30224
28980
  class Checkpoints2 extends APIResource2 {
30225
28981
  list(fineTuningJobID, query2 = {}, options) {
30226
- 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 });
30227
28983
  }
30228
28984
  }
30229
28985
 
@@ -30234,41 +28990,25 @@ class Jobs extends APIResource2 {
30234
28990
  this.checkpoints = new Checkpoints2(this._client);
30235
28991
  }
30236
28992
  create(body, options) {
30237
- return this._client.post("/fine_tuning/jobs", { body, ...options, __security: { bearerAuth: true } });
28993
+ return this._client.post("/fine_tuning/jobs", { body, ...options });
30238
28994
  }
30239
28995
  retrieve(fineTuningJobID, options) {
30240
- return this._client.get(path2`/fine_tuning/jobs/${fineTuningJobID}`, {
30241
- ...options,
30242
- __security: { bearerAuth: true }
30243
- });
28996
+ return this._client.get(path2`/fine_tuning/jobs/${fineTuningJobID}`, options);
30244
28997
  }
30245
28998
  list(query2 = {}, options) {
30246
- return this._client.getAPIList("/fine_tuning/jobs", CursorPage, {
30247
- query: query2,
30248
- ...options,
30249
- __security: { bearerAuth: true }
30250
- });
28999
+ return this._client.getAPIList("/fine_tuning/jobs", CursorPage, { query: query2, ...options });
30251
29000
  }
30252
29001
  cancel(fineTuningJobID, options) {
30253
- return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/cancel`, {
30254
- ...options,
30255
- __security: { bearerAuth: true }
30256
- });
29002
+ return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options);
30257
29003
  }
30258
29004
  listEvents(fineTuningJobID, query2 = {}, options) {
30259
- 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 });
30260
29006
  }
30261
29007
  pause(fineTuningJobID, options) {
30262
- return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/pause`, {
30263
- ...options,
30264
- __security: { bearerAuth: true }
30265
- });
29008
+ return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/pause`, options);
30266
29009
  }
30267
29010
  resume(fineTuningJobID, options) {
30268
- return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/resume`, {
30269
- ...options,
30270
- __security: { bearerAuth: true }
30271
- });
29011
+ return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/resume`, options);
30272
29012
  }
30273
29013
  }
30274
29014
  Jobs.Checkpoints = Checkpoints2;
@@ -30302,36 +29042,31 @@ Graders2.GraderModels = GraderModels;
30302
29042
  // node_modules/openai/resources/images.mjs
30303
29043
  class Images extends APIResource2 {
30304
29044
  createVariation(body, options) {
30305
- 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));
30306
29046
  }
30307
29047
  edit(body, options) {
30308
- 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));
30309
29049
  }
30310
29050
  generate(body, options) {
30311
- return this._client.post("/images/generations", {
30312
- body,
30313
- ...options,
30314
- stream: body.stream ?? false,
30315
- __security: { bearerAuth: true }
30316
- });
29051
+ return this._client.post("/images/generations", { body, ...options, stream: body.stream ?? false });
30317
29052
  }
30318
29053
  }
30319
29054
  // node_modules/openai/resources/models.mjs
30320
29055
  class Models3 extends APIResource2 {
30321
29056
  retrieve(model, options) {
30322
- return this._client.get(path2`/models/${model}`, { ...options, __security: { bearerAuth: true } });
29057
+ return this._client.get(path2`/models/${model}`, options);
30323
29058
  }
30324
29059
  list(options) {
30325
- return this._client.getAPIList("/models", Page2, { ...options, __security: { bearerAuth: true } });
29060
+ return this._client.getAPIList("/models", Page2, options);
30326
29061
  }
30327
29062
  delete(model, options) {
30328
- return this._client.delete(path2`/models/${model}`, { ...options, __security: { bearerAuth: true } });
29063
+ return this._client.delete(path2`/models/${model}`, options);
30329
29064
  }
30330
29065
  }
30331
29066
  // node_modules/openai/resources/moderations.mjs
30332
29067
  class Moderations extends APIResource2 {
30333
29068
  create(body, options) {
30334
- return this._client.post("/moderations", { body, ...options, __security: { bearerAuth: true } });
29069
+ return this._client.post("/moderations", { body, ...options });
30335
29070
  }
30336
29071
  }
30337
29072
  // node_modules/openai/resources/realtime/calls.mjs
@@ -30340,31 +29075,27 @@ class Calls extends APIResource2 {
30340
29075
  return this._client.post(path2`/realtime/calls/${callID}/accept`, {
30341
29076
  body,
30342
29077
  ...options,
30343
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30344
- __security: { bearerAuth: true }
29078
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30345
29079
  });
30346
29080
  }
30347
29081
  hangup(callID, options) {
30348
29082
  return this._client.post(path2`/realtime/calls/${callID}/hangup`, {
30349
29083
  ...options,
30350
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30351
- __security: { bearerAuth: true }
29084
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30352
29085
  });
30353
29086
  }
30354
29087
  refer(callID, body, options) {
30355
29088
  return this._client.post(path2`/realtime/calls/${callID}/refer`, {
30356
29089
  body,
30357
29090
  ...options,
30358
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30359
- __security: { bearerAuth: true }
29091
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30360
29092
  });
30361
29093
  }
30362
29094
  reject(callID, body = {}, options) {
30363
29095
  return this._client.post(path2`/realtime/calls/${callID}/reject`, {
30364
29096
  body,
30365
29097
  ...options,
30366
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30367
- __security: { bearerAuth: true }
29098
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30368
29099
  });
30369
29100
  }
30370
29101
  }
@@ -30372,11 +29103,7 @@ class Calls extends APIResource2 {
30372
29103
  // node_modules/openai/resources/realtime/client-secrets.mjs
30373
29104
  class ClientSecrets extends APIResource2 {
30374
29105
  create(body, options) {
30375
- return this._client.post("/realtime/client_secrets", {
30376
- body,
30377
- ...options,
30378
- __security: { bearerAuth: true }
30379
- });
29106
+ return this._client.post("/realtime/client_secrets", { body, ...options });
30380
29107
  }
30381
29108
  }
30382
29109
 
@@ -30773,18 +29500,14 @@ function finalizeResponse(snapshot, params) {
30773
29500
  // node_modules/openai/resources/responses/input-items.mjs
30774
29501
  class InputItems extends APIResource2 {
30775
29502
  list(responseID, query2 = {}, options) {
30776
- 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 });
30777
29504
  }
30778
29505
  }
30779
29506
 
30780
29507
  // node_modules/openai/resources/responses/input-tokens.mjs
30781
29508
  class InputTokens extends APIResource2 {
30782
29509
  count(body = {}, options) {
30783
- return this._client.post("/responses/input_tokens", {
30784
- body,
30785
- ...options,
30786
- __security: { bearerAuth: true }
30787
- });
29510
+ return this._client.post("/responses/input_tokens", { body, ...options });
30788
29511
  }
30789
29512
  }
30790
29513
 
@@ -30796,12 +29519,7 @@ class Responses extends APIResource2 {
30796
29519
  this.inputTokens = new InputTokens(this._client);
30797
29520
  }
30798
29521
  create(body, options) {
30799
- return this._client.post("/responses", {
30800
- body,
30801
- ...options,
30802
- stream: body.stream ?? false,
30803
- __security: { bearerAuth: true }
30804
- })._thenUnwrap((rsp) => {
29522
+ return this._client.post("/responses", { body, ...options, stream: body.stream ?? false })._thenUnwrap((rsp) => {
30805
29523
  if ("object" in rsp && rsp.object === "response") {
30806
29524
  addOutputText(rsp);
30807
29525
  }
@@ -30812,8 +29530,7 @@ class Responses extends APIResource2 {
30812
29530
  return this._client.get(path2`/responses/${responseID}`, {
30813
29531
  query: query2,
30814
29532
  ...options,
30815
- stream: query2?.stream ?? false,
30816
- __security: { bearerAuth: true }
29533
+ stream: query2?.stream ?? false
30817
29534
  })._thenUnwrap((rsp) => {
30818
29535
  if ("object" in rsp && rsp.object === "response") {
30819
29536
  addOutputText(rsp);
@@ -30824,8 +29541,7 @@ class Responses extends APIResource2 {
30824
29541
  delete(responseID, options) {
30825
29542
  return this._client.delete(path2`/responses/${responseID}`, {
30826
29543
  ...options,
30827
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30828
- __security: { bearerAuth: true }
29544
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30829
29545
  });
30830
29546
  }
30831
29547
  parse(body, options) {
@@ -30835,13 +29551,10 @@ class Responses extends APIResource2 {
30835
29551
  return ResponseStream.createResponse(this._client, body, options);
30836
29552
  }
30837
29553
  cancel(responseID, options) {
30838
- return this._client.post(path2`/responses/${responseID}/cancel`, {
30839
- ...options,
30840
- __security: { bearerAuth: true }
30841
- });
29554
+ return this._client.post(path2`/responses/${responseID}/cancel`, options);
30842
29555
  }
30843
29556
  compact(body, options) {
30844
- return this._client.post("/responses/compact", { body, ...options, __security: { bearerAuth: true } });
29557
+ return this._client.post("/responses/compact", { body, ...options });
30845
29558
  }
30846
29559
  }
30847
29560
  Responses.InputItems = InputItems;
@@ -30852,7 +29565,6 @@ class Content2 extends APIResource2 {
30852
29565
  return this._client.get(path2`/skills/${skillID}/content`, {
30853
29566
  ...options,
30854
29567
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
30855
- __security: { bearerAuth: true },
30856
29568
  __binaryResponse: true
30857
29569
  });
30858
29570
  }
@@ -30865,7 +29577,6 @@ class Content3 extends APIResource2 {
30865
29577
  return this._client.get(path2`/skills/${skill_id}/versions/${version}/content`, {
30866
29578
  ...options,
30867
29579
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
30868
- __security: { bearerAuth: true },
30869
29580
  __binaryResponse: true
30870
29581
  });
30871
29582
  }
@@ -30878,28 +29589,21 @@ class Versions2 extends APIResource2 {
30878
29589
  this.content = new Content3(this._client);
30879
29590
  }
30880
29591
  create(skillID, body = {}, options) {
30881
- 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));
30882
29593
  }
30883
29594
  retrieve(version, params, options) {
30884
29595
  const { skill_id } = params;
30885
- return this._client.get(path2`/skills/${skill_id}/versions/${version}`, {
30886
- ...options,
30887
- __security: { bearerAuth: true }
30888
- });
29596
+ return this._client.get(path2`/skills/${skill_id}/versions/${version}`, options);
30889
29597
  }
30890
29598
  list(skillID, query2 = {}, options) {
30891
29599
  return this._client.getAPIList(path2`/skills/${skillID}/versions`, CursorPage, {
30892
29600
  query: query2,
30893
- ...options,
30894
- __security: { bearerAuth: true }
29601
+ ...options
30895
29602
  });
30896
29603
  }
30897
29604
  delete(version, params, options) {
30898
29605
  const { skill_id } = params;
30899
- return this._client.delete(path2`/skills/${skill_id}/versions/${version}`, {
30900
- ...options,
30901
- __security: { bearerAuth: true }
30902
- });
29606
+ return this._client.delete(path2`/skills/${skill_id}/versions/${version}`, options);
30903
29607
  }
30904
29608
  }
30905
29609
  Versions2.Content = Content3;
@@ -30912,27 +29616,19 @@ class Skills2 extends APIResource2 {
30912
29616
  this.versions = new Versions2(this._client);
30913
29617
  }
30914
29618
  create(body = {}, options) {
30915
- return this._client.post("/skills", maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
29619
+ return this._client.post("/skills", maybeMultipartFormRequestOptions({ body, ...options }, this._client));
30916
29620
  }
30917
29621
  retrieve(skillID, options) {
30918
- return this._client.get(path2`/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
29622
+ return this._client.get(path2`/skills/${skillID}`, options);
30919
29623
  }
30920
29624
  update(skillID, body, options) {
30921
- return this._client.post(path2`/skills/${skillID}`, {
30922
- body,
30923
- ...options,
30924
- __security: { bearerAuth: true }
30925
- });
29625
+ return this._client.post(path2`/skills/${skillID}`, { body, ...options });
30926
29626
  }
30927
29627
  list(query2 = {}, options) {
30928
- return this._client.getAPIList("/skills", CursorPage, {
30929
- query: query2,
30930
- ...options,
30931
- __security: { bearerAuth: true }
30932
- });
29628
+ return this._client.getAPIList("/skills", CursorPage, { query: query2, ...options });
30933
29629
  }
30934
29630
  delete(skillID, options) {
30935
- return this._client.delete(path2`/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
29631
+ return this._client.delete(path2`/skills/${skillID}`, options);
30936
29632
  }
30937
29633
  }
30938
29634
  Skills2.Content = Content2;
@@ -30940,7 +29636,7 @@ Skills2.Versions = Versions2;
30940
29636
  // node_modules/openai/resources/uploads/parts.mjs
30941
29637
  class Parts extends APIResource2 {
30942
29638
  create(uploadID, body, options) {
30943
- 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));
30944
29640
  }
30945
29641
  }
30946
29642
 
@@ -30951,20 +29647,13 @@ class Uploads extends APIResource2 {
30951
29647
  this.parts = new Parts(this._client);
30952
29648
  }
30953
29649
  create(body, options) {
30954
- return this._client.post("/uploads", { body, ...options, __security: { bearerAuth: true } });
29650
+ return this._client.post("/uploads", { body, ...options });
30955
29651
  }
30956
29652
  cancel(uploadID, options) {
30957
- return this._client.post(path2`/uploads/${uploadID}/cancel`, {
30958
- ...options,
30959
- __security: { bearerAuth: true }
30960
- });
29653
+ return this._client.post(path2`/uploads/${uploadID}/cancel`, options);
30961
29654
  }
30962
29655
  complete(uploadID, body, options) {
30963
- return this._client.post(path2`/uploads/${uploadID}/complete`, {
30964
- body,
30965
- ...options,
30966
- __security: { bearerAuth: true }
30967
- });
29656
+ return this._client.post(path2`/uploads/${uploadID}/complete`, { body, ...options });
30968
29657
  }
30969
29658
  }
30970
29659
  Uploads.Parts = Parts;
@@ -30993,24 +29682,21 @@ class FileBatches extends APIResource2 {
30993
29682
  return this._client.post(path2`/vector_stores/${vectorStoreID}/file_batches`, {
30994
29683
  body,
30995
29684
  ...options,
30996
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30997
- __security: { bearerAuth: true }
29685
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30998
29686
  });
30999
29687
  }
31000
29688
  retrieve(batchID, params, options) {
31001
29689
  const { vector_store_id } = params;
31002
29690
  return this._client.get(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
31003
29691
  ...options,
31004
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31005
- __security: { bearerAuth: true }
29692
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31006
29693
  });
31007
29694
  }
31008
29695
  cancel(batchID, params, options) {
31009
29696
  const { vector_store_id } = params;
31010
29697
  return this._client.post(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
31011
29698
  ...options,
31012
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31013
- __security: { bearerAuth: true }
29699
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31014
29700
  });
31015
29701
  }
31016
29702
  async createAndPoll(vectorStoreId, body, options) {
@@ -31019,12 +29705,7 @@ class FileBatches extends APIResource2 {
31019
29705
  }
31020
29706
  listFiles(batchID, params, options) {
31021
29707
  const { vector_store_id, ...query2 } = params;
31022
- return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, {
31023
- query: query2,
31024
- ...options,
31025
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31026
- __security: { bearerAuth: true }
31027
- });
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]) });
31028
29709
  }
31029
29710
  async poll(vectorStoreID, batchID, options) {
31030
29711
  const headers = buildHeaders2([
@@ -31091,16 +29772,14 @@ class Files4 extends APIResource2 {
31091
29772
  return this._client.post(path2`/vector_stores/${vectorStoreID}/files`, {
31092
29773
  body,
31093
29774
  ...options,
31094
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31095
- __security: { bearerAuth: true }
29775
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31096
29776
  });
31097
29777
  }
31098
29778
  retrieve(fileID, params, options) {
31099
29779
  const { vector_store_id } = params;
31100
29780
  return this._client.get(path2`/vector_stores/${vector_store_id}/files/${fileID}`, {
31101
29781
  ...options,
31102
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31103
- __security: { bearerAuth: true }
29782
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31104
29783
  });
31105
29784
  }
31106
29785
  update(fileID, params, options) {
@@ -31108,24 +29787,21 @@ class Files4 extends APIResource2 {
31108
29787
  return this._client.post(path2`/vector_stores/${vector_store_id}/files/${fileID}`, {
31109
29788
  body,
31110
29789
  ...options,
31111
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31112
- __security: { bearerAuth: true }
29790
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31113
29791
  });
31114
29792
  }
31115
29793
  list(vectorStoreID, query2 = {}, options) {
31116
29794
  return this._client.getAPIList(path2`/vector_stores/${vectorStoreID}/files`, CursorPage, {
31117
29795
  query: query2,
31118
29796
  ...options,
31119
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31120
- __security: { bearerAuth: true }
29797
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31121
29798
  });
31122
29799
  }
31123
29800
  delete(fileID, params, options) {
31124
29801
  const { vector_store_id } = params;
31125
29802
  return this._client.delete(path2`/vector_stores/${vector_store_id}/files/${fileID}`, {
31126
29803
  ...options,
31127
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31128
- __security: { bearerAuth: true }
29804
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31129
29805
  });
31130
29806
  }
31131
29807
  async createAndPoll(vectorStoreId, body, options) {
@@ -31177,11 +29853,7 @@ class Files4 extends APIResource2 {
31177
29853
  }
31178
29854
  content(fileID, params, options) {
31179
29855
  const { vector_store_id } = params;
31180
- return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/files/${fileID}/content`, Page2, {
31181
- ...options,
31182
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31183
- __security: { bearerAuth: true }
31184
- });
29856
+ return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/files/${fileID}/content`, Page2, { ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
31185
29857
  }
31186
29858
  }
31187
29859
 
@@ -31196,38 +29868,33 @@ class VectorStores extends APIResource2 {
31196
29868
  return this._client.post("/vector_stores", {
31197
29869
  body,
31198
29870
  ...options,
31199
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31200
- __security: { bearerAuth: true }
29871
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31201
29872
  });
31202
29873
  }
31203
29874
  retrieve(vectorStoreID, options) {
31204
29875
  return this._client.get(path2`/vector_stores/${vectorStoreID}`, {
31205
29876
  ...options,
31206
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31207
- __security: { bearerAuth: true }
29877
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31208
29878
  });
31209
29879
  }
31210
29880
  update(vectorStoreID, body, options) {
31211
29881
  return this._client.post(path2`/vector_stores/${vectorStoreID}`, {
31212
29882
  body,
31213
29883
  ...options,
31214
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31215
- __security: { bearerAuth: true }
29884
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31216
29885
  });
31217
29886
  }
31218
29887
  list(query2 = {}, options) {
31219
29888
  return this._client.getAPIList("/vector_stores", CursorPage, {
31220
29889
  query: query2,
31221
29890
  ...options,
31222
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31223
- __security: { bearerAuth: true }
29891
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31224
29892
  });
31225
29893
  }
31226
29894
  delete(vectorStoreID, options) {
31227
29895
  return this._client.delete(path2`/vector_stores/${vectorStoreID}`, {
31228
29896
  ...options,
31229
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31230
- __security: { bearerAuth: true }
29897
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31231
29898
  });
31232
29899
  }
31233
29900
  search(vectorStoreID, body, options) {
@@ -31235,8 +29902,7 @@ class VectorStores extends APIResource2 {
31235
29902
  body,
31236
29903
  method: "post",
31237
29904
  ...options,
31238
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
31239
- __security: { bearerAuth: true }
29905
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
31240
29906
  });
31241
29907
  }
31242
29908
  }
@@ -31245,47 +29911,39 @@ VectorStores.FileBatches = FileBatches;
31245
29911
  // node_modules/openai/resources/videos.mjs
31246
29912
  class Videos extends APIResource2 {
31247
29913
  create(body, options) {
31248
- return this._client.post("/videos", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29914
+ return this._client.post("/videos", multipartFormRequestOptions2({ body, ...options }, this._client));
31249
29915
  }
31250
29916
  retrieve(videoID, options) {
31251
- return this._client.get(path2`/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
29917
+ return this._client.get(path2`/videos/${videoID}`, options);
31252
29918
  }
31253
29919
  list(query2 = {}, options) {
31254
- return this._client.getAPIList("/videos", ConversationCursorPage, {
31255
- query: query2,
31256
- ...options,
31257
- __security: { bearerAuth: true }
31258
- });
29920
+ return this._client.getAPIList("/videos", ConversationCursorPage, { query: query2, ...options });
31259
29921
  }
31260
29922
  delete(videoID, options) {
31261
- return this._client.delete(path2`/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
29923
+ return this._client.delete(path2`/videos/${videoID}`, options);
31262
29924
  }
31263
29925
  createCharacter(body, options) {
31264
- 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));
31265
29927
  }
31266
29928
  downloadContent(videoID, query2 = {}, options) {
31267
29929
  return this._client.get(path2`/videos/${videoID}/content`, {
31268
29930
  query: query2,
31269
29931
  ...options,
31270
29932
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
31271
- __security: { bearerAuth: true },
31272
29933
  __binaryResponse: true
31273
29934
  });
31274
29935
  }
31275
29936
  edit(body, options) {
31276
- 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));
31277
29938
  }
31278
29939
  extend(body, options) {
31279
- 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));
31280
29941
  }
31281
29942
  getCharacter(characterID, options) {
31282
- return this._client.get(path2`/videos/characters/${characterID}`, {
31283
- ...options,
31284
- __security: { bearerAuth: true }
31285
- });
29943
+ return this._client.get(path2`/videos/characters/${characterID}`, options);
31286
29944
  }
31287
29945
  remix(videoID, body, options) {
31288
- 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));
31289
29947
  }
31290
29948
  }
31291
29949
  // node_modules/openai/resources/webhooks/webhooks.mjs
@@ -31359,10 +30017,9 @@ var _OpenAI_instances;
31359
30017
  var _a3;
31360
30018
  var _OpenAI_encoder;
31361
30019
  var _OpenAI_baseURLOverridden;
31362
- var WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER = "workload-identity-auth";
31363
30020
 
31364
30021
  class OpenAI {
31365
- 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 } = {}) {
31366
30023
  _OpenAI_instances.add(this);
31367
30024
  _OpenAI_encoder.set(this, undefined);
31368
30025
  this.completions = new Completions3(this);
@@ -31380,7 +30037,6 @@ class OpenAI {
31380
30037
  this.beta = new Beta2(this);
31381
30038
  this.batches = new Batches3(this);
31382
30039
  this.uploads = new Uploads(this);
31383
- this.admin = new Admin(this);
31384
30040
  this.responses = new Responses(this);
31385
30041
  this.realtime = new Realtime2(this);
31386
30042
  this.conversations = new Conversations(this);
@@ -31388,22 +30044,17 @@ class OpenAI {
31388
30044
  this.containers = new Containers(this);
31389
30045
  this.skills = new Skills2(this);
31390
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
+ }
31391
30050
  const options = {
31392
30051
  apiKey,
31393
- adminAPIKey,
31394
30052
  organization,
31395
30053
  project,
31396
30054
  webhookSecret,
31397
- workloadIdentity,
31398
30055
  ...opts,
31399
30056
  baseURL: baseURL || `https://api.openai.com/v1`
31400
30057
  };
31401
- if (apiKey && workloadIdentity) {
31402
- throw new OpenAIError("The `apiKey` and `workloadIdentity` options are mutually exclusive");
31403
- }
31404
- if (!apiKey && !adminAPIKey && !workloadIdentity) {
31405
- throw new OpenAIError("Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.");
31406
- }
31407
30058
  if (!options.dangerouslyAllowBrowser && isRunningInBrowser2()) {
31408
30059
  throw new OpenAIError(`It looks like you're running in a browser-like environment.
31409
30060
 
@@ -31426,24 +30077,8 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31426
30077
  this.maxRetries = options.maxRetries ?? 2;
31427
30078
  this.fetch = options.fetch ?? getDefaultFetch2();
31428
30079
  __classPrivateFieldSet2(this, _OpenAI_encoder, FallbackEncoder2, "f");
31429
- const customHeadersEnv = readEnv2("OPENAI_CUSTOM_HEADERS");
31430
- if (customHeadersEnv) {
31431
- const parsed = {};
31432
- for (const line of customHeadersEnv.split(`
31433
- `)) {
31434
- const colon = line.indexOf(":");
31435
- if (colon >= 0) {
31436
- parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
31437
- }
31438
- }
31439
- options.defaultHeaders = buildHeaders2([parsed, options.defaultHeaders]);
31440
- }
31441
30080
  this._options = options;
31442
- if (workloadIdentity) {
31443
- this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
31444
- }
31445
- this.apiKey = typeof apiKey === "string" ? apiKey : null;
31446
- this.adminAPIKey = adminAPIKey;
30081
+ this.apiKey = typeof apiKey === "string" ? apiKey : "Missing Key";
31447
30082
  this.organization = organization;
31448
30083
  this.project = project;
31449
30084
  this.webhookSecret = webhookSecret;
@@ -31458,9 +30093,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31458
30093
  logLevel: this.logLevel,
31459
30094
  fetch: this.fetch,
31460
30095
  fetchOptions: this.fetchOptions,
31461
- apiKey: this._options.apiKey,
31462
- adminAPIKey: this.adminAPIKey,
31463
- workloadIdentity: this._options.workloadIdentity,
30096
+ apiKey: this.apiKey,
31464
30097
  organization: this.organization,
31465
30098
  project: this.project,
31466
30099
  webhookSecret: this.webhookSecret,
@@ -31471,45 +30104,12 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31471
30104
  defaultQuery() {
31472
30105
  return this._options.defaultQuery;
31473
30106
  }
31474
- validateHeaders({ values: values2, nulls }, schemes = {
31475
- bearerAuth: true,
31476
- adminAPIKeyAuth: true
31477
- }) {
31478
- if (values2.get("authorization") || values2.get("api-key")) {
31479
- return;
31480
- }
31481
- if (nulls.has("authorization") || nulls.has("api-key")) {
31482
- return;
31483
- }
31484
- if (this._workloadIdentityAuth && schemes.bearerAuth) {
31485
- return;
31486
- }
31487
- 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');
31488
- }
31489
- async authHeaders(opts, schemes = {
31490
- bearerAuth: true,
31491
- adminAPIKeyAuth: true
31492
- }) {
31493
- return buildHeaders2([
31494
- schemes.bearerAuth ? await this.bearerAuth(opts) : null,
31495
- schemes.adminAPIKeyAuth ? await this.adminAPIKeyAuth(opts) : null
31496
- ]);
30107
+ validateHeaders({ values: values2, nulls }) {
30108
+ return;
31497
30109
  }
31498
- async bearerAuth(opts) {
31499
- if (this._workloadIdentityAuth) {
31500
- return buildHeaders2([{ Authorization: `Bearer ${await this._workloadIdentityAuth.getToken()}` }]);
31501
- }
31502
- if (this.apiKey == null) {
31503
- return;
31504
- }
30110
+ async authHeaders(opts) {
31505
30111
  return buildHeaders2([{ Authorization: `Bearer ${this.apiKey}` }]);
31506
30112
  }
31507
- async adminAPIKeyAuth(opts) {
31508
- if (this.adminAPIKey == null) {
31509
- return;
31510
- }
31511
- return buildHeaders2([{ Authorization: `Bearer ${this.adminAPIKey}` }]);
31512
- }
31513
30113
  stringifyQuery(query2) {
31514
30114
  return stringifyQuery2(query2);
31515
30115
  }
@@ -31554,10 +30154,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31554
30154
  return url.toString();
31555
30155
  }
31556
30156
  async prepareOptions(options) {
31557
- const security = options.__security ?? { bearerAuth: true };
31558
- if (security.bearerAuth) {
31559
- await this._callApiKey();
31560
- }
30157
+ await this._callApiKey();
31561
30158
  }
31562
30159
  async prepareRequest(request, { url, options }) {}
31563
30160
  get(path3, opts) {
@@ -31607,9 +30204,8 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31607
30204
  if (options.signal?.aborted) {
31608
30205
  throw new APIUserAbortError2;
31609
30206
  }
31610
- const security = options.__security ?? { bearerAuth: true };
31611
30207
  const controller = new AbortController;
31612
- const response = await this.fetchWithAuth(url, req, timeout, controller, security).catch(castToError2);
30208
+ const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError2);
31613
30209
  const headersTime = Date.now();
31614
30210
  if (response instanceof globalThis.Error) {
31615
30211
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
@@ -31634,31 +30230,14 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31634
30230
  durationMs: headersTime - startTime,
31635
30231
  message: response.message
31636
30232
  }));
31637
- if (response instanceof OAuthError || response instanceof SubjectTokenProviderError) {
31638
- throw response;
31639
- }
31640
30233
  if (isTimeout) {
31641
30234
  throw new APIConnectionTimeoutError2;
31642
30235
  }
31643
- throw new APIConnectionError2({
31644
- message: getConnectionErrorMessage(response),
31645
- cause: response
31646
- });
30236
+ throw new APIConnectionError2({ cause: response });
31647
30237
  }
31648
30238
  const specialHeaders = [...response.headers.entries()].filter(([name]) => name === "x-request-id").map(([name, value]) => ", " + name + ": " + JSON.stringify(value)).join("");
31649
30239
  const responseInfo = `[${requestLogID}${retryLogStr}${specialHeaders}] ${req.method} ${url} ${response.ok ? "succeeded" : "failed"} with status ${response.status} in ${headersTime - startTime}ms`;
31650
30240
  if (!response.ok) {
31651
- if (response.status === 401 && this._workloadIdentityAuth && security.bearerAuth && !options.__metadata?.["hasStreamingBody"] && !options.__metadata?.["workloadIdentityTokenRefreshed"]) {
31652
- await CancelReadableStream2(response.body);
31653
- this._workloadIdentityAuth.invalidateToken();
31654
- return this.makeRequest({
31655
- ...options,
31656
- __metadata: {
31657
- ...options.__metadata,
31658
- workloadIdentityTokenRefreshed: true
31659
- }
31660
- }, retriesRemaining, retryOfRequestLogID ?? requestLogID);
31661
- }
31662
30241
  const shouldRetry = await this.shouldRetry(response);
31663
30242
  if (retriesRemaining && shouldRetry) {
31664
30243
  const retryMessage2 = `retrying, ${retriesRemaining} attempts remaining`;
@@ -31706,21 +30285,6 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31706
30285
  const request = this.makeRequest(options, null, undefined);
31707
30286
  return new PagePromise2(this, request, Page3);
31708
30287
  }
31709
- async fetchWithAuth(url, init, timeout, controller, schemes = {
31710
- bearerAuth: true,
31711
- adminAPIKeyAuth: true
31712
- }) {
31713
- if (this._workloadIdentityAuth && schemes.bearerAuth) {
31714
- const headers = init.headers;
31715
- const authHeader = headers.get("Authorization");
31716
- if (!authHeader || authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
31717
- const token = await this._workloadIdentityAuth.getToken();
31718
- headers.set("Authorization", `Bearer ${token}`);
31719
- }
31720
- }
31721
- const response = await this.fetchWithTimeout(url, init, timeout, controller);
31722
- return response;
31723
- }
31724
30288
  async fetchWithTimeout(url, init, ms, controller) {
31725
30289
  const { signal, method, ...options } = init || {};
31726
30290
  const abort = this._makeAbort(controller);
@@ -31799,13 +30363,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31799
30363
  if ("timeout" in options)
31800
30364
  validatePositiveInteger2("timeout", options.timeout);
31801
30365
  options.timeout = options.timeout ?? this.timeout;
31802
- const { bodyHeaders, body, isStreamingBody } = this.buildBody({ options });
31803
- if (isStreamingBody) {
31804
- inputOptions.__metadata = {
31805
- ...inputOptions.__metadata,
31806
- hasStreamingBody: true
31807
- };
31808
- }
30366
+ const { bodyHeaders, body } = this.buildBody({ options });
31809
30367
  const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
31810
30368
  const req = {
31811
30369
  method,
@@ -31836,12 +30394,12 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31836
30394
  "OpenAI-Organization": this.organization,
31837
30395
  "OpenAI-Project": this.project
31838
30396
  },
31839
- await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
30397
+ await this.authHeaders(options),
31840
30398
  this._options.defaultHeaders,
31841
30399
  bodyHeaders,
31842
30400
  options.headers
31843
30401
  ]);
31844
- this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
30402
+ this.validateHeaders(headers);
31845
30403
  return headers.values;
31846
30404
  }
31847
30405
  _makeAbort(controller) {
@@ -31849,27 +30407,20 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
31849
30407
  }
31850
30408
  buildBody({ options: { body, headers: rawHeaders } }) {
31851
30409
  if (!body) {
31852
- return { bodyHeaders: undefined, body: undefined, isStreamingBody: false };
30410
+ return { bodyHeaders: undefined, body: undefined };
31853
30411
  }
31854
30412
  const headers = buildHeaders2([rawHeaders]);
31855
- const isReadableStream = typeof globalThis.ReadableStream !== "undefined" && body instanceof globalThis.ReadableStream;
31856
- 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);
31857
- 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) {
31858
- 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 };
31859
30415
  } else if (typeof body === "object" && ((Symbol.asyncIterator in body) || (Symbol.iterator in body) && ("next" in body) && typeof body.next === "function")) {
31860
- return {
31861
- bodyHeaders: undefined,
31862
- body: ReadableStreamFrom2(body),
31863
- isStreamingBody: true
31864
- };
30416
+ return { bodyHeaders: undefined, body: ReadableStreamFrom2(body) };
31865
30417
  } else if (typeof body === "object" && headers.values.get("content-type") === "application/x-www-form-urlencoded") {
31866
30418
  return {
31867
30419
  bodyHeaders: { "content-type": "application/x-www-form-urlencoded" },
31868
- body: this.stringifyQuery(body),
31869
- isStreamingBody: false
30420
+ body: this.stringifyQuery(body)
31870
30421
  };
31871
30422
  } else {
31872
- return { ...__classPrivateFieldGet2(this, _OpenAI_encoder, "f").call(this, { body, headers }), isStreamingBody: false };
30423
+ return __classPrivateFieldGet2(this, _OpenAI_encoder, "f").call(this, { body, headers });
31873
30424
  }
31874
30425
  }
31875
30426
  }
@@ -31908,7 +30459,6 @@ OpenAI.Webhooks = Webhooks;
31908
30459
  OpenAI.Beta = Beta2;
31909
30460
  OpenAI.Batches = Batches3;
31910
30461
  OpenAI.Uploads = Uploads;
31911
- OpenAI.Admin = Admin;
31912
30462
  OpenAI.Responses = Responses;
31913
30463
  OpenAI.Realtime = Realtime2;
31914
30464
  OpenAI.Conversations = Conversations;
@@ -31916,23 +30466,6 @@ OpenAI.Evals = Evals;
31916
30466
  OpenAI.Containers = Containers;
31917
30467
  OpenAI.Skills = Skills2;
31918
30468
  OpenAI.Videos = Videos;
31919
- function getConnectionErrorMessage(error3) {
31920
- if (isUndiciDispatcherVersionMismatchError(error3)) {
31921
- 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(...) } });`;
31922
- }
31923
- return;
31924
- }
31925
- function isUndiciDispatcherVersionMismatchError(error3) {
31926
- let current = error3;
31927
- for (let i = 0;i < 8 && current && typeof current === "object"; i++) {
31928
- const err = current;
31929
- if (err.code === "UND_ERR_INVALID_ARG" && typeof err.message === "string" && err.message.includes("invalid onRequestStart method")) {
31930
- return true;
31931
- }
31932
- current = err.cause;
31933
- }
31934
- return false;
31935
- }
31936
30469
  // node_modules/openai/azure.mjs
31937
30470
  var _deployments_endpoints = new Set([
31938
30471
  "/completions",
@@ -32120,6 +30653,50 @@ function setNestedValue(obj, path3, value) {
32120
30653
  const last = parts[parts.length - 1] ?? "";
32121
30654
  cur[last] = value;
32122
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
+ }
32123
30700
  async function callHttpAdapter(config, input, turns) {
32124
30701
  const start = Date.now();
32125
30702
  try {
@@ -32146,6 +30723,22 @@ async function callHttpAdapter(config, input, turns) {
32146
30723
  signal: config.timeoutMs ? AbortSignal.timeout(config.timeoutMs) : undefined
32147
30724
  });
32148
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
+ }
32149
30742
  const data = await response.json();
32150
30743
  let output;
32151
30744
  if (config.outputPath) {
@@ -32156,11 +30749,13 @@ async function callHttpAdapter(config, input, turns) {
32156
30749
  const usage = getNestedValue(data, "usage");
32157
30750
  const inputTokens = Number(usage?.["prompt_tokens"] ?? usage?.["input_tokens"] ?? 0) || undefined;
32158
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"));
32159
30753
  return {
32160
30754
  output,
32161
30755
  durationMs,
32162
30756
  inputTokens,
32163
30757
  outputTokens,
30758
+ toolCalls,
32164
30759
  statusCode: response.status
32165
30760
  };
32166
30761
  } catch (err) {
@@ -32658,22 +31253,85 @@ function printDiffReport(diff) {
32658
31253
  init_store();
32659
31254
 
32660
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
+ }
32661
31295
  function parseAdapterConfig(opts) {
32662
31296
  const type = opts["adapter"] ?? "http";
32663
- const apiKey = opts["apiKeyEnv"] ? process.env[opts["apiKeyEnv"]] : undefined;
31297
+ const apiKey = opts["apiKey"] ?? (opts["apiKeyEnv"] ? process.env[opts["apiKeyEnv"]] : undefined);
32664
31298
  switch (type) {
32665
31299
  case "http":
32666
31300
  if (!opts["url"])
32667
31301
  throw new Error("--url is required for http adapter");
32668
- 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
+ };
32669
31312
  case "anthropic":
32670
31313
  if (!opts["model"])
32671
31314
  throw new Error("--model is required for anthropic adapter");
32672
- return { type: "anthropic", model: opts["model"], systemPrompt: opts["system"], ...apiKey ? { apiKey } : {} };
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
+ };
32673
31323
  case "openai":
32674
31324
  if (!opts["model"])
32675
31325
  throw new Error("--model is required for openai adapter");
32676
- return { type: "openai", model: opts["model"], systemPrompt: opts["system"], baseURL: opts["url"], ...apiKey ? { apiKey } : {} };
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
+ };
32677
31335
  case "function":
32678
31336
  if (!opts["module"])
32679
31337
  throw new Error("--module is required for function adapter");
@@ -32681,7 +31339,11 @@ function parseAdapterConfig(opts) {
32681
31339
  case "cli":
32682
31340
  if (!opts["command"])
32683
31341
  throw new Error("--command is required for cli adapter");
32684
- return { type: "cli", command: opts["command"] };
31342
+ return {
31343
+ type: "cli",
31344
+ command: opts["command"],
31345
+ timeoutMs: parsePositiveInteger(opts["timeoutMs"], "--timeout-ms")
31346
+ };
32685
31347
  case "mcp":
32686
31348
  if (!opts["mcpCommand"])
32687
31349
  throw new Error("--mcp-command is required for mcp adapter");
@@ -32690,7 +31352,8 @@ function parseAdapterConfig(opts) {
32690
31352
  return {
32691
31353
  type: "mcp",
32692
31354
  command: opts["mcpCommand"].split(" "),
32693
- tool: opts["tool"]
31355
+ tool: opts["tool"],
31356
+ timeoutMs: parsePositiveInteger(opts["timeoutMs"], "--timeout-ms")
32694
31357
  };
32695
31358
  default:
32696
31359
  throw new Error(`Unknown adapter type: ${type}. Use: http|anthropic|openai|mcp|function|cli`);
@@ -32699,7 +31362,7 @@ function parseAdapterConfig(opts) {
32699
31362
 
32700
31363
  // src/cli/commands/run.ts
32701
31364
  function runCommand() {
32702
- 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("--model <model>", "Model name (for anthropic/openai adapter)").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) => {
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) => {
32703
31366
  const { cases, warnings } = await loadDataset(dataset, {
32704
31367
  tags: opts["tags"] ? opts["tags"].split(",") : undefined
32705
31368
  });
@@ -32739,7 +31402,7 @@ init_loader();
32739
31402
  init_store();
32740
31403
  function ciCommand() {
32741
31404
  const cmd = new Command("ci").description("Run evals in CI mode \u2014 exit non-zero on regression");
32742
- 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("--model <model>", "Model name (for anthropic/openai adapter)").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) => {
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) => {
32743
31406
  const { cases } = await loadDataset(dataset);
32744
31407
  const adapter = parseAdapterConfig(opts);
32745
31408
  const run = await runEvals(cases, { dataset, adapter, skipJudge: opts["judge"] === false || opts["noJudge"] === true });
@@ -33044,14 +31707,14 @@ function kappaLabel(k) {
33044
31707
  }
33045
31708
 
33046
31709
  // src/cli/commands/doctor.ts
33047
- import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
31710
+ import { existsSync as existsSync4, readFileSync as readFileSync2 } from "fs";
33048
31711
  import { homedir as homedir4 } from "os";
33049
31712
  import { join as join4 } from "path";
33050
31713
  function resolveApiKey2(envVar, secretsPath, secretsKey) {
33051
31714
  if (process.env[envVar])
33052
31715
  return process.env[envVar];
33053
31716
  const fullPath = join4(homedir4(), ".secrets", secretsPath);
33054
- if (existsSync3(fullPath)) {
31717
+ if (existsSync4(fullPath)) {
33055
31718
  try {
33056
31719
  const content = readFileSync2(fullPath, "utf8");
33057
31720
  for (const line of content.split(`
@@ -33096,7 +31759,7 @@ function doctorCommand() {
33096
31759
  }
33097
31760
  try {
33098
31761
  const { loadDataset: loadDataset2 } = await Promise.resolve().then(() => (init_loader(), exports_loader));
33099
- const { existsSync: existsSync4 } = await import("fs");
31762
+ const { existsSync: existsSync5 } = await import("fs");
33100
31763
  const { join: join5 } = await import("path");
33101
31764
  const { homedir: homedir5 } = await import("os");
33102
31765
  const candidates = [
@@ -33106,7 +31769,7 @@ function doctorCommand() {
33106
31769
  join5(import.meta.dir, "../datasets/examples/smoke.jsonl"),
33107
31770
  join5(homedir5(), ".hasna", "evals", "examples", "smoke.jsonl")
33108
31771
  ];
33109
- const found = candidates.find((p) => existsSync4(p));
31772
+ const found = candidates.find((p) => existsSync5(p));
33110
31773
  if (!found)
33111
31774
  throw new Error("not found");
33112
31775
  const { cases } = await loadDataset2(found);
@@ -33141,7 +31804,7 @@ function doctorCommand() {
33141
31804
  }
33142
31805
 
33143
31806
  // src/cli/commands/mcp.ts
33144
- 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";
33145
31808
  import { homedir as homedir5 } from "os";
33146
31809
  import { join as join5 } from "path";
33147
31810
  function mcpCommand() {
@@ -33167,7 +31830,7 @@ var ENTRY = { command: "/home/hasna/.bun/bin/evals-mcp", args: [] };
33167
31830
  function registerClaude() {
33168
31831
  const mcpPath = join5(homedir5(), ".claude", "mcp.json");
33169
31832
  let config = {};
33170
- if (existsSync4(mcpPath)) {
31833
+ if (existsSync5(mcpPath)) {
33171
31834
  config = JSON.parse(readFileSync3(mcpPath, "utf8"));
33172
31835
  }
33173
31836
  config.mcpServers = { ...config.mcpServers ?? {}, evals: ENTRY };
@@ -33179,7 +31842,7 @@ function registerClaude() {
33179
31842
  function registerCodex() {
33180
31843
  const cfgPath = join5(homedir5(), ".codex", "config.json");
33181
31844
  let config = {};
33182
- if (existsSync4(cfgPath)) {
31845
+ if (existsSync5(cfgPath)) {
33183
31846
  config = JSON.parse(readFileSync3(cfgPath, "utf8"));
33184
31847
  }
33185
31848
  config.mcpServers = { ...config.mcpServers ?? {}, evals: { type: "stdio", ...ENTRY, env: {} } };
@@ -33190,7 +31853,7 @@ function registerCodex() {
33190
31853
  function registerGemini() {
33191
31854
  const cfgPath = join5(homedir5(), ".gemini", "settings.json");
33192
31855
  let config = {};
33193
- if (existsSync4(cfgPath)) {
31856
+ if (existsSync5(cfgPath)) {
33194
31857
  config = JSON.parse(readFileSync3(cfgPath, "utf8"));
33195
31858
  }
33196
31859
  config.mcpServers = { ...config.mcpServers ?? {}, evals: ENTRY };
@@ -33202,14 +31865,62 @@ function registerGemini() {
33202
31865
  // src/cli/commands/capture.ts
33203
31866
  import { createServer } from "http";
33204
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
+ }
33205
31916
  function captureCommand() {
33206
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) => {
33207
31918
  const appUrl = opts["app"] ?? "";
33208
31919
  const port = parseInt(opts["port"] ?? "19441");
33209
31920
  const rate = parseFloat(opts["rate"] ?? "0.1");
33210
- const output = opts["output"] ?? "captured.jsonl";
31921
+ const outputPath = opts["output"] ?? "captured.jsonl";
33211
31922
  let captured = 0;
33212
- writeFileSync3(output, "");
31923
+ writeFileSync3(outputPath, "");
33213
31924
  const server = createServer(async (req, res) => {
33214
31925
  const body = await new Promise((resolve) => {
33215
31926
  let data = "";
@@ -33227,31 +31938,20 @@ function captureCommand() {
33227
31938
  res.writeHead(upstreamRes.status, Object.fromEntries(upstreamRes.headers));
33228
31939
  res.end(responseBody);
33229
31940
  if (Math.random() < rate) {
33230
- try {
33231
- const reqJson = JSON.parse(body);
33232
- const resJson = JSON.parse(responseBody);
33233
- const input = String(reqJson["messages"]?.at(-1)?.content ?? reqJson["input"] ?? body);
33234
- const output2 = String(resJson["choices"]?.[0]?.message?.content ?? resJson["content"] ?? responseBody);
33235
- const evalCase = {
33236
- id: `captured-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
33237
- input,
33238
- expected: "Review and add expected behavior before promoting to eval suite",
33239
- tags: ["captured", "needs-review"],
33240
- metadata: { capturedAt: new Date().toISOString(), responsePreview: output2.slice(0, 200) }
33241
- };
33242
- appendFileSync(output2, JSON.stringify(evalCase) + `
33243
- `);
31941
+ const evalCase = buildCapturedEvalCase(body, responseBody);
31942
+ if (evalCase) {
31943
+ appendCapturedEvalCase(outputPath, evalCase);
33244
31944
  captured++;
33245
31945
  if (captured % 10 === 0)
33246
- console.log(`Captured ${captured} cases \u2192 ${output2}`);
33247
- } catch {}
31946
+ console.log(`Captured ${captured} cases \u2192 ${outputPath}`);
31947
+ }
33248
31948
  }
33249
31949
  });
33250
31950
  server.listen(port, () => {
33251
31951
  console.log(`\x1B[32m\u2713 Capture proxy running on http://localhost:${port}\x1B[0m`);
33252
31952
  console.log(` Forwarding to: ${appUrl}`);
33253
31953
  console.log(` Sampling rate: ${(rate * 100).toFixed(0)}%`);
33254
- console.log(` Output: ${output}`);
31954
+ console.log(` Output: ${outputPath}`);
33255
31955
  console.log(` Ctrl+C to stop
33256
31956
  `);
33257
31957
  });