@menteeai/menteeswe 0.1.26 → 0.1.28

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 +69 -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.28";
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) {
@@ -2155,6 +2143,10 @@ function App(props) {
2155
2143
  })()
2156
2144
  ] }),
2157
2145
  /* @__PURE__ */ jsxs6(Box6, { width: SIDEBAR_W, flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 1, children: [
2146
+ /* @__PURE__ */ jsx6(Text6, { color: "cyan", children: " __ __" }),
2147
+ /* @__PURE__ */ jsx6(Text6, { color: "cyan", children: "| \\/ |" }),
2148
+ /* @__PURE__ */ jsx6(Text6, { color: "cyan", children: "| |" }),
2149
+ /* @__PURE__ */ jsx6(Text6, { color: "cyan", children: "| |" }),
2158
2150
  /* @__PURE__ */ jsx6(Text6, { bold: true, color: "magenta", children: "MenteE SWE \u{1F380}" }),
2159
2151
  /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
2160
2152
  "v",
@@ -3972,6 +3964,8 @@ Saved to ${configFilePath()}
3972
3964
  // src/cli.tsx
3973
3965
  init_package();
3974
3966
  import path9 from "path";
3967
+ import { PassThrough } from "stream";
3968
+ import { EventEmitter } from "events";
3975
3969
  import { jsx as jsx7 } from "react/jsx-runtime";
3976
3970
  var program = new Command();
3977
3971
  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 +4019,50 @@ program.argument("[task...]", "the software task to perform (omit to type it int
4025
4019
  return { error: error.message };
4026
4020
  }
4027
4021
  };
4022
+ const scrollEvents = new EventEmitter();
4023
+ const virtualStdin = new PassThrough();
4024
+ const anyStdin = virtualStdin;
4025
+ anyStdin.isTTY = process.stdin.isTTY === true;
4026
+ anyStdin.setRawMode = (mode) => {
4027
+ if (process.stdin.isTTY) process.stdin.setRawMode(mode);
4028
+ };
4029
+ anyStdin.ref = () => {
4030
+ };
4031
+ anyStdin.unref = () => {
4032
+ };
4033
+ let pending = "";
4034
+ const flush = (s) => {
4035
+ if (s) virtualStdin.write(s);
4036
+ };
4037
+ const onRawData = (chunk) => {
4038
+ pending += chunk.toString("utf8");
4039
+ for (; ; ) {
4040
+ const esc = pending.indexOf("\x1B[<");
4041
+ if (esc === -1) {
4042
+ flush(pending);
4043
+ pending = "";
4044
+ return;
4045
+ }
4046
+ flush(pending.slice(0, esc));
4047
+ pending = pending.slice(esc);
4048
+ const m = /^\u001b\[<(\d+);\d+;\d+([Mm])/.exec(pending);
4049
+ if (m) {
4050
+ const cb = m[1] ?? "";
4051
+ if (cb === "64") scrollEvents.emit("wheel", "up");
4052
+ else if (cb === "65") scrollEvents.emit("wheel", "down");
4053
+ pending = pending.slice(m[0].length);
4054
+ continue;
4055
+ }
4056
+ if (pending.length > 32) {
4057
+ flush(pending);
4058
+ pending = "";
4059
+ }
4060
+ return;
4061
+ }
4062
+ };
4063
+ process.stdin.on("data", onRawData);
4064
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
4065
+ process.stdout.write("\x1B[?1000;1006h");
4028
4066
  const { App: App2 } = await Promise.resolve().then(() => (init_App(), App_exports));
4029
4067
  const { render } = await import("ink");
4030
4068
  const { waitUntilExit } = render(
@@ -4037,12 +4075,19 @@ program.argument("[task...]", "the software task to perform (omit to type it int
4037
4075
  tools,
4038
4076
  cwd: path9.resolve(cwd),
4039
4077
  yes: options.yes === true,
4040
- maxIterations
4078
+ maxIterations,
4079
+ scrollEvents
4041
4080
  }
4042
4081
  ),
4043
- { exitOnCtrlC: false }
4082
+ { exitOnCtrlC: false, stdin: virtualStdin }
4044
4083
  );
4045
- await waitUntilExit();
4084
+ try {
4085
+ await waitUntilExit();
4086
+ } finally {
4087
+ process.stdout.write("\x1B[?1000;1006l");
4088
+ if (process.stdin.isTTY) process.stdin.setRawMode(false);
4089
+ process.stdin.off("data", onRawData);
4090
+ }
4046
4091
  });
4047
4092
  program.parseAsync(process.argv).catch((error) => {
4048
4093
  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.28",
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",