MCPcopy Create free account
hub / github.com/TanStack/ai / getState

Method getState

packages/ai/src/activities/chat/stream/processor.ts:2148–2173  ·  view source on GitHub ↗

* Get current processor state (aggregated across all messages)

()

Source from the content-addressed store, hash-verified

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

Callers 3

TestPanelFunction · 0.95
streamResponseMethod · 0.80

Calls 4

valuesMethod · 0.80
getMethod · 0.65
setMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected