UNPKG

@mondaydotcomorg/atp-runtime

Version:

Runtime SDK injected into sandbox for Agent Tool Protocol

31 lines 860 B
export const utils = { async sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); }, async retry(fn, options) { let lastError; for (let attempt = 1; attempt <= options.maxAttempts; attempt++) { try { return await fn(); } catch (error) { lastError = error; if (attempt < options.maxAttempts) { await this.sleep(options.delayMs); } } } throw lastError; }, async parallel(tasks) { return Promise.all(tasks.map((task) => task())); }, async sequence(tasks) { const results = []; for (const task of tasks) { results.push(await task()); } return results; }, }; //# sourceMappingURL=utils.js.map