@zhongqian97-code/ecode 0.5.54 → 0.5.55

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
@@ -923,6 +923,6 @@ Node.js 16/18 \u8BF7\u4F7F\u7528 --web \u6216 --pipe \u6A21\u5F0F\u3002
923
923
  );
924
924
  process.exit(1);
925
925
  }
926
- const { App, React, render } = await import("./ui-A5WEKWOC.js");
926
+ const { App, React, render } = await import("./ui-5R3MFOW2.js");
927
927
  render(React.createElement(App, { config: finalConfig, version: VERSION, autoMode, registry, trustedSkillDirs, initialMessages }));
928
928
  }
@@ -2548,57 +2548,46 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
2548
2548
  useEffect3(() => {
2549
2549
  if (!stdout || !stdin) return;
2550
2550
  stdout.write("\x1B[?1002h\x1B[?1006h");
2551
- const origEmit = stdin.emit;
2552
- stdin.emit = function(event, ...args) {
2553
- if (event === "readable") {
2554
- const chunk = stdin.read();
2555
- if (chunk !== null) {
2556
- const s = chunk.toString("binary");
2557
- const mouseLen = mouseEventLength(s);
2558
- if (mouseLen > 0) {
2559
- const mouseStr = s.slice(0, mouseLen);
2560
- const scroll = parseMouseScroll(mouseStr);
2561
- if (scroll) {
2562
- const step = Math.max(1, Math.floor(historyMaxHeightRef.current / 2));
2563
- if (scroll.direction === "up") {
2564
- setScrollOffset((prev) => Math.min(prev + step, Math.max(0, totalLinesRef.current - 1)));
2565
- } else {
2566
- setScrollOffset((prev) => Math.max(0, prev - step));
2567
- }
2568
- }
2569
- const sel = parseMouseSelectionEvent(mouseStr);
2570
- if (sel) {
2571
- const totalL = totalLinesRef.current;
2572
- const scrollOff = scrollOffsetRef.current;
2573
- const histH = historyMaxHeightRef.current;
2574
- const visibleCount = Math.min(Math.max(0, totalL - scrollOff), histH);
2575
- const contentStartRow = histH - visibleCount;
2576
- const lineIdx = sel.row - contentStartRow;
2577
- if (lineIdx >= 0 && lineIdx < visibleCount) {
2578
- const pt = { row: lineIdx, col: sel.col };
2579
- if (sel.type === "leftDown") {
2580
- setSelectionState(startSelection(selectionStateRef.current, pt));
2581
- } else if (sel.type === "leftDrag") {
2582
- setSelectionState(updateSelection(selectionStateRef.current, pt));
2583
- } else if (sel.type === "leftUp") {
2584
- setSelectionState(finishSelection(selectionStateRef.current, pt));
2585
- }
2586
- }
2587
- }
2588
- const remainder = s.slice(mouseLen);
2589
- if (remainder.length > 0) {
2590
- stdin.unshift(Buffer.from(remainder, "binary"));
2591
- return origEmit.call(this, event, ...args);
2592
- }
2593
- return true;
2551
+ const origRead = stdin.read.bind(stdin);
2552
+ stdin.read = function(size) {
2553
+ const chunk = origRead(size);
2554
+ if (chunk === null) return null;
2555
+ const isStr = typeof chunk === "string";
2556
+ let s = isStr ? chunk : chunk.toString("binary");
2557
+ let mouseLen;
2558
+ while ((mouseLen = mouseEventLength(s)) > 0) {
2559
+ const mouseStr = s.slice(0, mouseLen);
2560
+ const scroll = parseMouseScroll(mouseStr);
2561
+ if (scroll) {
2562
+ const step = Math.max(1, Math.floor(historyMaxHeightRef.current / 2));
2563
+ if (scroll.direction === "up") {
2564
+ setScrollOffset((prev) => Math.min(prev + step, Math.max(0, totalLinesRef.current - 1)));
2565
+ } else {
2566
+ setScrollOffset((prev) => Math.max(0, prev - step));
2567
+ }
2568
+ }
2569
+ const sel = parseMouseSelectionEvent(mouseStr);
2570
+ if (sel) {
2571
+ const totalL = totalLinesRef.current;
2572
+ const scrollOff = scrollOffsetRef.current;
2573
+ const histH = historyMaxHeightRef.current;
2574
+ const visibleCount = Math.min(Math.max(0, totalL - scrollOff), histH);
2575
+ const contentStartRow = histH - visibleCount;
2576
+ const lineIdx = sel.row - contentStartRow;
2577
+ if (lineIdx >= 0 && lineIdx < visibleCount) {
2578
+ const pt = { row: lineIdx, col: sel.col };
2579
+ if (sel.type === "leftDown") setSelectionState(startSelection(selectionStateRef.current, pt));
2580
+ else if (sel.type === "leftDrag") setSelectionState(updateSelection(selectionStateRef.current, pt));
2581
+ else if (sel.type === "leftUp") setSelectionState(finishSelection(selectionStateRef.current, pt));
2594
2582
  }
2595
- stdin.unshift(chunk);
2596
2583
  }
2584
+ s = s.slice(mouseLen);
2597
2585
  }
2598
- return origEmit.call(this, event, ...args);
2586
+ if (s.length === 0) return null;
2587
+ return isStr ? s : Buffer.from(s, "binary");
2599
2588
  };
2600
2589
  return () => {
2601
- stdin.emit = origEmit;
2590
+ stdin.read = origRead;
2602
2591
  stdout.write("\x1B[?1002l\x1B[?1006l");
2603
2592
  };
2604
2593
  }, [stdout, stdin]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhongqian97-code/ecode",
3
- "version": "0.5.54",
3
+ "version": "0.5.55",
4
4
  "description": "A minimal Claude Code clone with REPL interface and bash tool calling",
5
5
  "type": "module",
6
6
  "author": "zhongqian97-code",