(streamInfo: {
startTime?: number;
parts: Array<{ timestamp?: number; workflowRun?: { timestamp?: number } }>;
toolCompletionTimestamps: Map<string, number>;
})
| 648 | } |
| 649 | |
| 650 | private getStreamLastTimestamp(streamInfo: { |
| 651 | startTime?: number; |
| 652 | parts: Array<{ timestamp?: number; workflowRun?: { timestamp?: number } }>; |
| 653 | toolCompletionTimestamps: Map<string, number>; |
| 654 | }): number { |
| 655 | // Use a nonzero floor so live-mode replay never sends afterTimestamp=0 when a |
| 656 | // stream has started but no parts/completions are recorded yet. |
| 657 | let streamLastTimestamp = streamInfo.startTime ?? 1; |
| 658 | for (let index = streamInfo.parts.length - 1; index >= 0; index -= 1) { |
| 659 | const timestamp = streamInfo.parts[index]?.timestamp; |
| 660 | if (timestamp === undefined) { |
| 661 | continue; |
| 662 | } |
| 663 | streamLastTimestamp = timestamp; |
| 664 | break; |
| 665 | } |
| 666 | |
| 667 | for (const part of streamInfo.parts) { |
| 668 | const workflowRunTimestamp = part.workflowRun?.timestamp; |
| 669 | if (workflowRunTimestamp !== undefined && workflowRunTimestamp > streamLastTimestamp) { |
| 670 | streamLastTimestamp = workflowRunTimestamp; |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | for (const completionTimestamp of streamInfo.toolCompletionTimestamps.values()) { |
| 675 | if (completionTimestamp > streamLastTimestamp) { |
| 676 | streamLastTimestamp = completionTimestamp; |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | return streamLastTimestamp; |
| 681 | } |
| 682 | |
| 683 | private getCurrentStreamLifecycleSnapshot(): StreamLifecycleSnapshot { |
| 684 | if (this.turnPhase === TurnPhase.PREPARING) { |
no outgoing calls
no test coverage detected