Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Use terminal close API with exit fallback in ChatView

Julius Marmingee6d645072817
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 7b1a85eaa..4b910be0b 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -302,9 +302,15 @@ export default function ChatView() {
const closeTerminal = useCallback(
(terminalId: string) => {
if (!activeThreadId || !api) return;
- void api.terminal.write({ threadId: activeThreadId, terminalId, data: "exit\n" }).catch(() => {
- // Ignore write errors so the UI can still close an uninitialized or already-exited terminal.
- });
+ const fallbackExitWrite = () =>
+ api.terminal.write({ threadId: activeThreadId, terminalId, data: "exit\n" }).catch(() => {
+ // Ignore write errors so the UI can still close an uninitialized or already-exited terminal.
+ });
+ if ("close" in api.terminal && typeof api.terminal.close === "function") {
+ void api.terminal.close({ threadId: activeThreadId, terminalId }).catch(() => fallbackExitWrite());
+ } else {
+ void fallbackExitWrite();
+ }
dispatch({
type: "CLOSE_THREAD_TERMINAL",
threadId: activeThreadId,