Andes.Extensions.AI.UI
0.3.1
dotnet add package Andes.Extensions.AI.UI --version 0.3.1
NuGet\Install-Package Andes.Extensions.AI.UI -Version 0.3.1
<PackageReference Include="Andes.Extensions.AI.UI" Version="0.3.1" />
<PackageVersion Include="Andes.Extensions.AI.UI" Version="0.3.1" />
<PackageReference Include="Andes.Extensions.AI.UI" />
paket add Andes.Extensions.AI.UI --version 0.3.1
#r "nuget: Andes.Extensions.AI.UI, 0.3.1"
#:package Andes.Extensions.AI.UI@0.3.1
#addin nuget:?package=Andes.Extensions.AI.UI&version=0.3.1
#tool nuget:?package=Andes.Extensions.AI.UI&version=0.3.1
Andes.Extensions.AI.UI
UI status contract for Andes.Extensions.AI tool tracking. Turns the tracked chat stream into a serializable, cross-language shape a UI can render — the same contract in C# (console, Blazor WebAssembly) and TypeScript (any SPA). Adds two things on top of the core middleware:
- A serializable status contract — flat per-flush
AssistantUiEventdeltas and a foldedAssistantStatusSnapshot(the assistant's status line plus a hierarchy ofAssistantActivitycards — functions, MCP tools, and agents, each with sub-statuses, nested children, and token usage). Each activity carries a cleanDisplayNameplus a separateKindbadge, so the kind word is never repeated in the label. - A mapper and reducer —
ToUiEventsAsync()/ToStatusSnapshotsAsync()project the in-bandChatProgressContent/UsageReportContentstream into the contract;AssistantStatusReducerfolds events into snapshots. A matching TypeScriptfoldAssistantEventsships in the package (typescript/andes-assistant-ui.ts) so a SPA reconstructs the same tree.
Install
dotnet add package Andes.Extensions.AI.UI
Quickstart
using Andes.Extensions.AI;
using Microsoft.Extensions.AI;
IChatClient client = innerClient
.AsBuilder()
.UseToolTracking()
.UseFunctionInvocation() // tracking must be registered before function invocation
.Build();
// Stream immutable snapshots and bind them to the UI (Blazor, console, ...).
await foreach (AssistantStatusSnapshot snapshot in client
.GetStreamingResponseAsync("prompt", chatOptions)
.ToStatusSnapshotsAsync())
{
Console.WriteLine(snapshot.AssistantStatus);
foreach (AssistantActivity activity in snapshot.Activities)
{
// e.g. "Andes Test MCP" [McpTool] — name and kind are separate, never "Andes Test MCP MCP"
Console.WriteLine($"{activity.DisplayName} [{activity.Kind}] — {activity.State}");
}
}
For an HTTP surface, stream ToUiEventsAsync() instead and serialize each event with AssistantUiJsonContext (camelCase, string enums, nulls omitted) over server-sent events; the browser folds them with foldAssistantEvents from the shipped .ts file.
Notes
DisplayNameis the raw function/server/agent name with no "Calling" prefix and no kind word appended; render it once and showKindas a badge. The contract carries no pre-composed header strings, so labels localize cleanly.AssistantUiJsonContextmatches the TypeScript interface byte-for-byte: camelCase keys, string enum values ("McpTool","Agent", …), and omittednulls.- Progress values from MCP servers are single-precision floats widened to
double; format with a rounding specifier such as"0.#"before display. - Privacy posture matches the core package: events and snapshots never carry prompt content, tool arguments, or tool results — only headers, statuses, names, and token counts.
Full documentation lives in the repository docs.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- Andes.Extensions.AI (>= 0.3.1)
- Microsoft.Extensions.AI (>= 10.8.1)
- Microsoft.Extensions.AI.Abstractions (>= 10.8.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.