From 58d8c352f3ef07ad1952fd7c8a37b97955d75dd5 Mon Sep 17 00:00:00 2001 From: sebseb7 Date: Tue, 12 Aug 2025 22:07:48 +0000 Subject: [PATCH] Add Array.fromAsync polyfill in cli.js for better async iterable support. This enhancement improves compatibility with async data processing in the CLI environment. --- cli.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cli.js b/cli.js index cdcc65b..90294e7 100644 --- a/cli.js +++ b/cli.js @@ -10,6 +10,16 @@ import { promises as fs, unwatchFile } from "node:fs"; import { fileURLToPath } from "node:url"; import path from "node:path"; +if (!Array.fromAsync) { + Array.fromAsync = async function fromAsync(asyncIterable) { + const array = []; + for await (const item of asyncIterable) { + array.push(item); + } + return array; + }; +} + function renderUsage(usage) { const inputTokens = usage.input_tokens - usage.input_tokens_details.cached_tokens; const cacheTokens = usage.input_tokens_details.cached_tokens;