@dmsdc-ai/aigentry-telepty 0.1.95 → 0.1.96

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.
Files changed (2) hide show
  1. package/daemon.js +18 -9
  2. package/package.json +1 -1
package/daemon.js CHANGED
@@ -1577,15 +1577,24 @@ app.get('/api/sessions/:id/screen', (req, res) => {
1577
1577
  // Strip ANSI escape sequences for clean text
1578
1578
  function stripAnsi(str) {
1579
1579
  return str
1580
- .replace(/[[0-9;]*[a-zA-Z]/g, '') // CSI sequences
1581
- .replace(/][^]*/g, '') // OSC sequences (BEL terminated)
1582
- .replace(/][^]*\\/g, '') // OSC sequences (ST terminated)
1583
- .replace(/[()][AB012]/g, '') // Character set selection
1584
- .replace(/[>=<]/g, '') // Keypad mode
1585
- .replace(/[[?]?[0-9;]*[hlsurm]/g, '') // Mode set/reset
1586
- .replace(/[[0-9;]*[ABCDHJ]/g, '') // Cursor movement
1587
- .replace(/[[0-9;]*[KG]/g, '') // Line clearing
1588
- .replace(/\r/g, ''); // Carriage returns
1580
+ // Replace cursor-forward (ESC[NC, ESC[C) with N spaces to preserve whitespace
1581
+ .replace(/\[(\d*)C/g, (_, n) => ' '.repeat(Number(n) || 1))
1582
+ // CSI sequences: ESC [ ? (optional) params final_byte
1583
+ .replace(/\[\??[0-9;]*[a-zA-Z@`]/g, '')
1584
+ // OSC sequences: ESC ] ... BEL
1585
+ .replace(/\][^]*/g, '')
1586
+ // OSC sequences: ESC ] ... ST (ESC \)
1587
+ .replace(/\][^]*\\/g, '')
1588
+ // Character set selection: ESC ( / ) + charset
1589
+ .replace(/[()][AB012]/g, '')
1590
+ // Keypad and other 2-char ESC sequences
1591
+ .replace(/[>=<78DMEHcNOZ~}|]/g, '')
1592
+ // DCS / PM / APC sequences
1593
+ .replace(/^_][^]*\\/g, '')
1594
+ // Any remaining bare ESC + single char
1595
+ .replace(/./g, '')
1596
+ // Carriage returns
1597
+ .replace(/\r/g, '');
1589
1598
  }
1590
1599
 
1591
1600
  const cleaned = raw ? fullOutput : stripAnsi(fullOutput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.1.95",
3
+ "version": "0.1.96",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "aigentry-telepty": "install.js",