Files
enkly-ai/api/proto/conversation/v1/conversation.proto
enkly 79ce8dc4c0
Some checks failed
Go CI Pipeline / build_and_test (push) Failing after 22m0s
Init Project
2026-10-30 18:06:55 +01:00

137 lines
3.4 KiB
Protocol Buffer

// Package conversation is the Conversation bounded context: chat threads
// and their messages/tool-call audit log. System of record for
// `conversations`, `messages` and `tool_calls` (see
// services/conversation/migrations/0001_init.sql).
//
// Mirrors internal/db/conversations.go, called both by the gateway
// (listing/renaming/deleting threads, loading history to render) and by
// the agent service (appending messages as a run proceeds).
syntax = "proto3";
package enkly.conversation.v1;
option go_package = "enkly/gen/conversation/v1;conversationv1";
import "google/protobuf/timestamp.proto";
service ConversationService {
rpc CreateConversation(CreateConversationRequest) returns (Conversation);
rpc GetConversation(GetConversationRequest) returns (Conversation);
rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse);
rpc MostRecentConversation(MostRecentConversationRequest) returns (Conversation);
rpc RenameConversation(RenameConversationRequest) returns (Conversation);
// AutoTitleConversation replaces db.AutoTitleConversation: sets the
// title from the first prompt only if the conversation still has the
// default title (returns retitled=true when it actually changed it).
rpc AutoTitleConversation(AutoTitleConversationRequest) returns (AutoTitleConversationResponse);
rpc DeleteConversation(DeleteConversationRequest) returns (DeleteConversationResponse);
rpc CountMessages(CountMessagesRequest) returns (CountMessagesResponse);
rpc AddMessage(AddMessageRequest) returns (Message);
rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse);
rpc AddToolCall(AddToolCallRequest) returns (AddToolCallResponse);
}
message Conversation {
int64 id = 1;
int64 user_id = 2;
string title = 3;
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp last_message_at = 5;
}
enum Role {
ROLE_UNSPECIFIED = 0;
ROLE_USER = 1;
ROLE_ASSISTANT = 2;
ROLE_SYSTEM = 3;
ROLE_TOOL = 4;
}
message Message {
int64 id = 1;
int64 conversation_id = 2;
Role role = 3;
string content = 4;
string tool_name = 5;
google.protobuf.Timestamp created_at = 6;
}
message CreateConversationRequest {
int64 user_id = 1;
string title = 2;
}
message GetConversationRequest {
int64 user_id = 1;
int64 conversation_id = 2;
}
message ListConversationsRequest {
int64 user_id = 1;
}
message ListConversationsResponse {
repeated Conversation conversations = 1;
}
message MostRecentConversationRequest {
int64 user_id = 1;
}
message RenameConversationRequest {
int64 user_id = 1;
int64 conversation_id = 2;
string title = 3;
}
message AutoTitleConversationRequest {
int64 user_id = 1;
int64 conversation_id = 2;
string title = 3;
}
message AutoTitleConversationResponse {
bool retitled = 1;
}
message DeleteConversationRequest {
int64 user_id = 1;
int64 conversation_id = 2;
}
message DeleteConversationResponse {}
message CountMessagesRequest {
int64 conversation_id = 1;
}
message CountMessagesResponse {
int32 count = 1;
}
message AddMessageRequest {
int64 conversation_id = 1;
Role role = 2;
string content = 3;
string tool_name = 4;
}
message ListMessagesRequest {
int64 conversation_id = 1;
}
message ListMessagesResponse {
repeated Message messages = 1;
}
message AddToolCallRequest {
int64 message_id = 1;
string tool_name = 2;
string arguments_json = 3;
string result = 4;
bool is_error = 5;
}
message AddToolCallResponse {}