diff --git a/frontend/src/composables/useTerminal.ts b/frontend/src/composables/useTerminal.ts index 03a0736..2d3407b 100644 --- a/frontend/src/composables/useTerminal.ts +++ b/frontend/src/composables/useTerminal.ts @@ -96,9 +96,23 @@ export function useTerminal(sessionId: string): UseTerminalReturn { fitAddon.fit(); // Subscribe to SSH output events for this session - cleanupEvent = Events.On(`ssh:data:${sessionId}`, (...args: unknown[]) => { - // Wails v3 events pass data as arguments - const b64data = typeof args[0] === "string" ? args[0] : String(args[0] ?? ""); + // Wails v3 Events.On callback receives a CustomEvent object with .data property + cleanupEvent = Events.On(`ssh:data:${sessionId}`, (event: any) => { + // Extract the base64 string from the event + // event.data is the first argument passed to app.Event.Emit() + let b64data: string; + if (typeof event === "string") { + b64data = event; + } else if (event?.data && typeof event.data === "string") { + b64data = event.data; + } else if (Array.isArray(event?.data)) { + b64data = String(event.data[0] ?? ""); + } else { + // Debug: log the actual shape so we can fix it + console.warn("ssh:data unexpected shape:", JSON.stringify(event)?.slice(0, 200)); + return; + } + try { const decoded = atob(b64data); terminal.write(decoded);