Some interesting functions, classes and source files
The function Run in DbgShell\ColorconsoleHost.cs seems to implement the «REPL-loop».
This loop calls m_host.m_ui.ReadLineWithTabCompletion( true ); which returns the line that the user entered.
Commands (such as those destined for the debugging engine) are routed to RunspaceSettings._OnCommandNotFound(…) (DbgProvider\internal\RunspaceSettings.cs).
DbgProvider\Debugger.psm1 defines some PowerShell functions (such as ~x) which are called (initiated?) from _OnCommandNotFound().