Unicorb.Playground
0.9.17-alpha
dotnet add package Unicorb.Playground --version 0.9.17-alpha
NuGet\Install-Package Unicorb.Playground -Version 0.9.17-alpha
<PackageReference Include="Unicorb.Playground" Version="0.9.17-alpha" />
<PackageVersion Include="Unicorb.Playground" Version="0.9.17-alpha" />
<PackageReference Include="Unicorb.Playground" />
paket add Unicorb.Playground --version 0.9.17-alpha
#r "nuget: Unicorb.Playground, 0.9.17-alpha"
#:package Unicorb.Playground@0.9.17-alpha
#addin nuget:?package=Unicorb.Playground&version=0.9.17-alpha&prerelease
#tool nuget:?package=Unicorb.Playground&version=0.9.17-alpha&prerelease
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);
Sendappends a new message.Editupdates a message in place.Keyboard: nullremoves an inline keyboard.- An empty reply keyboard removes the dock.
metadatastores 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 asWebAppDataInput(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:
initDatais 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) intoinitData/initDataUnsafe.session_id. - Some sites block iframe embedding (
X-Frame-Options, CSPframe-ancestors) — the page will not load inside the modal on those hosts
Demo
dotnet run --project Unicorb.Demo
| 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. 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. |
-
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 |