Fix reasoning timeline UI and type errors

This commit is contained in:
Mohamed Boudra
2025-11-23 14:12:53 +01:00
parent 95bacf8fc7
commit 47a99f5668
23 changed files with 2569 additions and 1237 deletions
@@ -216,6 +216,7 @@ class ClaudeAgentSession implements AgentSession {
private turnCancelRequested = false;
private streamedAssistantTextThisTurn = false;
private streamedReasoningThisTurn = false;
private cancelCurrentTurn: (() => void) | null = null;
constructor(
config: ClaudeAgentConfig,
@@ -282,6 +283,7 @@ class ClaudeAgentSession implements AgentSession {
void this.interruptActiveTurn();
queue.end();
};
this.cancelCurrentTurn = requestCancel;
if (this.historyPending && this.persistedHistory.length > 0) {
for (const item of this.persistedHistory) {
queue.push({ type: "timeline", item, provider: "claude" });
@@ -306,9 +308,16 @@ class ClaudeAgentSession implements AgentSession {
if (this.eventQueue === queue) {
this.eventQueue = null;
}
if (this.cancelCurrentTurn === requestCancel) {
this.cancelCurrentTurn = null;
}
}
}
async interrupt(): Promise<void> {
this.cancelCurrentTurn?.();
}
async *streamHistory(): AsyncGenerator<AgentStreamEvent> {
if (!this.historyPending || this.persistedHistory.length === 0) {
return;