@menteeai/menteeswe 0.1.15 → 0.1.16

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 +25 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -404,6 +404,13 @@ function formatEvent(event) {
404
404
  return "\n" + chalk.bold.magenta(`\u25B8 Task: ${event.message ?? ""}`);
405
405
  case "model_request":
406
406
  return chalk.gray("\u25CF thinking...");
407
+ case "tokens": {
408
+ const req = typeof event.data?.request === "number" ? event.data.request : 0;
409
+ const inTok = typeof event.data?.inputTokens === "number" ? event.data.inputTokens : 0;
410
+ const outTok = typeof event.data?.outputTokens === "number" ? event.data.outputTokens : 0;
411
+ const fmtK = (n) => n >= 1e3 ? `${(n / 1e3).toFixed(1)}k` : String(n);
412
+ return chalk.dim(` \u21C5 req #${req} \xB7 ctx ${fmtK(inTok)} tok \xB7 out ${fmtK(outTok)} tok`);
413
+ }
407
414
  case "info":
408
415
  return chalk.cyan.bold(`\u{1F4AD} ${event.message ?? ""}`);
409
416
  case "tool_started": {
@@ -997,6 +1004,13 @@ ${systemExtra}` : "");
997
1004
  if (response.usage) {
998
1005
  state.usage.inputTokens += response.usage.inputTokens;
999
1006
  state.usage.outputTokens += response.usage.outputTokens;
1007
+ bus.emit("tokens", void 0, {
1008
+ request: state.usage.modelRequests,
1009
+ inputTokens: response.usage.inputTokens,
1010
+ outputTokens: response.usage.outputTokens,
1011
+ totalIn: state.usage.inputTokens,
1012
+ totalOut: state.usage.outputTokens
1013
+ });
1000
1014
  }
1001
1015
  if (response.finishReason === "length") {
1002
1016
  bus.emit("warning", "Model hit its output length limit.");
@@ -1177,7 +1191,7 @@ var init_loop = __esm({
1177
1191
  var version;
1178
1192
  var init_package = __esm({
1179
1193
  "package.json"() {
1180
- version = "0.1.15";
1194
+ version = "0.1.16";
1181
1195
  }
1182
1196
  });
1183
1197
 
@@ -1545,6 +1559,7 @@ function App(props) {
1545
1559
  const [phase, setPhase] = useState3("");
1546
1560
  const [showEdits, setShowEdits] = useState3(true);
1547
1561
  const [taskSummary, setTaskSummary] = useState3(null);
1562
+ const [tokenTotals, setTokenTotals] = useState3({ totalIn: 0, totalOut: 0 });
1548
1563
  const finalTextRef = useRef(null);
1549
1564
  const pendingTool = useRef(null);
1550
1565
  const counter = useRef(0);
@@ -1583,6 +1598,11 @@ function App(props) {
1583
1598
  appendPatchEdit({ path: filePath, old: oldStr, new: newStr });
1584
1599
  return;
1585
1600
  }
1601
+ if (event.type === "tokens") {
1602
+ const totalIn = typeof event.data?.totalIn === "number" ? event.data.totalIn : 0;
1603
+ const totalOut = typeof event.data?.totalOut === "number" ? event.data.totalOut : 0;
1604
+ setTokenTotals({ totalIn, totalOut });
1605
+ }
1586
1606
  if (event.type === "task_completed") {
1587
1607
  setTaskSummary(formatEvent(event));
1588
1608
  const text = typeof event.data?.finalText === "string" ? event.data.finalText.trim() : "";
@@ -1795,6 +1815,7 @@ function App(props) {
1795
1815
  setDetailsOpen(false);
1796
1816
  setRunning(true);
1797
1817
  setTaskSummary(null);
1818
+ setTokenTotals({ totalIn: 0, totalOut: 0 });
1798
1819
  const ac = new AbortController();
1799
1820
  abortRef.current = ac;
1800
1821
  try {
@@ -1978,7 +1999,9 @@ function App(props) {
1978
1999
  /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
1979
2000
  "agent ",
1980
2001
  PHASE_LABEL[phase] ?? "working",
1981
- "\u2026 (Ctrl+C to exit)"
2002
+ "\u2026",
2003
+ tokenTotals.totalIn + tokenTotals.totalOut > 0 ? ` \xB7 ${((tokenTotals.totalIn + tokenTotals.totalOut) / 1e3).toFixed(1)}k tok` : "",
2004
+ " (Ctrl+C to exit)"
1982
2005
  ] })
1983
2006
  ] }),
1984
2007
  thinkingText ? /* @__PURE__ */ jsxs6(Box6, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@menteeai/menteeswe",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
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",