def handle_request(self, parent_sock):
        """
        Handle different types of requests/responses from Spokes.

        Args:
            parent_sock (Socket): The socket to communicate with the parent process.

        Returns:
            str: The final response from the spokes.

        """
        while True:
            data = parent_sock.recv()

            if data["message_type"] == "final_response":
                return data["response"]

            if data["message_type"] == "function_probe_request":
                function = data["requested_functionality"]
                spoke_session_id = data["spoke_id"]

                if function not in self.function_tools:
                    response = Message.no_functionality_response(
                        spoke_session_id, function
                    )
                    parent_sock.send(response)
                    continue

                request_app = ""
                spoke_id = spoke_session_id.split(":")[1]
                for app, spoke in self.spoke_tool.items():
                    if str(spoke["id"]) == spoke_id:
                        request_app = app
                        break

                app = self.function_tools[function]

                flag = False
                if request_app:
                    action_message = f'"{request_app}" requests to execute "{app}"'

                    for step_app_list in self.app_list:
                        if app in step_app_list and request_app in step_app_list:
                            flag = True
                            break

                    consent = get_user_consent(
                        self.user_id,
                        request_app + "->" + app,
                        action_message,
                        flag,
                        "collab",
                    )

                else:
                    action_message = (
                        f'Your request "{self.query}" requires executing "{app}"'
                    )

                    for step_app_list in self.app_list:
                        if app in step_app_list:
                            flag = True
                            break

                    consent = get_user_consent(
                        self.user_id, app, action_message, flag, "exec"
                    )

                if not consent:
                    response = Message.functionality_denial_response(
                        spoke_session_id, function
                    )
                else:
                    functionality_spec = self.tool_importer.get_tool_spec(function)
                    response = Message.function_probe_response(
                        spoke_session_id, functionality_spec
                    )

                parent_sock.send(response)

            if data["message_type"] == "app_request":
                functionality_request = data["functionality_request"]
                spoke_session_id = data["spoke_id"]

                if functionality_request not in self.function_tools:
                    response_message = functionality_request + " not found"
                    response = Message.no_functionality_response(functionality_request)
                else:
                    tool = self.function_tools[functionality_request]

                    shared_data_dict = None
                    if tool in self.app_data_dict:
                        shared_data_dict = self.app_data_dict[tool]
                        if shared_data_dict:
                            all_empty = all(
                                value == "" for value in shared_data_dict.values()
                            )
                            if all_empty:
                                shared_data_dict = None

                    app_response = self.execute_app_spoke(
                        str(data), shared_data_dict, tool, False
                    )
                    response_message = app_response
                    response = Message.app_response(spoke_session_id, app_response)

                if request_app:
                    action_message = f'"{app}" is returning the following response to "{request_app}":\n"{response_message}"'
                    consent = get_user_consent(
                        self.user_id,
                        app + "->" + request_app,
                        action_message,
                        True,
                        "collab",
                    )
                else:
                    action_message = f'"{app}" is returning the following response:\n"{response_message}"'
                    consent = get_user_consent(
                        self.user_id, app, action_message, True, "collab"
                    )

                if consent:
                    parent_sock.send(response)
                else:
                    parent_sock.send(
                        Message.no_functionality_response(functionality_request)
                    )

        Handle different types of requests/responses from Spokes.

        Args:
            parent_sock (Socket): The socket to communicate with the parent process.

        Returns:
            str: The final response from the spokes.

        
llama-index-packs/llama-index-packs-secgpt/llama_index/packs/secgpt/hub_operator.py