@menteeai/menteeswe 0.1.26 → 0.1.27

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/cli.js +61 -24
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1306,7 +1306,7 @@ var init_loop = __esm({
1306
1306
  var version;
1307
1307
  var init_package = __esm({
1308
1308
  "package.json"() {
1309
- version = "0.1.26";
1309
+ version = "0.1.27";
1310
1310
  }
1311
1311
  });
1312
1312
 
@@ -1641,7 +1641,7 @@ __export(App_exports, {
1641
1641
  App: () => App
1642
1642
  });
1643
1643
  import { useEffect as useEffect2, useMemo as useMemo2, useRef, useState as useState3 } from "react";
1644
- import { Box as Box6, Text as Text6, useApp, useInput as useInput4, useStdin, useStdout } from "ink";
1644
+ import { Box as Box6, Text as Text6, useApp, useInput as useInput4, useStdout } from "ink";
1645
1645
  import TextInput2 from "ink-text-input";
1646
1646
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1647
1647
  function wrappedH(text, w) {
@@ -1673,7 +1673,6 @@ function TaskBlock({ text }) {
1673
1673
  function App(props) {
1674
1674
  const { exit } = useApp();
1675
1675
  const { stdout } = useStdout();
1676
- const { stdin } = useStdin();
1677
1676
  const bus = useMemo2(() => new EventBus(), []);
1678
1677
  const bridge = useMemo2(() => new ApprovalBridge(), []);
1679
1678
  const [log, setLog] = useState3([]);
@@ -1813,27 +1812,16 @@ function App(props) {
1813
1812
  return () => clearInterval(timer);
1814
1813
  }, [running]);
1815
1814
  useEffect2(() => {
1816
- if (!stdin.isTTY) return;
1817
- stdout.write("\x1B[?1000;1006h");
1818
- let tail = "";
1819
- const onMouseData = (chunk) => {
1820
- tail += chunk.toString();
1821
- const re = /\u001b\[<(\d+);\d+;\d+[Mm]/g;
1822
- let match;
1823
- while ((match = re.exec(tail)) !== null) {
1824
- if (stateRef.current.dialog || stateRef.current.approval) continue;
1825
- const cb = Number(match[1]);
1826
- if (cb === 64) setScrollOffset((o) => Math.min(o + 3, maxScrollRef.current));
1827
- else if (cb === 65) setScrollOffset((o) => Math.max(0, o - 3));
1828
- }
1829
- tail = tail.slice(-32);
1815
+ const onWheel = (dir) => {
1816
+ if (stateRef.current.dialog || stateRef.current.approval) return;
1817
+ if (dir === "up") setScrollOffset((o) => Math.min(o + 3, maxScrollRef.current));
1818
+ else if (dir === "down") setScrollOffset((o) => Math.max(0, o - 3));
1830
1819
  };
1831
- stdin.on("data", onMouseData);
1820
+ props.scrollEvents.on("wheel", onWheel);
1832
1821
  return () => {
1833
- stdin.off("data", onMouseData);
1834
- stdout.write("\x1B[?1000;1006l");
1822
+ props.scrollEvents.off("wheel", onWheel);
1835
1823
  };
1836
- }, [stdin, stdout]);
1824
+ }, [props.scrollEvents]);
1837
1825
  useEffect2(() => {
1838
1826
  const turns = loadConversation(props.cwd);
1839
1827
  if (turns.length > 0) {
@@ -3972,6 +3960,8 @@ Saved to ${configFilePath()}
3972
3960
  // src/cli.tsx
3973
3961
  init_package();
3974
3962
  import path9 from "path";
3963
+ import { PassThrough } from "stream";
3964
+ import { EventEmitter } from "events";
3975
3965
  import { jsx as jsx7 } from "react/jsx-runtime";
3976
3966
  var program = new Command();
3977
3967
  program.name("mentee").description("MenteE SWE \u2014 an autonomous SWE agent in your terminal. Bring your own model: Kimi, GLM, Z.ai, OpenRouter, NVIDIA, and more.").version(version);
@@ -4025,6 +4015,46 @@ program.argument("[task...]", "the software task to perform (omit to type it int
4025
4015
  return { error: error.message };
4026
4016
  }
4027
4017
  };
4018
+ const scrollEvents = new EventEmitter();
4019
+ const virtualStdin = new PassThrough();
4020
+ const anyStdin = virtualStdin;
4021
+ anyStdin.isTTY = process.stdin.isTTY === true;
4022
+ anyStdin.setRawMode = (mode) => {
4023
+ if (process.stdin.isTTY) process.stdin.setRawMode(mode);
4024
+ };
4025
+ let pending = "";
4026
+ const flush = (s) => {
4027
+ if (s) virtualStdin.write(s);
4028
+ };
4029
+ const onRawData = (chunk) => {
4030
+ pending += chunk.toString("utf8");
4031
+ for (; ; ) {
4032
+ const esc = pending.indexOf("\x1B[<");
4033
+ if (esc === -1) {
4034
+ flush(pending);
4035
+ pending = "";
4036
+ return;
4037
+ }
4038
+ flush(pending.slice(0, esc));
4039
+ pending = pending.slice(esc);
4040
+ const m = /^\u001b\[<(\d+);\d+;\d+([Mm])/.exec(pending);
4041
+ if (m) {
4042
+ const cb = m[1] ?? "";
4043
+ if (cb === "64") scrollEvents.emit("wheel", "up");
4044
+ else if (cb === "65") scrollEvents.emit("wheel", "down");
4045
+ pending = pending.slice(m[0].length);
4046
+ continue;
4047
+ }
4048
+ if (pending.length > 32) {
4049
+ flush(pending);
4050
+ pending = "";
4051
+ }
4052
+ return;
4053
+ }
4054
+ };
4055
+ process.stdin.on("data", onRawData);
4056
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
4057
+ process.stdout.write("\x1B[?1000;1006h");
4028
4058
  const { App: App2 } = await Promise.resolve().then(() => (init_App(), App_exports));
4029
4059
  const { render } = await import("ink");
4030
4060
  const { waitUntilExit } = render(
@@ -4037,12 +4067,19 @@ program.argument("[task...]", "the software task to perform (omit to type it int
4037
4067
  tools,
4038
4068
  cwd: path9.resolve(cwd),
4039
4069
  yes: options.yes === true,
4040
- maxIterations
4070
+ maxIterations,
4071
+ scrollEvents
4041
4072
  }
4042
4073
  ),
4043
- { exitOnCtrlC: false }
4074
+ { exitOnCtrlC: false, stdin: virtualStdin }
4044
4075
  );
4045
- await waitUntilExit();
4076
+ try {
4077
+ await waitUntilExit();
4078
+ } finally {
4079
+ process.stdout.write("\x1B[?1000;1006l");
4080
+ if (process.stdin.isTTY) process.stdin.setRawMode(false);
4081
+ process.stdin.off("data", onRawData);
4082
+ }
4046
4083
  });
4047
4084
  program.parseAsync(process.argv).catch((error) => {
4048
4085
  console.error(chalk4.red(error.message));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@menteeai/menteeswe",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "MenteE SWE — a model-agnostic autonomous software-engineering agent CLI. Bring your own intelligence: Kimi, GLM/Z.ai, and more.",
5
5
  "type": "module",
6
6
  "license": "MIT",