ccx-relay 2.4.0 → 2.5.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 +10 -13
  2. package/package.json +1 -1
package/bin/ccx.js CHANGED
@@ -111,18 +111,15 @@ process.stdout.on('resize', () => {
111
111
  ptyProcess.resize(process.stdout.columns, process.stdout.rows);
112
112
  });
113
113
 
114
- // ── Erase current input (single or multi-line) ────────────────────────────────
115
- function eraseInput(line, cursor) {
116
- const parts = line.split('\n');
117
- const extra = parts.length - 1;
118
- if (extra === 0) {
119
- const after = line.length - cursor;
120
- if (after > 0) ptyProcess.write(`\x1b[${after}C`);
121
- 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');
114
+ // ── Erase current input via readline shortcuts ────────────────────────────────
115
+ // Ctrl+E (go to end of line) + Ctrl+U (kill to start) = clear entire line.
116
+ // Works regardless of visual wrapping — Claude Code's own readline handles it.
117
+ // For multi-line: Backspace through the join, then kill each previous line.
118
+ function eraseInput(line) {
119
+ const lineCount = line.split('\n').length;
120
+ ptyProcess.write('\x05\x15'); // Ctrl+E + Ctrl+U: clear last (or only) line
121
+ for (let i = 1; i < lineCount; i++) {
122
+ ptyProcess.write('\x7f\x05\x15'); // Backspace join + Ctrl+E + Ctrl+U
126
123
  }
127
124
  }
128
125
 
@@ -153,7 +150,7 @@ const handler = createInputHandler({
153
150
  else if (err instanceof TimeoutError) msg = `Timed out after ${config.timeoutSeconds}s — original restored`;
154
151
  else if (err instanceof NetworkError) msg = 'No connection — original restored';
155
152
  await spinnerStop('error', msg);
156
- eraseInput(line, cursor);
153
+ eraseInput(line);
157
154
  ptyProcess.write(toSend);
158
155
  handler.setBusy(false);
159
156
  handler.setLine(toSend);
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.5.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": {