diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 93f794f7fa..515645ab0b 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -5,6 +5,8 @@ ### Fixed - Fixed all extension loading silently failing on the cross-compiled `omp-darwin-arm64` release binary (downloaded directly or via a Homebrew tap wrapper) because `__computeBunfsPackageRoot` mis-handled `import.meta.dir = "//root/omp-darwin-arm64"`. Bun 1.3.14 reports `/` for the compiled entry's `import.meta.dir`, but the pre-fix function joined `metaDir + "packages"` and produced `/root/omp-darwin-arm64/packages` — the binary basename was baked into every bunfs path, so the TypeBox/legacy-pi shims and every `@oh-my-pi/pi-*` package-root override failed `existsSync` validation and `resolveCanonicalPiSpecifier` fell through to a bunfs `Bun.resolveSync` that also could not find the module. The function now detects the bunfs-root + binary-basename shape (`path.basename(path.dirname(metaDir)) === "root"`) and strips the trailing binary segment by slicing the original `metaDir`; the production bunfs shim join path also preserves Bun's bunfs-native `//root` / `B:\~BUN\root` prefix that `path.join` would otherwise collapse. ([#3329](https://github.com/can1357/oh-my-pi/issues/3329)) +- Fixed the TUI usage display failing to resolve a used fraction for limits that only populate `remainingFraction` (no `usedFraction`, `used`/`limit`, or `percent`+`used`). The TUI's local `resolveFraction` was missing the inverted-remaining fallback that the shared `resolveUsedFraction` from `@oh-my-pi/pi-ai` already handles — replaced the local copy with the shared function so the TUI and CLI paths resolve fractions identically. + ## [16.1.16] - 2026-06-23 ### Breaking Changes diff --git a/packages/coding-agent/src/modes/controllers/command-controller.ts b/packages/coding-agent/src/modes/controllers/command-controller.ts index e85ba82621..e0fca48944 100644 --- a/packages/coding-agent/src/modes/controllers/command-controller.ts +++ b/packages/coding-agent/src/modes/controllers/command-controller.ts @@ -6,6 +6,7 @@ import { getEnvApiKey, getProviderDetails, type ProviderDetails, + resolveUsedFraction, type UsageLimit, type UsageReport, } from "@oh-my-pi/pi-ai"; @@ -1306,22 +1307,10 @@ export function renderProviderSection(details: ProviderDetails, uiTheme: Pick 0) { - return amount.used / amount.limit; - } - if (amount.unit === "percent" && amount.used !== undefined) { - return amount.used / 100; - } - return undefined; -} - function resolveProviderUsageTotal(reports: UsageReport[]): number { return reports .flatMap(report => report.limits) - .map(limit => resolveFraction(limit) ?? 0) + .map(limit => resolveUsedFraction(limit) ?? 0) .reduce((sum, value) => sum + value, 0); } @@ -1432,7 +1421,7 @@ function resolveAggregateStatus(limits: UsageLimit[]): UsageLimit["status"] { function formatAggregateAmount(limits: UsageLimit[]): string { const fractions = limits - .map(limit => resolveFraction(limit)) + .map(limit => resolveUsedFraction(limit)) .filter((value): value is number => value !== undefined); if (fractions.length === limits.length && fractions.length > 0) { const sum = fractions.reduce((total, value) => total + value, 0); @@ -1489,7 +1478,7 @@ function resolveStatusColor(status: UsageLimit["status"]): "success" | "warning" } function renderUsageBar(limit: UsageLimit, uiTheme: typeof theme, barWidth: number): string { - const fraction = resolveFraction(limit); + const fraction = resolveUsedFraction(limit); if (fraction === undefined) { return uiTheme.fg("dim", "·".repeat(barWidth)); } @@ -1610,7 +1599,7 @@ function renderUsageReports( const entries = group.limits.map((limit, index) => ({ limit, report: group.reports[index], - fraction: resolveFraction(limit), + fraction: resolveUsedFraction(limit), index, })); entries.sort((a, b) => {