MentorAgent Docs
Menu

Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.

ReferencePackage: Novior.MentorAgent.Abstractions

IMentorOrchestrator interface

The IMentorOrchestrator interface of Novior.MentorAgent.Abstractions.Interfaces: Public contract for the MentorAgent orchestrator. Implemented by…

On this page

Public contract for the MentorAgent orchestrator. Implemented by MentorOrchestrator (Blazor Server) and WasmMentorOrchestrator (Blazor WASM via SignalR). Injected into ChatWidget — the component works identically in both contexts.

Namespace: Novior.MentorAgent.Abstractions.Interfaces. Package: Novior.MentorAgent.Abstractions.

public interface IMentorOrchestrator

Terminal
dotnet add package Novior.MentorAgent.Abstractions

void CancelCurrentRequest()

Cancels the current AI request.

Task ResetSessionAsync(CancellationToken ct = default)

Resets the conversation session.

Task RespondToApprovalAsync(ConfirmationRequest req, bool approved, CancellationToken ct = default)

Responds to a pending HITL confirmation dialog.

Task RestoreSessionAsync(JsonElement snapshot, CancellationToken ct = default)

Restores a conversation from a snapshot produced by IMentorOrchestrator.SerializeSessionAsync.

Throws ArgumentException if the snapshot is not one of ours or was written by an incompatible version, leaving the current conversation untouched. That is deliberate: the Agent Framework's own deserializer accepts unrelated JSON and returns an empty session, so without this check a stale localStorage entry would silently replace the conversation the user is having.

Task SendMessageAsync(string userMessage, CancellationToken ct = default)

Sends a user message and starts the AI response.

Task SendMessageAsync(MentorUserMessage message, CancellationToken ct = default)

Sends a user turn: its text, its images and its MentorUserMessage.Language. The turn is answered in that language, and the texts the server writes for it are in that language too. An implementation written before this method existed gets the call above, and ignores the language.

Task SendMessageAsync(string userMessage, IReadOnlyList<MentorAttachment>? attachments, CancellationToken ct = default)

Sends a user message with optional image attachments (roadmap #13) and starts the AI response. Attachments are ignored unless MentorOptions.EnableImageInput is set and the chat model is vision-capable. Passing null/empty is equivalent to the text-only overload.

Task<JsonElement?> SerializeSessionAsync(CancellationToken ct = default)

Saves the current conversation as a snapshot. The snapshot is the conversation in clear: keep it on the server, or protected (e.g. ProtectedLocalStorage) — never as text a user can read or edit, because a restored snapshot is history the model trusts. Novior.MentorAgent.Server's /mentor/session hands clients a protected, user-bound form instead. Returns null when there is no conversation yet — which a caller must tell apart from a snapshot, or it will overwrite a good stored one with nothing.

This lives here rather than on IMentorSessionManager because every method there takes the coordinator AIAgent as its first argument, and the coordinator is deliberately not handed out to application code — running it directly would bypass the guardrails, the rate limiter and both gates. The orchestrator already owns it, and already carries the third session operation (IMentorOrchestrator.ResetSessionAsync).