diff --git a/buf.gen.yaml b/buf.gen.yaml index 917c4ef..3ba1ec7 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -14,7 +14,7 @@ plugins: - Msf/codegen/conversation/v1/conversation.proto=github.com/streamingfast/substreams-codegen/pb/sf/codegen/conversation/v1;pbconvo - Msf/codegen/remotebuild/v1/remotebuild.proto=github.com/streamingfast/substreams-codegen/pb/sf/codegen/remotebuild/v1;pbbuild - - plugin: buf.build/grpc/go + - plugin: buf.build/grpc/go:v1.4.0 out: pb opt: - paths=source_relative diff --git a/conversation/v1/conversation.proto b/conversation/v1/conversation.proto deleted file mode 100644 index 01081a1..0000000 --- a/conversation/v1/conversation.proto +++ /dev/null @@ -1,150 +0,0 @@ -syntax = "proto3"; - -package sf.codegen.conversation.v1; - -service ConversationService { - rpc Converse(stream UserInput) returns (stream SystemOutput); - rpc Discover(DiscoveryRequest) returns (DiscoveryResponse); -} - -message Empty {} -message UserInput { - uint32 msg_id = 1; // Monotonic incrementing number - uint32 from_msg_id = 2; - string from_action_id = 3; - - oneof entry { - Start start = 11; - - TextInput text_input = 15; - Selection selection = 17; - Confirmation confirmation = 18; - Upload file = 16; - DownloadedFiles downloaded_files = 20; - } - message TextInput { - string value = 1; - } - message Start { - // generator_id routes the conversation to the right generator backend - string generator_id = 1; - - // Hydrate will be present when the user already has a pre-built state, and wants to continue from there. - Hydrate hydrate = 2; - - // Version of the supported protocol by the client. - // If the code generator requires a more recent client, then it should also report an error, or try to downgrade the conversation protocol. - uint32 version = 3; - } - message Hydrate { - // If `saved_payload` is none, then just start a new session. - string saved_state = 1; // JSON state from a previous session, to continue where we left off. - bytes signature = 2; // HMAC sig from the server for the saved_payload. Optional. - uint32 last_msg_id = 3; // whatever - bool reset_conversation = 4; // Whether to continue, or to reset the conversation. If this is `false`, it means try to continue (the connection was merely disconnected). Otherwise, it means we're starting anew. Let's give all the options and directions. - } - message Upload { - string mime_type = 1; - string filename = 2; - bytes content = 3; - } - message Selection { - string label = 1; - string value = 2; - } - message Confirmation { - bool affirmative = 1; - } - message DownloadedFiles { - // This is only to return a message to the server that the files were downloaded - } -} - -message SystemOutput { - uint32 msg_id = 1; // unique message ID - uint32 from_msg_id = 2; - string action_id = 3; // the type of action that is required here, tags like "confirm_final" or "select_subgraph" or "select_network", so the UI can hook into the response the user will take here. - string state = 4; // to be saved each step, if connection drops, Init back with this state - bytes state_signature = 5; // Optional, or future ? - - oneof entry { - Message message = 15; // Markdown message to display - ImageWithText image_with_text = 16; - ListSelect list_select = 17; - TextInput text_input = 18; - Confirm confirm = 21; - Loading loading = 19; - DownloadFiles download_files = 20; - } - - message Message { - string markdown = 1; - string style = 2; - } - message ImageWithText { - string img_url = 1; - string markdown = 2; - } - message ListSelect { - string id = 1; // Deprecated: use `action_id` instead - repeated string labels = 2; // These need to be the same length - repeated string values = 3; - repeated string image_urls = 4; // Optional. If present, same length as the labels and values. Shows a small icon aside of the label text. - string instructions = 6; // In Markdown format - bool select_many = 8; - SelectType select_type = 7; - string select_button_label = 5; - - enum SelectType { - DROPDOWN = 0; - BUTTONS = 1; - } - } - message TextInput { - string prompt = 8; - string description = 1; // Markdown - string placeholder = 2; - string default_value = 9; // Pre-filled the textbox - int32 multi_line = 3; // Number of lines if multiline box. - string validation_regexp = 4; - string validation_error_message = 5; - - string submit_button_label = 6; - string submit_button_icon = 7; // icon name or image_url - } - message Loading { - bool loading = 1; - string label = 2; - // other fields to format the loader and whatnot - } - message DownloadFiles { - repeated DownloadFile files = 1; - } - message DownloadFile { - string filename = 1; - string type = 2; - bytes content = 3; - string description = 4; - } - message Confirm { - string prompt = 1; - string description = 4; - string accept_button_label = 2; - string decline_button_label = 3; - } -} - -message DiscoveryRequest { - string search_terms = 1; -} - -message DiscoveryResponse { - repeated Generator generators = 1; - message Generator { - string id = 1; - string title = 2; - string description = 3; - string icon_url = 4; - string endpoint = 5; // if not the same as this one - } -} diff --git a/evm-events-calls/convo.go b/evm-events-calls/convo.go index 793fc1d..0d0ca1b 100644 --- a/evm-events-calls/convo.go +++ b/evm-events-calls/convo.go @@ -243,9 +243,9 @@ func (c *Convo) Update(msg loop.Msg) loop.Cmd { return loop.Seq( c.Msg().Messagef("We're tackling the %s contract.", humanize.Ordinal(c.State.currentContractIdx+1)).Cmd(), c.Action(InputContractAddress{}).TextInput("Please enter the contract address", "Submit"). - Description("Format it with 0x prefix and make sure it's a valid Ethereum address.\nFor example, the Uniswap v3 factory address: 0x1f98431c8ad98523631ae4a59f267346ea31f984"). + Description("Format it with 0x prefix and make sure it's a valid Ethereum address.\nThe default value is the Uniswap v3 factory address."). DefaultValue("0x1f98431c8ad98523631ae4a59f267346ea31f984"). - Validation("^0x[a-fA-F0-9]{40}$", "Please enter a valid Ethereum address").Cmd(), + Validation("^0x[a-fA-F0-9]{40}$", "Please enter a valid Ethereum address: 0x followed by 40 hex characters.").Cmd(), ) case AskDynamicContractAddress: @@ -254,8 +254,9 @@ func (c *Convo) Update(msg loop.Msg) loop.Cmd { return QuitInvalidContext } return c.Action(InputDynamicContractAddress{}).TextInput(fmt.Sprintf("Please enter an example contract created by the %q factory", factory.Name), "Submit"). - Description("Format it with 0x prefix and make sure it's a valid Ethereum address.\nFor example, the USDC/ETH pool at: 0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"). - Validation("^0x[a-fA-F0-9]{40}$", "Please enter a valid Ethereum address").Cmd() + Description("Format it with 0x prefix and make sure it's a valid Ethereum address.\nThe default value is the USDC/ETH pool address."). + DefaultValue("0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"). + Validation("^0x[a-fA-F0-9]{40}$", "Please enter a valid Ethereum address: 0x followed by 40 hex characters.").Cmd() case InputDynamicContractAddress: factory := c.contextContract() @@ -471,7 +472,7 @@ message {{.Proto.MessageName}} {{.Proto.OutputModuleFieldName}} { } {{- end}} `+"```"+` - `, map[string]any{"events": evt, "calls": calls}).Cmd() +`, map[string]any{"events": evt, "calls": calls}).Cmd() return loop.Seq(peekABI, cmd(AskConfirmContractABI{})) case AskConfirmContractABI: @@ -591,9 +592,13 @@ message {{.Proto.MessageName}} {{.Proto.OutputModuleFieldName}} { if contract == nil { return QuitInvalidContext } - return c.Action(InputContractName{}).TextInput(fmt.Sprintf("Choose a short name for the contract at address %q (lowercase and numbers only)", contract.Address), "Submit"). + act := c.Action(InputContractName{}).TextInput(fmt.Sprintf("Choose a short name for the contract at address %q (lowercase and numbers only)", contract.Address), "Submit"). Description("Lowercase and numbers only"). - Validation(`^([a-z][a-z0-9_]{0,63})$`, "The name should be short, and contain only lowercase characters and numbers, and not start with a number.").Cmd() + Validation(`^([a-z][a-z0-9_]{0,63})$`, "The name should be short, and contain only lowercase characters and numbers, and not start with a number.") + if contract.Address == "0x1f98431c8ad98523631ae4a59f267346ea31f984" { + act = act.DefaultValue("factory") + } + return act.Cmd() case InputContractName: contract := c.contextContract() @@ -617,9 +622,13 @@ message {{.Proto.MessageName}} {{.Proto.OutputModuleFieldName}} { if factory == nil { return QuitInvalidContext } - return c.Action(InputDynamicContractName{}).TextInput(fmt.Sprintf("Choose a short name for the contract that will be created by the factory %q (lowercase and numbers only)", factory.Name), "Submit"). + act := c.Action(InputDynamicContractName{}).TextInput(fmt.Sprintf("Choose a short name for the contract that will be created by the factory %q (lowercase and numbers only)", factory.Name), "Submit"). Description("Lowercase and numbers only"). - Validation(`^([a-z][a-z0-9_]{0,63})$`, "The name should be short, and contain only lowercase characters and numbers, and not start with a number.").Cmd() + Validation(`^([a-z][a-z0-9_]{0,63})$`, "The name should be short, and contain only lowercase characters and numbers, and not start with a number.") + if factory.Address == "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" { + act = act.DefaultValue("pool") + } + return act.Cmd() case InputDynamicContractName: factory := c.contextContract() diff --git a/msgwrap.go b/msgwrap.go index d0b49f3..6c81c9b 100644 --- a/msgwrap.go +++ b/msgwrap.go @@ -116,6 +116,26 @@ func (w *MsgWrap) Confirm(prompt string, acceptLabel, declineLabel string) *MsgW return w } +func (w *MsgWrap) DefaultAccept() *MsgWrap { + switch entry := w.Msg.Entry.(type) { + case *pbconvo.SystemOutput_Confirm_: + entry.Confirm.DefaultButton = pbconvo.SystemOutput_Confirm_CONFIRM + default: + panic("unsupported message type for this method") + } + return w +} + +func (w *MsgWrap) DefaultDecline() *MsgWrap { + switch entry := w.Msg.Entry.(type) { + case *pbconvo.SystemOutput_Confirm_: + entry.Confirm.DefaultButton = pbconvo.SystemOutput_Confirm_DECLINE + default: + panic("unsupported message type for this method") + } + return w +} + func (w *MsgWrap) DownloadFiles() *MsgWrap { // TODO: to a type assertion on the `lastType`, to make sure it matches what we're asking here.. w.Msg.Entry = &pbconvo.SystemOutput_DownloadFiles_{ diff --git a/pb/sf/codegen/conversation/v1/conversation.pb.go b/pb/sf/codegen/conversation/v1/conversation.pb.go index 448ae5e..40688c9 100644 --- a/pb/sf/codegen/conversation/v1/conversation.pb.go +++ b/pb/sf/codegen/conversation/v1/conversation.pb.go @@ -66,6 +66,55 @@ func (SystemOutput_ListSelect_SelectType) EnumDescriptor() ([]byte, []int) { return file_sf_codegen_conversation_v1_conversation_proto_rawDescGZIP(), []int{2, 2, 0} } +type SystemOutput_Confirm_Button int32 + +const ( + SystemOutput_Confirm_UNSET SystemOutput_Confirm_Button = 0 + SystemOutput_Confirm_CONFIRM SystemOutput_Confirm_Button = 1 + SystemOutput_Confirm_DECLINE SystemOutput_Confirm_Button = 2 +) + +// Enum value maps for SystemOutput_Confirm_Button. +var ( + SystemOutput_Confirm_Button_name = map[int32]string{ + 0: "UNSET", + 1: "CONFIRM", + 2: "DECLINE", + } + SystemOutput_Confirm_Button_value = map[string]int32{ + "UNSET": 0, + "CONFIRM": 1, + "DECLINE": 2, + } +) + +func (x SystemOutput_Confirm_Button) Enum() *SystemOutput_Confirm_Button { + p := new(SystemOutput_Confirm_Button) + *p = x + return p +} + +func (x SystemOutput_Confirm_Button) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SystemOutput_Confirm_Button) Descriptor() protoreflect.EnumDescriptor { + return file_sf_codegen_conversation_v1_conversation_proto_enumTypes[1].Descriptor() +} + +func (SystemOutput_Confirm_Button) Type() protoreflect.EnumType { + return &file_sf_codegen_conversation_v1_conversation_proto_enumTypes[1] +} + +func (x SystemOutput_Confirm_Button) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SystemOutput_Confirm_Button.Descriptor instead. +func (SystemOutput_Confirm_Button) EnumDescriptor() ([]byte, []int) { + return file_sf_codegen_conversation_v1_conversation_proto_rawDescGZIP(), []int{2, 7, 0} +} + type Empty struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1441,10 +1490,11 @@ type SystemOutput_Confirm struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - AcceptButtonLabel string `protobuf:"bytes,2,opt,name=accept_button_label,json=acceptButtonLabel,proto3" json:"accept_button_label,omitempty"` - DeclineButtonLabel string `protobuf:"bytes,3,opt,name=decline_button_label,json=declineButtonLabel,proto3" json:"decline_button_label,omitempty"` + Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + AcceptButtonLabel string `protobuf:"bytes,2,opt,name=accept_button_label,json=acceptButtonLabel,proto3" json:"accept_button_label,omitempty"` + DeclineButtonLabel string `protobuf:"bytes,3,opt,name=decline_button_label,json=declineButtonLabel,proto3" json:"decline_button_label,omitempty"` + DefaultButton SystemOutput_Confirm_Button `protobuf:"varint,5,opt,name=default_button,json=defaultButton,proto3,enum=sf.codegen.conversation.v1.SystemOutput_Confirm_Button" json:"default_button,omitempty"` } func (x *SystemOutput_Confirm) Reset() { @@ -1507,6 +1557,13 @@ func (x *SystemOutput_Confirm) GetDeclineButtonLabel() string { return "" } +func (x *SystemOutput_Confirm) GetDefaultButton() SystemOutput_Confirm_Button { + if x != nil { + return x.DefaultButton + } + return SystemOutput_Confirm_UNSET +} + type DiscoveryResponse_Generator struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1666,7 +1723,7 @@ var file_sf_codegen_conversation_v1_conversation_proto_rawDesc = []byte{ 0x61, 0x66, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x61, 0x66, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x76, 0x65, 0x1a, 0x11, 0x0a, 0x0f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, - 0x73, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0xa4, 0x10, 0x0a, 0x0c, 0x53, + 0x73, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0xb3, 0x11, 0x0a, 0x0c, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6d, 0x73, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x6d, 0x73, 0x67, 0x5f, 0x69, @@ -1786,7 +1843,7 @@ var file_sf_codegen_conversation_v1_conversation_proto_rawDesc = []byte{ 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x1a, 0xa5, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06, + 0x1a, 0xb4, 0x02, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, @@ -1796,41 +1853,50 @@ var file_sf_codegen_conversation_v1_conversation_proto_rawDesc = []byte{ 0x6e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x30, 0x0a, 0x14, 0x64, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x64, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x42, 0x75, 0x74, - 0x74, 0x6f, 0x6e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, - 0x79, 0x22, 0x35, 0x0a, 0x10, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, - 0x74, 0x65, 0x72, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x61, - 0x72, 0x63, 0x68, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x22, 0xf9, 0x01, 0x0a, 0x11, 0x44, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, - 0x0a, 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x2e, - 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0a, 0x67, 0x65, 0x6e, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x1a, 0x8a, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, - 0x08, 0x69, 0x63, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x69, 0x63, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, - 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, - 0x6f, 0x69, 0x6e, 0x74, 0x32, 0xdf, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x08, - 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x25, 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, - 0x64, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x1a, - 0x28, 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, - 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x73, - 0x74, 0x65, 0x6d, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x28, 0x01, 0x30, 0x01, 0x12, 0x67, 0x0a, - 0x08, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x2c, 0x2e, 0x73, 0x66, 0x2e, 0x63, - 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, 0x64, + 0x74, 0x6f, 0x6e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x5e, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x5f, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x37, 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x63, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x72, 0x6d, 0x2e, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x22, 0x2d, 0x0a, 0x06, 0x42, 0x75, 0x74, 0x74, + 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x0b, 0x0a, + 0x07, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, + 0x43, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, + 0x22, 0x35, 0x0a, 0x10, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x74, + 0x65, 0x72, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x22, 0xf9, 0x01, 0x0a, 0x11, 0x44, 0x69, 0x73, 0x63, + 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, + 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x37, 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x63, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0a, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x1a, 0x8a, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, + 0x69, 0x63, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x69, 0x63, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x32, 0xdf, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x08, 0x43, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x25, 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x1a, 0x28, + 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, 0x76, + 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x28, 0x01, 0x30, 0x01, 0x12, 0x67, 0x0a, 0x08, + 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x2c, 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, + 0x64, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x73, 0x66, 0x2e, 0x63, 0x6f, 0x64, 0x65, + 0x67, 0x65, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1845,59 +1911,61 @@ func file_sf_codegen_conversation_v1_conversation_proto_rawDescGZIP() []byte { return file_sf_codegen_conversation_v1_conversation_proto_rawDescData } -var file_sf_codegen_conversation_v1_conversation_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_sf_codegen_conversation_v1_conversation_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_sf_codegen_conversation_v1_conversation_proto_msgTypes = make([]protoimpl.MessageInfo, 21) var file_sf_codegen_conversation_v1_conversation_proto_goTypes = []any{ (SystemOutput_ListSelect_SelectType)(0), // 0: sf.codegen.conversation.v1.SystemOutput.ListSelect.SelectType - (*Empty)(nil), // 1: sf.codegen.conversation.v1.Empty - (*UserInput)(nil), // 2: sf.codegen.conversation.v1.UserInput - (*SystemOutput)(nil), // 3: sf.codegen.conversation.v1.SystemOutput - (*DiscoveryRequest)(nil), // 4: sf.codegen.conversation.v1.DiscoveryRequest - (*DiscoveryResponse)(nil), // 5: sf.codegen.conversation.v1.DiscoveryResponse - (*UserInput_TextInput)(nil), // 6: sf.codegen.conversation.v1.UserInput.TextInput - (*UserInput_Start)(nil), // 7: sf.codegen.conversation.v1.UserInput.Start - (*UserInput_Hydrate)(nil), // 8: sf.codegen.conversation.v1.UserInput.Hydrate - (*UserInput_Upload)(nil), // 9: sf.codegen.conversation.v1.UserInput.Upload - (*UserInput_Selection)(nil), // 10: sf.codegen.conversation.v1.UserInput.Selection - (*UserInput_Confirmation)(nil), // 11: sf.codegen.conversation.v1.UserInput.Confirmation - (*UserInput_DownloadedFiles)(nil), // 12: sf.codegen.conversation.v1.UserInput.DownloadedFiles - (*SystemOutput_Message)(nil), // 13: sf.codegen.conversation.v1.SystemOutput.Message - (*SystemOutput_ImageWithText)(nil), // 14: sf.codegen.conversation.v1.SystemOutput.ImageWithText - (*SystemOutput_ListSelect)(nil), // 15: sf.codegen.conversation.v1.SystemOutput.ListSelect - (*SystemOutput_TextInput)(nil), // 16: sf.codegen.conversation.v1.SystemOutput.TextInput - (*SystemOutput_Loading)(nil), // 17: sf.codegen.conversation.v1.SystemOutput.Loading - (*SystemOutput_DownloadFiles)(nil), // 18: sf.codegen.conversation.v1.SystemOutput.DownloadFiles - (*SystemOutput_DownloadFile)(nil), // 19: sf.codegen.conversation.v1.SystemOutput.DownloadFile - (*SystemOutput_Confirm)(nil), // 20: sf.codegen.conversation.v1.SystemOutput.Confirm - (*DiscoveryResponse_Generator)(nil), // 21: sf.codegen.conversation.v1.DiscoveryResponse.Generator + (SystemOutput_Confirm_Button)(0), // 1: sf.codegen.conversation.v1.SystemOutput.Confirm.Button + (*Empty)(nil), // 2: sf.codegen.conversation.v1.Empty + (*UserInput)(nil), // 3: sf.codegen.conversation.v1.UserInput + (*SystemOutput)(nil), // 4: sf.codegen.conversation.v1.SystemOutput + (*DiscoveryRequest)(nil), // 5: sf.codegen.conversation.v1.DiscoveryRequest + (*DiscoveryResponse)(nil), // 6: sf.codegen.conversation.v1.DiscoveryResponse + (*UserInput_TextInput)(nil), // 7: sf.codegen.conversation.v1.UserInput.TextInput + (*UserInput_Start)(nil), // 8: sf.codegen.conversation.v1.UserInput.Start + (*UserInput_Hydrate)(nil), // 9: sf.codegen.conversation.v1.UserInput.Hydrate + (*UserInput_Upload)(nil), // 10: sf.codegen.conversation.v1.UserInput.Upload + (*UserInput_Selection)(nil), // 11: sf.codegen.conversation.v1.UserInput.Selection + (*UserInput_Confirmation)(nil), // 12: sf.codegen.conversation.v1.UserInput.Confirmation + (*UserInput_DownloadedFiles)(nil), // 13: sf.codegen.conversation.v1.UserInput.DownloadedFiles + (*SystemOutput_Message)(nil), // 14: sf.codegen.conversation.v1.SystemOutput.Message + (*SystemOutput_ImageWithText)(nil), // 15: sf.codegen.conversation.v1.SystemOutput.ImageWithText + (*SystemOutput_ListSelect)(nil), // 16: sf.codegen.conversation.v1.SystemOutput.ListSelect + (*SystemOutput_TextInput)(nil), // 17: sf.codegen.conversation.v1.SystemOutput.TextInput + (*SystemOutput_Loading)(nil), // 18: sf.codegen.conversation.v1.SystemOutput.Loading + (*SystemOutput_DownloadFiles)(nil), // 19: sf.codegen.conversation.v1.SystemOutput.DownloadFiles + (*SystemOutput_DownloadFile)(nil), // 20: sf.codegen.conversation.v1.SystemOutput.DownloadFile + (*SystemOutput_Confirm)(nil), // 21: sf.codegen.conversation.v1.SystemOutput.Confirm + (*DiscoveryResponse_Generator)(nil), // 22: sf.codegen.conversation.v1.DiscoveryResponse.Generator } var file_sf_codegen_conversation_v1_conversation_proto_depIdxs = []int32{ - 7, // 0: sf.codegen.conversation.v1.UserInput.start:type_name -> sf.codegen.conversation.v1.UserInput.Start - 6, // 1: sf.codegen.conversation.v1.UserInput.text_input:type_name -> sf.codegen.conversation.v1.UserInput.TextInput - 10, // 2: sf.codegen.conversation.v1.UserInput.selection:type_name -> sf.codegen.conversation.v1.UserInput.Selection - 11, // 3: sf.codegen.conversation.v1.UserInput.confirmation:type_name -> sf.codegen.conversation.v1.UserInput.Confirmation - 9, // 4: sf.codegen.conversation.v1.UserInput.file:type_name -> sf.codegen.conversation.v1.UserInput.Upload - 12, // 5: sf.codegen.conversation.v1.UserInput.downloaded_files:type_name -> sf.codegen.conversation.v1.UserInput.DownloadedFiles - 13, // 6: sf.codegen.conversation.v1.SystemOutput.message:type_name -> sf.codegen.conversation.v1.SystemOutput.Message - 14, // 7: sf.codegen.conversation.v1.SystemOutput.image_with_text:type_name -> sf.codegen.conversation.v1.SystemOutput.ImageWithText - 15, // 8: sf.codegen.conversation.v1.SystemOutput.list_select:type_name -> sf.codegen.conversation.v1.SystemOutput.ListSelect - 16, // 9: sf.codegen.conversation.v1.SystemOutput.text_input:type_name -> sf.codegen.conversation.v1.SystemOutput.TextInput - 20, // 10: sf.codegen.conversation.v1.SystemOutput.confirm:type_name -> sf.codegen.conversation.v1.SystemOutput.Confirm - 17, // 11: sf.codegen.conversation.v1.SystemOutput.loading:type_name -> sf.codegen.conversation.v1.SystemOutput.Loading - 18, // 12: sf.codegen.conversation.v1.SystemOutput.download_files:type_name -> sf.codegen.conversation.v1.SystemOutput.DownloadFiles - 21, // 13: sf.codegen.conversation.v1.DiscoveryResponse.generators:type_name -> sf.codegen.conversation.v1.DiscoveryResponse.Generator - 8, // 14: sf.codegen.conversation.v1.UserInput.Start.hydrate:type_name -> sf.codegen.conversation.v1.UserInput.Hydrate + 8, // 0: sf.codegen.conversation.v1.UserInput.start:type_name -> sf.codegen.conversation.v1.UserInput.Start + 7, // 1: sf.codegen.conversation.v1.UserInput.text_input:type_name -> sf.codegen.conversation.v1.UserInput.TextInput + 11, // 2: sf.codegen.conversation.v1.UserInput.selection:type_name -> sf.codegen.conversation.v1.UserInput.Selection + 12, // 3: sf.codegen.conversation.v1.UserInput.confirmation:type_name -> sf.codegen.conversation.v1.UserInput.Confirmation + 10, // 4: sf.codegen.conversation.v1.UserInput.file:type_name -> sf.codegen.conversation.v1.UserInput.Upload + 13, // 5: sf.codegen.conversation.v1.UserInput.downloaded_files:type_name -> sf.codegen.conversation.v1.UserInput.DownloadedFiles + 14, // 6: sf.codegen.conversation.v1.SystemOutput.message:type_name -> sf.codegen.conversation.v1.SystemOutput.Message + 15, // 7: sf.codegen.conversation.v1.SystemOutput.image_with_text:type_name -> sf.codegen.conversation.v1.SystemOutput.ImageWithText + 16, // 8: sf.codegen.conversation.v1.SystemOutput.list_select:type_name -> sf.codegen.conversation.v1.SystemOutput.ListSelect + 17, // 9: sf.codegen.conversation.v1.SystemOutput.text_input:type_name -> sf.codegen.conversation.v1.SystemOutput.TextInput + 21, // 10: sf.codegen.conversation.v1.SystemOutput.confirm:type_name -> sf.codegen.conversation.v1.SystemOutput.Confirm + 18, // 11: sf.codegen.conversation.v1.SystemOutput.loading:type_name -> sf.codegen.conversation.v1.SystemOutput.Loading + 19, // 12: sf.codegen.conversation.v1.SystemOutput.download_files:type_name -> sf.codegen.conversation.v1.SystemOutput.DownloadFiles + 22, // 13: sf.codegen.conversation.v1.DiscoveryResponse.generators:type_name -> sf.codegen.conversation.v1.DiscoveryResponse.Generator + 9, // 14: sf.codegen.conversation.v1.UserInput.Start.hydrate:type_name -> sf.codegen.conversation.v1.UserInput.Hydrate 0, // 15: sf.codegen.conversation.v1.SystemOutput.ListSelect.select_type:type_name -> sf.codegen.conversation.v1.SystemOutput.ListSelect.SelectType - 19, // 16: sf.codegen.conversation.v1.SystemOutput.DownloadFiles.files:type_name -> sf.codegen.conversation.v1.SystemOutput.DownloadFile - 2, // 17: sf.codegen.conversation.v1.ConversationService.Converse:input_type -> sf.codegen.conversation.v1.UserInput - 4, // 18: sf.codegen.conversation.v1.ConversationService.Discover:input_type -> sf.codegen.conversation.v1.DiscoveryRequest - 3, // 19: sf.codegen.conversation.v1.ConversationService.Converse:output_type -> sf.codegen.conversation.v1.SystemOutput - 5, // 20: sf.codegen.conversation.v1.ConversationService.Discover:output_type -> sf.codegen.conversation.v1.DiscoveryResponse - 19, // [19:21] is the sub-list for method output_type - 17, // [17:19] is the sub-list for method input_type - 17, // [17:17] is the sub-list for extension type_name - 17, // [17:17] is the sub-list for extension extendee - 0, // [0:17] is the sub-list for field type_name + 20, // 16: sf.codegen.conversation.v1.SystemOutput.DownloadFiles.files:type_name -> sf.codegen.conversation.v1.SystemOutput.DownloadFile + 1, // 17: sf.codegen.conversation.v1.SystemOutput.Confirm.default_button:type_name -> sf.codegen.conversation.v1.SystemOutput.Confirm.Button + 3, // 18: sf.codegen.conversation.v1.ConversationService.Converse:input_type -> sf.codegen.conversation.v1.UserInput + 5, // 19: sf.codegen.conversation.v1.ConversationService.Discover:input_type -> sf.codegen.conversation.v1.DiscoveryRequest + 4, // 20: sf.codegen.conversation.v1.ConversationService.Converse:output_type -> sf.codegen.conversation.v1.SystemOutput + 6, // 21: sf.codegen.conversation.v1.ConversationService.Discover:output_type -> sf.codegen.conversation.v1.DiscoveryResponse + 20, // [20:22] is the sub-list for method output_type + 18, // [18:20] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name } func init() { file_sf_codegen_conversation_v1_conversation_proto_init() } @@ -2181,7 +2249,7 @@ func file_sf_codegen_conversation_v1_conversation_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_sf_codegen_conversation_v1_conversation_proto_rawDesc, - NumEnums: 1, + NumEnums: 2, NumMessages: 21, NumExtensions: 0, NumServices: 1, diff --git a/proto/sf/codegen/conversation/v1/conversation.proto b/proto/sf/codegen/conversation/v1/conversation.proto index 01081a1..9413ea3 100644 --- a/proto/sf/codegen/conversation/v1/conversation.proto +++ b/proto/sf/codegen/conversation/v1/conversation.proto @@ -131,6 +131,12 @@ message SystemOutput { string description = 4; string accept_button_label = 2; string decline_button_label = 3; + Button default_button = 5; + enum Button { + UNSET = 0; + CONFIRM = 1; + DECLINE = 2; + } } }