Unicorb.Playground 0.9.17-alpha

This is a prerelease version of Unicorb.Playground.
dotnet add package Unicorb.Playground --version 0.9.17-alpha
                    
NuGet\Install-Package Unicorb.Playground -Version 0.9.17-alpha
                    
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="Unicorb.Playground" Version="0.9.17-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Unicorb.Playground" Version="0.9.17-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Unicorb.Playground" />
                    
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 Unicorb.Playground --version 0.9.17-alpha
                    
#r "nuget: Unicorb.Playground, 0.9.17-alpha"
                    
#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.
#:package Unicorb.Playground@0.9.17-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Unicorb.Playground&version=0.9.17-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Unicorb.Playground&version=0.9.17-alpha&prerelease
                    
Install as a Cake Tool

Unicorb.Playground

Blazor Server UI for local bot debugging. It includes chat, attachments, reply keyboards, inline keyboards and a command palette.

The package can be used without Unicorb. Events enter through IPlaygroundUpdatePublisher; bot responses are sent through PlaygroundMessenger.

TFM: net9.0, net10.0

The API may change before version 1.0.0.

Install

dotnet add package Unicorb.Playground

Quick Start

With Unicorb, use Unicorb.Playground.Bridge. It wires the publisher, pipeline and adapter.

builder.Services.AddUnicorb(o => o.Registries(r =>
{
    r.ScanHandlersFrom<MyMarker>();
    r.ScanStatesFrom<MyMarker>();
    r.ScanCommandsFrom<MyMarker>();
    r.ScanExtractorsFrom<PlaygroundAssemblyMarker>();
}));

builder.Services.AddPlayground();
builder.Services.AddPlaygroundBridge();

var app = builder.Build();
app.UsePlayground();

Without the bridge, register your own IPlaygroundUpdatePublisher and call AddPlayground().

Bot Responses

PlaygroundBotMessage? saved = messenger.Send(sessionId, text, attachment, keyboard, parseMode, metadata);
PlaygroundBotMessage? edited = messenger.Edit(sessionId, messageId, text, attachment, keyboard, parseMode, metadata);
  • Send appends a new message.
  • Edit updates a message in place.
  • Keyboard: null removes an inline keyboard.
  • An empty reply keyboard removes the dock.
  • metadata stores your string data.

Options

PlaygroundOptions configures PathBase, Title, file limits and command palette behavior.

AllowManualSessionSelection controls manual session UI (enter a GUID, renew/reset session). Default is off; set true in AddPlayground when you need it (for example local QA or shared room links).

ShowMessageDebugMetadata shows the per-message debug metadata button. Default is off; set true when you want the UI metadata inspector.

AccentColor sets the brand accent hex (#RRGGBB). User bubble, send button, focus rings and related tints are derived from it automatically.

Composer commands are registered on PlaygroundMessenger (RegisterCommands). With Unicorb.Playground.Bridge, commands are synced from ICommandRegistry at startup.

The default UI path is /playground.

WebApp buttons

Playground supports Telegram-style WebApp buttons from Core keyboards via UrlButton { IsWebApp = true }:

  • Inline keyboard — opens the page in a modal iframe (no sendData() back to the bot, same as Telegram inline WebApp).
  • Reply keyboard — opens the modal and forwards WebApp.sendData() to the bot as WebAppDataInput (hidden from the chat feed, same as Telegram).
new InlineKeyboard()
    .Row(new UrlButton
    {
        Text = "Open",
        Url = new Uri("https://localhost:5001/mini-app/"),
        IsWebApp = true,
    });

new ReplyKeyboard()
    .Row(new UrlButton
    {
        Text = "Fill form",
        Url = new Uri("https://localhost:5001/mini-app/"),
        IsWebApp = true,
    });

Local mini-app testing

For local debugging, load the Playground WebApp shim on your mini-app page:

<script src="/playground/_content/assets/js/webapp-shim.js"></script>

Adjust the path to match your PathBase (default /playground). Static assets are served from the fixed _content/assets prefix (independent of the project/assembly name). The Demo page loads a same-folder copy (demo-webapp/webapp-shim.js) so it does not depend on PathBase.

The shim reads #webAppData=… from the URL hash and exposes window.Playground.WebApp (initData, initDataUnsafe, ready, expand, close, sendData, MainButton, BackButton).

Limitations:

  • initData is not cryptographically signed (hash=playground). Use it to test front-end mini-app logic, not backend HMAC validation.
  • Playground injects session_id (current Playground session GUID) into initData / initDataUnsafe.session_id.
  • Some sites block iframe embedding (X-Frame-Options, CSP frame-ancestors) — the page will not load inside the modal on those hosts

Demo

dotnet run --project Unicorb.Demo
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.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Unicorb.Playground:

Package Downloads
Unicorb.Playground.Bridge

Playground transport bridge for Unicorb: update pipeline, state machine, extractors, and in-process UI adapter

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.17-alpha 28 7/30/2026
0.9.16-alpha 33 7/30/2026
0.9.15-alpha 39 7/30/2026
0.9.14-alpha 35 7/29/2026
0.9.13-alpha 47 7/21/2026
0.9.12-alpha 50 7/20/2026
0.9.11-alpha 49 7/15/2026
0.9.10-alpha 57 7/13/2026
0.9.9-alpha 56 7/13/2026
0.9.8-alpha 53 7/12/2026
0.9.7-alpha 57 7/10/2026
0.9.6-alpha 61 7/10/2026
0.9.5-alpha 58 7/9/2026
0.9.4-alpha 54 7/9/2026
0.9.3-alpha 69 6/24/2026
0.9.2-alpha 69 6/23/2026
0.9.1-alpha 63 6/14/2026
0.9.0-alpha 62 6/14/2026
Loading failed