@oh-my-pi/pi-tui 8.12.9 → 8.12.10
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/package.json +2 -2
- package/src/terminal.ts +2 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-tui",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.10",
|
|
4
4
|
"description": "Terminal User Interface library with differential rendering for efficient text-based applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"bun": ">=1.3.7"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@oh-my-pi/pi-natives": "8.12.
|
|
50
|
+
"@oh-my-pi/pi-natives": "8.12.10",
|
|
51
51
|
"@types/mime-types": "^3.0.1",
|
|
52
52
|
"chalk": "^5.6.2",
|
|
53
53
|
"marked": "^17.0.1",
|
package/src/terminal.ts
CHANGED
|
@@ -80,8 +80,6 @@ export class ProcessTerminal implements Terminal {
|
|
|
80
80
|
private stdinDataHandler?: (data: string) => void;
|
|
81
81
|
private dead = false;
|
|
82
82
|
private writeLogPath = process.env.OMP_TUI_WRITE_LOG || "";
|
|
83
|
-
private lastStdinEvent = Date.now();
|
|
84
|
-
private stdinMonitor?: ReturnType<typeof setInterval>;
|
|
85
83
|
|
|
86
84
|
get kittyProtocolActive(): boolean {
|
|
87
85
|
return this._kittyProtocolActive;
|
|
@@ -166,29 +164,10 @@ export class ProcessTerminal implements Terminal {
|
|
|
166
164
|
|
|
167
165
|
// Handler that pipes stdin data through the buffer
|
|
168
166
|
this.stdinDataHandler = (data: string) => {
|
|
169
|
-
this.lastStdinEvent = Date.now();
|
|
170
167
|
this.stdinBuffer!.process(data);
|
|
171
168
|
};
|
|
172
169
|
}
|
|
173
170
|
|
|
174
|
-
private startStdinMonitor(): void {
|
|
175
|
-
this.lastStdinEvent = Date.now();
|
|
176
|
-
this.stdinMonitor = setInterval(() => {
|
|
177
|
-
const elapsed = Date.now() - this.lastStdinEvent;
|
|
178
|
-
if (elapsed > 10000) {
|
|
179
|
-
logger.warn("stdin appears stalled - no input events received", { elapsedMs: elapsed });
|
|
180
|
-
}
|
|
181
|
-
}, 10000);
|
|
182
|
-
this.stdinMonitor.unref();
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
private stopStdinMonitor(): void {
|
|
186
|
-
if (this.stdinMonitor) {
|
|
187
|
-
clearInterval(this.stdinMonitor);
|
|
188
|
-
this.stdinMonitor = undefined;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
171
|
/**
|
|
193
172
|
* Query terminal for Kitty keyboard protocol support and enable if available.
|
|
194
173
|
*
|
|
@@ -201,7 +180,6 @@ export class ProcessTerminal implements Terminal {
|
|
|
201
180
|
private queryAndEnableKittyProtocol(): void {
|
|
202
181
|
this.setupStdinBuffer();
|
|
203
182
|
process.stdin.on("data", this.stdinDataHandler!);
|
|
204
|
-
this.startStdinMonitor();
|
|
205
183
|
this.safeWrite("\x1b[?u");
|
|
206
184
|
}
|
|
207
185
|
|
|
@@ -211,9 +189,6 @@ export class ProcessTerminal implements Terminal {
|
|
|
211
189
|
activeTerminal = null;
|
|
212
190
|
}
|
|
213
191
|
|
|
214
|
-
// Stop stdin monitor
|
|
215
|
-
this.stopStdinMonitor();
|
|
216
|
-
|
|
217
192
|
// Disable bracketed paste mode
|
|
218
193
|
this.safeWrite("\x1b[?2004l");
|
|
219
194
|
|
|
@@ -262,9 +237,10 @@ export class ProcessTerminal implements Terminal {
|
|
|
262
237
|
if (this.dead) return;
|
|
263
238
|
try {
|
|
264
239
|
process.stdout.write(data);
|
|
265
|
-
} catch {
|
|
240
|
+
} catch (err) {
|
|
266
241
|
// Any write failure means terminal is dead - no recovery possible
|
|
267
242
|
this.dead = true;
|
|
243
|
+
logger.warn("terminal is dead - no recovery possible", { error: err, data });
|
|
268
244
|
}
|
|
269
245
|
}
|
|
270
246
|
|