codemaxxing 1.0.13 → 1.0.15

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/dist/index.js CHANGED
@@ -3,8 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import React, { useState, useEffect, useCallback } from "react";
4
4
  import { render, Box, Text, useInput, useApp, useStdout } from "ink";
5
5
  import { EventEmitter } from "events";
6
+ import { appendFileSync } from "node:fs";
6
7
  import TextInput from "ink-text-input";
7
- import { consumePendingPasteEndMarkerChunk } from "./utils/paste.js";
8
+ import { consumePendingPasteEndMarkerChunk, shouldSwallowPostPasteDebris } from "./utils/paste.js";
8
9
  import { CodingAgent } from "./agent.js";
9
10
  import { loadConfig, saveConfig, detectLocalProvider, detectLocalProviderDetailed, parseCLIArgs, applyOverrides, listModels } from "./config.js";
10
11
  import { listSessions, getSession, loadMessages, deleteSession } from "./utils/sessions.js";
@@ -1759,13 +1760,14 @@ let inBracketedPaste = false;
1759
1760
  let burstBuffer = "";
1760
1761
  let burstTimer = null;
1761
1762
  let pendingPasteEndMarker = { active: false, buffer: "" };
1763
+ let swallowPostPasteDebrisUntil = 0;
1762
1764
  const BURST_WINDOW_MS = 50; // Long enough for slow terminals to finish delivering paste
1765
+ const POST_PASTE_DEBRIS_WINDOW_MS = 1200;
1763
1766
  // Debug paste: set CODEMAXXING_DEBUG_PASTE=1 to log all stdin chunks to /tmp/codemaxxing-paste-debug.log
1764
1767
  const PASTE_DEBUG = process.env.CODEMAXXING_DEBUG_PASTE === "1";
1765
1768
  function pasteLog(msg) {
1766
1769
  if (!PASTE_DEBUG)
1767
1770
  return;
1768
- const { appendFileSync } = require("node:fs");
1769
1771
  const escaped = msg.replace(/\x1b/g, "\\x1b").replace(/\r/g, "\\r").replace(/\n/g, "\\n");
1770
1772
  try {
1771
1773
  appendFileSync("/tmp/codemaxxing-paste-debug.log", `[${Date.now()}] ${escaped}\n`);
@@ -1784,6 +1786,7 @@ function handlePasteContent(content) {
1784
1786
  // one character at a time *after* the paste payload. Arm a tiny
1785
1787
  // swallow-state so those trailing fragments never leak into the input.
1786
1788
  pendingPasteEndMarker = { active: true, buffer: "" };
1789
+ swallowPostPasteDebrisUntil = Date.now() + POST_PASTE_DEBRIS_WINDOW_MS;
1787
1790
  pasteEvents.emit("paste", { content: normalized, lines: lineCount });
1788
1791
  return;
1789
1792
  }
@@ -1839,6 +1842,10 @@ process.stdin.emit = function (event, ...args) {
1839
1842
  pasteLog("PENDING END MARKER swallowed chunk");
1840
1843
  return true;
1841
1844
  }
1845
+ if (Date.now() < swallowPostPasteDebrisUntil && shouldSwallowPostPasteDebris(data)) {
1846
+ pasteLog(`POST-PASTE DEBRIS swallowed raw=${data}`);
1847
+ return true;
1848
+ }
1842
1849
  // Aggressively strip ALL bracketed paste escape sequences from every chunk,
1843
1850
  // regardless of context. Some terminals split markers across chunks or send
1844
1851
  // them in unexpected positions. We never want \x1b[200~ or \x1b[201~ (or
@@ -2,6 +2,7 @@ export interface PendingPasteEndState {
2
2
  active: boolean;
3
3
  buffer: string;
4
4
  }
5
+ export declare function shouldSwallowPostPasteDebris(chunk: string): boolean;
5
6
  export declare function consumePendingPasteEndMarkerChunk(chunk: string, state: PendingPasteEndState): {
6
7
  remaining: string;
7
8
  nextState: PendingPasteEndState;
@@ -1,3 +1,13 @@
1
+ export function shouldSwallowPostPasteDebris(chunk) {
2
+ if (!chunk)
3
+ return false;
4
+ if (chunk.length > 8)
5
+ return false;
6
+ // Terminals sometimes leak tiny bracketed-paste marker fragments after the
7
+ // multiline payload is already complete. Be conservative: only swallow short
8
+ // chunks made entirely of characters that belong to those control fragments.
9
+ return /^[\x1b\[\]0-9;~]+$/.test(chunk);
10
+ }
1
11
  const END_MARKERS = ["\x1b[201~", "[201~", "201~"];
2
12
  function isPrefixOfAnyMarker(value) {
3
13
  return END_MARKERS.some((marker) => marker.startsWith(value));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemaxxing",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Open-source terminal coding agent. Connect any LLM. Max your code.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {