       readOnly         : @getOption 'readOnly'
       machine          : @machine
       mode             : @getMode()
+      session          : @session
       cssClass         : 'webterm'
       advancedSettings : no
 


    super options, data

    {@machine} = @getOptions()

    @createTerminal()

  createTerminal: ->
    @webtermView       = new WebTermView

    @webtermView.connectToTerminal()

    @webtermView.once "WebTerm.terminated", =>

      paneView = @parent
      tabView  = paneView.parent

      tabView.removePane paneView

      @machine.getBaseKite().fetchTerminalSessions()


  getMode: ->
    return  if @session? then 'resume' else 'create'

  runCommand: (command, callback) ->
    return unless command
