MeshWeaver.Kernel
2.0.3
dotnet add package MeshWeaver.Kernel --version 2.0.3
NuGet\Install-Package MeshWeaver.Kernel -Version 2.0.3
<PackageReference Include="MeshWeaver.Kernel" Version="2.0.3" />
<PackageVersion Include="MeshWeaver.Kernel" Version="2.0.3" />
<PackageReference Include="MeshWeaver.Kernel" />
paket add MeshWeaver.Kernel --version 2.0.3
#r "nuget: MeshWeaver.Kernel, 2.0.3"
#addin nuget:?package=MeshWeaver.Kernel&version=2.0.3
#tool nuget:?package=MeshWeaver.Kernel&version=2.0.3
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
- Main MeshWeaver Documentation - More about MeshWeaver architecture
Product | Versions 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. |
-
net9.0
- MeshWeaver.Layout (>= 2.0.3)
- MeshWeaver.Mesh.Contract (>= 2.0.3)
- MeshWeaver.Messaging.Hub (>= 2.0.3)
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 |