@wrongstack/tui 0.4.0 → 0.4.1

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
@@ -2,7 +2,7 @@ import { render, useApp, Box, useStdout, Static, Text, useInput, useStdin } from
2
2
  import React4, { useState, useReducer, useRef, useEffect, useMemo } from 'react';
3
3
  import * as fs2 from 'fs/promises';
4
4
  import * as path2 from 'path';
5
- import { InputBuilder, formatTodosList } from '@wrongstack/core';
5
+ import { InputBuilder, formatTodosList, buildChildEnv } from '@wrongstack/core';
6
6
  import { routeImagesForModel } from '@wrongstack/runtime/vision';
7
7
  import { readClipboardImage } from '@wrongstack/runtime/clipboard';
8
8
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -1927,6 +1927,7 @@ function runGit(cwd, args) {
1927
1927
  try {
1928
1928
  const child = spawn("git", args, {
1929
1929
  cwd,
1930
+ env: buildChildEnv(),
1930
1931
  // Inherit stderr (silent) — we don't care about git's noise.
1931
1932
  stdio: ["ignore", "pipe", "ignore"],
1932
1933
  // Don't let a slow git hang the TUI.
@@ -2662,16 +2663,7 @@ function App({
2662
2663
  clearInterval(t);
2663
2664
  };
2664
2665
  }, [agent.ctx.cwd]);
2665
- const [lastInputTokens, setLastInputTokens] = React4.useState(0);
2666
- useEffect(() => {
2667
- const off = events.on("provider.response", (e) => {
2668
- const total = (e.usage.input ?? 0) + (e.usage.cacheRead ?? 0) + (e.usage.cacheWrite ?? 0);
2669
- setLastInputTokens(total);
2670
- });
2671
- return () => {
2672
- off();
2673
- };
2674
- }, [events]);
2666
+ const lastInputTokens = tokenCounter?.total().input ?? 0;
2675
2667
  const maxContext = effectiveMaxContext ?? agent.ctx.provider.capabilities.maxContext;
2676
2668
  const contextWindow = useMemo(() => {
2677
2669
  void state.contextChipVersion;