fix(coding-agent): add Bun runtime errata guard for OSC sequence width bug
Detects known Bun.stringWidth mishandling of OSC sequences at startup and exits with a clear upgrade message instead of crashing in the TUI render path. Fixes #31
This commit is contained in:
@@ -6,6 +6,14 @@
|
||||
import { type CommandEntry, run } from "@oh-my-pi/pi-utils/cli";
|
||||
import { APP_NAME, VERSION } from "./config";
|
||||
|
||||
// Detect known Bun errata that cause TUI crashes (e.g. Bun.stringWidth mishandling OSC sequences).
|
||||
if (Bun.stringWidth("\x1b[0m\x1b]8;;\x07") !== 0) {
|
||||
process.stderr.write(
|
||||
`error: Bun runtime errata detected (v${Bun.version}). Please update Bun: bun upgrade\n`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.title = APP_NAME;
|
||||
|
||||
const commands: CommandEntry[] = [
|
||||
|
||||
Reference in New Issue
Block a user