Skip to content

FEAT: KodeRunner V3.X  #35

@charlie-sans

Description

@charlie-sans

With the recent developments inside resonite, KodeRunner v3 can start development of the new V3.X version of the server.

this new implementation of V3.X will be written in CSharp for loads of reasons.

This new version of koderunner will support:

  • terminal routing for IO streams.
  • starting and stopping programs FULLY.
  • full rewrite from the ground up.
  • code restoring from the server.
  • server plugins
  • and many more which ill add onto later on down the line

this is backed by the fact that we now have access to Dotnet 8.0 and 9.0 for the server and Resonite's headless.
and since the System.reflection library is now more advanced then the dotnet mono days of the implementation.

runners

Currently in V2.X versions of Runner, the server is written in python which makes updating and maintaining code hard and performance speeds are quite horrible.

Rewriting the server in CSharp 8/9 allows users to use reflection to load their Runners.

essentialy, you import the compiled kodeRunner server .dll as a reference in your project,
add a attrobute to a class and implement IRunnable and KodeRunner reflects to find your assemblies live and load the runnables.

take this test runner for example

using KodeRunner;
using System.Net.WebSockets;
using System.Text;
namespace shitters
{
    [Runnable("testrunner", "testrunner", 0)]
    class TestRunner : IRunnable
    {
        public string Name => "testrunner";
        public string Language => "testrunner";
        public int Priority => 0;
        public string description => "test runner for examples";

        public void Execute(Provider.ISettingsProvider settings)
        {
            Console.WriteLine("Running testrunner project");

            var terminalProcess = new TerminalProcess();

            // Capture the PMS WebSocket from settings
            WebSocket pmsWebSocket = settings.PmsWebSocket;

            terminalProcess.OnOutput += async (output) =>
            {
                
                if (pmsWebSocket != null && pmsWebSocket.State == WebSocketState.Open)
                {
                    var bytes = Encoding.UTF8.GetBytes(output);
                    await pmsWebSocket.SendAsync(new ArraySegment<byte>(bytes), WebSocketMessageType.Text, true, CancellationToken.None);
                }
            };

            terminalProcess.ExecuteCommand("echo \"hello world\"").Wait();
        }
    }
}

this simple runner just runs hello world using echo in bash. hopefully in the future while we develop this, we can implement the ability to change the runtime for your runnable.

KodeRunner V3.X will be the most feature packed update that i'm going to have to write documentation for...

Metadata

Metadata

Assignees

Labels

CoderunnercoderunnerbugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions