Files
leleka/crates/runtime-client/proto/runtime.proto
T
Pavlo RatushnyiandClaude Sonnet 5.5 60b48d8225 runtime reconfiguration: reopen the serve stack with new context/cache/resource settings without reloading the model
serve_tuning (settings document, validation, effective settings), Command::Reconfigure in the Original serve loop with rollback,
Backend::reconfigure, gRPC Runtime.Reconfigure, POST /v1/reconfigure, telemetry.settings; tests for each layer.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:01:53 +01:00

113 lines
5.6 KiB
Protocol Buffer

syntax = "proto3";
package leleka.runtime.v1;
// Separate inference-process contract; strata.node.v1 is unchanged.
service Runtime {
rpc Handshake(Hello) returns (.leleka.runtime.v1.Snapshot);
rpc Snapshot(Empty) returns (.leleka.runtime.v1.Snapshot);
rpc Watch(Cursor) returns (stream .leleka.runtime.v1.Snapshot);
rpc Load(LoadRequest) returns (OperationResult);
rpc Unload(UnloadRequest) returns (OperationResult);
rpc Operation(OperationQuery) returns (OperationResult);
rpc Generate(GenerateRequest) returns (stream GenerationFrame);
rpc Cancel(CancelRequest) returns (CancelAck);
// Change the inference settings of the loaded model at run time (the serve stack is reopened, the weights stay): context, caches, resources.
rpc Reconfigure(ReconfigureRequest) returns (ReconfigureReply);
}
message Empty {}
message Hello { uint32 protocol_version = 1; uint32 backend_api_version = 2; }
message Cursor { string epoch = 1; uint64 sequence = 2; }
message ModelDescriptor {
string family = 1;
string architecture = 2;
string artifact_digest = 3;
string weight_format = 4;
}
message NativeMode {}
message KarPleMode { string profile_id = 1; }
message MtpMode { string profile_id = 1; }
message KarExpertsMode {
string bundle_directory = 1; string archive_file = 2;
string binding_file = 3; string provenance_file = 4;
uint32 levels = 5; uint32 cache_mib = 6;
enum Prefill { UNSPECIFIED = 0; DECODE_ONLY = 1; ALL_ROUTED_BATCHED = 2; }
Prefill prefill_mode = 7;
}
message InferenceMode {
oneof selection { NativeMode native = 1; KarPleMode kar_ple = 2; KarExpertsMode kar_experts = 3; MtpMode mtp = 4; }
}
message LoadConfig {
uint32 version = 1; InferenceMode mode = 2;
optional uint64 gpu_memory_limit_bytes = 3; bool allow_experimental = 4;
}
message LoadedModel {
string handle = 1; ModelDescriptor descriptor = 2;
uint32 load_config_version = 3; InferenceMode effective_mode = 4;
string mode_identity_digest = 5;
}
message SupportedModelTuple { string family = 1; string architecture = 2; string weight_format = 3; }
message Capabilities {
repeated SupportedModelTuple models = 1;
uint32 max_concurrent_generations = 2;
bool cancellation = 3; bool tool_call_streaming = 4;
}
message Snapshot {
uint32 protocol_version = 1; uint32 backend_api_version = 2;
string epoch = 3; uint64 sequence = 4; bool full_snapshot = 5;
bool transport_ready = 6; bool model_ready = 7;
LoadedModel loaded = 8; Capabilities capabilities = 9;
string active_request_id = 10;
// JSON pool summary of the runtime's cross-session prefix cache (docs/prefix-cache.md), empty when it has none.
string prefix_cache_json = 11;
// JSON report of the runtime's memory governor (docs/memory-safety.md): pressure level, Retry-After, plan, inventory, counters. Empty when it has none.
string memory_json = 12;
// JSON telemetry of the runtime for the operator (leleka-memory telemetry): GPU load and VRAM, host RAM, CPU cores in use, prefill and decode tokens/s, prefix-cache hits, context in use. Empty when it has none.
string telemetry_json = 13;
}
message LoadRequest { string operation_id = 1; string expected_epoch = 2; ModelDescriptor model = 3; LoadConfig config = 4; }
message UnloadRequest { string operation_id = 1; string expected_epoch = 2; string handle = 3; }
message OperationQuery { string operation_id = 1; string expected_epoch = 2; }
message OperationResult {
string operation_id = 1; string epoch = 2;
enum State { UNSPECIFIED = 0; ACCEPTED = 1; COMPLETED = 2; FAILED = 3; INDETERMINATE = 4; }
State state = 3; string reason = 4; LoadedModel loaded = 5;
}
message GenerateRequest {
string request_id = 1; string expected_epoch = 2; string handle = 3;
string prompt = 4; uint32 max_output_tokens = 5; uint32 temperature_milli = 6;
// Remaining Original sampling controls (fixed point; an absent field keeps the Original's default).
// top_p/min_p/repetition_penalty are millionths, frequency/presence penalties signed millionths;
// top_k 0 or above 64 selects the widest list; seed absent or 0 draws a fresh seed per request.
optional uint32 top_p_micro = 7;
optional uint32 top_k = 8;
optional uint32 min_p_micro = 9;
optional uint32 repetition_penalty_micro = 10;
optional sint32 frequency_penalty_micro = 11;
optional sint32 presence_penalty_micro = 12;
optional uint32 penalty_last_n = 13;
optional uint64 seed = 14;
}
message ReconfigureRequest { string operation_id = 1; string expected_epoch = 2; string settings_json = 3; }
message ReconfigureReply {
string operation_id = 1; string epoch = 2;
bool ok = 3;
string effective_json = 4; // the settings the engine runs with now (also after a refusal: the previous ones)
string error_code = 5; // invalid | unavailable | exhausted | unsupported | internal
string error = 6; bool retryable = 7;
}
message CancelRequest { string request_id = 1; string expected_epoch = 2; }
message CancelAck { string request_id = 1; string epoch = 2; bool acknowledged = 3; }
message Accepted { bool accepted = 1; }
message TextDelta { string text = 1; }
message ToolCallDelta { uint32 index = 1; optional string id = 2; optional string name = 3; string arguments_delta = 4; }
message Usage { uint64 input_tokens = 1; uint64 output_tokens = 2; uint64 reused_input_tokens = 3; }
message Terminal {
enum State { UNSPECIFIED = 0; COMPLETED = 1; FAILED = 2; CANCELLED = 3; }
State state = 1; string reason = 2; Usage usage = 3;
string error_code = 4; bool retryable = 5;
}
message GenerationFrame {
string request_id = 1; string epoch = 2; uint64 sequence = 3;
oneof payload { Accepted accepted = 4; TextDelta text = 5; ToolCallDelta tool = 6; Usage usage = 7; Terminal terminal = 8; }
}