UNPKG

@openai/agents-core

Version:

The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.

108 lines 3.49 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.logging = exports.tracing = void 0; exports.loadEnv = loadEnv; // Use function instead of exporting the value to prevent // circular dependency resolution issues caused by other exports in '@openai/agents-core/_shims' const _shims = __importStar(require("@openai/agents-core/_shims")); function fallbackIsBrowserEnvironment() { return (typeof window !== 'undefined' && typeof document !== 'undefined' && typeof document.createElement === 'function'); } function isBrowserEnvironment() { try { if (typeof _shims?.isBrowserEnvironment === 'function') { return _shims.isBrowserEnvironment(); } } catch { // Fallback below. } return fallbackIsBrowserEnvironment(); } /** * Loads environment variables from the process environment. * * @returns An object containing the environment variables. */ function loadEnv() { try { const env = _shims?.loadEnv?.(); return typeof env === 'object' && env != null ? env : {}; } catch { return {}; } } /** * Checks if a flag is enabled in the environment. * * @param flagName - The name of the flag to check. * @returns `true` if the flag is enabled, `false` otherwise. */ function isEnabled(flagName) { const env = loadEnv(); return (typeof env !== 'undefined' && (env[flagName] === 'true' || env[flagName] === '1')); } /** * Global configuration for tracing. */ exports.tracing = { get disabled() { if (isBrowserEnvironment()) { return true; } else if (loadEnv().NODE_ENV === 'test') { // disabling by default in tests return true; } return isEnabled('OPENAI_AGENTS_DISABLE_TRACING'); }, }; /** * Global configuration for logging. */ exports.logging = { get dontLogModelData() { return isEnabled('OPENAI_AGENTS_DONT_LOG_MODEL_DATA'); }, get dontLogToolData() { return isEnabled('OPENAI_AGENTS_DONT_LOG_TOOL_DATA'); }, }; //# sourceMappingURL=config.js.map