ikie-cli 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/repl.js +18 -1
- package/package.json +1 -1
package/dist/repl.js
CHANGED
|
@@ -615,6 +615,19 @@ async function handleSlashCommand(input, agent, config, projectContext, rl, sess
|
|
|
615
615
|
return true;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
+
function fmtReset(resetAt) {
|
|
619
|
+
if (!resetAt)
|
|
620
|
+
return 'not started';
|
|
621
|
+
const ms = resetAt - Date.now();
|
|
622
|
+
if (ms <= 0)
|
|
623
|
+
return 'now';
|
|
624
|
+
const mins = Math.ceil(ms / 60000);
|
|
625
|
+
const h = Math.floor(mins / 60);
|
|
626
|
+
const m = mins % 60;
|
|
627
|
+
if (h >= 24)
|
|
628
|
+
return `${Math.floor(h / 24)}d ${h % 24}h`;
|
|
629
|
+
return h > 0 ? `${h}h ${m}m` : `${m}m`;
|
|
630
|
+
}
|
|
618
631
|
function fmtUsd(n) {
|
|
619
632
|
if (n === 0)
|
|
620
633
|
return '$0.00';
|
|
@@ -633,7 +646,11 @@ function printUsage(data) {
|
|
|
633
646
|
const s = data.stats;
|
|
634
647
|
const row = (label, value) => console.log(` ${c.secondary(label.padEnd(18))} ${c.white(value)}`);
|
|
635
648
|
console.log(`\n${c.primary.bold('Account Usage')}\n`);
|
|
636
|
-
|
|
649
|
+
const w5 = data.limits.fiveHour;
|
|
650
|
+
const wk = data.limits.weekly;
|
|
651
|
+
const limitColor = (rem, lim) => rem <= 0 ? c.error : rem / lim <= 0.3 ? c.warning : c.success;
|
|
652
|
+
row('5-hour limit', `${limitColor(w5.remaining, w5.limit).bold(fmtUsd(w5.remaining))} left ${c.muted(`of ${fmtUsd(w5.limit)} · resets ${fmtReset(w5.resetAt)}`)}`);
|
|
653
|
+
row('Weekly limit', `${limitColor(wk.remaining, wk.limit).bold(fmtUsd(wk.remaining))} left ${c.muted(`of ${fmtUsd(wk.limit)} · resets ${fmtReset(wk.resetAt)}`)}`);
|
|
637
654
|
row('Total spent', fmtUsd(s.totalCost));
|
|
638
655
|
console.log();
|
|
639
656
|
row('Requests · 30d', s.requests30d.toLocaleString());
|