MeshWeaver.Kernel 2.0.3

dotnet add package MeshWeaver.Kernel --version 2.0.3
                    
NuGet\Install-Package MeshWeaver.Kernel -Version 2.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MeshWeaver.Kernel" Version="2.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.Kernel" Version="2.0.3" />
                    
Directory.Packages.props
<PackageReference Include="MeshWeaver.Kernel" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MeshWeaver.Kernel --version 2.0.3
                    
#r "nuget: MeshWeaver.Kernel, 2.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=MeshWeaver.Kernel&version=2.0.3
                    
Install MeshWeaver.Kernel as a Cake Addin
#tool nuget:?package=MeshWeaver.Kernel&version=2.0.3
                    
Install MeshWeaver.Kernel as a Cake Tool

MeshWeaver.Kernel

Overview

MeshWeaver.Kernel provides the API for interacting with .NET Interactive kernels in the MeshWeaver mesh. It defines the core message types and events for kernel communication.

Message Types

Events and Commands

// Event envelope for kernel responses
public record KernelEventEnvelope(string Envelope);

// Command envelope for kernel execution
public record KernelCommandEnvelope(string Command)
{
    public string IFrameUrl { get; init; }
    public string ViewId { get; init; } = Guid.NewGuid().AsString();
}

// Code submission request
public record SubmitCodeRequest(string Code)
{
    public string IFrameUrl { get; init; }
    public string Id { get; init; } = Guid.NewGuid().AsString();
}

// Event subscription management
public record SubscribeKernelEventsRequest;
public record UnsubscribeKernelEventsRequest;

Usage

Submitting Code

There are two ways to handle code execution output:

1. Using Area ID (for internal usage)

Used when output should update a specific area in the mesh, typically for interactive components like markdown editors:

// Output will update an area with the specified ID
var request = new SubmitCodeRequest("Console.WriteLine(\"Hello\");")
{
    Id = "specific-area-id"  // Updates area with this ID
};

client.Post(request, o => o.WithTarget(new KernelAddress()));
2. Using IFrameUrl (for Polyglot Notebooks)

Used when output should be rendered in a notebook iframe:

// Output will be rendered in a notebook iframe
var request = new SubmitCodeRequest("Console.WriteLine(\"Hello\");")
{
    IFrameUrl = "http://localhost/area"  // Renders in notebook iframe
};

client.Post(request, o => o.WithTarget(new KernelAddress()));

Managing Event Subscriptions

// Subscribe to kernel events
client.Post(new SubscribeKernelEventsRequest(), 
    o => o.WithTarget(new KernelAddress()));

// Unsubscribe from kernel events
client.Post(new UnsubscribeKernelEventsRequest(), 
    o => o.WithTarget(new KernelAddress()));

Integration

  • Used by MeshWeaver.Kernel.Hub
  • Supports .NET Interactive kernel communication
  • Enables mesh-based code execution

See Also

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on MeshWeaver.Kernel:

Package Downloads
MeshWeaver.Hosting

Package Description

MeshWeaver.Markdown

Package Description

MeshWeaver.Hosting.SignalR

Package Description

MeshWeaver.Kernel.Hub

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.3 512 3/24/2025
2.0.2 489 3/24/2025
2.0.1 142 3/21/2025
2.0.0 183 3/20/2025
2.0.0-preview3 126 2/28/2025
2.0.0-Preview2 142 2/10/2025
2.0.0-preview1 128 1/6/2025