From 8362a50460691d1bfab9eff2d5a9fab5abe8235c Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Tue, 17 Mar 2026 11:46:00 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20SSH=20terminal=20[Object=20Object]=20?= =?UTF-8?q?=E2=80=94=20Wails=20v3=20Events.On=20receives=20event=20object,?= =?UTF-8?q?=20not=20raw=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Events.On callback gets a CustomEvent with .data property, not the base64 string directly. Added multi-format extraction with debug logging for unexpected shapes. Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/composables/useTerminal.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) 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);