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

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

CompilationAttempts

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

CompileFailures

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

ConstructorFailures

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

ExampleLookups

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

IsBusy

#
public bool IsBusy { get; }
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.

ModelCalls

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

PlainTextRetries

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

RunId

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

ShapeFailures

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

State

#
public InteractionState State { get; set; }

SymbolLookups

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

UnknownToolRetries

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

Methods

BeginRun

#
public CancellationToken BeginRun(out SolutionId id)
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.
id (out SolutionId)

CancelCurrentRun

#
public void 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.

EndRun

#
public void EndRun(SolutionId id)
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).
id (SolutionId)

Events

Changed

#
public event EventHandler Changed
Raised whenever any property changes.