opencode-top 3.1.1 → 3.1.2

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/package.json +1 -1
  2. package/src/ui/App.tsx +14 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-top",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Monitor OpenCode AI coding sessions - Token usage, costs, and agent analytics",
5
5
  "type": "module",
6
6
  "bin": {
package/src/ui/App.tsx CHANGED
@@ -29,6 +29,19 @@ export function App({ refreshInterval = 2000 }: AppProps) {
29
29
  const terminalHeight = stdout?.rows ?? 24;
30
30
  const terminalWidth = stdout?.columns ?? 80;
31
31
 
32
+ // Enter alternate screen buffer on mount — prevents Ink's clearTerminal flash.
33
+ // Ink triggers \x1b[2J\x1b[3J\x1b[H whenever outputHeight >= stdout.rows.
34
+ // Alt screen (\x1b[?1049h) moves rendering to a separate buffer so the main
35
+ // screen is never touched, eliminating the black flash entirely.
36
+ useEffect(() => {
37
+ stdout?.write("\x1b[?1049h"); // enter alt screen
38
+ stdout?.write("\x1b[?25l"); // hide cursor
39
+ return () => {
40
+ stdout?.write("\x1b[?25h"); // restore cursor
41
+ stdout?.write("\x1b[?1049l"); // leave alt screen
42
+ };
43
+ }, [stdout]);
44
+
32
45
  const [workflows, setWorkflows] = useState<Workflow[]>([]);
33
46
  const [screen, setScreen] = useState<ScreenId>("sessions");
34
47
  const [error, setError] = useState<string | null>(null);
@@ -108,7 +121,7 @@ export function App({ refreshInterval = 2000 }: AppProps) {
108
121
  const contentHeight = terminalHeight - 3;
109
122
 
110
123
  return (
111
- <Box flexDirection="column" width={terminalWidth} height={terminalHeight}>
124
+ <Box flexDirection="column" width={terminalWidth} height={terminalHeight - 1}>
112
125
  <TabBar activeScreen={screen} lastRefresh={lastRefresh} />
113
126
  <Box width={terminalWidth} height={contentHeight}>
114
127
  {screen === "sessions" && (