codemaxxing 1.0.4 → 1.0.6

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/dist/index.js +31 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1757,7 +1757,19 @@ let bracketedBuffer = "";
1757
1757
  let inBracketedPaste = false;
1758
1758
  let burstBuffer = "";
1759
1759
  let burstTimer = null;
1760
- const BURST_WINDOW_MS = 25; // Short enough to feel instant, long enough to catch paste bursts
1760
+ const BURST_WINDOW_MS = 50; // Long enough for slow terminals to finish delivering paste
1761
+ // Debug paste: set CODEMAXXING_DEBUG_PASTE=1 to log all stdin chunks to /tmp/codemaxxing-paste-debug.log
1762
+ const PASTE_DEBUG = process.env.CODEMAXXING_DEBUG_PASTE === "1";
1763
+ import { appendFileSync } from "node:fs";
1764
+ function pasteLog(msg) {
1765
+ if (!PASTE_DEBUG)
1766
+ return;
1767
+ const escaped = msg.replace(/\x1b/g, "\\x1b").replace(/\r/g, "\\r").replace(/\n/g, "\\n");
1768
+ try {
1769
+ appendFileSync("/tmp/codemaxxing-paste-debug.log", `[${Date.now()}] ${escaped}\n`);
1770
+ }
1771
+ catch { }
1772
+ }
1761
1773
  const origEmit = process.stdin.emit.bind(process.stdin);
1762
1774
  function handlePasteContent(content) {
1763
1775
  const normalized = content.replace(/\r\n/g, "\n").trim();
@@ -1786,7 +1798,9 @@ function flushBurst() {
1786
1798
  return;
1787
1799
  const buffered = burstBuffer;
1788
1800
  burstBuffer = "";
1789
- if (looksLikeMultilinePaste(buffered)) {
1801
+ const isMultiline = looksLikeMultilinePaste(buffered);
1802
+ pasteLog(`BURST FLUSH len=${buffered.length} multiline=${isMultiline}`);
1803
+ if (isMultiline) {
1790
1804
  handlePasteContent(buffered);
1791
1805
  }
1792
1806
  else {
@@ -1801,10 +1815,18 @@ process.stdin.emit = function (event, ...args) {
1801
1815
  }
1802
1816
  const chunk = args[0];
1803
1817
  let data = typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString("utf-8") : String(chunk);
1818
+ pasteLog(`CHUNK len=${data.length} raw=${data.substring(0, 200)}`);
1819
+ // Aggressively strip ALL bracketed paste escape sequences from every chunk,
1820
+ // regardless of context. Some terminals split markers across chunks or send
1821
+ // them in unexpected positions. We never want \x1b[200~ or \x1b[201~ (or
1822
+ // partial fragments like [200~ / [201~) to reach the input component.
1823
+ const hadStart = data.includes("\x1b[200~") || data.includes("[200~");
1824
+ const hadEnd = data.includes("\x1b[201~") || data.includes("[201~");
1825
+ pasteLog(`MARKERS start=${hadStart} end=${hadEnd} inBracketed=${inBracketedPaste}`);
1826
+ // Strip full and partial bracketed paste markers
1827
+ data = data.replace(/\x1b?\[20[01]~/g, "");
1804
1828
  // ── Bracketed paste handling ──
1805
- const hasStart = data.includes("\x1b[200~");
1806
- const hasEnd = data.includes("\x1b[201~");
1807
- if (hasStart) {
1829
+ if (hadStart) {
1808
1830
  // Flush any pending burst before entering bracketed mode
1809
1831
  if (burstTimer) {
1810
1832
  clearTimeout(burstTimer);
@@ -1812,24 +1834,23 @@ process.stdin.emit = function (event, ...args) {
1812
1834
  }
1813
1835
  flushBurst();
1814
1836
  inBracketedPaste = true;
1815
- data = data.replace(/\x1b\[200~/g, "");
1837
+ pasteLog("ENTERED bracketed paste mode");
1816
1838
  }
1817
- if (hasEnd) {
1818
- data = data.replace(/\x1b\[201~/g, "");
1839
+ if (hadEnd) {
1819
1840
  bracketedBuffer += data;
1820
1841
  inBracketedPaste = false;
1821
1842
  const content = bracketedBuffer;
1822
1843
  bracketedBuffer = "";
1844
+ pasteLog(`BRACKETED COMPLETE len=${content.length} lines=${content.split("\\n").length}`);
1823
1845
  handlePasteContent(content);
1824
1846
  return true;
1825
1847
  }
1826
1848
  if (inBracketedPaste) {
1827
1849
  bracketedBuffer += data;
1850
+ pasteLog(`BRACKETED BUFFERING total=${bracketedBuffer.length}`);
1828
1851
  return true;
1829
1852
  }
1830
1853
  // ── Burst buffering for non-bracketed paste ──
1831
- // Strip stray bracketed paste markers that might appear outside a proper pair
1832
- data = data.replace(/\x1b\[20[01]~/g, "");
1833
1854
  burstBuffer += data;
1834
1855
  if (burstTimer)
1835
1856
  clearTimeout(burstTimer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemaxxing",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Open-source terminal coding agent. Connect any LLM. Max your code.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {