PageAgent: improved main-file detection

Fixed the way how we detect the main application file for two cases:
  `node .` (run the local application)
  `node --debug` (start an interactive REPL session)

Fixed also other issues that prevented debugging of REPL sessions.