syntax = "proto3"; package homelab.v1; option go_package = "pwa-homelab-mon/gen/homelab/v1;homelabv1"; message Item { string name = 1; int32 args = 4; // exec: arg count repeated string arg_types = 5; // exec: text | number per arg } message Stat { string name = 1; string value = 2; } // Карточка монитора: проценты (-1 = скрипт не дал процент) + строки для подписей. // percentages[0] — основной (большой radial), дальше — дополнительные (per-core и т.п.). message Monitor { string name = 1; int32 percentage = 2; repeated Stat stats = 3; repeated int32 percentages = 4; } message Link { string name = 1; string url = 2; } message ListContentRequest {} message ListContentResponse { repeated Link links = 1; repeated Monitor monitors = 2; repeated Item exec = 3; repeated Service services = 4; } message DocMeta { string name = 1; string hash = 2; // sha256 hex of content } message ListDocsRequest {} message ListDocsResponse { repeated DocMeta docs = 1; } message GetDocRequest { string name = 1; } message GetDocResponse { string content = 1; } message SaveDocRequest { string name = 1; string content = 2; } message SaveDocResponse { string hash = 1; } // One card in the Services view: a systemd user unit or a docker compose project. enum ServiceKind { SYSTEMD = 0; DOCKER = 1; } message Service { ServiceKind kind = 1; string name = 2; // unit name without .service / compose project name (or container name if unlabeled) string state = 3; // systemd: ActiveState. docker: active | partial | inactive string substate = 4; // systemd: SubState. docker: "up/total" string load_state = 5; // systemd only: loaded | not-found (= disabled by the user, not an error) string unit_file_state = 6; // systemd only: enabled | disabled | static repeated string containers = 7; // docker only: containers the card controls string error = 8; // probe failure, empty = ok } enum ServiceOp { START = 0; STOP = 1; RESTART = 2; } message ServiceActionRequest { string name = 1; ServiceKind kind = 2; ServiceOp op = 3; } message ServiceActionResponse { string output = 1; } message ServiceInfoRequest { string name = 1; ServiceKind kind = 2; } message ServiceInfoResponse { string output = 1; } service HomelabService { rpc ListContent(ListContentRequest) returns (ListContentResponse); rpc ListDocs(ListDocsRequest) returns (ListDocsResponse); rpc GetDoc(GetDocRequest) returns (GetDocResponse); rpc SaveDoc(SaveDocRequest) returns (SaveDocResponse); rpc ServiceAction(ServiceActionRequest) returns (ServiceActionResponse); rpc ServiceInfo(ServiceInfoRequest) returns (ServiceInfoResponse); rpc RunScript(RunScriptRequest) returns (RunScriptResponse); } message RunScriptRequest { string name = 1; repeated string args = 2; } message RunScriptResponse { string output = 1; }