Drop the current client without killing the PTY.
()
| 395 | |
| 396 | /** Drop the current client without killing the PTY. */ |
| 397 | detach(): void { |
| 398 | if (this.ws === null) return; |
| 399 | const ws = this.ws; |
| 400 | this.ws = null; |
| 401 | this.controller = null; |
| 402 | this.unwireWs(ws); |
| 403 | // No consumer left — let the PTY run free into the in-memory ring buffer |
| 404 | // (onPtyData appends regardless of socket). If the socket dropped while |
| 405 | // we were backpressure-paused, NOT resuming here strands the PTY paused |
| 406 | // forever and the agent blocks on its next stdout write — the "running |
| 407 | // along and then freezes" symptom. |
| 408 | this.resumePty(); |
| 409 | if (this.cursorTimer) { |
| 410 | clearInterval(this.cursorTimer); |
| 411 | this.cursorTimer = null; |
| 412 | } |
| 413 | this.log.event('session.detached'); |
| 414 | } |
| 415 | |
| 416 | dispose(reason: string): void { |
| 417 | if (this.disposed) return; |
no test coverage detected