MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / detach

Method detach

src/workspaces/persistent-session.ts:397–414  ·  view source on GitHub ↗

Drop the current client without killing the PTY.

()

Source from the content-addressed store, hash-verified

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;

Callers 1

closeHandlerMethod · 0.95

Calls 3

unwireWsMethod · 0.95
resumePtyMethod · 0.95
eventMethod · 0.80

Tested by

no test coverage detected