@phenx-inc/ctlsurf 0.1.8 → 0.1.9
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/out/headless/index.mjs +15 -10
- package/out/headless/index.mjs.map +2 -2
- package/out/main/index.js +15 -10
- package/package.json +1 -1
- package/src/main/bridge.ts +21 -12
package/out/headless/index.mjs
CHANGED
|
@@ -3647,7 +3647,7 @@ var ConversationBridge = class {
|
|
|
3647
3647
|
inputBuffer = "";
|
|
3648
3648
|
// Virtual terminal for processing escape sequences into rendered text
|
|
3649
3649
|
terminal;
|
|
3650
|
-
|
|
3650
|
+
lastSnapshot = "";
|
|
3651
3651
|
pendingWrites = 0;
|
|
3652
3652
|
constructor() {
|
|
3653
3653
|
this.terminal = new import_headless.Terminal({ cols: 120, rows: 50, scrollback: 1e4 });
|
|
@@ -3657,7 +3657,7 @@ var ConversationBridge = class {
|
|
|
3657
3657
|
}
|
|
3658
3658
|
startSession() {
|
|
3659
3659
|
this.terminal.reset();
|
|
3660
|
-
this.
|
|
3660
|
+
this.lastSnapshot = "";
|
|
3661
3661
|
this.pendingWrites = 0;
|
|
3662
3662
|
this.inputBuffer = "";
|
|
3663
3663
|
this.sessionActive = true;
|
|
@@ -3706,18 +3706,23 @@ var ConversationBridge = class {
|
|
|
3706
3706
|
return;
|
|
3707
3707
|
}
|
|
3708
3708
|
const buf = this.terminal.buffer.active;
|
|
3709
|
-
const totalLines = buf.baseY +
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
for (let i = this.lastSnapshotLines; i < totalLines; i++) {
|
|
3709
|
+
const totalLines = buf.baseY + this.terminal.rows;
|
|
3710
|
+
const allLines = [];
|
|
3711
|
+
for (let i = 0; i < totalLines; i++) {
|
|
3713
3712
|
const line = buf.getLine(i);
|
|
3714
3713
|
if (line) {
|
|
3715
|
-
|
|
3714
|
+
allLines.push(line.translateToString(true));
|
|
3716
3715
|
}
|
|
3717
3716
|
}
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3717
|
+
const currentSnapshot = allLines.join("\n");
|
|
3718
|
+
let newContent;
|
|
3719
|
+
if (currentSnapshot.startsWith(this.lastSnapshot)) {
|
|
3720
|
+
newContent = currentSnapshot.slice(this.lastSnapshot.length);
|
|
3721
|
+
} else {
|
|
3722
|
+
newContent = currentSnapshot;
|
|
3723
|
+
}
|
|
3724
|
+
this.lastSnapshot = currentSnapshot;
|
|
3725
|
+
const cleaned = newContent.replace(/\n{3,}/g, "\n\n").trim();
|
|
3721
3726
|
if (cleaned.length === 0) return;
|
|
3722
3727
|
this.sendEntry("terminal_output", cleaned);
|
|
3723
3728
|
}
|