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

Method beginIteration

packages/ai/src/activities/chat/index.ts:971–988  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

969 }
970
971 private async beginIteration(): Promise<void> {
972 this.currentMessageId = this.createId('msg')
973 this.accumulatedContent = ''
974 this.accumulatedThinking = []
975 this.currentThinkingContent = ''
976 this.currentThinkingSignature = ''
977 this.finishedEvent = null
978
979 // Update mutable context fields
980 this.middlewareCtx.currentMessageId = this.currentMessageId
981 this.middlewareCtx.accumulatedContent = ''
982
983 // Notify middleware of new iteration (devtools emits assistant message:created here)
984 await this.middlewareRunner.runOnIteration(this.middlewareCtx, {
985 iteration: this.iterationCount,
986 messageId: this.currentMessageId,
987 })
988 }
989
990 private async *streamModelResponse(): AsyncGenerator<StreamChunk> {
991 const { metadata, modelOptions } = this.params

Callers 1

beginCycleMethod · 0.95

Calls 2

createIdMethod · 0.95
runOnIterationMethod · 0.80

Tested by

no test coverage detected