InteractionStatistics

References
public sealed class InteractionStatistics
Tracks what the AI conversation loop has been doing on a given AiComponent: the current phase plus running counters for each kind of event (model calls, docs lookups, clarifications, compilation attempts, various failure modes). Also owns the lifecycle handle for the current run -- the SolutionId identifying it and the CancellationToken that aborts it. The component's attributes class draws from this state. Every property setter fires Changed on a real change. The owning component subscribes once and invalidates the canvas on Changed, so the drawing refreshes automatically as the loop progresses.

Properties

Clarifications

#
Times a clarification dialog has been shown to the user.
public int Clarifications { get; set; }

CompilationAttempts

#
Times the model has submitted source via the Compilation tool.
public int CompilationAttempts { get; set; }

CompileFailures

#
Submissions where Roslyn reported one or more compile errors.
public int CompileFailures { get; set; }

ConstructorFailures

#
Submissions where the Logic subclass's parameterless constructor threw.
public int ConstructorFailures { get; set; }

ExampleLookups

#
Times the model has called the Explanation (example-fetch) tool.
public int ExampleLookups { get; set; }

IsBusy

#
True when the conversation loop is mid-flight: the model is being called, a tool result is being computed, a clarification dialog is open, or Roslyn is compiling. False when idle or terminal.
public bool IsBusy { get; }

ModelCalls

#
Total number of HTTP requests made to the LLM provider for this component.
public int ModelCalls { get; set; }

PlainTextRetries

#
Turns where the model returned prose instead of calling a tool.
public int PlainTextRetries { get; set; }

RunId

#
Identifier of the run currently owning this object, or SolutionId.None if no run is active.
public SolutionId RunId { get; }

ShapeFailures

#
Submissions that compiled but didn't expose exactly one concrete AiComponentLogic subclass.
public int ShapeFailures { get; set; }

State

#
public InteractionState State { get; set; }

SymbolLookups

#
Times the model has called the Description (symbol-lookup) tool.
public int SymbolLookups { get; set; }

UnknownToolRetries

#
Turns where the model called a tool we don't recognise.
public int UnknownToolRetries { get; set; }

Methods

BeginRun

#
Start a new run: cancel any prior in-flight run, allocate a fresh SolutionId and CancellationTokenSource, reset State to InteractionState.Idle, and return the token to thread through any awaitable work.
public CancellationToken BeginRun(
id
)

CancelCurrentRun

#
Cancel the in-flight run (if any): trip the token, mark the id as cancelled in the global registry, dispose the source, and move State to InteractionState.AbortedByUser so the busy icon clears. Safe to call when no run is active -- a no-op in that case.
public void CancelCurrentRun()

EndRun

#
Tear down the CTS at the end of a normal run. Only acts when the supplied id still matches RunId; if a newer run has already replaced it, this is a no-op (the newer run owns the source).
public void EndRun()

Events

Changed

#
Raised whenever any property changes.
public event EventHandler Changed