(message: StdoutMessage)
| 670 | } |
| 671 | |
| 672 | async write(message: StdoutMessage): Promise<void> { |
| 673 | if ('uuid' in message && typeof message.uuid === 'string') { |
| 674 | this.messageBuffer.add(message) |
| 675 | this.lastSentId = message.uuid |
| 676 | } |
| 677 | |
| 678 | const line = jsonStringify(message) + '\n' |
| 679 | |
| 680 | if (this.state !== 'connected') { |
| 681 | // Message buffered for replay when connected (if it has a UUID) |
| 682 | return |
| 683 | } |
| 684 | |
| 685 | const sessionLabel = this.sessionId ? ` session=${this.sessionId}` : '' |
| 686 | const detailLabel = this.getControlMessageDetailLabel(message) |
| 687 | |
| 688 | logForDebugging( |
| 689 | `WebSocketTransport: Sending message type=${message.type}${sessionLabel}${detailLabel}`, |
| 690 | ) |
| 691 | |
| 692 | this.sendLine(line) |
| 693 | } |
| 694 | |
| 695 | private getControlMessageDetailLabel(message: StdoutMessage): string { |
| 696 | if (message.type === 'control_request') { |
no test coverage detected