UNPKG

agentlang

Version:

The easiest way to build the most reliable AI agents - enterprise-grade teams of AI agents that collaborate with each other and humans

50 lines 1.66 kB
var _a; export let chalk; // Environment detection // Check if we're in a Node.js environment by verifying process.versions.node exists export const isNodeEnv = typeof process !== 'undefined' && !!((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node); if (isNodeEnv) { // Only import Node.js modules in Node environment // Using dynamic imports to avoid breaking browser bundling import('chalk').then(module => { chalk = module.default; }); } export function isExecGraphEnabled() { if (isNodeEnv) { const flag = process.env['AL_EXEC_GRAPH_ENABLED']; if (flag !== undefined && flag === 'false') { return false; } } return true; } // Browser-compatible path utilities export const browserPath = { extname: (path) => { const lastDotIndex = path.lastIndexOf('.'); return lastDotIndex !== -1 ? path.substring(lastDotIndex) : ''; }, basename: (path, ext) => { let name = path.split('/').pop() || ''; if (ext && name.endsWith(ext)) { name = name.substring(0, name.length - ext.length); } return name; }, dirname: (path) => { const parts = path.split('/'); parts.pop(); return parts.join('/') || '.'; }, join: (...parts) => { return parts.filter(Boolean).join('/').replace(/\/+/g, '/'); }, resolve: (path) => { return path; }, sep: '/', }; // Use either Node.js path or browser path based on environment export const path = isNodeEnv ? await import('node:path').then(module => module) : browserPath; //# sourceMappingURL=runtime.js.map