Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/coding-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<bunfs-root>/<binary-name>` 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
Expand Down
21 changes: 5 additions & 16 deletions packages/coding-agent/src/modes/controllers/command-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getEnvApiKey,
getProviderDetails,
type ProviderDetails,
resolveUsedFraction,
type UsageLimit,
type UsageReport,
} from "@oh-my-pi/pi-ai";
Expand Down Expand Up @@ -1306,22 +1307,10 @@ export function renderProviderSection(details: ProviderDetails, uiTheme: Pick<ty
return `${lines.join("\n")}\n`;
}

function resolveFraction(limit: UsageLimit): number | undefined {
const amount = limit.amount;
if (amount.usedFraction !== undefined) return amount.usedFraction;
if (amount.used !== undefined && amount.limit !== undefined && amount.limit > 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);
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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) => {
Expand Down
Loading