@openai/agents-core
Version:
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.
34 lines • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultLocalSnapshotBaseDir = defaultLocalSnapshotBaseDir;
const node_os_1 = require("node:os");
const node_path_1 = require("node:path");
function isAbsoluteWindowsPath(value) {
const root = node_path_1.win32.parse(value).root;
return node_path_1.win32.isAbsolute(value) && root.length > 1;
}
function defaultLocalSnapshotBaseDir() {
const configured = process.env.OPENAI_AGENTS_SANDBOX_SNAPSHOT_DIR?.trim();
if (configured) {
return configured;
}
const home = (0, node_os_1.homedir)();
if (process.platform === 'darwin' && home) {
return node_path_1.posix.join(home, 'Library', 'Application Support', 'openai-agents-js', 'sandbox-snapshots');
}
if (process.platform === 'win32') {
const localAppData = process.env.LOCALAPPDATA?.trim();
return node_path_1.win32.join(localAppData && isAbsoluteWindowsPath(localAppData)
? localAppData
: home
? node_path_1.win32.join(home, 'AppData', 'Local')
: (0, node_os_1.tmpdir)(), 'openai-agents-js', 'sandbox-snapshots');
}
const stateHome = process.env.XDG_STATE_HOME?.trim();
return node_path_1.posix.join(stateHome && node_path_1.posix.isAbsolute(stateHome)
? stateHome
: home
? node_path_1.posix.join(home, '.local', 'state')
: (0, node_os_1.tmpdir)(), 'openai-agents-js', 'sandbox-snapshots');
}
//# sourceMappingURL=localSnapshotPaths.js.map