syntax = "proto3";
package zed.messages;

import "task.proto";

message GetAgentServerCommand {
  uint64 project_id = 1;
  string name = 2;
  optional string root_dir = 3;
}

message GetContextServerCommand {
  uint64 project_id = 1;
  string server_id = 2;
  optional string root_dir = 3;
}

message ContextServerCommand {
  string path = 1;
  repeated string args = 2;
  map<string, string> env = 3;
}

message AgentServerCommand {
  string path = 1;
  repeated string args = 2;
  map<string, string> env = 3;
  string root_dir = 4;

  optional SpawnInTerminal login = 5;
}

message ExternalAgentsUpdated {
  uint64 project_id = 1;
  repeated string names = 2;
}

message ExternalExtensionAgentTarget {
  string archive = 1;
  string cmd = 2;
  repeated string args = 3;
  optional string sha256 = 4;
  map<string, string> env = 5;
}

message ExternalExtensionAgent {
  string name = 1;
  optional string icon_path = 2;
  string extension_id = 3;
  map<string, ExternalExtensionAgentTarget> targets = 4;
  map<string, string> env = 5;
  optional string version = 6;
}

message ExternalExtensionAgentsUpdated {
  uint64 project_id = 1;
  repeated ExternalExtensionAgent agents = 2;
}

message ExternalAgentLoadingStatusUpdated {
  uint64 project_id = 1;
  string name = 2;
  reserved 3;
}

message NewExternalAgentVersionAvailable {
  uint64 project_id = 1;
  string name = 2;
  string version = 3;
}

message ShareAgentThread {
  string session_id = 1; // Client-generated UUID (acp::SessionId)
  string title = 2;
  bytes thread_data = 3;
}

message GetSharedAgentThread {
  string session_id = 1; // UUID string
}

message GetSharedAgentThreadResponse {
  string title = 1;
  bytes thread_data = 2;
  string sharer_username = 3;
  string created_at = 4;
}
