diff --git a/chat.pb.go b/chat.pb.go index dfd71ef..2555a37 100644 --- a/chat.pb.go +++ b/chat.pb.go @@ -217,7 +217,7 @@ type Message struct { ReplyToMessageId *string `protobuf:"bytes,8,opt,name=reply_to_message_id,json=replyToMessageId,proto3,oneof" json:"reply_to_message_id,omitempty"` // parent message when this is a reply RootMessageId string `protobuf:"bytes,9,opt,name=root_message_id,json=rootMessageId,proto3" json:"root_message_id,omitempty"` // root of the reply chain (== id for non-replies) ReplyDepth int32 `protobuf:"varint,10,opt,name=reply_depth,json=replyDepth,proto3" json:"reply_depth,omitempty"` // 0 for non-replies, parent depth + 1 for replies; hard max 20 - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // original creation time; age = now - created_at unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -689,6 +689,76 @@ func (x *PostMessageRequest) GetIdempotencyKey() string { return "" } +type AgentPostMessageRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + TopicId string `protobuf:"bytes,1,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"` + Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + ReplyToMessageId *string `protobuf:"bytes,3,opt,name=reply_to_message_id,json=replyToMessageId,proto3,oneof" json:"reply_to_message_id,omitempty"` + // Mandatory: retrying with the same key returns the original message + // (duplicated=true) instead of creating a duplicate. + IdempotencyKey string `protobuf:"bytes,4,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AgentPostMessageRequest) Reset() { + *x = AgentPostMessageRequest{} + mi := &file_chat_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AgentPostMessageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AgentPostMessageRequest) ProtoMessage() {} + +func (x *AgentPostMessageRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AgentPostMessageRequest.ProtoReflect.Descriptor instead. +func (*AgentPostMessageRequest) Descriptor() ([]byte, []int) { + return file_chat_proto_rawDescGZIP(), []int{8} +} + +func (x *AgentPostMessageRequest) GetTopicId() string { + if x != nil { + return x.TopicId + } + return "" +} + +func (x *AgentPostMessageRequest) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *AgentPostMessageRequest) GetReplyToMessageId() string { + if x != nil && x.ReplyToMessageId != nil { + return *x.ReplyToMessageId + } + return "" +} + +func (x *AgentPostMessageRequest) GetIdempotencyKey() string { + if x != nil { + return x.IdempotencyKey + } + return "" +} + type PostMessageResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` @@ -699,7 +769,7 @@ type PostMessageResponse struct { func (x *PostMessageResponse) Reset() { *x = PostMessageResponse{} - mi := &file_chat_proto_msgTypes[8] + mi := &file_chat_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -711,7 +781,7 @@ func (x *PostMessageResponse) String() string { func (*PostMessageResponse) ProtoMessage() {} func (x *PostMessageResponse) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[8] + mi := &file_chat_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -724,7 +794,7 @@ func (x *PostMessageResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PostMessageResponse.ProtoReflect.Descriptor instead. func (*PostMessageResponse) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{8} + return file_chat_proto_rawDescGZIP(), []int{9} } func (x *PostMessageResponse) GetMessage() *Message { @@ -750,7 +820,7 @@ type GetMessageRequest struct { func (x *GetMessageRequest) Reset() { *x = GetMessageRequest{} - mi := &file_chat_proto_msgTypes[9] + mi := &file_chat_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -762,7 +832,7 @@ func (x *GetMessageRequest) String() string { func (*GetMessageRequest) ProtoMessage() {} func (x *GetMessageRequest) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[9] + mi := &file_chat_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -775,7 +845,7 @@ func (x *GetMessageRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetMessageRequest.ProtoReflect.Descriptor instead. func (*GetMessageRequest) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{9} + return file_chat_proto_rawDescGZIP(), []int{10} } func (x *GetMessageRequest) GetMessageId() string { @@ -802,7 +872,7 @@ type HistoryRequest struct { func (x *HistoryRequest) Reset() { *x = HistoryRequest{} - mi := &file_chat_proto_msgTypes[10] + mi := &file_chat_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -814,7 +884,7 @@ func (x *HistoryRequest) String() string { func (*HistoryRequest) ProtoMessage() {} func (x *HistoryRequest) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[10] + mi := &file_chat_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -827,7 +897,7 @@ func (x *HistoryRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use HistoryRequest.ProtoReflect.Descriptor instead. func (*HistoryRequest) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{10} + return file_chat_proto_rawDescGZIP(), []int{11} } func (x *HistoryRequest) GetTopicId() string { @@ -869,7 +939,7 @@ type HistoryResponse struct { func (x *HistoryResponse) Reset() { *x = HistoryResponse{} - mi := &file_chat_proto_msgTypes[11] + mi := &file_chat_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -881,7 +951,7 @@ func (x *HistoryResponse) String() string { func (*HistoryResponse) ProtoMessage() {} func (x *HistoryResponse) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[11] + mi := &file_chat_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -894,7 +964,7 @@ func (x *HistoryResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use HistoryResponse.ProtoReflect.Descriptor instead. func (*HistoryResponse) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{11} + return file_chat_proto_rawDescGZIP(), []int{12} } func (x *HistoryResponse) GetMessages() []*Message { @@ -913,15 +983,14 @@ func (x *HistoryResponse) GetHasMore() bool { type SubscribeRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` // stable identity of the consumer/agent - TopicId string `protobuf:"bytes,2,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"` + TopicId string `protobuf:"bytes,1,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *SubscribeRequest) Reset() { *x = SubscribeRequest{} - mi := &file_chat_proto_msgTypes[12] + mi := &file_chat_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -933,7 +1002,7 @@ func (x *SubscribeRequest) String() string { func (*SubscribeRequest) ProtoMessage() {} func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[12] + mi := &file_chat_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -946,14 +1015,7 @@ func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead. func (*SubscribeRequest) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{12} -} - -func (x *SubscribeRequest) GetConsumerId() string { - if x != nil { - return x.ConsumerId - } - return "" + return file_chat_proto_rawDescGZIP(), []int{13} } func (x *SubscribeRequest) GetTopicId() string { @@ -963,18 +1025,90 @@ func (x *SubscribeRequest) GetTopicId() string { return "" } +// DeliveryMessage wraps one delivered message with delivery metadata. +// message.created_at is always the original creation time; replay + the +// timestamp let the SDK decide how to treat a delivery. +type DeliveryMessage struct { + state protoimpl.MessageState `protogen:"open.v1"` + Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + // true when the message was committed BEFORE this subscription started + // (backlog catch-up after connect/reconnect); false for messages committed + // while this subscription is live. + Replay bool `protobuf:"varint,2,opt,name=replay,proto3" json:"replay,omitempty"` + // Opaque id of the current subscription, generated by the server per + // Subscribe stream. MUST be echoed in Acknowledge; a stale id (from a + // replaced/closed stream) is rejected. + SubscriptionId string `protobuf:"bytes,3,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeliveryMessage) Reset() { + *x = DeliveryMessage{} + mi := &file_chat_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeliveryMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeliveryMessage) ProtoMessage() {} + +func (x *DeliveryMessage) ProtoReflect() protoreflect.Message { + mi := &file_chat_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeliveryMessage.ProtoReflect.Descriptor instead. +func (*DeliveryMessage) Descriptor() ([]byte, []int) { + return file_chat_proto_rawDescGZIP(), []int{14} +} + +func (x *DeliveryMessage) GetMessage() *Message { + if x != nil { + return x.Message + } + return nil +} + +func (x *DeliveryMessage) GetReplay() bool { + if x != nil { + return x.Replay + } + return false +} + +func (x *DeliveryMessage) GetSubscriptionId() string { + if x != nil { + return x.SubscriptionId + } + return "" +} + type AcknowledgeRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` - TopicId string `protobuf:"bytes,2,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"` - LastAckSequence int64 `protobuf:"varint,3,opt,name=last_ack_sequence,json=lastAckSequence,proto3" json:"last_ack_sequence,omitempty"` // highest sequence processed by the consumer - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + TopicId string `protobuf:"bytes,1,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"` + // Highest sequence fully processed by the consumer (cumulative ack). + LastAckSequence int64 `protobuf:"varint,2,opt,name=last_ack_sequence,json=lastAckSequence,proto3" json:"last_ack_sequence,omitempty"` + // The subscription_id of the stream that delivered the message. Must be + // the CURRENT active subscription of this consumer in this topic. + SubscriptionId string `protobuf:"bytes,3,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AcknowledgeRequest) Reset() { *x = AcknowledgeRequest{} - mi := &file_chat_proto_msgTypes[13] + mi := &file_chat_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -986,7 +1120,7 @@ func (x *AcknowledgeRequest) String() string { func (*AcknowledgeRequest) ProtoMessage() {} func (x *AcknowledgeRequest) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[13] + mi := &file_chat_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -999,14 +1133,7 @@ func (x *AcknowledgeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AcknowledgeRequest.ProtoReflect.Descriptor instead. func (*AcknowledgeRequest) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{13} -} - -func (x *AcknowledgeRequest) GetConsumerId() string { - if x != nil { - return x.ConsumerId - } - return "" + return file_chat_proto_rawDescGZIP(), []int{15} } func (x *AcknowledgeRequest) GetTopicId() string { @@ -1023,6 +1150,13 @@ func (x *AcknowledgeRequest) GetLastAckSequence() int64 { return 0 } +func (x *AcknowledgeRequest) GetSubscriptionId() string { + if x != nil { + return x.SubscriptionId + } + return "" +} + type AcknowledgeResponse struct { state protoimpl.MessageState `protogen:"open.v1"` LastAckSequence int64 `protobuf:"varint,1,opt,name=last_ack_sequence,json=lastAckSequence,proto3" json:"last_ack_sequence,omitempty"` // the cursor as stored (never lower than before) @@ -1032,7 +1166,7 @@ type AcknowledgeResponse struct { func (x *AcknowledgeResponse) Reset() { *x = AcknowledgeResponse{} - mi := &file_chat_proto_msgTypes[14] + mi := &file_chat_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1044,7 +1178,7 @@ func (x *AcknowledgeResponse) String() string { func (*AcknowledgeResponse) ProtoMessage() {} func (x *AcknowledgeResponse) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[14] + mi := &file_chat_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1057,7 +1191,7 @@ func (x *AcknowledgeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AcknowledgeResponse.ProtoReflect.Descriptor instead. func (*AcknowledgeResponse) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{14} + return file_chat_proto_rawDescGZIP(), []int{16} } func (x *AcknowledgeResponse) GetLastAckSequence() int64 { @@ -1119,6 +1253,12 @@ const file_chat_proto_rawDesc = "" + "\acontent\x18\x05 \x01(\tR\acontent\x122\n" + "\x13reply_to_message_id\x18\x06 \x01(\tH\x00R\x10replyToMessageId\x88\x01\x01\x12'\n" + "\x0fidempotency_key\x18\a \x01(\tR\x0eidempotencyKeyB\x16\n" + + "\x14_reply_to_message_id\"\xc3\x01\n" + + "\x17AgentPostMessageRequest\x12\x19\n" + + "\btopic_id\x18\x01 \x01(\tR\atopicId\x12\x18\n" + + "\acontent\x18\x02 \x01(\tR\acontent\x122\n" + + "\x13reply_to_message_id\x18\x03 \x01(\tH\x00R\x10replyToMessageId\x88\x01\x01\x12'\n" + + "\x0fidempotency_key\x18\x04 \x01(\tR\x0eidempotencyKeyB\x16\n" + "\x14_reply_to_message_id\"^\n" + "\x13PostMessageResponse\x12'\n" + "\amessage\x18\x01 \x01(\v2\r.chat.MessageR\amessage\x12\x1e\n" + @@ -1135,16 +1275,17 @@ const file_chat_proto_rawDesc = "" + "\x05limit\x18\x04 \x01(\x05R\x05limit\"W\n" + "\x0fHistoryResponse\x12)\n" + "\bmessages\x18\x01 \x03(\v2\r.chat.MessageR\bmessages\x12\x19\n" + - "\bhas_more\x18\x02 \x01(\bR\ahasMore\"N\n" + - "\x10SubscribeRequest\x12\x1f\n" + - "\vconsumer_id\x18\x01 \x01(\tR\n" + - "consumerId\x12\x19\n" + - "\btopic_id\x18\x02 \x01(\tR\atopicId\"|\n" + - "\x12AcknowledgeRequest\x12\x1f\n" + - "\vconsumer_id\x18\x01 \x01(\tR\n" + - "consumerId\x12\x19\n" + - "\btopic_id\x18\x02 \x01(\tR\atopicId\x12*\n" + - "\x11last_ack_sequence\x18\x03 \x01(\x03R\x0flastAckSequence\"A\n" + + "\bhas_more\x18\x02 \x01(\bR\ahasMore\"-\n" + + "\x10SubscribeRequest\x12\x19\n" + + "\btopic_id\x18\x01 \x01(\tR\atopicId\"{\n" + + "\x0fDeliveryMessage\x12'\n" + + "\amessage\x18\x01 \x01(\v2\r.chat.MessageR\amessage\x12\x16\n" + + "\x06replay\x18\x02 \x01(\bR\x06replay\x12'\n" + + "\x0fsubscription_id\x18\x03 \x01(\tR\x0esubscriptionId\"\x84\x01\n" + + "\x12AcknowledgeRequest\x12\x19\n" + + "\btopic_id\x18\x01 \x01(\tR\atopicId\x12*\n" + + "\x11last_ack_sequence\x18\x02 \x01(\x03R\x0flastAckSequence\x12'\n" + + "\x0fsubscription_id\x18\x03 \x01(\tR\x0esubscriptionId\"A\n" + "\x13AcknowledgeResponse\x12*\n" + "\x11last_ack_sequence\x18\x01 \x01(\x03R\x0flastAckSequence*\x8c\x01\n" + "\n" + @@ -1159,18 +1300,19 @@ const file_chat_proto_rawDesc = "" + "\x12MESSAGE_SOURCE_WEB\x10\x01\x12\x1b\n" + "\x17MESSAGE_SOURCE_TELEGRAM\x10\x02\x12\x18\n" + "\x14MESSAGE_SOURCE_AGENT\x10\x03\x12\x19\n" + - "\x15MESSAGE_SOURCE_SYSTEM\x10\x042\x96\x04\n" + + "\x15MESSAGE_SOURCE_SYSTEM\x10\x042\xec\x04\n" + "\vChatService\x12?\n" + "\n" + "ListTopics\x12\x17.chat.ListTopicsRequest\x1a\x18.chat.ListTopicsResponse\x12.\n" + "\bGetTopic\x12\x15.chat.GetTopicRequest\x1a\v.chat.Topic\x124\n" + "\vCreateTopic\x12\x18.chat.CreateTopicRequest\x1a\v.chat.Topic\x124\n" + "\vUpdateTopic\x12\x18.chat.UpdateTopicRequest\x1a\v.chat.Topic\x12B\n" + - "\vPostMessage\x12\x18.chat.PostMessageRequest\x1a\x19.chat.PostMessageResponse\x124\n" + + "\vPostMessage\x12\x18.chat.PostMessageRequest\x1a\x19.chat.PostMessageResponse\x12L\n" + + "\x10AgentPostMessage\x12\x1d.chat.AgentPostMessageRequest\x1a\x19.chat.PostMessageResponse\x124\n" + "\n" + "GetMessage\x12\x17.chat.GetMessageRequest\x1a\r.chat.Message\x126\n" + - "\aHistory\x12\x14.chat.HistoryRequest\x1a\x15.chat.HistoryResponse\x124\n" + - "\tSubscribe\x12\x16.chat.SubscribeRequest\x1a\r.chat.Message0\x01\x12B\n" + + "\aHistory\x12\x14.chat.HistoryRequest\x1a\x15.chat.HistoryResponse\x12<\n" + + "\tSubscribe\x12\x16.chat.SubscribeRequest\x1a\x15.chat.DeliveryMessage0\x01\x12B\n" + "\vAcknowledge\x12\x18.chat.AcknowledgeRequest\x1a\x19.chat.AcknowledgeResponseB,Z*git.be.kaien.ru/l-ai/l-ai-chat-proto/protob\x06proto3" var ( @@ -1186,60 +1328,65 @@ func file_chat_proto_rawDescGZIP() []byte { } var file_chat_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_chat_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_chat_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_chat_proto_goTypes = []any{ - (AuthorType)(0), // 0: chat.AuthorType - (MessageSource)(0), // 1: chat.MessageSource - (*Topic)(nil), // 2: chat.Topic - (*Message)(nil), // 3: chat.Message - (*ListTopicsRequest)(nil), // 4: chat.ListTopicsRequest - (*ListTopicsResponse)(nil), // 5: chat.ListTopicsResponse - (*GetTopicRequest)(nil), // 6: chat.GetTopicRequest - (*CreateTopicRequest)(nil), // 7: chat.CreateTopicRequest - (*UpdateTopicRequest)(nil), // 8: chat.UpdateTopicRequest - (*PostMessageRequest)(nil), // 9: chat.PostMessageRequest - (*PostMessageResponse)(nil), // 10: chat.PostMessageResponse - (*GetMessageRequest)(nil), // 11: chat.GetMessageRequest - (*HistoryRequest)(nil), // 12: chat.HistoryRequest - (*HistoryResponse)(nil), // 13: chat.HistoryResponse - (*SubscribeRequest)(nil), // 14: chat.SubscribeRequest - (*AcknowledgeRequest)(nil), // 15: chat.AcknowledgeRequest - (*AcknowledgeResponse)(nil), // 16: chat.AcknowledgeResponse - (*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp + (AuthorType)(0), // 0: chat.AuthorType + (MessageSource)(0), // 1: chat.MessageSource + (*Topic)(nil), // 2: chat.Topic + (*Message)(nil), // 3: chat.Message + (*ListTopicsRequest)(nil), // 4: chat.ListTopicsRequest + (*ListTopicsResponse)(nil), // 5: chat.ListTopicsResponse + (*GetTopicRequest)(nil), // 6: chat.GetTopicRequest + (*CreateTopicRequest)(nil), // 7: chat.CreateTopicRequest + (*UpdateTopicRequest)(nil), // 8: chat.UpdateTopicRequest + (*PostMessageRequest)(nil), // 9: chat.PostMessageRequest + (*AgentPostMessageRequest)(nil), // 10: chat.AgentPostMessageRequest + (*PostMessageResponse)(nil), // 11: chat.PostMessageResponse + (*GetMessageRequest)(nil), // 12: chat.GetMessageRequest + (*HistoryRequest)(nil), // 13: chat.HistoryRequest + (*HistoryResponse)(nil), // 14: chat.HistoryResponse + (*SubscribeRequest)(nil), // 15: chat.SubscribeRequest + (*DeliveryMessage)(nil), // 16: chat.DeliveryMessage + (*AcknowledgeRequest)(nil), // 17: chat.AcknowledgeRequest + (*AcknowledgeResponse)(nil), // 18: chat.AcknowledgeResponse + (*timestamppb.Timestamp)(nil), // 19: google.protobuf.Timestamp } var file_chat_proto_depIdxs = []int32{ - 17, // 0: chat.Topic.created_at:type_name -> google.protobuf.Timestamp + 19, // 0: chat.Topic.created_at:type_name -> google.protobuf.Timestamp 0, // 1: chat.Message.author_type:type_name -> chat.AuthorType 1, // 2: chat.Message.source:type_name -> chat.MessageSource - 17, // 3: chat.Message.created_at:type_name -> google.protobuf.Timestamp + 19, // 3: chat.Message.created_at:type_name -> google.protobuf.Timestamp 2, // 4: chat.ListTopicsResponse.topics:type_name -> chat.Topic 0, // 5: chat.PostMessageRequest.author_type:type_name -> chat.AuthorType 1, // 6: chat.PostMessageRequest.source:type_name -> chat.MessageSource 3, // 7: chat.PostMessageResponse.message:type_name -> chat.Message 3, // 8: chat.HistoryResponse.messages:type_name -> chat.Message - 4, // 9: chat.ChatService.ListTopics:input_type -> chat.ListTopicsRequest - 6, // 10: chat.ChatService.GetTopic:input_type -> chat.GetTopicRequest - 7, // 11: chat.ChatService.CreateTopic:input_type -> chat.CreateTopicRequest - 8, // 12: chat.ChatService.UpdateTopic:input_type -> chat.UpdateTopicRequest - 9, // 13: chat.ChatService.PostMessage:input_type -> chat.PostMessageRequest - 11, // 14: chat.ChatService.GetMessage:input_type -> chat.GetMessageRequest - 12, // 15: chat.ChatService.History:input_type -> chat.HistoryRequest - 14, // 16: chat.ChatService.Subscribe:input_type -> chat.SubscribeRequest - 15, // 17: chat.ChatService.Acknowledge:input_type -> chat.AcknowledgeRequest - 5, // 18: chat.ChatService.ListTopics:output_type -> chat.ListTopicsResponse - 2, // 19: chat.ChatService.GetTopic:output_type -> chat.Topic - 2, // 20: chat.ChatService.CreateTopic:output_type -> chat.Topic - 2, // 21: chat.ChatService.UpdateTopic:output_type -> chat.Topic - 10, // 22: chat.ChatService.PostMessage:output_type -> chat.PostMessageResponse - 3, // 23: chat.ChatService.GetMessage:output_type -> chat.Message - 13, // 24: chat.ChatService.History:output_type -> chat.HistoryResponse - 3, // 25: chat.ChatService.Subscribe:output_type -> chat.Message - 16, // 26: chat.ChatService.Acknowledge:output_type -> chat.AcknowledgeResponse - 18, // [18:27] is the sub-list for method output_type - 9, // [9:18] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 3, // 9: chat.DeliveryMessage.message:type_name -> chat.Message + 4, // 10: chat.ChatService.ListTopics:input_type -> chat.ListTopicsRequest + 6, // 11: chat.ChatService.GetTopic:input_type -> chat.GetTopicRequest + 7, // 12: chat.ChatService.CreateTopic:input_type -> chat.CreateTopicRequest + 8, // 13: chat.ChatService.UpdateTopic:input_type -> chat.UpdateTopicRequest + 9, // 14: chat.ChatService.PostMessage:input_type -> chat.PostMessageRequest + 10, // 15: chat.ChatService.AgentPostMessage:input_type -> chat.AgentPostMessageRequest + 12, // 16: chat.ChatService.GetMessage:input_type -> chat.GetMessageRequest + 13, // 17: chat.ChatService.History:input_type -> chat.HistoryRequest + 15, // 18: chat.ChatService.Subscribe:input_type -> chat.SubscribeRequest + 17, // 19: chat.ChatService.Acknowledge:input_type -> chat.AcknowledgeRequest + 5, // 20: chat.ChatService.ListTopics:output_type -> chat.ListTopicsResponse + 2, // 21: chat.ChatService.GetTopic:output_type -> chat.Topic + 2, // 22: chat.ChatService.CreateTopic:output_type -> chat.Topic + 2, // 23: chat.ChatService.UpdateTopic:output_type -> chat.Topic + 11, // 24: chat.ChatService.PostMessage:output_type -> chat.PostMessageResponse + 11, // 25: chat.ChatService.AgentPostMessage:output_type -> chat.PostMessageResponse + 3, // 26: chat.ChatService.GetMessage:output_type -> chat.Message + 14, // 27: chat.ChatService.History:output_type -> chat.HistoryResponse + 16, // 28: chat.ChatService.Subscribe:output_type -> chat.DeliveryMessage + 18, // 29: chat.ChatService.Acknowledge:output_type -> chat.AcknowledgeResponse + 20, // [20:30] is the sub-list for method output_type + 10, // [10:20] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_chat_proto_init() } @@ -1253,13 +1400,14 @@ func file_chat_proto_init() { (*GetTopicRequest_Slug)(nil), } file_chat_proto_msgTypes[7].OneofWrappers = []any{} + file_chat_proto_msgTypes[8].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_chat_proto_rawDesc), len(file_chat_proto_rawDesc)), NumEnums: 2, - NumMessages: 15, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, diff --git a/chat.proto b/chat.proto index a3b14b9..d2eb8ed 100644 --- a/chat.proto +++ b/chat.proto @@ -24,11 +24,22 @@ service ChatService { // there is no delete API. rpc UpdateTopic(UpdateTopicRequest) returns (Topic); - // PostMessage appends a message to a topic. Repeated calls with the same - // (author_id, idempotency_key) must not create a second message; the - // original message is returned with duplicated=true instead. + // PostMessage appends a message to a topic. NOTE: this RPC is fail-closed + // until the human-authentication stage: there is no trusted way to fill + // author_id/author_type/source yet, so any call currently returns + // Unimplemented. Agents MUST use AgentPostMessage (the server derives the + // identity from the service token). The internal canonical-message path is + // re-exposed after human auth lands. rpc PostMessage(PostMessageRequest) returns (PostMessageResponse); + // AgentPostMessage posts a message as the authenticated agent. The server + // derives every server-owned field: author_id (deterministic UUID of the + // authenticated identity), author_type=AGENT, source=AGENT, sequence, + // root_message_id, reply_depth, created_at. Clients cannot spoof them. + // idempotency_key is mandatory: retries with the same key return the + // original message (duplicated=true). + rpc AgentPostMessage(AgentPostMessageRequest) returns (PostMessageResponse); + // GetMessage returns a single message by id. rpc GetMessage(GetMessageRequest) returns (Message); @@ -37,13 +48,26 @@ service ChatService { // after_sequence for oldest-first forward paging; at most one may be set. rpc History(HistoryRequest) returns (HistoryResponse); - // Subscribe streams new messages of a topic to a consumer. The consumer is - // expected to Acknowledge the messages it processed (at-least-once). - // NOTE: stream delivery is implemented in a later stage. - rpc Subscribe(SubscribeRequest) returns (stream Message); + // Subscribe opens the delivery stream of a topic for the authenticated + // consumer. Delivery is durable at-least-once: PostgreSQL (messages + + // per-(consumer, topic) delivery cursor) is the source of correctness; + // the stream is a live projection. Exactly one active subscription is + // admitted per (consumer, topic): a new Subscribe for the same pair + // replaces the previous one, which terminates with Aborted. Every + // DeliveryMessage carries the opaque subscription_id the consumer must + // echo in Acknowledge. Messages are delivered in ascending sequence + // order; gaps between sequences of one topic are normal (other topics + // consume global sequence values). + rpc Subscribe(SubscribeRequest) returns (stream DeliveryMessage); - // Acknowledge advances the durable delivery cursor of a consumer in a - // topic. Cursors are monotonic: the stored value never moves backwards. + // Acknowledge advances the durable delivery cursor of the CURRENT active + // subscription of the authenticated consumer in a topic. Cumulative: + // last_ack_sequence = highest sequence the consumer has fully processed. + // The ACK is validated against the active subscription: the sequence must + // not exceed the highest sequence this subscription actually delivered, + // and a stale/old subscription_id is rejected. The cursor is monotonic — + // it never moves backwards. Cursor changes ONLY here; delivery itself + // never persists cursor state. rpc Acknowledge(AcknowledgeRequest) returns (AcknowledgeResponse); } @@ -86,7 +110,7 @@ message Message { optional string reply_to_message_id = 8; // parent message when this is a reply string root_message_id = 9; // root of the reply chain (== id for non-replies) int32 reply_depth = 10; // 0 for non-replies, parent depth + 1 for replies; hard max 20 - google.protobuf.Timestamp created_at = 11; + google.protobuf.Timestamp created_at = 11; // original creation time; age = now - created_at } message ListTopicsRequest {} @@ -124,6 +148,15 @@ message PostMessageRequest { string idempotency_key = 7; } +message AgentPostMessageRequest { + string topic_id = 1; + string content = 2; + optional string reply_to_message_id = 3; + // Mandatory: retrying with the same key returns the original message + // (duplicated=true) instead of creating a duplicate. + string idempotency_key = 4; +} + message PostMessageResponse { Message message = 1; bool duplicated = 2; // true when an idempotent replay returned an existing message @@ -152,14 +185,34 @@ message HistoryResponse { } message SubscribeRequest { - string consumer_id = 1; // stable identity of the consumer/agent - string topic_id = 2; + string topic_id = 1; + // The consumer identity is NOT a request field: it is derived from the + // authenticated service credential, so one agent cannot subscribe as + // another. +} + +// DeliveryMessage wraps one delivered message with delivery metadata. +// message.created_at is always the original creation time; replay + the +// timestamp let the SDK decide how to treat a delivery. +message DeliveryMessage { + Message message = 1; + // true when the message was committed BEFORE this subscription started + // (backlog catch-up after connect/reconnect); false for messages committed + // while this subscription is live. + bool replay = 2; + // Opaque id of the current subscription, generated by the server per + // Subscribe stream. MUST be echoed in Acknowledge; a stale id (from a + // replaced/closed stream) is rejected. + string subscription_id = 3; } message AcknowledgeRequest { - string consumer_id = 1; - string topic_id = 2; - int64 last_ack_sequence = 3; // highest sequence processed by the consumer + string topic_id = 1; + // Highest sequence fully processed by the consumer (cumulative ack). + int64 last_ack_sequence = 2; + // The subscription_id of the stream that delivered the message. Must be + // the CURRENT active subscription of this consumer in this topic. + string subscription_id = 3; } message AcknowledgeResponse { diff --git a/chat_grpc.pb.go b/chat_grpc.pb.go index 2c9f706..05f4d94 100644 --- a/chat_grpc.pb.go +++ b/chat_grpc.pb.go @@ -19,15 +19,16 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - ChatService_ListTopics_FullMethodName = "/chat.ChatService/ListTopics" - ChatService_GetTopic_FullMethodName = "/chat.ChatService/GetTopic" - ChatService_CreateTopic_FullMethodName = "/chat.ChatService/CreateTopic" - ChatService_UpdateTopic_FullMethodName = "/chat.ChatService/UpdateTopic" - ChatService_PostMessage_FullMethodName = "/chat.ChatService/PostMessage" - ChatService_GetMessage_FullMethodName = "/chat.ChatService/GetMessage" - ChatService_History_FullMethodName = "/chat.ChatService/History" - ChatService_Subscribe_FullMethodName = "/chat.ChatService/Subscribe" - ChatService_Acknowledge_FullMethodName = "/chat.ChatService/Acknowledge" + ChatService_ListTopics_FullMethodName = "/chat.ChatService/ListTopics" + ChatService_GetTopic_FullMethodName = "/chat.ChatService/GetTopic" + ChatService_CreateTopic_FullMethodName = "/chat.ChatService/CreateTopic" + ChatService_UpdateTopic_FullMethodName = "/chat.ChatService/UpdateTopic" + ChatService_PostMessage_FullMethodName = "/chat.ChatService/PostMessage" + ChatService_AgentPostMessage_FullMethodName = "/chat.ChatService/AgentPostMessage" + ChatService_GetMessage_FullMethodName = "/chat.ChatService/GetMessage" + ChatService_History_FullMethodName = "/chat.ChatService/History" + ChatService_Subscribe_FullMethodName = "/chat.ChatService/Subscribe" + ChatService_Acknowledge_FullMethodName = "/chat.ChatService/Acknowledge" ) // ChatServiceClient is the client API for ChatService service. @@ -48,22 +49,45 @@ type ChatServiceClient interface { // identifier and cannot be changed. Topics are persistent in the MVP: // there is no delete API. UpdateTopic(ctx context.Context, in *UpdateTopicRequest, opts ...grpc.CallOption) (*Topic, error) - // PostMessage appends a message to a topic. Repeated calls with the same - // (author_id, idempotency_key) must not create a second message; the - // original message is returned with duplicated=true instead. + // PostMessage appends a message to a topic. NOTE: this RPC is fail-closed + // until the human-authentication stage: there is no trusted way to fill + // author_id/author_type/source yet, so any call currently returns + // Unimplemented. Agents MUST use AgentPostMessage (the server derives the + // identity from the service token). The internal canonical-message path is + // re-exposed after human auth lands. PostMessage(ctx context.Context, in *PostMessageRequest, opts ...grpc.CallOption) (*PostMessageResponse, error) + // AgentPostMessage posts a message as the authenticated agent. The server + // derives every server-owned field: author_id (deterministic UUID of the + // authenticated identity), author_type=AGENT, source=AGENT, sequence, + // root_message_id, reply_depth, created_at. Clients cannot spoof them. + // idempotency_key is mandatory: retries with the same key return the + // original message (duplicated=true). + AgentPostMessage(ctx context.Context, in *AgentPostMessageRequest, opts ...grpc.CallOption) (*PostMessageResponse, error) // GetMessage returns a single message by id. GetMessage(ctx context.Context, in *GetMessageRequest, opts ...grpc.CallOption) (*Message, error) // History returns messages of a topic, paginated by sequence (no offset // pagination). Use before_sequence for newest-first backward paging or // after_sequence for oldest-first forward paging; at most one may be set. History(ctx context.Context, in *HistoryRequest, opts ...grpc.CallOption) (*HistoryResponse, error) - // Subscribe streams new messages of a topic to a consumer. The consumer is - // expected to Acknowledge the messages it processed (at-least-once). - // NOTE: stream delivery is implemented in a later stage. - Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Message], error) - // Acknowledge advances the durable delivery cursor of a consumer in a - // topic. Cursors are monotonic: the stored value never moves backwards. + // Subscribe opens the delivery stream of a topic for the authenticated + // consumer. Delivery is durable at-least-once: PostgreSQL (messages + + // per-(consumer, topic) delivery cursor) is the source of correctness; + // the stream is a live projection. Exactly one active subscription is + // admitted per (consumer, topic): a new Subscribe for the same pair + // replaces the previous one, which terminates with Aborted. Every + // DeliveryMessage carries the opaque subscription_id the consumer must + // echo in Acknowledge. Messages are delivered in ascending sequence + // order; gaps between sequences of one topic are normal (other topics + // consume global sequence values). + Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DeliveryMessage], error) + // Acknowledge advances the durable delivery cursor of the CURRENT active + // subscription of the authenticated consumer in a topic. Cumulative: + // last_ack_sequence = highest sequence the consumer has fully processed. + // The ACK is validated against the active subscription: the sequence must + // not exceed the highest sequence this subscription actually delivered, + // and a stale/old subscription_id is rejected. The cursor is monotonic — + // it never moves backwards. Cursor changes ONLY here; delivery itself + // never persists cursor state. Acknowledge(ctx context.Context, in *AcknowledgeRequest, opts ...grpc.CallOption) (*AcknowledgeResponse, error) } @@ -125,6 +149,16 @@ func (c *chatServiceClient) PostMessage(ctx context.Context, in *PostMessageRequ return out, nil } +func (c *chatServiceClient) AgentPostMessage(ctx context.Context, in *AgentPostMessageRequest, opts ...grpc.CallOption) (*PostMessageResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PostMessageResponse) + err := c.cc.Invoke(ctx, ChatService_AgentPostMessage_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *chatServiceClient) GetMessage(ctx context.Context, in *GetMessageRequest, opts ...grpc.CallOption) (*Message, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Message) @@ -145,13 +179,13 @@ func (c *chatServiceClient) History(ctx context.Context, in *HistoryRequest, opt return out, nil } -func (c *chatServiceClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Message], error) { +func (c *chatServiceClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DeliveryMessage], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &ChatService_ServiceDesc.Streams[0], ChatService_Subscribe_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[SubscribeRequest, Message]{ClientStream: stream} + x := &grpc.GenericClientStream[SubscribeRequest, DeliveryMessage]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -162,7 +196,7 @@ func (c *chatServiceClient) Subscribe(ctx context.Context, in *SubscribeRequest, } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ChatService_SubscribeClient = grpc.ServerStreamingClient[Message] +type ChatService_SubscribeClient = grpc.ServerStreamingClient[DeliveryMessage] func (c *chatServiceClient) Acknowledge(ctx context.Context, in *AcknowledgeRequest, opts ...grpc.CallOption) (*AcknowledgeResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -192,22 +226,45 @@ type ChatServiceServer interface { // identifier and cannot be changed. Topics are persistent in the MVP: // there is no delete API. UpdateTopic(context.Context, *UpdateTopicRequest) (*Topic, error) - // PostMessage appends a message to a topic. Repeated calls with the same - // (author_id, idempotency_key) must not create a second message; the - // original message is returned with duplicated=true instead. + // PostMessage appends a message to a topic. NOTE: this RPC is fail-closed + // until the human-authentication stage: there is no trusted way to fill + // author_id/author_type/source yet, so any call currently returns + // Unimplemented. Agents MUST use AgentPostMessage (the server derives the + // identity from the service token). The internal canonical-message path is + // re-exposed after human auth lands. PostMessage(context.Context, *PostMessageRequest) (*PostMessageResponse, error) + // AgentPostMessage posts a message as the authenticated agent. The server + // derives every server-owned field: author_id (deterministic UUID of the + // authenticated identity), author_type=AGENT, source=AGENT, sequence, + // root_message_id, reply_depth, created_at. Clients cannot spoof them. + // idempotency_key is mandatory: retries with the same key return the + // original message (duplicated=true). + AgentPostMessage(context.Context, *AgentPostMessageRequest) (*PostMessageResponse, error) // GetMessage returns a single message by id. GetMessage(context.Context, *GetMessageRequest) (*Message, error) // History returns messages of a topic, paginated by sequence (no offset // pagination). Use before_sequence for newest-first backward paging or // after_sequence for oldest-first forward paging; at most one may be set. History(context.Context, *HistoryRequest) (*HistoryResponse, error) - // Subscribe streams new messages of a topic to a consumer. The consumer is - // expected to Acknowledge the messages it processed (at-least-once). - // NOTE: stream delivery is implemented in a later stage. - Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[Message]) error - // Acknowledge advances the durable delivery cursor of a consumer in a - // topic. Cursors are monotonic: the stored value never moves backwards. + // Subscribe opens the delivery stream of a topic for the authenticated + // consumer. Delivery is durable at-least-once: PostgreSQL (messages + + // per-(consumer, topic) delivery cursor) is the source of correctness; + // the stream is a live projection. Exactly one active subscription is + // admitted per (consumer, topic): a new Subscribe for the same pair + // replaces the previous one, which terminates with Aborted. Every + // DeliveryMessage carries the opaque subscription_id the consumer must + // echo in Acknowledge. Messages are delivered in ascending sequence + // order; gaps between sequences of one topic are normal (other topics + // consume global sequence values). + Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[DeliveryMessage]) error + // Acknowledge advances the durable delivery cursor of the CURRENT active + // subscription of the authenticated consumer in a topic. Cumulative: + // last_ack_sequence = highest sequence the consumer has fully processed. + // The ACK is validated against the active subscription: the sequence must + // not exceed the highest sequence this subscription actually delivered, + // and a stale/old subscription_id is rejected. The cursor is monotonic — + // it never moves backwards. Cursor changes ONLY here; delivery itself + // never persists cursor state. Acknowledge(context.Context, *AcknowledgeRequest) (*AcknowledgeResponse, error) mustEmbedUnimplementedChatServiceServer() } @@ -234,13 +291,16 @@ func (UnimplementedChatServiceServer) UpdateTopic(context.Context, *UpdateTopicR func (UnimplementedChatServiceServer) PostMessage(context.Context, *PostMessageRequest) (*PostMessageResponse, error) { return nil, status.Error(codes.Unimplemented, "method PostMessage not implemented") } +func (UnimplementedChatServiceServer) AgentPostMessage(context.Context, *AgentPostMessageRequest) (*PostMessageResponse, error) { + return nil, status.Error(codes.Unimplemented, "method AgentPostMessage not implemented") +} func (UnimplementedChatServiceServer) GetMessage(context.Context, *GetMessageRequest) (*Message, error) { return nil, status.Error(codes.Unimplemented, "method GetMessage not implemented") } func (UnimplementedChatServiceServer) History(context.Context, *HistoryRequest) (*HistoryResponse, error) { return nil, status.Error(codes.Unimplemented, "method History not implemented") } -func (UnimplementedChatServiceServer) Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[Message]) error { +func (UnimplementedChatServiceServer) Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[DeliveryMessage]) error { return status.Error(codes.Unimplemented, "method Subscribe not implemented") } func (UnimplementedChatServiceServer) Acknowledge(context.Context, *AcknowledgeRequest) (*AcknowledgeResponse, error) { @@ -357,6 +417,24 @@ func _ChatService_PostMessage_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _ChatService_AgentPostMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AgentPostMessageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).AgentPostMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_AgentPostMessage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).AgentPostMessage(ctx, req.(*AgentPostMessageRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _ChatService_GetMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetMessageRequest) if err := dec(in); err != nil { @@ -398,11 +476,11 @@ func _ChatService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) e if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ChatServiceServer).Subscribe(m, &grpc.GenericServerStream[SubscribeRequest, Message]{ServerStream: stream}) + return srv.(ChatServiceServer).Subscribe(m, &grpc.GenericServerStream[SubscribeRequest, DeliveryMessage]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ChatService_SubscribeServer = grpc.ServerStreamingServer[Message] +type ChatService_SubscribeServer = grpc.ServerStreamingServer[DeliveryMessage] func _ChatService_Acknowledge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AcknowledgeRequest) @@ -449,6 +527,10 @@ var ChatService_ServiceDesc = grpc.ServiceDesc{ MethodName: "PostMessage", Handler: _ChatService_PostMessage_Handler, }, + { + MethodName: "AgentPostMessage", + Handler: _ChatService_AgentPostMessage_Handler, + }, { MethodName: "GetMessage", Handler: _ChatService_GetMessage_Handler,