UNPKG

@openai/agents-core

Version:

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

38 lines • 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveLocalShellCommand = resolveLocalShellCommand; exports.resolveFallbackShellCommand = resolveFallbackShellCommand; const node_fs_1 = require("node:fs"); function resolveLocalShellCommand(args) { const configuredShell = firstNonEmpty(args.shell, args.defaultShell, args.envShell); if (configuredShell) { return shellCommand(configuredShell, args.login); } if (args.login) { const bashShell = firstExistingPath(args.bashPaths ?? ['/bin/bash', '/usr/bin/bash']); if (bashShell) { return shellCommand(bashShell, true); } } return shellCommand('/bin/sh', false); } function resolveFallbackShellCommand(args) { const configuredShell = firstNonEmpty(args.shell, args.defaultShell); if (configuredShell) { return shellCommand(configuredShell, args.login); } return shellCommand(args.fallbackShell ?? '/bin/sh', false); } function shellCommand(shellPath, login) { return { shellPath, flag: login ? '-lc' : '-c', }; } function firstExistingPath(paths) { return paths.find((path) => (0, node_fs_1.existsSync)(path)); } function firstNonEmpty(...values) { return values.find((value) => value !== undefined && value.trim().length > 0); } //# sourceMappingURL=shellCommand.js.map