@oh-my-pi/pi-tui 13.3.9 → 13.3.12

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [13.3.11] - 2026-02-28
6
+
7
+ ### Fixed
8
+
9
+ - Restored terminal image protocol override and fallback detection for image rendering, including `PI_FORCE_IMAGE_PROTOCOL` support and Kitty fallback for screen/tmux/ghostty-style TERM environments.
10
+
5
11
  ## [13.3.8] - 2026-02-28
6
12
  ### Breaking Changes
7
13
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-tui",
4
- "version": "13.3.9",
4
+ "version": "13.3.12",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -33,8 +33,8 @@
33
33
  "test": "bun test test/*.test.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@oh-my-pi/pi-natives": "13.3.9",
37
- "@oh-my-pi/pi-utils": "13.3.9",
36
+ "@oh-my-pi/pi-natives": "13.3.12",
37
+ "@oh-my-pi/pi-utils": "13.3.12",
38
38
  "marked": "^17.0"
39
39
  },
40
40
  "devDependencies": {
@@ -47,6 +47,24 @@ export function isNotificationSuppressed(): boolean {
47
47
  return value === "off" || value === "0" || value === "false";
48
48
  }
49
49
 
50
+ function getForcedImageProtocol(): ImageProtocol | null | undefined {
51
+ const raw = $env.PI_FORCE_IMAGE_PROTOCOL?.trim().toLowerCase();
52
+ if (!raw) return undefined;
53
+ if (raw === "kitty") return ImageProtocol.Kitty;
54
+ if (raw === "iterm2" || raw === "iterm") return ImageProtocol.Iterm2;
55
+ if (raw === "off" || raw === "none" || raw === "0" || raw === "false") return null;
56
+ return null;
57
+ }
58
+
59
+ function getFallbackImageProtocol(terminalId: TerminalId): ImageProtocol | null {
60
+ if (!process.stdout.isTTY) return null;
61
+ if (terminalId === "vscode" || terminalId === "alacritty") return null;
62
+ const term = Bun.env.TERM?.toLowerCase() ?? "";
63
+ if (term.includes("screen") || term.includes("tmux") || term.includes("ghostty")) {
64
+ return ImageProtocol.Kitty;
65
+ }
66
+ return null;
67
+ }
50
68
  const KNOWN_TERMINALS = Object.freeze({
51
69
  // Fallback terminals
52
70
  base: new TerminalInfo("base", null, false, true, NotifyProtocol.Bell),
@@ -101,7 +119,32 @@ export const TERMINAL_ID: TerminalId = (() => {
101
119
  return "base";
102
120
  })();
103
121
 
104
- export const TERMINAL = getTerminalInfo(TERMINAL_ID);
122
+ export const TERMINAL = (() => {
123
+ const terminal = getTerminalInfo(TERMINAL_ID);
124
+ const forcedImageProtocol = getForcedImageProtocol();
125
+ if (forcedImageProtocol !== undefined) {
126
+ return new TerminalInfo(
127
+ terminal.id,
128
+ forcedImageProtocol,
129
+ terminal.trueColor,
130
+ terminal.hyperlinks,
131
+ terminal.notifyProtocol,
132
+ );
133
+ }
134
+ if (!terminal.imageProtocol) {
135
+ const fallbackImageProtocol = getFallbackImageProtocol(terminal.id);
136
+ if (fallbackImageProtocol) {
137
+ return new TerminalInfo(
138
+ terminal.id,
139
+ fallbackImageProtocol,
140
+ terminal.trueColor,
141
+ terminal.hyperlinks,
142
+ terminal.notifyProtocol,
143
+ );
144
+ }
145
+ }
146
+ return terminal;
147
+ })();
105
148
 
106
149
  export function getTerminalInfo(terminalId: TerminalId): TerminalInfo {
107
150
  return KNOWN_TERMINALS[terminalId];