diff --git a/gen/http/http.pb.go b/gen/http/http.pb.go index e648d77..c365b1e 100644 --- a/gen/http/http.pb.go +++ b/gen/http/http.pb.go @@ -80,10 +80,11 @@ type Request struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - Headers []*Header `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty"` - Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` + Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` + Headers []*Header `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty"` + Body []byte `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"` } func (x *Request) Reset() { @@ -118,6 +119,13 @@ func (*Request) Descriptor() ([]byte, []int) { return file_http_http_proto_rawDescGZIP(), []int{1} } +func (x *Request) GetId() string { + if x != nil { + return x.Id + } + return "" +} + func (x *Request) GetMethod() string { if x != nil { return x.Method @@ -151,8 +159,9 @@ type Response struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Headers []*Header `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` - Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Headers []*Header `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty"` + Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` } func (x *Response) Reset() { @@ -187,6 +196,13 @@ func (*Response) Descriptor() ([]byte, []int) { return file_http_http_proto_rawDescGZIP(), []int{2} } +func (x *Response) GetId() string { + if x != nil { + return x.Id + } + return "" +} + func (x *Response) GetHeaders() []*Header { if x != nil { return x.Headers @@ -256,18 +272,65 @@ func (x *Route) GetMethod() string { return "" } +type TemplateFS struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *TemplateFS) Reset() { + *x = TemplateFS{} + if protoimpl.UnsafeEnabled { + mi := &file_http_http_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateFS) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateFS) ProtoMessage() {} + +func (x *TemplateFS) ProtoReflect() protoreflect.Message { + mi := &file_http_http_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateFS.ProtoReflect.Descriptor instead. +func (*TemplateFS) Descriptor() ([]byte, []int) { + return file_http_http_proto_rawDescGZIP(), []int{4} +} + +func (x *TemplateFS) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + type Template struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Template string `protobuf:"bytes,1,opt,name=template,proto3" json:"template,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } func (x *Template) Reset() { *x = Template{} if protoimpl.UnsafeEnabled { - mi := &file_http_http_proto_msgTypes[4] + mi := &file_http_http_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -280,7 +343,7 @@ func (x *Template) String() string { func (*Template) ProtoMessage() {} func (x *Template) ProtoReflect() protoreflect.Message { - mi := &file_http_http_proto_msgTypes[4] + mi := &file_http_http_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -293,12 +356,12 @@ func (x *Template) ProtoReflect() protoreflect.Message { // Deprecated: Use Template.ProtoReflect.Descriptor instead. func (*Template) Descriptor() ([]byte, []int) { - return file_http_http_proto_rawDescGZIP(), []int{4} + return file_http_http_proto_rawDescGZIP(), []int{5} } -func (x *Template) GetTemplate() string { +func (x *Template) GetName() string { if x != nil { - return x.Template + return x.Name } return "" } @@ -314,7 +377,7 @@ type Router struct { func (x *Router) Reset() { *x = Router{} if protoimpl.UnsafeEnabled { - mi := &file_http_http_proto_msgTypes[5] + mi := &file_http_http_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -327,7 +390,7 @@ func (x *Router) String() string { func (*Router) ProtoMessage() {} func (x *Router) ProtoReflect() protoreflect.Message { - mi := &file_http_http_proto_msgTypes[5] + mi := &file_http_http_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -340,7 +403,7 @@ func (x *Router) ProtoReflect() protoreflect.Message { // Deprecated: Use Router.ProtoReflect.Descriptor instead. func (*Router) Descriptor() ([]byte, []int) { - return file_http_http_proto_rawDescGZIP(), []int{5} + return file_http_http_proto_rawDescGZIP(), []int{6} } func (x *Router) GetRoot() string { @@ -359,14 +422,16 @@ type HTTP struct { // // *HTTP_Route // *HTTP_Template + // *HTTP_TemplateFs // *HTTP_Router + // *HTTP_Response Type isHTTP_Type `protobuf_oneof:"type"` } func (x *HTTP) Reset() { *x = HTTP{} if protoimpl.UnsafeEnabled { - mi := &file_http_http_proto_msgTypes[6] + mi := &file_http_http_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -379,7 +444,7 @@ func (x *HTTP) String() string { func (*HTTP) ProtoMessage() {} func (x *HTTP) ProtoReflect() protoreflect.Message { - mi := &file_http_http_proto_msgTypes[6] + mi := &file_http_http_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -392,7 +457,7 @@ func (x *HTTP) ProtoReflect() protoreflect.Message { // Deprecated: Use HTTP.ProtoReflect.Descriptor instead. func (*HTTP) Descriptor() ([]byte, []int) { - return file_http_http_proto_rawDescGZIP(), []int{6} + return file_http_http_proto_rawDescGZIP(), []int{7} } func (m *HTTP) GetType() isHTTP_Type { @@ -416,6 +481,13 @@ func (x *HTTP) GetTemplate() *Template { return nil } +func (x *HTTP) GetTemplateFs() *TemplateFS { + if x, ok := x.GetType().(*HTTP_TemplateFs); ok { + return x.TemplateFs + } + return nil +} + func (x *HTTP) GetRouter() *Router { if x, ok := x.GetType().(*HTTP_Router); ok { return x.Router @@ -423,6 +495,13 @@ func (x *HTTP) GetRouter() *Router { return nil } +func (x *HTTP) GetResponse() *Response { + if x, ok := x.GetType().(*HTTP_Response); ok { + return x.Response + } + return nil +} + type isHTTP_Type interface { isHTTP_Type() } @@ -435,16 +514,28 @@ type HTTP_Template struct { Template *Template `protobuf:"bytes,10,opt,name=template,proto3,oneof"` } +type HTTP_TemplateFs struct { + TemplateFs *TemplateFS `protobuf:"bytes,11,opt,name=template_fs,json=templateFs,proto3,oneof"` +} + type HTTP_Router struct { - Router *Router `protobuf:"bytes,11,opt,name=router,proto3,oneof"` + Router *Router `protobuf:"bytes,12,opt,name=router,proto3,oneof"` +} + +type HTTP_Response struct { + Response *Response `protobuf:"bytes,13,opt,name=response,proto3,oneof"` } func (*HTTP_Route) isHTTP_Type() {} func (*HTTP_Template) isHTTP_Type() {} +func (*HTTP_TemplateFs) isHTTP_Type() {} + func (*HTTP_Router) isHTTP_Type() {} +func (*HTTP_Response) isHTTP_Type() {} + var File_http_http_proto protoreflect.FileDescriptor var file_http_http_proto_rawDesc = []byte{ @@ -452,43 +543,53 @@ var file_http_http_proto_rawDesc = []byte{ 0x6f, 0x12, 0x04, 0x68, 0x74, 0x74, 0x70, 0x22, 0x32, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x6f, 0x0a, 0x07, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, - 0x12, 0x26, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x7f, 0x0a, 0x07, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, + 0x12, 0x26, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x46, 0x0a, 0x08, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x68, 0x74, 0x74, 0x70, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x56, 0x0a, 0x08, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, - 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, + 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x33, 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x22, 0x26, 0x0a, 0x08, 0x54, 0x65, 0x6d, - 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, - 0x65, 0x22, 0x1c, 0x0a, 0x06, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x72, - 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x22, - 0x89, 0x01, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x12, 0x23, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x52, - 0x6f, 0x75, 0x74, 0x65, 0x48, 0x00, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x2c, 0x0a, - 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x48, - 0x00, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x68, 0x74, - 0x74, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x73, 0x0a, 0x08, 0x63, - 0x6f, 0x6d, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x42, 0x09, 0x48, 0x74, 0x74, 0x70, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x68, 0x74, - 0x74, 0x70, 0xa2, 0x02, 0x03, 0x48, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x48, 0x74, 0x74, 0x70, 0xca, - 0x02, 0x04, 0x48, 0x74, 0x74, 0x70, 0xe2, 0x02, 0x10, 0x48, 0x74, 0x74, 0x70, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x48, 0x74, 0x74, 0x70, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x22, 0x20, 0x0a, 0x0a, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x46, 0x53, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x1e, 0x0a, 0x08, 0x54, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x1c, 0x0a, 0x06, 0x52, + 0x6f, 0x75, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x22, 0xec, 0x01, 0x0a, 0x04, 0x48, 0x54, + 0x54, 0x50, 0x12, 0x23, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0b, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x48, 0x00, + 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x68, 0x74, 0x74, 0x70, + 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x74, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x5f, 0x66, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x68, 0x74, 0x74, + 0x70, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x46, 0x53, 0x48, 0x00, 0x52, 0x0a, + 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x46, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x6f, + 0x75, 0x74, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x68, 0x74, 0x74, + 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, + 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x73, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, + 0x68, 0x74, 0x74, 0x70, 0x42, 0x09, 0x48, 0x74, 0x74, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x68, 0x74, 0x74, 0x70, 0xa2, + 0x02, 0x03, 0x48, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x48, 0x74, 0x74, 0x70, 0xca, 0x02, 0x04, 0x48, + 0x74, 0x74, 0x70, 0xe2, 0x02, 0x10, 0x48, 0x74, 0x74, 0x70, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x48, 0x74, 0x74, 0x70, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -503,27 +604,30 @@ func file_http_http_proto_rawDescGZIP() []byte { return file_http_http_proto_rawDescData } -var file_http_http_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_http_http_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_http_http_proto_goTypes = []interface{}{ - (*Header)(nil), // 0: http.Header - (*Request)(nil), // 1: http.Request - (*Response)(nil), // 2: http.Response - (*Route)(nil), // 3: http.Route - (*Template)(nil), // 4: http.Template - (*Router)(nil), // 5: http.Router - (*HTTP)(nil), // 6: http.HTTP + (*Header)(nil), // 0: http.Header + (*Request)(nil), // 1: http.Request + (*Response)(nil), // 2: http.Response + (*Route)(nil), // 3: http.Route + (*TemplateFS)(nil), // 4: http.TemplateFS + (*Template)(nil), // 5: http.Template + (*Router)(nil), // 6: http.Router + (*HTTP)(nil), // 7: http.HTTP } var file_http_http_proto_depIdxs = []int32{ 0, // 0: http.Request.headers:type_name -> http.Header 0, // 1: http.Response.headers:type_name -> http.Header 3, // 2: http.HTTP.route:type_name -> http.Route - 4, // 3: http.HTTP.template:type_name -> http.Template - 5, // 4: http.HTTP.router:type_name -> http.Router - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 5, // 3: http.HTTP.template:type_name -> http.Template + 4, // 4: http.HTTP.template_fs:type_name -> http.TemplateFS + 6, // 5: http.HTTP.router:type_name -> http.Router + 2, // 6: http.HTTP.response:type_name -> http.Response + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_http_http_proto_init() } @@ -581,7 +685,7 @@ func file_http_http_proto_init() { } } file_http_http_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Template); i { + switch v := v.(*TemplateFS); i { case 0: return &v.state case 1: @@ -593,7 +697,7 @@ func file_http_http_proto_init() { } } file_http_http_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Router); i { + switch v := v.(*Template); i { case 0: return &v.state case 1: @@ -605,6 +709,18 @@ func file_http_http_proto_init() { } } file_http_http_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Router); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_http_http_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HTTP); i { case 0: return &v.state @@ -617,10 +733,12 @@ func file_http_http_proto_init() { } } } - file_http_http_proto_msgTypes[6].OneofWrappers = []interface{}{ + file_http_http_proto_msgTypes[7].OneofWrappers = []interface{}{ (*HTTP_Route)(nil), (*HTTP_Template)(nil), + (*HTTP_TemplateFs)(nil), (*HTTP_Router)(nil), + (*HTTP_Response)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -628,7 +746,7 @@ func file_http_http_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_http_http_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/gen/project.pb.go b/gen/project.pb.go index cf2bb96..3e7bc9b 100644 --- a/gen/project.pb.go +++ b/gen/project.pb.go @@ -1000,8 +1000,7 @@ type NodeExecution struct { unknownFields protoimpl.UnknownFields NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Input string `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"` - Output string `protobuf:"bytes,3,opt,name=output,proto3" json:"output,omitempty"` + Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` } func (x *NodeExecution) Reset() { @@ -1043,13 +1042,6 @@ func (x *NodeExecution) GetNodeId() string { return "" } -func (x *NodeExecution) GetInput() string { - if x != nil { - return x.Input - } - return "" -} - func (x *NodeExecution) GetOutput() string { if x != nil { return x.Output @@ -2295,229 +2287,227 @@ var file_project_proto_rawDesc = []byte{ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x45, 0x78, 0x65, 0x63, 0x73, 0x22, 0x56, 0x0a, + 0x6f, 0x6e, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x45, 0x78, 0x65, 0x63, 0x73, 0x22, 0x40, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x4c, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, - 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, - 0x65, 0x49, 0x64, 0x22, 0xc2, 0x04, 0x0a, 0x0c, 0x47, 0x52, 0x50, 0x43, 0x54, 0x79, 0x70, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x38, 0x0a, 0x06, - 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x06, - 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x5f, 0x6c, - 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x50, 0x43, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x0a, 0x64, 0x65, 0x73, 0x63, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x12, 0x46, - 0x0a, 0x0b, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, - 0x50, 0x43, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4c, - 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x65, 0x6e, 0x75, 0x6d, - 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x12, - 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x1a, 0x5f, 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x63, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, + 0x4c, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0xc2, 0x04, + 0x0a, 0x0c, 0x47, 0x52, 0x50, 0x43, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, + 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, + 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x38, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x1a, 0x63, 0x0a, 0x0f, 0x45, 0x6e, 0x75, 0x6d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, - 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x6c, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, - 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x21, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x32, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x47, 0x52, 0x50, 0x43, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x74, 0x79, - 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x61, 0x0a, 0x0b, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, - 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x61, 0x6c, - 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x12, - 0x28, 0x0a, 0x05, 0x67, 0x72, 0x61, 0x70, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x05, 0x67, 0x72, 0x61, 0x70, 0x68, 0x22, 0x27, 0x0a, 0x09, 0x47, 0x72, 0x61, - 0x70, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x02, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, - 0x01, 0x79, 0x22, 0x85, 0x01, 0x0a, 0x12, 0x52, 0x75, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, - 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, - 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x1c, 0x0a, 0x04, 0x44, 0x61, - 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x6d, 0x0a, - 0x12, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, - 0x2b, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, + 0x12, 0x46, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x5f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x52, 0x50, 0x43, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x44, 0x65, 0x73, + 0x63, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x64, 0x65, + 0x73, 0x63, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x12, 0x46, 0x0a, 0x0b, 0x65, 0x6e, 0x75, 0x6d, + 0x5f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x50, 0x43, 0x54, 0x79, 0x70, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, + 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x5f, 0x0a, 0x0f, + 0x44, 0x65, 0x73, 0x63, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x63, 0x0a, + 0x0f, 0x45, 0x6e, 0x75, 0x6d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x3a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 0x6c, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x32, 0x0a, 0x09, + 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x50, 0x43, 0x54, 0x79, + 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x22, 0x61, 0x0a, 0x0b, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x05, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x28, 0x0a, 0x05, 0x67, 0x72, 0x61, + 0x70, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x67, 0x72, + 0x61, 0x70, 0x68, 0x22, 0x27, 0x0a, 0x09, 0x47, 0x72, 0x61, 0x70, 0x68, 0x44, 0x61, 0x74, 0x61, + 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x01, 0x78, 0x12, 0x0c, + 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x01, 0x79, 0x22, 0x85, 0x01, 0x0a, + 0x12, 0x52, 0x75, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, + 0x6e, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x22, 0x1c, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x23, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x6d, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, + 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x28, 0x0a, 0x12, - 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4e, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, - 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x2a, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, - 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x26, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, - 0x43, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x22, 0x34, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x8b, 0x01, 0x0a, 0x12, 0x45, - 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x12, 0x27, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x4e, 0x6f, 0x64, 0x65, - 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x05, 0x6e, 0x6f, - 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x67, 0x72, 0x61, 0x70, - 0x68, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x29, 0x0a, - 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x52, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x51, 0x0a, 0x14, - 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x22, - 0x57, 0x0a, 0x12, 0x53, 0x61, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2b, 0x0a, 0x05, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, + 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x28, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x22, 0x4e, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, + 0x22, 0x2a, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x15, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x22, 0x26, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x43, 0x0a, 0x15, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x34, + 0x0a, 0x13, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x05, 0x67, 0x72, 0x61, 0x70, 0x68, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x47, 0x72, 0x61, 0x70, - 0x68, 0x52, 0x05, 0x67, 0x72, 0x61, 0x70, 0x68, 0x22, 0x41, 0x0a, 0x13, 0x53, 0x61, 0x76, 0x65, - 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x2a, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2a, 0x32, 0x0a, 0x0d, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, - 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, - 0x44, 0x59, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x32, - 0x95, 0x09, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x4e, 0x65, 0x77, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x2e, - 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x4e, 0x6f, 0x64, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x4e, 0x65, 0x77, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x00, 0x12, - 0x43, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x74, 0x12, 0x18, 0x2e, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x53, 0x65, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x30, 0x01, 0x12, 0x50, 0x0a, 0x0d, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, - 0x78, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0b, 0x4c, 0x6f, 0x61, 0x64, 0x50, 0x72, + 0x63, 0x74, 0x49, 0x64, 0x22, 0x8b, 0x01, 0x0a, 0x12, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, + 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x4e, 0x6f, 0x64, 0x65, + 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, + 0x66, 0x6f, 0x22, 0x52, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x2c, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x51, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, + 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x09, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x22, 0x57, 0x0a, 0x12, 0x53, 0x61, 0x76, + 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x22, + 0x0a, 0x05, 0x67, 0x72, 0x61, 0x70, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, + 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x52, 0x05, 0x67, 0x72, 0x61, + 0x70, 0x68, 0x22, 0x41, 0x0a, 0x13, 0x53, 0x61, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2a, 0x32, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x01, 0x12, 0x09, + 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x32, 0x95, 0x09, 0x0a, 0x0e, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x07, + 0x4e, 0x65, 0x77, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x4e, 0x6f, + 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0f, + 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, + 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x08, 0x53, 0x65, 0x6e, + 0x64, 0x43, 0x68, 0x61, 0x74, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x53, 0x65, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x68, + 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x50, + 0x0a, 0x0d, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, + 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, + 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, + 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x50, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x4a, 0x0a, 0x0b, 0x4c, 0x6f, 0x61, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, + 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0a, + 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x50, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x12, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1c, 0x2e, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0b, 0x47, 0x65, + 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0b, 0x53, 0x61, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x4c, 0x6f, 0x61, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4c, 0x6f, 0x61, - 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0b, 0x47, - 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x0d, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x12, 0x45, - 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x73, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x4a, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0b, - 0x53, 0x61, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0b, 0x52, 0x75, 0x6e, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x52, 0x75, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4e, - 0x6f, 0x64, 0x65, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x30, 0x01, - 0x12, 0x4d, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x70, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, - 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x57, 0x6f, 0x72, - 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x56, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x75, - 0x6e, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, - 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, - 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6e, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x80, 0x01, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x42, 0x0c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2d, 0x6c, 0x61, - 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x67, 0x65, 0x6e, - 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0xca, 0x02, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0xe2, 0x02, 0x13, 0x50, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x53, 0x61, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x61, 0x76, + 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0b, 0x52, 0x75, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, + 0x77, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x75, 0x6e, 0x57, + 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, + 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x45, 0x78, 0x65, + 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x30, 0x01, 0x12, 0x4d, 0x0a, 0x0c, 0x53, 0x74, + 0x6f, 0x70, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, + 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x56, 0x0a, 0x0f, 0x47, 0x65, 0x74, + 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6e, 0x73, 0x12, 0x1f, 0x2e, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x52, 0x75, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x42, 0x80, 0x01, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x42, 0x0c, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x67, 0x65, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, + 0xaa, 0x02, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0xca, 0x02, 0x07, 0x50, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0xe2, 0x02, 0x13, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x07, 0x50, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/gen/reason/reason.pb.go b/gen/reason/reason.pb.go index 366c1e3..dcb99c0 100644 --- a/gen/reason/reason.pb.go +++ b/gen/reason/reason.pb.go @@ -25,7 +25,8 @@ type Prompt struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"` + Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"` + MinTokenCount uint64 `protobuf:"varint,2,opt,name=min_token_count,json=minTokenCount,proto3" json:"min_token_count,omitempty"` } func (x *Prompt) Reset() { @@ -67,6 +68,13 @@ func (x *Prompt) GetPrompt() string { return "" } +func (x *Prompt) GetMinTokenCount() uint64 { + if x != nil { + return x.MinTokenCount + } + return 0 +} + type Engine struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -190,25 +198,28 @@ var File_reason_reason_proto protoreflect.FileDescriptor var file_reason_reason_proto_rawDesc = []byte{ 0x0a, 0x13, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x2f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x20, 0x0a, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x48, 0x0a, 0x06, 0x50, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x70, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x22, - 0x08, 0x0a, 0x06, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x22, 0x64, 0x0a, 0x06, 0x52, 0x65, 0x61, - 0x73, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, - 0x6d, 0x70, 0x74, 0x48, 0x00, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x12, 0x28, 0x0a, - 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x48, 0x00, 0x52, - 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, - 0x81, 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0x0b, - 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x66, - 0x6c, 0x6f, 0x77, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x66, 0x6c, - 0x6f, 0x77, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0xa2, 0x02, 0x03, - 0x52, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0xca, 0x02, 0x06, 0x52, - 0x65, 0x61, 0x73, 0x6f, 0x6e, 0xe2, 0x02, 0x12, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x52, 0x65, 0x61, - 0x73, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x12, + 0x26, 0x0a, 0x0f, 0x6d, 0x69, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x08, 0x0a, 0x06, 0x45, 0x6e, 0x67, 0x69, 0x6e, + 0x65, 0x22, 0x64, 0x0a, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x06, 0x70, + 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x72, 0x65, + 0x61, 0x73, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x48, 0x00, 0x52, 0x06, 0x70, + 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x12, 0x28, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x2e, 0x45, + 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x48, 0x00, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x42, + 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x81, 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, + 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0x0b, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2d, 0x6c, 0x61, 0x62, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x72, + 0x65, 0x61, 0x73, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x52, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x52, 0x65, + 0x61, 0x73, 0x6f, 0x6e, 0xca, 0x02, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0xe2, 0x02, 0x12, + 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/package-lock.json b/package-lock.json index d4666a6..3dd3e1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "@types/react-dom": "18.0.11", "@types/react-syntax-highlighter": "^15.5.6", "bootstrap": "^5.3.0", + "d3-hierarchy": "^3.1.2", "esbuild-plugin-swc": "^1.0.1", "esbuild-style-plugin": "^1.6.1", "eslint": "8.39.0", @@ -3454,6 +3455,14 @@ "node": ">=12" } }, + "node_modules/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "engines": { + "node": ">=12" + } + }, "node_modules/d3-interpolate": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", @@ -9486,6 +9495,11 @@ "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==" }, + "d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==" + }, "d3-interpolate": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", diff --git a/package.json b/package.json index 0c2db02..39febff 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@types/react-dom": "18.0.11", "@types/react-syntax-highlighter": "^15.5.6", "bootstrap": "^5.3.0", + "d3-hierarchy": "^3.1.2", "esbuild-plugin-swc": "^1.0.1", "esbuild-style-plugin": "^1.6.1", "eslint": "8.39.0", diff --git a/pkg/graph/edge/base.go b/pkg/graph/edge/base.go index 357c851..59fae41 100644 --- a/pkg/graph/edge/base.go +++ b/pkg/graph/edge/base.go @@ -20,10 +20,6 @@ func (b *Base) ID() string { return b.Edge.Id } -func (b *Base) CanWire() bool { - return true -} - func NewBase(edge *gen.Edge) *Base { return &Base{ Edge: edge, diff --git a/pkg/graph/edge/provides.go b/pkg/graph/edge/provides.go index 48f926e..0f76e90 100644 --- a/pkg/graph/edge/provides.go +++ b/pkg/graph/edge/provides.go @@ -17,10 +17,6 @@ func NewProvides(edge *gen.Edge, p *gen.Provides) graph.Edge { } } -func (p *Provides) CanWire() bool { - return false -} - func (p *Provides) Connect(from, to graph.Node) error { return to.SetProvider(from) } diff --git a/pkg/graph/graph.go b/pkg/graph/graph.go index 0552e6e..640d483 100644 --- a/pkg/graph/graph.go +++ b/pkg/graph/graph.go @@ -3,6 +3,7 @@ package graph import ( "context" "github.com/pkg/errors" + "github.com/protoflow-labs/protoflow/gen" "github.com/protoflow-labs/protoflow/pkg/grpc" "github.com/protoflow-labs/protoflow/pkg/grpc/manager" "github.com/reactivex/rxgo/v2" @@ -44,9 +45,8 @@ type Node interface { ID() string // TODO breadchris type should probably just return a message descriptor Type() (*Info, error) - // Method returns the method descriptor for input and output of the node. - // Method() (*Info, error) - Init() (func(), error) + + Provide() ([]*gen.Node, error) // Provider returns the node that this node depends on. (eg. a grpc method node will return the service node) Provider() (Node, error) @@ -75,5 +75,4 @@ type Edge interface { From() string To() string Connect(from, to Node) error - CanWire() bool } diff --git a/pkg/graph/node/base/node.go b/pkg/graph/node/base/node.go index 8c58fa8..1ed7ad7 100644 --- a/pkg/graph/node/base/node.go +++ b/pkg/graph/node/base/node.go @@ -62,8 +62,8 @@ func (n *Node) Method() (*graph.Info, error) { return nil, errors.New("not implemented") } -func (n *Node) Init() (func(), error) { - return func() {}, nil +func (n *Node) Provide() ([]*gen.Node, error) { + return []*gen.Node{}, nil } // TODO breadchris this should be more robust and take into consideration type types of edges into the node diff --git a/pkg/graph/node/code/server.go b/pkg/graph/node/code/server.go index 8e448ab..d69058b 100644 --- a/pkg/graph/node/code/server.go +++ b/pkg/graph/node/code/server.go @@ -3,14 +3,12 @@ package code import ( "context" "github.com/pkg/errors" + "github.com/protoflow-labs/protoflow/gen" "github.com/protoflow-labs/protoflow/gen/code" "github.com/protoflow-labs/protoflow/pkg/graph" "github.com/protoflow-labs/protoflow/pkg/graph/node/base" "github.com/protoflow-labs/protoflow/pkg/graph/node/grpc" - "github.com/rs/zerolog/log" - "net" - "net/url" - "time" + igrpc "github.com/protoflow-labs/protoflow/pkg/grpc" ) type Server struct { @@ -46,42 +44,14 @@ func (r *Server) GetServer() *grpc.Server { return r.GRPC } -func (r *Server) Init() (func(), error) { - if r.Grpc != nil { - return r.GRPC.Init() - } - return nil, nil -} - func (r *Server) Type() (*graph.Info, error) { return nil, errors.New("implement me") } func (r *Server) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { - //TODO implement me - panic("implement me") + return input, nil } -func ensureRunning(host string) error { - maxRetries := 1 - retryInterval := 2 * time.Second - - u, err := url.Parse(host) - if err != nil { - return errors.Wrapf(err, "unable to parse url %s", host) - } - - log.Debug().Str("host", host).Msg("waiting for host to come online") - for i := 1; i <= maxRetries; i++ { - conn, err := net.DialTimeout("tcp", u.Host, time.Second) - if err == nil { - conn.Close() - log.Debug().Str("host", host).Msg("host is not listening") - return nil - } else { - log.Debug().Err(err).Int("attempt", i).Int("max", maxRetries).Msg("error connecting to host") - time.Sleep(retryInterval) - } - } - return errors.New("host did not come online in time") +func (r *Server) Provide() ([]*gen.Node, error) { + return igrpc.EnumerateResourceBlocks(r.Grpc, false) } diff --git a/pkg/graph/node/grpc/method.go b/pkg/graph/node/grpc/method.go index fdcaa72..a84a427 100644 --- a/pkg/graph/node/grpc/method.go +++ b/pkg/graph/node/grpc/method.go @@ -50,7 +50,7 @@ func NewMethodProto(packageService, m string) *pgrpc.GRPC { func GetMethodFromServer(r *Server, n *Method, protocol bufcurl.ReflectProtocol) (protoreflect.MethodDescriptor, error) { // TODO breadchris I think a grpc resource should have a host that has a protocol - m := manager.NewReflectionManager("http://"+r.Host, manager.WithProtocol(protocol)) + m := manager.NewReflectionManager(r.Host, manager.WithProtocol(protocol)) cleanup, err := m.Init() if err != nil { return nil, errors.Wrapf(err, "error initializing reflection manager") diff --git a/pkg/graph/node/grpc/server.go b/pkg/graph/node/grpc/server.go index 70e0999..8605fcb 100644 --- a/pkg/graph/node/grpc/server.go +++ b/pkg/graph/node/grpc/server.go @@ -2,9 +2,11 @@ package grpc import ( "context" + "github.com/protoflow-labs/protoflow/gen" pgrpc "github.com/protoflow-labs/protoflow/gen/grpc" "github.com/protoflow-labs/protoflow/pkg/graph" "github.com/protoflow-labs/protoflow/pkg/graph/node/base" + "github.com/protoflow-labs/protoflow/pkg/grpc" "strings" ) @@ -18,6 +20,10 @@ type ServerProvider interface { } func NewServer(b *base.Node, n *pgrpc.Server) *Server { + // TODO breadchris this shouldn't be here + if !strings.HasPrefix(n.Host, "http://") { + n.Host = "http://" + n.Host + } return &Server{ Node: b, Server: n, @@ -38,20 +44,10 @@ func (n *Server) GetServer() *Server { return n } -func (n *Server) Init() (func(), error) { - // TODO breadchris this is a hack to get the grpc server running, this is not ideal - if !strings.HasPrefix(n.Host, "http://") { - n.Host = "http://" + n.Host - } - //if err := ensureRunning(r.Host); err != nil { - // // TODO breadchris ignore errors for now - // // return nil, errors.Wrapf(err, "unable to get the %s grpc server running", r.Name()) - // return nil, nil - //} - return nil, nil +func (n *Server) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { + return input, nil } -func (n *Server) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { - //TODO implement me - panic("implement me") +func (n *Server) Provide() ([]*gen.Node, error) { + return grpc.EnumerateResourceBlocks(n.Server, false) } diff --git a/pkg/graph/node/http/http.go b/pkg/graph/node/http/http.go index 2f2f4c4..24a5387 100644 --- a/pkg/graph/node/http/http.go +++ b/pkg/graph/node/http/http.go @@ -48,16 +48,13 @@ type Router struct { var _ graph.Node = &Router{} func NewRouterNode(b *base.Node, node *http.Router) *Router { - return &Router{ + r := &Router{ Node: b, Router: node, } -} - -func (r *Router) Init() (func(), error) { // TODO breadchris proper dependency injection will need to be figured out to make this work r.HTTPStream = NewHTTPEventStream() - return nil, nil + return r } func (r *Router) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { diff --git a/pkg/graph/node/http/node.go b/pkg/graph/node/http/node.go index c8f4ed9..2fda3c5 100644 --- a/pkg/graph/node/http/node.go +++ b/pkg/graph/node/http/node.go @@ -1,6 +1,8 @@ package http import ( + "github.com/google/uuid" + "github.com/protoflow-labs/protoflow/gen" "github.com/protoflow-labs/protoflow/gen/http" "github.com/protoflow-labs/protoflow/pkg/graph" "github.com/protoflow-labs/protoflow/pkg/graph/node/base" @@ -14,7 +16,19 @@ func New(b *base.Node, node *http.HTTP) graph.Node { return NewRouterNode(b, t.Router) case *http.HTTP_Template: return NewTemplateNode(b, t.Template) + case *http.HTTP_TemplateFs: + return NewTemplateFSNode(b, t.TemplateFs) default: return nil } } + +func NewProto(name string, c *http.HTTP) *gen.Node { + return &gen.Node{ + Id: uuid.NewString(), + Name: name, + Type: &gen.Node_Http{ + Http: c, + }, + } +} diff --git a/pkg/graph/node/http/response.go b/pkg/graph/node/http/response.go new file mode 100644 index 0000000..417e20a --- /dev/null +++ b/pkg/graph/node/http/response.go @@ -0,0 +1,55 @@ +package http + +import ( + "context" + "fmt" + "github.com/protoflow-labs/protoflow/gen/http" + "github.com/protoflow-labs/protoflow/pkg/graph" + "github.com/protoflow-labs/protoflow/pkg/graph/node/base" + "github.com/protoflow-labs/protoflow/pkg/util/rx" + "github.com/reactivex/rxgo/v2" +) + +type Response struct { + *base.Node + *http.Response +} + +var _ graph.Node = &Response{} + +func NewResponse(b *base.Node, node *http.Response) *Response { + return &Response{ + Node: b, + Response: node, + } +} + +func (n *Response) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { + output := make(chan rxgo.Item) + p, err := n.Provider() + if err != nil { + return graph.IO{}, err + } + routerResource, ok := p.(*Router) + if !ok { + return graph.IO{}, fmt.Errorf("error getting http router resource: %v", n.Response) + } + + input.Observable.ForEach(func(item any) { + r, ok := item.(*http.Response) + if !ok { + output <- rx.NewError(fmt.Errorf("error getting http request from stream")) + return + } + routerResource.HTTPStream.Responses <- r + output <- rx.NewItem(r) + }, func(err error) { + output <- rx.NewError(err) + }, func() { + close(output) + }) + + return graph.IO{ + Observable: rxgo.FromChannel(output, rxgo.WithPublishStrategy()), + }, nil +} diff --git a/pkg/graph/node/http/route.go b/pkg/graph/node/http/route.go index ce4054d..b9ad956 100644 --- a/pkg/graph/node/http/route.go +++ b/pkg/graph/node/http/route.go @@ -3,6 +3,7 @@ package http import ( "context" "fmt" + "github.com/google/uuid" "github.com/pkg/errors" "github.com/protoflow-labs/protoflow/gen/http" "github.com/protoflow-labs/protoflow/pkg/graph" @@ -56,6 +57,7 @@ func (n *RouteNode) Wire(ctx context.Context, input graph.IO) (graph.IO, error) if u.Path != n.Path(routerResource) || r.Method != n.Route.Method { return } + r.Id = uuid.NewString() output <- rx.NewItem(r) }, func(err error) { output <- rx.NewError(err) diff --git a/pkg/graph/node/http/template.go b/pkg/graph/node/http/template.go index cd0a12c..4d4cf36 100644 --- a/pkg/graph/node/http/template.go +++ b/pkg/graph/node/http/template.go @@ -3,14 +3,93 @@ package http import ( "bytes" "context" + "github.com/pkg/errors" + "github.com/protoflow-labs/protoflow/gen" "github.com/protoflow-labs/protoflow/gen/http" "github.com/protoflow-labs/protoflow/pkg/graph" "github.com/protoflow-labs/protoflow/pkg/graph/node/base" + "github.com/protoflow-labs/protoflow/pkg/graph/node/storage" "github.com/protoflow-labs/protoflow/pkg/util/rx" "github.com/reactivex/rxgo/v2" "html/template" + "net/url" + "os" + "path" + "path/filepath" ) +type TemplateFSNode struct { + *base.Node + *http.TemplateFS +} + +var _ graph.Node = &TemplateFSNode{} + +func NewTemplateFSNode(b *base.Node, node *http.TemplateFS) *TemplateFSNode { + return &TemplateFSNode{ + Node: b, + TemplateFS: node, + } +} + +func nodesFromFiles(u string) ([]*gen.Node, error) { + parsedUrl, err := url.Parse(u) + if err != nil { + return nil, errors.Wrapf(err, "failed to parse url %s", u) + } + + var nodes []*gen.Node + err = filepath.WalkDir(parsedUrl.Path, func(p string, d os.DirEntry, err error) error { + if d.IsDir() { + return nil + } + rel, err := filepath.Rel(parsedUrl.Path, p) + if err != nil { + return errors.Wrapf(err, "failed to get relative path") + } + // TODO breadchris templates don't accept any paths it seems. how do we want to structure this to avoid template name collisions? + nodes = append(nodes, NewProto(rel, NewTemplateProto(path.Base(rel)))) + return nil + }) + if err != nil { + return nil, errors.Wrapf(err, "failed to walk dir %s", parsedUrl.Path) + } + return nodes, nil +} + +func (n *TemplateFSNode) Provide() ([]*gen.Node, error) { + p, err := n.Provider() + if err != nil { + return nil, errors.Wrapf(err, "error getting provider") + } + f, ok := p.(*storage.Folder) + if !ok { + return nil, errors.Wrapf(err, "error getting folder") + } + return nodesFromFiles(f.Url) +} + +func (n *TemplateFSNode) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { + return input, nil +} + +func (n *TemplateFSNode) templates(name string) (*template.Template, error) { + p, err := n.Provider() + if err != nil { + return nil, errors.Wrapf(err, "error getting provider") + } + f, ok := p.(*storage.Folder) + if !ok { + return nil, errors.Wrapf(err, "error getting folder") + } + parsedUrl, err := url.Parse(f.Url) + if err != nil { + return nil, errors.Wrapf(err, "failed to parse url %s", f.Url) + } + tmplPath := path.Join(parsedUrl.Path, n.Path) + return template.New(name).ParseFS(os.DirFS(tmplPath), "**/*.html") +} + type TemplateNode struct { *base.Node *http.Template @@ -25,17 +104,35 @@ func NewTemplateNode(b *base.Node, node *http.Template) *TemplateNode { } } +func NewTemplateProto(t string) *http.HTTP { + return &http.HTTP{ + Type: &http.HTTP_Template{ + Template: &http.Template{ + Name: t, + }, + }, + } +} + func (n *TemplateNode) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { output := make(chan rxgo.Item) + p, err := n.Provider() + if err != nil { + return graph.IO{}, errors.Wrapf(err, "error getting provider") + } + t, ok := p.(*TemplateFSNode) + if !ok { + return graph.IO{}, errors.Wrapf(err, "error getting folder") + } + tmpls, err := t.templates(n.Template.Name) + if err != nil { + return graph.IO{}, errors.Wrapf(err, "error getting templates") + } + input.Observable.ForEach(func(item any) { - tmpl, err := template.New(n.NormalizedName()).Parse(n.Template.Template) - if err != nil { - output <- rx.NewError(err) - return - } b := &bytes.Buffer{} - err = tmpl.Execute(b, item) + err = tmpls.Execute(b, item) if err != nil { output <- rx.NewError(err) return diff --git a/pkg/graph/node/reason/reason.go b/pkg/graph/node/reason/reason.go index 3867f62..653d8a9 100644 --- a/pkg/graph/node/reason/reason.go +++ b/pkg/graph/node/reason/reason.go @@ -5,6 +5,7 @@ import ( "encoding/json" "github.com/jhump/protoreflect/desc/builder" "github.com/pkg/errors" + "github.com/protoflow-labs/protoflow/gen" "github.com/protoflow-labs/protoflow/gen/reason" "github.com/protoflow-labs/protoflow/pkg/graph" "github.com/protoflow-labs/protoflow/pkg/graph/node/base" @@ -115,7 +116,7 @@ func (n *PromptNode) Wire(ctx context.Context, input graph.IO) (graph.IO, error) Content: normalizedItem, }) - s, err := r.QAClient.Ask(c) + s, err := r.QAClient.Ask(c, int(n.MinTokenCount)) if err != nil { outputStream <- rx.NewError(errors.Wrapf(err, "error executing prompt: %s", n.NormalizedName())) } @@ -149,7 +150,7 @@ func NewEngineNode(b *base.Node, node *reason.Engine) *Engine { } } -func (n *Engine) Init() (func(), error) { +func (n *Engine) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { // TODO breadchris replace with some type of dependency injection capability var ( configProvider config.Provider @@ -160,32 +161,32 @@ func (n *Engine) Init() (func(), error) { } p, err := n.Provider() if err != nil { - return nil, err + return graph.IO{}, err } t, ok := p.(*data.ConfigNode) if !ok { - return nil, errors.New("error getting config node resource") + return graph.IO{}, errors.New("error getting config node resource") } // TODO breadchris how do we handle resources that need to be initialized before others? configProvider, err = t.NewConfigProvider(config.Static(staticConfig)) if err != nil { - return nil, errors.Wrapf(err, "failed to build config provider") + return graph.IO{}, errors.Wrapf(err, "failed to build config provider") } if configProvider == nil { - return nil, errors.New("config provider not found") + return graph.IO{}, errors.New("config provider not found") } c, err := openaiclient.Wire(configProvider) if err != nil { - return nil, errors.Wrapf(err, "failed to initialize openai client") + return graph.IO{}, errors.Wrapf(err, "failed to initialize openai client") } n.QAClient = c - return nil, nil -} - -func (n *Engine) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { return graph.IO{ Observable: input.Observable, }, nil } + +func (n *Engine) Provide() ([]*gen.Node, error) { + return []*gen.Node{NewProto("prompt", NewPromptProto())}, nil +} diff --git a/pkg/graph/node/storage/docs.go b/pkg/graph/node/storage/docs.go index a3bf630..1dcae5a 100644 --- a/pkg/graph/node/storage/docs.go +++ b/pkg/graph/node/storage/docs.go @@ -34,10 +34,6 @@ func NewStore(b *base.Node, n *storage.Store) *Store { } } -func (r *Store) Init() (func(), error) { - return nil, nil -} - func (r *Store) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { //TODO implement me panic("implement me") @@ -104,26 +100,22 @@ func NewCollection(b *base.Node, n *storage.Collection) *Collection { } } -func (n *Collection) Init() (func(), error) { +func (n *Collection) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { p, err := n.Provider() if err != nil { - return nil, errors.Wrapf(err, "error getting provider") + return graph.IO{}, errors.Wrapf(err, "error getting provider") } d, ok := p.(*Store) if !ok { - return nil, errors.New("error provider is not a docstore") + return graph.IO{}, errors.New("error provider is not a docstore") } collection, cleanup, err := d.WithCollection(n.Collection.Name) if err != nil { - return nil, errors.Wrapf(err, "error connecting to collection") + return graph.IO{}, errors.Wrapf(err, "error connecting to collection") } n.collection = collection - return cleanup, nil -} - -func (n *Collection) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { insertWithID := func(record map[string]any) (string, error) { if record["id"] == nil { record["id"] = uuid.NewString() @@ -168,6 +160,7 @@ func (n *Collection) Wire(ctx context.Context, input graph.IO) (graph.IO, error) output <- rx.NewError(err) }, func() { close(output) + cleanup() }) return graph.IO{ diff --git a/pkg/graph/node/storage/files.go b/pkg/graph/node/storage/files.go index 359cdff..b10e0c8 100644 --- a/pkg/graph/node/storage/files.go +++ b/pkg/graph/node/storage/files.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "github.com/pkg/errors" + "github.com/protoflow-labs/protoflow/gen" "github.com/protoflow-labs/protoflow/gen/storage" "github.com/protoflow-labs/protoflow/pkg/graph" "github.com/protoflow-labs/protoflow/pkg/graph/node/base" @@ -13,9 +14,62 @@ import ( "github.com/rs/zerolog/log" "gocloud.dev/blob" "net/url" + "os" "path" ) +type File struct { + *base.Node + *storage.File +} + +var _ graph.Node = &File{} + +func NewFile(b *base.Node, node *storage.File) *File { + return &File{ + Node: b, + File: node, + } +} + +func NewFileProto(path string) *storage.Storage { + return &storage.Storage{ + Type: &storage.Storage_File{ + File: &storage.File{ + Path: path, + }, + }, + } +} + +func (n *File) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { + p, err := n.Provider() + if err != nil { + return graph.IO{}, errors.Wrapf(err, "error getting provider") + } + + f, ok := p.(*Folder) + if !ok { + return graph.IO{}, errors.Wrapf(err, "error getting folder") + } + u, err := url.Parse(f.Url) + if err != nil { + return graph.IO{}, errors.Wrapf(err, "error parsing filestore url") + } + filepath := path.Join(u.Path, n.File.Path) + + // TODO breadchris verify file exists? + obs := rxgo.Defer([]rxgo.Producer{func(ctx context.Context, next chan<- rxgo.Item) { + // TODO breadchris this should be a static type. This is a brittle type that maps to workflow.go:133 + next <- rx.NewItem(map[string]any{ + "path": filepath, + }) + }}) + return graph.IO{ + Observable: obs, + }, nil +} + type Folder struct { *base.Node *storage.Folder @@ -30,8 +84,14 @@ func NewFolder(b *base.Node, node *storage.Folder) *Folder { } } -func (r *Folder) Init() (func(), error) { - return nil, nil +func NewFolderProto(url string) *storage.Storage { + return &storage.Storage{ + Type: &storage.Storage_Folder{ + Folder: &storage.Folder{ + Url: url, + }, + }, + } } func (r *Folder) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { @@ -89,44 +149,25 @@ func (r *Folder) WithPath(path string) (*blob.Bucket, func(), error) { }, nil } -type File struct { - *base.Node - *storage.File -} - -var _ graph.Node = &File{} - -func NewFile(b *base.Node, node *storage.File) *File { - return &File{ - Node: b, - File: node, +func nodesFromFiles(u string) ([]*gen.Node, error) { + parsedUrl, err := url.Parse(u) + if err != nil { + return nil, errors.Wrapf(err, "failed to parse url %s", u) } -} - -func (n *File) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { - p, err := n.Provider() + // TODO breadchris support recursive enumeration + files, err := os.ReadDir(parsedUrl.Path) if err != nil { - return graph.IO{}, errors.Wrapf(err, "error getting provider") + return nil, errors.Wrapf(err, "failed to read dir %s", parsedUrl.Path) } - f, ok := p.(*Folder) - if !ok { - return graph.IO{}, errors.Wrapf(err, "error getting folder") - } - u, err := url.Parse(f.Url) - if err != nil { - return graph.IO{}, errors.Wrapf(err, "error parsing filestore url") + var nodes []*gen.Node + for _, file := range files { + // TODO breadchris need to collapse this instantiation + nodes = append(nodes, NewProto(file.Name(), NewFileProto(file.Name()))) } - filepath := path.Join(u.Path, n.File.Path) + return nodes, nil +} - // TODO breadchris verify file exists? - obs := rxgo.Defer([]rxgo.Producer{func(ctx context.Context, next chan<- rxgo.Item) { - // TODO breadchris this should be a static type. This is a brittle type that maps to workflow.go:133 - next <- rx.NewItem(map[string]any{ - "path": filepath, - }) - }}) - return graph.IO{ - Observable: obs, - }, nil +func (r *Folder) Provide() ([]*gen.Node, error) { + return nodesFromFiles(r.Folder.Url) } diff --git a/pkg/graph/node/storage/node.go b/pkg/graph/node/storage/node.go index 15a345a..0a9b5a4 100644 --- a/pkg/graph/node/storage/node.go +++ b/pkg/graph/node/storage/node.go @@ -1,6 +1,8 @@ package storage import ( + "github.com/google/uuid" + "github.com/protoflow-labs/protoflow/gen" "github.com/protoflow-labs/protoflow/gen/storage" "github.com/protoflow-labs/protoflow/pkg/graph" "github.com/protoflow-labs/protoflow/pkg/graph/node/base" @@ -31,3 +33,13 @@ func NewDocument(b *base.Node, node *storage.Document) graph.Node { return nil } } + +func NewProto(name string, c *storage.Storage) *gen.Node { + return &gen.Node{ + Id: uuid.NewString(), + Name: name, + Type: &gen.Node_Storage{ + Storage: c, + }, + } +} diff --git a/pkg/grpc/blocks.go b/pkg/grpc/blocks.go index 8120a2f..b788f20 100644 --- a/pkg/grpc/blocks.go +++ b/pkg/grpc/blocks.go @@ -14,6 +14,7 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/descriptorpb" + "net/url" ) func EnumerateResourceBlocks(server *pgrpc.Server, isLangService bool) ([]*gen.Node, error) { @@ -21,7 +22,12 @@ func EnumerateResourceBlocks(server *pgrpc.Server, isLangService bool) ([]*gen.N return nil, errors.New("host is required") } - conn, err := grpc.Dial(server.Host, grpc.WithTransportCredentials(insecure.NewCredentials())) + u, err := url.Parse(server.Host) + if err != nil { + return nil, errors.Wrapf(err, "unable to parse host %s", server.Host) + } + + conn, err := grpc.Dial(u.Host, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return nil, errors.Wrapf(err, "unable to connect to python server at %s", server.Host) } diff --git a/pkg/openai/chunker.go b/pkg/openai/chunker.go new file mode 100644 index 0000000..7dca405 --- /dev/null +++ b/pkg/openai/chunker.go @@ -0,0 +1,156 @@ +package openai + +import ( + tokenizer "github.com/samber/go-gpt-3-encoder" + "log" + "strings" +) + +type Chunker struct { + encoder *tokenizer.Encoder + splitFns []func(string) []string +} + +func NewChunker() (*Chunker, error) { + encoder, err := tokenizer.NewEncoder() + if err != nil { + return nil, err + } + + var splitFns []func(string) []string + allSeps := []string{" ", ",", "."} + for _, sep := range allSeps { + splitFn := splitBySep(sep, true) + splitFns = append(splitFns, splitFn) + } + + splitFns = append(splitFns, func(text string) []string { + return strings.Split(text, "") + }) + return &Chunker{ + encoder: encoder, + splitFns: splitFns, + }, nil +} + +func splitTextKeepSeparator(text string, separator string) []string { + parts := strings.Split(text, separator) + var result []string + for i, s := range parts { + if i > 0 { + result = append(result, separator+s) + } else { + result = append(result, s) + } + } + + // Filter empty strings + nonEmptyResult := []string{} + for _, s := range result { + if s != "" { + nonEmptyResult = append(nonEmptyResult, s) + } + } + return nonEmptyResult +} + +func splitBySep(sep string, keepSep bool) func(string) []string { + if keepSep { + return func(text string) []string { + return splitTextKeepSeparator(text, sep) + } + } + return func(text string) []string { + return strings.Split(text, sep) + } +} + +func (c *Chunker) SplitText(text string, chunkSize int) ([]string, error) { + if text == "" { + return []string{}, nil + } + + splits, err := c.split(text, chunkSize) + if err != nil { + return nil, err + } + + chunks := c.merge(splits, chunkSize) + + return chunks, nil +} + +func (c *Chunker) split(text string, chunkSize int) ([]string, error) { + tokens, err := c.encoder.Encode(text) + if err != nil { + return nil, err + } + + if len(tokens) <= chunkSize { + return []string{text}, nil + } + + var splits []string + for _, splitFn := range c.splitFns { + splits = splitFn(text) + if len(splits) > 1 { + break + } + } + + var newSplits []string + for _, split := range splits { + tokens, err := c.encoder.Encode(split) + if err != nil { + return nil, err + } + + if len(tokens) <= chunkSize { + newSplits = append(newSplits, split) + } else { + subSplits, err := c.split(split, chunkSize) + if err != nil { + return nil, err + } + newSplits = append(newSplits, subSplits...) + } + } + + return newSplits, nil +} + +func (c *Chunker) merge(splits []string, chunkSize int) []string { + var chunks []string + var curChunk []string + curLen := 0 + + for _, split := range splits { + tokens, err := c.encoder.Encode(split) + if err != nil { + log.Println("Error encoding split:", err) + continue + } + + splitLen := len(tokens) + if splitLen > chunkSize { + log.Printf("Got a split of size %d, larger than chunk size %d.", splitLen, chunkSize) + } + + if curLen+splitLen > chunkSize { + chunk := strings.Join(curChunk, "") + chunks = append(chunks, strings.TrimSpace(chunk)) + curChunk = []string{} + curLen = 0 + } + + curChunk = append(curChunk, split) + curLen += splitLen + } + + if len(curChunk) > 0 { + chunk := strings.Join(curChunk, "") + chunks = append(chunks, strings.TrimSpace(chunk)) + } + + return chunks +} diff --git a/pkg/openai/chunker_test.go b/pkg/openai/chunker_test.go new file mode 100644 index 0000000..4f4784c --- /dev/null +++ b/pkg/openai/chunker_test.go @@ -0,0 +1,38 @@ +package openai + +import ( + "strings" + "testing" +) + +type ChunkerTest struct { + content string + chunkSize int + chunkCount int + sep string +} + +func TestChunker(t *testing.T) { + tests := []ChunkerTest{ + {content: "This is a test", chunkSize: 5, chunkCount: 1, sep: " "}, + {content: "This is a test, This is a test", chunkSize: 5, chunkCount: 2, sep: " "}, + } + chunker, err := NewChunker() + if err != nil { + t.Errorf("NewChunker() error = %v", err) + } + for _, tt := range tests { + t.Run("chunking content", func(t *testing.T) { + chunks, err := chunker.SplitText(tt.content, tt.chunkSize) + if err != nil { + t.Errorf("ChunkChatCtx() error = %v", err) + } + if len(chunks) != tt.chunkCount { + t.Errorf("ChunkChatCtx() got = %v, want %v, chunks: %v", len(chunks), tt.chunkCount, chunks) + } + if strings.Join(chunks, tt.sep) != tt.content { + t.Errorf("ChunkChatCtx() got = %v, want %v", strings.Join(chunks, ""), tt.content) + } + }) + } +} diff --git a/pkg/openai/openai.go b/pkg/openai/openai.go index 3909ba4..8d97619 100644 --- a/pkg/openai/openai.go +++ b/pkg/openai/openai.go @@ -43,7 +43,7 @@ var ProviderSet = wire.NewSet( ) type QAClient interface { - Ask(chatCtx []openai.ChatCompletionMessage) (string, error) + Ask(chatCtx []openai.ChatCompletionMessage, minTokenCount int) (string, error) StreamResponse(chatCtx []openai.ChatCompletionMessage) (rxgo.Observable, error) } @@ -74,22 +74,39 @@ type OpenAIQAClient struct { var _ QAClient = &OpenAIQAClient{} -func (c *OpenAIQAClient) Ask(chatCtx []openai.ChatCompletionMessage) (string, error) { - // TODO breadchris figure out how to handle the context being too large - respTokenCount, err := validateChatCtx(chatCtx, c.modelDetails) +func (c *OpenAIQAClient) fillContext(respSize int, chatCtx []openai.ChatCompletionMessage) ([]openai.ChatCompletionMessage, int, error) { + tokenCount := respSize + var newChatCtx []openai.ChatCompletionMessage + for _, msg := range chatCtx { + s, err := fillMessageContext(tokenCount, msg, c.modelDetails) + if err != nil { + return nil, 0, err + } + newChatCtx = append(newChatCtx, s.Msg) + tokenCount += s.TokenCount + if s.Rest != "" { + log.Warn().Int("token count", tokenCount).Msg("context too large, truncating") + break + } + } + return newChatCtx, tokenCount, nil +} + +func (c *OpenAIQAClient) Ask(chatCtx []openai.ChatCompletionMessage, minTokenCount int) (string, error) { + newCtx, tokenCount, err := c.fillContext(minTokenCount, chatCtx) if err != nil { - return "", err + return "", errors.Wrapf(err, "failed to fill context") } log.Debug(). - Int("respTokenCount", respTokenCount). + Int("token count", tokenCount). Msg("Sending request to OpenAI") req := openai.ChatCompletionRequest{ Model: c.model, Temperature: float32(0), - MaxTokens: respTokenCount - 200, - Messages: chatCtx, + MaxTokens: tokenCount, + Messages: newCtx, } // TODO breadchris loading the timeout from the config was not working, debug this @@ -108,21 +125,21 @@ func (c *OpenAIQAClient) Ask(chatCtx []openai.ChatCompletionMessage) (string, er } func (c *OpenAIQAClient) StreamResponse(chatCtx []openai.ChatCompletionMessage) (rxgo.Observable, error) { - respTokenCount, err := validateChatCtx(chatCtx, c.modelDetails) + minRespSize := 100 + newCtx, tokenCount, err := c.fillContext(minRespSize, chatCtx) if err != nil { - return nil, err + return nil, errors.Wrapf(err, "failed to fill context") } - log.Debug(). - Int("respTokenCount", respTokenCount). + Int("respTokenCount", tokenCount). Msg("Sending request to OpenAI") req := openai.ChatCompletionRequest{ Model: c.model, Temperature: float32(0), - MaxTokens: respTokenCount - 200, + MaxTokens: tokenCount - 200, Stream: true, - Messages: chatCtx, + Messages: newCtx, // TODO breadchris need to validate the context size here Functions: []openai.FunctionDefinition{{ Name: "test", diff --git a/pkg/openai/tokens.go b/pkg/openai/tokens.go index 545d6cb..725069f 100644 --- a/pkg/openai/tokens.go +++ b/pkg/openai/tokens.go @@ -1,43 +1,117 @@ package openai import ( - "fmt" "github.com/pkg/errors" tokenizer "github.com/samber/go-gpt-3-encoder" "github.com/sashabaranov/go-openai" + "strings" ) -// validateChatCtx ensures that the chat context is not too long based on the max model tokens https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb -func validateChatCtx(chatCtx []openai.ChatCompletionMessage, modelDetails ModelDetails) (int, error) { - tokenCount, err := numTokensFromMessages(chatCtx, modelDetails) +const ( + promptTokenCount = 3 +) + +type SplitMessage struct { + Msg openai.ChatCompletionMessage + Rest string + TokenCount int +} + +func fillMessageContext(baseTokenCount int, msg openai.ChatCompletionMessage, modelDetails ModelDetails) (*SplitMessage, error) { + calcTokenCount, err := tokenCountForMessage(msg, modelDetails) if err != nil { - return 0, errors.Wrapf(err, "failed to encode prompt data") + return nil, errors.Wrapf(err, "failed to encode prompt data") } - diff := modelDetails.MaxTokens - 4 - tokenCount - if diff < 0 { - return 0, fmt.Errorf("chat context is too long") + if baseTokenCount+calcTokenCount < modelDetails.MaxTokens { + return &SplitMessage{ + Msg: msg, + Rest: "", + TokenCount: baseTokenCount + calcTokenCount, + }, nil } - return diff, nil + + // attempt to split the chat context into chunks + chunker, err := NewChunker() + if err != nil { + return nil, errors.Wrapf(err, "failed to create chunker") + } + // TODO breadchris determine what a good chunk size would be + chunks, err := chunker.SplitText(msg.Content, 16) + if err != nil { + return nil, errors.Wrapf(err, "failed to split text") + } + if len(chunks) == 0 { + return nil, errors.New("no chunks found") + } + + var chunkIdx int + sep := " " + for chunkIdx, _ = range chunks { + newCntJoined := strings.Join(chunks[:chunkIdx+1], sep) + m := openai.ChatCompletionMessage{ + Content: newCntJoined, + Role: msg.Role, + Name: msg.Name, + } + // TODO breadchris we could incrementally adding tokens instead of guessing and checking like this + tc, err := tokenCountForMessage(m, modelDetails) + if err != nil { + return nil, errors.Wrapf(err, "failed to encode prompt data") + } + if baseTokenCount+tc > modelDetails.MaxTokens { + break + } + calcTokenCount = tc + } + if len(chunks) == 1 { + // TODO breadchris address the case where a single chunk is too large + return &SplitMessage{ + Msg: openai.ChatCompletionMessage{ + Content: chunks[0], + Role: msg.Role, + Name: msg.Name, + }, + Rest: "", + TokenCount: baseTokenCount + calcTokenCount, + }, nil + } + return &SplitMessage{ + Msg: openai.ChatCompletionMessage{ + Content: strings.Join(chunks[:chunkIdx+1], sep), + Role: msg.Role, + Name: msg.Name, + }, + Rest: strings.Join(chunks[chunkIdx+1:], sep), + TokenCount: baseTokenCount + calcTokenCount, + }, nil } -func numTokensFromMessages(chatCtx []openai.ChatCompletionMessage, modelDetails ModelDetails) (int, error) { +func tokenCountForMessage(msg openai.ChatCompletionMessage, modelDetails ModelDetails) (int, error) { encoder, err := tokenizer.NewEncoder() if err != nil { return 0, err } numTokens := 0 - for _, msg := range chatCtx { - numTokens += modelDetails.TokensPerMsg - encoded, err := encoder.Encode(msg.Content) - if err != nil { - return 0, err - } - numTokens += len(encoded) - if msg.Name != "" { - numTokens += modelDetails.TokensPerName - } + numTokens += modelDetails.TokensPerMsg + encoded, err := encoder.Encode(msg.Content) + if err != nil { + return 0, err + } + numTokens += len(encoded) + role, err := encoder.Encode(msg.Role) + if err != nil { + return 0, err + } + numTokens += len(role) + name, err := encoder.Encode(msg.Name) + if err != nil { + return 0, err + } + numTokens += len(name) + if msg.Name != "" { + numTokens += modelDetails.TokensPerName } - numTokens += 3 + numTokens += promptTokenCount return numTokens, nil } diff --git a/pkg/openai/tokens_test.go b/pkg/openai/tokens_test.go new file mode 100644 index 0000000..97c28f3 --- /dev/null +++ b/pkg/openai/tokens_test.go @@ -0,0 +1,50 @@ +package openai + +import ( + "github.com/sashabaranov/go-openai" + "testing" +) + +type ChunkChatTest struct { + c openai.ChatCompletionMessage + maxTokens int + tokenCount int + rest string +} + +func TestChunkChatCtx(t *testing.T) { + md := models[openai.GPT3Dot5Turbo] + c := openai.ChatCompletionMessage{ + Role: openai.ChatMessageRoleUser, + Content: "Hello, my name is", + } + clarge := openai.ChatCompletionMessage{ + Role: openai.ChatMessageRoleUser, + Content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum. Donec in efficitur leo. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam", + } + tests := []ChunkChatTest{ + {c: c, tokenCount: 5 + md.TokensPerMsg + 1 + promptTokenCount}, + {c: clarge, tokenCount: 69 + md.TokensPerMsg + 1 + promptTokenCount, maxTokens: 10, rest: "adipiscing elit. Vivamus lacinia odio vitae vestibulum. Donec in efficitur leo. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam"}, + } + for _, tt := range tests { + t.Run("chunking chat context", func(t *testing.T) { + var m ModelDetails + if tt.maxTokens > 0 { + m = models[openai.GPT3Dot5Turbo] + m.MaxTokens = tt.maxTokens + } else { + m = models[openai.GPT3Dot5Turbo] + } + sm, err := fillMessageContext(0, tt.c, m) + if err != nil { + t.Errorf("ChunkChatCtx() error = %v", err) + } + if sm.Rest != tt.rest { + t.Errorf("ChunkChatCtx() got = %v, want %v", sm.Rest, tt.rest) + } + if sm.TokenCount != tt.tokenCount { + t.Errorf("ChunkChatCtx() got = %v, want %v", sm.TokenCount, tt.tokenCount) + } + }) + } +} diff --git a/pkg/project/default.go b/pkg/project/default.go index c538e6b..e2d3fbf 100644 --- a/pkg/project/default.go +++ b/pkg/project/default.go @@ -7,6 +7,8 @@ import ( "github.com/protoflow-labs/protoflow/pkg/graph/edge" "github.com/protoflow-labs/protoflow/pkg/graph/node/code" "github.com/protoflow-labs/protoflow/pkg/graph/node/data" + "github.com/protoflow-labs/protoflow/pkg/graph/node/storage" + "net/url" ) type ProjectConfig struct { @@ -15,14 +17,16 @@ type ProjectConfig struct { func getDefaultProject(name string, bucketDir string) *gen.Project { pid := uuid.NewString() + u := url.URL{Path: bucketDir, Scheme: "file"} p := code.NewProto("protoflow", code.NewServerProto(pcode.Runtime_GO)) n := code.NewProto("NewNode", code.NewFunctionProto()) c := data.NewProto("config", data.NewConfigProto(ProjectConfig{ID: pid})) + f := storage.NewProto("files", storage.NewFolderProto(u.String())) return &gen.Project{ Id: pid, Name: name, Graph: &gen.Graph{ - Nodes: []*gen.Node{p, n, c}, + Nodes: []*gen.Node{p, n, c, f}, Edges: []*gen.Edge{edge.NewProvidesProto(p.Id, n.Id)}, }, } diff --git a/pkg/project/provider.go b/pkg/project/provider.go index 4f4abdd..95c64cd 100644 --- a/pkg/project/provider.go +++ b/pkg/project/provider.go @@ -5,6 +5,8 @@ import ( "github.com/bufbuild/connect-go" "github.com/pkg/errors" "github.com/protoflow-labs/protoflow/gen" + "github.com/protoflow-labs/protoflow/pkg/graph" + "github.com/protoflow-labs/protoflow/pkg/workflow" ) func (s *Service) EnumerateProviders(ctx context.Context, c *connect.Request[gen.GetProvidersRequest]) (*connect.Response[gen.GetProvidersResponse], error) { @@ -13,9 +15,36 @@ func (s *Service) EnumerateProviders(ctx context.Context, c *connect.Request[gen return nil, errors.Wrapf(err, "failed to get project %s", c.Msg.ProjectId) } - providers, err := enumerateProvidersFromNodes(project.Graph.GetNodes()) - if err != nil { - return nil, err + w, err := workflow.Default(). + WithProtoProject(graph.ConvertProto(project)). + Build() + + var providers []*gen.EnumeratedProvider + for _, node := range project.Graph.Nodes { + info := &gen.ProviderInfo{ + State: gen.ProviderState_READY, + Error: "", + } + n, ok := w.NodeLookup[node.Id] + if !ok { + info.State = gen.ProviderState_ERROR + info.Error = "node not found" + } + + providedNodes, err := n.Provide() + if len(providedNodes) == 0 && err == nil { + continue + } + + if err != nil { + info.State = gen.ProviderState_ERROR + info.Error = err.Error() + } + providers = append(providers, &gen.EnumeratedProvider{ + Provider: node, + Nodes: providedNodes, + Info: info, + }) } return connect.NewResponse(&gen.GetProvidersResponse{ diff --git a/pkg/project/service.go b/pkg/project/service.go index 813d87f..7d7de97 100644 --- a/pkg/project/service.go +++ b/pkg/project/service.go @@ -6,28 +6,18 @@ import ( "github.com/google/wire" "github.com/pkg/errors" "github.com/protoflow-labs/protoflow/gen" - "github.com/protoflow-labs/protoflow/gen/code" - pdata "github.com/protoflow-labs/protoflow/gen/data" "github.com/protoflow-labs/protoflow/gen/genconnect" - pgrpc "github.com/protoflow-labs/protoflow/gen/grpc" - preason "github.com/protoflow-labs/protoflow/gen/reason" - "github.com/protoflow-labs/protoflow/gen/storage" "github.com/protoflow-labs/protoflow/pkg/bucket" "github.com/protoflow-labs/protoflow/pkg/graph" - "github.com/protoflow-labs/protoflow/pkg/graph/node/data" - "github.com/protoflow-labs/protoflow/pkg/graph/node/reason" "github.com/protoflow-labs/protoflow/pkg/grpc" openaiclient "github.com/protoflow-labs/protoflow/pkg/openai" "github.com/protoflow-labs/protoflow/pkg/store" "github.com/protoflow-labs/protoflow/pkg/workflow" "github.com/rs/zerolog/log" - "net/url" - "os" ) type Service struct { store store.Project - manager workflow.Manager cache bucket.Bucket chat *openaiclient.ChatServer defaultProject *gen.Project @@ -54,109 +44,18 @@ func NewDefaultProject(cache bucket.Bucket) (*gen.Project, error) { func NewService( store store.Project, - manager workflow.Manager, cache bucket.Bucket, chat *openaiclient.ChatServer, defaultProject *gen.Project, ) (*Service, error) { return &Service{ store: store, - manager: manager, cache: cache, chat: chat, defaultProject: defaultProject, }, nil } -func nodesFromFiles(u string) ([]*gen.Node, error) { - parsedUrl, err := url.Parse(u) - if err != nil { - return nil, errors.Wrapf(err, "failed to parse url %s", u) - } - // TODO breadchris support recursive enumeration - files, err := os.ReadDir(parsedUrl.Path) - if err != nil { - return nil, errors.Wrapf(err, "failed to read dir %s", parsedUrl.Path) - } - - var nodes []*gen.Node - for _, file := range files { - // TODO breadchris need to collapse this instantiation - nodes = append(nodes, &gen.Node{ - Name: file.Name(), - Type: &gen.Node_Storage{ - Storage: &storage.Storage{ - Type: &storage.Storage_File{ - File: &storage.File{ - Path: file.Name(), - }, - }, - }, - }, - }) - } - return nodes, nil -} - -// TODO breadchris this will be something that needs to be specified when someone is calling the API -func enumerateProvidersFromNodes(nodes []*gen.Node) ([]*gen.EnumeratedProvider, error) { - var providers []*gen.EnumeratedProvider - for _, node := range nodes { - info := &gen.ProviderInfo{ - State: gen.ProviderState_READY, - Error: "", - } - - var ( - providedNodes []*gen.Node - err error - ) - switch t := node.Type.(type) { - case *gen.Node_Storage: - switch u := t.Storage.Type.(type) { - case *storage.Storage_Folder: - providedNodes, err = nodesFromFiles(u.Folder.Url) - } - case *gen.Node_Grpc: - switch u := t.Grpc.Type.(type) { - case *pgrpc.GRPC_Server: - providedNodes, err = grpc.EnumerateResourceBlocks(u.Server, false) - } - case *gen.Node_Code: - switch u := t.Code.Type.(type) { - case *code.Code_Server: - providedNodes, err = grpc.EnumerateResourceBlocks(u.Server.Grpc, false) - } - case *gen.Node_Data: - switch t.Data.Type.(type) { - case *pdata.Data_Input: - providedNodes = []*gen.Node{data.NewProto("input", data.NewInputProto())} - } - case *gen.Node_Reason: - switch t.Reason.Type.(type) { - case *preason.Reason_Engine: - providedNodes = []*gen.Node{reason.NewProto("prompt", reason.NewPromptProto())} - } - default: - continue - } - if len(providedNodes) == 0 { - log.Warn().Msgf("no nodes provided by %s", node.Name) - continue - } - if err != nil { - info.State = gen.ProviderState_ERROR - info.Error = err.Error() - } - providers = append(providers, &gen.EnumeratedProvider{ - Provider: node, - Nodes: providedNodes, - Info: info, - }) - } - return providers, nil -} - func getProjectTypes() (*gen.ProjectTypes, error) { // TODO breadchris when types are bound to a project, this should be specific to a project // return the rules for different layers @@ -279,6 +178,10 @@ func (s *Service) GetNodeInfo(ctx context.Context, c *connect.Request[gen.GetNod log.Warn().Str("node", c.Msg.NodeId).Msg("node has no info") return connect.NewResponse(&gen.GetNodeInfoResponse{}), nil } + if nodeInfo.Method == nil { + log.Warn().Str("node", c.Msg.NodeId).Msg("node has no method") + return connect.NewResponse(&gen.GetNodeInfoResponse{}), nil + } typeInfo, err := nodeInfo.Method.Proto() if err != nil { return nil, errors.Wrapf(err, "failed to get proto for node %s", c.Msg.NodeId) diff --git a/pkg/workflow/connector.go b/pkg/workflow/connector.go index b15c781..5b741c2 100644 --- a/pkg/workflow/connector.go +++ b/pkg/workflow/connector.go @@ -2,6 +2,9 @@ package workflow import ( "context" + "encoding/json" + "github.com/pkg/errors" + "github.com/protoflow-labs/protoflow/gen" "github.com/protoflow-labs/protoflow/pkg/graph" "github.com/reactivex/rxgo/v2" ) @@ -27,8 +30,17 @@ func (c *Connector) Add(nodeID string, o *graph.IO) { func (c *Connector) Connect(ctx context.Context) rxgo.Observable { var obsSlice []rxgo.Observable - for _, o := range c.observers { - obsSlice = append(obsSlice, o.Observable) + for nodeID, o := range c.observers { + obsSlice = append(obsSlice, o.Observable.Map(func(ctx context.Context, i any) (any, error) { + output, err := json.Marshal(i) + if err != nil { + return nil, errors.Wrapf(err, "error marshalling output") + } + return &gen.NodeExecution{ + NodeId: nodeID, + Output: string(output), + }, nil + })) } o := rxgo.Merge(obsSlice, rxgo.WithPublishStrategy()) diff --git a/pkg/workflow/execute/context.go b/pkg/workflow/execute/context.go deleted file mode 100644 index 962ccda..0000000 --- a/pkg/workflow/execute/context.go +++ /dev/null @@ -1,16 +0,0 @@ -package execute - -import ( - "context" - "go.temporal.io/sdk/workflow" -) - -type MemoryContext struct { - context.Context -} - -func (m MemoryContext) Done() workflow.Channel { - panic("implement me") -} - -var _ workflow.Context = (*MemoryContext)(nil) diff --git a/pkg/workflow/execute/executor.go b/pkg/workflow/execute/executor.go deleted file mode 100644 index 3a56e05..0000000 --- a/pkg/workflow/execute/executor.go +++ /dev/null @@ -1,59 +0,0 @@ -package execute - -import ( - "github.com/pkg/errors" - "github.com/protoflow-labs/protoflow/pkg/graph" - "go.temporal.io/sdk/workflow" -) - -type Executor interface { - Execute(n graph.Node, input graph.IO) (*graph.IO, error) -} - -var _ Executor = &TemporalExecutor{} - -type TemporalExecutor struct { - ctx workflow.Context -} - -func NewTemporalExecutor(ctx workflow.Context) *TemporalExecutor { - return &TemporalExecutor{ - ctx: ctx, - } -} - -func (e *TemporalExecutor) Execute(n graph.Node, input graph.IO) (*graph.IO, error) { - var result graph.IO - // TODO breadchris n.WireNodes will not work here since n is a pointer and we are changing execution context, i think - err := workflow.ExecuteActivity(e.ctx, n.Wire, n, input).Get(e.ctx, &result) - if err != nil { - return nil, errors.Wrap(err, "error executing activity") - } - return &result, nil -} - -type MemoryExecutor struct { - ctx *MemoryContext -} - -var _ Executor = &MemoryExecutor{} - -type MemoryExecutorOption func(*MemoryExecutor) - -func NewMemoryExecutor(ctx *MemoryContext, opts ...MemoryExecutorOption) *MemoryExecutor { - e := &MemoryExecutor{ - ctx: ctx, - } - for _, opt := range opts { - opt(e) - } - return e -} - -func (e *MemoryExecutor) Execute(n graph.Node, input graph.IO) (*graph.IO, error) { - res, err := n.Wire(e.ctx.Context, input) - if err != nil { - return nil, err - } - return &res, nil -} diff --git a/pkg/workflow/manager.go b/pkg/workflow/manager.go deleted file mode 100644 index dd07d34..0000000 --- a/pkg/workflow/manager.go +++ /dev/null @@ -1,108 +0,0 @@ -package workflow - -import ( - "context" - "fmt" - "github.com/google/wire" - "github.com/protoflow-labs/protoflow/pkg/store" - "github.com/reactivex/rxgo/v2" - "go.uber.org/config" -) - -const TaskQueue = "protoflow" - -type Manager interface { - ExecuteWorkflow(ctx context.Context, w *Workflow, nodeID string, input rxgo.Observable) (rxgo.Observable, error) - CleanupResources() error -} - -var ProviderSet = wire.NewSet( - NewConfig, - NewManager, -) - -func NewManager(config Config, provider config.Provider, store store.Project) (Manager, error) { - switch config.ManagerType { - case MemoryManagerType: - return NewMemoryManager(store), nil - //case TemporalManagerType: - // // TODO breadchris we do this because we don't want a temporal client to try to connect on startup - // // Is there a way to run this more intelligently? maybe with sync.Once? - // client, err := temporal.WireNodes(provider) - // if err != nil { - // return nil, err - // } - // return NewTemporalManager(client), nil - default: - return nil, fmt.Errorf("unknown manager type %s", config.ManagerType) - } -} - -/* -// ProcessNewWorkflows starts any workflow that needs to be started now and saves them. -func getWorkflowResult(ctx context.Context, temporalClient client.Client, workflowID, runID string) { - var workflowCompeted bool - - for !workflowCompeted { - select { - case <-ctx.Done(): - return - default: - time.Sleep(125 * time.Millisecond) - resp, err := temporalClient.DescribeWorkflowExecution(ctx, workflowID, "") - if err != nil { - //workflowResult.Error = err - return - } - executionInfo := resp.GetWorkflowExecutionInfo() - if enums.WORKFLOW_EXECUTION_STATUS_COMPLETED == executionInfo.GetStatus() { - workflowCompeted = true - break - } - } - } - - workflowRun := temporalClient.GetProject(ctx, workflowID, runID) - workflowResult.Error = workflowRun.Get(ctx, &workflowResult.RESTNode) - return -} - -func CancelWorkflows(deploymentID string, workflowRuns []WorkflowRunModel) error { - for _, workflowRun := range workflowRuns { - err := m.temporalClient.CancelWorkflow(context.Background(), workflowRun.WorkflowID, workflowRun.RunID) - if err != nil { - continue - } - } - request := &workflowservice.ListOpenWorkflowExecutionsRequest{ - Namespace: "refinery", - Filters: &workflowservice.ListOpenWorkflowExecutionsRequest_ExecutionFilter{ - ExecutionFilter: filter.ExecutionFilter{ - WorkflowId: "", - }, - }, - } - return nil -} - -// StopAllOpenWorkflows gets all currently open workflows and cancels them. -func StopAllOpenWorkflows(c *fiber.Ctx) error { - request := &workflowservice.ListOpenWorkflowExecutionsRequest{ - Namespace: m.config.Temporal.Namespace, - } - - // TODO call this in loop to get all executions - response, err := m.temporalClient.ListOpenWorkflow(context.Background(), request) - if err != nil { - return err - } - for _, execution := range response.GetExecutions() { - workflowExec := execution.GetExecution() - err := m.temporalClient.CancelWorkflow(context.Background(), workflowExec.WorkflowId, workflowExec.RunId) - if err != nil { - return err - } - } - return nil -} -*/ diff --git a/pkg/workflow/memory.go b/pkg/workflow/memory.go deleted file mode 100644 index f50ecab..0000000 --- a/pkg/workflow/memory.go +++ /dev/null @@ -1,81 +0,0 @@ -package workflow - -import ( - "context" - "github.com/pkg/errors" - "github.com/protoflow-labs/protoflow/gen" - "github.com/protoflow-labs/protoflow/pkg/store" - "github.com/reactivex/rxgo/v2" - "github.com/rs/zerolog/log" - "sync" - - "github.com/google/uuid" -) - -type MemoryManager struct { - resourceCleanup sync.Cond - store store.Project -} - -var _ Manager = (*MemoryManager)(nil) - -func NewMemoryManager(store store.Project) *MemoryManager { - return &MemoryManager{ - store: store, - } -} - -func (m *MemoryManager) saveNodeExecutions(projectID, nodeID string, trace rxgo.Observable) error { - workflowRun := &gen.WorkflowRun{ - Id: uuid.NewString(), - Request: &gen.RunWorkflowRequest{ - ProjectId: projectID, - NodeId: nodeID, - }, - } - workflowRunID, err := m.store.CreateWorkflowRun(workflowRun) - if err != nil { - return errors.Wrap(err, "error creating workflow run") - } - trace.ForEach(func(i any) { - // TODO breadchris trace should be a generic observable - if nodeExec, ok := i.(*gen.NodeExecution); ok { - _, err := m.store.SaveNodeExecution(workflowRunID, nodeExec) - if err != nil { - log.Error().Err(err).Msg("error saving node execution") - } - } else { - log.Error(). - Interface("item", i). - Msg("error saving node execution, not a node execution") - } - }, func(err error) { - log.Error().Err(err).Msg("trace error") - }, func() { - log.Debug().Msg("trace complete") - }) - return nil -} - -func (m *MemoryManager) ExecuteWorkflow(ctx context.Context, w *Workflow, nodeID string, input rxgo.Observable) (rxgo.Observable, error) { - return w.WireNodes(ctx, nodeID, input) - - //logger := &MemoryLogger{} - // - //memoryCtx := &execute.MemoryContext{Context: ctx} - //executor := execute.NewMemoryExecutor(memoryCtx) - - //if err != nil { - // return nil, errors.Wrapf(err, "error running workflow") - //} - //err = m.saveNodeExecutions(w.ProjectID, nodeID, obs) - //if err != nil { - // return nil, errors.Wrapf(err, "error saving node executions") - //} - //return obs, nil -} - -func (m *MemoryManager) CleanupResources() error { - //TODO implement me - panic("implement me") -} diff --git a/pkg/workflow/temporal.go b/pkg/workflow/temporal.go deleted file mode 100644 index 0903044..0000000 --- a/pkg/workflow/temporal.go +++ /dev/null @@ -1,82 +0,0 @@ -package workflow - -import ( - "context" - "github.com/google/wire" - "github.com/pkg/errors" - "github.com/reactivex/rxgo/v2" - "github.com/rs/zerolog/log" - "go.temporal.io/sdk/client" - "go.temporal.io/sdk/workflow" -) - -//var _ Manager = (*TemporalManager)(nil) - -var TemporalManagerProviderSet = wire.NewSet( - NewTemporalManager, - wire.Bind(new(Manager), new(*TemporalManager)), -) - -type TemporalManager struct { - client client.Client -} - -func NewTemporalManager(client client.Client) *TemporalManager { - return &TemporalManager{ - client: client, - } -} - -func (m *TemporalManager) ExecuteWorkflow(ctx context.Context, w *Workflow, nodeID string, input interface{}) (string, error) { - workflowOptions := client.StartWorkflowOptions{ - ID: w.ID, - TaskQueue: TaskQueue, - // CronSchedule: workflow.CronSchedule, - } - - we, err := m.client.ExecuteWorkflow(ctx, workflowOptions, TemporalRun, w, nodeID, input) - if err != nil { - return "", errors.Wrapf(err, "failed to start workflow %s", w.ID) - } - - log.Debug(). - Str("id", we.GetID()). - Str("run id", we.GetRunID()). - Msg("started workflow") - return we.GetRunID(), nil -} - -func (m *TemporalManager) ExecuteWorkflowSync(ctx context.Context, w *Workflow, nodeID string, input any) (rxgo.Observable, error) { - //TODO implement me - panic("implement me") -} - -// TemporalRun is the entrypoint for a Temporal workflow that will run on a worker -func TemporalRun(ctx workflow.Context, w *Workflow, nodeID string, input string) (rxgo.Observable, error) { - //if w.NodeLookup == nil || w.Graph == nil { - // return nil, fmt.Errorf("workflow is not initialized") - //} - // - //ao := workflow.ActivityOptions{ - // ScheduleToStartTimeout: time.Minute, - // StartToCloseTimeout: time.Minute, - // HeartbeatTimeout: time.Second * 20, - //} - //ctx = workflow.WithActivityOptions(ctx, ao) - //logger := workflow.GetLogger(ctx) - // - //executor := execute.NewTemporalExecutor(ctx) - // - //// Adding context to a workflow - //// ctx = workflow.WithValue(ctx, AccountIDContextKey, dslWorkflow.AccountID) - // - //logger.Type("Starting workflow", "workflowID", workflow.GetInfo(ctx).WorkflowExecution.ID, "nodeID", nodeID) - // - //return w.WireNodes(context.Background(), logger, executor, nodeID, input) - return nil, nil -} - -func (m *TemporalManager) CleanupResources() error { - //TODO implement me - panic("implement me") -} diff --git a/pkg/workflow/worker.go b/pkg/workflow/worker.go deleted file mode 100644 index 202ee12..0000000 --- a/pkg/workflow/worker.go +++ /dev/null @@ -1,29 +0,0 @@ -package workflow - -import ( - "context" - "go.temporal.io/sdk/client" - "go.temporal.io/sdk/worker" -) - -type Worker struct { - client client.Client -} - -func NewWorker(client client.Client) *Worker { - return &Worker{ - client: client, - } -} - -func (s *Worker) Run() error { - w := worker.New(s.client, TaskQueue, worker.Options{ - BackgroundActivityContext: context.Background(), - }) - - w.RegisterWorkflow(TemporalRun) - // TODO breadchris register node activities - // w.RegisterActivity(&execute.Activity{}) - - return w.Run(worker.InterruptCh()) -} diff --git a/pkg/workflow/workflow.go b/pkg/workflow/workflow.go index 2aef795..42a0f95 100644 --- a/pkg/workflow/workflow.go +++ b/pkg/workflow/workflow.go @@ -271,24 +271,6 @@ func (w *Workflow) GetNodeProvider(id string) (graph.Node, error) { // WireNodes wires the nodes in the workflow together and returns an observable that can be subscribed to. Nodes are executed when an event is received on the input observable. func (w *Workflow) WireNodes(ctx context.Context, nodeID string, input rxgo.Observable) (rxgo.Observable, error) { - var cleanupFuncs []func() - defer func() { - for _, cleanup := range cleanupFuncs { - if cleanup != nil { - cleanup() - } - } - }() - - // TODO breadchris implement resource pool to avoid creating resources for every workflow - for _, r := range w.NodeLookup { - cleanup, err := r.Init() - if err != nil { - return nil, errors.Wrapf(err, "error creating resource %s", r.NormalizedName()) - } - cleanupFuncs = append(cleanupFuncs, cleanup) - } - connector := NewConnector() getEdge := func(from, to string) (graph.Edge, error) { @@ -321,42 +303,52 @@ func (w *Workflow) WireNodes(ctx context.Context, nodeID string, input rxgo.Obse } // TODO breadchris move workflow slicing into its own function + // search forward and backward in the graph to create a subgraph of nodes that are connected to the node we want to wire subgraph := graphlib.New(graphlib.StringHash, graphlib.Directed(), graphlib.PreventCycles()) _ = subgraph.AddVertex(in.ID()) _ = subgraph.AddEdge(in.ID(), nodeID) + + discovered := []string{nodeID} err = util.BFS(w.Graph, nodeID, true, func(from, to string) bool { e, err := getEdge(from, to) if err != nil { log.Error().Err(err).Msgf("error getting edge from %s to %s", from, to) return false } - if !e.CanWire() { - return false - } + log.Debug(). + Str("from", w.NodeLookup[from].NormalizedName()). + Str("to", w.NodeLookup[to].NormalizedName()). + Str("edge", e.ID()). + Msg("workflow forward bfs") _ = subgraph.AddVertex(from) _ = subgraph.AddVertex(to) _ = subgraph.AddEdge(from, to) + discovered = append(discovered, to) return false }) if err != nil { return nil, errors.Wrapf(err, "error traversing graph forward") } - err = util.BFS(w.Graph, nodeID, false, func(to, from string) bool { - e, err := getEdge(from, to) - if err != nil { - log.Error().Err(err).Msgf("error getting edge from %s to %s", from, to) - return false - } - if !e.CanWire() { + for _, discID := range discovered { + err = util.BFS(w.Graph, discID, false, func(to, from string) bool { + e, err := getEdge(from, to) + if err != nil { + log.Error().Err(err).Msgf("error getting edge from %s to %s", from, to) + return false + } + log.Debug(). + Str("from", w.NodeLookup[from].NormalizedName()). + Str("to", w.NodeLookup[to].NormalizedName()). + Str("edge", e.ID()). + Msg("workflow backward bfs") + _ = subgraph.AddVertex(from) + _ = subgraph.AddVertex(to) + _ = subgraph.AddEdge(from, to) return false + }) + if err != nil { + return nil, errors.Wrapf(err, "error traversing graph backward") } - _ = subgraph.AddVertex(from) - _ = subgraph.AddVertex(to) - _ = subgraph.AddEdge(from, to) - return false - }) - if err != nil { - return nil, errors.Wrapf(err, "error traversing graph backward") } depList, err := graphlib.TopologicalSort(subgraph) @@ -374,6 +366,7 @@ func (w *Workflow) WireNodes(ctx context.Context, nodeID string, input rxgo.Obse // since the graph is sorted topologically, we can wire the nodes in order for _, nID := range depList { n := w.NodeLookup[nID] + // TODO breadchris how do we handle lifecycle of nodes? cleaning up resources, err = w.wireWorkflow(ctx, connector, n) if err != nil { log.Error().Err(err).Msgf("failed to traverse workflow") diff --git a/proto/http/http.proto b/proto/http/http.proto index 945535c..d518bf5 100644 --- a/proto/http/http.proto +++ b/proto/http/http.proto @@ -9,15 +9,17 @@ message Header { } message Request { - string method = 1; - string url = 2; - repeated Header headers = 3; - bytes body = 4; + string id = 1; + string method = 2; + string url = 3; + repeated Header headers = 4; + bytes body = 5; } message Response { - repeated Header headers = 1; - bytes body = 2; + string id = 1; + repeated Header headers = 2; + bytes body = 3; } message Route { @@ -25,8 +27,12 @@ message Route { string method = 2; } +message TemplateFS { + string path = 1; +} + message Template { - string template = 1; + string name = 1; } message Router { @@ -37,6 +43,8 @@ message HTTP { oneof type { Route route = 9; Template template = 10; - Router router = 11; + TemplateFS template_fs = 11; + Router router = 12; + Response response = 13; } } \ No newline at end of file diff --git a/proto/project.proto b/proto/project.proto index 5ed8cde..04af9fc 100644 --- a/proto/project.proto +++ b/proto/project.proto @@ -115,8 +115,7 @@ message WorkflowRun { message NodeExecution { string node_id = 1; - string input = 2; - string output = 3; + string output = 2; } message GetNodeInfoRequest { diff --git a/proto/reason/reason.proto b/proto/reason/reason.proto index 6e771e5..c66c8b4 100644 --- a/proto/reason/reason.proto +++ b/proto/reason/reason.proto @@ -5,6 +5,7 @@ option go_package = "reason"; message Prompt { string prompt = 1; + uint64 min_token_count = 2; } message Engine { diff --git a/studio/src/components/ActionPanel.tsx b/studio/src/components/ActionPanel.tsx index 3960337..3437f03 100644 --- a/studio/src/components/ActionPanel.tsx +++ b/studio/src/components/ActionPanel.tsx @@ -17,13 +17,13 @@ export function ActionPanel() { }, [activelyEditing]); return ( -
Error: {r.info?.error}
: null} {r.nodes.map((node) => { return (