from google.protobuf.internal import containers as _containers
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from collections.abc import Iterable as _Iterable, Mapping as _Mapping
from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union

DESCRIPTOR: _descriptor.FileDescriptor

class SchemaVersion(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    SCHEMA_VERSION_UNSPECIFIED: _ClassVar[SchemaVersion]
    SCHEMA_VERSION_1: _ClassVar[SchemaVersion]

class ArchitectureType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    ARCHITECTURE_TYPE_UNSPECIFIED: _ClassVar[ArchitectureType]
    ARCHITECTURE_TYPE_DENSE: _ClassVar[ArchitectureType]
    ARCHITECTURE_TYPE_MOE: _ClassVar[ArchitectureType]
    ARCHITECTURE_TYPE_MLA: _ClassVar[ArchitectureType]

class DType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    DTYPE_UNSPECIFIED: _ClassVar[DType]
    DTYPE_BFLOAT16: _ClassVar[DType]
    DTYPE_FLOAT16: _ClassVar[DType]
    DTYPE_FLOAT32: _ClassVar[DType]
    DTYPE_INT32: _ClassVar[DType]
    DTYPE_INT64: _ClassVar[DType]
    DTYPE_UINT8: _ClassVar[DType]
    DTYPE_INT8: _ClassVar[DType]
    DTYPE_BOOL: _ClassVar[DType]

class ByteOrder(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    BYTE_ORDER_UNSPECIFIED: _ClassVar[ByteOrder]
    BYTE_ORDER_LITTLE_ENDIAN: _ClassVar[ByteOrder]
    BYTE_ORDER_BIG_ENDIAN: _ClassVar[ByteOrder]

class Compression(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    COMPRESSION_UNSPECIFIED: _ClassVar[Compression]
    COMPRESSION_NONE: _ClassVar[Compression]
    COMPRESSION_ZSTD: _ClassVar[Compression]

class ChecksumAlgorithm(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    CHECKSUM_ALGORITHM_UNSPECIFIED: _ClassVar[ChecksumAlgorithm]
    CHECKSUM_ALGORITHM_NONE: _ClassVar[ChecksumAlgorithm]
    CHECKSUM_ALGORITHM_CRC32C: _ClassVar[ChecksumAlgorithm]

class Phase(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    PHASE_UNSPECIFIED: _ClassVar[Phase]
    PHASE_PREFILL: _ClassVar[Phase]
    PHASE_DECODE: _ClassVar[Phase]
    PHASE_RELEASE: _ClassVar[Phase]
    PHASE_CANCEL: _ClassVar[Phase]

class CacheMode(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    CACHE_MODE_UNSPECIFIED: _ClassVar[CacheMode]
    CACHE_MODE_STATELESS: _ClassVar[CacheMode]
    CACHE_MODE_PREFILL: _ClassVar[CacheMode]
    CACHE_MODE_DECODE: _ClassVar[CacheMode]

class ErrorCode(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    ERROR_CODE_UNSPECIFIED: _ClassVar[ErrorCode]
    ERROR_CODE_SCHEMA_UNSUPPORTED: _ClassVar[ErrorCode]
    ERROR_CODE_FINGERPRINT_MISMATCH: _ClassVar[ErrorCode]
    ERROR_CODE_EPOCH_STALE: _ClassVar[ErrorCode]
    ERROR_CODE_SHARD_RANGE_MISMATCH: _ClassVar[ErrorCode]
    ERROR_CODE_CACHE_MISS: _ClassVar[ErrorCode]
    ERROR_CODE_RESOURCE_EXHAUSTED: _ClassVar[ErrorCode]
    ERROR_CODE_PAYLOAD_CORRUPT: _ClassVar[ErrorCode]
    ERROR_CODE_CANCELLED: _ClassVar[ErrorCode]
    ERROR_CODE_DEADLINE_EXCEEDED: _ClassVar[ErrorCode]
    ERROR_CODE_FLOW_CONTROL_VIOLATION: _ClassVar[ErrorCode]
    ERROR_CODE_INTERNAL: _ClassVar[ErrorCode]

class ServingState(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    SERVING_STATE_UNSPECIFIED: _ClassVar[ServingState]
    SERVING_STATE_SERVING: _ClassVar[ServingState]
    SERVING_STATE_DRAINING: _ClassVar[ServingState]
    SERVING_STATE_NOT_SERVING: _ClassVar[ServingState]
SCHEMA_VERSION_UNSPECIFIED: SchemaVersion
SCHEMA_VERSION_1: SchemaVersion
ARCHITECTURE_TYPE_UNSPECIFIED: ArchitectureType
ARCHITECTURE_TYPE_DENSE: ArchitectureType
ARCHITECTURE_TYPE_MOE: ArchitectureType
ARCHITECTURE_TYPE_MLA: ArchitectureType
DTYPE_UNSPECIFIED: DType
DTYPE_BFLOAT16: DType
DTYPE_FLOAT16: DType
DTYPE_FLOAT32: DType
DTYPE_INT32: DType
DTYPE_INT64: DType
DTYPE_UINT8: DType
DTYPE_INT8: DType
DTYPE_BOOL: DType
BYTE_ORDER_UNSPECIFIED: ByteOrder
BYTE_ORDER_LITTLE_ENDIAN: ByteOrder
BYTE_ORDER_BIG_ENDIAN: ByteOrder
COMPRESSION_UNSPECIFIED: Compression
COMPRESSION_NONE: Compression
COMPRESSION_ZSTD: Compression
CHECKSUM_ALGORITHM_UNSPECIFIED: ChecksumAlgorithm
CHECKSUM_ALGORITHM_NONE: ChecksumAlgorithm
CHECKSUM_ALGORITHM_CRC32C: ChecksumAlgorithm
PHASE_UNSPECIFIED: Phase
PHASE_PREFILL: Phase
PHASE_DECODE: Phase
PHASE_RELEASE: Phase
PHASE_CANCEL: Phase
CACHE_MODE_UNSPECIFIED: CacheMode
CACHE_MODE_STATELESS: CacheMode
CACHE_MODE_PREFILL: CacheMode
CACHE_MODE_DECODE: CacheMode
ERROR_CODE_UNSPECIFIED: ErrorCode
ERROR_CODE_SCHEMA_UNSUPPORTED: ErrorCode
ERROR_CODE_FINGERPRINT_MISMATCH: ErrorCode
ERROR_CODE_EPOCH_STALE: ErrorCode
ERROR_CODE_SHARD_RANGE_MISMATCH: ErrorCode
ERROR_CODE_CACHE_MISS: ErrorCode
ERROR_CODE_RESOURCE_EXHAUSTED: ErrorCode
ERROR_CODE_PAYLOAD_CORRUPT: ErrorCode
ERROR_CODE_CANCELLED: ErrorCode
ERROR_CODE_DEADLINE_EXCEEDED: ErrorCode
ERROR_CODE_FLOW_CONTROL_VIOLATION: ErrorCode
ERROR_CODE_INTERNAL: ErrorCode
SERVING_STATE_UNSPECIFIED: ServingState
SERVING_STATE_SERVING: ServingState
SERVING_STATE_DRAINING: ServingState
SERVING_STATE_NOT_SERVING: ServingState

class Checksum(_message.Message):
    __slots__ = ("algorithm", "value")
    ALGORITHM_FIELD_NUMBER: _ClassVar[int]
    VALUE_FIELD_NUMBER: _ClassVar[int]
    algorithm: ChecksumAlgorithm
    value: bytes
    def __init__(self, algorithm: _Optional[_Union[ChecksumAlgorithm, str]] = ..., value: _Optional[bytes] = ...) -> None: ...

class TensorFragment(_message.Message):
    __slots__ = ("fragment_index", "fragment_count", "byte_offset", "payload")
    FRAGMENT_INDEX_FIELD_NUMBER: _ClassVar[int]
    FRAGMENT_COUNT_FIELD_NUMBER: _ClassVar[int]
    BYTE_OFFSET_FIELD_NUMBER: _ClassVar[int]
    PAYLOAD_FIELD_NUMBER: _ClassVar[int]
    fragment_index: int
    fragment_count: int
    byte_offset: int
    payload: bytes
    def __init__(self, fragment_index: _Optional[int] = ..., fragment_count: _Optional[int] = ..., byte_offset: _Optional[int] = ..., payload: _Optional[bytes] = ...) -> None: ...

class NamedTensor(_message.Message):
    __slots__ = ("name", "shape", "dtype", "byte_order", "total_bytes", "compression", "checksum", "fragments")
    NAME_FIELD_NUMBER: _ClassVar[int]
    SHAPE_FIELD_NUMBER: _ClassVar[int]
    DTYPE_FIELD_NUMBER: _ClassVar[int]
    BYTE_ORDER_FIELD_NUMBER: _ClassVar[int]
    TOTAL_BYTES_FIELD_NUMBER: _ClassVar[int]
    COMPRESSION_FIELD_NUMBER: _ClassVar[int]
    CHECKSUM_FIELD_NUMBER: _ClassVar[int]
    FRAGMENTS_FIELD_NUMBER: _ClassVar[int]
    name: str
    shape: _containers.RepeatedScalarFieldContainer[int]
    dtype: DType
    byte_order: ByteOrder
    total_bytes: int
    compression: Compression
    checksum: Checksum
    fragments: _containers.RepeatedCompositeFieldContainer[TensorFragment]
    def __init__(self, name: _Optional[str] = ..., shape: _Optional[_Iterable[int]] = ..., dtype: _Optional[_Union[DType, str]] = ..., byte_order: _Optional[_Union[ByteOrder, str]] = ..., total_bytes: _Optional[int] = ..., compression: _Optional[_Union[Compression, str]] = ..., checksum: _Optional[_Union[Checksum, _Mapping]] = ..., fragments: _Optional[_Iterable[_Union[TensorFragment, _Mapping]]] = ...) -> None: ...

class TensorBundle(_message.Message):
    __slots__ = ("bundle_version", "tensors", "architecture", "boundary_point")
    BUNDLE_VERSION_FIELD_NUMBER: _ClassVar[int]
    TENSORS_FIELD_NUMBER: _ClassVar[int]
    ARCHITECTURE_FIELD_NUMBER: _ClassVar[int]
    BOUNDARY_POINT_FIELD_NUMBER: _ClassVar[int]
    bundle_version: int
    tensors: _containers.RepeatedCompositeFieldContainer[NamedTensor]
    architecture: ArchitectureType
    boundary_point: str
    def __init__(self, bundle_version: _Optional[int] = ..., tensors: _Optional[_Iterable[_Union[NamedTensor, _Mapping]]] = ..., architecture: _Optional[_Union[ArchitectureType, str]] = ..., boundary_point: _Optional[str] = ...) -> None: ...

class Fingerprint(_message.Message):
    __slots__ = ("model_artifact_digest", "runtime_recipe_digest", "recipe_id", "recipe_version", "catalogue_version")
    MODEL_ARTIFACT_DIGEST_FIELD_NUMBER: _ClassVar[int]
    RUNTIME_RECIPE_DIGEST_FIELD_NUMBER: _ClassVar[int]
    RECIPE_ID_FIELD_NUMBER: _ClassVar[int]
    RECIPE_VERSION_FIELD_NUMBER: _ClassVar[int]
    CATALOGUE_VERSION_FIELD_NUMBER: _ClassVar[int]
    model_artifact_digest: str
    runtime_recipe_digest: str
    recipe_id: str
    recipe_version: str
    catalogue_version: str
    def __init__(self, model_artifact_digest: _Optional[str] = ..., runtime_recipe_digest: _Optional[str] = ..., recipe_id: _Optional[str] = ..., recipe_version: _Optional[str] = ..., catalogue_version: _Optional[str] = ...) -> None: ...

class ShardRange(_message.Message):
    __slots__ = ("start_layer", "end_layer", "effective_start_layer")
    START_LAYER_FIELD_NUMBER: _ClassVar[int]
    END_LAYER_FIELD_NUMBER: _ClassVar[int]
    EFFECTIVE_START_LAYER_FIELD_NUMBER: _ClassVar[int]
    start_layer: int
    end_layer: int
    effective_start_layer: int
    def __init__(self, start_layer: _Optional[int] = ..., end_layer: _Optional[int] = ..., effective_start_layer: _Optional[int] = ...) -> None: ...

class PositionSpan(_message.Message):
    __slots__ = ("first_position", "token_count")
    FIRST_POSITION_FIELD_NUMBER: _ClassVar[int]
    TOKEN_COUNT_FIELD_NUMBER: _ClassVar[int]
    first_position: int
    token_count: int
    def __init__(self, first_position: _Optional[int] = ..., token_count: _Optional[int] = ...) -> None: ...

class ChunkInfo(_message.Message):
    __slots__ = ("chunk_index", "chunk_count", "final_chunk")
    CHUNK_INDEX_FIELD_NUMBER: _ClassVar[int]
    CHUNK_COUNT_FIELD_NUMBER: _ClassVar[int]
    FINAL_CHUNK_FIELD_NUMBER: _ClassVar[int]
    chunk_index: int
    chunk_count: int
    final_chunk: bool
    def __init__(self, chunk_index: _Optional[int] = ..., chunk_count: _Optional[int] = ..., final_chunk: _Optional[bool] = ...) -> None: ...

class CacheExpectation(_message.Message):
    __slots__ = ("mode", "expected_past_len")
    MODE_FIELD_NUMBER: _ClassVar[int]
    EXPECTED_PAST_LEN_FIELD_NUMBER: _ClassVar[int]
    mode: CacheMode
    expected_past_len: int
    def __init__(self, mode: _Optional[_Union[CacheMode, str]] = ..., expected_past_len: _Optional[int] = ...) -> None: ...

class CacheResult(_message.Message):
    __slots__ = ("mode", "past_len", "cache_hit")
    MODE_FIELD_NUMBER: _ClassVar[int]
    PAST_LEN_FIELD_NUMBER: _ClassVar[int]
    CACHE_HIT_FIELD_NUMBER: _ClassVar[int]
    mode: CacheMode
    past_len: int
    cache_hit: bool
    def __init__(self, mode: _Optional[_Union[CacheMode, str]] = ..., past_len: _Optional[int] = ..., cache_hit: _Optional[bool] = ...) -> None: ...

class Envelope(_message.Message):
    __slots__ = ("schema_version", "work_id", "route_session_id", "route_epoch", "fingerprint", "shard_range", "phase", "position", "idempotency_step", "cache_expectation", "deadline_unix_nanos", "chunk")
    SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
    WORK_ID_FIELD_NUMBER: _ClassVar[int]
    ROUTE_SESSION_ID_FIELD_NUMBER: _ClassVar[int]
    ROUTE_EPOCH_FIELD_NUMBER: _ClassVar[int]
    FINGERPRINT_FIELD_NUMBER: _ClassVar[int]
    SHARD_RANGE_FIELD_NUMBER: _ClassVar[int]
    PHASE_FIELD_NUMBER: _ClassVar[int]
    POSITION_FIELD_NUMBER: _ClassVar[int]
    IDEMPOTENCY_STEP_FIELD_NUMBER: _ClassVar[int]
    CACHE_EXPECTATION_FIELD_NUMBER: _ClassVar[int]
    DEADLINE_UNIX_NANOS_FIELD_NUMBER: _ClassVar[int]
    CHUNK_FIELD_NUMBER: _ClassVar[int]
    schema_version: SchemaVersion
    work_id: str
    route_session_id: str
    route_epoch: int
    fingerprint: Fingerprint
    shard_range: ShardRange
    phase: Phase
    position: PositionSpan
    idempotency_step: int
    cache_expectation: CacheExpectation
    deadline_unix_nanos: int
    chunk: ChunkInfo
    def __init__(self, schema_version: _Optional[_Union[SchemaVersion, str]] = ..., work_id: _Optional[str] = ..., route_session_id: _Optional[str] = ..., route_epoch: _Optional[int] = ..., fingerprint: _Optional[_Union[Fingerprint, _Mapping]] = ..., shard_range: _Optional[_Union[ShardRange, _Mapping]] = ..., phase: _Optional[_Union[Phase, str]] = ..., position: _Optional[_Union[PositionSpan, _Mapping]] = ..., idempotency_step: _Optional[int] = ..., cache_expectation: _Optional[_Union[CacheExpectation, _Mapping]] = ..., deadline_unix_nanos: _Optional[int] = ..., chunk: _Optional[_Union[ChunkInfo, _Mapping]] = ...) -> None: ...

class ShardError(_message.Message):
    __slots__ = ("code", "detail", "retryable", "actual_past_len")
    CODE_FIELD_NUMBER: _ClassVar[int]
    DETAIL_FIELD_NUMBER: _ClassVar[int]
    RETRYABLE_FIELD_NUMBER: _ClassVar[int]
    ACTUAL_PAST_LEN_FIELD_NUMBER: _ClassVar[int]
    code: ErrorCode
    detail: str
    retryable: bool
    actual_past_len: int
    def __init__(self, code: _Optional[_Union[ErrorCode, str]] = ..., detail: _Optional[str] = ..., retryable: _Optional[bool] = ..., actual_past_len: _Optional[int] = ...) -> None: ...

class FlowControl(_message.Message):
    __slots__ = ("credits_granted", "max_inflight_chunks", "max_chunk_bytes", "max_prefill_chunk_tokens")
    CREDITS_GRANTED_FIELD_NUMBER: _ClassVar[int]
    MAX_INFLIGHT_CHUNKS_FIELD_NUMBER: _ClassVar[int]
    MAX_CHUNK_BYTES_FIELD_NUMBER: _ClassVar[int]
    MAX_PREFILL_CHUNK_TOKENS_FIELD_NUMBER: _ClassVar[int]
    credits_granted: int
    max_inflight_chunks: int
    max_chunk_bytes: int
    max_prefill_chunk_tokens: int
    def __init__(self, credits_granted: _Optional[int] = ..., max_inflight_chunks: _Optional[int] = ..., max_chunk_bytes: _Optional[int] = ..., max_prefill_chunk_tokens: _Optional[int] = ...) -> None: ...

class SessionOpen(_message.Message):
    __slots__ = ("schema_version", "route_session_id", "route_epoch", "fingerprint", "shard_range", "proposed_flow_control", "accepted_compression")
    SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
    ROUTE_SESSION_ID_FIELD_NUMBER: _ClassVar[int]
    ROUTE_EPOCH_FIELD_NUMBER: _ClassVar[int]
    FINGERPRINT_FIELD_NUMBER: _ClassVar[int]
    SHARD_RANGE_FIELD_NUMBER: _ClassVar[int]
    PROPOSED_FLOW_CONTROL_FIELD_NUMBER: _ClassVar[int]
    ACCEPTED_COMPRESSION_FIELD_NUMBER: _ClassVar[int]
    schema_version: SchemaVersion
    route_session_id: str
    route_epoch: int
    fingerprint: Fingerprint
    shard_range: ShardRange
    proposed_flow_control: FlowControl
    accepted_compression: _containers.RepeatedScalarFieldContainer[Compression]
    def __init__(self, schema_version: _Optional[_Union[SchemaVersion, str]] = ..., route_session_id: _Optional[str] = ..., route_epoch: _Optional[int] = ..., fingerprint: _Optional[_Union[Fingerprint, _Mapping]] = ..., shard_range: _Optional[_Union[ShardRange, _Mapping]] = ..., proposed_flow_control: _Optional[_Union[FlowControl, _Mapping]] = ..., accepted_compression: _Optional[_Iterable[_Union[Compression, str]]] = ...) -> None: ...

class SessionAccepted(_message.Message):
    __slots__ = ("schema_version", "route_session_id", "route_epoch", "flow_control", "accepted_compression", "fingerprint")
    SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
    ROUTE_SESSION_ID_FIELD_NUMBER: _ClassVar[int]
    ROUTE_EPOCH_FIELD_NUMBER: _ClassVar[int]
    FLOW_CONTROL_FIELD_NUMBER: _ClassVar[int]
    ACCEPTED_COMPRESSION_FIELD_NUMBER: _ClassVar[int]
    FINGERPRINT_FIELD_NUMBER: _ClassVar[int]
    schema_version: SchemaVersion
    route_session_id: str
    route_epoch: int
    flow_control: FlowControl
    accepted_compression: _containers.RepeatedScalarFieldContainer[Compression]
    fingerprint: Fingerprint
    def __init__(self, schema_version: _Optional[_Union[SchemaVersion, str]] = ..., route_session_id: _Optional[str] = ..., route_epoch: _Optional[int] = ..., flow_control: _Optional[_Union[FlowControl, _Mapping]] = ..., accepted_compression: _Optional[_Iterable[_Union[Compression, str]]] = ..., fingerprint: _Optional[_Union[Fingerprint, _Mapping]] = ...) -> None: ...

class ActivationChunk(_message.Message):
    __slots__ = ("envelope", "bundle")
    ENVELOPE_FIELD_NUMBER: _ClassVar[int]
    BUNDLE_FIELD_NUMBER: _ClassVar[int]
    envelope: Envelope
    bundle: TensorBundle
    def __init__(self, envelope: _Optional[_Union[Envelope, _Mapping]] = ..., bundle: _Optional[_Union[TensorBundle, _Mapping]] = ...) -> None: ...

class DecodeStep(_message.Message):
    __slots__ = ("idempotency_step", "position", "expected_past_len", "tensor", "work_id", "deadline_unix_nanos", "bundle")
    IDEMPOTENCY_STEP_FIELD_NUMBER: _ClassVar[int]
    POSITION_FIELD_NUMBER: _ClassVar[int]
    EXPECTED_PAST_LEN_FIELD_NUMBER: _ClassVar[int]
    TENSOR_FIELD_NUMBER: _ClassVar[int]
    WORK_ID_FIELD_NUMBER: _ClassVar[int]
    DEADLINE_UNIX_NANOS_FIELD_NUMBER: _ClassVar[int]
    BUNDLE_FIELD_NUMBER: _ClassVar[int]
    idempotency_step: int
    position: int
    expected_past_len: int
    tensor: NamedTensor
    work_id: str
    deadline_unix_nanos: int
    bundle: TensorBundle
    def __init__(self, idempotency_step: _Optional[int] = ..., position: _Optional[int] = ..., expected_past_len: _Optional[int] = ..., tensor: _Optional[_Union[NamedTensor, _Mapping]] = ..., work_id: _Optional[str] = ..., deadline_unix_nanos: _Optional[int] = ..., bundle: _Optional[_Union[TensorBundle, _Mapping]] = ...) -> None: ...

class RequestRecipeIdentity(_message.Message):
    __slots__ = ("request_id", "runtime_recipe_digest", "chat_template_id", "chat_template_version", "reasoning_mode", "architecture")
    REQUEST_ID_FIELD_NUMBER: _ClassVar[int]
    RUNTIME_RECIPE_DIGEST_FIELD_NUMBER: _ClassVar[int]
    CHAT_TEMPLATE_ID_FIELD_NUMBER: _ClassVar[int]
    CHAT_TEMPLATE_VERSION_FIELD_NUMBER: _ClassVar[int]
    REASONING_MODE_FIELD_NUMBER: _ClassVar[int]
    ARCHITECTURE_FIELD_NUMBER: _ClassVar[int]
    request_id: str
    runtime_recipe_digest: str
    chat_template_id: str
    chat_template_version: str
    reasoning_mode: str
    architecture: ArchitectureType
    def __init__(self, request_id: _Optional[str] = ..., runtime_recipe_digest: _Optional[str] = ..., chat_template_id: _Optional[str] = ..., chat_template_version: _Optional[str] = ..., reasoning_mode: _Optional[str] = ..., architecture: _Optional[_Union[ArchitectureType, str]] = ...) -> None: ...

class SamplingParameters(_message.Message):
    __slots__ = ("temperature", "top_p", "top_k", "seed", "greedy")
    TEMPERATURE_FIELD_NUMBER: _ClassVar[int]
    TOP_P_FIELD_NUMBER: _ClassVar[int]
    TOP_K_FIELD_NUMBER: _ClassVar[int]
    SEED_FIELD_NUMBER: _ClassVar[int]
    GREEDY_FIELD_NUMBER: _ClassVar[int]
    temperature: float
    top_p: float
    top_k: int
    seed: int
    greedy: bool
    def __init__(self, temperature: _Optional[float] = ..., top_p: _Optional[float] = ..., top_k: _Optional[int] = ..., seed: _Optional[int] = ..., greedy: _Optional[bool] = ...) -> None: ...

class TailResult(_message.Message):
    __slots__ = ("identity", "sampling", "logits", "sampled_token_id")
    IDENTITY_FIELD_NUMBER: _ClassVar[int]
    SAMPLING_FIELD_NUMBER: _ClassVar[int]
    LOGITS_FIELD_NUMBER: _ClassVar[int]
    SAMPLED_TOKEN_ID_FIELD_NUMBER: _ClassVar[int]
    identity: RequestRecipeIdentity
    sampling: SamplingParameters
    logits: TensorBundle
    sampled_token_id: int
    def __init__(self, identity: _Optional[_Union[RequestRecipeIdentity, _Mapping]] = ..., sampling: _Optional[_Union[SamplingParameters, _Mapping]] = ..., logits: _Optional[_Union[TensorBundle, _Mapping]] = ..., sampled_token_id: _Optional[int] = ...) -> None: ...

class ReleaseSignal(_message.Message):
    __slots__ = ("route_session_id", "route_epoch", "work_id")
    ROUTE_SESSION_ID_FIELD_NUMBER: _ClassVar[int]
    ROUTE_EPOCH_FIELD_NUMBER: _ClassVar[int]
    WORK_ID_FIELD_NUMBER: _ClassVar[int]
    route_session_id: str
    route_epoch: int
    work_id: str
    def __init__(self, route_session_id: _Optional[str] = ..., route_epoch: _Optional[int] = ..., work_id: _Optional[str] = ...) -> None: ...

class CancelSignal(_message.Message):
    __slots__ = ("route_session_id", "route_epoch", "work_id", "reason")
    ROUTE_SESSION_ID_FIELD_NUMBER: _ClassVar[int]
    ROUTE_EPOCH_FIELD_NUMBER: _ClassVar[int]
    WORK_ID_FIELD_NUMBER: _ClassVar[int]
    REASON_FIELD_NUMBER: _ClassVar[int]
    route_session_id: str
    route_epoch: int
    work_id: str
    reason: str
    def __init__(self, route_session_id: _Optional[str] = ..., route_epoch: _Optional[int] = ..., work_id: _Optional[str] = ..., reason: _Optional[str] = ...) -> None: ...

class Ack(_message.Message):
    __slots__ = ("work_id", "idempotency_step", "cache_result", "duplicate", "execution_nanos")
    WORK_ID_FIELD_NUMBER: _ClassVar[int]
    IDEMPOTENCY_STEP_FIELD_NUMBER: _ClassVar[int]
    CACHE_RESULT_FIELD_NUMBER: _ClassVar[int]
    DUPLICATE_FIELD_NUMBER: _ClassVar[int]
    EXECUTION_NANOS_FIELD_NUMBER: _ClassVar[int]
    work_id: str
    idempotency_step: int
    cache_result: CacheResult
    duplicate: bool
    execution_nanos: int
    def __init__(self, work_id: _Optional[str] = ..., idempotency_step: _Optional[int] = ..., cache_result: _Optional[_Union[CacheResult, _Mapping]] = ..., duplicate: _Optional[bool] = ..., execution_nanos: _Optional[int] = ...) -> None: ...

class ShardStatus(_message.Message):
    __slots__ = ("work_id", "route_session_id", "idempotency_step", "error", "terminal")
    WORK_ID_FIELD_NUMBER: _ClassVar[int]
    ROUTE_SESSION_ID_FIELD_NUMBER: _ClassVar[int]
    IDEMPOTENCY_STEP_FIELD_NUMBER: _ClassVar[int]
    ERROR_FIELD_NUMBER: _ClassVar[int]
    TERMINAL_FIELD_NUMBER: _ClassVar[int]
    work_id: str
    route_session_id: str
    idempotency_step: int
    error: ShardError
    terminal: bool
    def __init__(self, work_id: _Optional[str] = ..., route_session_id: _Optional[str] = ..., idempotency_step: _Optional[int] = ..., error: _Optional[_Union[ShardError, _Mapping]] = ..., terminal: _Optional[bool] = ...) -> None: ...

class SessionRequest(_message.Message):
    __slots__ = ("open", "chunk", "decode", "flow_control", "release", "cancel")
    OPEN_FIELD_NUMBER: _ClassVar[int]
    CHUNK_FIELD_NUMBER: _ClassVar[int]
    DECODE_FIELD_NUMBER: _ClassVar[int]
    FLOW_CONTROL_FIELD_NUMBER: _ClassVar[int]
    RELEASE_FIELD_NUMBER: _ClassVar[int]
    CANCEL_FIELD_NUMBER: _ClassVar[int]
    open: SessionOpen
    chunk: ActivationChunk
    decode: DecodeStep
    flow_control: FlowControl
    release: ReleaseSignal
    cancel: CancelSignal
    def __init__(self, open: _Optional[_Union[SessionOpen, _Mapping]] = ..., chunk: _Optional[_Union[ActivationChunk, _Mapping]] = ..., decode: _Optional[_Union[DecodeStep, _Mapping]] = ..., flow_control: _Optional[_Union[FlowControl, _Mapping]] = ..., release: _Optional[_Union[ReleaseSignal, _Mapping]] = ..., cancel: _Optional[_Union[CancelSignal, _Mapping]] = ...) -> None: ...

class SessionResponse(_message.Message):
    __slots__ = ("accepted", "chunk", "ack", "flow_control", "status", "tail_result")
    ACCEPTED_FIELD_NUMBER: _ClassVar[int]
    CHUNK_FIELD_NUMBER: _ClassVar[int]
    ACK_FIELD_NUMBER: _ClassVar[int]
    FLOW_CONTROL_FIELD_NUMBER: _ClassVar[int]
    STATUS_FIELD_NUMBER: _ClassVar[int]
    TAIL_RESULT_FIELD_NUMBER: _ClassVar[int]
    accepted: SessionAccepted
    chunk: ActivationChunk
    ack: Ack
    flow_control: FlowControl
    status: ShardStatus
    tail_result: TailResult
    def __init__(self, accepted: _Optional[_Union[SessionAccepted, _Mapping]] = ..., chunk: _Optional[_Union[ActivationChunk, _Mapping]] = ..., ack: _Optional[_Union[Ack, _Mapping]] = ..., flow_control: _Optional[_Union[FlowControl, _Mapping]] = ..., status: _Optional[_Union[ShardStatus, _Mapping]] = ..., tail_result: _Optional[_Union[TailResult, _Mapping]] = ...) -> None: ...

class CapabilityRequest(_message.Message):
    __slots__ = ("schema_version",)
    SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
    schema_version: SchemaVersion
    def __init__(self, schema_version: _Optional[_Union[SchemaVersion, str]] = ...) -> None: ...

class CapabilityReport(_message.Message):
    __slots__ = ("schema_version", "fingerprint", "shard_range", "backend", "device", "validated", "detail", "max_concurrent_sessions", "max_context_tokens", "flow_control", "accepted_compression", "supported_schema_versions", "validated_at_unix_nanos")
    SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
    FINGERPRINT_FIELD_NUMBER: _ClassVar[int]
    SHARD_RANGE_FIELD_NUMBER: _ClassVar[int]
    BACKEND_FIELD_NUMBER: _ClassVar[int]
    DEVICE_FIELD_NUMBER: _ClassVar[int]
    VALIDATED_FIELD_NUMBER: _ClassVar[int]
    DETAIL_FIELD_NUMBER: _ClassVar[int]
    MAX_CONCURRENT_SESSIONS_FIELD_NUMBER: _ClassVar[int]
    MAX_CONTEXT_TOKENS_FIELD_NUMBER: _ClassVar[int]
    FLOW_CONTROL_FIELD_NUMBER: _ClassVar[int]
    ACCEPTED_COMPRESSION_FIELD_NUMBER: _ClassVar[int]
    SUPPORTED_SCHEMA_VERSIONS_FIELD_NUMBER: _ClassVar[int]
    VALIDATED_AT_UNIX_NANOS_FIELD_NUMBER: _ClassVar[int]
    schema_version: SchemaVersion
    fingerprint: Fingerprint
    shard_range: ShardRange
    backend: str
    device: str
    validated: bool
    detail: str
    max_concurrent_sessions: int
    max_context_tokens: int
    flow_control: FlowControl
    accepted_compression: _containers.RepeatedScalarFieldContainer[Compression]
    supported_schema_versions: _containers.RepeatedScalarFieldContainer[SchemaVersion]
    validated_at_unix_nanos: int
    def __init__(self, schema_version: _Optional[_Union[SchemaVersion, str]] = ..., fingerprint: _Optional[_Union[Fingerprint, _Mapping]] = ..., shard_range: _Optional[_Union[ShardRange, _Mapping]] = ..., backend: _Optional[str] = ..., device: _Optional[str] = ..., validated: _Optional[bool] = ..., detail: _Optional[str] = ..., max_concurrent_sessions: _Optional[int] = ..., max_context_tokens: _Optional[int] = ..., flow_control: _Optional[_Union[FlowControl, _Mapping]] = ..., accepted_compression: _Optional[_Iterable[_Union[Compression, str]]] = ..., supported_schema_versions: _Optional[_Iterable[_Union[SchemaVersion, str]]] = ..., validated_at_unix_nanos: _Optional[int] = ...) -> None: ...

class HealthRequest(_message.Message):
    __slots__ = ("schema_version",)
    SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
    schema_version: SchemaVersion
    def __init__(self, schema_version: _Optional[_Union[SchemaVersion, str]] = ...) -> None: ...

class HealthReport(_message.Message):
    __slots__ = ("schema_version", "state", "active_sessions", "queued_chunks", "batch_occupancy", "kv_pressure", "resident_bytes", "detail")
    SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
    STATE_FIELD_NUMBER: _ClassVar[int]
    ACTIVE_SESSIONS_FIELD_NUMBER: _ClassVar[int]
    QUEUED_CHUNKS_FIELD_NUMBER: _ClassVar[int]
    BATCH_OCCUPANCY_FIELD_NUMBER: _ClassVar[int]
    KV_PRESSURE_FIELD_NUMBER: _ClassVar[int]
    RESIDENT_BYTES_FIELD_NUMBER: _ClassVar[int]
    DETAIL_FIELD_NUMBER: _ClassVar[int]
    schema_version: SchemaVersion
    state: ServingState
    active_sessions: int
    queued_chunks: int
    batch_occupancy: int
    kv_pressure: float
    resident_bytes: int
    detail: str
    def __init__(self, schema_version: _Optional[_Union[SchemaVersion, str]] = ..., state: _Optional[_Union[ServingState, str]] = ..., active_sessions: _Optional[int] = ..., queued_chunks: _Optional[int] = ..., batch_occupancy: _Optional[int] = ..., kv_pressure: _Optional[float] = ..., resident_bytes: _Optional[int] = ..., detail: _Optional[str] = ...) -> None: ...

class ReleaseRequest(_message.Message):
    __slots__ = ("schema_version", "route_session_id", "route_epoch")
    SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
    ROUTE_SESSION_ID_FIELD_NUMBER: _ClassVar[int]
    ROUTE_EPOCH_FIELD_NUMBER: _ClassVar[int]
    schema_version: SchemaVersion
    route_session_id: str
    route_epoch: int
    def __init__(self, schema_version: _Optional[_Union[SchemaVersion, str]] = ..., route_session_id: _Optional[str] = ..., route_epoch: _Optional[int] = ...) -> None: ...

class ReleaseResponse(_message.Message):
    __slots__ = ("released", "error")
    RELEASED_FIELD_NUMBER: _ClassVar[int]
    ERROR_FIELD_NUMBER: _ClassVar[int]
    released: bool
    error: ShardError
    def __init__(self, released: _Optional[bool] = ..., error: _Optional[_Union[ShardError, _Mapping]] = ...) -> None: ...

class CancelRequest(_message.Message):
    __slots__ = ("schema_version", "route_session_id", "route_epoch", "work_id", "reason")
    SCHEMA_VERSION_FIELD_NUMBER: _ClassVar[int]
    ROUTE_SESSION_ID_FIELD_NUMBER: _ClassVar[int]
    ROUTE_EPOCH_FIELD_NUMBER: _ClassVar[int]
    WORK_ID_FIELD_NUMBER: _ClassVar[int]
    REASON_FIELD_NUMBER: _ClassVar[int]
    schema_version: SchemaVersion
    route_session_id: str
    route_epoch: int
    work_id: str
    reason: str
    def __init__(self, schema_version: _Optional[_Union[SchemaVersion, str]] = ..., route_session_id: _Optional[str] = ..., route_epoch: _Optional[int] = ..., work_id: _Optional[str] = ..., reason: _Optional[str] = ...) -> None: ...

class CancelResponse(_message.Message):
    __slots__ = ("cancelled_work_items", "error")
    CANCELLED_WORK_ITEMS_FIELD_NUMBER: _ClassVar[int]
    ERROR_FIELD_NUMBER: _ClassVar[int]
    cancelled_work_items: int
    error: ShardError
    def __init__(self, cancelled_work_items: _Optional[int] = ..., error: _Optional[_Union[ShardError, _Mapping]] = ...) -> None: ...
