@h-rig/cli 0.0.6-alpha.81 → 0.0.6-alpha.82
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/dist/bin/rig.js +11 -5
- package/dist/src/app-opentui/adapters/pi-attach.js +8 -4
- package/dist/src/app-opentui/bootstrap.js +11 -5
- package/dist/src/app-opentui/index.js +13 -5
- package/dist/src/app-opentui/pi-pty-host.js +8 -4
- package/dist/src/app-opentui/registry.js +8 -4
- package/dist/src/app-opentui/render/image-visual-layer-native-canvas.js +5 -1
- package/dist/src/app-opentui/render/image-visual-layer-worker.js +5 -1
- package/dist/src/app-opentui/render/image-visual-layer.d.ts +1 -0
- package/dist/src/app-opentui/render/image-visual-layer.js +5 -1
- package/dist/src/app-opentui/runtime.js +13 -5
- package/package.json +8 -8
package/dist/bin/rig.js
CHANGED
|
@@ -4347,7 +4347,7 @@ class PiPtyHost {
|
|
|
4347
4347
|
this.respondToRawTerminalQueries(text);
|
|
4348
4348
|
this.terminal.write(data, () => this.emitSnapshotSoon());
|
|
4349
4349
|
}
|
|
4350
|
-
emitSnapshotSoon(delayMs =
|
|
4350
|
+
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS) {
|
|
4351
4351
|
if (this._disposed || this.notifyTimer)
|
|
4352
4352
|
return;
|
|
4353
4353
|
this.notifyTimer = setTimeout(() => {
|
|
@@ -4361,16 +4361,18 @@ class PiPtyHost {
|
|
|
4361
4361
|
const buffer = this.terminal.buffer.active;
|
|
4362
4362
|
const end = buffer.length;
|
|
4363
4363
|
const start = Math.max(0, end - MAX_SNAPSHOT_LINES);
|
|
4364
|
+
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
4364
4365
|
const lines = [];
|
|
4365
4366
|
const styledLines = [];
|
|
4366
4367
|
for (let row = start;row < end; row += 1) {
|
|
4367
4368
|
const line = buffer.getLine(row);
|
|
4368
4369
|
lines.push((line?.translateToString(false) ?? "").slice(0, this.cols));
|
|
4369
|
-
|
|
4370
|
+
if (row >= styledStart)
|
|
4371
|
+
styledLines[lines.length - 1] = lineToStyledText(line, this.cols);
|
|
4370
4372
|
}
|
|
4371
4373
|
while (lines.length < this.rows) {
|
|
4372
4374
|
lines.push("");
|
|
4373
|
-
styledLines.
|
|
4375
|
+
styledLines[lines.length - 1] = new StyledText([{ __isChunk: true, text: "" }]);
|
|
4374
4376
|
}
|
|
4375
4377
|
return {
|
|
4376
4378
|
runId: this.runId,
|
|
@@ -4416,7 +4418,7 @@ class PiPtyHost {
|
|
|
4416
4418
|
}
|
|
4417
4419
|
}
|
|
4418
4420
|
}
|
|
4419
|
-
var MIN_COLS = 40, MIN_ROWS = 12, MAX_ROWS = 300, MAX_SNAPSHOT_LINES =
|
|
4421
|
+
var MIN_COLS = 40, MIN_ROWS = 12, MAX_ROWS = 300, MAX_SNAPSHOT_LINES = 360, STYLED_SNAPSHOT_MARGIN = 24, SNAPSHOT_DELAY_MS = 33, fallbackChildScriptPath, activeHost = null, XTERM_COLOR_MODE_INDEXED_16 = 16777216, XTERM_COLOR_MODE_INDEXED_256 = 33554432, XTERM_COLOR_MODE_RGB = 50331648;
|
|
4420
4422
|
var init_pi_pty_host = __esm(() => {
|
|
4421
4423
|
fallbackChildScriptPath = fileURLToPath(new URL("./pi-host-child.ts", import.meta.url));
|
|
4422
4424
|
});
|
|
@@ -17912,6 +17914,7 @@ class ImageVisualLayer {
|
|
|
17912
17914
|
chromeSlot = this.createSlot();
|
|
17913
17915
|
pendingFrames = new Map;
|
|
17914
17916
|
recentWrittenKeys = [];
|
|
17917
|
+
imagesVisible = false;
|
|
17915
17918
|
requestId = 0;
|
|
17916
17919
|
lastMotionFrameIndex = -1;
|
|
17917
17920
|
lastPanelFrameIndex = -1;
|
|
@@ -17931,7 +17934,9 @@ class ImageVisualLayer {
|
|
|
17931
17934
|
}
|
|
17932
17935
|
clear() {
|
|
17933
17936
|
if (this.enabled) {
|
|
17934
|
-
|
|
17937
|
+
if (this.imagesVisible)
|
|
17938
|
+
this.stdout.write([this.imageId, ...this.panelImageIds, ...this.panelChromeImageIds].map((id) => deleteKittyImage(id)).join("") + "\x1B[?25h");
|
|
17939
|
+
this.imagesVisible = false;
|
|
17935
17940
|
this.pendingFrames.clear();
|
|
17936
17941
|
this.recentWrittenKeys.length = 0;
|
|
17937
17942
|
this.resetSlot(this.motionSlot);
|
|
@@ -18051,6 +18056,7 @@ class ImageVisualLayer {
|
|
|
18051
18056
|
this.stdout.cork?.();
|
|
18052
18057
|
const accepted = this.stdout.write(payload);
|
|
18053
18058
|
this.stdout.uncork?.();
|
|
18059
|
+
this.imagesVisible = true;
|
|
18054
18060
|
return accepted;
|
|
18055
18061
|
}
|
|
18056
18062
|
createSlot() {
|
|
@@ -776,7 +776,9 @@ import { Terminal as XtermTerminal } from "@xterm/headless";
|
|
|
776
776
|
var MIN_COLS = 40;
|
|
777
777
|
var MIN_ROWS = 12;
|
|
778
778
|
var MAX_ROWS = 300;
|
|
779
|
-
var MAX_SNAPSHOT_LINES =
|
|
779
|
+
var MAX_SNAPSHOT_LINES = 360;
|
|
780
|
+
var STYLED_SNAPSHOT_MARGIN = 24;
|
|
781
|
+
var SNAPSHOT_DELAY_MS = 33;
|
|
780
782
|
var fallbackChildScriptPath = fileURLToPath(new URL("./pi-host-child.ts", import.meta.url));
|
|
781
783
|
var activeHost = null;
|
|
782
784
|
function clampCols(cols) {
|
|
@@ -1068,7 +1070,7 @@ class PiPtyHost {
|
|
|
1068
1070
|
this.respondToRawTerminalQueries(text);
|
|
1069
1071
|
this.terminal.write(data, () => this.emitSnapshotSoon());
|
|
1070
1072
|
}
|
|
1071
|
-
emitSnapshotSoon(delayMs =
|
|
1073
|
+
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS) {
|
|
1072
1074
|
if (this._disposed || this.notifyTimer)
|
|
1073
1075
|
return;
|
|
1074
1076
|
this.notifyTimer = setTimeout(() => {
|
|
@@ -1082,16 +1084,18 @@ class PiPtyHost {
|
|
|
1082
1084
|
const buffer = this.terminal.buffer.active;
|
|
1083
1085
|
const end = buffer.length;
|
|
1084
1086
|
const start = Math.max(0, end - MAX_SNAPSHOT_LINES);
|
|
1087
|
+
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
1085
1088
|
const lines = [];
|
|
1086
1089
|
const styledLines = [];
|
|
1087
1090
|
for (let row = start;row < end; row += 1) {
|
|
1088
1091
|
const line = buffer.getLine(row);
|
|
1089
1092
|
lines.push((line?.translateToString(false) ?? "").slice(0, this.cols));
|
|
1090
|
-
|
|
1093
|
+
if (row >= styledStart)
|
|
1094
|
+
styledLines[lines.length - 1] = lineToStyledText(line, this.cols);
|
|
1091
1095
|
}
|
|
1092
1096
|
while (lines.length < this.rows) {
|
|
1093
1097
|
lines.push("");
|
|
1094
|
-
styledLines.
|
|
1098
|
+
styledLines[lines.length - 1] = new StyledText([{ __isChunk: true, text: "" }]);
|
|
1095
1099
|
}
|
|
1096
1100
|
return {
|
|
1097
1101
|
runId: this.runId,
|
|
@@ -3762,7 +3762,7 @@ class PiPtyHost {
|
|
|
3762
3762
|
this.respondToRawTerminalQueries(text);
|
|
3763
3763
|
this.terminal.write(data, () => this.emitSnapshotSoon());
|
|
3764
3764
|
}
|
|
3765
|
-
emitSnapshotSoon(delayMs =
|
|
3765
|
+
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS) {
|
|
3766
3766
|
if (this._disposed || this.notifyTimer)
|
|
3767
3767
|
return;
|
|
3768
3768
|
this.notifyTimer = setTimeout(() => {
|
|
@@ -3776,16 +3776,18 @@ class PiPtyHost {
|
|
|
3776
3776
|
const buffer = this.terminal.buffer.active;
|
|
3777
3777
|
const end = buffer.length;
|
|
3778
3778
|
const start = Math.max(0, end - MAX_SNAPSHOT_LINES);
|
|
3779
|
+
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
3779
3780
|
const lines = [];
|
|
3780
3781
|
const styledLines = [];
|
|
3781
3782
|
for (let row = start;row < end; row += 1) {
|
|
3782
3783
|
const line = buffer.getLine(row);
|
|
3783
3784
|
lines.push((line?.translateToString(false) ?? "").slice(0, this.cols));
|
|
3784
|
-
|
|
3785
|
+
if (row >= styledStart)
|
|
3786
|
+
styledLines[lines.length - 1] = lineToStyledText(line, this.cols);
|
|
3785
3787
|
}
|
|
3786
3788
|
while (lines.length < this.rows) {
|
|
3787
3789
|
lines.push("");
|
|
3788
|
-
styledLines.
|
|
3790
|
+
styledLines[lines.length - 1] = new StyledText([{ __isChunk: true, text: "" }]);
|
|
3789
3791
|
}
|
|
3790
3792
|
return {
|
|
3791
3793
|
runId: this.runId,
|
|
@@ -3831,7 +3833,7 @@ class PiPtyHost {
|
|
|
3831
3833
|
}
|
|
3832
3834
|
}
|
|
3833
3835
|
}
|
|
3834
|
-
var MIN_COLS = 40, MIN_ROWS = 12, MAX_ROWS = 300, MAX_SNAPSHOT_LINES =
|
|
3836
|
+
var MIN_COLS = 40, MIN_ROWS = 12, MAX_ROWS = 300, MAX_SNAPSHOT_LINES = 360, STYLED_SNAPSHOT_MARGIN = 24, SNAPSHOT_DELAY_MS = 33, fallbackChildScriptPath, activeHost = null, XTERM_COLOR_MODE_INDEXED_16 = 16777216, XTERM_COLOR_MODE_INDEXED_256 = 33554432, XTERM_COLOR_MODE_RGB = 50331648;
|
|
3835
3837
|
var init_pi_pty_host = __esm(() => {
|
|
3836
3838
|
fallbackChildScriptPath = fileURLToPath(new URL("./pi-host-child.ts", import.meta.url));
|
|
3837
3839
|
});
|
|
@@ -16221,6 +16223,7 @@ class ImageVisualLayer {
|
|
|
16221
16223
|
chromeSlot = this.createSlot();
|
|
16222
16224
|
pendingFrames = new Map;
|
|
16223
16225
|
recentWrittenKeys = [];
|
|
16226
|
+
imagesVisible = false;
|
|
16224
16227
|
requestId = 0;
|
|
16225
16228
|
lastMotionFrameIndex = -1;
|
|
16226
16229
|
lastPanelFrameIndex = -1;
|
|
@@ -16240,7 +16243,9 @@ class ImageVisualLayer {
|
|
|
16240
16243
|
}
|
|
16241
16244
|
clear() {
|
|
16242
16245
|
if (this.enabled) {
|
|
16243
|
-
|
|
16246
|
+
if (this.imagesVisible)
|
|
16247
|
+
this.stdout.write([this.imageId, ...this.panelImageIds, ...this.panelChromeImageIds].map((id) => deleteKittyImage(id)).join("") + "\x1B[?25h");
|
|
16248
|
+
this.imagesVisible = false;
|
|
16244
16249
|
this.pendingFrames.clear();
|
|
16245
16250
|
this.recentWrittenKeys.length = 0;
|
|
16246
16251
|
this.resetSlot(this.motionSlot);
|
|
@@ -16360,6 +16365,7 @@ class ImageVisualLayer {
|
|
|
16360
16365
|
this.stdout.cork?.();
|
|
16361
16366
|
const accepted = this.stdout.write(payload);
|
|
16362
16367
|
this.stdout.uncork?.();
|
|
16368
|
+
this.imagesVisible = true;
|
|
16363
16369
|
return accepted;
|
|
16364
16370
|
}
|
|
16365
16371
|
createSlot() {
|
|
@@ -1635,6 +1635,7 @@ class ImageVisualLayer {
|
|
|
1635
1635
|
chromeSlot = this.createSlot();
|
|
1636
1636
|
pendingFrames = new Map;
|
|
1637
1637
|
recentWrittenKeys = [];
|
|
1638
|
+
imagesVisible = false;
|
|
1638
1639
|
requestId = 0;
|
|
1639
1640
|
lastMotionFrameIndex = -1;
|
|
1640
1641
|
lastPanelFrameIndex = -1;
|
|
@@ -1654,7 +1655,9 @@ class ImageVisualLayer {
|
|
|
1654
1655
|
}
|
|
1655
1656
|
clear() {
|
|
1656
1657
|
if (this.enabled) {
|
|
1657
|
-
|
|
1658
|
+
if (this.imagesVisible)
|
|
1659
|
+
this.stdout.write([this.imageId, ...this.panelImageIds, ...this.panelChromeImageIds].map((id) => deleteKittyImage(id)).join("") + "\x1B[?25h");
|
|
1660
|
+
this.imagesVisible = false;
|
|
1658
1661
|
this.pendingFrames.clear();
|
|
1659
1662
|
this.recentWrittenKeys.length = 0;
|
|
1660
1663
|
this.resetSlot(this.motionSlot);
|
|
@@ -1774,6 +1777,7 @@ class ImageVisualLayer {
|
|
|
1774
1777
|
this.stdout.cork?.();
|
|
1775
1778
|
const accepted = this.stdout.write(payload);
|
|
1776
1779
|
this.stdout.uncork?.();
|
|
1780
|
+
this.imagesVisible = true;
|
|
1777
1781
|
return accepted;
|
|
1778
1782
|
}
|
|
1779
1783
|
createSlot() {
|
|
@@ -2508,7 +2512,9 @@ import { Terminal as XtermTerminal } from "@xterm/headless";
|
|
|
2508
2512
|
var MIN_COLS = 40;
|
|
2509
2513
|
var MIN_ROWS = 12;
|
|
2510
2514
|
var MAX_ROWS = 300;
|
|
2511
|
-
var MAX_SNAPSHOT_LINES =
|
|
2515
|
+
var MAX_SNAPSHOT_LINES = 360;
|
|
2516
|
+
var STYLED_SNAPSHOT_MARGIN = 24;
|
|
2517
|
+
var SNAPSHOT_DELAY_MS = 33;
|
|
2512
2518
|
var fallbackChildScriptPath = fileURLToPath(new URL("./pi-host-child.ts", import.meta.url));
|
|
2513
2519
|
var activeHost = null;
|
|
2514
2520
|
function clampCols(cols) {
|
|
@@ -2801,7 +2807,7 @@ class PiPtyHost {
|
|
|
2801
2807
|
this.respondToRawTerminalQueries(text);
|
|
2802
2808
|
this.terminal.write(data, () => this.emitSnapshotSoon());
|
|
2803
2809
|
}
|
|
2804
|
-
emitSnapshotSoon(delayMs =
|
|
2810
|
+
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS) {
|
|
2805
2811
|
if (this._disposed || this.notifyTimer)
|
|
2806
2812
|
return;
|
|
2807
2813
|
this.notifyTimer = setTimeout(() => {
|
|
@@ -2815,16 +2821,18 @@ class PiPtyHost {
|
|
|
2815
2821
|
const buffer = this.terminal.buffer.active;
|
|
2816
2822
|
const end = buffer.length;
|
|
2817
2823
|
const start = Math.max(0, end - MAX_SNAPSHOT_LINES);
|
|
2824
|
+
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
2818
2825
|
const lines = [];
|
|
2819
2826
|
const styledLines = [];
|
|
2820
2827
|
for (let row = start;row < end; row += 1) {
|
|
2821
2828
|
const line2 = buffer.getLine(row);
|
|
2822
2829
|
lines.push((line2?.translateToString(false) ?? "").slice(0, this.cols));
|
|
2823
|
-
|
|
2830
|
+
if (row >= styledStart)
|
|
2831
|
+
styledLines[lines.length - 1] = lineToStyledText(line2, this.cols);
|
|
2824
2832
|
}
|
|
2825
2833
|
while (lines.length < this.rows) {
|
|
2826
2834
|
lines.push("");
|
|
2827
|
-
styledLines.
|
|
2835
|
+
styledLines[lines.length - 1] = new StyledText2([{ __isChunk: true, text: "" }]);
|
|
2828
2836
|
}
|
|
2829
2837
|
return {
|
|
2830
2838
|
runId: this.runId,
|
|
@@ -7,7 +7,9 @@ import { Terminal as XtermTerminal } from "@xterm/headless";
|
|
|
7
7
|
var MIN_COLS = 40;
|
|
8
8
|
var MIN_ROWS = 12;
|
|
9
9
|
var MAX_ROWS = 300;
|
|
10
|
-
var MAX_SNAPSHOT_LINES =
|
|
10
|
+
var MAX_SNAPSHOT_LINES = 360;
|
|
11
|
+
var STYLED_SNAPSHOT_MARGIN = 24;
|
|
12
|
+
var SNAPSHOT_DELAY_MS = 33;
|
|
11
13
|
var fallbackChildScriptPath = fileURLToPath(new URL("./pi-host-child.ts", import.meta.url));
|
|
12
14
|
var activeHost = null;
|
|
13
15
|
function clampCols(cols) {
|
|
@@ -307,7 +309,7 @@ class PiPtyHost {
|
|
|
307
309
|
this.respondToRawTerminalQueries(text);
|
|
308
310
|
this.terminal.write(data, () => this.emitSnapshotSoon());
|
|
309
311
|
}
|
|
310
|
-
emitSnapshotSoon(delayMs =
|
|
312
|
+
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS) {
|
|
311
313
|
if (this._disposed || this.notifyTimer)
|
|
312
314
|
return;
|
|
313
315
|
this.notifyTimer = setTimeout(() => {
|
|
@@ -321,16 +323,18 @@ class PiPtyHost {
|
|
|
321
323
|
const buffer = this.terminal.buffer.active;
|
|
322
324
|
const end = buffer.length;
|
|
323
325
|
const start = Math.max(0, end - MAX_SNAPSHOT_LINES);
|
|
326
|
+
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
324
327
|
const lines = [];
|
|
325
328
|
const styledLines = [];
|
|
326
329
|
for (let row = start;row < end; row += 1) {
|
|
327
330
|
const line = buffer.getLine(row);
|
|
328
331
|
lines.push((line?.translateToString(false) ?? "").slice(0, this.cols));
|
|
329
|
-
|
|
332
|
+
if (row >= styledStart)
|
|
333
|
+
styledLines[lines.length - 1] = lineToStyledText(line, this.cols);
|
|
330
334
|
}
|
|
331
335
|
while (lines.length < this.rows) {
|
|
332
336
|
lines.push("");
|
|
333
|
-
styledLines.
|
|
337
|
+
styledLines[lines.length - 1] = new StyledText([{ __isChunk: true, text: "" }]);
|
|
334
338
|
}
|
|
335
339
|
return {
|
|
336
340
|
runId: this.runId,
|
|
@@ -5082,7 +5082,9 @@ import { Terminal as XtermTerminal } from "@xterm/headless";
|
|
|
5082
5082
|
var MIN_COLS = 40;
|
|
5083
5083
|
var MIN_ROWS = 12;
|
|
5084
5084
|
var MAX_ROWS = 300;
|
|
5085
|
-
var MAX_SNAPSHOT_LINES =
|
|
5085
|
+
var MAX_SNAPSHOT_LINES = 360;
|
|
5086
|
+
var STYLED_SNAPSHOT_MARGIN = 24;
|
|
5087
|
+
var SNAPSHOT_DELAY_MS = 33;
|
|
5086
5088
|
var fallbackChildScriptPath = fileURLToPath(new URL("./pi-host-child.ts", import.meta.url));
|
|
5087
5089
|
var activeHost = null;
|
|
5088
5090
|
function clampCols(cols) {
|
|
@@ -5374,7 +5376,7 @@ class PiPtyHost {
|
|
|
5374
5376
|
this.respondToRawTerminalQueries(text);
|
|
5375
5377
|
this.terminal.write(data, () => this.emitSnapshotSoon());
|
|
5376
5378
|
}
|
|
5377
|
-
emitSnapshotSoon(delayMs =
|
|
5379
|
+
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS) {
|
|
5378
5380
|
if (this._disposed || this.notifyTimer)
|
|
5379
5381
|
return;
|
|
5380
5382
|
this.notifyTimer = setTimeout(() => {
|
|
@@ -5388,16 +5390,18 @@ class PiPtyHost {
|
|
|
5388
5390
|
const buffer = this.terminal.buffer.active;
|
|
5389
5391
|
const end = buffer.length;
|
|
5390
5392
|
const start = Math.max(0, end - MAX_SNAPSHOT_LINES);
|
|
5393
|
+
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
5391
5394
|
const lines = [];
|
|
5392
5395
|
const styledLines = [];
|
|
5393
5396
|
for (let row = start;row < end; row += 1) {
|
|
5394
5397
|
const line = buffer.getLine(row);
|
|
5395
5398
|
lines.push((line?.translateToString(false) ?? "").slice(0, this.cols));
|
|
5396
|
-
|
|
5399
|
+
if (row >= styledStart)
|
|
5400
|
+
styledLines[lines.length - 1] = lineToStyledText(line, this.cols);
|
|
5397
5401
|
}
|
|
5398
5402
|
while (lines.length < this.rows) {
|
|
5399
5403
|
lines.push("");
|
|
5400
|
-
styledLines.
|
|
5404
|
+
styledLines[lines.length - 1] = new StyledText([{ __isChunk: true, text: "" }]);
|
|
5401
5405
|
}
|
|
5402
5406
|
return {
|
|
5403
5407
|
runId: this.runId,
|
|
@@ -664,6 +664,7 @@ class ImageVisualLayer {
|
|
|
664
664
|
chromeSlot = this.createSlot();
|
|
665
665
|
pendingFrames = new Map;
|
|
666
666
|
recentWrittenKeys = [];
|
|
667
|
+
imagesVisible = false;
|
|
667
668
|
requestId = 0;
|
|
668
669
|
lastMotionFrameIndex = -1;
|
|
669
670
|
lastPanelFrameIndex = -1;
|
|
@@ -683,7 +684,9 @@ class ImageVisualLayer {
|
|
|
683
684
|
}
|
|
684
685
|
clear() {
|
|
685
686
|
if (this.enabled) {
|
|
686
|
-
|
|
687
|
+
if (this.imagesVisible)
|
|
688
|
+
this.stdout.write([this.imageId, ...this.panelImageIds, ...this.panelChromeImageIds].map((id) => deleteKittyImage(id)).join("") + "\x1B[?25h");
|
|
689
|
+
this.imagesVisible = false;
|
|
687
690
|
this.pendingFrames.clear();
|
|
688
691
|
this.recentWrittenKeys.length = 0;
|
|
689
692
|
this.resetSlot(this.motionSlot);
|
|
@@ -803,6 +806,7 @@ class ImageVisualLayer {
|
|
|
803
806
|
this.stdout.cork?.();
|
|
804
807
|
const accepted = this.stdout.write(payload);
|
|
805
808
|
this.stdout.uncork?.();
|
|
809
|
+
this.imagesVisible = true;
|
|
806
810
|
return accepted;
|
|
807
811
|
}
|
|
808
812
|
createSlot() {
|
|
@@ -647,6 +647,7 @@ class ImageVisualLayer {
|
|
|
647
647
|
chromeSlot = this.createSlot();
|
|
648
648
|
pendingFrames = new Map;
|
|
649
649
|
recentWrittenKeys = [];
|
|
650
|
+
imagesVisible = false;
|
|
650
651
|
requestId = 0;
|
|
651
652
|
lastMotionFrameIndex = -1;
|
|
652
653
|
lastPanelFrameIndex = -1;
|
|
@@ -666,7 +667,9 @@ class ImageVisualLayer {
|
|
|
666
667
|
}
|
|
667
668
|
clear() {
|
|
668
669
|
if (this.enabled) {
|
|
669
|
-
|
|
670
|
+
if (this.imagesVisible)
|
|
671
|
+
this.stdout.write([this.imageId, ...this.panelImageIds, ...this.panelChromeImageIds].map((id) => deleteKittyImage(id)).join("") + "\x1B[?25h");
|
|
672
|
+
this.imagesVisible = false;
|
|
670
673
|
this.pendingFrames.clear();
|
|
671
674
|
this.recentWrittenKeys.length = 0;
|
|
672
675
|
this.resetSlot(this.motionSlot);
|
|
@@ -786,6 +789,7 @@ class ImageVisualLayer {
|
|
|
786
789
|
this.stdout.cork?.();
|
|
787
790
|
const accepted = this.stdout.write(payload);
|
|
788
791
|
this.stdout.uncork?.();
|
|
792
|
+
this.imagesVisible = true;
|
|
789
793
|
return accepted;
|
|
790
794
|
}
|
|
791
795
|
createSlot() {
|
|
@@ -665,6 +665,7 @@ class ImageVisualLayer {
|
|
|
665
665
|
chromeSlot = this.createSlot();
|
|
666
666
|
pendingFrames = new Map;
|
|
667
667
|
recentWrittenKeys = [];
|
|
668
|
+
imagesVisible = false;
|
|
668
669
|
requestId = 0;
|
|
669
670
|
lastMotionFrameIndex = -1;
|
|
670
671
|
lastPanelFrameIndex = -1;
|
|
@@ -684,7 +685,9 @@ class ImageVisualLayer {
|
|
|
684
685
|
}
|
|
685
686
|
clear() {
|
|
686
687
|
if (this.enabled) {
|
|
687
|
-
|
|
688
|
+
if (this.imagesVisible)
|
|
689
|
+
this.stdout.write([this.imageId, ...this.panelImageIds, ...this.panelChromeImageIds].map((id) => deleteKittyImage(id)).join("") + "\x1B[?25h");
|
|
690
|
+
this.imagesVisible = false;
|
|
688
691
|
this.pendingFrames.clear();
|
|
689
692
|
this.recentWrittenKeys.length = 0;
|
|
690
693
|
this.resetSlot(this.motionSlot);
|
|
@@ -804,6 +807,7 @@ class ImageVisualLayer {
|
|
|
804
807
|
this.stdout.cork?.();
|
|
805
808
|
const accepted = this.stdout.write(payload);
|
|
806
809
|
this.stdout.uncork?.();
|
|
810
|
+
this.imagesVisible = true;
|
|
807
811
|
return accepted;
|
|
808
812
|
}
|
|
809
813
|
createSlot() {
|
|
@@ -1611,6 +1611,7 @@ class ImageVisualLayer {
|
|
|
1611
1611
|
chromeSlot = this.createSlot();
|
|
1612
1612
|
pendingFrames = new Map;
|
|
1613
1613
|
recentWrittenKeys = [];
|
|
1614
|
+
imagesVisible = false;
|
|
1614
1615
|
requestId = 0;
|
|
1615
1616
|
lastMotionFrameIndex = -1;
|
|
1616
1617
|
lastPanelFrameIndex = -1;
|
|
@@ -1630,7 +1631,9 @@ class ImageVisualLayer {
|
|
|
1630
1631
|
}
|
|
1631
1632
|
clear() {
|
|
1632
1633
|
if (this.enabled) {
|
|
1633
|
-
|
|
1634
|
+
if (this.imagesVisible)
|
|
1635
|
+
this.stdout.write([this.imageId, ...this.panelImageIds, ...this.panelChromeImageIds].map((id) => deleteKittyImage(id)).join("") + "\x1B[?25h");
|
|
1636
|
+
this.imagesVisible = false;
|
|
1634
1637
|
this.pendingFrames.clear();
|
|
1635
1638
|
this.recentWrittenKeys.length = 0;
|
|
1636
1639
|
this.resetSlot(this.motionSlot);
|
|
@@ -1750,6 +1753,7 @@ class ImageVisualLayer {
|
|
|
1750
1753
|
this.stdout.cork?.();
|
|
1751
1754
|
const accepted = this.stdout.write(payload);
|
|
1752
1755
|
this.stdout.uncork?.();
|
|
1756
|
+
this.imagesVisible = true;
|
|
1753
1757
|
return accepted;
|
|
1754
1758
|
}
|
|
1755
1759
|
createSlot() {
|
|
@@ -2454,7 +2458,9 @@ import { Terminal as XtermTerminal } from "@xterm/headless";
|
|
|
2454
2458
|
var MIN_COLS = 40;
|
|
2455
2459
|
var MIN_ROWS = 12;
|
|
2456
2460
|
var MAX_ROWS = 300;
|
|
2457
|
-
var MAX_SNAPSHOT_LINES =
|
|
2461
|
+
var MAX_SNAPSHOT_LINES = 360;
|
|
2462
|
+
var STYLED_SNAPSHOT_MARGIN = 24;
|
|
2463
|
+
var SNAPSHOT_DELAY_MS = 33;
|
|
2458
2464
|
var fallbackChildScriptPath = fileURLToPath(new URL("./pi-host-child.ts", import.meta.url));
|
|
2459
2465
|
var activeHost = null;
|
|
2460
2466
|
function clampCols(cols) {
|
|
@@ -2747,7 +2753,7 @@ class PiPtyHost {
|
|
|
2747
2753
|
this.respondToRawTerminalQueries(text);
|
|
2748
2754
|
this.terminal.write(data, () => this.emitSnapshotSoon());
|
|
2749
2755
|
}
|
|
2750
|
-
emitSnapshotSoon(delayMs =
|
|
2756
|
+
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS) {
|
|
2751
2757
|
if (this._disposed || this.notifyTimer)
|
|
2752
2758
|
return;
|
|
2753
2759
|
this.notifyTimer = setTimeout(() => {
|
|
@@ -2761,16 +2767,18 @@ class PiPtyHost {
|
|
|
2761
2767
|
const buffer = this.terminal.buffer.active;
|
|
2762
2768
|
const end = buffer.length;
|
|
2763
2769
|
const start = Math.max(0, end - MAX_SNAPSHOT_LINES);
|
|
2770
|
+
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
2764
2771
|
const lines = [];
|
|
2765
2772
|
const styledLines = [];
|
|
2766
2773
|
for (let row = start;row < end; row += 1) {
|
|
2767
2774
|
const line2 = buffer.getLine(row);
|
|
2768
2775
|
lines.push((line2?.translateToString(false) ?? "").slice(0, this.cols));
|
|
2769
|
-
|
|
2776
|
+
if (row >= styledStart)
|
|
2777
|
+
styledLines[lines.length - 1] = lineToStyledText(line2, this.cols);
|
|
2770
2778
|
}
|
|
2771
2779
|
while (lines.length < this.rows) {
|
|
2772
2780
|
lines.push("");
|
|
2773
|
-
styledLines.
|
|
2781
|
+
styledLines[lines.length - 1] = new StyledText2([{ __isChunk: true, text: "" }]);
|
|
2774
2782
|
}
|
|
2775
2783
|
return {
|
|
2776
2784
|
runId: this.runId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-rig/cli",
|
|
3
|
-
"version": "0.0.6-alpha.
|
|
3
|
+
"version": "0.0.6-alpha.82",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Rig package",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"@earendil-works/pi-tui": "^0.79.0",
|
|
29
29
|
"@napi-rs/canvas": "^1.0.0",
|
|
30
30
|
"@opentui/core": "^0.4.1",
|
|
31
|
-
"@rig/client": "npm:@h-rig/client@0.0.6-alpha.
|
|
32
|
-
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.
|
|
33
|
-
"@rig/core": "npm:@h-rig/core@0.0.6-alpha.
|
|
34
|
-
"@rig/pi-rig": "npm:@h-rig/pi-rig@0.0.6-alpha.
|
|
35
|
-
"@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.
|
|
36
|
-
"@rig/server": "npm:@h-rig/server@0.0.6-alpha.
|
|
37
|
-
"@rig/standard-plugin": "npm:@h-rig/standard-plugin@0.0.6-alpha.
|
|
31
|
+
"@rig/client": "npm:@h-rig/client@0.0.6-alpha.82",
|
|
32
|
+
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.82",
|
|
33
|
+
"@rig/core": "npm:@h-rig/core@0.0.6-alpha.82",
|
|
34
|
+
"@rig/pi-rig": "npm:@h-rig/pi-rig@0.0.6-alpha.82",
|
|
35
|
+
"@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.82",
|
|
36
|
+
"@rig/server": "npm:@h-rig/server@0.0.6-alpha.82",
|
|
37
|
+
"@rig/standard-plugin": "npm:@h-rig/standard-plugin@0.0.6-alpha.82",
|
|
38
38
|
"@xterm/headless": "^6.0.0",
|
|
39
39
|
"effect": "4.0.0-beta.78",
|
|
40
40
|
"picocolors": "^1.1.1"
|