refactor: apply Single Responsibility Principle to Program.cs and ReplLoop.cs
extracted responsibilities from Program.cs (208→46 lines) and ReplLoop.cs (274→174 lines) into focused service classes: HeaderRenderer, SessionManager, ApplicationStartup, ResponseStreamer, SpinnerService, UsageDisplayer, and ContextCompactionService. Each class now has a single, well-defined responsibility, improving testability and maintainability.
This commit is contained in:
@@ -5,12 +5,22 @@ namespace AnchorCli.OpenRouter;
|
||||
/// </summary>
|
||||
internal sealed class TokenTracker
|
||||
{
|
||||
private readonly ChatSession _session;
|
||||
private ChatSession _session;
|
||||
|
||||
public TokenTracker(ChatSession session)
|
||||
{
|
||||
_session = session;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the session. Allows setting the session after construction
|
||||
/// to support dependency injection patterns.
|
||||
/// </summary>
|
||||
public ChatSession Session
|
||||
{
|
||||
get => _session;
|
||||
set => _session = value;
|
||||
}
|
||||
|
||||
public string Provider { get; set; } = "Unknown";
|
||||
public long SessionInputTokens => _session.SessionInputTokens;
|
||||
|
||||
Reference in New Issue
Block a user