(message: StdoutMessage)
| 658 | } |
| 659 | |
| 660 | async write(message: StdoutMessage): Promise<void> { |
| 661 | if ('uuid' in message && typeof message.uuid === 'string') { |
| 662 | this.messageBuffer.add(message) |
| 663 | this.lastSentId = message.uuid |
| 664 | } |
| 665 | |
| 666 | const line = jsonStringify(message) + '\n' |
| 667 | |
| 668 | if (this.state !== 'connected') { |
| 669 | // Message buffered for replay when connected (if it has a UUID) |
| 670 | return |
| 671 | } |
| 672 | |
| 673 | const sessionLabel = this.sessionId ? ` session=${this.sessionId}` : '' |
| 674 | const detailLabel = this.getControlMessageDetailLabel(message) |
| 675 | |
| 676 | logForDebugging( |
| 677 | `WebSocketTransport: Sending message type=${message.type}${sessionLabel}${detailLabel}`, |
| 678 | ) |
| 679 | |
| 680 | this.sendLine(line) |
| 681 | } |
| 682 | |
| 683 | private getControlMessageDetailLabel(message: StdoutMessage): string { |
| 684 | if (message.type === 'control_request') { |
no test coverage detected