()
| 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 |
no test coverage detected