Class ChatRenderer
Renders chat messages, tool outputs, and status to the terminal using Spectre.Console markup.
public static class ChatRenderer
- Inheritance
-
ChatRenderer
- Inherited Members
Properties
CurrentOutputStyle
public static OutputStyle CurrentOutputStyle { get; }
Property Value
CurrentTheme
public static TuiTheme CurrentTheme { get; }
Property Value
Methods
ApplyTheme(TuiTheme)
Apply a named terminal theme for future output.
public static void ApplyTheme(TuiTheme theme)
Parameters
themeTuiTheme
BeginStreaming()
Begin an assistant streaming block (response content).
public static void BeginStreaming()
BeginThinking()
Begin a thinking/reasoning block (dim gray output).
public static void BeginThinking()
Confirm(string)
Ask the user for confirmation.
[ExcludeFromCodeCoverage]
public static bool Confirm(string message)
Parameters
messagestring
Returns
ConfirmWorkflow(string)
Workflow confirmation prompt. Defaults to No (Enter/N/Escape = decline).
public static bool ConfirmWorkflow(string message)
Parameters
messagestring
Returns
DimInputLine(string)
Dim the already-visible user input line in-place. Moves the cursor up to the prompt line, rewrites it in dim, then returns to the next line for output.
[ExcludeFromCodeCoverage]
public static void DimInputLine(string text)
Parameters
textstring
EndStreaming()
End the streaming block. Safe to call multiple times — subsequent calls are no-ops once the state has already been reset.
public static void EndStreaming()
EndThinking()
End a thinking/reasoning block.
public static void EndThinking()
PauseStreaming()
Pause the streaming indicator so it doesn't overwrite interactive prompts. Text continues to buffer but no indicator line is written until ResumeStreaming().
public static void PauseStreaming()
ReadInput(InteractiveInput?)
Prompt for user input with interactive completions.
[ExcludeFromCodeCoverage]
public static string? ReadInput(InteractiveInput? input = null)
Parameters
inputInteractiveInput
Returns
ReadInputStructured(InteractiveInput)
Prompt for user input, returning structured result with attachments.
[ExcludeFromCodeCoverage]
public static InputResult? ReadInputStructured(InteractiveInput input)
Parameters
inputInteractiveInput
Returns
RenderAssistantMessage(string)
Render an assistant text response.
public static void RenderAssistantMessage(string text)
Parameters
textstring
RenderBanner(string, string, int, IReadOnlyList<WelcomeIndicator>?, WelcomeBannerDetails?, WelcomePanelSettings?)
Render the startup banner with detected providers.
public static void RenderBanner(string modelName, string providerName, int totalModels, IReadOnlyList<WelcomeIndicator>? indicators = null, WelcomeBannerDetails? details = null, WelcomePanelSettings? welcomeSettings = null)
Parameters
modelNamestringproviderNamestringtotalModelsintindicatorsIReadOnlyList<WelcomeIndicator>detailsWelcomeBannerDetailswelcomeSettingsWelcomePanelSettings
RenderError(string)
Render an error message.
public static void RenderError(string text)
Parameters
textstring
RenderInfo(string)
Render a system/info message.
public static void RenderInfo(string text)
Parameters
textstring
RenderModeBar(PermissionMode)
Render a mode indicator bar above the input prompt.
public static void RenderModeBar(PermissionMode mode)
Parameters
modePermissionMode
RenderStatusBar(string, string, long)
Render the status bar line.
public static void RenderStatusBar(string provider, string model, long tokens)
Parameters
RenderSystemPromptWarning(int, int, int, int)
Render a system prompt size warning below the welcome banner.
public static void RenderSystemPromptWarning(int actualTokens, int budgetTokens, int budgetPercent, int contextWindow)
Parameters
RenderToolCall(string, string?, string)
Render a tool invocation and its result.
public static void RenderToolCall(string toolName, string? args, string result)
Parameters
RenderTurnMetrics(long, int, long, SpinnerStyle, long?, string?)
Render a turn completion metrics line, styled per style.
public static void RenderTurnMetrics(long elapsedMs, int tokens, long bytes, SpinnerStyle style = SpinnerStyle.Normal, long? ttftMs = null, string? model = null)
Parameters
RenderUserMessage(string)
Render a user message.
public static void RenderUserMessage(string text)
Parameters
textstring
RenderWarning(string)
Render a warning message.
public static void RenderWarning(string text)
Parameters
textstring
ResumeStreaming()
Resume the streaming indicator after a pause, rendering any text buffered during the pause.
public static void ResumeStreaming()
SetOutputStyle(OutputStyle)
Set assistant output rendering style.
public static void SetOutputStyle(OutputStyle style)
Parameters
styleOutputStyle
WriteStreamingChunk(string)
Write a streaming text chunk (raw, inline).
public static void WriteStreamingChunk(string text)
Parameters
textstring
WriteThinkingChunk(string)
Write a thinking/reasoning chunk as dim gray text.
public static void WriteThinkingChunk(string text)
Parameters
textstring