* Get current processor state (aggregated across all messages)
()
| 2146 | * Get current processor state (aggregated across all messages) |
| 2147 | */ |
| 2148 | getState(): ProcessorState { |
| 2149 | let content = '' |
| 2150 | let thinking = '' |
| 2151 | const toolCalls = new Map<string, InternalToolCallState>() |
| 2152 | const toolCallOrder: Array<string> = [] |
| 2153 | |
| 2154 | for (const state of this.messageStates.values()) { |
| 2155 | content += state.totalTextContent |
| 2156 | for (const stepId of state.thinkingStepOrder) { |
| 2157 | thinking += state.thinkingSteps.get(stepId) ?? '' |
| 2158 | } |
| 2159 | for (const [id, tc] of state.toolCalls) { |
| 2160 | toolCalls.set(id, tc) |
| 2161 | } |
| 2162 | toolCallOrder.push(...state.toolCallOrder) |
| 2163 | } |
| 2164 | |
| 2165 | return { |
| 2166 | content, |
| 2167 | thinking, |
| 2168 | toolCalls, |
| 2169 | toolCallOrder, |
| 2170 | finishReason: this.finishReason, |
| 2171 | done: this.isDone, |
| 2172 | } |
| 2173 | } |
| 2174 | |
| 2175 | /** |
| 2176 | * Start recording chunks |
no test coverage detected