* Check if we should continue the flow and do so if needed
()
| 1324 | * Check if we should continue the flow and do so if needed |
| 1325 | */ |
| 1326 | private async checkForContinuation(): Promise<void> { |
| 1327 | // Prevent duplicate continuation attempts |
| 1328 | if (this.continuationPending || this.isLoading) { |
| 1329 | this.continuationSkipped = true |
| 1330 | return |
| 1331 | } |
| 1332 | |
| 1333 | if (this.shouldAutoSend()) { |
| 1334 | this.continuationPending = true |
| 1335 | this.continuationSkipped = false |
| 1336 | let succeeded = false |
| 1337 | try { |
| 1338 | succeeded = await this.streamResponse() |
| 1339 | } finally { |
| 1340 | this.continuationPending = false |
| 1341 | } |
| 1342 | // If a queued check was skipped while continuationPending was true |
| 1343 | // (e.g. a chained approval responded to during the stream), re-evaluate |
| 1344 | // now that the flag is cleared. Only replay after a successful stream — |
| 1345 | // aborted or errored streams should not trigger further continuation. |
| 1346 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- mutated asynchronously during await |
| 1347 | if (this.continuationSkipped && succeeded) { |
| 1348 | this.continuationSkipped = false |
| 1349 | await this.checkForContinuation() |
| 1350 | } |
| 1351 | } |
| 1352 | } |
| 1353 | |
| 1354 | /** |
| 1355 | * Check if all tool calls are complete and we should auto-send. |
no test coverage detected