@@ -22,6 +22,7 @@ class WebDebugBridge:
2222 """
2323
2424 def __init__ (self , mode : ExecutionMode = ExecutionMode .RUN ):
25+ """Initialize the web debug bridge."""
2526 self ._mode = mode
2627 self ._auto_resume = mode == ExecutionMode .RUN
2728 self ._resume_event = asyncio .Event ()
@@ -43,33 +44,39 @@ def __init__(self, mode: ExecutionMode = ExecutionMode.RUN):
4344 # ------------------------------------------------------------------
4445
4546 async def connect (self ) -> None :
47+ """Establish connection to debugger."""
4648 logger .debug ("WebDebugBridge connected (mode=%s)" , self ._mode )
4749
4850 async def disconnect (self ) -> None :
51+ """Close connection to debugger."""
4952 self ._resume_event .set ()
5053 self ._terminate_event .set ()
5154 logger .debug ("WebDebugBridge disconnected" )
5255
5356 async def emit_execution_started (self , ** kwargs : Any ) -> None :
57+ """Notify debugger that execution started."""
5458 logger .debug ("Execution started" )
5559 if self .on_execution_started :
5660 self .on_execution_started ()
5761
5862 async def emit_state_update (self , state_event : UiPathRuntimeStateEvent ) -> None :
63+ """Notify debugger of runtime state update."""
5964 logger .debug ("State update: %s" , state_event .node_name )
6065 if self .on_state_update :
6166 self .on_state_update (state_event )
6267
6368 async def emit_breakpoint_hit (
6469 self , breakpoint_result : UiPathBreakpointResult
6570 ) -> None :
71+ """Notify debugger that a breakpoint was hit."""
6672 logger .debug ("Breakpoint hit: %s" , breakpoint_result )
6773 if self .on_breakpoint_hit :
6874 self .on_breakpoint_hit (breakpoint_result )
6975
7076 async def emit_execution_suspended (
7177 self , runtime_result : UiPathRuntimeResult
7278 ) -> None :
79+ """Notify debugger that execution is suspended."""
7380 logger .debug ("Execution suspended" )
7481 if runtime_result .trigger is None :
7582 return
@@ -86,21 +93,25 @@ async def emit_execution_suspended(
8693 )
8794
8895 async def emit_execution_resumed (self , resume_data : Any ) -> None :
96+ """Notify debugger that execution resumed."""
8997 logger .debug ("Execution resumed" )
9098
9199 async def emit_execution_completed (
92100 self , runtime_result : UiPathRuntimeResult
93101 ) -> None :
102+ """Notify debugger that execution completed."""
94103 logger .debug ("Execution completed" )
95104 if self .on_execution_completed :
96105 self .on_execution_completed (runtime_result )
97106
98107 async def emit_execution_error (self , error : str ) -> None :
108+ """Notify debugger that an error occurred."""
99109 logger .error ("Execution error: %s" , error )
100110 if self .on_execution_error :
101111 self .on_execution_error (error )
102112
103113 async def wait_for_resume (self ) -> Any :
114+ """Wait for resume command from debugger."""
104115 if self ._auto_resume :
105116 self ._auto_resume = False # Only auto-resume the first (initial) pause
106117 return {}
@@ -114,22 +125,27 @@ async def wait_for_resume(self) -> Any:
114125 return self ._resume_data
115126
116127 async def wait_for_terminate (self ) -> None :
128+ """Wait for terminate command from debugger."""
117129 await self ._terminate_event .wait ()
118130
119131 def get_breakpoints (self ) -> list [str ] | Literal ["*" ]:
132+ """Get nodes to suspend execution at."""
120133 return self ._breakpoints
121134
122135 # ------------------------------------------------------------------
123136 # Control methods (called from RunService / WS handler)
124137 # ------------------------------------------------------------------
125138
126139 def resume (self , resume_data : Any ) -> None :
140+ """Signal that execution should resume."""
127141 self ._resume_data = resume_data or {}
128142 self ._resume_event .set ()
129143
130144 def quit (self ) -> None :
145+ """Signal that execution should quit."""
131146 self ._terminate_event .set ()
132147 self ._resume_event .set ()
133148
134149 def set_breakpoints (self , breakpoints : list [str ] | Literal ["*" ]) -> None :
150+ """Set breakpoints."""
135151 self ._breakpoints = breakpoints
0 commit comments