64 lines
1.6 KiB
Python
64 lines
1.6 KiB
Python
"""The native Shard protocol: Protobuf over gRPC/HTTP2 (ADR-0020).
|
|
|
|
`packages/node/native/proto/shard_runtime.proto` is the contract. This package
|
|
is how Python speaks it: the generated stubs plus the validation, framing and
|
|
chunking rules that the stubs cannot express.
|
|
|
|
Import the message types from here rather than reaching into `.generated`, so
|
|
the location of build output stays an implementation detail::
|
|
|
|
from meshnet_node.native_protocol import pb, encode_tensor, decode_bundle
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .generated import shard_runtime_pb2 as pb
|
|
from .codec import (
|
|
BUNDLE_VERSION,
|
|
DEFAULT_MAX_CHUNK_BYTES,
|
|
DEFAULT_MAX_FRAGMENT_BYTES,
|
|
DEFAULT_MAX_INFLIGHT_CHUNKS,
|
|
DEFAULT_MAX_PREFILL_CHUNK_TOKENS,
|
|
HIDDEN_STATES,
|
|
SCHEMA_VERSION,
|
|
PayloadCorrupt,
|
|
PrefillChunk,
|
|
ProtocolError,
|
|
checksum_of,
|
|
crc32c,
|
|
decode_bundle,
|
|
decode_tensor,
|
|
default_flow_control,
|
|
encode_bundle,
|
|
encode_tensor,
|
|
expected_bytes,
|
|
itemsize,
|
|
negotiate_flow_control,
|
|
plan_prefill_chunks,
|
|
)
|
|
|
|
__all__ = [
|
|
"BUNDLE_VERSION",
|
|
"DEFAULT_MAX_CHUNK_BYTES",
|
|
"DEFAULT_MAX_FRAGMENT_BYTES",
|
|
"DEFAULT_MAX_INFLIGHT_CHUNKS",
|
|
"DEFAULT_MAX_PREFILL_CHUNK_TOKENS",
|
|
"HIDDEN_STATES",
|
|
"SCHEMA_VERSION",
|
|
"PayloadCorrupt",
|
|
"PrefillChunk",
|
|
"ProtocolError",
|
|
"checksum_of",
|
|
"crc32c",
|
|
"decode_bundle",
|
|
"decode_tensor",
|
|
"default_flow_control",
|
|
"encode_bundle",
|
|
"encode_tensor",
|
|
"expected_bytes",
|
|
"itemsize",
|
|
"negotiate_flow_control",
|
|
"pb",
|
|
"plan_prefill_chunks",
|
|
]
|