Novior.MentorAgent.Blazor
1.5.0
Prefix Reserved
dotnet add package Novior.MentorAgent.Blazor --version 1.5.0
NuGet\Install-Package Novior.MentorAgent.Blazor -Version 1.5.0
<PackageReference Include="Novior.MentorAgent.Blazor" Version="1.5.0" />
<PackageVersion Include="Novior.MentorAgent.Blazor" Version="1.5.0" />
<PackageReference Include="Novior.MentorAgent.Blazor" />
paket add Novior.MentorAgent.Blazor --version 1.5.0
#r "nuget: Novior.MentorAgent.Blazor, 1.5.0"
#:package Novior.MentorAgent.Blazor@1.5.0
#addin nuget:?package=Novior.MentorAgent.Blazor&version=1.5.0
#tool nuget:?package=Novior.MentorAgent.Blazor&version=1.5.0
Novior.MentorAgent.Blazor
New package IDs. From 1.0.0 the packages, their namespaces and their assemblies are
Novior.MentorAgent.*; up to 1.0.0-rc.15 they wereMentorAgent.*. See Migrating from the MentorAgent.* packages in the Novior.MentorAgent README.
Blazor WebAssembly client for MentorAgent. Install this in your Blazor WASM / Blazor Auto client project.
Connects to a Novior.MentorAgent.Server hub via SignalR and provides the same <ChatWidget /> experience as Blazor Server — same features, same API, no code changes needed when switching between render modes.
All AI processing happens server-side — configured in your server project with AddMentorAgent(). The client sends messages, registers page context and UI actions, and receives streaming events.
Table of Contents
- What MentorAgent can do
- Package Family
- Getting started
- Widget customization
- Page context and UI actions
- Page navigation
- UI Action overloads reference
[MentorPage]parameters (server project)- All
AddMentorAgentBlazor()options - How it works
- Events — IMentorStateService
- Blazor Auto tip
- Requirements
- Related Packages
- License
What MentorAgent can do
All features below are available. Configure them server-side in AddMentorAgent().
| Feature | Description |
|---|---|
| 🤖 Multi-agent orchestration | Coordinator + specialized agents via Handoff Workflow |
| 👥 Group Chat teams | Multiple agents collaborate before acting |
| 🛠️ Tool discovery | C# methods become AI tools via [Description] or [MentorAction] |
| 🎯 UI Actions | AI invokes page-level actions (highlight rows, open modals, pre-fill forms) as individually named tools with typed parameters and async support |
| 📖 Agent Skills | Domain knowledge loaded on demand (load_skill) — progressive disclosure |
| 🧠 Contextual memory | Remembers user preferences across sessions |
| 🗺️ Page navigation | AI navigates to pages decorated with [MentorPage] |
| 📚 RAG | Inject relevant documents into every AI response, read through an IMentorRagSource you implement on the server |
| 🔌 MCP Client | Consume external MCP servers as additional tools |
| 🖥️ MCP Server | Expose [MentorAction] methods to Claude Desktop, VS Code, Cursor |
| 🌐 A2A Consumer | Connect to remote A2A agents in the Handoff workflow |
| 📡 A2A Server | Expose as a federatable A2A agent |
| 🎨 Customizable widget | Themes, colors, position, avatar, bot name |
| 🌍 Multi-language | 10 languages for AI responses and widget UI |
| 🎤 Voice input/output | Browser Speech Recognition + Speech Synthesis — speaks while the answer streams, stops when the user takes the floor, optional hands-free loop |
| 🧭 Onboarding tour | First-run guide generated on the server from its own pages and tools |
| 🃏 Generative UI cards | A server-side tool returns a card and the widget renders it — fields, accent, buttons |
| 🖼️ Multimodal image input | Attach images to a message — upload, clipboard paste, drag & drop or URL |
| 🌐 Hosted tools | The model provider runs web search, a code-interpreter sandbox and file search — configured server-side, results arrive in the stream |
| 🔒 Safety check | AI-based prompt injection detection |
| ⏱️ Rate limiting | Per-user message limit |
| ✅ Confirmation dialogs | Destructive actions ask for approval (HITL) — including MCP tools, in either the MentorAgent or the Agent Framework native flow |
| 🔐 Role-based actions | Actions restricted by ASP.NET Core identity roles |
| 💸 Token & cost optimization | Slim cache-friendly prompt, semantic tool filtering, history compaction, RAG/memory gating |
Package Family
| Package | Install when |
|---|---|
| Novior.MentorAgent | Blazor Server app |
| Novior.MentorAgent.Server | Server project (Web API / Blazor Auto server) |
| Novior.MentorAgent.Blazor ← you are here | Blazor WASM / Blazor Auto client project |
| Novior.MentorAgent.Abstractions | Never directly — it arrives with any of the above |
| Novior.MentorAgent.Declarative | Optional — Level-2 specialists in YAML, added on the server project |
Getting started
Installation
# Client project
dotnet add package Novior.MentorAgent.Blazor
# Server project — MentorAgent is included automatically as a transitive dependency
dotnet add package Novior.MentorAgent.Server
Server project setup
All AI behaviour is configured on the server (the transitive
Novior.MentorAgentcore): agents, RAG, memory, skills, MCP/A2A and the token/cost optimizations below. The client only renders the widget.
// Server/Program.cs
builder.Services.AddMentorAgent(options =>
{
options.AppName = "My App";
options.AppDescription = "An order management application";
options.ChatClient = chatClient;
options.ScanAssemblies = [typeof(Program).Assembly];
// All features configured here: agents, RAG, MCP, A2A, memory, skills...
options.UseMemoryContext = true;
options.UseRag = true;
options.McpServerEnabled = true;
options.A2AServerEnabled = true;
options.EnableSkills = true;
options.RateLimitPerUser = 20;
});
builder.Services.AddMentorAgentServer();
app.MapMentorAgentServer(); // /mentor-hub, /mentor/chat + /mentor/approve, /mentor/cancel, /mentor/session, /mentor/tour, /mentor/admin/metrics
app.MapMentorAgentMcp(); // optional
app.MapMentorAgentA2A(); // optional
AddRazorComponents() and AddMentorAgentServer() can come in either order: Blazor's circuits keep their user, and the hub, /mentor/chat and A2A get theirs from the request.
Token & cost optimization + reliable memory (server project)
These options cut the tokens sent per request and make memory reliable — all on the server. Full details: MentorAgent core README → Token & cost optimization.
builder.Services.AddMentorAgent(options =>
{
// ...ChatClient, ScanAssemblies as above...
// Embedding model — powers semantic tool filtering AND semantic memory relevance.
options.EmbeddingGenerator = new AzureOpenAIClient(endpoint, credential)
.GetEmbeddingClient("text-embedding-3-small").AsIEmbeddingGenerator();
// Send only the tools semantically relevant to the message (requires EmbeddingGenerator).
options.EnableToolFiltering = true;
options.ToolFilterMinScore = 0.35f;
// Compact long conversation history before each call.
options.EnableCompaction = true;
options.CompactionTokenThreshold = 4000;
// Memory: reliable post-turn fact capture (default true) + inject only relevant memories.
options.UseMemoryContext = true;
options.MemoryAutoCapture = true; // default — reliable writer on Path A
options.MemoryRelevanceFiltering = true; // requires EmbeddingGenerator
});
Robustness, observability & cost dashboard (server project)
Also configured on the server — see the MentorAgent core README for full details.
builder.Services.AddMentorAgent(options =>
{
// Middleware hooks
options.OnException = ex => ex.Message.Contains("rate", StringComparison.OrdinalIgnoreCase)
? "The service is busy, please retry shortly." : null;
options.ConfigureChatClientPipeline = b => b.UseLogging();
// Observability (add an OpenTelemetry exporter to the app as usual)
options.EnableObservability = true;
// Dashboard cost pricing (supply your own; none built in)
options.ModelPricing = new Dictionary<string, ModelPrice>(StringComparer.OrdinalIgnoreCase)
{
["gpt-4o"] = new ModelPrice(2.50m, 10.00m), ["gpt-4o-mini"] = new ModelPrice(0.15m, 0.60m),
};
});
The admin dashboard ships as a Blazor component. Drop it on a protected page (you own the authorization). On Blazor Server / Auto it reads IMentorMetrics in-process; on standalone WASM, fetch GET /mentor/admin/metrics from the server and pass the snapshot:
@* Blazor Server / Auto — in-process (the component reads IMentorMetrics itself) *@
@attribute [Authorize(Roles = "Admin")]
@using Novior.MentorAgent.Abstractions.Components
<MentorDashboard Currency="$" />
@* Standalone WASM — fetch the snapshot from the server and pass it in *@
@attribute [Authorize(Roles = "Admin")]
@using System.Net.Http.Json
@using Novior.MentorAgent.Abstractions.Components
@using Novior.MentorAgent.Abstractions.Models
@inject HttpClient Http
<MentorDashboard Snapshot="_snapshot" OnRefresh="LoadAsync" Currency="$" />
@code {
private MentorMetricsSnapshot? _snapshot;
protected override Task OnInitializedAsync() => LoadAsync();
// HttpClient must target the server; the endpoint is gated by options.DashboardRole.
private async Task LoadAsync() =>
_snapshot = await Http.GetFromJsonAsync<MentorMetricsSnapshot>("mentor/admin/metrics");
}
Also configured/available on the server (see the core README for full examples):
- Rich responses — with
options.EnableRichResponses(server, default on) the assistant formats structured data as Markdown; this widget renders the tables, lists and links automatically — no client wiring, XSS-safe, tables scroll horizontally on narrow screens. - Model routing (
options.StrongChatClient+options.RoutingStrategy:Semantic/Classifier/Cascade/Custom) — cheap↔strong per turn. - Structured outputs — inject
IMentorStructured(GenerateAsync<T>) for typed results / auto-filled forms. - Evaluation — inject
MentorEvaluator(wraps the Agent Framework's nativeagent.EvaluateAsync) in tests to gate CI on token/quality regressions; plugFoundryEvals/MEAI evaluators for quality & safety.
Client project setup
// Client/Program.cs
using Novior.MentorAgent.Abstractions.Models; // MentorLanguage, MentorTheme, ChatPosition
using Novior.MentorAgent.Blazor.Extensions;
// Stop and confirmations go through an HttpClient. The standalone WebAssembly template registers one;
// the client project of a Blazor Web App does not.
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddMentorAgentBlazor(options =>
{
options.HubUrl = "/mentor-hub"; // URL of Novior.MentorAgent.Server hub
options.BotName = "My Assistant";
options.Language = MentorLanguage.English;
options.Theme = MentorTheme.Default;
options.PrimaryColor = "#2563eb";
});
⚠️
HubUrl— relative vs absolute.
- Same origin (Blazor Auto hosted, or WASM served by the same ASP.NET Core host): use a relative path —
options.HubUrl = "/mentor-hub". It is resolved against the page's base address, as the browser resolves it:/mentor-hubat the origin's root,mentor-hubunder the app's base path.- Different origin (standalone WASM on
:5001connecting to a server on:5169): use the server's absolute URL —options.HubUrl = "http://localhost:5169/mentor-hub"— and configure CORS on the server (see the Novior.MentorAgent.Server README → CORS). Without server-side CORS the SignalR handshake is silently blocked by the browser.
// Standalone WASM example — different origin
builder.Services.AddMentorAgentBlazor(options =>
{
options.HubUrl = "http://localhost:5169/mentor-hub"; // absolute — server on a different port
options.BotName = "My Assistant";
});
Authenticating the connection — AccessTokenProvider
If your users sign in, set this. The server resolves the caller from the SignalR
HubCallerContext.User, and a browser cannot send an Authorization header on a WebSocket or
Server-Sent Events connection — so the token travels the way SignalR expects, and
AccessTokenProvider is where you supply it. It is the
WASM equivalent of the JavaScript client's accessTokenFactory.
var tokenStore = new TokenStore(); // your own: holds the signed-in user's token
builder.Services.AddSingleton(tokenStore); // same instance for your login page
builder.Services.AddMentorAgentBlazor(options =>
{
options.HubUrl = "https://api.example.com/mentor-hub";
options.AccessTokenProvider = () => Task.FromResult(tokenStore.Token); // null while signed out
});
⚠️ Without it every user is anonymous to the server, and every
RequiredRolesaction is blocked. What else follows depends on the server'sAnonymousIdentity. With the defaultPerSession, each hub connection is its own anonymous user: nothing is shared between people, but memory and theRateLimitPerUserallowance start over on every reconnect. WithShared, every user is the single key"anonymous": one rate limit for everybody and one memory bucket. WithMemoryAutoCaptureon (the default), one person's name and preferences then reach another person's prompt.
The server must accept the token from the query string. A browser cannot send an
Authorizationheader on a WebSocket or Server-Sent Events connection, so SignalR sends the token as?access_token=…. With JWT bearer on the server, forward it inOnMessageReceived, or the hub still sees an anonymous caller:// Server Program.cs builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => options.Events = new JwtBearerEvents { OnMessageReceived = ctx => { var token = ctx.Request.Query["access_token"]; if (!string.IsNullOrEmpty(token) && ctx.HttpContext.Request.Path.StartsWithSegments("/mentor-hub")) ctx.Token = token; return Task.CompletedTask; } });
For the hub, the provider is read on connect and on every reconnect, not per message. (The Stop and confirmation requests read it again each time they are sent.) The widget opens the hub connection lazily, when the user sends the first message, and keeps it for the life of the page. A sign-in before that first message is picked up automatically. A user who signs in after it stays on the old, anonymous connection:
MentorHubClienthas no way to restart it, so reload the page after sign-in (Navigation.NavigateTo(Navigation.Uri, forceLoad: true)) and restore the persisted token during startup. A reconnect is a new connection on the server, so it also starts a new conversation.
For anything else the connection needs — a custom header, a transport restriction, cookies —
ConfigureConnection runs on the same HttpConnectionOptions immediately afterwards:
options.ConfigureConnection = o => o.Headers["X-Tenant"] = tenantId;
Stop and confirmations — plain HTTP to the hub's server
■ Stop (POST /mentor/cancel) and the answer to a confirmation (POST /mentor/approve) cannot
go through the hub (see How it works), so the widget sends them as HTTP requests.
They follow the hub settings above:
- Where they go. When
HubUrlis an absolutehttp(s)URL, both are posted to the hub's origin (https://api.example.com/mentor/approveforHubUrl = "https://api.example.com/mentor-hub"). With a relativeHubUrl(same-origin hosting) they stay relative and resolve against the host'sHttpClient.BaseAddress. - What they carry. When
AccessTokenProvideris set, each request sendsAuthorization: Bearer <token>with the token it returns — the same credential the hub uses. Both endpoints accept a Stop or an answer only from the user who opened the hub connection (401for an anonymous caller,403for another user), so this is what lets a signed-in user's Stop and confirmations through.
Two things are still yours:
- Register an
HttpClient. The widget sends these requests through theHttpClientin your client's DI container, andAddMentorAgentBlazor()does not register one. The standalone WebAssembly template registers one. The client project of a Blazor Web App does not, and without it the WebAssembly runtime does not start (CannotResolveService … HttpClient): add the line of the setup snippet above to itsProgram.cs. With an absoluteHubUrltheBaseAddressdoes not matter for these two calls. - CORS, cross-origin. The server's CORS policy must allow the client's origin for these POSTs as
well as for the hub, including the
Authorizationheader when you send a token. On the server,UseCorscomes beforeUseAuthenticationandUseAuthorization, and those beforeMap…: with a protected hub, any other order blocks the client on another origin (see the Novior.MentorAgent.Server README → CORS).
A failure is only logged (the widget has already closed the prompt), so check the browser console if Stop or a confirmation seems to be ignored.
Add the widget
In MainLayout.razor or any page:
@using Novior.MentorAgent.Abstractions.Components
<ChatWidget />
Important — a standalone Blazor WASM app requires manual CSS/JS links in index.html.
Unlike Blazor Server (where the widget injects CSS automatically via <HeadContent>), a standalone Blazor WASM app uses a static index.html that is served before the .NET runtime starts. Add these two lines to your wwwroot/index.html:
<head>
...
<link href="_content/Novior.MentorAgent.Abstractions/css/MentorAgent.css?v=1.5.0" rel="stylesheet" />
</head>
<body>
...
<script src="_content/Novior.MentorAgent.Abstractions/js/MentorAgent.js?v=1.5.0"></script>
</body>
Without this, the widget will render unstyled until after WASM initializes (flash of unstyled content).
⚠️ Set the
?v=to the package version and change it on every upgrade. On Blazor Server the widget writes these tags itself and versions them for you, with the package version and its commit; here they are yours, nothing fingerprints them, and a returning visitor's browser will reuse the copy it already has. A staleMentorAgent.jsfails silently and selectively — the widget still works, but the calls that did not exist in the older file are swallowed by theirtry/catch, so the onboarding tour never appears and voice falls back to reading the whole answer at the end. If a feature seems missing after an upgrade, check the served file before anything else: it should containflagGetandbeginSpeech.
On Blazor Server, <ChatWidget /> injects its own CSS and JS automatically — no changes to _Host.cshtml or App.razor needed. A Blazor Web App (Auto or WebAssembly) has no index.html: prerendered — the default — the widget writes the two tags itself, as on Blazor Server; with prerender: false add them to the <head> of App.razor.
Widget customization
Theme and appearance
options.Theme = MentorTheme.Minimal; // Default | Dark | Minimal | Custom | Auto
options.PrimaryColor = "#7c3aed"; // any hex color
options.Position = ChatPosition.BottomRight; // BottomRight | BottomLeft | TopRight | TopLeft | SideRight | SideLeft
options.AvatarUrl = "/my-avatar.png";
options.BotName = "ShopFlow Assistant";
The panel is nearly opaque, so that its text keeps its contrast on any page (WCAG 2.1 AA in what we tested, from 1.5.0). For the glass of
1.4, set --bm-bg-panel back to a translucent color in your stylesheet: the contrast is then your page's to keep. The
whole list of variables, and what the widget does for accessibility, is in the Novior.MentorAgent README.
Welcome message and input
options.WelcomeMessage = "Hello! How can I help you today?";
options.InputPlaceholder = "Ask anything...";
options.EnableSuggestions = true; // show suggestion chips in the welcome panel
Language (10 supported)
options.Language = MentorLanguage.Italian;
// English | Italian | French | German | Spanish | Portuguese | Dutch | Polish | Japanese | Chinese
This sets the widget's UI strings, read again on every use. The language the assistant answers in is the server's options.Language in AddMentorAgent(), and the prompt enforces it whatever language the user writes in. A widget given its own language, <ChatWidget Language="MentorLanguage.Italian" />, sends it with every turn, and the server answers in it (see A language per page in the MentorAgent README). Otherwise set both:
using Novior.MentorAgent.Abstractions.Models; // MentorLanguage, in both Program.cs files
// Server Program.cs
builder.Services.AddMentorAgent(options => { /* ... */ options.Language = MentorLanguage.Italian; });
// Client Program.cs
builder.Services.AddMentorAgentBlazor(options => { options.Language = MentorLanguage.Italian; });
Voice
options.EnableVoiceInput = true; // microphone button (browser Speech Recognition)
options.EnableVoiceOutput = true; // text-to-speech for AI responses
options.VoiceStreaming = true; // default — speak sentence by sentence while the answer streams
options.VoiceBargeIn = true; // default — taking the floor stops playback
options.VoiceHandsFree = false; // opt-in — keep the conversation going by voice alone
options.VoiceRate = 1.0; // 0.5–2.0
Unlike image input and the hosted-tools badge below, these are not a mirror of server settings. Voice is entirely browser behaviour: your server sees only the transcript, as an ordinary message, and these options are the real thing rather than a copy of something the server enforces. The audio is the browser's business: some browsers, Chrome among them, send it to their maker's speech service for recognition (MDN, Using the Web Speech API).
VoiceStreaming is what makes voice output usable on anything longer than a sentence. Without it the assistant stays silent for the whole response and then recites it. Text is buffered to a sentence boundary and queued as its own utterance, so speech keeps pace with the stream — and the boundary detection knows that 8.459 is one number and that a fenced code block must be dropped whole rather than read out.
VoiceBargeIn stops playback when the user presses the microphone, sends a message, presses ■ Stop or starts a new conversation. It is press-to-interrupt, not acoustic: a browser cannot listen through its own playback without echo cancellation.
VoiceHandsFree sends on silence and reopens the microphone after the spoken answer ends. It needs both voice options on — with nothing to listen to there is nothing to wait for, and the loop would transcribe the assistant. If you set only one, it is ignored.
Onboarding tour
options.EnableOnboardingTour = true; // shown once, on this user's first open of the widget
options.TourUrl = "/mentor/tour"; // default — only change it if you remapped the server endpoints
The steps are generated on the server — only it knows the registered [MentorPage] pages and the assistant's tools — and fetched from GET /mentor/tour, which MapMentorAgentServer() maps whatever the server's own EnableOnboardingTour says. The flag on this client alone decides whether to show the tour; the server needs only the [MentorPage] pages, and with none it answers [].
That split follows the same rule as the hosted-tools badge: the server is the single source of truth, and a client that reproduces server state locally eventually displays something the server no longer agrees with.
Each step can carry a ready-made question the user sends with one tap — which is the point, since the usual failure of an in-app assistant is not that people cannot find it but that they do not know what to ask. A ? button in the header replays the tour later.
If the fetch fails the widget opens normally and logs a warning: a missing tour is a missing nicety, not a broken chat.
Generative UI cards
Nothing to configure on the client. When a server-side tool returns a MentorCard, the server pushes it on the Cards hub event and the widget renders it under the reply — fields, accent colour and buttons.
Buttons work the same as in Blazor Server: SendMessage sends the text as a user turn, Navigate routes to the URL, UIAction runs an action the current page registered (resolved at click time, so a stale handler from a page you have navigated away from is skipped rather than invoked).
To render a card kind yourself, supply a template and fall back to the built-in renderer for the rest:
<ChatWidget>
<CardTemplate Context="card">
@if (card.Kind == "order") { <OrderCard Card="card" /> }
else { <MentorCardView Card="card" /> }
</CardTemplate>
</ChatWidget>
The fallback's buttons work without any wiring: ChatWidget cascades its own card-action dispatcher around the cards, and a <MentorCardView> inside the template that sets no OnAction uses it, with the same SendMessage / Navigate / UIAction behaviour as above. An explicit OnAction on the MentorCardView still wins. The dispatcher reaches only MentorCardView: buttons you draw yourself in a template (as OrderCard might) get nothing from it, so render a MentorCardView for any card whose buttons should behave like the built-in ones.
Cards are built by server-side application code, not by the model, which is why they can safely carry buttons: nothing said in the conversation can add one or change where it points.
Image input (multimodal)
Lets the user attach images to a message. The widget accepts them four ways — 📎 file picker, Ctrl+V clipboard paste, drag & drop onto the composer, and 🔗 remote URL — and shows removable thumbnails before sending and inside the message bubble afterwards.
// Client Program.cs — mirrors the server settings (the server is what actually enforces them)
builder.Services.AddMentorAgentBlazor(options =>
{
options.EnableImageInput = true;
options.MaxImageBytes = 4 * 1024 * 1024; // per image (default 4 MB)
options.MaxImagesPerMessage = 4; // per turn (default 4)
options.AllowedImageTypes = ["image/png", "image/jpeg", "image/webp"]; // MIME allow-list
});
The server must also enable it, with a vision-capable model:
// Server Program.cs
builder.Services.AddMentorAgent(options =>
{
// ...AppName, ScanAssemblies as above...
options.ChatClient = azure.GetChatClient("gpt-4.1").AsIChatClient(); // vision-capable
options.EnableImageInput = true;
});
The client values only drive the UI and give the user instant feedback; every attachment is re-validated server-side (allow-list, size, count) before it reaches the model. Images travel over the hub as the second argument of SendMessage(text, attachments). The client always sends both arguments, with null for a text-only turn, because SignalR binds hub arguments by count. The images ride inside that one hub message as base64, so AddMentorAgentServer() raises MentorHub's MaximumReceiveMessageSize from the server's MaxImageBytes × MaxImagesPerMessage (+512 KB). Keep the client values at or below the server's: a message larger than the hub limit makes SignalR abort the connection before the server can validate it, and the user sees their own bubble and no reply.
Sending images from your own code:
@inject IMentorOrchestrator Orchestrator
await Orchestrator.SendMessageAsync("Cosa non va in questo screenshot?", [
new MentorAttachment { MimeType = "image/png", DataBase64 = base64, FileName = "error.png" },
new MentorAttachment { MimeType = "image/jpeg", Url = "https://cdn.example.com/product.jpg" },
]);
Image bytes are streamed to .NET through
IJSStreamReference, never marshalled as one big interop payload — so this works unchanged on Blazor Server too, without touchingHubOptions.MaximumReceiveMessageSize.
RAG citations
options.ShowRagSources = true; // show citation chips below AI responses
MCP and A2A status badges
When the server has MCP client servers or remote A2A agents configured, the widget can display live status badges in the header. Because the WASM client doesn't read the server configuration directly, you must mirror the relevant settings:
// Client Program.cs
builder.Services.AddMentorAgentBlazor(options =>
{
// MCP badge — mirror McpServers names from the server
options.ShowMcpStatus = true;
options.HasMcpServers = true;
options.McpServerNames = ["time", "filesystem"]; // must match server McpServers[].Name
// A2A badge — mirror RemoteAgents from the server
options.ShowA2AStatus = true;
options.HasRemoteAgents = true;
options.RemoteAgentDisplays = [
new AgentDisplayInfo { Name = "ShopFlow-B", AgentCardUrl = "http://localhost:5001" }
];
});
The MCP badge updates dynamically — when a server connects or disconnects the hub fires McpServerStatusChanged and the badge turns green/red. The A2A badge is static (shows configured agents, no live status).
Note:
McpServerNamesmust match theNamefields inMentorMcpServer[]configured on the server. A mismatch shows a stale "connecting" badge.
Hosted tools badge
If the server enables hosted tools (provider-side web search, code interpreter, file search, image generation, remote MCP), an amber pill lists them in the header. Do not list them here — turn the badge on and let the server say what it enabled:
options.ShowHostedToolsStatus = true; // that's all
The server sends its active set on the HostedToolsDeclared hub event the moment the client connects, and the widget prefers it over any local value. On WebAssembly the connection opens when the user sends the first message, so until then the badge shows options.HostedTools (nothing, by default). Setting options.HostedTools by hand still works as a pre-connection placeholder, but it is a copy that goes stale: change the server's configuration and the badge starts claiming tools that are not there — which is worse than no badge, because it is believed.
Unlike MCP the badge has no live status afterwards: hosted tools are configuration, not a connection.
Live activity needs no configuration here. When the server has ShowHostedToolActivity on, the widget already shows what the provider is doing, over the hub events it consumes anyway:
- "Ricerca sul web… · .NET 10" in the feedback line, via
ActionExecuting/ActionCompleted - pages cited by web search as citation chips, via
RagSourcesReady— the same panel as RAG, so it also needsShowRagSources - generated images attached to the finished message, via the
GeneratedImagesevent
The WASM client handles all three out of the box.
Page context and UI actions
IMentorPageContext works identically to Blazor Server. Register context data and UI actions in any page — they are sent to the server as a snapshot before each AI message.
Inject page context
@inject IMentorPageContext PageContext
@implements IDisposable
@code {
protected override void OnInitialized()
{
PageContext
.SetPageName("Orders")
.Set("ActiveFilter", "Pending")
.Set("VisibleRows", _orders.Count);
}
public void Dispose() => PageContext.Clear("Orders"); // this page's entries only, by its name
}
Register UI actions (no parameter)
PageContext.RegisterUIAction(
"open_create_modal",
"Opens the modal to create a new order",
_ => OpenCreateModal());
Register UI actions with typed parameter
// The AI calls highlight_row(42) — parameter deserialized automatically
PageContext.RegisterUIAction<int>(
"highlight_row",
"Highlights the specified order row",
id => HighlightRow(id),
parameterHint: "integer: order ID");
Async UI actions
PageContext.RegisterUIActionAsync<OrderModel>(
"prefill_form",
"Pre-fills the edit form with order data",
async model => {
_formModel = model;
await InvokeAsync(StateHasChanged);
},
parameterHint: "JSON: { orderId, amount, status }");
A form as a UI action — RegisterForm<TModel>
@inject IMentorPageContext PageContext
@inject IJSRuntime JS
<EditForm Model="_ticket" OnValidSubmit="SaveAsync">
<InputText data-mentor-id="ticket.title" @bind-Value="_ticket.Title" />
<InputCheckbox data-mentor-id="ticket.urgent" @bind-Value="_ticket.Urgent" />
<button type="submit">Save</button>
</EditForm>
@code {
protected override void OnInitialized()
{
PageContext.SetPageName("New ticket")
.RegisterForm<Ticket>("ticket", "The form of a new support ticket", JS);
PageContext.SignalReady();
}
}
The model gets one action, fill_<form>, whose parameter is the fields to fill: each field is found by its data-mentor-id, "<form>.<field>". It fills and never submits the form: sending it stays an action of your own. Sensitive fields (passwords, secrets, tokens, PINs, cards, IBANs, one-time codes) are left out unless you let them in, and a password field of the page is never written. The fill runs in the browser, in the page; the server is not told whether it succeeded, as for every UI action of a WebAssembly client. The whole reference, with the options, is in the Novior.MentorAgent README, «A page's form as a UI action».
A grid as UI actions — RegisterGrid<TRow>
<tr data-mentor-id="tickets.row">
<td data-mentor-id="tickets.cell.id">@t.Id</td>
<td><button data-mentor-id="tickets.open" @onclick="@(() => Open(t))">Open</button></td>
</tr>
@code {
protected override void OnInitialized()
{
PageContext.SetPageName("Tickets")
.RegisterGrid<Ticket>("tickets", "The open tickets", JS, t => t.Id);
PageContext.SignalReady();
}
}
The model gets open_<grid>_row({ key }), and sort_<grid>({ column, descending? }) and filter_<grid>(text) when the grid sorts and filters: each part is found by its data-mentor-id, "<grid>.row", "<grid>.cell.<key>", "<grid>.open", "<grid>.sort.<column>" and "<grid>.filter". A sort reads the header's aria-sort. Nothing of the rows goes back to the model, and a sensitive column is never the key. A QuickGrid is given its selectors with MentorGridOptions.Selector. The whole reference is in the Novior.MentorAgent README, «A page's grid as UI actions».
Remove an action
PageContext.UnregisterUIAction("highlight_row");
Signal page ready (Blazor Server and MAUI Blazor Hybrid only)
On WebAssembly SignalReady() is a no-op and costs nothing, so you can keep the call in pages shared with a Blazor Server host:
protected override async Task OnInitializedAsync()
{
await LoadDataAsync();
PageContext.SignalReady(); // Blazor Server, MAUI Blazor Hybrid: tells navigate_to the UI actions are ready. WASM: no-op
}
What matters on WebAssembly is when the server learns about the page. Its name, data and UI actions reach the server only with the page-context snapshot sent before the user's next message (UpdatePageContext). So when the assistant moves the user with navigate_to, the server does not wait for the new page — even on a [MentorPage] with HasUIActions = true, because on a hub connection nothing could ever signal it. The new page's UI actions become callable from the user's next message, not later in the same answer.
(On Blazor Server and in MAUI Blazor Hybrid, where navigate_to does wait on HasUIActions pages, call SignalReady() as the last line of OnInitialized / OnInitializedAsync, not from OnAfterRenderAsync, or the wait may already have timed out.)
Page navigation
⚠️
[MentorPage]attributes are defined in the server project (scanned byScanAssemblies), not in the client project.
// Server project — scanned via options.ScanAssemblies
[MentorPage(Url = "/orders", Name = "Orders", Description = "Order management")]
public class OrdersPage { }
[MentorPage(Url = "/products", Name = "Products", HasUIActions = true, ReadyTimeout = 3000)]
public class ProductsPage { }
The AI calls navigate_to("/orders") — the WASM widget handles navigation automatically via Blazor's NavigationManager.
HasUIActions and ReadyTimeout only affect hosts where the page runs in the same process as the turn: Blazor Server, or a MAUI Blazor Hybrid app. For a turn that arrives over the hub, navigate_to returns without waiting for SignalReady (it logs this at Debug level), and the new page's UI actions reach the model with the next page-context snapshot, on the user's next message — see Signal page ready.
UI Action overloads reference
Four overloads are available, from simple to fully typed and async:
| Overload | Parameter | Execution | Use when |
|---|---|---|---|
RegisterUIAction(name, desc, Action<object?>) |
Raw object? |
Synchronous | Simple no-param or legacy code |
RegisterUIAction<TParam>(name, desc, Action<TParam>) |
Auto-deserialized from JSON | Synchronous | Typed param, sync handler |
RegisterUIActionAsync(name, desc, Func<object?, Task>) |
Raw object? |
Async | No-param async actions (e.g. async _ => { await LoadAsync(); }) |
RegisterUIActionAsync<TParam>(name, desc, Func<TParam, Task>) |
Auto-deserialized from JSON | Async | Typed param, async handler (recommended) |
UnregisterUIAction(name) |
— | — | Remove a specific action dynamically |
Automatic parameterHint generation
For typed overloads, parameterHint is auto-generated from the type when omitted:
TParam |
Auto-generated hint |
|---|---|
int, long, and the other integers, unsigned too |
"integer" |
float, double, decimal |
"number" |
bool |
"boolean" |
string |
"string" |
Guid |
"string (GUID)" |
DateTime, DateTimeOffset, DateOnly |
"string (ISO 8601 date)" |
TimeOnly, TimeSpan |
"string (time, HH:mm:ss)", "string (duration, d.hh:mm:ss)" |
char, Uri |
"string (one character)", "string (URI)" |
Status (enum) |
"string (Active\|Inactive\|Pending)" |
List<int> |
"array<integer>" |
OrderFormModel (class) |
"{ customerId: integer, productName: string, ... }" |
Override only when extra clarity is needed:
.RegisterUIAction<int>(
"highlight_row", "Highlights an order row",
id => HighlightRow(id),
parameterHint: "integer: order ID") // ← manual override
On WebAssembly the AI does not wait for your handler. The server forwards the call as
UIActionRequestedand reports the action complete as soon as it is sent. The browser then runs the handler and reports nothing back. As a result, an exception in the handler never reaches the model, andOnUIActionCompletedcan fire before an async handler has finished. Make each action self-contained (load what it needs inside the handler) rather than relying on the model to chain actions that depend on the previous one having finished. (On Blazor Server, where the handler runs in-process, async handlers are awaited.)
[MentorPage] parameters (server project)
| Parameter | Required | Description |
|---|---|---|
Url |
✅ | Page URL (e.g. "/orders") |
Name |
✅ | Human-readable page name injected into the system prompt |
Description |
— | Optional feature description |
HasUIActions |
— | If true, navigate_to waits for PageContext.SignalReady() before UI actions — only where the page runs in the turn's process: Blazor Server or MAUI Blazor Hybrid. On a hub turn from this WASM client it does not wait: the page's actions arrive with the user's next message. Default: false |
ReadyTimeout |
— | Timeout in ms for SignalReady() (Blazor Server and MAUI Blazor Hybrid only). Default: 2000 |
All AddMentorAgentBlazor() options
| Option | Type | Default | Description |
|---|---|---|---|
HubUrl |
string |
"/mentor-hub" |
URL of the Novior.MentorAgent.Server SignalR hub. A relative value is resolved against the page's base address. When absolute (http(s)), its origin is also where Stop (/mentor/cancel) and confirmation answers (/mentor/approve) are posted |
AccessTokenProvider |
Func<Task<string?>>? |
null |
Bearer token for the hub, read on connect and on every reconnect, and sent as Authorization: Bearer on every Stop and confirmation request. Without it every user is anonymous: RequiredRoles blocked; memory and rate limit are per connection (server default AnonymousIdentity = PerSession) or one shared bucket (Shared) |
ConfigureConnection |
Action<HttpConnectionOptions>? |
null |
Escape hatch on the hub's connection options — headers, transports, cookies. Runs after AccessTokenProvider |
PageAssemblies |
Assembly[] |
[] |
Assemblies with pages (@page) the entry assembly does not reference. At every connection the client sends the server its pages, for a server with AutoMentor.Enabled (Novior.MentorAgent README, «Pages from your routes») |
BotName |
string |
"Mentor AI" |
Bot name in the widget header |
WelcomeMessage |
string? |
null |
Welcome message (HTML supported) |
ShowAiDisclosure |
bool |
true |
Shows the notice that tells people they are talking to an AI, under the widget's header for the whole conversation. false hides it; the replies' marker stays |
AiDisclosureMessage |
string? |
null |
The notice's text, shown as written (as text, never as markup). null or white space: the default, translated into the configured language |
AvatarUrl |
string? |
null |
Custom avatar URL |
InputPlaceholder |
string? |
null |
Input box placeholder. null uses the localized text in Language ("Write a message..." in English) |
Theme |
MentorTheme |
Default |
Widget visual theme |
Position |
ChatPosition |
BottomRight |
Widget position on screen |
PrimaryColor |
string? |
null |
Custom hex accent color |
Language |
MentorLanguage |
English |
Language for widget UI strings (10 languages supported) |
EnableVoiceInput |
bool |
false |
Show microphone button (browser Speech Recognition) |
EnableVoiceOutput |
bool |
false |
Text-to-speech for AI responses (browser Speech Synthesis) |
VoiceStreaming |
bool |
true |
Speak each sentence as it streams instead of reading the finished answer back |
VoiceBargeIn |
bool |
true |
Stop playback when the user takes the floor |
VoiceHandsFree |
bool |
false |
Voice-only conversation loop. Ignored unless both voice options are on |
VoiceRate |
double |
1.0 |
SpeechSynthesisUtterance.rate — useful range 0.5–2.0 |
EnableOnboardingTour |
bool |
false |
Show the guided tour on first open. This flag alone decides: the server answers GET /mentor/tour whatever its own EnableOnboardingTour says |
TourUrl |
string |
"/mentor/tour" |
Where to fetch the tour steps from. A relative value is resolved against HubUrl's origin when HubUrl is absolute (the tour is served by the same server as the hub), otherwise against the app base address. An absolute URL is used as-is |
EnableSuggestions |
bool |
false |
Suggestion chips in the welcome panel |
EnableImageInput |
bool |
false |
Image attachments — 📎 upload, paste, drag & drop and 🔗 URL. Must also be enabled server-side |
MaxImageBytes |
int |
4194304 |
Client-side size cap per image (4 MB). Mirrors the server option |
MaxImagesPerMessage |
int |
4 |
Client-side cap on images per message. Mirrors the server option |
AllowedImageTypes |
List<string> |
png, jpeg, gif, webp |
Client-side MIME allow-list. Mirrors the server option |
ShowRagSources |
bool |
false |
Citation chips below AI responses |
ShowHostedToolsStatus |
bool |
false |
Show the hosted-tools badge (provider-side web search / code interpreter / file search / image generation / remote MCP) |
HostedTools |
MentorHostedTools |
None |
Pre-connection placeholder only. The server publishes its actual set on HostedToolsDeclared at connect and the widget prefers that — leave this unset rather than keeping a copy that goes stale |
ShowMcpStatus |
bool |
false |
Show MCP server connection status badge in the widget header |
HasMcpServers |
bool |
false |
Whether the server has MCP client servers configured (enables the MCP badge) |
McpServerNames |
List<string> |
[] |
Names of MCP servers configured on the server — pre-populates the badge in "connecting" state at startup |
ShowA2AStatus |
bool |
false |
Show A2A remote agent status badge in the widget header |
HasRemoteAgents |
bool |
false |
Whether the server has remote A2A agents configured (enables the A2A badge) |
RemoteAgentDisplays |
List<AgentDisplayInfo> |
[] |
Remote A2A agents to display in the A2A badge and detail bar |
How it works
[Blazor WASM Browser]
ChatWidget
↓ IMentorOrchestrator (WasmMentorOrchestrator)
↓ SignalR
[ASP.NET Core Server — Novior.MentorAgent.Server]
MentorHub
↓ MentorOrchestrator (full AI pipeline)
↓ AI Provider (Azure OpenAI, OpenAI, Ollama...)
↑ Streaming events (chunks, confirmations, navigation, UI actions...)
↑ SignalR
ChatWidget renders response
- Page context (page name, data, UI action descriptions, and the path of the page shown without its query or fragment) is sent to the server before every message via
UpdatePageContext. - Recipes of the page that the server asks to run arrive as
RecipeRequested: the client runs them in the page with the runner of Novior.MentorAgent.Abstractions and answers withPOST /mentor/recipe-result(HTTP, for the same reason as Stop below), to the hub's origin with the hub's bearer token. The model waits for that answer. - UI action invocations arrive from the server as
UIActionRequestedand are executed locally in the browser byWasmMentorStateService. - Confirmation dialogs (HITL) are shown inline by
ChatWidget. The response is sent viaPOST /mentor/approve?actionId=...&approved=true|false(HTTP) — not via a hub method. SignalR processes hub messages sequentially per connection, so callingRespondToApprovalvia hub whileSendMessageis awaiting would deadlock.WasmMentorStateServicesends it to the hub's origin with the hub's bearer token — see Stop and confirmations. - Stop (cancelling an in-flight turn) is sent via
POST /mentor/cancel?connectionId=...(HTTP) — not via theCancelRequesthub method, for the same sequential-dispatch reason: whileSendMessageis streaming, SignalR cannot dispatch another hub invocation on that connection, so the hub call would only run after the turn it was meant to abort.WasmMentorOrchestratorsends it the same way as the approval: to the hub's origin, with the hub's bearer token. - UI actions after
navigate_to: the server does not wait for the new page (nothing on a hub connection can callSignalReady); the page's actions reach the model with the nextUpdatePageContext, on the user's next message. - Navigation triggered by the AI arrives as
NavigationRequestedand is handled by Blazor'sNavigationManager.
Conversation lifetime and session snapshots
The conversation lives on the server, in a DI scope that belongs to one SignalR connection. A reconnect (network drop, server restart, a laptop waking up) gets a new connection id and therefore a new, empty conversation on the server, even though the widget still shows the old messages.
IMentorOrchestrator.SerializeSessionAsync / RestoreSessionAsync throw NotSupportedException on WebAssembly, because the AgentSession is not in the browser. Save and restore it over HTTP instead, with the live connection id. That id is null until the first message opens the connection.
@inject Novior.MentorAgent.Blazor.Hub.MentorHubClient Hub
// BaseAddress = the server, carrying the user's token
@inject HttpClient Http
// Save — 204 means there is no conversation yet: keep what you already have
var save = await Http.GetAsync($"mentor/session?connectionId={Uri.EscapeDataString(Hub.ConnectionId!)}");
if (save.StatusCode == HttpStatusCode.OK)
_saved = await save.Content.ReadAsStringAsync();
// Restore on the new connection (after its first message; an earlier request can get 404)
await Http.PostAsync($"mentor/session?connectionId={Uri.EscapeDataString(Hub.ConnectionId!)}",
new StringContent(_saved, Encoding.UTF8, "application/json"));
Both endpoints check that the caller is the user who opened the connection (401/403 otherwise), before the body is read. The snapshot is opaque — protected with ASP.NET Core Data Protection and bound to that user (on a host without sign-in every visitor is the same anonymous user, so there it is bound to the application only) — so store it as the text GET returned. A body that is not a snapshot this server issued for this user, or was edited, or was saved before 1.0.0-rc.14, is refused with 400 and leaves the live conversation untouched. Restoring after a server restart needs the server's Data Protection key ring persisted (see the Novior.MentorAgent.Server README).
Events — IMentorStateService
ChatWidget handles all events automatically. If you need to subscribe to events directly in your own components, inject IMentorStateService:
@inject IMentorStateService State
@implements IDisposable
protected override void OnInitialized()
{
State.OnStreamingChunk += OnChunk;
State.OnStreamingCompleted += OnCompleted;
State.OnBusyChanged += OnBusy;
State.OnError += OnError;
State.OnActionExecuting += OnActionExecuting;
State.OnActionCompleted += OnActionCompleted;
State.OnActionFailed += OnActionFailed;
State.OnConfirmationRequired += OnConfirmationRequired;
State.OnNavigationRequested += OnNavigation;
State.OnRagSourcesReady += OnRagSources;
State.OnTeamMemberSpeaking += OnTeamSpeaking;
State.OnUIActionExecuting += OnUIActionStart;
State.OnUIActionCompleted += OnUIActionEnd;
}
public void Dispose()
{
State.OnStreamingChunk -= OnChunk;
// ... unsubscribe all
}
Complete event reference
| Event | Signature | Fired when | Typical use |
|---|---|---|---|
OnStreamingChunk |
Action<string> |
Each streaming token | Append text to a custom chat bubble |
OnStreamingCompleted |
Action |
Full response received | Finalize message, re-enable input |
OnBusyChanged |
Action<bool> |
AI starts/stops processing | Show/hide spinner |
OnError |
Action<string> |
Critical error (rate limit, safety block) | Show error banner |
OnActionExecuting |
Action<string> |
Tool/agent is executing. Carries the text to show (the action's Description, or the routing, team or hosted-tool label), not the tool name |
Show action feedback bar. To log which tool ran, use OnActionCompleted, which carries the tool name |
OnActionStarted |
Action<MentorActionStarted> |
Never raised by this client: the hub sends it only the text shown, not the tool name | Record actions on the server, where it is raised with ToolName and DisplayName |
OnActionCompleted |
Action<string> |
Tool execution succeeded | Hide feedback bar |
OnActionFailed |
Action<string> |
Tool execution failed — tool: message; with the server's OnException set, never the exception's own text |
Show error in feedback |
OnConfirmationRequired |
Action<ConfirmationRequest> |
Destructive action needs user approval | Show custom confirmation dialog |
OnApprovalResponse |
Action<ConfirmationRequest, bool> |
The answer reached the waiting turn: raised once the server accepted it, never after Stop or for a second answer | An audit trail of decisions |
OnNavigationRequested |
Action<string> |
AI triggered navigation | Custom routing logic |
OnRagSourcesReady |
Action<IReadOnlyList<MentorRagResult>> |
RAG documents the finished answer cited (plus hosted web/file-search citations); not raised when nothing was cited | Show custom citation UI |
OnTeamMemberSpeaking |
Action<string, string> |
GroupChat member speaking | Show "Team · Role" feedback |
OnUIActionExecuting |
Action<string> |
UI action started | Custom feedback |
OnUIActionCompleted |
Action<string> |
UI action completed | Custom feedback |
OnMcpServerStatusChanged |
Action<string, bool> |
MCP server connects (true) or disconnects (false) |
Update the MCP status badge — forwarded over the hub as McpServerStatusChanged |
OnCardsReady |
Action<IReadOnlyList<MentorCard>> |
A tool returned generative-UI cards | Render them yourself instead of using CardTemplate |
OnGeneratedImages |
Action<IReadOnlyList<string>> |
The hosted image tool produced images | Show them in your own gallery. Each string is a data: URI or URL |
OnHostedToolsDeclared |
Action<MentorHostedTools> |
Once per connection, right after connect | Drive your own capability badge from what the server actually enabled, rather than from a client-side guess |
@inject IMentorStateService State
@inject IMentorOrchestrator Orchestrator
@inject NavigationManager Nav
@implements IDisposable
@if (_capabilities.HasFlag(MentorHostedTools.WebSearch)) { <span class="badge">🌐 web</span> }
@foreach (var url in _images) { <img src="@url" alt="generata" /> }
@* Outside ChatWidget no dispatcher is cascaded: without OnAction the buttons do nothing *@
@foreach (var c in _cards) { <MentorCardView Card="c" OnAction="OnCardAction" /> }
<span>MCP: @_mcp.Count(x => x.Value)/@_mcp.Count</span>
@code {
private MentorHostedTools _capabilities;
private IReadOnlyList<string> _images = [];
private IReadOnlyList<MentorCard> _cards = [];
private readonly Dictionary<string, bool> _mcp = new();
protected override void OnInitialized()
{
State.OnHostedToolsDeclared += Declared;
State.OnGeneratedImages += Images;
State.OnCardsReady += Cards;
State.OnMcpServerStatusChanged += Mcp;
}
// Fires once per connection, before any message. Render your capability badge from THIS rather
// than from a client-side copy of the server's configuration — the two drift, and a badge
// claiming web search the model never got is worse than no badge.
private void Declared(MentorHostedTools flags) { _capabilities = flags; InvokeAsync(StateHasChanged); }
private void Images(IReadOnlyList<string> urls) { _images = urls; InvokeAsync(StateHasChanged); }
// Only if you are NOT using ChatWidget's CardTemplate. Ignoring cards loses them outright: the
// model is told they are already on screen, so it will not repeat their content as text.
private void Cards(IReadOnlyList<MentorCard> cards) { _cards = cards; InvokeAsync(StateHasChanged); }
private async Task OnCardAction(MentorCardAction action)
{
if (action.Kind == MentorCardActionKind.SendMessage) await Orchestrator.SendMessageAsync(action.Value);
else if (action.Kind == MentorCardActionKind.Navigate) Nav.NavigateTo(action.Value);
// UIAction: run the current page's registered action named action.Value, as ChatWidget does
}
private void Mcp(string name, bool connected) { _mcp[name] = connected; InvokeAsync(StateHasChanged); }
public void Dispose()
{
State.OnHostedToolsDeclared -= Declared;
State.OnGeneratedImages -= Images;
State.OnCardsReady -= Cards;
State.OnMcpServerStatusChanged -= Mcp;
}
}
All eighteen events are listed above — that is the whole of IMentorStateService's read side.
All events fire on a background thread from the SignalR connection. Always use
InvokeAsync(StateHasChanged)when updating Blazor component state from these handlers.
Sending state changes — the Notify* side
Each event has a matching Notify* method on the same interface (NotifyStreamingChunk,
NotifyCardsReady, …). Those are how the orchestrator raises the events; application code
subscribes and does not call them.
The two members you do call are the HITL replies:
| Method | Purpose |
|---|---|
ConfirmAsync(Guid actionId) |
Approve the pending action |
Cancel(Guid actionId) |
Reject it |
actionId is ConfirmationRequest.ActionId from OnConfirmationRequired. In WASM these travel to
the server over POST /mentor/approve (at the hub's origin, with the AccessTokenProvider token —
see Stop and confirmations), never as a hub method — SignalR dispatches one hub call at a
time per connection, so an approval sent through the hub would deadlock behind the turn that is
waiting for it.
Custom HITL confirmation dialog
ChatWidget always shows its own inline confirmation prompt when OnConfirmationRequired fires, and no parameter turns it off. Subscribing therefore adds your dialog next to the widget's prompt instead of replacing it. Answering from your dialog also does not close the widget's prompt, which reacts only to its own buttons. To show only your dialog, hide the built-in prompt with CSS (.bm-confirm { display: none !important; }: the package stylesheet sets display: flex on the same selector), then subscribe to OnConfirmationRequired and call ConfirmAsync / Cancel yourself.
This works identically whichever
MentorOptions.HitlModethe server uses (Blockingor the Agent Framework'sNativeflow) — the WASM client sees the sameConfirmationRequiredevent and replies over the samePOST /mentor/approveendpoint, so switching mode server-side needs no client change.
@inject IMentorStateService State
@implements IDisposable
@if (_pendingConfirmation is not null)
{
<div class="my-confirm-dialog">
<p>@_pendingConfirmation.Message</p>
<button @onclick="Approve">Conferma</button>
<button @onclick="Reject">Annulla</button>
</div>
}
@code {
private ConfirmationRequest? _pendingConfirmation;
protected override void OnInitialized()
{
State.OnConfirmationRequired += OnConfirmationRequired;
State.OnBusyChanged += OnBusyChanged;
}
private void OnConfirmationRequired(ConfirmationRequest req)
=> InvokeAsync(() => { _pendingConfirmation = req; StateHasChanged(); });
// The turn is over (answered, stopped or failed): nothing waits for this dialog any more.
private void OnBusyChanged(bool busy)
{
if (!busy) InvokeAsync(() => { _pendingConfirmation = null; StateHasChanged(); });
}
private async Task Approve()
{
if (_pendingConfirmation is not { } req) return;
_pendingConfirmation = null;
await State.ConfirmAsync(req.ActionId);
}
private void Reject()
{
if (_pendingConfirmation is not { } req) return;
_pendingConfirmation = null;
State.Cancel(req.ActionId);
}
public void Dispose()
{
State.OnConfirmationRequired -= OnConfirmationRequired;
State.OnBusyChanged -= OnBusyChanged;
}
}
Close the dialog on the click and when the turn ends, as here. OnApprovalResponse is raised only when
the answer reached a turn that was waiting for it, so it suits an audit trail of decisions, not closing
a dialog: a click after Stop raises nothing.
// An audit trail: one entry per answer that a waiting turn received
State.OnApprovalResponse += (req, approved) =>
logger.LogInformation("{Tool} {Decision} by the user", req.ToolName, approved ? "approved" : "rejected");
ConfirmationRequesthas three properties:ActionId(Guid),ToolName(string), andMessage(string). UseToolNameto customize the dialog copy per action type if needed.
Blazor Auto tip
In a Blazor Auto app, you can keep <ChatWidget /> with @rendermode="InteractiveServer" — it stays server-side with no changes to your existing Novior.MentorAgent setup. Use Novior.MentorAgent.Blazor only when you need the widget to run fully in WebAssembly.
This needs the template's Interactivity location: Per page/component. With Global the layout runs under Auto and, once in WebAssembly, cannot host a server component (NotSupportedException): use Novior.MentorAgent.Blazor there. In the WebAssembly template, first add .AddInteractiveServerComponents() and .AddInteractiveServerRenderMode() to the server's Program.cs, or every page fails with HTTP 500.
@* Keep server-side in Blazor Auto — zero changes needed *@
<ChatWidget @rendermode="InteractiveServer" />
Requirements
- .NET 10.0+
- Server project must have
Novior.MentorAgent+Novior.MentorAgent.Serverinstalled and configured - Browser with WebAssembly support
Related Packages
| Package | Purpose |
|---|---|
| Novior.MentorAgent | Blazor Server app — AI orchestration engine |
| Novior.MentorAgent.Server | Any ASP.NET Core backend — SignalR hub + SSE + MCP + A2A |
| Novior.MentorAgent.Abstractions | Shared UI components (transitive dep — no need to install directly) |
| Novior.MentorAgent.Declarative | Optional — define Level-2 specialist agents in YAML instead of C# |
License
Apache License 2.0 — the full text is in the LICENSE file inside this package, with the copyright notice in NOTICE. Versions up to and including 1.0.0-rc.14 were released under the MIT License, which still applies to them.
| 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
- Microsoft.AspNetCore.SignalR.Client (>= 10.0.13)
- Novior.MentorAgent.Abstractions (= 1.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1.5.0 - 2026-11-26
### Added
- The AutoMentor knows the pages of a Blazor application from its routes, with no attribute: with
`options.AutoMentor.Enabled`, the components that carry `@page` in the entry assembly, in the assemblies it
references that use the components, and in the new `AutoMentor.PageAssemblies`, read once. The WebAssembly client of
Novior.MentorAgent.Blazor sends its own pages to the server at every connection, with the new hub method
`ReportPages` (`PageRouteInfo`); `MentorAgentBlazorOptions.PageAssemblies` adds an assembly. Structure only: a route
and the component that serves it. New rules in ACTION-RULES.md: `page.from-routes`, `page.client-routes`,
`page.route-shape`, `page.route-limit`, `page.read`. README: «Pages from your routes».
- The AutoMentor reads the manifest of the pages a scan writes, `mentor-ui-manifest.json` in the project: the targets
of Novior.MentorAgent, in `buildTransitive`, embed it in the application, also one that references only
Novior.MentorAgent.Server, and the host reads it once with the pages. A page it has is scanned, with the elements
the scan read; the others are to scan. It is read as untrusted: a password field, card data (`autocomplete="cc-*"`),
a hidden, disabled or `data-mentor-exclude` element never comes out, and a value has no place in it. New rules in
ACTION-RULES.md: `page.manifest`, `page.manifest-read`, `page.manifest-version`, `page.manifest-excluded`,
`page.manifest-shape`.
- `IMentorActionCatalog.GetPages()` lists the pages the AutoMentor knows, each a `MentorPageInfo` with its route, its
component, its `MentorPageCoverage` (`ToScan` or `Scanned`), when the scan read it and its elements
(`MentorPageElement`: tag, role, label, type, option labels, form, a stable selector, the roles it was seen with).
A catalogue written before the member lists none. New rule in ACTION-RULES.md: `page.catalog`.
- **Novior.MentorAgent:** the package now carries `buildTransitive/Novior.MentorAgent.targets`. When the project has
`mentor-ui-manifest.json` (or the file its `MentorUiManifest` property names), it embeds the file in the application
and takes it out of `Content` and `None`; without the file it does nothing. It holds no target and no check, so it
cannot stop a build.
- `MentorActionInfo.ParametersSchema`: the JSON schema of an action's arguments, the one the model reads in the
action's tool, for every origin. An endpoint declared as an action has the schema of its route, its query and its
body; a command or a query, its type's properties. `null` when there is no tool to read it from, such as an endpoint
in a host without Novior.MentorAgent.Server. New rule in ACTION-RULES.md: `describe.parameters-schema`.
- **Novior.MentorAgent.Scanner**, a new package for development: `AddMentorUiScanner()` scans the pages of a Blazor
application once it has started, in `Development` only, with the Edge or Chrome already installed (it downloads
none), and writes `mentor-ui-manifest.json` in the project for the AutoMentor. Structure only, never a value.
Reference it in Debug only. With `MentorAgent:Scanner:Roles` it also reads the pages as a user of its own with each
role, signed in with a one-time token, in `Development` and from this machine only; it clicks only what opens a tab,
a menu or a collapsed section, never a submit or a delete. MentorAgent's own chat widget, and what the page does not
show, stay out of the manifest; the rows of a table are read once per column, with the column's header. Its browser closes with the application, on Windows also
when the application is killed; elsewhere the next scan closes it. A page with route parameters is opened with the
values of `MentorAgent:Scanner:RouteParameters`. A scan reads again only the pages whose code, or whose layout's,
changed (`MentorAgent:Scanner:Full` reads them all), and writes the manifest only when it changes. In a .NET MAUI
Blazor Hybrid app on Windows, `StartMentorUiScan()` reads the pages in the app's own WebView2, in a Debug build only,
as the app's user. New rules in ACTION-RULES.md: `page.scan`, `page.scan-development`, `page.scan-browser`,
`page.scan-user`, `page.scan-clicks`, `page.scan-parameters`, `page.scan-changed`, `page.scan-webview`.
- **Novior.MentorAgent.Cli**, a new .NET tool: `novior-mentor scan` runs the same scan from outside the app, for a CI
pipeline or a WebAssembly standalone app. The pages come from the app's built dll, the app runs at `--url`, and the
browser runs on the machine that runs the command. `--account <role>=<variable>` reads as an account of the team,
its session cookie taken from an environment variable and never logged; `--fail-on-change` writes nothing and exits
with 3 when the manifest would change. New rules in ACTION-RULES.md: `page.scan-tool`, `page.scan-ci`.
- **Observation of the pages in production** (`MentorAutoMentorOptions.ObservePages`, on by default, with the
AutoMentor, which is off by default): the widget reads what the users open, dialogs, tabs and panels included, with
the scan's own reader, and sends the structure, never a value, no option of a select, no text of a row, a list or a
card. An observed element's selector is its `data-mentor-id`, or a path of tags and positions from the nearest
ancestor with one, or from the body: never an id, a class, a name or a `data-testid`, which may be a record's; give
the elements a `data-mentor-id` for stable selectors. An element reaches `IMentorActionCatalog.GetPages()` only once two users saw it the same (one is enough in a
MAUI Hybrid app, on the user's own device), marked with the new `MentorPageElement.Coverage` (`Observed`), and with
no label and no form: what a user saw stays in the application's process. A page only observed has the new
coverage `MentorPageCoverage.Observed`. Kept in memory, within limits, never in the log. A WebAssembly client of
**Novior.MentorAgent.Blazor** sends it to the hub's new `ReportObservedPage` (**Novior.MentorAgent.Server**), with
the new `PageObservedElement`, once the widget connects to the hub, usually at the first message; until then it
waits in the browser, at most 200 messages. New rules in
ACTION-RULES.md: `page.observe`, `page.observe-private`, `page.observe-values`, `page.observe-repeated`,
`page.observe-shared`, `page.observe-route`, `page.observe-limit`, `page.observe-off`.
- **Recipes of the pages, from a source**: a recipe is a sequence of steps on one page that the widget runs in the
user's browser, with the new `MentorRecipeRunner.js` of **Novior.MentorAgent.Abstractions**, offered to the model as
one of the page's UI actions with its own roles and its own confirmation. An application gets its recipes from an
`IMentorRecipeSource` (`AddMentorRecipeSource<T>()`), typically the bridge of a console where they are approved:
asked once for a session, which keeps them, it gives `MentorRecipeDefinition`s, known by their route and their name.
A recipe that breaks a rule (`MentorRecipeLimits`) is left out with a code of the closed list
`MentorRecipeRejectionReasons`, reported to the new `IMentorAgentSourceObserver.OnRecipesLoaded` (with a default
body), and is never a tool. A recipe is governed as a UI action of its page: the policies answer for it by page and
name when it is offered and when it is called. With the name of a UI action the page registers in code, the source
says who wins (`MentorRecipeSourceResult.Precedence`: `MentorRecipePrecedence.Code`, the default, or `Source`); any
other tool always wins over a recipe. A recipe turned off stays off in its version: a new version is on. A step whose element is gone, hidden, disabled or excluded stops
the recipe and turns it off. New reason code of `Failed`: `MentorActionReasons.ElementMissing` (`element-missing`).
A row step finds the row of a table or a grid by the text of a key cell, compared in the browser, with the page's
filter or scrolling, a virtualized `QuickGrid` included, and clicks an action in it; after writing the page's
filter it waits for the page's answer, up to 5 seconds, so that a server slower than a quiet while (Blazor Server
under load) is not read before it answered, and a render that leaves the rows as they were, as Blazor Server makes
at the first await of the event's handler, is not taken for the answer; nothing inside
`data-mentor-exclude` is read, rows, key cells or filters. The steps of a run weigh at most 16 KB. On a WebAssembly
client the hub asks the client to run the recipe (`RecipeRequested`, with a run id of the server's, answered once),
and the client answers with the new `POST /mentor/recipe-result` of **Novior.MentorAgent.Server**, owner-checked
like `/mentor/cancel`, with done, the step and the reason only; **Novior.MentorAgent.Blazor** sends the path of the
page shown, without its query or fragment, with the page context. New rules in ACTION-RULES.md:
`recipe.shape`, `recipe.offer`, `recipe.gated`, `recipe.run`, `recipe.row`, `recipe.row-excluded`,
`recipe.element-missing`, `recipe.from-source`, `recipe.precedence`, `recipe.session`, `recipe.rejected-with-reason`, `recipe.governed`,
`recipe.hub`, `recipe.hub-result`.
- **Recipes in React, Angular and other front ends**: **Novior.MentorAgent.Server** serves `/mentor/agent.js`, a
JavaScript module with the recipes' runner that a front end that is not Blazor loads with `<script type="module">`
and ties to its own `@microsoft/signalr` connection with `attach(connection, options)`: the recipes the hub asks for
run in the page, the answer goes back with `POST /mentor/recipe-result`, and the front end's routes reach the server,
from `options.routes` (`/orders/:id`) or from the links of the page. A field is written so that React's controlled
fields keep the value in their state and Angular's forms read it, and is then left (`blur`), as `updateOn: 'blur'`
needs. The script has the hub's CORS, never its authorization, and is cached for a year at the address with the
package's version (`?v=`). React and Angular do not observe the pages yet. New rules in ACTION-RULES.md:
`recipe.front-end`, `recipe.front-end-cors`, `page.front-end-routes`. README of Novior.MentorAgent.Server: «Recipes
in React, Angular and other front ends».
- **Angular's own routes for `/mentor/agent.js`**: `attach`'s `routes` also takes the router's configuration, Angular's
`Routes` or React Router's route objects, with their `children`; a redirect is not a page, and a class component is
named by its route. A recipe is tested on an Angular 22 reactive form, built ahead of time and zoneless: the values
stay in the form, `updateOn: 'blur'` included, and the Send it enables is clicked.
- **The scan of a React or Angular front end**: in the .NET backend, **Novior.MentorAgent.Scanner** reads the pages of
a front end it does not serve, at the new `MentorUiScannerOptions.FrontEndUrl` (the development server of Vite or of
the Angular CLI): the routes of the new `FrontEndRoutes` (`/orders/:id`, with the values of `RouteParameters`), or the
pages its links reach from its first page. With no user, each page at every scan. New rule in ACTION-RULES.md:
`page.scan-front-end`.
- **Novior.MentorAgent.Abstractions:** `IMentorAssistantStatus`, for an application that turns its assistant off from
somewhere else, a switch of its own or a console. While its `IsOn` is false, the chat widget disables the input and
the send button, offers no suggestion to send, shows *off* in its header where it shows *online*, and says, right
above the input and before anyone writes, that the assistant was turned off by the administrator, in the ten
languages of the widget. `Changed` may come on a
background thread. Without a service registered nothing changes. README: «Showing that the assistant is off».
- **Novior.MentorAgent.Server, Novior.MentorAgent.Blazor:** the assistant turned off reaches the hub's clients. The hub
method `GetAssistantStatus` answers whether it is on, and the event `AssistantStatus(bool)` goes to every connection
when it is turned off or on, only with an `IMentorAssistantStatus` registered in the server. The WebAssembly widget
reads it when it connects and follows each change, as the widget in the server does; its client now opens the hub
connection when the widget is created, not at the first message, and sends no message while the assistant is off.
Two openings at once now make one connection: the second waits for the first. `/mentor/agent.js` gives a
React or Angular page `assistantIsOn()` and `onAssistantStatus(callback)`.
- **Novior.MentorAgent.Abstractions:** the cost per agent and per user. `IMentorActionObserver.OnModelCallAsync`
receives a `MentorModelCall` for each call to a model: its tokens (cached and reasoning ones included, when the
provider says so), the model, how it ended, the agent that made it, and the session, the turn, the user and the
tenant, never the text. Each agent has its calls: the coordinator, the router of the handoff (`MentorAgentKind.Router`,
new), the specialists, the team members and the agents of an `IMentorAgentSource`. MentorAgent's own calls come
too, with no agent and what they were for (`MentorModelCallPurpose`): the input, output and scope checks, the
request and announced-action checks, the refusal and grounding checks, the memory's extraction, the routing
classifier and the warm-up, the one call outside any session. It has a default that does nothing, so an existing
observer is unchanged and is not called for them. The calls come on a queue of their own: a full one drops calls,
never a decision, and the order between a call and a decision is not kept. README: «The calls to the models».
- **A page's form as a UI action** (**Novior.MentorAgent.Abstractions**): `IMentorPageContext.RegisterForm<TModel>(name,
description, js, configure)` registers the form whose model is `TModel` as one UI action, `fill_<name>`, whose
parameter is the fields to fill. The fields are the model's simple properties with a setter, found in the page by
their `data-mentor-id` (`"<name>.<field>"`), or by a selector of the application's (`MentorFormOptions`); each value
is checked against its field's type, and the fields are written in the browser with the recipes' runner, through the
page's `IJSRuntime`, on Blazor Server, WebAssembly and MAUI Hybrid. The action fills and never submits the form:
sending it stays an action of the application's, with its confirmation if it writes. It goes through the gate as any
UI action. Sensitive fields (passwords, secrets, tokens, PINs, cards, IBANs, one-time codes) are never offered unless
the application lets them in (`IncludeSensitive`), and the runner never writes a password field, for a form or a
recipe, unless its field was let in. New rules in ACTION-RULES.md: `form.fill`, `form.sensitive`.
- **A page's grid as UI actions** (**Novior.MentorAgent.Abstractions**): `IMentorPageContext.RegisterGrid<TRow>(name,
description, js, key, configure)` registers a table of rows, written by hand or a `QuickGrid`, as
`open_<name>_row({ key })`, `sort_<name>({ column, descending? })` and `filter_<name>(text)`, each offered only when
the grid can do it (`MentorGridOptions`: `Filter`, `Sortable`). The parts are found by their `data-mentor-id`, or by
selectors of the application's, which a `QuickGrid` needs. A row is found by its key, after the grid's filter or
scrolling, and opened; a sort clicks the header until its `aria-sort` reads the order asked. Nothing of the rows
goes back to the model. A sensitive column is not sorted by unless the application lets it in, and is never the
key. The steps run with the recipes' runner through the page's `IJSRuntime`, and the actions go through the gate as
any UI action. New rules in ACTION-RULES.md: `grid.open`, `grid.filter`, `grid.sort`, `grid.sensitive`.
- **Novior.MentorAgent.Abstractions:** `MentorActionRequest` and `MentorActionDecision` say who provides the tool, with `Provenance`
(`MentorActionProvenance`: `Application`, `McpServer`, `Library`) and `ProvenanceName`, the MCP server's `Name`. A
policy can be stricter with the tools of an MCP server the application consumes. `Unknown`, the default of a
request built by hand, is never what MentorAgent sends: treat it as not trusted. New rule in ACTION-RULES.md:
`policy.provenance`.
### Changed
- **The widget meets WCAG 2.1 A and AA in what we tested**: axe-core finds no violation in any state and theme, the
keyboard and the focus are checked against EN 301 549, and it was used with Narrator on Windows; `ACCESSIBILITY.md`
says what was tested and what was not (**Novior.MentorAgent.Abstractions**):
- the panel is nearly opaque by default, `--bm-bg-panel: rgba(10,14,26,.96)`, so that the contrast of its text no
longer depends on the page behind it; it was glass at 55%, which that variable brings back, the contrast then
being the page's to keep. `MentorTheme.Dark` is at 96% too;
- `--bm-text-muted` is lighter (`#7d8bb3`; `#5b6b82` in `Minimal`), and the primary button white on the darker accent,
4.5:1 or more on every surface. `Minimal` sets a darker `--bm-accent-bright` (`#1d4ed8`) and the new
`--bm-status-online` (`#047857`): its status, links and connecting pills were pale blue and green on white;
- the conversation is a log a screen reader announces (`role="log"`, `aria-live`), busy while a reply streams so
that it is read once whole, and the keyboard reaches it;
- Esc closes the tour, the image URL's field or a detail first, then the panel, and never answers a confirmation:
the banner is there again when the panel opens; opened by the user, the focus is in the field, and closed, back
on the button;
- the launcher says whether the panel is open (`aria-expanded`); a confirmation is an alert dialog that takes the
focus itself, never on its Confirm button, whose name says the action, also when the panel opens again with it
waiting; after a reply, or a confirmation answered, the focus is back in the field; the tour takes the focus when
it opens; the message field has a name of its own, not only a placeholder; the image button is reached with the
keyboard; the widget says its language (`lang`), also on a page in another;
- a visitor who asks for less motion (`prefers-reduced-motion`) gets none.
- **Behavior change — Novior.MentorAgent.Declarative:** a declarative agent whose file lists a tool the Agent
Framework's factory did not make is no longer loaded without it (BUG-244). Up to 1.4.0 an entry of `tools` without
`kind`, in a list at its key's indentation, was dropped without a word and the agent started without the tool; from
1.5.0 that agent is not loaded, `invalid-definition`, and the reason names the entry, its number and its name, and
says it has no `kind`. What to do: write `kind: function` in every entry of `tools`.
- **Behavior change — Novior.MentorAgent:** with `EnableObservability`, the model calls of the agents under the
coordinator — the router of the handoff, the specialists, the team members, the agents of an `IMentorAgentSource` —
have their own spans, as the coordinator's do. A delegated turn or a team emits more spans than before, and the
GenAI token metrics (`gen_ai.client.token.usage`) now count those calls, which they missed: a threshold or a chart
on them sees a jump. Each call is counted once, and the dashboard's totals do not change. The span of each call
carries `gen_ai.agent.name`, `mentoragent.agent.kind` and `mentoragent.model.purpose`, never the user.
- **Behavior change — Novior.MentorAgent:** with `EnableObservability`, MentorAgent's own calls around a reply — the
checks on `ClassifierChatClient`, the routing classifier, the warm-up — have their spans too, each with its
`mentoragent.model.purpose`, so a turn emits more spans than before. A client the host already traces (one with
`UseOpenTelemetry()` in its chain, as the README told hosts to do) is not traced again: its span stays the host's,
one for each call, and nothing needs to change on the host's side.
- **Behavior change — Novior.MentorAgent:** with `WarmUpChatModel`, the warm-up request is counted on the dashboard
under its model, in no session: one request per client more on each start, which the provider bills.
- The family moves onto the Microsoft Agent Framework 1.28.0 line (`Microsoft.Agents.AI` and
`Microsoft.Agents.AI.Workflows` 1.28.0). **Novior.MentorAgent.Declarative:** `Microsoft.Agents.AI.Declarative` moves
to 1.28.0-rc1, on the same line. The breaking changes of Agent Framework 1.28 are in parts MentorAgent does not
use: its own A2A hosting and `A2AAgent` (MentorAgent uses the A2A SDK directly), the HTTP and MCP handlers and the
Foundry provider of its declarative workflows, CodeAct and GitHub Copilot. One is visible to a host that collects
Agent Framework's telemetry: its workflow spans are renamed.
- The family moves onto Microsoft.Extensions.AI 11.0.0 (`Novior.MentorAgent.Abstractions` and `Novior.MentorAgent`).
It declares no breaking change to the AI API, but it requires the 11.0.0 packages of
`Microsoft.Extensions.DependencyInjection.Abstractions`, `Microsoft.Extensions.Logging.Abstractions`,
`Microsoft.Extensions.Caching.Abstractions`, `Microsoft.Extensions.Primitives`, `System.Diagnostics.DiagnosticSource`
and `System.Numerics.Tensors`, so a .NET 10 application that uses MentorAgent now gets those at 11.0.0, above the
ones of the shared framework. Agent Framework 1.28, built on Microsoft.Extensions.AI 10.11, runs on 11.0.0.
`Microsoft.Extensions.AI.OpenAI` 11.0.0 requires `OpenAI` 2.14.0 or later.
The README's hold for Azure OpenAI with the Responses API (`Microsoft.Extensions.AI.OpenAI` `[10.6.0]`, which keeps
`OpenAI` at 2.10) still works on 11.0.0: verified with turns on the Responses API, with and without a tool.
- The A2A SDK moves to 1.0.0-preview4: `A2A` in Novior.MentorAgent and `A2A.AspNetCore` in
**Novior.MentorAgent.Server**. MentorAgent's own API does not change, and its A2A agent and client behave as before.
- **Breaking — Novior.MentorAgent, .Server:** an application that implements the A2A SDK's `IA2ARequestHandler`
itself, or calls the handler's methods of `A2AServer` directly, no longer compiles: with this version it gets
A2A 1.0.0-preview4, where each of the eleven operations takes an `A2ARequestContext?` before the cancellation
token. Add the argument, and hand it on to an inner handler as it came (null when the request negotiated no
extension). `IAgentHandler` and `IA2AClient` do not change.
### Fixed
- **BUG-265 (S3, present from 1.3.0):** over A2A, a turn that got the second request of `CheckAnnouncedActions`
returned its two replies joined in one text. The caller now gets the second reply alone, or the first when the second
fails or writes nothing (**Novior.MentorAgent**).
- **BUG-263 (S3, present from 1.0.0):** in the onboarding tour, a screen reader said nothing of the step Next or Back
moved to, as the focus stays on the button. The tour now announces the new step, its number, title and text; back
to the first step, the focus goes to Next (**Novior.MentorAgent.Abstractions**).
- **BUG-262 (S3, present from 1.0.0):** Tab could leave the onboarding tour, a modal dialog, for controls of the panel
a screen reader no longer showed. While the tour is open the rest of the panel is now inert, and Tab and Shift+Tab
go round the tour's buttons (**Novior.MentorAgent.Abstractions**).
- **BUG-261 (S3, present from 1.0.0):** on a page rendered without a prerender, the widget's voice output and its
`PrimaryColor` could stay off for the whole visit: the widget asked its script for them before the browser had run
it, and said nothing. The widget now waits for its script, for 10 seconds at most, and then logs a Warning that says
what to check (**Novior.MentorAgent.Abstractions**).
- **BUG-260 (S3, present from 1.0.0):** with `EnableVoiceOutput`, the widget's voice started on at every visit, also
for a visitor who had turned it off: someone with a screen reader, which reads the reply too, heard both at once
and had to turn it off each time. The visitor's choice is now remembered in their browser; with none, the voice
starts on as before (**Novior.MentorAgent.Abstractions**).
- **BUG-257 (S3, present from 1.0.0):** a screen reader read the widget's decorative images and icons: the
assistant's avatar, named beside the name written on the launcher, in the header, in the welcome and before every
reply; the welcome suggestions' emoji; icons not hidden from it. The avatars now have an empty `alt`, every icon is
`aria-hidden`, a suggestion is named by its words and sends them without its icon, and each message in the
conversation starts with who speaks, in the widget's language, for a screen reader only. The close buttons of the
MCP and A2A details are named in the widget's language; they said "Chiudi" in every one
(**Novior.MentorAgent.Abstractions**).
- **BUG-254 (S4, present from 1.0.0):** a request to `/mentor/approve`, `/mentor/cancel` or `/mentor/session` that met
the close of its connection could answer 500 instead of 404; nothing ran. The request now keeps the connection's
scope for the work it does, and once the connection is closing the answer is a 404.
- **BUG-253 (S3, present from 1.0.0):** on a screen narrower than 480 px the widget's panel kept its place and its
height cap instead of taking the whole screen, as the rule of its position won. The panel now takes the whole screen
there, and the launcher is hidden while it is open.
- **The closed panel's controls could be reached with Tab and were read by a screen reader**, invisible (present from
1.0.0). The closed panel is now `inert`.
- **BUG-251 (S2, present from 1.0.0):** with `RequireActionForChangeRequests` on and semantic tool filtering, a request
for what one of the page's own actions does could be taken for a complete request for one of the application's
confirmation-gated actions, and the first call of the turn was then required to be that action: the user was asked
to confirm an action they had not asked for. The request classifier is now shown the page's actions with the actions
too, and a request for one of them is not forced; a complete request for one of the actions still is, page or not.
- **BUG-250 (S3, present from 1.2.0):** the A2A agent card listed an action an action policy turns off for every
caller: it was built once, at startup, without asking the policies. **Novior.MentorAgent.Abstractions:** a new stage,
`MentorActionStage.Card`: the card asks `IsAllowedAsync` with nobody and leaves out what a policy does not allow; a
policy answers no there only for an action off for every caller. The card is built again when it is older than 30
seconds, so a rule changed at run time reaches it. New rule in ACTION-RULES.md: `policy.card`.
- **BUG-248 (S3, present from 1.2.0):** a call an action policy did not allow was refused with the words of a refusal of
the user's own ("you are not allowed to use this action"), where the application has a rule. It now says that a rule
of the application does not offer the action here, in the application's language; a `Stop` keeps its reason.
- **BUG-249 (S4, present from 1.2.0):** on the MCP server, the refusal of a call a policy wanted confirmed, which nobody
can confirm there, was in English. It now follows the application's language, as the other refusals of a policy.
- **BUG-247 (S2, present from 1.0.0):** with `RequireLookupForRecordQuestions` on, a request for what one of the
page's own actions does (a UI action or a recipe) could be taken for a question about the records, and the first
call of the turn was then required to be one of the application's reads, which the page's actions cannot satisfy:
the reply missed what was asked. The request classifier is now shown the page's actions offered on the turn, and a
request for one of them is not forced; a question about a value the records hold still is, page or not. Without page
actions nothing changes.
- **BUG-238 (S3, present from 1.3.0):** `CheckAnnouncedActions` did nothing with `UseServiceManagedHistory`, which the
Responses client requires: a reply that announced an action, or reported one as done, when no tool ran was not
checked. The second request is now sent from the response the turn started from, with the user's message again and
the instruction in its instructions, so nothing of the check is stored; the conversation goes on from its answer,
and the first reply stays on the service, on a branch nobody follows. Only a turn of one request is checked there.
The Warning at startup now says the check is not made only with an `IMentorSessionManager` of the application.
- **BUG-245 (S3, present from 1.3.0):** with routing on, the second request of the announced-action check was routed
again, on MentorAgent's instruction instead of the user's message, and could go to the other model in the middle of
the turn. It is now served by the turn's model.
- **BUG-244 (S3, present from 1.0.0):** a declarative agent whose `tools` list, at its key's indentation, had an entry
without `kind` loaded without that tool, and nothing said so; an entry with `kind` after `name` was refused. The
definition is now given to the Agent Framework's factory again rewritten, `kind` first, and an agent the factory
still makes with fewer tools than its file lists is not loaded: `invalid-definition`, with the reason.
- **BUG-243 (S3, present from 1.0.0):** a declarative agent (`Novior.MentorAgent.Declarative`) written in valid YAML the
Agent Framework's reader refuses was not loaded, `invalid-definition`, with an error naming the end of the file: a
list at its key's indentation (the form YamlDotNet writes by default), an explicit end of the document (`...`), or a
folded scalar (`>`). A definition the reader refuses is now given to it again rewritten, lists indented, no end
marker, folded scalars literal with the same value; one it takes is never rewritten, and the error of one that fails
both ways is the one of the text as written.
- **BUG-242 (S4, present from 1.0.0):** the parameter hint a typed UI action generates told the model to send a
`DateOnly`, a `TimeOnly`, a `TimeSpan` or a `Uri` as an object of its properties, which the handler could not read,
and named `uint`, `ulong`, `ushort`, `sbyte` and `char` by their .NET names. Each is now described by the text or the
number JSON writes it as: `string (ISO 8601 date)`, `string (time, HH:mm:ss)`, `string (duration, d.hh:mm:ss)`,
`string (URI)`, `integer`, `string (one character)`.
- **BUG-241 (S3, present from 1.4.0):** a UI action of the page whose handler threw, or `invoke_ui_action` on Path B,
reached the `IMentorActionObserver`s as `Executed`, while the model was told it had failed. It is now `Failed`, with
the type of the handler's exception, and the model gets the message of `OnException` when the application set it,
as for any other action.
With `OnException` set, the model now gets the application's message for a UI action too, where it got the
exception's.
- **BUG-240 (S3, present from 1.0.0):** with `RoutingStrategy` `Classifier` or `Cascade`, the routing classifier's
call — one a turn: a turn streams, so `Cascade` asks the same question before the answer — was billed by the
provider and counted nowhere: not on the dashboard, not in `MentorTokenUsage`, not on the session's counter, while
the README said so. It is now counted, under the classifier's model, once, and with `EnableObservability` it has its
span.
- **BUG-235:** a call of the model of a specialist, a team member or an agent of an `IMentorAgentSource` to an action
of the application its agent does not hold (one an `IMentorActionGovernor` or `EnabledByDefault = false` left out,
or another agent's) ran nothing, but had no decision, so an audit of the actions did not see it. It now has one,
`Denied`, `not-offered`, with the agent's `AgentKind` and `AgentName`, as the coordinator's has. Nothing more starts.
New rule in ACTION-RULES.md: `agent.not-offered-call`.
- The scan of the pages (Novior.MentorAgent.Scanner, new in this release) read the label of a field from a `<label>`
that holds the field with all its text: a select's options, or what a text area held, went into the label in the
manifest. A label is now read without the fields it holds, in the scan and in the observation.
### Known issues
- **Novior.MentorAgent:** BUG-264 (S3, present from 1.4.0). With `RequireLookupForRecordQuestions`, when
`CheckAnnouncedActions` takes the reply to a record question for a reported action, its second request is required
again to call a read, with only the reads among its tools; the README says that request keeps the tool mode it had.
The reply the user gets is right, as the second request reads again. It is fixed in a later version, together with
the check's judgement of a reply that only states what a read returned.
The full history is in CHANGELOG.md, inside this package.