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;