bingocode 1.0.14 → 1.0.16

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.
@@ -318,6 +318,33 @@ export function getProxyFetchOptions(opts?: { forAnthropicAPI?: boolean }): {
318
318
  return { ...base, ...getTLSFetchOptions() }
319
319
  }
320
320
 
321
+ /**
322
+ * Get fetch options that bypass any system proxies to test direct connectivity.
323
+ */
324
+ export function getDirectFetchOptions(): {
325
+ tls?: TLSConfig
326
+ dispatcher?: undici.Dispatcher
327
+ proxy?: undefined
328
+ keepalive?: false
329
+ } {
330
+ const base = keepAliveDisabled ? ({ keepalive: false } as const) : {}
331
+
332
+ if (typeof Bun !== 'undefined') {
333
+ // In Bun, explicit undefined for proxy bypasses the system proxy
334
+ return { ...base, proxy: undefined, ...getTLSFetchOptions() }
335
+ }
336
+
337
+ // In Node.js/undici, a fresh Agent with no proxy settings bypasses system defaults
338
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
339
+ const undiciMod = require('undici') as typeof undici
340
+ const tlsOpts = getTLSFetchOptions()
341
+
342
+ return {
343
+ ...base,
344
+ dispatcher: new undiciMod.Agent(tlsOpts.dispatcher ? (tlsOpts.dispatcher as any).options : {}),
345
+ }
346
+ }
347
+
321
348
  /**
322
349
  * Configure global HTTP agents for both axios and undici
323
350
  * This ensures all HTTP requests use the proxy and/or mTLS if configured