def get_multiline_conversation_input(self) -> str:
        """Get multiline input with CTRL+D handling for conversation mode"""
        buffer = []

        # Save original terminal settings
        fd = sys.stdin.fileno()
        old_settings = termios.tcgetattr(fd)

        try:
            # Set terminal to raw mode
            tty.setraw(fd)

            current_line = []
            while True:
                char = sys.stdin.read(1)

                # CTRL+D detection
                if not char or ord(char) == 4:  # EOF or CTRL+D
                    sys.stdout.write('\n')
                    if current_line:
                        buffer.append(''.join(current_line))
                    return ' '.join(buffer).strip()

                # Handle special characters
                elif ord(char) == 13:  # Enter
                    sys.stdout.write('\n')
                    buffer.append(''.join(current_line))
                    current_line = []

                elif ord(char) == 127:  # Backspace
                    if current_line:
                        current_line.pop()
                        sys.stdout.write('\b \b')

                elif ord(char) == 3:  # CTRL+C
                    sys.stdout.write('\n')
                    return 'quit'

                # Normal character
                elif 32 <= ord(char) <= 126:  # Printable characters
                    current_line.append(char)
                    sys.stdout.write(char)

                sys.stdout.flush()

        finally:
            # Restore terminal settings
            termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
            print()  # New line for clean display
Get multiline input with CTRL+D handling for conversation mode
research_manager.py