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

from ai.stigmer.agentic.session.v1 import api_pb2 as ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2
from ai.stigmer.agentic.session.v1 import io_pb2 as ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2


class SessionCommandControllerStub(object):
    """SessionCommandController handles write operations for agent sessions.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.apply = channel.unary_unary(
                '/ai.stigmer.agentic.session.v1.SessionCommandController/apply',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
                _registered_method=True)
        self.create = channel.unary_unary(
                '/ai.stigmer.agentic.session.v1.SessionCommandController/create',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
                _registered_method=True)
        self.update = channel.unary_unary(
                '/ai.stigmer.agentic.session.v1.SessionCommandController/update',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
                _registered_method=True)
        self.updateSubject = channel.unary_unary(
                '/ai.stigmer.agentic.session.v1.SessionCommandController/updateSubject',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2.UpdateSessionSubjectRequest.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
                _registered_method=True)
        self.updateSandboxId = channel.unary_unary(
                '/ai.stigmer.agentic.session.v1.SessionCommandController/updateSandboxId',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2.UpdateSessionSandboxIdRequest.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
                _registered_method=True)
        self.delete = channel.unary_unary(
                '/ai.stigmer.agentic.session.v1.SessionCommandController/delete',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2.SessionId.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
                _registered_method=True)


class SessionCommandControllerServicer(object):
    """SessionCommandController handles write operations for agent sessions.
    """

    def apply(self, request, context):
        """Create or update a session.
        The authorization and state-operation are determined depending on whether the session
        is going to be created or updated which is determined as part of the request execution.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def create(self, request, context):
        """Create a new session for an agent.
        Requires can_create_session permission in the organization.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def update(self, request, context):
        """Update an existing session (e.g., subject, thread_id, sandbox_id).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def updateSubject(self, request, context):
        """Set the session subject (server-side field-level update, race-safe).

        Unlike the full update RPC, this atomically modifies only spec.subject
        without touching other fields. This eliminates the lost-update race
        between GenerateSessionSubject and sandbox_manager, which both run in
        parallel during agent execution.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def updateSandboxId(self, request, context):
        """Set the session sandbox ID (server-side field-level update, race-safe).

        Unlike the full update RPC, this atomically modifies only spec.sandbox_id
        without touching other fields. This eliminates the lost-update race
        between sandbox_manager and GenerateSessionSubject, which both run in
        parallel during agent execution.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def delete(self, request, context):
        """Delete a session (also cleans up thread and sandbox).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_SessionCommandControllerServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'apply': grpc.unary_unary_rpc_method_handler(
                    servicer.apply,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
            ),
            'create': grpc.unary_unary_rpc_method_handler(
                    servicer.create,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
            ),
            'update': grpc.unary_unary_rpc_method_handler(
                    servicer.update,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
            ),
            'updateSubject': grpc.unary_unary_rpc_method_handler(
                    servicer.updateSubject,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2.UpdateSessionSubjectRequest.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
            ),
            'updateSandboxId': grpc.unary_unary_rpc_method_handler(
                    servicer.updateSandboxId,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2.UpdateSessionSandboxIdRequest.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
            ),
            'delete': grpc.unary_unary_rpc_method_handler(
                    servicer.delete,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2.SessionId.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'ai.stigmer.agentic.session.v1.SessionCommandController', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('ai.stigmer.agentic.session.v1.SessionCommandController', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class SessionCommandController(object):
    """SessionCommandController handles write operations for agent sessions.
    """

    @staticmethod
    def apply(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,
            '/ai.stigmer.agentic.session.v1.SessionCommandController/apply',
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def create(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,
            '/ai.stigmer.agentic.session.v1.SessionCommandController/create',
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def update(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,
            '/ai.stigmer.agentic.session.v1.SessionCommandController/update',
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def updateSubject(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,
            '/ai.stigmer.agentic.session.v1.SessionCommandController/updateSubject',
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2.UpdateSessionSubjectRequest.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def updateSandboxId(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,
            '/ai.stigmer.agentic.session.v1.SessionCommandController/updateSandboxId',
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2.UpdateSessionSandboxIdRequest.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def delete(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,
            '/ai.stigmer.agentic.session.v1.SessionCommandController/delete',
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_io__pb2.SessionId.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_session_dot_v1_dot_api__pb2.Session.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
