nominal_api/proto/
nominal.conversations.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct CreateConversationRequest {
4    #[prost(string, tag = "1")]
5    pub workspace_rid: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub workbook_rid: ::prost::alloc::string::String,
8    #[prost(message, optional, tag = "3")]
9    pub message: ::core::option::Option<ModelMessage>,
10    #[prost(string, optional, tag = "4")]
11    pub title: ::core::option::Option<::prost::alloc::string::String>,
12}
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct CreateConversationResponse {
15    #[prost(string, tag = "1")]
16    pub conversation_rid: ::prost::alloc::string::String,
17}
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct ListConversationsRequest {
20    #[prost(string, tag = "1")]
21    pub workbook_rid: ::prost::alloc::string::String,
22    /// (default 10)
23    #[prost(int32, optional, tag = "2")]
24    pub limit: ::core::option::Option<i32>,
25    /// (default empty)
26    #[prost(string, optional, tag = "3")]
27    pub cursor: ::core::option::Option<::prost::alloc::string::String>,
28}
29#[derive(Clone, PartialEq, ::prost::Message)]
30pub struct ListConversationsResponse {
31    #[prost(message, repeated, tag = "1")]
32    pub conversations: ::prost::alloc::vec::Vec<ConversationMetadata>,
33    /// Next cursor for pagination
34    #[prost(string, optional, tag = "2")]
35    pub next_cursor: ::core::option::Option<::prost::alloc::string::String>,
36}
37#[derive(Clone, PartialEq, ::prost::Message)]
38pub struct GetConversationRequest {
39    #[prost(string, tag = "1")]
40    pub conversation_rid: ::prost::alloc::string::String,
41}
42#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct GetConversationResponse {
44    #[prost(message, optional, tag = "1")]
45    pub conversation: ::core::option::Option<Conversation>,
46}
47#[derive(Clone, PartialEq, ::prost::Message)]
48pub struct AddMessageRequest {
49    #[prost(string, tag = "1")]
50    pub conversation_rid: ::prost::alloc::string::String,
51    #[prost(message, optional, tag = "2")]
52    pub message: ::core::option::Option<ModelMessage>,
53}
54#[derive(Clone, PartialEq, ::prost::Message)]
55pub struct AddMessageResponse {
56    /// Confirmation of the message being added
57    #[prost(string, tag = "1")]
58    pub message_id: ::prost::alloc::string::String,
59}
60#[derive(Clone, PartialEq, ::prost::Message)]
61pub struct SetConversationTitleRequest {
62    #[prost(string, tag = "1")]
63    pub conversation_rid: ::prost::alloc::string::String,
64    #[prost(string, tag = "2")]
65    pub title: ::prost::alloc::string::String,
66}
67/// Empty response
68#[derive(Clone, Copy, PartialEq, ::prost::Message)]
69pub struct SetConversationTitleResponse {}
70#[derive(Clone, PartialEq, ::prost::Message)]
71pub struct ConversationMetadata {
72    /// Conversation rid
73    #[prost(string, tag = "1")]
74    pub rid: ::prost::alloc::string::String,
75    #[prost(string, tag = "2")]
76    pub workbook_rid: ::prost::alloc::string::String,
77    /// LLM-generated or user-set title
78    #[prost(string, tag = "3")]
79    pub title: ::prost::alloc::string::String,
80    /// Creation timestamp
81    #[prost(message, optional, tag = "4")]
82    pub created_at: ::core::option::Option<
83        super::super::super::google::protobuf::Timestamp,
84    >,
85    /// Last updated timestamp
86    #[prost(message, optional, tag = "5")]
87    pub updated_at: ::core::option::Option<
88        super::super::super::google::protobuf::Timestamp,
89    >,
90}
91/// ModelMessage is a discriminated union of user and assistant messages.
92/// Each message type has its own structure and content.
93#[derive(Clone, PartialEq, ::prost::Message)]
94pub struct ModelMessage {
95    /// UUID - allows us to restart or resume a conversation from a given message
96    #[prost(string, tag = "1")]
97    pub id: ::prost::alloc::string::String,
98    /// Timestamp when the message was created
99    #[prost(message, optional, tag = "2")]
100    pub created_at: ::core::option::Option<
101        super::super::super::google::protobuf::Timestamp,
102    >,
103    #[prost(oneof = "model_message::Kind", tags = "3, 4")]
104    pub kind: ::core::option::Option<model_message::Kind>,
105}
106/// Nested message and enum types in `ModelMessage`.
107pub mod model_message {
108    #[derive(Clone, PartialEq, ::prost::Oneof)]
109    pub enum Kind {
110        #[prost(message, tag = "3")]
111        User(super::UserModelMessage),
112        #[prost(message, tag = "4")]
113        Assistant(super::AssistantModelMessage),
114    }
115}
116#[derive(Clone, PartialEq, ::prost::Message)]
117pub struct Conversation {
118    #[prost(message, optional, tag = "1")]
119    pub metadata: ::core::option::Option<ConversationMetadata>,
120    #[prost(message, repeated, tag = "2")]
121    pub messages: ::prost::alloc::vec::Vec<ModelMessage>,
122}
123/// A user message containing text and optional context
124#[derive(Clone, PartialEq, ::prost::Message)]
125pub struct UserModelMessage {
126    #[prost(message, repeated, tag = "1")]
127    pub parts: ::prost::alloc::vec::Vec<UserContentPart>,
128}
129/// An assistant message containing text and reasoning
130#[derive(Clone, PartialEq, ::prost::Message)]
131pub struct AssistantModelMessage {
132    #[prost(message, repeated, tag = "1")]
133    pub parts: ::prost::alloc::vec::Vec<AssistantContentPart>,
134}
135#[derive(Clone, PartialEq, ::prost::Message)]
136pub struct UserContentPart {
137    #[prost(oneof = "user_content_part::Part", tags = "1, 2")]
138    pub part: ::core::option::Option<user_content_part::Part>,
139}
140/// Nested message and enum types in `UserContentPart`.
141pub mod user_content_part {
142    #[derive(Clone, PartialEq, ::prost::Oneof)]
143    pub enum Part {
144        #[prost(message, tag = "1")]
145        Text(super::TextPart),
146        #[prost(message, tag = "2")]
147        Image(super::ImagePart),
148    }
149}
150/// Content part for assistant messages: can be text or reasoning.
151#[derive(Clone, PartialEq, ::prost::Message)]
152pub struct AssistantContentPart {
153    #[prost(oneof = "assistant_content_part::Part", tags = "1, 2, 3")]
154    pub part: ::core::option::Option<assistant_content_part::Part>,
155}
156/// Nested message and enum types in `AssistantContentPart`.
157pub mod assistant_content_part {
158    #[derive(Clone, PartialEq, ::prost::Oneof)]
159    pub enum Part {
160        #[prost(message, tag = "1")]
161        Text(super::TextPart),
162        #[prost(message, tag = "2")]
163        Reasoning(super::ReasoningPart),
164        #[prost(message, tag = "3")]
165        ToolAction(super::ToolActionPart),
166    }
167}
168/// Text part for user or assistant messages.
169#[derive(Clone, PartialEq, ::prost::Message)]
170pub struct TextPart {
171    #[prost(string, tag = "1")]
172    pub text: ::prost::alloc::string::String,
173}
174/// User-supplied image part.
175#[derive(Clone, PartialEq, ::prost::Message)]
176pub struct ImagePart {
177    #[prost(string, tag = "1")]
178    pub s3_uri: ::prost::alloc::string::String,
179    /// The media type of the image (e.g. "image/png", "image/jpeg")
180    #[prost(string, optional, tag = "2")]
181    pub media_type: ::core::option::Option<::prost::alloc::string::String>,
182}
183/// Reasoning part for assistant messages.
184#[derive(Clone, PartialEq, ::prost::Message)]
185pub struct ReasoningPart {
186    #[prost(string, tag = "1")]
187    pub reasoning: ::prost::alloc::string::String,
188}
189/// Tool action part for assistant messages.
190#[derive(Clone, PartialEq, ::prost::Message)]
191pub struct ToolActionPart {
192    #[prost(string, tag = "1")]
193    pub id: ::prost::alloc::string::String,
194    /// "Thought", "Read", "Find", "Look-up", etc.
195    #[prost(string, tag = "2")]
196    pub tool_action_verb: ::prost::alloc::string::String,
197    /// "workbook", "channel", "variable", "panel", etc.
198    #[prost(string, optional, tag = "3")]
199    pub tool_target: ::core::option::Option<::prost::alloc::string::String>,
200}
201/// Generated client implementations.
202pub mod conversation_service_client {
203    #![allow(
204        unused_variables,
205        dead_code,
206        missing_docs,
207        clippy::wildcard_imports,
208        clippy::let_unit_value,
209    )]
210    use tonic::codegen::*;
211    use tonic::codegen::http::Uri;
212    /// ConversationService provides conversation lifecycle and persistence for AI agents
213    #[derive(Debug, Clone)]
214    pub struct ConversationServiceClient<T> {
215        inner: tonic::client::Grpc<T>,
216    }
217    impl ConversationServiceClient<tonic::transport::Channel> {
218        /// Attempt to create a new client by connecting to a given endpoint.
219        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
220        where
221            D: TryInto<tonic::transport::Endpoint>,
222            D::Error: Into<StdError>,
223        {
224            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
225            Ok(Self::new(conn))
226        }
227    }
228    impl<T> ConversationServiceClient<T>
229    where
230        T: tonic::client::GrpcService<tonic::body::Body>,
231        T::Error: Into<StdError>,
232        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
233        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
234    {
235        pub fn new(inner: T) -> Self {
236            let inner = tonic::client::Grpc::new(inner);
237            Self { inner }
238        }
239        pub fn with_origin(inner: T, origin: Uri) -> Self {
240            let inner = tonic::client::Grpc::with_origin(inner, origin);
241            Self { inner }
242        }
243        pub fn with_interceptor<F>(
244            inner: T,
245            interceptor: F,
246        ) -> ConversationServiceClient<InterceptedService<T, F>>
247        where
248            F: tonic::service::Interceptor,
249            T::ResponseBody: Default,
250            T: tonic::codegen::Service<
251                http::Request<tonic::body::Body>,
252                Response = http::Response<
253                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
254                >,
255            >,
256            <T as tonic::codegen::Service<
257                http::Request<tonic::body::Body>,
258            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
259        {
260            ConversationServiceClient::new(InterceptedService::new(inner, interceptor))
261        }
262        /// Compress requests with the given encoding.
263        ///
264        /// This requires the server to support it otherwise it might respond with an
265        /// error.
266        #[must_use]
267        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
268            self.inner = self.inner.send_compressed(encoding);
269            self
270        }
271        /// Enable decompressing responses.
272        #[must_use]
273        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
274            self.inner = self.inner.accept_compressed(encoding);
275            self
276        }
277        /// Limits the maximum size of a decoded message.
278        ///
279        /// Default: `4MB`
280        #[must_use]
281        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
282            self.inner = self.inner.max_decoding_message_size(limit);
283            self
284        }
285        /// Limits the maximum size of an encoded message.
286        ///
287        /// Default: `usize::MAX`
288        #[must_use]
289        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
290            self.inner = self.inner.max_encoding_message_size(limit);
291            self
292        }
293        /// Create a new conversation for any agent type
294        pub async fn create_conversation(
295            &mut self,
296            request: impl tonic::IntoRequest<super::CreateConversationRequest>,
297        ) -> std::result::Result<
298            tonic::Response<super::CreateConversationResponse>,
299            tonic::Status,
300        > {
301            self.inner
302                .ready()
303                .await
304                .map_err(|e| {
305                    tonic::Status::unknown(
306                        format!("Service was not ready: {}", e.into()),
307                    )
308                })?;
309            let codec = tonic::codec::ProstCodec::default();
310            let path = http::uri::PathAndQuery::from_static(
311                "/nominal.conversations.v1.ConversationService/CreateConversation",
312            );
313            let mut req = request.into_request();
314            req.extensions_mut()
315                .insert(
316                    GrpcMethod::new(
317                        "nominal.conversations.v1.ConversationService",
318                        "CreateConversation",
319                    ),
320                );
321            self.inner.unary(req, path, codec).await
322        }
323        /// List latest conversations for a context in descending order of updated_at timestamp
324        pub async fn list_conversations(
325            &mut self,
326            request: impl tonic::IntoRequest<super::ListConversationsRequest>,
327        ) -> std::result::Result<
328            tonic::Response<super::ListConversationsResponse>,
329            tonic::Status,
330        > {
331            self.inner
332                .ready()
333                .await
334                .map_err(|e| {
335                    tonic::Status::unknown(
336                        format!("Service was not ready: {}", e.into()),
337                    )
338                })?;
339            let codec = tonic::codec::ProstCodec::default();
340            let path = http::uri::PathAndQuery::from_static(
341                "/nominal.conversations.v1.ConversationService/ListConversations",
342            );
343            let mut req = request.into_request();
344            req.extensions_mut()
345                .insert(
346                    GrpcMethod::new(
347                        "nominal.conversations.v1.ConversationService",
348                        "ListConversations",
349                    ),
350                );
351            self.inner.unary(req, path, codec).await
352        }
353        /// Get conversation by rid including full message history
354        pub async fn get_conversation(
355            &mut self,
356            request: impl tonic::IntoRequest<super::GetConversationRequest>,
357        ) -> std::result::Result<
358            tonic::Response<super::GetConversationResponse>,
359            tonic::Status,
360        > {
361            self.inner
362                .ready()
363                .await
364                .map_err(|e| {
365                    tonic::Status::unknown(
366                        format!("Service was not ready: {}", e.into()),
367                    )
368                })?;
369            let codec = tonic::codec::ProstCodec::default();
370            let path = http::uri::PathAndQuery::from_static(
371                "/nominal.conversations.v1.ConversationService/GetConversation",
372            );
373            let mut req = request.into_request();
374            req.extensions_mut()
375                .insert(
376                    GrpcMethod::new(
377                        "nominal.conversations.v1.ConversationService",
378                        "GetConversation",
379                    ),
380                );
381            self.inner.unary(req, path, codec).await
382        }
383        /// Add a message to an existing conversation
384        pub async fn add_message(
385            &mut self,
386            request: impl tonic::IntoRequest<super::AddMessageRequest>,
387        ) -> std::result::Result<
388            tonic::Response<super::AddMessageResponse>,
389            tonic::Status,
390        > {
391            self.inner
392                .ready()
393                .await
394                .map_err(|e| {
395                    tonic::Status::unknown(
396                        format!("Service was not ready: {}", e.into()),
397                    )
398                })?;
399            let codec = tonic::codec::ProstCodec::default();
400            let path = http::uri::PathAndQuery::from_static(
401                "/nominal.conversations.v1.ConversationService/AddMessage",
402            );
403            let mut req = request.into_request();
404            req.extensions_mut()
405                .insert(
406                    GrpcMethod::new(
407                        "nominal.conversations.v1.ConversationService",
408                        "AddMessage",
409                    ),
410                );
411            self.inner.unary(req, path, codec).await
412        }
413        /// Set or update the title of a conversation
414        pub async fn set_conversation_title(
415            &mut self,
416            request: impl tonic::IntoRequest<super::SetConversationTitleRequest>,
417        ) -> std::result::Result<
418            tonic::Response<super::SetConversationTitleResponse>,
419            tonic::Status,
420        > {
421            self.inner
422                .ready()
423                .await
424                .map_err(|e| {
425                    tonic::Status::unknown(
426                        format!("Service was not ready: {}", e.into()),
427                    )
428                })?;
429            let codec = tonic::codec::ProstCodec::default();
430            let path = http::uri::PathAndQuery::from_static(
431                "/nominal.conversations.v1.ConversationService/SetConversationTitle",
432            );
433            let mut req = request.into_request();
434            req.extensions_mut()
435                .insert(
436                    GrpcMethod::new(
437                        "nominal.conversations.v1.ConversationService",
438                        "SetConversationTitle",
439                    ),
440                );
441            self.inner.unary(req, path, codec).await
442        }
443    }
444}