// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClassifyErrorRequest {
    /// The error message or description to classify
    #[prost(string, tag = "1")]
    pub error_message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClassifyErrorResponse {
    /// The classification result
    #[prost(enumeration = "ErrorClassification", tag = "1")]
    pub classification: i32,
    /// Explanation for why this classification was chosen
    #[prost(string, tag = "2")]
    pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ErrorClassification {
    Unspecified = 0,
    Client = 1,
    Server = 2,
}
impl ErrorClassification {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ERROR_CLASSIFICATION_UNSPECIFIED",
            Self::Client => "ERROR_CLASSIFICATION_CLIENT",
            Self::Server => "ERROR_CLASSIFICATION_SERVER",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ERROR_CLASSIFICATION_UNSPECIFIED" => Some(Self::Unspecified),
            "ERROR_CLASSIFICATION_CLIENT" => Some(Self::Client),
            "ERROR_CLASSIFICATION_SERVER" => Some(Self::Server),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod data_ingestion_error_classifier_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// DataIngestionErrorClassifierService classifies data ingestion errors as CLIENT or SERVER issues.
    /// CLIENT errors are customer data issues (empty files, schema conflicts, timestamp problems, etc.)
    /// SERVER errors are infrastructure issues (internal errors, timeouts, capacity limits, etc.)
    #[derive(Debug, Clone)]
    pub struct DataIngestionErrorClassifierServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl DataIngestionErrorClassifierServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> DataIngestionErrorClassifierServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> DataIngestionErrorClassifierServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            DataIngestionErrorClassifierServiceClient::new(
                InterceptedService::new(inner, interceptor),
            )
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// ClassifyError analyzes an error message and classifies it as CLIENT or SERVER.
        pub async fn classify_error(
            &mut self,
            request: impl tonic::IntoRequest<super::ClassifyErrorRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ClassifyErrorResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.DataIngestionErrorClassifierService/ClassifyError",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.DataIngestionErrorClassifierService",
                        "ClassifyError",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetProviderStatusRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetProviderStatusResponse {
    /// Timestamp when the last status was determined
    #[prost(message, optional, tag = "1")]
    pub timestamp: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
    /// Status of the most recent health check probe
    #[prost(message, optional, tag = "2")]
    pub last_status: ::core::option::Option<ProviderStatus>,
    /// Aggregated status over the last 30 minutes (DEGRADED if any check failed or exceeded thresholds)
    /// Deprecated: Use aggregated_status instead. This field is kept for backward compatibility.
    #[deprecated]
    #[prost(message, optional, tag = "3")]
    pub aggregated_status_over_last_30m: ::core::option::Option<ProviderStatus>,
    /// Aggregated status over the last iterations, configurable in the BE (DEGRADED if any check failed or exceeded thresholds)
    #[prost(message, optional, tag = "4")]
    pub aggregated_status: ::core::option::Option<ProviderStatus>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ProviderStatus {
    #[prost(oneof = "provider_status::Status", tags = "1, 2")]
    pub status: ::core::option::Option<provider_status::Status>,
}
/// Nested message and enum types in `ProviderStatus`.
pub mod provider_status {
    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
    pub enum Status {
        #[prost(message, tag = "1")]
        Healthy(super::Healthy),
        #[prost(message, tag = "2")]
        Degraded(super::Degraded),
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Healthy {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Degraded {
    #[prost(enumeration = "DegradationReason", tag = "1")]
    pub reason: i32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ProviderMetrics {
    #[prost(int32, tag = "1")]
    pub time_to_first_token_ms: i32,
    #[prost(int32, tag = "2")]
    pub total_time_ms: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DegradationReason {
    Unspecified = 0,
    HighLatency = 1,
    Failures = 2,
    HighLatencyAndFailures = 3,
}
impl DegradationReason {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "DEGRADATION_REASON_UNSPECIFIED",
            Self::HighLatency => "DEGRADATION_REASON_HIGH_LATENCY",
            Self::Failures => "DEGRADATION_REASON_FAILURES",
            Self::HighLatencyAndFailures => {
                "DEGRADATION_REASON_HIGH_LATENCY_AND_FAILURES"
            }
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "DEGRADATION_REASON_UNSPECIFIED" => Some(Self::Unspecified),
            "DEGRADATION_REASON_HIGH_LATENCY" => Some(Self::HighLatency),
            "DEGRADATION_REASON_FAILURES" => Some(Self::Failures),
            "DEGRADATION_REASON_HIGH_LATENCY_AND_FAILURES" => {
                Some(Self::HighLatencyAndFailures)
            }
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod model_provider_health_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// ModelProviderHealthService monitors the health and performance of the backing LLM model provider.
    /// It runs lightweight health checks every 5 minutes to measure provider responsiveness and reliability,
    /// independent of the complexity of user prompts.
    #[derive(Debug, Clone)]
    pub struct ModelProviderHealthServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl ModelProviderHealthServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> ModelProviderHealthServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> ModelProviderHealthServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            ModelProviderHealthServiceClient::new(
                InterceptedService::new(inner, interceptor),
            )
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// GetProviderStatus returns the current health status of the model provider based on recent health checks.
        /// The status is HEALTHY if all checks in the last 30 minutes passed latency thresholds,
        /// or DEGRADED if any checks exceeded latency thresholds or failed entirely.
        pub async fn get_provider_status(
            &mut self,
            request: impl tonic::IntoRequest<super::GetProviderStatusRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetProviderStatusResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.ModelProviderHealthService/GetProviderStatus",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.ModelProviderHealthService",
                        "GetProviderStatus",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
/// CreateOrUpdateKnowledgeBaseRequest is a request to create a knowledge from an attachment in the attachment's
/// workspace. Subsequent calls for the same attachment will overwrite the existing knowledge base.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateOrUpdateKnowledgeBaseRequest {
    #[prost(string, tag = "1")]
    pub attachment_rid: ::prost::alloc::string::String,
    /// summary of the knowledge base, will be used by the LLM to decide when to use it
    #[prost(string, tag = "2")]
    pub summary_description: ::prost::alloc::string::String,
    #[prost(enumeration = "KnowledgeBaseType", optional, tag = "3")]
    pub r#type: ::core::option::Option<i32>,
}
/// CreateOrUpdateKnowledgeBaseResponse is the response to creating/updating a knowledge base
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateOrUpdateKnowledgeBaseResponse {
    #[prost(string, tag = "1")]
    pub knowledge_base_rid: ::prost::alloc::string::String,
}
/// KnowledgeBase represents a knowledge base entry
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KnowledgeBase {
    #[prost(string, tag = "1")]
    pub knowledge_base_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub attachment_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub workspace_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub summary_description: ::prost::alloc::string::String,
    #[prost(enumeration = "KnowledgeBaseType", tag = "5")]
    pub r#type: i32,
    #[prost(int32, tag = "6")]
    pub version: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListRequest {
    #[prost(string, tag = "1")]
    pub workspace_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListResponse {
    #[prost(message, repeated, tag = "1")]
    pub knowledge_bases: ::prost::alloc::vec::Vec<KnowledgeBase>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteRequest {
    #[prost(string, tag = "1")]
    pub knowledge_base_rid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeleteResponse {
    #[prost(bool, tag = "1")]
    pub success: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBatchRequest {
    #[prost(string, repeated, tag = "1")]
    pub knowledge_base_rids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBatchResponse {
    #[prost(message, repeated, tag = "1")]
    pub knowledge_bases: ::prost::alloc::vec::Vec<KnowledgeBase>,
}
/// generate summary description is intentionally going to return the generated description to the frontend
/// rather than storing it in the knowledge base directly because the description needs to be accepted by the user
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenerateSummaryDescriptionRequest {
    #[prost(string, tag = "1")]
    pub attachment_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenerateSummaryDescriptionResponse {
    #[prost(string, tag = "1")]
    pub summary_description: ::prost::alloc::string::String,
}
/// KnowledgeBaseType defines the types of knowledge base
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum KnowledgeBaseType {
    /// defaults to PROMPT
    Unspecified = 0,
    /// knowledge base gets added directly to prompt (needs to be small enough!)
    Prompt = 1,
    /// knowledge base gets used via vector search on embeddings
    Embedding = 2,
}
impl KnowledgeBaseType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "KNOWLEDGE_BASE_TYPE_UNSPECIFIED",
            Self::Prompt => "KNOWLEDGE_BASE_TYPE_PROMPT",
            Self::Embedding => "KNOWLEDGE_BASE_TYPE_EMBEDDING",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "KNOWLEDGE_BASE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "KNOWLEDGE_BASE_TYPE_PROMPT" => Some(Self::Prompt),
            "KNOWLEDGE_BASE_TYPE_EMBEDDING" => Some(Self::Embedding),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod knowledge_base_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// KnowledgeBaseService provides AI-powered knowledge base management
    #[derive(Debug, Clone)]
    pub struct KnowledgeBaseServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl KnowledgeBaseServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> KnowledgeBaseServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> KnowledgeBaseServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            KnowledgeBaseServiceClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// CreateOrUpdateKnowledgeBase creates a knowledge base in the workspace
        pub async fn create_or_update_knowledge_base(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateOrUpdateKnowledgeBaseRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CreateOrUpdateKnowledgeBaseResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.KnowledgeBaseService/CreateOrUpdateKnowledgeBase",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.KnowledgeBaseService",
                        "CreateOrUpdateKnowledgeBase",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// List returns all knowledge bases in the specified workspace
        pub async fn list(
            &mut self,
            request: impl tonic::IntoRequest<super::ListRequest>,
        ) -> std::result::Result<tonic::Response<super::ListResponse>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.KnowledgeBaseService/List",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("nominal.ai.v1.KnowledgeBaseService", "List"));
            self.inner.unary(req, path, codec).await
        }
        /// Delete removes a knowledge base by its RID
        pub async fn delete(
            &mut self,
            request: impl tonic::IntoRequest<super::DeleteRequest>,
        ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.KnowledgeBaseService/Delete",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("nominal.ai.v1.KnowledgeBaseService", "Delete"));
            self.inner.unary(req, path, codec).await
        }
        /// GetBatch retrieves multiple knowledge bases by their RIDs
        pub async fn get_batch(
            &mut self,
            request: impl tonic::IntoRequest<super::GetBatchRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetBatchResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.KnowledgeBaseService/GetBatch",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("nominal.ai.v1.KnowledgeBaseService", "GetBatch"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// GenerateSummaryDescription generates a summary description for an attachment rid
        pub async fn generate_summary_description(
            &mut self,
            request: impl tonic::IntoRequest<super::GenerateSummaryDescriptionRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GenerateSummaryDescriptionResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.KnowledgeBaseService/GenerateSummaryDescription",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.KnowledgeBaseService",
                        "GenerateSummaryDescription",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSnapshotRidByUserMessageIdRequest {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub message_id: ::prost::alloc::string::String,
}
/// Will return an empty response body in the case where the message id exists, but there is no associated snapshot
/// This occurs in the instance where a message was sent in a non-workbook context
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSnapshotRidByUserMessageIdResponse {
    #[prost(string, optional, tag = "1")]
    pub snapshot_rid: ::core::option::Option<::prost::alloc::string::String>,
}
/// ReadOnlyMode configures read-only mode where edit tools are shadowed/disabled
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ReadOnlyMode {}
/// EditMode configures edit mode where all tools are available
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EditMode {
    /// when set to true, we auto accept edits for any tools typically requiring approval
    #[prost(bool, optional, tag = "1")]
    pub auto_accept: ::core::option::Option<bool>,
}
/// ConversationMode specifies the mode of the conversation
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ConversationMode {
    #[prost(oneof = "conversation_mode::Mode", tags = "1, 2")]
    pub mode: ::core::option::Option<conversation_mode::Mode>,
}
/// Nested message and enum types in `ConversationMode`.
pub mod conversation_mode {
    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
    pub enum Mode {
        #[prost(message, tag = "1")]
        ReadOnly(super::ReadOnlyMode),
        #[prost(message, tag = "2")]
        Edit(super::EditMode),
    }
}
/// When the agent makes a request to use a tool, the user responds
/// with one of these for every request - mapping a tool id to its approval/denial
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolApprovalResult {
    /// identifies the tool call
    #[prost(string, tag = "1")]
    pub tool_call_id: ::prost::alloc::string::String,
    #[prost(oneof = "tool_approval_result::Response", tags = "2, 3")]
    pub response: ::core::option::Option<tool_approval_result::Response>,
}
/// Nested message and enum types in `ToolApprovalResult`.
pub mod tool_approval_result {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Response {
        #[prost(message, tag = "2")]
        Approved(super::ToolApprovedResponse),
        #[prost(message, tag = "3")]
        Denied(super::ToolDeniedResponse),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolApprovedResponse {
    /// json string representation of the override argument if the user
    /// needs it to be changed in some way
    #[prost(string, optional, tag = "1")]
    pub override_args: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolDeniedResponse {
    #[prost(string, tag = "2")]
    pub denial_reason: ::prost::alloc::string::String,
}
/// RetryRequest retries the last request (e.g., if it was interrupted/failed part-way through)
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RetryRequest {}
/// UserPromptRequest contains a new user message
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserPromptRequest {
    #[prost(message, optional, tag = "1")]
    pub message: ::core::option::Option<UserModelMessage>,
    /// Optional: image files to provide to the agent
    #[prost(message, repeated, tag = "2")]
    pub images: ::prost::alloc::vec::Vec<ImagePart>,
}
/// ToolApprovalRequest contains tool approval results
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolApprovalRequest {
    #[prost(message, repeated, tag = "1")]
    pub tool_approvals: ::prost::alloc::vec::Vec<ToolApprovalResult>,
}
/// StreamChatRequest is a request to stream chat messages for AI agent.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamChatRequest {
    /// The conversation ID
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
    /// DEPRECATED: use request_type.user_prompt.message instead
    #[deprecated]
    #[prost(message, optional, tag = "2")]
    pub message: ::core::option::Option<UserModelMessage>,
    /// DEPRECATED: use request_type.user_prompt.images instead
    #[deprecated]
    #[prost(message, repeated, tag = "3")]
    pub images: ::prost::alloc::vec::Vec<ImagePart>,
    /// DEPRECATED: use request_type.tool_approval instead
    #[deprecated]
    #[prost(message, repeated, tag = "6")]
    pub tool_approvals: ::prost::alloc::vec::Vec<ToolApprovalResult>,
    /// The type of request - exactly one should be set
    #[prost(oneof = "stream_chat_request::RequestType", tags = "7, 8, 9")]
    pub request_type: ::core::option::Option<stream_chat_request::RequestType>,
    /// Context-specific fields based on the oneofKind.
    #[prost(oneof = "stream_chat_request::Context", tags = "4, 5, 10")]
    pub context: ::core::option::Option<stream_chat_request::Context>,
}
/// Nested message and enum types in `StreamChatRequest`.
pub mod stream_chat_request {
    /// The type of request - exactly one should be set
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum RequestType {
        #[prost(message, tag = "7")]
        Retry(super::RetryRequest),
        #[prost(message, tag = "8")]
        UserPrompt(super::UserPromptRequest),
        #[prost(message, tag = "9")]
        ToolApproval(super::ToolApprovalRequest),
    }
    /// Context-specific fields based on the oneofKind.
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Context {
        #[prost(message, tag = "4")]
        Workbook(super::WorkbookContext),
        #[prost(message, tag = "5")]
        Global(super::GlobalContext),
        #[prost(message, tag = "10")]
        Checklist(super::ChecklistContext),
    }
}
/// WorkbookContext contains workbook-specific context fields
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkbookContext {
    /// RID of the workbook to use for context
    #[prost(string, tag = "1")]
    pub workbook_rid: ::prost::alloc::string::String,
    /// The user's presence in the workbook
    #[prost(message, optional, tag = "2")]
    pub user_presence: ::core::option::Option<WorkbookUserPresence>,
}
/// ChecklistContext for use when the agent is being messaged in the context of a
/// checklist currently being edited
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChecklistContext {
    /// RID of the checklist being edited
    #[prost(string, tag = "1")]
    pub checklist_rid: ::prost::alloc::string::String,
    /// Name of the branch that this edit is being done on
    /// This is equivalent to the 'draft name' for a check being edited in the UI
    #[prost(string, tag = "2")]
    pub branch_name: ::prost::alloc::string::String,
    /// A checklist opened in edit mode will always have some resource by which it
    /// is referencing for viewing. It can either be an asset or a run
    #[prost(oneof = "checklist_context::ReferenceRid", tags = "3, 4")]
    pub reference_rid: ::core::option::Option<checklist_context::ReferenceRid>,
}
/// Nested message and enum types in `ChecklistContext`.
pub mod checklist_context {
    /// A checklist opened in edit mode will always have some resource by which it
    /// is referencing for viewing. It can either be an asset or a run
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum ReferenceRid {
        #[prost(string, tag = "3")]
        Asset(::prost::alloc::string::String),
        #[prost(string, tag = "4")]
        Run(::prost::alloc::string::String),
    }
}
/// DefaultContext (no context)
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GlobalContext {}
/// WorkbookUserPresence contains the user's presence in the workbook
/// which is used to describe what the user is viewing at the time of the message.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct WorkbookUserPresence {
    #[prost(int32, tag = "1")]
    pub tab_index: i32,
    #[prost(message, optional, tag = "2")]
    pub range: ::core::option::Option<TimeRange>,
}
/// CreateConversation request will create a new conversation thread
/// if old conversation id is not set, a brand new, clear chat is created
/// If old conversation id is set without a previous message id, the full conversation thread will be copied
/// if previous message id is set with a previous message id, the conversation thread up until that message will be copied
/// the above case is useful for branching a conversation into a new thread
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateConversationRequest {
    #[prost(string, tag = "1")]
    pub title: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub workspace_rid: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "3")]
    pub old_conversation_rid: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "4")]
    pub previous_message_id: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(message, optional, tag = "5")]
    pub conversation_mode: ::core::option::Option<ConversationMode>,
}
/// CreateConversationResponse will return the conversation id for the new conversation
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateConversationResponse {
    #[prost(string, tag = "1")]
    pub new_conversation_rid: ::prost::alloc::string::String,
}
/// Updates the fields if specified (optional means no change for that field)
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateConversationMetadataRequest {
    #[prost(string, optional, tag = "1")]
    pub title: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, tag = "2")]
    pub conversation_rid: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub conversation_mode: ::core::option::Option<ConversationMode>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UpdateConversationMetadataResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteConversationRequest {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeleteConversationResponse {}
/// a GetConversationRequest allows you to retrieve a subset of messages from a conversation thread represented
/// by provided rid. To start from a particular message - you can also provide a message id.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationRequest {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "2")]
    pub page_start_message_id: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(int32, optional, tag = "3")]
    pub max_message_count: ::core::option::Option<i32>,
}
/// a CompactConversationRequest allows you to reduce the token count in your conversation by up to half
/// will be a no op if current conversation has not yet reached at least half of the max token count
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactConversationRequest {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
}
/// returns the new token count of the now compacted conversation
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CompactConversationResponse {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<ContextStatus>,
}
/// Model message with id allows you to identify the message ID of a given message
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModelMessageWithId {
    #[prost(string, tag = "3")]
    pub message_id: ::prost::alloc::string::String,
    /// WB agent user messages can have snapshot rids associated with them
    #[prost(string, optional, tag = "4")]
    pub snapshot_rid: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(message, repeated, tag = "5")]
    pub tool_approval_requests: ::prost::alloc::vec::Vec<ToolCallDescription>,
    #[prost(oneof = "model_message_with_id::Content", tags = "1, 2, 6")]
    pub content: ::core::option::Option<model_message_with_id::Content>,
}
/// Nested message and enum types in `ModelMessageWithId`.
pub mod model_message_with_id {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Content {
        #[prost(message, tag = "1")]
        Message(super::ModelMessage),
        #[prost(message, tag = "2")]
        ToolAction(super::ToolAction),
        #[prost(message, tag = "6")]
        ToolActionConfirmation(super::ToolActionConfirmation),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationResponse {
    #[prost(message, repeated, tag = "1")]
    pub ordered_messages: ::prost::alloc::vec::Vec<ModelMessageWithId>,
    #[prost(message, optional, tag = "2")]
    pub conversation_metadata: ::core::option::Option<ConversationMetadata>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationMetadataRequest {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationMetadataResponse {
    #[prost(message, optional, tag = "1")]
    pub conversation_metadata: ::core::option::Option<ConversationMetadata>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationMessagesRequest {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "2")]
    pub page_start_message_id: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(int32, optional, tag = "3")]
    pub max_message_count: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationMessagesResponse {
    #[prost(message, repeated, tag = "1")]
    pub ordered_messages: ::prost::alloc::vec::Vec<ModelMessageWithId>,
    #[prost(string, optional, tag = "2")]
    pub next_page_token: ::core::option::Option<::prost::alloc::string::String>,
}
/// Will generate all conversation threads that this user has in this workspace
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListConversationsRequest {
    #[prost(string, tag = "1")]
    pub workspace_rid: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "2")]
    pub next_page_token: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(int32, optional, tag = "3")]
    pub page_size: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConversationMetadata {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub title: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub created_at: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
    #[prost(message, optional, tag = "4")]
    pub last_updated_at: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
    #[prost(message, optional, tag = "5")]
    pub mode: ::core::option::Option<ConversationMode>,
    #[prost(message, optional, tag = "6")]
    pub current_context: ::core::option::Option<ContextStatus>,
}
/// ListConversationsResponse is a list of conversations that can be used in a call to GetConversationRequest
/// to get a full conversation from storage. These are ordered by creation time.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListConversationsResponse {
    #[prost(message, repeated, tag = "1")]
    pub conversations: ::prost::alloc::vec::Vec<ConversationMetadata>,
    #[prost(string, optional, tag = "2")]
    pub next_page_token: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TimeRange {
    #[prost(message, optional, tag = "1")]
    pub range_start: ::core::option::Option<Timestamp>,
    #[prost(message, optional, tag = "2")]
    pub range_end: ::core::option::Option<Timestamp>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Timestamp {
    #[prost(int32, tag = "1")]
    pub seconds: i32,
    #[prost(int32, tag = "2")]
    pub nanoseconds: i32,
}
/// ModelMessage is a discriminated union of system, user, assistant, and tool messages.
/// Each message type has its own structure and content.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModelMessage {
    #[prost(oneof = "model_message::Kind", tags = "1, 2")]
    pub kind: ::core::option::Option<model_message::Kind>,
}
/// Nested message and enum types in `ModelMessage`.
pub mod model_message {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        #[prost(message, tag = "1")]
        User(super::UserModelMessage),
        #[prost(message, tag = "2")]
        Assistant(super::AssistantModelMessage),
    }
}
/// A user message containing text
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserModelMessage {
    #[prost(message, repeated, tag = "1")]
    pub text: ::prost::alloc::vec::Vec<UserContentPart>,
}
/// An assistant message containing text
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AssistantModelMessage {
    #[prost(message, repeated, tag = "1")]
    pub content_parts: ::prost::alloc::vec::Vec<AssistantContentPart>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserContentPart {
    #[prost(oneof = "user_content_part::Part", tags = "1")]
    pub part: ::core::option::Option<user_content_part::Part>,
}
/// Nested message and enum types in `UserContentPart`.
pub mod user_content_part {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Part {
        #[prost(message, tag = "1")]
        Text(super::TextPart),
    }
}
/// Content part for assistant messages: can be text, reasoning, or mutation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AssistantContentPart {
    #[prost(oneof = "assistant_content_part::Part", tags = "1, 2")]
    pub part: ::core::option::Option<assistant_content_part::Part>,
}
/// Nested message and enum types in `AssistantContentPart`.
pub mod assistant_content_part {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Part {
        #[prost(message, tag = "1")]
        Text(super::TextPart),
        #[prost(message, tag = "2")]
        Reasoning(super::ReasoningPart),
    }
}
/// Text part for user or assistant messages.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextPart {
    #[prost(string, tag = "1")]
    pub text: ::prost::alloc::string::String,
}
/// User-supplied image part.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImagePart {
    /// The base64-encoded image data
    #[prost(bytes = "vec", tag = "1")]
    pub data: ::prost::alloc::vec::Vec<u8>,
    /// The media type of the image (e.g. "image/png", "image/jpeg")
    #[prost(string, optional, tag = "2")]
    pub media_type: ::core::option::Option<::prost::alloc::string::String>,
    /// Optional: the filename of the image
    #[prost(string, optional, tag = "3")]
    pub filename: ::core::option::Option<::prost::alloc::string::String>,
}
/// Reasoning part for assistant messages.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningPart {
    #[prost(string, tag = "1")]
    pub reasoning: ::prost::alloc::string::String,
}
/// StreamChatResponse is a discriminated union response to a StreamChatRequest
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamChatResponse {
    #[prost(
        oneof = "stream_chat_response::Response",
        tags = "1, 2, 3, 4, 5, 6, 7, 8, 10, 11"
    )]
    pub response: ::core::option::Option<stream_chat_response::Response>,
}
/// Nested message and enum types in `StreamChatResponse`.
pub mod stream_chat_response {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Response {
        #[prost(message, tag = "1")]
        Finish(super::Finish),
        #[prost(message, tag = "2")]
        Error(super::Error),
        #[prost(message, tag = "3")]
        TextStart(super::TextStart),
        #[prost(message, tag = "4")]
        TextDelta(super::TextDelta),
        #[prost(message, tag = "5")]
        TextEnd(super::TextEnd),
        #[prost(message, tag = "6")]
        ReasoningStart(super::ReasoningStart),
        #[prost(message, tag = "7")]
        ReasoningDelta(super::ReasoningDelta),
        #[prost(message, tag = "8")]
        ReasoningEnd(super::ReasoningEnd),
        #[prost(message, tag = "10")]
        ToolAction(super::ToolAction),
        #[prost(message, tag = "11")]
        ToolActionConfirmation(super::ToolActionConfirmation),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolCallDescription {
    #[prost(string, tag = "1")]
    pub tool_call_id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub tool_name: ::prost::alloc::string::String,
    /// string representation of the proposed tool args for display
    #[prost(string, tag = "3")]
    pub tool_args_json_string: ::prost::alloc::string::String,
    /// used to conditionally render an approval button based the outcome of the tool call
    #[prost(enumeration = "ToolCallStatus", tag = "4")]
    pub status: i32,
}
/// Indicates the end of a chat session
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Finish {
    /// The message ids in order of all generated messages for this agent run
    /// These ids can be used to branch a message from that specific message
    #[prost(string, repeated, tag = "1")]
    pub ordered_message_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// In the case that this is the first agent run in a conversation thread, we also
    /// return the new conversation title generated
    #[prost(string, optional, tag = "2")]
    pub new_title: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(message, repeated, tag = "3")]
    pub tool_approval_requests: ::prost::alloc::vec::Vec<ToolCallDescription>,
    #[prost(message, optional, tag = "4")]
    pub updated_context: ::core::option::Option<ContextStatus>,
}
/// An error that occurred during the chat session
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Error {
    #[prost(string, tag = "1")]
    pub message: ::prost::alloc::string::String,
}
/// Indicates the start of a text message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextStart {
    /// uniquely identifies the text message (e.g. uuid) so that the client can
    /// merge parallel message streams (if it happens).
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
/// A delta (continuation) of a text message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextDelta {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// The next chunk of text
    #[prost(string, tag = "2")]
    pub delta: ::prost::alloc::string::String,
}
/// Indicates the end of a text message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextEnd {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
/// Indicates the start of a reasoning message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningStart {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
/// A delta (continuation) of a reasoning message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningDelta {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// The next chunk of reasoning
    #[prost(string, tag = "2")]
    pub delta: ::prost::alloc::string::String,
}
/// Indicates the end of a reasoning message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningEnd {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
/// this is a concise description of a tool call that the agent is making internally
/// without revealing too much detail about the tool call, it informs the user what the agent is doing
/// at a high level. the format is: `{tool_action_verb} {tool_target}` for example:
/// "Search channels for My Datasource"
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolAction {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// "Thought", "Read", "Find", "Look-up", etc.
    #[prost(string, tag = "2")]
    pub tool_action_verb: ::prost::alloc::string::String,
    /// "workbook", "channel", "variable", "panel", etc.
    #[prost(string, optional, tag = "3")]
    pub tool_target: ::core::option::Option<::prost::alloc::string::String>,
}
/// When we see a ToolAction in the stream, we wait for the corresponding ToolActionConfirmation
/// to indicate whether or not the tool call has successfully executed
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolActionConfirmation {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(oneof = "tool_action_confirmation::Outcome", tags = "2, 3")]
    pub outcome: ::core::option::Option<tool_action_confirmation::Outcome>,
}
/// Nested message and enum types in `ToolActionConfirmation`.
pub mod tool_action_confirmation {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Outcome {
        #[prost(message, tag = "2")]
        Success(super::ToolActionSuccess),
        #[prost(message, tag = "3")]
        Failure(super::ToolActionFailure),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolActionSuccess {
    #[prost(string, tag = "1")]
    pub tool_success_message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolActionFailure {
    #[prost(string, tag = "1")]
    pub tool_error_message: ::prost::alloc::string::String,
}
/// ContextStatus represents the current token usage of a conversation relative to the selected model's context limit.
/// NOTE: A curr_token_count of zero means the token count is not yet known (e.g., no prompt has been sent yet,
/// or the conversation was just branched). It does not necessarily mean the conversation is empty.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ContextStatus {
    #[prost(int32, tag = "1")]
    pub curr_token_count: i32,
    #[prost(int32, tag = "2")]
    pub model_context_limit: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ToolCallStatus {
    Unspecified = 0,
    Approved = 1,
    Denied = 2,
    AwaitingApproval = 3,
}
impl ToolCallStatus {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "TOOL_CALL_STATUS_UNSPECIFIED",
            Self::Approved => "TOOL_CALL_STATUS_APPROVED",
            Self::Denied => "TOOL_CALL_STATUS_DENIED",
            Self::AwaitingApproval => "TOOL_CALL_STATUS_AWAITING_APPROVAL",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TOOL_CALL_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
            "TOOL_CALL_STATUS_APPROVED" => Some(Self::Approved),
            "TOOL_CALL_STATUS_DENIED" => Some(Self::Denied),
            "TOOL_CALL_STATUS_AWAITING_APPROVAL" => Some(Self::AwaitingApproval),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod ai_agent_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// AIAgentService provides AI-powered assistance for general operations
    #[derive(Debug, Clone)]
    pub struct AiAgentServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl AiAgentServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> AiAgentServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> AiAgentServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            AiAgentServiceClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// StreamChat handles bidirectional streaming chat for AI agent
        pub async fn stream_chat(
            &mut self,
            request: impl tonic::IntoRequest<super::StreamChatRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::StreamChatResponse>>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/StreamChat",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("nominal.ai.v1.AIAgentService", "StreamChat"));
            self.inner.server_streaming(req, path, codec).await
        }
        /// GetConversation [DEPRACATED] handles getting a complete conversation list, with an optional limit on number of messages returned
        #[deprecated]
        pub async fn get_conversation(
            &mut self,
            request: impl tonic::IntoRequest<super::GetConversationRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetConversationResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/GetConversation",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("nominal.ai.v1.AIAgentService", "GetConversation"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// GetConversationMetadata handles getting the conversation metadata like title, current token count etc
        pub async fn get_conversation_metadata(
            &mut self,
            request: impl tonic::IntoRequest<super::GetConversationMetadataRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetConversationMetadataResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/GetConversationMetadata",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.AIAgentService",
                        "GetConversationMetadata",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// GetConversationMessages handles retrieving the set of conversation messages. Supports pagination
        pub async fn get_conversation_messages(
            &mut self,
            request: impl tonic::IntoRequest<super::GetConversationMessagesRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetConversationMessagesResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/GetConversationMessages",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.AIAgentService",
                        "GetConversationMessages",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// ListConversations handles getting the list of conversation ids ordered by most recently updated
        pub async fn list_conversations(
            &mut self,
            request: impl tonic::IntoRequest<super::ListConversationsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListConversationsResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/ListConversations",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("nominal.ai.v1.AIAgentService", "ListConversations"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// CreateConversation handles creating a conversation and assigning it a conversation rid
        pub async fn create_conversation(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateConversationRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CreateConversationResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/CreateConversation",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("nominal.ai.v1.AIAgentService", "CreateConversation"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// UpdateConversationMetadata handles updating any metadata associated with a conversation
        pub async fn update_conversation_metadata(
            &mut self,
            request: impl tonic::IntoRequest<super::UpdateConversationMetadataRequest>,
        ) -> std::result::Result<
            tonic::Response<super::UpdateConversationMetadataResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/UpdateConversationMetadata",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.AIAgentService",
                        "UpdateConversationMetadata",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// DeleteConversation handles deleting a specific conversation by conversation rid
        pub async fn delete_conversation(
            &mut self,
            request: impl tonic::IntoRequest<super::DeleteConversationRequest>,
        ) -> std::result::Result<
            tonic::Response<super::DeleteConversationResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/DeleteConversation",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("nominal.ai.v1.AIAgentService", "DeleteConversation"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// GetSnapshotRidByUserMessageId handles resolving the snapshot rid of the workbook at the time the message is sent
        pub async fn get_snapshot_rid_by_user_message_id(
            &mut self,
            request: impl tonic::IntoRequest<super::GetSnapshotRidByUserMessageIdRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetSnapshotRidByUserMessageIdResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/GetSnapshotRidByUserMessageId",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.AIAgentService",
                        "GetSnapshotRidByUserMessageId",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// CompactConversation handles compacting the conversation context into approximately half its original size
        pub async fn compact_conversation(
            &mut self,
            request: impl tonic::IntoRequest<super::CompactConversationRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CompactConversationResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.AIAgentService/CompactConversation",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.AIAgentService",
                        "CompactConversation",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
