dotfiles/proto/agent.proto
2023-12-16 22:59:19 +02:00

92 lines
1.8 KiB
Protocol Buffer

syntax = "proto3";
import "google/protobuf/empty.proto";
package prymn;
message SystemHealth {
// Comma-separated statuses
string status = 1;
}
message TaskHealth {
string started_on = 1;
float progress = 2;
}
message HealthResponse {
string version = 1;
SystemHealth system = 2;
map<string, TaskHealth> tasks = 3;
}
message SysInfoResponse {
message Cpu {
uint64 freq_mhz = 1;
float usage = 2;
}
message Disk {
string name = 1;
uint64 total_bytes = 2;
uint64 avail_bytes = 3;
string mount_point = 4;
}
uint64 uptime = 1;
string hostname = 2;
string os = 3;
uint64 mem_total_bytes = 4;
uint64 mem_avail_bytes = 5;
uint64 swap_total_bytes = 6;
uint64 swap_free_bytes = 7;
repeated Cpu cpus = 8;
repeated Disk disks = 9;
uint32 updates_available = 10;
}
message ExecRequest {
string user = 1;
string program = 2;
repeated string args = 3;
}
message ExecResponse {
oneof out {
string stdout = 1;
string stderr = 2;
string error = 3;
int32 exit_code = 4;
}
}
message SysUpdateRequest {
bool dry_run = 1;
}
message SysUpdateResponse {
string output = 1;
int32 progress = 2;
}
message TerminalRequest {
message Resize {
uint32 rows = 1;
uint32 cols = 2;
}
bytes input = 1;
optional Resize resize = 2;
}
message TerminalResponse {
bytes output = 1;
}
service Agent {
rpc Health(google.protobuf.Empty) returns (stream HealthResponse);
rpc Exec(ExecRequest) returns (stream ExecResponse);
rpc Terminal(stream TerminalRequest) returns (stream TerminalResponse);
rpc GetSysInfo(google.protobuf.Empty) returns (SysInfoResponse);
rpc SysUpdate(SysUpdateRequest) returns (stream SysUpdateResponse);
}