@@ -6,6 +6,7 @@ import { ExecutionMetadata } from "@/lib/types/messaging";
66import { TeachModeEventPayload } from "@/lib/pubsub/types" ;
77import { Logging } from "@/lib/utils/Logging" ;
88import { type SemanticWorkflow } from "@/lib/teach-mode/types" ;
9+ import { GlowAnimationService } from '@/lib/services/GlowAnimationService' ;
910
1011interface PredefinedPlan {
1112 agentId : string ;
@@ -22,6 +23,7 @@ interface PredefinedPlan {
2223export class TeachWebSocketAgent {
2324 private readonly executionContext : ExecutionContext ;
2425 private readonly mainPubsub : PubSubChannel ; // Main channel for teach-mode events
26+ private readonly glowService : GlowAnimationService ;
2527
2628 // WebSocket state
2729 private ws : WebSocket | null = null ;
@@ -33,6 +35,7 @@ export class TeachWebSocketAgent {
3335 constructor ( executionContext : ExecutionContext ) {
3436 this . executionContext = executionContext ;
3537 this . mainPubsub = PubSub . getChannel ( 'main' ) ; // Get main channel for teach-mode events
38+ this . glowService = GlowAnimationService . getInstance ( ) ;
3639 Logging . log ( "TeachWebSocketAgent" , "Agent instance created" , "info" ) ;
3740 }
3841
@@ -173,6 +176,16 @@ ${JSON.stringify(userTrajectorySteps, null, 2)}`;
173176 totalSteps : workflow ?. steps ?. length || 0
174177 } ) ;
175178
179+ // Start glow animation
180+ try {
181+ const currentPage = await this . executionContext . browserContext . getCurrentPage ( ) ;
182+ if ( currentPage ?. tabId && ! this . glowService . isGlowActive ( currentPage . tabId ) ) {
183+ await this . glowService . startGlow ( currentPage . tabId ) ;
184+ }
185+ } catch ( error ) {
186+ Logging . log ( "TeachWebSocketAgent" , `Could not start glow animation: ${ error } ` , "warning" ) ;
187+ }
188+
176189 // Connect to WebSocket server
177190 await this . _connect ( ) ;
178191
@@ -196,6 +209,16 @@ ${JSON.stringify(userTrajectorySteps, null, 2)}`;
196209 endTime : Date . now ( ) ,
197210 } ) ;
198211 this . _logMetrics ( ) ;
212+
213+ // Stop glow animation
214+ try {
215+ const activeGlows = this . glowService . getAllActiveGlows ( ) ;
216+ for ( const tabId of activeGlows ) {
217+ await this . glowService . stopGlow ( tabId ) ;
218+ }
219+ } catch ( error ) {
220+ Logging . log ( "TeachWebSocketAgent" , `Could not stop glow animation: ${ error } ` , "warning" ) ;
221+ }
199222 }
200223 }
201224
0 commit comments