feat(api): agent-facing contract — AgentPostMessage, subscription-bound delivery (DeliveryMessage, subscription_id), Subscribe/Acknowledge without client-supplied consumer identity
This commit is contained in:
parent
719114ca23
commit
d7b517548d
354
chat.pb.go
354
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
|
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)
|
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
|
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
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -689,6 +689,76 @@ func (x *PostMessageRequest) GetIdempotencyKey() string {
|
|||||||
return ""
|
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 {
|
type PostMessageResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
|
Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
|
||||||
@ -699,7 +769,7 @@ type PostMessageResponse struct {
|
|||||||
|
|
||||||
func (x *PostMessageResponse) Reset() {
|
func (x *PostMessageResponse) Reset() {
|
||||||
*x = PostMessageResponse{}
|
*x = PostMessageResponse{}
|
||||||
mi := &file_chat_proto_msgTypes[8]
|
mi := &file_chat_proto_msgTypes[9]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -711,7 +781,7 @@ func (x *PostMessageResponse) String() string {
|
|||||||
func (*PostMessageResponse) ProtoMessage() {}
|
func (*PostMessageResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PostMessageResponse) ProtoReflect() protoreflect.Message {
|
func (x *PostMessageResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_chat_proto_msgTypes[8]
|
mi := &file_chat_proto_msgTypes[9]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -724,7 +794,7 @@ func (x *PostMessageResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use PostMessageResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PostMessageResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*PostMessageResponse) Descriptor() ([]byte, []int) {
|
func (*PostMessageResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_chat_proto_rawDescGZIP(), []int{8}
|
return file_chat_proto_rawDescGZIP(), []int{9}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PostMessageResponse) GetMessage() *Message {
|
func (x *PostMessageResponse) GetMessage() *Message {
|
||||||
@ -750,7 +820,7 @@ type GetMessageRequest struct {
|
|||||||
|
|
||||||
func (x *GetMessageRequest) Reset() {
|
func (x *GetMessageRequest) Reset() {
|
||||||
*x = GetMessageRequest{}
|
*x = GetMessageRequest{}
|
||||||
mi := &file_chat_proto_msgTypes[9]
|
mi := &file_chat_proto_msgTypes[10]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -762,7 +832,7 @@ func (x *GetMessageRequest) String() string {
|
|||||||
func (*GetMessageRequest) ProtoMessage() {}
|
func (*GetMessageRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetMessageRequest) ProtoReflect() protoreflect.Message {
|
func (x *GetMessageRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_chat_proto_msgTypes[9]
|
mi := &file_chat_proto_msgTypes[10]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -775,7 +845,7 @@ func (x *GetMessageRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetMessageRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetMessageRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*GetMessageRequest) Descriptor() ([]byte, []int) {
|
func (*GetMessageRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_chat_proto_rawDescGZIP(), []int{9}
|
return file_chat_proto_rawDescGZIP(), []int{10}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetMessageRequest) GetMessageId() string {
|
func (x *GetMessageRequest) GetMessageId() string {
|
||||||
@ -802,7 +872,7 @@ type HistoryRequest struct {
|
|||||||
|
|
||||||
func (x *HistoryRequest) Reset() {
|
func (x *HistoryRequest) Reset() {
|
||||||
*x = HistoryRequest{}
|
*x = HistoryRequest{}
|
||||||
mi := &file_chat_proto_msgTypes[10]
|
mi := &file_chat_proto_msgTypes[11]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -814,7 +884,7 @@ func (x *HistoryRequest) String() string {
|
|||||||
func (*HistoryRequest) ProtoMessage() {}
|
func (*HistoryRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *HistoryRequest) ProtoReflect() protoreflect.Message {
|
func (x *HistoryRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_chat_proto_msgTypes[10]
|
mi := &file_chat_proto_msgTypes[11]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -827,7 +897,7 @@ func (x *HistoryRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use HistoryRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use HistoryRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*HistoryRequest) Descriptor() ([]byte, []int) {
|
func (*HistoryRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_chat_proto_rawDescGZIP(), []int{10}
|
return file_chat_proto_rawDescGZIP(), []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoryRequest) GetTopicId() string {
|
func (x *HistoryRequest) GetTopicId() string {
|
||||||
@ -869,7 +939,7 @@ type HistoryResponse struct {
|
|||||||
|
|
||||||
func (x *HistoryResponse) Reset() {
|
func (x *HistoryResponse) Reset() {
|
||||||
*x = HistoryResponse{}
|
*x = HistoryResponse{}
|
||||||
mi := &file_chat_proto_msgTypes[11]
|
mi := &file_chat_proto_msgTypes[12]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -881,7 +951,7 @@ func (x *HistoryResponse) String() string {
|
|||||||
func (*HistoryResponse) ProtoMessage() {}
|
func (*HistoryResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *HistoryResponse) ProtoReflect() protoreflect.Message {
|
func (x *HistoryResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_chat_proto_msgTypes[11]
|
mi := &file_chat_proto_msgTypes[12]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -894,7 +964,7 @@ func (x *HistoryResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use HistoryResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use HistoryResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*HistoryResponse) Descriptor() ([]byte, []int) {
|
func (*HistoryResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_chat_proto_rawDescGZIP(), []int{11}
|
return file_chat_proto_rawDescGZIP(), []int{12}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoryResponse) GetMessages() []*Message {
|
func (x *HistoryResponse) GetMessages() []*Message {
|
||||||
@ -913,15 +983,14 @@ func (x *HistoryResponse) GetHasMore() bool {
|
|||||||
|
|
||||||
type SubscribeRequest struct {
|
type SubscribeRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
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,1,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"`
|
||||||
TopicId string `protobuf:"bytes,2,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SubscribeRequest) Reset() {
|
func (x *SubscribeRequest) Reset() {
|
||||||
*x = SubscribeRequest{}
|
*x = SubscribeRequest{}
|
||||||
mi := &file_chat_proto_msgTypes[12]
|
mi := &file_chat_proto_msgTypes[13]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -933,7 +1002,7 @@ func (x *SubscribeRequest) String() string {
|
|||||||
func (*SubscribeRequest) ProtoMessage() {}
|
func (*SubscribeRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SubscribeRequest) ProtoReflect() protoreflect.Message {
|
func (x *SubscribeRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_chat_proto_msgTypes[12]
|
mi := &file_chat_proto_msgTypes[13]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -946,14 +1015,7 @@ func (x *SubscribeRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*SubscribeRequest) Descriptor() ([]byte, []int) {
|
func (*SubscribeRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_chat_proto_rawDescGZIP(), []int{12}
|
return file_chat_proto_rawDescGZIP(), []int{13}
|
||||||
}
|
|
||||||
|
|
||||||
func (x *SubscribeRequest) GetConsumerId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.ConsumerId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SubscribeRequest) GetTopicId() string {
|
func (x *SubscribeRequest) GetTopicId() string {
|
||||||
@ -963,18 +1025,90 @@ func (x *SubscribeRequest) GetTopicId() string {
|
|||||||
return ""
|
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 {
|
type AcknowledgeRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
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,1,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"`
|
||||||
TopicId string `protobuf:"bytes,2,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"`
|
// Highest sequence fully processed by the consumer (cumulative ack).
|
||||||
LastAckSequence int64 `protobuf:"varint,3,opt,name=last_ack_sequence,json=lastAckSequence,proto3" json:"last_ack_sequence,omitempty"` // highest sequence processed by the consumer
|
LastAckSequence int64 `protobuf:"varint,2,opt,name=last_ack_sequence,json=lastAckSequence,proto3" json:"last_ack_sequence,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
// The subscription_id of the stream that delivered the message. Must be
|
||||||
sizeCache protoimpl.SizeCache
|
// 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() {
|
func (x *AcknowledgeRequest) Reset() {
|
||||||
*x = AcknowledgeRequest{}
|
*x = AcknowledgeRequest{}
|
||||||
mi := &file_chat_proto_msgTypes[13]
|
mi := &file_chat_proto_msgTypes[15]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -986,7 +1120,7 @@ func (x *AcknowledgeRequest) String() string {
|
|||||||
func (*AcknowledgeRequest) ProtoMessage() {}
|
func (*AcknowledgeRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *AcknowledgeRequest) ProtoReflect() protoreflect.Message {
|
func (x *AcknowledgeRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_chat_proto_msgTypes[13]
|
mi := &file_chat_proto_msgTypes[15]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -999,14 +1133,7 @@ func (x *AcknowledgeRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use AcknowledgeRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use AcknowledgeRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*AcknowledgeRequest) Descriptor() ([]byte, []int) {
|
func (*AcknowledgeRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_chat_proto_rawDescGZIP(), []int{13}
|
return file_chat_proto_rawDescGZIP(), []int{15}
|
||||||
}
|
|
||||||
|
|
||||||
func (x *AcknowledgeRequest) GetConsumerId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.ConsumerId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AcknowledgeRequest) GetTopicId() string {
|
func (x *AcknowledgeRequest) GetTopicId() string {
|
||||||
@ -1023,6 +1150,13 @@ func (x *AcknowledgeRequest) GetLastAckSequence() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *AcknowledgeRequest) GetSubscriptionId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.SubscriptionId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type AcknowledgeResponse struct {
|
type AcknowledgeResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
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)
|
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() {
|
func (x *AcknowledgeResponse) Reset() {
|
||||||
*x = AcknowledgeResponse{}
|
*x = AcknowledgeResponse{}
|
||||||
mi := &file_chat_proto_msgTypes[14]
|
mi := &file_chat_proto_msgTypes[16]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -1044,7 +1178,7 @@ func (x *AcknowledgeResponse) String() string {
|
|||||||
func (*AcknowledgeResponse) ProtoMessage() {}
|
func (*AcknowledgeResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *AcknowledgeResponse) ProtoReflect() protoreflect.Message {
|
func (x *AcknowledgeResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_chat_proto_msgTypes[14]
|
mi := &file_chat_proto_msgTypes[16]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -1057,7 +1191,7 @@ func (x *AcknowledgeResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use AcknowledgeResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use AcknowledgeResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*AcknowledgeResponse) Descriptor() ([]byte, []int) {
|
func (*AcknowledgeResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_chat_proto_rawDescGZIP(), []int{14}
|
return file_chat_proto_rawDescGZIP(), []int{16}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AcknowledgeResponse) GetLastAckSequence() int64 {
|
func (x *AcknowledgeResponse) GetLastAckSequence() int64 {
|
||||||
@ -1119,6 +1253,12 @@ const file_chat_proto_rawDesc = "" +
|
|||||||
"\acontent\x18\x05 \x01(\tR\acontent\x122\n" +
|
"\acontent\x18\x05 \x01(\tR\acontent\x122\n" +
|
||||||
"\x13reply_to_message_id\x18\x06 \x01(\tH\x00R\x10replyToMessageId\x88\x01\x01\x12'\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" +
|
"\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" +
|
"\x14_reply_to_message_id\"^\n" +
|
||||||
"\x13PostMessageResponse\x12'\n" +
|
"\x13PostMessageResponse\x12'\n" +
|
||||||
"\amessage\x18\x01 \x01(\v2\r.chat.MessageR\amessage\x12\x1e\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" +
|
"\x05limit\x18\x04 \x01(\x05R\x05limit\"W\n" +
|
||||||
"\x0fHistoryResponse\x12)\n" +
|
"\x0fHistoryResponse\x12)\n" +
|
||||||
"\bmessages\x18\x01 \x03(\v2\r.chat.MessageR\bmessages\x12\x19\n" +
|
"\bmessages\x18\x01 \x03(\v2\r.chat.MessageR\bmessages\x12\x19\n" +
|
||||||
"\bhas_more\x18\x02 \x01(\bR\ahasMore\"N\n" +
|
"\bhas_more\x18\x02 \x01(\bR\ahasMore\"-\n" +
|
||||||
"\x10SubscribeRequest\x12\x1f\n" +
|
"\x10SubscribeRequest\x12\x19\n" +
|
||||||
"\vconsumer_id\x18\x01 \x01(\tR\n" +
|
"\btopic_id\x18\x01 \x01(\tR\atopicId\"{\n" +
|
||||||
"consumerId\x12\x19\n" +
|
"\x0fDeliveryMessage\x12'\n" +
|
||||||
"\btopic_id\x18\x02 \x01(\tR\atopicId\"|\n" +
|
"\amessage\x18\x01 \x01(\v2\r.chat.MessageR\amessage\x12\x16\n" +
|
||||||
"\x12AcknowledgeRequest\x12\x1f\n" +
|
"\x06replay\x18\x02 \x01(\bR\x06replay\x12'\n" +
|
||||||
"\vconsumer_id\x18\x01 \x01(\tR\n" +
|
"\x0fsubscription_id\x18\x03 \x01(\tR\x0esubscriptionId\"\x84\x01\n" +
|
||||||
"consumerId\x12\x19\n" +
|
"\x12AcknowledgeRequest\x12\x19\n" +
|
||||||
"\btopic_id\x18\x02 \x01(\tR\atopicId\x12*\n" +
|
"\btopic_id\x18\x01 \x01(\tR\atopicId\x12*\n" +
|
||||||
"\x11last_ack_sequence\x18\x03 \x01(\x03R\x0flastAckSequence\"A\n" +
|
"\x11last_ack_sequence\x18\x02 \x01(\x03R\x0flastAckSequence\x12'\n" +
|
||||||
|
"\x0fsubscription_id\x18\x03 \x01(\tR\x0esubscriptionId\"A\n" +
|
||||||
"\x13AcknowledgeResponse\x12*\n" +
|
"\x13AcknowledgeResponse\x12*\n" +
|
||||||
"\x11last_ack_sequence\x18\x01 \x01(\x03R\x0flastAckSequence*\x8c\x01\n" +
|
"\x11last_ack_sequence\x18\x01 \x01(\x03R\x0flastAckSequence*\x8c\x01\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
@ -1159,18 +1300,19 @@ const file_chat_proto_rawDesc = "" +
|
|||||||
"\x12MESSAGE_SOURCE_WEB\x10\x01\x12\x1b\n" +
|
"\x12MESSAGE_SOURCE_WEB\x10\x01\x12\x1b\n" +
|
||||||
"\x17MESSAGE_SOURCE_TELEGRAM\x10\x02\x12\x18\n" +
|
"\x17MESSAGE_SOURCE_TELEGRAM\x10\x02\x12\x18\n" +
|
||||||
"\x14MESSAGE_SOURCE_AGENT\x10\x03\x12\x19\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" +
|
"\vChatService\x12?\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"ListTopics\x12\x17.chat.ListTopicsRequest\x1a\x18.chat.ListTopicsResponse\x12.\n" +
|
"ListTopics\x12\x17.chat.ListTopicsRequest\x1a\x18.chat.ListTopicsResponse\x12.\n" +
|
||||||
"\bGetTopic\x12\x15.chat.GetTopicRequest\x1a\v.chat.Topic\x124\n" +
|
"\bGetTopic\x12\x15.chat.GetTopicRequest\x1a\v.chat.Topic\x124\n" +
|
||||||
"\vCreateTopic\x12\x18.chat.CreateTopicRequest\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" +
|
"\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" +
|
"\n" +
|
||||||
"GetMessage\x12\x17.chat.GetMessageRequest\x1a\r.chat.Message\x126\n" +
|
"GetMessage\x12\x17.chat.GetMessageRequest\x1a\r.chat.Message\x126\n" +
|
||||||
"\aHistory\x12\x14.chat.HistoryRequest\x1a\x15.chat.HistoryResponse\x124\n" +
|
"\aHistory\x12\x14.chat.HistoryRequest\x1a\x15.chat.HistoryResponse\x12<\n" +
|
||||||
"\tSubscribe\x12\x16.chat.SubscribeRequest\x1a\r.chat.Message0\x01\x12B\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"
|
"\vAcknowledge\x12\x18.chat.AcknowledgeRequest\x1a\x19.chat.AcknowledgeResponseB,Z*git.be.kaien.ru/l-ai/l-ai-chat-proto/protob\x06proto3"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -1186,60 +1328,65 @@ func file_chat_proto_rawDescGZIP() []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var file_chat_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
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{
|
var file_chat_proto_goTypes = []any{
|
||||||
(AuthorType)(0), // 0: chat.AuthorType
|
(AuthorType)(0), // 0: chat.AuthorType
|
||||||
(MessageSource)(0), // 1: chat.MessageSource
|
(MessageSource)(0), // 1: chat.MessageSource
|
||||||
(*Topic)(nil), // 2: chat.Topic
|
(*Topic)(nil), // 2: chat.Topic
|
||||||
(*Message)(nil), // 3: chat.Message
|
(*Message)(nil), // 3: chat.Message
|
||||||
(*ListTopicsRequest)(nil), // 4: chat.ListTopicsRequest
|
(*ListTopicsRequest)(nil), // 4: chat.ListTopicsRequest
|
||||||
(*ListTopicsResponse)(nil), // 5: chat.ListTopicsResponse
|
(*ListTopicsResponse)(nil), // 5: chat.ListTopicsResponse
|
||||||
(*GetTopicRequest)(nil), // 6: chat.GetTopicRequest
|
(*GetTopicRequest)(nil), // 6: chat.GetTopicRequest
|
||||||
(*CreateTopicRequest)(nil), // 7: chat.CreateTopicRequest
|
(*CreateTopicRequest)(nil), // 7: chat.CreateTopicRequest
|
||||||
(*UpdateTopicRequest)(nil), // 8: chat.UpdateTopicRequest
|
(*UpdateTopicRequest)(nil), // 8: chat.UpdateTopicRequest
|
||||||
(*PostMessageRequest)(nil), // 9: chat.PostMessageRequest
|
(*PostMessageRequest)(nil), // 9: chat.PostMessageRequest
|
||||||
(*PostMessageResponse)(nil), // 10: chat.PostMessageResponse
|
(*AgentPostMessageRequest)(nil), // 10: chat.AgentPostMessageRequest
|
||||||
(*GetMessageRequest)(nil), // 11: chat.GetMessageRequest
|
(*PostMessageResponse)(nil), // 11: chat.PostMessageResponse
|
||||||
(*HistoryRequest)(nil), // 12: chat.HistoryRequest
|
(*GetMessageRequest)(nil), // 12: chat.GetMessageRequest
|
||||||
(*HistoryResponse)(nil), // 13: chat.HistoryResponse
|
(*HistoryRequest)(nil), // 13: chat.HistoryRequest
|
||||||
(*SubscribeRequest)(nil), // 14: chat.SubscribeRequest
|
(*HistoryResponse)(nil), // 14: chat.HistoryResponse
|
||||||
(*AcknowledgeRequest)(nil), // 15: chat.AcknowledgeRequest
|
(*SubscribeRequest)(nil), // 15: chat.SubscribeRequest
|
||||||
(*AcknowledgeResponse)(nil), // 16: chat.AcknowledgeResponse
|
(*DeliveryMessage)(nil), // 16: chat.DeliveryMessage
|
||||||
(*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp
|
(*AcknowledgeRequest)(nil), // 17: chat.AcknowledgeRequest
|
||||||
|
(*AcknowledgeResponse)(nil), // 18: chat.AcknowledgeResponse
|
||||||
|
(*timestamppb.Timestamp)(nil), // 19: google.protobuf.Timestamp
|
||||||
}
|
}
|
||||||
var file_chat_proto_depIdxs = []int32{
|
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
|
0, // 1: chat.Message.author_type:type_name -> chat.AuthorType
|
||||||
1, // 2: chat.Message.source:type_name -> chat.MessageSource
|
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
|
2, // 4: chat.ListTopicsResponse.topics:type_name -> chat.Topic
|
||||||
0, // 5: chat.PostMessageRequest.author_type:type_name -> chat.AuthorType
|
0, // 5: chat.PostMessageRequest.author_type:type_name -> chat.AuthorType
|
||||||
1, // 6: chat.PostMessageRequest.source:type_name -> chat.MessageSource
|
1, // 6: chat.PostMessageRequest.source:type_name -> chat.MessageSource
|
||||||
3, // 7: chat.PostMessageResponse.message:type_name -> chat.Message
|
3, // 7: chat.PostMessageResponse.message:type_name -> chat.Message
|
||||||
3, // 8: chat.HistoryResponse.messages:type_name -> chat.Message
|
3, // 8: chat.HistoryResponse.messages:type_name -> chat.Message
|
||||||
4, // 9: chat.ChatService.ListTopics:input_type -> chat.ListTopicsRequest
|
3, // 9: chat.DeliveryMessage.message:type_name -> chat.Message
|
||||||
6, // 10: chat.ChatService.GetTopic:input_type -> chat.GetTopicRequest
|
4, // 10: chat.ChatService.ListTopics:input_type -> chat.ListTopicsRequest
|
||||||
7, // 11: chat.ChatService.CreateTopic:input_type -> chat.CreateTopicRequest
|
6, // 11: chat.ChatService.GetTopic:input_type -> chat.GetTopicRequest
|
||||||
8, // 12: chat.ChatService.UpdateTopic:input_type -> chat.UpdateTopicRequest
|
7, // 12: chat.ChatService.CreateTopic:input_type -> chat.CreateTopicRequest
|
||||||
9, // 13: chat.ChatService.PostMessage:input_type -> chat.PostMessageRequest
|
8, // 13: chat.ChatService.UpdateTopic:input_type -> chat.UpdateTopicRequest
|
||||||
11, // 14: chat.ChatService.GetMessage:input_type -> chat.GetMessageRequest
|
9, // 14: chat.ChatService.PostMessage:input_type -> chat.PostMessageRequest
|
||||||
12, // 15: chat.ChatService.History:input_type -> chat.HistoryRequest
|
10, // 15: chat.ChatService.AgentPostMessage:input_type -> chat.AgentPostMessageRequest
|
||||||
14, // 16: chat.ChatService.Subscribe:input_type -> chat.SubscribeRequest
|
12, // 16: chat.ChatService.GetMessage:input_type -> chat.GetMessageRequest
|
||||||
15, // 17: chat.ChatService.Acknowledge:input_type -> chat.AcknowledgeRequest
|
13, // 17: chat.ChatService.History:input_type -> chat.HistoryRequest
|
||||||
5, // 18: chat.ChatService.ListTopics:output_type -> chat.ListTopicsResponse
|
15, // 18: chat.ChatService.Subscribe:input_type -> chat.SubscribeRequest
|
||||||
2, // 19: chat.ChatService.GetTopic:output_type -> chat.Topic
|
17, // 19: chat.ChatService.Acknowledge:input_type -> chat.AcknowledgeRequest
|
||||||
2, // 20: chat.ChatService.CreateTopic:output_type -> chat.Topic
|
5, // 20: chat.ChatService.ListTopics:output_type -> chat.ListTopicsResponse
|
||||||
2, // 21: chat.ChatService.UpdateTopic:output_type -> chat.Topic
|
2, // 21: chat.ChatService.GetTopic:output_type -> chat.Topic
|
||||||
10, // 22: chat.ChatService.PostMessage:output_type -> chat.PostMessageResponse
|
2, // 22: chat.ChatService.CreateTopic:output_type -> chat.Topic
|
||||||
3, // 23: chat.ChatService.GetMessage:output_type -> chat.Message
|
2, // 23: chat.ChatService.UpdateTopic:output_type -> chat.Topic
|
||||||
13, // 24: chat.ChatService.History:output_type -> chat.HistoryResponse
|
11, // 24: chat.ChatService.PostMessage:output_type -> chat.PostMessageResponse
|
||||||
3, // 25: chat.ChatService.Subscribe:output_type -> chat.Message
|
11, // 25: chat.ChatService.AgentPostMessage:output_type -> chat.PostMessageResponse
|
||||||
16, // 26: chat.ChatService.Acknowledge:output_type -> chat.AcknowledgeResponse
|
3, // 26: chat.ChatService.GetMessage:output_type -> chat.Message
|
||||||
18, // [18:27] is the sub-list for method output_type
|
14, // 27: chat.ChatService.History:output_type -> chat.HistoryResponse
|
||||||
9, // [9:18] is the sub-list for method input_type
|
16, // 28: chat.ChatService.Subscribe:output_type -> chat.DeliveryMessage
|
||||||
9, // [9:9] is the sub-list for extension type_name
|
18, // 29: chat.ChatService.Acknowledge:output_type -> chat.AcknowledgeResponse
|
||||||
9, // [9:9] is the sub-list for extension extendee
|
20, // [20:30] is the sub-list for method output_type
|
||||||
0, // [0:9] is the sub-list for field type_name
|
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() }
|
func init() { file_chat_proto_init() }
|
||||||
@ -1253,13 +1400,14 @@ func file_chat_proto_init() {
|
|||||||
(*GetTopicRequest_Slug)(nil),
|
(*GetTopicRequest_Slug)(nil),
|
||||||
}
|
}
|
||||||
file_chat_proto_msgTypes[7].OneofWrappers = []any{}
|
file_chat_proto_msgTypes[7].OneofWrappers = []any{}
|
||||||
|
file_chat_proto_msgTypes[8].OneofWrappers = []any{}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_chat_proto_rawDesc), len(file_chat_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_chat_proto_rawDesc), len(file_chat_proto_rawDesc)),
|
||||||
NumEnums: 2,
|
NumEnums: 2,
|
||||||
NumMessages: 15,
|
NumMessages: 17,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
83
chat.proto
83
chat.proto
@ -24,11 +24,22 @@ service ChatService {
|
|||||||
// there is no delete API.
|
// there is no delete API.
|
||||||
rpc UpdateTopic(UpdateTopicRequest) returns (Topic);
|
rpc UpdateTopic(UpdateTopicRequest) returns (Topic);
|
||||||
|
|
||||||
// PostMessage appends a message to a topic. Repeated calls with the same
|
// PostMessage appends a message to a topic. NOTE: this RPC is fail-closed
|
||||||
// (author_id, idempotency_key) must not create a second message; the
|
// until the human-authentication stage: there is no trusted way to fill
|
||||||
// original message is returned with duplicated=true instead.
|
// 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);
|
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.
|
// GetMessage returns a single message by id.
|
||||||
rpc GetMessage(GetMessageRequest) returns (Message);
|
rpc GetMessage(GetMessageRequest) returns (Message);
|
||||||
|
|
||||||
@ -37,13 +48,26 @@ service ChatService {
|
|||||||
// after_sequence for oldest-first forward paging; at most one may be set.
|
// after_sequence for oldest-first forward paging; at most one may be set.
|
||||||
rpc History(HistoryRequest) returns (HistoryResponse);
|
rpc History(HistoryRequest) returns (HistoryResponse);
|
||||||
|
|
||||||
// Subscribe streams new messages of a topic to a consumer. The consumer is
|
// Subscribe opens the delivery stream of a topic for the authenticated
|
||||||
// expected to Acknowledge the messages it processed (at-least-once).
|
// consumer. Delivery is durable at-least-once: PostgreSQL (messages +
|
||||||
// NOTE: stream delivery is implemented in a later stage.
|
// per-(consumer, topic) delivery cursor) is the source of correctness;
|
||||||
rpc Subscribe(SubscribeRequest) returns (stream Message);
|
// 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
|
// Acknowledge advances the durable delivery cursor of the CURRENT active
|
||||||
// topic. Cursors are monotonic: the stored value never moves backwards.
|
// 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);
|
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
|
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)
|
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
|
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 {}
|
message ListTopicsRequest {}
|
||||||
@ -124,6 +148,15 @@ message PostMessageRequest {
|
|||||||
string idempotency_key = 7;
|
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 PostMessageResponse {
|
||||||
Message message = 1;
|
Message message = 1;
|
||||||
bool duplicated = 2; // true when an idempotent replay returned an existing message
|
bool duplicated = 2; // true when an idempotent replay returned an existing message
|
||||||
@ -152,14 +185,34 @@ message HistoryResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message SubscribeRequest {
|
message SubscribeRequest {
|
||||||
string consumer_id = 1; // stable identity of the consumer/agent
|
string topic_id = 1;
|
||||||
string topic_id = 2;
|
// 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 {
|
message AcknowledgeRequest {
|
||||||
string consumer_id = 1;
|
string topic_id = 1;
|
||||||
string topic_id = 2;
|
// Highest sequence fully processed by the consumer (cumulative ack).
|
||||||
int64 last_ack_sequence = 3; // highest sequence processed by the consumer
|
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 {
|
message AcknowledgeResponse {
|
||||||
|
|||||||
148
chat_grpc.pb.go
148
chat_grpc.pb.go
@ -19,15 +19,16 @@ import (
|
|||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ChatService_ListTopics_FullMethodName = "/chat.ChatService/ListTopics"
|
ChatService_ListTopics_FullMethodName = "/chat.ChatService/ListTopics"
|
||||||
ChatService_GetTopic_FullMethodName = "/chat.ChatService/GetTopic"
|
ChatService_GetTopic_FullMethodName = "/chat.ChatService/GetTopic"
|
||||||
ChatService_CreateTopic_FullMethodName = "/chat.ChatService/CreateTopic"
|
ChatService_CreateTopic_FullMethodName = "/chat.ChatService/CreateTopic"
|
||||||
ChatService_UpdateTopic_FullMethodName = "/chat.ChatService/UpdateTopic"
|
ChatService_UpdateTopic_FullMethodName = "/chat.ChatService/UpdateTopic"
|
||||||
ChatService_PostMessage_FullMethodName = "/chat.ChatService/PostMessage"
|
ChatService_PostMessage_FullMethodName = "/chat.ChatService/PostMessage"
|
||||||
ChatService_GetMessage_FullMethodName = "/chat.ChatService/GetMessage"
|
ChatService_AgentPostMessage_FullMethodName = "/chat.ChatService/AgentPostMessage"
|
||||||
ChatService_History_FullMethodName = "/chat.ChatService/History"
|
ChatService_GetMessage_FullMethodName = "/chat.ChatService/GetMessage"
|
||||||
ChatService_Subscribe_FullMethodName = "/chat.ChatService/Subscribe"
|
ChatService_History_FullMethodName = "/chat.ChatService/History"
|
||||||
ChatService_Acknowledge_FullMethodName = "/chat.ChatService/Acknowledge"
|
ChatService_Subscribe_FullMethodName = "/chat.ChatService/Subscribe"
|
||||||
|
ChatService_Acknowledge_FullMethodName = "/chat.ChatService/Acknowledge"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChatServiceClient is the client API for ChatService service.
|
// 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:
|
// identifier and cannot be changed. Topics are persistent in the MVP:
|
||||||
// there is no delete API.
|
// there is no delete API.
|
||||||
UpdateTopic(ctx context.Context, in *UpdateTopicRequest, opts ...grpc.CallOption) (*Topic, error)
|
UpdateTopic(ctx context.Context, in *UpdateTopicRequest, opts ...grpc.CallOption) (*Topic, error)
|
||||||
// PostMessage appends a message to a topic. Repeated calls with the same
|
// PostMessage appends a message to a topic. NOTE: this RPC is fail-closed
|
||||||
// (author_id, idempotency_key) must not create a second message; the
|
// until the human-authentication stage: there is no trusted way to fill
|
||||||
// original message is returned with duplicated=true instead.
|
// 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)
|
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 returns a single message by id.
|
||||||
GetMessage(ctx context.Context, in *GetMessageRequest, opts ...grpc.CallOption) (*Message, error)
|
GetMessage(ctx context.Context, in *GetMessageRequest, opts ...grpc.CallOption) (*Message, error)
|
||||||
// History returns messages of a topic, paginated by sequence (no offset
|
// History returns messages of a topic, paginated by sequence (no offset
|
||||||
// pagination). Use before_sequence for newest-first backward paging or
|
// pagination). Use before_sequence for newest-first backward paging or
|
||||||
// after_sequence for oldest-first forward paging; at most one may be set.
|
// after_sequence for oldest-first forward paging; at most one may be set.
|
||||||
History(ctx context.Context, in *HistoryRequest, opts ...grpc.CallOption) (*HistoryResponse, error)
|
History(ctx context.Context, in *HistoryRequest, opts ...grpc.CallOption) (*HistoryResponse, error)
|
||||||
// Subscribe streams new messages of a topic to a consumer. The consumer is
|
// Subscribe opens the delivery stream of a topic for the authenticated
|
||||||
// expected to Acknowledge the messages it processed (at-least-once).
|
// consumer. Delivery is durable at-least-once: PostgreSQL (messages +
|
||||||
// NOTE: stream delivery is implemented in a later stage.
|
// per-(consumer, topic) delivery cursor) is the source of correctness;
|
||||||
Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Message], error)
|
// the stream is a live projection. Exactly one active subscription is
|
||||||
// Acknowledge advances the durable delivery cursor of a consumer in a
|
// admitted per (consumer, topic): a new Subscribe for the same pair
|
||||||
// topic. Cursors are monotonic: the stored value never moves backwards.
|
// 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)
|
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
|
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) {
|
func (c *chatServiceClient) GetMessage(ctx context.Context, in *GetMessageRequest, opts ...grpc.CallOption) (*Message, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(Message)
|
out := new(Message)
|
||||||
@ -145,13 +179,13 @@ func (c *chatServiceClient) History(ctx context.Context, in *HistoryRequest, opt
|
|||||||
return out, nil
|
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...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
stream, err := c.cc.NewStream(ctx, &ChatService_ServiceDesc.Streams[0], ChatService_Subscribe_FullMethodName, cOpts...)
|
stream, err := c.cc.NewStream(ctx, &ChatService_ServiceDesc.Streams[0], ChatService_Subscribe_FullMethodName, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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 {
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||||
return nil, err
|
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.
|
// 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) {
|
func (c *chatServiceClient) Acknowledge(ctx context.Context, in *AcknowledgeRequest, opts ...grpc.CallOption) (*AcknowledgeResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
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:
|
// identifier and cannot be changed. Topics are persistent in the MVP:
|
||||||
// there is no delete API.
|
// there is no delete API.
|
||||||
UpdateTopic(context.Context, *UpdateTopicRequest) (*Topic, error)
|
UpdateTopic(context.Context, *UpdateTopicRequest) (*Topic, error)
|
||||||
// PostMessage appends a message to a topic. Repeated calls with the same
|
// PostMessage appends a message to a topic. NOTE: this RPC is fail-closed
|
||||||
// (author_id, idempotency_key) must not create a second message; the
|
// until the human-authentication stage: there is no trusted way to fill
|
||||||
// original message is returned with duplicated=true instead.
|
// 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)
|
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 returns a single message by id.
|
||||||
GetMessage(context.Context, *GetMessageRequest) (*Message, error)
|
GetMessage(context.Context, *GetMessageRequest) (*Message, error)
|
||||||
// History returns messages of a topic, paginated by sequence (no offset
|
// History returns messages of a topic, paginated by sequence (no offset
|
||||||
// pagination). Use before_sequence for newest-first backward paging or
|
// pagination). Use before_sequence for newest-first backward paging or
|
||||||
// after_sequence for oldest-first forward paging; at most one may be set.
|
// after_sequence for oldest-first forward paging; at most one may be set.
|
||||||
History(context.Context, *HistoryRequest) (*HistoryResponse, error)
|
History(context.Context, *HistoryRequest) (*HistoryResponse, error)
|
||||||
// Subscribe streams new messages of a topic to a consumer. The consumer is
|
// Subscribe opens the delivery stream of a topic for the authenticated
|
||||||
// expected to Acknowledge the messages it processed (at-least-once).
|
// consumer. Delivery is durable at-least-once: PostgreSQL (messages +
|
||||||
// NOTE: stream delivery is implemented in a later stage.
|
// per-(consumer, topic) delivery cursor) is the source of correctness;
|
||||||
Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[Message]) error
|
// the stream is a live projection. Exactly one active subscription is
|
||||||
// Acknowledge advances the durable delivery cursor of a consumer in a
|
// admitted per (consumer, topic): a new Subscribe for the same pair
|
||||||
// topic. Cursors are monotonic: the stored value never moves backwards.
|
// 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)
|
Acknowledge(context.Context, *AcknowledgeRequest) (*AcknowledgeResponse, error)
|
||||||
mustEmbedUnimplementedChatServiceServer()
|
mustEmbedUnimplementedChatServiceServer()
|
||||||
}
|
}
|
||||||
@ -234,13 +291,16 @@ func (UnimplementedChatServiceServer) UpdateTopic(context.Context, *UpdateTopicR
|
|||||||
func (UnimplementedChatServiceServer) PostMessage(context.Context, *PostMessageRequest) (*PostMessageResponse, error) {
|
func (UnimplementedChatServiceServer) PostMessage(context.Context, *PostMessageRequest) (*PostMessageResponse, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method PostMessage not implemented")
|
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) {
|
func (UnimplementedChatServiceServer) GetMessage(context.Context, *GetMessageRequest) (*Message, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method GetMessage not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetMessage not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedChatServiceServer) History(context.Context, *HistoryRequest) (*HistoryResponse, error) {
|
func (UnimplementedChatServiceServer) History(context.Context, *HistoryRequest) (*HistoryResponse, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method History not implemented")
|
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")
|
return status.Error(codes.Unimplemented, "method Subscribe not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedChatServiceServer) Acknowledge(context.Context, *AcknowledgeRequest) (*AcknowledgeResponse, error) {
|
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)
|
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) {
|
func _ChatService_GetMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(GetMessageRequest)
|
in := new(GetMessageRequest)
|
||||||
if err := dec(in); err != nil {
|
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 {
|
if err := stream.RecvMsg(m); err != nil {
|
||||||
return err
|
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.
|
// 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) {
|
func _ChatService_Acknowledge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(AcknowledgeRequest)
|
in := new(AcknowledgeRequest)
|
||||||
@ -449,6 +527,10 @@ var ChatService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "PostMessage",
|
MethodName: "PostMessage",
|
||||||
Handler: _ChatService_PostMessage_Handler,
|
Handler: _ChatService_PostMessage_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "AgentPostMessage",
|
||||||
|
Handler: _ChatService_AgentPostMessage_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "GetMessage",
|
MethodName: "GetMessage",
|
||||||
Handler: _ChatService_GetMessage_Handler,
|
Handler: _ChatService_GetMessage_Handler,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user