66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
import { Anthropic } from "@anthropic-ai/sdk"
|
|
import { AssistantMessageContent } from "@core/assistant-message"
|
|
import { ClineAskResponse } from "@shared/WebviewMessage"
|
|
|
|
export class TaskState {
|
|
// Streaming flags
|
|
isStreaming = false
|
|
isWaitingForFirstChunk = false
|
|
didCompleteReadingStream = false
|
|
|
|
// Content processing
|
|
currentStreamingContentIndex = 0
|
|
assistantMessageContent: AssistantMessageContent[] = []
|
|
userMessageContent: (Anthropic.TextBlockParam | Anthropic.ImageBlockParam)[] = []
|
|
userMessageContentReady = false
|
|
|
|
// Presentation locks
|
|
presentAssistantMessageLocked = false
|
|
presentAssistantMessageHasPendingUpdates = false
|
|
|
|
// Ask/Response handling
|
|
askResponse?: ClineAskResponse
|
|
askResponseText?: string
|
|
askResponseImages?: string[]
|
|
askResponseFiles?: string[]
|
|
lastMessageTs?: number
|
|
|
|
// Plan mode specific state
|
|
isAwaitingPlanResponse = false
|
|
didRespondToPlanAskBySwitchingMode = false
|
|
|
|
// Context and history
|
|
conversationHistoryDeletedRange?: [number, number]
|
|
|
|
// Tool execution flags
|
|
didRejectTool = false
|
|
didAlreadyUseTool = false
|
|
didEditFile: boolean = false
|
|
|
|
// Consecutive request tracking
|
|
consecutiveAutoApprovedRequestsCount: number = 0
|
|
|
|
// Error tracking
|
|
consecutiveMistakeCount: number = 0
|
|
didAutomaticallyRetryFailedApiRequest = false
|
|
checkpointTrackerErrorMessage?: string
|
|
|
|
// Task Initialization
|
|
isInitialized = false
|
|
|
|
// Focus Chain / Todo List Management
|
|
apiRequestCount: number = 0
|
|
apiRequestsSinceLastTodoUpdate: number = 0
|
|
currentFocusChainChecklist: string | null = null
|
|
todoListWasUpdatedByUser: boolean = false
|
|
|
|
// Task Abort / Cancellation
|
|
abort: boolean = false
|
|
didFinishAbortingStream = false
|
|
abandoned = false
|
|
|
|
// Auto-context summarization
|
|
currentlySummarizing: boolean = false
|
|
lastAutoCompactTriggerIndex?: number
|
|
}
|