Add refs to track activeTab and pending commands outside render cycle. Flush queued commands after terminal initialization completes. Fix sendToTerminal to use stable refs instead of stale state. Enhance debug logging for tab operations. 💘 Generated with Crush Assisted-by: MiniMax-M2.7 via Crush <crush@charm.land>