syntax = "proto3";

package moby.buildkit.v1;

// Minimal definitions for decoding BuildKit status messages
// Based on https://github.com/moby/buildkit/blob/master/api/services/control/control.proto
// Related to https://github.com/moby/buildkit/blob/master/solver/pb/ops.proto (vertices map to the solver op DAG)

message StatusResponse {
  repeated Vertex vertexes = 1;
  repeated VertexStatus statuses = 2;
  repeated VertexLog logs = 3;
  repeated VertexWarning warnings = 4;
}

message Vertex {
  string digest = 1;
  repeated string inputs = 2;
  string name = 3;
  bool cached = 4;
  Timestamp started = 5;
  Timestamp completed = 6;
  string error = 7;
  ProgressGroup progressGroup = 8;
}

message VertexStatus {
  string ID = 1;
  string vertex = 2;
  string name = 3;
  int64 current = 4;
  int64 total = 5;
  Timestamp timestamp = 6;
  Timestamp started = 7;
  Timestamp completed = 8;
}

message VertexLog {
  string vertex = 1;
  Timestamp timestamp = 2;
  int64 stream = 3;
  bytes msg = 4;
}

message VertexWarning {
  string vertex = 1;
  int64 level = 2;
  bytes short = 3;
  repeated bytes detail = 4;
  string url = 5;
  SourceInfo info = 6;
  repeated Range ranges = 7;
}

message ProgressGroup {
  string id = 1;
  string name = 2;
  bool weak = 3;
}

// Simplified Timestamp to match google.protobuf.Timestamp wire format
message Timestamp {
  int64 seconds = 1;
  int32 nanos = 2;
}

message SourceInfo {
  string filename = 1;
  bytes data = 2;
  // definition and language fields omitted - not needed for log decoding
}

message Range {
  Position start = 1;
  Position end = 2;
}

message Position {
  int32 line = 1;
  int32 character = 2;
}
