@@ -136,9 +136,9 @@ function mergeAdjacentParts(parts: MuxMessage["parts"]): MuxMessage["parts"] {
136136}
137137
138138export class StreamingMessageAggregator {
139- // Streams that have been registered/started in the backend but haven't emitted stream-start yet.
139+ // Streams that have emitted `stream-pending` but not ` stream-start` yet.
140140 // This is the "connecting" phase: abort should work, but no deltas have started.
141- private connectingStreams = new Map < string , { startTime : number ; model : string } > ( ) ;
141+ private pendingStreams = new Map < string , { startTime : number ; model : string } > ( ) ;
142142 private messages = new Map < string , MuxMessage > ( ) ;
143143 private activeStreams = new Map < string , StreamingContext > ( ) ;
144144
@@ -348,7 +348,7 @@ export class StreamingMessageAggregator {
348348 */
349349 private cleanupStreamState ( messageId : string ) : void {
350350 this . activeStreams . delete ( messageId ) ;
351- this . connectingStreams . delete ( messageId ) ;
351+ this . pendingStreams . delete ( messageId ) ;
352352 // Clear todos when stream ends - they're stream-scoped state
353353 // On reload, todos will be reconstructed from completed tool_write calls in history
354354 this . currentTodos = [ ] ;
@@ -466,8 +466,8 @@ export class StreamingMessageAggregator {
466466 this . pendingStreamStartTime = time ;
467467 }
468468
469- hasConnectingStreams ( ) : boolean {
470- return this . connectingStreams . size > 0 ;
469+ hasPendingStreams ( ) : boolean {
470+ return this . pendingStreams . size > 0 ;
471471 }
472472 getActiveStreams ( ) : StreamingContext [ ] {
473473 return Array . from ( this . activeStreams . values ( ) ) ;
@@ -497,7 +497,7 @@ export class StreamingMessageAggregator {
497497 }
498498
499499 // If we're connecting (stream-pending), return that model
500- for ( const context of this . connectingStreams . values ( ) ) {
500+ for ( const context of this . pendingStreams . values ( ) ) {
501501 return context . model ;
502502 }
503503
@@ -520,7 +520,7 @@ export class StreamingMessageAggregator {
520520 clear ( ) : void {
521521 this . messages . clear ( ) ;
522522 this . activeStreams . clear ( ) ;
523- this . connectingStreams . clear ( ) ;
523+ this . pendingStreams . clear ( ) ;
524524 this . invalidateCache ( ) ;
525525 }
526526
@@ -547,14 +547,14 @@ export class StreamingMessageAggregator {
547547 // Clear pending stream start timestamp - backend has accepted the request.
548548 this . setPendingStreamStartTime ( null ) ;
549549
550- this . connectingStreams . set ( data . messageId , { startTime : Date . now ( ) , model : data . model } ) ;
550+ this . pendingStreams . set ( data . messageId , { startTime : Date . now ( ) , model : data . model } ) ;
551551 this . invalidateCache ( ) ;
552552 }
553553
554554 handleStreamStart ( data : StreamStartEvent ) : void {
555555 // Clear pending/connecting state - stream has started.
556556 this . setPendingStreamStartTime ( null ) ;
557- this . connectingStreams . delete ( data . messageId ) ;
557+ this . pendingStreams . delete ( data . messageId ) ;
558558
559559 // NOTE: We do NOT clear agentStatus or currentTodos here.
560560 // They are cleared when a new user message arrives (see handleMessage),
@@ -697,7 +697,7 @@ export class StreamingMessageAggregator {
697697
698698 handleStreamError ( data : StreamErrorMessage ) : void {
699699 const isTrackedStream =
700- this . activeStreams . has ( data . messageId ) || this . connectingStreams . has ( data . messageId ) ;
700+ this . activeStreams . has ( data . messageId ) || this . pendingStreams . has ( data . messageId ) ;
701701
702702 if ( isTrackedStream ) {
703703 // Mark the message with error metadata
0 commit comments