# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
from truffle.hyphae import context_pb2 as truffle_dot_hyphae_dot_context__pb2
from truffle.hyphae import contextmgmt_pb2 as truffle_dot_hyphae_dot_contextmgmt__pb2
from truffle.hyphae import hooks_pb2 as truffle_dot_hyphae_dot_hooks__pb2
from truffle.hyphae import serializestate_pb2 as truffle_dot_hyphae_dot_serializestate__pb2

GRPC_GENERATED_VERSION = '1.72.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in truffle/hyphae/runtime_svc_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class HyphaeRuntimeStub(object):
    """
    all the standard stuff u can override / sdk must impl
    HyphaeRuntime is the runtime service for Hyphae, called by the same agentic client that manages toolcalls.
    The client/agent expects implementations of the following methods to be available for it to function.
    Allowing users to override these methods in an SDK scenario allows for customization of the agentic loop iterations and context management.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.OnAppStart = channel.unary_unary(
                '/truffle.hyphae.HyphaeRuntime/OnAppStart',
                request_serializer=truffle_dot_hyphae_dot_hooks__pb2.OnAppStartRequest.SerializeToString,
                response_deserializer=truffle_dot_hyphae_dot_hooks__pb2.OnAppStartResponse.FromString,
                _registered_method=True)
        self.OnLoopStart = channel.unary_unary(
                '/truffle.hyphae.HyphaeRuntime/OnLoopStart',
                request_serializer=truffle_dot_hyphae_dot_hooks__pb2.OnLoopStartRequest.SerializeToString,
                response_deserializer=truffle_dot_hyphae_dot_hooks__pb2.OnLoopStartResponse.FromString,
                _registered_method=True)
        self.BuildContext = channel.unary_unary(
                '/truffle.hyphae.HyphaeRuntime/BuildContext',
                request_serializer=truffle_dot_hyphae_dot_contextmgmt__pb2.BuildContextRequest.SerializeToString,
                response_deserializer=truffle_dot_hyphae_dot_contextmgmt__pb2.BuildContextResponse.FromString,
                _registered_method=True)
        self.OnCtxManage = channel.unary_unary(
                '/truffle.hyphae.HyphaeRuntime/OnCtxManage',
                request_serializer=truffle_dot_hyphae_dot_contextmgmt__pb2.ManageContextRequest.SerializeToString,
                response_deserializer=truffle_dot_hyphae_dot_context__pb2.Context.FromString,
                _registered_method=True)
        self.LoadState = channel.unary_unary(
                '/truffle.hyphae.HyphaeRuntime/LoadState',
                request_serializer=truffle_dot_hyphae_dot_serializestate__pb2.LoadStateRequest.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                _registered_method=True)
        self.SaveState = channel.unary_unary(
                '/truffle.hyphae.HyphaeRuntime/SaveState',
                request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
                response_deserializer=truffle_dot_hyphae_dot_serializestate__pb2.SaveStateResponse.FromString,
                _registered_method=True)
        self.SetTaskFlags = channel.unary_unary(
                '/truffle.hyphae.HyphaeRuntime/SetTaskFlags',
                request_serializer=truffle_dot_hyphae_dot_hooks__pb2.SetTaskFlagsRequest.SerializeToString,
                response_deserializer=truffle_dot_hyphae_dot_hooks__pb2.SetTaskFlagsResponse.FromString,
                _registered_method=True)
        self.GetAppInfo = channel.unary_unary(
                '/truffle.hyphae.HyphaeRuntime/GetAppInfo',
                request_serializer=truffle_dot_hyphae_dot_hooks__pb2.AppInfoRequest.SerializeToString,
                response_deserializer=truffle_dot_hyphae_dot_hooks__pb2.AppInfoResponse.FromString,
                _registered_method=True)


class HyphaeRuntimeServicer(object):
    """
    all the standard stuff u can override / sdk must impl
    HyphaeRuntime is the runtime service for Hyphae, called by the same agentic client that manages toolcalls.
    The client/agent expects implementations of the following methods to be available for it to function.
    Allowing users to override these methods in an SDK scenario allows for customization of the agentic loop iterations and context management.
    """

    def OnAppStart(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def OnLoopStart(self, request, context):
        """called before the start of an agentic loop iteration
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def BuildContext(self, request, context):
        """called to build the context, the app should return a modified context, a conversation, or a raw string
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def OnCtxManage(self, request, context):
        """called with the models context, and cur len/target len - will change 
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def LoadState(self, request, context):
        """change these app should save state to container. 
        called to load a saved state, the app should restore its state from the provided AppState
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SaveState(self, request, context):
        """called to save the current state of the app, the app should serialize its state and return it in the AppState message
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SetTaskFlags(self, request, context):
        """called to set the flags for the app, like if user wants URR disabled, etc.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetAppInfo(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_HyphaeRuntimeServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'OnAppStart': grpc.unary_unary_rpc_method_handler(
                    servicer.OnAppStart,
                    request_deserializer=truffle_dot_hyphae_dot_hooks__pb2.OnAppStartRequest.FromString,
                    response_serializer=truffle_dot_hyphae_dot_hooks__pb2.OnAppStartResponse.SerializeToString,
            ),
            'OnLoopStart': grpc.unary_unary_rpc_method_handler(
                    servicer.OnLoopStart,
                    request_deserializer=truffle_dot_hyphae_dot_hooks__pb2.OnLoopStartRequest.FromString,
                    response_serializer=truffle_dot_hyphae_dot_hooks__pb2.OnLoopStartResponse.SerializeToString,
            ),
            'BuildContext': grpc.unary_unary_rpc_method_handler(
                    servicer.BuildContext,
                    request_deserializer=truffle_dot_hyphae_dot_contextmgmt__pb2.BuildContextRequest.FromString,
                    response_serializer=truffle_dot_hyphae_dot_contextmgmt__pb2.BuildContextResponse.SerializeToString,
            ),
            'OnCtxManage': grpc.unary_unary_rpc_method_handler(
                    servicer.OnCtxManage,
                    request_deserializer=truffle_dot_hyphae_dot_contextmgmt__pb2.ManageContextRequest.FromString,
                    response_serializer=truffle_dot_hyphae_dot_context__pb2.Context.SerializeToString,
            ),
            'LoadState': grpc.unary_unary_rpc_method_handler(
                    servicer.LoadState,
                    request_deserializer=truffle_dot_hyphae_dot_serializestate__pb2.LoadStateRequest.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
            'SaveState': grpc.unary_unary_rpc_method_handler(
                    servicer.SaveState,
                    request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                    response_serializer=truffle_dot_hyphae_dot_serializestate__pb2.SaveStateResponse.SerializeToString,
            ),
            'SetTaskFlags': grpc.unary_unary_rpc_method_handler(
                    servicer.SetTaskFlags,
                    request_deserializer=truffle_dot_hyphae_dot_hooks__pb2.SetTaskFlagsRequest.FromString,
                    response_serializer=truffle_dot_hyphae_dot_hooks__pb2.SetTaskFlagsResponse.SerializeToString,
            ),
            'GetAppInfo': grpc.unary_unary_rpc_method_handler(
                    servicer.GetAppInfo,
                    request_deserializer=truffle_dot_hyphae_dot_hooks__pb2.AppInfoRequest.FromString,
                    response_serializer=truffle_dot_hyphae_dot_hooks__pb2.AppInfoResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'truffle.hyphae.HyphaeRuntime', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('truffle.hyphae.HyphaeRuntime', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class HyphaeRuntime(object):
    """
    all the standard stuff u can override / sdk must impl
    HyphaeRuntime is the runtime service for Hyphae, called by the same agentic client that manages toolcalls.
    The client/agent expects implementations of the following methods to be available for it to function.
    Allowing users to override these methods in an SDK scenario allows for customization of the agentic loop iterations and context management.
    """

    @staticmethod
    def OnAppStart(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/truffle.hyphae.HyphaeRuntime/OnAppStart',
            truffle_dot_hyphae_dot_hooks__pb2.OnAppStartRequest.SerializeToString,
            truffle_dot_hyphae_dot_hooks__pb2.OnAppStartResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def OnLoopStart(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/truffle.hyphae.HyphaeRuntime/OnLoopStart',
            truffle_dot_hyphae_dot_hooks__pb2.OnLoopStartRequest.SerializeToString,
            truffle_dot_hyphae_dot_hooks__pb2.OnLoopStartResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def BuildContext(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/truffle.hyphae.HyphaeRuntime/BuildContext',
            truffle_dot_hyphae_dot_contextmgmt__pb2.BuildContextRequest.SerializeToString,
            truffle_dot_hyphae_dot_contextmgmt__pb2.BuildContextResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def OnCtxManage(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/truffle.hyphae.HyphaeRuntime/OnCtxManage',
            truffle_dot_hyphae_dot_contextmgmt__pb2.ManageContextRequest.SerializeToString,
            truffle_dot_hyphae_dot_context__pb2.Context.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def LoadState(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/truffle.hyphae.HyphaeRuntime/LoadState',
            truffle_dot_hyphae_dot_serializestate__pb2.LoadStateRequest.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SaveState(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/truffle.hyphae.HyphaeRuntime/SaveState',
            google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            truffle_dot_hyphae_dot_serializestate__pb2.SaveStateResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SetTaskFlags(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/truffle.hyphae.HyphaeRuntime/SetTaskFlags',
            truffle_dot_hyphae_dot_hooks__pb2.SetTaskFlagsRequest.SerializeToString,
            truffle_dot_hyphae_dot_hooks__pb2.SetTaskFlagsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetAppInfo(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/truffle.hyphae.HyphaeRuntime/GetAppInfo',
            truffle_dot_hyphae_dot_hooks__pb2.AppInfoRequest.SerializeToString,
            truffle_dot_hyphae_dot_hooks__pb2.AppInfoResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
