syntax = "proto3";

option go_package = "github.com/vercel/turbo/cli/internal/turbodprotocol";

package turbodprotocol;

service Turbod {
  rpc Hello (HelloRequest) returns (HelloResponse);
  rpc Shutdown (ShutdownRequest) returns (ShutdownResponse);
  rpc Status (StatusRequest) returns (StatusResponse);
  // Implement cache watching
  rpc NotifyOutputsWritten (NotifyOutputsWrittenRequest) returns (NotifyOutputsWrittenResponse);
  rpc GetChangedOutputs (GetChangedOutputsRequest) returns (GetChangedOutputsResponse);
}

message HelloRequest {
  string version = 1;
  string session_id = 2;
}

message HelloResponse {}

message ShutdownRequest {}

message ShutdownResponse {}

message StatusRequest {}

message StatusResponse {
  DaemonStatus daemonStatus = 1;
}

message NotifyOutputsWrittenRequest {
  repeated string output_globs = 1;
  string hash = 2;
  repeated string output_exclusion_globs = 3;
}

message NotifyOutputsWrittenResponse {}

message GetChangedOutputsRequest {
  repeated string output_globs = 1;
  string hash = 2;
}

message GetChangedOutputsResponse {
  repeated string changed_output_globs = 1;
}

message DaemonStatus {
  string log_file = 1;
  uint64 uptime_msec = 2;
}
