openrune 0.3.14 → 0.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openrune",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "description": "Rune — File-based AI Agent Harness for Claude Code",
5
5
  "keywords": ["ai", "agent", "claude", "desktop", "electron", "mcp", "claude-code", "harness", "automation"],
6
6
  "repository": {
@@ -7,20 +7,16 @@ export function App() {
7
7
  const chat = useChat()
8
8
  const [showTerminal, setShowTerminal] = useState(true)
9
9
 
10
- // Auto-switch to chat when MCP channel connects OR when history is loaded
10
+ // Show terminal until connected, then switch to chat
11
11
  useEffect(() => {
12
12
  const handler = (data: { port: number; connected: boolean }) => {
13
13
  if (data.connected) setShowTerminal(false)
14
+ else setShowTerminal(true)
14
15
  }
15
16
  window.rune.on('rune:channelStatus', handler)
16
17
  return () => window.rune.off('rune:channelStatus', handler)
17
18
  }, [])
18
19
 
19
- // If there's existing history, show chat immediately
20
- useEffect(() => {
21
- if (chat.messages.length > 0) setShowTerminal(false)
22
- }, [chat.messages.length > 0])
23
-
24
20
  const toggleTerminal = useCallback(() => setShowTerminal(prev => !prev), [])
25
21
 
26
22
  if (!chat.runeInfo) {
@@ -70,6 +70,7 @@ export function ChatPanel({ chat, showTerminal, onToggleTerminal }: ChatPanelPro
70
70
  <TerminalPanel
71
71
  cwd={chat.runeInfo.folderPath}
72
72
  autoCommand={channelCommand}
73
+ visible={showTerminal}
73
74
  />
74
75
  </div>
75
76
  )}
@@ -6,6 +6,7 @@ import '@xterm/xterm/css/xterm.css'
6
6
  interface TerminalPanelProps {
7
7
  cwd?: string
8
8
  autoCommand?: string
9
+ visible?: boolean
9
10
  }
10
11
 
11
12
  const THEME = {
@@ -32,7 +33,7 @@ const THEME = {
32
33
  brightWhite: '#ffffff',
33
34
  }
34
35
 
35
- export function TerminalPanel({ cwd, autoCommand }: TerminalPanelProps) {
36
+ export function TerminalPanel({ cwd, autoCommand, visible }: TerminalPanelProps) {
36
37
  const containerRef = useRef<HTMLDivElement>(null)
37
38
  const termRef = useRef<Terminal | null>(null)
38
39
  const fitRef = useRef<FitAddon | null>(null)
@@ -128,6 +129,22 @@ export function TerminalPanel({ cwd, autoCommand }: TerminalPanelProps) {
128
129
  }
129
130
  }, []) // eslint-disable-line react-hooks/exhaustive-deps
130
131
 
132
+ // Re-fit terminal when visibility changes
133
+ useEffect(() => {
134
+ if (visible && fitRef.current && termRef.current) {
135
+ requestAnimationFrame(() => {
136
+ fitRef.current?.fit()
137
+ if (ptyIdRef.current) {
138
+ window.rune.send('terminal:resize', {
139
+ id: ptyIdRef.current,
140
+ cols: termRef.current!.cols,
141
+ rows: termRef.current!.rows,
142
+ })
143
+ }
144
+ })
145
+ }
146
+ }, [visible])
147
+
131
148
  return (
132
149
  <div
133
150
  ref={containerRef}