Current section

Files

Jump to
snakepit priv proto snakepit.proto
Raw

priv/proto/snakepit.proto

syntax = "proto3";
package snakepit;
// Core gRPC bridge service for external process communication
service SnakepitBridge {
// Simple request/response (existing functionality)
rpc Execute(ExecuteRequest) returns (ExecuteResponse);
// Server streaming (new: progressive results)
rpc ExecuteStream(ExecuteRequest) returns (stream StreamResponse);
// Session management
rpc ExecuteInSession(SessionRequest) returns (ExecuteResponse);
rpc ExecuteInSessionStream(SessionRequest) returns (stream StreamResponse);
// Health check
rpc Health(HealthRequest) returns (HealthResponse);
// Worker info and capabilities
rpc GetInfo(InfoRequest) returns (InfoResponse);
}
// Basic execution request
message ExecuteRequest {
string command = 1;
map<string, bytes> args = 2; // Use bytes for flexibility with binary data
int32 timeout_ms = 3;
string request_id = 4; // Optional request tracking
}
// Basic execution response
message ExecuteResponse {
bool success = 1;
map<string, bytes> result = 2;
string error = 3;
int64 timestamp = 4;
string request_id = 5;
}
// Streaming response chunk
message StreamResponse {
bool is_final = 1;
map<string, bytes> chunk = 2;
string error = 3;
int64 timestamp = 4;
string request_id = 5;
int32 chunk_index = 6; // For ordering
}
// Session-based execution request
message SessionRequest {
string session_id = 1;
string command = 2;
map<string, bytes> args = 3;
int32 timeout_ms = 4;
string request_id = 5;
}
// Health check request
message HealthRequest {
string worker_id = 1; // Optional worker identification
}
// Health check response
message HealthResponse {
bool healthy = 1;
string worker_id = 2;
int64 uptime_ms = 3;
int64 total_requests = 4;
int64 total_errors = 5;
string version = 6;
}
// Worker info request
message InfoRequest {
bool include_capabilities = 1;
bool include_stats = 2;
}
// Worker info response
message InfoResponse {
string worker_type = 1; // "python", "javascript", etc.
string version = 2;
repeated string supported_commands = 3;
map<string, string> capabilities = 4; // Key-value capabilities
WorkerStats stats = 5;
map<string, string> system_info = 6;
}
// Worker statistics
message WorkerStats {
int64 requests_handled = 1;
int64 requests_failed = 2;
int64 uptime_ms = 3;
int64 memory_usage_bytes = 4;
double cpu_usage_percent = 5;
int64 active_sessions = 6;
}