ccx-relay 2.4.0 → 2.6.0

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/bin/ccx.js +15 -11
  2. package/package.json +1 -1
package/bin/ccx.js CHANGED
@@ -92,16 +92,18 @@ const contextLines = [];
92
92
 
93
93
  function stripAnsi(s) {
94
94
  return s
95
- .replace(/\x1b\[[0-9;]*[A-Za-z]/g, '')
96
- .replace(/\x1b\][^\x07]*\x07/g, '')
95
+ .replace(/\x1b\[[\d;?]*[A-Za-z]/g, '') // CSI (including ?-prefixed private modes)
96
+ .replace(/\x1b\][^\x07]*\x07/g, '') // OSC
97
+ .replace(/\x1b[()#;?][A-Za-z]/g, '') // other 2-byte ESC sequences
97
98
  .replace(/\r/g, '');
98
99
  }
99
100
 
100
101
  ptyProcess.onData(data => {
101
102
  process.stdout.write(data);
102
103
  for (const ln of stripAnsi(data).split('\n')) {
103
- if (ln.trim()) {
104
- contextLines.push(ln.trim());
104
+ const t = ln.trim();
105
+ if (t.length > 12) { // skip echoed single chars and short noise
106
+ contextLines.push(t);
105
107
  if (contextLines.length > CONTEXT_MAX) contextLines.shift();
106
108
  }
107
109
  }
@@ -111,18 +113,20 @@ process.stdout.on('resize', () => {
111
113
  ptyProcess.resize(process.stdout.columns, process.stdout.rows);
112
114
  });
113
115
 
114
- // ── Erase current input (single or multi-line) ────────────────────────────────
116
+ // ── Erase current input ───────────────────────────────────────────────────────
117
+ // Pure backspace approach — avoids Ctrl+U (\x15) which toggles Claude Code's
118
+ // manual mode, and Ctrl+D (\x04) which sends EOF on empty lines.
119
+ // For multi-line (Shift+Enter blocks): ANSI line-clear sequence per line.
115
120
  function eraseInput(line, cursor) {
116
121
  const parts = line.split('\n');
117
- const extra = parts.length - 1;
118
- if (extra === 0) {
122
+ if (parts.length > 1) {
123
+ ptyProcess.write('\x1b[2K');
124
+ for (let i = 1; i < parts.length; i++) ptyProcess.write('\x1b[1A\x1b[2K');
125
+ ptyProcess.write('\x1b[G');
126
+ } else {
119
127
  const after = line.length - cursor;
120
128
  if (after > 0) ptyProcess.write(`\x1b[${after}C`);
121
129
  ptyProcess.write(Buffer.alloc(line.length, 0x7f));
122
- } else {
123
- ptyProcess.write('\x1b[2K');
124
- for (let i = 0; i < extra; i++) ptyProcess.write('\x1b[1A\x1b[2K');
125
- ptyProcess.write('\x1b[G');
126
130
  }
127
131
  }
128
132
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "ccx-relay",
4
- "version": "2.4.0",
4
+ "version": "2.6.0",
5
5
  "description": "Transparent PTY wrapper for Claude Code (or any CLI) that lets you refine your prompt with Gemini AI before submitting it, without leaving your terminal session.",
6
6
  "main": "bin/ccx.js",
7
7
  "bin": {